@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.
- package/README.md +569 -80
- package/dist/cjs/index.cjs +319 -270
- package/package.json +1 -1
- package/src/adapter/adapter-loader.js +1 -1
- package/src/adapter/adapter-loader.spec.js +1 -1
- package/src/adapter/decorator/data-sanitizing-decorator.js +1 -1
- package/src/adapter/decorator/data-transformation-decorator.js +1 -1
- package/src/adapter/decorator/data-validation-decorator.js +1 -1
- package/src/adapter/decorator/default-values-decorator.js +1 -1
- package/src/adapter/decorator/fields-filtering-decorator.js +1 -1
- package/src/adapter/decorator/inclusion-decorator.js +1 -1
- package/src/adapter/decorator/property-uniqueness-decorator.js +1 -1
- package/src/definition/datasource/datasource-definition-validator.js +3 -3
- package/src/definition/datasource/datasource-definition-validator.spec.js +3 -3
- package/src/definition/model/model-data-sanitizer.js +2 -2
- package/src/definition/model/model-data-transformer.js +71 -13
- package/src/definition/model/model-data-transformer.spec.js +2073 -407
- package/src/definition/model/model-data-validator.js +125 -37
- package/src/definition/model/model-data-validator.spec.js +2138 -440
- package/src/definition/model/model-definition-utils.js +5 -5
- package/src/definition/model/model-definition-utils.spec.js +7 -7
- package/src/definition/model/model-definition-validator.js +7 -7
- package/src/definition/model/model-definition-validator.spec.js +10 -7
- package/src/definition/model/properties/properties-definition-validator.js +129 -54
- package/src/definition/model/properties/properties-definition-validator.spec.js +85 -25
- package/src/definition/model/properties/property-definition.d.ts +3 -3
- package/src/definition/model/properties/property-transformer/builtin/index.d.ts +0 -1
- package/src/definition/model/properties/property-transformer/builtin/index.js +0 -1
- package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.d.ts +1 -1
- package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js +1 -1
- package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.spec.js +1 -1
- package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.d.ts +1 -1
- package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js +1 -1
- package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.spec.js +1 -1
- package/src/definition/model/properties/property-transformer/builtin/trim-transformer.js +1 -1
- package/src/definition/model/properties/property-transformer/builtin/trim-transformer.spec.js +1 -1
- package/src/definition/model/properties/property-transformer/property-transformer-registry.js +2 -4
- package/src/definition/model/properties/property-transformer/property-transformer-registry.spec.js +2 -4
- package/src/definition/model/properties/property-transformer/property-transformer.d.ts +2 -2
- package/src/definition/model/properties/property-uniqueness-validator.js +4 -4
- package/src/definition/model/properties/property-uniqueness-validator.spec.js +4 -4
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.d.ts +1 -1
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.js +2 -2
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js +2 -2
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.d.ts +1 -1
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.js +2 -2
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.spec.js +2 -2
- package/src/definition/model/properties/property-validator/builtin/regexp-validator.d.ts +1 -1
- package/src/definition/model/properties/property-validator/builtin/regexp-validator.js +2 -2
- package/src/definition/model/properties/property-validator/builtin/regexp-validator.spec.js +2 -2
- package/src/definition/model/properties/property-validator/property-validator-registry.js +2 -2
- package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +2 -2
- package/src/definition/model/properties/property-validator/property-validator.d.ts +2 -2
- package/src/definition/model/relations/relation-definition.d.ts +21 -21
- package/src/definition/model/relations/relations-definition-validator.js +23 -23
- package/src/definition/model/relations/relations-definition-validator.spec.js +24 -24
- package/src/errors/invalid-operator-value-error.js +1 -1
- package/src/errors/invalid-operator-value-error.spec.js +1 -1
- package/src/filter/fields-clause-tool.js +5 -5
- package/src/filter/fields-clause-tool.spec.js +16 -16
- package/src/filter/include-clause-tool.js +6 -6
- package/src/filter/include-clause-tool.spec.js +2 -2
- package/src/filter/operator-clause-tool.js +13 -13
- package/src/filter/operator-clause-tool.spec.js +13 -13
- package/src/filter/order-clause-tool.js +3 -3
- package/src/filter/order-clause-tool.spec.js +4 -4
- package/src/filter/slice-clause-tool.js +5 -5
- package/src/filter/slice-clause-tool.spec.js +5 -5
- package/src/filter/where-clause-tool.js +4 -4
- package/src/filter/where-clause-tool.spec.js +3 -3
- package/src/relations/belongs-to-resolver.js +14 -14
- package/src/relations/belongs-to-resolver.spec.js +14 -14
- package/src/relations/has-many-resolver.js +22 -22
- package/src/relations/has-many-resolver.spec.js +23 -23
- package/src/relations/has-one-resolver.js +22 -22
- package/src/relations/has-one-resolver.spec.js +23 -23
- package/src/relations/references-many-resolver.js +7 -7
- package/src/relations/references-many-resolver.spec.js +7 -7
- package/src/repository/repository-registry.js +1 -1
- package/src/utils/exclude-object-keys.js +1 -1
- package/src/utils/exclude-object-keys.spec.js +1 -1
- package/src/utils/model-name-to-model-key.js +1 -1
- package/src/utils/model-name-to-model-key.spec.js +7 -7
- package/src/utils/select-object-keys.js +3 -3
- package/src/utils/select-object-keys.spec.js +3 -3
- package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.d.ts +0 -6
- package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js +0 -22
- package/src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.spec.js +0 -41
|
@@ -22,7 +22,7 @@ export class FieldsClauseTool extends Service {
|
|
|
22
22
|
if (!entity || typeof entity !== 'object' || Array.isArray(entity))
|
|
23
23
|
throw new InvalidArgumentError(
|
|
24
24
|
'The first argument of FieldsClauseTool.filter should be an Object or ' +
|
|
25
|
-
'an Array of Object, but %v given.',
|
|
25
|
+
'an Array of Object, but %v was given.',
|
|
26
26
|
entity,
|
|
27
27
|
);
|
|
28
28
|
});
|
|
@@ -30,7 +30,7 @@ export class FieldsClauseTool extends Service {
|
|
|
30
30
|
if (!modelName || typeof modelName !== 'string')
|
|
31
31
|
throw new InvalidArgumentError(
|
|
32
32
|
'The second argument of FieldsClauseTool.filter should be ' +
|
|
33
|
-
'a non-empty String, but %v given.',
|
|
33
|
+
'a non-empty String, but %v was given.',
|
|
34
34
|
modelName,
|
|
35
35
|
);
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ export class FieldsClauseTool extends Service {
|
|
|
42
42
|
if (!field || typeof field !== 'string')
|
|
43
43
|
throw new InvalidArgumentError(
|
|
44
44
|
'The provided option "fields" should be a non-empty String ' +
|
|
45
|
-
'or an Array of non-empty String, but %v given.',
|
|
45
|
+
'or an Array of non-empty String, but %v was given.',
|
|
46
46
|
field,
|
|
47
47
|
);
|
|
48
48
|
});
|
|
@@ -70,7 +70,7 @@ export class FieldsClauseTool extends Service {
|
|
|
70
70
|
if (!field || typeof field !== 'string')
|
|
71
71
|
throw new InvalidArgumentError(
|
|
72
72
|
'The provided option "fields" should be a non-empty String ' +
|
|
73
|
-
'or an Array of non-empty String, but %v given.',
|
|
73
|
+
'or an Array of non-empty String, but %v was given.',
|
|
74
74
|
field,
|
|
75
75
|
);
|
|
76
76
|
});
|
|
@@ -90,7 +90,7 @@ export class FieldsClauseTool extends Service {
|
|
|
90
90
|
if (!field || typeof field !== 'string')
|
|
91
91
|
throw new InvalidArgumentError(
|
|
92
92
|
'The provided option "fields" should be a non-empty String ' +
|
|
93
|
-
'or an Array of non-empty String, but %v given.',
|
|
93
|
+
'or an Array of non-empty String, but %v was given.',
|
|
94
94
|
field,
|
|
95
95
|
);
|
|
96
96
|
});
|
|
@@ -24,7 +24,7 @@ describe('FieldsClauseTool', function () {
|
|
|
24
24
|
const error = v =>
|
|
25
25
|
format(
|
|
26
26
|
'The first argument of FieldsClauseTool.filter should be an Object or ' +
|
|
27
|
-
'an Array of Object, but %s given.',
|
|
27
|
+
'an Array of Object, but %s was given.',
|
|
28
28
|
v,
|
|
29
29
|
);
|
|
30
30
|
expect(throwable('str')).to.throw(error('"str"'));
|
|
@@ -45,7 +45,7 @@ describe('FieldsClauseTool', function () {
|
|
|
45
45
|
const error = v =>
|
|
46
46
|
format(
|
|
47
47
|
'The second argument of FieldsClauseTool.filter should be ' +
|
|
48
|
-
'a non-empty String, but %s given.',
|
|
48
|
+
'a non-empty String, but %s was given.',
|
|
49
49
|
v,
|
|
50
50
|
);
|
|
51
51
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -64,7 +64,7 @@ describe('FieldsClauseTool', function () {
|
|
|
64
64
|
const error = v =>
|
|
65
65
|
format(
|
|
66
66
|
'The provided option "fields" should be a non-empty String ' +
|
|
67
|
-
'or an Array of non-empty String, but %s given.',
|
|
67
|
+
'or an Array of non-empty String, but %s was given.',
|
|
68
68
|
v,
|
|
69
69
|
);
|
|
70
70
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -103,7 +103,7 @@ describe('FieldsClauseTool', function () {
|
|
|
103
103
|
const error = v =>
|
|
104
104
|
format(
|
|
105
105
|
'The first argument of FieldsClauseTool.filter should be an Object or ' +
|
|
106
|
-
'an Array of Object, but %s given.',
|
|
106
|
+
'an Array of Object, but %s was given.',
|
|
107
107
|
v,
|
|
108
108
|
);
|
|
109
109
|
expect(throwable('str')).to.throw(error('"str"'));
|
|
@@ -124,7 +124,7 @@ describe('FieldsClauseTool', function () {
|
|
|
124
124
|
const error = v =>
|
|
125
125
|
format(
|
|
126
126
|
'The second argument of FieldsClauseTool.filter should be ' +
|
|
127
|
-
'a non-empty String, but %s given.',
|
|
127
|
+
'a non-empty String, but %s was given.',
|
|
128
128
|
v,
|
|
129
129
|
);
|
|
130
130
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -143,7 +143,7 @@ describe('FieldsClauseTool', function () {
|
|
|
143
143
|
const error = v =>
|
|
144
144
|
format(
|
|
145
145
|
'The provided option "fields" should be a non-empty String ' +
|
|
146
|
-
'or an Array of non-empty String, but %s given.',
|
|
146
|
+
'or an Array of non-empty String, but %s was given.',
|
|
147
147
|
v,
|
|
148
148
|
);
|
|
149
149
|
expect(throwable([''])).to.throw(error('""'));
|
|
@@ -189,7 +189,7 @@ describe('FieldsClauseTool', function () {
|
|
|
189
189
|
const error = v =>
|
|
190
190
|
format(
|
|
191
191
|
'The first argument of FieldsClauseTool.filter should be an Object or ' +
|
|
192
|
-
'an Array of Object, but %s given.',
|
|
192
|
+
'an Array of Object, but %s was given.',
|
|
193
193
|
v,
|
|
194
194
|
);
|
|
195
195
|
expect(throwable(['str'])).to.throw(error('"str"'));
|
|
@@ -216,7 +216,7 @@ describe('FieldsClauseTool', function () {
|
|
|
216
216
|
const error = v =>
|
|
217
217
|
format(
|
|
218
218
|
'The second argument of FieldsClauseTool.filter should be ' +
|
|
219
|
-
'a non-empty String, but %s given.',
|
|
219
|
+
'a non-empty String, but %s was given.',
|
|
220
220
|
v,
|
|
221
221
|
);
|
|
222
222
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -243,7 +243,7 @@ describe('FieldsClauseTool', function () {
|
|
|
243
243
|
const error = v =>
|
|
244
244
|
format(
|
|
245
245
|
'The provided option "fields" should be a non-empty String ' +
|
|
246
|
-
'or an Array of non-empty String, but %s given.',
|
|
246
|
+
'or an Array of non-empty String, but %s was given.',
|
|
247
247
|
v,
|
|
248
248
|
);
|
|
249
249
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -306,7 +306,7 @@ describe('FieldsClauseTool', function () {
|
|
|
306
306
|
const error = v =>
|
|
307
307
|
format(
|
|
308
308
|
'The first argument of FieldsClauseTool.filter should be an Object or ' +
|
|
309
|
-
'an Array of Object, but %s given.',
|
|
309
|
+
'an Array of Object, but %s was given.',
|
|
310
310
|
v,
|
|
311
311
|
);
|
|
312
312
|
expect(throwable(['str'])).to.throw(error('"str"'));
|
|
@@ -333,7 +333,7 @@ describe('FieldsClauseTool', function () {
|
|
|
333
333
|
const error = v =>
|
|
334
334
|
format(
|
|
335
335
|
'The second argument of FieldsClauseTool.filter should be ' +
|
|
336
|
-
'a non-empty String, but %s given.',
|
|
336
|
+
'a non-empty String, but %s was given.',
|
|
337
337
|
v,
|
|
338
338
|
);
|
|
339
339
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -360,7 +360,7 @@ describe('FieldsClauseTool', function () {
|
|
|
360
360
|
const error = v =>
|
|
361
361
|
format(
|
|
362
362
|
'The provided option "fields" should be a non-empty String ' +
|
|
363
|
-
'or an Array of non-empty String, but %s given.',
|
|
363
|
+
'or an Array of non-empty String, but %s was given.',
|
|
364
364
|
v,
|
|
365
365
|
);
|
|
366
366
|
expect(throwable([''])).to.throw(error('""'));
|
|
@@ -414,7 +414,7 @@ describe('FieldsClauseTool', function () {
|
|
|
414
414
|
const error = v =>
|
|
415
415
|
format(
|
|
416
416
|
'The provided option "fields" should be a non-empty String ' +
|
|
417
|
-
'or an Array of non-empty String, but %s given.',
|
|
417
|
+
'or an Array of non-empty String, but %s was given.',
|
|
418
418
|
v,
|
|
419
419
|
);
|
|
420
420
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -435,7 +435,7 @@ describe('FieldsClauseTool', function () {
|
|
|
435
435
|
const error = v =>
|
|
436
436
|
format(
|
|
437
437
|
'The provided option "fields" should be a non-empty String ' +
|
|
438
|
-
'or an Array of non-empty String, but %s given.',
|
|
438
|
+
'or an Array of non-empty String, but %s was given.',
|
|
439
439
|
v,
|
|
440
440
|
);
|
|
441
441
|
expect(throwable([''])).to.throw(error('""'));
|
|
@@ -460,7 +460,7 @@ describe('FieldsClauseTool', function () {
|
|
|
460
460
|
const error = v =>
|
|
461
461
|
format(
|
|
462
462
|
'The provided option "fields" should be a non-empty String ' +
|
|
463
|
-
'or an Array of non-empty String, but %s given.',
|
|
463
|
+
'or an Array of non-empty String, but %s was given.',
|
|
464
464
|
v,
|
|
465
465
|
);
|
|
466
466
|
expect(throwable('')).to.throw(error('""'));
|
|
@@ -487,7 +487,7 @@ describe('FieldsClauseTool', function () {
|
|
|
487
487
|
const error = v =>
|
|
488
488
|
format(
|
|
489
489
|
'The provided option "fields" should be a non-empty String ' +
|
|
490
|
-
'or an Array of non-empty String, but %s given.',
|
|
490
|
+
'or an Array of non-empty String, but %s was given.',
|
|
491
491
|
v,
|
|
492
492
|
);
|
|
493
493
|
expect(throwable([''])).to.throw(error('""'));
|
|
@@ -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
|
}
|