@e22m4u/js-repository 0.1.25 → 0.1.26
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/build-cjs.js +5 -0
- package/dist/cjs/index.cjs +453 -834
- package/package.json +3 -2
- package/src/adapter/adapter-loader.js +1 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -38,393 +38,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
38
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
39
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
40
40
|
|
|
41
|
-
// node_modules/@e22m4u/js-format/src/utils/is-class.js
|
|
42
|
-
function isClass(value) {
|
|
43
|
-
if (!value) return false;
|
|
44
|
-
return typeof value === "function" && /^class\s/.test(Function.prototype.toString.call(value));
|
|
45
|
-
}
|
|
46
|
-
var init_is_class = __esm({
|
|
47
|
-
"node_modules/@e22m4u/js-format/src/utils/is-class.js"() {
|
|
48
|
-
__name(isClass, "isClass");
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// node_modules/@e22m4u/js-format/src/utils/index.js
|
|
53
|
-
var init_utils = __esm({
|
|
54
|
-
"node_modules/@e22m4u/js-format/src/utils/index.js"() {
|
|
55
|
-
init_is_class();
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// node_modules/@e22m4u/js-format/src/value-to-string.js
|
|
60
|
-
function valueToString(input) {
|
|
61
|
-
if (input == null) return String(input);
|
|
62
|
-
if (typeof input === "string") return `"${input}"`;
|
|
63
|
-
if (typeof input === "number" || typeof input === "boolean")
|
|
64
|
-
return String(input);
|
|
65
|
-
if (isClass(input)) return input.name ? input.name : "Class";
|
|
66
|
-
if (input.constructor && input.constructor.name)
|
|
67
|
-
return BASE_CTOR_NAMES.includes(input.constructor.name) ? input.constructor.name : `${input.constructor.name} (instance)`;
|
|
68
|
-
if (typeof input === "object" && input.constructor == null) return "Object";
|
|
69
|
-
return String(input);
|
|
70
|
-
}
|
|
71
|
-
var BASE_CTOR_NAMES;
|
|
72
|
-
var init_value_to_string = __esm({
|
|
73
|
-
"node_modules/@e22m4u/js-format/src/value-to-string.js"() {
|
|
74
|
-
init_utils();
|
|
75
|
-
BASE_CTOR_NAMES = [
|
|
76
|
-
"String",
|
|
77
|
-
"Number",
|
|
78
|
-
"Boolean",
|
|
79
|
-
"Object",
|
|
80
|
-
"Array",
|
|
81
|
-
"Function",
|
|
82
|
-
"Symbol",
|
|
83
|
-
"Map",
|
|
84
|
-
"Set",
|
|
85
|
-
"Date"
|
|
86
|
-
];
|
|
87
|
-
__name(valueToString, "valueToString");
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// node_modules/@e22m4u/js-format/src/array-to-list.js
|
|
92
|
-
function arrayToList(input) {
|
|
93
|
-
if (Array.isArray(input) && input.length)
|
|
94
|
-
return input.map(valueToString).join(SEPARATOR);
|
|
95
|
-
return valueToString(input);
|
|
96
|
-
}
|
|
97
|
-
var SEPARATOR;
|
|
98
|
-
var init_array_to_list = __esm({
|
|
99
|
-
"node_modules/@e22m4u/js-format/src/array-to-list.js"() {
|
|
100
|
-
init_value_to_string();
|
|
101
|
-
SEPARATOR = ", ";
|
|
102
|
-
__name(arrayToList, "arrayToList");
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
// node_modules/@e22m4u/js-format/src/format.js
|
|
107
|
-
function format(pattern) {
|
|
108
|
-
if (pattern instanceof Date) {
|
|
109
|
-
pattern = pattern.toISOString();
|
|
110
|
-
} else if (typeof pattern !== "string") {
|
|
111
|
-
pattern = String(pattern);
|
|
112
|
-
}
|
|
113
|
-
const re = /(%?)(%([sdjvl]))/g;
|
|
114
|
-
const args = Array.prototype.slice.call(arguments, 1);
|
|
115
|
-
if (args.length) {
|
|
116
|
-
pattern = pattern.replace(re, function(match, escaped, ptn, flag) {
|
|
117
|
-
let arg = args.shift();
|
|
118
|
-
switch (flag) {
|
|
119
|
-
case "s":
|
|
120
|
-
arg = String(arg);
|
|
121
|
-
break;
|
|
122
|
-
case "d":
|
|
123
|
-
arg = Number(arg);
|
|
124
|
-
break;
|
|
125
|
-
case "j":
|
|
126
|
-
arg = JSON.stringify(arg);
|
|
127
|
-
break;
|
|
128
|
-
case "v":
|
|
129
|
-
arg = valueToString(arg);
|
|
130
|
-
break;
|
|
131
|
-
case "l":
|
|
132
|
-
arg = arrayToList(arg);
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
if (!escaped) return arg;
|
|
136
|
-
args.unshift(arg);
|
|
137
|
-
return match;
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
if (args.length) pattern += " " + args.join(" ");
|
|
141
|
-
pattern = pattern.replace(/%{2}/g, "%");
|
|
142
|
-
return "" + pattern;
|
|
143
|
-
}
|
|
144
|
-
var init_format = __esm({
|
|
145
|
-
"node_modules/@e22m4u/js-format/src/format.js"() {
|
|
146
|
-
init_array_to_list();
|
|
147
|
-
init_value_to_string();
|
|
148
|
-
__name(format, "format");
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
// node_modules/@e22m4u/js-format/src/errorf.js
|
|
153
|
-
var _Errorf, Errorf;
|
|
154
|
-
var init_errorf = __esm({
|
|
155
|
-
"node_modules/@e22m4u/js-format/src/errorf.js"() {
|
|
156
|
-
init_format();
|
|
157
|
-
_Errorf = class _Errorf extends Error {
|
|
158
|
-
/**
|
|
159
|
-
* Constructor.
|
|
160
|
-
*
|
|
161
|
-
* @param {string|undefined} pattern
|
|
162
|
-
* @param {any} args
|
|
163
|
-
*/
|
|
164
|
-
constructor(pattern = void 0, ...args) {
|
|
165
|
-
const message = pattern != null ? format(pattern, ...args) : void 0;
|
|
166
|
-
super(message);
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
__name(_Errorf, "Errorf");
|
|
170
|
-
Errorf = _Errorf;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// node_modules/@e22m4u/js-format/src/index.js
|
|
175
|
-
var init_src = __esm({
|
|
176
|
-
"node_modules/@e22m4u/js-format/src/index.js"() {
|
|
177
|
-
init_format();
|
|
178
|
-
init_errorf();
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
// node_modules/@e22m4u/js-service/src/errors/invalid-argument-error.js
|
|
183
|
-
var _InvalidArgumentError, InvalidArgumentError;
|
|
184
|
-
var init_invalid_argument_error = __esm({
|
|
185
|
-
"node_modules/@e22m4u/js-service/src/errors/invalid-argument-error.js"() {
|
|
186
|
-
init_src();
|
|
187
|
-
_InvalidArgumentError = class _InvalidArgumentError extends Errorf {
|
|
188
|
-
};
|
|
189
|
-
__name(_InvalidArgumentError, "InvalidArgumentError");
|
|
190
|
-
InvalidArgumentError = _InvalidArgumentError;
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
// node_modules/@e22m4u/js-service/src/errors/index.js
|
|
195
|
-
var init_errors = __esm({
|
|
196
|
-
"node_modules/@e22m4u/js-service/src/errors/index.js"() {
|
|
197
|
-
init_invalid_argument_error();
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
// node_modules/@e22m4u/js-service/src/service-container.js
|
|
202
|
-
var _ServiceContainer, ServiceContainer;
|
|
203
|
-
var init_service_container = __esm({
|
|
204
|
-
"node_modules/@e22m4u/js-service/src/service-container.js"() {
|
|
205
|
-
init_service();
|
|
206
|
-
init_errors();
|
|
207
|
-
_ServiceContainer = class _ServiceContainer {
|
|
208
|
-
/**
|
|
209
|
-
* Services map.
|
|
210
|
-
*
|
|
211
|
-
* @type {Map<any, any>}
|
|
212
|
-
* @private
|
|
213
|
-
*/
|
|
214
|
-
_services = /* @__PURE__ */ new Map();
|
|
215
|
-
/**
|
|
216
|
-
* Parent container.
|
|
217
|
-
*
|
|
218
|
-
* @type {ServiceContainer}
|
|
219
|
-
* @private
|
|
220
|
-
*/
|
|
221
|
-
_parent;
|
|
222
|
-
/**
|
|
223
|
-
* Constructor.
|
|
224
|
-
*
|
|
225
|
-
* @param {ServiceContainer|undefined} parent
|
|
226
|
-
*/
|
|
227
|
-
constructor(parent = void 0) {
|
|
228
|
-
if (parent != null) {
|
|
229
|
-
if (!(parent instanceof _ServiceContainer))
|
|
230
|
-
throw new InvalidArgumentError(
|
|
231
|
-
'The provided parameter "parent" of ServicesContainer.constructor must be an instance ServiceContainer, but %v given.',
|
|
232
|
-
parent
|
|
233
|
-
);
|
|
234
|
-
this._parent = parent;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Получить существующий или новый экземпляр.
|
|
239
|
-
*
|
|
240
|
-
* @param {*} ctor
|
|
241
|
-
* @param {*} args
|
|
242
|
-
* @return {*}
|
|
243
|
-
*/
|
|
244
|
-
get(ctor, ...args) {
|
|
245
|
-
if (!ctor || typeof ctor !== "function")
|
|
246
|
-
throw new InvalidArgumentError(
|
|
247
|
-
"The first argument of ServicesContainer.get must be a class constructor, but %v given.",
|
|
248
|
-
ctor
|
|
249
|
-
);
|
|
250
|
-
if (!this._services.has(ctor) && this._parent && this._parent.has(ctor)) {
|
|
251
|
-
return this._parent.get(ctor);
|
|
252
|
-
}
|
|
253
|
-
let service = this._services.get(ctor);
|
|
254
|
-
if (!service || args.length) {
|
|
255
|
-
service = "prototype" in ctor && ctor.prototype instanceof Service ? new ctor(this, ...args) : new ctor(...args);
|
|
256
|
-
this._services.set(ctor, service);
|
|
257
|
-
} else if (typeof service === "function") {
|
|
258
|
-
service = service();
|
|
259
|
-
this._services.set(ctor, service);
|
|
260
|
-
}
|
|
261
|
-
return service;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Проверка существования конструктора в контейнере.
|
|
265
|
-
*
|
|
266
|
-
* @param {*} ctor
|
|
267
|
-
* @return {boolean}
|
|
268
|
-
*/
|
|
269
|
-
has(ctor) {
|
|
270
|
-
if (this._services.has(ctor)) return true;
|
|
271
|
-
if (this._parent) return this._parent.has(ctor);
|
|
272
|
-
return false;
|
|
273
|
-
}
|
|
274
|
-
/**
|
|
275
|
-
* Добавить конструктор в контейнер.
|
|
276
|
-
*
|
|
277
|
-
* @param {*} ctor
|
|
278
|
-
* @param {*} args
|
|
279
|
-
* @return {this}
|
|
280
|
-
*/
|
|
281
|
-
add(ctor, ...args) {
|
|
282
|
-
if (!ctor || typeof ctor !== "function")
|
|
283
|
-
throw new InvalidArgumentError(
|
|
284
|
-
"The first argument of ServicesContainer.add must be a class constructor, but %v given.",
|
|
285
|
-
ctor
|
|
286
|
-
);
|
|
287
|
-
const factory = /* @__PURE__ */ __name(() => ctor.prototype instanceof Service ? new ctor(this, ...args) : new ctor(...args), "factory");
|
|
288
|
-
this._services.set(ctor, factory);
|
|
289
|
-
return this;
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Добавить конструктор и создать экземпляр.
|
|
293
|
-
*
|
|
294
|
-
* @param {*} ctor
|
|
295
|
-
* @param {*} args
|
|
296
|
-
* @return {this}
|
|
297
|
-
*/
|
|
298
|
-
use(ctor, ...args) {
|
|
299
|
-
if (!ctor || typeof ctor !== "function")
|
|
300
|
-
throw new InvalidArgumentError(
|
|
301
|
-
"The first argument of ServicesContainer.use must be a class constructor, but %v given.",
|
|
302
|
-
ctor
|
|
303
|
-
);
|
|
304
|
-
const service = ctor.prototype instanceof Service ? new ctor(this, ...args) : new ctor(...args);
|
|
305
|
-
this._services.set(ctor, service);
|
|
306
|
-
return this;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Добавить конструктор и связанный экземпляр.
|
|
310
|
-
*
|
|
311
|
-
* @param {*} ctor
|
|
312
|
-
* @param {*} service
|
|
313
|
-
* @return {this}
|
|
314
|
-
*/
|
|
315
|
-
set(ctor, service) {
|
|
316
|
-
if (!ctor || typeof ctor !== "function")
|
|
317
|
-
throw new InvalidArgumentError(
|
|
318
|
-
"The first argument of ServicesContainer.set must be a class constructor, but %v given.",
|
|
319
|
-
ctor
|
|
320
|
-
);
|
|
321
|
-
if (!service || typeof service !== "object" || Array.isArray(service))
|
|
322
|
-
throw new InvalidArgumentError(
|
|
323
|
-
"The second argument of ServicesContainer.set must be an Object, but %v given.",
|
|
324
|
-
service
|
|
325
|
-
);
|
|
326
|
-
this._services.set(ctor, service);
|
|
327
|
-
return this;
|
|
328
|
-
}
|
|
329
|
-
};
|
|
330
|
-
__name(_ServiceContainer, "ServiceContainer");
|
|
331
|
-
ServiceContainer = _ServiceContainer;
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
// node_modules/@e22m4u/js-service/src/service.js
|
|
336
|
-
var _Service, Service;
|
|
337
|
-
var init_service = __esm({
|
|
338
|
-
"node_modules/@e22m4u/js-service/src/service.js"() {
|
|
339
|
-
init_service_container();
|
|
340
|
-
_Service = class _Service {
|
|
341
|
-
/**
|
|
342
|
-
* Container.
|
|
343
|
-
*
|
|
344
|
-
* @type {ServiceContainer}
|
|
345
|
-
*/
|
|
346
|
-
container;
|
|
347
|
-
/**
|
|
348
|
-
* Constructor.
|
|
349
|
-
*
|
|
350
|
-
* @param {ServiceContainer|undefined} container
|
|
351
|
-
*/
|
|
352
|
-
constructor(container = void 0) {
|
|
353
|
-
this.container = container instanceof ServiceContainer ? container : new ServiceContainer();
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* Получить существующий или новый экземпляр.
|
|
357
|
-
*
|
|
358
|
-
* @param {*} ctor
|
|
359
|
-
* @param {*} args
|
|
360
|
-
* @return {*}
|
|
361
|
-
*/
|
|
362
|
-
getService(ctor, ...args) {
|
|
363
|
-
return this.container.get(ctor, ...args);
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Проверка существования конструктора в контейнере.
|
|
367
|
-
*
|
|
368
|
-
* @param {*} ctor
|
|
369
|
-
* @return {boolean}
|
|
370
|
-
*/
|
|
371
|
-
hasService(ctor) {
|
|
372
|
-
return this.container.has(ctor);
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Добавить конструктор в контейнер.
|
|
376
|
-
*
|
|
377
|
-
* @param {*} ctor
|
|
378
|
-
* @param {*} args
|
|
379
|
-
* @return {this}
|
|
380
|
-
*/
|
|
381
|
-
addService(ctor, ...args) {
|
|
382
|
-
this.container.add(ctor, ...args);
|
|
383
|
-
return this;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Добавить конструктор и создать экземпляр.
|
|
387
|
-
*
|
|
388
|
-
* @param {*} ctor
|
|
389
|
-
* @param {*} args
|
|
390
|
-
* @return {this}
|
|
391
|
-
*/
|
|
392
|
-
useService(ctor, ...args) {
|
|
393
|
-
this.container.use(ctor, ...args);
|
|
394
|
-
return this;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Добавить конструктор и связанный экземпляр.
|
|
398
|
-
*
|
|
399
|
-
* @param {*} ctor
|
|
400
|
-
* @param {*} service
|
|
401
|
-
* @return {this}
|
|
402
|
-
*/
|
|
403
|
-
setService(ctor, service) {
|
|
404
|
-
this.container.set(ctor, service);
|
|
405
|
-
return this;
|
|
406
|
-
}
|
|
407
|
-
};
|
|
408
|
-
__name(_Service, "Service");
|
|
409
|
-
Service = _Service;
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
// node_modules/@e22m4u/js-service/src/index.js
|
|
414
|
-
var init_src2 = __esm({
|
|
415
|
-
"node_modules/@e22m4u/js-service/src/index.js"() {
|
|
416
|
-
init_service();
|
|
417
|
-
init_service_container();
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
|
|
421
41
|
// src/errors/not-implemented-error.js
|
|
422
|
-
var _NotImplementedError, NotImplementedError;
|
|
42
|
+
var import_js_format, _NotImplementedError, NotImplementedError;
|
|
423
43
|
var init_not_implemented_error = __esm({
|
|
424
44
|
"src/errors/not-implemented-error.js"() {
|
|
425
45
|
"use strict";
|
|
426
|
-
|
|
427
|
-
_NotImplementedError = class _NotImplementedError extends Errorf {
|
|
46
|
+
import_js_format = require("@e22m4u/js-format");
|
|
47
|
+
_NotImplementedError = class _NotImplementedError extends import_js_format.Errorf {
|
|
428
48
|
};
|
|
429
49
|
__name(_NotImplementedError, "NotImplementedError");
|
|
430
50
|
NotImplementedError = _NotImplementedError;
|
|
@@ -432,24 +52,24 @@ var init_not_implemented_error = __esm({
|
|
|
432
52
|
});
|
|
433
53
|
|
|
434
54
|
// src/errors/invalid-argument-error.js
|
|
435
|
-
var
|
|
436
|
-
var
|
|
55
|
+
var import_js_format2, _InvalidArgumentError, InvalidArgumentError;
|
|
56
|
+
var init_invalid_argument_error = __esm({
|
|
437
57
|
"src/errors/invalid-argument-error.js"() {
|
|
438
58
|
"use strict";
|
|
439
|
-
|
|
440
|
-
|
|
59
|
+
import_js_format2 = require("@e22m4u/js-format");
|
|
60
|
+
_InvalidArgumentError = class _InvalidArgumentError extends import_js_format2.Errorf {
|
|
441
61
|
};
|
|
442
|
-
__name(
|
|
443
|
-
|
|
62
|
+
__name(_InvalidArgumentError, "InvalidArgumentError");
|
|
63
|
+
InvalidArgumentError = _InvalidArgumentError;
|
|
444
64
|
}
|
|
445
65
|
});
|
|
446
66
|
|
|
447
67
|
// src/errors/invalid-operator-value-error.js
|
|
448
|
-
var _InvalidOperatorValueError, InvalidOperatorValueError;
|
|
68
|
+
var import_js_format3, _InvalidOperatorValueError, InvalidOperatorValueError;
|
|
449
69
|
var init_invalid_operator_value_error = __esm({
|
|
450
70
|
"src/errors/invalid-operator-value-error.js"() {
|
|
451
71
|
"use strict";
|
|
452
|
-
|
|
72
|
+
import_js_format3 = require("@e22m4u/js-format");
|
|
453
73
|
_InvalidOperatorValueError = class _InvalidOperatorValueError extends Error {
|
|
454
74
|
/**
|
|
455
75
|
* Constructor.
|
|
@@ -460,7 +80,7 @@ var init_invalid_operator_value_error = __esm({
|
|
|
460
80
|
*/
|
|
461
81
|
constructor(operator, expected, value) {
|
|
462
82
|
super(
|
|
463
|
-
format(
|
|
83
|
+
(0, import_js_format3.format)(
|
|
464
84
|
"Condition of {%s: ...} should have %s, but %v given.",
|
|
465
85
|
operator,
|
|
466
86
|
expected,
|
|
@@ -475,23 +95,23 @@ var init_invalid_operator_value_error = __esm({
|
|
|
475
95
|
});
|
|
476
96
|
|
|
477
97
|
// src/errors/index.js
|
|
478
|
-
var
|
|
98
|
+
var init_errors = __esm({
|
|
479
99
|
"src/errors/index.js"() {
|
|
480
100
|
"use strict";
|
|
481
101
|
init_not_implemented_error();
|
|
482
|
-
|
|
102
|
+
init_invalid_argument_error();
|
|
483
103
|
init_invalid_operator_value_error();
|
|
484
104
|
}
|
|
485
105
|
});
|
|
486
106
|
|
|
487
107
|
// src/filter/slice-clause-tool.js
|
|
488
|
-
var _SliceClauseTool, SliceClauseTool;
|
|
108
|
+
var import_js_service, _SliceClauseTool, SliceClauseTool;
|
|
489
109
|
var init_slice_clause_tool = __esm({
|
|
490
110
|
"src/filter/slice-clause-tool.js"() {
|
|
491
111
|
"use strict";
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
_SliceClauseTool = class _SliceClauseTool extends Service {
|
|
112
|
+
import_js_service = require("@e22m4u/js-service");
|
|
113
|
+
init_errors();
|
|
114
|
+
_SliceClauseTool = class _SliceClauseTool extends import_js_service.Service {
|
|
495
115
|
/**
|
|
496
116
|
* Slice.
|
|
497
117
|
*
|
|
@@ -502,17 +122,17 @@ var init_slice_clause_tool = __esm({
|
|
|
502
122
|
*/
|
|
503
123
|
slice(entities, skip = void 0, limit = void 0) {
|
|
504
124
|
if (!Array.isArray(entities))
|
|
505
|
-
throw new
|
|
125
|
+
throw new InvalidArgumentError(
|
|
506
126
|
"The first argument of SliceClauseTool.slice should be an Array, but %v given.",
|
|
507
127
|
entities
|
|
508
128
|
);
|
|
509
129
|
if (skip != null && typeof skip !== "number")
|
|
510
|
-
throw new
|
|
130
|
+
throw new InvalidArgumentError(
|
|
511
131
|
'The provided option "skip" should be a Number, but %v given.',
|
|
512
132
|
skip
|
|
513
133
|
);
|
|
514
134
|
if (limit != null && typeof limit !== "number")
|
|
515
|
-
throw new
|
|
135
|
+
throw new InvalidArgumentError(
|
|
516
136
|
'The provided option "limit" should be a Number, but %v given.',
|
|
517
137
|
limit
|
|
518
138
|
);
|
|
@@ -528,7 +148,7 @@ var init_slice_clause_tool = __esm({
|
|
|
528
148
|
static validateSkipClause(skip) {
|
|
529
149
|
if (skip == null) return;
|
|
530
150
|
if (typeof skip !== "number")
|
|
531
|
-
throw new
|
|
151
|
+
throw new InvalidArgumentError(
|
|
532
152
|
'The provided option "skip" should be a Number, but %v given.',
|
|
533
153
|
skip
|
|
534
154
|
);
|
|
@@ -541,7 +161,7 @@ var init_slice_clause_tool = __esm({
|
|
|
541
161
|
static validateLimitClause(limit) {
|
|
542
162
|
if (limit == null) return;
|
|
543
163
|
if (typeof limit !== "number")
|
|
544
|
-
throw new
|
|
164
|
+
throw new InvalidArgumentError(
|
|
545
165
|
'The provided option "limit" should be a Number, but %v given.',
|
|
546
166
|
limit
|
|
547
167
|
);
|
|
@@ -793,18 +413,18 @@ var init_transform_promise = __esm({
|
|
|
793
413
|
// src/utils/select-object-keys.js
|
|
794
414
|
function selectObjectKeys(obj, keys) {
|
|
795
415
|
if (!obj || typeof obj !== "object" || Array.isArray(obj))
|
|
796
|
-
throw new
|
|
416
|
+
throw new InvalidArgumentError(
|
|
797
417
|
"The first argument of selectObjectKeys should be an Object, but %v given.",
|
|
798
418
|
obj
|
|
799
419
|
);
|
|
800
420
|
if (!Array.isArray(keys))
|
|
801
|
-
throw new
|
|
421
|
+
throw new InvalidArgumentError(
|
|
802
422
|
"The second argument of selectObjectKeys should be an Array of String, but %v given.",
|
|
803
423
|
keys
|
|
804
424
|
);
|
|
805
425
|
keys.forEach((key) => {
|
|
806
426
|
if (typeof key !== "string")
|
|
807
|
-
throw new
|
|
427
|
+
throw new InvalidArgumentError(
|
|
808
428
|
"The second argument of selectObjectKeys should be an Array of String, but %v given.",
|
|
809
429
|
key
|
|
810
430
|
);
|
|
@@ -819,7 +439,7 @@ function selectObjectKeys(obj, keys) {
|
|
|
819
439
|
var init_select_object_keys = __esm({
|
|
820
440
|
"src/utils/select-object-keys.js"() {
|
|
821
441
|
"use strict";
|
|
822
|
-
|
|
442
|
+
init_errors();
|
|
823
443
|
__name(selectObjectKeys, "selectObjectKeys");
|
|
824
444
|
}
|
|
825
445
|
});
|
|
@@ -827,7 +447,7 @@ var init_select_object_keys = __esm({
|
|
|
827
447
|
// src/utils/exclude-object-keys.js
|
|
828
448
|
function excludeObjectKeys(obj, keys) {
|
|
829
449
|
if (typeof obj !== "object" || !obj || Array.isArray(obj))
|
|
830
|
-
throw new
|
|
450
|
+
throw new InvalidArgumentError(
|
|
831
451
|
"Cannot exclude keys from a non-Object value, %v given.",
|
|
832
452
|
obj
|
|
833
453
|
);
|
|
@@ -839,7 +459,7 @@ function excludeObjectKeys(obj, keys) {
|
|
|
839
459
|
var init_exclude_object_keys = __esm({
|
|
840
460
|
"src/utils/exclude-object-keys.js"() {
|
|
841
461
|
"use strict";
|
|
842
|
-
|
|
462
|
+
init_errors();
|
|
843
463
|
__name(excludeObjectKeys, "excludeObjectKeys");
|
|
844
464
|
}
|
|
845
465
|
});
|
|
@@ -884,7 +504,7 @@ var init_get_decorator_target_type = __esm({
|
|
|
884
504
|
});
|
|
885
505
|
|
|
886
506
|
// src/utils/index.js
|
|
887
|
-
var
|
|
507
|
+
var init_utils = __esm({
|
|
888
508
|
"src/utils/index.js"() {
|
|
889
509
|
"use strict";
|
|
890
510
|
init_is_ctor();
|
|
@@ -920,14 +540,14 @@ function compareFn(a, b) {
|
|
|
920
540
|
}
|
|
921
541
|
return 0;
|
|
922
542
|
}
|
|
923
|
-
var _OrderClauseTool, OrderClauseTool;
|
|
543
|
+
var import_js_service2, _OrderClauseTool, OrderClauseTool;
|
|
924
544
|
var init_order_clause_tool = __esm({
|
|
925
545
|
"src/filter/order-clause-tool.js"() {
|
|
926
546
|
"use strict";
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
_OrderClauseTool = class _OrderClauseTool extends Service {
|
|
547
|
+
import_js_service2 = require("@e22m4u/js-service");
|
|
548
|
+
init_utils();
|
|
549
|
+
init_errors();
|
|
550
|
+
_OrderClauseTool = class _OrderClauseTool extends import_js_service2.Service {
|
|
931
551
|
/**
|
|
932
552
|
* Sort.
|
|
933
553
|
*
|
|
@@ -941,7 +561,7 @@ var init_order_clause_tool = __esm({
|
|
|
941
561
|
const mapping = [];
|
|
942
562
|
clause.forEach((key, index) => {
|
|
943
563
|
if (!key || typeof key !== "string")
|
|
944
|
-
throw new
|
|
564
|
+
throw new InvalidArgumentError(
|
|
945
565
|
'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
946
566
|
key
|
|
947
567
|
);
|
|
@@ -966,7 +586,7 @@ var init_order_clause_tool = __esm({
|
|
|
966
586
|
if (!clause.length) return;
|
|
967
587
|
clause.forEach((field) => {
|
|
968
588
|
if (!field || typeof field !== "string")
|
|
969
|
-
throw new
|
|
589
|
+
throw new InvalidArgumentError(
|
|
970
590
|
'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
971
591
|
field
|
|
972
592
|
);
|
|
@@ -984,7 +604,7 @@ var init_order_clause_tool = __esm({
|
|
|
984
604
|
if (!clause.length) return;
|
|
985
605
|
clause.forEach((field) => {
|
|
986
606
|
if (!field || typeof field !== "string")
|
|
987
|
-
throw new
|
|
607
|
+
throw new InvalidArgumentError(
|
|
988
608
|
'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
989
609
|
field
|
|
990
610
|
);
|
|
@@ -999,15 +619,15 @@ var init_order_clause_tool = __esm({
|
|
|
999
619
|
});
|
|
1000
620
|
|
|
1001
621
|
// src/filter/operator-clause-tool.js
|
|
1002
|
-
var _OperatorClauseTool, OperatorClauseTool;
|
|
622
|
+
var import_js_service3, _OperatorClauseTool, OperatorClauseTool;
|
|
1003
623
|
var init_operator_clause_tool = __esm({
|
|
1004
624
|
"src/filter/operator-clause-tool.js"() {
|
|
1005
625
|
"use strict";
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
_OperatorClauseTool = class _OperatorClauseTool extends Service {
|
|
626
|
+
import_js_service3 = require("@e22m4u/js-service");
|
|
627
|
+
init_utils();
|
|
628
|
+
init_errors();
|
|
629
|
+
init_errors();
|
|
630
|
+
_OperatorClauseTool = class _OperatorClauseTool extends import_js_service3.Service {
|
|
1011
631
|
/**
|
|
1012
632
|
* Compare.
|
|
1013
633
|
*
|
|
@@ -1051,7 +671,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1051
671
|
*/
|
|
1052
672
|
testAll(clause, value) {
|
|
1053
673
|
if (!clause || typeof clause !== "object" || Array.isArray(clause))
|
|
1054
|
-
throw new
|
|
674
|
+
throw new InvalidArgumentError(
|
|
1055
675
|
"The first argument of OperatorUtils.testAll should be an Object, but %v given.",
|
|
1056
676
|
clause
|
|
1057
677
|
);
|
|
@@ -1101,7 +721,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1101
721
|
*/
|
|
1102
722
|
testEqNeq(clause, value) {
|
|
1103
723
|
if (!clause || typeof clause !== "object")
|
|
1104
|
-
throw new
|
|
724
|
+
throw new InvalidArgumentError(
|
|
1105
725
|
"The first argument of OperatorUtils.testEqNeq should be an Object, but %v given.",
|
|
1106
726
|
clause
|
|
1107
727
|
);
|
|
@@ -1145,7 +765,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1145
765
|
*/
|
|
1146
766
|
testGtLt(clause, value) {
|
|
1147
767
|
if (!clause || typeof clause !== "object")
|
|
1148
|
-
throw new
|
|
768
|
+
throw new InvalidArgumentError(
|
|
1149
769
|
"The first argument of OperatorUtils.testGtLt should be an Object, but %v given.",
|
|
1150
770
|
clause
|
|
1151
771
|
);
|
|
@@ -1170,7 +790,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1170
790
|
*/
|
|
1171
791
|
testInq(clause, value) {
|
|
1172
792
|
if (!clause || typeof clause !== "object")
|
|
1173
|
-
throw new
|
|
793
|
+
throw new InvalidArgumentError(
|
|
1174
794
|
"The first argument of OperatorUtils.testInq should be an Object, but %v given.",
|
|
1175
795
|
clause
|
|
1176
796
|
);
|
|
@@ -1204,7 +824,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1204
824
|
*/
|
|
1205
825
|
testNin(clause, value) {
|
|
1206
826
|
if (!clause || typeof clause !== "object")
|
|
1207
|
-
throw new
|
|
827
|
+
throw new InvalidArgumentError(
|
|
1208
828
|
"The first argument of OperatorUtils.testNin should be an Object, but %v given.",
|
|
1209
829
|
clause
|
|
1210
830
|
);
|
|
@@ -1238,7 +858,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1238
858
|
*/
|
|
1239
859
|
testBetween(clause, value) {
|
|
1240
860
|
if (!clause || typeof clause !== "object")
|
|
1241
|
-
throw new
|
|
861
|
+
throw new InvalidArgumentError(
|
|
1242
862
|
"The first argument of OperatorUtils.testBetween should be an Object, but %v given.",
|
|
1243
863
|
clause
|
|
1244
864
|
);
|
|
@@ -1269,7 +889,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1269
889
|
*/
|
|
1270
890
|
testExists(clause, value) {
|
|
1271
891
|
if (!clause || typeof clause !== "object")
|
|
1272
|
-
throw new
|
|
892
|
+
throw new InvalidArgumentError(
|
|
1273
893
|
"The first argument of OperatorUtils.testExists should be an Object, but %v given.",
|
|
1274
894
|
clause
|
|
1275
895
|
);
|
|
@@ -1300,7 +920,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1300
920
|
*/
|
|
1301
921
|
testLike(clause, value) {
|
|
1302
922
|
if (!clause || typeof clause !== "object")
|
|
1303
|
-
throw new
|
|
923
|
+
throw new InvalidArgumentError(
|
|
1304
924
|
"The first argument of OperatorUtils.testLike should be an Object, but %v given.",
|
|
1305
925
|
clause
|
|
1306
926
|
);
|
|
@@ -1326,7 +946,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1326
946
|
*/
|
|
1327
947
|
testNlike(clause, value) {
|
|
1328
948
|
if (!clause || typeof clause !== "object")
|
|
1329
|
-
throw new
|
|
949
|
+
throw new InvalidArgumentError(
|
|
1330
950
|
"The first argument of OperatorUtils.testNlike should be an Object, but %v given.",
|
|
1331
951
|
clause
|
|
1332
952
|
);
|
|
@@ -1353,7 +973,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1353
973
|
*/
|
|
1354
974
|
testIlike(clause, value) {
|
|
1355
975
|
if (!clause || typeof clause !== "object")
|
|
1356
|
-
throw new
|
|
976
|
+
throw new InvalidArgumentError(
|
|
1357
977
|
"The first argument of OperatorUtils.testIlike should be an Object, but %v given.",
|
|
1358
978
|
clause
|
|
1359
979
|
);
|
|
@@ -1380,7 +1000,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1380
1000
|
*/
|
|
1381
1001
|
testNilike(clause, value) {
|
|
1382
1002
|
if (!clause || typeof clause !== "object")
|
|
1383
|
-
throw new
|
|
1003
|
+
throw new InvalidArgumentError(
|
|
1384
1004
|
"The first argument of OperatorUtils.testNilike should be an Object, but %v given.",
|
|
1385
1005
|
clause
|
|
1386
1006
|
);
|
|
@@ -1419,7 +1039,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1419
1039
|
*/
|
|
1420
1040
|
testRegexp(clause, value) {
|
|
1421
1041
|
if (!clause || typeof clause !== "object")
|
|
1422
|
-
throw new
|
|
1042
|
+
throw new InvalidArgumentError(
|
|
1423
1043
|
"The first argument of OperatorUtils.testRegexp should be an Object, but %v given.",
|
|
1424
1044
|
clause
|
|
1425
1045
|
);
|
|
@@ -1433,7 +1053,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1433
1053
|
}
|
|
1434
1054
|
const flags = clause.flags || void 0;
|
|
1435
1055
|
if (flags && typeof flags !== "string")
|
|
1436
|
-
throw new
|
|
1056
|
+
throw new InvalidArgumentError(
|
|
1437
1057
|
"RegExp flags should be a String, but %v given.",
|
|
1438
1058
|
clause.flags
|
|
1439
1059
|
);
|
|
@@ -1449,15 +1069,15 @@ var init_operator_clause_tool = __esm({
|
|
|
1449
1069
|
});
|
|
1450
1070
|
|
|
1451
1071
|
// src/filter/where-clause-tool.js
|
|
1452
|
-
var _WhereClauseTool, WhereClauseTool;
|
|
1072
|
+
var import_js_service4, _WhereClauseTool, WhereClauseTool;
|
|
1453
1073
|
var init_where_clause_tool = __esm({
|
|
1454
1074
|
"src/filter/where-clause-tool.js"() {
|
|
1455
1075
|
"use strict";
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1076
|
+
import_js_service4 = require("@e22m4u/js-service");
|
|
1077
|
+
init_utils();
|
|
1078
|
+
init_errors();
|
|
1459
1079
|
init_operator_clause_tool();
|
|
1460
|
-
_WhereClauseTool = class _WhereClauseTool extends Service {
|
|
1080
|
+
_WhereClauseTool = class _WhereClauseTool extends import_js_service4.Service {
|
|
1461
1081
|
/**
|
|
1462
1082
|
* Filter by where clause.
|
|
1463
1083
|
*
|
|
@@ -1489,7 +1109,7 @@ var init_where_clause_tool = __esm({
|
|
|
1489
1109
|
*/
|
|
1490
1110
|
filter(entities, where = void 0) {
|
|
1491
1111
|
if (!Array.isArray(entities))
|
|
1492
|
-
throw new
|
|
1112
|
+
throw new InvalidArgumentError(
|
|
1493
1113
|
"The first argument of WhereClauseTool.filter should be an Array of Object, but %v given.",
|
|
1494
1114
|
entities
|
|
1495
1115
|
);
|
|
@@ -1504,14 +1124,14 @@ var init_where_clause_tool = __esm({
|
|
|
1504
1124
|
*/
|
|
1505
1125
|
_createFilter(whereClause) {
|
|
1506
1126
|
if (typeof whereClause !== "object" || Array.isArray(whereClause))
|
|
1507
|
-
throw new
|
|
1127
|
+
throw new InvalidArgumentError(
|
|
1508
1128
|
'The provided option "where" should be an Object, but %v given.',
|
|
1509
1129
|
whereClause
|
|
1510
1130
|
);
|
|
1511
1131
|
const keys = Object.keys(whereClause);
|
|
1512
1132
|
return (data) => {
|
|
1513
1133
|
if (typeof data !== "object")
|
|
1514
|
-
throw new
|
|
1134
|
+
throw new InvalidArgumentError(
|
|
1515
1135
|
"The first argument of WhereClauseTool.filter should be an Array of Object, but %v given.",
|
|
1516
1136
|
data
|
|
1517
1137
|
);
|
|
@@ -1581,7 +1201,7 @@ var init_where_clause_tool = __esm({
|
|
|
1581
1201
|
static validateWhereClause(clause) {
|
|
1582
1202
|
if (clause == null || typeof clause === "function") return;
|
|
1583
1203
|
if (typeof clause !== "object" || Array.isArray(clause))
|
|
1584
|
-
throw new
|
|
1204
|
+
throw new InvalidArgumentError(
|
|
1585
1205
|
'The provided option "where" should be an Object, but %v given.',
|
|
1586
1206
|
clause
|
|
1587
1207
|
);
|
|
@@ -1614,15 +1234,15 @@ var init_relation_definition = __esm({
|
|
|
1614
1234
|
});
|
|
1615
1235
|
|
|
1616
1236
|
// src/definition/model/relations/relations-definition-validator.js
|
|
1617
|
-
var _RelationsDefinitionValidator, RelationsDefinitionValidator;
|
|
1237
|
+
var import_js_service5, _RelationsDefinitionValidator, RelationsDefinitionValidator;
|
|
1618
1238
|
var init_relations_definition_validator = __esm({
|
|
1619
1239
|
"src/definition/model/relations/relations-definition-validator.js"() {
|
|
1620
1240
|
"use strict";
|
|
1621
|
-
|
|
1241
|
+
import_js_service5 = require("@e22m4u/js-service");
|
|
1622
1242
|
init_relation_type();
|
|
1623
1243
|
init_relation_type();
|
|
1624
|
-
|
|
1625
|
-
_RelationsDefinitionValidator = class _RelationsDefinitionValidator extends Service {
|
|
1244
|
+
init_errors();
|
|
1245
|
+
_RelationsDefinitionValidator = class _RelationsDefinitionValidator extends import_js_service5.Service {
|
|
1626
1246
|
/**
|
|
1627
1247
|
* Validate.
|
|
1628
1248
|
*
|
|
@@ -1631,12 +1251,12 @@ var init_relations_definition_validator = __esm({
|
|
|
1631
1251
|
*/
|
|
1632
1252
|
validate(modelName, relDefs) {
|
|
1633
1253
|
if (!modelName || typeof modelName !== "string")
|
|
1634
|
-
throw new
|
|
1254
|
+
throw new InvalidArgumentError(
|
|
1635
1255
|
"The first argument of RelationsDefinitionValidator.validate should be a non-empty String, but %v given.",
|
|
1636
1256
|
modelName
|
|
1637
1257
|
);
|
|
1638
1258
|
if (!relDefs || typeof relDefs !== "object" || Array.isArray(relDefs))
|
|
1639
|
-
throw new
|
|
1259
|
+
throw new InvalidArgumentError(
|
|
1640
1260
|
'The provided option "relations" of the model %v should be an Object, but %v given.',
|
|
1641
1261
|
modelName,
|
|
1642
1262
|
relDefs
|
|
@@ -1656,25 +1276,25 @@ var init_relations_definition_validator = __esm({
|
|
|
1656
1276
|
*/
|
|
1657
1277
|
_validateRelation(modelName, relName, relDef) {
|
|
1658
1278
|
if (!modelName || typeof modelName !== "string")
|
|
1659
|
-
throw new
|
|
1279
|
+
throw new InvalidArgumentError(
|
|
1660
1280
|
"The first argument of RelationsDefinitionValidator._validateRelation should be a non-empty String, but %v given.",
|
|
1661
1281
|
modelName
|
|
1662
1282
|
);
|
|
1663
1283
|
if (!relName || typeof relName !== "string")
|
|
1664
|
-
throw new
|
|
1284
|
+
throw new InvalidArgumentError(
|
|
1665
1285
|
"The relation name of the model %v should be a non-empty String, but %v given.",
|
|
1666
1286
|
modelName,
|
|
1667
1287
|
relName
|
|
1668
1288
|
);
|
|
1669
1289
|
if (!relDef || typeof relDef !== "object" || Array.isArray(relDef))
|
|
1670
|
-
throw new
|
|
1290
|
+
throw new InvalidArgumentError(
|
|
1671
1291
|
"The relation %v of the model %v should be an Object, but %v given.",
|
|
1672
1292
|
relName,
|
|
1673
1293
|
modelName,
|
|
1674
1294
|
relDef
|
|
1675
1295
|
);
|
|
1676
1296
|
if (!relDef.type || !Object.values(RelationType).includes(relDef.type))
|
|
1677
|
-
throw new
|
|
1297
|
+
throw new InvalidArgumentError(
|
|
1678
1298
|
'The relation %v of the model %v requires the option "type" to have one of relation types: %l, but %v given.',
|
|
1679
1299
|
relName,
|
|
1680
1300
|
modelName,
|
|
@@ -1717,21 +1337,21 @@ var init_relations_definition_validator = __esm({
|
|
|
1717
1337
|
if (relDef.type !== RelationType.BELONGS_TO) return;
|
|
1718
1338
|
if (relDef.polymorphic) {
|
|
1719
1339
|
if (typeof relDef.polymorphic !== "boolean")
|
|
1720
|
-
throw new
|
|
1340
|
+
throw new InvalidArgumentError(
|
|
1721
1341
|
'The relation %v of the model %v has the type "belongsTo", so it expects the option "polymorphic" to be a Boolean, but %v given.',
|
|
1722
1342
|
relName,
|
|
1723
1343
|
modelName,
|
|
1724
1344
|
relDef.polymorphic
|
|
1725
1345
|
);
|
|
1726
1346
|
if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
|
|
1727
|
-
throw new
|
|
1347
|
+
throw new InvalidArgumentError(
|
|
1728
1348
|
'The relation %v of the model %v is a polymorphic "belongsTo" relation, so it expects the provided option "foreignKey" to be a String, but %v given.',
|
|
1729
1349
|
relName,
|
|
1730
1350
|
modelName,
|
|
1731
1351
|
relDef.foreignKey
|
|
1732
1352
|
);
|
|
1733
1353
|
if (relDef.discriminator && typeof relDef.discriminator !== "string")
|
|
1734
|
-
throw new
|
|
1354
|
+
throw new InvalidArgumentError(
|
|
1735
1355
|
'The relation %v of the model %v is a polymorphic "belongsTo" relation, so it expects the provided option "discriminator" to be a String, but %v given.',
|
|
1736
1356
|
relName,
|
|
1737
1357
|
modelName,
|
|
@@ -1739,21 +1359,21 @@ var init_relations_definition_validator = __esm({
|
|
|
1739
1359
|
);
|
|
1740
1360
|
} else {
|
|
1741
1361
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1742
|
-
throw new
|
|
1362
|
+
throw new InvalidArgumentError(
|
|
1743
1363
|
'The relation %v of the model %v has the type "belongsTo", so it requires the option "model" to be a non-empty String, but %v given.',
|
|
1744
1364
|
relName,
|
|
1745
1365
|
modelName,
|
|
1746
1366
|
relDef.model
|
|
1747
1367
|
);
|
|
1748
1368
|
if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
|
|
1749
|
-
throw new
|
|
1369
|
+
throw new InvalidArgumentError(
|
|
1750
1370
|
'The relation %v of the model %v has the type "belongsTo", so it expects the provided option "foreignKey" to be a String, but %v given.',
|
|
1751
1371
|
relName,
|
|
1752
1372
|
modelName,
|
|
1753
1373
|
relDef.foreignKey
|
|
1754
1374
|
);
|
|
1755
1375
|
if (relDef.discriminator)
|
|
1756
|
-
throw new
|
|
1376
|
+
throw new InvalidArgumentError(
|
|
1757
1377
|
'The relation %v of the model %v is a non-polymorphic "belongsTo" relation, so it should not have the option "discriminator" to be provided.',
|
|
1758
1378
|
relName,
|
|
1759
1379
|
modelName
|
|
@@ -1800,7 +1420,7 @@ var init_relations_definition_validator = __esm({
|
|
|
1800
1420
|
_validateHasOne(modelName, relName, relDef) {
|
|
1801
1421
|
if (relDef.type !== RelationType.HAS_ONE) return;
|
|
1802
1422
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1803
|
-
throw new
|
|
1423
|
+
throw new InvalidArgumentError(
|
|
1804
1424
|
'The relation %v of the model %v has the type "hasOne", so it requires the option "model" to be a non-empty String, but %v given.',
|
|
1805
1425
|
relName,
|
|
1806
1426
|
modelName,
|
|
@@ -1809,34 +1429,34 @@ var init_relations_definition_validator = __esm({
|
|
|
1809
1429
|
if (relDef.polymorphic) {
|
|
1810
1430
|
if (typeof relDef.polymorphic === "string") {
|
|
1811
1431
|
if (relDef.foreignKey)
|
|
1812
|
-
throw new
|
|
1432
|
+
throw new InvalidArgumentError(
|
|
1813
1433
|
'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "foreignKey" to be provided.',
|
|
1814
1434
|
relName,
|
|
1815
1435
|
modelName
|
|
1816
1436
|
);
|
|
1817
1437
|
if (relDef.discriminator)
|
|
1818
|
-
throw new
|
|
1438
|
+
throw new InvalidArgumentError(
|
|
1819
1439
|
'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "discriminator" to be provided.',
|
|
1820
1440
|
relName,
|
|
1821
1441
|
modelName
|
|
1822
1442
|
);
|
|
1823
1443
|
} else if (typeof relDef.polymorphic === "boolean") {
|
|
1824
1444
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1825
|
-
throw new
|
|
1445
|
+
throw new InvalidArgumentError(
|
|
1826
1446
|
'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "foreignKey" to be a non-empty String, but %v given.',
|
|
1827
1447
|
relName,
|
|
1828
1448
|
modelName,
|
|
1829
1449
|
relDef.foreignKey
|
|
1830
1450
|
);
|
|
1831
1451
|
if (!relDef.discriminator || typeof relDef.discriminator !== "string")
|
|
1832
|
-
throw new
|
|
1452
|
+
throw new InvalidArgumentError(
|
|
1833
1453
|
'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "discriminator" to be a non-empty String, but %v given.',
|
|
1834
1454
|
relName,
|
|
1835
1455
|
modelName,
|
|
1836
1456
|
relDef.discriminator
|
|
1837
1457
|
);
|
|
1838
1458
|
} else {
|
|
1839
|
-
throw new
|
|
1459
|
+
throw new InvalidArgumentError(
|
|
1840
1460
|
'The relation %v of the model %v has the type "hasOne", so it expects the provided option "polymorphic" to be a String or a Boolean, but %v given.',
|
|
1841
1461
|
relName,
|
|
1842
1462
|
modelName,
|
|
@@ -1845,14 +1465,14 @@ var init_relations_definition_validator = __esm({
|
|
|
1845
1465
|
}
|
|
1846
1466
|
} else {
|
|
1847
1467
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1848
|
-
throw new
|
|
1468
|
+
throw new InvalidArgumentError(
|
|
1849
1469
|
'The relation %v of the model %v has the type "hasOne", so it requires the option "foreignKey" to be a non-empty String, but %v given.',
|
|
1850
1470
|
relName,
|
|
1851
1471
|
modelName,
|
|
1852
1472
|
relDef.foreignKey
|
|
1853
1473
|
);
|
|
1854
1474
|
if (relDef.discriminator)
|
|
1855
|
-
throw new
|
|
1475
|
+
throw new InvalidArgumentError(
|
|
1856
1476
|
'The relation %v of the model %v is a non-polymorphic "hasOne" relation, so it should not have the option "discriminator" to be provided.',
|
|
1857
1477
|
relName,
|
|
1858
1478
|
modelName
|
|
@@ -1899,7 +1519,7 @@ var init_relations_definition_validator = __esm({
|
|
|
1899
1519
|
_validateHasMany(modelName, relName, relDef) {
|
|
1900
1520
|
if (relDef.type !== RelationType.HAS_MANY) return;
|
|
1901
1521
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1902
|
-
throw new
|
|
1522
|
+
throw new InvalidArgumentError(
|
|
1903
1523
|
'The relation %v of the model %v has the type "hasMany", so it requires the option "model" to be a non-empty String, but %v given.',
|
|
1904
1524
|
relName,
|
|
1905
1525
|
modelName,
|
|
@@ -1908,34 +1528,34 @@ var init_relations_definition_validator = __esm({
|
|
|
1908
1528
|
if (relDef.polymorphic) {
|
|
1909
1529
|
if (typeof relDef.polymorphic === "string") {
|
|
1910
1530
|
if (relDef.foreignKey)
|
|
1911
|
-
throw new
|
|
1531
|
+
throw new InvalidArgumentError(
|
|
1912
1532
|
'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "foreignKey" to be provided.',
|
|
1913
1533
|
relName,
|
|
1914
1534
|
modelName
|
|
1915
1535
|
);
|
|
1916
1536
|
if (relDef.discriminator)
|
|
1917
|
-
throw new
|
|
1537
|
+
throw new InvalidArgumentError(
|
|
1918
1538
|
'The relation %v of the model %v has the option "polymorphic" with a String value, so it should not have the option "discriminator" to be provided.',
|
|
1919
1539
|
relName,
|
|
1920
1540
|
modelName
|
|
1921
1541
|
);
|
|
1922
1542
|
} else if (typeof relDef.polymorphic === "boolean") {
|
|
1923
1543
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1924
|
-
throw new
|
|
1544
|
+
throw new InvalidArgumentError(
|
|
1925
1545
|
'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "foreignKey" to be a non-empty String, but %v given.',
|
|
1926
1546
|
relName,
|
|
1927
1547
|
modelName,
|
|
1928
1548
|
relDef.foreignKey
|
|
1929
1549
|
);
|
|
1930
1550
|
if (!relDef.discriminator || typeof relDef.discriminator !== "string")
|
|
1931
|
-
throw new
|
|
1551
|
+
throw new InvalidArgumentError(
|
|
1932
1552
|
'The relation %v of the model %v has the option "polymorphic" with "true" value, so it requires the option "discriminator" to be a non-empty String, but %v given.',
|
|
1933
1553
|
relName,
|
|
1934
1554
|
modelName,
|
|
1935
1555
|
relDef.discriminator
|
|
1936
1556
|
);
|
|
1937
1557
|
} else {
|
|
1938
|
-
throw new
|
|
1558
|
+
throw new InvalidArgumentError(
|
|
1939
1559
|
'The relation %v of the model %v has the type "hasMany", so it expects the provided option "polymorphic" to be a String or a Boolean, but %v given.',
|
|
1940
1560
|
relName,
|
|
1941
1561
|
modelName,
|
|
@@ -1944,14 +1564,14 @@ var init_relations_definition_validator = __esm({
|
|
|
1944
1564
|
}
|
|
1945
1565
|
} else {
|
|
1946
1566
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1947
|
-
throw new
|
|
1567
|
+
throw new InvalidArgumentError(
|
|
1948
1568
|
'The relation %v of the model %v has the type "hasMany", so it requires the option "foreignKey" to be a non-empty String, but %v given.',
|
|
1949
1569
|
relName,
|
|
1950
1570
|
modelName,
|
|
1951
1571
|
relDef.foreignKey
|
|
1952
1572
|
);
|
|
1953
1573
|
if (relDef.discriminator)
|
|
1954
|
-
throw new
|
|
1574
|
+
throw new InvalidArgumentError(
|
|
1955
1575
|
'The relation %v of the model %v is a non-polymorphic "hasMany" relation, so it should not have the option "discriminator" to be provided.',
|
|
1956
1576
|
relName,
|
|
1957
1577
|
modelName
|
|
@@ -1978,21 +1598,21 @@ var init_relations_definition_validator = __esm({
|
|
|
1978
1598
|
_validateReferencesMany(modelName, relName, relDef) {
|
|
1979
1599
|
if (relDef.type !== RelationType.REFERENCES_MANY) return;
|
|
1980
1600
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1981
|
-
throw new
|
|
1601
|
+
throw new InvalidArgumentError(
|
|
1982
1602
|
'The relation %v of the model %v has the type "referencesMany", so it requires the option "model" to be a non-empty String, but %v given.',
|
|
1983
1603
|
relName,
|
|
1984
1604
|
modelName,
|
|
1985
1605
|
relDef.model
|
|
1986
1606
|
);
|
|
1987
1607
|
if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
|
|
1988
|
-
throw new
|
|
1608
|
+
throw new InvalidArgumentError(
|
|
1989
1609
|
'The relation %v of the model %v has the type "referencesMany", so it expects the provided option "foreignKey" to be a String, but %v given.',
|
|
1990
1610
|
relName,
|
|
1991
1611
|
modelName,
|
|
1992
1612
|
relDef.foreignKey
|
|
1993
1613
|
);
|
|
1994
1614
|
if (relDef.discriminator)
|
|
1995
|
-
throw new
|
|
1615
|
+
throw new InvalidArgumentError(
|
|
1996
1616
|
'The relation %v of the model %v has the type "referencesMany", so it should not have the option "discriminator" to be provided.',
|
|
1997
1617
|
relName,
|
|
1998
1618
|
modelName
|
|
@@ -2051,15 +1671,15 @@ var init_property_uniqueness = __esm({
|
|
|
2051
1671
|
});
|
|
2052
1672
|
|
|
2053
1673
|
// src/definition/model/properties/empty-values-definer.js
|
|
2054
|
-
var _EmptyValuesDefiner, EmptyValuesDefiner;
|
|
1674
|
+
var import_js_service6, _EmptyValuesDefiner, EmptyValuesDefiner;
|
|
2055
1675
|
var init_empty_values_definer = __esm({
|
|
2056
1676
|
"src/definition/model/properties/empty-values-definer.js"() {
|
|
2057
1677
|
"use strict";
|
|
2058
1678
|
init_data_type();
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
_EmptyValuesDefiner = class _EmptyValuesDefiner extends Service {
|
|
1679
|
+
import_js_service6 = require("@e22m4u/js-service");
|
|
1680
|
+
init_utils();
|
|
1681
|
+
init_errors();
|
|
1682
|
+
_EmptyValuesDefiner = class _EmptyValuesDefiner extends import_js_service6.Service {
|
|
2063
1683
|
/**
|
|
2064
1684
|
* Empty values map.
|
|
2065
1685
|
*
|
|
@@ -2082,13 +1702,13 @@ var init_empty_values_definer = __esm({
|
|
|
2082
1702
|
*/
|
|
2083
1703
|
setEmptyValuesOf(dataType, emptyValues) {
|
|
2084
1704
|
if (!Object.values(DataType).includes(dataType))
|
|
2085
|
-
throw new
|
|
1705
|
+
throw new InvalidArgumentError(
|
|
2086
1706
|
'The argument "dataType" of the EmptyValuesDefiner.setEmptyValuesOf must be one of data types: %l, but %v given.',
|
|
2087
1707
|
Object.values(DataType),
|
|
2088
1708
|
dataType
|
|
2089
1709
|
);
|
|
2090
1710
|
if (!Array.isArray(emptyValues))
|
|
2091
|
-
throw new
|
|
1711
|
+
throw new InvalidArgumentError(
|
|
2092
1712
|
'The argument "emptyValues" of the EmptyValuesDefiner.setEmptyValuesOf must be an Array, but %v given.',
|
|
2093
1713
|
emptyValues
|
|
2094
1714
|
);
|
|
@@ -2104,7 +1724,7 @@ var init_empty_values_definer = __esm({
|
|
|
2104
1724
|
*/
|
|
2105
1725
|
isEmpty(dataType, value) {
|
|
2106
1726
|
if (!Object.values(DataType).includes(dataType))
|
|
2107
|
-
throw new
|
|
1727
|
+
throw new InvalidArgumentError(
|
|
2108
1728
|
'The argument "dataType" of the EmptyValuesDefiner.isEmpty must be one of data types: %l, but %v given.',
|
|
2109
1729
|
Object.values(DataType),
|
|
2110
1730
|
dataType
|
|
@@ -2128,7 +1748,7 @@ var init_property_validator = __esm({
|
|
|
2128
1748
|
function regexpValidator(value, options, context) {
|
|
2129
1749
|
if (value == null || options === false) return true;
|
|
2130
1750
|
if (typeof options !== "string" && !(options instanceof RegExp))
|
|
2131
|
-
throw new
|
|
1751
|
+
throw new InvalidArgumentError(
|
|
2132
1752
|
'The validator %v requires the "options" argument as a String or RegExp, but %v given.',
|
|
2133
1753
|
context.validatorName,
|
|
2134
1754
|
options
|
|
@@ -2137,7 +1757,7 @@ function regexpValidator(value, options, context) {
|
|
|
2137
1757
|
const regexp = stringToRegexp(options);
|
|
2138
1758
|
return regexp.test(value);
|
|
2139
1759
|
}
|
|
2140
|
-
throw new
|
|
1760
|
+
throw new InvalidArgumentError(
|
|
2141
1761
|
"The property validator %v requires a String value, but %v given.",
|
|
2142
1762
|
context.validatorName,
|
|
2143
1763
|
value
|
|
@@ -2146,8 +1766,8 @@ function regexpValidator(value, options, context) {
|
|
|
2146
1766
|
var init_regexp_validator = __esm({
|
|
2147
1767
|
"src/definition/model/properties/property-validator/builtin/regexp-validator.js"() {
|
|
2148
1768
|
"use strict";
|
|
2149
|
-
|
|
2150
|
-
|
|
1769
|
+
init_utils();
|
|
1770
|
+
init_errors();
|
|
2151
1771
|
__name(regexpValidator, "regexpValidator");
|
|
2152
1772
|
}
|
|
2153
1773
|
});
|
|
@@ -2156,14 +1776,14 @@ var init_regexp_validator = __esm({
|
|
|
2156
1776
|
function maxLengthValidator(value, options, context) {
|
|
2157
1777
|
if (value == null || options === false) return true;
|
|
2158
1778
|
if (typeof options !== "number")
|
|
2159
|
-
throw new
|
|
1779
|
+
throw new InvalidArgumentError(
|
|
2160
1780
|
'The validator %v requires the "options" argument as a Number, but %v given.',
|
|
2161
1781
|
context.validatorName,
|
|
2162
1782
|
options
|
|
2163
1783
|
);
|
|
2164
1784
|
if (typeof value === "string" || Array.isArray(value))
|
|
2165
1785
|
return value.length <= options;
|
|
2166
|
-
throw new
|
|
1786
|
+
throw new InvalidArgumentError(
|
|
2167
1787
|
"The property validator %v requires a String or an Array value, but %v given.",
|
|
2168
1788
|
context.validatorName,
|
|
2169
1789
|
value
|
|
@@ -2172,7 +1792,7 @@ function maxLengthValidator(value, options, context) {
|
|
|
2172
1792
|
var init_max_length_validator = __esm({
|
|
2173
1793
|
"src/definition/model/properties/property-validator/builtin/max-length-validator.js"() {
|
|
2174
1794
|
"use strict";
|
|
2175
|
-
|
|
1795
|
+
init_errors();
|
|
2176
1796
|
__name(maxLengthValidator, "maxLengthValidator");
|
|
2177
1797
|
}
|
|
2178
1798
|
});
|
|
@@ -2181,14 +1801,14 @@ var init_max_length_validator = __esm({
|
|
|
2181
1801
|
function minLengthValidator(value, options, context) {
|
|
2182
1802
|
if (value == null || options === false) return true;
|
|
2183
1803
|
if (typeof options !== "number")
|
|
2184
|
-
throw new
|
|
1804
|
+
throw new InvalidArgumentError(
|
|
2185
1805
|
'The validator %v requires the "options" argument as a Number, but %v given.',
|
|
2186
1806
|
context.validatorName,
|
|
2187
1807
|
options
|
|
2188
1808
|
);
|
|
2189
1809
|
if (typeof value === "string" || Array.isArray(value))
|
|
2190
1810
|
return value.length >= options;
|
|
2191
|
-
throw new
|
|
1811
|
+
throw new InvalidArgumentError(
|
|
2192
1812
|
"The property validator %v requires a String or an Array value, but %v given.",
|
|
2193
1813
|
context.validatorName,
|
|
2194
1814
|
value
|
|
@@ -2197,7 +1817,7 @@ function minLengthValidator(value, options, context) {
|
|
|
2197
1817
|
var init_min_length_validator = __esm({
|
|
2198
1818
|
"src/definition/model/properties/property-validator/builtin/min-length-validator.js"() {
|
|
2199
1819
|
"use strict";
|
|
2200
|
-
|
|
1820
|
+
init_errors();
|
|
2201
1821
|
__name(minLengthValidator, "minLengthValidator");
|
|
2202
1822
|
}
|
|
2203
1823
|
});
|
|
@@ -2213,16 +1833,16 @@ var init_builtin = __esm({
|
|
|
2213
1833
|
});
|
|
2214
1834
|
|
|
2215
1835
|
// src/definition/model/properties/property-validator/property-validator-registry.js
|
|
2216
|
-
var _PropertyValidatorRegistry, PropertyValidatorRegistry;
|
|
1836
|
+
var import_js_service7, _PropertyValidatorRegistry, PropertyValidatorRegistry;
|
|
2217
1837
|
var init_property_validator_registry = __esm({
|
|
2218
1838
|
"src/definition/model/properties/property-validator/property-validator-registry.js"() {
|
|
2219
1839
|
"use strict";
|
|
2220
|
-
|
|
1840
|
+
import_js_service7 = require("@e22m4u/js-service");
|
|
2221
1841
|
init_builtin();
|
|
2222
1842
|
init_builtin();
|
|
2223
1843
|
init_builtin();
|
|
2224
|
-
|
|
2225
|
-
_PropertyValidatorRegistry = class _PropertyValidatorRegistry extends Service {
|
|
1844
|
+
init_errors();
|
|
1845
|
+
_PropertyValidatorRegistry = class _PropertyValidatorRegistry extends import_js_service7.Service {
|
|
2226
1846
|
/**
|
|
2227
1847
|
* Validators.
|
|
2228
1848
|
*
|
|
@@ -2242,17 +1862,17 @@ var init_property_validator_registry = __esm({
|
|
|
2242
1862
|
*/
|
|
2243
1863
|
addValidator(name, validator) {
|
|
2244
1864
|
if (!name || typeof name !== "string")
|
|
2245
|
-
throw new
|
|
1865
|
+
throw new InvalidArgumentError(
|
|
2246
1866
|
"A name of the property validator must be a non-empty String, but %v given.",
|
|
2247
1867
|
name
|
|
2248
1868
|
);
|
|
2249
1869
|
if (name in this._validators)
|
|
2250
|
-
throw new
|
|
1870
|
+
throw new InvalidArgumentError(
|
|
2251
1871
|
"The property validator %v is already defined.",
|
|
2252
1872
|
name
|
|
2253
1873
|
);
|
|
2254
1874
|
if (typeof validator !== "function")
|
|
2255
|
-
throw new
|
|
1875
|
+
throw new InvalidArgumentError(
|
|
2256
1876
|
"The property validator %v must be a Function, but %v given.",
|
|
2257
1877
|
name,
|
|
2258
1878
|
validator
|
|
@@ -2278,7 +1898,7 @@ var init_property_validator_registry = __esm({
|
|
|
2278
1898
|
getValidator(name) {
|
|
2279
1899
|
const validator = this._validators[name];
|
|
2280
1900
|
if (!validator)
|
|
2281
|
-
throw new
|
|
1901
|
+
throw new InvalidArgumentError(
|
|
2282
1902
|
"The property validator %v is not defined.",
|
|
2283
1903
|
name
|
|
2284
1904
|
);
|
|
@@ -2310,7 +1930,7 @@ var init_property_transformer = __esm({
|
|
|
2310
1930
|
function trimTransformer(value, options, context) {
|
|
2311
1931
|
if (value == null) return value;
|
|
2312
1932
|
if (typeof value === "string") return value.trim();
|
|
2313
|
-
throw new
|
|
1933
|
+
throw new InvalidArgumentError(
|
|
2314
1934
|
"The property transformer %v requires a String value, but %v given.",
|
|
2315
1935
|
context.transformerName,
|
|
2316
1936
|
value
|
|
@@ -2319,7 +1939,7 @@ function trimTransformer(value, options, context) {
|
|
|
2319
1939
|
var init_trim_transformer = __esm({
|
|
2320
1940
|
"src/definition/model/properties/property-transformer/builtin/trim-transformer.js"() {
|
|
2321
1941
|
"use strict";
|
|
2322
|
-
|
|
1942
|
+
init_errors();
|
|
2323
1943
|
__name(trimTransformer, "trimTransformer");
|
|
2324
1944
|
}
|
|
2325
1945
|
});
|
|
@@ -2328,7 +1948,7 @@ var init_trim_transformer = __esm({
|
|
|
2328
1948
|
function toLowerCaseTransformer(value, options, context) {
|
|
2329
1949
|
if (value == null) return value;
|
|
2330
1950
|
if (typeof value === "string") return value.toLowerCase();
|
|
2331
|
-
throw new
|
|
1951
|
+
throw new InvalidArgumentError(
|
|
2332
1952
|
"The property transformer %v requires a String value, but %v given.",
|
|
2333
1953
|
context.transformerName,
|
|
2334
1954
|
value
|
|
@@ -2337,7 +1957,7 @@ function toLowerCaseTransformer(value, options, context) {
|
|
|
2337
1957
|
var init_to_lower_case_transformer = __esm({
|
|
2338
1958
|
"src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js"() {
|
|
2339
1959
|
"use strict";
|
|
2340
|
-
|
|
1960
|
+
init_errors();
|
|
2341
1961
|
__name(toLowerCaseTransformer, "toLowerCaseTransformer");
|
|
2342
1962
|
}
|
|
2343
1963
|
});
|
|
@@ -2346,7 +1966,7 @@ var init_to_lower_case_transformer = __esm({
|
|
|
2346
1966
|
function toUpperCaseTransformer(value, options, context) {
|
|
2347
1967
|
if (value == null) return value;
|
|
2348
1968
|
if (typeof value === "string") return value.toUpperCase();
|
|
2349
|
-
throw new
|
|
1969
|
+
throw new InvalidArgumentError(
|
|
2350
1970
|
"The property transformer %v requires a String value, but %v given.",
|
|
2351
1971
|
context.transformerName,
|
|
2352
1972
|
value
|
|
@@ -2355,7 +1975,7 @@ function toUpperCaseTransformer(value, options, context) {
|
|
|
2355
1975
|
var init_to_upper_case_transformer = __esm({
|
|
2356
1976
|
"src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js"() {
|
|
2357
1977
|
"use strict";
|
|
2358
|
-
|
|
1978
|
+
init_errors();
|
|
2359
1979
|
__name(toUpperCaseTransformer, "toUpperCaseTransformer");
|
|
2360
1980
|
}
|
|
2361
1981
|
});
|
|
@@ -2367,7 +1987,7 @@ function toTitleCaseTransformer(value, options, context) {
|
|
|
2367
1987
|
return value.replace(new RegExp("\\p{L}\\S*", "gu"), (text) => {
|
|
2368
1988
|
return text.charAt(0).toUpperCase() + text.substring(1).toLowerCase();
|
|
2369
1989
|
});
|
|
2370
|
-
throw new
|
|
1990
|
+
throw new InvalidArgumentError(
|
|
2371
1991
|
"The property transformer %v requires a String value, but %v given.",
|
|
2372
1992
|
context.transformerName,
|
|
2373
1993
|
value
|
|
@@ -2376,7 +1996,7 @@ function toTitleCaseTransformer(value, options, context) {
|
|
|
2376
1996
|
var init_to_title_case_transformer = __esm({
|
|
2377
1997
|
"src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js"() {
|
|
2378
1998
|
"use strict";
|
|
2379
|
-
|
|
1999
|
+
init_errors();
|
|
2380
2000
|
__name(toTitleCaseTransformer, "toTitleCaseTransformer");
|
|
2381
2001
|
}
|
|
2382
2002
|
});
|
|
@@ -2393,17 +2013,17 @@ var init_builtin2 = __esm({
|
|
|
2393
2013
|
});
|
|
2394
2014
|
|
|
2395
2015
|
// src/definition/model/properties/property-transformer/property-transformer-registry.js
|
|
2396
|
-
var _PropertyTransformerRegistry, PropertyTransformerRegistry;
|
|
2016
|
+
var import_js_service8, _PropertyTransformerRegistry, PropertyTransformerRegistry;
|
|
2397
2017
|
var init_property_transformer_registry = __esm({
|
|
2398
2018
|
"src/definition/model/properties/property-transformer/property-transformer-registry.js"() {
|
|
2399
2019
|
"use strict";
|
|
2400
|
-
|
|
2020
|
+
import_js_service8 = require("@e22m4u/js-service");
|
|
2401
2021
|
init_builtin2();
|
|
2402
2022
|
init_builtin2();
|
|
2403
2023
|
init_builtin2();
|
|
2404
2024
|
init_builtin2();
|
|
2405
|
-
|
|
2406
|
-
_PropertyTransformerRegistry = class _PropertyTransformerRegistry extends Service {
|
|
2025
|
+
init_errors();
|
|
2026
|
+
_PropertyTransformerRegistry = class _PropertyTransformerRegistry extends import_js_service8.Service {
|
|
2407
2027
|
/**
|
|
2408
2028
|
* Transformers.
|
|
2409
2029
|
*
|
|
@@ -2424,17 +2044,17 @@ var init_property_transformer_registry = __esm({
|
|
|
2424
2044
|
*/
|
|
2425
2045
|
addTransformer(name, transformer) {
|
|
2426
2046
|
if (!name || typeof name !== "string")
|
|
2427
|
-
throw new
|
|
2047
|
+
throw new InvalidArgumentError(
|
|
2428
2048
|
"A name of the property transformer must be a non-empty String, but %v given.",
|
|
2429
2049
|
name
|
|
2430
2050
|
);
|
|
2431
2051
|
if (name in this._transformers)
|
|
2432
|
-
throw new
|
|
2052
|
+
throw new InvalidArgumentError(
|
|
2433
2053
|
"The property transformer %v is already defined.",
|
|
2434
2054
|
name
|
|
2435
2055
|
);
|
|
2436
2056
|
if (typeof transformer !== "function")
|
|
2437
|
-
throw new
|
|
2057
|
+
throw new InvalidArgumentError(
|
|
2438
2058
|
"The property transformer %v must be a Function, but %v given.",
|
|
2439
2059
|
name,
|
|
2440
2060
|
transformer
|
|
@@ -2460,7 +2080,7 @@ var init_property_transformer_registry = __esm({
|
|
|
2460
2080
|
getTransformer(name) {
|
|
2461
2081
|
const transformer = this._transformers[name];
|
|
2462
2082
|
if (!transformer)
|
|
2463
|
-
throw new
|
|
2083
|
+
throw new InvalidArgumentError(
|
|
2464
2084
|
"The property transformer %v is not defined.",
|
|
2465
2085
|
name
|
|
2466
2086
|
);
|
|
@@ -2482,15 +2102,15 @@ var init_property_transformer2 = __esm({
|
|
|
2482
2102
|
});
|
|
2483
2103
|
|
|
2484
2104
|
// src/definition/definition-registry.js
|
|
2485
|
-
var _DefinitionRegistry, DefinitionRegistry;
|
|
2105
|
+
var import_js_service9, _DefinitionRegistry, DefinitionRegistry;
|
|
2486
2106
|
var init_definition_registry = __esm({
|
|
2487
2107
|
"src/definition/definition-registry.js"() {
|
|
2488
2108
|
"use strict";
|
|
2489
|
-
|
|
2490
|
-
|
|
2109
|
+
import_js_service9 = require("@e22m4u/js-service");
|
|
2110
|
+
init_errors();
|
|
2491
2111
|
init_model();
|
|
2492
2112
|
init_definition();
|
|
2493
|
-
_DefinitionRegistry = class _DefinitionRegistry extends Service {
|
|
2113
|
+
_DefinitionRegistry = class _DefinitionRegistry extends import_js_service9.Service {
|
|
2494
2114
|
/**
|
|
2495
2115
|
* Datasources.
|
|
2496
2116
|
*
|
|
@@ -2512,7 +2132,7 @@ var init_definition_registry = __esm({
|
|
|
2512
2132
|
this.getService(DatasourceDefinitionValidator).validate(datasourceDef);
|
|
2513
2133
|
const name = datasourceDef.name;
|
|
2514
2134
|
if (name in this._datasources)
|
|
2515
|
-
throw new
|
|
2135
|
+
throw new InvalidArgumentError(
|
|
2516
2136
|
"The datasource %v is already defined.",
|
|
2517
2137
|
name
|
|
2518
2138
|
);
|
|
@@ -2536,7 +2156,7 @@ var init_definition_registry = __esm({
|
|
|
2536
2156
|
getDatasource(name) {
|
|
2537
2157
|
const datasourceDef = this._datasources[name];
|
|
2538
2158
|
if (!datasourceDef)
|
|
2539
|
-
throw new
|
|
2159
|
+
throw new InvalidArgumentError("The datasource %v is not defined.", name);
|
|
2540
2160
|
return datasourceDef;
|
|
2541
2161
|
}
|
|
2542
2162
|
/**
|
|
@@ -2548,7 +2168,7 @@ var init_definition_registry = __esm({
|
|
|
2548
2168
|
this.getService(ModelDefinitionValidator).validate(modelDef);
|
|
2549
2169
|
const name = modelDef.name;
|
|
2550
2170
|
if (name in this._models)
|
|
2551
|
-
throw new
|
|
2171
|
+
throw new InvalidArgumentError("The model %v is already defined.", name);
|
|
2552
2172
|
this._models[name] = modelDef;
|
|
2553
2173
|
}
|
|
2554
2174
|
/**
|
|
@@ -2569,7 +2189,7 @@ var init_definition_registry = __esm({
|
|
|
2569
2189
|
getModel(name) {
|
|
2570
2190
|
const modelDef = this._models[name];
|
|
2571
2191
|
if (!modelDef)
|
|
2572
|
-
throw new
|
|
2192
|
+
throw new InvalidArgumentError("The model %v is not defined.", name);
|
|
2573
2193
|
return modelDef;
|
|
2574
2194
|
}
|
|
2575
2195
|
};
|
|
@@ -2579,19 +2199,19 @@ var init_definition_registry = __esm({
|
|
|
2579
2199
|
});
|
|
2580
2200
|
|
|
2581
2201
|
// src/definition/model/model-definition-utils.js
|
|
2582
|
-
var DEFAULT_PRIMARY_KEY_PROPERTY_NAME, _ModelDefinitionUtils, ModelDefinitionUtils;
|
|
2202
|
+
var import_js_service10, DEFAULT_PRIMARY_KEY_PROPERTY_NAME, _ModelDefinitionUtils, ModelDefinitionUtils;
|
|
2583
2203
|
var init_model_definition_utils = __esm({
|
|
2584
2204
|
"src/definition/model/model-definition-utils.js"() {
|
|
2585
2205
|
"use strict";
|
|
2586
|
-
|
|
2206
|
+
import_js_service10 = require("@e22m4u/js-service");
|
|
2587
2207
|
init_properties();
|
|
2588
|
-
|
|
2589
|
-
|
|
2208
|
+
init_utils();
|
|
2209
|
+
init_utils();
|
|
2590
2210
|
init_properties();
|
|
2591
|
-
|
|
2211
|
+
init_errors();
|
|
2592
2212
|
init_definition_registry();
|
|
2593
2213
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME = "id";
|
|
2594
|
-
_ModelDefinitionUtils = class _ModelDefinitionUtils extends Service {
|
|
2214
|
+
_ModelDefinitionUtils = class _ModelDefinitionUtils extends import_js_service10.Service {
|
|
2595
2215
|
/**
|
|
2596
2216
|
* Get primary key as property name.
|
|
2597
2217
|
*
|
|
@@ -2609,7 +2229,7 @@ var init_model_definition_utils = __esm({
|
|
|
2609
2229
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME
|
|
2610
2230
|
);
|
|
2611
2231
|
if (isDefaultPrimaryKeyAlreadyInUse)
|
|
2612
|
-
throw new
|
|
2232
|
+
throw new InvalidArgumentError(
|
|
2613
2233
|
'The property name %v of the model %v is defined as a regular property. In this case, a primary key should be defined explicitly. Do use the option "primaryKey" to specify the primary key.',
|
|
2614
2234
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME,
|
|
2615
2235
|
modelName
|
|
@@ -2630,7 +2250,7 @@ var init_model_definition_utils = __esm({
|
|
|
2630
2250
|
try {
|
|
2631
2251
|
pkColName = this.getColumnNameByPropertyName(modelName, pkPropName);
|
|
2632
2252
|
} catch (error) {
|
|
2633
|
-
if (!(error instanceof
|
|
2253
|
+
if (!(error instanceof InvalidArgumentError)) throw error;
|
|
2634
2254
|
}
|
|
2635
2255
|
if (pkColName === void 0) return pkPropName;
|
|
2636
2256
|
return pkColName;
|
|
@@ -2658,7 +2278,7 @@ var init_model_definition_utils = __esm({
|
|
|
2658
2278
|
const propDefs = this.getPropertiesDefinitionInBaseModelHierarchy(modelName);
|
|
2659
2279
|
const propDef = propDefs[propertyName];
|
|
2660
2280
|
if (!propDef)
|
|
2661
|
-
throw new
|
|
2281
|
+
throw new InvalidArgumentError(
|
|
2662
2282
|
"The model %v does not have the property %v.",
|
|
2663
2283
|
modelName,
|
|
2664
2284
|
propertyName
|
|
@@ -2678,7 +2298,7 @@ var init_model_definition_utils = __esm({
|
|
|
2678
2298
|
const propDefs = this.getPropertiesDefinitionInBaseModelHierarchy(modelName);
|
|
2679
2299
|
const propDef = propDefs[propertyName];
|
|
2680
2300
|
if (!propDef)
|
|
2681
|
-
throw new
|
|
2301
|
+
throw new InvalidArgumentError(
|
|
2682
2302
|
"The model %v does not have the property %v.",
|
|
2683
2303
|
modelName,
|
|
2684
2304
|
propertyName
|
|
@@ -2768,7 +2388,7 @@ var init_model_definition_utils = __esm({
|
|
|
2768
2388
|
if (!propDef) {
|
|
2769
2389
|
const pkPropName = this.getPrimaryKeyAsPropertyName(modelName);
|
|
2770
2390
|
if (pkPropName === propertyName) return DataType.ANY;
|
|
2771
|
-
throw new
|
|
2391
|
+
throw new InvalidArgumentError(
|
|
2772
2392
|
"The model %v does not have the property %v.",
|
|
2773
2393
|
modelName,
|
|
2774
2394
|
propertyName
|
|
@@ -2785,7 +2405,7 @@ var init_model_definition_utils = __esm({
|
|
|
2785
2405
|
*/
|
|
2786
2406
|
getDataTypeFromPropertyDefinition(propDef) {
|
|
2787
2407
|
if ((!propDef || typeof propDef !== "object") && !Object.values(DataType).includes(propDef)) {
|
|
2788
|
-
throw new
|
|
2408
|
+
throw new InvalidArgumentError(
|
|
2789
2409
|
'The argument "propDef" of the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should be an Object or the DataType enum, but %v given.',
|
|
2790
2410
|
propDef
|
|
2791
2411
|
);
|
|
@@ -2793,7 +2413,7 @@ var init_model_definition_utils = __esm({
|
|
|
2793
2413
|
if (typeof propDef === "string") return propDef;
|
|
2794
2414
|
const dataType = propDef.type;
|
|
2795
2415
|
if (!Object.values(DataType).includes(dataType))
|
|
2796
|
-
throw new
|
|
2416
|
+
throw new InvalidArgumentError(
|
|
2797
2417
|
'The given Object to the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should have the "type" property with one of values: %l, but %v given.',
|
|
2798
2418
|
Object.values(DataType),
|
|
2799
2419
|
propDef.type
|
|
@@ -2843,7 +2463,7 @@ var init_model_definition_utils = __esm({
|
|
|
2843
2463
|
let pkPropDefs = {};
|
|
2844
2464
|
const recursion = /* @__PURE__ */ __name((currModelName, prevModelName = void 0) => {
|
|
2845
2465
|
if (currModelName === prevModelName)
|
|
2846
|
-
throw new
|
|
2466
|
+
throw new InvalidArgumentError(
|
|
2847
2467
|
"The model %v has a circular inheritance.",
|
|
2848
2468
|
currModelName
|
|
2849
2469
|
);
|
|
@@ -2881,7 +2501,7 @@ var init_model_definition_utils = __esm({
|
|
|
2881
2501
|
const recursion = /* @__PURE__ */ __name((currModelName, prevModelName = void 0) => {
|
|
2882
2502
|
var _a;
|
|
2883
2503
|
if (currModelName === prevModelName)
|
|
2884
|
-
throw new
|
|
2504
|
+
throw new InvalidArgumentError(
|
|
2885
2505
|
"The model %v has a circular inheritance.",
|
|
2886
2506
|
currModelName
|
|
2887
2507
|
);
|
|
@@ -2911,7 +2531,7 @@ var init_model_definition_utils = __esm({
|
|
|
2911
2531
|
}
|
|
2912
2532
|
}
|
|
2913
2533
|
if (!foundDef)
|
|
2914
|
-
throw new
|
|
2534
|
+
throw new InvalidArgumentError(
|
|
2915
2535
|
"The model %v does not have relation name %v.",
|
|
2916
2536
|
modelName,
|
|
2917
2537
|
relationName
|
|
@@ -2927,7 +2547,7 @@ var init_model_definition_utils = __esm({
|
|
|
2927
2547
|
*/
|
|
2928
2548
|
excludeObjectKeysByRelationNames(modelName, modelData) {
|
|
2929
2549
|
if (!modelData || typeof modelData !== "object" || Array.isArray(modelData))
|
|
2930
|
-
throw new
|
|
2550
|
+
throw new InvalidArgumentError(
|
|
2931
2551
|
"The second argument of ModelDefinitionUtils.excludeObjectKeysByRelationNames should be an Object, but %v given.",
|
|
2932
2552
|
modelData
|
|
2933
2553
|
);
|
|
@@ -2942,18 +2562,18 @@ var init_model_definition_utils = __esm({
|
|
|
2942
2562
|
});
|
|
2943
2563
|
|
|
2944
2564
|
// src/definition/model/properties/property-uniqueness-validator.js
|
|
2945
|
-
var _PropertyUniquenessValidator, PropertyUniquenessValidator;
|
|
2565
|
+
var import_js_service11, _PropertyUniquenessValidator, PropertyUniquenessValidator;
|
|
2946
2566
|
var init_property_uniqueness_validator = __esm({
|
|
2947
2567
|
"src/definition/model/properties/property-uniqueness-validator.js"() {
|
|
2948
2568
|
"use strict";
|
|
2949
2569
|
init_data_type();
|
|
2950
|
-
|
|
2951
|
-
|
|
2570
|
+
import_js_service11 = require("@e22m4u/js-service");
|
|
2571
|
+
init_utils();
|
|
2952
2572
|
init_property_uniqueness();
|
|
2953
2573
|
init_empty_values_definer();
|
|
2954
|
-
|
|
2574
|
+
init_errors();
|
|
2955
2575
|
init_model_definition_utils();
|
|
2956
|
-
_PropertyUniquenessValidator = class _PropertyUniquenessValidator extends Service {
|
|
2576
|
+
_PropertyUniquenessValidator = class _PropertyUniquenessValidator extends import_js_service11.Service {
|
|
2957
2577
|
/**
|
|
2958
2578
|
* Validate.
|
|
2959
2579
|
*
|
|
@@ -2966,22 +2586,22 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2966
2586
|
*/
|
|
2967
2587
|
async validate(countMethod, methodName, modelName, modelData, modelId = void 0) {
|
|
2968
2588
|
if (typeof countMethod !== "function")
|
|
2969
|
-
throw new
|
|
2589
|
+
throw new InvalidArgumentError(
|
|
2970
2590
|
'The parameter "countMethod" of the PropertyUniquenessValidator must be a Function, but %v given.',
|
|
2971
2591
|
countMethod
|
|
2972
2592
|
);
|
|
2973
2593
|
if (!methodName || typeof methodName !== "string")
|
|
2974
|
-
throw new
|
|
2594
|
+
throw new InvalidArgumentError(
|
|
2975
2595
|
'The parameter "methodName" of the PropertyUniquenessValidator must be a non-empty String, but %v given.',
|
|
2976
2596
|
methodName
|
|
2977
2597
|
);
|
|
2978
2598
|
if (!modelName || typeof modelName !== "string")
|
|
2979
|
-
throw new
|
|
2599
|
+
throw new InvalidArgumentError(
|
|
2980
2600
|
'The parameter "modelName" of the PropertyUniquenessValidator must be a non-empty String, but %v given.',
|
|
2981
2601
|
modelName
|
|
2982
2602
|
);
|
|
2983
2603
|
if (!isPureObject(modelData))
|
|
2984
|
-
throw new
|
|
2604
|
+
throw new InvalidArgumentError(
|
|
2985
2605
|
"The data of the model %v should be an Object, but %v given.",
|
|
2986
2606
|
modelName,
|
|
2987
2607
|
modelData
|
|
@@ -2994,7 +2614,7 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2994
2614
|
const idProp = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
|
|
2995
2615
|
modelName
|
|
2996
2616
|
);
|
|
2997
|
-
const createError = /* @__PURE__ */ __name((propName, propValue) => new
|
|
2617
|
+
const createError = /* @__PURE__ */ __name((propName, propValue) => new InvalidArgumentError(
|
|
2998
2618
|
"An existing document of the model %v already has the property %v with the value %v and should be unique.",
|
|
2999
2619
|
modelName,
|
|
3000
2620
|
propName,
|
|
@@ -3048,7 +2668,7 @@ var init_property_uniqueness_validator = __esm({
|
|
|
3048
2668
|
});
|
|
3049
2669
|
if (count > 0) throw createError(propName, propValue);
|
|
3050
2670
|
} else {
|
|
3051
|
-
throw new
|
|
2671
|
+
throw new InvalidArgumentError(
|
|
3052
2672
|
"The PropertyUniquenessValidator does not support the adapter method %v.",
|
|
3053
2673
|
methodName
|
|
3054
2674
|
);
|
|
@@ -3062,14 +2682,14 @@ var init_property_uniqueness_validator = __esm({
|
|
|
3062
2682
|
});
|
|
3063
2683
|
|
|
3064
2684
|
// src/definition/model/properties/primary-keys-definition-validator.js
|
|
3065
|
-
var _PrimaryKeysDefinitionValidator, PrimaryKeysDefinitionValidator;
|
|
2685
|
+
var import_js_service12, _PrimaryKeysDefinitionValidator, PrimaryKeysDefinitionValidator;
|
|
3066
2686
|
var init_primary_keys_definition_validator = __esm({
|
|
3067
2687
|
"src/definition/model/properties/primary-keys-definition-validator.js"() {
|
|
3068
2688
|
"use strict";
|
|
3069
|
-
|
|
3070
|
-
|
|
2689
|
+
import_js_service12 = require("@e22m4u/js-service");
|
|
2690
|
+
init_errors();
|
|
3071
2691
|
init_model_definition_utils();
|
|
3072
|
-
_PrimaryKeysDefinitionValidator = class _PrimaryKeysDefinitionValidator extends Service {
|
|
2692
|
+
_PrimaryKeysDefinitionValidator = class _PrimaryKeysDefinitionValidator extends import_js_service12.Service {
|
|
3073
2693
|
/**
|
|
3074
2694
|
* Validate.
|
|
3075
2695
|
*
|
|
@@ -3084,7 +2704,7 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3084
2704
|
if (propNames.length < 1) {
|
|
3085
2705
|
const isDefaultPrimaryKeyAlreadyInUse = Object.keys(propDefs).includes(DEFAULT_PRIMARY_KEY_PROPERTY_NAME);
|
|
3086
2706
|
if (isDefaultPrimaryKeyAlreadyInUse)
|
|
3087
|
-
throw new
|
|
2707
|
+
throw new InvalidArgumentError(
|
|
3088
2708
|
'The property name %v of the model %v is defined as a regular property. In this case, a primary key should be defined explicitly. Do use the option "primaryKey" to specify the primary key.',
|
|
3089
2709
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME,
|
|
3090
2710
|
modelName
|
|
@@ -3092,7 +2712,7 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3092
2712
|
return;
|
|
3093
2713
|
}
|
|
3094
2714
|
if (propNames.length > 1)
|
|
3095
|
-
throw new
|
|
2715
|
+
throw new InvalidArgumentError(
|
|
3096
2716
|
"The model definition %v should not have multiple primary keys, but %v keys given.",
|
|
3097
2717
|
modelName,
|
|
3098
2718
|
propNames.length
|
|
@@ -3100,7 +2720,7 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3100
2720
|
const pkPropName = propNames[0];
|
|
3101
2721
|
const pkPropDef = propDefs[pkPropName];
|
|
3102
2722
|
if (pkPropDef && typeof pkPropDef === "object" && pkPropDef.default !== void 0) {
|
|
3103
|
-
throw new
|
|
2723
|
+
throw new InvalidArgumentError(
|
|
3104
2724
|
"Do not specify a default value for the primary key %v of the model %v.",
|
|
3105
2725
|
pkPropName,
|
|
3106
2726
|
modelName
|
|
@@ -3114,19 +2734,19 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3114
2734
|
});
|
|
3115
2735
|
|
|
3116
2736
|
// src/definition/model/properties/properties-definition-validator.js
|
|
3117
|
-
var _PropertiesDefinitionValidator, PropertiesDefinitionValidator;
|
|
2737
|
+
var import_js_service13, _PropertiesDefinitionValidator, PropertiesDefinitionValidator;
|
|
3118
2738
|
var init_properties_definition_validator = __esm({
|
|
3119
2739
|
"src/definition/model/properties/properties-definition-validator.js"() {
|
|
3120
2740
|
"use strict";
|
|
3121
|
-
|
|
2741
|
+
import_js_service13 = require("@e22m4u/js-service");
|
|
3122
2742
|
init_data_type();
|
|
3123
|
-
|
|
2743
|
+
init_utils();
|
|
3124
2744
|
init_property_uniqueness();
|
|
3125
|
-
|
|
2745
|
+
init_errors();
|
|
3126
2746
|
init_property_validator2();
|
|
3127
2747
|
init_property_transformer2();
|
|
3128
2748
|
init_primary_keys_definition_validator();
|
|
3129
|
-
_PropertiesDefinitionValidator = class _PropertiesDefinitionValidator extends Service {
|
|
2749
|
+
_PropertiesDefinitionValidator = class _PropertiesDefinitionValidator extends import_js_service13.Service {
|
|
3130
2750
|
/**
|
|
3131
2751
|
* Validate.
|
|
3132
2752
|
*
|
|
@@ -3135,12 +2755,12 @@ var init_properties_definition_validator = __esm({
|
|
|
3135
2755
|
*/
|
|
3136
2756
|
validate(modelName, propDefs) {
|
|
3137
2757
|
if (!modelName || typeof modelName !== "string")
|
|
3138
|
-
throw new
|
|
2758
|
+
throw new InvalidArgumentError(
|
|
3139
2759
|
"The first argument of PropertiesDefinitionValidator.validate should be a non-empty String, but %v given.",
|
|
3140
2760
|
modelName
|
|
3141
2761
|
);
|
|
3142
2762
|
if (!propDefs || typeof propDefs !== "object" || Array.isArray(propDefs)) {
|
|
3143
|
-
throw new
|
|
2763
|
+
throw new InvalidArgumentError(
|
|
3144
2764
|
'The provided option "properties" of the model %v should be an Object, but %v given.',
|
|
3145
2765
|
modelName,
|
|
3146
2766
|
propDefs
|
|
@@ -3165,18 +2785,18 @@ var init_properties_definition_validator = __esm({
|
|
|
3165
2785
|
*/
|
|
3166
2786
|
_validateProperty(modelName, propName, propDef) {
|
|
3167
2787
|
if (!modelName || typeof modelName !== "string")
|
|
3168
|
-
throw new
|
|
2788
|
+
throw new InvalidArgumentError(
|
|
3169
2789
|
"The first argument of PropertiesDefinitionValidator._validateProperty should be a non-empty String, but %v given.",
|
|
3170
2790
|
modelName
|
|
3171
2791
|
);
|
|
3172
2792
|
if (!propName || typeof propName !== "string")
|
|
3173
|
-
throw new
|
|
2793
|
+
throw new InvalidArgumentError(
|
|
3174
2794
|
"The property name of the model %v should be a non-empty String, but %v given.",
|
|
3175
2795
|
modelName,
|
|
3176
2796
|
propName
|
|
3177
2797
|
);
|
|
3178
2798
|
if (!propDef)
|
|
3179
|
-
throw new
|
|
2799
|
+
throw new InvalidArgumentError(
|
|
3180
2800
|
"The property %v of the model %v should have a property definition, but %v given.",
|
|
3181
2801
|
propName,
|
|
3182
2802
|
modelName,
|
|
@@ -3184,7 +2804,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3184
2804
|
);
|
|
3185
2805
|
if (typeof propDef === "string") {
|
|
3186
2806
|
if (!Object.values(DataType).includes(propDef))
|
|
3187
|
-
throw new
|
|
2807
|
+
throw new InvalidArgumentError(
|
|
3188
2808
|
"In case of a short property definition, the property %v of the model %v should have one of data types: %l, but %v given.",
|
|
3189
2809
|
propName,
|
|
3190
2810
|
modelName,
|
|
@@ -3194,7 +2814,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3194
2814
|
return;
|
|
3195
2815
|
}
|
|
3196
2816
|
if (!propDef || typeof propDef !== "object" || Array.isArray(propDef)) {
|
|
3197
|
-
throw new
|
|
2817
|
+
throw new InvalidArgumentError(
|
|
3198
2818
|
"In case of a full property definition, the property %v of the model %v should be an Object, but %v given.",
|
|
3199
2819
|
propName,
|
|
3200
2820
|
modelName,
|
|
@@ -3202,7 +2822,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3202
2822
|
);
|
|
3203
2823
|
}
|
|
3204
2824
|
if (!propDef.type || !Object.values(DataType).includes(propDef.type))
|
|
3205
|
-
throw new
|
|
2825
|
+
throw new InvalidArgumentError(
|
|
3206
2826
|
'The property %v of the model %v requires the option "type" to have one of data types: %l, but %v given.',
|
|
3207
2827
|
propName,
|
|
3208
2828
|
modelName,
|
|
@@ -3210,7 +2830,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3210
2830
|
propDef.type
|
|
3211
2831
|
);
|
|
3212
2832
|
if (propDef.itemType && !Object.values(DataType).includes(propDef.itemType)) {
|
|
3213
|
-
throw new
|
|
2833
|
+
throw new InvalidArgumentError(
|
|
3214
2834
|
'The provided option "itemType" of the property %v in the model %v should have one of data types: %l, but %v given.',
|
|
3215
2835
|
propName,
|
|
3216
2836
|
modelName,
|
|
@@ -3219,60 +2839,60 @@ var init_properties_definition_validator = __esm({
|
|
|
3219
2839
|
);
|
|
3220
2840
|
}
|
|
3221
2841
|
if (propDef.model && typeof propDef.model !== "string")
|
|
3222
|
-
throw new
|
|
2842
|
+
throw new InvalidArgumentError(
|
|
3223
2843
|
'The provided option "model" of the property %v in the model %v should be a String, but %v given.',
|
|
3224
2844
|
propName,
|
|
3225
2845
|
modelName,
|
|
3226
2846
|
propDef.model
|
|
3227
2847
|
);
|
|
3228
2848
|
if (propDef.primaryKey && typeof propDef.primaryKey !== "boolean")
|
|
3229
|
-
throw new
|
|
2849
|
+
throw new InvalidArgumentError(
|
|
3230
2850
|
'The provided option "primaryKey" of the property %v in the model %v should be a Boolean, but %v given.',
|
|
3231
2851
|
propName,
|
|
3232
2852
|
modelName,
|
|
3233
2853
|
propDef.primaryKey
|
|
3234
2854
|
);
|
|
3235
2855
|
if (propDef.columnName && typeof propDef.columnName !== "string")
|
|
3236
|
-
throw new
|
|
2856
|
+
throw new InvalidArgumentError(
|
|
3237
2857
|
'The provided option "columnName" of the property %v in the model %v should be a String, but %v given.',
|
|
3238
2858
|
propName,
|
|
3239
2859
|
modelName,
|
|
3240
2860
|
propDef.columnName
|
|
3241
2861
|
);
|
|
3242
2862
|
if (propDef.columnType && typeof propDef.columnType !== "string")
|
|
3243
|
-
throw new
|
|
2863
|
+
throw new InvalidArgumentError(
|
|
3244
2864
|
'The provided option "columnType" of the property %v in the model %v should be a String, but %v given.',
|
|
3245
2865
|
propName,
|
|
3246
2866
|
modelName,
|
|
3247
2867
|
propDef.columnType
|
|
3248
2868
|
);
|
|
3249
2869
|
if (propDef.required && typeof propDef.required !== "boolean")
|
|
3250
|
-
throw new
|
|
2870
|
+
throw new InvalidArgumentError(
|
|
3251
2871
|
'The provided option "required" of the property %v in the model %v should be a Boolean, but %v given.',
|
|
3252
2872
|
propName,
|
|
3253
2873
|
modelName,
|
|
3254
2874
|
propDef.required
|
|
3255
2875
|
);
|
|
3256
2876
|
if (propDef.required && propDef.default !== void 0)
|
|
3257
|
-
throw new
|
|
2877
|
+
throw new InvalidArgumentError(
|
|
3258
2878
|
'The property %v of the model %v is a required property, so it should not have the option "default" to be provided.',
|
|
3259
2879
|
propName,
|
|
3260
2880
|
modelName
|
|
3261
2881
|
);
|
|
3262
2882
|
if (propDef.primaryKey && propDef.required)
|
|
3263
|
-
throw new
|
|
2883
|
+
throw new InvalidArgumentError(
|
|
3264
2884
|
'The property %v of the model %v is a primary key, so it should not have the option "required" to be provided.',
|
|
3265
2885
|
propName,
|
|
3266
2886
|
modelName
|
|
3267
2887
|
);
|
|
3268
2888
|
if (propDef.primaryKey && propDef.default !== void 0)
|
|
3269
|
-
throw new
|
|
2889
|
+
throw new InvalidArgumentError(
|
|
3270
2890
|
'The property %v of the model %v is a primary key, so it should not have the option "default" to be provided.',
|
|
3271
2891
|
propName,
|
|
3272
2892
|
modelName
|
|
3273
2893
|
);
|
|
3274
2894
|
if (propDef.itemType && propDef.type !== DataType.ARRAY)
|
|
3275
|
-
throw new
|
|
2895
|
+
throw new InvalidArgumentError(
|
|
3276
2896
|
'The property %v of the model %v has the non-array type, so it should not have the option "itemType" to be provided.',
|
|
3277
2897
|
propName,
|
|
3278
2898
|
modelName,
|
|
@@ -3280,14 +2900,14 @@ var init_properties_definition_validator = __esm({
|
|
|
3280
2900
|
);
|
|
3281
2901
|
if (propDef.model && propDef.type !== DataType.OBJECT && propDef.itemType !== DataType.OBJECT) {
|
|
3282
2902
|
if (propDef.type !== DataType.ARRAY) {
|
|
3283
|
-
throw new
|
|
2903
|
+
throw new InvalidArgumentError(
|
|
3284
2904
|
'The option "model" is not supported for %s property type, so the property %v of the model %v should not have the option "model" to be provided.',
|
|
3285
2905
|
capitalize(propDef.type),
|
|
3286
2906
|
propName,
|
|
3287
2907
|
modelName
|
|
3288
2908
|
);
|
|
3289
2909
|
} else {
|
|
3290
|
-
throw new
|
|
2910
|
+
throw new InvalidArgumentError(
|
|
3291
2911
|
'The option "model" is not supported for Array property type of %s, so the property %v of the model %v should not have the option "model" to be provided.',
|
|
3292
2912
|
capitalize(propDef.itemType),
|
|
3293
2913
|
propName,
|
|
@@ -3301,21 +2921,21 @@ var init_properties_definition_validator = __esm({
|
|
|
3301
2921
|
);
|
|
3302
2922
|
if (propDef.validate && typeof propDef.validate === "string") {
|
|
3303
2923
|
if (!propertyValidatorRegistry.hasValidator(propDef.validate))
|
|
3304
|
-
throw new
|
|
2924
|
+
throw new InvalidArgumentError(
|
|
3305
2925
|
"The property validator %v is not found.",
|
|
3306
2926
|
propDef.validate
|
|
3307
2927
|
);
|
|
3308
2928
|
} else if (Array.isArray(propDef.validate)) {
|
|
3309
2929
|
for (const validatorName of propDef.validate) {
|
|
3310
2930
|
if (typeof validatorName !== "string")
|
|
3311
|
-
throw new
|
|
2931
|
+
throw new InvalidArgumentError(
|
|
3312
2932
|
'The provided option "validate" of the property %v in the model %v has an Array value that should have a non-empty String, but %v given.',
|
|
3313
2933
|
propName,
|
|
3314
2934
|
modelName,
|
|
3315
2935
|
validatorName
|
|
3316
2936
|
);
|
|
3317
2937
|
if (!propertyValidatorRegistry.hasValidator(validatorName))
|
|
3318
|
-
throw new
|
|
2938
|
+
throw new InvalidArgumentError(
|
|
3319
2939
|
"The property validator %v is not found.",
|
|
3320
2940
|
validatorName
|
|
3321
2941
|
);
|
|
@@ -3323,13 +2943,13 @@ var init_properties_definition_validator = __esm({
|
|
|
3323
2943
|
} else if (typeof propDef.validate === "object") {
|
|
3324
2944
|
for (const validatorName in propDef.validate) {
|
|
3325
2945
|
if (!propertyValidatorRegistry.hasValidator(validatorName))
|
|
3326
|
-
throw new
|
|
2946
|
+
throw new InvalidArgumentError(
|
|
3327
2947
|
"The property validator %v is not found.",
|
|
3328
2948
|
validatorName
|
|
3329
2949
|
);
|
|
3330
2950
|
}
|
|
3331
2951
|
} else {
|
|
3332
|
-
throw new
|
|
2952
|
+
throw new InvalidArgumentError(
|
|
3333
2953
|
'The provided option "validate" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
|
|
3334
2954
|
propName,
|
|
3335
2955
|
modelName,
|
|
@@ -3343,21 +2963,21 @@ var init_properties_definition_validator = __esm({
|
|
|
3343
2963
|
);
|
|
3344
2964
|
if (propDef.transform && typeof propDef.transform === "string") {
|
|
3345
2965
|
if (!propertyTransformerRegistry.hasTransformer(propDef.transform))
|
|
3346
|
-
throw new
|
|
2966
|
+
throw new InvalidArgumentError(
|
|
3347
2967
|
"The property transformer %v is not found.",
|
|
3348
2968
|
propDef.transform
|
|
3349
2969
|
);
|
|
3350
2970
|
} else if (Array.isArray(propDef.transform)) {
|
|
3351
2971
|
for (const transformerName of propDef.transform) {
|
|
3352
2972
|
if (typeof transformerName !== "string")
|
|
3353
|
-
throw new
|
|
2973
|
+
throw new InvalidArgumentError(
|
|
3354
2974
|
'The provided option "transform" of the property %v in the model %v has an Array value that should have a non-empty String, but %v given.',
|
|
3355
2975
|
propName,
|
|
3356
2976
|
modelName,
|
|
3357
2977
|
transformerName
|
|
3358
2978
|
);
|
|
3359
2979
|
if (!propertyTransformerRegistry.hasTransformer(transformerName))
|
|
3360
|
-
throw new
|
|
2980
|
+
throw new InvalidArgumentError(
|
|
3361
2981
|
"The property transformer %v is not found.",
|
|
3362
2982
|
transformerName
|
|
3363
2983
|
);
|
|
@@ -3365,13 +2985,13 @@ var init_properties_definition_validator = __esm({
|
|
|
3365
2985
|
} else if (typeof propDef.transform === "object") {
|
|
3366
2986
|
for (const transformerName in propDef.transform) {
|
|
3367
2987
|
if (!propertyTransformerRegistry.hasTransformer(transformerName))
|
|
3368
|
-
throw new
|
|
2988
|
+
throw new InvalidArgumentError(
|
|
3369
2989
|
"The property transformer %v is not found.",
|
|
3370
2990
|
transformerName
|
|
3371
2991
|
);
|
|
3372
2992
|
}
|
|
3373
2993
|
} else {
|
|
3374
|
-
throw new
|
|
2994
|
+
throw new InvalidArgumentError(
|
|
3375
2995
|
'The provided option "transform" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
|
|
3376
2996
|
propName,
|
|
3377
2997
|
modelName,
|
|
@@ -3381,7 +3001,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3381
3001
|
}
|
|
3382
3002
|
if (propDef.unique) {
|
|
3383
3003
|
if (typeof propDef.unique !== "boolean" && !Object.values(PropertyUniqueness).includes(propDef.unique)) {
|
|
3384
|
-
throw new
|
|
3004
|
+
throw new InvalidArgumentError(
|
|
3385
3005
|
'The provided option "unique" of the property %v in the model %v should be a Boolean or one of values: %l, but %v given.',
|
|
3386
3006
|
propName,
|
|
3387
3007
|
modelName,
|
|
@@ -3391,7 +3011,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3391
3011
|
}
|
|
3392
3012
|
}
|
|
3393
3013
|
if (propDef.unique && propDef.primaryKey)
|
|
3394
|
-
throw new
|
|
3014
|
+
throw new InvalidArgumentError(
|
|
3395
3015
|
'The property %v of the model %v is a primary key, so it should not have the option "unique" to be provided.',
|
|
3396
3016
|
propName,
|
|
3397
3017
|
modelName
|
|
@@ -3427,19 +3047,19 @@ var init_model_definition = __esm({
|
|
|
3427
3047
|
});
|
|
3428
3048
|
|
|
3429
3049
|
// src/definition/model/model-data-validator.js
|
|
3430
|
-
var _ModelDataValidator, ModelDataValidator;
|
|
3050
|
+
var import_js_service14, _ModelDataValidator, ModelDataValidator;
|
|
3431
3051
|
var init_model_data_validator = __esm({
|
|
3432
3052
|
"src/definition/model/model-data-validator.js"() {
|
|
3433
3053
|
"use strict";
|
|
3434
|
-
|
|
3054
|
+
import_js_service14 = require("@e22m4u/js-service");
|
|
3435
3055
|
init_properties();
|
|
3436
|
-
|
|
3437
|
-
|
|
3056
|
+
init_utils();
|
|
3057
|
+
init_utils();
|
|
3438
3058
|
init_properties();
|
|
3439
|
-
|
|
3059
|
+
init_errors();
|
|
3440
3060
|
init_properties();
|
|
3441
3061
|
init_model_definition_utils();
|
|
3442
|
-
_ModelDataValidator = class _ModelDataValidator extends Service {
|
|
3062
|
+
_ModelDataValidator = class _ModelDataValidator extends import_js_service14.Service {
|
|
3443
3063
|
/**
|
|
3444
3064
|
* Validate.
|
|
3445
3065
|
*
|
|
@@ -3450,7 +3070,7 @@ var init_model_data_validator = __esm({
|
|
|
3450
3070
|
*/
|
|
3451
3071
|
validate(modelName, modelData, isPartial = false) {
|
|
3452
3072
|
if (!isPureObject(modelData))
|
|
3453
|
-
throw new
|
|
3073
|
+
throw new InvalidArgumentError(
|
|
3454
3074
|
"The data of the model %v should be an Object, but %v given.",
|
|
3455
3075
|
modelName,
|
|
3456
3076
|
modelData
|
|
@@ -3490,7 +3110,7 @@ var init_model_data_validator = __esm({
|
|
|
3490
3110
|
if (isEmpty) {
|
|
3491
3111
|
const isRequired = typeof propDef === "string" ? false : Boolean(propDef.required);
|
|
3492
3112
|
if (!isRequired) return;
|
|
3493
|
-
throw new
|
|
3113
|
+
throw new InvalidArgumentError(
|
|
3494
3114
|
"The property %v of the model %v is required, but %v given.",
|
|
3495
3115
|
propName,
|
|
3496
3116
|
modelName,
|
|
@@ -3531,7 +3151,7 @@ var init_model_data_validator = __esm({
|
|
|
3531
3151
|
const pattern = isArrayValue ? "The array property %v of the model %v must have %s element, but %s given." : "The property %v of the model %v must have %s, but %s given.";
|
|
3532
3152
|
const ctorName = getCtorName(propValue);
|
|
3533
3153
|
const givenStr = ctorName != null ? ctorName : typeof propValue;
|
|
3534
|
-
return new
|
|
3154
|
+
return new InvalidArgumentError(
|
|
3535
3155
|
pattern,
|
|
3536
3156
|
propName,
|
|
3537
3157
|
modelName,
|
|
@@ -3586,7 +3206,7 @@ var init_model_data_validator = __esm({
|
|
|
3586
3206
|
if (typeof propDef === "string" || propDef.validate == null) return;
|
|
3587
3207
|
const validateDef = propDef.validate;
|
|
3588
3208
|
const validatorRegistry = this.getService(PropertyValidatorRegistry);
|
|
3589
|
-
const createError = /* @__PURE__ */ __name((validatorName) => new
|
|
3209
|
+
const createError = /* @__PURE__ */ __name((validatorName) => new InvalidArgumentError(
|
|
3590
3210
|
"The property %v of the model %v has an invalid value %v that caught by the validator %v.",
|
|
3591
3211
|
propName,
|
|
3592
3212
|
modelName,
|
|
@@ -3598,7 +3218,7 @@ var init_model_data_validator = __esm({
|
|
|
3598
3218
|
const context = { validatorName, modelName, propName };
|
|
3599
3219
|
const valid = validator(propValue, validatorOptions, context);
|
|
3600
3220
|
if (valid instanceof Promise) {
|
|
3601
|
-
throw new
|
|
3221
|
+
throw new InvalidArgumentError(
|
|
3602
3222
|
"Asynchronous property validators are not supported, but the property validator %v returns a Promise.",
|
|
3603
3223
|
validatorName
|
|
3604
3224
|
);
|
|
@@ -3618,7 +3238,7 @@ var init_model_data_validator = __esm({
|
|
|
3618
3238
|
}
|
|
3619
3239
|
});
|
|
3620
3240
|
} else {
|
|
3621
|
-
throw new
|
|
3241
|
+
throw new InvalidArgumentError(
|
|
3622
3242
|
'The provided option "validate" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
|
|
3623
3243
|
propName,
|
|
3624
3244
|
modelName,
|
|
@@ -3633,14 +3253,14 @@ var init_model_data_validator = __esm({
|
|
|
3633
3253
|
});
|
|
3634
3254
|
|
|
3635
3255
|
// src/definition/model/model-data-sanitizer.js
|
|
3636
|
-
var _ModelDataSanitizer, ModelDataSanitizer;
|
|
3256
|
+
var import_js_service15, _ModelDataSanitizer, ModelDataSanitizer;
|
|
3637
3257
|
var init_model_data_sanitizer = __esm({
|
|
3638
3258
|
"src/definition/model/model-data-sanitizer.js"() {
|
|
3639
3259
|
"use strict";
|
|
3640
|
-
|
|
3641
|
-
|
|
3260
|
+
import_js_service15 = require("@e22m4u/js-service");
|
|
3261
|
+
init_errors();
|
|
3642
3262
|
init_model_definition_utils();
|
|
3643
|
-
_ModelDataSanitizer = class _ModelDataSanitizer extends Service {
|
|
3263
|
+
_ModelDataSanitizer = class _ModelDataSanitizer extends import_js_service15.Service {
|
|
3644
3264
|
/**
|
|
3645
3265
|
* Validate.
|
|
3646
3266
|
*
|
|
@@ -3650,12 +3270,12 @@ var init_model_data_sanitizer = __esm({
|
|
|
3650
3270
|
*/
|
|
3651
3271
|
sanitize(modelName, modelData) {
|
|
3652
3272
|
if (!modelName || typeof modelName !== "string")
|
|
3653
|
-
throw new
|
|
3273
|
+
throw new InvalidArgumentError(
|
|
3654
3274
|
"The first argument of ModelDataSanitizer.sanitize should be a string, but %v given.",
|
|
3655
3275
|
modelName
|
|
3656
3276
|
);
|
|
3657
3277
|
if (!modelData || typeof modelData !== "object")
|
|
3658
|
-
throw new
|
|
3278
|
+
throw new InvalidArgumentError(
|
|
3659
3279
|
"The second argument of ModelDataSanitizer.sanitize should be an Object, but %v given.",
|
|
3660
3280
|
modelData
|
|
3661
3281
|
);
|
|
@@ -3670,19 +3290,19 @@ var init_model_data_sanitizer = __esm({
|
|
|
3670
3290
|
});
|
|
3671
3291
|
|
|
3672
3292
|
// src/definition/model/model-data-transformer.js
|
|
3673
|
-
var _ModelDataTransformer, ModelDataTransformer;
|
|
3293
|
+
var import_js_service16, _ModelDataTransformer, ModelDataTransformer;
|
|
3674
3294
|
var init_model_data_transformer = __esm({
|
|
3675
3295
|
"src/definition/model/model-data-transformer.js"() {
|
|
3676
3296
|
"use strict";
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3297
|
+
import_js_service16 = require("@e22m4u/js-service");
|
|
3298
|
+
init_utils();
|
|
3299
|
+
init_utils();
|
|
3300
|
+
init_utils();
|
|
3681
3301
|
init_properties();
|
|
3682
|
-
|
|
3302
|
+
init_errors();
|
|
3683
3303
|
init_model_definition_utils();
|
|
3684
3304
|
init_properties();
|
|
3685
|
-
_ModelDataTransformer = class _ModelDataTransformer extends Service {
|
|
3305
|
+
_ModelDataTransformer = class _ModelDataTransformer extends import_js_service16.Service {
|
|
3686
3306
|
/**
|
|
3687
3307
|
* Transform.
|
|
3688
3308
|
*
|
|
@@ -3693,7 +3313,7 @@ var init_model_data_transformer = __esm({
|
|
|
3693
3313
|
*/
|
|
3694
3314
|
transform(modelName, modelData, isPartial = false) {
|
|
3695
3315
|
if (!isPureObject(modelData))
|
|
3696
|
-
throw new
|
|
3316
|
+
throw new InvalidArgumentError(
|
|
3697
3317
|
"The data of the model %v should be an Object, but %v given.",
|
|
3698
3318
|
modelName,
|
|
3699
3319
|
modelData
|
|
@@ -3764,7 +3384,7 @@ var init_model_data_transformer = __esm({
|
|
|
3764
3384
|
propValue
|
|
3765
3385
|
);
|
|
3766
3386
|
} else {
|
|
3767
|
-
throw new
|
|
3387
|
+
throw new InvalidArgumentError(
|
|
3768
3388
|
'The provided option "transform" of the property %v in the model %v should be a non-empty String, an Array of String or an Object, but %v given.',
|
|
3769
3389
|
propName,
|
|
3770
3390
|
modelName,
|
|
@@ -3779,15 +3399,15 @@ var init_model_data_transformer = __esm({
|
|
|
3779
3399
|
});
|
|
3780
3400
|
|
|
3781
3401
|
// src/definition/model/model-definition-validator.js
|
|
3782
|
-
var _ModelDefinitionValidator, ModelDefinitionValidator;
|
|
3402
|
+
var import_js_service17, _ModelDefinitionValidator, ModelDefinitionValidator;
|
|
3783
3403
|
var init_model_definition_validator = __esm({
|
|
3784
3404
|
"src/definition/model/model-definition-validator.js"() {
|
|
3785
3405
|
"use strict";
|
|
3786
|
-
|
|
3787
|
-
|
|
3406
|
+
import_js_service17 = require("@e22m4u/js-service");
|
|
3407
|
+
init_errors();
|
|
3788
3408
|
init_relations();
|
|
3789
3409
|
init_properties();
|
|
3790
|
-
_ModelDefinitionValidator = class _ModelDefinitionValidator extends Service {
|
|
3410
|
+
_ModelDefinitionValidator = class _ModelDefinitionValidator extends import_js_service17.Service {
|
|
3791
3411
|
/**
|
|
3792
3412
|
* Validate.
|
|
3793
3413
|
*
|
|
@@ -3795,36 +3415,36 @@ var init_model_definition_validator = __esm({
|
|
|
3795
3415
|
*/
|
|
3796
3416
|
validate(modelDef) {
|
|
3797
3417
|
if (!modelDef || typeof modelDef !== "object" || Array.isArray(modelDef))
|
|
3798
|
-
throw new
|
|
3418
|
+
throw new InvalidArgumentError(
|
|
3799
3419
|
"The model definition should be an Object, but %v given.",
|
|
3800
3420
|
modelDef
|
|
3801
3421
|
);
|
|
3802
3422
|
if (!modelDef.name || typeof modelDef.name !== "string")
|
|
3803
|
-
throw new
|
|
3423
|
+
throw new InvalidArgumentError(
|
|
3804
3424
|
'The model definition requires the option "name" as a non-empty String, but %v given.',
|
|
3805
3425
|
modelDef.name
|
|
3806
3426
|
);
|
|
3807
3427
|
if (modelDef.datasource && typeof modelDef.datasource !== "string")
|
|
3808
|
-
throw new
|
|
3428
|
+
throw new InvalidArgumentError(
|
|
3809
3429
|
'The provided option "datasource" of the model %v should be a String, but %v given.',
|
|
3810
3430
|
modelDef.name,
|
|
3811
3431
|
modelDef.datasource
|
|
3812
3432
|
);
|
|
3813
3433
|
if (modelDef.base && typeof modelDef.base !== "string")
|
|
3814
|
-
throw new
|
|
3434
|
+
throw new InvalidArgumentError(
|
|
3815
3435
|
'The provided option "base" of the model %v should be a String, but %v given.',
|
|
3816
3436
|
modelDef.name,
|
|
3817
3437
|
modelDef.base
|
|
3818
3438
|
);
|
|
3819
3439
|
if (modelDef.tableName && typeof modelDef.tableName !== "string")
|
|
3820
|
-
throw new
|
|
3440
|
+
throw new InvalidArgumentError(
|
|
3821
3441
|
'The provided option "tableName" of the model %v should be a String, but %v given.',
|
|
3822
3442
|
modelDef.name,
|
|
3823
3443
|
modelDef.tableName
|
|
3824
3444
|
);
|
|
3825
3445
|
if (modelDef.properties) {
|
|
3826
3446
|
if (typeof modelDef.properties !== "object" || Array.isArray(modelDef.properties)) {
|
|
3827
|
-
throw new
|
|
3447
|
+
throw new InvalidArgumentError(
|
|
3828
3448
|
'The provided option "properties" of the model %v should be an Object, but %v given.',
|
|
3829
3449
|
modelDef.name,
|
|
3830
3450
|
modelDef.properties
|
|
@@ -3837,7 +3457,7 @@ var init_model_definition_validator = __esm({
|
|
|
3837
3457
|
}
|
|
3838
3458
|
if (modelDef.relations) {
|
|
3839
3459
|
if (typeof modelDef.relations !== "object" || Array.isArray(modelDef.relations)) {
|
|
3840
|
-
throw new
|
|
3460
|
+
throw new InvalidArgumentError(
|
|
3841
3461
|
'The provided option "relations" of the model %v should be an Object, but %v given.',
|
|
3842
3462
|
modelDef.name,
|
|
3843
3463
|
modelDef.relations
|
|
@@ -3871,13 +3491,13 @@ var init_model = __esm({
|
|
|
3871
3491
|
});
|
|
3872
3492
|
|
|
3873
3493
|
// src/definition/datasource/datasource-definition-validator.js
|
|
3874
|
-
var _DatasourceDefinitionValidator, DatasourceDefinitionValidator;
|
|
3494
|
+
var import_js_service18, _DatasourceDefinitionValidator, DatasourceDefinitionValidator;
|
|
3875
3495
|
var init_datasource_definition_validator = __esm({
|
|
3876
3496
|
"src/definition/datasource/datasource-definition-validator.js"() {
|
|
3877
3497
|
"use strict";
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
_DatasourceDefinitionValidator = class _DatasourceDefinitionValidator extends Service {
|
|
3498
|
+
import_js_service18 = require("@e22m4u/js-service");
|
|
3499
|
+
init_errors();
|
|
3500
|
+
_DatasourceDefinitionValidator = class _DatasourceDefinitionValidator extends import_js_service18.Service {
|
|
3881
3501
|
/**
|
|
3882
3502
|
* Validate.
|
|
3883
3503
|
*
|
|
@@ -3885,17 +3505,17 @@ var init_datasource_definition_validator = __esm({
|
|
|
3885
3505
|
*/
|
|
3886
3506
|
validate(datasourceDef) {
|
|
3887
3507
|
if (!datasourceDef || typeof datasourceDef !== "object")
|
|
3888
|
-
throw new
|
|
3508
|
+
throw new InvalidArgumentError(
|
|
3889
3509
|
"The datasource definition should be an Object, but %v given.",
|
|
3890
3510
|
datasourceDef
|
|
3891
3511
|
);
|
|
3892
3512
|
if (!datasourceDef.name || typeof datasourceDef.name !== "string")
|
|
3893
|
-
throw new
|
|
3513
|
+
throw new InvalidArgumentError(
|
|
3894
3514
|
'The datasource definition requires the option "name" as a non-empty String, but %v given.',
|
|
3895
3515
|
datasourceDef.name
|
|
3896
3516
|
);
|
|
3897
3517
|
if (!datasourceDef.adapter || typeof datasourceDef.adapter !== "string")
|
|
3898
|
-
throw new
|
|
3518
|
+
throw new InvalidArgumentError(
|
|
3899
3519
|
'The datasource %v requires the option "adapter" as a non-empty String, but %v given.',
|
|
3900
3520
|
datasourceDef.name,
|
|
3901
3521
|
datasourceDef.adapter
|
|
@@ -3926,15 +3546,15 @@ var init_definition = __esm({
|
|
|
3926
3546
|
});
|
|
3927
3547
|
|
|
3928
3548
|
// src/filter/fields-clause-tool.js
|
|
3929
|
-
var _FieldsClauseTool, FieldsClauseTool;
|
|
3549
|
+
var import_js_service19, _FieldsClauseTool, FieldsClauseTool;
|
|
3930
3550
|
var init_fields_clause_tool = __esm({
|
|
3931
3551
|
"src/filter/fields-clause-tool.js"() {
|
|
3932
3552
|
"use strict";
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3553
|
+
import_js_service19 = require("@e22m4u/js-service");
|
|
3554
|
+
init_utils();
|
|
3555
|
+
init_errors();
|
|
3936
3556
|
init_definition();
|
|
3937
|
-
_FieldsClauseTool = class _FieldsClauseTool extends Service {
|
|
3557
|
+
_FieldsClauseTool = class _FieldsClauseTool extends import_js_service19.Service {
|
|
3938
3558
|
/**
|
|
3939
3559
|
* Filter.
|
|
3940
3560
|
*
|
|
@@ -3948,13 +3568,13 @@ var init_fields_clause_tool = __esm({
|
|
|
3948
3568
|
let entities = isArray ? input : [input];
|
|
3949
3569
|
entities.forEach((entity) => {
|
|
3950
3570
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
3951
|
-
throw new
|
|
3571
|
+
throw new InvalidArgumentError(
|
|
3952
3572
|
"The first argument of FieldsClauseTool.filter should be an Object or an Array of Object, but %v given.",
|
|
3953
3573
|
entity
|
|
3954
3574
|
);
|
|
3955
3575
|
});
|
|
3956
3576
|
if (!modelName || typeof modelName !== "string")
|
|
3957
|
-
throw new
|
|
3577
|
+
throw new InvalidArgumentError(
|
|
3958
3578
|
"The second argument of FieldsClauseTool.filter should be a non-empty String, but %v given.",
|
|
3959
3579
|
modelName
|
|
3960
3580
|
);
|
|
@@ -3963,7 +3583,7 @@ var init_fields_clause_tool = __esm({
|
|
|
3963
3583
|
if (!fields.length) return input;
|
|
3964
3584
|
fields.forEach((field) => {
|
|
3965
3585
|
if (!field || typeof field !== "string")
|
|
3966
|
-
throw new
|
|
3586
|
+
throw new InvalidArgumentError(
|
|
3967
3587
|
'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
3968
3588
|
field
|
|
3969
3589
|
);
|
|
@@ -3986,7 +3606,7 @@ var init_fields_clause_tool = __esm({
|
|
|
3986
3606
|
if (!fields.length) return;
|
|
3987
3607
|
fields.forEach((field) => {
|
|
3988
3608
|
if (!field || typeof field !== "string")
|
|
3989
|
-
throw new
|
|
3609
|
+
throw new InvalidArgumentError(
|
|
3990
3610
|
'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
3991
3611
|
field
|
|
3992
3612
|
);
|
|
@@ -4004,7 +3624,7 @@ var init_fields_clause_tool = __esm({
|
|
|
4004
3624
|
if (!fields.length) return;
|
|
4005
3625
|
fields.forEach((field) => {
|
|
4006
3626
|
if (!field || typeof field !== "string")
|
|
4007
|
-
throw new
|
|
3627
|
+
throw new InvalidArgumentError(
|
|
4008
3628
|
'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
4009
3629
|
field
|
|
4010
3630
|
);
|
|
@@ -4018,17 +3638,17 @@ var init_fields_clause_tool = __esm({
|
|
|
4018
3638
|
});
|
|
4019
3639
|
|
|
4020
3640
|
// src/relations/has-one-resolver.js
|
|
4021
|
-
var _HasOneResolver, HasOneResolver;
|
|
3641
|
+
var import_js_service20, _HasOneResolver, HasOneResolver;
|
|
4022
3642
|
var init_has_one_resolver = __esm({
|
|
4023
3643
|
"src/relations/has-one-resolver.js"() {
|
|
4024
3644
|
"use strict";
|
|
4025
|
-
|
|
4026
|
-
|
|
3645
|
+
import_js_service20 = require("@e22m4u/js-service");
|
|
3646
|
+
init_utils();
|
|
4027
3647
|
init_definition();
|
|
4028
|
-
|
|
3648
|
+
init_errors();
|
|
4029
3649
|
init_repository2();
|
|
4030
3650
|
init_definition();
|
|
4031
|
-
_HasOneResolver = class _HasOneResolver extends Service {
|
|
3651
|
+
_HasOneResolver = class _HasOneResolver extends import_js_service20.Service {
|
|
4032
3652
|
/**
|
|
4033
3653
|
* Include to.
|
|
4034
3654
|
*
|
|
@@ -4042,32 +3662,32 @@ var init_has_one_resolver = __esm({
|
|
|
4042
3662
|
*/
|
|
4043
3663
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
|
|
4044
3664
|
if (!entities || !Array.isArray(entities))
|
|
4045
|
-
throw new
|
|
3665
|
+
throw new InvalidArgumentError(
|
|
4046
3666
|
'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v given.',
|
|
4047
3667
|
entities
|
|
4048
3668
|
);
|
|
4049
3669
|
if (!sourceName || typeof sourceName !== "string")
|
|
4050
|
-
throw new
|
|
3670
|
+
throw new InvalidArgumentError(
|
|
4051
3671
|
'The parameter "sourceName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
4052
3672
|
sourceName
|
|
4053
3673
|
);
|
|
4054
3674
|
if (!targetName || typeof targetName !== "string")
|
|
4055
|
-
throw new
|
|
3675
|
+
throw new InvalidArgumentError(
|
|
4056
3676
|
'The parameter "targetName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
4057
3677
|
targetName
|
|
4058
3678
|
);
|
|
4059
3679
|
if (!relationName || typeof relationName !== "string")
|
|
4060
|
-
throw new
|
|
3680
|
+
throw new InvalidArgumentError(
|
|
4061
3681
|
'The parameter "relationName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
4062
3682
|
relationName
|
|
4063
3683
|
);
|
|
4064
3684
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4065
|
-
throw new
|
|
3685
|
+
throw new InvalidArgumentError(
|
|
4066
3686
|
'The parameter "foreignKey" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
4067
3687
|
foreignKey
|
|
4068
3688
|
);
|
|
4069
3689
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4070
|
-
throw new
|
|
3690
|
+
throw new InvalidArgumentError(
|
|
4071
3691
|
'The provided parameter "scope" of HasOneResolver.includeTo should be an Object, but %v given.',
|
|
4072
3692
|
scope
|
|
4073
3693
|
);
|
|
@@ -4077,7 +3697,7 @@ var init_has_one_resolver = __esm({
|
|
|
4077
3697
|
const sourceIds = [];
|
|
4078
3698
|
entities.forEach((entity) => {
|
|
4079
3699
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4080
|
-
throw new
|
|
3700
|
+
throw new InvalidArgumentError(
|
|
4081
3701
|
'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v given.',
|
|
4082
3702
|
entity
|
|
4083
3703
|
);
|
|
@@ -4121,37 +3741,37 @@ var init_has_one_resolver = __esm({
|
|
|
4121
3741
|
*/
|
|
4122
3742
|
async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
|
|
4123
3743
|
if (!entities || !Array.isArray(entities))
|
|
4124
|
-
throw new
|
|
3744
|
+
throw new InvalidArgumentError(
|
|
4125
3745
|
'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4126
3746
|
entities
|
|
4127
3747
|
);
|
|
4128
3748
|
if (!sourceName || typeof sourceName !== "string")
|
|
4129
|
-
throw new
|
|
3749
|
+
throw new InvalidArgumentError(
|
|
4130
3750
|
'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4131
3751
|
sourceName
|
|
4132
3752
|
);
|
|
4133
3753
|
if (!targetName || typeof targetName !== "string")
|
|
4134
|
-
throw new
|
|
3754
|
+
throw new InvalidArgumentError(
|
|
4135
3755
|
'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4136
3756
|
targetName
|
|
4137
3757
|
);
|
|
4138
3758
|
if (!relationName || typeof relationName !== "string")
|
|
4139
|
-
throw new
|
|
3759
|
+
throw new InvalidArgumentError(
|
|
4140
3760
|
'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4141
3761
|
relationName
|
|
4142
3762
|
);
|
|
4143
3763
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4144
|
-
throw new
|
|
3764
|
+
throw new InvalidArgumentError(
|
|
4145
3765
|
'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4146
3766
|
foreignKey
|
|
4147
3767
|
);
|
|
4148
3768
|
if (!discriminator || typeof discriminator !== "string")
|
|
4149
|
-
throw new
|
|
3769
|
+
throw new InvalidArgumentError(
|
|
4150
3770
|
'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4151
3771
|
discriminator
|
|
4152
3772
|
);
|
|
4153
3773
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4154
|
-
throw new
|
|
3774
|
+
throw new InvalidArgumentError(
|
|
4155
3775
|
'The provided parameter "scope" of HasOneResolver.includePolymorphicTo should be an Object, but %v given.',
|
|
4156
3776
|
scope
|
|
4157
3777
|
);
|
|
@@ -4161,7 +3781,7 @@ var init_has_one_resolver = __esm({
|
|
|
4161
3781
|
const sourceIds = [];
|
|
4162
3782
|
entities.forEach((entity) => {
|
|
4163
3783
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4164
|
-
throw new
|
|
3784
|
+
throw new InvalidArgumentError(
|
|
4165
3785
|
'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4166
3786
|
entity
|
|
4167
3787
|
);
|
|
@@ -4207,32 +3827,32 @@ var init_has_one_resolver = __esm({
|
|
|
4207
3827
|
*/
|
|
4208
3828
|
async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
|
|
4209
3829
|
if (!entities || !Array.isArray(entities))
|
|
4210
|
-
throw new
|
|
3830
|
+
throw new InvalidArgumentError(
|
|
4211
3831
|
'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires an Array of Object, but %v given.',
|
|
4212
3832
|
entities
|
|
4213
3833
|
);
|
|
4214
3834
|
if (!sourceName || typeof sourceName !== "string")
|
|
4215
|
-
throw new
|
|
3835
|
+
throw new InvalidArgumentError(
|
|
4216
3836
|
'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4217
3837
|
sourceName
|
|
4218
3838
|
);
|
|
4219
3839
|
if (!targetName || typeof targetName !== "string")
|
|
4220
|
-
throw new
|
|
3840
|
+
throw new InvalidArgumentError(
|
|
4221
3841
|
'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4222
3842
|
targetName
|
|
4223
3843
|
);
|
|
4224
3844
|
if (!relationName || typeof relationName !== "string")
|
|
4225
|
-
throw new
|
|
3845
|
+
throw new InvalidArgumentError(
|
|
4226
3846
|
'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4227
3847
|
relationName
|
|
4228
3848
|
);
|
|
4229
3849
|
if (!targetRelationName || typeof targetRelationName !== "string")
|
|
4230
|
-
throw new
|
|
3850
|
+
throw new InvalidArgumentError(
|
|
4231
3851
|
'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4232
3852
|
targetRelationName
|
|
4233
3853
|
);
|
|
4234
3854
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4235
|
-
throw new
|
|
3855
|
+
throw new InvalidArgumentError(
|
|
4236
3856
|
'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName should be an Object, but %v given.',
|
|
4237
3857
|
scope
|
|
4238
3858
|
);
|
|
@@ -4240,7 +3860,7 @@ var init_has_one_resolver = __esm({
|
|
|
4240
3860
|
ModelDefinitionUtils
|
|
4241
3861
|
).getRelationDefinitionByName(targetName, targetRelationName);
|
|
4242
3862
|
if (targetRelationDef.type !== RelationType.BELONGS_TO)
|
|
4243
|
-
throw new
|
|
3863
|
+
throw new InvalidArgumentError(
|
|
4244
3864
|
'The relation %v of the model %v is a polymorphic "hasOne" relation, so it requires the target relation %v to be a polymorphic "belongsTo", but %v type given.',
|
|
4245
3865
|
relationName,
|
|
4246
3866
|
sourceName,
|
|
@@ -4248,7 +3868,7 @@ var init_has_one_resolver = __esm({
|
|
|
4248
3868
|
targetRelationDef.type
|
|
4249
3869
|
);
|
|
4250
3870
|
if (!targetRelationDef.polymorphic)
|
|
4251
|
-
throw new
|
|
3871
|
+
throw new InvalidArgumentError(
|
|
4252
3872
|
'The relation %v of the model %v is a polymorphic "hasOne" relation, so it requires the target relation %v to be a polymorphic too.',
|
|
4253
3873
|
relationName,
|
|
4254
3874
|
sourceName,
|
|
@@ -4273,17 +3893,17 @@ var init_has_one_resolver = __esm({
|
|
|
4273
3893
|
});
|
|
4274
3894
|
|
|
4275
3895
|
// src/relations/has-many-resolver.js
|
|
4276
|
-
var _HasManyResolver, HasManyResolver;
|
|
3896
|
+
var import_js_service21, _HasManyResolver, HasManyResolver;
|
|
4277
3897
|
var init_has_many_resolver = __esm({
|
|
4278
3898
|
"src/relations/has-many-resolver.js"() {
|
|
4279
3899
|
"use strict";
|
|
4280
|
-
|
|
4281
|
-
|
|
3900
|
+
import_js_service21 = require("@e22m4u/js-service");
|
|
3901
|
+
init_utils();
|
|
4282
3902
|
init_definition();
|
|
4283
|
-
|
|
3903
|
+
init_errors();
|
|
4284
3904
|
init_repository2();
|
|
4285
3905
|
init_definition();
|
|
4286
|
-
_HasManyResolver = class _HasManyResolver extends Service {
|
|
3906
|
+
_HasManyResolver = class _HasManyResolver extends import_js_service21.Service {
|
|
4287
3907
|
/**
|
|
4288
3908
|
* Include to.
|
|
4289
3909
|
*
|
|
@@ -4297,32 +3917,32 @@ var init_has_many_resolver = __esm({
|
|
|
4297
3917
|
*/
|
|
4298
3918
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
|
|
4299
3919
|
if (!entities || !Array.isArray(entities))
|
|
4300
|
-
throw new
|
|
3920
|
+
throw new InvalidArgumentError(
|
|
4301
3921
|
'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4302
3922
|
entities
|
|
4303
3923
|
);
|
|
4304
3924
|
if (!sourceName || typeof sourceName !== "string")
|
|
4305
|
-
throw new
|
|
3925
|
+
throw new InvalidArgumentError(
|
|
4306
3926
|
'The parameter "sourceName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4307
3927
|
sourceName
|
|
4308
3928
|
);
|
|
4309
3929
|
if (!targetName || typeof targetName !== "string")
|
|
4310
|
-
throw new
|
|
3930
|
+
throw new InvalidArgumentError(
|
|
4311
3931
|
'The parameter "targetName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4312
3932
|
targetName
|
|
4313
3933
|
);
|
|
4314
3934
|
if (!relationName || typeof relationName !== "string")
|
|
4315
|
-
throw new
|
|
3935
|
+
throw new InvalidArgumentError(
|
|
4316
3936
|
'The parameter "relationName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4317
3937
|
relationName
|
|
4318
3938
|
);
|
|
4319
3939
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4320
|
-
throw new
|
|
3940
|
+
throw new InvalidArgumentError(
|
|
4321
3941
|
'The parameter "foreignKey" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4322
3942
|
foreignKey
|
|
4323
3943
|
);
|
|
4324
3944
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4325
|
-
throw new
|
|
3945
|
+
throw new InvalidArgumentError(
|
|
4326
3946
|
'The provided parameter "scope" of HasManyResolver.includeTo should be an Object, but %v given.',
|
|
4327
3947
|
scope
|
|
4328
3948
|
);
|
|
@@ -4332,7 +3952,7 @@ var init_has_many_resolver = __esm({
|
|
|
4332
3952
|
const sourceIds = [];
|
|
4333
3953
|
entities.forEach((entity) => {
|
|
4334
3954
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4335
|
-
throw new
|
|
3955
|
+
throw new InvalidArgumentError(
|
|
4336
3956
|
'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4337
3957
|
entity
|
|
4338
3958
|
);
|
|
@@ -4381,37 +4001,37 @@ var init_has_many_resolver = __esm({
|
|
|
4381
4001
|
*/
|
|
4382
4002
|
async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
|
|
4383
4003
|
if (!entities || !Array.isArray(entities))
|
|
4384
|
-
throw new
|
|
4004
|
+
throw new InvalidArgumentError(
|
|
4385
4005
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4386
4006
|
entities
|
|
4387
4007
|
);
|
|
4388
4008
|
if (!sourceName || typeof sourceName !== "string")
|
|
4389
|
-
throw new
|
|
4009
|
+
throw new InvalidArgumentError(
|
|
4390
4010
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4391
4011
|
sourceName
|
|
4392
4012
|
);
|
|
4393
4013
|
if (!targetName || typeof targetName !== "string")
|
|
4394
|
-
throw new
|
|
4014
|
+
throw new InvalidArgumentError(
|
|
4395
4015
|
'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4396
4016
|
targetName
|
|
4397
4017
|
);
|
|
4398
4018
|
if (!relationName || typeof relationName !== "string")
|
|
4399
|
-
throw new
|
|
4019
|
+
throw new InvalidArgumentError(
|
|
4400
4020
|
'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4401
4021
|
relationName
|
|
4402
4022
|
);
|
|
4403
4023
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4404
|
-
throw new
|
|
4024
|
+
throw new InvalidArgumentError(
|
|
4405
4025
|
'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4406
4026
|
foreignKey
|
|
4407
4027
|
);
|
|
4408
4028
|
if (!discriminator || typeof discriminator !== "string")
|
|
4409
|
-
throw new
|
|
4029
|
+
throw new InvalidArgumentError(
|
|
4410
4030
|
'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4411
4031
|
discriminator
|
|
4412
4032
|
);
|
|
4413
4033
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4414
|
-
throw new
|
|
4034
|
+
throw new InvalidArgumentError(
|
|
4415
4035
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicTo should be an Object, but %v given.',
|
|
4416
4036
|
scope
|
|
4417
4037
|
);
|
|
@@ -4421,7 +4041,7 @@ var init_has_many_resolver = __esm({
|
|
|
4421
4041
|
const sourceIds = [];
|
|
4422
4042
|
entities.forEach((entity) => {
|
|
4423
4043
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4424
|
-
throw new
|
|
4044
|
+
throw new InvalidArgumentError(
|
|
4425
4045
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4426
4046
|
entity
|
|
4427
4047
|
);
|
|
@@ -4472,32 +4092,32 @@ var init_has_many_resolver = __esm({
|
|
|
4472
4092
|
*/
|
|
4473
4093
|
async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
|
|
4474
4094
|
if (!entities || !Array.isArray(entities))
|
|
4475
|
-
throw new
|
|
4095
|
+
throw new InvalidArgumentError(
|
|
4476
4096
|
'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires an Array of Object, but %v given.',
|
|
4477
4097
|
entities
|
|
4478
4098
|
);
|
|
4479
4099
|
if (!sourceName || typeof sourceName !== "string")
|
|
4480
|
-
throw new
|
|
4100
|
+
throw new InvalidArgumentError(
|
|
4481
4101
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4482
4102
|
sourceName
|
|
4483
4103
|
);
|
|
4484
4104
|
if (!targetName || typeof targetName !== "string")
|
|
4485
|
-
throw new
|
|
4105
|
+
throw new InvalidArgumentError(
|
|
4486
4106
|
'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4487
4107
|
targetName
|
|
4488
4108
|
);
|
|
4489
4109
|
if (!relationName || typeof relationName !== "string")
|
|
4490
|
-
throw new
|
|
4110
|
+
throw new InvalidArgumentError(
|
|
4491
4111
|
'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4492
4112
|
relationName
|
|
4493
4113
|
);
|
|
4494
4114
|
if (!targetRelationName || typeof targetRelationName !== "string")
|
|
4495
|
-
throw new
|
|
4115
|
+
throw new InvalidArgumentError(
|
|
4496
4116
|
'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4497
4117
|
targetRelationName
|
|
4498
4118
|
);
|
|
4499
4119
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4500
|
-
throw new
|
|
4120
|
+
throw new InvalidArgumentError(
|
|
4501
4121
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName should be an Object, but %v given.',
|
|
4502
4122
|
scope
|
|
4503
4123
|
);
|
|
@@ -4505,7 +4125,7 @@ var init_has_many_resolver = __esm({
|
|
|
4505
4125
|
ModelDefinitionUtils
|
|
4506
4126
|
).getRelationDefinitionByName(targetName, targetRelationName);
|
|
4507
4127
|
if (targetRelationDef.type !== RelationType.BELONGS_TO)
|
|
4508
|
-
throw new
|
|
4128
|
+
throw new InvalidArgumentError(
|
|
4509
4129
|
'The relation %v of the model %v is a polymorphic "hasMany" relation, so it requires the target relation %v to be a polymorphic "belongsTo", but %v type given.',
|
|
4510
4130
|
relationName,
|
|
4511
4131
|
sourceName,
|
|
@@ -4513,7 +4133,7 @@ var init_has_many_resolver = __esm({
|
|
|
4513
4133
|
targetRelationDef.type
|
|
4514
4134
|
);
|
|
4515
4135
|
if (!targetRelationDef.polymorphic)
|
|
4516
|
-
throw new
|
|
4136
|
+
throw new InvalidArgumentError(
|
|
4517
4137
|
'The relation %v of the model %v is a polymorphic "hasMany" relation, so it requires the target relation %v to be a polymorphic too.',
|
|
4518
4138
|
relationName,
|
|
4519
4139
|
sourceName,
|
|
@@ -4538,17 +4158,17 @@ var init_has_many_resolver = __esm({
|
|
|
4538
4158
|
});
|
|
4539
4159
|
|
|
4540
4160
|
// src/relations/belongs-to-resolver.js
|
|
4541
|
-
var _BelongsToResolver, BelongsToResolver;
|
|
4161
|
+
var import_js_service22, _BelongsToResolver, BelongsToResolver;
|
|
4542
4162
|
var init_belongs_to_resolver = __esm({
|
|
4543
4163
|
"src/relations/belongs-to-resolver.js"() {
|
|
4544
4164
|
"use strict";
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4165
|
+
import_js_service22 = require("@e22m4u/js-service");
|
|
4166
|
+
init_utils();
|
|
4167
|
+
init_utils();
|
|
4168
|
+
init_errors();
|
|
4549
4169
|
init_repository2();
|
|
4550
4170
|
init_definition();
|
|
4551
|
-
_BelongsToResolver = class _BelongsToResolver extends Service {
|
|
4171
|
+
_BelongsToResolver = class _BelongsToResolver extends import_js_service22.Service {
|
|
4552
4172
|
/**
|
|
4553
4173
|
* Include to.
|
|
4554
4174
|
*
|
|
@@ -4562,39 +4182,39 @@ var init_belongs_to_resolver = __esm({
|
|
|
4562
4182
|
*/
|
|
4563
4183
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
|
|
4564
4184
|
if (!entities || !Array.isArray(entities))
|
|
4565
|
-
throw new
|
|
4185
|
+
throw new InvalidArgumentError(
|
|
4566
4186
|
'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v given.',
|
|
4567
4187
|
entities
|
|
4568
4188
|
);
|
|
4569
4189
|
if (!sourceName || typeof sourceName !== "string")
|
|
4570
|
-
throw new
|
|
4190
|
+
throw new InvalidArgumentError(
|
|
4571
4191
|
'The parameter "sourceName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
|
|
4572
4192
|
sourceName
|
|
4573
4193
|
);
|
|
4574
4194
|
if (!targetName || typeof targetName !== "string")
|
|
4575
|
-
throw new
|
|
4195
|
+
throw new InvalidArgumentError(
|
|
4576
4196
|
'The parameter "targetName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
|
|
4577
4197
|
targetName
|
|
4578
4198
|
);
|
|
4579
4199
|
if (!relationName || typeof relationName !== "string")
|
|
4580
|
-
throw new
|
|
4200
|
+
throw new InvalidArgumentError(
|
|
4581
4201
|
'The parameter "relationName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
|
|
4582
4202
|
relationName
|
|
4583
4203
|
);
|
|
4584
4204
|
if (foreignKey && typeof foreignKey !== "string")
|
|
4585
|
-
throw new
|
|
4205
|
+
throw new InvalidArgumentError(
|
|
4586
4206
|
'The provided parameter "foreignKey" of BelongsToResolver.includeTo should be a String, but %v given.',
|
|
4587
4207
|
foreignKey
|
|
4588
4208
|
);
|
|
4589
4209
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4590
|
-
throw new
|
|
4210
|
+
throw new InvalidArgumentError(
|
|
4591
4211
|
'The provided parameter "scope" of BelongsToResolver.includeTo should be an Object, but %v given.',
|
|
4592
4212
|
scope
|
|
4593
4213
|
);
|
|
4594
4214
|
if (foreignKey == null) foreignKey = `${relationName}Id`;
|
|
4595
4215
|
const targetIds = entities.reduce((acc, entity) => {
|
|
4596
4216
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4597
|
-
throw new
|
|
4217
|
+
throw new InvalidArgumentError(
|
|
4598
4218
|
'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v given.',
|
|
4599
4219
|
entity
|
|
4600
4220
|
);
|
|
@@ -4634,32 +4254,32 @@ var init_belongs_to_resolver = __esm({
|
|
|
4634
4254
|
*/
|
|
4635
4255
|
async includePolymorphicTo(entities, sourceName, relationName, foreignKey = void 0, discriminator = void 0, scope = void 0) {
|
|
4636
4256
|
if (!entities || !Array.isArray(entities))
|
|
4637
|
-
throw new
|
|
4257
|
+
throw new InvalidArgumentError(
|
|
4638
4258
|
'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4639
4259
|
entities
|
|
4640
4260
|
);
|
|
4641
4261
|
if (!sourceName || typeof sourceName !== "string")
|
|
4642
|
-
throw new
|
|
4262
|
+
throw new InvalidArgumentError(
|
|
4643
4263
|
'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4644
4264
|
sourceName
|
|
4645
4265
|
);
|
|
4646
4266
|
if (!relationName || typeof relationName !== "string")
|
|
4647
|
-
throw new
|
|
4267
|
+
throw new InvalidArgumentError(
|
|
4648
4268
|
'The parameter "relationName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4649
4269
|
relationName
|
|
4650
4270
|
);
|
|
4651
4271
|
if (foreignKey && typeof foreignKey !== "string")
|
|
4652
|
-
throw new
|
|
4272
|
+
throw new InvalidArgumentError(
|
|
4653
4273
|
'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo should be a String, but %v given.',
|
|
4654
4274
|
foreignKey
|
|
4655
4275
|
);
|
|
4656
4276
|
if (discriminator && typeof discriminator !== "string")
|
|
4657
|
-
throw new
|
|
4277
|
+
throw new InvalidArgumentError(
|
|
4658
4278
|
'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo should be a String, but %v given.',
|
|
4659
4279
|
discriminator
|
|
4660
4280
|
);
|
|
4661
4281
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4662
|
-
throw new
|
|
4282
|
+
throw new InvalidArgumentError(
|
|
4663
4283
|
'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo should be an Object, but %v given.',
|
|
4664
4284
|
scope
|
|
4665
4285
|
);
|
|
@@ -4674,7 +4294,7 @@ var init_belongs_to_resolver = __esm({
|
|
|
4674
4294
|
const targetIdsByTargetName = {};
|
|
4675
4295
|
entities.forEach((entity) => {
|
|
4676
4296
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4677
|
-
throw new
|
|
4297
|
+
throw new InvalidArgumentError(
|
|
4678
4298
|
'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4679
4299
|
entity
|
|
4680
4300
|
);
|
|
@@ -4695,7 +4315,7 @@ var init_belongs_to_resolver = __esm({
|
|
|
4695
4315
|
try {
|
|
4696
4316
|
targetRepository = this.getService(RepositoryRegistry).getRepository(targetName);
|
|
4697
4317
|
} catch (error) {
|
|
4698
|
-
if (error instanceof
|
|
4318
|
+
if (error instanceof InvalidArgumentError) {
|
|
4699
4319
|
if (error.message === `The model "${targetName}" is not defined.` || error.message === `The model "${targetName}" does not have a specified datasource.`) {
|
|
4700
4320
|
return;
|
|
4701
4321
|
}
|
|
@@ -4746,17 +4366,17 @@ var init_belongs_to_resolver = __esm({
|
|
|
4746
4366
|
});
|
|
4747
4367
|
|
|
4748
4368
|
// src/relations/references-many-resolver.js
|
|
4749
|
-
var _ReferencesManyResolver, ReferencesManyResolver;
|
|
4369
|
+
var import_js_service23, _ReferencesManyResolver, ReferencesManyResolver;
|
|
4750
4370
|
var init_references_many_resolver = __esm({
|
|
4751
4371
|
"src/relations/references-many-resolver.js"() {
|
|
4752
4372
|
"use strict";
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4373
|
+
import_js_service23 = require("@e22m4u/js-service");
|
|
4374
|
+
init_utils();
|
|
4375
|
+
init_utils();
|
|
4376
|
+
init_errors();
|
|
4757
4377
|
init_repository2();
|
|
4758
4378
|
init_definition();
|
|
4759
|
-
_ReferencesManyResolver = class _ReferencesManyResolver extends Service {
|
|
4379
|
+
_ReferencesManyResolver = class _ReferencesManyResolver extends import_js_service23.Service {
|
|
4760
4380
|
/**
|
|
4761
4381
|
* Include to.
|
|
4762
4382
|
*
|
|
@@ -4770,32 +4390,32 @@ var init_references_many_resolver = __esm({
|
|
|
4770
4390
|
*/
|
|
4771
4391
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
|
|
4772
4392
|
if (!entities || !Array.isArray(entities))
|
|
4773
|
-
throw new
|
|
4393
|
+
throw new InvalidArgumentError(
|
|
4774
4394
|
'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4775
4395
|
entities
|
|
4776
4396
|
);
|
|
4777
4397
|
if (!sourceName || typeof sourceName !== "string")
|
|
4778
|
-
throw new
|
|
4398
|
+
throw new InvalidArgumentError(
|
|
4779
4399
|
'The parameter "sourceName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4780
4400
|
sourceName
|
|
4781
4401
|
);
|
|
4782
4402
|
if (!targetName || typeof targetName !== "string")
|
|
4783
|
-
throw new
|
|
4403
|
+
throw new InvalidArgumentError(
|
|
4784
4404
|
'The parameter "targetName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4785
4405
|
targetName
|
|
4786
4406
|
);
|
|
4787
4407
|
if (!relationName || typeof relationName !== "string")
|
|
4788
|
-
throw new
|
|
4408
|
+
throw new InvalidArgumentError(
|
|
4789
4409
|
'The parameter "relationName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4790
4410
|
relationName
|
|
4791
4411
|
);
|
|
4792
4412
|
if (foreignKey && typeof foreignKey !== "string")
|
|
4793
|
-
throw new
|
|
4413
|
+
throw new InvalidArgumentError(
|
|
4794
4414
|
'The provided parameter "foreignKey" of ReferencesManyResolver.includeTo should be a String, but %v given.',
|
|
4795
4415
|
foreignKey
|
|
4796
4416
|
);
|
|
4797
4417
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4798
|
-
throw new
|
|
4418
|
+
throw new InvalidArgumentError(
|
|
4799
4419
|
'The provided parameter "scope" of ReferencesManyResolver.includeTo should be an Object, but %v given.',
|
|
4800
4420
|
scope
|
|
4801
4421
|
);
|
|
@@ -4805,7 +4425,7 @@ var init_references_many_resolver = __esm({
|
|
|
4805
4425
|
}
|
|
4806
4426
|
const targetIds = entities.reduce((acc, entity) => {
|
|
4807
4427
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4808
|
-
throw new
|
|
4428
|
+
throw new InvalidArgumentError(
|
|
4809
4429
|
'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4810
4430
|
entity
|
|
4811
4431
|
);
|
|
@@ -4858,23 +4478,23 @@ var init_relations2 = __esm({
|
|
|
4858
4478
|
});
|
|
4859
4479
|
|
|
4860
4480
|
// src/filter/include-clause-tool.js
|
|
4861
|
-
var _IncludeClauseTool, IncludeClauseTool;
|
|
4481
|
+
var import_js_service24, _IncludeClauseTool, IncludeClauseTool;
|
|
4862
4482
|
var init_include_clause_tool = __esm({
|
|
4863
4483
|
"src/filter/include-clause-tool.js"() {
|
|
4864
4484
|
"use strict";
|
|
4865
|
-
|
|
4485
|
+
import_js_service24 = require("@e22m4u/js-service");
|
|
4866
4486
|
init_definition();
|
|
4867
4487
|
init_relations2();
|
|
4868
4488
|
init_relations2();
|
|
4869
4489
|
init_where_clause_tool();
|
|
4870
4490
|
init_order_clause_tool();
|
|
4871
4491
|
init_slice_clause_tool();
|
|
4872
|
-
|
|
4492
|
+
init_errors();
|
|
4873
4493
|
init_relations2();
|
|
4874
4494
|
init_fields_clause_tool();
|
|
4875
4495
|
init_definition();
|
|
4876
4496
|
init_relations2();
|
|
4877
|
-
_IncludeClauseTool = class _IncludeClauseTool extends Service {
|
|
4497
|
+
_IncludeClauseTool = class _IncludeClauseTool extends import_js_service24.Service {
|
|
4878
4498
|
/**
|
|
4879
4499
|
* Include to.
|
|
4880
4500
|
*
|
|
@@ -5006,7 +4626,7 @@ var init_include_clause_tool = __esm({
|
|
|
5006
4626
|
);
|
|
5007
4627
|
break;
|
|
5008
4628
|
default:
|
|
5009
|
-
throw new
|
|
4629
|
+
throw new InvalidArgumentError(
|
|
5010
4630
|
"The relation type %v does not have an inclusion resolver.",
|
|
5011
4631
|
relDef.type
|
|
5012
4632
|
);
|
|
@@ -5039,14 +4659,14 @@ var init_include_clause_tool = __esm({
|
|
|
5039
4659
|
(name, i) => relNames.indexOf(name) !== i
|
|
5040
4660
|
);
|
|
5041
4661
|
if (duplicateNames.length)
|
|
5042
|
-
throw new
|
|
4662
|
+
throw new InvalidArgumentError(
|
|
5043
4663
|
'The provided option "include" has duplicates of %v.',
|
|
5044
4664
|
duplicateNames[0]
|
|
5045
4665
|
);
|
|
5046
4666
|
} else if (typeof clause === "object") {
|
|
5047
4667
|
if ("relation" in clause) {
|
|
5048
4668
|
if (!clause.relation || typeof clause.relation !== "string")
|
|
5049
|
-
throw new
|
|
4669
|
+
throw new InvalidArgumentError(
|
|
5050
4670
|
'The provided option "relation" should be a non-empty String, but %v given.',
|
|
5051
4671
|
clause.relation
|
|
5052
4672
|
);
|
|
@@ -5059,7 +4679,7 @@ var init_include_clause_tool = __esm({
|
|
|
5059
4679
|
});
|
|
5060
4680
|
}
|
|
5061
4681
|
} else {
|
|
5062
|
-
throw new
|
|
4682
|
+
throw new InvalidArgumentError(
|
|
5063
4683
|
'The provided option "include" should have a non-empty String, an Object or an Array, but %v given.',
|
|
5064
4684
|
clause
|
|
5065
4685
|
);
|
|
@@ -5073,7 +4693,7 @@ var init_include_clause_tool = __esm({
|
|
|
5073
4693
|
static validateScopeClause(clause) {
|
|
5074
4694
|
if (clause == null) return;
|
|
5075
4695
|
if (typeof clause !== "object" || Array.isArray(clause))
|
|
5076
|
-
throw new
|
|
4696
|
+
throw new InvalidArgumentError(
|
|
5077
4697
|
'The provided option "scope" should be an Object, but %v given.',
|
|
5078
4698
|
clause
|
|
5079
4699
|
);
|
|
@@ -5118,14 +4738,14 @@ var init_include_clause_tool = __esm({
|
|
|
5118
4738
|
(name, i) => relNames.indexOf(name) !== i
|
|
5119
4739
|
);
|
|
5120
4740
|
if (duplicateNames.length)
|
|
5121
|
-
throw new
|
|
4741
|
+
throw new InvalidArgumentError(
|
|
5122
4742
|
'The provided option "include" has duplicates of %v.',
|
|
5123
4743
|
duplicateNames[0]
|
|
5124
4744
|
);
|
|
5125
4745
|
} else if (typeof clause === "object") {
|
|
5126
4746
|
if ("relation" in clause) {
|
|
5127
4747
|
if (!clause.relation || typeof clause.relation !== "string")
|
|
5128
|
-
throw new
|
|
4748
|
+
throw new InvalidArgumentError(
|
|
5129
4749
|
'The provided option "relation" should be a non-empty String, but %v given.',
|
|
5130
4750
|
clause.relation
|
|
5131
4751
|
);
|
|
@@ -5144,7 +4764,7 @@ var init_include_clause_tool = __esm({
|
|
|
5144
4764
|
});
|
|
5145
4765
|
}
|
|
5146
4766
|
} else {
|
|
5147
|
-
throw new
|
|
4767
|
+
throw new InvalidArgumentError(
|
|
5148
4768
|
'The provided option "include" should have a non-empty String, an Object or an Array, but %v given.',
|
|
5149
4769
|
clause
|
|
5150
4770
|
);
|
|
@@ -5160,7 +4780,7 @@ var init_include_clause_tool = __esm({
|
|
|
5160
4780
|
static normalizeScopeClause(clause) {
|
|
5161
4781
|
if (clause == null) return;
|
|
5162
4782
|
if (typeof clause !== "object" || Array.isArray(clause))
|
|
5163
|
-
throw new
|
|
4783
|
+
throw new InvalidArgumentError(
|
|
5164
4784
|
'The provided option "scope" should be an Object, but %v given.',
|
|
5165
4785
|
clause
|
|
5166
4786
|
);
|
|
@@ -5211,15 +4831,15 @@ var init_filter = __esm({
|
|
|
5211
4831
|
});
|
|
5212
4832
|
|
|
5213
4833
|
// src/adapter/decorator/inclusion-decorator.js
|
|
5214
|
-
var _InclusionDecorator, InclusionDecorator;
|
|
4834
|
+
var import_js_service25, _InclusionDecorator, InclusionDecorator;
|
|
5215
4835
|
var init_inclusion_decorator = __esm({
|
|
5216
4836
|
"src/adapter/decorator/inclusion-decorator.js"() {
|
|
5217
4837
|
"use strict";
|
|
5218
4838
|
init_adapter();
|
|
5219
|
-
|
|
4839
|
+
import_js_service25 = require("@e22m4u/js-service");
|
|
5220
4840
|
init_filter();
|
|
5221
|
-
|
|
5222
|
-
_InclusionDecorator = class _InclusionDecorator extends Service {
|
|
4841
|
+
init_errors();
|
|
4842
|
+
_InclusionDecorator = class _InclusionDecorator extends import_js_service25.Service {
|
|
5223
4843
|
/**
|
|
5224
4844
|
* Decorate.
|
|
5225
4845
|
*
|
|
@@ -5227,7 +4847,7 @@ var init_inclusion_decorator = __esm({
|
|
|
5227
4847
|
*/
|
|
5228
4848
|
decorate(adapter) {
|
|
5229
4849
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5230
|
-
throw new
|
|
4850
|
+
throw new InvalidArgumentError(
|
|
5231
4851
|
"The first argument of InclusionDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5232
4852
|
adapter
|
|
5233
4853
|
);
|
|
@@ -5300,15 +4920,15 @@ var init_inclusion_decorator = __esm({
|
|
|
5300
4920
|
});
|
|
5301
4921
|
|
|
5302
4922
|
// src/adapter/decorator/default-values-decorator.js
|
|
5303
|
-
var _DefaultValuesDecorator, DefaultValuesDecorator;
|
|
4923
|
+
var import_js_service26, _DefaultValuesDecorator, DefaultValuesDecorator;
|
|
5304
4924
|
var init_default_values_decorator = __esm({
|
|
5305
4925
|
"src/adapter/decorator/default-values-decorator.js"() {
|
|
5306
4926
|
"use strict";
|
|
5307
4927
|
init_adapter();
|
|
5308
|
-
|
|
5309
|
-
|
|
4928
|
+
import_js_service26 = require("@e22m4u/js-service");
|
|
4929
|
+
init_errors();
|
|
5310
4930
|
init_definition();
|
|
5311
|
-
_DefaultValuesDecorator = class _DefaultValuesDecorator extends Service {
|
|
4931
|
+
_DefaultValuesDecorator = class _DefaultValuesDecorator extends import_js_service26.Service {
|
|
5312
4932
|
/**
|
|
5313
4933
|
* Decorate.
|
|
5314
4934
|
*
|
|
@@ -5316,7 +4936,7 @@ var init_default_values_decorator = __esm({
|
|
|
5316
4936
|
*/
|
|
5317
4937
|
decorate(adapter) {
|
|
5318
4938
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5319
|
-
throw new
|
|
4939
|
+
throw new InvalidArgumentError(
|
|
5320
4940
|
"The first argument of DefaultValuesDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5321
4941
|
adapter
|
|
5322
4942
|
);
|
|
@@ -5365,15 +4985,15 @@ var init_default_values_decorator = __esm({
|
|
|
5365
4985
|
});
|
|
5366
4986
|
|
|
5367
4987
|
// src/adapter/decorator/data-sanitizing-decorator.js
|
|
5368
|
-
var _DataSanitizingDecorator, DataSanitizingDecorator;
|
|
4988
|
+
var import_js_service27, _DataSanitizingDecorator, DataSanitizingDecorator;
|
|
5369
4989
|
var init_data_sanitizing_decorator = __esm({
|
|
5370
4990
|
"src/adapter/decorator/data-sanitizing-decorator.js"() {
|
|
5371
4991
|
"use strict";
|
|
5372
4992
|
init_adapter();
|
|
5373
|
-
|
|
5374
|
-
|
|
4993
|
+
import_js_service27 = require("@e22m4u/js-service");
|
|
4994
|
+
init_errors();
|
|
5375
4995
|
init_definition();
|
|
5376
|
-
_DataSanitizingDecorator = class _DataSanitizingDecorator extends Service {
|
|
4996
|
+
_DataSanitizingDecorator = class _DataSanitizingDecorator extends import_js_service27.Service {
|
|
5377
4997
|
/**
|
|
5378
4998
|
* Decorate.
|
|
5379
4999
|
*
|
|
@@ -5381,7 +5001,7 @@ var init_data_sanitizing_decorator = __esm({
|
|
|
5381
5001
|
*/
|
|
5382
5002
|
decorate(adapter) {
|
|
5383
5003
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5384
|
-
throw new
|
|
5004
|
+
throw new InvalidArgumentError(
|
|
5385
5005
|
"The first argument of DataSanitizingDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5386
5006
|
adapter
|
|
5387
5007
|
);
|
|
@@ -5420,15 +5040,15 @@ var init_data_sanitizing_decorator = __esm({
|
|
|
5420
5040
|
});
|
|
5421
5041
|
|
|
5422
5042
|
// src/adapter/decorator/data-validation-decorator.js
|
|
5423
|
-
var _DataValidationDecorator, DataValidationDecorator;
|
|
5043
|
+
var import_js_service28, _DataValidationDecorator, DataValidationDecorator;
|
|
5424
5044
|
var init_data_validation_decorator = __esm({
|
|
5425
5045
|
"src/adapter/decorator/data-validation-decorator.js"() {
|
|
5426
5046
|
"use strict";
|
|
5427
5047
|
init_adapter();
|
|
5428
|
-
|
|
5429
|
-
|
|
5048
|
+
import_js_service28 = require("@e22m4u/js-service");
|
|
5049
|
+
init_errors();
|
|
5430
5050
|
init_definition();
|
|
5431
|
-
_DataValidationDecorator = class _DataValidationDecorator extends Service {
|
|
5051
|
+
_DataValidationDecorator = class _DataValidationDecorator extends import_js_service28.Service {
|
|
5432
5052
|
/**
|
|
5433
5053
|
* Decorate.
|
|
5434
5054
|
*
|
|
@@ -5436,7 +5056,7 @@ var init_data_validation_decorator = __esm({
|
|
|
5436
5056
|
*/
|
|
5437
5057
|
decorate(adapter) {
|
|
5438
5058
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5439
|
-
throw new
|
|
5059
|
+
throw new InvalidArgumentError(
|
|
5440
5060
|
"The first argument of DataValidationDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5441
5061
|
adapter
|
|
5442
5062
|
);
|
|
@@ -5474,15 +5094,15 @@ var init_data_validation_decorator = __esm({
|
|
|
5474
5094
|
});
|
|
5475
5095
|
|
|
5476
5096
|
// src/adapter/decorator/fields-filtering-decorator.js
|
|
5477
|
-
var _FieldsFilteringDecorator, FieldsFilteringDecorator;
|
|
5097
|
+
var import_js_service29, _FieldsFilteringDecorator, FieldsFilteringDecorator;
|
|
5478
5098
|
var init_fields_filtering_decorator = __esm({
|
|
5479
5099
|
"src/adapter/decorator/fields-filtering-decorator.js"() {
|
|
5480
5100
|
"use strict";
|
|
5481
5101
|
init_adapter();
|
|
5482
|
-
|
|
5102
|
+
import_js_service29 = require("@e22m4u/js-service");
|
|
5483
5103
|
init_filter();
|
|
5484
|
-
|
|
5485
|
-
_FieldsFilteringDecorator = class _FieldsFilteringDecorator extends Service {
|
|
5104
|
+
init_errors();
|
|
5105
|
+
_FieldsFilteringDecorator = class _FieldsFilteringDecorator extends import_js_service29.Service {
|
|
5486
5106
|
/**
|
|
5487
5107
|
* Decorate.
|
|
5488
5108
|
*
|
|
@@ -5490,7 +5110,7 @@ var init_fields_filtering_decorator = __esm({
|
|
|
5490
5110
|
*/
|
|
5491
5111
|
decorate(adapter) {
|
|
5492
5112
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5493
|
-
throw new
|
|
5113
|
+
throw new InvalidArgumentError(
|
|
5494
5114
|
"The first argument of FieldsFilteringDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5495
5115
|
adapter
|
|
5496
5116
|
);
|
|
@@ -5557,15 +5177,15 @@ var init_fields_filtering_decorator = __esm({
|
|
|
5557
5177
|
});
|
|
5558
5178
|
|
|
5559
5179
|
// src/adapter/decorator/data-transformation-decorator.js
|
|
5560
|
-
var _DataTransformationDecorator, DataTransformationDecorator;
|
|
5180
|
+
var import_js_service30, _DataTransformationDecorator, DataTransformationDecorator;
|
|
5561
5181
|
var init_data_transformation_decorator = __esm({
|
|
5562
5182
|
"src/adapter/decorator/data-transformation-decorator.js"() {
|
|
5563
5183
|
"use strict";
|
|
5564
5184
|
init_adapter();
|
|
5565
|
-
|
|
5566
|
-
|
|
5185
|
+
import_js_service30 = require("@e22m4u/js-service");
|
|
5186
|
+
init_errors();
|
|
5567
5187
|
init_definition();
|
|
5568
|
-
_DataTransformationDecorator = class _DataTransformationDecorator extends Service {
|
|
5188
|
+
_DataTransformationDecorator = class _DataTransformationDecorator extends import_js_service30.Service {
|
|
5569
5189
|
/**
|
|
5570
5190
|
* Decorate.
|
|
5571
5191
|
*
|
|
@@ -5573,7 +5193,7 @@ var init_data_transformation_decorator = __esm({
|
|
|
5573
5193
|
*/
|
|
5574
5194
|
decorate(adapter) {
|
|
5575
5195
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5576
|
-
throw new
|
|
5196
|
+
throw new InvalidArgumentError(
|
|
5577
5197
|
"The first argument of DataTransformerDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5578
5198
|
adapter
|
|
5579
5199
|
);
|
|
@@ -5611,15 +5231,15 @@ var init_data_transformation_decorator = __esm({
|
|
|
5611
5231
|
});
|
|
5612
5232
|
|
|
5613
5233
|
// src/adapter/decorator/property-uniqueness-decorator.js
|
|
5614
|
-
var _PropertyUniquenessDecorator, PropertyUniquenessDecorator;
|
|
5234
|
+
var import_js_service31, _PropertyUniquenessDecorator, PropertyUniquenessDecorator;
|
|
5615
5235
|
var init_property_uniqueness_decorator = __esm({
|
|
5616
5236
|
"src/adapter/decorator/property-uniqueness-decorator.js"() {
|
|
5617
5237
|
"use strict";
|
|
5618
5238
|
init_adapter();
|
|
5619
|
-
|
|
5620
|
-
|
|
5239
|
+
import_js_service31 = require("@e22m4u/js-service");
|
|
5240
|
+
init_errors();
|
|
5621
5241
|
init_definition();
|
|
5622
|
-
_PropertyUniquenessDecorator = class _PropertyUniquenessDecorator extends Service {
|
|
5242
|
+
_PropertyUniquenessDecorator = class _PropertyUniquenessDecorator extends import_js_service31.Service {
|
|
5623
5243
|
/**
|
|
5624
5244
|
* Decorate.
|
|
5625
5245
|
*
|
|
@@ -5627,7 +5247,7 @@ var init_property_uniqueness_decorator = __esm({
|
|
|
5627
5247
|
*/
|
|
5628
5248
|
decorate(adapter) {
|
|
5629
5249
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5630
|
-
throw new
|
|
5250
|
+
throw new InvalidArgumentError(
|
|
5631
5251
|
"The first argument of PropertyUniquenessDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5632
5252
|
adapter
|
|
5633
5253
|
);
|
|
@@ -5701,12 +5321,12 @@ var init_decorator = __esm({
|
|
|
5701
5321
|
});
|
|
5702
5322
|
|
|
5703
5323
|
// src/adapter/adapter.js
|
|
5704
|
-
var _Adapter, Adapter;
|
|
5324
|
+
var import_js_service32, _Adapter, Adapter;
|
|
5705
5325
|
var init_adapter = __esm({
|
|
5706
5326
|
"src/adapter/adapter.js"() {
|
|
5707
5327
|
"use strict";
|
|
5708
|
-
|
|
5709
|
-
|
|
5328
|
+
import_js_service32 = require("@e22m4u/js-service");
|
|
5329
|
+
init_errors();
|
|
5710
5330
|
init_decorator();
|
|
5711
5331
|
init_decorator();
|
|
5712
5332
|
init_decorator();
|
|
@@ -5714,7 +5334,7 @@ var init_adapter = __esm({
|
|
|
5714
5334
|
init_decorator();
|
|
5715
5335
|
init_decorator();
|
|
5716
5336
|
init_decorator();
|
|
5717
|
-
_Adapter = class _Adapter extends Service {
|
|
5337
|
+
_Adapter = class _Adapter extends import_js_service32.Service {
|
|
5718
5338
|
/**
|
|
5719
5339
|
* Settings.
|
|
5720
5340
|
*
|
|
@@ -5921,13 +5541,13 @@ var init_memory_adapter = __esm({
|
|
|
5921
5541
|
"src/adapter/builtin/memory-adapter.js"() {
|
|
5922
5542
|
"use strict";
|
|
5923
5543
|
init_adapter();
|
|
5924
|
-
|
|
5925
|
-
|
|
5544
|
+
init_utils();
|
|
5545
|
+
init_utils();
|
|
5926
5546
|
init_definition();
|
|
5927
5547
|
init_filter();
|
|
5928
5548
|
init_filter();
|
|
5929
5549
|
init_filter();
|
|
5930
|
-
|
|
5550
|
+
init_errors();
|
|
5931
5551
|
init_definition();
|
|
5932
5552
|
_MemoryAdapter = class _MemoryAdapter extends Adapter {
|
|
5933
5553
|
/**
|
|
@@ -5969,7 +5589,7 @@ var init_memory_adapter = __esm({
|
|
|
5969
5589
|
ModelDefinitionUtils
|
|
5970
5590
|
).getDataTypeByPropertyName(modelName, propName);
|
|
5971
5591
|
if (propType !== DataType.ANY && propType !== DataType.NUMBER)
|
|
5972
|
-
throw new
|
|
5592
|
+
throw new InvalidArgumentError(
|
|
5973
5593
|
"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.",
|
|
5974
5594
|
propName,
|
|
5975
5595
|
modelName,
|
|
@@ -6005,7 +5625,7 @@ var init_memory_adapter = __esm({
|
|
|
6005
5625
|
}
|
|
6006
5626
|
const table = this._getTableOrCreate(modelName);
|
|
6007
5627
|
if (table.has(idValue))
|
|
6008
|
-
throw new
|
|
5628
|
+
throw new InvalidArgumentError(
|
|
6009
5629
|
"The value %v of the primary key %v already exists in the model %v.",
|
|
6010
5630
|
idValue,
|
|
6011
5631
|
pkPropName,
|
|
@@ -6038,7 +5658,7 @@ var init_memory_adapter = __esm({
|
|
|
6038
5658
|
modelName
|
|
6039
5659
|
);
|
|
6040
5660
|
if (!isExists)
|
|
6041
|
-
throw new
|
|
5661
|
+
throw new InvalidArgumentError(
|
|
6042
5662
|
"The value %v of the primary key %v does not exist in the model %v.",
|
|
6043
5663
|
id,
|
|
6044
5664
|
pkPropName,
|
|
@@ -6135,7 +5755,7 @@ var init_memory_adapter = __esm({
|
|
|
6135
5755
|
modelName
|
|
6136
5756
|
);
|
|
6137
5757
|
if (existingTableData == null)
|
|
6138
|
-
throw new
|
|
5758
|
+
throw new InvalidArgumentError(
|
|
6139
5759
|
"The value %v of the primary key %v does not exist in the model %v.",
|
|
6140
5760
|
id,
|
|
6141
5761
|
pkPropName,
|
|
@@ -6204,7 +5824,7 @@ var init_memory_adapter = __esm({
|
|
|
6204
5824
|
modelName
|
|
6205
5825
|
);
|
|
6206
5826
|
if (!tableData)
|
|
6207
|
-
throw new
|
|
5827
|
+
throw new InvalidArgumentError(
|
|
6208
5828
|
"The value %v of the primary key %v does not exist in the model %v.",
|
|
6209
5829
|
id,
|
|
6210
5830
|
pkPropName,
|
|
@@ -6308,23 +5928,22 @@ function findAdapterCtorInModule(module2) {
|
|
|
6308
5928
|
let adapterCtor;
|
|
6309
5929
|
if (!module2 || typeof module2 !== "object" || Array.isArray(module2)) return;
|
|
6310
5930
|
for (const ctor of Object.values(module2)) {
|
|
6311
|
-
|
|
6312
|
-
if (typeof ctor === "function" && ctor.kind === Adapter.name) {
|
|
5931
|
+
if (typeof ctor === "function" && ctor.kind === Adapter.kind) {
|
|
6313
5932
|
adapterCtor = ctor;
|
|
6314
5933
|
break;
|
|
6315
5934
|
}
|
|
6316
5935
|
}
|
|
6317
5936
|
return adapterCtor;
|
|
6318
5937
|
}
|
|
6319
|
-
var _AdapterLoader, AdapterLoader;
|
|
5938
|
+
var import_js_service33, _AdapterLoader, AdapterLoader;
|
|
6320
5939
|
var init_adapter_loader = __esm({
|
|
6321
5940
|
"src/adapter/adapter-loader.js"() {
|
|
6322
5941
|
"use strict";
|
|
6323
5942
|
init_adapter();
|
|
6324
|
-
|
|
6325
|
-
|
|
5943
|
+
import_js_service33 = require("@e22m4u/js-service");
|
|
5944
|
+
init_errors();
|
|
6326
5945
|
init_();
|
|
6327
|
-
_AdapterLoader = class _AdapterLoader extends Service {
|
|
5946
|
+
_AdapterLoader = class _AdapterLoader extends import_js_service33.Service {
|
|
6328
5947
|
/**
|
|
6329
5948
|
* Load by name.
|
|
6330
5949
|
*
|
|
@@ -6334,7 +5953,7 @@ var init_adapter_loader = __esm({
|
|
|
6334
5953
|
*/
|
|
6335
5954
|
async loadByName(adapterName, settings = void 0) {
|
|
6336
5955
|
if (!adapterName || typeof adapterName !== "string")
|
|
6337
|
-
throw new
|
|
5956
|
+
throw new InvalidArgumentError(
|
|
6338
5957
|
"The adapter name should be a non-empty String, but %v given.",
|
|
6339
5958
|
adapterName
|
|
6340
5959
|
);
|
|
@@ -6351,7 +5970,7 @@ var init_adapter_loader = __esm({
|
|
|
6351
5970
|
} catch (e) {
|
|
6352
5971
|
}
|
|
6353
5972
|
if (!adapterCtor)
|
|
6354
|
-
throw new
|
|
5973
|
+
throw new InvalidArgumentError(
|
|
6355
5974
|
"The adapter %v is not found.",
|
|
6356
5975
|
adapterName
|
|
6357
5976
|
);
|
|
@@ -6365,15 +5984,15 @@ var init_adapter_loader = __esm({
|
|
|
6365
5984
|
});
|
|
6366
5985
|
|
|
6367
5986
|
// src/adapter/adapter-registry.js
|
|
6368
|
-
var _AdapterRegistry, AdapterRegistry;
|
|
5987
|
+
var import_js_service34, _AdapterRegistry, AdapterRegistry;
|
|
6369
5988
|
var init_adapter_registry = __esm({
|
|
6370
5989
|
"src/adapter/adapter-registry.js"() {
|
|
6371
5990
|
"use strict";
|
|
6372
5991
|
init_adapter();
|
|
6373
|
-
|
|
5992
|
+
import_js_service34 = require("@e22m4u/js-service");
|
|
6374
5993
|
init_adapter_loader();
|
|
6375
5994
|
init_definition();
|
|
6376
|
-
_AdapterRegistry = class _AdapterRegistry extends Service {
|
|
5995
|
+
_AdapterRegistry = class _AdapterRegistry extends import_js_service34.Service {
|
|
6377
5996
|
/**
|
|
6378
5997
|
* Adapters.
|
|
6379
5998
|
*
|
|
@@ -6415,16 +6034,16 @@ var init_adapter2 = __esm({
|
|
|
6415
6034
|
});
|
|
6416
6035
|
|
|
6417
6036
|
// src/repository/repository.js
|
|
6418
|
-
var _Repository, Repository;
|
|
6037
|
+
var import_js_service35, _Repository, Repository;
|
|
6419
6038
|
var init_repository = __esm({
|
|
6420
6039
|
"src/repository/repository.js"() {
|
|
6421
6040
|
"use strict";
|
|
6422
|
-
|
|
6041
|
+
import_js_service35 = require("@e22m4u/js-service");
|
|
6423
6042
|
init_adapter2();
|
|
6424
6043
|
init_adapter2();
|
|
6425
|
-
|
|
6044
|
+
init_errors();
|
|
6426
6045
|
init_definition();
|
|
6427
|
-
_Repository = class _Repository extends Service {
|
|
6046
|
+
_Repository = class _Repository extends import_js_service35.Service {
|
|
6428
6047
|
/**
|
|
6429
6048
|
* Model name.
|
|
6430
6049
|
*
|
|
@@ -6466,7 +6085,7 @@ var init_repository = __esm({
|
|
|
6466
6085
|
const modelDef = this.getService(DefinitionRegistry).getModel(modelName);
|
|
6467
6086
|
const datasourceName = modelDef.datasource;
|
|
6468
6087
|
if (!datasourceName)
|
|
6469
|
-
throw new
|
|
6088
|
+
throw new InvalidArgumentError(
|
|
6470
6089
|
"The model %v does not have a specified datasource.",
|
|
6471
6090
|
modelName
|
|
6472
6091
|
);
|
|
@@ -6618,14 +6237,14 @@ var init_repository = __esm({
|
|
|
6618
6237
|
});
|
|
6619
6238
|
|
|
6620
6239
|
// src/repository/repository-registry.js
|
|
6621
|
-
var _RepositoryRegistry, RepositoryRegistry;
|
|
6240
|
+
var import_js_service36, _RepositoryRegistry, RepositoryRegistry;
|
|
6622
6241
|
var init_repository_registry = __esm({
|
|
6623
6242
|
"src/repository/repository-registry.js"() {
|
|
6624
6243
|
"use strict";
|
|
6625
|
-
|
|
6244
|
+
import_js_service36 = require("@e22m4u/js-service");
|
|
6626
6245
|
init_repository();
|
|
6627
|
-
|
|
6628
|
-
_RepositoryRegistry = class _RepositoryRegistry extends Service {
|
|
6246
|
+
init_errors();
|
|
6247
|
+
_RepositoryRegistry = class _RepositoryRegistry extends import_js_service36.Service {
|
|
6629
6248
|
/**
|
|
6630
6249
|
* Repositories.
|
|
6631
6250
|
*
|
|
@@ -6646,7 +6265,7 @@ var init_repository_registry = __esm({
|
|
|
6646
6265
|
*/
|
|
6647
6266
|
setRepositoryCtor(ctor) {
|
|
6648
6267
|
if (!ctor || typeof ctor !== "function" || !(ctor.prototype instanceof Repository)) {
|
|
6649
|
-
throw new
|
|
6268
|
+
throw new InvalidArgumentError(
|
|
6650
6269
|
"The first argument of RepositoryRegistry.setRepositoryCtor must inherit from Repository class, but %v given.",
|
|
6651
6270
|
ctor
|
|
6652
6271
|
);
|
|
@@ -6698,7 +6317,7 @@ __export(src_exports, {
|
|
|
6698
6317
|
HasManyResolver: () => HasManyResolver,
|
|
6699
6318
|
HasOneResolver: () => HasOneResolver,
|
|
6700
6319
|
IncludeClauseTool: () => IncludeClauseTool,
|
|
6701
|
-
InvalidArgumentError: () =>
|
|
6320
|
+
InvalidArgumentError: () => InvalidArgumentError,
|
|
6702
6321
|
InvalidOperatorValueError: () => InvalidOperatorValueError,
|
|
6703
6322
|
ModelDataSanitizer: () => ModelDataSanitizer,
|
|
6704
6323
|
ModelDataTransformer: () => ModelDataTransformer,
|
|
@@ -6740,11 +6359,11 @@ __export(src_exports, {
|
|
|
6740
6359
|
module.exports = __toCommonJS(src_exports);
|
|
6741
6360
|
|
|
6742
6361
|
// src/schema.js
|
|
6743
|
-
|
|
6362
|
+
var import_js_service37 = require("@e22m4u/js-service");
|
|
6744
6363
|
init_repository2();
|
|
6745
6364
|
init_definition();
|
|
6746
6365
|
init_repository2();
|
|
6747
|
-
var _Schema = class _Schema extends Service {
|
|
6366
|
+
var _Schema = class _Schema extends import_js_service37.Service {
|
|
6748
6367
|
/**
|
|
6749
6368
|
* Define datasource.
|
|
6750
6369
|
*
|
|
@@ -6779,8 +6398,8 @@ __name(_Schema, "Schema");
|
|
|
6779
6398
|
var Schema = _Schema;
|
|
6780
6399
|
|
|
6781
6400
|
// src/index.js
|
|
6782
|
-
|
|
6783
|
-
|
|
6401
|
+
init_utils();
|
|
6402
|
+
init_errors();
|
|
6784
6403
|
init_filter();
|
|
6785
6404
|
init_adapter2();
|
|
6786
6405
|
init_relations2();
|