objection 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +2 -2
  2. package/lib/model/AjvValidator.js +19 -7
  3. package/lib/model/Model.js +1 -1
  4. package/lib/model/graph/ModelGraphBuilder.js +2 -2
  5. package/lib/model/inheritModel.js +1 -1
  6. package/lib/model/modelQueryProps.js +1 -1
  7. package/lib/model/modelSet.js +1 -1
  8. package/lib/model/modelTableMetadata.js +1 -1
  9. package/lib/queryBuilder/QueryBuilder.js +9 -9
  10. package/lib/queryBuilder/QueryBuilderBase.js +16 -16
  11. package/lib/queryBuilder/QueryBuilderOperationSupport.js +3 -3
  12. package/lib/queryBuilder/graph/GraphNodeDbExistence.js +1 -1
  13. package/lib/queryBuilder/graph/GraphOptions.js +1 -1
  14. package/lib/queryBuilder/graph/GraphUpsert.js +5 -5
  15. package/lib/queryBuilder/graph/delete/GraphDelete.js +1 -1
  16. package/lib/queryBuilder/graph/insert/GraphInsert.js +1 -1
  17. package/lib/queryBuilder/graph/insert/GraphInsertAction.js +1 -1
  18. package/lib/queryBuilder/graph/insert/JoinRowGraphInsertAction.js +3 -3
  19. package/lib/queryBuilder/graph/patch/GraphPatch.js +1 -1
  20. package/lib/queryBuilder/graph/patch/GraphPatchAction.js +1 -1
  21. package/lib/queryBuilder/graph/recursiveUpsert/GraphRecursiveUpsertAction.js +2 -2
  22. package/lib/queryBuilder/join/JoinResultParser.js +1 -1
  23. package/lib/queryBuilder/join/RelationJoiner.js +7 -7
  24. package/lib/queryBuilder/operations/FromOperation.js +1 -1
  25. package/lib/queryBuilder/operations/ObjectionToKnexConvertingOperation.js +3 -3
  26. package/lib/queryBuilder/operations/UpdateOperation.js +1 -1
  27. package/lib/queryBuilder/operations/UpsertGraphOperation.js +2 -2
  28. package/lib/queryBuilder/operations/eager/WhereInEagerOperation.js +3 -3
  29. package/lib/queryBuilder/operations/jsonApi/WhereJsonHasPostgresOperation.js +1 -1
  30. package/lib/queryBuilder/operations/jsonApi/WhereJsonNotObjectPostgresOperation.js +1 -1
  31. package/lib/queryBuilder/operations/jsonApi/WhereJsonPostgresOperation.js +1 -1
  32. package/lib/queryBuilder/operations/jsonApi/postgresJsonApi.js +3 -3
  33. package/lib/queryBuilder/operations/whereInComposite/WhereInCompositeMsSqlOperation.js +5 -5
  34. package/lib/queryBuilder/parsers/jsonFieldExpressionParser.js +3 -3
  35. package/lib/queryBuilder/parsers/relationExpressionParser.js +5 -5
  36. package/lib/relations/Relation.js +6 -6
  37. package/lib/relations/RelationOwner.js +1 -1
  38. package/lib/relations/belongsToOne/BelongsToOneUnrelateOperation.js +1 -1
  39. package/lib/relations/hasMany/HasManyInsertOperation.js +1 -1
  40. package/lib/relations/hasMany/HasManyRelateOperation.js +1 -1
  41. package/lib/relations/manyToMany/ManyToManyRelation.js +5 -5
  42. package/lib/relations/manyToMany/delete/ManyToManyDeleteSqliteOperation.js +1 -1
  43. package/lib/relations/manyToMany/relate/ManyToManyRelateOperation.js +3 -3
  44. package/lib/relations/manyToMany/unrelate/ManyToManyUnrelateSqliteOperation.js +1 -1
  45. package/lib/relations/manyToMany/update/ManyToManyUpdateOperationBase.js +1 -1
  46. package/lib/relations/manyToMany/update/ManyToManyUpdateSqliteOperation.js +1 -1
  47. package/lib/transaction.js +7 -7
  48. package/lib/utils/assert.js +1 -1
  49. package/lib/utils/clone.js +2 -2
  50. package/lib/utils/identifierMapping.js +1 -1
  51. package/lib/utils/normalizeIds.js +1 -1
  52. package/lib/utils/resolveModel.js +2 -2
  53. package/package.json +4 -4
  54. package/typings/objection/index.d.ts +62 -62
@@ -10,7 +10,7 @@ class UpsertGraphOperation extends QueryBuilderOperation {
10
10
  name,
11
11
  Object.assign({}, opt, {
12
12
  upsertOptions: {},
13
- })
13
+ }),
14
14
  );
15
15
 
16
16
  this.upsertOptions = opt.upsertOptions || {};
@@ -43,7 +43,7 @@ class UpsertGraphOperation extends QueryBuilderOperation {
43
43
  onAfter1(builder) {
44
44
  if (hasOtherSqlModifyingQueryBuilderCalls(builder)) {
45
45
  throw new Error(
46
- 'upsertGraph query should contain no other query builder calls like `findById`, `where` or `$relatedQuery` that would affect the SQL. They have no effect.'
46
+ 'upsertGraph query should contain no other query builder calls like `findById`, `where` or `$relatedQuery` that would affect the SQL. They have no effect.',
47
47
  );
48
48
  }
49
49
 
@@ -41,7 +41,7 @@ class WhereInEagerOperation extends EagerOperation {
41
41
  onBuild(builder) {
42
42
  const relationsToFetch = findRelationsToFetch(
43
43
  builder.modelClass(),
44
- this.buildFinalExpression()
44
+ this.buildFinalExpression(),
45
45
  );
46
46
 
47
47
  const { selectionsToAdd, selectedProps } = findRelationPropsToSelect(builder, relationsToFetch);
@@ -71,7 +71,7 @@ class WhereInEagerOperation extends EagerOperation {
71
71
  await promiseUtils.map(
72
72
  this.relationsToFetch,
73
73
  (it) => this.fetchRelation(builder, models, it.relation, it.childExpression),
74
- { concurrency: modelClass.getConcurrency(builder.unsafeKnex()) }
74
+ { concurrency: modelClass.getConcurrency(builder.unsafeKnex()) },
75
75
  );
76
76
 
77
77
  const intOpt = builder.internalOptions();
@@ -103,7 +103,7 @@ class WhereInEagerOperation extends EagerOperation {
103
103
  (batch) => this.fetchRelationBatch(builder, batch, relation, expr),
104
104
  {
105
105
  concurrency: modelClass.getConcurrency(builder.unsafeKnex()),
106
- }
106
+ },
107
107
  );
108
108
 
109
109
  return flatten(result);
@@ -11,7 +11,7 @@ class WhereJsonHasPostgresOperation extends ObjectionToKnexConvertingOperation {
11
11
  builder.knex(),
12
12
  args[0],
13
13
  this.opt.operator,
14
- args[1]
14
+ args[1],
15
15
  );
16
16
 
17
17
  if (this.opt.bool === 'or') {
@@ -15,7 +15,7 @@ class WhereJsonNotObjectPostgresOperation extends ObjectionToKnexConvertingOpera
15
15
  fieldExpression,
16
16
  '@>',
17
17
  this.opt.compareValue,
18
- 'not'
18
+ 'not',
19
19
  );
20
20
 
21
21
  builder.orWhereRaw(jsonApi.whereJsonFieldQuery(knex, fieldExpression, 'IS', null));
@@ -11,7 +11,7 @@ class WhereJsonPostgresOperation extends ObjectionToKnexConvertingOperation {
11
11
  args[0],
12
12
  this.opt.operator,
13
13
  args[1],
14
- this.opt.prefix
14
+ this.opt.prefix,
15
15
  );
16
16
 
17
17
  if (this.opt.bool === 'or') {
@@ -55,13 +55,13 @@ function whereJsonbRefOnLeftJsonbValOrRefOnRight(
55
55
  fieldExpression,
56
56
  operator,
57
57
  jsonObjectOrFieldExpression,
58
- queryPrefix
58
+ queryPrefix,
59
59
  ) {
60
60
  let queryParams = whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(
61
61
  fieldExpression,
62
62
  operator,
63
63
  jsonObjectOrFieldExpression,
64
- queryPrefix
64
+ queryPrefix,
65
65
  );
66
66
  return builder.whereRaw.apply(builder, queryParams);
67
67
  }
@@ -70,7 +70,7 @@ function whereJsonbRefOnLeftJsonbValOrRefOnRightRawQueryParams(
70
70
  fieldExpression,
71
71
  operator,
72
72
  jsonObjectOrFieldExpression,
73
- queryPrefix
73
+ queryPrefix,
74
74
  ) {
75
75
  let fieldReference = parseFieldExpression(fieldExpression);
76
76
 
@@ -36,7 +36,7 @@ class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation
36
36
  knexBuilder,
37
37
  columns,
38
38
  helperColumns,
39
- values.as(knex.raw(`V(${helperColumns.map((_) => '??')})`, helperColumns))
39
+ values.as(knex.raw(`V(${helperColumns.map((_) => '??')})`, helperColumns)),
40
40
  );
41
41
  }
42
42
  }
@@ -51,8 +51,8 @@ class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation
51
51
  `(VALUES ${values
52
52
  .map((value) => `(${value.map((_) => '?').join(',')})`)
53
53
  .join(',')}) AS V(${helperColumns.map((_) => '??').join(',')})`,
54
- flatten(values).concat(helperColumns)
55
- )
54
+ flatten(values).concat(helperColumns),
55
+ ),
56
56
  );
57
57
  }
58
58
 
@@ -60,8 +60,8 @@ class WhereInCompositeMsSqlOperation extends ObjectionToKnexConvertingOperation
60
60
  const wrapperQuery = knex.from(subQuery).where(
61
61
  zipObject(
62
62
  helperColumns,
63
- columns.map((column) => knex.raw('??', column))
64
- )
63
+ columns.map((column) => knex.raw('??', column)),
64
+ ),
65
65
  );
66
66
 
67
67
  if (this.prefix === 'not') {
@@ -229,7 +229,7 @@ function peg$parse(input, options) {
229
229
  throw peg$buildStructuredError(
230
230
  [peg$otherExpectation(description)],
231
231
  input.substring(peg$savedPos, peg$currPos),
232
- location
232
+ location,
233
233
  );
234
234
  }
235
235
 
@@ -333,7 +333,7 @@ function peg$parse(input, options) {
333
333
  peg$SyntaxError.buildMessage(expected, found),
334
334
  expected,
335
335
  found,
336
- location
336
+ location,
337
337
  );
338
338
  }
339
339
 
@@ -875,7 +875,7 @@ function peg$parse(input, options) {
875
875
  peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
876
876
  peg$maxFailPos < input.length
877
877
  ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
878
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
878
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos),
879
879
  );
880
880
  }
881
881
  }
@@ -229,7 +229,7 @@ function peg$parse(input, options) {
229
229
  peg$c9 = peg$classExpectation(
230
230
  ['[', ']', '(', ')', ',', '.', ' ', '\t', '\r', '\n'],
231
231
  true,
232
- false
232
+ false,
233
233
  ),
234
234
  peg$c10 = '(',
235
235
  peg$c11 = peg$literalExpectation('(', false),
@@ -293,7 +293,7 @@ function peg$parse(input, options) {
293
293
  throw peg$buildStructuredError(
294
294
  [peg$otherExpectation(description)],
295
295
  input.substring(peg$savedPos, peg$currPos),
296
- location
296
+ location,
297
297
  );
298
298
  }
299
299
 
@@ -397,7 +397,7 @@ function peg$parse(input, options) {
397
397
  peg$SyntaxError.buildMessage(expected, found),
398
398
  expected,
399
399
  found,
400
- location
400
+ location,
401
401
  );
402
402
  }
403
403
 
@@ -996,7 +996,7 @@ function peg$parse(input, options) {
996
996
  function assertDuplicateRelation(node, expr) {
997
997
  if (expr.$name in node) {
998
998
  console.warn(
999
- `Duplicate relation "${expr.$name}" in a relation expression. You should use "a.[b, c]" instead of "[a.b, a.c]". This will cause an error in objection 2.0`
999
+ `Duplicate relation "${expr.$name}" in a relation expression. You should use "a.[b, c]" instead of "[a.b, a.c]". This will cause an error in objection 2.0`,
1000
1000
  );
1001
1001
 
1002
1002
  // TODO: enable for v2.0.
@@ -1031,7 +1031,7 @@ function peg$parse(input, options) {
1031
1031
  peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1032
1032
  peg$maxFailPos < input.length
1033
1033
  ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1034
- : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1034
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos),
1035
1035
  );
1036
1036
  }
1037
1037
  }
@@ -140,7 +140,7 @@ class Relation {
140
140
  relatedJoinSelectQuery = this.relatedModelClass.query().childQueryOf(builder),
141
141
  relatedTable = builder.tableNameFor(this.relatedModelClass),
142
142
  ownerTable = builder.tableRefFor(this.ownerModelClass),
143
- } = {}
143
+ } = {},
144
144
  ) {
145
145
  let relatedJoinSelect = this.applyModify(relatedJoinSelectQuery).as(relatedTableAlias);
146
146
 
@@ -278,7 +278,7 @@ function resolveRelatedModelClass(ctx) {
278
278
  relatedModelClass = resolveModel(
279
279
  ctx.mapping.modelClass,
280
280
  ctx.ownerModelClass.modelPaths,
281
- 'modelClass'
281
+ 'modelClass',
282
282
  );
283
283
  } catch (err) {
284
284
  throw ctx.createError(err.message);
@@ -304,7 +304,7 @@ function createJoinProperties(ctx) {
304
304
 
305
305
  if (!mapping.join || !mapping.join.from || !mapping.join.to) {
306
306
  throw ctx.createError(
307
- 'join must be an object that maps the columns of the related models together. For example: {from: "SomeTable.id", to: "SomeOtherTable.someModelId"}'
307
+ 'join must be an object that maps the columns of the related models together. For example: {from: "SomeTable.id", to: "SomeOtherTable.someModelId"}',
308
308
  );
309
309
  }
310
310
 
@@ -326,7 +326,7 @@ function createJoinProperties(ctx) {
326
326
 
327
327
  if (ownerProp.props.some((it) => it === ctx.name)) {
328
328
  throw ctx.createError(
329
- `join: relation name and join property '${ctx.name}' cannot have the same name. If you cannot change one or the other, you can use $parseDatabaseJson and $formatDatabaseJson methods to convert the column name.`
329
+ `join: relation name and join property '${ctx.name}' cannot have the same name. If you cannot change one or the other, you can use $parseDatabaseJson and $formatDatabaseJson methods to convert the column name.`,
330
330
  );
331
331
  }
332
332
 
@@ -345,11 +345,11 @@ function createRelationProperty(ctx, refString, propName) {
345
345
  } catch (err) {
346
346
  if (err instanceof RelationProperty.ModelNotFoundError) {
347
347
  throw ctx.createError(
348
- `join: either \`from\` or \`to\` must point to the owner model table and the other one to the related table. It might be that specified table '${err.tableName}' is not correct`
348
+ `join: either \`from\` or \`to\` must point to the owner model table and the other one to the related table. It might be that specified table '${err.tableName}' is not correct`,
349
349
  );
350
350
  } else if (err instanceof RelationProperty.InvalidReferenceError) {
351
351
  throw ctx.createError(
352
- `${propName} must have format TableName.columnName. For example "SomeTable.id" or in case of composite key ["SomeTable.a", "SomeTable.b"].`
352
+ `${propName} must have format TableName.columnName. For example "SomeTable.id" or in case of composite key ["SomeTable.a", "SomeTable.b"].`,
353
353
  );
354
354
  } else {
355
355
  throw err;
@@ -189,7 +189,7 @@ function findFirstNonPartialAncestorQuery(builder) {
189
189
  builder = builder.parentQuery();
190
190
  if (!builder)
191
191
  throw Error(
192
- 'query method `for` ommitted outside a subquery, can not figure out relation target'
192
+ 'query method `for` ommitted outside a subquery, can not figure out relation target',
193
193
  );
194
194
  while (builder.isPartial()) {
195
195
  if (!builder.parentQuery()) {
@@ -48,7 +48,7 @@ class BelongsToOneUnrelateOperation extends UnrelateOperation {
48
48
  this.relation.ownerModelClass
49
49
  .relatedQuery(this.relation.name)
50
50
  .copyFrom(builder, builder.constructor.JoinSelector)
51
- .copyFrom(builder, builder.constructor.WhereSelector)
51
+ .copyFrom(builder, builder.constructor.WhereSelector),
52
52
  );
53
53
  }
54
54
 
@@ -51,7 +51,7 @@ function assertOwnerIsSingleItem(owner, relation) {
51
51
 
52
52
  'If you need to insert items for multiple parents, simply loop through them.',
53
53
  `That's the most performant way.`,
54
- ].join(' ')
54
+ ].join(' '),
55
55
  );
56
56
  }
57
57
  }
@@ -50,7 +50,7 @@ function assertOwnerIsSingleItem(owner, relation) {
50
50
 
51
51
  'If you need to relate items for multiple parents, simply loop through them.',
52
52
  `That's the most performant way.`,
53
- ].join(' ')
53
+ ].join(' '),
54
54
  );
55
55
  }
56
56
  }
@@ -104,7 +104,7 @@ class ManyToManyRelation extends Relation {
104
104
  relatedTable = defaultRelatedTable(this, builder),
105
105
  ownerTable = defaultOwnerTable(this, builder),
106
106
  joinTableAlias = defaultJoinTableAlias(this, relatedTableAlias, builder),
107
- } = {}
107
+ } = {},
108
108
  ) {
109
109
  let relatedJoinSelect = this.applyModify(relatedJoinSelectQuery).as(relatedTableAlias);
110
110
 
@@ -274,7 +274,7 @@ class ManyToManyRelation extends Relation {
274
274
  return mapAfterAllReturn(
275
275
  models,
276
276
  (model) => this.joinTableBeforeInsert(model, queryContext),
277
- result
277
+ result,
278
278
  );
279
279
  }
280
280
  }
@@ -334,7 +334,7 @@ function checkThroughObject(ctx) {
334
334
 
335
335
  if (!mapping.join.through.from || !mapping.join.through.to) {
336
336
  throw ctx.createError(
337
- 'join.through must be an object that describes the join table. For example: {from: "JoinTable.someId", to: "JoinTable.someOtherId"}'
337
+ 'join.through must be an object that describes the join table. For example: {from: "JoinTable.someId", to: "JoinTable.someOtherId"}',
338
338
  );
339
339
  }
340
340
 
@@ -349,7 +349,7 @@ function resolveJoinModelClassIfDefined(ctx) {
349
349
  joinTableModelClass = resolveModel(
350
350
  ctx.mapping.join.through.modelClass,
351
351
  ctx.ownerModelClass.modelPaths,
352
- 'join.through.modelClass'
352
+ 'join.through.modelClass',
353
353
  );
354
354
  } catch (err) {
355
355
  throw ctx.createError(err.message);
@@ -420,7 +420,7 @@ function createRelationProperty(ctx, refString, messagePrefix) {
420
420
  throw ctx.createError('join.through `from` and `to` must point to the same join table.');
421
421
  } else {
422
422
  throw ctx.createError(
423
- `${messagePrefix} must have format JoinTable.columnName. For example "JoinTable.someId" or in case of composite key ["JoinTable.a", "JoinTable.b"].`
423
+ `${messagePrefix} must have format JoinTable.columnName. For example "JoinTable.someId" or in case of composite key ["JoinTable.a", "JoinTable.b"].`,
424
424
  );
425
425
  }
426
426
  }
@@ -4,7 +4,7 @@ const { ManyToManyDeleteOperationBase } = require('./ManyToManyDeleteOperationBa
4
4
  const { ManyToManySqliteModifyMixin } = require('../ManyToManySqliteModifyMixin');
5
5
 
6
6
  class ManyToManyDeleteSqliteOperation extends ManyToManySqliteModifyMixin(
7
- ManyToManyDeleteOperationBase
7
+ ManyToManyDeleteOperationBase,
8
8
  ) {}
9
9
 
10
10
  module.exports = {
@@ -21,7 +21,7 @@ class ManyToManyRelateOperation extends RelateOperation {
21
21
  for (const ownerValue of ownerValues) {
22
22
  for (const relatedValue of this.ids) {
23
23
  joinModels.push(
24
- joinModelClass.fromJson(this.relation.createJoinModel(ownerValue, relatedValue))
24
+ joinModelClass.fromJson(this.relation.createJoinModel(ownerValue, relatedValue)),
25
25
  );
26
26
  }
27
27
  }
@@ -58,7 +58,7 @@ function assertOwnerIsSingleItem(builder, owner, relation) {
58
58
  if (isPostgres(builder.unsafeKnex())) {
59
59
  if (!isModels && !isIdentifiers && !isQueryBuilder) {
60
60
  throw new Error(
61
- 'Parent must be a list of identifiers or a list of models when relating a ManyToManyRelation'
61
+ 'Parent must be a list of identifiers or a list of models when relating a ManyToManyRelation',
62
62
  );
63
63
  }
64
64
  } else {
@@ -70,7 +70,7 @@ function assertOwnerIsSingleItem(builder, owner, relation) {
70
70
 
71
71
  'If you need to relate items for multiple parents, simply loop through them.',
72
72
  `That's the most performant way.`,
73
- ].join(' ')
73
+ ].join(' '),
74
74
  );
75
75
  }
76
76
  }
@@ -4,7 +4,7 @@ const { ManyToManyUnrelateOperationBase } = require('./ManyToManyUnrelateOperati
4
4
  const { ManyToManySqliteModifyMixin } = require('../ManyToManySqliteModifyMixin');
5
5
 
6
6
  class ManyToManyUnrelateSqliteOperation extends ManyToManySqliteModifyMixin(
7
- ManyToManyUnrelateOperationBase
7
+ ManyToManyUnrelateOperationBase,
8
8
  ) {
9
9
  get modifyMainQuery() {
10
10
  return false;
@@ -45,7 +45,7 @@ class ManyToManyUpdateOperationBase extends UpdateOperation {
45
45
  .patch(this.joinTablePatch);
46
46
 
47
47
  await this.applyModifyFilterForJoinTable(joinTableUpdateQuery).modify(
48
- this.relation.joinTableModify
48
+ this.relation.joinTableModify,
49
49
  );
50
50
  return result;
51
51
  } else {
@@ -4,7 +4,7 @@ const { ManyToManyUpdateOperationBase } = require('./ManyToManyUpdateOperationBa
4
4
  const { ManyToManySqliteModifyMixin } = require('../ManyToManySqliteModifyMixin');
5
5
 
6
6
  class ManyToManyUpdateSqliteOperation extends ManyToManySqliteModifyMixin(
7
- ManyToManyUpdateOperationBase
7
+ ManyToManyUpdateOperationBase,
8
8
  ) {}
9
9
 
10
10
  module.exports = {
@@ -8,8 +8,8 @@ function transaction() {
8
8
  if (arguments.length < 2) {
9
9
  return Promise.reject(
10
10
  new Error(
11
- 'objection.transaction: provide at least one Model class to bind to the transaction or a knex instance'
12
- )
11
+ 'objection.transaction: provide at least one Model class to bind to the transaction or a knex instance',
12
+ ),
13
13
  );
14
14
  }
15
15
 
@@ -29,7 +29,7 @@ function transaction() {
29
29
  for (i = 0; i < modelClasses.length; ++i) {
30
30
  if (!isModelClass(modelClasses[i])) {
31
31
  return Promise.reject(
32
- new Error('objection.transaction: all but the last argument should be Model subclasses')
32
+ new Error('objection.transaction: all but the last argument should be Model subclasses'),
33
33
  );
34
34
  }
35
35
  }
@@ -39,8 +39,8 @@ function transaction() {
39
39
  if (modelClasses[i].knex() !== knex) {
40
40
  return Promise.reject(
41
41
  new Error(
42
- 'objection.transaction: all Model subclasses must be bound to the same database'
43
- )
42
+ 'objection.transaction: all Model subclasses must be bound to the same database',
43
+ ),
44
44
  );
45
45
  }
46
46
  }
@@ -71,8 +71,8 @@ transaction.start = function (modelClassOrKnex) {
71
71
  if (!knex || !isFunction(knex.transaction)) {
72
72
  return Promise.reject(
73
73
  new Error(
74
- 'objection.transaction.start: first argument must be a model class or a knex instance'
75
- )
74
+ 'objection.transaction.start: first argument must be a model class or a knex instance',
75
+ ),
76
76
  );
77
77
  }
78
78
 
@@ -6,7 +6,7 @@ function assertHasId(model) {
6
6
  const ids = modelClass.getIdColumnArray().join(', ');
7
7
 
8
8
  throw new Error(
9
- `one of the identifier columns [${ids}] is null or undefined. Have you specified the correct identifier column for the model '${modelClass.name}' using the 'idColumn' property?`
9
+ `one of the identifier columns [${ids}] is null or undefined. Have you specified the correct identifier column for the model '${modelClass.name}' using the 'idColumn' property?`,
10
10
  );
11
11
  }
12
12
  }
@@ -325,7 +325,7 @@
325
325
  .call(hasOwnProperty)
326
326
  .replace(reRegExpChar, '\\$&')
327
327
  .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') +
328
- '$'
328
+ '$',
329
329
  );
330
330
 
331
331
  /** Built-in value references. */
@@ -1923,7 +1923,7 @@
1923
1923
  var isArguments = baseIsArguments(
1924
1924
  (function () {
1925
1925
  return arguments;
1926
- })()
1926
+ })(),
1927
1927
  )
1928
1928
  ? baseIsArguments
1929
1929
  : function (value) {
@@ -27,7 +27,7 @@ function snakeCase(
27
27
  upperCase = false,
28
28
  underscoreBeforeDigits = false,
29
29
  underscoreBetweenUppercaseLetters = false,
30
- } = {}
30
+ } = {},
31
31
  ) {
32
32
  if (str.length === 0) {
33
33
  return str;
@@ -122,7 +122,7 @@ function checkProperties(ret, prop) {
122
122
 
123
123
  if (typeof val === 'undefined') {
124
124
  throw new Error(
125
- `expected id ${JSON.stringify(obj)} to have property ${prop.propDescription(j)}`
125
+ `expected id ${JSON.stringify(obj)} to have property ${prop.propDescription(j)}`,
126
126
  );
127
127
  }
128
128
  }
@@ -20,7 +20,7 @@ function resolveModel(modelRef, modelPaths, errorPrefix) {
20
20
 
21
21
  if (!isModelClass(modelRef)) {
22
22
  throw new ResolveError(
23
- `is not a subclass of Model or a file path to a module that exports one. You may be dealing with a require loop. See the documentation section about require loops.`
23
+ `is not a subclass of Model or a file path to a module that exports one. You may be dealing with a require loop. See the documentation section about require loops.`,
24
24
  );
25
25
  }
26
26
 
@@ -77,7 +77,7 @@ function requireModel(modelPath) {
77
77
  if (isModelClass(exp)) {
78
78
  if (modelClass !== null) {
79
79
  throw new ResolveError(
80
- `path ${modelPath} exports multiple models. Don't know which one to choose.`
80
+ `path ${modelPath} exports multiple models. Don't know which one to choose.`,
81
81
  );
82
82
  }
83
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "objection",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "An SQL-friendly ORM for Node.js",
5
5
  "main": "lib/objection.js",
6
6
  "license": "MIT",
@@ -66,15 +66,15 @@
66
66
  "chai-subset": "^1.6.0",
67
67
  "eslint": "^8.1.0",
68
68
  "eslint-formatter-codeframe": "^7.32.1",
69
- "eslint-plugin-prettier": "^4.0.0",
69
+ "eslint-plugin-prettier": "^5.0.0",
70
70
  "expect.js": "^0.3.1",
71
71
  "knex": ">=1.0.1",
72
72
  "mocha": "^10.2.0",
73
73
  "mysql": "^2.18.1",
74
74
  "pg": "^8.7.1",
75
- "prettier": "2.8.8",
75
+ "prettier": "3.0.3",
76
76
  "sqlite3": "^5.0.2",
77
77
  "typescript": ">=4.5.4",
78
- "vuepress": "1.9.9"
78
+ "vuepress": "1.9.10"
79
79
  }
80
80
  }