remult 0.9.15 → 0.9.19
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/index.d.ts +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/remult-mongo.d.ts +9 -0
- package/remult-mongo.js +519 -0
- package/remult-mongo.js.map +1 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +1 -0
- package/src/backend-tests/backend-database-test-setup.backend-spec.js +45 -1
- package/src/backend-tests/backend-database-test-setup.backend-spec.js.map +1 -1
- package/src/filter/filter-interfaces.d.ts +1 -1
- package/src/filter/filter-interfaces.js +2 -2
- package/src/filter/filter-interfaces.js.map +1 -1
- package/src/remult3/RepositoryImplementation.d.ts +29 -12
- package/src/remult3/RepositoryImplementation.js +246 -147
- package/src/remult3/RepositoryImplementation.js.map +1 -1
- package/src/remult3/remult3.d.ts +24 -13
- package/src/server-action.js.map +1 -1
- package/src/shared-tests/db-tests.db-tests.js +5 -5
- package/src/shared-tests/db-tests.db-tests.js.map +1 -1
- package/src/validators.d.ts +3 -0
- package/src/validators.js +15 -0
- package/src/validators.js.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EntityBase = exports.Entity = exports.decorateColumnSettings = exports.Field = exports.ValueListFieldType = exports.IntegerField = exports.DateOnlyField = exports.JsonField = exports.FieldType = exports.columnDefsImpl = exports.buildCaption = exports.CaptionTransformer = exports.getEntityRef = exports.FieldRefImplementation = exports.controllerRefImpl = exports.getControllerRef = exports.getFields = exports.rowHelperImplementation = exports.createOldEntity = exports.columnsOfType = exports.getEntityKey = exports.getEntitySettings = exports.entityInfo_key = exports.entityInfo = exports.__updateEntityBasedOnWhere = exports.RepositoryImplementation = void 0;
|
|
3
|
+
exports.ControllerBase = exports.EntityBase = exports.Entity = exports.decorateColumnSettings = exports.Field = exports.ValueListFieldType = exports.IntegerField = exports.DateOnlyField = exports.JsonField = exports.FieldType = exports.columnDefsImpl = exports.buildCaption = exports.CaptionTransformer = exports.getEntityRef = exports.FieldRefImplementation = exports.controllerRefImpl = exports.getControllerRef = exports.getFields = exports.rowHelperImplementation = exports.createOldEntity = exports.columnsOfType = exports.getEntityKey = exports.getEntitySettings = exports.entityInfo_key = exports.entityInfo = exports.__updateEntityBasedOnWhere = exports.RepositoryImplementation = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
5
|
var column_1 = require("../column");
|
|
6
6
|
var context_1 = require("../context");
|
|
@@ -531,7 +531,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
531
531
|
case 1:
|
|
532
532
|
r = _a.sent();
|
|
533
533
|
if (!(r && !this.dataProvider.supportsCustomFilter)) return [3 /*break*/, 3];
|
|
534
|
-
return [4 /*yield*/, filter_interfaces_1.Filter.translateCustomWhere(r, this.metadata, this.
|
|
534
|
+
return [4 /*yield*/, filter_interfaces_1.Filter.translateCustomWhere(r, this.metadata, this.remult)];
|
|
535
535
|
case 2:
|
|
536
536
|
r = _a.sent();
|
|
537
537
|
_a.label = 3;
|
|
@@ -653,18 +653,36 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
653
653
|
var lookup_1 = new column_1.LookupColumn(remult.repo(col.valueType), undefined);
|
|
654
654
|
this_1.lookups.set(col.key, lookup_1);
|
|
655
655
|
var val = instance[col.key];
|
|
656
|
+
var refImpl_1;
|
|
656
657
|
Object.defineProperty(instance, col.key, {
|
|
657
658
|
get: function () {
|
|
658
|
-
_this.
|
|
659
|
+
if (_this._subscribers) {
|
|
660
|
+
_this._subscribers.reportObserved();
|
|
661
|
+
if (!refImpl_1) {
|
|
662
|
+
refImpl_1 = _this.fields.find(col.key);
|
|
663
|
+
if (!refImpl_1._subscribers) {
|
|
664
|
+
refImpl_1._subscribers = new SubscribableImp();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
refImpl_1._subscribers.reportObserved();
|
|
668
|
+
}
|
|
659
669
|
return lookup_1.item;
|
|
660
670
|
},
|
|
661
671
|
set: function (val) {
|
|
672
|
+
var _a;
|
|
662
673
|
lookup_1.set(val);
|
|
663
|
-
_this.
|
|
674
|
+
(_a = _this._subscribers) === null || _a === void 0 ? void 0 : _a.reportChanged();
|
|
675
|
+
if (!refImpl_1) {
|
|
676
|
+
refImpl_1 = _this.fields.find(col.key);
|
|
677
|
+
if (!refImpl_1._subscribers) {
|
|
678
|
+
refImpl_1._subscribers = new SubscribableImp();
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
refImpl_1._subscribers.reportChanged();
|
|
664
682
|
},
|
|
665
683
|
enumerable: true
|
|
666
684
|
});
|
|
667
|
-
|
|
685
|
+
lookup_1.set(val);
|
|
668
686
|
}
|
|
669
687
|
else {
|
|
670
688
|
}
|
|
@@ -686,51 +704,46 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
686
704
|
}
|
|
687
705
|
Object.defineProperty(rowHelperBase.prototype, "error", {
|
|
688
706
|
get: function () {
|
|
689
|
-
|
|
707
|
+
var _a;
|
|
708
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportObserved();
|
|
690
709
|
return this._error;
|
|
691
710
|
},
|
|
692
711
|
set: function (val) {
|
|
712
|
+
var _a;
|
|
693
713
|
this._error = val;
|
|
694
|
-
this.
|
|
714
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportChanged();
|
|
695
715
|
},
|
|
696
716
|
enumerable: false,
|
|
697
717
|
configurable: true
|
|
698
718
|
});
|
|
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
719
|
rowHelperBase.prototype.subscribe = function (listener) {
|
|
720
|
+
this.initSubscribers();
|
|
721
|
+
return this._subscribers.subscribe(listener);
|
|
722
|
+
};
|
|
723
|
+
rowHelperBase.prototype.initSubscribers = function () {
|
|
708
724
|
var e_11, _a;
|
|
709
725
|
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
726
|
if (!this._subscribers) {
|
|
719
|
-
this._subscribers =
|
|
727
|
+
this._subscribers = new SubscribableImp();
|
|
728
|
+
;
|
|
720
729
|
var _loop_4 = function (col) {
|
|
721
730
|
var ei = getEntitySettings(col.valueType, false);
|
|
722
731
|
if (ei && this_2.remult) {
|
|
723
732
|
}
|
|
724
733
|
else {
|
|
725
734
|
var val_1 = this_2.instance[col.key];
|
|
735
|
+
var refImpl_2 = this_2.fields.find(col.key);
|
|
736
|
+
refImpl_2._subscribers = new SubscribableImp();
|
|
726
737
|
Object.defineProperty(this_2.instance, col.key, {
|
|
727
738
|
get: function () {
|
|
728
|
-
_this.
|
|
739
|
+
_this._subscribers.reportObserved();
|
|
740
|
+
refImpl_2._subscribers.reportObserved();
|
|
729
741
|
return val_1;
|
|
730
742
|
},
|
|
731
743
|
set: function (value) {
|
|
732
744
|
val_1 = value;
|
|
733
|
-
_this.
|
|
745
|
+
_this._subscribers.reportChanged();
|
|
746
|
+
refImpl_2._subscribers.reportChanged();
|
|
734
747
|
},
|
|
735
748
|
enumerable: true
|
|
736
749
|
});
|
|
@@ -751,17 +764,17 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
751
764
|
finally { if (e_11) throw e_11.error; }
|
|
752
765
|
}
|
|
753
766
|
}
|
|
754
|
-
this._subscribers.push(list);
|
|
755
|
-
return function () { return _this._subscribers = _this._subscribers.filter(function (x) { return x != listener; }); };
|
|
756
767
|
};
|
|
757
768
|
Object.defineProperty(rowHelperBase.prototype, "isLoading", {
|
|
758
769
|
get: function () {
|
|
759
|
-
|
|
770
|
+
var _a;
|
|
771
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportObserved();
|
|
760
772
|
return this._isLoading;
|
|
761
773
|
},
|
|
762
774
|
set: function (val) {
|
|
775
|
+
var _a;
|
|
763
776
|
this._isLoading = val;
|
|
764
|
-
this.
|
|
777
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportChanged();
|
|
765
778
|
},
|
|
766
779
|
enumerable: false,
|
|
767
780
|
configurable: true
|
|
@@ -830,17 +843,38 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
830
843
|
}
|
|
831
844
|
throw err;
|
|
832
845
|
};
|
|
833
|
-
rowHelperBase.prototype.
|
|
846
|
+
rowHelperBase.prototype.__clearErrorsAndReportChanged = function () {
|
|
834
847
|
this.errors = undefined;
|
|
835
848
|
this.error = undefined;
|
|
836
|
-
this.
|
|
849
|
+
this._reportChangedToEntityAndFields();
|
|
850
|
+
};
|
|
851
|
+
rowHelperBase.prototype._reportChangedToEntityAndFields = function () {
|
|
852
|
+
var e_13, _a;
|
|
853
|
+
if (this._subscribers) {
|
|
854
|
+
this._subscribers.reportChanged();
|
|
855
|
+
try {
|
|
856
|
+
for (var _b = tslib_1.__values(this.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
857
|
+
var field = _c.value;
|
|
858
|
+
var ref = field;
|
|
859
|
+
ref._subscribers.reportChanged();
|
|
860
|
+
}
|
|
861
|
+
}
|
|
862
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
863
|
+
finally {
|
|
864
|
+
try {
|
|
865
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
866
|
+
}
|
|
867
|
+
finally { if (e_13) throw e_13.error; }
|
|
868
|
+
}
|
|
869
|
+
}
|
|
837
870
|
};
|
|
838
871
|
rowHelperBase.prototype.hasErrors = function () {
|
|
839
|
-
|
|
872
|
+
var _a;
|
|
873
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportObserved();
|
|
840
874
|
return !!!this.error && this.errors == undefined;
|
|
841
875
|
};
|
|
842
876
|
rowHelperBase.prototype.copyDataToObject = function () {
|
|
843
|
-
var
|
|
877
|
+
var e_14, _a;
|
|
844
878
|
var d = {};
|
|
845
879
|
try {
|
|
846
880
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -859,12 +893,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
859
893
|
d[col.key] = val;
|
|
860
894
|
}
|
|
861
895
|
}
|
|
862
|
-
catch (
|
|
896
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
863
897
|
finally {
|
|
864
898
|
try {
|
|
865
899
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
866
900
|
}
|
|
867
|
-
finally { if (
|
|
901
|
+
finally { if (e_14) throw e_14.error; }
|
|
868
902
|
}
|
|
869
903
|
return d;
|
|
870
904
|
};
|
|
@@ -877,7 +911,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
877
911
|
return tslib_1.__generator(this, function (_a) {
|
|
878
912
|
switch (_a.label) {
|
|
879
913
|
case 0:
|
|
880
|
-
this.
|
|
914
|
+
this.__clearErrorsAndReportChanged();
|
|
881
915
|
if (!classValidatorValidate) return [3 /*break*/, 2];
|
|
882
916
|
return [4 /*yield*/, classValidatorValidate(this.instance, this)];
|
|
883
917
|
case 1:
|
|
@@ -897,7 +931,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
897
931
|
return tslib_1.__generator(this, function (_a) {
|
|
898
932
|
switch (_a.label) {
|
|
899
933
|
case 0:
|
|
900
|
-
this.
|
|
934
|
+
this.__clearErrorsAndReportChanged();
|
|
901
935
|
if (!classValidatorValidate) return [3 /*break*/, 2];
|
|
902
936
|
return [4 /*yield*/, classValidatorValidate(this.instance, this)];
|
|
903
937
|
case 1:
|
|
@@ -920,7 +954,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
920
954
|
});
|
|
921
955
|
};
|
|
922
956
|
rowHelperBase.prototype.toApiJson = function () {
|
|
923
|
-
var
|
|
957
|
+
var e_15, _a;
|
|
924
958
|
var result = {};
|
|
925
959
|
try {
|
|
926
960
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -945,19 +979,19 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
945
979
|
}
|
|
946
980
|
}
|
|
947
981
|
}
|
|
948
|
-
catch (
|
|
982
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
949
983
|
finally {
|
|
950
984
|
try {
|
|
951
985
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
952
986
|
}
|
|
953
|
-
finally { if (
|
|
987
|
+
finally { if (e_15) throw e_15.error; }
|
|
954
988
|
}
|
|
955
989
|
return result;
|
|
956
990
|
};
|
|
957
991
|
rowHelperBase.prototype._updateEntityBasedOnApi = function (body) {
|
|
958
992
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
959
993
|
var keys, _a, _b, col, lu;
|
|
960
|
-
var
|
|
994
|
+
var e_16, _c;
|
|
961
995
|
return tslib_1.__generator(this, function (_d) {
|
|
962
996
|
switch (_d.label) {
|
|
963
997
|
case 0:
|
|
@@ -977,12 +1011,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
977
1011
|
}
|
|
978
1012
|
}
|
|
979
1013
|
}
|
|
980
|
-
catch (
|
|
1014
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
981
1015
|
finally {
|
|
982
1016
|
try {
|
|
983
1017
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
984
1018
|
}
|
|
985
|
-
finally { if (
|
|
1019
|
+
finally { if (e_16) throw e_16.error; }
|
|
986
1020
|
}
|
|
987
1021
|
return [4 /*yield*/, Promise.all(tslib_1.__spread(this.fields).map(function (x) { return x.load(); }))];
|
|
988
1022
|
case 1:
|
|
@@ -997,7 +1031,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
997
1031
|
var rowHelperImplementation = /** @class */ (function (_super) {
|
|
998
1032
|
tslib_1.__extends(rowHelperImplementation, _super);
|
|
999
1033
|
function rowHelperImplementation(info, instance, repository, edp, remult, _isNew) {
|
|
1000
|
-
var
|
|
1034
|
+
var e_17, _a;
|
|
1001
1035
|
var _this = _super.call(this, info.columnsInfo, instance, remult) || this;
|
|
1002
1036
|
_this.info = info;
|
|
1003
1037
|
_this.repository = repository;
|
|
@@ -1018,12 +1052,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1018
1052
|
}
|
|
1019
1053
|
}
|
|
1020
1054
|
}
|
|
1021
|
-
catch (
|
|
1055
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1022
1056
|
finally {
|
|
1023
1057
|
try {
|
|
1024
1058
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1025
1059
|
}
|
|
1026
|
-
finally { if (
|
|
1060
|
+
finally { if (e_17) throw e_17.error; }
|
|
1027
1061
|
}
|
|
1028
1062
|
}
|
|
1029
1063
|
if (_this.info.options.entityRefInit)
|
|
@@ -1054,13 +1088,13 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1054
1088
|
return this.instance[this.info.idMetadata.field.key];
|
|
1055
1089
|
};
|
|
1056
1090
|
rowHelperImplementation.prototype.wasDeleted = function () {
|
|
1057
|
-
|
|
1091
|
+
var _a;
|
|
1092
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportObserved();
|
|
1058
1093
|
return this._wasDeleted;
|
|
1059
1094
|
};
|
|
1060
1095
|
rowHelperImplementation.prototype.undoChanges = function () {
|
|
1061
1096
|
this.loadDataFrom(this.originalValues);
|
|
1062
|
-
this.
|
|
1063
|
-
this._reportChanged();
|
|
1097
|
+
this.__clearErrorsAndReportChanged();
|
|
1064
1098
|
};
|
|
1065
1099
|
rowHelperImplementation.prototype.reload = function () {
|
|
1066
1100
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
@@ -1080,7 +1114,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1080
1114
|
}); })];
|
|
1081
1115
|
case 1:
|
|
1082
1116
|
_a.sent();
|
|
1083
|
-
this.
|
|
1117
|
+
this._reportChangedToEntityAndFields();
|
|
1084
1118
|
return [2 /*return*/, this.instance];
|
|
1085
1119
|
}
|
|
1086
1120
|
});
|
|
@@ -1088,7 +1122,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1088
1122
|
};
|
|
1089
1123
|
Object.defineProperty(rowHelperImplementation.prototype, "fields", {
|
|
1090
1124
|
get: function () {
|
|
1091
|
-
var _a,
|
|
1125
|
+
var _a, e_18, _b;
|
|
1092
1126
|
if (!this._columns) {
|
|
1093
1127
|
var _items_1 = [];
|
|
1094
1128
|
var r_1 = (_a = {
|
|
@@ -1102,12 +1136,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1102
1136
|
_items_1.push(r_1[c.key] = new FieldRefImplementation(c, this.info.fields[c.key], this.instance, this, this));
|
|
1103
1137
|
}
|
|
1104
1138
|
}
|
|
1105
|
-
catch (
|
|
1139
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1106
1140
|
finally {
|
|
1107
1141
|
try {
|
|
1108
1142
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1109
1143
|
}
|
|
1110
|
-
finally { if (
|
|
1144
|
+
finally { if (e_18) throw e_18.error; }
|
|
1111
1145
|
}
|
|
1112
1146
|
this._columns = r_1;
|
|
1113
1147
|
}
|
|
@@ -1117,30 +1151,31 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1117
1151
|
configurable: true
|
|
1118
1152
|
});
|
|
1119
1153
|
rowHelperImplementation.prototype.save = function () {
|
|
1154
|
+
var _a;
|
|
1120
1155
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1121
|
-
var doNotSave_1, d, ignoreKeys,
|
|
1122
|
-
var
|
|
1123
|
-
return tslib_1.__generator(this, function (
|
|
1124
|
-
switch (
|
|
1156
|
+
var doNotSave_1, d, ignoreKeys, _b, _c, field, f, updatedRow, changesOnly, wasChanged, key, element, err_1;
|
|
1157
|
+
var e_19, _d;
|
|
1158
|
+
return tslib_1.__generator(this, function (_e) {
|
|
1159
|
+
switch (_e.label) {
|
|
1125
1160
|
case 0:
|
|
1126
|
-
|
|
1161
|
+
_e.trys.push([0, , 17, 18]);
|
|
1127
1162
|
this.isLoading = true;
|
|
1128
1163
|
return [4 /*yield*/, this.__validateEntity()];
|
|
1129
1164
|
case 1:
|
|
1130
|
-
|
|
1165
|
+
_e.sent();
|
|
1131
1166
|
doNotSave_1 = false;
|
|
1132
1167
|
if (!this.info.entityInfo.saving) return [3 /*break*/, 3];
|
|
1133
1168
|
return [4 /*yield*/, this.info.entityInfo.saving(this.instance, function () { return doNotSave_1 = true; })];
|
|
1134
1169
|
case 2:
|
|
1135
|
-
|
|
1136
|
-
|
|
1170
|
+
_e.sent();
|
|
1171
|
+
_e.label = 3;
|
|
1137
1172
|
case 3:
|
|
1138
1173
|
this.__assertValidity();
|
|
1139
1174
|
d = this.copyDataToObject();
|
|
1140
1175
|
ignoreKeys = [];
|
|
1141
1176
|
try {
|
|
1142
|
-
for (
|
|
1143
|
-
field =
|
|
1177
|
+
for (_b = tslib_1.__values(this.metadata.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
1178
|
+
field = _c.value;
|
|
1144
1179
|
if (field.dbReadOnly || field == this.metadata.idMetadata.field && this.metadata.options.dbAutoIncrementId) {
|
|
1145
1180
|
d[field.key] = undefined;
|
|
1146
1181
|
ignoreKeys.push(field.key);
|
|
@@ -1149,24 +1184,24 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1149
1184
|
}
|
|
1150
1185
|
}
|
|
1151
1186
|
}
|
|
1152
|
-
catch (
|
|
1187
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1153
1188
|
finally {
|
|
1154
1189
|
try {
|
|
1155
|
-
if (
|
|
1190
|
+
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
1156
1191
|
}
|
|
1157
|
-
finally { if (
|
|
1192
|
+
finally { if (e_19) throw e_19.error; }
|
|
1158
1193
|
}
|
|
1159
1194
|
if (this.info.idMetadata.field instanceof column_1.CompoundIdField)
|
|
1160
1195
|
d.id = undefined;
|
|
1161
1196
|
updatedRow = void 0;
|
|
1162
|
-
|
|
1197
|
+
_e.label = 4;
|
|
1163
1198
|
case 4:
|
|
1164
|
-
|
|
1165
|
-
this.
|
|
1199
|
+
_e.trys.push([4, 14, , 16]);
|
|
1200
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportChanged();
|
|
1166
1201
|
if (!this.isNew()) return [3 /*break*/, 6];
|
|
1167
1202
|
return [4 /*yield*/, this.edp.insert(d)];
|
|
1168
1203
|
case 5:
|
|
1169
|
-
updatedRow =
|
|
1204
|
+
updatedRow = _e.sent();
|
|
1170
1205
|
return [3 /*break*/, 10];
|
|
1171
1206
|
case 6:
|
|
1172
1207
|
changesOnly = {};
|
|
@@ -1185,34 +1220,34 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1185
1220
|
if (!doNotSave_1) return [3 /*break*/, 8];
|
|
1186
1221
|
return [4 /*yield*/, this.edp.find({ where: this.getIdFilter() })];
|
|
1187
1222
|
case 7:
|
|
1188
|
-
updatedRow = (
|
|
1223
|
+
updatedRow = (_e.sent())[0];
|
|
1189
1224
|
return [3 /*break*/, 10];
|
|
1190
1225
|
case 8: return [4 /*yield*/, this.edp.update(this.id, changesOnly)];
|
|
1191
1226
|
case 9:
|
|
1192
|
-
updatedRow =
|
|
1193
|
-
|
|
1227
|
+
updatedRow = _e.sent();
|
|
1228
|
+
_e.label = 10;
|
|
1194
1229
|
case 10: return [4 /*yield*/, this.loadDataFrom(updatedRow)];
|
|
1195
1230
|
case 11:
|
|
1196
|
-
|
|
1231
|
+
_e.sent();
|
|
1197
1232
|
if (!this.info.entityInfo.saved) return [3 /*break*/, 13];
|
|
1198
1233
|
return [4 /*yield*/, this.info.entityInfo.saved(this.instance)];
|
|
1199
1234
|
case 12:
|
|
1200
|
-
|
|
1201
|
-
|
|
1235
|
+
_e.sent();
|
|
1236
|
+
_e.label = 13;
|
|
1202
1237
|
case 13:
|
|
1203
1238
|
this.saveOriginalData();
|
|
1204
1239
|
this._isNew = false;
|
|
1205
1240
|
return [2 /*return*/, this.instance];
|
|
1206
1241
|
case 14:
|
|
1207
|
-
err_1 =
|
|
1242
|
+
err_1 = _e.sent();
|
|
1208
1243
|
return [4 /*yield*/, this.catchSaveErrors(err_1)];
|
|
1209
1244
|
case 15:
|
|
1210
|
-
|
|
1245
|
+
_e.sent();
|
|
1211
1246
|
return [3 /*break*/, 16];
|
|
1212
1247
|
case 16: return [3 /*break*/, 18];
|
|
1213
1248
|
case 17:
|
|
1214
1249
|
this.isLoading = false;
|
|
1215
|
-
this.
|
|
1250
|
+
this._reportChangedToEntityAndFields();
|
|
1216
1251
|
return [7 /*endfinally*/];
|
|
1217
1252
|
case 18: return [2 /*return*/];
|
|
1218
1253
|
}
|
|
@@ -1224,12 +1259,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1224
1259
|
};
|
|
1225
1260
|
rowHelperImplementation.prototype.delete = function () {
|
|
1226
1261
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1227
|
-
var _a, _b, listener,
|
|
1228
|
-
var
|
|
1262
|
+
var _a, _b, listener, e_20_1, err_2;
|
|
1263
|
+
var e_20, _c;
|
|
1229
1264
|
return tslib_1.__generator(this, function (_d) {
|
|
1230
1265
|
switch (_d.label) {
|
|
1231
1266
|
case 0:
|
|
1232
|
-
this.
|
|
1267
|
+
this.__clearErrorsAndReportChanged();
|
|
1233
1268
|
if (!this.info.entityInfo.deleting) return [3 /*break*/, 2];
|
|
1234
1269
|
return [4 /*yield*/, this.info.entityInfo.deleting(this.instance)];
|
|
1235
1270
|
case 1:
|
|
@@ -1267,14 +1302,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1267
1302
|
return [3 /*break*/, 8];
|
|
1268
1303
|
case 11: return [3 /*break*/, 14];
|
|
1269
1304
|
case 12:
|
|
1270
|
-
|
|
1271
|
-
|
|
1305
|
+
e_20_1 = _d.sent();
|
|
1306
|
+
e_20 = { error: e_20_1 };
|
|
1272
1307
|
return [3 /*break*/, 14];
|
|
1273
1308
|
case 13:
|
|
1274
1309
|
try {
|
|
1275
1310
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1276
1311
|
}
|
|
1277
|
-
finally { if (
|
|
1312
|
+
finally { if (e_20) throw e_20.error; }
|
|
1278
1313
|
return [7 /*endfinally*/];
|
|
1279
1314
|
case 14:
|
|
1280
1315
|
this._wasDeleted = true;
|
|
@@ -1292,8 +1327,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1292
1327
|
};
|
|
1293
1328
|
rowHelperImplementation.prototype.loadDataFrom = function (data, loadItems) {
|
|
1294
1329
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1295
|
-
var _a, _b, col, lu,
|
|
1296
|
-
var
|
|
1330
|
+
var _a, _b, col, lu, e_21_1;
|
|
1331
|
+
var e_21, _c;
|
|
1297
1332
|
return tslib_1.__generator(this, function (_d) {
|
|
1298
1333
|
switch (_d.label) {
|
|
1299
1334
|
case 0:
|
|
@@ -1328,14 +1363,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1328
1363
|
return [3 /*break*/, 1];
|
|
1329
1364
|
case 9: return [3 /*break*/, 12];
|
|
1330
1365
|
case 10:
|
|
1331
|
-
|
|
1332
|
-
|
|
1366
|
+
e_21_1 = _d.sent();
|
|
1367
|
+
e_21 = { error: e_21_1 };
|
|
1333
1368
|
return [3 /*break*/, 12];
|
|
1334
1369
|
case 11:
|
|
1335
1370
|
try {
|
|
1336
1371
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1337
1372
|
}
|
|
1338
|
-
finally { if (
|
|
1373
|
+
finally { if (e_21) throw e_21.error; }
|
|
1339
1374
|
return [7 /*endfinally*/];
|
|
1340
1375
|
case 12: return [4 /*yield*/, this.calcServerExpression()];
|
|
1341
1376
|
case 13:
|
|
@@ -1355,8 +1390,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1355
1390
|
};
|
|
1356
1391
|
rowHelperImplementation.prototype.calcServerExpression = function () {
|
|
1357
1392
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1358
|
-
var _a, _b, col, _c, _d,
|
|
1359
|
-
var
|
|
1393
|
+
var _a, _b, col, _c, _d, e_22_1;
|
|
1394
|
+
var e_22, _e;
|
|
1360
1395
|
return tslib_1.__generator(this, function (_f) {
|
|
1361
1396
|
switch (_f.label) {
|
|
1362
1397
|
case 0:
|
|
@@ -1381,14 +1416,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1381
1416
|
return [3 /*break*/, 2];
|
|
1382
1417
|
case 5: return [3 /*break*/, 8];
|
|
1383
1418
|
case 6:
|
|
1384
|
-
|
|
1385
|
-
|
|
1419
|
+
e_22_1 = _f.sent();
|
|
1420
|
+
e_22 = { error: e_22_1 };
|
|
1386
1421
|
return [3 /*break*/, 8];
|
|
1387
1422
|
case 7:
|
|
1388
1423
|
try {
|
|
1389
1424
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1390
1425
|
}
|
|
1391
|
-
finally { if (
|
|
1426
|
+
finally { if (e_22) throw e_22.error; }
|
|
1392
1427
|
return [7 /*endfinally*/];
|
|
1393
1428
|
case 8: return [2 /*return*/];
|
|
1394
1429
|
}
|
|
@@ -1396,32 +1431,34 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1396
1431
|
});
|
|
1397
1432
|
};
|
|
1398
1433
|
rowHelperImplementation.prototype.isNew = function () {
|
|
1399
|
-
|
|
1434
|
+
var _a;
|
|
1435
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportObserved();
|
|
1400
1436
|
return this._isNew;
|
|
1401
1437
|
};
|
|
1402
1438
|
rowHelperImplementation.prototype.wasChanged = function () {
|
|
1403
|
-
var
|
|
1404
|
-
|
|
1439
|
+
var e_23, _a;
|
|
1440
|
+
var _b;
|
|
1441
|
+
(_b = this._subscribers) === null || _b === void 0 ? void 0 : _b.reportObserved();
|
|
1405
1442
|
try {
|
|
1406
|
-
for (var
|
|
1407
|
-
var col =
|
|
1443
|
+
for (var _c = tslib_1.__values(this.fields), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
1444
|
+
var col = _d.value;
|
|
1408
1445
|
if (col.valueChanged())
|
|
1409
1446
|
return true;
|
|
1410
1447
|
}
|
|
1411
1448
|
}
|
|
1412
|
-
catch (
|
|
1449
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
1413
1450
|
finally {
|
|
1414
1451
|
try {
|
|
1415
|
-
if (
|
|
1452
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1416
1453
|
}
|
|
1417
|
-
finally { if (
|
|
1454
|
+
finally { if (e_23) throw e_23.error; }
|
|
1418
1455
|
}
|
|
1419
1456
|
return false;
|
|
1420
1457
|
};
|
|
1421
1458
|
rowHelperImplementation.prototype.__performColumnAndEntityValidations = function () {
|
|
1422
1459
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1423
|
-
var _a, _b, c, col,
|
|
1424
|
-
var
|
|
1460
|
+
var _a, _b, c, col, e_24_1, _c, _d, listener, e_25_1;
|
|
1461
|
+
var e_24, _e, e_25, _f;
|
|
1425
1462
|
return tslib_1.__generator(this, function (_g) {
|
|
1426
1463
|
switch (_g.label) {
|
|
1427
1464
|
case 0:
|
|
@@ -1442,14 +1479,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1442
1479
|
return [3 /*break*/, 1];
|
|
1443
1480
|
case 4: return [3 /*break*/, 7];
|
|
1444
1481
|
case 5:
|
|
1445
|
-
|
|
1446
|
-
|
|
1482
|
+
e_24_1 = _g.sent();
|
|
1483
|
+
e_24 = { error: e_24_1 };
|
|
1447
1484
|
return [3 /*break*/, 7];
|
|
1448
1485
|
case 6:
|
|
1449
1486
|
try {
|
|
1450
1487
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1451
1488
|
}
|
|
1452
|
-
finally { if (
|
|
1489
|
+
finally { if (e_24) throw e_24.error; }
|
|
1453
1490
|
return [7 /*endfinally*/];
|
|
1454
1491
|
case 7:
|
|
1455
1492
|
if (!this.info.entityInfo.validation) return [3 /*break*/, 9];
|
|
@@ -1476,14 +1513,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1476
1513
|
return [3 /*break*/, 11];
|
|
1477
1514
|
case 14: return [3 /*break*/, 17];
|
|
1478
1515
|
case 15:
|
|
1479
|
-
|
|
1480
|
-
|
|
1516
|
+
e_25_1 = _g.sent();
|
|
1517
|
+
e_25 = { error: e_25_1 };
|
|
1481
1518
|
return [3 /*break*/, 17];
|
|
1482
1519
|
case 16:
|
|
1483
1520
|
try {
|
|
1484
1521
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
1485
1522
|
}
|
|
1486
|
-
finally { if (
|
|
1523
|
+
finally { if (e_25) throw e_25.error; }
|
|
1487
1524
|
return [7 /*endfinally*/];
|
|
1488
1525
|
case 17: return [2 /*return*/];
|
|
1489
1526
|
}
|
|
@@ -1525,7 +1562,7 @@ exports.getControllerRef = getControllerRef;
|
|
|
1525
1562
|
var controllerRefImpl = /** @class */ (function (_super) {
|
|
1526
1563
|
tslib_1.__extends(controllerRefImpl, _super);
|
|
1527
1564
|
function controllerRefImpl(columnsInfo, instance, remult) {
|
|
1528
|
-
var _a,
|
|
1565
|
+
var _a, e_26, _b;
|
|
1529
1566
|
var _this = _super.call(this, columnsInfo, instance, remult) || this;
|
|
1530
1567
|
var _items = [];
|
|
1531
1568
|
var r = (_a = {
|
|
@@ -1539,20 +1576,20 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1539
1576
|
_items.push(r[col.key] = new FieldRefImplementation(col, new columnDefsImpl(col, undefined, remult), instance, undefined, _this));
|
|
1540
1577
|
}
|
|
1541
1578
|
}
|
|
1542
|
-
catch (
|
|
1579
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1543
1580
|
finally {
|
|
1544
1581
|
try {
|
|
1545
1582
|
if (columnsInfo_2_1 && !columnsInfo_2_1.done && (_b = columnsInfo_2.return)) _b.call(columnsInfo_2);
|
|
1546
1583
|
}
|
|
1547
|
-
finally { if (
|
|
1584
|
+
finally { if (e_26) throw e_26.error; }
|
|
1548
1585
|
}
|
|
1549
1586
|
_this.fields = r;
|
|
1550
1587
|
return _this;
|
|
1551
1588
|
}
|
|
1552
1589
|
controllerRefImpl.prototype.__performColumnAndEntityValidations = function () {
|
|
1553
1590
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1554
|
-
var _a, _b, col,
|
|
1555
|
-
var
|
|
1591
|
+
var _a, _b, col, e_27_1;
|
|
1592
|
+
var e_27, _c;
|
|
1556
1593
|
return tslib_1.__generator(this, function (_d) {
|
|
1557
1594
|
switch (_d.label) {
|
|
1558
1595
|
case 0:
|
|
@@ -1572,14 +1609,14 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1572
1609
|
return [3 /*break*/, 1];
|
|
1573
1610
|
case 4: return [3 /*break*/, 7];
|
|
1574
1611
|
case 5:
|
|
1575
|
-
|
|
1576
|
-
|
|
1612
|
+
e_27_1 = _d.sent();
|
|
1613
|
+
e_27 = { error: e_27_1 };
|
|
1577
1614
|
return [3 /*break*/, 7];
|
|
1578
1615
|
case 6:
|
|
1579
1616
|
try {
|
|
1580
1617
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1581
1618
|
}
|
|
1582
|
-
finally { if (
|
|
1619
|
+
finally { if (e_27) throw e_27.error; }
|
|
1583
1620
|
return [7 /*endfinally*/];
|
|
1584
1621
|
case 7: return [2 /*return*/];
|
|
1585
1622
|
}
|
|
@@ -1599,8 +1636,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1599
1636
|
this.target = this.settings.target;
|
|
1600
1637
|
this.entityRef = this.helper;
|
|
1601
1638
|
}
|
|
1639
|
+
FieldRefImplementation.prototype.subscribe = function (listener) {
|
|
1640
|
+
if (!this._subscribers) {
|
|
1641
|
+
this.rowBase.initSubscribers();
|
|
1642
|
+
}
|
|
1643
|
+
return this._subscribers.subscribe(listener);
|
|
1644
|
+
};
|
|
1602
1645
|
FieldRefImplementation.prototype.valueIsNull = function () {
|
|
1603
|
-
this.
|
|
1646
|
+
this.reportObserved();
|
|
1604
1647
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1605
1648
|
if (lu) {
|
|
1606
1649
|
return lu.id === undefined || lu.id === null;
|
|
@@ -1608,7 +1651,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1608
1651
|
return this.value === null;
|
|
1609
1652
|
};
|
|
1610
1653
|
FieldRefImplementation.prototype.originalValueIsNull = function () {
|
|
1611
|
-
this.
|
|
1654
|
+
this.reportObserved();
|
|
1612
1655
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1613
1656
|
return this.rawOriginalValue() === null;
|
|
1614
1657
|
};
|
|
@@ -1632,9 +1675,19 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1632
1675
|
});
|
|
1633
1676
|
});
|
|
1634
1677
|
};
|
|
1678
|
+
FieldRefImplementation.prototype.reportObserved = function () {
|
|
1679
|
+
var _a, _b;
|
|
1680
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportObserved();
|
|
1681
|
+
(_b = this.rowBase._subscribers) === null || _b === void 0 ? void 0 : _b.reportObserved();
|
|
1682
|
+
};
|
|
1683
|
+
FieldRefImplementation.prototype.reportChanged = function () {
|
|
1684
|
+
var _a, _b;
|
|
1685
|
+
(_a = this._subscribers) === null || _a === void 0 ? void 0 : _a.reportChanged();
|
|
1686
|
+
(_b = this.rowBase._subscribers) === null || _b === void 0 ? void 0 : _b.reportChanged();
|
|
1687
|
+
};
|
|
1635
1688
|
Object.defineProperty(FieldRefImplementation.prototype, "error", {
|
|
1636
1689
|
get: function () {
|
|
1637
|
-
this.
|
|
1690
|
+
this.reportObserved();
|
|
1638
1691
|
if (!this.rowBase.errors)
|
|
1639
1692
|
return undefined;
|
|
1640
1693
|
return this.rowBase.errors[this.metadata.key];
|
|
@@ -1643,14 +1696,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1643
1696
|
if (!this.rowBase.errors)
|
|
1644
1697
|
this.rowBase.errors = {};
|
|
1645
1698
|
this.rowBase.errors[this.metadata.key] = error;
|
|
1646
|
-
this.
|
|
1699
|
+
this.reportChanged();
|
|
1647
1700
|
},
|
|
1648
1701
|
enumerable: false,
|
|
1649
1702
|
configurable: true
|
|
1650
1703
|
});
|
|
1651
1704
|
Object.defineProperty(FieldRefImplementation.prototype, "displayValue", {
|
|
1652
1705
|
get: function () {
|
|
1653
|
-
this.
|
|
1706
|
+
this.reportObserved();
|
|
1654
1707
|
if (this.value != undefined) {
|
|
1655
1708
|
if (this.settings.displayValue)
|
|
1656
1709
|
return this.settings.displayValue(this.container, this.value);
|
|
@@ -1675,7 +1728,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1675
1728
|
;
|
|
1676
1729
|
Object.defineProperty(FieldRefImplementation.prototype, "originalValue", {
|
|
1677
1730
|
get: function () {
|
|
1678
|
-
this.
|
|
1731
|
+
this.reportObserved();
|
|
1679
1732
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1680
1733
|
if (lu)
|
|
1681
1734
|
return lu.get(this.rawOriginalValue());
|
|
@@ -1690,7 +1743,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1690
1743
|
};
|
|
1691
1744
|
Object.defineProperty(FieldRefImplementation.prototype, "inputValue", {
|
|
1692
1745
|
get: function () {
|
|
1693
|
-
this.
|
|
1746
|
+
this.reportObserved();
|
|
1694
1747
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1695
1748
|
if (lu)
|
|
1696
1749
|
return lu.id != undefined ? lu.id.toString() : null;
|
|
@@ -1709,7 +1762,7 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1709
1762
|
});
|
|
1710
1763
|
;
|
|
1711
1764
|
FieldRefImplementation.prototype.valueChanged = function () {
|
|
1712
|
-
this.
|
|
1765
|
+
this.reportObserved();
|
|
1713
1766
|
var val = this.value;
|
|
1714
1767
|
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1715
1768
|
if (lu) {
|
|
@@ -1719,8 +1772,8 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1719
1772
|
};
|
|
1720
1773
|
FieldRefImplementation.prototype.__performValidation = function () {
|
|
1721
1774
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1722
|
-
var x, _a, _b, v,
|
|
1723
|
-
var
|
|
1775
|
+
var x, _a, _b, v, e_28_1;
|
|
1776
|
+
var e_28, _c;
|
|
1724
1777
|
return tslib_1.__generator(this, function (_d) {
|
|
1725
1778
|
switch (_d.label) {
|
|
1726
1779
|
case 0:
|
|
@@ -1743,14 +1796,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1743
1796
|
return [3 /*break*/, 2];
|
|
1744
1797
|
case 5: return [3 /*break*/, 8];
|
|
1745
1798
|
case 6:
|
|
1746
|
-
|
|
1747
|
-
|
|
1799
|
+
e_28_1 = _d.sent();
|
|
1800
|
+
e_28 = { error: e_28_1 };
|
|
1748
1801
|
return [3 /*break*/, 8];
|
|
1749
1802
|
case 7:
|
|
1750
1803
|
try {
|
|
1751
1804
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1752
1805
|
}
|
|
1753
|
-
finally { if (
|
|
1806
|
+
finally { if (e_28) throw e_28.error; }
|
|
1754
1807
|
return [7 /*endfinally*/];
|
|
1755
1808
|
case 8: return [3 /*break*/, 11];
|
|
1756
1809
|
case 9:
|
|
@@ -1877,7 +1930,7 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
1877
1930
|
exports.columnDefsImpl = columnDefsImpl;
|
|
1878
1931
|
var EntityFullInfo = /** @class */ (function () {
|
|
1879
1932
|
function EntityFullInfo(columnsInfo, entityInfo, remult, entityType, key) {
|
|
1880
|
-
var _a,
|
|
1933
|
+
var _a, e_29, _b;
|
|
1881
1934
|
var _this = this;
|
|
1882
1935
|
this.columnsInfo = columnsInfo;
|
|
1883
1936
|
this.entityInfo = entityInfo;
|
|
@@ -1946,12 +1999,12 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
1946
1999
|
_items.push(r[x.key] = new columnDefsImpl(x, this, remult));
|
|
1947
2000
|
}
|
|
1948
2001
|
}
|
|
1949
|
-
catch (
|
|
2002
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
1950
2003
|
finally {
|
|
1951
2004
|
try {
|
|
1952
2005
|
if (columnsInfo_3_1 && !columnsInfo_3_1.done && (_b = columnsInfo_3.return)) _b.call(columnsInfo_3);
|
|
1953
2006
|
}
|
|
1954
|
-
finally { if (
|
|
2007
|
+
finally { if (e_29) throw e_29.error; }
|
|
1955
2008
|
}
|
|
1956
2009
|
this.fields = r;
|
|
1957
2010
|
this.dbAutoIncrementId = entityInfo.dbAutoIncrementId;
|
|
@@ -2118,7 +2171,7 @@ function Field() {
|
|
|
2118
2171
|
exports.Field = Field;
|
|
2119
2172
|
var storableMember = Symbol("storableMember");
|
|
2120
2173
|
function buildOptions(options, remult) {
|
|
2121
|
-
var
|
|
2174
|
+
var e_30, _a;
|
|
2122
2175
|
var r = {};
|
|
2123
2176
|
try {
|
|
2124
2177
|
for (var options_1 = tslib_1.__values(options), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) {
|
|
@@ -2131,12 +2184,12 @@ function buildOptions(options, remult) {
|
|
|
2131
2184
|
}
|
|
2132
2185
|
}
|
|
2133
2186
|
}
|
|
2134
|
-
catch (
|
|
2187
|
+
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
2135
2188
|
finally {
|
|
2136
2189
|
try {
|
|
2137
2190
|
if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1);
|
|
2138
2191
|
}
|
|
2139
|
-
finally { if (
|
|
2192
|
+
finally { if (e_30) throw e_30.error; }
|
|
2140
2193
|
}
|
|
2141
2194
|
return r;
|
|
2142
2195
|
}
|
|
@@ -2219,7 +2272,7 @@ function Entity(key) {
|
|
|
2219
2272
|
}
|
|
2220
2273
|
}
|
|
2221
2274
|
var factory = function (remult) {
|
|
2222
|
-
var
|
|
2275
|
+
var e_31, _a;
|
|
2223
2276
|
var r = {};
|
|
2224
2277
|
try {
|
|
2225
2278
|
for (var options_2 = tslib_1.__values(options), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) {
|
|
@@ -2232,12 +2285,12 @@ function Entity(key) {
|
|
|
2232
2285
|
}
|
|
2233
2286
|
}
|
|
2234
2287
|
}
|
|
2235
|
-
catch (
|
|
2288
|
+
catch (e_31_1) { e_31 = { error: e_31_1 }; }
|
|
2236
2289
|
finally {
|
|
2237
2290
|
try {
|
|
2238
2291
|
if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2);
|
|
2239
2292
|
}
|
|
2240
|
-
finally { if (
|
|
2293
|
+
finally { if (e_31) throw e_31.error; }
|
|
2241
2294
|
}
|
|
2242
2295
|
var base = Object.getPrototypeOf(target);
|
|
2243
2296
|
if (base) {
|
|
@@ -2282,6 +2335,23 @@ var EntityBase = /** @class */ (function () {
|
|
|
2282
2335
|
return EntityBase;
|
|
2283
2336
|
}());
|
|
2284
2337
|
exports.EntityBase = EntityBase;
|
|
2338
|
+
var ControllerBase = /** @class */ (function () {
|
|
2339
|
+
function ControllerBase(remult) {
|
|
2340
|
+
this.remult = remult;
|
|
2341
|
+
}
|
|
2342
|
+
Object.defineProperty(ControllerBase.prototype, "$", {
|
|
2343
|
+
get: function () { return getFields(this); },
|
|
2344
|
+
enumerable: false,
|
|
2345
|
+
configurable: true
|
|
2346
|
+
});
|
|
2347
|
+
Object.defineProperty(ControllerBase.prototype, "_", {
|
|
2348
|
+
get: function () { return getControllerRef(this); },
|
|
2349
|
+
enumerable: false,
|
|
2350
|
+
configurable: true
|
|
2351
|
+
});
|
|
2352
|
+
return ControllerBase;
|
|
2353
|
+
}());
|
|
2354
|
+
exports.ControllerBase = ControllerBase;
|
|
2285
2355
|
var QueryResultImpl = /** @class */ (function () {
|
|
2286
2356
|
function QueryResultImpl(options, repo) {
|
|
2287
2357
|
this.options = options;
|
|
@@ -2326,9 +2396,9 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2326
2396
|
});
|
|
2327
2397
|
};
|
|
2328
2398
|
QueryResultImpl.prototype.forEach = function (what) {
|
|
2329
|
-
var
|
|
2399
|
+
var e_32, _a;
|
|
2330
2400
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2331
|
-
var i, _b, _c, x,
|
|
2401
|
+
var i, _b, _c, x, e_32_1;
|
|
2332
2402
|
return tslib_1.__generator(this, function (_d) {
|
|
2333
2403
|
switch (_d.label) {
|
|
2334
2404
|
case 0:
|
|
@@ -2350,8 +2420,8 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2350
2420
|
case 5: return [3 /*break*/, 2];
|
|
2351
2421
|
case 6: return [3 /*break*/, 13];
|
|
2352
2422
|
case 7:
|
|
2353
|
-
|
|
2354
|
-
|
|
2423
|
+
e_32_1 = _d.sent();
|
|
2424
|
+
e_32 = { error: e_32_1 };
|
|
2355
2425
|
return [3 /*break*/, 13];
|
|
2356
2426
|
case 8:
|
|
2357
2427
|
_d.trys.push([8, , 11, 12]);
|
|
@@ -2362,7 +2432,7 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2362
2432
|
_d.label = 10;
|
|
2363
2433
|
case 10: return [3 /*break*/, 12];
|
|
2364
2434
|
case 11:
|
|
2365
|
-
if (
|
|
2435
|
+
if (e_32) throw e_32.error;
|
|
2366
2436
|
return [7 /*endfinally*/];
|
|
2367
2437
|
case 12: return [7 /*endfinally*/];
|
|
2368
2438
|
case 13: return [2 /*return*/, i];
|
|
@@ -2478,4 +2548,33 @@ var cacheEntityInfo = /** @class */ (function () {
|
|
|
2478
2548
|
}
|
|
2479
2549
|
return cacheEntityInfo;
|
|
2480
2550
|
}());
|
|
2551
|
+
var SubscribableImp = /** @class */ (function () {
|
|
2552
|
+
function SubscribableImp() {
|
|
2553
|
+
}
|
|
2554
|
+
SubscribableImp.prototype.reportChanged = function () {
|
|
2555
|
+
if (this._subscribers)
|
|
2556
|
+
this._subscribers.forEach(function (x) { return x.reportChanged(); });
|
|
2557
|
+
};
|
|
2558
|
+
SubscribableImp.prototype.reportObserved = function () {
|
|
2559
|
+
if (this._subscribers)
|
|
2560
|
+
this._subscribers.forEach(function (x) { return x.reportObserved(); });
|
|
2561
|
+
};
|
|
2562
|
+
SubscribableImp.prototype.subscribe = function (listener) {
|
|
2563
|
+
var _this = this;
|
|
2564
|
+
var list;
|
|
2565
|
+
if (typeof listener === "function")
|
|
2566
|
+
list = {
|
|
2567
|
+
reportChanged: function () { return listener(); },
|
|
2568
|
+
reportObserved: function () { }
|
|
2569
|
+
};
|
|
2570
|
+
else
|
|
2571
|
+
list = listener;
|
|
2572
|
+
if (!this._subscribers) {
|
|
2573
|
+
this._subscribers = [];
|
|
2574
|
+
}
|
|
2575
|
+
this._subscribers.push(list);
|
|
2576
|
+
return function () { return _this._subscribers = _this._subscribers.filter(function (x) { return x != listener; }); };
|
|
2577
|
+
};
|
|
2578
|
+
return SubscribableImp;
|
|
2579
|
+
}());
|
|
2481
2580
|
//# sourceMappingURL=RepositoryImplementation.js.map
|