@e22m4u/js-repository 0.6.5 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.json +2 -3
- package/README.md +128 -695
- package/dist/cjs/index.cjs +141 -1262
- package/eslint.config.js +29 -58
- package/jsconfig.json +7 -0
- package/package.json +12 -20
- package/src/adapter/adapter-loader.js +3 -4
- package/src/adapter/adapter.js +10 -11
- package/src/adapter/adapter.spec.js +13 -24
- package/src/adapter/builtin/memory-adapter.js +49 -19
- package/src/adapter/builtin/memory-adapter.spec.js +52 -2
- package/src/adapter/decorator/default-values-decorator.spec.js +1 -2
- package/src/adapter/decorator/index.js +0 -2
- package/src/database-schema.js +1 -2
- package/src/{database-schema.spec.ts → database-schema.spec.js} +5 -17
- package/src/definition/model/index.js +0 -3
- package/src/definition/model/model-definition-utils.js +1 -2
- package/src/definition/model/model-definition-utils.spec.js +5 -2
- package/src/definition/model/properties/index.js +0 -3
- package/src/definition/model/properties/properties-definition-validator.js +0 -169
- package/src/definition/model/properties/properties-definition-validator.spec.js +0 -162
- package/src/definition/model/relations/index.js +0 -1
- package/src/definition/model/relations/relations-definition-validator.js +4 -5
- package/src/filter/include-clause-tool.js +8 -6
- package/src/index.js +0 -1
- package/src/relations/belongs-to-resolver.js +1 -2
- package/src/relations/belongs-to-resolver.spec.js +6 -3
- package/src/relations/has-many-resolver.js +1 -2
- package/src/relations/has-many-resolver.spec.js +6 -3
- package/src/relations/has-one-resolver.js +1 -2
- package/src/relations/has-one-resolver.spec.js +6 -3
- package/src/relations/references-many-resolver.js +1 -2
- package/src/relations/references-many-resolver.spec.js +6 -3
- package/src/repository/repository.js +1 -2
- package/src/utils/index.js +0 -4
- package/src/utils/is-plain-object.js +4 -4
- package/src/utils/model-name-to-model-key.js +0 -4
- package/src/utils/model-name-to-model-key.spec.js +0 -23
- package/src/adapter/adapter-loader.d.ts +0 -16
- package/src/adapter/adapter-registry.d.ts +0 -14
- package/src/adapter/adapter.d.ts +0 -155
- package/src/adapter/builtin/memory-adapter.d.ts +0 -148
- package/src/adapter/decorator/data-sanitizing-decorator.d.ts +0 -14
- package/src/adapter/decorator/data-transformation-decorator.d.ts +0 -14
- package/src/adapter/decorator/data-transformation-decorator.js +0 -54
- package/src/adapter/decorator/data-transformation-decorator.spec.js +0 -193
- package/src/adapter/decorator/data-validation-decorator.d.ts +0 -14
- package/src/adapter/decorator/data-validation-decorator.js +0 -54
- package/src/adapter/decorator/data-validation-decorator.spec.js +0 -105
- package/src/adapter/decorator/default-values-decorator.d.ts +0 -14
- package/src/adapter/decorator/fields-filtering-decorator.d.ts +0 -14
- package/src/adapter/decorator/inclusion-decorator.d.ts +0 -14
- package/src/adapter/decorator/index.d.ts +0 -7
- package/src/adapter/decorator/property-uniqueness-decorator.d.ts +0 -14
- package/src/adapter/index.d.ts +0 -3
- package/src/database-schema.d.ts +0 -37
- package/src/definition/datasource/datasource-definition-validator.d.ts +0 -14
- package/src/definition/datasource/datasource-definition.d.ts +0 -8
- package/src/definition/datasource/index.d.ts +0 -2
- package/src/definition/definition-registry.d.ts +0 -50
- package/src/definition/index.d.ts +0 -3
- package/src/definition/model/index.d.ts +0 -8
- package/src/definition/model/model-data-sanitizer.d.ts +0 -15
- package/src/definition/model/model-data-transformer.d.ts +0 -16
- package/src/definition/model/model-data-transformer.js +0 -170
- package/src/definition/model/model-data-transformer.spec.js +0 -2312
- package/src/definition/model/model-data-validator.d.ts +0 -16
- package/src/definition/model/model-data-validator.js +0 -318
- package/src/definition/model/model-data-validator.spec.js +0 -4528
- package/src/definition/model/model-definition-utils.d.ts +0 -180
- package/src/definition/model/model-definition-validator.d.ts +0 -14
- package/src/definition/model/model-definition.d.ts +0 -28
- package/src/definition/model/model-definition.js +0 -1
- package/src/definition/model/properties/data-type.d.ts +0 -16
- package/src/definition/model/properties/index.d.ts +0 -8
- package/src/definition/model/properties/primary-keys-definition-validator.d.ts +0 -15
- package/src/definition/model/properties/properties-definition-validator.d.ts +0 -15
- package/src/definition/model/properties/property-definition.d.ts +0 -27
- package/src/definition/model/properties/property-definition.js +0 -1
- package/src/definition/model/properties/property-transformer/builtin/index.d.ts +0 -3
- package/src/definition/model/properties/property-transformer/builtin/index.js +0 -3
- package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.d.ts +0 -6
- package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js +0 -19
- package/src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.spec.js +0 -39
- package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.d.ts +0 -6
- package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js +0 -19
- package/src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.spec.js +0 -39
- package/src/definition/model/properties/property-transformer/builtin/trim-transformer.d.ts +0 -6
- package/src/definition/model/properties/property-transformer/builtin/trim-transformer.js +0 -19
- package/src/definition/model/properties/property-transformer/builtin/trim-transformer.spec.js +0 -39
- package/src/definition/model/properties/property-transformer/index.d.ts +0 -2
- package/src/definition/model/properties/property-transformer/index.js +0 -2
- package/src/definition/model/properties/property-transformer/property-transformer-registry.d.ts +0 -29
- package/src/definition/model/properties/property-transformer/property-transformer-registry.js +0 -76
- package/src/definition/model/properties/property-transformer/property-transformer-registry.spec.js +0 -133
- package/src/definition/model/properties/property-transformer/property-transformer.d.ts +0 -27
- package/src/definition/model/properties/property-transformer/property-transformer.js +0 -1
- package/src/definition/model/properties/property-uniqueness-validator.d.ts +0 -31
- package/src/definition/model/properties/property-uniqueness.d.ts +0 -14
- package/src/definition/model/properties/property-validator/builtin/index.d.ts +0 -3
- package/src/definition/model/properties/property-validator/builtin/index.js +0 -3
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.d.ts +0 -6
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.js +0 -28
- package/src/definition/model/properties/property-validator/builtin/max-length-validator.spec.js +0 -100
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.d.ts +0 -6
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.js +0 -28
- package/src/definition/model/properties/property-validator/builtin/min-length-validator.spec.js +0 -100
- package/src/definition/model/properties/property-validator/builtin/regexp-validator.d.ts +0 -6
- package/src/definition/model/properties/property-validator/builtin/regexp-validator.js +0 -30
- package/src/definition/model/properties/property-validator/builtin/regexp-validator.spec.js +0 -102
- package/src/definition/model/properties/property-validator/index.d.ts +0 -2
- package/src/definition/model/properties/property-validator/index.js +0 -2
- package/src/definition/model/properties/property-validator/property-validator-registry.d.ts +0 -29
- package/src/definition/model/properties/property-validator/property-validator-registry.js +0 -76
- package/src/definition/model/properties/property-validator/property-validator-registry.spec.js +0 -132
- package/src/definition/model/properties/property-validator/property-validator.d.ts +0 -25
- package/src/definition/model/properties/property-validator/property-validator.js +0 -1
- package/src/definition/model/relations/index.d.ts +0 -3
- package/src/definition/model/relations/relation-definition.d.ts +0 -236
- package/src/definition/model/relations/relation-definition.js +0 -1
- package/src/definition/model/relations/relation-type.d.ts +0 -14
- package/src/definition/model/relations/relations-definition-validator.d.ts +0 -15
- package/src/errors/index.d.ts +0 -3
- package/src/errors/invalid-argument-error.d.ts +0 -6
- package/src/errors/invalid-operator-value-error.d.ts +0 -13
- package/src/errors/not-implemented-error.d.ts +0 -6
- package/src/filter/fields-clause-tool.d.ts +0 -38
- package/src/filter/filter-clause.d.ts +0 -348
- package/src/filter/include-clause-tool.d.ts +0 -55
- package/src/filter/index.d.ts +0 -7
- package/src/filter/operator-clause-tool.d.ts +0 -224
- package/src/filter/order-clause-tool.d.ts +0 -32
- package/src/filter/slice-clause-tool.d.ts +0 -30
- package/src/filter/where-clause-tool.d.ts +0 -23
- package/src/index.d.ts +0 -9
- package/src/relations/belongs-to-resolver.d.ts +0 -46
- package/src/relations/has-many-resolver.d.ts +0 -67
- package/src/relations/has-one-resolver.d.ts +0 -67
- package/src/relations/index.d.ts +0 -4
- package/src/relations/references-many-resolver.d.ts +0 -27
- package/src/repository/index.d.ts +0 -2
- package/src/repository/repository-registry.d.ts +0 -29
- package/src/repository/repository.d.ts +0 -183
- package/src/types.d.ts +0 -43
- package/src/types.js +0 -1
- package/src/utils/capitalize.d.ts +0 -6
- package/src/utils/clone-deep.d.ts +0 -6
- package/src/utils/exclude-object-keys.d.ts +0 -10
- package/src/utils/get-ctor-name.d.ts +0 -6
- package/src/utils/get-ctor-name.js +0 -11
- package/src/utils/get-ctor-name.spec.js +0 -17
- package/src/utils/get-decorator-target-type.d.ts +0 -27
- package/src/utils/get-decorator-target-type.js +0 -63
- package/src/utils/get-decorator-target-type.spec.js +0 -80
- package/src/utils/get-value-by-path.d.ts +0 -12
- package/src/utils/index.d.ts +0 -16
- package/src/utils/is-ctor.d.ts +0 -8
- package/src/utils/is-ctor.js +0 -11
- package/src/utils/is-ctor.spec.js +0 -26
- package/src/utils/is-deep-equal.d.ts +0 -10
- package/src/utils/is-plain-object.d.ts +0 -6
- package/src/utils/is-promise.d.ts +0 -10
- package/src/utils/like-to-regexp.d.ts +0 -14
- package/src/utils/model-name-to-model-key.d.ts +0 -6
- package/src/utils/select-object-keys.d.ts +0 -10
- package/src/utils/singularize.d.ts +0 -6
- package/src/utils/string-to-regexp.d.ts +0 -10
- package/src/utils/transform-promise.d.ts +0 -13
- package/src/utils/transform-promise.js +0 -15
- package/src/utils/transform-promise.spec.js +0 -19
- package/tsconfig.json +0 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -38,18 +37,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
37
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
38
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
39
|
|
|
41
|
-
// src/utils/is-ctor.js
|
|
42
|
-
function isCtor(value) {
|
|
43
|
-
if (!value) return false;
|
|
44
|
-
return typeof value === "function" && "prototype" in value;
|
|
45
|
-
}
|
|
46
|
-
var init_is_ctor = __esm({
|
|
47
|
-
"src/utils/is-ctor.js"() {
|
|
48
|
-
"use strict";
|
|
49
|
-
__name(isCtor, "isCtor");
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
40
|
// src/utils/is-promise.js
|
|
54
41
|
function isPromise(value) {
|
|
55
42
|
if (!value) return false;
|
|
@@ -58,7 +45,6 @@ function isPromise(value) {
|
|
|
58
45
|
}
|
|
59
46
|
var init_is_promise = __esm({
|
|
60
47
|
"src/utils/is-promise.js"() {
|
|
61
|
-
"use strict";
|
|
62
48
|
__name(isPromise, "isPromise");
|
|
63
49
|
}
|
|
64
50
|
});
|
|
@@ -70,7 +56,6 @@ function capitalize(string) {
|
|
|
70
56
|
}
|
|
71
57
|
var init_capitalize = __esm({
|
|
72
58
|
"src/utils/capitalize.js"() {
|
|
73
|
-
"use strict";
|
|
74
59
|
__name(capitalize, "capitalize");
|
|
75
60
|
}
|
|
76
61
|
});
|
|
@@ -114,7 +99,6 @@ function cloneDeep(value) {
|
|
|
114
99
|
}
|
|
115
100
|
var init_clone_deep = __esm({
|
|
116
101
|
"src/utils/clone-deep.js"() {
|
|
117
|
-
"use strict";
|
|
118
102
|
__name(cloneDeep, "cloneDeep");
|
|
119
103
|
}
|
|
120
104
|
});
|
|
@@ -138,7 +122,6 @@ function singularize(noun) {
|
|
|
138
122
|
}
|
|
139
123
|
var init_singularize = __esm({
|
|
140
124
|
"src/utils/singularize.js"() {
|
|
141
|
-
"use strict";
|
|
142
125
|
__name(singularize, "singularize");
|
|
143
126
|
}
|
|
144
127
|
});
|
|
@@ -187,29 +170,14 @@ function isDeepEqual(firstValue, secondValue) {
|
|
|
187
170
|
}
|
|
188
171
|
var init_is_deep_equal = __esm({
|
|
189
172
|
"src/utils/is-deep-equal.js"() {
|
|
190
|
-
"use strict";
|
|
191
173
|
__name(isDeepEqual, "isDeepEqual");
|
|
192
174
|
}
|
|
193
175
|
});
|
|
194
176
|
|
|
195
|
-
// src/utils/get-ctor-name.js
|
|
196
|
-
function getCtorName(value) {
|
|
197
|
-
if (value === null) return "Null";
|
|
198
|
-
if (value === void 0) return "Undefined";
|
|
199
|
-
return value.constructor && value.constructor.name || void 0;
|
|
200
|
-
}
|
|
201
|
-
var init_get_ctor_name = __esm({
|
|
202
|
-
"src/utils/get-ctor-name.js"() {
|
|
203
|
-
"use strict";
|
|
204
|
-
__name(getCtorName, "getCtorName");
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
|
|
208
177
|
// src/errors/not-implemented-error.js
|
|
209
178
|
var import_js_format, _NotImplementedError, NotImplementedError;
|
|
210
179
|
var init_not_implemented_error = __esm({
|
|
211
180
|
"src/errors/not-implemented-error.js"() {
|
|
212
|
-
"use strict";
|
|
213
181
|
import_js_format = require("@e22m4u/js-format");
|
|
214
182
|
_NotImplementedError = class _NotImplementedError extends import_js_format.Errorf {
|
|
215
183
|
};
|
|
@@ -222,7 +190,6 @@ var init_not_implemented_error = __esm({
|
|
|
222
190
|
var import_js_format2, _InvalidArgumentError, InvalidArgumentError;
|
|
223
191
|
var init_invalid_argument_error = __esm({
|
|
224
192
|
"src/errors/invalid-argument-error.js"() {
|
|
225
|
-
"use strict";
|
|
226
193
|
import_js_format2 = require("@e22m4u/js-format");
|
|
227
194
|
_InvalidArgumentError = class _InvalidArgumentError extends import_js_format2.Errorf {
|
|
228
195
|
};
|
|
@@ -235,7 +202,6 @@ var init_invalid_argument_error = __esm({
|
|
|
235
202
|
var import_js_format3, _InvalidOperatorValueError, InvalidOperatorValueError;
|
|
236
203
|
var init_invalid_operator_value_error = __esm({
|
|
237
204
|
"src/errors/invalid-operator-value-error.js"() {
|
|
238
|
-
"use strict";
|
|
239
205
|
import_js_format3 = require("@e22m4u/js-format");
|
|
240
206
|
_InvalidOperatorValueError = class _InvalidOperatorValueError extends Error {
|
|
241
207
|
/**
|
|
@@ -264,7 +230,6 @@ var init_invalid_operator_value_error = __esm({
|
|
|
264
230
|
// src/errors/index.js
|
|
265
231
|
var init_errors = __esm({
|
|
266
232
|
"src/errors/index.js"() {
|
|
267
|
-
"use strict";
|
|
268
233
|
init_not_implemented_error();
|
|
269
234
|
init_invalid_argument_error();
|
|
270
235
|
init_invalid_operator_value_error();
|
|
@@ -306,7 +271,6 @@ function likeToRegexp(pattern, isCaseInsensitive = false) {
|
|
|
306
271
|
}
|
|
307
272
|
var init_like_to_regexp = __esm({
|
|
308
273
|
"src/utils/like-to-regexp.js"() {
|
|
309
|
-
"use strict";
|
|
310
274
|
init_errors();
|
|
311
275
|
__name(likeToRegexp, "likeToRegexp");
|
|
312
276
|
}
|
|
@@ -320,7 +284,6 @@ function isPlainObject(value) {
|
|
|
320
284
|
}
|
|
321
285
|
var init_is_plain_object = __esm({
|
|
322
286
|
"src/utils/is-plain-object.js"() {
|
|
323
|
-
"use strict";
|
|
324
287
|
__name(isPlainObject, "isPlainObject");
|
|
325
288
|
}
|
|
326
289
|
});
|
|
@@ -334,7 +297,6 @@ function stringToRegexp(pattern, flags = void 0) {
|
|
|
334
297
|
}
|
|
335
298
|
var init_string_to_regexp = __esm({
|
|
336
299
|
"src/utils/string-to-regexp.js"() {
|
|
337
|
-
"use strict";
|
|
338
300
|
__name(stringToRegexp, "stringToRegexp");
|
|
339
301
|
}
|
|
340
302
|
});
|
|
@@ -357,23 +319,10 @@ function getValueByPath(obj, path, orElse = void 0) {
|
|
|
357
319
|
}
|
|
358
320
|
var init_get_value_by_path = __esm({
|
|
359
321
|
"src/utils/get-value-by-path.js"() {
|
|
360
|
-
"use strict";
|
|
361
322
|
__name(getValueByPath, "getValueByPath");
|
|
362
323
|
}
|
|
363
324
|
});
|
|
364
325
|
|
|
365
|
-
// src/utils/transform-promise.js
|
|
366
|
-
function transformPromise(valueOrPromise, transformer) {
|
|
367
|
-
return isPromise(valueOrPromise) ? valueOrPromise.then(transformer) : transformer(valueOrPromise);
|
|
368
|
-
}
|
|
369
|
-
var init_transform_promise = __esm({
|
|
370
|
-
"src/utils/transform-promise.js"() {
|
|
371
|
-
"use strict";
|
|
372
|
-
init_is_promise();
|
|
373
|
-
__name(transformPromise, "transformPromise");
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
|
|
377
326
|
// src/utils/select-object-keys.js
|
|
378
327
|
function selectObjectKeys(obj, keys) {
|
|
379
328
|
if (!obj || typeof obj !== "object" || Array.isArray(obj))
|
|
@@ -402,7 +351,6 @@ function selectObjectKeys(obj, keys) {
|
|
|
402
351
|
}
|
|
403
352
|
var init_select_object_keys = __esm({
|
|
404
353
|
"src/utils/select-object-keys.js"() {
|
|
405
|
-
"use strict";
|
|
406
354
|
init_errors();
|
|
407
355
|
__name(selectObjectKeys, "selectObjectKeys");
|
|
408
356
|
}
|
|
@@ -422,7 +370,6 @@ function excludeObjectKeys(obj, keys) {
|
|
|
422
370
|
}
|
|
423
371
|
var init_exclude_object_keys = __esm({
|
|
424
372
|
"src/utils/exclude-object-keys.js"() {
|
|
425
|
-
"use strict";
|
|
426
373
|
init_errors();
|
|
427
374
|
__name(excludeObjectKeys, "excludeObjectKeys");
|
|
428
375
|
}
|
|
@@ -435,77 +382,30 @@ function modelNameToModelKey(modelName) {
|
|
|
435
382
|
"The model name should be a non-empty String without spaces, but %v was given.",
|
|
436
383
|
modelName
|
|
437
384
|
);
|
|
438
|
-
if (modelName.toLowerCase() !== "model")
|
|
439
|
-
modelName = modelName.replace(/[-_]?Model$/, "").replace(/[-_](MODEL|model)$/, "");
|
|
440
385
|
return modelName.toLowerCase().replace(/[-_]/g, "");
|
|
441
386
|
}
|
|
442
387
|
var init_model_name_to_model_key = __esm({
|
|
443
388
|
"src/utils/model-name-to-model-key.js"() {
|
|
444
|
-
"use strict";
|
|
445
389
|
init_errors();
|
|
446
390
|
__name(modelNameToModelKey, "modelNameToModelKey");
|
|
447
391
|
}
|
|
448
392
|
});
|
|
449
393
|
|
|
450
|
-
// src/utils/get-decorator-target-type.js
|
|
451
|
-
function getDecoratorTargetType(target, propertyKey, descriptorOrIndex) {
|
|
452
|
-
const isCtor2 = typeof target === "function";
|
|
453
|
-
const isParameter = typeof descriptorOrIndex === "number";
|
|
454
|
-
const isProperty = propertyKey != null && descriptorOrIndex == null;
|
|
455
|
-
const isMethod = propertyKey != null && descriptorOrIndex != null;
|
|
456
|
-
const D = DecoratorTargetType;
|
|
457
|
-
if (isCtor2) {
|
|
458
|
-
if (isParameter)
|
|
459
|
-
return propertyKey ? D.STATIC_METHOD_PARAMETER : D.CONSTRUCTOR_PARAMETER;
|
|
460
|
-
if (isProperty) return D.STATIC_PROPERTY;
|
|
461
|
-
if (isMethod) return D.STATIC_METHOD;
|
|
462
|
-
return D.CONSTRUCTOR;
|
|
463
|
-
} else {
|
|
464
|
-
if (isParameter) return D.INSTANCE_METHOD_PARAMETER;
|
|
465
|
-
if (isProperty) return D.INSTANCE_PROPERTY;
|
|
466
|
-
if (isMethod) return D.INSTANCE_METHOD;
|
|
467
|
-
return D.INSTANCE;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
var DecoratorTargetType;
|
|
471
|
-
var init_get_decorator_target_type = __esm({
|
|
472
|
-
"src/utils/get-decorator-target-type.js"() {
|
|
473
|
-
"use strict";
|
|
474
|
-
DecoratorTargetType = {
|
|
475
|
-
CONSTRUCTOR: "constructor",
|
|
476
|
-
INSTANCE: "instance",
|
|
477
|
-
STATIC_METHOD: "staticMethod",
|
|
478
|
-
INSTANCE_METHOD: "instanceMethod",
|
|
479
|
-
STATIC_PROPERTY: "staticProperty",
|
|
480
|
-
INSTANCE_PROPERTY: "instanceProperty",
|
|
481
|
-
CONSTRUCTOR_PARAMETER: "constructorParameter",
|
|
482
|
-
STATIC_METHOD_PARAMETER: "staticMethodParameter",
|
|
483
|
-
INSTANCE_METHOD_PARAMETER: "instanceMethodParameter"
|
|
484
|
-
};
|
|
485
|
-
__name(getDecoratorTargetType, "getDecoratorTargetType");
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
|
|
489
394
|
// src/utils/index.js
|
|
490
395
|
var init_utils = __esm({
|
|
491
396
|
"src/utils/index.js"() {
|
|
492
|
-
"use strict";
|
|
493
|
-
init_is_ctor();
|
|
494
397
|
init_is_promise();
|
|
495
398
|
init_capitalize();
|
|
496
399
|
init_clone_deep();
|
|
497
400
|
init_singularize();
|
|
498
401
|
init_is_deep_equal();
|
|
499
|
-
init_get_ctor_name();
|
|
500
402
|
init_like_to_regexp();
|
|
501
403
|
init_is_plain_object();
|
|
502
404
|
init_string_to_regexp();
|
|
503
405
|
init_get_value_by_path();
|
|
504
|
-
init_transform_promise();
|
|
505
406
|
init_select_object_keys();
|
|
506
407
|
init_exclude_object_keys();
|
|
507
408
|
init_model_name_to_model_key();
|
|
508
|
-
init_get_decorator_target_type();
|
|
509
409
|
}
|
|
510
410
|
});
|
|
511
411
|
|
|
@@ -513,7 +413,6 @@ var init_utils = __esm({
|
|
|
513
413
|
var import_js_service, _SliceClauseTool, SliceClauseTool;
|
|
514
414
|
var init_slice_clause_tool = __esm({
|
|
515
415
|
"src/filter/slice-clause-tool.js"() {
|
|
516
|
-
"use strict";
|
|
517
416
|
import_js_service = require("@e22m4u/js-service");
|
|
518
417
|
init_errors();
|
|
519
418
|
_SliceClauseTool = class _SliceClauseTool extends import_js_service.Service {
|
|
@@ -596,7 +495,6 @@ function compareFn(a, b) {
|
|
|
596
495
|
var import_js_service2, _OrderClauseTool, OrderClauseTool;
|
|
597
496
|
var init_order_clause_tool = __esm({
|
|
598
497
|
"src/filter/order-clause-tool.js"() {
|
|
599
|
-
"use strict";
|
|
600
498
|
import_js_service2 = require("@e22m4u/js-service");
|
|
601
499
|
init_utils();
|
|
602
500
|
init_errors();
|
|
@@ -675,7 +573,6 @@ var init_order_clause_tool = __esm({
|
|
|
675
573
|
var import_js_service3, _OperatorClauseTool, OperatorClauseTool;
|
|
676
574
|
var init_operator_clause_tool = __esm({
|
|
677
575
|
"src/filter/operator-clause-tool.js"() {
|
|
678
|
-
"use strict";
|
|
679
576
|
import_js_service3 = require("@e22m4u/js-service");
|
|
680
577
|
init_utils();
|
|
681
578
|
init_errors();
|
|
@@ -1137,7 +1034,6 @@ var init_operator_clause_tool = __esm({
|
|
|
1137
1034
|
var import_js_service4, _WhereClauseTool, WhereClauseTool;
|
|
1138
1035
|
var init_where_clause_tool = __esm({
|
|
1139
1036
|
"src/filter/where-clause-tool.js"() {
|
|
1140
|
-
"use strict";
|
|
1141
1037
|
import_js_service4 = require("@e22m4u/js-service");
|
|
1142
1038
|
init_errors();
|
|
1143
1039
|
init_operator_clause_tool();
|
|
@@ -1283,7 +1179,6 @@ var init_where_clause_tool = __esm({
|
|
|
1283
1179
|
var RelationType;
|
|
1284
1180
|
var init_relation_type = __esm({
|
|
1285
1181
|
"src/definition/model/relations/relation-type.js"() {
|
|
1286
|
-
"use strict";
|
|
1287
1182
|
RelationType = {
|
|
1288
1183
|
BELONGS_TO: "belongsTo",
|
|
1289
1184
|
HAS_ONE: "hasOne",
|
|
@@ -1293,21 +1188,12 @@ var init_relation_type = __esm({
|
|
|
1293
1188
|
}
|
|
1294
1189
|
});
|
|
1295
1190
|
|
|
1296
|
-
// src/definition/model/relations/relation-definition.js
|
|
1297
|
-
var init_relation_definition = __esm({
|
|
1298
|
-
"src/definition/model/relations/relation-definition.js"() {
|
|
1299
|
-
"use strict";
|
|
1300
|
-
}
|
|
1301
|
-
});
|
|
1302
|
-
|
|
1303
1191
|
// src/definition/model/relations/relations-definition-validator.js
|
|
1304
1192
|
var import_js_service5, _RelationsDefinitionValidator, RelationsDefinitionValidator;
|
|
1305
1193
|
var init_relations_definition_validator = __esm({
|
|
1306
1194
|
"src/definition/model/relations/relations-definition-validator.js"() {
|
|
1307
|
-
"use strict";
|
|
1308
1195
|
import_js_service5 = require("@e22m4u/js-service");
|
|
1309
1196
|
init_relation_type();
|
|
1310
|
-
init_relation_type();
|
|
1311
1197
|
init_errors();
|
|
1312
1198
|
_RelationsDefinitionValidator = class _RelationsDefinitionValidator extends import_js_service5.Service {
|
|
1313
1199
|
/**
|
|
@@ -1694,9 +1580,7 @@ var init_relations_definition_validator = __esm({
|
|
|
1694
1580
|
// src/definition/model/relations/index.js
|
|
1695
1581
|
var init_relations = __esm({
|
|
1696
1582
|
"src/definition/model/relations/index.js"() {
|
|
1697
|
-
"use strict";
|
|
1698
1583
|
init_relation_type();
|
|
1699
|
-
init_relation_definition();
|
|
1700
1584
|
init_relations_definition_validator();
|
|
1701
1585
|
}
|
|
1702
1586
|
});
|
|
@@ -1705,7 +1589,6 @@ var init_relations = __esm({
|
|
|
1705
1589
|
var DataType;
|
|
1706
1590
|
var init_data_type = __esm({
|
|
1707
1591
|
"src/definition/model/properties/data-type.js"() {
|
|
1708
|
-
"use strict";
|
|
1709
1592
|
DataType = {
|
|
1710
1593
|
ANY: "any",
|
|
1711
1594
|
STRING: "string",
|
|
@@ -1717,18 +1600,10 @@ var init_data_type = __esm({
|
|
|
1717
1600
|
}
|
|
1718
1601
|
});
|
|
1719
1602
|
|
|
1720
|
-
// src/definition/model/properties/property-definition.js
|
|
1721
|
-
var init_property_definition = __esm({
|
|
1722
|
-
"src/definition/model/properties/property-definition.js"() {
|
|
1723
|
-
"use strict";
|
|
1724
|
-
}
|
|
1725
|
-
});
|
|
1726
|
-
|
|
1727
1603
|
// src/definition/model/properties/property-uniqueness.js
|
|
1728
1604
|
var PropertyUniqueness;
|
|
1729
1605
|
var init_property_uniqueness = __esm({
|
|
1730
1606
|
"src/definition/model/properties/property-uniqueness.js"() {
|
|
1731
|
-
"use strict";
|
|
1732
1607
|
PropertyUniqueness = {
|
|
1733
1608
|
STRICT: "strict",
|
|
1734
1609
|
SPARSE: "sparse",
|
|
@@ -1737,357 +1612,16 @@ var init_property_uniqueness = __esm({
|
|
|
1737
1612
|
}
|
|
1738
1613
|
});
|
|
1739
1614
|
|
|
1740
|
-
// src/definition/model/properties/property-validator/property-validator.js
|
|
1741
|
-
var init_property_validator = __esm({
|
|
1742
|
-
"src/definition/model/properties/property-validator/property-validator.js"() {
|
|
1743
|
-
"use strict";
|
|
1744
|
-
}
|
|
1745
|
-
});
|
|
1746
|
-
|
|
1747
|
-
// src/definition/model/properties/property-validator/builtin/regexp-validator.js
|
|
1748
|
-
function regexpValidator(value, options, context) {
|
|
1749
|
-
if (value == null || options === false) return true;
|
|
1750
|
-
if (typeof options !== "string" && !(options instanceof RegExp))
|
|
1751
|
-
throw new InvalidArgumentError(
|
|
1752
|
-
'The validator %v requires the "options" argument as a String or RegExp, but %v was given.',
|
|
1753
|
-
context.validatorName,
|
|
1754
|
-
options
|
|
1755
|
-
);
|
|
1756
|
-
if (typeof value === "string") {
|
|
1757
|
-
const regexp = stringToRegexp(options);
|
|
1758
|
-
return regexp.test(value);
|
|
1759
|
-
}
|
|
1760
|
-
throw new InvalidArgumentError(
|
|
1761
|
-
"The property validator %v requires a String value, but %v was given.",
|
|
1762
|
-
context.validatorName,
|
|
1763
|
-
value
|
|
1764
|
-
);
|
|
1765
|
-
}
|
|
1766
|
-
var init_regexp_validator = __esm({
|
|
1767
|
-
"src/definition/model/properties/property-validator/builtin/regexp-validator.js"() {
|
|
1768
|
-
"use strict";
|
|
1769
|
-
init_utils();
|
|
1770
|
-
init_errors();
|
|
1771
|
-
__name(regexpValidator, "regexpValidator");
|
|
1772
|
-
}
|
|
1773
|
-
});
|
|
1774
|
-
|
|
1775
|
-
// src/definition/model/properties/property-validator/builtin/max-length-validator.js
|
|
1776
|
-
function maxLengthValidator(value, options, context) {
|
|
1777
|
-
if (value == null || options === false) return true;
|
|
1778
|
-
if (typeof options !== "number")
|
|
1779
|
-
throw new InvalidArgumentError(
|
|
1780
|
-
'The validator %v requires the "options" argument as a Number, but %v was given.',
|
|
1781
|
-
context.validatorName,
|
|
1782
|
-
options
|
|
1783
|
-
);
|
|
1784
|
-
if (typeof value === "string" || Array.isArray(value))
|
|
1785
|
-
return value.length <= options;
|
|
1786
|
-
throw new InvalidArgumentError(
|
|
1787
|
-
"The property validator %v requires a String or an Array value, but %v was given.",
|
|
1788
|
-
context.validatorName,
|
|
1789
|
-
value
|
|
1790
|
-
);
|
|
1791
|
-
}
|
|
1792
|
-
var init_max_length_validator = __esm({
|
|
1793
|
-
"src/definition/model/properties/property-validator/builtin/max-length-validator.js"() {
|
|
1794
|
-
"use strict";
|
|
1795
|
-
init_errors();
|
|
1796
|
-
__name(maxLengthValidator, "maxLengthValidator");
|
|
1797
|
-
}
|
|
1798
|
-
});
|
|
1799
|
-
|
|
1800
|
-
// src/definition/model/properties/property-validator/builtin/min-length-validator.js
|
|
1801
|
-
function minLengthValidator(value, options, context) {
|
|
1802
|
-
if (value == null || options === false) return true;
|
|
1803
|
-
if (typeof options !== "number")
|
|
1804
|
-
throw new InvalidArgumentError(
|
|
1805
|
-
'The validator %v requires the "options" argument as a Number, but %v was given.',
|
|
1806
|
-
context.validatorName,
|
|
1807
|
-
options
|
|
1808
|
-
);
|
|
1809
|
-
if (typeof value === "string" || Array.isArray(value))
|
|
1810
|
-
return value.length >= options;
|
|
1811
|
-
throw new InvalidArgumentError(
|
|
1812
|
-
"The property validator %v requires a String or an Array value, but %v was given.",
|
|
1813
|
-
context.validatorName,
|
|
1814
|
-
value
|
|
1815
|
-
);
|
|
1816
|
-
}
|
|
1817
|
-
var init_min_length_validator = __esm({
|
|
1818
|
-
"src/definition/model/properties/property-validator/builtin/min-length-validator.js"() {
|
|
1819
|
-
"use strict";
|
|
1820
|
-
init_errors();
|
|
1821
|
-
__name(minLengthValidator, "minLengthValidator");
|
|
1822
|
-
}
|
|
1823
|
-
});
|
|
1824
|
-
|
|
1825
|
-
// src/definition/model/properties/property-validator/builtin/index.js
|
|
1826
|
-
var init_builtin = __esm({
|
|
1827
|
-
"src/definition/model/properties/property-validator/builtin/index.js"() {
|
|
1828
|
-
"use strict";
|
|
1829
|
-
init_regexp_validator();
|
|
1830
|
-
init_max_length_validator();
|
|
1831
|
-
init_min_length_validator();
|
|
1832
|
-
}
|
|
1833
|
-
});
|
|
1834
|
-
|
|
1835
|
-
// src/definition/model/properties/property-validator/property-validator-registry.js
|
|
1836
|
-
var import_js_service6, _PropertyValidatorRegistry, PropertyValidatorRegistry;
|
|
1837
|
-
var init_property_validator_registry = __esm({
|
|
1838
|
-
"src/definition/model/properties/property-validator/property-validator-registry.js"() {
|
|
1839
|
-
"use strict";
|
|
1840
|
-
import_js_service6 = require("@e22m4u/js-service");
|
|
1841
|
-
init_builtin();
|
|
1842
|
-
init_builtin();
|
|
1843
|
-
init_builtin();
|
|
1844
|
-
init_errors();
|
|
1845
|
-
_PropertyValidatorRegistry = class _PropertyValidatorRegistry extends import_js_service6.Service {
|
|
1846
|
-
/**
|
|
1847
|
-
* Validators.
|
|
1848
|
-
*
|
|
1849
|
-
* @type {object}
|
|
1850
|
-
*/
|
|
1851
|
-
_validators = {
|
|
1852
|
-
maxLength: maxLengthValidator,
|
|
1853
|
-
minLength: minLengthValidator,
|
|
1854
|
-
regexp: regexpValidator
|
|
1855
|
-
};
|
|
1856
|
-
/**
|
|
1857
|
-
* Add validator.
|
|
1858
|
-
*
|
|
1859
|
-
* @param {string} name
|
|
1860
|
-
* @param {Function} validator
|
|
1861
|
-
* @returns {PropertyValidatorRegistry}
|
|
1862
|
-
*/
|
|
1863
|
-
addValidator(name, validator) {
|
|
1864
|
-
if (!name || typeof name !== "string")
|
|
1865
|
-
throw new InvalidArgumentError(
|
|
1866
|
-
"A name of the property validator must be a non-empty String, but %v was given.",
|
|
1867
|
-
name
|
|
1868
|
-
);
|
|
1869
|
-
if (name in this._validators)
|
|
1870
|
-
throw new InvalidArgumentError(
|
|
1871
|
-
"The property validator %v is already defined.",
|
|
1872
|
-
name
|
|
1873
|
-
);
|
|
1874
|
-
if (typeof validator !== "function")
|
|
1875
|
-
throw new InvalidArgumentError(
|
|
1876
|
-
"The property validator %v must be a Function, but %v was given.",
|
|
1877
|
-
name,
|
|
1878
|
-
validator
|
|
1879
|
-
);
|
|
1880
|
-
this._validators[name] = validator;
|
|
1881
|
-
return this;
|
|
1882
|
-
}
|
|
1883
|
-
/**
|
|
1884
|
-
* Has validator.
|
|
1885
|
-
*
|
|
1886
|
-
* @param {string} name
|
|
1887
|
-
* @returns {boolean}
|
|
1888
|
-
*/
|
|
1889
|
-
hasValidator(name) {
|
|
1890
|
-
return Boolean(this._validators[name]);
|
|
1891
|
-
}
|
|
1892
|
-
/**
|
|
1893
|
-
* Get validator.
|
|
1894
|
-
*
|
|
1895
|
-
* @param {string} name
|
|
1896
|
-
* @returns {Function}
|
|
1897
|
-
*/
|
|
1898
|
-
getValidator(name) {
|
|
1899
|
-
const validator = this._validators[name];
|
|
1900
|
-
if (!validator)
|
|
1901
|
-
throw new InvalidArgumentError(
|
|
1902
|
-
"The property validator %v is not defined.",
|
|
1903
|
-
name
|
|
1904
|
-
);
|
|
1905
|
-
return validator;
|
|
1906
|
-
}
|
|
1907
|
-
};
|
|
1908
|
-
__name(_PropertyValidatorRegistry, "PropertyValidatorRegistry");
|
|
1909
|
-
PropertyValidatorRegistry = _PropertyValidatorRegistry;
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
1912
|
-
|
|
1913
|
-
// src/definition/model/properties/property-validator/index.js
|
|
1914
|
-
var init_property_validator2 = __esm({
|
|
1915
|
-
"src/definition/model/properties/property-validator/index.js"() {
|
|
1916
|
-
"use strict";
|
|
1917
|
-
init_property_validator();
|
|
1918
|
-
init_property_validator_registry();
|
|
1919
|
-
}
|
|
1920
|
-
});
|
|
1921
|
-
|
|
1922
|
-
// src/definition/model/properties/property-transformer/property-transformer.js
|
|
1923
|
-
var init_property_transformer = __esm({
|
|
1924
|
-
"src/definition/model/properties/property-transformer/property-transformer.js"() {
|
|
1925
|
-
"use strict";
|
|
1926
|
-
}
|
|
1927
|
-
});
|
|
1928
|
-
|
|
1929
|
-
// src/definition/model/properties/property-transformer/builtin/trim-transformer.js
|
|
1930
|
-
function trimTransformer(value, options, context) {
|
|
1931
|
-
if (value == null) return value;
|
|
1932
|
-
if (typeof value === "string") return value.trim();
|
|
1933
|
-
throw new InvalidArgumentError(
|
|
1934
|
-
"The property transformer %v requires a String value, but %v was given.",
|
|
1935
|
-
context.transformerName,
|
|
1936
|
-
value
|
|
1937
|
-
);
|
|
1938
|
-
}
|
|
1939
|
-
var init_trim_transformer = __esm({
|
|
1940
|
-
"src/definition/model/properties/property-transformer/builtin/trim-transformer.js"() {
|
|
1941
|
-
"use strict";
|
|
1942
|
-
init_errors();
|
|
1943
|
-
__name(trimTransformer, "trimTransformer");
|
|
1944
|
-
}
|
|
1945
|
-
});
|
|
1946
|
-
|
|
1947
|
-
// src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js
|
|
1948
|
-
function toLowerCaseTransformer(value, options, context) {
|
|
1949
|
-
if (value == null) return value;
|
|
1950
|
-
if (typeof value === "string") return value.toLowerCase();
|
|
1951
|
-
throw new InvalidArgumentError(
|
|
1952
|
-
"The property transformer %v requires a String value, but %v was given.",
|
|
1953
|
-
context.transformerName,
|
|
1954
|
-
value
|
|
1955
|
-
);
|
|
1956
|
-
}
|
|
1957
|
-
var init_to_lower_case_transformer = __esm({
|
|
1958
|
-
"src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js"() {
|
|
1959
|
-
"use strict";
|
|
1960
|
-
init_errors();
|
|
1961
|
-
__name(toLowerCaseTransformer, "toLowerCaseTransformer");
|
|
1962
|
-
}
|
|
1963
|
-
});
|
|
1964
|
-
|
|
1965
|
-
// src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js
|
|
1966
|
-
function toUpperCaseTransformer(value, options, context) {
|
|
1967
|
-
if (value == null) return value;
|
|
1968
|
-
if (typeof value === "string") return value.toUpperCase();
|
|
1969
|
-
throw new InvalidArgumentError(
|
|
1970
|
-
"The property transformer %v requires a String value, but %v was given.",
|
|
1971
|
-
context.transformerName,
|
|
1972
|
-
value
|
|
1973
|
-
);
|
|
1974
|
-
}
|
|
1975
|
-
var init_to_upper_case_transformer = __esm({
|
|
1976
|
-
"src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js"() {
|
|
1977
|
-
"use strict";
|
|
1978
|
-
init_errors();
|
|
1979
|
-
__name(toUpperCaseTransformer, "toUpperCaseTransformer");
|
|
1980
|
-
}
|
|
1981
|
-
});
|
|
1982
|
-
|
|
1983
|
-
// src/definition/model/properties/property-transformer/builtin/index.js
|
|
1984
|
-
var init_builtin2 = __esm({
|
|
1985
|
-
"src/definition/model/properties/property-transformer/builtin/index.js"() {
|
|
1986
|
-
"use strict";
|
|
1987
|
-
init_trim_transformer();
|
|
1988
|
-
init_to_lower_case_transformer();
|
|
1989
|
-
init_to_upper_case_transformer();
|
|
1990
|
-
}
|
|
1991
|
-
});
|
|
1992
|
-
|
|
1993
|
-
// src/definition/model/properties/property-transformer/property-transformer-registry.js
|
|
1994
|
-
var import_js_service7, _PropertyTransformerRegistry, PropertyTransformerRegistry;
|
|
1995
|
-
var init_property_transformer_registry = __esm({
|
|
1996
|
-
"src/definition/model/properties/property-transformer/property-transformer-registry.js"() {
|
|
1997
|
-
"use strict";
|
|
1998
|
-
import_js_service7 = require("@e22m4u/js-service");
|
|
1999
|
-
init_builtin2();
|
|
2000
|
-
init_builtin2();
|
|
2001
|
-
init_builtin2();
|
|
2002
|
-
init_errors();
|
|
2003
|
-
_PropertyTransformerRegistry = class _PropertyTransformerRegistry extends import_js_service7.Service {
|
|
2004
|
-
/**
|
|
2005
|
-
* Transformers.
|
|
2006
|
-
*
|
|
2007
|
-
* @type {object}
|
|
2008
|
-
*/
|
|
2009
|
-
_transformers = {
|
|
2010
|
-
trim: trimTransformer,
|
|
2011
|
-
toUpperCase: toUpperCaseTransformer,
|
|
2012
|
-
toLowerCase: toLowerCaseTransformer
|
|
2013
|
-
};
|
|
2014
|
-
/**
|
|
2015
|
-
* Add transformer.
|
|
2016
|
-
*
|
|
2017
|
-
* @param {string} name
|
|
2018
|
-
* @param {Function} transformer
|
|
2019
|
-
* @returns {PropertyTransformerRegistry}
|
|
2020
|
-
*/
|
|
2021
|
-
addTransformer(name, transformer) {
|
|
2022
|
-
if (!name || typeof name !== "string")
|
|
2023
|
-
throw new InvalidArgumentError(
|
|
2024
|
-
"A name of the property transformer must be a non-empty String, but %v was given.",
|
|
2025
|
-
name
|
|
2026
|
-
);
|
|
2027
|
-
if (name in this._transformers)
|
|
2028
|
-
throw new InvalidArgumentError(
|
|
2029
|
-
"The property transformer %v is already defined.",
|
|
2030
|
-
name
|
|
2031
|
-
);
|
|
2032
|
-
if (typeof transformer !== "function")
|
|
2033
|
-
throw new InvalidArgumentError(
|
|
2034
|
-
"The property transformer %v must be a Function, but %v was given.",
|
|
2035
|
-
name,
|
|
2036
|
-
transformer
|
|
2037
|
-
);
|
|
2038
|
-
this._transformers[name] = transformer;
|
|
2039
|
-
return this;
|
|
2040
|
-
}
|
|
2041
|
-
/**
|
|
2042
|
-
* Has transformer.
|
|
2043
|
-
*
|
|
2044
|
-
* @param {string} name
|
|
2045
|
-
* @returns {boolean}
|
|
2046
|
-
*/
|
|
2047
|
-
hasTransformer(name) {
|
|
2048
|
-
return Boolean(this._transformers[name]);
|
|
2049
|
-
}
|
|
2050
|
-
/**
|
|
2051
|
-
* Get transformer.
|
|
2052
|
-
*
|
|
2053
|
-
* @param {string} name
|
|
2054
|
-
* @returns {Function}
|
|
2055
|
-
*/
|
|
2056
|
-
getTransformer(name) {
|
|
2057
|
-
const transformer = this._transformers[name];
|
|
2058
|
-
if (!transformer)
|
|
2059
|
-
throw new InvalidArgumentError(
|
|
2060
|
-
"The property transformer %v is not defined.",
|
|
2061
|
-
name
|
|
2062
|
-
);
|
|
2063
|
-
return transformer;
|
|
2064
|
-
}
|
|
2065
|
-
};
|
|
2066
|
-
__name(_PropertyTransformerRegistry, "PropertyTransformerRegistry");
|
|
2067
|
-
PropertyTransformerRegistry = _PropertyTransformerRegistry;
|
|
2068
|
-
}
|
|
2069
|
-
});
|
|
2070
|
-
|
|
2071
|
-
// src/definition/model/properties/property-transformer/index.js
|
|
2072
|
-
var init_property_transformer2 = __esm({
|
|
2073
|
-
"src/definition/model/properties/property-transformer/index.js"() {
|
|
2074
|
-
"use strict";
|
|
2075
|
-
init_property_transformer();
|
|
2076
|
-
init_property_transformer_registry();
|
|
2077
|
-
}
|
|
2078
|
-
});
|
|
2079
|
-
|
|
2080
1615
|
// src/definition/definition-registry.js
|
|
2081
|
-
var
|
|
1616
|
+
var import_js_service6, _DefinitionRegistry, DefinitionRegistry;
|
|
2082
1617
|
var init_definition_registry = __esm({
|
|
2083
1618
|
"src/definition/definition-registry.js"() {
|
|
2084
|
-
|
|
2085
|
-
import_js_service8 = require("@e22m4u/js-service");
|
|
1619
|
+
import_js_service6 = require("@e22m4u/js-service");
|
|
2086
1620
|
init_utils();
|
|
2087
1621
|
init_errors();
|
|
2088
1622
|
init_model();
|
|
2089
1623
|
init_definition();
|
|
2090
|
-
_DefinitionRegistry = class _DefinitionRegistry extends
|
|
1624
|
+
_DefinitionRegistry = class _DefinitionRegistry extends import_js_service6.Service {
|
|
2091
1625
|
/**
|
|
2092
1626
|
* Datasources.
|
|
2093
1627
|
*
|
|
@@ -2181,19 +1715,17 @@ var init_definition_registry = __esm({
|
|
|
2181
1715
|
});
|
|
2182
1716
|
|
|
2183
1717
|
// src/definition/model/model-definition-utils.js
|
|
2184
|
-
var
|
|
1718
|
+
var import_js_service7, import_js_empty_values, DEFAULT_PRIMARY_KEY_PROPERTY_NAME, _ModelDefinitionUtils, ModelDefinitionUtils;
|
|
2185
1719
|
var init_model_definition_utils = __esm({
|
|
2186
1720
|
"src/definition/model/model-definition-utils.js"() {
|
|
2187
|
-
|
|
2188
|
-
import_js_service9 = require("@e22m4u/js-service");
|
|
1721
|
+
import_js_service7 = require("@e22m4u/js-service");
|
|
2189
1722
|
init_properties();
|
|
2190
|
-
init_utils();
|
|
2191
|
-
init_utils();
|
|
2192
1723
|
import_js_empty_values = require("@e22m4u/js-empty-values");
|
|
2193
1724
|
init_errors();
|
|
2194
1725
|
init_definition_registry();
|
|
1726
|
+
init_utils();
|
|
2195
1727
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME = "id";
|
|
2196
|
-
_ModelDefinitionUtils = class _ModelDefinitionUtils extends
|
|
1728
|
+
_ModelDefinitionUtils = class _ModelDefinitionUtils extends import_js_service7.Service {
|
|
2197
1729
|
/**
|
|
2198
1730
|
* Get primary key as property name.
|
|
2199
1731
|
*
|
|
@@ -2595,18 +2127,17 @@ var init_model_definition_utils = __esm({
|
|
|
2595
2127
|
});
|
|
2596
2128
|
|
|
2597
2129
|
// src/definition/model/properties/property-uniqueness-validator.js
|
|
2598
|
-
var
|
|
2130
|
+
var import_js_service8, import_js_empty_values2, _PropertyUniquenessValidator, PropertyUniquenessValidator;
|
|
2599
2131
|
var init_property_uniqueness_validator = __esm({
|
|
2600
2132
|
"src/definition/model/properties/property-uniqueness-validator.js"() {
|
|
2601
|
-
"use strict";
|
|
2602
2133
|
init_data_type();
|
|
2603
|
-
|
|
2134
|
+
import_js_service8 = require("@e22m4u/js-service");
|
|
2604
2135
|
init_utils();
|
|
2605
2136
|
import_js_empty_values2 = require("@e22m4u/js-empty-values");
|
|
2606
2137
|
init_property_uniqueness();
|
|
2607
2138
|
init_errors();
|
|
2608
2139
|
init_model_definition_utils();
|
|
2609
|
-
_PropertyUniquenessValidator = class _PropertyUniquenessValidator extends
|
|
2140
|
+
_PropertyUniquenessValidator = class _PropertyUniquenessValidator extends import_js_service8.Service {
|
|
2610
2141
|
/**
|
|
2611
2142
|
* Validate.
|
|
2612
2143
|
*
|
|
@@ -2715,14 +2246,13 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2715
2246
|
});
|
|
2716
2247
|
|
|
2717
2248
|
// src/definition/model/properties/primary-keys-definition-validator.js
|
|
2718
|
-
var
|
|
2249
|
+
var import_js_service9, _PrimaryKeysDefinitionValidator, PrimaryKeysDefinitionValidator;
|
|
2719
2250
|
var init_primary_keys_definition_validator = __esm({
|
|
2720
2251
|
"src/definition/model/properties/primary-keys-definition-validator.js"() {
|
|
2721
|
-
|
|
2722
|
-
import_js_service11 = require("@e22m4u/js-service");
|
|
2252
|
+
import_js_service9 = require("@e22m4u/js-service");
|
|
2723
2253
|
init_errors();
|
|
2724
2254
|
init_model_definition_utils();
|
|
2725
|
-
_PrimaryKeysDefinitionValidator = class _PrimaryKeysDefinitionValidator extends
|
|
2255
|
+
_PrimaryKeysDefinitionValidator = class _PrimaryKeysDefinitionValidator extends import_js_service9.Service {
|
|
2726
2256
|
/**
|
|
2727
2257
|
* Validate.
|
|
2728
2258
|
*
|
|
@@ -2767,19 +2297,16 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
2767
2297
|
});
|
|
2768
2298
|
|
|
2769
2299
|
// src/definition/model/properties/properties-definition-validator.js
|
|
2770
|
-
var
|
|
2300
|
+
var import_js_service10, _PropertiesDefinitionValidator, PropertiesDefinitionValidator;
|
|
2771
2301
|
var init_properties_definition_validator = __esm({
|
|
2772
2302
|
"src/definition/model/properties/properties-definition-validator.js"() {
|
|
2773
|
-
|
|
2774
|
-
import_js_service12 = require("@e22m4u/js-service");
|
|
2303
|
+
import_js_service10 = require("@e22m4u/js-service");
|
|
2775
2304
|
init_data_type();
|
|
2776
2305
|
init_utils();
|
|
2777
2306
|
init_property_uniqueness();
|
|
2778
2307
|
init_errors();
|
|
2779
|
-
init_property_validator2();
|
|
2780
|
-
init_property_transformer2();
|
|
2781
2308
|
init_primary_keys_definition_validator();
|
|
2782
|
-
_PropertiesDefinitionValidator = class _PropertiesDefinitionValidator extends
|
|
2309
|
+
_PropertiesDefinitionValidator = class _PropertiesDefinitionValidator extends import_js_service10.Service {
|
|
2783
2310
|
/**
|
|
2784
2311
|
* Validate.
|
|
2785
2312
|
*
|
|
@@ -2969,406 +2496,49 @@ var init_properties_definition_validator = __esm({
|
|
|
2969
2496
|
propName,
|
|
2970
2497
|
modelName
|
|
2971
2498
|
);
|
|
2972
|
-
if (propDef.validate != null) {
|
|
2973
|
-
const propertyValidatorRegistry = this.getService(
|
|
2974
|
-
PropertyValidatorRegistry
|
|
2975
|
-
);
|
|
2976
|
-
if (propDef.validate && typeof propDef.validate === "string") {
|
|
2977
|
-
if (!propertyValidatorRegistry.hasValidator(propDef.validate))
|
|
2978
|
-
throw new InvalidArgumentError(
|
|
2979
|
-
"The property validator %v is not found.",
|
|
2980
|
-
propDef.validate
|
|
2981
|
-
);
|
|
2982
|
-
} else if (propDef.validate && typeof propDef.validate === "function") {
|
|
2983
|
-
} else if (Array.isArray(propDef.validate)) {
|
|
2984
|
-
for (const validatorOrName of propDef.validate) {
|
|
2985
|
-
if (validatorOrName && typeof validatorOrName === "string") {
|
|
2986
|
-
if (!propertyValidatorRegistry.hasValidator(validatorOrName))
|
|
2987
|
-
throw new InvalidArgumentError(
|
|
2988
|
-
"The property validator %v is not found.",
|
|
2989
|
-
validatorOrName
|
|
2990
|
-
);
|
|
2991
|
-
} else if (validatorOrName && typeof validatorOrName === "function") {
|
|
2992
|
-
} else {
|
|
2993
|
-
throw new InvalidArgumentError(
|
|
2994
|
-
'The provided option "validate" for the property %v in the model %v has an Array value that should contain validator names or validator functions, but %v was given.',
|
|
2995
|
-
propName,
|
|
2996
|
-
modelName,
|
|
2997
|
-
validatorOrName
|
|
2998
|
-
);
|
|
2999
|
-
}
|
|
3000
|
-
}
|
|
3001
|
-
} else if (typeof propDef.validate === "object") {
|
|
3002
|
-
Object.keys(propDef.validate).forEach((validatorName) => {
|
|
3003
|
-
if (!propertyValidatorRegistry.hasValidator(validatorName))
|
|
3004
|
-
throw new InvalidArgumentError(
|
|
3005
|
-
"The property validator %v is not found.",
|
|
3006
|
-
validatorName
|
|
3007
|
-
);
|
|
3008
|
-
});
|
|
3009
|
-
} else {
|
|
3010
|
-
throw new InvalidArgumentError(
|
|
3011
|
-
'The provided option "validate" for the property %v in the model %v should be either a validator name, a validator function, an array of validator names or functions, or an object mapping validator names to their arguments, but %v was given.',
|
|
3012
|
-
propName,
|
|
3013
|
-
modelName,
|
|
3014
|
-
propDef.validate
|
|
3015
|
-
);
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
3018
|
-
if (propDef.transform != null) {
|
|
3019
|
-
const propertyTransformerRegistry = this.getService(
|
|
3020
|
-
PropertyTransformerRegistry
|
|
3021
|
-
);
|
|
3022
|
-
if (propDef.transform && typeof propDef.transform === "string") {
|
|
3023
|
-
if (!propertyTransformerRegistry.hasTransformer(propDef.transform))
|
|
3024
|
-
throw new InvalidArgumentError(
|
|
3025
|
-
"The property transformer %v is not found.",
|
|
3026
|
-
propDef.transform
|
|
3027
|
-
);
|
|
3028
|
-
} else if (propDef.transform && typeof propDef.transform === "function") {
|
|
3029
|
-
} else if (Array.isArray(propDef.transform)) {
|
|
3030
|
-
for (const transformerOrName of propDef.transform) {
|
|
3031
|
-
if (transformerOrName && typeof transformerOrName === "string") {
|
|
3032
|
-
if (!propertyTransformerRegistry.hasTransformer(transformerOrName))
|
|
3033
|
-
throw new InvalidArgumentError(
|
|
3034
|
-
"The property transformer %v is not found.",
|
|
3035
|
-
transformerOrName
|
|
3036
|
-
);
|
|
3037
|
-
} else if (transformerOrName && typeof transformerOrName === "function") {
|
|
3038
|
-
} else {
|
|
3039
|
-
throw new InvalidArgumentError(
|
|
3040
|
-
'The provided option "transform" for the property %v in the model %v has an Array value that should contain transformer names or transformer functions, but %v was given.',
|
|
3041
|
-
propName,
|
|
3042
|
-
modelName,
|
|
3043
|
-
transformerOrName
|
|
3044
|
-
);
|
|
3045
|
-
}
|
|
3046
|
-
}
|
|
3047
|
-
} else if (typeof propDef.transform === "object") {
|
|
3048
|
-
Object.keys(propDef.transform).forEach((transformerName) => {
|
|
3049
|
-
if (!propertyTransformerRegistry.hasTransformer(transformerName))
|
|
3050
|
-
throw new InvalidArgumentError(
|
|
3051
|
-
"The property transformer %v is not found.",
|
|
3052
|
-
transformerName
|
|
3053
|
-
);
|
|
3054
|
-
});
|
|
3055
|
-
} else {
|
|
3056
|
-
throw new InvalidArgumentError(
|
|
3057
|
-
'The provided option "transform" for the property %v in the model %v should be either a transformer name, a transformer function, an array of transformer names or functions, or an object mapping transformer names to their arguments, but %v was given.',
|
|
3058
|
-
propName,
|
|
3059
|
-
modelName,
|
|
3060
|
-
propDef.transform
|
|
3061
|
-
);
|
|
3062
|
-
}
|
|
3063
|
-
}
|
|
3064
2499
|
if (propDef.unique) {
|
|
3065
|
-
if (typeof propDef.unique !== "boolean" && !Object.values(PropertyUniqueness).includes(propDef.unique)) {
|
|
3066
|
-
throw new InvalidArgumentError(
|
|
3067
|
-
'The provided option "unique" of the property %v in the model %v should be a Boolean or one of values: %l, but %v was given.',
|
|
3068
|
-
propName,
|
|
3069
|
-
modelName,
|
|
3070
|
-
Object.values(PropertyUniqueness),
|
|
3071
|
-
propDef.unique
|
|
3072
|
-
);
|
|
3073
|
-
}
|
|
3074
|
-
}
|
|
3075
|
-
if (propDef.unique && propDef.primaryKey)
|
|
3076
|
-
throw new InvalidArgumentError(
|
|
3077
|
-
'The property %v of the model %v is a primary key, so it should not have the option "unique" to be provided.',
|
|
3078
|
-
propName,
|
|
3079
|
-
modelName
|
|
3080
|
-
);
|
|
3081
|
-
}
|
|
3082
|
-
};
|
|
3083
|
-
__name(_PropertiesDefinitionValidator, "PropertiesDefinitionValidator");
|
|
3084
|
-
PropertiesDefinitionValidator = _PropertiesDefinitionValidator;
|
|
3085
|
-
}
|
|
3086
|
-
});
|
|
3087
|
-
|
|
3088
|
-
// src/definition/model/properties/index.js
|
|
3089
|
-
var init_properties = __esm({
|
|
3090
|
-
"src/definition/model/properties/index.js"() {
|
|
3091
|
-
"use strict";
|
|
3092
|
-
init_data_type();
|
|
3093
|
-
init_property_definition();
|
|
3094
|
-
init_property_uniqueness();
|
|
3095
|
-
init_property_validator2();
|
|
3096
|
-
init_property_transformer2();
|
|
3097
|
-
init_property_uniqueness_validator();
|
|
3098
|
-
init_properties_definition_validator();
|
|
3099
|
-
init_primary_keys_definition_validator();
|
|
3100
|
-
}
|
|
3101
|
-
});
|
|
3102
|
-
|
|
3103
|
-
// src/definition/model/model-definition.js
|
|
3104
|
-
var init_model_definition = __esm({
|
|
3105
|
-
"src/definition/model/model-definition.js"() {
|
|
3106
|
-
"use strict";
|
|
3107
|
-
}
|
|
3108
|
-
});
|
|
3109
|
-
|
|
3110
|
-
// src/definition/model/model-data-validator.js
|
|
3111
|
-
var import_js_service13, import_js_empty_values3, _ModelDataValidator, ModelDataValidator;
|
|
3112
|
-
var init_model_data_validator = __esm({
|
|
3113
|
-
"src/definition/model/model-data-validator.js"() {
|
|
3114
|
-
"use strict";
|
|
3115
|
-
import_js_service13 = require("@e22m4u/js-service");
|
|
3116
|
-
init_properties();
|
|
3117
|
-
init_utils();
|
|
3118
|
-
init_utils();
|
|
3119
|
-
import_js_empty_values3 = require("@e22m4u/js-empty-values");
|
|
3120
|
-
init_errors();
|
|
3121
|
-
init_properties();
|
|
3122
|
-
init_model_definition_utils();
|
|
3123
|
-
_ModelDataValidator = class _ModelDataValidator extends import_js_service13.Service {
|
|
3124
|
-
/**
|
|
3125
|
-
* Validate.
|
|
3126
|
-
*
|
|
3127
|
-
* @param {string} modelName
|
|
3128
|
-
* @param {object} modelData
|
|
3129
|
-
* @param {boolean} isPartial
|
|
3130
|
-
* @returns {undefined}
|
|
3131
|
-
*/
|
|
3132
|
-
validate(modelName, modelData, isPartial = false) {
|
|
3133
|
-
if (!isPlainObject(modelData))
|
|
3134
|
-
throw new InvalidArgumentError(
|
|
3135
|
-
"The data of the model %v should be an Object, but %v was given.",
|
|
3136
|
-
modelName,
|
|
3137
|
-
modelData
|
|
3138
|
-
);
|
|
3139
|
-
const propDefs = this.getService(
|
|
3140
|
-
ModelDefinitionUtils
|
|
3141
|
-
).getPropertiesDefinitionInBaseModelHierarchy(modelName);
|
|
3142
|
-
const propNames = Object.keys(isPartial ? modelData : propDefs);
|
|
3143
|
-
propNames.forEach((propName) => {
|
|
3144
|
-
const propDef = propDefs[propName];
|
|
3145
|
-
if (!propDef) return;
|
|
3146
|
-
this._validatePropertyValue(
|
|
3147
|
-
modelName,
|
|
3148
|
-
propName,
|
|
3149
|
-
propDef,
|
|
3150
|
-
modelData[propName]
|
|
3151
|
-
);
|
|
3152
|
-
});
|
|
3153
|
-
}
|
|
3154
|
-
/**
|
|
3155
|
-
* Validate property value.
|
|
3156
|
-
*
|
|
3157
|
-
* @param {string} modelName
|
|
3158
|
-
* @param {string} propName
|
|
3159
|
-
* @param {string|object} propDef
|
|
3160
|
-
* @param {*} propValue
|
|
3161
|
-
* @returns {undefined}
|
|
3162
|
-
*/
|
|
3163
|
-
_validatePropertyValue(modelName, propName, propDef, propValue) {
|
|
3164
|
-
const propType = this.getService(ModelDefinitionUtils).getDataTypeFromPropertyDefinition(
|
|
3165
|
-
propDef
|
|
3166
|
-
);
|
|
3167
|
-
const isEmpty = this.getService(import_js_empty_values3.EmptyValuesService).isEmptyByType(
|
|
3168
|
-
propType,
|
|
3169
|
-
propValue
|
|
3170
|
-
);
|
|
3171
|
-
if (isEmpty) {
|
|
3172
|
-
const isRequired = typeof propDef === "string" ? false : Boolean(propDef.required);
|
|
3173
|
-
if (!isRequired) return;
|
|
3174
|
-
throw new InvalidArgumentError(
|
|
3175
|
-
"The property %v of the model %v is required, but %v was given.",
|
|
3176
|
-
propName,
|
|
3177
|
-
modelName,
|
|
3178
|
-
propValue
|
|
3179
|
-
);
|
|
3180
|
-
}
|
|
3181
|
-
this._validateValueByPropertyType(modelName, propName, propDef, propValue);
|
|
3182
|
-
this._validateValueByPropertyValidators(
|
|
3183
|
-
modelName,
|
|
3184
|
-
propName,
|
|
3185
|
-
propDef,
|
|
3186
|
-
propValue
|
|
3187
|
-
);
|
|
3188
|
-
}
|
|
3189
|
-
/**
|
|
3190
|
-
* Validate value by property type.
|
|
3191
|
-
*
|
|
3192
|
-
* @param {string} modelName
|
|
3193
|
-
* @param {string} propName
|
|
3194
|
-
* @param {string|object} propDef
|
|
3195
|
-
* @param {*} propValue
|
|
3196
|
-
* @param {boolean} isArrayValue
|
|
3197
|
-
* @returns {undefined}
|
|
3198
|
-
*/
|
|
3199
|
-
_validateValueByPropertyType(modelName, propName, propDef, propValue, isArrayValue = false) {
|
|
3200
|
-
var _a;
|
|
3201
|
-
let expectingType;
|
|
3202
|
-
if (isArrayValue) {
|
|
3203
|
-
if (typeof propDef === "object") {
|
|
3204
|
-
expectingType = (_a = propDef.itemType) != null ? _a : DataType.ANY;
|
|
3205
|
-
} else {
|
|
3206
|
-
expectingType = DataType.ANY;
|
|
3207
|
-
}
|
|
3208
|
-
} else {
|
|
3209
|
-
expectingType = typeof propDef !== "string" ? propDef.type : propDef;
|
|
3210
|
-
}
|
|
3211
|
-
const createError = /* @__PURE__ */ __name((expected) => {
|
|
3212
|
-
const pattern = isArrayValue ? "The array property %v of the model %v must have %s element, but %s was given." : "The property %v of the model %v must have %s, but %s was given.";
|
|
3213
|
-
const ctorName = getCtorName(propValue);
|
|
3214
|
-
const givenStr = ctorName != null ? ctorName : typeof propValue;
|
|
3215
|
-
return new InvalidArgumentError(
|
|
3216
|
-
pattern,
|
|
3217
|
-
propName,
|
|
3218
|
-
modelName,
|
|
3219
|
-
expected,
|
|
3220
|
-
givenStr
|
|
3221
|
-
);
|
|
3222
|
-
}, "createError");
|
|
3223
|
-
switch (expectingType) {
|
|
3224
|
-
// STRING
|
|
3225
|
-
case DataType.STRING:
|
|
3226
|
-
if (typeof propValue !== "string") throw createError("a String");
|
|
3227
|
-
break;
|
|
3228
|
-
// NUMBER
|
|
3229
|
-
case DataType.NUMBER:
|
|
3230
|
-
if (typeof propValue !== "number") throw createError("a Number");
|
|
3231
|
-
break;
|
|
3232
|
-
// BOOLEAN
|
|
3233
|
-
case DataType.BOOLEAN:
|
|
3234
|
-
if (typeof propValue !== "boolean") throw createError("a Boolean");
|
|
3235
|
-
break;
|
|
3236
|
-
// ARRAY
|
|
3237
|
-
case DataType.ARRAY:
|
|
3238
|
-
if (!Array.isArray(propValue)) throw createError("an Array");
|
|
3239
|
-
propValue.forEach(
|
|
3240
|
-
(value) => this._validateValueByPropertyType(
|
|
3241
|
-
modelName,
|
|
3242
|
-
propName,
|
|
3243
|
-
propDef,
|
|
3244
|
-
value,
|
|
3245
|
-
true
|
|
3246
|
-
)
|
|
3247
|
-
);
|
|
3248
|
-
break;
|
|
3249
|
-
// OBJECT
|
|
3250
|
-
case DataType.OBJECT: {
|
|
3251
|
-
if (!isPlainObject(propValue)) throw createError("an Object");
|
|
3252
|
-
if (typeof propDef === "object") {
|
|
3253
|
-
const modelOptionField = isArrayValue ? "itemModel" : "model";
|
|
3254
|
-
const modelOptionValue = propDef[modelOptionField];
|
|
3255
|
-
if (modelOptionValue) this.validate(modelOptionValue, propValue);
|
|
3256
|
-
}
|
|
3257
|
-
break;
|
|
3258
|
-
}
|
|
3259
|
-
}
|
|
3260
|
-
}
|
|
3261
|
-
/**
|
|
3262
|
-
* Validate value by property validators.
|
|
3263
|
-
*
|
|
3264
|
-
* @param {string} modelName
|
|
3265
|
-
* @param {string} propName
|
|
3266
|
-
* @param {string|object} propDef
|
|
3267
|
-
* @param {*} propValue
|
|
3268
|
-
* @returns {undefined}
|
|
3269
|
-
*/
|
|
3270
|
-
_validateValueByPropertyValidators(modelName, propName, propDef, propValue) {
|
|
3271
|
-
if (typeof propDef === "string" || propDef.validate == null) return;
|
|
3272
|
-
const validateDef = propDef.validate;
|
|
3273
|
-
const validatorRegistry = this.getService(PropertyValidatorRegistry);
|
|
3274
|
-
const createError = /* @__PURE__ */ __name((validatorName) => {
|
|
3275
|
-
if (validatorName) {
|
|
3276
|
-
return new InvalidArgumentError(
|
|
3277
|
-
"The property %v of the model %v has the invalid value %v that caught by the property validator %v.",
|
|
3278
|
-
propName,
|
|
3279
|
-
modelName,
|
|
3280
|
-
propValue,
|
|
3281
|
-
validatorName
|
|
3282
|
-
);
|
|
3283
|
-
} else {
|
|
3284
|
-
return new InvalidArgumentError(
|
|
3285
|
-
"The property %v of the model %v has the invalid value %v that caught by a property validator.",
|
|
2500
|
+
if (typeof propDef.unique !== "boolean" && !Object.values(PropertyUniqueness).includes(propDef.unique)) {
|
|
2501
|
+
throw new InvalidArgumentError(
|
|
2502
|
+
'The provided option "unique" of the property %v in the model %v should be a Boolean or one of values: %l, but %v was given.',
|
|
3286
2503
|
propName,
|
|
3287
2504
|
modelName,
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
}
|
|
3291
|
-
}, "createError");
|
|
3292
|
-
const validateBy = /* @__PURE__ */ __name((validatorOrName, validatorOptions = void 0) => {
|
|
3293
|
-
let validatorName, validatorFn;
|
|
3294
|
-
if (typeof validatorOrName === "string") {
|
|
3295
|
-
validatorName = validatorOrName;
|
|
3296
|
-
validatorFn = validatorRegistry.getValidator(validatorName);
|
|
3297
|
-
} else if (typeof validatorOrName === "function") {
|
|
3298
|
-
validatorName = validatorOrName.name && validatorOrName.name !== "validate" ? validatorOrName.name : void 0;
|
|
3299
|
-
validatorFn = validatorOrName;
|
|
3300
|
-
} else {
|
|
3301
|
-
throw new InvalidArgumentError(
|
|
3302
|
-
"Validator must be a non-empty String or a Function, but %v was given.",
|
|
3303
|
-
validatorOrName
|
|
2505
|
+
Object.values(PropertyUniqueness),
|
|
2506
|
+
propDef.unique
|
|
3304
2507
|
);
|
|
3305
2508
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
if (valid instanceof Promise) {
|
|
3309
|
-
if (validatorName) {
|
|
3310
|
-
throw new InvalidArgumentError(
|
|
3311
|
-
"Asynchronous property validators are not supported, but the property %v of the model %v has the property validator %v that returns a Promise.",
|
|
3312
|
-
propName,
|
|
3313
|
-
modelName,
|
|
3314
|
-
validatorName
|
|
3315
|
-
);
|
|
3316
|
-
} else {
|
|
3317
|
-
throw new InvalidArgumentError(
|
|
3318
|
-
"Asynchronous property validators are not supported, but the property %v of the model %v has a property validator that returns a Promise.",
|
|
3319
|
-
propName,
|
|
3320
|
-
modelName
|
|
3321
|
-
);
|
|
3322
|
-
}
|
|
3323
|
-
} else if (valid !== true) {
|
|
3324
|
-
throw createError(validatorName);
|
|
3325
|
-
}
|
|
3326
|
-
}, "validateBy");
|
|
3327
|
-
if (validateDef && typeof validateDef === "string") {
|
|
3328
|
-
validateBy(validateDef);
|
|
3329
|
-
} else if (validateDef && typeof validateDef === "function") {
|
|
3330
|
-
validateBy(validateDef);
|
|
3331
|
-
} else if (Array.isArray(validateDef)) {
|
|
3332
|
-
validateDef.forEach((validatorOrName) => {
|
|
3333
|
-
if (!validatorOrName || typeof validatorOrName !== "string" && typeof validatorOrName !== "function") {
|
|
3334
|
-
throw new InvalidArgumentError(
|
|
3335
|
-
'The provided option "validate" for the property %v in the model %v has an Array value that should contain validator names or validator functions, but %v was given.',
|
|
3336
|
-
propName,
|
|
3337
|
-
modelName,
|
|
3338
|
-
validatorOrName
|
|
3339
|
-
);
|
|
3340
|
-
}
|
|
3341
|
-
validateBy(validatorOrName);
|
|
3342
|
-
});
|
|
3343
|
-
} else if (validateDef !== null && typeof validateDef === "object") {
|
|
3344
|
-
Object.keys(validateDef).forEach((validatorName) => {
|
|
3345
|
-
const validatorOptions = validateDef[validatorName];
|
|
3346
|
-
validateBy(validatorName, validatorOptions);
|
|
3347
|
-
});
|
|
3348
|
-
} else {
|
|
2509
|
+
}
|
|
2510
|
+
if (propDef.unique && propDef.primaryKey)
|
|
3349
2511
|
throw new InvalidArgumentError(
|
|
3350
|
-
'The
|
|
2512
|
+
'The property %v of the model %v is a primary key, so it should not have the option "unique" to be provided.',
|
|
3351
2513
|
propName,
|
|
3352
|
-
modelName
|
|
3353
|
-
validateDef
|
|
2514
|
+
modelName
|
|
3354
2515
|
);
|
|
3355
|
-
}
|
|
3356
2516
|
}
|
|
3357
2517
|
};
|
|
3358
|
-
__name(
|
|
3359
|
-
|
|
2518
|
+
__name(_PropertiesDefinitionValidator, "PropertiesDefinitionValidator");
|
|
2519
|
+
PropertiesDefinitionValidator = _PropertiesDefinitionValidator;
|
|
2520
|
+
}
|
|
2521
|
+
});
|
|
2522
|
+
|
|
2523
|
+
// src/definition/model/properties/index.js
|
|
2524
|
+
var init_properties = __esm({
|
|
2525
|
+
"src/definition/model/properties/index.js"() {
|
|
2526
|
+
init_data_type();
|
|
2527
|
+
init_property_uniqueness();
|
|
2528
|
+
init_property_uniqueness_validator();
|
|
2529
|
+
init_properties_definition_validator();
|
|
2530
|
+
init_primary_keys_definition_validator();
|
|
3360
2531
|
}
|
|
3361
2532
|
});
|
|
3362
2533
|
|
|
3363
2534
|
// src/definition/model/model-data-sanitizer.js
|
|
3364
|
-
var
|
|
2535
|
+
var import_js_service11, _ModelDataSanitizer, ModelDataSanitizer;
|
|
3365
2536
|
var init_model_data_sanitizer = __esm({
|
|
3366
2537
|
"src/definition/model/model-data-sanitizer.js"() {
|
|
3367
|
-
|
|
3368
|
-
import_js_service14 = require("@e22m4u/js-service");
|
|
2538
|
+
import_js_service11 = require("@e22m4u/js-service");
|
|
3369
2539
|
init_errors();
|
|
3370
2540
|
init_model_definition_utils();
|
|
3371
|
-
_ModelDataSanitizer = class _ModelDataSanitizer extends
|
|
2541
|
+
_ModelDataSanitizer = class _ModelDataSanitizer extends import_js_service11.Service {
|
|
3372
2542
|
/**
|
|
3373
2543
|
* Validate.
|
|
3374
2544
|
*
|
|
@@ -3397,147 +2567,15 @@ var init_model_data_sanitizer = __esm({
|
|
|
3397
2567
|
}
|
|
3398
2568
|
});
|
|
3399
2569
|
|
|
3400
|
-
// src/definition/model/model-data-transformer.js
|
|
3401
|
-
var import_js_service15, import_js_empty_values4, _ModelDataTransformer, ModelDataTransformer;
|
|
3402
|
-
var init_model_data_transformer = __esm({
|
|
3403
|
-
"src/definition/model/model-data-transformer.js"() {
|
|
3404
|
-
"use strict";
|
|
3405
|
-
import_js_service15 = require("@e22m4u/js-service");
|
|
3406
|
-
init_utils();
|
|
3407
|
-
init_utils();
|
|
3408
|
-
init_utils();
|
|
3409
|
-
import_js_empty_values4 = require("@e22m4u/js-empty-values");
|
|
3410
|
-
init_errors();
|
|
3411
|
-
init_model_definition_utils();
|
|
3412
|
-
init_properties();
|
|
3413
|
-
_ModelDataTransformer = class _ModelDataTransformer extends import_js_service15.Service {
|
|
3414
|
-
/**
|
|
3415
|
-
* Transform.
|
|
3416
|
-
*
|
|
3417
|
-
* @param {string} modelName
|
|
3418
|
-
* @param {object} modelData
|
|
3419
|
-
* @param {boolean} isPartial
|
|
3420
|
-
* @returns {object|Promise<object>}
|
|
3421
|
-
*/
|
|
3422
|
-
transform(modelName, modelData, isPartial = false) {
|
|
3423
|
-
if (!isPlainObject(modelData))
|
|
3424
|
-
throw new InvalidArgumentError(
|
|
3425
|
-
"The data of the model %v should be an Object, but %v was given.",
|
|
3426
|
-
modelName,
|
|
3427
|
-
modelData
|
|
3428
|
-
);
|
|
3429
|
-
const emptyValuesService = this.getService(import_js_empty_values4.EmptyValuesService);
|
|
3430
|
-
const modelDefinitionUtils = this.getService(ModelDefinitionUtils);
|
|
3431
|
-
const propDefs = modelDefinitionUtils.getPropertiesDefinitionInBaseModelHierarchy(
|
|
3432
|
-
modelName
|
|
3433
|
-
);
|
|
3434
|
-
const propNames = Object.keys(isPartial ? modelData : propDefs);
|
|
3435
|
-
const transformedData = cloneDeep(modelData);
|
|
3436
|
-
return propNames.reduce((transformedDataOrPromise, propName) => {
|
|
3437
|
-
const propDef = propDefs[propName];
|
|
3438
|
-
if (!propDef) return transformedDataOrPromise;
|
|
3439
|
-
const propType = modelDefinitionUtils.getDataTypeFromPropertyDefinition(propDef);
|
|
3440
|
-
const propValue = modelData[propName];
|
|
3441
|
-
const isEmpty = emptyValuesService.isEmptyByType(propType, propValue);
|
|
3442
|
-
if (isEmpty) return transformedDataOrPromise;
|
|
3443
|
-
const newPropValueOrPromise = this._transformPropertyValue(
|
|
3444
|
-
modelName,
|
|
3445
|
-
propName,
|
|
3446
|
-
propDef,
|
|
3447
|
-
propValue
|
|
3448
|
-
);
|
|
3449
|
-
return transformPromise(newPropValueOrPromise, (newPropValue) => {
|
|
3450
|
-
return transformPromise(transformedDataOrPromise, (resolvedData) => {
|
|
3451
|
-
if (newPropValue !== propValue) resolvedData[propName] = newPropValue;
|
|
3452
|
-
return resolvedData;
|
|
3453
|
-
});
|
|
3454
|
-
});
|
|
3455
|
-
}, transformedData);
|
|
3456
|
-
}
|
|
3457
|
-
/**
|
|
3458
|
-
* Transform property value.
|
|
3459
|
-
*
|
|
3460
|
-
* @param {string} modelName
|
|
3461
|
-
* @param {string} propName
|
|
3462
|
-
* @param {string|object} propDef
|
|
3463
|
-
* @param {*} propValue
|
|
3464
|
-
* @returns {*|Promise<*>}
|
|
3465
|
-
*/
|
|
3466
|
-
_transformPropertyValue(modelName, propName, propDef, propValue) {
|
|
3467
|
-
if (typeof propDef === "string" || propDef.transform == null)
|
|
3468
|
-
return propValue;
|
|
3469
|
-
const transformDef = propDef.transform;
|
|
3470
|
-
const transformerRegistry = this.getService(PropertyTransformerRegistry);
|
|
3471
|
-
const transformFn = /* @__PURE__ */ __name((value, transformerOrName, transformerOptions = void 0) => {
|
|
3472
|
-
let transformerName, transformerFn;
|
|
3473
|
-
if (typeof transformerOrName === "string") {
|
|
3474
|
-
transformerName = transformerOrName;
|
|
3475
|
-
transformerFn = transformerRegistry.getTransformer(transformerName);
|
|
3476
|
-
} else if (typeof transformerOrName === "function") {
|
|
3477
|
-
transformerName = transformerOrName.name && transformerOrName.name !== "transform" ? transformerOrName.name : void 0;
|
|
3478
|
-
transformerFn = transformerOrName;
|
|
3479
|
-
} else {
|
|
3480
|
-
throw new InvalidArgumentError(
|
|
3481
|
-
"Transformer must be a non-empty String or a Function, but %v was given.",
|
|
3482
|
-
transformerOrName
|
|
3483
|
-
);
|
|
3484
|
-
}
|
|
3485
|
-
const context = { transformerName, modelName, propName };
|
|
3486
|
-
return transformerFn(value, transformerOptions, context);
|
|
3487
|
-
}, "transformFn");
|
|
3488
|
-
if (transformDef && typeof transformDef === "string") {
|
|
3489
|
-
return transformFn(propValue, transformDef);
|
|
3490
|
-
} else if (transformDef && typeof transformDef === "function") {
|
|
3491
|
-
return transformFn(propValue, transformDef);
|
|
3492
|
-
} else if (Array.isArray(transformDef)) {
|
|
3493
|
-
return transformDef.reduce((valueOrPromise, transformerOrName) => {
|
|
3494
|
-
if (!transformerOrName || typeof transformerOrName !== "string" && typeof transformerOrName !== "function") {
|
|
3495
|
-
throw new InvalidArgumentError(
|
|
3496
|
-
'The provided option "transform" for the property %v in the model %v has an Array value that should contain transformer names or transformer functions, but %v was given.',
|
|
3497
|
-
propName,
|
|
3498
|
-
modelName,
|
|
3499
|
-
transformerOrName
|
|
3500
|
-
);
|
|
3501
|
-
}
|
|
3502
|
-
return transformPromise(valueOrPromise, (value) => {
|
|
3503
|
-
return transformFn(value, transformerOrName);
|
|
3504
|
-
});
|
|
3505
|
-
}, propValue);
|
|
3506
|
-
} else if (transformDef !== null && typeof transformDef === "object") {
|
|
3507
|
-
return Object.keys(transformDef).reduce(
|
|
3508
|
-
(valueOrPromise, transformerName) => {
|
|
3509
|
-
const transformerOptions = transformDef[transformerName];
|
|
3510
|
-
return transformPromise(valueOrPromise, (value) => {
|
|
3511
|
-
return transformFn(value, transformerName, transformerOptions);
|
|
3512
|
-
});
|
|
3513
|
-
},
|
|
3514
|
-
propValue
|
|
3515
|
-
);
|
|
3516
|
-
} else {
|
|
3517
|
-
throw new InvalidArgumentError(
|
|
3518
|
-
'The provided option "transform" for the property %v in the model %v should be either a transformer name, a transformer function, an array of transformer names or functions, or an object mapping transformer names to their arguments, but %v was given.',
|
|
3519
|
-
propName,
|
|
3520
|
-
modelName,
|
|
3521
|
-
transformDef
|
|
3522
|
-
);
|
|
3523
|
-
}
|
|
3524
|
-
}
|
|
3525
|
-
};
|
|
3526
|
-
__name(_ModelDataTransformer, "ModelDataTransformer");
|
|
3527
|
-
ModelDataTransformer = _ModelDataTransformer;
|
|
3528
|
-
}
|
|
3529
|
-
});
|
|
3530
|
-
|
|
3531
2570
|
// src/definition/model/model-definition-validator.js
|
|
3532
|
-
var
|
|
2571
|
+
var import_js_service12, _ModelDefinitionValidator, ModelDefinitionValidator;
|
|
3533
2572
|
var init_model_definition_validator = __esm({
|
|
3534
2573
|
"src/definition/model/model-definition-validator.js"() {
|
|
3535
|
-
|
|
3536
|
-
import_js_service16 = require("@e22m4u/js-service");
|
|
2574
|
+
import_js_service12 = require("@e22m4u/js-service");
|
|
3537
2575
|
init_errors();
|
|
3538
2576
|
init_relations();
|
|
3539
2577
|
init_properties();
|
|
3540
|
-
_ModelDefinitionValidator = class _ModelDefinitionValidator extends
|
|
2578
|
+
_ModelDefinitionValidator = class _ModelDefinitionValidator extends import_js_service12.Service {
|
|
3541
2579
|
/**
|
|
3542
2580
|
* Validate.
|
|
3543
2581
|
*
|
|
@@ -3608,26 +2646,21 @@ var init_model_definition_validator = __esm({
|
|
|
3608
2646
|
// src/definition/model/index.js
|
|
3609
2647
|
var init_model = __esm({
|
|
3610
2648
|
"src/definition/model/index.js"() {
|
|
3611
|
-
"use strict";
|
|
3612
2649
|
init_relations();
|
|
3613
2650
|
init_properties();
|
|
3614
|
-
init_model_definition();
|
|
3615
|
-
init_model_data_validator();
|
|
3616
2651
|
init_model_data_sanitizer();
|
|
3617
|
-
init_model_data_transformer();
|
|
3618
2652
|
init_model_definition_utils();
|
|
3619
2653
|
init_model_definition_validator();
|
|
3620
2654
|
}
|
|
3621
2655
|
});
|
|
3622
2656
|
|
|
3623
2657
|
// src/definition/datasource/datasource-definition-validator.js
|
|
3624
|
-
var
|
|
2658
|
+
var import_js_service13, _DatasourceDefinitionValidator, DatasourceDefinitionValidator;
|
|
3625
2659
|
var init_datasource_definition_validator = __esm({
|
|
3626
2660
|
"src/definition/datasource/datasource-definition-validator.js"() {
|
|
3627
|
-
|
|
3628
|
-
import_js_service17 = require("@e22m4u/js-service");
|
|
2661
|
+
import_js_service13 = require("@e22m4u/js-service");
|
|
3629
2662
|
init_errors();
|
|
3630
|
-
_DatasourceDefinitionValidator = class _DatasourceDefinitionValidator extends
|
|
2663
|
+
_DatasourceDefinitionValidator = class _DatasourceDefinitionValidator extends import_js_service13.Service {
|
|
3631
2664
|
/**
|
|
3632
2665
|
* Validate.
|
|
3633
2666
|
*
|
|
@@ -3660,7 +2693,6 @@ var init_datasource_definition_validator = __esm({
|
|
|
3660
2693
|
// src/definition/datasource/index.js
|
|
3661
2694
|
var init_datasource = __esm({
|
|
3662
2695
|
"src/definition/datasource/index.js"() {
|
|
3663
|
-
"use strict";
|
|
3664
2696
|
init_datasource_definition_validator();
|
|
3665
2697
|
}
|
|
3666
2698
|
});
|
|
@@ -3668,7 +2700,6 @@ var init_datasource = __esm({
|
|
|
3668
2700
|
// src/definition/index.js
|
|
3669
2701
|
var init_definition = __esm({
|
|
3670
2702
|
"src/definition/index.js"() {
|
|
3671
|
-
"use strict";
|
|
3672
2703
|
init_model();
|
|
3673
2704
|
init_datasource();
|
|
3674
2705
|
init_definition_registry();
|
|
@@ -3676,15 +2707,14 @@ var init_definition = __esm({
|
|
|
3676
2707
|
});
|
|
3677
2708
|
|
|
3678
2709
|
// src/filter/fields-clause-tool.js
|
|
3679
|
-
var
|
|
2710
|
+
var import_js_service14, _FieldsClauseTool, FieldsClauseTool;
|
|
3680
2711
|
var init_fields_clause_tool = __esm({
|
|
3681
2712
|
"src/filter/fields-clause-tool.js"() {
|
|
3682
|
-
|
|
3683
|
-
import_js_service18 = require("@e22m4u/js-service");
|
|
2713
|
+
import_js_service14 = require("@e22m4u/js-service");
|
|
3684
2714
|
init_utils();
|
|
3685
2715
|
init_errors();
|
|
3686
2716
|
init_definition();
|
|
3687
|
-
_FieldsClauseTool = class _FieldsClauseTool extends
|
|
2717
|
+
_FieldsClauseTool = class _FieldsClauseTool extends import_js_service14.Service {
|
|
3688
2718
|
/**
|
|
3689
2719
|
* Filter.
|
|
3690
2720
|
*
|
|
@@ -3768,15 +2798,14 @@ var init_fields_clause_tool = __esm({
|
|
|
3768
2798
|
});
|
|
3769
2799
|
|
|
3770
2800
|
// src/adapter/decorator/inclusion-decorator.js
|
|
3771
|
-
var
|
|
2801
|
+
var import_js_service15, _InclusionDecorator, InclusionDecorator;
|
|
3772
2802
|
var init_inclusion_decorator = __esm({
|
|
3773
2803
|
"src/adapter/decorator/inclusion-decorator.js"() {
|
|
3774
|
-
"use strict";
|
|
3775
2804
|
init_adapter();
|
|
3776
|
-
|
|
2805
|
+
import_js_service15 = require("@e22m4u/js-service");
|
|
3777
2806
|
init_filter();
|
|
3778
2807
|
init_errors();
|
|
3779
|
-
_InclusionDecorator = class _InclusionDecorator extends
|
|
2808
|
+
_InclusionDecorator = class _InclusionDecorator extends import_js_service15.Service {
|
|
3780
2809
|
/**
|
|
3781
2810
|
* Decorate.
|
|
3782
2811
|
*
|
|
@@ -3857,15 +2886,14 @@ var init_inclusion_decorator = __esm({
|
|
|
3857
2886
|
});
|
|
3858
2887
|
|
|
3859
2888
|
// src/adapter/decorator/default-values-decorator.js
|
|
3860
|
-
var
|
|
2889
|
+
var import_js_service16, _DefaultValuesDecorator, DefaultValuesDecorator;
|
|
3861
2890
|
var init_default_values_decorator = __esm({
|
|
3862
2891
|
"src/adapter/decorator/default-values-decorator.js"() {
|
|
3863
|
-
"use strict";
|
|
3864
2892
|
init_adapter();
|
|
3865
|
-
|
|
2893
|
+
import_js_service16 = require("@e22m4u/js-service");
|
|
3866
2894
|
init_errors();
|
|
3867
2895
|
init_definition();
|
|
3868
|
-
_DefaultValuesDecorator = class _DefaultValuesDecorator extends
|
|
2896
|
+
_DefaultValuesDecorator = class _DefaultValuesDecorator extends import_js_service16.Service {
|
|
3869
2897
|
/**
|
|
3870
2898
|
* Decorate.
|
|
3871
2899
|
*
|
|
@@ -3922,15 +2950,14 @@ var init_default_values_decorator = __esm({
|
|
|
3922
2950
|
});
|
|
3923
2951
|
|
|
3924
2952
|
// src/adapter/decorator/data-sanitizing-decorator.js
|
|
3925
|
-
var
|
|
2953
|
+
var import_js_service17, _DataSanitizingDecorator, DataSanitizingDecorator;
|
|
3926
2954
|
var init_data_sanitizing_decorator = __esm({
|
|
3927
2955
|
"src/adapter/decorator/data-sanitizing-decorator.js"() {
|
|
3928
|
-
"use strict";
|
|
3929
2956
|
init_adapter();
|
|
3930
|
-
|
|
2957
|
+
import_js_service17 = require("@e22m4u/js-service");
|
|
3931
2958
|
init_errors();
|
|
3932
2959
|
init_definition();
|
|
3933
|
-
_DataSanitizingDecorator = class _DataSanitizingDecorator extends
|
|
2960
|
+
_DataSanitizingDecorator = class _DataSanitizingDecorator extends import_js_service17.Service {
|
|
3934
2961
|
/**
|
|
3935
2962
|
* Decorate.
|
|
3936
2963
|
*
|
|
@@ -3976,70 +3003,15 @@ var init_data_sanitizing_decorator = __esm({
|
|
|
3976
3003
|
}
|
|
3977
3004
|
});
|
|
3978
3005
|
|
|
3979
|
-
// src/adapter/decorator/data-validation-decorator.js
|
|
3980
|
-
var import_js_service22, _DataValidationDecorator, DataValidationDecorator;
|
|
3981
|
-
var init_data_validation_decorator = __esm({
|
|
3982
|
-
"src/adapter/decorator/data-validation-decorator.js"() {
|
|
3983
|
-
"use strict";
|
|
3984
|
-
init_adapter();
|
|
3985
|
-
import_js_service22 = require("@e22m4u/js-service");
|
|
3986
|
-
init_errors();
|
|
3987
|
-
init_definition();
|
|
3988
|
-
_DataValidationDecorator = class _DataValidationDecorator extends import_js_service22.Service {
|
|
3989
|
-
/**
|
|
3990
|
-
* Decorate.
|
|
3991
|
-
*
|
|
3992
|
-
* @param {Adapter} adapter
|
|
3993
|
-
*/
|
|
3994
|
-
decorate(adapter) {
|
|
3995
|
-
if (!adapter || !(adapter instanceof Adapter))
|
|
3996
|
-
throw new InvalidArgumentError(
|
|
3997
|
-
"The first argument of DataValidationDecorator.decorate should be an Adapter instance, but %v was given.",
|
|
3998
|
-
adapter
|
|
3999
|
-
);
|
|
4000
|
-
const validator = this.getService(ModelDataValidator);
|
|
4001
|
-
const create = adapter.create;
|
|
4002
|
-
adapter.create = function(modelName, modelData, filter) {
|
|
4003
|
-
validator.validate(modelName, modelData);
|
|
4004
|
-
return create.call(this, modelName, modelData, filter);
|
|
4005
|
-
};
|
|
4006
|
-
const replaceById = adapter.replaceById;
|
|
4007
|
-
adapter.replaceById = function(modelName, id, modelData, filter) {
|
|
4008
|
-
validator.validate(modelName, modelData);
|
|
4009
|
-
return replaceById.call(this, modelName, id, modelData, filter);
|
|
4010
|
-
};
|
|
4011
|
-
const replaceOrCreate = adapter.replaceOrCreate;
|
|
4012
|
-
adapter.replaceOrCreate = function(modelName, modelData, filter) {
|
|
4013
|
-
validator.validate(modelName, modelData);
|
|
4014
|
-
return replaceOrCreate.call(this, modelName, modelData, filter);
|
|
4015
|
-
};
|
|
4016
|
-
const patch = adapter.patch;
|
|
4017
|
-
adapter.patch = function(modelName, modelData, where) {
|
|
4018
|
-
validator.validate(modelName, modelData, true);
|
|
4019
|
-
return patch.call(this, modelName, modelData, where);
|
|
4020
|
-
};
|
|
4021
|
-
const patchById = adapter.patchById;
|
|
4022
|
-
adapter.patchById = function(modelName, id, modelData, filter) {
|
|
4023
|
-
validator.validate(modelName, modelData, true);
|
|
4024
|
-
return patchById.call(this, modelName, id, modelData, filter);
|
|
4025
|
-
};
|
|
4026
|
-
}
|
|
4027
|
-
};
|
|
4028
|
-
__name(_DataValidationDecorator, "DataValidationDecorator");
|
|
4029
|
-
DataValidationDecorator = _DataValidationDecorator;
|
|
4030
|
-
}
|
|
4031
|
-
});
|
|
4032
|
-
|
|
4033
3006
|
// src/adapter/decorator/fields-filtering-decorator.js
|
|
4034
|
-
var
|
|
3007
|
+
var import_js_service18, _FieldsFilteringDecorator, FieldsFilteringDecorator;
|
|
4035
3008
|
var init_fields_filtering_decorator = __esm({
|
|
4036
3009
|
"src/adapter/decorator/fields-filtering-decorator.js"() {
|
|
4037
|
-
"use strict";
|
|
4038
3010
|
init_adapter();
|
|
4039
|
-
|
|
3011
|
+
import_js_service18 = require("@e22m4u/js-service");
|
|
4040
3012
|
init_filter();
|
|
4041
3013
|
init_errors();
|
|
4042
|
-
_FieldsFilteringDecorator = class _FieldsFilteringDecorator extends
|
|
3014
|
+
_FieldsFilteringDecorator = class _FieldsFilteringDecorator extends import_js_service18.Service {
|
|
4043
3015
|
/**
|
|
4044
3016
|
* Decorate.
|
|
4045
3017
|
*
|
|
@@ -4113,70 +3085,15 @@ var init_fields_filtering_decorator = __esm({
|
|
|
4113
3085
|
}
|
|
4114
3086
|
});
|
|
4115
3087
|
|
|
4116
|
-
// src/adapter/decorator/data-transformation-decorator.js
|
|
4117
|
-
var import_js_service24, _DataTransformationDecorator, DataTransformationDecorator;
|
|
4118
|
-
var init_data_transformation_decorator = __esm({
|
|
4119
|
-
"src/adapter/decorator/data-transformation-decorator.js"() {
|
|
4120
|
-
"use strict";
|
|
4121
|
-
init_adapter();
|
|
4122
|
-
import_js_service24 = require("@e22m4u/js-service");
|
|
4123
|
-
init_errors();
|
|
4124
|
-
init_definition();
|
|
4125
|
-
_DataTransformationDecorator = class _DataTransformationDecorator extends import_js_service24.Service {
|
|
4126
|
-
/**
|
|
4127
|
-
* Decorate.
|
|
4128
|
-
*
|
|
4129
|
-
* @param {Adapter} adapter
|
|
4130
|
-
*/
|
|
4131
|
-
decorate(adapter) {
|
|
4132
|
-
if (!adapter || !(adapter instanceof Adapter))
|
|
4133
|
-
throw new InvalidArgumentError(
|
|
4134
|
-
"The first argument of DataTransformerDecorator.decorate should be an Adapter instance, but %v was given.",
|
|
4135
|
-
adapter
|
|
4136
|
-
);
|
|
4137
|
-
const transformer = this.getService(ModelDataTransformer);
|
|
4138
|
-
const create = adapter.create;
|
|
4139
|
-
adapter.create = async function(modelName, modelData, filter) {
|
|
4140
|
-
modelData = await transformer.transform(modelName, modelData);
|
|
4141
|
-
return create.call(this, modelName, modelData, filter);
|
|
4142
|
-
};
|
|
4143
|
-
const replaceById = adapter.replaceById;
|
|
4144
|
-
adapter.replaceById = async function(modelName, id, modelData, filter) {
|
|
4145
|
-
modelData = await transformer.transform(modelName, modelData);
|
|
4146
|
-
return replaceById.call(this, modelName, id, modelData, filter);
|
|
4147
|
-
};
|
|
4148
|
-
const replaceOrCreate = adapter.replaceOrCreate;
|
|
4149
|
-
adapter.replaceOrCreate = async function(modelName, modelData, filter) {
|
|
4150
|
-
modelData = await transformer.transform(modelName, modelData);
|
|
4151
|
-
return replaceOrCreate.call(this, modelName, modelData, filter);
|
|
4152
|
-
};
|
|
4153
|
-
const patch = adapter.patch;
|
|
4154
|
-
adapter.patch = async function(modelName, modelData, where) {
|
|
4155
|
-
modelData = await transformer.transform(modelName, modelData, true);
|
|
4156
|
-
return patch.call(this, modelName, modelData, where);
|
|
4157
|
-
};
|
|
4158
|
-
const patchById = adapter.patchById;
|
|
4159
|
-
adapter.patchById = async function(modelName, id, modelData, filter) {
|
|
4160
|
-
modelData = await transformer.transform(modelName, modelData, true);
|
|
4161
|
-
return patchById.call(this, modelName, id, modelData, filter);
|
|
4162
|
-
};
|
|
4163
|
-
}
|
|
4164
|
-
};
|
|
4165
|
-
__name(_DataTransformationDecorator, "DataTransformationDecorator");
|
|
4166
|
-
DataTransformationDecorator = _DataTransformationDecorator;
|
|
4167
|
-
}
|
|
4168
|
-
});
|
|
4169
|
-
|
|
4170
3088
|
// src/adapter/decorator/property-uniqueness-decorator.js
|
|
4171
|
-
var
|
|
3089
|
+
var import_js_service19, _PropertyUniquenessDecorator, PropertyUniquenessDecorator;
|
|
4172
3090
|
var init_property_uniqueness_decorator = __esm({
|
|
4173
3091
|
"src/adapter/decorator/property-uniqueness-decorator.js"() {
|
|
4174
|
-
"use strict";
|
|
4175
3092
|
init_adapter();
|
|
4176
|
-
|
|
3093
|
+
import_js_service19 = require("@e22m4u/js-service");
|
|
4177
3094
|
init_errors();
|
|
4178
3095
|
init_definition();
|
|
4179
|
-
_PropertyUniquenessDecorator = class _PropertyUniquenessDecorator extends
|
|
3096
|
+
_PropertyUniquenessDecorator = class _PropertyUniquenessDecorator extends import_js_service19.Service {
|
|
4180
3097
|
/**
|
|
4181
3098
|
* Decorate.
|
|
4182
3099
|
*
|
|
@@ -4246,33 +3163,23 @@ var init_property_uniqueness_decorator = __esm({
|
|
|
4246
3163
|
// src/adapter/decorator/index.js
|
|
4247
3164
|
var init_decorator = __esm({
|
|
4248
3165
|
"src/adapter/decorator/index.js"() {
|
|
4249
|
-
"use strict";
|
|
4250
3166
|
init_inclusion_decorator();
|
|
4251
3167
|
init_default_values_decorator();
|
|
4252
3168
|
init_data_sanitizing_decorator();
|
|
4253
|
-
init_data_validation_decorator();
|
|
4254
3169
|
init_fields_filtering_decorator();
|
|
4255
|
-
init_data_transformation_decorator();
|
|
4256
3170
|
init_property_uniqueness_decorator();
|
|
4257
3171
|
}
|
|
4258
3172
|
});
|
|
4259
3173
|
|
|
4260
3174
|
// src/adapter/adapter.js
|
|
4261
|
-
var
|
|
3175
|
+
var import_js_service20, ADAPTER_CLASS_NAME, _Adapter, Adapter;
|
|
4262
3176
|
var init_adapter = __esm({
|
|
4263
3177
|
"src/adapter/adapter.js"() {
|
|
4264
|
-
|
|
4265
|
-
import_js_service26 = require("@e22m4u/js-service");
|
|
3178
|
+
import_js_service20 = require("@e22m4u/js-service");
|
|
4266
3179
|
init_errors();
|
|
4267
3180
|
init_decorator();
|
|
4268
|
-
init_decorator();
|
|
4269
|
-
init_decorator();
|
|
4270
|
-
init_decorator();
|
|
4271
|
-
init_decorator();
|
|
4272
|
-
init_decorator();
|
|
4273
|
-
init_decorator();
|
|
4274
3181
|
ADAPTER_CLASS_NAME = "Adapter";
|
|
4275
|
-
_Adapter = class _Adapter extends
|
|
3182
|
+
_Adapter = class _Adapter extends import_js_service20.Service {
|
|
4276
3183
|
/**
|
|
4277
3184
|
* Settings.
|
|
4278
3185
|
*
|
|
@@ -4299,8 +3206,6 @@ var init_adapter = __esm({
|
|
|
4299
3206
|
if (this.constructor !== _Adapter) {
|
|
4300
3207
|
this.getService(DataSanitizingDecorator).decorate(this);
|
|
4301
3208
|
this.getService(DefaultValuesDecorator).decorate(this);
|
|
4302
|
-
this.getService(DataTransformationDecorator).decorate(this);
|
|
4303
|
-
this.getService(DataValidationDecorator).decorate(this);
|
|
4304
3209
|
this.getService(PropertyUniquenessDecorator).decorate(this);
|
|
4305
3210
|
this.getService(FieldsFilteringDecorator).decorate(this);
|
|
4306
3211
|
this.getService(InclusionDecorator).decorate(this);
|
|
@@ -4460,11 +3365,11 @@ var init_adapter = __esm({
|
|
|
4460
3365
|
};
|
|
4461
3366
|
__name(_Adapter, "Adapter");
|
|
4462
3367
|
/**
|
|
4463
|
-
*
|
|
3368
|
+
* Kinds.
|
|
4464
3369
|
*
|
|
4465
|
-
* @type {string}
|
|
3370
|
+
* @type {string[]}
|
|
4466
3371
|
*/
|
|
4467
|
-
__publicField(_Adapter, "kinds", [...
|
|
3372
|
+
__publicField(_Adapter, "kinds", [...import_js_service20.Service.kinds, ADAPTER_CLASS_NAME]);
|
|
4468
3373
|
Adapter = _Adapter;
|
|
4469
3374
|
}
|
|
4470
3375
|
});
|
|
@@ -4477,16 +3382,11 @@ __export(memory_adapter_exports, {
|
|
|
4477
3382
|
var _MemoryAdapter, MemoryAdapter;
|
|
4478
3383
|
var init_memory_adapter = __esm({
|
|
4479
3384
|
"src/adapter/builtin/memory-adapter.js"() {
|
|
4480
|
-
"use strict";
|
|
4481
3385
|
init_adapter();
|
|
4482
3386
|
init_utils();
|
|
4483
|
-
init_utils();
|
|
4484
|
-
init_definition();
|
|
4485
|
-
init_filter();
|
|
4486
|
-
init_filter();
|
|
4487
|
-
init_filter();
|
|
4488
3387
|
init_errors();
|
|
4489
3388
|
init_definition();
|
|
3389
|
+
init_filter();
|
|
4490
3390
|
_MemoryAdapter = class _MemoryAdapter extends Adapter {
|
|
4491
3391
|
/**
|
|
4492
3392
|
* Tables.
|
|
@@ -4523,10 +3423,9 @@ var init_memory_adapter = __esm({
|
|
|
4523
3423
|
*/
|
|
4524
3424
|
_genNextIdValue(modelName, propName) {
|
|
4525
3425
|
var _a;
|
|
4526
|
-
const
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
if (propType !== DataType.ANY && propType !== DataType.NUMBER)
|
|
3426
|
+
const modelUtils = this.getService(ModelDefinitionUtils);
|
|
3427
|
+
const propType = modelUtils.getDataTypeByPropertyName(modelName, propName);
|
|
3428
|
+
if (propType !== DataType.ANY && propType !== DataType.NUMBER) {
|
|
4530
3429
|
throw new InvalidArgumentError(
|
|
4531
3430
|
"The memory adapter able to generate only Number identifiers, but the primary key %v of the model %v is defined as %s. Do provide your own value for the %v property, or change the type in the primary key definition to a Number that will be generated automatically.",
|
|
4532
3431
|
propName,
|
|
@@ -4534,16 +3433,34 @@ var init_memory_adapter = __esm({
|
|
|
4534
3433
|
capitalize(propType),
|
|
4535
3434
|
propName
|
|
4536
3435
|
);
|
|
4537
|
-
|
|
4538
|
-
const
|
|
4539
|
-
const nextId = lastId + 1;
|
|
4540
|
-
this._lastIds.set(tableName, nextId);
|
|
3436
|
+
}
|
|
3437
|
+
const tableName = modelUtils.getTableNameByModelName(modelName);
|
|
4541
3438
|
const table = this._getTableOrCreate(modelName);
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
3439
|
+
let nextId = (_a = this._lastIds.get(tableName)) != null ? _a : 0;
|
|
3440
|
+
do {
|
|
3441
|
+
nextId++;
|
|
3442
|
+
} while (table.has(nextId));
|
|
3443
|
+
this._lastIds.set(tableName, nextId);
|
|
4545
3444
|
return nextId;
|
|
4546
3445
|
}
|
|
3446
|
+
/**
|
|
3447
|
+
* Update last id value if needed.
|
|
3448
|
+
*
|
|
3449
|
+
* Если переданное значение последнего использованного
|
|
3450
|
+
* идентификатора больше текущего, то текущее значение
|
|
3451
|
+
* перезаписывается полученным.
|
|
3452
|
+
*
|
|
3453
|
+
* @param {string} modelName
|
|
3454
|
+
* @param {number} idValue
|
|
3455
|
+
*/
|
|
3456
|
+
_updateLastIdValueIfNeeded(modelName, idValue) {
|
|
3457
|
+
var _a;
|
|
3458
|
+
const tableName = this.getService(ModelDefinitionUtils).getTableNameByModelName(modelName);
|
|
3459
|
+
const currentLastId = (_a = this._lastIds.get(tableName)) != null ? _a : 0;
|
|
3460
|
+
if (idValue > currentLastId) {
|
|
3461
|
+
this._lastIds.set(tableName, idValue);
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
4547
3464
|
/**
|
|
4548
3465
|
* Create
|
|
4549
3466
|
*
|
|
@@ -4560,6 +3477,8 @@ var init_memory_adapter = __esm({
|
|
|
4560
3477
|
let idValue = modelData[pkPropName];
|
|
4561
3478
|
if (idValue == null || idValue === "" || idValue === 0) {
|
|
4562
3479
|
idValue = this._genNextIdValue(modelName, pkPropName);
|
|
3480
|
+
} else if (typeof idValue === "number") {
|
|
3481
|
+
this._updateLastIdValueIfNeeded(modelName, idValue);
|
|
4563
3482
|
}
|
|
4564
3483
|
const table = this._getTableOrCreate(modelName);
|
|
4565
3484
|
if (table.has(idValue))
|
|
@@ -4628,6 +3547,8 @@ var init_memory_adapter = __esm({
|
|
|
4628
3547
|
let idValue = modelData[pkPropName];
|
|
4629
3548
|
if (idValue == null || idValue === "" || idValue === 0) {
|
|
4630
3549
|
idValue = this._genNextIdValue(modelName, pkPropName);
|
|
3550
|
+
} else if (typeof idValue === "number") {
|
|
3551
|
+
this._updateLastIdValueIfNeeded(modelName, idValue);
|
|
4631
3552
|
}
|
|
4632
3553
|
const table = this._getTableOrCreate(modelName);
|
|
4633
3554
|
modelData = cloneDeep(modelData);
|
|
@@ -4873,16 +3794,14 @@ function findAdapterCtorInModule(module2) {
|
|
|
4873
3794
|
}
|
|
4874
3795
|
return adapterCtor;
|
|
4875
3796
|
}
|
|
4876
|
-
var
|
|
3797
|
+
var import_js_service21, _AdapterLoader, AdapterLoader;
|
|
4877
3798
|
var init_adapter_loader = __esm({
|
|
4878
3799
|
"src/adapter/adapter-loader.js"() {
|
|
4879
|
-
|
|
4880
|
-
init_adapter();
|
|
4881
|
-
import_js_service27 = require("@e22m4u/js-service");
|
|
4882
|
-
init_adapter();
|
|
3800
|
+
import_js_service21 = require("@e22m4u/js-service");
|
|
4883
3801
|
init_errors();
|
|
3802
|
+
init_adapter();
|
|
4884
3803
|
init_();
|
|
4885
|
-
_AdapterLoader = class _AdapterLoader extends
|
|
3804
|
+
_AdapterLoader = class _AdapterLoader extends import_js_service21.Service {
|
|
4886
3805
|
/**
|
|
4887
3806
|
* Load by name.
|
|
4888
3807
|
*
|
|
@@ -4900,13 +3819,13 @@ var init_adapter_loader = __esm({
|
|
|
4900
3819
|
try {
|
|
4901
3820
|
const module2 = await globImport_builtin_adapter_js(`./builtin/${adapterName}-adapter.js`);
|
|
4902
3821
|
adapterCtor = findAdapterCtorInModule(module2);
|
|
4903
|
-
} catch
|
|
3822
|
+
} catch {
|
|
4904
3823
|
}
|
|
4905
3824
|
if (!adapterCtor)
|
|
4906
3825
|
try {
|
|
4907
3826
|
const module2 = await Promise.resolve().then(() => __toESM(require(`@e22m4u/js-repository-${adapterName}-adapter`)));
|
|
4908
3827
|
adapterCtor = findAdapterCtorInModule(module2);
|
|
4909
|
-
} catch
|
|
3828
|
+
} catch {
|
|
4910
3829
|
}
|
|
4911
3830
|
if (!adapterCtor)
|
|
4912
3831
|
throw new InvalidArgumentError(
|
|
@@ -4923,15 +3842,14 @@ var init_adapter_loader = __esm({
|
|
|
4923
3842
|
});
|
|
4924
3843
|
|
|
4925
3844
|
// src/adapter/adapter-registry.js
|
|
4926
|
-
var
|
|
3845
|
+
var import_js_service22, _AdapterRegistry, AdapterRegistry;
|
|
4927
3846
|
var init_adapter_registry = __esm({
|
|
4928
3847
|
"src/adapter/adapter-registry.js"() {
|
|
4929
|
-
"use strict";
|
|
4930
3848
|
init_adapter();
|
|
4931
|
-
|
|
3849
|
+
import_js_service22 = require("@e22m4u/js-service");
|
|
4932
3850
|
init_adapter_loader();
|
|
4933
3851
|
init_definition();
|
|
4934
|
-
_AdapterRegistry = class _AdapterRegistry extends
|
|
3852
|
+
_AdapterRegistry = class _AdapterRegistry extends import_js_service22.Service {
|
|
4935
3853
|
/**
|
|
4936
3854
|
* Adapters.
|
|
4937
3855
|
*
|
|
@@ -4965,7 +3883,6 @@ var init_adapter_registry = __esm({
|
|
|
4965
3883
|
// src/adapter/index.js
|
|
4966
3884
|
var init_adapter2 = __esm({
|
|
4967
3885
|
"src/adapter/index.js"() {
|
|
4968
|
-
"use strict";
|
|
4969
3886
|
init_adapter();
|
|
4970
3887
|
init_adapter_loader();
|
|
4971
3888
|
init_adapter_registry();
|
|
@@ -4973,16 +3890,14 @@ var init_adapter2 = __esm({
|
|
|
4973
3890
|
});
|
|
4974
3891
|
|
|
4975
3892
|
// src/repository/repository.js
|
|
4976
|
-
var
|
|
3893
|
+
var import_js_service23, _Repository, Repository;
|
|
4977
3894
|
var init_repository = __esm({
|
|
4978
3895
|
"src/repository/repository.js"() {
|
|
4979
|
-
|
|
4980
|
-
import_js_service29 = require("@e22m4u/js-service");
|
|
4981
|
-
init_adapter2();
|
|
4982
|
-
init_adapter2();
|
|
3896
|
+
import_js_service23 = require("@e22m4u/js-service");
|
|
4983
3897
|
init_errors();
|
|
4984
3898
|
init_definition();
|
|
4985
|
-
|
|
3899
|
+
init_adapter2();
|
|
3900
|
+
_Repository = class _Repository extends import_js_service23.Service {
|
|
4986
3901
|
/**
|
|
4987
3902
|
* Model name.
|
|
4988
3903
|
*
|
|
@@ -5176,15 +4091,14 @@ var init_repository = __esm({
|
|
|
5176
4091
|
});
|
|
5177
4092
|
|
|
5178
4093
|
// src/repository/repository-registry.js
|
|
5179
|
-
var
|
|
4094
|
+
var import_js_service24, _RepositoryRegistry, RepositoryRegistry;
|
|
5180
4095
|
var init_repository_registry = __esm({
|
|
5181
4096
|
"src/repository/repository-registry.js"() {
|
|
5182
|
-
|
|
5183
|
-
import_js_service30 = require("@e22m4u/js-service");
|
|
4097
|
+
import_js_service24 = require("@e22m4u/js-service");
|
|
5184
4098
|
init_repository();
|
|
5185
4099
|
init_utils();
|
|
5186
4100
|
init_errors();
|
|
5187
|
-
_RepositoryRegistry = class _RepositoryRegistry extends
|
|
4101
|
+
_RepositoryRegistry = class _RepositoryRegistry extends import_js_service24.Service {
|
|
5188
4102
|
/**
|
|
5189
4103
|
* Repositories.
|
|
5190
4104
|
*
|
|
@@ -5235,24 +4149,21 @@ var init_repository_registry = __esm({
|
|
|
5235
4149
|
// src/repository/index.js
|
|
5236
4150
|
var init_repository2 = __esm({
|
|
5237
4151
|
"src/repository/index.js"() {
|
|
5238
|
-
"use strict";
|
|
5239
4152
|
init_repository();
|
|
5240
4153
|
init_repository_registry();
|
|
5241
4154
|
}
|
|
5242
4155
|
});
|
|
5243
4156
|
|
|
5244
4157
|
// src/relations/has-one-resolver.js
|
|
5245
|
-
var
|
|
4158
|
+
var import_js_service25, _HasOneResolver, HasOneResolver;
|
|
5246
4159
|
var init_has_one_resolver = __esm({
|
|
5247
4160
|
"src/relations/has-one-resolver.js"() {
|
|
5248
|
-
|
|
5249
|
-
import_js_service31 = require("@e22m4u/js-service");
|
|
4161
|
+
import_js_service25 = require("@e22m4u/js-service");
|
|
5250
4162
|
init_utils();
|
|
5251
|
-
init_definition();
|
|
5252
4163
|
init_errors();
|
|
5253
4164
|
init_repository2();
|
|
5254
4165
|
init_definition();
|
|
5255
|
-
_HasOneResolver = class _HasOneResolver extends
|
|
4166
|
+
_HasOneResolver = class _HasOneResolver extends import_js_service25.Service {
|
|
5256
4167
|
/**
|
|
5257
4168
|
* Include to.
|
|
5258
4169
|
*
|
|
@@ -5497,17 +4408,15 @@ var init_has_one_resolver = __esm({
|
|
|
5497
4408
|
});
|
|
5498
4409
|
|
|
5499
4410
|
// src/relations/has-many-resolver.js
|
|
5500
|
-
var
|
|
4411
|
+
var import_js_service26, _HasManyResolver, HasManyResolver;
|
|
5501
4412
|
var init_has_many_resolver = __esm({
|
|
5502
4413
|
"src/relations/has-many-resolver.js"() {
|
|
5503
|
-
|
|
5504
|
-
import_js_service32 = require("@e22m4u/js-service");
|
|
4414
|
+
import_js_service26 = require("@e22m4u/js-service");
|
|
5505
4415
|
init_utils();
|
|
5506
|
-
init_definition();
|
|
5507
4416
|
init_errors();
|
|
5508
4417
|
init_repository2();
|
|
5509
4418
|
init_definition();
|
|
5510
|
-
_HasManyResolver = class _HasManyResolver extends
|
|
4419
|
+
_HasManyResolver = class _HasManyResolver extends import_js_service26.Service {
|
|
5511
4420
|
/**
|
|
5512
4421
|
* Include to.
|
|
5513
4422
|
*
|
|
@@ -5762,17 +4671,15 @@ var init_has_many_resolver = __esm({
|
|
|
5762
4671
|
});
|
|
5763
4672
|
|
|
5764
4673
|
// src/relations/belongs-to-resolver.js
|
|
5765
|
-
var
|
|
4674
|
+
var import_js_service27, _BelongsToResolver, BelongsToResolver;
|
|
5766
4675
|
var init_belongs_to_resolver = __esm({
|
|
5767
4676
|
"src/relations/belongs-to-resolver.js"() {
|
|
5768
|
-
|
|
5769
|
-
import_js_service33 = require("@e22m4u/js-service");
|
|
5770
|
-
init_utils();
|
|
5771
|
-
init_utils();
|
|
4677
|
+
import_js_service27 = require("@e22m4u/js-service");
|
|
5772
4678
|
init_errors();
|
|
4679
|
+
init_utils();
|
|
5773
4680
|
init_repository2();
|
|
5774
4681
|
init_definition();
|
|
5775
|
-
_BelongsToResolver = class _BelongsToResolver extends
|
|
4682
|
+
_BelongsToResolver = class _BelongsToResolver extends import_js_service27.Service {
|
|
5776
4683
|
/**
|
|
5777
4684
|
* Include to.
|
|
5778
4685
|
*
|
|
@@ -5970,17 +4877,15 @@ var init_belongs_to_resolver = __esm({
|
|
|
5970
4877
|
});
|
|
5971
4878
|
|
|
5972
4879
|
// src/relations/references-many-resolver.js
|
|
5973
|
-
var
|
|
4880
|
+
var import_js_service28, _ReferencesManyResolver, ReferencesManyResolver;
|
|
5974
4881
|
var init_references_many_resolver = __esm({
|
|
5975
4882
|
"src/relations/references-many-resolver.js"() {
|
|
5976
|
-
|
|
5977
|
-
import_js_service34 = require("@e22m4u/js-service");
|
|
5978
|
-
init_utils();
|
|
5979
|
-
init_utils();
|
|
4883
|
+
import_js_service28 = require("@e22m4u/js-service");
|
|
5980
4884
|
init_errors();
|
|
4885
|
+
init_utils();
|
|
5981
4886
|
init_repository2();
|
|
5982
4887
|
init_definition();
|
|
5983
|
-
_ReferencesManyResolver = class _ReferencesManyResolver extends
|
|
4888
|
+
_ReferencesManyResolver = class _ReferencesManyResolver extends import_js_service28.Service {
|
|
5984
4889
|
/**
|
|
5985
4890
|
* Include to.
|
|
5986
4891
|
*
|
|
@@ -6073,7 +4978,6 @@ var init_references_many_resolver = __esm({
|
|
|
6073
4978
|
// src/relations/index.js
|
|
6074
4979
|
var init_relations2 = __esm({
|
|
6075
4980
|
"src/relations/index.js"() {
|
|
6076
|
-
"use strict";
|
|
6077
4981
|
init_has_one_resolver();
|
|
6078
4982
|
init_has_many_resolver();
|
|
6079
4983
|
init_belongs_to_resolver();
|
|
@@ -6082,23 +4986,18 @@ var init_relations2 = __esm({
|
|
|
6082
4986
|
});
|
|
6083
4987
|
|
|
6084
4988
|
// src/filter/include-clause-tool.js
|
|
6085
|
-
var
|
|
4989
|
+
var import_js_service29, _IncludeClauseTool, IncludeClauseTool;
|
|
6086
4990
|
var init_include_clause_tool = __esm({
|
|
6087
4991
|
"src/filter/include-clause-tool.js"() {
|
|
6088
|
-
|
|
6089
|
-
import_js_service35 = require("@e22m4u/js-service");
|
|
6090
|
-
init_definition();
|
|
6091
|
-
init_relations2();
|
|
6092
|
-
init_relations2();
|
|
4992
|
+
import_js_service29 = require("@e22m4u/js-service");
|
|
6093
4993
|
init_where_clause_tool();
|
|
6094
4994
|
init_order_clause_tool();
|
|
6095
4995
|
init_slice_clause_tool();
|
|
6096
4996
|
init_errors();
|
|
6097
|
-
init_relations2();
|
|
6098
4997
|
init_fields_clause_tool();
|
|
6099
4998
|
init_definition();
|
|
6100
4999
|
init_relations2();
|
|
6101
|
-
_IncludeClauseTool = class _IncludeClauseTool extends
|
|
5000
|
+
_IncludeClauseTool = class _IncludeClauseTool extends import_js_service29.Service {
|
|
6102
5001
|
/**
|
|
6103
5002
|
* Include to.
|
|
6104
5003
|
*
|
|
@@ -6424,7 +5323,6 @@ var init_include_clause_tool = __esm({
|
|
|
6424
5323
|
// src/filter/index.js
|
|
6425
5324
|
var init_filter = __esm({
|
|
6426
5325
|
"src/filter/index.js"() {
|
|
6427
|
-
"use strict";
|
|
6428
5326
|
init_slice_clause_tool();
|
|
6429
5327
|
init_order_clause_tool();
|
|
6430
5328
|
init_where_clause_tool();
|
|
@@ -6446,7 +5344,6 @@ __export(index_exports, {
|
|
|
6446
5344
|
DataType: () => DataType,
|
|
6447
5345
|
DatabaseSchema: () => DatabaseSchema,
|
|
6448
5346
|
DatasourceDefinitionValidator: () => DatasourceDefinitionValidator,
|
|
6449
|
-
DecoratorTargetType: () => DecoratorTargetType,
|
|
6450
5347
|
DefinitionRegistry: () => DefinitionRegistry,
|
|
6451
5348
|
FieldsClauseTool: () => FieldsClauseTool,
|
|
6452
5349
|
HasManyResolver: () => HasManyResolver,
|
|
@@ -6455,8 +5352,6 @@ __export(index_exports, {
|
|
|
6455
5352
|
InvalidArgumentError: () => InvalidArgumentError,
|
|
6456
5353
|
InvalidOperatorValueError: () => InvalidOperatorValueError,
|
|
6457
5354
|
ModelDataSanitizer: () => ModelDataSanitizer,
|
|
6458
|
-
ModelDataTransformer: () => ModelDataTransformer,
|
|
6459
|
-
ModelDataValidator: () => ModelDataValidator,
|
|
6460
5355
|
ModelDefinitionUtils: () => ModelDefinitionUtils,
|
|
6461
5356
|
ModelDefinitionValidator: () => ModelDefinitionValidator,
|
|
6462
5357
|
NotImplementedError: () => NotImplementedError,
|
|
@@ -6464,10 +5359,8 @@ __export(index_exports, {
|
|
|
6464
5359
|
OrderClauseTool: () => OrderClauseTool,
|
|
6465
5360
|
PrimaryKeysDefinitionValidator: () => PrimaryKeysDefinitionValidator,
|
|
6466
5361
|
PropertiesDefinitionValidator: () => PropertiesDefinitionValidator,
|
|
6467
|
-
PropertyTransformerRegistry: () => PropertyTransformerRegistry,
|
|
6468
5362
|
PropertyUniqueness: () => PropertyUniqueness,
|
|
6469
5363
|
PropertyUniquenessValidator: () => PropertyUniquenessValidator,
|
|
6470
|
-
PropertyValidatorRegistry: () => PropertyValidatorRegistry,
|
|
6471
5364
|
ReferencesManyResolver: () => ReferencesManyResolver,
|
|
6472
5365
|
RelationType: () => RelationType,
|
|
6473
5366
|
RelationsDefinitionValidator: () => RelationsDefinitionValidator,
|
|
@@ -6478,10 +5371,7 @@ __export(index_exports, {
|
|
|
6478
5371
|
capitalize: () => capitalize,
|
|
6479
5372
|
cloneDeep: () => cloneDeep,
|
|
6480
5373
|
excludeObjectKeys: () => excludeObjectKeys,
|
|
6481
|
-
getCtorName: () => getCtorName,
|
|
6482
|
-
getDecoratorTargetType: () => getDecoratorTargetType,
|
|
6483
5374
|
getValueByPath: () => getValueByPath,
|
|
6484
|
-
isCtor: () => isCtor,
|
|
6485
5375
|
isDeepEqual: () => isDeepEqual,
|
|
6486
5376
|
isPlainObject: () => isPlainObject,
|
|
6487
5377
|
isPromise: () => isPromise,
|
|
@@ -6489,8 +5379,7 @@ __export(index_exports, {
|
|
|
6489
5379
|
modelNameToModelKey: () => modelNameToModelKey,
|
|
6490
5380
|
selectObjectKeys: () => selectObjectKeys,
|
|
6491
5381
|
singularize: () => singularize,
|
|
6492
|
-
stringToRegexp: () => stringToRegexp
|
|
6493
|
-
transformPromise: () => transformPromise
|
|
5382
|
+
stringToRegexp: () => stringToRegexp
|
|
6494
5383
|
});
|
|
6495
5384
|
module.exports = __toCommonJS(index_exports);
|
|
6496
5385
|
init_utils();
|
|
@@ -6499,11 +5388,10 @@ init_filter();
|
|
|
6499
5388
|
init_adapter2();
|
|
6500
5389
|
|
|
6501
5390
|
// src/database-schema.js
|
|
6502
|
-
var
|
|
6503
|
-
init_repository2();
|
|
5391
|
+
var import_js_service30 = require("@e22m4u/js-service");
|
|
6504
5392
|
init_definition();
|
|
6505
5393
|
init_repository2();
|
|
6506
|
-
var _DatabaseSchema = class _DatabaseSchema extends
|
|
5394
|
+
var _DatabaseSchema = class _DatabaseSchema extends import_js_service30.Service {
|
|
6507
5395
|
/**
|
|
6508
5396
|
* Define datasource.
|
|
6509
5397
|
*
|
|
@@ -6552,7 +5440,6 @@ init_repository2();
|
|
|
6552
5440
|
DataType,
|
|
6553
5441
|
DatabaseSchema,
|
|
6554
5442
|
DatasourceDefinitionValidator,
|
|
6555
|
-
DecoratorTargetType,
|
|
6556
5443
|
DefinitionRegistry,
|
|
6557
5444
|
FieldsClauseTool,
|
|
6558
5445
|
HasManyResolver,
|
|
@@ -6561,8 +5448,6 @@ init_repository2();
|
|
|
6561
5448
|
InvalidArgumentError,
|
|
6562
5449
|
InvalidOperatorValueError,
|
|
6563
5450
|
ModelDataSanitizer,
|
|
6564
|
-
ModelDataTransformer,
|
|
6565
|
-
ModelDataValidator,
|
|
6566
5451
|
ModelDefinitionUtils,
|
|
6567
5452
|
ModelDefinitionValidator,
|
|
6568
5453
|
NotImplementedError,
|
|
@@ -6570,10 +5455,8 @@ init_repository2();
|
|
|
6570
5455
|
OrderClauseTool,
|
|
6571
5456
|
PrimaryKeysDefinitionValidator,
|
|
6572
5457
|
PropertiesDefinitionValidator,
|
|
6573
|
-
PropertyTransformerRegistry,
|
|
6574
5458
|
PropertyUniqueness,
|
|
6575
5459
|
PropertyUniquenessValidator,
|
|
6576
|
-
PropertyValidatorRegistry,
|
|
6577
5460
|
ReferencesManyResolver,
|
|
6578
5461
|
RelationType,
|
|
6579
5462
|
RelationsDefinitionValidator,
|
|
@@ -6584,10 +5467,7 @@ init_repository2();
|
|
|
6584
5467
|
capitalize,
|
|
6585
5468
|
cloneDeep,
|
|
6586
5469
|
excludeObjectKeys,
|
|
6587
|
-
getCtorName,
|
|
6588
|
-
getDecoratorTargetType,
|
|
6589
5470
|
getValueByPath,
|
|
6590
|
-
isCtor,
|
|
6591
5471
|
isDeepEqual,
|
|
6592
5472
|
isPlainObject,
|
|
6593
5473
|
isPromise,
|
|
@@ -6595,6 +5475,5 @@ init_repository2();
|
|
|
6595
5475
|
modelNameToModelKey,
|
|
6596
5476
|
selectObjectKeys,
|
|
6597
5477
|
singularize,
|
|
6598
|
-
stringToRegexp
|
|
6599
|
-
transformPromise
|
|
5478
|
+
stringToRegexp
|
|
6600
5479
|
});
|