@e22m4u/js-repository 0.4.0 → 0.5.1

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 (88) hide show
  1. package/README.md +569 -80
  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-definition.d.ts +3 -3
  27. package/src/definition/model/properties/property-transformer/builtin/index.d.ts +0 -1
  28. package/src/definition/model/properties/property-transformer/builtin/index.js +0 -1
  29. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.d.ts +1 -1
  30. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js +1 -1
  31. package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.spec.js +1 -1
  32. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.d.ts +1 -1
  33. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js +1 -1
  34. package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.spec.js +1 -1
  35. package/src/definition/model/properties/property-transformer/builtin/trim-transformer.js +1 -1
  36. package/src/definition/model/properties/property-transformer/builtin/trim-transformer.spec.js +1 -1
  37. package/src/definition/model/properties/property-transformer/property-transformer-registry.js +2 -4
  38. package/src/definition/model/properties/property-transformer/property-transformer-registry.spec.js +2 -4
  39. package/src/definition/model/properties/property-transformer/property-transformer.d.ts +2 -2
  40. package/src/definition/model/properties/property-uniqueness-validator.js +4 -4
  41. package/src/definition/model/properties/property-uniqueness-validator.spec.js +4 -4
  42. package/src/definition/model/properties/property-validator/builtin/max-length-validator.d.ts +1 -1
  43. package/src/definition/model/properties/property-validator/builtin/max-length-validator.js +2 -2
  44. package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js +2 -2
  45. package/src/definition/model/properties/property-validator/builtin/min-length-validator.d.ts +1 -1
  46. package/src/definition/model/properties/property-validator/builtin/min-length-validator.js +2 -2
  47. package/src/definition/model/properties/property-validator/builtin/min-length-validator.spec.js +2 -2
  48. package/src/definition/model/properties/property-validator/builtin/regexp-validator.d.ts +1 -1
  49. package/src/definition/model/properties/property-validator/builtin/regexp-validator.js +2 -2
  50. package/src/definition/model/properties/property-validator/builtin/regexp-validator.spec.js +2 -2
  51. package/src/definition/model/properties/property-validator/property-validator-registry.js +2 -2
  52. package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +2 -2
  53. package/src/definition/model/properties/property-validator/property-validator.d.ts +2 -2
  54. package/src/definition/model/relations/relation-definition.d.ts +21 -21
  55. package/src/definition/model/relations/relations-definition-validator.js +23 -23
  56. package/src/definition/model/relations/relations-definition-validator.spec.js +24 -24
  57. package/src/errors/invalid-operator-value-error.js +1 -1
  58. package/src/errors/invalid-operator-value-error.spec.js +1 -1
  59. package/src/filter/fields-clause-tool.js +5 -5
  60. package/src/filter/fields-clause-tool.spec.js +16 -16
  61. package/src/filter/include-clause-tool.js +6 -6
  62. package/src/filter/include-clause-tool.spec.js +2 -2
  63. package/src/filter/operator-clause-tool.js +13 -13
  64. package/src/filter/operator-clause-tool.spec.js +13 -13
  65. package/src/filter/order-clause-tool.js +3 -3
  66. package/src/filter/order-clause-tool.spec.js +4 -4
  67. package/src/filter/slice-clause-tool.js +5 -5
  68. package/src/filter/slice-clause-tool.spec.js +5 -5
  69. package/src/filter/where-clause-tool.js +4 -4
  70. package/src/filter/where-clause-tool.spec.js +3 -3
  71. package/src/relations/belongs-to-resolver.js +14 -14
  72. package/src/relations/belongs-to-resolver.spec.js +14 -14
  73. package/src/relations/has-many-resolver.js +22 -22
  74. package/src/relations/has-many-resolver.spec.js +23 -23
  75. package/src/relations/has-one-resolver.js +22 -22
  76. package/src/relations/has-one-resolver.spec.js +23 -23
  77. package/src/relations/references-many-resolver.js +7 -7
  78. package/src/relations/references-many-resolver.spec.js +7 -7
  79. package/src/repository/repository-registry.js +1 -1
  80. package/src/utils/exclude-object-keys.js +1 -1
  81. package/src/utils/exclude-object-keys.spec.js +1 -1
  82. package/src/utils/model-name-to-model-key.js +1 -1
  83. package/src/utils/model-name-to-model-key.spec.js +7 -7
  84. package/src/utils/select-object-keys.js +3 -3
  85. package/src/utils/select-object-keys.spec.js +3 -3
  86. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.d.ts +0 -6
  87. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js +0 -22
  88. package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.spec.js +0 -41
@@ -31,37 +31,37 @@ export class HasOneResolver extends Service {
31
31
  if (!entities || !Array.isArray(entities))
32
32
  throw new InvalidArgumentError(
33
33
  'The parameter "entities" of HasOneResolver.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 HasOneResolver.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 HasOneResolver.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 HasOneResolver.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 parameter "foreignKey" of HasOneResolver.includeTo requires ' +
58
- 'a non-empty String, but %v given.',
58
+ 'a non-empty 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 HasOneResolver.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
 
@@ -74,7 +74,7 @@ export class HasOneResolver extends Service {
74
74
  if (!entity || typeof entity !== 'object' || Array.isArray(entity))
75
75
  throw new InvalidArgumentError(
76
76
  'The parameter "entities" of HasOneResolver.includeTo requires ' +
77
- 'an Array of Object, but %v given.',
77
+ 'an Array of Object, but %v was given.',
78
78
  entity,
79
79
  );
80
80
  const sourceId = entity[sourcePkPropName];
@@ -131,43 +131,43 @@ export class HasOneResolver extends Service {
131
131
  if (!entities || !Array.isArray(entities))
132
132
  throw new InvalidArgumentError(
133
133
  'The parameter "entities" of HasOneResolver.includePolymorphicTo requires ' +
134
- 'an Array of Object, but %v given.',
134
+ 'an Array of Object, but %v was given.',
135
135
  entities,
136
136
  );
137
137
  if (!sourceName || typeof sourceName !== 'string')
138
138
  throw new InvalidArgumentError(
139
139
  'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires ' +
140
- 'a non-empty String, but %v given.',
140
+ 'a non-empty String, but %v was given.',
141
141
  sourceName,
142
142
  );
143
143
  if (!targetName || typeof targetName !== 'string')
144
144
  throw new InvalidArgumentError(
145
145
  'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires ' +
146
- 'a non-empty String, but %v given.',
146
+ 'a non-empty String, but %v was given.',
147
147
  targetName,
148
148
  );
149
149
  if (!relationName || typeof relationName !== 'string')
150
150
  throw new InvalidArgumentError(
151
151
  'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires ' +
152
- 'a non-empty String, but %v given.',
152
+ 'a non-empty String, but %v was given.',
153
153
  relationName,
154
154
  );
155
155
  if (!foreignKey || typeof foreignKey !== 'string')
156
156
  throw new InvalidArgumentError(
157
157
  'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires ' +
158
- 'a non-empty String, but %v given.',
158
+ 'a non-empty String, but %v was given.',
159
159
  foreignKey,
160
160
  );
161
161
  if (!discriminator || typeof discriminator !== 'string')
162
162
  throw new InvalidArgumentError(
163
163
  'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires ' +
164
- 'a non-empty String, but %v given.',
164
+ 'a non-empty String, but %v was given.',
165
165
  discriminator,
166
166
  );
167
167
  if (scope && (typeof scope !== 'object' || Array.isArray(scope)))
168
168
  throw new InvalidArgumentError(
169
169
  'The provided parameter "scope" of HasOneResolver.includePolymorphicTo ' +
170
- 'should be an Object, but %v given.',
170
+ 'should be an Object, but %v was given.',
171
171
  scope,
172
172
  );
173
173
 
@@ -180,7 +180,7 @@ export class HasOneResolver extends Service {
180
180
  if (!entity || typeof entity !== 'object' || Array.isArray(entity))
181
181
  throw new InvalidArgumentError(
182
182
  'The parameter "entities" of HasOneResolver.includePolymorphicTo requires ' +
183
- 'an Array of Object, but %v given.',
183
+ 'an Array of Object, but %v was given.',
184
184
  entity,
185
185
  );
186
186
  const sourceId = entity[sourcePkPropName];
@@ -238,37 +238,37 @@ export class HasOneResolver extends Service {
238
238
  if (!entities || !Array.isArray(entities))
239
239
  throw new InvalidArgumentError(
240
240
  'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires ' +
241
- 'an Array of Object, but %v given.',
241
+ 'an Array of Object, but %v was given.',
242
242
  entities,
243
243
  );
244
244
  if (!sourceName || typeof sourceName !== 'string')
245
245
  throw new InvalidArgumentError(
246
246
  'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires ' +
247
- 'a non-empty String, but %v given.',
247
+ 'a non-empty String, but %v was given.',
248
248
  sourceName,
249
249
  );
250
250
  if (!targetName || typeof targetName !== 'string')
251
251
  throw new InvalidArgumentError(
252
252
  'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires ' +
253
- 'a non-empty String, but %v given.',
253
+ 'a non-empty String, but %v was given.',
254
254
  targetName,
255
255
  );
256
256
  if (!relationName || typeof relationName !== 'string')
257
257
  throw new InvalidArgumentError(
258
258
  'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires ' +
259
- 'a non-empty String, but %v given.',
259
+ 'a non-empty String, but %v was given.',
260
260
  relationName,
261
261
  );
262
262
  if (!targetRelationName || typeof targetRelationName !== 'string')
263
263
  throw new InvalidArgumentError(
264
264
  'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires ' +
265
- 'a non-empty String, but %v given.',
265
+ 'a non-empty String, but %v was given.',
266
266
  targetRelationName,
267
267
  );
268
268
  if (scope && (typeof scope !== 'object' || Array.isArray(scope)))
269
269
  throw new InvalidArgumentError(
270
270
  'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName ' +
271
- 'should be an Object, but %v given.',
271
+ 'should be an Object, but %v was given.',
272
272
  scope,
273
273
  );
274
274
 
@@ -279,7 +279,7 @@ export class HasOneResolver extends Service {
279
279
  throw new InvalidArgumentError(
280
280
  'The relation %v of the model %v is a polymorphic "hasOne" relation, ' +
281
281
  'so it requires the target relation %v to be a polymorphic "belongsTo", ' +
282
- 'but %v type given.',
282
+ 'but %v type was given.',
283
283
  relationName,
284
284
  sourceName,
285
285
  targetRelationName,
@@ -14,7 +14,7 @@ describe('HasOneResolver', function () {
14
14
  const error = v =>
15
15
  format(
16
16
  'The parameter "entities" of HasOneResolver.includeTo requires ' +
17
- 'an Array of Object, but %s given.',
17
+ 'an Array of Object, but %s was given.',
18
18
  v,
19
19
  );
20
20
  const throwable = v =>
@@ -42,7 +42,7 @@ describe('HasOneResolver', function () {
42
42
  const error = v =>
43
43
  format(
44
44
  'The parameter "entities" of HasOneResolver.includeTo requires ' +
45
- 'an Array of Object, but %s given.',
45
+ 'an Array of Object, but %s was given.',
46
46
  v,
47
47
  );
48
48
  const throwable = v =>
@@ -63,7 +63,7 @@ describe('HasOneResolver', function () {
63
63
  const error = v =>
64
64
  format(
65
65
  'The parameter "sourceName" of HasOneResolver.includeTo requires ' +
66
- 'a non-empty String, but %s given.',
66
+ 'a non-empty String, but %s was given.',
67
67
  v,
68
68
  );
69
69
  const throwable = v =>
@@ -84,7 +84,7 @@ describe('HasOneResolver', function () {
84
84
  const error = v =>
85
85
  format(
86
86
  'The parameter "targetName" of HasOneResolver.includeTo requires ' +
87
- 'a non-empty String, but %s given.',
87
+ 'a non-empty String, but %s was given.',
88
88
  v,
89
89
  );
90
90
  const throwable = v =>
@@ -105,7 +105,7 @@ describe('HasOneResolver', function () {
105
105
  const error = v =>
106
106
  format(
107
107
  'The parameter "relationName" of HasOneResolver.includeTo requires ' +
108
- 'a non-empty String, but %s given.',
108
+ 'a non-empty String, but %s was given.',
109
109
  v,
110
110
  );
111
111
  const throwable = v =>
@@ -126,7 +126,7 @@ describe('HasOneResolver', function () {
126
126
  const error = v =>
127
127
  format(
128
128
  'The parameter "foreignKey" of HasOneResolver.includeTo requires ' +
129
- 'a non-empty String, but %s given.',
129
+ 'a non-empty String, but %s was given.',
130
130
  v,
131
131
  );
132
132
  const throwable = v =>
@@ -147,7 +147,7 @@ describe('HasOneResolver', function () {
147
147
  const error = v =>
148
148
  format(
149
149
  'The provided parameter "scope" of HasOneResolver.includeTo ' +
150
- 'should be an Object, but %s given.',
150
+ 'should be an Object, but %s was given.',
151
151
  v,
152
152
  );
153
153
  const throwable = v =>
@@ -557,7 +557,7 @@ describe('HasOneResolver', function () {
557
557
  const error = v =>
558
558
  format(
559
559
  'The parameter "entities" of HasOneResolver.includePolymorphicTo requires ' +
560
- 'an Array of Object, but %s given.',
560
+ 'an Array of Object, but %s was given.',
561
561
  v,
562
562
  );
563
563
  const throwable = v =>
@@ -586,7 +586,7 @@ describe('HasOneResolver', function () {
586
586
  const error = v =>
587
587
  format(
588
588
  'The parameter "entities" of HasOneResolver.includePolymorphicTo requires ' +
589
- 'an Array of Object, but %s given.',
589
+ 'an Array of Object, but %s was given.',
590
590
  v,
591
591
  );
592
592
  const throwable = v =>
@@ -614,7 +614,7 @@ describe('HasOneResolver', function () {
614
614
  const error = v =>
615
615
  format(
616
616
  'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires ' +
617
- 'a non-empty String, but %s given.',
617
+ 'a non-empty String, but %s was given.',
618
618
  v,
619
619
  );
620
620
  const throwable = v =>
@@ -642,7 +642,7 @@ describe('HasOneResolver', function () {
642
642
  const error = v =>
643
643
  format(
644
644
  'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires ' +
645
- 'a non-empty String, but %s given.',
645
+ 'a non-empty String, but %s was given.',
646
646
  v,
647
647
  );
648
648
  const throwable = v =>
@@ -670,7 +670,7 @@ describe('HasOneResolver', function () {
670
670
  const error = v =>
671
671
  format(
672
672
  'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires ' +
673
- 'a non-empty String, but %s given.',
673
+ 'a non-empty String, but %s was given.',
674
674
  v,
675
675
  );
676
676
  const throwable = v =>
@@ -698,7 +698,7 @@ describe('HasOneResolver', function () {
698
698
  const error = v =>
699
699
  format(
700
700
  'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires ' +
701
- 'a non-empty String, but %s given.',
701
+ 'a non-empty String, but %s was given.',
702
702
  v,
703
703
  );
704
704
  const throwable = v =>
@@ -726,7 +726,7 @@ describe('HasOneResolver', function () {
726
726
  const error = v =>
727
727
  format(
728
728
  'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires ' +
729
- 'a non-empty String, but %s given.',
729
+ 'a non-empty String, but %s was given.',
730
730
  v,
731
731
  );
732
732
  const throwable = v =>
@@ -754,7 +754,7 @@ describe('HasOneResolver', function () {
754
754
  const error = v =>
755
755
  format(
756
756
  'The provided parameter "scope" of HasOneResolver.includePolymorphicTo ' +
757
- 'should be an Object, but %s given.',
757
+ 'should be an Object, but %s was given.',
758
758
  v,
759
759
  );
760
760
  const throwable = v =>
@@ -1307,7 +1307,7 @@ describe('HasOneResolver', function () {
1307
1307
  const error = v =>
1308
1308
  format(
1309
1309
  'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires ' +
1310
- 'an Array of Object, but %s given.',
1310
+ 'an Array of Object, but %s was given.',
1311
1311
  v,
1312
1312
  );
1313
1313
  const throwable = v =>
@@ -1344,7 +1344,7 @@ describe('HasOneResolver', function () {
1344
1344
  const error = v =>
1345
1345
  format(
1346
1346
  'The parameter "entities" of HasOneResolver.includePolymorphicTo requires ' +
1347
- 'an Array of Object, but %s given.',
1347
+ 'an Array of Object, but %s was given.',
1348
1348
  v,
1349
1349
  );
1350
1350
  const throwable = v =>
@@ -1371,7 +1371,7 @@ describe('HasOneResolver', function () {
1371
1371
  const error = v =>
1372
1372
  format(
1373
1373
  'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires ' +
1374
- 'a non-empty String, but %s given.',
1374
+ 'a non-empty String, but %s was given.',
1375
1375
  v,
1376
1376
  );
1377
1377
  const throwable = v =>
@@ -1398,7 +1398,7 @@ describe('HasOneResolver', function () {
1398
1398
  const error = v =>
1399
1399
  format(
1400
1400
  'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires ' +
1401
- 'a non-empty String, but %s given.',
1401
+ 'a non-empty String, but %s was given.',
1402
1402
  v,
1403
1403
  );
1404
1404
  const throwable = v =>
@@ -1425,7 +1425,7 @@ describe('HasOneResolver', function () {
1425
1425
  const error = v =>
1426
1426
  format(
1427
1427
  'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires ' +
1428
- 'a non-empty String, but %s given.',
1428
+ 'a non-empty String, but %s was given.',
1429
1429
  v,
1430
1430
  );
1431
1431
  const throwable = v =>
@@ -1452,7 +1452,7 @@ describe('HasOneResolver', function () {
1452
1452
  const error = v =>
1453
1453
  format(
1454
1454
  'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires ' +
1455
- 'a non-empty String, but %s given.',
1455
+ 'a non-empty String, but %s was given.',
1456
1456
  v,
1457
1457
  );
1458
1458
  const throwable = v =>
@@ -1479,7 +1479,7 @@ describe('HasOneResolver', function () {
1479
1479
  const error = v =>
1480
1480
  format(
1481
1481
  'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName ' +
1482
- 'should be an Object, but %s given.',
1482
+ 'should be an Object, but %s was given.',
1483
1483
  v,
1484
1484
  );
1485
1485
  const throwable = v =>
@@ -1556,7 +1556,7 @@ describe('HasOneResolver', function () {
1556
1556
  await expect(promise).to.be.rejectedWith(
1557
1557
  'The relation "child" of the model "source" is a polymorphic "hasOne" relation, ' +
1558
1558
  'so it requires the target relation "parent" to be a polymorphic "belongsTo", ' +
1559
- 'but "referencesMany" type given.',
1559
+ 'but "referencesMany" type was given.',
1560
1560
  );
1561
1561
  });
1562
1562
 
@@ -31,37 +31,37 @@ export class ReferencesManyResolver extends Service {
31
31
  if (!entities || !Array.isArray(entities))
32
32
  throw new InvalidArgumentError(
33
33
  'The parameter "entities" of ReferencesManyResolver.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 ReferencesManyResolver.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 ReferencesManyResolver.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 ReferencesManyResolver.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 ReferencesManyResolver.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 ReferencesManyResolver.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) {
@@ -72,7 +72,7 @@ export class ReferencesManyResolver extends Service {
72
72
  if (!entity || typeof entity !== 'object' || Array.isArray(entity))
73
73
  throw new InvalidArgumentError(
74
74
  'The parameter "entities" of ReferencesManyResolver.includeTo requires ' +
75
- 'an Array of Object, but %v given.',
75
+ 'an Array of Object, but %v was given.',
76
76
  entity,
77
77
  );
78
78
  const ids = entity[foreignKey];
@@ -14,7 +14,7 @@ describe('ReferencesManyResolver', function () {
14
14
  const error = v =>
15
15
  format(
16
16
  'The parameter "entities" of ReferencesManyResolver.includeTo requires ' +
17
- 'an Array of Object, but %s given.',
17
+ 'an Array of Object, but %s was given.',
18
18
  v,
19
19
  );
20
20
  const throwable = v =>
@@ -35,7 +35,7 @@ describe('ReferencesManyResolver', function () {
35
35
  const error = v =>
36
36
  format(
37
37
  'The parameter "entities" of ReferencesManyResolver.includeTo requires ' +
38
- 'an Array of Object, but %s given.',
38
+ 'an Array of Object, but %s was given.',
39
39
  v,
40
40
  );
41
41
  const throwable = v =>
@@ -56,7 +56,7 @@ describe('ReferencesManyResolver', function () {
56
56
  const error = v =>
57
57
  format(
58
58
  'The parameter "sourceName" of ReferencesManyResolver.includeTo requires ' +
59
- 'a non-empty String, but %s given.',
59
+ 'a non-empty String, but %s was given.',
60
60
  v,
61
61
  );
62
62
  const throwable = v => R.includeTo([], v, 'targetName', 'relationName');
@@ -76,7 +76,7 @@ describe('ReferencesManyResolver', function () {
76
76
  const error = v =>
77
77
  format(
78
78
  'The parameter "targetName" of ReferencesManyResolver.includeTo requires ' +
79
- 'a non-empty String, but %s given.',
79
+ 'a non-empty String, but %s was given.',
80
80
  v,
81
81
  );
82
82
  const throwable = v => R.includeTo([], 'sourceName', v, 'relationName');
@@ -96,7 +96,7 @@ describe('ReferencesManyResolver', function () {
96
96
  const error = v =>
97
97
  format(
98
98
  'The parameter "relationName" of ReferencesManyResolver.includeTo requires ' +
99
- 'a non-empty String, but %s given.',
99
+ 'a non-empty String, but %s was given.',
100
100
  v,
101
101
  );
102
102
  const throwable = v => R.includeTo([], 'sourceName', 'targetName', v);
@@ -116,7 +116,7 @@ describe('ReferencesManyResolver', function () {
116
116
  const error = v =>
117
117
  format(
118
118
  'The provided parameter "foreignKey" of ReferencesManyResolver.includeTo ' +
119
- 'should be a String, but %s given.',
119
+ 'should be a String, but %s was given.',
120
120
  v,
121
121
  );
122
122
  const throwable = v =>
@@ -133,7 +133,7 @@ describe('ReferencesManyResolver', function () {
133
133
  const error = v =>
134
134
  format(
135
135
  'The provided parameter "scope" of ReferencesManyResolver.includeTo ' +
136
- 'should be an Object, but %s given.',
136
+ 'should be an Object, but %s was given.',
137
137
  v,
138
138
  );
139
139
  const throwable = v =>
@@ -35,7 +35,7 @@ export class RepositoryRegistry extends Service {
35
35
  ) {
36
36
  throw new InvalidArgumentError(
37
37
  'The first argument of RepositoryRegistry.setRepositoryCtor ' +
38
- 'must inherit from Repository class, but %v given.',
38
+ 'must inherit from Repository class, but %v was given.',
39
39
  ctor,
40
40
  );
41
41
  }
@@ -10,7 +10,7 @@ import {InvalidArgumentError} from '../errors/index.js';
10
10
  export function excludeObjectKeys(obj, keys) {
11
11
  if (typeof obj !== 'object' || !obj || Array.isArray(obj))
12
12
  throw new InvalidArgumentError(
13
- 'Cannot exclude keys from a non-Object value, %v given.',
13
+ 'Cannot exclude keys from a non-Object value, %v was given.',
14
14
  obj,
15
15
  );
16
16
  const result = {...obj};
@@ -37,7 +37,7 @@ describe('excludeObjectKeys', function () {
37
37
  it('throws an error for a non-object values', function () {
38
38
  const throwable = v => () => excludeObjectKeys(v, 'key');
39
39
  const error = v =>
40
- format('Cannot exclude keys from a non-Object value, %s given.', v);
40
+ format('Cannot exclude keys from a non-Object value, %s was given.', v);
41
41
  expect(throwable('str')).to.throw(error('"str"'));
42
42
  expect(throwable(10)).to.throw(error('10'));
43
43
  expect(throwable(true)).to.throw(error('true'));
@@ -10,7 +10,7 @@ export function modelNameToModelKey(modelName) {
10
10
  if (!modelName || typeof modelName !== 'string' || /\s/.test(modelName))
11
11
  throw new InvalidArgumentError(
12
12
  'The model name should be a non-empty String ' +
13
- 'without spaces, but %v given.',
13
+ 'without spaces, but %v was given.',
14
14
  modelName,
15
15
  );
16
16
  return modelName.toLowerCase().replace(/[-_]/g, '');
@@ -38,7 +38,7 @@ describe('modelNameToModelKey', function () {
38
38
  const throwable = () => modelNameToModelKey('');
39
39
  expect(throwable).to.throw(
40
40
  'The model name should be a non-empty String ' +
41
- 'without spaces, but "" given.',
41
+ 'without spaces, but "" was given.',
42
42
  );
43
43
  });
44
44
 
@@ -46,7 +46,7 @@ describe('modelNameToModelKey', function () {
46
46
  const throwable = () => modelNameToModelKey('user profile');
47
47
  expect(throwable).to.throw(
48
48
  'The model name should be a non-empty String ' +
49
- 'without spaces, but "user profile" given.',
49
+ 'without spaces, but "user profile" was given.',
50
50
  );
51
51
  });
52
52
 
@@ -54,7 +54,7 @@ describe('modelNameToModelKey', function () {
54
54
  const throwable = () => modelNameToModelKey(null);
55
55
  expect(throwable).to.throw(
56
56
  'The model name should be a non-empty String ' +
57
- 'without spaces, but null given.',
57
+ 'without spaces, but null was given.',
58
58
  );
59
59
  });
60
60
 
@@ -62,7 +62,7 @@ describe('modelNameToModelKey', function () {
62
62
  const throwable = () => modelNameToModelKey(undefined);
63
63
  expect(throwable).to.throw(
64
64
  'The model name should be a non-empty String ' +
65
- 'without spaces, but undefined given.',
65
+ 'without spaces, but undefined was given.',
66
66
  );
67
67
  });
68
68
 
@@ -70,7 +70,7 @@ describe('modelNameToModelKey', function () {
70
70
  const throwable = () => modelNameToModelKey(123);
71
71
  expect(throwable).to.throw(
72
72
  'The model name should be a non-empty String ' +
73
- 'without spaces, but 123 given.',
73
+ 'without spaces, but 123 was given.',
74
74
  );
75
75
  });
76
76
 
@@ -78,7 +78,7 @@ describe('modelNameToModelKey', function () {
78
78
  const throwable = () => modelNameToModelKey({name: 'test'});
79
79
  expect(throwable).to.throw(
80
80
  'The model name should be a non-empty String ' +
81
- 'without spaces, but Object given.',
81
+ 'without spaces, but Object was given.',
82
82
  );
83
83
  });
84
84
 
@@ -86,7 +86,7 @@ describe('modelNameToModelKey', function () {
86
86
  const throwable = () => modelNameToModelKey(['test']);
87
87
  expect(throwable).to.throw(
88
88
  'The model name should be a non-empty String ' +
89
- 'without spaces, but Array given.',
89
+ 'without spaces, but Array was given.',
90
90
  );
91
91
  });
92
92
  });
@@ -11,20 +11,20 @@ export function selectObjectKeys(obj, keys) {
11
11
  if (!obj || typeof obj !== 'object' || Array.isArray(obj))
12
12
  throw new InvalidArgumentError(
13
13
  'The first argument of selectObjectKeys ' +
14
- 'should be an Object, but %v given.',
14
+ 'should be an Object, but %v was given.',
15
15
  obj,
16
16
  );
17
17
  if (!Array.isArray(keys))
18
18
  throw new InvalidArgumentError(
19
19
  'The second argument of selectObjectKeys ' +
20
- 'should be an Array of String, but %v given.',
20
+ 'should be an Array of String, but %v was given.',
21
21
  keys,
22
22
  );
23
23
  keys.forEach(key => {
24
24
  if (typeof key !== 'string')
25
25
  throw new InvalidArgumentError(
26
26
  'The second argument of selectObjectKeys ' +
27
- 'should be an Array of String, but %v given.',
27
+ 'should be an Array of String, but %v was given.',
28
28
  key,
29
29
  );
30
30
  });
@@ -18,7 +18,7 @@ describe('selectObjectKeys', function () {
18
18
  const throwable = () => selectObjectKeys(10, ['key']);
19
19
  expect(throwable).to.throw(
20
20
  'The first argument of selectObjectKeys ' +
21
- 'should be an Object, but 10 given.',
21
+ 'should be an Object, but 10 was given.',
22
22
  );
23
23
  });
24
24
 
@@ -26,7 +26,7 @@ describe('selectObjectKeys', function () {
26
26
  const throwable = () => selectObjectKeys({});
27
27
  expect(throwable).to.throw(
28
28
  'The second argument of selectObjectKeys ' +
29
- 'should be an Array of String, but undefined given.',
29
+ 'should be an Array of String, but undefined was given.',
30
30
  );
31
31
  });
32
32
 
@@ -34,7 +34,7 @@ describe('selectObjectKeys', function () {
34
34
  const throwable = () => selectObjectKeys({}, [10]);
35
35
  expect(throwable).to.throw(
36
36
  'The second argument of selectObjectKeys ' +
37
- 'should be an Array of String, but 10 given.',
37
+ 'should be an Array of String, but 10 was given.',
38
38
  );
39
39
  });
40
40
  });
@@ -1,6 +0,0 @@
1
- import {PropertyTransformer} from '../property-transformer.js';
2
-
3
- /**
4
- * To title case transformer.
5
- */
6
- export declare type toTitleCaseTransformer = PropertyTransformer;
@@ -1,22 +0,0 @@
1
- import {InvalidArgumentError} from '../../../../../errors/index.js';
2
-
3
- /**
4
- * To title case transformer.
5
- *
6
- * @param {*} value
7
- * @param {undefined} options
8
- * @param {object} context
9
- * @returns {string|undefined|null}
10
- */
11
- export function toTitleCaseTransformer(value, options, context) {
12
- if (value == null) return value;
13
- if (typeof value === 'string')
14
- return value.replace(/\p{L}\S*/gu, text => {
15
- return text.charAt(0).toUpperCase() + text.substring(1).toLowerCase();
16
- });
17
- throw new InvalidArgumentError(
18
- 'The property transformer %v requires a String value, but %v given.',
19
- context.transformerName,
20
- value,
21
- );
22
- }