@e22m4u/js-repository 0.1.24 → 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 +6 -0
- package/dist/cjs/index.cjs +586 -847
- package/package.json +3 -2
- package/src/adapter/adapter-loader.js +1 -2
- package/src/adapter/adapter.d.ts +7 -0
- package/src/adapter/adapter.js +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -5,6 +5,8 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
10
|
var __glob = (map) => (path) => {
|
|
9
11
|
var fn = map[path];
|
|
10
12
|
if (fn) return fn();
|
|
@@ -34,404 +36,41 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
36
|
mod
|
|
35
37
|
));
|
|
36
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
-
|
|
38
|
-
// node_modules/@e22m4u/js-format/src/utils/is-class.js
|
|
39
|
-
function isClass(value) {
|
|
40
|
-
if (!value) return false;
|
|
41
|
-
return typeof value === "function" && /^class\s/.test(Function.prototype.toString.call(value));
|
|
42
|
-
}
|
|
43
|
-
var init_is_class = __esm({
|
|
44
|
-
"node_modules/@e22m4u/js-format/src/utils/is-class.js"() {
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
// node_modules/@e22m4u/js-format/src/utils/index.js
|
|
49
|
-
var init_utils = __esm({
|
|
50
|
-
"node_modules/@e22m4u/js-format/src/utils/index.js"() {
|
|
51
|
-
init_is_class();
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
// node_modules/@e22m4u/js-format/src/value-to-string.js
|
|
56
|
-
function valueToString(input) {
|
|
57
|
-
if (input == null) return String(input);
|
|
58
|
-
if (typeof input === "string") return `"${input}"`;
|
|
59
|
-
if (typeof input === "number" || typeof input === "boolean")
|
|
60
|
-
return String(input);
|
|
61
|
-
if (isClass(input)) return input.name ? input.name : "Class";
|
|
62
|
-
if (input.constructor && input.constructor.name)
|
|
63
|
-
return BASE_CTOR_NAMES.includes(input.constructor.name) ? input.constructor.name : `${input.constructor.name} (instance)`;
|
|
64
|
-
if (typeof input === "object" && input.constructor == null) return "Object";
|
|
65
|
-
return String(input);
|
|
66
|
-
}
|
|
67
|
-
var BASE_CTOR_NAMES;
|
|
68
|
-
var init_value_to_string = __esm({
|
|
69
|
-
"node_modules/@e22m4u/js-format/src/value-to-string.js"() {
|
|
70
|
-
init_utils();
|
|
71
|
-
BASE_CTOR_NAMES = [
|
|
72
|
-
"String",
|
|
73
|
-
"Number",
|
|
74
|
-
"Boolean",
|
|
75
|
-
"Object",
|
|
76
|
-
"Array",
|
|
77
|
-
"Function",
|
|
78
|
-
"Symbol",
|
|
79
|
-
"Map",
|
|
80
|
-
"Set",
|
|
81
|
-
"Date"
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
// node_modules/@e22m4u/js-format/src/array-to-list.js
|
|
87
|
-
function arrayToList(input) {
|
|
88
|
-
if (Array.isArray(input) && input.length)
|
|
89
|
-
return input.map(valueToString).join(SEPARATOR);
|
|
90
|
-
return valueToString(input);
|
|
91
|
-
}
|
|
92
|
-
var SEPARATOR;
|
|
93
|
-
var init_array_to_list = __esm({
|
|
94
|
-
"node_modules/@e22m4u/js-format/src/array-to-list.js"() {
|
|
95
|
-
init_value_to_string();
|
|
96
|
-
SEPARATOR = ", ";
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// node_modules/@e22m4u/js-format/src/format.js
|
|
101
|
-
function format(pattern) {
|
|
102
|
-
if (pattern instanceof Date) {
|
|
103
|
-
pattern = pattern.toISOString();
|
|
104
|
-
} else if (typeof pattern !== "string") {
|
|
105
|
-
pattern = String(pattern);
|
|
106
|
-
}
|
|
107
|
-
const re = /(%?)(%([sdjvl]))/g;
|
|
108
|
-
const args = Array.prototype.slice.call(arguments, 1);
|
|
109
|
-
if (args.length) {
|
|
110
|
-
pattern = pattern.replace(re, function(match, escaped, ptn, flag) {
|
|
111
|
-
let arg = args.shift();
|
|
112
|
-
switch (flag) {
|
|
113
|
-
case "s":
|
|
114
|
-
arg = String(arg);
|
|
115
|
-
break;
|
|
116
|
-
case "d":
|
|
117
|
-
arg = Number(arg);
|
|
118
|
-
break;
|
|
119
|
-
case "j":
|
|
120
|
-
arg = JSON.stringify(arg);
|
|
121
|
-
break;
|
|
122
|
-
case "v":
|
|
123
|
-
arg = valueToString(arg);
|
|
124
|
-
break;
|
|
125
|
-
case "l":
|
|
126
|
-
arg = arrayToList(arg);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
if (!escaped) return arg;
|
|
130
|
-
args.unshift(arg);
|
|
131
|
-
return match;
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
if (args.length) pattern += " " + args.join(" ");
|
|
135
|
-
pattern = pattern.replace(/%{2}/g, "%");
|
|
136
|
-
return "" + pattern;
|
|
137
|
-
}
|
|
138
|
-
var init_format = __esm({
|
|
139
|
-
"node_modules/@e22m4u/js-format/src/format.js"() {
|
|
140
|
-
init_array_to_list();
|
|
141
|
-
init_value_to_string();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// node_modules/@e22m4u/js-format/src/errorf.js
|
|
146
|
-
var Errorf;
|
|
147
|
-
var init_errorf = __esm({
|
|
148
|
-
"node_modules/@e22m4u/js-format/src/errorf.js"() {
|
|
149
|
-
init_format();
|
|
150
|
-
Errorf = class extends Error {
|
|
151
|
-
/**
|
|
152
|
-
* Constructor.
|
|
153
|
-
*
|
|
154
|
-
* @param {string|undefined} pattern
|
|
155
|
-
* @param {any} args
|
|
156
|
-
*/
|
|
157
|
-
constructor(pattern = void 0, ...args) {
|
|
158
|
-
const message = pattern != null ? format(pattern, ...args) : void 0;
|
|
159
|
-
super(message);
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
// node_modules/@e22m4u/js-format/src/index.js
|
|
166
|
-
var init_src = __esm({
|
|
167
|
-
"node_modules/@e22m4u/js-format/src/index.js"() {
|
|
168
|
-
init_format();
|
|
169
|
-
init_errorf();
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// node_modules/@e22m4u/js-service/src/errors/invalid-argument-error.js
|
|
174
|
-
var InvalidArgumentError;
|
|
175
|
-
var init_invalid_argument_error = __esm({
|
|
176
|
-
"node_modules/@e22m4u/js-service/src/errors/invalid-argument-error.js"() {
|
|
177
|
-
init_src();
|
|
178
|
-
InvalidArgumentError = class extends Errorf {
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
// node_modules/@e22m4u/js-service/src/errors/index.js
|
|
184
|
-
var init_errors = __esm({
|
|
185
|
-
"node_modules/@e22m4u/js-service/src/errors/index.js"() {
|
|
186
|
-
init_invalid_argument_error();
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// node_modules/@e22m4u/js-service/src/service-container.js
|
|
191
|
-
var ServiceContainer;
|
|
192
|
-
var init_service_container = __esm({
|
|
193
|
-
"node_modules/@e22m4u/js-service/src/service-container.js"() {
|
|
194
|
-
init_service();
|
|
195
|
-
init_errors();
|
|
196
|
-
ServiceContainer = class _ServiceContainer {
|
|
197
|
-
/**
|
|
198
|
-
* Services map.
|
|
199
|
-
*
|
|
200
|
-
* @type {Map<any, any>}
|
|
201
|
-
* @private
|
|
202
|
-
*/
|
|
203
|
-
_services = /* @__PURE__ */ new Map();
|
|
204
|
-
/**
|
|
205
|
-
* Parent container.
|
|
206
|
-
*
|
|
207
|
-
* @type {ServiceContainer}
|
|
208
|
-
* @private
|
|
209
|
-
*/
|
|
210
|
-
_parent;
|
|
211
|
-
/**
|
|
212
|
-
* Constructor.
|
|
213
|
-
*
|
|
214
|
-
* @param {ServiceContainer|undefined} parent
|
|
215
|
-
*/
|
|
216
|
-
constructor(parent = void 0) {
|
|
217
|
-
if (parent != null) {
|
|
218
|
-
if (!(parent instanceof _ServiceContainer))
|
|
219
|
-
throw new InvalidArgumentError(
|
|
220
|
-
'The provided parameter "parent" of ServicesContainer.constructor must be an instance ServiceContainer, but %v given.',
|
|
221
|
-
parent
|
|
222
|
-
);
|
|
223
|
-
this._parent = parent;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Получить существующий или новый экземпляр.
|
|
228
|
-
*
|
|
229
|
-
* @param {*} ctor
|
|
230
|
-
* @param {*} args
|
|
231
|
-
* @return {*}
|
|
232
|
-
*/
|
|
233
|
-
get(ctor, ...args) {
|
|
234
|
-
if (!ctor || typeof ctor !== "function")
|
|
235
|
-
throw new InvalidArgumentError(
|
|
236
|
-
"The first argument of ServicesContainer.get must be a class constructor, but %v given.",
|
|
237
|
-
ctor
|
|
238
|
-
);
|
|
239
|
-
if (!this._services.has(ctor) && this._parent && this._parent.has(ctor)) {
|
|
240
|
-
return this._parent.get(ctor);
|
|
241
|
-
}
|
|
242
|
-
let service = this._services.get(ctor);
|
|
243
|
-
if (!service || args.length) {
|
|
244
|
-
service = "prototype" in ctor && ctor.prototype instanceof Service ? new ctor(this, ...args) : new ctor(...args);
|
|
245
|
-
this._services.set(ctor, service);
|
|
246
|
-
} else if (typeof service === "function") {
|
|
247
|
-
service = service();
|
|
248
|
-
this._services.set(ctor, service);
|
|
249
|
-
}
|
|
250
|
-
return service;
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Проверка существования конструктора в контейнере.
|
|
254
|
-
*
|
|
255
|
-
* @param {*} ctor
|
|
256
|
-
* @return {boolean}
|
|
257
|
-
*/
|
|
258
|
-
has(ctor) {
|
|
259
|
-
if (this._services.has(ctor)) return true;
|
|
260
|
-
if (this._parent) return this._parent.has(ctor);
|
|
261
|
-
return false;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Добавить конструктор в контейнер.
|
|
265
|
-
*
|
|
266
|
-
* @param {*} ctor
|
|
267
|
-
* @param {*} args
|
|
268
|
-
* @return {this}
|
|
269
|
-
*/
|
|
270
|
-
add(ctor, ...args) {
|
|
271
|
-
if (!ctor || typeof ctor !== "function")
|
|
272
|
-
throw new InvalidArgumentError(
|
|
273
|
-
"The first argument of ServicesContainer.add must be a class constructor, but %v given.",
|
|
274
|
-
ctor
|
|
275
|
-
);
|
|
276
|
-
const factory = () => ctor.prototype instanceof Service ? new ctor(this, ...args) : new ctor(...args);
|
|
277
|
-
this._services.set(ctor, factory);
|
|
278
|
-
return this;
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Добавить конструктор и создать экземпляр.
|
|
282
|
-
*
|
|
283
|
-
* @param {*} ctor
|
|
284
|
-
* @param {*} args
|
|
285
|
-
* @return {this}
|
|
286
|
-
*/
|
|
287
|
-
use(ctor, ...args) {
|
|
288
|
-
if (!ctor || typeof ctor !== "function")
|
|
289
|
-
throw new InvalidArgumentError(
|
|
290
|
-
"The first argument of ServicesContainer.use must be a class constructor, but %v given.",
|
|
291
|
-
ctor
|
|
292
|
-
);
|
|
293
|
-
const service = ctor.prototype instanceof Service ? new ctor(this, ...args) : new ctor(...args);
|
|
294
|
-
this._services.set(ctor, service);
|
|
295
|
-
return this;
|
|
296
|
-
}
|
|
297
|
-
/**
|
|
298
|
-
* Добавить конструктор и связанный экземпляр.
|
|
299
|
-
*
|
|
300
|
-
* @param {*} ctor
|
|
301
|
-
* @param {*} service
|
|
302
|
-
* @return {this}
|
|
303
|
-
*/
|
|
304
|
-
set(ctor, service) {
|
|
305
|
-
if (!ctor || typeof ctor !== "function")
|
|
306
|
-
throw new InvalidArgumentError(
|
|
307
|
-
"The first argument of ServicesContainer.set must be a class constructor, but %v given.",
|
|
308
|
-
ctor
|
|
309
|
-
);
|
|
310
|
-
if (!service || typeof service !== "object" || Array.isArray(service))
|
|
311
|
-
throw new InvalidArgumentError(
|
|
312
|
-
"The second argument of ServicesContainer.set must be an Object, but %v given.",
|
|
313
|
-
service
|
|
314
|
-
);
|
|
315
|
-
this._services.set(ctor, service);
|
|
316
|
-
return this;
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
// node_modules/@e22m4u/js-service/src/service.js
|
|
323
|
-
var Service;
|
|
324
|
-
var init_service = __esm({
|
|
325
|
-
"node_modules/@e22m4u/js-service/src/service.js"() {
|
|
326
|
-
init_service_container();
|
|
327
|
-
Service = class {
|
|
328
|
-
/**
|
|
329
|
-
* Container.
|
|
330
|
-
*
|
|
331
|
-
* @type {ServiceContainer}
|
|
332
|
-
*/
|
|
333
|
-
container;
|
|
334
|
-
/**
|
|
335
|
-
* Constructor.
|
|
336
|
-
*
|
|
337
|
-
* @param {ServiceContainer|undefined} container
|
|
338
|
-
*/
|
|
339
|
-
constructor(container = void 0) {
|
|
340
|
-
this.container = container instanceof ServiceContainer ? container : new ServiceContainer();
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Получить существующий или новый экземпляр.
|
|
344
|
-
*
|
|
345
|
-
* @param {*} ctor
|
|
346
|
-
* @param {*} args
|
|
347
|
-
* @return {*}
|
|
348
|
-
*/
|
|
349
|
-
getService(ctor, ...args) {
|
|
350
|
-
return this.container.get(ctor, ...args);
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Проверка существования конструктора в контейнере.
|
|
354
|
-
*
|
|
355
|
-
* @param {*} ctor
|
|
356
|
-
* @return {boolean}
|
|
357
|
-
*/
|
|
358
|
-
hasService(ctor) {
|
|
359
|
-
return this.container.has(ctor);
|
|
360
|
-
}
|
|
361
|
-
/**
|
|
362
|
-
* Добавить конструктор в контейнер.
|
|
363
|
-
*
|
|
364
|
-
* @param {*} ctor
|
|
365
|
-
* @param {*} args
|
|
366
|
-
* @return {this}
|
|
367
|
-
*/
|
|
368
|
-
addService(ctor, ...args) {
|
|
369
|
-
this.container.add(ctor, ...args);
|
|
370
|
-
return this;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Добавить конструктор и создать экземпляр.
|
|
374
|
-
*
|
|
375
|
-
* @param {*} ctor
|
|
376
|
-
* @param {*} args
|
|
377
|
-
* @return {this}
|
|
378
|
-
*/
|
|
379
|
-
useService(ctor, ...args) {
|
|
380
|
-
this.container.use(ctor, ...args);
|
|
381
|
-
return this;
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* Добавить конструктор и связанный экземпляр.
|
|
385
|
-
*
|
|
386
|
-
* @param {*} ctor
|
|
387
|
-
* @param {*} service
|
|
388
|
-
* @return {this}
|
|
389
|
-
*/
|
|
390
|
-
setService(ctor, service) {
|
|
391
|
-
this.container.set(ctor, service);
|
|
392
|
-
return this;
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
// node_modules/@e22m4u/js-service/src/index.js
|
|
399
|
-
var init_src2 = __esm({
|
|
400
|
-
"node_modules/@e22m4u/js-service/src/index.js"() {
|
|
401
|
-
init_service();
|
|
402
|
-
init_service_container();
|
|
403
|
-
}
|
|
404
|
-
});
|
|
39
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
405
40
|
|
|
406
41
|
// src/errors/not-implemented-error.js
|
|
407
|
-
var NotImplementedError;
|
|
42
|
+
var import_js_format, _NotImplementedError, NotImplementedError;
|
|
408
43
|
var init_not_implemented_error = __esm({
|
|
409
44
|
"src/errors/not-implemented-error.js"() {
|
|
410
45
|
"use strict";
|
|
411
|
-
|
|
412
|
-
|
|
46
|
+
import_js_format = require("@e22m4u/js-format");
|
|
47
|
+
_NotImplementedError = class _NotImplementedError extends import_js_format.Errorf {
|
|
413
48
|
};
|
|
49
|
+
__name(_NotImplementedError, "NotImplementedError");
|
|
50
|
+
NotImplementedError = _NotImplementedError;
|
|
414
51
|
}
|
|
415
52
|
});
|
|
416
53
|
|
|
417
54
|
// src/errors/invalid-argument-error.js
|
|
418
|
-
var
|
|
419
|
-
var
|
|
55
|
+
var import_js_format2, _InvalidArgumentError, InvalidArgumentError;
|
|
56
|
+
var init_invalid_argument_error = __esm({
|
|
420
57
|
"src/errors/invalid-argument-error.js"() {
|
|
421
58
|
"use strict";
|
|
422
|
-
|
|
423
|
-
|
|
59
|
+
import_js_format2 = require("@e22m4u/js-format");
|
|
60
|
+
_InvalidArgumentError = class _InvalidArgumentError extends import_js_format2.Errorf {
|
|
424
61
|
};
|
|
62
|
+
__name(_InvalidArgumentError, "InvalidArgumentError");
|
|
63
|
+
InvalidArgumentError = _InvalidArgumentError;
|
|
425
64
|
}
|
|
426
65
|
});
|
|
427
66
|
|
|
428
67
|
// src/errors/invalid-operator-value-error.js
|
|
429
|
-
var InvalidOperatorValueError;
|
|
68
|
+
var import_js_format3, _InvalidOperatorValueError, InvalidOperatorValueError;
|
|
430
69
|
var init_invalid_operator_value_error = __esm({
|
|
431
70
|
"src/errors/invalid-operator-value-error.js"() {
|
|
432
71
|
"use strict";
|
|
433
|
-
|
|
434
|
-
|
|
72
|
+
import_js_format3 = require("@e22m4u/js-format");
|
|
73
|
+
_InvalidOperatorValueError = class _InvalidOperatorValueError extends Error {
|
|
435
74
|
/**
|
|
436
75
|
* Constructor.
|
|
437
76
|
*
|
|
@@ -441,7 +80,7 @@ var init_invalid_operator_value_error = __esm({
|
|
|
441
80
|
*/
|
|
442
81
|
constructor(operator, expected, value) {
|
|
443
82
|
super(
|
|
444
|
-
format(
|
|
83
|
+
(0, import_js_format3.format)(
|
|
445
84
|
"Condition of {%s: ...} should have %s, but %v given.",
|
|
446
85
|
operator,
|
|
447
86
|
expected,
|
|
@@ -450,27 +89,29 @@ var init_invalid_operator_value_error = __esm({
|
|
|
450
89
|
);
|
|
451
90
|
}
|
|
452
91
|
};
|
|
92
|
+
__name(_InvalidOperatorValueError, "InvalidOperatorValueError");
|
|
93
|
+
InvalidOperatorValueError = _InvalidOperatorValueError;
|
|
453
94
|
}
|
|
454
95
|
});
|
|
455
96
|
|
|
456
97
|
// src/errors/index.js
|
|
457
|
-
var
|
|
98
|
+
var init_errors = __esm({
|
|
458
99
|
"src/errors/index.js"() {
|
|
459
100
|
"use strict";
|
|
460
101
|
init_not_implemented_error();
|
|
461
|
-
|
|
102
|
+
init_invalid_argument_error();
|
|
462
103
|
init_invalid_operator_value_error();
|
|
463
104
|
}
|
|
464
105
|
});
|
|
465
106
|
|
|
466
107
|
// src/filter/slice-clause-tool.js
|
|
467
|
-
var SliceClauseTool;
|
|
108
|
+
var import_js_service, _SliceClauseTool, SliceClauseTool;
|
|
468
109
|
var init_slice_clause_tool = __esm({
|
|
469
110
|
"src/filter/slice-clause-tool.js"() {
|
|
470
111
|
"use strict";
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
112
|
+
import_js_service = require("@e22m4u/js-service");
|
|
113
|
+
init_errors();
|
|
114
|
+
_SliceClauseTool = class _SliceClauseTool extends import_js_service.Service {
|
|
474
115
|
/**
|
|
475
116
|
* Slice.
|
|
476
117
|
*
|
|
@@ -481,17 +122,17 @@ var init_slice_clause_tool = __esm({
|
|
|
481
122
|
*/
|
|
482
123
|
slice(entities, skip = void 0, limit = void 0) {
|
|
483
124
|
if (!Array.isArray(entities))
|
|
484
|
-
throw new
|
|
125
|
+
throw new InvalidArgumentError(
|
|
485
126
|
"The first argument of SliceClauseTool.slice should be an Array, but %v given.",
|
|
486
127
|
entities
|
|
487
128
|
);
|
|
488
129
|
if (skip != null && typeof skip !== "number")
|
|
489
|
-
throw new
|
|
130
|
+
throw new InvalidArgumentError(
|
|
490
131
|
'The provided option "skip" should be a Number, but %v given.',
|
|
491
132
|
skip
|
|
492
133
|
);
|
|
493
134
|
if (limit != null && typeof limit !== "number")
|
|
494
|
-
throw new
|
|
135
|
+
throw new InvalidArgumentError(
|
|
495
136
|
'The provided option "limit" should be a Number, but %v given.',
|
|
496
137
|
limit
|
|
497
138
|
);
|
|
@@ -507,7 +148,7 @@ var init_slice_clause_tool = __esm({
|
|
|
507
148
|
static validateSkipClause(skip) {
|
|
508
149
|
if (skip == null) return;
|
|
509
150
|
if (typeof skip !== "number")
|
|
510
|
-
throw new
|
|
151
|
+
throw new InvalidArgumentError(
|
|
511
152
|
'The provided option "skip" should be a Number, but %v given.',
|
|
512
153
|
skip
|
|
513
154
|
);
|
|
@@ -520,12 +161,14 @@ var init_slice_clause_tool = __esm({
|
|
|
520
161
|
static validateLimitClause(limit) {
|
|
521
162
|
if (limit == null) return;
|
|
522
163
|
if (typeof limit !== "number")
|
|
523
|
-
throw new
|
|
164
|
+
throw new InvalidArgumentError(
|
|
524
165
|
'The provided option "limit" should be a Number, but %v given.',
|
|
525
166
|
limit
|
|
526
167
|
);
|
|
527
168
|
}
|
|
528
169
|
};
|
|
170
|
+
__name(_SliceClauseTool, "SliceClauseTool");
|
|
171
|
+
SliceClauseTool = _SliceClauseTool;
|
|
529
172
|
}
|
|
530
173
|
});
|
|
531
174
|
|
|
@@ -537,6 +180,7 @@ function isCtor(value) {
|
|
|
537
180
|
var init_is_ctor = __esm({
|
|
538
181
|
"src/utils/is-ctor.js"() {
|
|
539
182
|
"use strict";
|
|
183
|
+
__name(isCtor, "isCtor");
|
|
540
184
|
}
|
|
541
185
|
});
|
|
542
186
|
|
|
@@ -549,6 +193,7 @@ function isPromise(value) {
|
|
|
549
193
|
var init_is_promise = __esm({
|
|
550
194
|
"src/utils/is-promise.js"() {
|
|
551
195
|
"use strict";
|
|
196
|
+
__name(isPromise, "isPromise");
|
|
552
197
|
}
|
|
553
198
|
});
|
|
554
199
|
|
|
@@ -560,6 +205,7 @@ function capitalize(string) {
|
|
|
560
205
|
var init_capitalize = __esm({
|
|
561
206
|
"src/utils/capitalize.js"() {
|
|
562
207
|
"use strict";
|
|
208
|
+
__name(capitalize, "capitalize");
|
|
563
209
|
}
|
|
564
210
|
});
|
|
565
211
|
|
|
@@ -603,6 +249,7 @@ function cloneDeep(value) {
|
|
|
603
249
|
var init_clone_deep = __esm({
|
|
604
250
|
"src/utils/clone-deep.js"() {
|
|
605
251
|
"use strict";
|
|
252
|
+
__name(cloneDeep, "cloneDeep");
|
|
606
253
|
}
|
|
607
254
|
});
|
|
608
255
|
|
|
@@ -626,13 +273,14 @@ function singularize(noun) {
|
|
|
626
273
|
var init_singularize = __esm({
|
|
627
274
|
"src/utils/singularize.js"() {
|
|
628
275
|
"use strict";
|
|
276
|
+
__name(singularize, "singularize");
|
|
629
277
|
}
|
|
630
278
|
});
|
|
631
279
|
|
|
632
280
|
// src/utils/is-deep-equal.js
|
|
633
281
|
function isDeepEqual(firstValue, secondValue) {
|
|
634
282
|
const cached = /* @__PURE__ */ new WeakMap();
|
|
635
|
-
const compare = (a, b) => {
|
|
283
|
+
const compare = /* @__PURE__ */ __name((a, b) => {
|
|
636
284
|
if (a === null || b === null) return a === b;
|
|
637
285
|
if (typeof a !== "object" || typeof b !== "object") return a === b;
|
|
638
286
|
const dataTypeA = Array.isArray(a) ? "array" : "object";
|
|
@@ -668,12 +316,13 @@ function isDeepEqual(firstValue, secondValue) {
|
|
|
668
316
|
if (!compare(propertyValueA, propertyValueB)) return false;
|
|
669
317
|
}
|
|
670
318
|
return true;
|
|
671
|
-
};
|
|
319
|
+
}, "compare");
|
|
672
320
|
return compare(firstValue, secondValue);
|
|
673
321
|
}
|
|
674
322
|
var init_is_deep_equal = __esm({
|
|
675
323
|
"src/utils/is-deep-equal.js"() {
|
|
676
324
|
"use strict";
|
|
325
|
+
__name(isDeepEqual, "isDeepEqual");
|
|
677
326
|
}
|
|
678
327
|
});
|
|
679
328
|
|
|
@@ -686,6 +335,7 @@ function getCtorName(value) {
|
|
|
686
335
|
var init_get_ctor_name = __esm({
|
|
687
336
|
"src/utils/get-ctor-name.js"() {
|
|
688
337
|
"use strict";
|
|
338
|
+
__name(getCtorName, "getCtorName");
|
|
689
339
|
}
|
|
690
340
|
});
|
|
691
341
|
|
|
@@ -698,6 +348,7 @@ function isPureObject(value) {
|
|
|
698
348
|
var init_is_pure_object = __esm({
|
|
699
349
|
"src/utils/is-pure-object.js"() {
|
|
700
350
|
"use strict";
|
|
351
|
+
__name(isPureObject, "isPureObject");
|
|
701
352
|
}
|
|
702
353
|
});
|
|
703
354
|
|
|
@@ -720,6 +371,7 @@ function stringToRegexp(pattern, flags = void 0) {
|
|
|
720
371
|
var init_string_to_regexp = __esm({
|
|
721
372
|
"src/utils/string-to-regexp.js"() {
|
|
722
373
|
"use strict";
|
|
374
|
+
__name(stringToRegexp, "stringToRegexp");
|
|
723
375
|
}
|
|
724
376
|
});
|
|
725
377
|
|
|
@@ -742,6 +394,7 @@ function getValueByPath(obj, path, orElse = void 0) {
|
|
|
742
394
|
var init_get_value_by_path = __esm({
|
|
743
395
|
"src/utils/get-value-by-path.js"() {
|
|
744
396
|
"use strict";
|
|
397
|
+
__name(getValueByPath, "getValueByPath");
|
|
745
398
|
}
|
|
746
399
|
});
|
|
747
400
|
|
|
@@ -753,24 +406,25 @@ var init_transform_promise = __esm({
|
|
|
753
406
|
"src/utils/transform-promise.js"() {
|
|
754
407
|
"use strict";
|
|
755
408
|
init_is_promise();
|
|
409
|
+
__name(transformPromise, "transformPromise");
|
|
756
410
|
}
|
|
757
411
|
});
|
|
758
412
|
|
|
759
413
|
// src/utils/select-object-keys.js
|
|
760
414
|
function selectObjectKeys(obj, keys) {
|
|
761
415
|
if (!obj || typeof obj !== "object" || Array.isArray(obj))
|
|
762
|
-
throw new
|
|
416
|
+
throw new InvalidArgumentError(
|
|
763
417
|
"The first argument of selectObjectKeys should be an Object, but %v given.",
|
|
764
418
|
obj
|
|
765
419
|
);
|
|
766
420
|
if (!Array.isArray(keys))
|
|
767
|
-
throw new
|
|
421
|
+
throw new InvalidArgumentError(
|
|
768
422
|
"The second argument of selectObjectKeys should be an Array of String, but %v given.",
|
|
769
423
|
keys
|
|
770
424
|
);
|
|
771
425
|
keys.forEach((key) => {
|
|
772
426
|
if (typeof key !== "string")
|
|
773
|
-
throw new
|
|
427
|
+
throw new InvalidArgumentError(
|
|
774
428
|
"The second argument of selectObjectKeys should be an Array of String, but %v given.",
|
|
775
429
|
key
|
|
776
430
|
);
|
|
@@ -785,14 +439,15 @@ function selectObjectKeys(obj, keys) {
|
|
|
785
439
|
var init_select_object_keys = __esm({
|
|
786
440
|
"src/utils/select-object-keys.js"() {
|
|
787
441
|
"use strict";
|
|
788
|
-
|
|
442
|
+
init_errors();
|
|
443
|
+
__name(selectObjectKeys, "selectObjectKeys");
|
|
789
444
|
}
|
|
790
445
|
});
|
|
791
446
|
|
|
792
447
|
// src/utils/exclude-object-keys.js
|
|
793
448
|
function excludeObjectKeys(obj, keys) {
|
|
794
449
|
if (typeof obj !== "object" || !obj || Array.isArray(obj))
|
|
795
|
-
throw new
|
|
450
|
+
throw new InvalidArgumentError(
|
|
796
451
|
"Cannot exclude keys from a non-Object value, %v given.",
|
|
797
452
|
obj
|
|
798
453
|
);
|
|
@@ -804,7 +459,8 @@ function excludeObjectKeys(obj, keys) {
|
|
|
804
459
|
var init_exclude_object_keys = __esm({
|
|
805
460
|
"src/utils/exclude-object-keys.js"() {
|
|
806
461
|
"use strict";
|
|
807
|
-
|
|
462
|
+
init_errors();
|
|
463
|
+
__name(excludeObjectKeys, "excludeObjectKeys");
|
|
808
464
|
}
|
|
809
465
|
});
|
|
810
466
|
|
|
@@ -843,11 +499,12 @@ var init_get_decorator_target_type = __esm({
|
|
|
843
499
|
STATIC_METHOD_PARAMETER: "staticMethodParameter",
|
|
844
500
|
INSTANCE_METHOD_PARAMETER: "instanceMethodParameter"
|
|
845
501
|
};
|
|
502
|
+
__name(getDecoratorTargetType, "getDecoratorTargetType");
|
|
846
503
|
}
|
|
847
504
|
});
|
|
848
505
|
|
|
849
506
|
// src/utils/index.js
|
|
850
|
-
var
|
|
507
|
+
var init_utils = __esm({
|
|
851
508
|
"src/utils/index.js"() {
|
|
852
509
|
"use strict";
|
|
853
510
|
init_is_ctor();
|
|
@@ -883,14 +540,14 @@ function compareFn(a, b) {
|
|
|
883
540
|
}
|
|
884
541
|
return 0;
|
|
885
542
|
}
|
|
886
|
-
var OrderClauseTool;
|
|
543
|
+
var import_js_service2, _OrderClauseTool, OrderClauseTool;
|
|
887
544
|
var init_order_clause_tool = __esm({
|
|
888
545
|
"src/filter/order-clause-tool.js"() {
|
|
889
546
|
"use strict";
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
547
|
+
import_js_service2 = require("@e22m4u/js-service");
|
|
548
|
+
init_utils();
|
|
549
|
+
init_errors();
|
|
550
|
+
_OrderClauseTool = class _OrderClauseTool extends import_js_service2.Service {
|
|
894
551
|
/**
|
|
895
552
|
* Sort.
|
|
896
553
|
*
|
|
@@ -904,7 +561,7 @@ var init_order_clause_tool = __esm({
|
|
|
904
561
|
const mapping = [];
|
|
905
562
|
clause.forEach((key, index) => {
|
|
906
563
|
if (!key || typeof key !== "string")
|
|
907
|
-
throw new
|
|
564
|
+
throw new InvalidArgumentError(
|
|
908
565
|
'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
909
566
|
key
|
|
910
567
|
);
|
|
@@ -929,7 +586,7 @@ var init_order_clause_tool = __esm({
|
|
|
929
586
|
if (!clause.length) return;
|
|
930
587
|
clause.forEach((field) => {
|
|
931
588
|
if (!field || typeof field !== "string")
|
|
932
|
-
throw new
|
|
589
|
+
throw new InvalidArgumentError(
|
|
933
590
|
'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
934
591
|
field
|
|
935
592
|
);
|
|
@@ -947,7 +604,7 @@ var init_order_clause_tool = __esm({
|
|
|
947
604
|
if (!clause.length) return;
|
|
948
605
|
clause.forEach((field) => {
|
|
949
606
|
if (!field || typeof field !== "string")
|
|
950
|
-
throw new
|
|
607
|
+
throw new InvalidArgumentError(
|
|
951
608
|
'The provided option "order" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
952
609
|
field
|
|
953
610
|
);
|
|
@@ -955,19 +612,22 @@ var init_order_clause_tool = __esm({
|
|
|
955
612
|
return clause;
|
|
956
613
|
}
|
|
957
614
|
};
|
|
615
|
+
__name(_OrderClauseTool, "OrderClauseTool");
|
|
616
|
+
OrderClauseTool = _OrderClauseTool;
|
|
617
|
+
__name(compareFn, "compareFn");
|
|
958
618
|
}
|
|
959
619
|
});
|
|
960
620
|
|
|
961
621
|
// src/filter/operator-clause-tool.js
|
|
962
|
-
var OperatorClauseTool;
|
|
622
|
+
var import_js_service3, _OperatorClauseTool, OperatorClauseTool;
|
|
963
623
|
var init_operator_clause_tool = __esm({
|
|
964
624
|
"src/filter/operator-clause-tool.js"() {
|
|
965
625
|
"use strict";
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
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 {
|
|
971
631
|
/**
|
|
972
632
|
* Compare.
|
|
973
633
|
*
|
|
@@ -1011,7 +671,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1011
671
|
*/
|
|
1012
672
|
testAll(clause, value) {
|
|
1013
673
|
if (!clause || typeof clause !== "object" || Array.isArray(clause))
|
|
1014
|
-
throw new
|
|
674
|
+
throw new InvalidArgumentError(
|
|
1015
675
|
"The first argument of OperatorUtils.testAll should be an Object, but %v given.",
|
|
1016
676
|
clause
|
|
1017
677
|
);
|
|
@@ -1061,7 +721,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1061
721
|
*/
|
|
1062
722
|
testEqNeq(clause, value) {
|
|
1063
723
|
if (!clause || typeof clause !== "object")
|
|
1064
|
-
throw new
|
|
724
|
+
throw new InvalidArgumentError(
|
|
1065
725
|
"The first argument of OperatorUtils.testEqNeq should be an Object, but %v given.",
|
|
1066
726
|
clause
|
|
1067
727
|
);
|
|
@@ -1105,7 +765,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1105
765
|
*/
|
|
1106
766
|
testGtLt(clause, value) {
|
|
1107
767
|
if (!clause || typeof clause !== "object")
|
|
1108
|
-
throw new
|
|
768
|
+
throw new InvalidArgumentError(
|
|
1109
769
|
"The first argument of OperatorUtils.testGtLt should be an Object, but %v given.",
|
|
1110
770
|
clause
|
|
1111
771
|
);
|
|
@@ -1130,7 +790,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1130
790
|
*/
|
|
1131
791
|
testInq(clause, value) {
|
|
1132
792
|
if (!clause || typeof clause !== "object")
|
|
1133
|
-
throw new
|
|
793
|
+
throw new InvalidArgumentError(
|
|
1134
794
|
"The first argument of OperatorUtils.testInq should be an Object, but %v given.",
|
|
1135
795
|
clause
|
|
1136
796
|
);
|
|
@@ -1164,7 +824,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1164
824
|
*/
|
|
1165
825
|
testNin(clause, value) {
|
|
1166
826
|
if (!clause || typeof clause !== "object")
|
|
1167
|
-
throw new
|
|
827
|
+
throw new InvalidArgumentError(
|
|
1168
828
|
"The first argument of OperatorUtils.testNin should be an Object, but %v given.",
|
|
1169
829
|
clause
|
|
1170
830
|
);
|
|
@@ -1198,7 +858,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1198
858
|
*/
|
|
1199
859
|
testBetween(clause, value) {
|
|
1200
860
|
if (!clause || typeof clause !== "object")
|
|
1201
|
-
throw new
|
|
861
|
+
throw new InvalidArgumentError(
|
|
1202
862
|
"The first argument of OperatorUtils.testBetween should be an Object, but %v given.",
|
|
1203
863
|
clause
|
|
1204
864
|
);
|
|
@@ -1229,7 +889,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1229
889
|
*/
|
|
1230
890
|
testExists(clause, value) {
|
|
1231
891
|
if (!clause || typeof clause !== "object")
|
|
1232
|
-
throw new
|
|
892
|
+
throw new InvalidArgumentError(
|
|
1233
893
|
"The first argument of OperatorUtils.testExists should be an Object, but %v given.",
|
|
1234
894
|
clause
|
|
1235
895
|
);
|
|
@@ -1260,7 +920,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1260
920
|
*/
|
|
1261
921
|
testLike(clause, value) {
|
|
1262
922
|
if (!clause || typeof clause !== "object")
|
|
1263
|
-
throw new
|
|
923
|
+
throw new InvalidArgumentError(
|
|
1264
924
|
"The first argument of OperatorUtils.testLike should be an Object, but %v given.",
|
|
1265
925
|
clause
|
|
1266
926
|
);
|
|
@@ -1286,7 +946,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1286
946
|
*/
|
|
1287
947
|
testNlike(clause, value) {
|
|
1288
948
|
if (!clause || typeof clause !== "object")
|
|
1289
|
-
throw new
|
|
949
|
+
throw new InvalidArgumentError(
|
|
1290
950
|
"The first argument of OperatorUtils.testNlike should be an Object, but %v given.",
|
|
1291
951
|
clause
|
|
1292
952
|
);
|
|
@@ -1313,7 +973,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1313
973
|
*/
|
|
1314
974
|
testIlike(clause, value) {
|
|
1315
975
|
if (!clause || typeof clause !== "object")
|
|
1316
|
-
throw new
|
|
976
|
+
throw new InvalidArgumentError(
|
|
1317
977
|
"The first argument of OperatorUtils.testIlike should be an Object, but %v given.",
|
|
1318
978
|
clause
|
|
1319
979
|
);
|
|
@@ -1340,7 +1000,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1340
1000
|
*/
|
|
1341
1001
|
testNilike(clause, value) {
|
|
1342
1002
|
if (!clause || typeof clause !== "object")
|
|
1343
|
-
throw new
|
|
1003
|
+
throw new InvalidArgumentError(
|
|
1344
1004
|
"The first argument of OperatorUtils.testNilike should be an Object, but %v given.",
|
|
1345
1005
|
clause
|
|
1346
1006
|
);
|
|
@@ -1379,7 +1039,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1379
1039
|
*/
|
|
1380
1040
|
testRegexp(clause, value) {
|
|
1381
1041
|
if (!clause || typeof clause !== "object")
|
|
1382
|
-
throw new
|
|
1042
|
+
throw new InvalidArgumentError(
|
|
1383
1043
|
"The first argument of OperatorUtils.testRegexp should be an Object, but %v given.",
|
|
1384
1044
|
clause
|
|
1385
1045
|
);
|
|
@@ -1393,7 +1053,7 @@ var init_operator_clause_tool = __esm({
|
|
|
1393
1053
|
}
|
|
1394
1054
|
const flags = clause.flags || void 0;
|
|
1395
1055
|
if (flags && typeof flags !== "string")
|
|
1396
|
-
throw new
|
|
1056
|
+
throw new InvalidArgumentError(
|
|
1397
1057
|
"RegExp flags should be a String, but %v given.",
|
|
1398
1058
|
clause.flags
|
|
1399
1059
|
);
|
|
@@ -1403,19 +1063,21 @@ var init_operator_clause_tool = __esm({
|
|
|
1403
1063
|
}
|
|
1404
1064
|
}
|
|
1405
1065
|
};
|
|
1066
|
+
__name(_OperatorClauseTool, "OperatorClauseTool");
|
|
1067
|
+
OperatorClauseTool = _OperatorClauseTool;
|
|
1406
1068
|
}
|
|
1407
1069
|
});
|
|
1408
1070
|
|
|
1409
1071
|
// src/filter/where-clause-tool.js
|
|
1410
|
-
var WhereClauseTool;
|
|
1072
|
+
var import_js_service4, _WhereClauseTool, WhereClauseTool;
|
|
1411
1073
|
var init_where_clause_tool = __esm({
|
|
1412
1074
|
"src/filter/where-clause-tool.js"() {
|
|
1413
1075
|
"use strict";
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1076
|
+
import_js_service4 = require("@e22m4u/js-service");
|
|
1077
|
+
init_utils();
|
|
1078
|
+
init_errors();
|
|
1417
1079
|
init_operator_clause_tool();
|
|
1418
|
-
|
|
1080
|
+
_WhereClauseTool = class _WhereClauseTool extends import_js_service4.Service {
|
|
1419
1081
|
/**
|
|
1420
1082
|
* Filter by where clause.
|
|
1421
1083
|
*
|
|
@@ -1447,7 +1109,7 @@ var init_where_clause_tool = __esm({
|
|
|
1447
1109
|
*/
|
|
1448
1110
|
filter(entities, where = void 0) {
|
|
1449
1111
|
if (!Array.isArray(entities))
|
|
1450
|
-
throw new
|
|
1112
|
+
throw new InvalidArgumentError(
|
|
1451
1113
|
"The first argument of WhereClauseTool.filter should be an Array of Object, but %v given.",
|
|
1452
1114
|
entities
|
|
1453
1115
|
);
|
|
@@ -1462,14 +1124,14 @@ var init_where_clause_tool = __esm({
|
|
|
1462
1124
|
*/
|
|
1463
1125
|
_createFilter(whereClause) {
|
|
1464
1126
|
if (typeof whereClause !== "object" || Array.isArray(whereClause))
|
|
1465
|
-
throw new
|
|
1127
|
+
throw new InvalidArgumentError(
|
|
1466
1128
|
'The provided option "where" should be an Object, but %v given.',
|
|
1467
1129
|
whereClause
|
|
1468
1130
|
);
|
|
1469
1131
|
const keys = Object.keys(whereClause);
|
|
1470
1132
|
return (data) => {
|
|
1471
1133
|
if (typeof data !== "object")
|
|
1472
|
-
throw new
|
|
1134
|
+
throw new InvalidArgumentError(
|
|
1473
1135
|
"The first argument of WhereClauseTool.filter should be an Array of Object, but %v given.",
|
|
1474
1136
|
data
|
|
1475
1137
|
);
|
|
@@ -1539,12 +1201,14 @@ var init_where_clause_tool = __esm({
|
|
|
1539
1201
|
static validateWhereClause(clause) {
|
|
1540
1202
|
if (clause == null || typeof clause === "function") return;
|
|
1541
1203
|
if (typeof clause !== "object" || Array.isArray(clause))
|
|
1542
|
-
throw new
|
|
1204
|
+
throw new InvalidArgumentError(
|
|
1543
1205
|
'The provided option "where" should be an Object, but %v given.',
|
|
1544
1206
|
clause
|
|
1545
1207
|
);
|
|
1546
1208
|
}
|
|
1547
1209
|
};
|
|
1210
|
+
__name(_WhereClauseTool, "WhereClauseTool");
|
|
1211
|
+
WhereClauseTool = _WhereClauseTool;
|
|
1548
1212
|
}
|
|
1549
1213
|
});
|
|
1550
1214
|
|
|
@@ -1570,15 +1234,15 @@ var init_relation_definition = __esm({
|
|
|
1570
1234
|
});
|
|
1571
1235
|
|
|
1572
1236
|
// src/definition/model/relations/relations-definition-validator.js
|
|
1573
|
-
var RelationsDefinitionValidator;
|
|
1237
|
+
var import_js_service5, _RelationsDefinitionValidator, RelationsDefinitionValidator;
|
|
1574
1238
|
var init_relations_definition_validator = __esm({
|
|
1575
1239
|
"src/definition/model/relations/relations-definition-validator.js"() {
|
|
1576
1240
|
"use strict";
|
|
1577
|
-
|
|
1241
|
+
import_js_service5 = require("@e22m4u/js-service");
|
|
1578
1242
|
init_relation_type();
|
|
1579
1243
|
init_relation_type();
|
|
1580
|
-
|
|
1581
|
-
|
|
1244
|
+
init_errors();
|
|
1245
|
+
_RelationsDefinitionValidator = class _RelationsDefinitionValidator extends import_js_service5.Service {
|
|
1582
1246
|
/**
|
|
1583
1247
|
* Validate.
|
|
1584
1248
|
*
|
|
@@ -1587,12 +1251,12 @@ var init_relations_definition_validator = __esm({
|
|
|
1587
1251
|
*/
|
|
1588
1252
|
validate(modelName, relDefs) {
|
|
1589
1253
|
if (!modelName || typeof modelName !== "string")
|
|
1590
|
-
throw new
|
|
1254
|
+
throw new InvalidArgumentError(
|
|
1591
1255
|
"The first argument of RelationsDefinitionValidator.validate should be a non-empty String, but %v given.",
|
|
1592
1256
|
modelName
|
|
1593
1257
|
);
|
|
1594
1258
|
if (!relDefs || typeof relDefs !== "object" || Array.isArray(relDefs))
|
|
1595
|
-
throw new
|
|
1259
|
+
throw new InvalidArgumentError(
|
|
1596
1260
|
'The provided option "relations" of the model %v should be an Object, but %v given.',
|
|
1597
1261
|
modelName,
|
|
1598
1262
|
relDefs
|
|
@@ -1612,25 +1276,25 @@ var init_relations_definition_validator = __esm({
|
|
|
1612
1276
|
*/
|
|
1613
1277
|
_validateRelation(modelName, relName, relDef) {
|
|
1614
1278
|
if (!modelName || typeof modelName !== "string")
|
|
1615
|
-
throw new
|
|
1279
|
+
throw new InvalidArgumentError(
|
|
1616
1280
|
"The first argument of RelationsDefinitionValidator._validateRelation should be a non-empty String, but %v given.",
|
|
1617
1281
|
modelName
|
|
1618
1282
|
);
|
|
1619
1283
|
if (!relName || typeof relName !== "string")
|
|
1620
|
-
throw new
|
|
1284
|
+
throw new InvalidArgumentError(
|
|
1621
1285
|
"The relation name of the model %v should be a non-empty String, but %v given.",
|
|
1622
1286
|
modelName,
|
|
1623
1287
|
relName
|
|
1624
1288
|
);
|
|
1625
1289
|
if (!relDef || typeof relDef !== "object" || Array.isArray(relDef))
|
|
1626
|
-
throw new
|
|
1290
|
+
throw new InvalidArgumentError(
|
|
1627
1291
|
"The relation %v of the model %v should be an Object, but %v given.",
|
|
1628
1292
|
relName,
|
|
1629
1293
|
modelName,
|
|
1630
1294
|
relDef
|
|
1631
1295
|
);
|
|
1632
1296
|
if (!relDef.type || !Object.values(RelationType).includes(relDef.type))
|
|
1633
|
-
throw new
|
|
1297
|
+
throw new InvalidArgumentError(
|
|
1634
1298
|
'The relation %v of the model %v requires the option "type" to have one of relation types: %l, but %v given.',
|
|
1635
1299
|
relName,
|
|
1636
1300
|
modelName,
|
|
@@ -1673,21 +1337,21 @@ var init_relations_definition_validator = __esm({
|
|
|
1673
1337
|
if (relDef.type !== RelationType.BELONGS_TO) return;
|
|
1674
1338
|
if (relDef.polymorphic) {
|
|
1675
1339
|
if (typeof relDef.polymorphic !== "boolean")
|
|
1676
|
-
throw new
|
|
1340
|
+
throw new InvalidArgumentError(
|
|
1677
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.',
|
|
1678
1342
|
relName,
|
|
1679
1343
|
modelName,
|
|
1680
1344
|
relDef.polymorphic
|
|
1681
1345
|
);
|
|
1682
1346
|
if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
|
|
1683
|
-
throw new
|
|
1347
|
+
throw new InvalidArgumentError(
|
|
1684
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.',
|
|
1685
1349
|
relName,
|
|
1686
1350
|
modelName,
|
|
1687
1351
|
relDef.foreignKey
|
|
1688
1352
|
);
|
|
1689
1353
|
if (relDef.discriminator && typeof relDef.discriminator !== "string")
|
|
1690
|
-
throw new
|
|
1354
|
+
throw new InvalidArgumentError(
|
|
1691
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.',
|
|
1692
1356
|
relName,
|
|
1693
1357
|
modelName,
|
|
@@ -1695,21 +1359,21 @@ var init_relations_definition_validator = __esm({
|
|
|
1695
1359
|
);
|
|
1696
1360
|
} else {
|
|
1697
1361
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1698
|
-
throw new
|
|
1362
|
+
throw new InvalidArgumentError(
|
|
1699
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.',
|
|
1700
1364
|
relName,
|
|
1701
1365
|
modelName,
|
|
1702
1366
|
relDef.model
|
|
1703
1367
|
);
|
|
1704
1368
|
if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
|
|
1705
|
-
throw new
|
|
1369
|
+
throw new InvalidArgumentError(
|
|
1706
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.',
|
|
1707
1371
|
relName,
|
|
1708
1372
|
modelName,
|
|
1709
1373
|
relDef.foreignKey
|
|
1710
1374
|
);
|
|
1711
1375
|
if (relDef.discriminator)
|
|
1712
|
-
throw new
|
|
1376
|
+
throw new InvalidArgumentError(
|
|
1713
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.',
|
|
1714
1378
|
relName,
|
|
1715
1379
|
modelName
|
|
@@ -1756,7 +1420,7 @@ var init_relations_definition_validator = __esm({
|
|
|
1756
1420
|
_validateHasOne(modelName, relName, relDef) {
|
|
1757
1421
|
if (relDef.type !== RelationType.HAS_ONE) return;
|
|
1758
1422
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1759
|
-
throw new
|
|
1423
|
+
throw new InvalidArgumentError(
|
|
1760
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.',
|
|
1761
1425
|
relName,
|
|
1762
1426
|
modelName,
|
|
@@ -1765,34 +1429,34 @@ var init_relations_definition_validator = __esm({
|
|
|
1765
1429
|
if (relDef.polymorphic) {
|
|
1766
1430
|
if (typeof relDef.polymorphic === "string") {
|
|
1767
1431
|
if (relDef.foreignKey)
|
|
1768
|
-
throw new
|
|
1432
|
+
throw new InvalidArgumentError(
|
|
1769
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.',
|
|
1770
1434
|
relName,
|
|
1771
1435
|
modelName
|
|
1772
1436
|
);
|
|
1773
1437
|
if (relDef.discriminator)
|
|
1774
|
-
throw new
|
|
1438
|
+
throw new InvalidArgumentError(
|
|
1775
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.',
|
|
1776
1440
|
relName,
|
|
1777
1441
|
modelName
|
|
1778
1442
|
);
|
|
1779
1443
|
} else if (typeof relDef.polymorphic === "boolean") {
|
|
1780
1444
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1781
|
-
throw new
|
|
1445
|
+
throw new InvalidArgumentError(
|
|
1782
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.',
|
|
1783
1447
|
relName,
|
|
1784
1448
|
modelName,
|
|
1785
1449
|
relDef.foreignKey
|
|
1786
1450
|
);
|
|
1787
1451
|
if (!relDef.discriminator || typeof relDef.discriminator !== "string")
|
|
1788
|
-
throw new
|
|
1452
|
+
throw new InvalidArgumentError(
|
|
1789
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.',
|
|
1790
1454
|
relName,
|
|
1791
1455
|
modelName,
|
|
1792
1456
|
relDef.discriminator
|
|
1793
1457
|
);
|
|
1794
1458
|
} else {
|
|
1795
|
-
throw new
|
|
1459
|
+
throw new InvalidArgumentError(
|
|
1796
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.',
|
|
1797
1461
|
relName,
|
|
1798
1462
|
modelName,
|
|
@@ -1801,14 +1465,14 @@ var init_relations_definition_validator = __esm({
|
|
|
1801
1465
|
}
|
|
1802
1466
|
} else {
|
|
1803
1467
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1804
|
-
throw new
|
|
1468
|
+
throw new InvalidArgumentError(
|
|
1805
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.',
|
|
1806
1470
|
relName,
|
|
1807
1471
|
modelName,
|
|
1808
1472
|
relDef.foreignKey
|
|
1809
1473
|
);
|
|
1810
1474
|
if (relDef.discriminator)
|
|
1811
|
-
throw new
|
|
1475
|
+
throw new InvalidArgumentError(
|
|
1812
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.',
|
|
1813
1477
|
relName,
|
|
1814
1478
|
modelName
|
|
@@ -1855,7 +1519,7 @@ var init_relations_definition_validator = __esm({
|
|
|
1855
1519
|
_validateHasMany(modelName, relName, relDef) {
|
|
1856
1520
|
if (relDef.type !== RelationType.HAS_MANY) return;
|
|
1857
1521
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1858
|
-
throw new
|
|
1522
|
+
throw new InvalidArgumentError(
|
|
1859
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.',
|
|
1860
1524
|
relName,
|
|
1861
1525
|
modelName,
|
|
@@ -1864,34 +1528,34 @@ var init_relations_definition_validator = __esm({
|
|
|
1864
1528
|
if (relDef.polymorphic) {
|
|
1865
1529
|
if (typeof relDef.polymorphic === "string") {
|
|
1866
1530
|
if (relDef.foreignKey)
|
|
1867
|
-
throw new
|
|
1531
|
+
throw new InvalidArgumentError(
|
|
1868
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.',
|
|
1869
1533
|
relName,
|
|
1870
1534
|
modelName
|
|
1871
1535
|
);
|
|
1872
1536
|
if (relDef.discriminator)
|
|
1873
|
-
throw new
|
|
1537
|
+
throw new InvalidArgumentError(
|
|
1874
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.',
|
|
1875
1539
|
relName,
|
|
1876
1540
|
modelName
|
|
1877
1541
|
);
|
|
1878
1542
|
} else if (typeof relDef.polymorphic === "boolean") {
|
|
1879
1543
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1880
|
-
throw new
|
|
1544
|
+
throw new InvalidArgumentError(
|
|
1881
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.',
|
|
1882
1546
|
relName,
|
|
1883
1547
|
modelName,
|
|
1884
1548
|
relDef.foreignKey
|
|
1885
1549
|
);
|
|
1886
1550
|
if (!relDef.discriminator || typeof relDef.discriminator !== "string")
|
|
1887
|
-
throw new
|
|
1551
|
+
throw new InvalidArgumentError(
|
|
1888
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.',
|
|
1889
1553
|
relName,
|
|
1890
1554
|
modelName,
|
|
1891
1555
|
relDef.discriminator
|
|
1892
1556
|
);
|
|
1893
1557
|
} else {
|
|
1894
|
-
throw new
|
|
1558
|
+
throw new InvalidArgumentError(
|
|
1895
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.',
|
|
1896
1560
|
relName,
|
|
1897
1561
|
modelName,
|
|
@@ -1900,14 +1564,14 @@ var init_relations_definition_validator = __esm({
|
|
|
1900
1564
|
}
|
|
1901
1565
|
} else {
|
|
1902
1566
|
if (!relDef.foreignKey || typeof relDef.foreignKey !== "string")
|
|
1903
|
-
throw new
|
|
1567
|
+
throw new InvalidArgumentError(
|
|
1904
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.',
|
|
1905
1569
|
relName,
|
|
1906
1570
|
modelName,
|
|
1907
1571
|
relDef.foreignKey
|
|
1908
1572
|
);
|
|
1909
1573
|
if (relDef.discriminator)
|
|
1910
|
-
throw new
|
|
1574
|
+
throw new InvalidArgumentError(
|
|
1911
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.',
|
|
1912
1576
|
relName,
|
|
1913
1577
|
modelName
|
|
@@ -1934,27 +1598,29 @@ var init_relations_definition_validator = __esm({
|
|
|
1934
1598
|
_validateReferencesMany(modelName, relName, relDef) {
|
|
1935
1599
|
if (relDef.type !== RelationType.REFERENCES_MANY) return;
|
|
1936
1600
|
if (!relDef.model || typeof relDef.model !== "string")
|
|
1937
|
-
throw new
|
|
1601
|
+
throw new InvalidArgumentError(
|
|
1938
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.',
|
|
1939
1603
|
relName,
|
|
1940
1604
|
modelName,
|
|
1941
1605
|
relDef.model
|
|
1942
1606
|
);
|
|
1943
1607
|
if (relDef.foreignKey && typeof relDef.foreignKey !== "string")
|
|
1944
|
-
throw new
|
|
1608
|
+
throw new InvalidArgumentError(
|
|
1945
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.',
|
|
1946
1610
|
relName,
|
|
1947
1611
|
modelName,
|
|
1948
1612
|
relDef.foreignKey
|
|
1949
1613
|
);
|
|
1950
1614
|
if (relDef.discriminator)
|
|
1951
|
-
throw new
|
|
1615
|
+
throw new InvalidArgumentError(
|
|
1952
1616
|
'The relation %v of the model %v has the type "referencesMany", so it should not have the option "discriminator" to be provided.',
|
|
1953
1617
|
relName,
|
|
1954
1618
|
modelName
|
|
1955
1619
|
);
|
|
1956
1620
|
}
|
|
1957
1621
|
};
|
|
1622
|
+
__name(_RelationsDefinitionValidator, "RelationsDefinitionValidator");
|
|
1623
|
+
RelationsDefinitionValidator = _RelationsDefinitionValidator;
|
|
1958
1624
|
}
|
|
1959
1625
|
});
|
|
1960
1626
|
|
|
@@ -2005,15 +1671,15 @@ var init_property_uniqueness = __esm({
|
|
|
2005
1671
|
});
|
|
2006
1672
|
|
|
2007
1673
|
// src/definition/model/properties/empty-values-definer.js
|
|
2008
|
-
var EmptyValuesDefiner;
|
|
1674
|
+
var import_js_service6, _EmptyValuesDefiner, EmptyValuesDefiner;
|
|
2009
1675
|
var init_empty_values_definer = __esm({
|
|
2010
1676
|
"src/definition/model/properties/empty-values-definer.js"() {
|
|
2011
1677
|
"use strict";
|
|
2012
1678
|
init_data_type();
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
1679
|
+
import_js_service6 = require("@e22m4u/js-service");
|
|
1680
|
+
init_utils();
|
|
1681
|
+
init_errors();
|
|
1682
|
+
_EmptyValuesDefiner = class _EmptyValuesDefiner extends import_js_service6.Service {
|
|
2017
1683
|
/**
|
|
2018
1684
|
* Empty values map.
|
|
2019
1685
|
*
|
|
@@ -2036,13 +1702,13 @@ var init_empty_values_definer = __esm({
|
|
|
2036
1702
|
*/
|
|
2037
1703
|
setEmptyValuesOf(dataType, emptyValues) {
|
|
2038
1704
|
if (!Object.values(DataType).includes(dataType))
|
|
2039
|
-
throw new
|
|
1705
|
+
throw new InvalidArgumentError(
|
|
2040
1706
|
'The argument "dataType" of the EmptyValuesDefiner.setEmptyValuesOf must be one of data types: %l, but %v given.',
|
|
2041
1707
|
Object.values(DataType),
|
|
2042
1708
|
dataType
|
|
2043
1709
|
);
|
|
2044
1710
|
if (!Array.isArray(emptyValues))
|
|
2045
|
-
throw new
|
|
1711
|
+
throw new InvalidArgumentError(
|
|
2046
1712
|
'The argument "emptyValues" of the EmptyValuesDefiner.setEmptyValuesOf must be an Array, but %v given.',
|
|
2047
1713
|
emptyValues
|
|
2048
1714
|
);
|
|
@@ -2058,7 +1724,7 @@ var init_empty_values_definer = __esm({
|
|
|
2058
1724
|
*/
|
|
2059
1725
|
isEmpty(dataType, value) {
|
|
2060
1726
|
if (!Object.values(DataType).includes(dataType))
|
|
2061
|
-
throw new
|
|
1727
|
+
throw new InvalidArgumentError(
|
|
2062
1728
|
'The argument "dataType" of the EmptyValuesDefiner.isEmpty must be one of data types: %l, but %v given.',
|
|
2063
1729
|
Object.values(DataType),
|
|
2064
1730
|
dataType
|
|
@@ -2066,6 +1732,8 @@ var init_empty_values_definer = __esm({
|
|
|
2066
1732
|
return this._emptyValuesMap.get(dataType).some((v) => isDeepEqual(v, value));
|
|
2067
1733
|
}
|
|
2068
1734
|
};
|
|
1735
|
+
__name(_EmptyValuesDefiner, "EmptyValuesDefiner");
|
|
1736
|
+
EmptyValuesDefiner = _EmptyValuesDefiner;
|
|
2069
1737
|
}
|
|
2070
1738
|
});
|
|
2071
1739
|
|
|
@@ -2080,7 +1748,7 @@ var init_property_validator = __esm({
|
|
|
2080
1748
|
function regexpValidator(value, options, context) {
|
|
2081
1749
|
if (value == null || options === false) return true;
|
|
2082
1750
|
if (typeof options !== "string" && !(options instanceof RegExp))
|
|
2083
|
-
throw new
|
|
1751
|
+
throw new InvalidArgumentError(
|
|
2084
1752
|
'The validator %v requires the "options" argument as a String or RegExp, but %v given.',
|
|
2085
1753
|
context.validatorName,
|
|
2086
1754
|
options
|
|
@@ -2089,7 +1757,7 @@ function regexpValidator(value, options, context) {
|
|
|
2089
1757
|
const regexp = stringToRegexp(options);
|
|
2090
1758
|
return regexp.test(value);
|
|
2091
1759
|
}
|
|
2092
|
-
throw new
|
|
1760
|
+
throw new InvalidArgumentError(
|
|
2093
1761
|
"The property validator %v requires a String value, but %v given.",
|
|
2094
1762
|
context.validatorName,
|
|
2095
1763
|
value
|
|
@@ -2098,8 +1766,9 @@ function regexpValidator(value, options, context) {
|
|
|
2098
1766
|
var init_regexp_validator = __esm({
|
|
2099
1767
|
"src/definition/model/properties/property-validator/builtin/regexp-validator.js"() {
|
|
2100
1768
|
"use strict";
|
|
2101
|
-
|
|
2102
|
-
|
|
1769
|
+
init_utils();
|
|
1770
|
+
init_errors();
|
|
1771
|
+
__name(regexpValidator, "regexpValidator");
|
|
2103
1772
|
}
|
|
2104
1773
|
});
|
|
2105
1774
|
|
|
@@ -2107,14 +1776,14 @@ var init_regexp_validator = __esm({
|
|
|
2107
1776
|
function maxLengthValidator(value, options, context) {
|
|
2108
1777
|
if (value == null || options === false) return true;
|
|
2109
1778
|
if (typeof options !== "number")
|
|
2110
|
-
throw new
|
|
1779
|
+
throw new InvalidArgumentError(
|
|
2111
1780
|
'The validator %v requires the "options" argument as a Number, but %v given.',
|
|
2112
1781
|
context.validatorName,
|
|
2113
1782
|
options
|
|
2114
1783
|
);
|
|
2115
1784
|
if (typeof value === "string" || Array.isArray(value))
|
|
2116
1785
|
return value.length <= options;
|
|
2117
|
-
throw new
|
|
1786
|
+
throw new InvalidArgumentError(
|
|
2118
1787
|
"The property validator %v requires a String or an Array value, but %v given.",
|
|
2119
1788
|
context.validatorName,
|
|
2120
1789
|
value
|
|
@@ -2123,7 +1792,8 @@ function maxLengthValidator(value, options, context) {
|
|
|
2123
1792
|
var init_max_length_validator = __esm({
|
|
2124
1793
|
"src/definition/model/properties/property-validator/builtin/max-length-validator.js"() {
|
|
2125
1794
|
"use strict";
|
|
2126
|
-
|
|
1795
|
+
init_errors();
|
|
1796
|
+
__name(maxLengthValidator, "maxLengthValidator");
|
|
2127
1797
|
}
|
|
2128
1798
|
});
|
|
2129
1799
|
|
|
@@ -2131,14 +1801,14 @@ var init_max_length_validator = __esm({
|
|
|
2131
1801
|
function minLengthValidator(value, options, context) {
|
|
2132
1802
|
if (value == null || options === false) return true;
|
|
2133
1803
|
if (typeof options !== "number")
|
|
2134
|
-
throw new
|
|
1804
|
+
throw new InvalidArgumentError(
|
|
2135
1805
|
'The validator %v requires the "options" argument as a Number, but %v given.',
|
|
2136
1806
|
context.validatorName,
|
|
2137
1807
|
options
|
|
2138
1808
|
);
|
|
2139
1809
|
if (typeof value === "string" || Array.isArray(value))
|
|
2140
1810
|
return value.length >= options;
|
|
2141
|
-
throw new
|
|
1811
|
+
throw new InvalidArgumentError(
|
|
2142
1812
|
"The property validator %v requires a String or an Array value, but %v given.",
|
|
2143
1813
|
context.validatorName,
|
|
2144
1814
|
value
|
|
@@ -2147,7 +1817,8 @@ function minLengthValidator(value, options, context) {
|
|
|
2147
1817
|
var init_min_length_validator = __esm({
|
|
2148
1818
|
"src/definition/model/properties/property-validator/builtin/min-length-validator.js"() {
|
|
2149
1819
|
"use strict";
|
|
2150
|
-
|
|
1820
|
+
init_errors();
|
|
1821
|
+
__name(minLengthValidator, "minLengthValidator");
|
|
2151
1822
|
}
|
|
2152
1823
|
});
|
|
2153
1824
|
|
|
@@ -2162,16 +1833,16 @@ var init_builtin = __esm({
|
|
|
2162
1833
|
});
|
|
2163
1834
|
|
|
2164
1835
|
// src/definition/model/properties/property-validator/property-validator-registry.js
|
|
2165
|
-
var PropertyValidatorRegistry;
|
|
1836
|
+
var import_js_service7, _PropertyValidatorRegistry, PropertyValidatorRegistry;
|
|
2166
1837
|
var init_property_validator_registry = __esm({
|
|
2167
1838
|
"src/definition/model/properties/property-validator/property-validator-registry.js"() {
|
|
2168
1839
|
"use strict";
|
|
2169
|
-
|
|
1840
|
+
import_js_service7 = require("@e22m4u/js-service");
|
|
2170
1841
|
init_builtin();
|
|
2171
1842
|
init_builtin();
|
|
2172
1843
|
init_builtin();
|
|
2173
|
-
|
|
2174
|
-
|
|
1844
|
+
init_errors();
|
|
1845
|
+
_PropertyValidatorRegistry = class _PropertyValidatorRegistry extends import_js_service7.Service {
|
|
2175
1846
|
/**
|
|
2176
1847
|
* Validators.
|
|
2177
1848
|
*
|
|
@@ -2191,17 +1862,17 @@ var init_property_validator_registry = __esm({
|
|
|
2191
1862
|
*/
|
|
2192
1863
|
addValidator(name, validator) {
|
|
2193
1864
|
if (!name || typeof name !== "string")
|
|
2194
|
-
throw new
|
|
1865
|
+
throw new InvalidArgumentError(
|
|
2195
1866
|
"A name of the property validator must be a non-empty String, but %v given.",
|
|
2196
1867
|
name
|
|
2197
1868
|
);
|
|
2198
1869
|
if (name in this._validators)
|
|
2199
|
-
throw new
|
|
1870
|
+
throw new InvalidArgumentError(
|
|
2200
1871
|
"The property validator %v is already defined.",
|
|
2201
1872
|
name
|
|
2202
1873
|
);
|
|
2203
1874
|
if (typeof validator !== "function")
|
|
2204
|
-
throw new
|
|
1875
|
+
throw new InvalidArgumentError(
|
|
2205
1876
|
"The property validator %v must be a Function, but %v given.",
|
|
2206
1877
|
name,
|
|
2207
1878
|
validator
|
|
@@ -2227,13 +1898,15 @@ var init_property_validator_registry = __esm({
|
|
|
2227
1898
|
getValidator(name) {
|
|
2228
1899
|
const validator = this._validators[name];
|
|
2229
1900
|
if (!validator)
|
|
2230
|
-
throw new
|
|
1901
|
+
throw new InvalidArgumentError(
|
|
2231
1902
|
"The property validator %v is not defined.",
|
|
2232
1903
|
name
|
|
2233
1904
|
);
|
|
2234
1905
|
return validator;
|
|
2235
1906
|
}
|
|
2236
1907
|
};
|
|
1908
|
+
__name(_PropertyValidatorRegistry, "PropertyValidatorRegistry");
|
|
1909
|
+
PropertyValidatorRegistry = _PropertyValidatorRegistry;
|
|
2237
1910
|
}
|
|
2238
1911
|
});
|
|
2239
1912
|
|
|
@@ -2257,7 +1930,7 @@ var init_property_transformer = __esm({
|
|
|
2257
1930
|
function trimTransformer(value, options, context) {
|
|
2258
1931
|
if (value == null) return value;
|
|
2259
1932
|
if (typeof value === "string") return value.trim();
|
|
2260
|
-
throw new
|
|
1933
|
+
throw new InvalidArgumentError(
|
|
2261
1934
|
"The property transformer %v requires a String value, but %v given.",
|
|
2262
1935
|
context.transformerName,
|
|
2263
1936
|
value
|
|
@@ -2266,7 +1939,8 @@ function trimTransformer(value, options, context) {
|
|
|
2266
1939
|
var init_trim_transformer = __esm({
|
|
2267
1940
|
"src/definition/model/properties/property-transformer/builtin/trim-transformer.js"() {
|
|
2268
1941
|
"use strict";
|
|
2269
|
-
|
|
1942
|
+
init_errors();
|
|
1943
|
+
__name(trimTransformer, "trimTransformer");
|
|
2270
1944
|
}
|
|
2271
1945
|
});
|
|
2272
1946
|
|
|
@@ -2274,7 +1948,7 @@ var init_trim_transformer = __esm({
|
|
|
2274
1948
|
function toLowerCaseTransformer(value, options, context) {
|
|
2275
1949
|
if (value == null) return value;
|
|
2276
1950
|
if (typeof value === "string") return value.toLowerCase();
|
|
2277
|
-
throw new
|
|
1951
|
+
throw new InvalidArgumentError(
|
|
2278
1952
|
"The property transformer %v requires a String value, but %v given.",
|
|
2279
1953
|
context.transformerName,
|
|
2280
1954
|
value
|
|
@@ -2283,7 +1957,8 @@ function toLowerCaseTransformer(value, options, context) {
|
|
|
2283
1957
|
var init_to_lower_case_transformer = __esm({
|
|
2284
1958
|
"src/definition/model/properties/property-transformer/builtin/to-lower-case-transformer.js"() {
|
|
2285
1959
|
"use strict";
|
|
2286
|
-
|
|
1960
|
+
init_errors();
|
|
1961
|
+
__name(toLowerCaseTransformer, "toLowerCaseTransformer");
|
|
2287
1962
|
}
|
|
2288
1963
|
});
|
|
2289
1964
|
|
|
@@ -2291,7 +1966,7 @@ var init_to_lower_case_transformer = __esm({
|
|
|
2291
1966
|
function toUpperCaseTransformer(value, options, context) {
|
|
2292
1967
|
if (value == null) return value;
|
|
2293
1968
|
if (typeof value === "string") return value.toUpperCase();
|
|
2294
|
-
throw new
|
|
1969
|
+
throw new InvalidArgumentError(
|
|
2295
1970
|
"The property transformer %v requires a String value, but %v given.",
|
|
2296
1971
|
context.transformerName,
|
|
2297
1972
|
value
|
|
@@ -2300,7 +1975,8 @@ function toUpperCaseTransformer(value, options, context) {
|
|
|
2300
1975
|
var init_to_upper_case_transformer = __esm({
|
|
2301
1976
|
"src/definition/model/properties/property-transformer/builtin/to-upper-case-transformer.js"() {
|
|
2302
1977
|
"use strict";
|
|
2303
|
-
|
|
1978
|
+
init_errors();
|
|
1979
|
+
__name(toUpperCaseTransformer, "toUpperCaseTransformer");
|
|
2304
1980
|
}
|
|
2305
1981
|
});
|
|
2306
1982
|
|
|
@@ -2311,7 +1987,7 @@ function toTitleCaseTransformer(value, options, context) {
|
|
|
2311
1987
|
return value.replace(new RegExp("\\p{L}\\S*", "gu"), (text) => {
|
|
2312
1988
|
return text.charAt(0).toUpperCase() + text.substring(1).toLowerCase();
|
|
2313
1989
|
});
|
|
2314
|
-
throw new
|
|
1990
|
+
throw new InvalidArgumentError(
|
|
2315
1991
|
"The property transformer %v requires a String value, but %v given.",
|
|
2316
1992
|
context.transformerName,
|
|
2317
1993
|
value
|
|
@@ -2320,7 +1996,8 @@ function toTitleCaseTransformer(value, options, context) {
|
|
|
2320
1996
|
var init_to_title_case_transformer = __esm({
|
|
2321
1997
|
"src/definition/model/properties/property-transformer/builtin/to-title-case-transformer.js"() {
|
|
2322
1998
|
"use strict";
|
|
2323
|
-
|
|
1999
|
+
init_errors();
|
|
2000
|
+
__name(toTitleCaseTransformer, "toTitleCaseTransformer");
|
|
2324
2001
|
}
|
|
2325
2002
|
});
|
|
2326
2003
|
|
|
@@ -2336,17 +2013,17 @@ var init_builtin2 = __esm({
|
|
|
2336
2013
|
});
|
|
2337
2014
|
|
|
2338
2015
|
// src/definition/model/properties/property-transformer/property-transformer-registry.js
|
|
2339
|
-
var PropertyTransformerRegistry;
|
|
2016
|
+
var import_js_service8, _PropertyTransformerRegistry, PropertyTransformerRegistry;
|
|
2340
2017
|
var init_property_transformer_registry = __esm({
|
|
2341
2018
|
"src/definition/model/properties/property-transformer/property-transformer-registry.js"() {
|
|
2342
2019
|
"use strict";
|
|
2343
|
-
|
|
2020
|
+
import_js_service8 = require("@e22m4u/js-service");
|
|
2344
2021
|
init_builtin2();
|
|
2345
2022
|
init_builtin2();
|
|
2346
2023
|
init_builtin2();
|
|
2347
2024
|
init_builtin2();
|
|
2348
|
-
|
|
2349
|
-
|
|
2025
|
+
init_errors();
|
|
2026
|
+
_PropertyTransformerRegistry = class _PropertyTransformerRegistry extends import_js_service8.Service {
|
|
2350
2027
|
/**
|
|
2351
2028
|
* Transformers.
|
|
2352
2029
|
*
|
|
@@ -2367,17 +2044,17 @@ var init_property_transformer_registry = __esm({
|
|
|
2367
2044
|
*/
|
|
2368
2045
|
addTransformer(name, transformer) {
|
|
2369
2046
|
if (!name || typeof name !== "string")
|
|
2370
|
-
throw new
|
|
2047
|
+
throw new InvalidArgumentError(
|
|
2371
2048
|
"A name of the property transformer must be a non-empty String, but %v given.",
|
|
2372
2049
|
name
|
|
2373
2050
|
);
|
|
2374
2051
|
if (name in this._transformers)
|
|
2375
|
-
throw new
|
|
2052
|
+
throw new InvalidArgumentError(
|
|
2376
2053
|
"The property transformer %v is already defined.",
|
|
2377
2054
|
name
|
|
2378
2055
|
);
|
|
2379
2056
|
if (typeof transformer !== "function")
|
|
2380
|
-
throw new
|
|
2057
|
+
throw new InvalidArgumentError(
|
|
2381
2058
|
"The property transformer %v must be a Function, but %v given.",
|
|
2382
2059
|
name,
|
|
2383
2060
|
transformer
|
|
@@ -2403,13 +2080,15 @@ var init_property_transformer_registry = __esm({
|
|
|
2403
2080
|
getTransformer(name) {
|
|
2404
2081
|
const transformer = this._transformers[name];
|
|
2405
2082
|
if (!transformer)
|
|
2406
|
-
throw new
|
|
2083
|
+
throw new InvalidArgumentError(
|
|
2407
2084
|
"The property transformer %v is not defined.",
|
|
2408
2085
|
name
|
|
2409
2086
|
);
|
|
2410
2087
|
return transformer;
|
|
2411
2088
|
}
|
|
2412
2089
|
};
|
|
2090
|
+
__name(_PropertyTransformerRegistry, "PropertyTransformerRegistry");
|
|
2091
|
+
PropertyTransformerRegistry = _PropertyTransformerRegistry;
|
|
2413
2092
|
}
|
|
2414
2093
|
});
|
|
2415
2094
|
|
|
@@ -2423,15 +2102,15 @@ var init_property_transformer2 = __esm({
|
|
|
2423
2102
|
});
|
|
2424
2103
|
|
|
2425
2104
|
// src/definition/definition-registry.js
|
|
2426
|
-
var DefinitionRegistry;
|
|
2105
|
+
var import_js_service9, _DefinitionRegistry, DefinitionRegistry;
|
|
2427
2106
|
var init_definition_registry = __esm({
|
|
2428
2107
|
"src/definition/definition-registry.js"() {
|
|
2429
2108
|
"use strict";
|
|
2430
|
-
|
|
2431
|
-
|
|
2109
|
+
import_js_service9 = require("@e22m4u/js-service");
|
|
2110
|
+
init_errors();
|
|
2432
2111
|
init_model();
|
|
2433
2112
|
init_definition();
|
|
2434
|
-
|
|
2113
|
+
_DefinitionRegistry = class _DefinitionRegistry extends import_js_service9.Service {
|
|
2435
2114
|
/**
|
|
2436
2115
|
* Datasources.
|
|
2437
2116
|
*
|
|
@@ -2453,7 +2132,7 @@ var init_definition_registry = __esm({
|
|
|
2453
2132
|
this.getService(DatasourceDefinitionValidator).validate(datasourceDef);
|
|
2454
2133
|
const name = datasourceDef.name;
|
|
2455
2134
|
if (name in this._datasources)
|
|
2456
|
-
throw new
|
|
2135
|
+
throw new InvalidArgumentError(
|
|
2457
2136
|
"The datasource %v is already defined.",
|
|
2458
2137
|
name
|
|
2459
2138
|
);
|
|
@@ -2477,7 +2156,7 @@ var init_definition_registry = __esm({
|
|
|
2477
2156
|
getDatasource(name) {
|
|
2478
2157
|
const datasourceDef = this._datasources[name];
|
|
2479
2158
|
if (!datasourceDef)
|
|
2480
|
-
throw new
|
|
2159
|
+
throw new InvalidArgumentError("The datasource %v is not defined.", name);
|
|
2481
2160
|
return datasourceDef;
|
|
2482
2161
|
}
|
|
2483
2162
|
/**
|
|
@@ -2489,7 +2168,7 @@ var init_definition_registry = __esm({
|
|
|
2489
2168
|
this.getService(ModelDefinitionValidator).validate(modelDef);
|
|
2490
2169
|
const name = modelDef.name;
|
|
2491
2170
|
if (name in this._models)
|
|
2492
|
-
throw new
|
|
2171
|
+
throw new InvalidArgumentError("The model %v is already defined.", name);
|
|
2493
2172
|
this._models[name] = modelDef;
|
|
2494
2173
|
}
|
|
2495
2174
|
/**
|
|
@@ -2510,27 +2189,29 @@ var init_definition_registry = __esm({
|
|
|
2510
2189
|
getModel(name) {
|
|
2511
2190
|
const modelDef = this._models[name];
|
|
2512
2191
|
if (!modelDef)
|
|
2513
|
-
throw new
|
|
2192
|
+
throw new InvalidArgumentError("The model %v is not defined.", name);
|
|
2514
2193
|
return modelDef;
|
|
2515
2194
|
}
|
|
2516
2195
|
};
|
|
2196
|
+
__name(_DefinitionRegistry, "DefinitionRegistry");
|
|
2197
|
+
DefinitionRegistry = _DefinitionRegistry;
|
|
2517
2198
|
}
|
|
2518
2199
|
});
|
|
2519
2200
|
|
|
2520
2201
|
// src/definition/model/model-definition-utils.js
|
|
2521
|
-
var DEFAULT_PRIMARY_KEY_PROPERTY_NAME, ModelDefinitionUtils;
|
|
2202
|
+
var import_js_service10, DEFAULT_PRIMARY_KEY_PROPERTY_NAME, _ModelDefinitionUtils, ModelDefinitionUtils;
|
|
2522
2203
|
var init_model_definition_utils = __esm({
|
|
2523
2204
|
"src/definition/model/model-definition-utils.js"() {
|
|
2524
2205
|
"use strict";
|
|
2525
|
-
|
|
2206
|
+
import_js_service10 = require("@e22m4u/js-service");
|
|
2526
2207
|
init_properties();
|
|
2527
|
-
|
|
2528
|
-
|
|
2208
|
+
init_utils();
|
|
2209
|
+
init_utils();
|
|
2529
2210
|
init_properties();
|
|
2530
|
-
|
|
2211
|
+
init_errors();
|
|
2531
2212
|
init_definition_registry();
|
|
2532
2213
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME = "id";
|
|
2533
|
-
|
|
2214
|
+
_ModelDefinitionUtils = class _ModelDefinitionUtils extends import_js_service10.Service {
|
|
2534
2215
|
/**
|
|
2535
2216
|
* Get primary key as property name.
|
|
2536
2217
|
*
|
|
@@ -2548,7 +2229,7 @@ var init_model_definition_utils = __esm({
|
|
|
2548
2229
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME
|
|
2549
2230
|
);
|
|
2550
2231
|
if (isDefaultPrimaryKeyAlreadyInUse)
|
|
2551
|
-
throw new
|
|
2232
|
+
throw new InvalidArgumentError(
|
|
2552
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.',
|
|
2553
2234
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME,
|
|
2554
2235
|
modelName
|
|
@@ -2569,7 +2250,7 @@ var init_model_definition_utils = __esm({
|
|
|
2569
2250
|
try {
|
|
2570
2251
|
pkColName = this.getColumnNameByPropertyName(modelName, pkPropName);
|
|
2571
2252
|
} catch (error) {
|
|
2572
|
-
if (!(error instanceof
|
|
2253
|
+
if (!(error instanceof InvalidArgumentError)) throw error;
|
|
2573
2254
|
}
|
|
2574
2255
|
if (pkColName === void 0) return pkPropName;
|
|
2575
2256
|
return pkColName;
|
|
@@ -2597,7 +2278,7 @@ var init_model_definition_utils = __esm({
|
|
|
2597
2278
|
const propDefs = this.getPropertiesDefinitionInBaseModelHierarchy(modelName);
|
|
2598
2279
|
const propDef = propDefs[propertyName];
|
|
2599
2280
|
if (!propDef)
|
|
2600
|
-
throw new
|
|
2281
|
+
throw new InvalidArgumentError(
|
|
2601
2282
|
"The model %v does not have the property %v.",
|
|
2602
2283
|
modelName,
|
|
2603
2284
|
propertyName
|
|
@@ -2617,7 +2298,7 @@ var init_model_definition_utils = __esm({
|
|
|
2617
2298
|
const propDefs = this.getPropertiesDefinitionInBaseModelHierarchy(modelName);
|
|
2618
2299
|
const propDef = propDefs[propertyName];
|
|
2619
2300
|
if (!propDef)
|
|
2620
|
-
throw new
|
|
2301
|
+
throw new InvalidArgumentError(
|
|
2621
2302
|
"The model %v does not have the property %v.",
|
|
2622
2303
|
modelName,
|
|
2623
2304
|
propertyName
|
|
@@ -2707,7 +2388,7 @@ var init_model_definition_utils = __esm({
|
|
|
2707
2388
|
if (!propDef) {
|
|
2708
2389
|
const pkPropName = this.getPrimaryKeyAsPropertyName(modelName);
|
|
2709
2390
|
if (pkPropName === propertyName) return DataType.ANY;
|
|
2710
|
-
throw new
|
|
2391
|
+
throw new InvalidArgumentError(
|
|
2711
2392
|
"The model %v does not have the property %v.",
|
|
2712
2393
|
modelName,
|
|
2713
2394
|
propertyName
|
|
@@ -2724,7 +2405,7 @@ var init_model_definition_utils = __esm({
|
|
|
2724
2405
|
*/
|
|
2725
2406
|
getDataTypeFromPropertyDefinition(propDef) {
|
|
2726
2407
|
if ((!propDef || typeof propDef !== "object") && !Object.values(DataType).includes(propDef)) {
|
|
2727
|
-
throw new
|
|
2408
|
+
throw new InvalidArgumentError(
|
|
2728
2409
|
'The argument "propDef" of the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should be an Object or the DataType enum, but %v given.',
|
|
2729
2410
|
propDef
|
|
2730
2411
|
);
|
|
@@ -2732,7 +2413,7 @@ var init_model_definition_utils = __esm({
|
|
|
2732
2413
|
if (typeof propDef === "string") return propDef;
|
|
2733
2414
|
const dataType = propDef.type;
|
|
2734
2415
|
if (!Object.values(DataType).includes(dataType))
|
|
2735
|
-
throw new
|
|
2416
|
+
throw new InvalidArgumentError(
|
|
2736
2417
|
'The given Object to the ModelDefinitionUtils.getDataTypeFromPropertyDefinition should have the "type" property with one of values: %l, but %v given.',
|
|
2737
2418
|
Object.values(DataType),
|
|
2738
2419
|
propDef.type
|
|
@@ -2780,9 +2461,9 @@ var init_model_definition_utils = __esm({
|
|
|
2780
2461
|
getPropertiesDefinitionInBaseModelHierarchy(modelName) {
|
|
2781
2462
|
let result = {};
|
|
2782
2463
|
let pkPropDefs = {};
|
|
2783
|
-
const recursion = (currModelName, prevModelName = void 0) => {
|
|
2464
|
+
const recursion = /* @__PURE__ */ __name((currModelName, prevModelName = void 0) => {
|
|
2784
2465
|
if (currModelName === prevModelName)
|
|
2785
|
-
throw new
|
|
2466
|
+
throw new InvalidArgumentError(
|
|
2786
2467
|
"The model %v has a circular inheritance.",
|
|
2787
2468
|
currModelName
|
|
2788
2469
|
);
|
|
@@ -2794,7 +2475,7 @@ var init_model_definition_utils = __esm({
|
|
|
2794
2475
|
result = { ...regularPropDefs, ...result };
|
|
2795
2476
|
const modelDef = this.getService(DefinitionRegistry).getModel(currModelName);
|
|
2796
2477
|
if (modelDef.base) recursion(modelDef.base, currModelName);
|
|
2797
|
-
};
|
|
2478
|
+
}, "recursion");
|
|
2798
2479
|
recursion(modelName);
|
|
2799
2480
|
return result;
|
|
2800
2481
|
}
|
|
@@ -2817,10 +2498,10 @@ var init_model_definition_utils = __esm({
|
|
|
2817
2498
|
*/
|
|
2818
2499
|
getRelationsDefinitionInBaseModelHierarchy(modelName) {
|
|
2819
2500
|
let result = {};
|
|
2820
|
-
const recursion = (currModelName, prevModelName = void 0) => {
|
|
2501
|
+
const recursion = /* @__PURE__ */ __name((currModelName, prevModelName = void 0) => {
|
|
2821
2502
|
var _a;
|
|
2822
2503
|
if (currModelName === prevModelName)
|
|
2823
|
-
throw new
|
|
2504
|
+
throw new InvalidArgumentError(
|
|
2824
2505
|
"The model %v has a circular inheritance.",
|
|
2825
2506
|
currModelName
|
|
2826
2507
|
);
|
|
@@ -2828,7 +2509,7 @@ var init_model_definition_utils = __esm({
|
|
|
2828
2509
|
const ownRelDefs = (_a = modelDef.relations) != null ? _a : {};
|
|
2829
2510
|
result = { ...ownRelDefs, ...result };
|
|
2830
2511
|
if (modelDef.base) recursion(modelDef.base, currModelName);
|
|
2831
|
-
};
|
|
2512
|
+
}, "recursion");
|
|
2832
2513
|
recursion(modelName);
|
|
2833
2514
|
return result;
|
|
2834
2515
|
}
|
|
@@ -2850,7 +2531,7 @@ var init_model_definition_utils = __esm({
|
|
|
2850
2531
|
}
|
|
2851
2532
|
}
|
|
2852
2533
|
if (!foundDef)
|
|
2853
|
-
throw new
|
|
2534
|
+
throw new InvalidArgumentError(
|
|
2854
2535
|
"The model %v does not have relation name %v.",
|
|
2855
2536
|
modelName,
|
|
2856
2537
|
relationName
|
|
@@ -2866,7 +2547,7 @@ var init_model_definition_utils = __esm({
|
|
|
2866
2547
|
*/
|
|
2867
2548
|
excludeObjectKeysByRelationNames(modelName, modelData) {
|
|
2868
2549
|
if (!modelData || typeof modelData !== "object" || Array.isArray(modelData))
|
|
2869
|
-
throw new
|
|
2550
|
+
throw new InvalidArgumentError(
|
|
2870
2551
|
"The second argument of ModelDefinitionUtils.excludeObjectKeysByRelationNames should be an Object, but %v given.",
|
|
2871
2552
|
modelData
|
|
2872
2553
|
);
|
|
@@ -2875,22 +2556,24 @@ var init_model_definition_utils = __esm({
|
|
|
2875
2556
|
return excludeObjectKeys(modelData, relNames);
|
|
2876
2557
|
}
|
|
2877
2558
|
};
|
|
2559
|
+
__name(_ModelDefinitionUtils, "ModelDefinitionUtils");
|
|
2560
|
+
ModelDefinitionUtils = _ModelDefinitionUtils;
|
|
2878
2561
|
}
|
|
2879
2562
|
});
|
|
2880
2563
|
|
|
2881
2564
|
// src/definition/model/properties/property-uniqueness-validator.js
|
|
2882
|
-
var PropertyUniquenessValidator;
|
|
2565
|
+
var import_js_service11, _PropertyUniquenessValidator, PropertyUniquenessValidator;
|
|
2883
2566
|
var init_property_uniqueness_validator = __esm({
|
|
2884
2567
|
"src/definition/model/properties/property-uniqueness-validator.js"() {
|
|
2885
2568
|
"use strict";
|
|
2886
2569
|
init_data_type();
|
|
2887
|
-
|
|
2888
|
-
|
|
2570
|
+
import_js_service11 = require("@e22m4u/js-service");
|
|
2571
|
+
init_utils();
|
|
2889
2572
|
init_property_uniqueness();
|
|
2890
2573
|
init_empty_values_definer();
|
|
2891
|
-
|
|
2574
|
+
init_errors();
|
|
2892
2575
|
init_model_definition_utils();
|
|
2893
|
-
|
|
2576
|
+
_PropertyUniquenessValidator = class _PropertyUniquenessValidator extends import_js_service11.Service {
|
|
2894
2577
|
/**
|
|
2895
2578
|
* Validate.
|
|
2896
2579
|
*
|
|
@@ -2903,22 +2586,22 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2903
2586
|
*/
|
|
2904
2587
|
async validate(countMethod, methodName, modelName, modelData, modelId = void 0) {
|
|
2905
2588
|
if (typeof countMethod !== "function")
|
|
2906
|
-
throw new
|
|
2589
|
+
throw new InvalidArgumentError(
|
|
2907
2590
|
'The parameter "countMethod" of the PropertyUniquenessValidator must be a Function, but %v given.',
|
|
2908
2591
|
countMethod
|
|
2909
2592
|
);
|
|
2910
2593
|
if (!methodName || typeof methodName !== "string")
|
|
2911
|
-
throw new
|
|
2594
|
+
throw new InvalidArgumentError(
|
|
2912
2595
|
'The parameter "methodName" of the PropertyUniquenessValidator must be a non-empty String, but %v given.',
|
|
2913
2596
|
methodName
|
|
2914
2597
|
);
|
|
2915
2598
|
if (!modelName || typeof modelName !== "string")
|
|
2916
|
-
throw new
|
|
2599
|
+
throw new InvalidArgumentError(
|
|
2917
2600
|
'The parameter "modelName" of the PropertyUniquenessValidator must be a non-empty String, but %v given.',
|
|
2918
2601
|
modelName
|
|
2919
2602
|
);
|
|
2920
2603
|
if (!isPureObject(modelData))
|
|
2921
|
-
throw new
|
|
2604
|
+
throw new InvalidArgumentError(
|
|
2922
2605
|
"The data of the model %v should be an Object, but %v given.",
|
|
2923
2606
|
modelName,
|
|
2924
2607
|
modelData
|
|
@@ -2931,12 +2614,12 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2931
2614
|
const idProp = this.getService(ModelDefinitionUtils).getPrimaryKeyAsPropertyName(
|
|
2932
2615
|
modelName
|
|
2933
2616
|
);
|
|
2934
|
-
const createError = (propName, propValue) => new
|
|
2617
|
+
const createError = /* @__PURE__ */ __name((propName, propValue) => new InvalidArgumentError(
|
|
2935
2618
|
"An existing document of the model %v already has the property %v with the value %v and should be unique.",
|
|
2936
2619
|
modelName,
|
|
2937
2620
|
propName,
|
|
2938
2621
|
propValue
|
|
2939
|
-
);
|
|
2622
|
+
), "createError");
|
|
2940
2623
|
let willBeReplaced = void 0;
|
|
2941
2624
|
const emptyValuesDefiner = this.getService(EmptyValuesDefiner);
|
|
2942
2625
|
for (const propName of propNames) {
|
|
@@ -2985,7 +2668,7 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2985
2668
|
});
|
|
2986
2669
|
if (count > 0) throw createError(propName, propValue);
|
|
2987
2670
|
} else {
|
|
2988
|
-
throw new
|
|
2671
|
+
throw new InvalidArgumentError(
|
|
2989
2672
|
"The PropertyUniquenessValidator does not support the adapter method %v.",
|
|
2990
2673
|
methodName
|
|
2991
2674
|
);
|
|
@@ -2993,18 +2676,20 @@ var init_property_uniqueness_validator = __esm({
|
|
|
2993
2676
|
}
|
|
2994
2677
|
}
|
|
2995
2678
|
};
|
|
2679
|
+
__name(_PropertyUniquenessValidator, "PropertyUniquenessValidator");
|
|
2680
|
+
PropertyUniquenessValidator = _PropertyUniquenessValidator;
|
|
2996
2681
|
}
|
|
2997
2682
|
});
|
|
2998
2683
|
|
|
2999
2684
|
// src/definition/model/properties/primary-keys-definition-validator.js
|
|
3000
|
-
var PrimaryKeysDefinitionValidator;
|
|
2685
|
+
var import_js_service12, _PrimaryKeysDefinitionValidator, PrimaryKeysDefinitionValidator;
|
|
3001
2686
|
var init_primary_keys_definition_validator = __esm({
|
|
3002
2687
|
"src/definition/model/properties/primary-keys-definition-validator.js"() {
|
|
3003
2688
|
"use strict";
|
|
3004
|
-
|
|
3005
|
-
|
|
2689
|
+
import_js_service12 = require("@e22m4u/js-service");
|
|
2690
|
+
init_errors();
|
|
3006
2691
|
init_model_definition_utils();
|
|
3007
|
-
|
|
2692
|
+
_PrimaryKeysDefinitionValidator = class _PrimaryKeysDefinitionValidator extends import_js_service12.Service {
|
|
3008
2693
|
/**
|
|
3009
2694
|
* Validate.
|
|
3010
2695
|
*
|
|
@@ -3019,7 +2704,7 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3019
2704
|
if (propNames.length < 1) {
|
|
3020
2705
|
const isDefaultPrimaryKeyAlreadyInUse = Object.keys(propDefs).includes(DEFAULT_PRIMARY_KEY_PROPERTY_NAME);
|
|
3021
2706
|
if (isDefaultPrimaryKeyAlreadyInUse)
|
|
3022
|
-
throw new
|
|
2707
|
+
throw new InvalidArgumentError(
|
|
3023
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.',
|
|
3024
2709
|
DEFAULT_PRIMARY_KEY_PROPERTY_NAME,
|
|
3025
2710
|
modelName
|
|
@@ -3027,7 +2712,7 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3027
2712
|
return;
|
|
3028
2713
|
}
|
|
3029
2714
|
if (propNames.length > 1)
|
|
3030
|
-
throw new
|
|
2715
|
+
throw new InvalidArgumentError(
|
|
3031
2716
|
"The model definition %v should not have multiple primary keys, but %v keys given.",
|
|
3032
2717
|
modelName,
|
|
3033
2718
|
propNames.length
|
|
@@ -3035,7 +2720,7 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3035
2720
|
const pkPropName = propNames[0];
|
|
3036
2721
|
const pkPropDef = propDefs[pkPropName];
|
|
3037
2722
|
if (pkPropDef && typeof pkPropDef === "object" && pkPropDef.default !== void 0) {
|
|
3038
|
-
throw new
|
|
2723
|
+
throw new InvalidArgumentError(
|
|
3039
2724
|
"Do not specify a default value for the primary key %v of the model %v.",
|
|
3040
2725
|
pkPropName,
|
|
3041
2726
|
modelName
|
|
@@ -3043,23 +2728,25 @@ var init_primary_keys_definition_validator = __esm({
|
|
|
3043
2728
|
}
|
|
3044
2729
|
}
|
|
3045
2730
|
};
|
|
2731
|
+
__name(_PrimaryKeysDefinitionValidator, "PrimaryKeysDefinitionValidator");
|
|
2732
|
+
PrimaryKeysDefinitionValidator = _PrimaryKeysDefinitionValidator;
|
|
3046
2733
|
}
|
|
3047
2734
|
});
|
|
3048
2735
|
|
|
3049
2736
|
// src/definition/model/properties/properties-definition-validator.js
|
|
3050
|
-
var PropertiesDefinitionValidator;
|
|
2737
|
+
var import_js_service13, _PropertiesDefinitionValidator, PropertiesDefinitionValidator;
|
|
3051
2738
|
var init_properties_definition_validator = __esm({
|
|
3052
2739
|
"src/definition/model/properties/properties-definition-validator.js"() {
|
|
3053
2740
|
"use strict";
|
|
3054
|
-
|
|
2741
|
+
import_js_service13 = require("@e22m4u/js-service");
|
|
3055
2742
|
init_data_type();
|
|
3056
|
-
|
|
2743
|
+
init_utils();
|
|
3057
2744
|
init_property_uniqueness();
|
|
3058
|
-
|
|
2745
|
+
init_errors();
|
|
3059
2746
|
init_property_validator2();
|
|
3060
2747
|
init_property_transformer2();
|
|
3061
2748
|
init_primary_keys_definition_validator();
|
|
3062
|
-
|
|
2749
|
+
_PropertiesDefinitionValidator = class _PropertiesDefinitionValidator extends import_js_service13.Service {
|
|
3063
2750
|
/**
|
|
3064
2751
|
* Validate.
|
|
3065
2752
|
*
|
|
@@ -3068,12 +2755,12 @@ var init_properties_definition_validator = __esm({
|
|
|
3068
2755
|
*/
|
|
3069
2756
|
validate(modelName, propDefs) {
|
|
3070
2757
|
if (!modelName || typeof modelName !== "string")
|
|
3071
|
-
throw new
|
|
2758
|
+
throw new InvalidArgumentError(
|
|
3072
2759
|
"The first argument of PropertiesDefinitionValidator.validate should be a non-empty String, but %v given.",
|
|
3073
2760
|
modelName
|
|
3074
2761
|
);
|
|
3075
2762
|
if (!propDefs || typeof propDefs !== "object" || Array.isArray(propDefs)) {
|
|
3076
|
-
throw new
|
|
2763
|
+
throw new InvalidArgumentError(
|
|
3077
2764
|
'The provided option "properties" of the model %v should be an Object, but %v given.',
|
|
3078
2765
|
modelName,
|
|
3079
2766
|
propDefs
|
|
@@ -3098,18 +2785,18 @@ var init_properties_definition_validator = __esm({
|
|
|
3098
2785
|
*/
|
|
3099
2786
|
_validateProperty(modelName, propName, propDef) {
|
|
3100
2787
|
if (!modelName || typeof modelName !== "string")
|
|
3101
|
-
throw new
|
|
2788
|
+
throw new InvalidArgumentError(
|
|
3102
2789
|
"The first argument of PropertiesDefinitionValidator._validateProperty should be a non-empty String, but %v given.",
|
|
3103
2790
|
modelName
|
|
3104
2791
|
);
|
|
3105
2792
|
if (!propName || typeof propName !== "string")
|
|
3106
|
-
throw new
|
|
2793
|
+
throw new InvalidArgumentError(
|
|
3107
2794
|
"The property name of the model %v should be a non-empty String, but %v given.",
|
|
3108
2795
|
modelName,
|
|
3109
2796
|
propName
|
|
3110
2797
|
);
|
|
3111
2798
|
if (!propDef)
|
|
3112
|
-
throw new
|
|
2799
|
+
throw new InvalidArgumentError(
|
|
3113
2800
|
"The property %v of the model %v should have a property definition, but %v given.",
|
|
3114
2801
|
propName,
|
|
3115
2802
|
modelName,
|
|
@@ -3117,7 +2804,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3117
2804
|
);
|
|
3118
2805
|
if (typeof propDef === "string") {
|
|
3119
2806
|
if (!Object.values(DataType).includes(propDef))
|
|
3120
|
-
throw new
|
|
2807
|
+
throw new InvalidArgumentError(
|
|
3121
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.",
|
|
3122
2809
|
propName,
|
|
3123
2810
|
modelName,
|
|
@@ -3127,7 +2814,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3127
2814
|
return;
|
|
3128
2815
|
}
|
|
3129
2816
|
if (!propDef || typeof propDef !== "object" || Array.isArray(propDef)) {
|
|
3130
|
-
throw new
|
|
2817
|
+
throw new InvalidArgumentError(
|
|
3131
2818
|
"In case of a full property definition, the property %v of the model %v should be an Object, but %v given.",
|
|
3132
2819
|
propName,
|
|
3133
2820
|
modelName,
|
|
@@ -3135,7 +2822,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3135
2822
|
);
|
|
3136
2823
|
}
|
|
3137
2824
|
if (!propDef.type || !Object.values(DataType).includes(propDef.type))
|
|
3138
|
-
throw new
|
|
2825
|
+
throw new InvalidArgumentError(
|
|
3139
2826
|
'The property %v of the model %v requires the option "type" to have one of data types: %l, but %v given.',
|
|
3140
2827
|
propName,
|
|
3141
2828
|
modelName,
|
|
@@ -3143,7 +2830,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3143
2830
|
propDef.type
|
|
3144
2831
|
);
|
|
3145
2832
|
if (propDef.itemType && !Object.values(DataType).includes(propDef.itemType)) {
|
|
3146
|
-
throw new
|
|
2833
|
+
throw new InvalidArgumentError(
|
|
3147
2834
|
'The provided option "itemType" of the property %v in the model %v should have one of data types: %l, but %v given.',
|
|
3148
2835
|
propName,
|
|
3149
2836
|
modelName,
|
|
@@ -3152,60 +2839,60 @@ var init_properties_definition_validator = __esm({
|
|
|
3152
2839
|
);
|
|
3153
2840
|
}
|
|
3154
2841
|
if (propDef.model && typeof propDef.model !== "string")
|
|
3155
|
-
throw new
|
|
2842
|
+
throw new InvalidArgumentError(
|
|
3156
2843
|
'The provided option "model" of the property %v in the model %v should be a String, but %v given.',
|
|
3157
2844
|
propName,
|
|
3158
2845
|
modelName,
|
|
3159
2846
|
propDef.model
|
|
3160
2847
|
);
|
|
3161
2848
|
if (propDef.primaryKey && typeof propDef.primaryKey !== "boolean")
|
|
3162
|
-
throw new
|
|
2849
|
+
throw new InvalidArgumentError(
|
|
3163
2850
|
'The provided option "primaryKey" of the property %v in the model %v should be a Boolean, but %v given.',
|
|
3164
2851
|
propName,
|
|
3165
2852
|
modelName,
|
|
3166
2853
|
propDef.primaryKey
|
|
3167
2854
|
);
|
|
3168
2855
|
if (propDef.columnName && typeof propDef.columnName !== "string")
|
|
3169
|
-
throw new
|
|
2856
|
+
throw new InvalidArgumentError(
|
|
3170
2857
|
'The provided option "columnName" of the property %v in the model %v should be a String, but %v given.',
|
|
3171
2858
|
propName,
|
|
3172
2859
|
modelName,
|
|
3173
2860
|
propDef.columnName
|
|
3174
2861
|
);
|
|
3175
2862
|
if (propDef.columnType && typeof propDef.columnType !== "string")
|
|
3176
|
-
throw new
|
|
2863
|
+
throw new InvalidArgumentError(
|
|
3177
2864
|
'The provided option "columnType" of the property %v in the model %v should be a String, but %v given.',
|
|
3178
2865
|
propName,
|
|
3179
2866
|
modelName,
|
|
3180
2867
|
propDef.columnType
|
|
3181
2868
|
);
|
|
3182
2869
|
if (propDef.required && typeof propDef.required !== "boolean")
|
|
3183
|
-
throw new
|
|
2870
|
+
throw new InvalidArgumentError(
|
|
3184
2871
|
'The provided option "required" of the property %v in the model %v should be a Boolean, but %v given.',
|
|
3185
2872
|
propName,
|
|
3186
2873
|
modelName,
|
|
3187
2874
|
propDef.required
|
|
3188
2875
|
);
|
|
3189
2876
|
if (propDef.required && propDef.default !== void 0)
|
|
3190
|
-
throw new
|
|
2877
|
+
throw new InvalidArgumentError(
|
|
3191
2878
|
'The property %v of the model %v is a required property, so it should not have the option "default" to be provided.',
|
|
3192
2879
|
propName,
|
|
3193
2880
|
modelName
|
|
3194
2881
|
);
|
|
3195
2882
|
if (propDef.primaryKey && propDef.required)
|
|
3196
|
-
throw new
|
|
2883
|
+
throw new InvalidArgumentError(
|
|
3197
2884
|
'The property %v of the model %v is a primary key, so it should not have the option "required" to be provided.',
|
|
3198
2885
|
propName,
|
|
3199
2886
|
modelName
|
|
3200
2887
|
);
|
|
3201
2888
|
if (propDef.primaryKey && propDef.default !== void 0)
|
|
3202
|
-
throw new
|
|
2889
|
+
throw new InvalidArgumentError(
|
|
3203
2890
|
'The property %v of the model %v is a primary key, so it should not have the option "default" to be provided.',
|
|
3204
2891
|
propName,
|
|
3205
2892
|
modelName
|
|
3206
2893
|
);
|
|
3207
2894
|
if (propDef.itemType && propDef.type !== DataType.ARRAY)
|
|
3208
|
-
throw new
|
|
2895
|
+
throw new InvalidArgumentError(
|
|
3209
2896
|
'The property %v of the model %v has the non-array type, so it should not have the option "itemType" to be provided.',
|
|
3210
2897
|
propName,
|
|
3211
2898
|
modelName,
|
|
@@ -3213,14 +2900,14 @@ var init_properties_definition_validator = __esm({
|
|
|
3213
2900
|
);
|
|
3214
2901
|
if (propDef.model && propDef.type !== DataType.OBJECT && propDef.itemType !== DataType.OBJECT) {
|
|
3215
2902
|
if (propDef.type !== DataType.ARRAY) {
|
|
3216
|
-
throw new
|
|
2903
|
+
throw new InvalidArgumentError(
|
|
3217
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.',
|
|
3218
2905
|
capitalize(propDef.type),
|
|
3219
2906
|
propName,
|
|
3220
2907
|
modelName
|
|
3221
2908
|
);
|
|
3222
2909
|
} else {
|
|
3223
|
-
throw new
|
|
2910
|
+
throw new InvalidArgumentError(
|
|
3224
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.',
|
|
3225
2912
|
capitalize(propDef.itemType),
|
|
3226
2913
|
propName,
|
|
@@ -3234,21 +2921,21 @@ var init_properties_definition_validator = __esm({
|
|
|
3234
2921
|
);
|
|
3235
2922
|
if (propDef.validate && typeof propDef.validate === "string") {
|
|
3236
2923
|
if (!propertyValidatorRegistry.hasValidator(propDef.validate))
|
|
3237
|
-
throw new
|
|
2924
|
+
throw new InvalidArgumentError(
|
|
3238
2925
|
"The property validator %v is not found.",
|
|
3239
2926
|
propDef.validate
|
|
3240
2927
|
);
|
|
3241
2928
|
} else if (Array.isArray(propDef.validate)) {
|
|
3242
2929
|
for (const validatorName of propDef.validate) {
|
|
3243
2930
|
if (typeof validatorName !== "string")
|
|
3244
|
-
throw new
|
|
2931
|
+
throw new InvalidArgumentError(
|
|
3245
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.',
|
|
3246
2933
|
propName,
|
|
3247
2934
|
modelName,
|
|
3248
2935
|
validatorName
|
|
3249
2936
|
);
|
|
3250
2937
|
if (!propertyValidatorRegistry.hasValidator(validatorName))
|
|
3251
|
-
throw new
|
|
2938
|
+
throw new InvalidArgumentError(
|
|
3252
2939
|
"The property validator %v is not found.",
|
|
3253
2940
|
validatorName
|
|
3254
2941
|
);
|
|
@@ -3256,13 +2943,13 @@ var init_properties_definition_validator = __esm({
|
|
|
3256
2943
|
} else if (typeof propDef.validate === "object") {
|
|
3257
2944
|
for (const validatorName in propDef.validate) {
|
|
3258
2945
|
if (!propertyValidatorRegistry.hasValidator(validatorName))
|
|
3259
|
-
throw new
|
|
2946
|
+
throw new InvalidArgumentError(
|
|
3260
2947
|
"The property validator %v is not found.",
|
|
3261
2948
|
validatorName
|
|
3262
2949
|
);
|
|
3263
2950
|
}
|
|
3264
2951
|
} else {
|
|
3265
|
-
throw new
|
|
2952
|
+
throw new InvalidArgumentError(
|
|
3266
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.',
|
|
3267
2954
|
propName,
|
|
3268
2955
|
modelName,
|
|
@@ -3276,21 +2963,21 @@ var init_properties_definition_validator = __esm({
|
|
|
3276
2963
|
);
|
|
3277
2964
|
if (propDef.transform && typeof propDef.transform === "string") {
|
|
3278
2965
|
if (!propertyTransformerRegistry.hasTransformer(propDef.transform))
|
|
3279
|
-
throw new
|
|
2966
|
+
throw new InvalidArgumentError(
|
|
3280
2967
|
"The property transformer %v is not found.",
|
|
3281
2968
|
propDef.transform
|
|
3282
2969
|
);
|
|
3283
2970
|
} else if (Array.isArray(propDef.transform)) {
|
|
3284
2971
|
for (const transformerName of propDef.transform) {
|
|
3285
2972
|
if (typeof transformerName !== "string")
|
|
3286
|
-
throw new
|
|
2973
|
+
throw new InvalidArgumentError(
|
|
3287
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.',
|
|
3288
2975
|
propName,
|
|
3289
2976
|
modelName,
|
|
3290
2977
|
transformerName
|
|
3291
2978
|
);
|
|
3292
2979
|
if (!propertyTransformerRegistry.hasTransformer(transformerName))
|
|
3293
|
-
throw new
|
|
2980
|
+
throw new InvalidArgumentError(
|
|
3294
2981
|
"The property transformer %v is not found.",
|
|
3295
2982
|
transformerName
|
|
3296
2983
|
);
|
|
@@ -3298,13 +2985,13 @@ var init_properties_definition_validator = __esm({
|
|
|
3298
2985
|
} else if (typeof propDef.transform === "object") {
|
|
3299
2986
|
for (const transformerName in propDef.transform) {
|
|
3300
2987
|
if (!propertyTransformerRegistry.hasTransformer(transformerName))
|
|
3301
|
-
throw new
|
|
2988
|
+
throw new InvalidArgumentError(
|
|
3302
2989
|
"The property transformer %v is not found.",
|
|
3303
2990
|
transformerName
|
|
3304
2991
|
);
|
|
3305
2992
|
}
|
|
3306
2993
|
} else {
|
|
3307
|
-
throw new
|
|
2994
|
+
throw new InvalidArgumentError(
|
|
3308
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.',
|
|
3309
2996
|
propName,
|
|
3310
2997
|
modelName,
|
|
@@ -3314,7 +3001,7 @@ var init_properties_definition_validator = __esm({
|
|
|
3314
3001
|
}
|
|
3315
3002
|
if (propDef.unique) {
|
|
3316
3003
|
if (typeof propDef.unique !== "boolean" && !Object.values(PropertyUniqueness).includes(propDef.unique)) {
|
|
3317
|
-
throw new
|
|
3004
|
+
throw new InvalidArgumentError(
|
|
3318
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.',
|
|
3319
3006
|
propName,
|
|
3320
3007
|
modelName,
|
|
@@ -3324,13 +3011,15 @@ var init_properties_definition_validator = __esm({
|
|
|
3324
3011
|
}
|
|
3325
3012
|
}
|
|
3326
3013
|
if (propDef.unique && propDef.primaryKey)
|
|
3327
|
-
throw new
|
|
3014
|
+
throw new InvalidArgumentError(
|
|
3328
3015
|
'The property %v of the model %v is a primary key, so it should not have the option "unique" to be provided.',
|
|
3329
3016
|
propName,
|
|
3330
3017
|
modelName
|
|
3331
3018
|
);
|
|
3332
3019
|
}
|
|
3333
3020
|
};
|
|
3021
|
+
__name(_PropertiesDefinitionValidator, "PropertiesDefinitionValidator");
|
|
3022
|
+
PropertiesDefinitionValidator = _PropertiesDefinitionValidator;
|
|
3334
3023
|
}
|
|
3335
3024
|
});
|
|
3336
3025
|
|
|
@@ -3358,19 +3047,19 @@ var init_model_definition = __esm({
|
|
|
3358
3047
|
});
|
|
3359
3048
|
|
|
3360
3049
|
// src/definition/model/model-data-validator.js
|
|
3361
|
-
var ModelDataValidator;
|
|
3050
|
+
var import_js_service14, _ModelDataValidator, ModelDataValidator;
|
|
3362
3051
|
var init_model_data_validator = __esm({
|
|
3363
3052
|
"src/definition/model/model-data-validator.js"() {
|
|
3364
3053
|
"use strict";
|
|
3365
|
-
|
|
3054
|
+
import_js_service14 = require("@e22m4u/js-service");
|
|
3366
3055
|
init_properties();
|
|
3367
|
-
|
|
3368
|
-
|
|
3056
|
+
init_utils();
|
|
3057
|
+
init_utils();
|
|
3369
3058
|
init_properties();
|
|
3370
|
-
|
|
3059
|
+
init_errors();
|
|
3371
3060
|
init_properties();
|
|
3372
3061
|
init_model_definition_utils();
|
|
3373
|
-
|
|
3062
|
+
_ModelDataValidator = class _ModelDataValidator extends import_js_service14.Service {
|
|
3374
3063
|
/**
|
|
3375
3064
|
* Validate.
|
|
3376
3065
|
*
|
|
@@ -3381,7 +3070,7 @@ var init_model_data_validator = __esm({
|
|
|
3381
3070
|
*/
|
|
3382
3071
|
validate(modelName, modelData, isPartial = false) {
|
|
3383
3072
|
if (!isPureObject(modelData))
|
|
3384
|
-
throw new
|
|
3073
|
+
throw new InvalidArgumentError(
|
|
3385
3074
|
"The data of the model %v should be an Object, but %v given.",
|
|
3386
3075
|
modelName,
|
|
3387
3076
|
modelData
|
|
@@ -3421,7 +3110,7 @@ var init_model_data_validator = __esm({
|
|
|
3421
3110
|
if (isEmpty) {
|
|
3422
3111
|
const isRequired = typeof propDef === "string" ? false : Boolean(propDef.required);
|
|
3423
3112
|
if (!isRequired) return;
|
|
3424
|
-
throw new
|
|
3113
|
+
throw new InvalidArgumentError(
|
|
3425
3114
|
"The property %v of the model %v is required, but %v given.",
|
|
3426
3115
|
propName,
|
|
3427
3116
|
modelName,
|
|
@@ -3458,18 +3147,18 @@ var init_model_data_validator = __esm({
|
|
|
3458
3147
|
} else {
|
|
3459
3148
|
expectingType = typeof propDef !== "string" ? propDef.type : propDef;
|
|
3460
3149
|
}
|
|
3461
|
-
const createError = (expected) => {
|
|
3150
|
+
const createError = /* @__PURE__ */ __name((expected) => {
|
|
3462
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.";
|
|
3463
3152
|
const ctorName = getCtorName(propValue);
|
|
3464
3153
|
const givenStr = ctorName != null ? ctorName : typeof propValue;
|
|
3465
|
-
return new
|
|
3154
|
+
return new InvalidArgumentError(
|
|
3466
3155
|
pattern,
|
|
3467
3156
|
propName,
|
|
3468
3157
|
modelName,
|
|
3469
3158
|
expected,
|
|
3470
3159
|
givenStr
|
|
3471
3160
|
);
|
|
3472
|
-
};
|
|
3161
|
+
}, "createError");
|
|
3473
3162
|
switch (expectingType) {
|
|
3474
3163
|
// STRING
|
|
3475
3164
|
case DataType.STRING:
|
|
@@ -3517,26 +3206,26 @@ var init_model_data_validator = __esm({
|
|
|
3517
3206
|
if (typeof propDef === "string" || propDef.validate == null) return;
|
|
3518
3207
|
const validateDef = propDef.validate;
|
|
3519
3208
|
const validatorRegistry = this.getService(PropertyValidatorRegistry);
|
|
3520
|
-
const createError = (validatorName) => new
|
|
3209
|
+
const createError = /* @__PURE__ */ __name((validatorName) => new InvalidArgumentError(
|
|
3521
3210
|
"The property %v of the model %v has an invalid value %v that caught by the validator %v.",
|
|
3522
3211
|
propName,
|
|
3523
3212
|
modelName,
|
|
3524
3213
|
propValue,
|
|
3525
3214
|
validatorName
|
|
3526
|
-
);
|
|
3527
|
-
const validateBy = (validatorName, validatorOptions = void 0) => {
|
|
3215
|
+
), "createError");
|
|
3216
|
+
const validateBy = /* @__PURE__ */ __name((validatorName, validatorOptions = void 0) => {
|
|
3528
3217
|
const validator = validatorRegistry.getValidator(validatorName);
|
|
3529
3218
|
const context = { validatorName, modelName, propName };
|
|
3530
3219
|
const valid = validator(propValue, validatorOptions, context);
|
|
3531
3220
|
if (valid instanceof Promise) {
|
|
3532
|
-
throw new
|
|
3221
|
+
throw new InvalidArgumentError(
|
|
3533
3222
|
"Asynchronous property validators are not supported, but the property validator %v returns a Promise.",
|
|
3534
3223
|
validatorName
|
|
3535
3224
|
);
|
|
3536
3225
|
} else if (valid !== true) {
|
|
3537
3226
|
throw createError(validatorName);
|
|
3538
3227
|
}
|
|
3539
|
-
};
|
|
3228
|
+
}, "validateBy");
|
|
3540
3229
|
if (validateDef && typeof validateDef === "string") {
|
|
3541
3230
|
validateBy(validateDef);
|
|
3542
3231
|
} else if (Array.isArray(validateDef)) {
|
|
@@ -3549,7 +3238,7 @@ var init_model_data_validator = __esm({
|
|
|
3549
3238
|
}
|
|
3550
3239
|
});
|
|
3551
3240
|
} else {
|
|
3552
|
-
throw new
|
|
3241
|
+
throw new InvalidArgumentError(
|
|
3553
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.',
|
|
3554
3243
|
propName,
|
|
3555
3244
|
modelName,
|
|
@@ -3558,18 +3247,20 @@ var init_model_data_validator = __esm({
|
|
|
3558
3247
|
}
|
|
3559
3248
|
}
|
|
3560
3249
|
};
|
|
3250
|
+
__name(_ModelDataValidator, "ModelDataValidator");
|
|
3251
|
+
ModelDataValidator = _ModelDataValidator;
|
|
3561
3252
|
}
|
|
3562
3253
|
});
|
|
3563
3254
|
|
|
3564
3255
|
// src/definition/model/model-data-sanitizer.js
|
|
3565
|
-
var ModelDataSanitizer;
|
|
3256
|
+
var import_js_service15, _ModelDataSanitizer, ModelDataSanitizer;
|
|
3566
3257
|
var init_model_data_sanitizer = __esm({
|
|
3567
3258
|
"src/definition/model/model-data-sanitizer.js"() {
|
|
3568
3259
|
"use strict";
|
|
3569
|
-
|
|
3570
|
-
|
|
3260
|
+
import_js_service15 = require("@e22m4u/js-service");
|
|
3261
|
+
init_errors();
|
|
3571
3262
|
init_model_definition_utils();
|
|
3572
|
-
|
|
3263
|
+
_ModelDataSanitizer = class _ModelDataSanitizer extends import_js_service15.Service {
|
|
3573
3264
|
/**
|
|
3574
3265
|
* Validate.
|
|
3575
3266
|
*
|
|
@@ -3579,12 +3270,12 @@ var init_model_data_sanitizer = __esm({
|
|
|
3579
3270
|
*/
|
|
3580
3271
|
sanitize(modelName, modelData) {
|
|
3581
3272
|
if (!modelName || typeof modelName !== "string")
|
|
3582
|
-
throw new
|
|
3273
|
+
throw new InvalidArgumentError(
|
|
3583
3274
|
"The first argument of ModelDataSanitizer.sanitize should be a string, but %v given.",
|
|
3584
3275
|
modelName
|
|
3585
3276
|
);
|
|
3586
3277
|
if (!modelData || typeof modelData !== "object")
|
|
3587
|
-
throw new
|
|
3278
|
+
throw new InvalidArgumentError(
|
|
3588
3279
|
"The second argument of ModelDataSanitizer.sanitize should be an Object, but %v given.",
|
|
3589
3280
|
modelData
|
|
3590
3281
|
);
|
|
@@ -3593,23 +3284,25 @@ var init_model_data_sanitizer = __esm({
|
|
|
3593
3284
|
).excludeObjectKeysByRelationNames(modelName, modelData);
|
|
3594
3285
|
}
|
|
3595
3286
|
};
|
|
3287
|
+
__name(_ModelDataSanitizer, "ModelDataSanitizer");
|
|
3288
|
+
ModelDataSanitizer = _ModelDataSanitizer;
|
|
3596
3289
|
}
|
|
3597
3290
|
});
|
|
3598
3291
|
|
|
3599
3292
|
// src/definition/model/model-data-transformer.js
|
|
3600
|
-
var ModelDataTransformer;
|
|
3293
|
+
var import_js_service16, _ModelDataTransformer, ModelDataTransformer;
|
|
3601
3294
|
var init_model_data_transformer = __esm({
|
|
3602
3295
|
"src/definition/model/model-data-transformer.js"() {
|
|
3603
3296
|
"use strict";
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3297
|
+
import_js_service16 = require("@e22m4u/js-service");
|
|
3298
|
+
init_utils();
|
|
3299
|
+
init_utils();
|
|
3300
|
+
init_utils();
|
|
3608
3301
|
init_properties();
|
|
3609
|
-
|
|
3302
|
+
init_errors();
|
|
3610
3303
|
init_model_definition_utils();
|
|
3611
3304
|
init_properties();
|
|
3612
|
-
|
|
3305
|
+
_ModelDataTransformer = class _ModelDataTransformer extends import_js_service16.Service {
|
|
3613
3306
|
/**
|
|
3614
3307
|
* Transform.
|
|
3615
3308
|
*
|
|
@@ -3620,7 +3313,7 @@ var init_model_data_transformer = __esm({
|
|
|
3620
3313
|
*/
|
|
3621
3314
|
transform(modelName, modelData, isPartial = false) {
|
|
3622
3315
|
if (!isPureObject(modelData))
|
|
3623
|
-
throw new
|
|
3316
|
+
throw new InvalidArgumentError(
|
|
3624
3317
|
"The data of the model %v should be an Object, but %v given.",
|
|
3625
3318
|
modelName,
|
|
3626
3319
|
modelData
|
|
@@ -3667,11 +3360,11 @@ var init_model_data_transformer = __esm({
|
|
|
3667
3360
|
return propValue;
|
|
3668
3361
|
const transformDef = propDef.transform;
|
|
3669
3362
|
const transformerRegistry = this.getService(PropertyTransformerRegistry);
|
|
3670
|
-
const transformFn = (value, transformerName, transformerOptions = void 0) => {
|
|
3363
|
+
const transformFn = /* @__PURE__ */ __name((value, transformerName, transformerOptions = void 0) => {
|
|
3671
3364
|
const transformer = transformerRegistry.getTransformer(transformerName);
|
|
3672
3365
|
const context = { transformerName, modelName, propName };
|
|
3673
3366
|
return transformer(value, transformerOptions, context);
|
|
3674
|
-
};
|
|
3367
|
+
}, "transformFn");
|
|
3675
3368
|
if (transformDef && typeof transformDef === "string") {
|
|
3676
3369
|
return transformFn(propValue, transformDef);
|
|
3677
3370
|
} else if (Array.isArray(transformDef)) {
|
|
@@ -3691,7 +3384,7 @@ var init_model_data_transformer = __esm({
|
|
|
3691
3384
|
propValue
|
|
3692
3385
|
);
|
|
3693
3386
|
} else {
|
|
3694
|
-
throw new
|
|
3387
|
+
throw new InvalidArgumentError(
|
|
3695
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.',
|
|
3696
3389
|
propName,
|
|
3697
3390
|
modelName,
|
|
@@ -3700,19 +3393,21 @@ var init_model_data_transformer = __esm({
|
|
|
3700
3393
|
}
|
|
3701
3394
|
}
|
|
3702
3395
|
};
|
|
3396
|
+
__name(_ModelDataTransformer, "ModelDataTransformer");
|
|
3397
|
+
ModelDataTransformer = _ModelDataTransformer;
|
|
3703
3398
|
}
|
|
3704
3399
|
});
|
|
3705
3400
|
|
|
3706
3401
|
// src/definition/model/model-definition-validator.js
|
|
3707
|
-
var ModelDefinitionValidator;
|
|
3402
|
+
var import_js_service17, _ModelDefinitionValidator, ModelDefinitionValidator;
|
|
3708
3403
|
var init_model_definition_validator = __esm({
|
|
3709
3404
|
"src/definition/model/model-definition-validator.js"() {
|
|
3710
3405
|
"use strict";
|
|
3711
|
-
|
|
3712
|
-
|
|
3406
|
+
import_js_service17 = require("@e22m4u/js-service");
|
|
3407
|
+
init_errors();
|
|
3713
3408
|
init_relations();
|
|
3714
3409
|
init_properties();
|
|
3715
|
-
|
|
3410
|
+
_ModelDefinitionValidator = class _ModelDefinitionValidator extends import_js_service17.Service {
|
|
3716
3411
|
/**
|
|
3717
3412
|
* Validate.
|
|
3718
3413
|
*
|
|
@@ -3720,36 +3415,36 @@ var init_model_definition_validator = __esm({
|
|
|
3720
3415
|
*/
|
|
3721
3416
|
validate(modelDef) {
|
|
3722
3417
|
if (!modelDef || typeof modelDef !== "object" || Array.isArray(modelDef))
|
|
3723
|
-
throw new
|
|
3418
|
+
throw new InvalidArgumentError(
|
|
3724
3419
|
"The model definition should be an Object, but %v given.",
|
|
3725
3420
|
modelDef
|
|
3726
3421
|
);
|
|
3727
3422
|
if (!modelDef.name || typeof modelDef.name !== "string")
|
|
3728
|
-
throw new
|
|
3423
|
+
throw new InvalidArgumentError(
|
|
3729
3424
|
'The model definition requires the option "name" as a non-empty String, but %v given.',
|
|
3730
3425
|
modelDef.name
|
|
3731
3426
|
);
|
|
3732
3427
|
if (modelDef.datasource && typeof modelDef.datasource !== "string")
|
|
3733
|
-
throw new
|
|
3428
|
+
throw new InvalidArgumentError(
|
|
3734
3429
|
'The provided option "datasource" of the model %v should be a String, but %v given.',
|
|
3735
3430
|
modelDef.name,
|
|
3736
3431
|
modelDef.datasource
|
|
3737
3432
|
);
|
|
3738
3433
|
if (modelDef.base && typeof modelDef.base !== "string")
|
|
3739
|
-
throw new
|
|
3434
|
+
throw new InvalidArgumentError(
|
|
3740
3435
|
'The provided option "base" of the model %v should be a String, but %v given.',
|
|
3741
3436
|
modelDef.name,
|
|
3742
3437
|
modelDef.base
|
|
3743
3438
|
);
|
|
3744
3439
|
if (modelDef.tableName && typeof modelDef.tableName !== "string")
|
|
3745
|
-
throw new
|
|
3440
|
+
throw new InvalidArgumentError(
|
|
3746
3441
|
'The provided option "tableName" of the model %v should be a String, but %v given.',
|
|
3747
3442
|
modelDef.name,
|
|
3748
3443
|
modelDef.tableName
|
|
3749
3444
|
);
|
|
3750
3445
|
if (modelDef.properties) {
|
|
3751
3446
|
if (typeof modelDef.properties !== "object" || Array.isArray(modelDef.properties)) {
|
|
3752
|
-
throw new
|
|
3447
|
+
throw new InvalidArgumentError(
|
|
3753
3448
|
'The provided option "properties" of the model %v should be an Object, but %v given.',
|
|
3754
3449
|
modelDef.name,
|
|
3755
3450
|
modelDef.properties
|
|
@@ -3762,7 +3457,7 @@ var init_model_definition_validator = __esm({
|
|
|
3762
3457
|
}
|
|
3763
3458
|
if (modelDef.relations) {
|
|
3764
3459
|
if (typeof modelDef.relations !== "object" || Array.isArray(modelDef.relations)) {
|
|
3765
|
-
throw new
|
|
3460
|
+
throw new InvalidArgumentError(
|
|
3766
3461
|
'The provided option "relations" of the model %v should be an Object, but %v given.',
|
|
3767
3462
|
modelDef.name,
|
|
3768
3463
|
modelDef.relations
|
|
@@ -3775,6 +3470,8 @@ var init_model_definition_validator = __esm({
|
|
|
3775
3470
|
}
|
|
3776
3471
|
}
|
|
3777
3472
|
};
|
|
3473
|
+
__name(_ModelDefinitionValidator, "ModelDefinitionValidator");
|
|
3474
|
+
ModelDefinitionValidator = _ModelDefinitionValidator;
|
|
3778
3475
|
}
|
|
3779
3476
|
});
|
|
3780
3477
|
|
|
@@ -3794,13 +3491,13 @@ var init_model = __esm({
|
|
|
3794
3491
|
});
|
|
3795
3492
|
|
|
3796
3493
|
// src/definition/datasource/datasource-definition-validator.js
|
|
3797
|
-
var DatasourceDefinitionValidator;
|
|
3494
|
+
var import_js_service18, _DatasourceDefinitionValidator, DatasourceDefinitionValidator;
|
|
3798
3495
|
var init_datasource_definition_validator = __esm({
|
|
3799
3496
|
"src/definition/datasource/datasource-definition-validator.js"() {
|
|
3800
3497
|
"use strict";
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3498
|
+
import_js_service18 = require("@e22m4u/js-service");
|
|
3499
|
+
init_errors();
|
|
3500
|
+
_DatasourceDefinitionValidator = class _DatasourceDefinitionValidator extends import_js_service18.Service {
|
|
3804
3501
|
/**
|
|
3805
3502
|
* Validate.
|
|
3806
3503
|
*
|
|
@@ -3808,23 +3505,25 @@ var init_datasource_definition_validator = __esm({
|
|
|
3808
3505
|
*/
|
|
3809
3506
|
validate(datasourceDef) {
|
|
3810
3507
|
if (!datasourceDef || typeof datasourceDef !== "object")
|
|
3811
|
-
throw new
|
|
3508
|
+
throw new InvalidArgumentError(
|
|
3812
3509
|
"The datasource definition should be an Object, but %v given.",
|
|
3813
3510
|
datasourceDef
|
|
3814
3511
|
);
|
|
3815
3512
|
if (!datasourceDef.name || typeof datasourceDef.name !== "string")
|
|
3816
|
-
throw new
|
|
3513
|
+
throw new InvalidArgumentError(
|
|
3817
3514
|
'The datasource definition requires the option "name" as a non-empty String, but %v given.',
|
|
3818
3515
|
datasourceDef.name
|
|
3819
3516
|
);
|
|
3820
3517
|
if (!datasourceDef.adapter || typeof datasourceDef.adapter !== "string")
|
|
3821
|
-
throw new
|
|
3518
|
+
throw new InvalidArgumentError(
|
|
3822
3519
|
'The datasource %v requires the option "adapter" as a non-empty String, but %v given.',
|
|
3823
3520
|
datasourceDef.name,
|
|
3824
3521
|
datasourceDef.adapter
|
|
3825
3522
|
);
|
|
3826
3523
|
}
|
|
3827
3524
|
};
|
|
3525
|
+
__name(_DatasourceDefinitionValidator, "DatasourceDefinitionValidator");
|
|
3526
|
+
DatasourceDefinitionValidator = _DatasourceDefinitionValidator;
|
|
3828
3527
|
}
|
|
3829
3528
|
});
|
|
3830
3529
|
|
|
@@ -3847,15 +3546,15 @@ var init_definition = __esm({
|
|
|
3847
3546
|
});
|
|
3848
3547
|
|
|
3849
3548
|
// src/filter/fields-clause-tool.js
|
|
3850
|
-
var FieldsClauseTool;
|
|
3549
|
+
var import_js_service19, _FieldsClauseTool, FieldsClauseTool;
|
|
3851
3550
|
var init_fields_clause_tool = __esm({
|
|
3852
3551
|
"src/filter/fields-clause-tool.js"() {
|
|
3853
3552
|
"use strict";
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3553
|
+
import_js_service19 = require("@e22m4u/js-service");
|
|
3554
|
+
init_utils();
|
|
3555
|
+
init_errors();
|
|
3857
3556
|
init_definition();
|
|
3858
|
-
|
|
3557
|
+
_FieldsClauseTool = class _FieldsClauseTool extends import_js_service19.Service {
|
|
3859
3558
|
/**
|
|
3860
3559
|
* Filter.
|
|
3861
3560
|
*
|
|
@@ -3869,13 +3568,13 @@ var init_fields_clause_tool = __esm({
|
|
|
3869
3568
|
let entities = isArray ? input : [input];
|
|
3870
3569
|
entities.forEach((entity) => {
|
|
3871
3570
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
3872
|
-
throw new
|
|
3571
|
+
throw new InvalidArgumentError(
|
|
3873
3572
|
"The first argument of FieldsClauseTool.filter should be an Object or an Array of Object, but %v given.",
|
|
3874
3573
|
entity
|
|
3875
3574
|
);
|
|
3876
3575
|
});
|
|
3877
3576
|
if (!modelName || typeof modelName !== "string")
|
|
3878
|
-
throw new
|
|
3577
|
+
throw new InvalidArgumentError(
|
|
3879
3578
|
"The second argument of FieldsClauseTool.filter should be a non-empty String, but %v given.",
|
|
3880
3579
|
modelName
|
|
3881
3580
|
);
|
|
@@ -3884,7 +3583,7 @@ var init_fields_clause_tool = __esm({
|
|
|
3884
3583
|
if (!fields.length) return input;
|
|
3885
3584
|
fields.forEach((field) => {
|
|
3886
3585
|
if (!field || typeof field !== "string")
|
|
3887
|
-
throw new
|
|
3586
|
+
throw new InvalidArgumentError(
|
|
3888
3587
|
'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
3889
3588
|
field
|
|
3890
3589
|
);
|
|
@@ -3907,7 +3606,7 @@ var init_fields_clause_tool = __esm({
|
|
|
3907
3606
|
if (!fields.length) return;
|
|
3908
3607
|
fields.forEach((field) => {
|
|
3909
3608
|
if (!field || typeof field !== "string")
|
|
3910
|
-
throw new
|
|
3609
|
+
throw new InvalidArgumentError(
|
|
3911
3610
|
'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
3912
3611
|
field
|
|
3913
3612
|
);
|
|
@@ -3925,7 +3624,7 @@ var init_fields_clause_tool = __esm({
|
|
|
3925
3624
|
if (!fields.length) return;
|
|
3926
3625
|
fields.forEach((field) => {
|
|
3927
3626
|
if (!field || typeof field !== "string")
|
|
3928
|
-
throw new
|
|
3627
|
+
throw new InvalidArgumentError(
|
|
3929
3628
|
'The provided option "fields" should be a non-empty String or an Array of non-empty String, but %v given.',
|
|
3930
3629
|
field
|
|
3931
3630
|
);
|
|
@@ -3933,21 +3632,23 @@ var init_fields_clause_tool = __esm({
|
|
|
3933
3632
|
return fields;
|
|
3934
3633
|
}
|
|
3935
3634
|
};
|
|
3635
|
+
__name(_FieldsClauseTool, "FieldsClauseTool");
|
|
3636
|
+
FieldsClauseTool = _FieldsClauseTool;
|
|
3936
3637
|
}
|
|
3937
3638
|
});
|
|
3938
3639
|
|
|
3939
3640
|
// src/relations/has-one-resolver.js
|
|
3940
|
-
var HasOneResolver;
|
|
3641
|
+
var import_js_service20, _HasOneResolver, HasOneResolver;
|
|
3941
3642
|
var init_has_one_resolver = __esm({
|
|
3942
3643
|
"src/relations/has-one-resolver.js"() {
|
|
3943
3644
|
"use strict";
|
|
3944
|
-
|
|
3945
|
-
|
|
3645
|
+
import_js_service20 = require("@e22m4u/js-service");
|
|
3646
|
+
init_utils();
|
|
3946
3647
|
init_definition();
|
|
3947
|
-
|
|
3648
|
+
init_errors();
|
|
3948
3649
|
init_repository2();
|
|
3949
3650
|
init_definition();
|
|
3950
|
-
|
|
3651
|
+
_HasOneResolver = class _HasOneResolver extends import_js_service20.Service {
|
|
3951
3652
|
/**
|
|
3952
3653
|
* Include to.
|
|
3953
3654
|
*
|
|
@@ -3961,32 +3662,32 @@ var init_has_one_resolver = __esm({
|
|
|
3961
3662
|
*/
|
|
3962
3663
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
|
|
3963
3664
|
if (!entities || !Array.isArray(entities))
|
|
3964
|
-
throw new
|
|
3665
|
+
throw new InvalidArgumentError(
|
|
3965
3666
|
'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v given.',
|
|
3966
3667
|
entities
|
|
3967
3668
|
);
|
|
3968
3669
|
if (!sourceName || typeof sourceName !== "string")
|
|
3969
|
-
throw new
|
|
3670
|
+
throw new InvalidArgumentError(
|
|
3970
3671
|
'The parameter "sourceName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
3971
3672
|
sourceName
|
|
3972
3673
|
);
|
|
3973
3674
|
if (!targetName || typeof targetName !== "string")
|
|
3974
|
-
throw new
|
|
3675
|
+
throw new InvalidArgumentError(
|
|
3975
3676
|
'The parameter "targetName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
3976
3677
|
targetName
|
|
3977
3678
|
);
|
|
3978
3679
|
if (!relationName || typeof relationName !== "string")
|
|
3979
|
-
throw new
|
|
3680
|
+
throw new InvalidArgumentError(
|
|
3980
3681
|
'The parameter "relationName" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
3981
3682
|
relationName
|
|
3982
3683
|
);
|
|
3983
3684
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
3984
|
-
throw new
|
|
3685
|
+
throw new InvalidArgumentError(
|
|
3985
3686
|
'The parameter "foreignKey" of HasOneResolver.includeTo requires a non-empty String, but %v given.',
|
|
3986
3687
|
foreignKey
|
|
3987
3688
|
);
|
|
3988
3689
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
3989
|
-
throw new
|
|
3690
|
+
throw new InvalidArgumentError(
|
|
3990
3691
|
'The provided parameter "scope" of HasOneResolver.includeTo should be an Object, but %v given.',
|
|
3991
3692
|
scope
|
|
3992
3693
|
);
|
|
@@ -3996,7 +3697,7 @@ var init_has_one_resolver = __esm({
|
|
|
3996
3697
|
const sourceIds = [];
|
|
3997
3698
|
entities.forEach((entity) => {
|
|
3998
3699
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
3999
|
-
throw new
|
|
3700
|
+
throw new InvalidArgumentError(
|
|
4000
3701
|
'The parameter "entities" of HasOneResolver.includeTo requires an Array of Object, but %v given.',
|
|
4001
3702
|
entity
|
|
4002
3703
|
);
|
|
@@ -4040,37 +3741,37 @@ var init_has_one_resolver = __esm({
|
|
|
4040
3741
|
*/
|
|
4041
3742
|
async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
|
|
4042
3743
|
if (!entities || !Array.isArray(entities))
|
|
4043
|
-
throw new
|
|
3744
|
+
throw new InvalidArgumentError(
|
|
4044
3745
|
'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4045
3746
|
entities
|
|
4046
3747
|
);
|
|
4047
3748
|
if (!sourceName || typeof sourceName !== "string")
|
|
4048
|
-
throw new
|
|
3749
|
+
throw new InvalidArgumentError(
|
|
4049
3750
|
'The parameter "sourceName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4050
3751
|
sourceName
|
|
4051
3752
|
);
|
|
4052
3753
|
if (!targetName || typeof targetName !== "string")
|
|
4053
|
-
throw new
|
|
3754
|
+
throw new InvalidArgumentError(
|
|
4054
3755
|
'The parameter "targetName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4055
3756
|
targetName
|
|
4056
3757
|
);
|
|
4057
3758
|
if (!relationName || typeof relationName !== "string")
|
|
4058
|
-
throw new
|
|
3759
|
+
throw new InvalidArgumentError(
|
|
4059
3760
|
'The parameter "relationName" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4060
3761
|
relationName
|
|
4061
3762
|
);
|
|
4062
3763
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4063
|
-
throw new
|
|
3764
|
+
throw new InvalidArgumentError(
|
|
4064
3765
|
'The parameter "foreignKey" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4065
3766
|
foreignKey
|
|
4066
3767
|
);
|
|
4067
3768
|
if (!discriminator || typeof discriminator !== "string")
|
|
4068
|
-
throw new
|
|
3769
|
+
throw new InvalidArgumentError(
|
|
4069
3770
|
'The parameter "discriminator" of HasOneResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4070
3771
|
discriminator
|
|
4071
3772
|
);
|
|
4072
3773
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4073
|
-
throw new
|
|
3774
|
+
throw new InvalidArgumentError(
|
|
4074
3775
|
'The provided parameter "scope" of HasOneResolver.includePolymorphicTo should be an Object, but %v given.',
|
|
4075
3776
|
scope
|
|
4076
3777
|
);
|
|
@@ -4080,7 +3781,7 @@ var init_has_one_resolver = __esm({
|
|
|
4080
3781
|
const sourceIds = [];
|
|
4081
3782
|
entities.forEach((entity) => {
|
|
4082
3783
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4083
|
-
throw new
|
|
3784
|
+
throw new InvalidArgumentError(
|
|
4084
3785
|
'The parameter "entities" of HasOneResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4085
3786
|
entity
|
|
4086
3787
|
);
|
|
@@ -4126,32 +3827,32 @@ var init_has_one_resolver = __esm({
|
|
|
4126
3827
|
*/
|
|
4127
3828
|
async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
|
|
4128
3829
|
if (!entities || !Array.isArray(entities))
|
|
4129
|
-
throw new
|
|
3830
|
+
throw new InvalidArgumentError(
|
|
4130
3831
|
'The parameter "entities" of HasOneResolver.includePolymorphicByRelationName requires an Array of Object, but %v given.',
|
|
4131
3832
|
entities
|
|
4132
3833
|
);
|
|
4133
3834
|
if (!sourceName || typeof sourceName !== "string")
|
|
4134
|
-
throw new
|
|
3835
|
+
throw new InvalidArgumentError(
|
|
4135
3836
|
'The parameter "sourceName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4136
3837
|
sourceName
|
|
4137
3838
|
);
|
|
4138
3839
|
if (!targetName || typeof targetName !== "string")
|
|
4139
|
-
throw new
|
|
3840
|
+
throw new InvalidArgumentError(
|
|
4140
3841
|
'The parameter "targetName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4141
3842
|
targetName
|
|
4142
3843
|
);
|
|
4143
3844
|
if (!relationName || typeof relationName !== "string")
|
|
4144
|
-
throw new
|
|
3845
|
+
throw new InvalidArgumentError(
|
|
4145
3846
|
'The parameter "relationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4146
3847
|
relationName
|
|
4147
3848
|
);
|
|
4148
3849
|
if (!targetRelationName || typeof targetRelationName !== "string")
|
|
4149
|
-
throw new
|
|
3850
|
+
throw new InvalidArgumentError(
|
|
4150
3851
|
'The parameter "targetRelationName" of HasOneResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4151
3852
|
targetRelationName
|
|
4152
3853
|
);
|
|
4153
3854
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4154
|
-
throw new
|
|
3855
|
+
throw new InvalidArgumentError(
|
|
4155
3856
|
'The provided parameter "scope" of HasOneResolver.includePolymorphicByRelationName should be an Object, but %v given.',
|
|
4156
3857
|
scope
|
|
4157
3858
|
);
|
|
@@ -4159,7 +3860,7 @@ var init_has_one_resolver = __esm({
|
|
|
4159
3860
|
ModelDefinitionUtils
|
|
4160
3861
|
).getRelationDefinitionByName(targetName, targetRelationName);
|
|
4161
3862
|
if (targetRelationDef.type !== RelationType.BELONGS_TO)
|
|
4162
|
-
throw new
|
|
3863
|
+
throw new InvalidArgumentError(
|
|
4163
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.',
|
|
4164
3865
|
relationName,
|
|
4165
3866
|
sourceName,
|
|
@@ -4167,7 +3868,7 @@ var init_has_one_resolver = __esm({
|
|
|
4167
3868
|
targetRelationDef.type
|
|
4168
3869
|
);
|
|
4169
3870
|
if (!targetRelationDef.polymorphic)
|
|
4170
|
-
throw new
|
|
3871
|
+
throw new InvalidArgumentError(
|
|
4171
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.',
|
|
4172
3873
|
relationName,
|
|
4173
3874
|
sourceName,
|
|
@@ -4186,21 +3887,23 @@ var init_has_one_resolver = __esm({
|
|
|
4186
3887
|
);
|
|
4187
3888
|
}
|
|
4188
3889
|
};
|
|
3890
|
+
__name(_HasOneResolver, "HasOneResolver");
|
|
3891
|
+
HasOneResolver = _HasOneResolver;
|
|
4189
3892
|
}
|
|
4190
3893
|
});
|
|
4191
3894
|
|
|
4192
3895
|
// src/relations/has-many-resolver.js
|
|
4193
|
-
var HasManyResolver;
|
|
3896
|
+
var import_js_service21, _HasManyResolver, HasManyResolver;
|
|
4194
3897
|
var init_has_many_resolver = __esm({
|
|
4195
3898
|
"src/relations/has-many-resolver.js"() {
|
|
4196
3899
|
"use strict";
|
|
4197
|
-
|
|
4198
|
-
|
|
3900
|
+
import_js_service21 = require("@e22m4u/js-service");
|
|
3901
|
+
init_utils();
|
|
4199
3902
|
init_definition();
|
|
4200
|
-
|
|
3903
|
+
init_errors();
|
|
4201
3904
|
init_repository2();
|
|
4202
3905
|
init_definition();
|
|
4203
|
-
|
|
3906
|
+
_HasManyResolver = class _HasManyResolver extends import_js_service21.Service {
|
|
4204
3907
|
/**
|
|
4205
3908
|
* Include to.
|
|
4206
3909
|
*
|
|
@@ -4214,32 +3917,32 @@ var init_has_many_resolver = __esm({
|
|
|
4214
3917
|
*/
|
|
4215
3918
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey, scope = void 0) {
|
|
4216
3919
|
if (!entities || !Array.isArray(entities))
|
|
4217
|
-
throw new
|
|
3920
|
+
throw new InvalidArgumentError(
|
|
4218
3921
|
'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4219
3922
|
entities
|
|
4220
3923
|
);
|
|
4221
3924
|
if (!sourceName || typeof sourceName !== "string")
|
|
4222
|
-
throw new
|
|
3925
|
+
throw new InvalidArgumentError(
|
|
4223
3926
|
'The parameter "sourceName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4224
3927
|
sourceName
|
|
4225
3928
|
);
|
|
4226
3929
|
if (!targetName || typeof targetName !== "string")
|
|
4227
|
-
throw new
|
|
3930
|
+
throw new InvalidArgumentError(
|
|
4228
3931
|
'The parameter "targetName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4229
3932
|
targetName
|
|
4230
3933
|
);
|
|
4231
3934
|
if (!relationName || typeof relationName !== "string")
|
|
4232
|
-
throw new
|
|
3935
|
+
throw new InvalidArgumentError(
|
|
4233
3936
|
'The parameter "relationName" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4234
3937
|
relationName
|
|
4235
3938
|
);
|
|
4236
3939
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4237
|
-
throw new
|
|
3940
|
+
throw new InvalidArgumentError(
|
|
4238
3941
|
'The parameter "foreignKey" of HasManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4239
3942
|
foreignKey
|
|
4240
3943
|
);
|
|
4241
3944
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4242
|
-
throw new
|
|
3945
|
+
throw new InvalidArgumentError(
|
|
4243
3946
|
'The provided parameter "scope" of HasManyResolver.includeTo should be an Object, but %v given.',
|
|
4244
3947
|
scope
|
|
4245
3948
|
);
|
|
@@ -4249,7 +3952,7 @@ var init_has_many_resolver = __esm({
|
|
|
4249
3952
|
const sourceIds = [];
|
|
4250
3953
|
entities.forEach((entity) => {
|
|
4251
3954
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4252
|
-
throw new
|
|
3955
|
+
throw new InvalidArgumentError(
|
|
4253
3956
|
'The parameter "entities" of HasManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4254
3957
|
entity
|
|
4255
3958
|
);
|
|
@@ -4298,37 +4001,37 @@ var init_has_many_resolver = __esm({
|
|
|
4298
4001
|
*/
|
|
4299
4002
|
async includePolymorphicTo(entities, sourceName, targetName, relationName, foreignKey, discriminator, scope = void 0) {
|
|
4300
4003
|
if (!entities || !Array.isArray(entities))
|
|
4301
|
-
throw new
|
|
4004
|
+
throw new InvalidArgumentError(
|
|
4302
4005
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4303
4006
|
entities
|
|
4304
4007
|
);
|
|
4305
4008
|
if (!sourceName || typeof sourceName !== "string")
|
|
4306
|
-
throw new
|
|
4009
|
+
throw new InvalidArgumentError(
|
|
4307
4010
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4308
4011
|
sourceName
|
|
4309
4012
|
);
|
|
4310
4013
|
if (!targetName || typeof targetName !== "string")
|
|
4311
|
-
throw new
|
|
4014
|
+
throw new InvalidArgumentError(
|
|
4312
4015
|
'The parameter "targetName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4313
4016
|
targetName
|
|
4314
4017
|
);
|
|
4315
4018
|
if (!relationName || typeof relationName !== "string")
|
|
4316
|
-
throw new
|
|
4019
|
+
throw new InvalidArgumentError(
|
|
4317
4020
|
'The parameter "relationName" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4318
4021
|
relationName
|
|
4319
4022
|
);
|
|
4320
4023
|
if (!foreignKey || typeof foreignKey !== "string")
|
|
4321
|
-
throw new
|
|
4024
|
+
throw new InvalidArgumentError(
|
|
4322
4025
|
'The parameter "foreignKey" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4323
4026
|
foreignKey
|
|
4324
4027
|
);
|
|
4325
4028
|
if (!discriminator || typeof discriminator !== "string")
|
|
4326
|
-
throw new
|
|
4029
|
+
throw new InvalidArgumentError(
|
|
4327
4030
|
'The parameter "discriminator" of HasManyResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4328
4031
|
discriminator
|
|
4329
4032
|
);
|
|
4330
4033
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4331
|
-
throw new
|
|
4034
|
+
throw new InvalidArgumentError(
|
|
4332
4035
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicTo should be an Object, but %v given.',
|
|
4333
4036
|
scope
|
|
4334
4037
|
);
|
|
@@ -4338,7 +4041,7 @@ var init_has_many_resolver = __esm({
|
|
|
4338
4041
|
const sourceIds = [];
|
|
4339
4042
|
entities.forEach((entity) => {
|
|
4340
4043
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4341
|
-
throw new
|
|
4044
|
+
throw new InvalidArgumentError(
|
|
4342
4045
|
'The parameter "entities" of HasManyResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4343
4046
|
entity
|
|
4344
4047
|
);
|
|
@@ -4389,32 +4092,32 @@ var init_has_many_resolver = __esm({
|
|
|
4389
4092
|
*/
|
|
4390
4093
|
async includePolymorphicByRelationName(entities, sourceName, targetName, relationName, targetRelationName, scope = void 0) {
|
|
4391
4094
|
if (!entities || !Array.isArray(entities))
|
|
4392
|
-
throw new
|
|
4095
|
+
throw new InvalidArgumentError(
|
|
4393
4096
|
'The parameter "entities" of HasManyResolver.includePolymorphicByRelationName requires an Array of Object, but %v given.',
|
|
4394
4097
|
entities
|
|
4395
4098
|
);
|
|
4396
4099
|
if (!sourceName || typeof sourceName !== "string")
|
|
4397
|
-
throw new
|
|
4100
|
+
throw new InvalidArgumentError(
|
|
4398
4101
|
'The parameter "sourceName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4399
4102
|
sourceName
|
|
4400
4103
|
);
|
|
4401
4104
|
if (!targetName || typeof targetName !== "string")
|
|
4402
|
-
throw new
|
|
4105
|
+
throw new InvalidArgumentError(
|
|
4403
4106
|
'The parameter "targetName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4404
4107
|
targetName
|
|
4405
4108
|
);
|
|
4406
4109
|
if (!relationName || typeof relationName !== "string")
|
|
4407
|
-
throw new
|
|
4110
|
+
throw new InvalidArgumentError(
|
|
4408
4111
|
'The parameter "relationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4409
4112
|
relationName
|
|
4410
4113
|
);
|
|
4411
4114
|
if (!targetRelationName || typeof targetRelationName !== "string")
|
|
4412
|
-
throw new
|
|
4115
|
+
throw new InvalidArgumentError(
|
|
4413
4116
|
'The parameter "targetRelationName" of HasManyResolver.includePolymorphicByRelationName requires a non-empty String, but %v given.',
|
|
4414
4117
|
targetRelationName
|
|
4415
4118
|
);
|
|
4416
4119
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4417
|
-
throw new
|
|
4120
|
+
throw new InvalidArgumentError(
|
|
4418
4121
|
'The provided parameter "scope" of HasManyResolver.includePolymorphicByRelationName should be an Object, but %v given.',
|
|
4419
4122
|
scope
|
|
4420
4123
|
);
|
|
@@ -4422,7 +4125,7 @@ var init_has_many_resolver = __esm({
|
|
|
4422
4125
|
ModelDefinitionUtils
|
|
4423
4126
|
).getRelationDefinitionByName(targetName, targetRelationName);
|
|
4424
4127
|
if (targetRelationDef.type !== RelationType.BELONGS_TO)
|
|
4425
|
-
throw new
|
|
4128
|
+
throw new InvalidArgumentError(
|
|
4426
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.',
|
|
4427
4130
|
relationName,
|
|
4428
4131
|
sourceName,
|
|
@@ -4430,7 +4133,7 @@ var init_has_many_resolver = __esm({
|
|
|
4430
4133
|
targetRelationDef.type
|
|
4431
4134
|
);
|
|
4432
4135
|
if (!targetRelationDef.polymorphic)
|
|
4433
|
-
throw new
|
|
4136
|
+
throw new InvalidArgumentError(
|
|
4434
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.',
|
|
4435
4138
|
relationName,
|
|
4436
4139
|
sourceName,
|
|
@@ -4449,21 +4152,23 @@ var init_has_many_resolver = __esm({
|
|
|
4449
4152
|
);
|
|
4450
4153
|
}
|
|
4451
4154
|
};
|
|
4155
|
+
__name(_HasManyResolver, "HasManyResolver");
|
|
4156
|
+
HasManyResolver = _HasManyResolver;
|
|
4452
4157
|
}
|
|
4453
4158
|
});
|
|
4454
4159
|
|
|
4455
4160
|
// src/relations/belongs-to-resolver.js
|
|
4456
|
-
var BelongsToResolver;
|
|
4161
|
+
var import_js_service22, _BelongsToResolver, BelongsToResolver;
|
|
4457
4162
|
var init_belongs_to_resolver = __esm({
|
|
4458
4163
|
"src/relations/belongs-to-resolver.js"() {
|
|
4459
4164
|
"use strict";
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4165
|
+
import_js_service22 = require("@e22m4u/js-service");
|
|
4166
|
+
init_utils();
|
|
4167
|
+
init_utils();
|
|
4168
|
+
init_errors();
|
|
4464
4169
|
init_repository2();
|
|
4465
4170
|
init_definition();
|
|
4466
|
-
|
|
4171
|
+
_BelongsToResolver = class _BelongsToResolver extends import_js_service22.Service {
|
|
4467
4172
|
/**
|
|
4468
4173
|
* Include to.
|
|
4469
4174
|
*
|
|
@@ -4477,39 +4182,39 @@ var init_belongs_to_resolver = __esm({
|
|
|
4477
4182
|
*/
|
|
4478
4183
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
|
|
4479
4184
|
if (!entities || !Array.isArray(entities))
|
|
4480
|
-
throw new
|
|
4185
|
+
throw new InvalidArgumentError(
|
|
4481
4186
|
'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v given.',
|
|
4482
4187
|
entities
|
|
4483
4188
|
);
|
|
4484
4189
|
if (!sourceName || typeof sourceName !== "string")
|
|
4485
|
-
throw new
|
|
4190
|
+
throw new InvalidArgumentError(
|
|
4486
4191
|
'The parameter "sourceName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
|
|
4487
4192
|
sourceName
|
|
4488
4193
|
);
|
|
4489
4194
|
if (!targetName || typeof targetName !== "string")
|
|
4490
|
-
throw new
|
|
4195
|
+
throw new InvalidArgumentError(
|
|
4491
4196
|
'The parameter "targetName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
|
|
4492
4197
|
targetName
|
|
4493
4198
|
);
|
|
4494
4199
|
if (!relationName || typeof relationName !== "string")
|
|
4495
|
-
throw new
|
|
4200
|
+
throw new InvalidArgumentError(
|
|
4496
4201
|
'The parameter "relationName" of BelongsToResolver.includeTo requires a non-empty String, but %v given.',
|
|
4497
4202
|
relationName
|
|
4498
4203
|
);
|
|
4499
4204
|
if (foreignKey && typeof foreignKey !== "string")
|
|
4500
|
-
throw new
|
|
4205
|
+
throw new InvalidArgumentError(
|
|
4501
4206
|
'The provided parameter "foreignKey" of BelongsToResolver.includeTo should be a String, but %v given.',
|
|
4502
4207
|
foreignKey
|
|
4503
4208
|
);
|
|
4504
4209
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4505
|
-
throw new
|
|
4210
|
+
throw new InvalidArgumentError(
|
|
4506
4211
|
'The provided parameter "scope" of BelongsToResolver.includeTo should be an Object, but %v given.',
|
|
4507
4212
|
scope
|
|
4508
4213
|
);
|
|
4509
4214
|
if (foreignKey == null) foreignKey = `${relationName}Id`;
|
|
4510
4215
|
const targetIds = entities.reduce((acc, entity) => {
|
|
4511
4216
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4512
|
-
throw new
|
|
4217
|
+
throw new InvalidArgumentError(
|
|
4513
4218
|
'The parameter "entities" of BelongsToResolver.includeTo requires an Array of Object, but %v given.',
|
|
4514
4219
|
entity
|
|
4515
4220
|
);
|
|
@@ -4549,32 +4254,32 @@ var init_belongs_to_resolver = __esm({
|
|
|
4549
4254
|
*/
|
|
4550
4255
|
async includePolymorphicTo(entities, sourceName, relationName, foreignKey = void 0, discriminator = void 0, scope = void 0) {
|
|
4551
4256
|
if (!entities || !Array.isArray(entities))
|
|
4552
|
-
throw new
|
|
4257
|
+
throw new InvalidArgumentError(
|
|
4553
4258
|
'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4554
4259
|
entities
|
|
4555
4260
|
);
|
|
4556
4261
|
if (!sourceName || typeof sourceName !== "string")
|
|
4557
|
-
throw new
|
|
4262
|
+
throw new InvalidArgumentError(
|
|
4558
4263
|
'The parameter "sourceName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4559
4264
|
sourceName
|
|
4560
4265
|
);
|
|
4561
4266
|
if (!relationName || typeof relationName !== "string")
|
|
4562
|
-
throw new
|
|
4267
|
+
throw new InvalidArgumentError(
|
|
4563
4268
|
'The parameter "relationName" of BelongsToResolver.includePolymorphicTo requires a non-empty String, but %v given.',
|
|
4564
4269
|
relationName
|
|
4565
4270
|
);
|
|
4566
4271
|
if (foreignKey && typeof foreignKey !== "string")
|
|
4567
|
-
throw new
|
|
4272
|
+
throw new InvalidArgumentError(
|
|
4568
4273
|
'The provided parameter "foreignKey" of BelongsToResolver.includePolymorphicTo should be a String, but %v given.',
|
|
4569
4274
|
foreignKey
|
|
4570
4275
|
);
|
|
4571
4276
|
if (discriminator && typeof discriminator !== "string")
|
|
4572
|
-
throw new
|
|
4277
|
+
throw new InvalidArgumentError(
|
|
4573
4278
|
'The provided parameter "discriminator" of BelongsToResolver.includePolymorphicTo should be a String, but %v given.',
|
|
4574
4279
|
discriminator
|
|
4575
4280
|
);
|
|
4576
4281
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4577
|
-
throw new
|
|
4282
|
+
throw new InvalidArgumentError(
|
|
4578
4283
|
'The provided parameter "scope" of BelongsToResolver.includePolymorphicTo should be an Object, but %v given.',
|
|
4579
4284
|
scope
|
|
4580
4285
|
);
|
|
@@ -4589,7 +4294,7 @@ var init_belongs_to_resolver = __esm({
|
|
|
4589
4294
|
const targetIdsByTargetName = {};
|
|
4590
4295
|
entities.forEach((entity) => {
|
|
4591
4296
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4592
|
-
throw new
|
|
4297
|
+
throw new InvalidArgumentError(
|
|
4593
4298
|
'The parameter "entities" of BelongsToResolver.includePolymorphicTo requires an Array of Object, but %v given.',
|
|
4594
4299
|
entity
|
|
4595
4300
|
);
|
|
@@ -4610,7 +4315,7 @@ var init_belongs_to_resolver = __esm({
|
|
|
4610
4315
|
try {
|
|
4611
4316
|
targetRepository = this.getService(RepositoryRegistry).getRepository(targetName);
|
|
4612
4317
|
} catch (error) {
|
|
4613
|
-
if (error instanceof
|
|
4318
|
+
if (error instanceof InvalidArgumentError) {
|
|
4614
4319
|
if (error.message === `The model "${targetName}" is not defined.` || error.message === `The model "${targetName}" does not have a specified datasource.`) {
|
|
4615
4320
|
return;
|
|
4616
4321
|
}
|
|
@@ -4655,21 +4360,23 @@ var init_belongs_to_resolver = __esm({
|
|
|
4655
4360
|
});
|
|
4656
4361
|
}
|
|
4657
4362
|
};
|
|
4363
|
+
__name(_BelongsToResolver, "BelongsToResolver");
|
|
4364
|
+
BelongsToResolver = _BelongsToResolver;
|
|
4658
4365
|
}
|
|
4659
4366
|
});
|
|
4660
4367
|
|
|
4661
4368
|
// src/relations/references-many-resolver.js
|
|
4662
|
-
var ReferencesManyResolver;
|
|
4369
|
+
var import_js_service23, _ReferencesManyResolver, ReferencesManyResolver;
|
|
4663
4370
|
var init_references_many_resolver = __esm({
|
|
4664
4371
|
"src/relations/references-many-resolver.js"() {
|
|
4665
4372
|
"use strict";
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4373
|
+
import_js_service23 = require("@e22m4u/js-service");
|
|
4374
|
+
init_utils();
|
|
4375
|
+
init_utils();
|
|
4376
|
+
init_errors();
|
|
4670
4377
|
init_repository2();
|
|
4671
4378
|
init_definition();
|
|
4672
|
-
|
|
4379
|
+
_ReferencesManyResolver = class _ReferencesManyResolver extends import_js_service23.Service {
|
|
4673
4380
|
/**
|
|
4674
4381
|
* Include to.
|
|
4675
4382
|
*
|
|
@@ -4683,32 +4390,32 @@ var init_references_many_resolver = __esm({
|
|
|
4683
4390
|
*/
|
|
4684
4391
|
async includeTo(entities, sourceName, targetName, relationName, foreignKey = void 0, scope = void 0) {
|
|
4685
4392
|
if (!entities || !Array.isArray(entities))
|
|
4686
|
-
throw new
|
|
4393
|
+
throw new InvalidArgumentError(
|
|
4687
4394
|
'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4688
4395
|
entities
|
|
4689
4396
|
);
|
|
4690
4397
|
if (!sourceName || typeof sourceName !== "string")
|
|
4691
|
-
throw new
|
|
4398
|
+
throw new InvalidArgumentError(
|
|
4692
4399
|
'The parameter "sourceName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4693
4400
|
sourceName
|
|
4694
4401
|
);
|
|
4695
4402
|
if (!targetName || typeof targetName !== "string")
|
|
4696
|
-
throw new
|
|
4403
|
+
throw new InvalidArgumentError(
|
|
4697
4404
|
'The parameter "targetName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4698
4405
|
targetName
|
|
4699
4406
|
);
|
|
4700
4407
|
if (!relationName || typeof relationName !== "string")
|
|
4701
|
-
throw new
|
|
4408
|
+
throw new InvalidArgumentError(
|
|
4702
4409
|
'The parameter "relationName" of ReferencesManyResolver.includeTo requires a non-empty String, but %v given.',
|
|
4703
4410
|
relationName
|
|
4704
4411
|
);
|
|
4705
4412
|
if (foreignKey && typeof foreignKey !== "string")
|
|
4706
|
-
throw new
|
|
4413
|
+
throw new InvalidArgumentError(
|
|
4707
4414
|
'The provided parameter "foreignKey" of ReferencesManyResolver.includeTo should be a String, but %v given.',
|
|
4708
4415
|
foreignKey
|
|
4709
4416
|
);
|
|
4710
4417
|
if (scope && (typeof scope !== "object" || Array.isArray(scope)))
|
|
4711
|
-
throw new
|
|
4418
|
+
throw new InvalidArgumentError(
|
|
4712
4419
|
'The provided parameter "scope" of ReferencesManyResolver.includeTo should be an Object, but %v given.',
|
|
4713
4420
|
scope
|
|
4714
4421
|
);
|
|
@@ -4718,7 +4425,7 @@ var init_references_many_resolver = __esm({
|
|
|
4718
4425
|
}
|
|
4719
4426
|
const targetIds = entities.reduce((acc, entity) => {
|
|
4720
4427
|
if (!entity || typeof entity !== "object" || Array.isArray(entity))
|
|
4721
|
-
throw new
|
|
4428
|
+
throw new InvalidArgumentError(
|
|
4722
4429
|
'The parameter "entities" of ReferencesManyResolver.includeTo requires an Array of Object, but %v given.',
|
|
4723
4430
|
entity
|
|
4724
4431
|
);
|
|
@@ -4754,6 +4461,8 @@ var init_references_many_resolver = __esm({
|
|
|
4754
4461
|
});
|
|
4755
4462
|
}
|
|
4756
4463
|
};
|
|
4464
|
+
__name(_ReferencesManyResolver, "ReferencesManyResolver");
|
|
4465
|
+
ReferencesManyResolver = _ReferencesManyResolver;
|
|
4757
4466
|
}
|
|
4758
4467
|
});
|
|
4759
4468
|
|
|
@@ -4769,23 +4478,23 @@ var init_relations2 = __esm({
|
|
|
4769
4478
|
});
|
|
4770
4479
|
|
|
4771
4480
|
// src/filter/include-clause-tool.js
|
|
4772
|
-
var IncludeClauseTool;
|
|
4481
|
+
var import_js_service24, _IncludeClauseTool, IncludeClauseTool;
|
|
4773
4482
|
var init_include_clause_tool = __esm({
|
|
4774
4483
|
"src/filter/include-clause-tool.js"() {
|
|
4775
4484
|
"use strict";
|
|
4776
|
-
|
|
4485
|
+
import_js_service24 = require("@e22m4u/js-service");
|
|
4777
4486
|
init_definition();
|
|
4778
4487
|
init_relations2();
|
|
4779
4488
|
init_relations2();
|
|
4780
4489
|
init_where_clause_tool();
|
|
4781
4490
|
init_order_clause_tool();
|
|
4782
4491
|
init_slice_clause_tool();
|
|
4783
|
-
|
|
4492
|
+
init_errors();
|
|
4784
4493
|
init_relations2();
|
|
4785
4494
|
init_fields_clause_tool();
|
|
4786
4495
|
init_definition();
|
|
4787
4496
|
init_relations2();
|
|
4788
|
-
|
|
4497
|
+
_IncludeClauseTool = class _IncludeClauseTool extends import_js_service24.Service {
|
|
4789
4498
|
/**
|
|
4790
4499
|
* Include to.
|
|
4791
4500
|
*
|
|
@@ -4917,7 +4626,7 @@ var init_include_clause_tool = __esm({
|
|
|
4917
4626
|
);
|
|
4918
4627
|
break;
|
|
4919
4628
|
default:
|
|
4920
|
-
throw new
|
|
4629
|
+
throw new InvalidArgumentError(
|
|
4921
4630
|
"The relation type %v does not have an inclusion resolver.",
|
|
4922
4631
|
relDef.type
|
|
4923
4632
|
);
|
|
@@ -4950,14 +4659,14 @@ var init_include_clause_tool = __esm({
|
|
|
4950
4659
|
(name, i) => relNames.indexOf(name) !== i
|
|
4951
4660
|
);
|
|
4952
4661
|
if (duplicateNames.length)
|
|
4953
|
-
throw new
|
|
4662
|
+
throw new InvalidArgumentError(
|
|
4954
4663
|
'The provided option "include" has duplicates of %v.',
|
|
4955
4664
|
duplicateNames[0]
|
|
4956
4665
|
);
|
|
4957
4666
|
} else if (typeof clause === "object") {
|
|
4958
4667
|
if ("relation" in clause) {
|
|
4959
4668
|
if (!clause.relation || typeof clause.relation !== "string")
|
|
4960
|
-
throw new
|
|
4669
|
+
throw new InvalidArgumentError(
|
|
4961
4670
|
'The provided option "relation" should be a non-empty String, but %v given.',
|
|
4962
4671
|
clause.relation
|
|
4963
4672
|
);
|
|
@@ -4970,7 +4679,7 @@ var init_include_clause_tool = __esm({
|
|
|
4970
4679
|
});
|
|
4971
4680
|
}
|
|
4972
4681
|
} else {
|
|
4973
|
-
throw new
|
|
4682
|
+
throw new InvalidArgumentError(
|
|
4974
4683
|
'The provided option "include" should have a non-empty String, an Object or an Array, but %v given.',
|
|
4975
4684
|
clause
|
|
4976
4685
|
);
|
|
@@ -4984,7 +4693,7 @@ var init_include_clause_tool = __esm({
|
|
|
4984
4693
|
static validateScopeClause(clause) {
|
|
4985
4694
|
if (clause == null) return;
|
|
4986
4695
|
if (typeof clause !== "object" || Array.isArray(clause))
|
|
4987
|
-
throw new
|
|
4696
|
+
throw new InvalidArgumentError(
|
|
4988
4697
|
'The provided option "scope" should be an Object, but %v given.',
|
|
4989
4698
|
clause
|
|
4990
4699
|
);
|
|
@@ -5029,14 +4738,14 @@ var init_include_clause_tool = __esm({
|
|
|
5029
4738
|
(name, i) => relNames.indexOf(name) !== i
|
|
5030
4739
|
);
|
|
5031
4740
|
if (duplicateNames.length)
|
|
5032
|
-
throw new
|
|
4741
|
+
throw new InvalidArgumentError(
|
|
5033
4742
|
'The provided option "include" has duplicates of %v.',
|
|
5034
4743
|
duplicateNames[0]
|
|
5035
4744
|
);
|
|
5036
4745
|
} else if (typeof clause === "object") {
|
|
5037
4746
|
if ("relation" in clause) {
|
|
5038
4747
|
if (!clause.relation || typeof clause.relation !== "string")
|
|
5039
|
-
throw new
|
|
4748
|
+
throw new InvalidArgumentError(
|
|
5040
4749
|
'The provided option "relation" should be a non-empty String, but %v given.',
|
|
5041
4750
|
clause.relation
|
|
5042
4751
|
);
|
|
@@ -5055,7 +4764,7 @@ var init_include_clause_tool = __esm({
|
|
|
5055
4764
|
});
|
|
5056
4765
|
}
|
|
5057
4766
|
} else {
|
|
5058
|
-
throw new
|
|
4767
|
+
throw new InvalidArgumentError(
|
|
5059
4768
|
'The provided option "include" should have a non-empty String, an Object or an Array, but %v given.',
|
|
5060
4769
|
clause
|
|
5061
4770
|
);
|
|
@@ -5071,7 +4780,7 @@ var init_include_clause_tool = __esm({
|
|
|
5071
4780
|
static normalizeScopeClause(clause) {
|
|
5072
4781
|
if (clause == null) return;
|
|
5073
4782
|
if (typeof clause !== "object" || Array.isArray(clause))
|
|
5074
|
-
throw new
|
|
4783
|
+
throw new InvalidArgumentError(
|
|
5075
4784
|
'The provided option "scope" should be an Object, but %v given.',
|
|
5076
4785
|
clause
|
|
5077
4786
|
);
|
|
@@ -5103,6 +4812,8 @@ var init_include_clause_tool = __esm({
|
|
|
5103
4812
|
return void 0;
|
|
5104
4813
|
}
|
|
5105
4814
|
};
|
|
4815
|
+
__name(_IncludeClauseTool, "IncludeClauseTool");
|
|
4816
|
+
IncludeClauseTool = _IncludeClauseTool;
|
|
5106
4817
|
}
|
|
5107
4818
|
});
|
|
5108
4819
|
|
|
@@ -5120,15 +4831,15 @@ var init_filter = __esm({
|
|
|
5120
4831
|
});
|
|
5121
4832
|
|
|
5122
4833
|
// src/adapter/decorator/inclusion-decorator.js
|
|
5123
|
-
var InclusionDecorator;
|
|
4834
|
+
var import_js_service25, _InclusionDecorator, InclusionDecorator;
|
|
5124
4835
|
var init_inclusion_decorator = __esm({
|
|
5125
4836
|
"src/adapter/decorator/inclusion-decorator.js"() {
|
|
5126
4837
|
"use strict";
|
|
5127
4838
|
init_adapter();
|
|
5128
|
-
|
|
4839
|
+
import_js_service25 = require("@e22m4u/js-service");
|
|
5129
4840
|
init_filter();
|
|
5130
|
-
|
|
5131
|
-
|
|
4841
|
+
init_errors();
|
|
4842
|
+
_InclusionDecorator = class _InclusionDecorator extends import_js_service25.Service {
|
|
5132
4843
|
/**
|
|
5133
4844
|
* Decorate.
|
|
5134
4845
|
*
|
|
@@ -5136,12 +4847,12 @@ var init_inclusion_decorator = __esm({
|
|
|
5136
4847
|
*/
|
|
5137
4848
|
decorate(adapter) {
|
|
5138
4849
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5139
|
-
throw new
|
|
4850
|
+
throw new InvalidArgumentError(
|
|
5140
4851
|
"The first argument of InclusionDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5141
4852
|
adapter
|
|
5142
4853
|
);
|
|
5143
4854
|
const tool = adapter.getService(IncludeClauseTool);
|
|
5144
|
-
const includeTo = (...args) => tool.includeTo(...args);
|
|
4855
|
+
const includeTo = /* @__PURE__ */ __name((...args) => tool.includeTo(...args), "includeTo");
|
|
5145
4856
|
const create = adapter.create;
|
|
5146
4857
|
adapter.create = async function(modelName, modelData, filter) {
|
|
5147
4858
|
const retvalData = await create.call(this, modelName, modelData, filter);
|
|
@@ -5203,19 +4914,21 @@ var init_inclusion_decorator = __esm({
|
|
|
5203
4914
|
};
|
|
5204
4915
|
}
|
|
5205
4916
|
};
|
|
4917
|
+
__name(_InclusionDecorator, "InclusionDecorator");
|
|
4918
|
+
InclusionDecorator = _InclusionDecorator;
|
|
5206
4919
|
}
|
|
5207
4920
|
});
|
|
5208
4921
|
|
|
5209
4922
|
// src/adapter/decorator/default-values-decorator.js
|
|
5210
|
-
var DefaultValuesDecorator;
|
|
4923
|
+
var import_js_service26, _DefaultValuesDecorator, DefaultValuesDecorator;
|
|
5211
4924
|
var init_default_values_decorator = __esm({
|
|
5212
4925
|
"src/adapter/decorator/default-values-decorator.js"() {
|
|
5213
4926
|
"use strict";
|
|
5214
4927
|
init_adapter();
|
|
5215
|
-
|
|
5216
|
-
|
|
4928
|
+
import_js_service26 = require("@e22m4u/js-service");
|
|
4929
|
+
init_errors();
|
|
5217
4930
|
init_definition();
|
|
5218
|
-
|
|
4931
|
+
_DefaultValuesDecorator = class _DefaultValuesDecorator extends import_js_service26.Service {
|
|
5219
4932
|
/**
|
|
5220
4933
|
* Decorate.
|
|
5221
4934
|
*
|
|
@@ -5223,12 +4936,12 @@ var init_default_values_decorator = __esm({
|
|
|
5223
4936
|
*/
|
|
5224
4937
|
decorate(adapter) {
|
|
5225
4938
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5226
|
-
throw new
|
|
4939
|
+
throw new InvalidArgumentError(
|
|
5227
4940
|
"The first argument of DefaultValuesDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5228
4941
|
adapter
|
|
5229
4942
|
);
|
|
5230
4943
|
const utils = adapter.getService(ModelDefinitionUtils);
|
|
5231
|
-
const setDefaults = (...args) => utils.setDefaultValuesToEmptyProperties(...args);
|
|
4944
|
+
const setDefaults = /* @__PURE__ */ __name((...args) => utils.setDefaultValuesToEmptyProperties(...args), "setDefaults");
|
|
5232
4945
|
const create = adapter.create;
|
|
5233
4946
|
adapter.create = function(modelName, modelData, filter) {
|
|
5234
4947
|
modelData = setDefaults(modelName, modelData);
|
|
@@ -5266,19 +4979,21 @@ var init_default_values_decorator = __esm({
|
|
|
5266
4979
|
};
|
|
5267
4980
|
}
|
|
5268
4981
|
};
|
|
4982
|
+
__name(_DefaultValuesDecorator, "DefaultValuesDecorator");
|
|
4983
|
+
DefaultValuesDecorator = _DefaultValuesDecorator;
|
|
5269
4984
|
}
|
|
5270
4985
|
});
|
|
5271
4986
|
|
|
5272
4987
|
// src/adapter/decorator/data-sanitizing-decorator.js
|
|
5273
|
-
var DataSanitizingDecorator;
|
|
4988
|
+
var import_js_service27, _DataSanitizingDecorator, DataSanitizingDecorator;
|
|
5274
4989
|
var init_data_sanitizing_decorator = __esm({
|
|
5275
4990
|
"src/adapter/decorator/data-sanitizing-decorator.js"() {
|
|
5276
4991
|
"use strict";
|
|
5277
4992
|
init_adapter();
|
|
5278
|
-
|
|
5279
|
-
|
|
4993
|
+
import_js_service27 = require("@e22m4u/js-service");
|
|
4994
|
+
init_errors();
|
|
5280
4995
|
init_definition();
|
|
5281
|
-
|
|
4996
|
+
_DataSanitizingDecorator = class _DataSanitizingDecorator extends import_js_service27.Service {
|
|
5282
4997
|
/**
|
|
5283
4998
|
* Decorate.
|
|
5284
4999
|
*
|
|
@@ -5286,12 +5001,12 @@ var init_data_sanitizing_decorator = __esm({
|
|
|
5286
5001
|
*/
|
|
5287
5002
|
decorate(adapter) {
|
|
5288
5003
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5289
|
-
throw new
|
|
5004
|
+
throw new InvalidArgumentError(
|
|
5290
5005
|
"The first argument of DataSanitizingDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5291
5006
|
adapter
|
|
5292
5007
|
);
|
|
5293
5008
|
const sanitizer = adapter.getService(ModelDataSanitizer);
|
|
5294
|
-
const sanitize = (...args) => sanitizer.sanitize(...args);
|
|
5009
|
+
const sanitize = /* @__PURE__ */ __name((...args) => sanitizer.sanitize(...args), "sanitize");
|
|
5295
5010
|
const create = adapter.create;
|
|
5296
5011
|
adapter.create = async function(modelName, modelData, filter) {
|
|
5297
5012
|
modelData = sanitize(modelName, modelData);
|
|
@@ -5319,19 +5034,21 @@ var init_data_sanitizing_decorator = __esm({
|
|
|
5319
5034
|
};
|
|
5320
5035
|
}
|
|
5321
5036
|
};
|
|
5037
|
+
__name(_DataSanitizingDecorator, "DataSanitizingDecorator");
|
|
5038
|
+
DataSanitizingDecorator = _DataSanitizingDecorator;
|
|
5322
5039
|
}
|
|
5323
5040
|
});
|
|
5324
5041
|
|
|
5325
5042
|
// src/adapter/decorator/data-validation-decorator.js
|
|
5326
|
-
var DataValidationDecorator;
|
|
5043
|
+
var import_js_service28, _DataValidationDecorator, DataValidationDecorator;
|
|
5327
5044
|
var init_data_validation_decorator = __esm({
|
|
5328
5045
|
"src/adapter/decorator/data-validation-decorator.js"() {
|
|
5329
5046
|
"use strict";
|
|
5330
5047
|
init_adapter();
|
|
5331
|
-
|
|
5332
|
-
|
|
5048
|
+
import_js_service28 = require("@e22m4u/js-service");
|
|
5049
|
+
init_errors();
|
|
5333
5050
|
init_definition();
|
|
5334
|
-
|
|
5051
|
+
_DataValidationDecorator = class _DataValidationDecorator extends import_js_service28.Service {
|
|
5335
5052
|
/**
|
|
5336
5053
|
* Decorate.
|
|
5337
5054
|
*
|
|
@@ -5339,7 +5056,7 @@ var init_data_validation_decorator = __esm({
|
|
|
5339
5056
|
*/
|
|
5340
5057
|
decorate(adapter) {
|
|
5341
5058
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5342
|
-
throw new
|
|
5059
|
+
throw new InvalidArgumentError(
|
|
5343
5060
|
"The first argument of DataValidationDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5344
5061
|
adapter
|
|
5345
5062
|
);
|
|
@@ -5371,19 +5088,21 @@ var init_data_validation_decorator = __esm({
|
|
|
5371
5088
|
};
|
|
5372
5089
|
}
|
|
5373
5090
|
};
|
|
5091
|
+
__name(_DataValidationDecorator, "DataValidationDecorator");
|
|
5092
|
+
DataValidationDecorator = _DataValidationDecorator;
|
|
5374
5093
|
}
|
|
5375
5094
|
});
|
|
5376
5095
|
|
|
5377
5096
|
// src/adapter/decorator/fields-filtering-decorator.js
|
|
5378
|
-
var FieldsFilteringDecorator;
|
|
5097
|
+
var import_js_service29, _FieldsFilteringDecorator, FieldsFilteringDecorator;
|
|
5379
5098
|
var init_fields_filtering_decorator = __esm({
|
|
5380
5099
|
"src/adapter/decorator/fields-filtering-decorator.js"() {
|
|
5381
5100
|
"use strict";
|
|
5382
5101
|
init_adapter();
|
|
5383
|
-
|
|
5102
|
+
import_js_service29 = require("@e22m4u/js-service");
|
|
5384
5103
|
init_filter();
|
|
5385
|
-
|
|
5386
|
-
|
|
5104
|
+
init_errors();
|
|
5105
|
+
_FieldsFilteringDecorator = class _FieldsFilteringDecorator extends import_js_service29.Service {
|
|
5387
5106
|
/**
|
|
5388
5107
|
* Decorate.
|
|
5389
5108
|
*
|
|
@@ -5391,12 +5110,12 @@ var init_fields_filtering_decorator = __esm({
|
|
|
5391
5110
|
*/
|
|
5392
5111
|
decorate(adapter) {
|
|
5393
5112
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5394
|
-
throw new
|
|
5113
|
+
throw new InvalidArgumentError(
|
|
5395
5114
|
"The first argument of FieldsFilteringDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5396
5115
|
adapter
|
|
5397
5116
|
);
|
|
5398
5117
|
const tool = adapter.getService(FieldsClauseTool);
|
|
5399
|
-
const selectFields = (...args) => tool.filter(...args);
|
|
5118
|
+
const selectFields = /* @__PURE__ */ __name((...args) => tool.filter(...args), "selectFields");
|
|
5400
5119
|
const create = adapter.create;
|
|
5401
5120
|
adapter.create = async function(modelName, modelData, filter) {
|
|
5402
5121
|
let result = await create.call(this, modelName, modelData, filter);
|
|
@@ -5452,19 +5171,21 @@ var init_fields_filtering_decorator = __esm({
|
|
|
5452
5171
|
};
|
|
5453
5172
|
}
|
|
5454
5173
|
};
|
|
5174
|
+
__name(_FieldsFilteringDecorator, "FieldsFilteringDecorator");
|
|
5175
|
+
FieldsFilteringDecorator = _FieldsFilteringDecorator;
|
|
5455
5176
|
}
|
|
5456
5177
|
});
|
|
5457
5178
|
|
|
5458
5179
|
// src/adapter/decorator/data-transformation-decorator.js
|
|
5459
|
-
var DataTransformationDecorator;
|
|
5180
|
+
var import_js_service30, _DataTransformationDecorator, DataTransformationDecorator;
|
|
5460
5181
|
var init_data_transformation_decorator = __esm({
|
|
5461
5182
|
"src/adapter/decorator/data-transformation-decorator.js"() {
|
|
5462
5183
|
"use strict";
|
|
5463
5184
|
init_adapter();
|
|
5464
|
-
|
|
5465
|
-
|
|
5185
|
+
import_js_service30 = require("@e22m4u/js-service");
|
|
5186
|
+
init_errors();
|
|
5466
5187
|
init_definition();
|
|
5467
|
-
|
|
5188
|
+
_DataTransformationDecorator = class _DataTransformationDecorator extends import_js_service30.Service {
|
|
5468
5189
|
/**
|
|
5469
5190
|
* Decorate.
|
|
5470
5191
|
*
|
|
@@ -5472,7 +5193,7 @@ var init_data_transformation_decorator = __esm({
|
|
|
5472
5193
|
*/
|
|
5473
5194
|
decorate(adapter) {
|
|
5474
5195
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5475
|
-
throw new
|
|
5196
|
+
throw new InvalidArgumentError(
|
|
5476
5197
|
"The first argument of DataTransformerDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5477
5198
|
adapter
|
|
5478
5199
|
);
|
|
@@ -5504,19 +5225,21 @@ var init_data_transformation_decorator = __esm({
|
|
|
5504
5225
|
};
|
|
5505
5226
|
}
|
|
5506
5227
|
};
|
|
5228
|
+
__name(_DataTransformationDecorator, "DataTransformationDecorator");
|
|
5229
|
+
DataTransformationDecorator = _DataTransformationDecorator;
|
|
5507
5230
|
}
|
|
5508
5231
|
});
|
|
5509
5232
|
|
|
5510
5233
|
// src/adapter/decorator/property-uniqueness-decorator.js
|
|
5511
|
-
var PropertyUniquenessDecorator;
|
|
5234
|
+
var import_js_service31, _PropertyUniquenessDecorator, PropertyUniquenessDecorator;
|
|
5512
5235
|
var init_property_uniqueness_decorator = __esm({
|
|
5513
5236
|
"src/adapter/decorator/property-uniqueness-decorator.js"() {
|
|
5514
5237
|
"use strict";
|
|
5515
5238
|
init_adapter();
|
|
5516
|
-
|
|
5517
|
-
|
|
5239
|
+
import_js_service31 = require("@e22m4u/js-service");
|
|
5240
|
+
init_errors();
|
|
5518
5241
|
init_definition();
|
|
5519
|
-
|
|
5242
|
+
_PropertyUniquenessDecorator = class _PropertyUniquenessDecorator extends import_js_service31.Service {
|
|
5520
5243
|
/**
|
|
5521
5244
|
* Decorate.
|
|
5522
5245
|
*
|
|
@@ -5524,7 +5247,7 @@ var init_property_uniqueness_decorator = __esm({
|
|
|
5524
5247
|
*/
|
|
5525
5248
|
decorate(adapter) {
|
|
5526
5249
|
if (!adapter || !(adapter instanceof Adapter))
|
|
5527
|
-
throw new
|
|
5250
|
+
throw new InvalidArgumentError(
|
|
5528
5251
|
"The first argument of PropertyUniquenessDecorator.decorate should be an Adapter instance, but %v given.",
|
|
5529
5252
|
adapter
|
|
5530
5253
|
);
|
|
@@ -5578,6 +5301,8 @@ var init_property_uniqueness_decorator = __esm({
|
|
|
5578
5301
|
};
|
|
5579
5302
|
}
|
|
5580
5303
|
};
|
|
5304
|
+
__name(_PropertyUniquenessDecorator, "PropertyUniquenessDecorator");
|
|
5305
|
+
PropertyUniquenessDecorator = _PropertyUniquenessDecorator;
|
|
5581
5306
|
}
|
|
5582
5307
|
});
|
|
5583
5308
|
|
|
@@ -5596,12 +5321,12 @@ var init_decorator = __esm({
|
|
|
5596
5321
|
});
|
|
5597
5322
|
|
|
5598
5323
|
// src/adapter/adapter.js
|
|
5599
|
-
var Adapter;
|
|
5324
|
+
var import_js_service32, _Adapter, Adapter;
|
|
5600
5325
|
var init_adapter = __esm({
|
|
5601
5326
|
"src/adapter/adapter.js"() {
|
|
5602
5327
|
"use strict";
|
|
5603
|
-
|
|
5604
|
-
|
|
5328
|
+
import_js_service32 = require("@e22m4u/js-service");
|
|
5329
|
+
init_errors();
|
|
5605
5330
|
init_decorator();
|
|
5606
5331
|
init_decorator();
|
|
5607
5332
|
init_decorator();
|
|
@@ -5609,13 +5334,7 @@ var init_adapter = __esm({
|
|
|
5609
5334
|
init_decorator();
|
|
5610
5335
|
init_decorator();
|
|
5611
5336
|
init_decorator();
|
|
5612
|
-
|
|
5613
|
-
/**
|
|
5614
|
-
* Kind.
|
|
5615
|
-
*
|
|
5616
|
-
* @type {string}
|
|
5617
|
-
*/
|
|
5618
|
-
static kind = _Adapter.name;
|
|
5337
|
+
_Adapter = class _Adapter extends import_js_service32.Service {
|
|
5619
5338
|
/**
|
|
5620
5339
|
* Settings.
|
|
5621
5340
|
*
|
|
@@ -5801,6 +5520,14 @@ var init_adapter = __esm({
|
|
|
5801
5520
|
);
|
|
5802
5521
|
}
|
|
5803
5522
|
};
|
|
5523
|
+
__name(_Adapter, "Adapter");
|
|
5524
|
+
/**
|
|
5525
|
+
* Kind.
|
|
5526
|
+
*
|
|
5527
|
+
* @type {string}
|
|
5528
|
+
*/
|
|
5529
|
+
__publicField(_Adapter, "kind", "Adapter");
|
|
5530
|
+
Adapter = _Adapter;
|
|
5804
5531
|
}
|
|
5805
5532
|
});
|
|
5806
5533
|
|
|
@@ -5809,20 +5536,20 @@ var memory_adapter_exports = {};
|
|
|
5809
5536
|
__export(memory_adapter_exports, {
|
|
5810
5537
|
MemoryAdapter: () => MemoryAdapter
|
|
5811
5538
|
});
|
|
5812
|
-
var MemoryAdapter;
|
|
5539
|
+
var _MemoryAdapter, MemoryAdapter;
|
|
5813
5540
|
var init_memory_adapter = __esm({
|
|
5814
5541
|
"src/adapter/builtin/memory-adapter.js"() {
|
|
5815
5542
|
"use strict";
|
|
5816
5543
|
init_adapter();
|
|
5817
|
-
|
|
5818
|
-
|
|
5544
|
+
init_utils();
|
|
5545
|
+
init_utils();
|
|
5819
5546
|
init_definition();
|
|
5820
5547
|
init_filter();
|
|
5821
5548
|
init_filter();
|
|
5822
5549
|
init_filter();
|
|
5823
|
-
|
|
5550
|
+
init_errors();
|
|
5824
5551
|
init_definition();
|
|
5825
|
-
|
|
5552
|
+
_MemoryAdapter = class _MemoryAdapter extends Adapter {
|
|
5826
5553
|
/**
|
|
5827
5554
|
* Tables.
|
|
5828
5555
|
*
|
|
@@ -5862,7 +5589,7 @@ var init_memory_adapter = __esm({
|
|
|
5862
5589
|
ModelDefinitionUtils
|
|
5863
5590
|
).getDataTypeByPropertyName(modelName, propName);
|
|
5864
5591
|
if (propType !== DataType.ANY && propType !== DataType.NUMBER)
|
|
5865
|
-
throw new
|
|
5592
|
+
throw new InvalidArgumentError(
|
|
5866
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.",
|
|
5867
5594
|
propName,
|
|
5868
5595
|
modelName,
|
|
@@ -5898,7 +5625,7 @@ var init_memory_adapter = __esm({
|
|
|
5898
5625
|
}
|
|
5899
5626
|
const table = this._getTableOrCreate(modelName);
|
|
5900
5627
|
if (table.has(idValue))
|
|
5901
|
-
throw new
|
|
5628
|
+
throw new InvalidArgumentError(
|
|
5902
5629
|
"The value %v of the primary key %v already exists in the model %v.",
|
|
5903
5630
|
idValue,
|
|
5904
5631
|
pkPropName,
|
|
@@ -5931,7 +5658,7 @@ var init_memory_adapter = __esm({
|
|
|
5931
5658
|
modelName
|
|
5932
5659
|
);
|
|
5933
5660
|
if (!isExists)
|
|
5934
|
-
throw new
|
|
5661
|
+
throw new InvalidArgumentError(
|
|
5935
5662
|
"The value %v of the primary key %v does not exist in the model %v.",
|
|
5936
5663
|
id,
|
|
5937
5664
|
pkPropName,
|
|
@@ -6028,7 +5755,7 @@ var init_memory_adapter = __esm({
|
|
|
6028
5755
|
modelName
|
|
6029
5756
|
);
|
|
6030
5757
|
if (existingTableData == null)
|
|
6031
|
-
throw new
|
|
5758
|
+
throw new InvalidArgumentError(
|
|
6032
5759
|
"The value %v of the primary key %v does not exist in the model %v.",
|
|
6033
5760
|
id,
|
|
6034
5761
|
pkPropName,
|
|
@@ -6097,7 +5824,7 @@ var init_memory_adapter = __esm({
|
|
|
6097
5824
|
modelName
|
|
6098
5825
|
);
|
|
6099
5826
|
if (!tableData)
|
|
6100
|
-
throw new
|
|
5827
|
+
throw new InvalidArgumentError(
|
|
6101
5828
|
"The value %v of the primary key %v does not exist in the model %v.",
|
|
6102
5829
|
id,
|
|
6103
5830
|
pkPropName,
|
|
@@ -6181,6 +5908,8 @@ var init_memory_adapter = __esm({
|
|
|
6181
5908
|
return modelItems.length;
|
|
6182
5909
|
}
|
|
6183
5910
|
};
|
|
5911
|
+
__name(_MemoryAdapter, "MemoryAdapter");
|
|
5912
|
+
MemoryAdapter = _MemoryAdapter;
|
|
6184
5913
|
}
|
|
6185
5914
|
});
|
|
6186
5915
|
|
|
@@ -6199,23 +5928,22 @@ function findAdapterCtorInModule(module2) {
|
|
|
6199
5928
|
let adapterCtor;
|
|
6200
5929
|
if (!module2 || typeof module2 !== "object" || Array.isArray(module2)) return;
|
|
6201
5930
|
for (const ctor of Object.values(module2)) {
|
|
6202
|
-
|
|
6203
|
-
if (typeof ctor === "function" && ctor.kind === Adapter.name) {
|
|
5931
|
+
if (typeof ctor === "function" && ctor.kind === Adapter.kind) {
|
|
6204
5932
|
adapterCtor = ctor;
|
|
6205
5933
|
break;
|
|
6206
5934
|
}
|
|
6207
5935
|
}
|
|
6208
5936
|
return adapterCtor;
|
|
6209
5937
|
}
|
|
6210
|
-
var AdapterLoader;
|
|
5938
|
+
var import_js_service33, _AdapterLoader, AdapterLoader;
|
|
6211
5939
|
var init_adapter_loader = __esm({
|
|
6212
5940
|
"src/adapter/adapter-loader.js"() {
|
|
6213
5941
|
"use strict";
|
|
6214
5942
|
init_adapter();
|
|
6215
|
-
|
|
6216
|
-
|
|
5943
|
+
import_js_service33 = require("@e22m4u/js-service");
|
|
5944
|
+
init_errors();
|
|
6217
5945
|
init_();
|
|
6218
|
-
|
|
5946
|
+
_AdapterLoader = class _AdapterLoader extends import_js_service33.Service {
|
|
6219
5947
|
/**
|
|
6220
5948
|
* Load by name.
|
|
6221
5949
|
*
|
|
@@ -6225,7 +5953,7 @@ var init_adapter_loader = __esm({
|
|
|
6225
5953
|
*/
|
|
6226
5954
|
async loadByName(adapterName, settings = void 0) {
|
|
6227
5955
|
if (!adapterName || typeof adapterName !== "string")
|
|
6228
|
-
throw new
|
|
5956
|
+
throw new InvalidArgumentError(
|
|
6229
5957
|
"The adapter name should be a non-empty String, but %v given.",
|
|
6230
5958
|
adapterName
|
|
6231
5959
|
);
|
|
@@ -6242,26 +5970,29 @@ var init_adapter_loader = __esm({
|
|
|
6242
5970
|
} catch (e) {
|
|
6243
5971
|
}
|
|
6244
5972
|
if (!adapterCtor)
|
|
6245
|
-
throw new
|
|
5973
|
+
throw new InvalidArgumentError(
|
|
6246
5974
|
"The adapter %v is not found.",
|
|
6247
5975
|
adapterName
|
|
6248
5976
|
);
|
|
6249
5977
|
return new adapterCtor(this.container, settings);
|
|
6250
5978
|
}
|
|
6251
5979
|
};
|
|
5980
|
+
__name(_AdapterLoader, "AdapterLoader");
|
|
5981
|
+
AdapterLoader = _AdapterLoader;
|
|
5982
|
+
__name(findAdapterCtorInModule, "findAdapterCtorInModule");
|
|
6252
5983
|
}
|
|
6253
5984
|
});
|
|
6254
5985
|
|
|
6255
5986
|
// src/adapter/adapter-registry.js
|
|
6256
|
-
var AdapterRegistry;
|
|
5987
|
+
var import_js_service34, _AdapterRegistry, AdapterRegistry;
|
|
6257
5988
|
var init_adapter_registry = __esm({
|
|
6258
5989
|
"src/adapter/adapter-registry.js"() {
|
|
6259
5990
|
"use strict";
|
|
6260
5991
|
init_adapter();
|
|
6261
|
-
|
|
5992
|
+
import_js_service34 = require("@e22m4u/js-service");
|
|
6262
5993
|
init_adapter_loader();
|
|
6263
5994
|
init_definition();
|
|
6264
|
-
|
|
5995
|
+
_AdapterRegistry = class _AdapterRegistry extends import_js_service34.Service {
|
|
6265
5996
|
/**
|
|
6266
5997
|
* Adapters.
|
|
6267
5998
|
*
|
|
@@ -6287,6 +6018,8 @@ var init_adapter_registry = __esm({
|
|
|
6287
6018
|
return adapter;
|
|
6288
6019
|
}
|
|
6289
6020
|
};
|
|
6021
|
+
__name(_AdapterRegistry, "AdapterRegistry");
|
|
6022
|
+
AdapterRegistry = _AdapterRegistry;
|
|
6290
6023
|
}
|
|
6291
6024
|
});
|
|
6292
6025
|
|
|
@@ -6301,16 +6034,16 @@ var init_adapter2 = __esm({
|
|
|
6301
6034
|
});
|
|
6302
6035
|
|
|
6303
6036
|
// src/repository/repository.js
|
|
6304
|
-
var Repository;
|
|
6037
|
+
var import_js_service35, _Repository, Repository;
|
|
6305
6038
|
var init_repository = __esm({
|
|
6306
6039
|
"src/repository/repository.js"() {
|
|
6307
6040
|
"use strict";
|
|
6308
|
-
|
|
6041
|
+
import_js_service35 = require("@e22m4u/js-service");
|
|
6309
6042
|
init_adapter2();
|
|
6310
6043
|
init_adapter2();
|
|
6311
|
-
|
|
6044
|
+
init_errors();
|
|
6312
6045
|
init_definition();
|
|
6313
|
-
|
|
6046
|
+
_Repository = class _Repository extends import_js_service35.Service {
|
|
6314
6047
|
/**
|
|
6315
6048
|
* Model name.
|
|
6316
6049
|
*
|
|
@@ -6352,7 +6085,7 @@ var init_repository = __esm({
|
|
|
6352
6085
|
const modelDef = this.getService(DefinitionRegistry).getModel(modelName);
|
|
6353
6086
|
const datasourceName = modelDef.datasource;
|
|
6354
6087
|
if (!datasourceName)
|
|
6355
|
-
throw new
|
|
6088
|
+
throw new InvalidArgumentError(
|
|
6356
6089
|
"The model %v does not have a specified datasource.",
|
|
6357
6090
|
modelName
|
|
6358
6091
|
);
|
|
@@ -6498,18 +6231,20 @@ var init_repository = __esm({
|
|
|
6498
6231
|
return adapter.count(this.modelName, where);
|
|
6499
6232
|
}
|
|
6500
6233
|
};
|
|
6234
|
+
__name(_Repository, "Repository");
|
|
6235
|
+
Repository = _Repository;
|
|
6501
6236
|
}
|
|
6502
6237
|
});
|
|
6503
6238
|
|
|
6504
6239
|
// src/repository/repository-registry.js
|
|
6505
|
-
var RepositoryRegistry;
|
|
6240
|
+
var import_js_service36, _RepositoryRegistry, RepositoryRegistry;
|
|
6506
6241
|
var init_repository_registry = __esm({
|
|
6507
6242
|
"src/repository/repository-registry.js"() {
|
|
6508
6243
|
"use strict";
|
|
6509
|
-
|
|
6244
|
+
import_js_service36 = require("@e22m4u/js-service");
|
|
6510
6245
|
init_repository();
|
|
6511
|
-
|
|
6512
|
-
|
|
6246
|
+
init_errors();
|
|
6247
|
+
_RepositoryRegistry = class _RepositoryRegistry extends import_js_service36.Service {
|
|
6513
6248
|
/**
|
|
6514
6249
|
* Repositories.
|
|
6515
6250
|
*
|
|
@@ -6530,7 +6265,7 @@ var init_repository_registry = __esm({
|
|
|
6530
6265
|
*/
|
|
6531
6266
|
setRepositoryCtor(ctor) {
|
|
6532
6267
|
if (!ctor || typeof ctor !== "function" || !(ctor.prototype instanceof Repository)) {
|
|
6533
|
-
throw new
|
|
6268
|
+
throw new InvalidArgumentError(
|
|
6534
6269
|
"The first argument of RepositoryRegistry.setRepositoryCtor must inherit from Repository class, but %v given.",
|
|
6535
6270
|
ctor
|
|
6536
6271
|
);
|
|
@@ -6551,6 +6286,8 @@ var init_repository_registry = __esm({
|
|
|
6551
6286
|
return repository;
|
|
6552
6287
|
}
|
|
6553
6288
|
};
|
|
6289
|
+
__name(_RepositoryRegistry, "RepositoryRegistry");
|
|
6290
|
+
RepositoryRegistry = _RepositoryRegistry;
|
|
6554
6291
|
}
|
|
6555
6292
|
});
|
|
6556
6293
|
|
|
@@ -6580,7 +6317,7 @@ __export(src_exports, {
|
|
|
6580
6317
|
HasManyResolver: () => HasManyResolver,
|
|
6581
6318
|
HasOneResolver: () => HasOneResolver,
|
|
6582
6319
|
IncludeClauseTool: () => IncludeClauseTool,
|
|
6583
|
-
InvalidArgumentError: () =>
|
|
6320
|
+
InvalidArgumentError: () => InvalidArgumentError,
|
|
6584
6321
|
InvalidOperatorValueError: () => InvalidOperatorValueError,
|
|
6585
6322
|
ModelDataSanitizer: () => ModelDataSanitizer,
|
|
6586
6323
|
ModelDataTransformer: () => ModelDataTransformer,
|
|
@@ -6622,11 +6359,11 @@ __export(src_exports, {
|
|
|
6622
6359
|
module.exports = __toCommonJS(src_exports);
|
|
6623
6360
|
|
|
6624
6361
|
// src/schema.js
|
|
6625
|
-
|
|
6362
|
+
var import_js_service37 = require("@e22m4u/js-service");
|
|
6626
6363
|
init_repository2();
|
|
6627
6364
|
init_definition();
|
|
6628
6365
|
init_repository2();
|
|
6629
|
-
var
|
|
6366
|
+
var _Schema = class _Schema extends import_js_service37.Service {
|
|
6630
6367
|
/**
|
|
6631
6368
|
* Define datasource.
|
|
6632
6369
|
*
|
|
@@ -6657,10 +6394,12 @@ var Schema = class extends Service {
|
|
|
6657
6394
|
return this.getService(RepositoryRegistry).getRepository(modelName);
|
|
6658
6395
|
}
|
|
6659
6396
|
};
|
|
6397
|
+
__name(_Schema, "Schema");
|
|
6398
|
+
var Schema = _Schema;
|
|
6660
6399
|
|
|
6661
6400
|
// src/index.js
|
|
6662
|
-
|
|
6663
|
-
|
|
6401
|
+
init_utils();
|
|
6402
|
+
init_errors();
|
|
6664
6403
|
init_filter();
|
|
6665
6404
|
init_adapter2();
|
|
6666
6405
|
init_relations2();
|