remult 0.9.7 → 0.9.11
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/package.json +1 -1
- package/postgres/postgres-data-provider.js +6 -3
- package/postgres/postgres-data-provider.js.map +1 -1
- package/remult-knex/index.d.ts +42 -0
- package/remult-knex/index.js +768 -0
- package/remult-knex/index.js.map +1 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +4 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.js +123 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.js.map +1 -0
- package/src/backend-tests/my-test.backend-spec.d.ts +1 -0
- package/src/backend-tests/my-test.backend-spec.js +24 -0
- package/src/backend-tests/my-test.backend-spec.js.map +1 -0
- package/src/context.d.ts +7 -2
- package/src/context.js +19 -5
- package/src/context.js.map +1 -1
- package/src/data-providers/array-entity-data-provider.js +1 -1
- package/src/data-providers/array-entity-data-provider.js.map +1 -1
- package/src/data-providers/sql-database.js +1 -2
- package/src/data-providers/sql-database.js.map +1 -1
- package/src/entity.d.ts +3 -2
- package/src/remult3/RepositoryImplementation.d.ts +14 -2
- package/src/remult3/RepositoryImplementation.js +422 -136
- package/src/remult3/RepositoryImplementation.js.map +1 -1
- package/src/remult3/remult3.d.ts +6 -1
- package/src/shared-tests/db-tests-setup.d.ts +23 -0
- package/src/shared-tests/db-tests-setup.js +171 -0
- package/src/shared-tests/db-tests-setup.js.map +1 -0
- package/src/shared-tests/db-tests.db-tests.d.ts +5 -0
- package/src/shared-tests/db-tests.db-tests.js +1228 -0
- package/src/shared-tests/db-tests.db-tests.js.map +1 -0
- package/src/shared-tests/deleteAll.d.ts +2 -0
- package/src/shared-tests/deleteAll.js +22 -0
- package/src/shared-tests/deleteAll.js.map +1 -0
- package/src/shared-tests/entityWithValidations.d.ts +14 -0
- package/src/shared-tests/entityWithValidations.js +95 -0
- package/src/shared-tests/entityWithValidations.js.map +1 -0
- package/src/shared-tests/index.d.ts +4 -0
- package/src/shared-tests/index.js +7 -0
- package/src/shared-tests/index.js.map +1 -0
- package/src/shared-tests/test-custom-id-column.spec.d.ts +1 -0
- package/src/shared-tests/test-custom-id-column.spec.js +88 -0
- package/src/shared-tests/test-custom-id-column.spec.js.map +1 -0
- package/src/shared-tests/test-special-value.spec.d.ts +10 -0
- package/src/shared-tests/test-special-value.spec.js +129 -0
- package/src/shared-tests/test-special-value.spec.js.map +1 -0
- package/src/shared-tests/test-update-with-null.spec.d.ts +1 -0
- package/src/shared-tests/test-update-with-null.spec.js +52 -0
- package/src/shared-tests/test-update-with-null.spec.js.map +1 -0
- package/src/tests/Done.d.ts +5 -0
- package/src/tests/Done.js +18 -0
- package/src/tests/Done.js.map +1 -0
- package/src/tests/TestDataApiResponse.d.ts +10 -0
- package/src/tests/TestDataApiResponse.js +30 -0
- package/src/tests/TestDataApiResponse.js.map +1 -0
- package/src/tests/c.d.ts +8 -0
- package/src/tests/c.js +29 -0
- package/src/tests/c.js.map +1 -0
- package/src/tests/createData.d.ts +7 -0
- package/src/tests/createData.js +51 -0
- package/src/tests/createData.js.map +1 -0
- package/src/tests/d.d.ts +7 -0
- package/src/tests/d.js +44 -0
- package/src/tests/d.js.map +1 -0
- package/src/tests/dWithPrefilter.d.ts +7 -0
- package/src/tests/dWithPrefilter.js +46 -0
- package/src/tests/dWithPrefilter.js.map +1 -0
- package/src/tests/entityForCustomFilter.d.ts +16 -0
- package/src/tests/entityForCustomFilter.js +67 -0
- package/src/tests/entityForCustomFilter.js.map +1 -0
- package/src/tests/entityWithValidationsOnColumn.d.ts +5 -0
- package/src/tests/entityWithValidationsOnColumn.js +30 -0
- package/src/tests/entityWithValidationsOnColumn.js.map +1 -0
- package/src/tests/h.d.ts +6 -0
- package/src/tests/h.js +43 -0
- package/src/tests/h.js.map +1 -0
- package/src/tests/tasks.d.ts +6 -0
- package/src/tests/tasks.js +31 -0
- package/src/tests/tasks.js.map +1 -0
|
@@ -9,6 +9,34 @@ var sort_1 = require("../sort");
|
|
|
9
9
|
var valueConverters_1 = require("../../valueConverters");
|
|
10
10
|
var filter_interfaces_2 = require("../filter/filter-interfaces");
|
|
11
11
|
var assign_1 = require("../../assign");
|
|
12
|
+
var classValidatorValidate = undefined;
|
|
13
|
+
Promise.resolve().then(function () { return require("class-validator"); }).then(function (v) {
|
|
14
|
+
classValidatorValidate = function (item, ref) {
|
|
15
|
+
return v.validate(item).then(function (errors) {
|
|
16
|
+
var e_1, _a;
|
|
17
|
+
try {
|
|
18
|
+
for (var errors_1 = tslib_1.__values(errors), errors_1_1 = errors_1.next(); !errors_1_1.done; errors_1_1 = errors_1.next()) {
|
|
19
|
+
var err = errors_1_1.value;
|
|
20
|
+
for (var key in err.constraints) {
|
|
21
|
+
if (Object.prototype.hasOwnProperty.call(err.constraints, key)) {
|
|
22
|
+
var element = err.constraints[key];
|
|
23
|
+
ref.fields.find(err.property).error = element;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
29
|
+
finally {
|
|
30
|
+
try {
|
|
31
|
+
if (errors_1_1 && !errors_1_1.done && (_a = errors_1.return)) _a.call(errors_1);
|
|
32
|
+
}
|
|
33
|
+
finally { if (e_1) throw e_1.error; }
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
})
|
|
38
|
+
.catch(function () {
|
|
39
|
+
});
|
|
12
40
|
var RepositoryImplementation = /** @class */ (function () {
|
|
13
41
|
function RepositoryImplementation(entity, remult, dataProvider) {
|
|
14
42
|
this.entity = entity;
|
|
@@ -21,7 +49,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
21
49
|
RepositoryImplementation.prototype.createAfterFilter = function (orderBy, lastRow) {
|
|
22
50
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
23
51
|
var values, _a, _b, s, existingVal, r, equalToColumn, _c, _d, s, ff, f, equalToColumn_1, equalToColumn_1_1, c;
|
|
24
|
-
var
|
|
52
|
+
var e_2, _e, e_3, _f, e_4, _g;
|
|
25
53
|
return tslib_1.__generator(this, function (_h) {
|
|
26
54
|
values = new Map();
|
|
27
55
|
try {
|
|
@@ -39,12 +67,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
39
67
|
values.set(s.field.key, existingVal);
|
|
40
68
|
}
|
|
41
69
|
}
|
|
42
|
-
catch (
|
|
70
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
43
71
|
finally {
|
|
44
72
|
try {
|
|
45
73
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
46
74
|
}
|
|
47
|
-
finally { if (
|
|
75
|
+
finally { if (e_2) throw e_2.error; }
|
|
48
76
|
}
|
|
49
77
|
r = { $or: [] };
|
|
50
78
|
equalToColumn = [];
|
|
@@ -54,17 +82,17 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
54
82
|
ff = new filter_interfaces_2.filterHelper(s.field);
|
|
55
83
|
f = {};
|
|
56
84
|
try {
|
|
57
|
-
for (equalToColumn_1 = (
|
|
85
|
+
for (equalToColumn_1 = (e_4 = void 0, tslib_1.__values(equalToColumn)), equalToColumn_1_1 = equalToColumn_1.next(); !equalToColumn_1_1.done; equalToColumn_1_1 = equalToColumn_1.next()) {
|
|
58
86
|
c = equalToColumn_1_1.value;
|
|
59
87
|
f[c.key] = values.get(c.key);
|
|
60
88
|
}
|
|
61
89
|
}
|
|
62
|
-
catch (
|
|
90
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
63
91
|
finally {
|
|
64
92
|
try {
|
|
65
93
|
if (equalToColumn_1_1 && !equalToColumn_1_1.done && (_g = equalToColumn_1.return)) _g.call(equalToColumn_1);
|
|
66
94
|
}
|
|
67
|
-
finally { if (
|
|
95
|
+
finally { if (e_4) throw e_4.error; }
|
|
68
96
|
}
|
|
69
97
|
equalToColumn.push(s.field);
|
|
70
98
|
if (s.isDescending) {
|
|
@@ -75,12 +103,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
75
103
|
r.$or.push(f);
|
|
76
104
|
}
|
|
77
105
|
}
|
|
78
|
-
catch (
|
|
106
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
79
107
|
finally {
|
|
80
108
|
try {
|
|
81
109
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
82
110
|
}
|
|
83
|
-
finally { if (
|
|
111
|
+
finally { if (e_3) throw e_3.error; }
|
|
84
112
|
}
|
|
85
113
|
return [2 /*return*/, r];
|
|
86
114
|
});
|
|
@@ -94,6 +122,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
94
122
|
configurable: true
|
|
95
123
|
});
|
|
96
124
|
RepositoryImplementation.prototype.getCachedById = function (id) {
|
|
125
|
+
id = id + '';
|
|
97
126
|
this.getCachedByIdAsync(id);
|
|
98
127
|
var r = this.idCache.get(id);
|
|
99
128
|
if (r instanceof Promise)
|
|
@@ -107,6 +136,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
107
136
|
return tslib_1.__generator(this, function (_a) {
|
|
108
137
|
switch (_a.label) {
|
|
109
138
|
case 0:
|
|
139
|
+
id = id + '';
|
|
110
140
|
r = this.idCache.get(id);
|
|
111
141
|
if (!(r instanceof Promise)) return [3 /*break*/, 2];
|
|
112
142
|
return [4 /*yield*/, r];
|
|
@@ -134,7 +164,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
134
164
|
};
|
|
135
165
|
RepositoryImplementation.prototype.addToCache = function (item) {
|
|
136
166
|
if (item)
|
|
137
|
-
this.idCache.set(this.getEntityRef(item).getId(), item);
|
|
167
|
+
this.idCache.set(this.getEntityRef(item).getId() + '', item);
|
|
138
168
|
};
|
|
139
169
|
Object.defineProperty(RepositoryImplementation.prototype, "metadata", {
|
|
140
170
|
get: function () { return this._info; },
|
|
@@ -221,10 +251,11 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
221
251
|
};
|
|
222
252
|
RepositoryImplementation.prototype.find = function (options) {
|
|
223
253
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
224
|
-
var opt, _a, rawRows, loadFields, result;
|
|
254
|
+
var opt, _a, rawRows, loadFields, _b, _c, col, ei, load, repo, toLoad, rawRows_1, rawRows_1_1, r, val, rows, rows_1, rows_1_1, r, e_5_1, result;
|
|
255
|
+
var e_5, _d, e_6, _e, _f, e_7, _g;
|
|
225
256
|
var _this = this;
|
|
226
|
-
return tslib_1.__generator(this, function (
|
|
227
|
-
switch (
|
|
257
|
+
return tslib_1.__generator(this, function (_h) {
|
|
258
|
+
switch (_h.label) {
|
|
228
259
|
case 0:
|
|
229
260
|
opt = {};
|
|
230
261
|
if (!options)
|
|
@@ -236,24 +267,88 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
236
267
|
_a = opt;
|
|
237
268
|
return [4 /*yield*/, this.translateWhereToFilter(options.where)];
|
|
238
269
|
case 1:
|
|
239
|
-
_a.where =
|
|
270
|
+
_a.where = _h.sent();
|
|
240
271
|
opt.orderBy = sort_1.Sort.translateOrderByToSort(this.metadata, options.orderBy);
|
|
241
272
|
opt.limit = options.limit;
|
|
242
273
|
opt.page = options.page;
|
|
243
274
|
return [4 /*yield*/, this.edp.find(opt)];
|
|
244
275
|
case 2:
|
|
245
|
-
rawRows =
|
|
276
|
+
rawRows = _h.sent();
|
|
246
277
|
loadFields = undefined;
|
|
247
278
|
if (options.load)
|
|
248
279
|
loadFields = options.load(this.metadata.fields);
|
|
249
|
-
|
|
250
|
-
switch (_a.label) {
|
|
251
|
-
case 0: return [4 /*yield*/, this.mapRawDataToResult(r, loadFields)];
|
|
252
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
253
|
-
}
|
|
254
|
-
}); }); }))];
|
|
280
|
+
_h.label = 3;
|
|
255
281
|
case 3:
|
|
256
|
-
|
|
282
|
+
_h.trys.push([3, 8, 9, 10]);
|
|
283
|
+
_b = tslib_1.__values(this.metadata.fields), _c = _b.next();
|
|
284
|
+
_h.label = 4;
|
|
285
|
+
case 4:
|
|
286
|
+
if (!!_c.done) return [3 /*break*/, 7];
|
|
287
|
+
col = _c.value;
|
|
288
|
+
ei = getEntitySettings(col.valueType, false);
|
|
289
|
+
if (!ei) return [3 /*break*/, 6];
|
|
290
|
+
load = !col.options.lazy;
|
|
291
|
+
if (loadFields !== undefined)
|
|
292
|
+
load = loadFields.includes(col);
|
|
293
|
+
if (!load) return [3 /*break*/, 6];
|
|
294
|
+
repo = this.remult.repo(col.valueType);
|
|
295
|
+
toLoad = [];
|
|
296
|
+
try {
|
|
297
|
+
for (rawRows_1 = (e_6 = void 0, tslib_1.__values(rawRows)), rawRows_1_1 = rawRows_1.next(); !rawRows_1_1.done; rawRows_1_1 = rawRows_1.next()) {
|
|
298
|
+
r = rawRows_1_1.value;
|
|
299
|
+
val = r[col.key];
|
|
300
|
+
if (val !== undefined && val !== null && !toLoad.includes(val) && !repo.idCache.has(val)) {
|
|
301
|
+
toLoad.push(val);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
306
|
+
finally {
|
|
307
|
+
try {
|
|
308
|
+
if (rawRows_1_1 && !rawRows_1_1.done && (_e = rawRows_1.return)) _e.call(rawRows_1);
|
|
309
|
+
}
|
|
310
|
+
finally { if (e_6) throw e_6.error; }
|
|
311
|
+
}
|
|
312
|
+
if (!(toLoad.length > 0)) return [3 /*break*/, 6];
|
|
313
|
+
return [4 /*yield*/, repo.find({ where: (_f = repo.metadata.idMetadata).getIdFilter.apply(_f, tslib_1.__spread(toLoad)) })];
|
|
314
|
+
case 5:
|
|
315
|
+
rows = _h.sent();
|
|
316
|
+
try {
|
|
317
|
+
for (rows_1 = (e_7 = void 0, tslib_1.__values(rows)), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
|
|
318
|
+
r = rows_1_1.value;
|
|
319
|
+
repo.addToCache(r);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
323
|
+
finally {
|
|
324
|
+
try {
|
|
325
|
+
if (rows_1_1 && !rows_1_1.done && (_g = rows_1.return)) _g.call(rows_1);
|
|
326
|
+
}
|
|
327
|
+
finally { if (e_7) throw e_7.error; }
|
|
328
|
+
}
|
|
329
|
+
_h.label = 6;
|
|
330
|
+
case 6:
|
|
331
|
+
_c = _b.next();
|
|
332
|
+
return [3 /*break*/, 4];
|
|
333
|
+
case 7: return [3 /*break*/, 10];
|
|
334
|
+
case 8:
|
|
335
|
+
e_5_1 = _h.sent();
|
|
336
|
+
e_5 = { error: e_5_1 };
|
|
337
|
+
return [3 /*break*/, 10];
|
|
338
|
+
case 9:
|
|
339
|
+
try {
|
|
340
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
341
|
+
}
|
|
342
|
+
finally { if (e_5) throw e_5.error; }
|
|
343
|
+
return [7 /*endfinally*/];
|
|
344
|
+
case 10: return [4 /*yield*/, Promise.all(rawRows.map(function (r) { return tslib_1.__awaiter(_this, void 0, void 0, function () { return tslib_1.__generator(this, function (_a) {
|
|
345
|
+
switch (_a.label) {
|
|
346
|
+
case 0: return [4 /*yield*/, this.mapRawDataToResult(r, loadFields)];
|
|
347
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
348
|
+
}
|
|
349
|
+
}); }); }))];
|
|
350
|
+
case 11:
|
|
351
|
+
result = _h.sent();
|
|
257
352
|
return [2 /*return*/, result];
|
|
258
353
|
}
|
|
259
354
|
});
|
|
@@ -379,7 +474,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
379
474
|
RepositoryImplementation.prototype.fromJson = function (json, newRow) {
|
|
380
475
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
381
476
|
var obj, _a, _b, col, r, helper;
|
|
382
|
-
var
|
|
477
|
+
var e_8, _c;
|
|
383
478
|
return tslib_1.__generator(this, function (_d) {
|
|
384
479
|
switch (_d.label) {
|
|
385
480
|
case 0:
|
|
@@ -392,12 +487,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
392
487
|
}
|
|
393
488
|
}
|
|
394
489
|
}
|
|
395
|
-
catch (
|
|
490
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
396
491
|
finally {
|
|
397
492
|
try {
|
|
398
493
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
399
494
|
}
|
|
400
|
-
finally { if (
|
|
495
|
+
finally { if (e_8) throw e_8.error; }
|
|
401
496
|
}
|
|
402
497
|
if (!newRow) return [3 /*break*/, 2];
|
|
403
498
|
r = this.create();
|
|
@@ -497,28 +592,62 @@ function createOldEntity(entity, remult) {
|
|
|
497
592
|
var r = exports.columnsOfType.get(entity);
|
|
498
593
|
if (!r)
|
|
499
594
|
exports.columnsOfType.set(entity, r = []);
|
|
500
|
-
var info = getEntitySettings(entity);
|
|
595
|
+
var info = getEntitySettings(entity)(remult);
|
|
501
596
|
var key = getEntityKey(entity);
|
|
502
597
|
var base = Object.getPrototypeOf(entity);
|
|
503
|
-
|
|
598
|
+
var _loop_1 = function () {
|
|
599
|
+
var e_9, _a;
|
|
504
600
|
var baseCols = exports.columnsOfType.get(base);
|
|
505
601
|
if (baseCols) {
|
|
506
602
|
r.unshift.apply(r, tslib_1.__spread(baseCols.filter(function (x) { return !r.find(function (y) { return y.key == x.key; }); })));
|
|
507
603
|
}
|
|
604
|
+
var baseSettingsFactory = getEntitySettings(base, false);
|
|
605
|
+
if (baseSettingsFactory) {
|
|
606
|
+
var baseSettings_1 = baseSettingsFactory(remult);
|
|
607
|
+
info = tslib_1.__assign(tslib_1.__assign({}, baseSettings_1), info);
|
|
608
|
+
var functions = ["saving", "saved", "deleting", "deleted", "validation"];
|
|
609
|
+
var _loop_2 = function (key_1) {
|
|
610
|
+
if (baseSettings_1[key_1]) {
|
|
611
|
+
var x_1 = info[key_1];
|
|
612
|
+
info[key_1] = function (a, b) {
|
|
613
|
+
x_1(a, b);
|
|
614
|
+
baseSettings_1[key_1](a, b);
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
try {
|
|
619
|
+
for (var _b = (e_9 = void 0, tslib_1.__values(functions)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
620
|
+
var key_1 = _c.value;
|
|
621
|
+
_loop_2(key_1);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
625
|
+
finally {
|
|
626
|
+
try {
|
|
627
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
628
|
+
}
|
|
629
|
+
finally { if (e_9) throw e_9.error; }
|
|
630
|
+
}
|
|
631
|
+
}
|
|
508
632
|
base = Object.getPrototypeOf(base);
|
|
633
|
+
};
|
|
634
|
+
while (base != null) {
|
|
635
|
+
_loop_1();
|
|
509
636
|
}
|
|
510
|
-
return new EntityFullInfo(prepareColumnInfo(r, remult), info
|
|
637
|
+
return new EntityFullInfo(prepareColumnInfo(r, remult), info, remult, entity, key);
|
|
511
638
|
}
|
|
512
639
|
exports.createOldEntity = createOldEntity;
|
|
513
640
|
var rowHelperBase = /** @class */ (function () {
|
|
514
641
|
function rowHelperBase(columnsInfo, instance, remult) {
|
|
515
|
-
var
|
|
642
|
+
var e_10, _a;
|
|
643
|
+
var _this = this;
|
|
516
644
|
this.columnsInfo = columnsInfo;
|
|
517
645
|
this.instance = instance;
|
|
518
646
|
this.remult = remult;
|
|
647
|
+
this._isLoading = false;
|
|
519
648
|
this.lookups = new Map();
|
|
520
649
|
this.originalValues = {};
|
|
521
|
-
var
|
|
650
|
+
var _loop_3 = function (col) {
|
|
522
651
|
var ei = getEntitySettings(col.valueType, false);
|
|
523
652
|
if (ei && remult) {
|
|
524
653
|
var lookup_1 = new column_1.LookupColumn(remult.repo(col.valueType), undefined);
|
|
@@ -526,31 +655,117 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
526
655
|
var val = instance[col.key];
|
|
527
656
|
Object.defineProperty(instance, col.key, {
|
|
528
657
|
get: function () {
|
|
658
|
+
_this._reportObserved();
|
|
529
659
|
return lookup_1.item;
|
|
530
660
|
},
|
|
531
661
|
set: function (val) {
|
|
532
|
-
|
|
662
|
+
lookup_1.set(val);
|
|
663
|
+
_this._reportChanged();
|
|
533
664
|
},
|
|
534
665
|
enumerable: true
|
|
535
666
|
});
|
|
536
667
|
instance[col.key] = val;
|
|
537
668
|
}
|
|
669
|
+
else {
|
|
670
|
+
}
|
|
538
671
|
};
|
|
539
672
|
var this_1 = this;
|
|
540
673
|
try {
|
|
541
674
|
for (var columnsInfo_1 = tslib_1.__values(columnsInfo), columnsInfo_1_1 = columnsInfo_1.next(); !columnsInfo_1_1.done; columnsInfo_1_1 = columnsInfo_1.next()) {
|
|
542
675
|
var col = columnsInfo_1_1.value;
|
|
543
|
-
|
|
676
|
+
_loop_3(col);
|
|
544
677
|
}
|
|
545
678
|
}
|
|
546
|
-
catch (
|
|
679
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
547
680
|
finally {
|
|
548
681
|
try {
|
|
549
682
|
if (columnsInfo_1_1 && !columnsInfo_1_1.done && (_a = columnsInfo_1.return)) _a.call(columnsInfo_1);
|
|
550
683
|
}
|
|
551
|
-
finally { if (
|
|
684
|
+
finally { if (e_10) throw e_10.error; }
|
|
552
685
|
}
|
|
553
686
|
}
|
|
687
|
+
Object.defineProperty(rowHelperBase.prototype, "error", {
|
|
688
|
+
get: function () {
|
|
689
|
+
this._reportObserved();
|
|
690
|
+
return this._error;
|
|
691
|
+
},
|
|
692
|
+
set: function (val) {
|
|
693
|
+
this._error = val;
|
|
694
|
+
this._reportChanged();
|
|
695
|
+
},
|
|
696
|
+
enumerable: false,
|
|
697
|
+
configurable: true
|
|
698
|
+
});
|
|
699
|
+
rowHelperBase.prototype._reportChanged = function () {
|
|
700
|
+
if (this._subscribers)
|
|
701
|
+
this._subscribers.forEach(function (x) { return x.reportChanged(); });
|
|
702
|
+
};
|
|
703
|
+
rowHelperBase.prototype._reportObserved = function () {
|
|
704
|
+
if (this._subscribers)
|
|
705
|
+
this._subscribers.forEach(function (x) { return x.reportObserved(); });
|
|
706
|
+
};
|
|
707
|
+
rowHelperBase.prototype.subscribe = function (listener) {
|
|
708
|
+
var e_11, _a;
|
|
709
|
+
var _this = this;
|
|
710
|
+
var list;
|
|
711
|
+
if (typeof listener === "function")
|
|
712
|
+
list = {
|
|
713
|
+
reportChanged: function () { return listener(); },
|
|
714
|
+
reportObserved: function () { }
|
|
715
|
+
};
|
|
716
|
+
else
|
|
717
|
+
list = listener;
|
|
718
|
+
if (!this._subscribers) {
|
|
719
|
+
this._subscribers = [];
|
|
720
|
+
var _loop_4 = function (col) {
|
|
721
|
+
var ei = getEntitySettings(col.valueType, false);
|
|
722
|
+
if (ei && this_2.remult) {
|
|
723
|
+
}
|
|
724
|
+
else {
|
|
725
|
+
var val_1 = this_2.instance[col.key];
|
|
726
|
+
Object.defineProperty(this_2.instance, col.key, {
|
|
727
|
+
get: function () {
|
|
728
|
+
_this._reportObserved();
|
|
729
|
+
return val_1;
|
|
730
|
+
},
|
|
731
|
+
set: function (value) {
|
|
732
|
+
val_1 = value;
|
|
733
|
+
_this._reportChanged();
|
|
734
|
+
},
|
|
735
|
+
enumerable: true
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
var this_2 = this;
|
|
740
|
+
try {
|
|
741
|
+
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
742
|
+
var col = _c.value;
|
|
743
|
+
_loop_4(col);
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
747
|
+
finally {
|
|
748
|
+
try {
|
|
749
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
750
|
+
}
|
|
751
|
+
finally { if (e_11) throw e_11.error; }
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
this._subscribers.push(list);
|
|
755
|
+
return function () { return _this._subscribers = _this._subscribers.filter(function (x) { return x != listener; }); };
|
|
756
|
+
};
|
|
757
|
+
Object.defineProperty(rowHelperBase.prototype, "isLoading", {
|
|
758
|
+
get: function () {
|
|
759
|
+
this._reportObserved();
|
|
760
|
+
return this._isLoading;
|
|
761
|
+
},
|
|
762
|
+
set: function (val) {
|
|
763
|
+
this._isLoading = val;
|
|
764
|
+
this._reportChanged();
|
|
765
|
+
},
|
|
766
|
+
enumerable: false,
|
|
767
|
+
configurable: true
|
|
768
|
+
});
|
|
554
769
|
rowHelperBase.prototype.waitLoad = function () {
|
|
555
770
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
556
771
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -564,7 +779,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
564
779
|
});
|
|
565
780
|
};
|
|
566
781
|
rowHelperBase.prototype.__assertValidity = function () {
|
|
567
|
-
var
|
|
782
|
+
var e_12, _a;
|
|
568
783
|
if (!this.hasErrors()) {
|
|
569
784
|
var error = {
|
|
570
785
|
modelState: Object.assign({}, this.errors),
|
|
@@ -581,12 +796,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
581
796
|
}
|
|
582
797
|
}
|
|
583
798
|
}
|
|
584
|
-
catch (
|
|
799
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
585
800
|
finally {
|
|
586
801
|
try {
|
|
587
802
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
588
803
|
}
|
|
589
|
-
finally { if (
|
|
804
|
+
finally { if (e_12) throw e_12.error; }
|
|
590
805
|
}
|
|
591
806
|
}
|
|
592
807
|
throw error;
|
|
@@ -618,12 +833,14 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
618
833
|
rowHelperBase.prototype.__clearErrors = function () {
|
|
619
834
|
this.errors = undefined;
|
|
620
835
|
this.error = undefined;
|
|
836
|
+
this._reportChanged();
|
|
621
837
|
};
|
|
622
838
|
rowHelperBase.prototype.hasErrors = function () {
|
|
839
|
+
this._reportObserved();
|
|
623
840
|
return !!!this.error && this.errors == undefined;
|
|
624
841
|
};
|
|
625
842
|
rowHelperBase.prototype.copyDataToObject = function () {
|
|
626
|
-
var
|
|
843
|
+
var e_13, _a;
|
|
627
844
|
var d = {};
|
|
628
845
|
try {
|
|
629
846
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -642,12 +859,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
642
859
|
d[col.key] = val;
|
|
643
860
|
}
|
|
644
861
|
}
|
|
645
|
-
catch (
|
|
862
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
646
863
|
finally {
|
|
647
864
|
try {
|
|
648
865
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
649
866
|
}
|
|
650
|
-
finally { if (
|
|
867
|
+
finally { if (e_13) throw e_13.error; }
|
|
651
868
|
}
|
|
652
869
|
return d;
|
|
653
870
|
};
|
|
@@ -661,8 +878,13 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
661
878
|
switch (_a.label) {
|
|
662
879
|
case 0:
|
|
663
880
|
this.__clearErrors();
|
|
664
|
-
return [
|
|
881
|
+
if (!classValidatorValidate) return [3 /*break*/, 2];
|
|
882
|
+
return [4 /*yield*/, classValidatorValidate(this.instance, this)];
|
|
665
883
|
case 1:
|
|
884
|
+
_a.sent();
|
|
885
|
+
_a.label = 2;
|
|
886
|
+
case 2: return [4 /*yield*/, this.__performColumnAndEntityValidations()];
|
|
887
|
+
case 3:
|
|
666
888
|
_a.sent();
|
|
667
889
|
r = this.hasErrors();
|
|
668
890
|
return [2 /*return*/, r];
|
|
@@ -676,8 +898,13 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
676
898
|
switch (_a.label) {
|
|
677
899
|
case 0:
|
|
678
900
|
this.__clearErrors();
|
|
679
|
-
return [
|
|
901
|
+
if (!classValidatorValidate) return [3 /*break*/, 2];
|
|
902
|
+
return [4 /*yield*/, classValidatorValidate(this.instance, this)];
|
|
680
903
|
case 1:
|
|
904
|
+
_a.sent();
|
|
905
|
+
_a.label = 2;
|
|
906
|
+
case 2: return [4 /*yield*/, this.__performColumnAndEntityValidations()];
|
|
907
|
+
case 3:
|
|
681
908
|
_a.sent();
|
|
682
909
|
this.__assertValidity();
|
|
683
910
|
return [2 /*return*/];
|
|
@@ -693,7 +920,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
693
920
|
});
|
|
694
921
|
};
|
|
695
922
|
rowHelperBase.prototype.toApiJson = function () {
|
|
696
|
-
var
|
|
923
|
+
var e_14, _a;
|
|
697
924
|
var result = {};
|
|
698
925
|
try {
|
|
699
926
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -718,19 +945,19 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
718
945
|
}
|
|
719
946
|
}
|
|
720
947
|
}
|
|
721
|
-
catch (
|
|
948
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
722
949
|
finally {
|
|
723
950
|
try {
|
|
724
951
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
725
952
|
}
|
|
726
|
-
finally { if (
|
|
953
|
+
finally { if (e_14) throw e_14.error; }
|
|
727
954
|
}
|
|
728
955
|
return result;
|
|
729
956
|
};
|
|
730
957
|
rowHelperBase.prototype._updateEntityBasedOnApi = function (body) {
|
|
731
958
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
732
959
|
var keys, _a, _b, col, lu;
|
|
733
|
-
var
|
|
960
|
+
var e_15, _c;
|
|
734
961
|
return tslib_1.__generator(this, function (_d) {
|
|
735
962
|
switch (_d.label) {
|
|
736
963
|
case 0:
|
|
@@ -750,12 +977,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
750
977
|
}
|
|
751
978
|
}
|
|
752
979
|
}
|
|
753
|
-
catch (
|
|
980
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
754
981
|
finally {
|
|
755
982
|
try {
|
|
756
983
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
757
984
|
}
|
|
758
|
-
finally { if (
|
|
985
|
+
finally { if (e_15) throw e_15.error; }
|
|
759
986
|
}
|
|
760
987
|
return [4 /*yield*/, Promise.all(tslib_1.__spread(this.fields).map(function (x) { return x.load(); }))];
|
|
761
988
|
case 1:
|
|
@@ -770,7 +997,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
770
997
|
var rowHelperImplementation = /** @class */ (function (_super) {
|
|
771
998
|
tslib_1.__extends(rowHelperImplementation, _super);
|
|
772
999
|
function rowHelperImplementation(info, instance, repository, edp, remult, _isNew) {
|
|
773
|
-
var
|
|
1000
|
+
var e_16, _a;
|
|
774
1001
|
var _this = _super.call(this, info.columnsInfo, instance, remult) || this;
|
|
775
1002
|
_this.info = info;
|
|
776
1003
|
_this.repository = repository;
|
|
@@ -791,14 +1018,18 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
791
1018
|
}
|
|
792
1019
|
}
|
|
793
1020
|
}
|
|
794
|
-
catch (
|
|
1021
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
795
1022
|
finally {
|
|
796
1023
|
try {
|
|
797
1024
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
798
1025
|
}
|
|
799
|
-
finally { if (
|
|
1026
|
+
finally { if (e_16) throw e_16.error; }
|
|
800
1027
|
}
|
|
801
1028
|
}
|
|
1029
|
+
if (_this.info.options.entityRefInit)
|
|
1030
|
+
_this.info.options.entityRefInit(_this, instance);
|
|
1031
|
+
if (context_1.Remult.entityRefInit)
|
|
1032
|
+
context_1.Remult.entityRefInit(_this, instance);
|
|
802
1033
|
return _this;
|
|
803
1034
|
}
|
|
804
1035
|
Object.defineProperty(rowHelperImplementation.prototype, "apiUpdateAllowed", {
|
|
@@ -823,11 +1054,13 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
823
1054
|
return this.instance[this.info.idMetadata.field.key];
|
|
824
1055
|
};
|
|
825
1056
|
rowHelperImplementation.prototype.wasDeleted = function () {
|
|
1057
|
+
this._reportObserved();
|
|
826
1058
|
return this._wasDeleted;
|
|
827
1059
|
};
|
|
828
1060
|
rowHelperImplementation.prototype.undoChanges = function () {
|
|
829
1061
|
this.loadDataFrom(this.originalValues);
|
|
830
1062
|
this.__clearErrors();
|
|
1063
|
+
this._reportChanged();
|
|
831
1064
|
};
|
|
832
1065
|
rowHelperImplementation.prototype.reload = function () {
|
|
833
1066
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -847,6 +1080,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
847
1080
|
}); })];
|
|
848
1081
|
case 1:
|
|
849
1082
|
_a.sent();
|
|
1083
|
+
this._reportChanged();
|
|
850
1084
|
return [2 /*return*/, this.instance];
|
|
851
1085
|
}
|
|
852
1086
|
});
|
|
@@ -854,7 +1088,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
854
1088
|
};
|
|
855
1089
|
Object.defineProperty(rowHelperImplementation.prototype, "fields", {
|
|
856
1090
|
get: function () {
|
|
857
|
-
var _a,
|
|
1091
|
+
var _a, e_17, _b;
|
|
858
1092
|
if (!this._columns) {
|
|
859
1093
|
var _items_1 = [];
|
|
860
1094
|
var r_1 = (_a = {
|
|
@@ -868,12 +1102,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
868
1102
|
_items_1.push(r_1[c.key] = new FieldRefImplementation(c, this.info.fields[c.key], this.instance, this, this));
|
|
869
1103
|
}
|
|
870
1104
|
}
|
|
871
|
-
catch (
|
|
1105
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
872
1106
|
finally {
|
|
873
1107
|
try {
|
|
874
1108
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
875
1109
|
}
|
|
876
|
-
finally { if (
|
|
1110
|
+
finally { if (e_17) throw e_17.error; }
|
|
877
1111
|
}
|
|
878
1112
|
this._columns = r_1;
|
|
879
1113
|
}
|
|
@@ -884,30 +1118,55 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
884
1118
|
});
|
|
885
1119
|
rowHelperImplementation.prototype.save = function () {
|
|
886
1120
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
887
|
-
var
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1121
|
+
var doNotSave_1, d, ignoreKeys, _a, _b, field, f, updatedRow, changesOnly, wasChanged, key, element, err_1;
|
|
1122
|
+
var e_18, _c;
|
|
1123
|
+
return tslib_1.__generator(this, function (_d) {
|
|
1124
|
+
switch (_d.label) {
|
|
1125
|
+
case 0:
|
|
1126
|
+
_d.trys.push([0, , 17, 18]);
|
|
1127
|
+
this.isLoading = true;
|
|
1128
|
+
return [4 /*yield*/, this.__validateEntity()];
|
|
891
1129
|
case 1:
|
|
892
|
-
|
|
893
|
-
|
|
1130
|
+
_d.sent();
|
|
1131
|
+
doNotSave_1 = false;
|
|
894
1132
|
if (!this.info.entityInfo.saving) return [3 /*break*/, 3];
|
|
895
|
-
return [4 /*yield*/, this.info.entityInfo.saving(this.instance, function () { return
|
|
1133
|
+
return [4 /*yield*/, this.info.entityInfo.saving(this.instance, function () { return doNotSave_1 = true; })];
|
|
896
1134
|
case 2:
|
|
897
|
-
|
|
898
|
-
|
|
1135
|
+
_d.sent();
|
|
1136
|
+
_d.label = 3;
|
|
899
1137
|
case 3:
|
|
900
1138
|
this.__assertValidity();
|
|
901
1139
|
d = this.copyDataToObject();
|
|
1140
|
+
ignoreKeys = [];
|
|
1141
|
+
try {
|
|
1142
|
+
for (_a = tslib_1.__values(this.metadata.fields), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
1143
|
+
field = _b.value;
|
|
1144
|
+
if (field.dbReadOnly || field == this.metadata.idMetadata.field && this.metadata.options.dbAutoIncrementId) {
|
|
1145
|
+
d[field.key] = undefined;
|
|
1146
|
+
ignoreKeys.push(field.key);
|
|
1147
|
+
f = this.fields.find(field);
|
|
1148
|
+
f.value = f.originalValue;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1153
|
+
finally {
|
|
1154
|
+
try {
|
|
1155
|
+
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1156
|
+
}
|
|
1157
|
+
finally { if (e_18) throw e_18.error; }
|
|
1158
|
+
}
|
|
902
1159
|
if (this.info.idMetadata.field instanceof column_1.CompoundIdField)
|
|
903
1160
|
d.id = undefined;
|
|
904
|
-
|
|
1161
|
+
updatedRow = void 0;
|
|
1162
|
+
_d.label = 4;
|
|
905
1163
|
case 4:
|
|
906
|
-
|
|
1164
|
+
_d.trys.push([4, 14, , 16]);
|
|
1165
|
+
this._reportChanged();
|
|
907
1166
|
if (!this.isNew()) return [3 /*break*/, 6];
|
|
908
1167
|
return [4 /*yield*/, this.edp.insert(d)];
|
|
909
1168
|
case 5:
|
|
910
|
-
updatedRow =
|
|
1169
|
+
updatedRow = _d.sent();
|
|
911
1170
|
return [3 /*break*/, 10];
|
|
912
1171
|
case 6:
|
|
913
1172
|
changesOnly = {};
|
|
@@ -915,7 +1174,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
915
1174
|
for (key in d) {
|
|
916
1175
|
if (Object.prototype.hasOwnProperty.call(d, key)) {
|
|
917
1176
|
element = d[key];
|
|
918
|
-
if (element !== this.originalValues[key]) {
|
|
1177
|
+
if (element !== this.originalValues[key] && !ignoreKeys.includes(key)) {
|
|
919
1178
|
changesOnly[key] = element;
|
|
920
1179
|
wasChanged = true;
|
|
921
1180
|
}
|
|
@@ -923,34 +1182,39 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
923
1182
|
}
|
|
924
1183
|
if (!wasChanged)
|
|
925
1184
|
return [2 /*return*/, this.instance];
|
|
926
|
-
if (!
|
|
1185
|
+
if (!doNotSave_1) return [3 /*break*/, 8];
|
|
927
1186
|
return [4 /*yield*/, this.edp.find({ where: this.getIdFilter() })];
|
|
928
1187
|
case 7:
|
|
929
|
-
updatedRow = (
|
|
1188
|
+
updatedRow = (_d.sent())[0];
|
|
930
1189
|
return [3 /*break*/, 10];
|
|
931
1190
|
case 8: return [4 /*yield*/, this.edp.update(this.id, changesOnly)];
|
|
932
1191
|
case 9:
|
|
933
|
-
updatedRow =
|
|
934
|
-
|
|
1192
|
+
updatedRow = _d.sent();
|
|
1193
|
+
_d.label = 10;
|
|
935
1194
|
case 10: return [4 /*yield*/, this.loadDataFrom(updatedRow)];
|
|
936
1195
|
case 11:
|
|
937
|
-
|
|
1196
|
+
_d.sent();
|
|
938
1197
|
if (!this.info.entityInfo.saved) return [3 /*break*/, 13];
|
|
939
1198
|
return [4 /*yield*/, this.info.entityInfo.saved(this.instance)];
|
|
940
1199
|
case 12:
|
|
941
|
-
|
|
942
|
-
|
|
1200
|
+
_d.sent();
|
|
1201
|
+
_d.label = 13;
|
|
943
1202
|
case 13:
|
|
944
1203
|
this.saveOriginalData();
|
|
945
1204
|
this._isNew = false;
|
|
946
1205
|
return [2 /*return*/, this.instance];
|
|
947
1206
|
case 14:
|
|
948
|
-
err_1 =
|
|
1207
|
+
err_1 = _d.sent();
|
|
949
1208
|
return [4 /*yield*/, this.catchSaveErrors(err_1)];
|
|
950
1209
|
case 15:
|
|
951
|
-
|
|
1210
|
+
_d.sent();
|
|
952
1211
|
return [3 /*break*/, 16];
|
|
953
|
-
case 16: return [
|
|
1212
|
+
case 16: return [3 /*break*/, 18];
|
|
1213
|
+
case 17:
|
|
1214
|
+
this.isLoading = false;
|
|
1215
|
+
this._reportChanged();
|
|
1216
|
+
return [7 /*endfinally*/];
|
|
1217
|
+
case 18: return [2 /*return*/];
|
|
954
1218
|
}
|
|
955
1219
|
});
|
|
956
1220
|
});
|
|
@@ -960,8 +1224,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
960
1224
|
};
|
|
961
1225
|
rowHelperImplementation.prototype.delete = function () {
|
|
962
1226
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
963
|
-
var _a, _b, listener,
|
|
964
|
-
var
|
|
1227
|
+
var _a, _b, listener, e_19_1, err_2;
|
|
1228
|
+
var e_19, _c;
|
|
965
1229
|
return tslib_1.__generator(this, function (_d) {
|
|
966
1230
|
switch (_d.label) {
|
|
967
1231
|
case 0:
|
|
@@ -1003,14 +1267,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1003
1267
|
return [3 /*break*/, 8];
|
|
1004
1268
|
case 11: return [3 /*break*/, 14];
|
|
1005
1269
|
case 12:
|
|
1006
|
-
|
|
1007
|
-
|
|
1270
|
+
e_19_1 = _d.sent();
|
|
1271
|
+
e_19 = { error: e_19_1 };
|
|
1008
1272
|
return [3 /*break*/, 14];
|
|
1009
1273
|
case 13:
|
|
1010
1274
|
try {
|
|
1011
1275
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1012
1276
|
}
|
|
1013
|
-
finally { if (
|
|
1277
|
+
finally { if (e_19) throw e_19.error; }
|
|
1014
1278
|
return [7 /*endfinally*/];
|
|
1015
1279
|
case 14:
|
|
1016
1280
|
this._wasDeleted = true;
|
|
@@ -1028,8 +1292,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1028
1292
|
};
|
|
1029
1293
|
rowHelperImplementation.prototype.loadDataFrom = function (data, loadItems) {
|
|
1030
1294
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1031
|
-
var _a, _b, col, lu,
|
|
1032
|
-
var
|
|
1295
|
+
var _a, _b, col, lu, e_20_1;
|
|
1296
|
+
var e_20, _c;
|
|
1033
1297
|
return tslib_1.__generator(this, function (_d) {
|
|
1034
1298
|
switch (_d.label) {
|
|
1035
1299
|
case 0:
|
|
@@ -1064,14 +1328,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1064
1328
|
return [3 /*break*/, 1];
|
|
1065
1329
|
case 9: return [3 /*break*/, 12];
|
|
1066
1330
|
case 10:
|
|
1067
|
-
|
|
1068
|
-
|
|
1331
|
+
e_20_1 = _d.sent();
|
|
1332
|
+
e_20 = { error: e_20_1 };
|
|
1069
1333
|
return [3 /*break*/, 12];
|
|
1070
1334
|
case 11:
|
|
1071
1335
|
try {
|
|
1072
1336
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1073
1337
|
}
|
|
1074
|
-
finally { if (
|
|
1338
|
+
finally { if (e_20) throw e_20.error; }
|
|
1075
1339
|
return [7 /*endfinally*/];
|
|
1076
1340
|
case 12: return [4 /*yield*/, this.calcServerExpression()];
|
|
1077
1341
|
case 13:
|
|
@@ -1091,8 +1355,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1091
1355
|
};
|
|
1092
1356
|
rowHelperImplementation.prototype.calcServerExpression = function () {
|
|
1093
1357
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1094
|
-
var _a, _b, col, _c, _d,
|
|
1095
|
-
var
|
|
1358
|
+
var _a, _b, col, _c, _d, e_21_1;
|
|
1359
|
+
var e_21, _e;
|
|
1096
1360
|
return tslib_1.__generator(this, function (_f) {
|
|
1097
1361
|
switch (_f.label) {
|
|
1098
1362
|
case 0:
|
|
@@ -1117,14 +1381,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1117
1381
|
return [3 /*break*/, 2];
|
|
1118
1382
|
case 5: return [3 /*break*/, 8];
|
|
1119
1383
|
case 6:
|
|
1120
|
-
|
|
1121
|
-
|
|
1384
|
+
e_21_1 = _f.sent();
|
|
1385
|
+
e_21 = { error: e_21_1 };
|
|
1122
1386
|
return [3 /*break*/, 8];
|
|
1123
1387
|
case 7:
|
|
1124
1388
|
try {
|
|
1125
1389
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1126
1390
|
}
|
|
1127
|
-
finally { if (
|
|
1391
|
+
finally { if (e_21) throw e_21.error; }
|
|
1128
1392
|
return [7 /*endfinally*/];
|
|
1129
1393
|
case 8: return [2 /*return*/];
|
|
1130
1394
|
}
|
|
@@ -1132,10 +1396,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1132
1396
|
});
|
|
1133
1397
|
};
|
|
1134
1398
|
rowHelperImplementation.prototype.isNew = function () {
|
|
1399
|
+
this._reportObserved();
|
|
1135
1400
|
return this._isNew;
|
|
1136
1401
|
};
|
|
1137
1402
|
rowHelperImplementation.prototype.wasChanged = function () {
|
|
1138
|
-
var
|
|
1403
|
+
var e_22, _a;
|
|
1404
|
+
this._reportObserved();
|
|
1139
1405
|
try {
|
|
1140
1406
|
for (var _b = tslib_1.__values(this.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1141
1407
|
var col = _c.value;
|
|
@@ -1143,19 +1409,19 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1143
1409
|
return true;
|
|
1144
1410
|
}
|
|
1145
1411
|
}
|
|
1146
|
-
catch (
|
|
1412
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1147
1413
|
finally {
|
|
1148
1414
|
try {
|
|
1149
1415
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1150
1416
|
}
|
|
1151
|
-
finally { if (
|
|
1417
|
+
finally { if (e_22) throw e_22.error; }
|
|
1152
1418
|
}
|
|
1153
1419
|
return false;
|
|
1154
1420
|
};
|
|
1155
1421
|
rowHelperImplementation.prototype.__performColumnAndEntityValidations = function () {
|
|
1156
1422
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1157
|
-
var _a, _b, c, col,
|
|
1158
|
-
var
|
|
1423
|
+
var _a, _b, c, col, e_23_1, _c, _d, listener, e_24_1;
|
|
1424
|
+
var e_23, _e, e_24, _f;
|
|
1159
1425
|
return tslib_1.__generator(this, function (_g) {
|
|
1160
1426
|
switch (_g.label) {
|
|
1161
1427
|
case 0:
|
|
@@ -1176,18 +1442,18 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1176
1442
|
return [3 /*break*/, 1];
|
|
1177
1443
|
case 4: return [3 /*break*/, 7];
|
|
1178
1444
|
case 5:
|
|
1179
|
-
|
|
1180
|
-
|
|
1445
|
+
e_23_1 = _g.sent();
|
|
1446
|
+
e_23 = { error: e_23_1 };
|
|
1181
1447
|
return [3 /*break*/, 7];
|
|
1182
1448
|
case 6:
|
|
1183
1449
|
try {
|
|
1184
1450
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1185
1451
|
}
|
|
1186
|
-
finally { if (
|
|
1452
|
+
finally { if (e_23) throw e_23.error; }
|
|
1187
1453
|
return [7 /*endfinally*/];
|
|
1188
1454
|
case 7:
|
|
1189
1455
|
if (!this.info.entityInfo.validation) return [3 /*break*/, 9];
|
|
1190
|
-
return [4 /*yield*/, this.info.entityInfo.validation(this.instance)];
|
|
1456
|
+
return [4 /*yield*/, this.info.entityInfo.validation(this.instance, this)];
|
|
1191
1457
|
case 8:
|
|
1192
1458
|
_g.sent();
|
|
1193
1459
|
_g.label = 9;
|
|
@@ -1210,14 +1476,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1210
1476
|
return [3 /*break*/, 11];
|
|
1211
1477
|
case 14: return [3 /*break*/, 17];
|
|
1212
1478
|
case 15:
|
|
1213
|
-
|
|
1214
|
-
|
|
1479
|
+
e_24_1 = _g.sent();
|
|
1480
|
+
e_24 = { error: e_24_1 };
|
|
1215
1481
|
return [3 /*break*/, 17];
|
|
1216
1482
|
case 16:
|
|
1217
1483
|
try {
|
|
1218
1484
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
1219
1485
|
}
|
|
1220
|
-
finally { if (
|
|
1486
|
+
finally { if (e_24) throw e_24.error; }
|
|
1221
1487
|
return [7 /*endfinally*/];
|
|
1222
1488
|
case 17: return [2 /*return*/];
|
|
1223
1489
|
}
|
|
@@ -1259,7 +1525,7 @@ exports.getControllerRef = getControllerRef;
|
|
|
1259
1525
|
var controllerRefImpl = /** @class */ (function (_super) {
|
|
1260
1526
|
tslib_1.__extends(controllerRefImpl, _super);
|
|
1261
1527
|
function controllerRefImpl(columnsInfo, instance, remult) {
|
|
1262
|
-
var _a,
|
|
1528
|
+
var _a, e_25, _b;
|
|
1263
1529
|
var _this = _super.call(this, columnsInfo, instance, remult) || this;
|
|
1264
1530
|
var _items = [];
|
|
1265
1531
|
var r = (_a = {
|
|
@@ -1273,20 +1539,20 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1273
1539
|
_items.push(r[col.key] = new FieldRefImplementation(col, new columnDefsImpl(col, undefined, remult), instance, undefined, _this));
|
|
1274
1540
|
}
|
|
1275
1541
|
}
|
|
1276
|
-
catch (
|
|
1542
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1277
1543
|
finally {
|
|
1278
1544
|
try {
|
|
1279
1545
|
if (columnsInfo_2_1 && !columnsInfo_2_1.done && (_b = columnsInfo_2.return)) _b.call(columnsInfo_2);
|
|
1280
1546
|
}
|
|
1281
|
-
finally { if (
|
|
1547
|
+
finally { if (e_25) throw e_25.error; }
|
|
1282
1548
|
}
|
|
1283
1549
|
_this.fields = r;
|
|
1284
1550
|
return _this;
|
|
1285
1551
|
}
|
|
1286
1552
|
controllerRefImpl.prototype.__performColumnAndEntityValidations = function () {
|
|
1287
1553
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1288
|
-
var _a, _b, col,
|
|
1289
|
-
var
|
|
1554
|
+
var _a, _b, col, e_26_1;
|
|
1555
|
+
var e_26, _c;
|
|
1290
1556
|
return tslib_1.__generator(this, function (_d) {
|
|
1291
1557
|
switch (_d.label) {
|
|
1292
1558
|
case 0:
|
|
@@ -1306,14 +1572,14 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1306
1572
|
return [3 /*break*/, 1];
|
|
1307
1573
|
case 4: return [3 /*break*/, 7];
|
|
1308
1574
|
case 5:
|
|
1309
|
-
|
|
1310
|
-
|
|
1575
|
+
e_26_1 = _d.sent();
|
|
1576
|
+
e_26 = { error: e_26_1 };
|
|
1311
1577
|
return [3 /*break*/, 7];
|
|
1312
1578
|
case 6:
|
|
1313
1579
|
try {
|
|
1314
1580
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1315
1581
|
}
|
|
1316
|
-
finally { if (
|
|
1582
|
+
finally { if (e_26) throw e_26.error; }
|
|
1317
1583
|
return [7 /*endfinally*/];
|
|
1318
1584
|
case 7: return [2 /*return*/];
|
|
1319
1585
|
}
|
|
@@ -1334,6 +1600,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1334
1600
|
this.entityRef = this.helper;
|
|
1335
1601
|
}
|
|
1336
1602
|
FieldRefImplementation.prototype.valueIsNull = function () {
|
|
1603
|
+
this.rowBase._reportObserved();
|
|
1337
1604
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1338
1605
|
if (lu) {
|
|
1339
1606
|
return lu.id === undefined || lu.id === null;
|
|
@@ -1341,6 +1608,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1341
1608
|
return this.value === null;
|
|
1342
1609
|
};
|
|
1343
1610
|
FieldRefImplementation.prototype.originalValueIsNull = function () {
|
|
1611
|
+
this.rowBase._reportObserved();
|
|
1344
1612
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1345
1613
|
return this.rawOriginalValue() === null;
|
|
1346
1614
|
};
|
|
@@ -1366,6 +1634,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1366
1634
|
};
|
|
1367
1635
|
Object.defineProperty(FieldRefImplementation.prototype, "error", {
|
|
1368
1636
|
get: function () {
|
|
1637
|
+
this.rowBase._reportObserved();
|
|
1369
1638
|
if (!this.rowBase.errors)
|
|
1370
1639
|
return undefined;
|
|
1371
1640
|
return this.rowBase.errors[this.metadata.key];
|
|
@@ -1374,12 +1643,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1374
1643
|
if (!this.rowBase.errors)
|
|
1375
1644
|
this.rowBase.errors = {};
|
|
1376
1645
|
this.rowBase.errors[this.metadata.key] = error;
|
|
1646
|
+
this.rowBase._reportChanged();
|
|
1377
1647
|
},
|
|
1378
1648
|
enumerable: false,
|
|
1379
1649
|
configurable: true
|
|
1380
1650
|
});
|
|
1381
1651
|
Object.defineProperty(FieldRefImplementation.prototype, "displayValue", {
|
|
1382
1652
|
get: function () {
|
|
1653
|
+
this.rowBase._reportObserved();
|
|
1383
1654
|
if (this.value != undefined) {
|
|
1384
1655
|
if (this.settings.displayValue)
|
|
1385
1656
|
return this.settings.displayValue(this.container, this.value);
|
|
@@ -1404,6 +1675,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1404
1675
|
;
|
|
1405
1676
|
Object.defineProperty(FieldRefImplementation.prototype, "originalValue", {
|
|
1406
1677
|
get: function () {
|
|
1678
|
+
this.rowBase._reportObserved();
|
|
1407
1679
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1408
1680
|
if (lu)
|
|
1409
1681
|
return lu.get(this.rawOriginalValue());
|
|
@@ -1418,6 +1690,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1418
1690
|
};
|
|
1419
1691
|
Object.defineProperty(FieldRefImplementation.prototype, "inputValue", {
|
|
1420
1692
|
get: function () {
|
|
1693
|
+
this.rowBase._reportObserved();
|
|
1421
1694
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1422
1695
|
if (lu)
|
|
1423
1696
|
return lu.id != undefined ? lu.id.toString() : null;
|
|
@@ -1436,6 +1709,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1436
1709
|
});
|
|
1437
1710
|
;
|
|
1438
1711
|
FieldRefImplementation.prototype.valueChanged = function () {
|
|
1712
|
+
this.rowBase._reportObserved();
|
|
1439
1713
|
var val = this.value;
|
|
1440
1714
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1441
1715
|
if (lu) {
|
|
@@ -1445,8 +1719,8 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1445
1719
|
};
|
|
1446
1720
|
FieldRefImplementation.prototype.__performValidation = function () {
|
|
1447
1721
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1448
|
-
var x, _a, _b, v,
|
|
1449
|
-
var
|
|
1722
|
+
var x, _a, _b, v, e_27_1;
|
|
1723
|
+
var e_27, _c;
|
|
1450
1724
|
return tslib_1.__generator(this, function (_d) {
|
|
1451
1725
|
switch (_d.label) {
|
|
1452
1726
|
case 0:
|
|
@@ -1469,14 +1743,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1469
1743
|
return [3 /*break*/, 2];
|
|
1470
1744
|
case 5: return [3 /*break*/, 8];
|
|
1471
1745
|
case 6:
|
|
1472
|
-
|
|
1473
|
-
|
|
1746
|
+
e_27_1 = _d.sent();
|
|
1747
|
+
e_27 = { error: e_27_1 };
|
|
1474
1748
|
return [3 /*break*/, 8];
|
|
1475
1749
|
case 7:
|
|
1476
1750
|
try {
|
|
1477
1751
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1478
1752
|
}
|
|
1479
|
-
finally { if (
|
|
1753
|
+
finally { if (e_27) throw e_27.error; }
|
|
1480
1754
|
return [7 /*endfinally*/];
|
|
1481
1755
|
case 8: return [3 /*break*/, 11];
|
|
1482
1756
|
case 9:
|
|
@@ -1603,7 +1877,7 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
1603
1877
|
exports.columnDefsImpl = columnDefsImpl;
|
|
1604
1878
|
var EntityFullInfo = /** @class */ (function () {
|
|
1605
1879
|
function EntityFullInfo(columnsInfo, entityInfo, remult, entityType, key) {
|
|
1606
|
-
var _a,
|
|
1880
|
+
var _a, e_28, _b;
|
|
1607
1881
|
var _this = this;
|
|
1608
1882
|
this.columnsInfo = columnsInfo;
|
|
1609
1883
|
this.entityInfo = entityInfo;
|
|
@@ -1622,14 +1896,26 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
1622
1896
|
isIdField: function (col) {
|
|
1623
1897
|
return col.key == _this.idMetadata.field.key;
|
|
1624
1898
|
},
|
|
1625
|
-
getIdFilter: function (
|
|
1626
|
-
var _a;
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1899
|
+
getIdFilter: function () {
|
|
1900
|
+
var _a, _b;
|
|
1901
|
+
var ids = [];
|
|
1902
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1903
|
+
ids[_i] = arguments[_i];
|
|
1904
|
+
}
|
|
1905
|
+
if (_this.idMetadata.field instanceof column_1.CompoundIdField) {
|
|
1906
|
+
var field_1 = _this.idMetadata.field;
|
|
1907
|
+
return {
|
|
1908
|
+
$or: ids.map(function (x) { return field_1.isEqualTo(x); })
|
|
1909
|
+
};
|
|
1910
|
+
}
|
|
1911
|
+
if (ids.length == 1)
|
|
1630
1912
|
return _a = {},
|
|
1631
|
-
_a[_this.idMetadata.field.key] =
|
|
1913
|
+
_a[_this.idMetadata.field.key] = ids[0],
|
|
1632
1914
|
_a;
|
|
1915
|
+
else
|
|
1916
|
+
return _b = {},
|
|
1917
|
+
_b[_this.idMetadata.field.key] = ids,
|
|
1918
|
+
_b;
|
|
1633
1919
|
}
|
|
1634
1920
|
};
|
|
1635
1921
|
if (this.options.allowApiCrud !== undefined) {
|
|
@@ -1660,12 +1946,12 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
1660
1946
|
_items.push(r[x.key] = new columnDefsImpl(x, this, remult));
|
|
1661
1947
|
}
|
|
1662
1948
|
}
|
|
1663
|
-
catch (
|
|
1949
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
1664
1950
|
finally {
|
|
1665
1951
|
try {
|
|
1666
1952
|
if (columnsInfo_3_1 && !columnsInfo_3_1.done && (_b = columnsInfo_3.return)) _b.call(columnsInfo_3);
|
|
1667
1953
|
}
|
|
1668
|
-
finally { if (
|
|
1954
|
+
finally { if (e_28) throw e_28.error; }
|
|
1669
1955
|
}
|
|
1670
1956
|
this.fields = r;
|
|
1671
1957
|
this.dbAutoIncrementId = entityInfo.dbAutoIncrementId;
|
|
@@ -1832,7 +2118,7 @@ function Field() {
|
|
|
1832
2118
|
exports.Field = Field;
|
|
1833
2119
|
var storableMember = Symbol("storableMember");
|
|
1834
2120
|
function buildOptions(options, remult) {
|
|
1835
|
-
var
|
|
2121
|
+
var e_29, _a;
|
|
1836
2122
|
var r = {};
|
|
1837
2123
|
try {
|
|
1838
2124
|
for (var options_1 = tslib_1.__values(options), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) {
|
|
@@ -1845,12 +2131,12 @@ function buildOptions(options, remult) {
|
|
|
1845
2131
|
}
|
|
1846
2132
|
}
|
|
1847
2133
|
}
|
|
1848
|
-
catch (
|
|
2134
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
1849
2135
|
finally {
|
|
1850
2136
|
try {
|
|
1851
2137
|
if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1);
|
|
1852
2138
|
}
|
|
1853
|
-
finally { if (
|
|
2139
|
+
finally { if (e_29) throw e_29.error; }
|
|
1854
2140
|
}
|
|
1855
2141
|
return r;
|
|
1856
2142
|
}
|
|
@@ -1933,7 +2219,7 @@ function Entity(key) {
|
|
|
1933
2219
|
}
|
|
1934
2220
|
}
|
|
1935
2221
|
var factory = function (remult) {
|
|
1936
|
-
var
|
|
2222
|
+
var e_30, _a;
|
|
1937
2223
|
var r = {};
|
|
1938
2224
|
try {
|
|
1939
2225
|
for (var options_2 = tslib_1.__values(options), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) {
|
|
@@ -1946,12 +2232,12 @@ function Entity(key) {
|
|
|
1946
2232
|
}
|
|
1947
2233
|
}
|
|
1948
2234
|
}
|
|
1949
|
-
catch (
|
|
2235
|
+
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
1950
2236
|
finally {
|
|
1951
2237
|
try {
|
|
1952
2238
|
if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2);
|
|
1953
2239
|
}
|
|
1954
|
-
finally { if (
|
|
2240
|
+
finally { if (e_30) throw e_30.error; }
|
|
1955
2241
|
}
|
|
1956
2242
|
var base = Object.getPrototypeOf(target);
|
|
1957
2243
|
if (base) {
|
|
@@ -2040,9 +2326,9 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2040
2326
|
});
|
|
2041
2327
|
};
|
|
2042
2328
|
QueryResultImpl.prototype.forEach = function (what) {
|
|
2043
|
-
var
|
|
2329
|
+
var e_31, _a;
|
|
2044
2330
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2045
|
-
var i, _b, _c, x,
|
|
2331
|
+
var i, _b, _c, x, e_31_1;
|
|
2046
2332
|
return tslib_1.__generator(this, function (_d) {
|
|
2047
2333
|
switch (_d.label) {
|
|
2048
2334
|
case 0:
|
|
@@ -2064,8 +2350,8 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2064
2350
|
case 5: return [3 /*break*/, 2];
|
|
2065
2351
|
case 6: return [3 /*break*/, 13];
|
|
2066
2352
|
case 7:
|
|
2067
|
-
|
|
2068
|
-
|
|
2353
|
+
e_31_1 = _d.sent();
|
|
2354
|
+
e_31 = { error: e_31_1 };
|
|
2069
2355
|
return [3 /*break*/, 13];
|
|
2070
2356
|
case 8:
|
|
2071
2357
|
_d.trys.push([8, , 11, 12]);
|
|
@@ -2076,7 +2362,7 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2076
2362
|
_d.label = 10;
|
|
2077
2363
|
case 10: return [3 /*break*/, 12];
|
|
2078
2364
|
case 11:
|
|
2079
|
-
if (
|
|
2365
|
+
if (e_31) throw e_31.error;
|
|
2080
2366
|
return [7 /*endfinally*/];
|
|
2081
2367
|
case 12: return [7 /*endfinally*/];
|
|
2082
2368
|
case 13: return [2 /*return*/, i];
|