@e22m4u/js-repository 0.4.0 → 0.5.0

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 (86) hide show
  1. package/README.md +479 -61
  2. package/dist/cjs/index.cjs +319 -270
  3. package/package.json +1 -1
  4. package/src/adapter/adapter-loader.js +1 -1
  5. package/src/adapter/adapter-loader.spec.js +1 -1
  6. package/src/adapter/decorator/data-sanitizing-decorator.js +1 -1
  7. package/src/adapter/decorator/data-transformation-decorator.js +1 -1
  8. package/src/adapter/decorator/data-validation-decorator.js +1 -1
  9. package/src/adapter/decorator/default-values-decorator.js +1 -1
  10. package/src/adapter/decorator/fields-filtering-decorator.js +1 -1
  11. package/src/adapter/decorator/inclusion-decorator.js +1 -1
  12. package/src/adapter/decorator/property-uniqueness-decorator.js +1 -1
  13. package/src/definition/datasource/datasource-definition-validator.js +3 -3
  14. package/src/definition/datasource/datasource-definition-validator.spec.js +3 -3
  15. package/src/definition/model/model-data-sanitizer.js +2 -2
  16. package/src/definition/model/model-data-transformer.js +71 -13
  17. package/src/definition/model/model-data-transformer.spec.js +2073 -407
  18. package/src/definition/model/model-data-validator.js +125 -37
  19. package/src/definition/model/model-data-validator.spec.js +2138 -440
  20. package/src/definition/model/model-definition-utils.js +5 -5
  21. package/src/definition/model/model-definition-utils.spec.js +7 -7
  22. package/src/definition/model/model-definition-validator.js +7 -7
  23. package/src/definition/model/model-definition-validator.spec.js +10 -7
  24. package/src/definition/model/properties/properties-definition-validator.js +129 -54
  25. package/src/definition/model/properties/properties-definition-validator.spec.js +85 -25
  26. package/src/definition/model/properties/property-transformer/builtin/index.d.ts +0 -1
  27. package/src/definition/model/properties/property-transformer/builtin/index.js +0 -1
  28. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.d.ts +1 -1
  29. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js +1 -1
  30. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.spec.js +1 -1
  31. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.d.ts +1 -1
  32. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js +1 -1
  33. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.spec.js +1 -1
  34. package/src/definition/model/properties/property-transformer/builtin/trim-transformer.js +1 -1
  35. package/src/definition/model/properties/property-transformer/builtin/trim-transformer.spec.js +1 -1
  36. package/src/definition/model/properties/property-transformer/property-transformer-registry.js +2 -4
  37. package/src/definition/model/properties/property-transformer/property-transformer-registry.spec.js +2 -4
  38. package/src/definition/model/properties/property-transformer/property-transformer.d.ts +2 -2
  39. package/src/definition/model/properties/property-uniqueness-validator.js +4 -4
  40. package/src/definition/model/properties/property-uniqueness-validator.spec.js +4 -4
  41. package/src/definition/model/properties/property-validator/builtin/max-length-validator.d.ts +1 -1
  42. package/src/definition/model/properties/property-validator/builtin/max-length-validator.js +2 -2
  43. package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js +2 -2
  44. package/src/definition/model/properties/property-validator/builtin/min-length-validator.d.ts +1 -1
  45. package/src/definition/model/properties/property-validator/builtin/min-length-validator.js +2 -2
  46. package/src/definition/model/properties/property-validator/builtin/min-length-validator.spec.js +2 -2
  47. package/src/definition/model/properties/property-validator/builtin/regexp-validator.d.ts +1 -1
  48. package/src/definition/model/properties/property-validator/builtin/regexp-validator.js +2 -2
  49. package/src/definition/model/properties/property-validator/builtin/regexp-validator.spec.js +2 -2
  50. package/src/definition/model/properties/property-validator/property-validator-registry.js +2 -2
  51. package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +2 -2
  52. package/src/definition/model/properties/property-validator/property-validator.d.ts +2 -2
  53. package/src/definition/model/relations/relations-definition-validator.js +23 -23
  54. package/src/definition/model/relations/relations-definition-validator.spec.js +24 -24
  55. package/src/errors/invalid-operator-value-error.js +1 -1
  56. package/src/errors/invalid-operator-value-error.spec.js +1 -1
  57. package/src/filter/fields-clause-tool.js +5 -5
  58. package/src/filter/fields-clause-tool.spec.js +16 -16
  59. package/src/filter/include-clause-tool.js +6 -6
  60. package/src/filter/include-clause-tool.spec.js +2 -2
  61. package/src/filter/operator-clause-tool.js +13 -13
  62. package/src/filter/operator-clause-tool.spec.js +13 -13
  63. package/src/filter/order-clause-tool.js +3 -3
  64. package/src/filter/order-clause-tool.spec.js +4 -4
  65. package/src/filter/slice-clause-tool.js +5 -5
  66. package/src/filter/slice-clause-tool.spec.js +5 -5
  67. package/src/filter/where-clause-tool.js +4 -4
  68. package/src/filter/where-clause-tool.spec.js +3 -3
  69. package/src/relations/belongs-to-resolver.js +14 -14
  70. package/src/relations/belongs-to-resolver.spec.js +14 -14
  71. package/src/relations/has-many-resolver.js +22 -22
  72. package/src/relations/has-many-resolver.spec.js +23 -23
  73. package/src/relations/has-one-resolver.js +22 -22
  74. package/src/relations/has-one-resolver.spec.js +23 -23
  75. package/src/relations/references-many-resolver.js +7 -7
  76. package/src/relations/references-many-resolver.spec.js +7 -7
  77. package/src/repository/repository-registry.js +1 -1
  78. package/src/utils/exclude-object-keys.js +1 -1
  79. package/src/utils/exclude-object-keys.spec.js +1 -1
  80. package/src/utils/model-name-to-model-key.js +1 -1
  81. package/src/utils/model-name-to-model-key.spec.js +7 -7
  82. package/src/utils/select-object-keys.js +3 -3
  83. package/src/utils/select-object-keys.spec.js +3 -3
  84. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.d.ts +0 -6
  85. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js +0 -22
  86. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.spec.js +0 -41
@@ -197,7 +197,7 @@ export class IncludeClauseTool extends Service {
197
197
  if (!clause.relation || typeof clause.relation !== 'string')
198
198
  throw new InvalidArgumentError(
199
199
  'The provided option "relation" should be ' +
200
- 'a non-empty String, but %v given.',
200
+ 'a non-empty String, but %v was given.',
201
201
  clause.relation,
202
202
  );
203
203
  if ('scope' in clause && clause) this.validateScopeClause(clause.scope);
@@ -213,7 +213,7 @@ export class IncludeClauseTool extends Service {
213
213
  // unsupported
214
214
  throw new InvalidArgumentError(
215
215
  'The provided option "include" should have a non-empty String, ' +
216
- 'an Object or an Array, but %v given.',
216
+ 'an Object or an Array, but %v was given.',
217
217
  clause,
218
218
  );
219
219
  }
@@ -228,7 +228,7 @@ export class IncludeClauseTool extends Service {
228
228
  if (clause == null) return;
229
229
  if (typeof clause !== 'object' || Array.isArray(clause))
230
230
  throw new InvalidArgumentError(
231
- 'The provided option "scope" should be an Object, but %v given.',
231
+ 'The provided option "scope" should be an Object, but %v was given.',
232
232
  clause,
233
233
  );
234
234
  // {where: ...}
@@ -294,7 +294,7 @@ export class IncludeClauseTool extends Service {
294
294
  if (!clause.relation || typeof clause.relation !== 'string')
295
295
  throw new InvalidArgumentError(
296
296
  'The provided option "relation" should be ' +
297
- 'a non-empty String, but %v given.',
297
+ 'a non-empty String, but %v was given.',
298
298
  clause.relation,
299
299
  );
300
300
  const normalized = {relation: clause.relation};
@@ -316,7 +316,7 @@ export class IncludeClauseTool extends Service {
316
316
  // unsupported
317
317
  throw new InvalidArgumentError(
318
318
  'The provided option "include" should have a non-empty String, ' +
319
- 'an Object or an Array, but %v given.',
319
+ 'an Object or an Array, but %v was given.',
320
320
  clause,
321
321
  );
322
322
  }
@@ -333,7 +333,7 @@ export class IncludeClauseTool extends Service {
333
333
  if (clause == null) return;
334
334
  if (typeof clause !== 'object' || Array.isArray(clause))
335
335
  throw new InvalidArgumentError(
336
- 'The provided option "scope" should be an Object, but %v given.',
336
+ 'The provided option "scope" should be an Object, but %v was given.',
337
337
  clause,
338
338
  );
339
339
  const result = {};
@@ -41,7 +41,7 @@ describe('IncludeClauseTool', function () {
41
41
  const createError = v =>
42
42
  format(
43
43
  'The provided option "include" should have a non-empty String, ' +
44
- 'an Object or an Array, but %v given.',
44
+ 'an Object or an Array, but %v was given.',
45
45
  v,
46
46
  );
47
47
  const testOf = v => {
@@ -105,7 +105,7 @@ describe('IncludeClauseTool', function () {
105
105
  const createError = v =>
106
106
  format(
107
107
  'The provided option "include" should have a non-empty String, ' +
108
- 'an Object or an Array, but %v given.',
108
+ 'an Object or an Array, but %v was given.',
109
109
  v,
110
110
  );
111
111
  const testOf = v => {
@@ -59,7 +59,7 @@ export class OperatorClauseTool extends Service {
59
59
  if (!clause || typeof clause !== 'object' || Array.isArray(clause))
60
60
  throw new InvalidArgumentError(
61
61
  'The first argument of OperatorUtils.testAll ' +
62
- 'should be an Object, but %v given.',
62
+ 'should be an Object, but %v was given.',
63
63
  clause,
64
64
  );
65
65
 
@@ -137,7 +137,7 @@ export class OperatorClauseTool extends Service {
137
137
  if (!clause || typeof clause !== 'object')
138
138
  throw new InvalidArgumentError(
139
139
  'The first argument of OperatorUtils.testEqNeq ' +
140
- 'should be an Object, but %v given.',
140
+ 'should be an Object, but %v was given.',
141
141
  clause,
142
142
  );
143
143
  if ('eq' in clause) return this.compare(clause.eq, value) === 0;
@@ -183,7 +183,7 @@ export class OperatorClauseTool extends Service {
183
183
  if (!clause || typeof clause !== 'object')
184
184
  throw new InvalidArgumentError(
185
185
  'The first argument of OperatorUtils.testGtLt ' +
186
- 'should be an Object, but %v given.',
186
+ 'should be an Object, but %v was given.',
187
187
  clause,
188
188
  );
189
189
  if ('gt' in clause) return this.compare(value, clause.gt) > 0;
@@ -210,7 +210,7 @@ export class OperatorClauseTool extends Service {
210
210
  if (!clause || typeof clause !== 'object')
211
211
  throw new InvalidArgumentError(
212
212
  'The first argument of OperatorUtils.testInq ' +
213
- 'should be an Object, but %v given.',
213
+ 'should be an Object, but %v was given.',
214
214
  clause,
215
215
  );
216
216
  if ('inq' in clause && clause.inq !== undefined) {
@@ -246,7 +246,7 @@ export class OperatorClauseTool extends Service {
246
246
  if (!clause || typeof clause !== 'object')
247
247
  throw new InvalidArgumentError(
248
248
  'The first argument of OperatorUtils.testNin ' +
249
- 'should be an Object, but %v given.',
249
+ 'should be an Object, but %v was given.',
250
250
  clause,
251
251
  );
252
252
  if ('nin' in clause && clause.nin !== undefined) {
@@ -282,7 +282,7 @@ export class OperatorClauseTool extends Service {
282
282
  if (!clause || typeof clause !== 'object')
283
283
  throw new InvalidArgumentError(
284
284
  'The first argument of OperatorUtils.testBetween ' +
285
- 'should be an Object, but %v given.',
285
+ 'should be an Object, but %v was given.',
286
286
  clause,
287
287
  );
288
288
  if ('between' in clause && clause.between !== undefined) {
@@ -318,7 +318,7 @@ export class OperatorClauseTool extends Service {
318
318
  if (!clause || typeof clause !== 'object')
319
319
  throw new InvalidArgumentError(
320
320
  'The first argument of OperatorUtils.testExists ' +
321
- 'should be an Object, but %v given.',
321
+ 'should be an Object, but %v was given.',
322
322
  clause,
323
323
  );
324
324
  if ('exists' in clause && clause.exists !== undefined) {
@@ -351,7 +351,7 @@ export class OperatorClauseTool extends Service {
351
351
  if (!clause || typeof clause !== 'object')
352
352
  throw new InvalidArgumentError(
353
353
  'The first argument of OperatorUtils.testLike ' +
354
- 'should be an Object, but %v given.',
354
+ 'should be an Object, but %v was given.',
355
355
  clause,
356
356
  );
357
357
  if ('like' in clause && clause.like !== undefined) {
@@ -379,7 +379,7 @@ export class OperatorClauseTool extends Service {
379
379
  if (!clause || typeof clause !== 'object')
380
380
  throw new InvalidArgumentError(
381
381
  'The first argument of OperatorUtils.testNlike ' +
382
- 'should be an Object, but %v given.',
382
+ 'should be an Object, but %v was given.',
383
383
  clause,
384
384
  );
385
385
  if ('nlike' in clause && clause.nlike !== undefined) {
@@ -411,7 +411,7 @@ export class OperatorClauseTool extends Service {
411
411
  if (!clause || typeof clause !== 'object')
412
412
  throw new InvalidArgumentError(
413
413
  'The first argument of OperatorUtils.testIlike ' +
414
- 'should be an Object, but %v given.',
414
+ 'should be an Object, but %v was given.',
415
415
  clause,
416
416
  );
417
417
  if ('ilike' in clause && clause.ilike !== undefined) {
@@ -443,7 +443,7 @@ export class OperatorClauseTool extends Service {
443
443
  if (!clause || typeof clause !== 'object')
444
444
  throw new InvalidArgumentError(
445
445
  'The first argument of OperatorUtils.testNilike ' +
446
- 'should be an Object, but %v given.',
446
+ 'should be an Object, but %v was given.',
447
447
  clause,
448
448
  );
449
449
  if ('nilike' in clause && clause.nilike !== undefined) {
@@ -487,7 +487,7 @@ export class OperatorClauseTool extends Service {
487
487
  if (!clause || typeof clause !== 'object')
488
488
  throw new InvalidArgumentError(
489
489
  'The first argument of OperatorUtils.testRegexp ' +
490
- 'should be an Object, but %v given.',
490
+ 'should be an Object, but %v was given.',
491
491
  clause,
492
492
  );
493
493
  if ('regexp' in clause && clause.regexp !== undefined) {
@@ -504,7 +504,7 @@ export class OperatorClauseTool extends Service {
504
504
  const flags = clause.flags || undefined;
505
505
  if (flags && typeof flags !== 'string')
506
506
  throw new InvalidArgumentError(
507
- 'RegExp flags should be a String, but %v given.',
507
+ 'RegExp flags should be a String, but %v was given.',
508
508
  clause.flags,
509
509
  );
510
510
  if (!value || typeof value !== 'string') return false;
@@ -116,7 +116,7 @@ describe('OperatorClauseTool', function () {
116
116
  const throwable = () => S.testAll(10);
117
117
  expect(throwable).to.throw(
118
118
  'The first argument of OperatorUtils.testAll ' +
119
- 'should be an Object, but 10 given.',
119
+ 'should be an Object, but 10 was given.',
120
120
  );
121
121
  });
122
122
  });
@@ -131,7 +131,7 @@ describe('OperatorClauseTool', function () {
131
131
  const throwable = () => S.testEqNeq(10);
132
132
  expect(throwable).to.throw(
133
133
  'The first argument of OperatorUtils.testEqNeq ' +
134
- 'should be an Object, but 10 given.',
134
+ 'should be an Object, but 10 was given.',
135
135
  );
136
136
  });
137
137
 
@@ -216,7 +216,7 @@ describe('OperatorClauseTool', function () {
216
216
  const throwable = () => S.testGtLt(10);
217
217
  expect(throwable).to.throw(
218
218
  'The first argument of OperatorUtils.testGtLt ' +
219
- 'should be an Object, but 10 given.',
219
+ 'should be an Object, but 10 was given.',
220
220
  );
221
221
  });
222
222
 
@@ -391,7 +391,7 @@ describe('OperatorClauseTool', function () {
391
391
  const throwable = () => S.testInq(10);
392
392
  expect(throwable).to.throw(
393
393
  'The first argument of OperatorUtils.testInq ' +
394
- 'should be an Object, but 10 given.',
394
+ 'should be an Object, but 10 was given.',
395
395
  );
396
396
  });
397
397
 
@@ -446,7 +446,7 @@ describe('OperatorClauseTool', function () {
446
446
  const throwable = () => S.testNin(10);
447
447
  expect(throwable).to.throw(
448
448
  'The first argument of OperatorUtils.testNin ' +
449
- 'should be an Object, but 10 given.',
449
+ 'should be an Object, but 10 was given.',
450
450
  );
451
451
  });
452
452
 
@@ -515,7 +515,7 @@ describe('OperatorClauseTool', function () {
515
515
  const throwable = () => S.testBetween(10);
516
516
  expect(throwable).to.throw(
517
517
  'The first argument of OperatorUtils.testBetween ' +
518
- 'should be an Object, but 10 given.',
518
+ 'should be an Object, but 10 was given.',
519
519
  );
520
520
  });
521
521
 
@@ -572,7 +572,7 @@ describe('OperatorClauseTool', function () {
572
572
  const throwable = () => S.testExists(10);
573
573
  expect(throwable).to.throw(
574
574
  'The first argument of OperatorUtils.testExists ' +
575
- 'should be an Object, but 10 given.',
575
+ 'should be an Object, but 10 was given.',
576
576
  );
577
577
  });
578
578
 
@@ -695,7 +695,7 @@ describe('OperatorClauseTool', function () {
695
695
  const throwable = () => S.testLike(10);
696
696
  expect(throwable).to.throw(
697
697
  'The first argument of OperatorUtils.testLike ' +
698
- 'should be an Object, but 10 given.',
698
+ 'should be an Object, but 10 was given.',
699
699
  );
700
700
  });
701
701
 
@@ -774,7 +774,7 @@ describe('OperatorClauseTool', function () {
774
774
  const throwable = () => S.testNlike(10);
775
775
  expect(throwable).to.throw(
776
776
  'The first argument of OperatorUtils.testNlike ' +
777
- 'should be an Object, but 10 given.',
777
+ 'should be an Object, but 10 was given.',
778
778
  );
779
779
  });
780
780
 
@@ -853,7 +853,7 @@ describe('OperatorClauseTool', function () {
853
853
  const throwable = () => S.testIlike(10);
854
854
  expect(throwable).to.throw(
855
855
  'The first argument of OperatorUtils.testIlike ' +
856
- 'should be an Object, but 10 given.',
856
+ 'should be an Object, but 10 was given.',
857
857
  );
858
858
  });
859
859
 
@@ -932,7 +932,7 @@ describe('OperatorClauseTool', function () {
932
932
  const throwable = () => S.testNilike(10);
933
933
  expect(throwable).to.throw(
934
934
  'The first argument of OperatorUtils.testNilike ' +
935
- 'should be an Object, but 10 given.',
935
+ 'should be an Object, but 10 was given.',
936
936
  );
937
937
  });
938
938
 
@@ -1023,7 +1023,7 @@ describe('OperatorClauseTool', function () {
1023
1023
  const throwable = () => S.testRegexp(10);
1024
1024
  expect(throwable).to.throw(
1025
1025
  'The first argument of OperatorUtils.testRegexp ' +
1026
- 'should be an Object, but 10 given.',
1026
+ 'should be an Object, but 10 was given.',
1027
1027
  );
1028
1028
  });
1029
1029
 
@@ -1049,7 +1049,7 @@ describe('OperatorClauseTool', function () {
1049
1049
  const throwable = v => () =>
1050
1050
  S.testRegexp({regexp: 'Val.+', flags: v}, 'val');
1051
1051
  const error = v =>
1052
- format('RegExp flags should be a String, but %s given.', v);
1052
+ format('RegExp flags should be a String, but %s was given.', v);
1053
1053
  expect(throwable(10)).to.throw(error('10'));
1054
1054
  expect(throwable(true)).to.throw(error('true'));
1055
1055
  expect(throwable([])).to.throw(error('Array'));
@@ -21,7 +21,7 @@ export class OrderClauseTool extends Service {
21
21
  if (!key || typeof key !== 'string')
22
22
  throw new InvalidArgumentError(
23
23
  'The provided option "order" should be a non-empty String ' +
24
- 'or an Array of non-empty String, but %v given.',
24
+ 'or an Array of non-empty String, but %v was given.',
25
25
  key,
26
26
  );
27
27
  let reverse = 1;
@@ -48,7 +48,7 @@ export class OrderClauseTool extends Service {
48
48
  if (!field || typeof field !== 'string')
49
49
  throw new InvalidArgumentError(
50
50
  'The provided option "order" should be a non-empty String ' +
51
- 'or an Array of non-empty String, but %v given.',
51
+ 'or an Array of non-empty String, but %v was given.',
52
52
  field,
53
53
  );
54
54
  });
@@ -68,7 +68,7 @@ export class OrderClauseTool extends Service {
68
68
  if (!field || typeof field !== 'string')
69
69
  throw new InvalidArgumentError(
70
70
  'The provided option "order" should be a non-empty String ' +
71
- 'or an Array of non-empty String, but %v given.',
71
+ 'or an Array of non-empty String, but %v was given.',
72
72
  field,
73
73
  );
74
74
  });
@@ -602,7 +602,7 @@ describe('OrderClauseTool', function () {
602
602
  const error = v =>
603
603
  format(
604
604
  'The provided option "order" should be a non-empty String ' +
605
- 'or an Array of non-empty String, but %s given.',
605
+ 'or an Array of non-empty String, but %s was given.',
606
606
  v,
607
607
  );
608
608
  expect(throwable('')).to.throw(error('""'));
@@ -623,7 +623,7 @@ describe('OrderClauseTool', function () {
623
623
  const error = v =>
624
624
  format(
625
625
  'The provided option "order" should be a non-empty String ' +
626
- 'or an Array of non-empty String, but %s given.',
626
+ 'or an Array of non-empty String, but %s was given.',
627
627
  v,
628
628
  );
629
629
  expect(throwable([''])).to.throw(error('""'));
@@ -647,7 +647,7 @@ describe('OrderClauseTool', function () {
647
647
  const error = v =>
648
648
  format(
649
649
  'The provided option "order" should be a non-empty String ' +
650
- 'or an Array of non-empty String, but %s given.',
650
+ 'or an Array of non-empty String, but %s was given.',
651
651
  v,
652
652
  );
653
653
  expect(throwable('')).to.throw(error('""'));
@@ -673,7 +673,7 @@ describe('OrderClauseTool', function () {
673
673
  const error = v =>
674
674
  format(
675
675
  'The provided option "order" should be a non-empty String ' +
676
- 'or an Array of non-empty String, but %s given.',
676
+ 'or an Array of non-empty String, but %s was given.',
677
677
  v,
678
678
  );
679
679
  expect(throwable([''])).to.throw(error('""'));
@@ -17,17 +17,17 @@ export class SliceClauseTool extends Service {
17
17
  if (!Array.isArray(entities))
18
18
  throw new InvalidArgumentError(
19
19
  'The first argument of SliceClauseTool.slice ' +
20
- 'should be an Array, but %v given.',
20
+ 'should be an Array, but %v was given.',
21
21
  entities,
22
22
  );
23
23
  if (skip != null && typeof skip !== 'number')
24
24
  throw new InvalidArgumentError(
25
- 'The provided option "skip" should be a Number, but %v given.',
25
+ 'The provided option "skip" should be a Number, but %v was given.',
26
26
  skip,
27
27
  );
28
28
  if (limit != null && typeof limit !== 'number')
29
29
  throw new InvalidArgumentError(
30
- 'The provided option "limit" should be a Number, but %v given.',
30
+ 'The provided option "limit" should be a Number, but %v was given.',
31
31
  limit,
32
32
  );
33
33
  skip = skip || 0;
@@ -44,7 +44,7 @@ export class SliceClauseTool extends Service {
44
44
  if (skip == null) return;
45
45
  if (typeof skip !== 'number')
46
46
  throw new InvalidArgumentError(
47
- 'The provided option "skip" should be a Number, but %v given.',
47
+ 'The provided option "skip" should be a Number, but %v was given.',
48
48
  skip,
49
49
  );
50
50
  }
@@ -58,7 +58,7 @@ export class SliceClauseTool extends Service {
58
58
  if (limit == null) return;
59
59
  if (typeof limit !== 'number')
60
60
  throw new InvalidArgumentError(
61
- 'The provided option "limit" should be a Number, but %v given.',
61
+ 'The provided option "limit" should be a Number, but %v was given.',
62
62
  limit,
63
63
  );
64
64
  }
@@ -11,7 +11,7 @@ describe('SliceClauseTool', function () {
11
11
  const error = v =>
12
12
  format(
13
13
  'The first argument of SliceClauseTool.slice ' +
14
- 'should be an Array, but %s given.',
14
+ 'should be an Array, but %s was given.',
15
15
  v,
16
16
  );
17
17
  expect(throwable('str')).to.throw(error('"str"'));
@@ -32,7 +32,7 @@ describe('SliceClauseTool', function () {
32
32
  const throwable = v => () => S.slice(items, v);
33
33
  const error = v =>
34
34
  format(
35
- 'The provided option "skip" should be a Number, but %s given.',
35
+ 'The provided option "skip" should be a Number, but %s was given.',
36
36
  v,
37
37
  );
38
38
  expect(throwable('str')).to.throw(error('"str"'));
@@ -52,7 +52,7 @@ describe('SliceClauseTool', function () {
52
52
  const throwable = v => () => S.slice(items, undefined, v);
53
53
  const error = v =>
54
54
  format(
55
- 'The provided option "limit" should be a Number, but %s given.',
55
+ 'The provided option "limit" should be a Number, but %s was given.',
56
56
  v,
57
57
  );
58
58
  expect(throwable('str')).to.throw(error('"str"'));
@@ -119,7 +119,7 @@ describe('SliceClauseTool', function () {
119
119
  const throwable = v => () => SliceClauseTool.validateSkipClause(v);
120
120
  const error = v =>
121
121
  format(
122
- 'The provided option "skip" should be a Number, but %s given.',
122
+ 'The provided option "skip" should be a Number, but %s was given.',
123
123
  v,
124
124
  );
125
125
  expect(throwable('str')).to.throw(error('"str"'));
@@ -140,7 +140,7 @@ describe('SliceClauseTool', function () {
140
140
  const throwable = v => () => SliceClauseTool.validateLimitClause(v);
141
141
  const error = v =>
142
142
  format(
143
- 'The provided option "limit" should be a Number, but %s given.',
143
+ 'The provided option "limit" should be a Number, but %s was given.',
144
144
  v,
145
145
  );
146
146
  expect(throwable('str')).to.throw(error('"str"'));
@@ -42,7 +42,7 @@ export class WhereClauseTool extends Service {
42
42
  if (!Array.isArray(entities))
43
43
  throw new InvalidArgumentError(
44
44
  'The first argument of WhereClauseTool.filter should be ' +
45
- 'an Array of Object, but %v given.',
45
+ 'an Array of Object, but %v was given.',
46
46
  entities,
47
47
  );
48
48
  if (where == null) return entities;
@@ -58,7 +58,7 @@ export class WhereClauseTool extends Service {
58
58
  _createFilter(whereClause) {
59
59
  if (typeof whereClause !== 'object' || Array.isArray(whereClause))
60
60
  throw new InvalidArgumentError(
61
- 'The provided option "where" should be an Object, but %v given.',
61
+ 'The provided option "where" should be an Object, but %v was given.',
62
62
  whereClause,
63
63
  );
64
64
  const keys = Object.keys(whereClause);
@@ -66,7 +66,7 @@ export class WhereClauseTool extends Service {
66
66
  if (typeof data !== 'object')
67
67
  throw new InvalidArgumentError(
68
68
  'The first argument of WhereClauseTool.filter should be ' +
69
- 'an Array of Object, but %v given.',
69
+ 'an Array of Object, but %v was given.',
70
70
  data,
71
71
  );
72
72
  return keys.every(key => {
@@ -161,7 +161,7 @@ export class WhereClauseTool extends Service {
161
161
  if (clause == null || typeof clause === 'function') return;
162
162
  if (typeof clause !== 'object' || Array.isArray(clause))
163
163
  throw new InvalidArgumentError(
164
- 'The provided option "where" should be an Object, but %v given.',
164
+ 'The provided option "where" should be an Object, but %v was given.',
165
165
  clause,
166
166
  );
167
167
  }
@@ -49,7 +49,7 @@ describe('WhereClauseTool', function () {
49
49
  const error = v =>
50
50
  format(
51
51
  'The first argument of WhereClauseTool.filter should be ' +
52
- 'an Array of Object, but %s given.',
52
+ 'an Array of Object, but %s was given.',
53
53
  v,
54
54
  );
55
55
  expect(throwable('str')).to.throw(error('"str"'));
@@ -69,7 +69,7 @@ describe('WhereClauseTool', function () {
69
69
  const throwable = v => () => S.filter(OBJECTS, v);
70
70
  const error = v =>
71
71
  format(
72
- 'The provided option "where" should be an Object, but %s given.',
72
+ 'The provided option "where" should be an Object, but %s was given.',
73
73
  v,
74
74
  );
75
75
  expect(throwable('str')).to.throw(error('"str"'));
@@ -284,7 +284,7 @@ describe('WhereClauseTool', function () {
284
284
  const throwable = v => () => WhereClauseTool.validateWhereClause(v);
285
285
  const error = v =>
286
286
  format(
287
- 'The provided option "where" should be an Object, but %s given.',
287
+ 'The provided option "where" should be an Object, but %s was given.',
288
288
  v,
289
289
  );
290
290
  expect(throwable('str')).to.throw(error('"str"'));
@@ -31,37 +31,37 @@ export class BelongsToResolver extends Service {
31
31
  if (!entities || !Array.isArray(entities))
32
32
  throw new InvalidArgumentError(
33
33
  'The parameter "entities" of BelongsToResolver.includeTo requires ' +
34
- 'an Array of Object, but %v given.',
34
+ 'an Array of Object, but %v was given.',
35
35
  entities,
36
36
  );
37
37
  if (!sourceName || typeof sourceName !== 'string')
38
38
  throw new InvalidArgumentError(
39
39
  'The parameter "sourceName" of BelongsToResolver.includeTo requires ' +
40
- 'a non-empty String, but %v given.',
40
+ 'a non-empty String, but %v was given.',
41
41
  sourceName,
42
42
  );
43
43
  if (!targetName || typeof targetName !== 'string')
44
44
  throw new InvalidArgumentError(
45
45
  'The parameter "targetName" of BelongsToResolver.includeTo requires ' +
46
- 'a non-empty String, but %v given.',
46
+ 'a non-empty String, but %v was given.',
47
47
  targetName,
48
48
  );
49
49
  if (!relationName || typeof relationName !== 'string')
50
50
  throw new InvalidArgumentError(
51
51
  'The parameter "relationName" of BelongsToResolver.includeTo requires ' +
52
- 'a non-empty String, but %v given.',
52
+ 'a non-empty String, but %v was given.',
53
53
  relationName,
54
54
  );
55
55
  if (foreignKey && typeof foreignKey !== 'string')
56
56
  throw new InvalidArgumentError(
57
57
  'The provided parameter "foreignKey" of BelongsToResolver.includeTo ' +
58
- 'should be a String, but %v given.',
58
+ 'should be a String, but %v was given.',
59
59
  foreignKey,
60
60
  );
61
61
  if (scope && (typeof scope !== 'object' || Array.isArray(scope)))
62
62
  throw new InvalidArgumentError(
63
63
  'The provided parameter "scope" of BelongsToResolver.includeTo ' +
64
- 'should be an Object, but %v given.',
64
+ 'should be an Object, but %v was given.',
65
65
  scope,
66
66
  );
67
67
  if (foreignKey == null) foreignKey = `${relationName}Id`;
@@ -69,7 +69,7 @@ export class BelongsToResolver extends Service {
69
69
  if (!entity || typeof entity !== 'object' || Array.isArray(entity))
70
70
  throw new InvalidArgumentError(
71
71
  'The parameter "entities" of BelongsToResolver.includeTo requires ' +
72
- 'an Array of Object, but %v given.',
72
+ 'an Array of Object, but %v was given.',
73
73
  entity,
74
74
  );
75
75
  const targetId = entity[foreignKey];
@@ -120,37 +120,37 @@ export class BelongsToResolver extends Service {
120
120
  if (!entities || !Array.isArray(entities))
121
121
  throw new InvalidArgumentError(
122
122
  'The parameter "entities" of BelongsToResolver.includePolymorphicTo ' +
123
- 'requires an Array of Object, but %v given.',
123
+ 'requires an Array of Object, but %v was given.',
124
124
  entities,
125
125
  );
126
126
  if (!sourceName || typeof sourceName !== 'string')
127
127
  throw new InvalidArgumentError(
128
128
  'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo ' +
129
- 'requires a non-empty String, but %v given.',
129
+ 'requires a non-empty String, but %v was given.',
130
130
  sourceName,
131
131
  );
132
132
  if (!relationName || typeof relationName !== 'string')
133
133
  throw new InvalidArgumentError(
134
134
  'The parameter "relationName" of BelongsToResolver.includePolymorphicTo ' +
135
- 'requires a non-empty String, but %v given.',
135
+ 'requires a non-empty String, but %v was given.',
136
136
  relationName,
137
137
  );
138
138
  if (foreignKey && typeof foreignKey !== 'string')
139
139
  throw new InvalidArgumentError(
140
140
  'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo ' +
141
- 'should be a String, but %v given.',
141
+ 'should be a String, but %v was given.',
142
142
  foreignKey,
143
143
  );
144
144
  if (discriminator && typeof discriminator !== 'string')
145
145
  throw new InvalidArgumentError(
146
146
  'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo ' +
147
- 'should be a String, but %v given.',
147
+ 'should be a String, but %v was given.',
148
148
  discriminator,
149
149
  );
150
150
  if (scope && (typeof scope !== 'object' || Array.isArray(scope)))
151
151
  throw new InvalidArgumentError(
152
152
  'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo ' +
153
- 'should be an Object, but %v given.',
153
+ 'should be an Object, but %v was given.',
154
154
  scope,
155
155
  );
156
156
  if (foreignKey == null) {
@@ -166,7 +166,7 @@ export class BelongsToResolver extends Service {
166
166
  if (!entity || typeof entity !== 'object' || Array.isArray(entity))
167
167
  throw new InvalidArgumentError(
168
168
  'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires ' +
169
- 'an Array of Object, but %v given.',
169
+ 'an Array of Object, but %v was given.',
170
170
  entity,
171
171
  );
172
172
  const targetId = entity[foreignKey];