remult 0.9.9 → 0.9.13
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/remult-knex/index.d.ts +1 -0
- package/remult-knex/index.js +56 -3
- package/remult-knex/index.js.map +1 -1
- package/src/backend-tests/backend-database-test-setup.backend-spec.js +31 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.js.map +1 -1
- package/src/context.d.ts +2 -1
- package/src/context.js.map +1 -1
- package/src/entity.d.ts +3 -2
- package/src/remult3/RepositoryImplementation.d.ts +9 -3
- package/src/remult3/RepositoryImplementation.js +205 -120
- package/src/remult3/RepositoryImplementation.js.map +1 -1
- package/src/remult3/remult3.d.ts +4 -1
- package/src/shared-tests/db-tests.db-tests.js +22 -0
- package/src/shared-tests/db-tests.db-tests.js.map +1 -1
|
@@ -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
|
});
|
|
@@ -223,8 +251,8 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
223
251
|
};
|
|
224
252
|
RepositoryImplementation.prototype.find = function (options) {
|
|
225
253
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
226
|
-
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,
|
|
227
|
-
var
|
|
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;
|
|
228
256
|
var _this = this;
|
|
229
257
|
return tslib_1.__generator(this, function (_h) {
|
|
230
258
|
switch (_h.label) {
|
|
@@ -266,7 +294,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
266
294
|
repo = this.remult.repo(col.valueType);
|
|
267
295
|
toLoad = [];
|
|
268
296
|
try {
|
|
269
|
-
for (rawRows_1 = (
|
|
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()) {
|
|
270
298
|
r = rawRows_1_1.value;
|
|
271
299
|
val = r[col.key];
|
|
272
300
|
if (val !== undefined && val !== null && !toLoad.includes(val) && !repo.idCache.has(val)) {
|
|
@@ -274,29 +302,29 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
274
302
|
}
|
|
275
303
|
}
|
|
276
304
|
}
|
|
277
|
-
catch (
|
|
305
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
278
306
|
finally {
|
|
279
307
|
try {
|
|
280
308
|
if (rawRows_1_1 && !rawRows_1_1.done && (_e = rawRows_1.return)) _e.call(rawRows_1);
|
|
281
309
|
}
|
|
282
|
-
finally { if (
|
|
310
|
+
finally { if (e_6) throw e_6.error; }
|
|
283
311
|
}
|
|
284
312
|
if (!(toLoad.length > 0)) return [3 /*break*/, 6];
|
|
285
313
|
return [4 /*yield*/, repo.find({ where: (_f = repo.metadata.idMetadata).getIdFilter.apply(_f, tslib_1.__spread(toLoad)) })];
|
|
286
314
|
case 5:
|
|
287
315
|
rows = _h.sent();
|
|
288
316
|
try {
|
|
289
|
-
for (rows_1 = (
|
|
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()) {
|
|
290
318
|
r = rows_1_1.value;
|
|
291
319
|
repo.addToCache(r);
|
|
292
320
|
}
|
|
293
321
|
}
|
|
294
|
-
catch (
|
|
322
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
295
323
|
finally {
|
|
296
324
|
try {
|
|
297
325
|
if (rows_1_1 && !rows_1_1.done && (_g = rows_1.return)) _g.call(rows_1);
|
|
298
326
|
}
|
|
299
|
-
finally { if (
|
|
327
|
+
finally { if (e_7) throw e_7.error; }
|
|
300
328
|
}
|
|
301
329
|
_h.label = 6;
|
|
302
330
|
case 6:
|
|
@@ -304,14 +332,14 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
304
332
|
return [3 /*break*/, 4];
|
|
305
333
|
case 7: return [3 /*break*/, 10];
|
|
306
334
|
case 8:
|
|
307
|
-
|
|
308
|
-
|
|
335
|
+
e_5_1 = _h.sent();
|
|
336
|
+
e_5 = { error: e_5_1 };
|
|
309
337
|
return [3 /*break*/, 10];
|
|
310
338
|
case 9:
|
|
311
339
|
try {
|
|
312
340
|
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
313
341
|
}
|
|
314
|
-
finally { if (
|
|
342
|
+
finally { if (e_5) throw e_5.error; }
|
|
315
343
|
return [7 /*endfinally*/];
|
|
316
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) {
|
|
317
345
|
switch (_a.label) {
|
|
@@ -446,7 +474,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
446
474
|
RepositoryImplementation.prototype.fromJson = function (json, newRow) {
|
|
447
475
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
448
476
|
var obj, _a, _b, col, r, helper;
|
|
449
|
-
var
|
|
477
|
+
var e_8, _c;
|
|
450
478
|
return tslib_1.__generator(this, function (_d) {
|
|
451
479
|
switch (_d.label) {
|
|
452
480
|
case 0:
|
|
@@ -459,12 +487,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
459
487
|
}
|
|
460
488
|
}
|
|
461
489
|
}
|
|
462
|
-
catch (
|
|
490
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
463
491
|
finally {
|
|
464
492
|
try {
|
|
465
493
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
466
494
|
}
|
|
467
|
-
finally { if (
|
|
495
|
+
finally { if (e_8) throw e_8.error; }
|
|
468
496
|
}
|
|
469
497
|
if (!newRow) return [3 /*break*/, 2];
|
|
470
498
|
r = this.create();
|
|
@@ -568,7 +596,7 @@ function createOldEntity(entity, remult) {
|
|
|
568
596
|
var key = getEntityKey(entity);
|
|
569
597
|
var base = Object.getPrototypeOf(entity);
|
|
570
598
|
var _loop_1 = function () {
|
|
571
|
-
var
|
|
599
|
+
var e_9, _a;
|
|
572
600
|
var baseCols = exports.columnsOfType.get(base);
|
|
573
601
|
if (baseCols) {
|
|
574
602
|
r.unshift.apply(r, tslib_1.__spread(baseCols.filter(function (x) { return !r.find(function (y) { return y.key == x.key; }); })));
|
|
@@ -588,17 +616,17 @@ function createOldEntity(entity, remult) {
|
|
|
588
616
|
}
|
|
589
617
|
};
|
|
590
618
|
try {
|
|
591
|
-
for (var _b = (
|
|
619
|
+
for (var _b = (e_9 = void 0, tslib_1.__values(functions)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
592
620
|
var key_1 = _c.value;
|
|
593
621
|
_loop_2(key_1);
|
|
594
622
|
}
|
|
595
623
|
}
|
|
596
|
-
catch (
|
|
624
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
597
625
|
finally {
|
|
598
626
|
try {
|
|
599
627
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
600
628
|
}
|
|
601
|
-
finally { if (
|
|
629
|
+
finally { if (e_9) throw e_9.error; }
|
|
602
630
|
}
|
|
603
631
|
}
|
|
604
632
|
base = Object.getPrototypeOf(base);
|
|
@@ -611,12 +639,12 @@ function createOldEntity(entity, remult) {
|
|
|
611
639
|
exports.createOldEntity = createOldEntity;
|
|
612
640
|
var rowHelperBase = /** @class */ (function () {
|
|
613
641
|
function rowHelperBase(columnsInfo, instance, remult) {
|
|
614
|
-
var
|
|
642
|
+
var e_10, _a;
|
|
615
643
|
var _this = this;
|
|
616
644
|
this.columnsInfo = columnsInfo;
|
|
617
645
|
this.instance = instance;
|
|
618
646
|
this.remult = remult;
|
|
619
|
-
this.
|
|
647
|
+
this._isLoading = false;
|
|
620
648
|
this.lookups = new Map();
|
|
621
649
|
this.originalValues = {};
|
|
622
650
|
var _loop_3 = function (col) {
|
|
@@ -627,11 +655,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
627
655
|
var val = instance[col.key];
|
|
628
656
|
Object.defineProperty(instance, col.key, {
|
|
629
657
|
get: function () {
|
|
658
|
+
_this._reportObserved();
|
|
630
659
|
return lookup_1.item;
|
|
631
660
|
},
|
|
632
661
|
set: function (val) {
|
|
633
662
|
lookup_1.set(val);
|
|
634
|
-
_this.
|
|
663
|
+
_this._reportChanged();
|
|
635
664
|
},
|
|
636
665
|
enumerable: true
|
|
637
666
|
});
|
|
@@ -647,30 +676,45 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
647
676
|
_loop_3(col);
|
|
648
677
|
}
|
|
649
678
|
}
|
|
650
|
-
catch (
|
|
679
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
651
680
|
finally {
|
|
652
681
|
try {
|
|
653
682
|
if (columnsInfo_1_1 && !columnsInfo_1_1.done && (_a = columnsInfo_1.return)) _a.call(columnsInfo_1);
|
|
654
683
|
}
|
|
655
|
-
finally { if (
|
|
684
|
+
finally { if (e_10) throw e_10.error; }
|
|
656
685
|
}
|
|
657
686
|
}
|
|
658
687
|
Object.defineProperty(rowHelperBase.prototype, "error", {
|
|
659
|
-
get: function () {
|
|
688
|
+
get: function () {
|
|
689
|
+
this._reportObserved();
|
|
690
|
+
return this._error;
|
|
691
|
+
},
|
|
660
692
|
set: function (val) {
|
|
661
693
|
this._error = val;
|
|
662
|
-
this.
|
|
694
|
+
this._reportChanged();
|
|
663
695
|
},
|
|
664
696
|
enumerable: false,
|
|
665
697
|
configurable: true
|
|
666
698
|
});
|
|
667
|
-
rowHelperBase.prototype.
|
|
699
|
+
rowHelperBase.prototype._reportChanged = function () {
|
|
700
|
+
if (this._subscribers)
|
|
701
|
+
this._subscribers.forEach(function (x) { return x.reportChanged(); });
|
|
702
|
+
};
|
|
703
|
+
rowHelperBase.prototype._reportObserved = function () {
|
|
668
704
|
if (this._subscribers)
|
|
669
|
-
this._subscribers.forEach(function (x) { return x(); });
|
|
705
|
+
this._subscribers.forEach(function (x) { return x.reportObserved(); });
|
|
670
706
|
};
|
|
671
707
|
rowHelperBase.prototype.subscribe = function (listener) {
|
|
672
|
-
var
|
|
708
|
+
var e_11, _a;
|
|
673
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;
|
|
674
718
|
if (!this._subscribers) {
|
|
675
719
|
this._subscribers = [];
|
|
676
720
|
var _loop_4 = function (col) {
|
|
@@ -681,11 +725,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
681
725
|
var val_1 = this_2.instance[col.key];
|
|
682
726
|
Object.defineProperty(this_2.instance, col.key, {
|
|
683
727
|
get: function () {
|
|
728
|
+
_this._reportObserved();
|
|
684
729
|
return val_1;
|
|
685
730
|
},
|
|
686
731
|
set: function (value) {
|
|
687
732
|
val_1 = value;
|
|
688
|
-
_this.
|
|
733
|
+
_this._reportChanged();
|
|
689
734
|
},
|
|
690
735
|
enumerable: true
|
|
691
736
|
});
|
|
@@ -698,17 +743,29 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
698
743
|
_loop_4(col);
|
|
699
744
|
}
|
|
700
745
|
}
|
|
701
|
-
catch (
|
|
746
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
702
747
|
finally {
|
|
703
748
|
try {
|
|
704
749
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
705
750
|
}
|
|
706
|
-
finally { if (
|
|
751
|
+
finally { if (e_11) throw e_11.error; }
|
|
707
752
|
}
|
|
708
753
|
}
|
|
709
|
-
this._subscribers.push(
|
|
754
|
+
this._subscribers.push(list);
|
|
710
755
|
return function () { return _this._subscribers = _this._subscribers.filter(function (x) { return x != listener; }); };
|
|
711
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
|
+
});
|
|
712
769
|
rowHelperBase.prototype.waitLoad = function () {
|
|
713
770
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
714
771
|
return tslib_1.__generator(this, function (_a) {
|
|
@@ -722,7 +779,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
722
779
|
});
|
|
723
780
|
};
|
|
724
781
|
rowHelperBase.prototype.__assertValidity = function () {
|
|
725
|
-
var
|
|
782
|
+
var e_12, _a;
|
|
726
783
|
if (!this.hasErrors()) {
|
|
727
784
|
var error = {
|
|
728
785
|
modelState: Object.assign({}, this.errors),
|
|
@@ -739,12 +796,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
739
796
|
}
|
|
740
797
|
}
|
|
741
798
|
}
|
|
742
|
-
catch (
|
|
799
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
743
800
|
finally {
|
|
744
801
|
try {
|
|
745
802
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
746
803
|
}
|
|
747
|
-
finally { if (
|
|
804
|
+
finally { if (e_12) throw e_12.error; }
|
|
748
805
|
}
|
|
749
806
|
}
|
|
750
807
|
throw error;
|
|
@@ -776,12 +833,14 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
776
833
|
rowHelperBase.prototype.__clearErrors = function () {
|
|
777
834
|
this.errors = undefined;
|
|
778
835
|
this.error = undefined;
|
|
836
|
+
this._reportChanged();
|
|
779
837
|
};
|
|
780
838
|
rowHelperBase.prototype.hasErrors = function () {
|
|
839
|
+
this._reportObserved();
|
|
781
840
|
return !!!this.error && this.errors == undefined;
|
|
782
841
|
};
|
|
783
842
|
rowHelperBase.prototype.copyDataToObject = function () {
|
|
784
|
-
var
|
|
843
|
+
var e_13, _a;
|
|
785
844
|
var d = {};
|
|
786
845
|
try {
|
|
787
846
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -800,12 +859,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
800
859
|
d[col.key] = val;
|
|
801
860
|
}
|
|
802
861
|
}
|
|
803
|
-
catch (
|
|
862
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
804
863
|
finally {
|
|
805
864
|
try {
|
|
806
865
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
807
866
|
}
|
|
808
|
-
finally { if (
|
|
867
|
+
finally { if (e_13) throw e_13.error; }
|
|
809
868
|
}
|
|
810
869
|
return d;
|
|
811
870
|
};
|
|
@@ -819,8 +878,13 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
819
878
|
switch (_a.label) {
|
|
820
879
|
case 0:
|
|
821
880
|
this.__clearErrors();
|
|
822
|
-
return [
|
|
881
|
+
if (!classValidatorValidate) return [3 /*break*/, 2];
|
|
882
|
+
return [4 /*yield*/, classValidatorValidate(this.instance, this)];
|
|
823
883
|
case 1:
|
|
884
|
+
_a.sent();
|
|
885
|
+
_a.label = 2;
|
|
886
|
+
case 2: return [4 /*yield*/, this.__performColumnAndEntityValidations()];
|
|
887
|
+
case 3:
|
|
824
888
|
_a.sent();
|
|
825
889
|
r = this.hasErrors();
|
|
826
890
|
return [2 /*return*/, r];
|
|
@@ -834,8 +898,13 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
834
898
|
switch (_a.label) {
|
|
835
899
|
case 0:
|
|
836
900
|
this.__clearErrors();
|
|
837
|
-
return [
|
|
901
|
+
if (!classValidatorValidate) return [3 /*break*/, 2];
|
|
902
|
+
return [4 /*yield*/, classValidatorValidate(this.instance, this)];
|
|
838
903
|
case 1:
|
|
904
|
+
_a.sent();
|
|
905
|
+
_a.label = 2;
|
|
906
|
+
case 2: return [4 /*yield*/, this.__performColumnAndEntityValidations()];
|
|
907
|
+
case 3:
|
|
839
908
|
_a.sent();
|
|
840
909
|
this.__assertValidity();
|
|
841
910
|
return [2 /*return*/];
|
|
@@ -851,7 +920,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
851
920
|
});
|
|
852
921
|
};
|
|
853
922
|
rowHelperBase.prototype.toApiJson = function () {
|
|
854
|
-
var
|
|
923
|
+
var e_14, _a;
|
|
855
924
|
var result = {};
|
|
856
925
|
try {
|
|
857
926
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -876,19 +945,19 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
876
945
|
}
|
|
877
946
|
}
|
|
878
947
|
}
|
|
879
|
-
catch (
|
|
948
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
880
949
|
finally {
|
|
881
950
|
try {
|
|
882
951
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
883
952
|
}
|
|
884
|
-
finally { if (
|
|
953
|
+
finally { if (e_14) throw e_14.error; }
|
|
885
954
|
}
|
|
886
955
|
return result;
|
|
887
956
|
};
|
|
888
957
|
rowHelperBase.prototype._updateEntityBasedOnApi = function (body) {
|
|
889
958
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
890
959
|
var keys, _a, _b, col, lu;
|
|
891
|
-
var
|
|
960
|
+
var e_15, _c;
|
|
892
961
|
return tslib_1.__generator(this, function (_d) {
|
|
893
962
|
switch (_d.label) {
|
|
894
963
|
case 0:
|
|
@@ -908,12 +977,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
908
977
|
}
|
|
909
978
|
}
|
|
910
979
|
}
|
|
911
|
-
catch (
|
|
980
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
912
981
|
finally {
|
|
913
982
|
try {
|
|
914
983
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
915
984
|
}
|
|
916
|
-
finally { if (
|
|
985
|
+
finally { if (e_15) throw e_15.error; }
|
|
917
986
|
}
|
|
918
987
|
return [4 /*yield*/, Promise.all(tslib_1.__spread(this.fields).map(function (x) { return x.load(); }))];
|
|
919
988
|
case 1:
|
|
@@ -928,7 +997,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
928
997
|
var rowHelperImplementation = /** @class */ (function (_super) {
|
|
929
998
|
tslib_1.__extends(rowHelperImplementation, _super);
|
|
930
999
|
function rowHelperImplementation(info, instance, repository, edp, remult, _isNew) {
|
|
931
|
-
var
|
|
1000
|
+
var e_16, _a;
|
|
932
1001
|
var _this = _super.call(this, info.columnsInfo, instance, remult) || this;
|
|
933
1002
|
_this.info = info;
|
|
934
1003
|
_this.repository = repository;
|
|
@@ -949,14 +1018,18 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
949
1018
|
}
|
|
950
1019
|
}
|
|
951
1020
|
}
|
|
952
|
-
catch (
|
|
1021
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
953
1022
|
finally {
|
|
954
1023
|
try {
|
|
955
1024
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
956
1025
|
}
|
|
957
|
-
finally { if (
|
|
1026
|
+
finally { if (e_16) throw e_16.error; }
|
|
958
1027
|
}
|
|
959
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);
|
|
960
1033
|
return _this;
|
|
961
1034
|
}
|
|
962
1035
|
Object.defineProperty(rowHelperImplementation.prototype, "apiUpdateAllowed", {
|
|
@@ -981,11 +1054,13 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
981
1054
|
return this.instance[this.info.idMetadata.field.key];
|
|
982
1055
|
};
|
|
983
1056
|
rowHelperImplementation.prototype.wasDeleted = function () {
|
|
1057
|
+
this._reportObserved();
|
|
984
1058
|
return this._wasDeleted;
|
|
985
1059
|
};
|
|
986
1060
|
rowHelperImplementation.prototype.undoChanges = function () {
|
|
987
1061
|
this.loadDataFrom(this.originalValues);
|
|
988
1062
|
this.__clearErrors();
|
|
1063
|
+
this._reportChanged();
|
|
989
1064
|
};
|
|
990
1065
|
rowHelperImplementation.prototype.reload = function () {
|
|
991
1066
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -1005,6 +1080,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1005
1080
|
}); })];
|
|
1006
1081
|
case 1:
|
|
1007
1082
|
_a.sent();
|
|
1083
|
+
this._reportChanged();
|
|
1008
1084
|
return [2 /*return*/, this.instance];
|
|
1009
1085
|
}
|
|
1010
1086
|
});
|
|
@@ -1012,7 +1088,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1012
1088
|
};
|
|
1013
1089
|
Object.defineProperty(rowHelperImplementation.prototype, "fields", {
|
|
1014
1090
|
get: function () {
|
|
1015
|
-
var _a,
|
|
1091
|
+
var _a, e_17, _b;
|
|
1016
1092
|
if (!this._columns) {
|
|
1017
1093
|
var _items_1 = [];
|
|
1018
1094
|
var r_1 = (_a = {
|
|
@@ -1026,12 +1102,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1026
1102
|
_items_1.push(r_1[c.key] = new FieldRefImplementation(c, this.info.fields[c.key], this.instance, this, this));
|
|
1027
1103
|
}
|
|
1028
1104
|
}
|
|
1029
|
-
catch (
|
|
1105
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1030
1106
|
finally {
|
|
1031
1107
|
try {
|
|
1032
1108
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1033
1109
|
}
|
|
1034
|
-
finally { if (
|
|
1110
|
+
finally { if (e_17) throw e_17.error; }
|
|
1035
1111
|
}
|
|
1036
1112
|
this._columns = r_1;
|
|
1037
1113
|
}
|
|
@@ -1043,7 +1119,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1043
1119
|
rowHelperImplementation.prototype.save = function () {
|
|
1044
1120
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1045
1121
|
var doNotSave_1, d, ignoreKeys, _a, _b, field, f, updatedRow, changesOnly, wasChanged, key, element, err_1;
|
|
1046
|
-
var
|
|
1122
|
+
var e_18, _c;
|
|
1047
1123
|
return tslib_1.__generator(this, function (_d) {
|
|
1048
1124
|
switch (_d.label) {
|
|
1049
1125
|
case 0:
|
|
@@ -1073,12 +1149,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1073
1149
|
}
|
|
1074
1150
|
}
|
|
1075
1151
|
}
|
|
1076
|
-
catch (
|
|
1152
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1077
1153
|
finally {
|
|
1078
1154
|
try {
|
|
1079
1155
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1080
1156
|
}
|
|
1081
|
-
finally { if (
|
|
1157
|
+
finally { if (e_18) throw e_18.error; }
|
|
1082
1158
|
}
|
|
1083
1159
|
if (this.info.idMetadata.field instanceof column_1.CompoundIdField)
|
|
1084
1160
|
d.id = undefined;
|
|
@@ -1086,7 +1162,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1086
1162
|
_d.label = 4;
|
|
1087
1163
|
case 4:
|
|
1088
1164
|
_d.trys.push([4, 14, , 16]);
|
|
1089
|
-
this.
|
|
1165
|
+
this._reportChanged();
|
|
1090
1166
|
if (!this.isNew()) return [3 /*break*/, 6];
|
|
1091
1167
|
return [4 /*yield*/, this.edp.insert(d)];
|
|
1092
1168
|
case 5:
|
|
@@ -1136,7 +1212,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1136
1212
|
case 16: return [3 /*break*/, 18];
|
|
1137
1213
|
case 17:
|
|
1138
1214
|
this.isLoading = false;
|
|
1139
|
-
this.
|
|
1215
|
+
this._reportChanged();
|
|
1140
1216
|
return [7 /*endfinally*/];
|
|
1141
1217
|
case 18: return [2 /*return*/];
|
|
1142
1218
|
}
|
|
@@ -1148,8 +1224,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1148
1224
|
};
|
|
1149
1225
|
rowHelperImplementation.prototype.delete = function () {
|
|
1150
1226
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1151
|
-
var _a, _b, listener,
|
|
1152
|
-
var
|
|
1227
|
+
var _a, _b, listener, e_19_1, err_2;
|
|
1228
|
+
var e_19, _c;
|
|
1153
1229
|
return tslib_1.__generator(this, function (_d) {
|
|
1154
1230
|
switch (_d.label) {
|
|
1155
1231
|
case 0:
|
|
@@ -1191,14 +1267,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1191
1267
|
return [3 /*break*/, 8];
|
|
1192
1268
|
case 11: return [3 /*break*/, 14];
|
|
1193
1269
|
case 12:
|
|
1194
|
-
|
|
1195
|
-
|
|
1270
|
+
e_19_1 = _d.sent();
|
|
1271
|
+
e_19 = { error: e_19_1 };
|
|
1196
1272
|
return [3 /*break*/, 14];
|
|
1197
1273
|
case 13:
|
|
1198
1274
|
try {
|
|
1199
1275
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1200
1276
|
}
|
|
1201
|
-
finally { if (
|
|
1277
|
+
finally { if (e_19) throw e_19.error; }
|
|
1202
1278
|
return [7 /*endfinally*/];
|
|
1203
1279
|
case 14:
|
|
1204
1280
|
this._wasDeleted = true;
|
|
@@ -1216,8 +1292,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1216
1292
|
};
|
|
1217
1293
|
rowHelperImplementation.prototype.loadDataFrom = function (data, loadItems) {
|
|
1218
1294
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1219
|
-
var _a, _b, col, lu,
|
|
1220
|
-
var
|
|
1295
|
+
var _a, _b, col, lu, e_20_1;
|
|
1296
|
+
var e_20, _c;
|
|
1221
1297
|
return tslib_1.__generator(this, function (_d) {
|
|
1222
1298
|
switch (_d.label) {
|
|
1223
1299
|
case 0:
|
|
@@ -1252,14 +1328,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1252
1328
|
return [3 /*break*/, 1];
|
|
1253
1329
|
case 9: return [3 /*break*/, 12];
|
|
1254
1330
|
case 10:
|
|
1255
|
-
|
|
1256
|
-
|
|
1331
|
+
e_20_1 = _d.sent();
|
|
1332
|
+
e_20 = { error: e_20_1 };
|
|
1257
1333
|
return [3 /*break*/, 12];
|
|
1258
1334
|
case 11:
|
|
1259
1335
|
try {
|
|
1260
1336
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1261
1337
|
}
|
|
1262
|
-
finally { if (
|
|
1338
|
+
finally { if (e_20) throw e_20.error; }
|
|
1263
1339
|
return [7 /*endfinally*/];
|
|
1264
1340
|
case 12: return [4 /*yield*/, this.calcServerExpression()];
|
|
1265
1341
|
case 13:
|
|
@@ -1279,8 +1355,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1279
1355
|
};
|
|
1280
1356
|
rowHelperImplementation.prototype.calcServerExpression = function () {
|
|
1281
1357
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1282
|
-
var _a, _b, col, _c, _d,
|
|
1283
|
-
var
|
|
1358
|
+
var _a, _b, col, _c, _d, e_21_1;
|
|
1359
|
+
var e_21, _e;
|
|
1284
1360
|
return tslib_1.__generator(this, function (_f) {
|
|
1285
1361
|
switch (_f.label) {
|
|
1286
1362
|
case 0:
|
|
@@ -1305,14 +1381,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1305
1381
|
return [3 /*break*/, 2];
|
|
1306
1382
|
case 5: return [3 /*break*/, 8];
|
|
1307
1383
|
case 6:
|
|
1308
|
-
|
|
1309
|
-
|
|
1384
|
+
e_21_1 = _f.sent();
|
|
1385
|
+
e_21 = { error: e_21_1 };
|
|
1310
1386
|
return [3 /*break*/, 8];
|
|
1311
1387
|
case 7:
|
|
1312
1388
|
try {
|
|
1313
1389
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1314
1390
|
}
|
|
1315
|
-
finally { if (
|
|
1391
|
+
finally { if (e_21) throw e_21.error; }
|
|
1316
1392
|
return [7 /*endfinally*/];
|
|
1317
1393
|
case 8: return [2 /*return*/];
|
|
1318
1394
|
}
|
|
@@ -1320,10 +1396,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1320
1396
|
});
|
|
1321
1397
|
};
|
|
1322
1398
|
rowHelperImplementation.prototype.isNew = function () {
|
|
1399
|
+
this._reportObserved();
|
|
1323
1400
|
return this._isNew;
|
|
1324
1401
|
};
|
|
1325
1402
|
rowHelperImplementation.prototype.wasChanged = function () {
|
|
1326
|
-
var
|
|
1403
|
+
var e_22, _a;
|
|
1404
|
+
this._reportObserved();
|
|
1327
1405
|
try {
|
|
1328
1406
|
for (var _b = tslib_1.__values(this.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1329
1407
|
var col = _c.value;
|
|
@@ -1331,19 +1409,19 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1331
1409
|
return true;
|
|
1332
1410
|
}
|
|
1333
1411
|
}
|
|
1334
|
-
catch (
|
|
1412
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1335
1413
|
finally {
|
|
1336
1414
|
try {
|
|
1337
1415
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1338
1416
|
}
|
|
1339
|
-
finally { if (
|
|
1417
|
+
finally { if (e_22) throw e_22.error; }
|
|
1340
1418
|
}
|
|
1341
1419
|
return false;
|
|
1342
1420
|
};
|
|
1343
1421
|
rowHelperImplementation.prototype.__performColumnAndEntityValidations = function () {
|
|
1344
1422
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1345
|
-
var _a, _b, c, col,
|
|
1346
|
-
var
|
|
1423
|
+
var _a, _b, c, col, e_23_1, _c, _d, listener, e_24_1;
|
|
1424
|
+
var e_23, _e, e_24, _f;
|
|
1347
1425
|
return tslib_1.__generator(this, function (_g) {
|
|
1348
1426
|
switch (_g.label) {
|
|
1349
1427
|
case 0:
|
|
@@ -1364,18 +1442,18 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1364
1442
|
return [3 /*break*/, 1];
|
|
1365
1443
|
case 4: return [3 /*break*/, 7];
|
|
1366
1444
|
case 5:
|
|
1367
|
-
|
|
1368
|
-
|
|
1445
|
+
e_23_1 = _g.sent();
|
|
1446
|
+
e_23 = { error: e_23_1 };
|
|
1369
1447
|
return [3 /*break*/, 7];
|
|
1370
1448
|
case 6:
|
|
1371
1449
|
try {
|
|
1372
1450
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1373
1451
|
}
|
|
1374
|
-
finally { if (
|
|
1452
|
+
finally { if (e_23) throw e_23.error; }
|
|
1375
1453
|
return [7 /*endfinally*/];
|
|
1376
1454
|
case 7:
|
|
1377
1455
|
if (!this.info.entityInfo.validation) return [3 /*break*/, 9];
|
|
1378
|
-
return [4 /*yield*/, this.info.entityInfo.validation(this.instance)];
|
|
1456
|
+
return [4 /*yield*/, this.info.entityInfo.validation(this.instance, this)];
|
|
1379
1457
|
case 8:
|
|
1380
1458
|
_g.sent();
|
|
1381
1459
|
_g.label = 9;
|
|
@@ -1398,14 +1476,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1398
1476
|
return [3 /*break*/, 11];
|
|
1399
1477
|
case 14: return [3 /*break*/, 17];
|
|
1400
1478
|
case 15:
|
|
1401
|
-
|
|
1402
|
-
|
|
1479
|
+
e_24_1 = _g.sent();
|
|
1480
|
+
e_24 = { error: e_24_1 };
|
|
1403
1481
|
return [3 /*break*/, 17];
|
|
1404
1482
|
case 16:
|
|
1405
1483
|
try {
|
|
1406
1484
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
1407
1485
|
}
|
|
1408
|
-
finally { if (
|
|
1486
|
+
finally { if (e_24) throw e_24.error; }
|
|
1409
1487
|
return [7 /*endfinally*/];
|
|
1410
1488
|
case 17: return [2 /*return*/];
|
|
1411
1489
|
}
|
|
@@ -1447,7 +1525,7 @@ exports.getControllerRef = getControllerRef;
|
|
|
1447
1525
|
var controllerRefImpl = /** @class */ (function (_super) {
|
|
1448
1526
|
tslib_1.__extends(controllerRefImpl, _super);
|
|
1449
1527
|
function controllerRefImpl(columnsInfo, instance, remult) {
|
|
1450
|
-
var _a,
|
|
1528
|
+
var _a, e_25, _b;
|
|
1451
1529
|
var _this = _super.call(this, columnsInfo, instance, remult) || this;
|
|
1452
1530
|
var _items = [];
|
|
1453
1531
|
var r = (_a = {
|
|
@@ -1461,20 +1539,20 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1461
1539
|
_items.push(r[col.key] = new FieldRefImplementation(col, new columnDefsImpl(col, undefined, remult), instance, undefined, _this));
|
|
1462
1540
|
}
|
|
1463
1541
|
}
|
|
1464
|
-
catch (
|
|
1542
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
1465
1543
|
finally {
|
|
1466
1544
|
try {
|
|
1467
1545
|
if (columnsInfo_2_1 && !columnsInfo_2_1.done && (_b = columnsInfo_2.return)) _b.call(columnsInfo_2);
|
|
1468
1546
|
}
|
|
1469
|
-
finally { if (
|
|
1547
|
+
finally { if (e_25) throw e_25.error; }
|
|
1470
1548
|
}
|
|
1471
1549
|
_this.fields = r;
|
|
1472
1550
|
return _this;
|
|
1473
1551
|
}
|
|
1474
1552
|
controllerRefImpl.prototype.__performColumnAndEntityValidations = function () {
|
|
1475
1553
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1476
|
-
var _a, _b, col,
|
|
1477
|
-
var
|
|
1554
|
+
var _a, _b, col, e_26_1;
|
|
1555
|
+
var e_26, _c;
|
|
1478
1556
|
return tslib_1.__generator(this, function (_d) {
|
|
1479
1557
|
switch (_d.label) {
|
|
1480
1558
|
case 0:
|
|
@@ -1494,14 +1572,14 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1494
1572
|
return [3 /*break*/, 1];
|
|
1495
1573
|
case 4: return [3 /*break*/, 7];
|
|
1496
1574
|
case 5:
|
|
1497
|
-
|
|
1498
|
-
|
|
1575
|
+
e_26_1 = _d.sent();
|
|
1576
|
+
e_26 = { error: e_26_1 };
|
|
1499
1577
|
return [3 /*break*/, 7];
|
|
1500
1578
|
case 6:
|
|
1501
1579
|
try {
|
|
1502
1580
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1503
1581
|
}
|
|
1504
|
-
finally { if (
|
|
1582
|
+
finally { if (e_26) throw e_26.error; }
|
|
1505
1583
|
return [7 /*endfinally*/];
|
|
1506
1584
|
case 7: return [2 /*return*/];
|
|
1507
1585
|
}
|
|
@@ -1522,6 +1600,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1522
1600
|
this.entityRef = this.helper;
|
|
1523
1601
|
}
|
|
1524
1602
|
FieldRefImplementation.prototype.valueIsNull = function () {
|
|
1603
|
+
this.rowBase._reportObserved();
|
|
1525
1604
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1526
1605
|
if (lu) {
|
|
1527
1606
|
return lu.id === undefined || lu.id === null;
|
|
@@ -1529,6 +1608,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1529
1608
|
return this.value === null;
|
|
1530
1609
|
};
|
|
1531
1610
|
FieldRefImplementation.prototype.originalValueIsNull = function () {
|
|
1611
|
+
this.rowBase._reportObserved();
|
|
1532
1612
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1533
1613
|
return this.rawOriginalValue() === null;
|
|
1534
1614
|
};
|
|
@@ -1554,6 +1634,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1554
1634
|
};
|
|
1555
1635
|
Object.defineProperty(FieldRefImplementation.prototype, "error", {
|
|
1556
1636
|
get: function () {
|
|
1637
|
+
this.rowBase._reportObserved();
|
|
1557
1638
|
if (!this.rowBase.errors)
|
|
1558
1639
|
return undefined;
|
|
1559
1640
|
return this.rowBase.errors[this.metadata.key];
|
|
@@ -1562,13 +1643,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1562
1643
|
if (!this.rowBase.errors)
|
|
1563
1644
|
this.rowBase.errors = {};
|
|
1564
1645
|
this.rowBase.errors[this.metadata.key] = error;
|
|
1565
|
-
this.rowBase.
|
|
1646
|
+
this.rowBase._reportChanged();
|
|
1566
1647
|
},
|
|
1567
1648
|
enumerable: false,
|
|
1568
1649
|
configurable: true
|
|
1569
1650
|
});
|
|
1570
1651
|
Object.defineProperty(FieldRefImplementation.prototype, "displayValue", {
|
|
1571
1652
|
get: function () {
|
|
1653
|
+
this.rowBase._reportObserved();
|
|
1572
1654
|
if (this.value != undefined) {
|
|
1573
1655
|
if (this.settings.displayValue)
|
|
1574
1656
|
return this.settings.displayValue(this.container, this.value);
|
|
@@ -1593,6 +1675,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1593
1675
|
;
|
|
1594
1676
|
Object.defineProperty(FieldRefImplementation.prototype, "originalValue", {
|
|
1595
1677
|
get: function () {
|
|
1678
|
+
this.rowBase._reportObserved();
|
|
1596
1679
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1597
1680
|
if (lu)
|
|
1598
1681
|
return lu.get(this.rawOriginalValue());
|
|
@@ -1607,6 +1690,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1607
1690
|
};
|
|
1608
1691
|
Object.defineProperty(FieldRefImplementation.prototype, "inputValue", {
|
|
1609
1692
|
get: function () {
|
|
1693
|
+
this.rowBase._reportObserved();
|
|
1610
1694
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1611
1695
|
if (lu)
|
|
1612
1696
|
return lu.id != undefined ? lu.id.toString() : null;
|
|
@@ -1625,6 +1709,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1625
1709
|
});
|
|
1626
1710
|
;
|
|
1627
1711
|
FieldRefImplementation.prototype.valueChanged = function () {
|
|
1712
|
+
this.rowBase._reportObserved();
|
|
1628
1713
|
var val = this.value;
|
|
1629
1714
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1630
1715
|
if (lu) {
|
|
@@ -1634,8 +1719,8 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1634
1719
|
};
|
|
1635
1720
|
FieldRefImplementation.prototype.__performValidation = function () {
|
|
1636
1721
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1637
|
-
var x, _a, _b, v,
|
|
1638
|
-
var
|
|
1722
|
+
var x, _a, _b, v, e_27_1;
|
|
1723
|
+
var e_27, _c;
|
|
1639
1724
|
return tslib_1.__generator(this, function (_d) {
|
|
1640
1725
|
switch (_d.label) {
|
|
1641
1726
|
case 0:
|
|
@@ -1658,14 +1743,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1658
1743
|
return [3 /*break*/, 2];
|
|
1659
1744
|
case 5: return [3 /*break*/, 8];
|
|
1660
1745
|
case 6:
|
|
1661
|
-
|
|
1662
|
-
|
|
1746
|
+
e_27_1 = _d.sent();
|
|
1747
|
+
e_27 = { error: e_27_1 };
|
|
1663
1748
|
return [3 /*break*/, 8];
|
|
1664
1749
|
case 7:
|
|
1665
1750
|
try {
|
|
1666
1751
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1667
1752
|
}
|
|
1668
|
-
finally { if (
|
|
1753
|
+
finally { if (e_27) throw e_27.error; }
|
|
1669
1754
|
return [7 /*endfinally*/];
|
|
1670
1755
|
case 8: return [3 /*break*/, 11];
|
|
1671
1756
|
case 9:
|
|
@@ -1792,7 +1877,7 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
1792
1877
|
exports.columnDefsImpl = columnDefsImpl;
|
|
1793
1878
|
var EntityFullInfo = /** @class */ (function () {
|
|
1794
1879
|
function EntityFullInfo(columnsInfo, entityInfo, remult, entityType, key) {
|
|
1795
|
-
var _a,
|
|
1880
|
+
var _a, e_28, _b;
|
|
1796
1881
|
var _this = this;
|
|
1797
1882
|
this.columnsInfo = columnsInfo;
|
|
1798
1883
|
this.entityInfo = entityInfo;
|
|
@@ -1861,12 +1946,12 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
1861
1946
|
_items.push(r[x.key] = new columnDefsImpl(x, this, remult));
|
|
1862
1947
|
}
|
|
1863
1948
|
}
|
|
1864
|
-
catch (
|
|
1949
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
1865
1950
|
finally {
|
|
1866
1951
|
try {
|
|
1867
1952
|
if (columnsInfo_3_1 && !columnsInfo_3_1.done && (_b = columnsInfo_3.return)) _b.call(columnsInfo_3);
|
|
1868
1953
|
}
|
|
1869
|
-
finally { if (
|
|
1954
|
+
finally { if (e_28) throw e_28.error; }
|
|
1870
1955
|
}
|
|
1871
1956
|
this.fields = r;
|
|
1872
1957
|
this.dbAutoIncrementId = entityInfo.dbAutoIncrementId;
|
|
@@ -2033,7 +2118,7 @@ function Field() {
|
|
|
2033
2118
|
exports.Field = Field;
|
|
2034
2119
|
var storableMember = Symbol("storableMember");
|
|
2035
2120
|
function buildOptions(options, remult) {
|
|
2036
|
-
var
|
|
2121
|
+
var e_29, _a;
|
|
2037
2122
|
var r = {};
|
|
2038
2123
|
try {
|
|
2039
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()) {
|
|
@@ -2046,12 +2131,12 @@ function buildOptions(options, remult) {
|
|
|
2046
2131
|
}
|
|
2047
2132
|
}
|
|
2048
2133
|
}
|
|
2049
|
-
catch (
|
|
2134
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
2050
2135
|
finally {
|
|
2051
2136
|
try {
|
|
2052
2137
|
if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1);
|
|
2053
2138
|
}
|
|
2054
|
-
finally { if (
|
|
2139
|
+
finally { if (e_29) throw e_29.error; }
|
|
2055
2140
|
}
|
|
2056
2141
|
return r;
|
|
2057
2142
|
}
|
|
@@ -2134,7 +2219,7 @@ function Entity(key) {
|
|
|
2134
2219
|
}
|
|
2135
2220
|
}
|
|
2136
2221
|
var factory = function (remult) {
|
|
2137
|
-
var
|
|
2222
|
+
var e_30, _a;
|
|
2138
2223
|
var r = {};
|
|
2139
2224
|
try {
|
|
2140
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()) {
|
|
@@ -2147,12 +2232,12 @@ function Entity(key) {
|
|
|
2147
2232
|
}
|
|
2148
2233
|
}
|
|
2149
2234
|
}
|
|
2150
|
-
catch (
|
|
2235
|
+
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
2151
2236
|
finally {
|
|
2152
2237
|
try {
|
|
2153
2238
|
if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2);
|
|
2154
2239
|
}
|
|
2155
|
-
finally { if (
|
|
2240
|
+
finally { if (e_30) throw e_30.error; }
|
|
2156
2241
|
}
|
|
2157
2242
|
var base = Object.getPrototypeOf(target);
|
|
2158
2243
|
if (base) {
|
|
@@ -2241,9 +2326,9 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2241
2326
|
});
|
|
2242
2327
|
};
|
|
2243
2328
|
QueryResultImpl.prototype.forEach = function (what) {
|
|
2244
|
-
var
|
|
2329
|
+
var e_31, _a;
|
|
2245
2330
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2246
|
-
var i, _b, _c, x,
|
|
2331
|
+
var i, _b, _c, x, e_31_1;
|
|
2247
2332
|
return tslib_1.__generator(this, function (_d) {
|
|
2248
2333
|
switch (_d.label) {
|
|
2249
2334
|
case 0:
|
|
@@ -2265,8 +2350,8 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2265
2350
|
case 5: return [3 /*break*/, 2];
|
|
2266
2351
|
case 6: return [3 /*break*/, 13];
|
|
2267
2352
|
case 7:
|
|
2268
|
-
|
|
2269
|
-
|
|
2353
|
+
e_31_1 = _d.sent();
|
|
2354
|
+
e_31 = { error: e_31_1 };
|
|
2270
2355
|
return [3 /*break*/, 13];
|
|
2271
2356
|
case 8:
|
|
2272
2357
|
_d.trys.push([8, , 11, 12]);
|
|
@@ -2277,7 +2362,7 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2277
2362
|
_d.label = 10;
|
|
2278
2363
|
case 10: return [3 /*break*/, 12];
|
|
2279
2364
|
case 11:
|
|
2280
|
-
if (
|
|
2365
|
+
if (e_31) throw e_31.error;
|
|
2281
2366
|
return [7 /*endfinally*/];
|
|
2282
2367
|
case 12: return [7 /*endfinally*/];
|
|
2283
2368
|
case 13: return [2 /*return*/, i];
|