Skip to content

Commit

Permalink
chore(package): update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Dec 30, 2019
1 parent 3eac2ff commit c58d691
Show file tree
Hide file tree
Showing 8 changed files with 8,496 additions and 73 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ build
dist
yarn.lock
shrinkwrap.yaml
package-lock.json
8,468 changes: 8,468 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,32 @@
},
"homepage": "https://github.com/adonisjs/adonis-lucid#readme",
"dependencies": {
"@adonisjs/application": "^1.3.0",
"@adonisjs/logger": "^1.1.6",
"@adonisjs/application": "^1.3.2",
"@adonisjs/logger": "^1.1.7",
"@adonisjs/profiler": "^1.2.4",
"@poppinss/traits": "^1.0.0",
"@poppinss/utils": "^2.1.0",
"@poppinss/traits": "^1.0.1",
"@poppinss/utils": "^2.1.1",
"camelcase": "^5.3.1",
"columnify": "^1.5.4",
"knex": "^0.20.4",
"knex": "^0.20.6",
"knex-dynamic-connection": "^1.0.3",
"log-update": "^3.3.0",
"macroable": "^3.0.0",
"macroable": "^4.0.1",
"pluralize": "^8.0.0",
"snake-case": "^3.0.2",
"snake-case": "^3.0.3",
"ts-essentials": "^4.0.0"
},
"peerDependencies": {
"@adonisjs/core": "2.x.x"
},
"devDependencies": {
"@adonisjs/ace": "^6.7.4",
"@adonisjs/ace": "^6.7.5",
"@adonisjs/fold": "^6.2.3",
"@adonisjs/mrm-preset": "^2.2.2",
"@adonisjs/sink": "^2.4.0",
"@poppinss/dev-utils": "^1.0.2",
"@adonisjs/mrm-preset": "^2.2.3",
"@adonisjs/sink": "^2.4.2",
"@poppinss/dev-utils": "^1.0.3",
"@types/dotenv": "^8.2.0",
"@types/node": "^12.12.17",
"@types/node": "^13.1.1",
"@types/pluralize": "0.0.29",
"clone": "^2.1.2",
"commitizen": "^4.0.3",
Expand All @@ -73,18 +73,18 @@
"del-cli": "^3.0.0",
"doctoc": "^1.4.0",
"dotenv": "^8.2.0",
"eslint": "^6.7.2",
"eslint-plugin-adonis": "^1.0.2",
"eslint": "^6.8.0",
"eslint-plugin-adonis": "^1.0.5",
"husky": "^3.1.0",
"japa": "^3.0.1",
"mrm": "^2.0.1",
"mrm": "^2.0.2",
"mysql": "^2.17.1",
"np": "^5.2.1",
"pg": "^7.14.0",
"pg": "^7.17.0",
"reflect-metadata": "^0.1.13",
"sqlite3": "^4.1.1",
"ts-node": "^8.5.4",
"typescript": "^3.7.3"
"typescript": "^3.7.4"
},
"publishConfig": {
"tag": "next",
Expand Down
4 changes: 2 additions & 2 deletions src/Database/QueryBuilder/Database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export class DatabaseQueryBuilder extends Chainable implements DatabaseQueryBuil
/**
* Required by macroable
*/
protected static _macros = {}
protected static _getters = {}
protected static macros = {}
protected static getters = {}

/**
* Ensures that we are not executing `update` or `del` when using read only
Expand Down
4 changes: 2 additions & 2 deletions src/Database/QueryBuilder/Insert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class InsertQueryBuilder extends Macroable implements InsertQueryBuilderC
/**
* Required by macroable
*/
protected static _macros = {}
protected static _getters = {}
protected static macros = {}
protected static getters = {}

/**
* Returns the client to be used for the query. Even though the insert query
Expand Down
4 changes: 2 additions & 2 deletions src/Orm/QueryBuilder/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export class ModelQueryBuilder extends Chainable implements ModelQueryBuilderCon
/**
* Required by macroable
*/
protected static _macros = {}
protected static _getters = {}
protected static macros = {}
protected static getters = {}

/**
* Options that must be passed to all new model instances
Expand Down
9 changes: 5 additions & 4 deletions src/Orm/Relations/HasMany/QueryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ ModelConstructorContract
* Saving many of the related instances by wrapping all of them
* inside a transaction
*/
Promise.all(related.map((row) => {
await Promise.all(related.map((row) => {
row[this.$relation.$foreignKey] = foreignKeyValue
row.$trx = trx
return row.save()
Expand Down Expand Up @@ -136,9 +136,10 @@ ModelConstructorContract
this.ensureSingleParent(this.parent)
await this.parent.save()

return this.$relation.$relatedModel().createMany(Object.assign({
[this.$relation.$foreignKey]: this.getForeignKeyValue(this.parent, 'createMany'),
}, values), this.$clientOptions)
const foreignKeyValue = this.getForeignKeyValue(this.parent, 'saveMany')
return this.$relation.$relatedModel().createMany(values.map((value) => {
return Object.assign({ [this.$relation.$foreignKey]: foreignKeyValue }, value)
}), this.$clientOptions)
}

/**
Expand Down
45 changes: 0 additions & 45 deletions test/orm/model-has-one.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1166,51 +1166,6 @@ test.group('Model | HasOne | persist', (group) => {
assert.equal(user.id, profile.userId)
})

test('use parent model transaction when defined', async (assert) => {
class Profile extends BaseModel {
@column({ primary: true })
public id: number

@column()
public userId: number

@column()
public displayName: string
}

class User extends BaseModel {
@column({ primary: true })
public id: number

@column()
public username: string

@hasOne(() => Profile)
public profile: HasOne<Profile>
}

const trx = await db.transaction()

const user = new User()
user.username = 'virk'
user.$trx = trx
await user.save()

const profile = new Profile()
profile.displayName = 'virk'

await user.related('profile').save(profile)
await trx.rollback()

const totalUsers = await db.query().from('users').count('*', 'total')
const totalProfiles = await db.query().from('profiles').count('*', 'total')

assert.equal(totalUsers[0].total, 0)
assert.equal(totalProfiles[0].total, 0)
assert.isUndefined(user.$trx)
assert.isUndefined(profile.$trx)
})

test('create related instance', async (assert) => {
class Profile extends BaseModel {
@column({ primary: true })
Expand Down

0 comments on commit c58d691

Please sign in to comment.