@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
|
@@ -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];
|
|
@@ -14,7 +14,7 @@ describe('BelongsToResolver', function () {
|
|
|
14
14
|
const error = v =>
|
|
15
15
|
format(
|
|
16
16
|
'The parameter "entities" of BelongsToResolver.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('BelongsToResolver', function () {
|
|
|
35
35
|
const error = v =>
|
|
36
36
|
format(
|
|
37
37
|
'The parameter "entities" of BelongsToResolver.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('BelongsToResolver', function () {
|
|
|
56
56
|
const error = v =>
|
|
57
57
|
format(
|
|
58
58
|
'The parameter "sourceName" of BelongsToResolver.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('BelongsToResolver', function () {
|
|
|
76
76
|
const error = v =>
|
|
77
77
|
format(
|
|
78
78
|
'The parameter "targetName" of BelongsToResolver.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('BelongsToResolver', function () {
|
|
|
96
96
|
const error = v =>
|
|
97
97
|
format(
|
|
98
98
|
'The parameter "relationName" of BelongsToResolver.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('BelongsToResolver', function () {
|
|
|
116
116
|
const error = v =>
|
|
117
117
|
format(
|
|
118
118
|
'The provided parameter "foreignKey" of BelongsToResolver.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('BelongsToResolver', function () {
|
|
|
133
133
|
const error = v =>
|
|
134
134
|
format(
|
|
135
135
|
'The provided parameter "scope" of BelongsToResolver.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 =>
|
|
@@ -528,7 +528,7 @@ describe('BelongsToResolver', function () {
|
|
|
528
528
|
const error = v =>
|
|
529
529
|
format(
|
|
530
530
|
'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires ' +
|
|
531
|
-
'an Array of Object, but %s given.',
|
|
531
|
+
'an Array of Object, but %s was given.',
|
|
532
532
|
v,
|
|
533
533
|
);
|
|
534
534
|
const throwable = v =>
|
|
@@ -549,7 +549,7 @@ describe('BelongsToResolver', function () {
|
|
|
549
549
|
const error = v =>
|
|
550
550
|
format(
|
|
551
551
|
'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires ' +
|
|
552
|
-
'an Array of Object, but %s given.',
|
|
552
|
+
'an Array of Object, but %s was given.',
|
|
553
553
|
v,
|
|
554
554
|
);
|
|
555
555
|
const throwable = v =>
|
|
@@ -570,7 +570,7 @@ describe('BelongsToResolver', function () {
|
|
|
570
570
|
const error = v =>
|
|
571
571
|
format(
|
|
572
572
|
'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo requires ' +
|
|
573
|
-
'a non-empty String, but %s given.',
|
|
573
|
+
'a non-empty String, but %s was given.',
|
|
574
574
|
v,
|
|
575
575
|
);
|
|
576
576
|
const throwable = v =>
|
|
@@ -591,7 +591,7 @@ describe('BelongsToResolver', function () {
|
|
|
591
591
|
const error = v =>
|
|
592
592
|
format(
|
|
593
593
|
'The parameter "relationName" of BelongsToResolver.includePolymorphicTo requires ' +
|
|
594
|
-
'a non-empty String, but %s given.',
|
|
594
|
+
'a non-empty String, but %s was given.',
|
|
595
595
|
v,
|
|
596
596
|
);
|
|
597
597
|
const throwable = v => R.includePolymorphicTo([], 'sourceName', v);
|
|
@@ -611,7 +611,7 @@ describe('BelongsToResolver', function () {
|
|
|
611
611
|
const error = v =>
|
|
612
612
|
format(
|
|
613
613
|
'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo ' +
|
|
614
|
-
'should be a String, but %s given.',
|
|
614
|
+
'should be a String, but %s was given.',
|
|
615
615
|
v,
|
|
616
616
|
);
|
|
617
617
|
const throwable = v =>
|
|
@@ -628,7 +628,7 @@ describe('BelongsToResolver', function () {
|
|
|
628
628
|
const error = v =>
|
|
629
629
|
format(
|
|
630
630
|
'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo ' +
|
|
631
|
-
'should be a String, but %s given.',
|
|
631
|
+
'should be a String, but %s was given.',
|
|
632
632
|
v,
|
|
633
633
|
);
|
|
634
634
|
const throwable = v =>
|
|
@@ -645,7 +645,7 @@ describe('BelongsToResolver', function () {
|
|
|
645
645
|
const error = v =>
|
|
646
646
|
format(
|
|
647
647
|
'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo ' +
|
|
648
|
-
'should be an Object, but %s given.',
|
|
648
|
+
'should be an Object, but %s was given.',
|
|
649
649
|
v,
|
|
650
650
|
);
|
|
651
651
|
const throwable = v =>
|
|
@@ -31,37 +31,37 @@ export class HasManyResolver extends Service {
|
|
|
31
31
|
if (!entities || !Array.isArray(entities))
|
|
32
32
|
throw new InvalidArgumentError(
|
|
33
33
|
'The parameter "entities" of HasManyResolver.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 HasManyResolver.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 HasManyResolver.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 HasManyResolver.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 HasManyResolver.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 HasManyResolver.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 HasManyResolver extends Service {
|
|
|
74
74
|
if (!entity || typeof entity !== 'object' || Array.isArray(entity))
|
|
75
75
|
throw new InvalidArgumentError(
|
|
76
76
|
'The parameter "entities" of HasManyResolver.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];
|
|
@@ -134,43 +134,43 @@ export class HasManyResolver extends Service {
|
|
|
134
134
|
if (!entities || !Array.isArray(entities))
|
|
135
135
|
throw new InvalidArgumentError(
|
|
136
136
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires ' +
|
|
137
|
-
'an Array of Object, but %v given.',
|
|
137
|
+
'an Array of Object, but %v was given.',
|
|
138
138
|
entities,
|
|
139
139
|
);
|
|
140
140
|
if (!sourceName || typeof sourceName !== 'string')
|
|
141
141
|
throw new InvalidArgumentError(
|
|
142
142
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires ' +
|
|
143
|
-
'a non-empty String, but %v given.',
|
|
143
|
+
'a non-empty String, but %v was given.',
|
|
144
144
|
sourceName,
|
|
145
145
|
);
|
|
146
146
|
if (!targetName || typeof targetName !== 'string')
|
|
147
147
|
throw new InvalidArgumentError(
|
|
148
148
|
'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires ' +
|
|
149
|
-
'a non-empty String, but %v given.',
|
|
149
|
+
'a non-empty String, but %v was given.',
|
|
150
150
|
targetName,
|
|
151
151
|
);
|
|
152
152
|
if (!relationName || typeof relationName !== 'string')
|
|
153
153
|
throw new InvalidArgumentError(
|
|
154
154
|
'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires ' +
|
|
155
|
-
'a non-empty String, but %v given.',
|
|
155
|
+
'a non-empty String, but %v was given.',
|
|
156
156
|
relationName,
|
|
157
157
|
);
|
|
158
158
|
if (!foreignKey || typeof foreignKey !== 'string')
|
|
159
159
|
throw new InvalidArgumentError(
|
|
160
160
|
'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires ' +
|
|
161
|
-
'a non-empty String, but %v given.',
|
|
161
|
+
'a non-empty String, but %v was given.',
|
|
162
162
|
foreignKey,
|
|
163
163
|
);
|
|
164
164
|
if (!discriminator || typeof discriminator !== 'string')
|
|
165
165
|
throw new InvalidArgumentError(
|
|
166
166
|
'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires ' +
|
|
167
|
-
'a non-empty String, but %v given.',
|
|
167
|
+
'a non-empty String, but %v was given.',
|
|
168
168
|
discriminator,
|
|
169
169
|
);
|
|
170
170
|
if (scope && (typeof scope !== 'object' || Array.isArray(scope)))
|
|
171
171
|
throw new InvalidArgumentError(
|
|
172
172
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicTo ' +
|
|
173
|
-
'should be an Object, but %v given.',
|
|
173
|
+
'should be an Object, but %v was given.',
|
|
174
174
|
scope,
|
|
175
175
|
);
|
|
176
176
|
|
|
@@ -183,7 +183,7 @@ export class HasManyResolver extends Service {
|
|
|
183
183
|
if (!entity || typeof entity !== 'object' || Array.isArray(entity))
|
|
184
184
|
throw new InvalidArgumentError(
|
|
185
185
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires ' +
|
|
186
|
-
'an Array of Object, but %v given.',
|
|
186
|
+
'an Array of Object, but %v was given.',
|
|
187
187
|
entity,
|
|
188
188
|
);
|
|
189
189
|
const sourceId = entity[sourcePkPropName];
|
|
@@ -244,37 +244,37 @@ export class HasManyResolver extends Service {
|
|
|
244
244
|
if (!entities || !Array.isArray(entities))
|
|
245
245
|
throw new InvalidArgumentError(
|
|
246
246
|
'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
247
|
-
'an Array of Object, but %v given.',
|
|
247
|
+
'an Array of Object, but %v was given.',
|
|
248
248
|
entities,
|
|
249
249
|
);
|
|
250
250
|
if (!sourceName || typeof sourceName !== 'string')
|
|
251
251
|
throw new InvalidArgumentError(
|
|
252
252
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
253
|
-
'a non-empty String, but %v given.',
|
|
253
|
+
'a non-empty String, but %v was given.',
|
|
254
254
|
sourceName,
|
|
255
255
|
);
|
|
256
256
|
if (!targetName || typeof targetName !== 'string')
|
|
257
257
|
throw new InvalidArgumentError(
|
|
258
258
|
'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
259
|
-
'a non-empty String, but %v given.',
|
|
259
|
+
'a non-empty String, but %v was given.',
|
|
260
260
|
targetName,
|
|
261
261
|
);
|
|
262
262
|
if (!relationName || typeof relationName !== 'string')
|
|
263
263
|
throw new InvalidArgumentError(
|
|
264
264
|
'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
265
|
-
'a non-empty String, but %v given.',
|
|
265
|
+
'a non-empty String, but %v was given.',
|
|
266
266
|
relationName,
|
|
267
267
|
);
|
|
268
268
|
if (!targetRelationName || typeof targetRelationName !== 'string')
|
|
269
269
|
throw new InvalidArgumentError(
|
|
270
270
|
'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
271
|
-
'a non-empty String, but %v given.',
|
|
271
|
+
'a non-empty String, but %v was given.',
|
|
272
272
|
targetRelationName,
|
|
273
273
|
);
|
|
274
274
|
if (scope && (typeof scope !== 'object' || Array.isArray(scope)))
|
|
275
275
|
throw new InvalidArgumentError(
|
|
276
276
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName ' +
|
|
277
|
-
'should be an Object, but %v given.',
|
|
277
|
+
'should be an Object, but %v was given.',
|
|
278
278
|
scope,
|
|
279
279
|
);
|
|
280
280
|
|
|
@@ -285,7 +285,7 @@ export class HasManyResolver extends Service {
|
|
|
285
285
|
throw new InvalidArgumentError(
|
|
286
286
|
'The relation %v of the model %v is a polymorphic "hasMany" relation, ' +
|
|
287
287
|
'so it requires the target relation %v to be a polymorphic "belongsTo", ' +
|
|
288
|
-
'but %v type given.',
|
|
288
|
+
'but %v type was given.',
|
|
289
289
|
relationName,
|
|
290
290
|
sourceName,
|
|
291
291
|
targetRelationName,
|
|
@@ -14,7 +14,7 @@ describe('HasManyResolver', function () {
|
|
|
14
14
|
const error = v =>
|
|
15
15
|
format(
|
|
16
16
|
'The parameter "entities" of HasManyResolver.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('HasManyResolver', function () {
|
|
|
42
42
|
const error = v =>
|
|
43
43
|
format(
|
|
44
44
|
'The parameter "entities" of HasManyResolver.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('HasManyResolver', function () {
|
|
|
63
63
|
const error = v =>
|
|
64
64
|
format(
|
|
65
65
|
'The parameter "sourceName" of HasManyResolver.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('HasManyResolver', function () {
|
|
|
84
84
|
const error = v =>
|
|
85
85
|
format(
|
|
86
86
|
'The parameter "targetName" of HasManyResolver.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('HasManyResolver', function () {
|
|
|
105
105
|
const error = v =>
|
|
106
106
|
format(
|
|
107
107
|
'The parameter "relationName" of HasManyResolver.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('HasManyResolver', function () {
|
|
|
126
126
|
const error = v =>
|
|
127
127
|
format(
|
|
128
128
|
'The parameter "foreignKey" of HasManyResolver.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('HasManyResolver', function () {
|
|
|
147
147
|
const error = v =>
|
|
148
148
|
format(
|
|
149
149
|
'The provided parameter "scope" of HasManyResolver.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 =>
|
|
@@ -726,7 +726,7 @@ describe('HasManyResolver', function () {
|
|
|
726
726
|
const error = v =>
|
|
727
727
|
format(
|
|
728
728
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires ' +
|
|
729
|
-
'an Array of Object, but %s given.',
|
|
729
|
+
'an Array of Object, but %s was given.',
|
|
730
730
|
v,
|
|
731
731
|
);
|
|
732
732
|
const throwable = v =>
|
|
@@ -755,7 +755,7 @@ describe('HasManyResolver', function () {
|
|
|
755
755
|
const error = v =>
|
|
756
756
|
format(
|
|
757
757
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires ' +
|
|
758
|
-
'an Array of Object, but %s given.',
|
|
758
|
+
'an Array of Object, but %s was given.',
|
|
759
759
|
v,
|
|
760
760
|
);
|
|
761
761
|
const throwable = v =>
|
|
@@ -783,7 +783,7 @@ describe('HasManyResolver', function () {
|
|
|
783
783
|
const error = v =>
|
|
784
784
|
format(
|
|
785
785
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires ' +
|
|
786
|
-
'a non-empty String, but %s given.',
|
|
786
|
+
'a non-empty String, but %s was given.',
|
|
787
787
|
v,
|
|
788
788
|
);
|
|
789
789
|
const throwable = v =>
|
|
@@ -811,7 +811,7 @@ describe('HasManyResolver', function () {
|
|
|
811
811
|
const error = v =>
|
|
812
812
|
format(
|
|
813
813
|
'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires ' +
|
|
814
|
-
'a non-empty String, but %s given.',
|
|
814
|
+
'a non-empty String, but %s was given.',
|
|
815
815
|
v,
|
|
816
816
|
);
|
|
817
817
|
const throwable = v =>
|
|
@@ -839,7 +839,7 @@ describe('HasManyResolver', function () {
|
|
|
839
839
|
const error = v =>
|
|
840
840
|
format(
|
|
841
841
|
'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires ' +
|
|
842
|
-
'a non-empty String, but %s given.',
|
|
842
|
+
'a non-empty String, but %s was given.',
|
|
843
843
|
v,
|
|
844
844
|
);
|
|
845
845
|
const throwable = v =>
|
|
@@ -867,7 +867,7 @@ describe('HasManyResolver', function () {
|
|
|
867
867
|
const error = v =>
|
|
868
868
|
format(
|
|
869
869
|
'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires ' +
|
|
870
|
-
'a non-empty String, but %s given.',
|
|
870
|
+
'a non-empty String, but %s was given.',
|
|
871
871
|
v,
|
|
872
872
|
);
|
|
873
873
|
const throwable = v =>
|
|
@@ -895,7 +895,7 @@ describe('HasManyResolver', function () {
|
|
|
895
895
|
const error = v =>
|
|
896
896
|
format(
|
|
897
897
|
'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires ' +
|
|
898
|
-
'a non-empty String, but %s given.',
|
|
898
|
+
'a non-empty String, but %s was given.',
|
|
899
899
|
v,
|
|
900
900
|
);
|
|
901
901
|
const throwable = v =>
|
|
@@ -923,7 +923,7 @@ describe('HasManyResolver', function () {
|
|
|
923
923
|
const error = v =>
|
|
924
924
|
format(
|
|
925
925
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicTo ' +
|
|
926
|
-
'should be an Object, but %s given.',
|
|
926
|
+
'should be an Object, but %s was given.',
|
|
927
927
|
v,
|
|
928
928
|
);
|
|
929
929
|
const throwable = v =>
|
|
@@ -1685,7 +1685,7 @@ describe('HasManyResolver', function () {
|
|
|
1685
1685
|
const error = v =>
|
|
1686
1686
|
format(
|
|
1687
1687
|
'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
1688
|
-
'an Array of Object, but %s given.',
|
|
1688
|
+
'an Array of Object, but %s was given.',
|
|
1689
1689
|
v,
|
|
1690
1690
|
);
|
|
1691
1691
|
const throwable = v =>
|
|
@@ -1722,7 +1722,7 @@ describe('HasManyResolver', function () {
|
|
|
1722
1722
|
const error = v =>
|
|
1723
1723
|
format(
|
|
1724
1724
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires ' +
|
|
1725
|
-
'an Array of Object, but %s given.',
|
|
1725
|
+
'an Array of Object, but %s was given.',
|
|
1726
1726
|
v,
|
|
1727
1727
|
);
|
|
1728
1728
|
const throwable = v =>
|
|
@@ -1749,7 +1749,7 @@ describe('HasManyResolver', function () {
|
|
|
1749
1749
|
const error = v =>
|
|
1750
1750
|
format(
|
|
1751
1751
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
1752
|
-
'a non-empty String, but %s given.',
|
|
1752
|
+
'a non-empty String, but %s was given.',
|
|
1753
1753
|
v,
|
|
1754
1754
|
);
|
|
1755
1755
|
const throwable = v =>
|
|
@@ -1776,7 +1776,7 @@ describe('HasManyResolver', function () {
|
|
|
1776
1776
|
const error = v =>
|
|
1777
1777
|
format(
|
|
1778
1778
|
'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
1779
|
-
'a non-empty String, but %s given.',
|
|
1779
|
+
'a non-empty String, but %s was given.',
|
|
1780
1780
|
v,
|
|
1781
1781
|
);
|
|
1782
1782
|
const throwable = v =>
|
|
@@ -1803,7 +1803,7 @@ describe('HasManyResolver', function () {
|
|
|
1803
1803
|
const error = v =>
|
|
1804
1804
|
format(
|
|
1805
1805
|
'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
1806
|
-
'a non-empty String, but %s given.',
|
|
1806
|
+
'a non-empty String, but %s was given.',
|
|
1807
1807
|
v,
|
|
1808
1808
|
);
|
|
1809
1809
|
const throwable = v =>
|
|
@@ -1830,7 +1830,7 @@ describe('HasManyResolver', function () {
|
|
|
1830
1830
|
const error = v =>
|
|
1831
1831
|
format(
|
|
1832
1832
|
'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires ' +
|
|
1833
|
-
'a non-empty String, but %s given.',
|
|
1833
|
+
'a non-empty String, but %s was given.',
|
|
1834
1834
|
v,
|
|
1835
1835
|
);
|
|
1836
1836
|
const throwable = v =>
|
|
@@ -1857,7 +1857,7 @@ describe('HasManyResolver', function () {
|
|
|
1857
1857
|
const error = v =>
|
|
1858
1858
|
format(
|
|
1859
1859
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName ' +
|
|
1860
|
-
'should be an Object, but %s given.',
|
|
1860
|
+
'should be an Object, but %s was given.',
|
|
1861
1861
|
v,
|
|
1862
1862
|
);
|
|
1863
1863
|
const throwable = v =>
|
|
@@ -1934,7 +1934,7 @@ describe('HasManyResolver', function () {
|
|
|
1934
1934
|
await expect(promise).to.be.rejectedWith(
|
|
1935
1935
|
'The relation "children" of the model "source" is a polymorphic "hasMany" relation, ' +
|
|
1936
1936
|
'so it requires the target relation "parent" to be a polymorphic "belongsTo", ' +
|
|
1937
|
-
'but "referencesMany" type given.',
|
|
1937
|
+
'but "referencesMany" type was given.',
|
|
1938
1938
|
);
|
|
1939
1939
|
});
|
|
1940
1940
|
|