remult 0.9.25 → 0.9.29

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ControllerBase = exports.EntityBase = exports.Entity = exports.decorateColumnSettings = exports.Field = exports.UUIDField = 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.UuidField = 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");
@@ -11,33 +11,23 @@ var valueConverters_1 = require("../../valueConverters");
11
11
  var filter_interfaces_2 = require("../filter/filter-interfaces");
12
12
  var assign_1 = require("../../assign");
13
13
  var classValidatorValidate = undefined;
14
- Promise.resolve().then(function () { return require("class-validator".toString()); }).then(function (v) {
15
- classValidatorValidate = function (item, ref) {
16
- return v.validate(item).then(function (errors) {
17
- var e_1, _a;
18
- try {
19
- for (var errors_1 = tslib_1.__values(errors), errors_1_1 = errors_1.next(); !errors_1_1.done; errors_1_1 = errors_1.next()) {
20
- var err = errors_1_1.value;
21
- for (var key in err.constraints) {
22
- if (Object.prototype.hasOwnProperty.call(err.constraints, key)) {
23
- var element = err.constraints[key];
24
- ref.fields.find(err.property).error = element;
25
- }
26
- }
27
- }
28
- }
29
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
30
- finally {
31
- try {
32
- if (errors_1_1 && !errors_1_1.done && (_a = errors_1.return)) _a.call(errors_1);
33
- }
34
- finally { if (e_1) throw e_1.error; }
35
- }
36
- });
37
- };
38
- })
39
- .catch(function () {
40
- });
14
+ // import("class-validator".toString())
15
+ // .then((v) => {
16
+ // classValidatorValidate = (item, ref) => {
17
+ // return v.validate(item).then(errors => {
18
+ // for (const err of errors) {
19
+ // for (const key in err.constraints) {
20
+ // if (Object.prototype.hasOwnProperty.call(err.constraints, key)) {
21
+ // const element = err.constraints[key];
22
+ // ref.fields.find(err.property).error = element;
23
+ // }
24
+ // }
25
+ // }
26
+ // });
27
+ // }
28
+ // })
29
+ // .catch(() => {
30
+ // });
41
31
  var RepositoryImplementation = /** @class */ (function () {
42
32
  function RepositoryImplementation(entity, remult, dataProvider) {
43
33
  this.entity = entity;
@@ -50,7 +40,7 @@ var RepositoryImplementation = /** @class */ (function () {
50
40
  RepositoryImplementation.prototype.createAfterFilter = function (orderBy, lastRow) {
51
41
  return tslib_1.__awaiter(this, void 0, void 0, function () {
52
42
  var values, _a, _b, s, existingVal, r, equalToColumn, _c, _d, s, ff, f, equalToColumn_1, equalToColumn_1_1, c;
53
- var e_2, _e, e_3, _f, e_4, _g;
43
+ var e_1, _e, e_2, _f, e_3, _g;
54
44
  return tslib_1.__generator(this, function (_h) {
55
45
  values = new Map();
56
46
  try {
@@ -68,12 +58,12 @@ var RepositoryImplementation = /** @class */ (function () {
68
58
  values.set(s.field.key, existingVal);
69
59
  }
70
60
  }
71
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
61
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
72
62
  finally {
73
63
  try {
74
64
  if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
75
65
  }
76
- finally { if (e_2) throw e_2.error; }
66
+ finally { if (e_1) throw e_1.error; }
77
67
  }
78
68
  r = { $or: [] };
79
69
  equalToColumn = [];
@@ -83,17 +73,17 @@ var RepositoryImplementation = /** @class */ (function () {
83
73
  ff = new filter_interfaces_2.filterHelper(s.field);
84
74
  f = {};
85
75
  try {
86
- 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()) {
76
+ for (equalToColumn_1 = (e_3 = void 0, tslib_1.__values(equalToColumn)), equalToColumn_1_1 = equalToColumn_1.next(); !equalToColumn_1_1.done; equalToColumn_1_1 = equalToColumn_1.next()) {
87
77
  c = equalToColumn_1_1.value;
88
78
  f[c.key] = values.get(c.key);
89
79
  }
90
80
  }
91
- catch (e_4_1) { e_4 = { error: e_4_1 }; }
81
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
92
82
  finally {
93
83
  try {
94
84
  if (equalToColumn_1_1 && !equalToColumn_1_1.done && (_g = equalToColumn_1.return)) _g.call(equalToColumn_1);
95
85
  }
96
- finally { if (e_4) throw e_4.error; }
86
+ finally { if (e_3) throw e_3.error; }
97
87
  }
98
88
  equalToColumn.push(s.field);
99
89
  if (s.isDescending) {
@@ -104,12 +94,12 @@ var RepositoryImplementation = /** @class */ (function () {
104
94
  r.$or.push(f);
105
95
  }
106
96
  }
107
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
97
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
108
98
  finally {
109
99
  try {
110
100
  if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
111
101
  }
112
- finally { if (e_3) throw e_3.error; }
102
+ finally { if (e_2) throw e_2.error; }
113
103
  }
114
104
  return [2 /*return*/, r];
115
105
  });
@@ -252,8 +242,8 @@ var RepositoryImplementation = /** @class */ (function () {
252
242
  };
253
243
  RepositoryImplementation.prototype.find = function (options) {
254
244
  return tslib_1.__awaiter(this, void 0, void 0, function () {
255
- 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;
256
- var e_5, _d, e_6, _e, _f, e_7, _g;
245
+ 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_4_1, result;
246
+ var e_4, _d, e_5, _e, _f, e_6, _g;
257
247
  var _this = this;
258
248
  return tslib_1.__generator(this, function (_h) {
259
249
  switch (_h.label) {
@@ -295,7 +285,7 @@ var RepositoryImplementation = /** @class */ (function () {
295
285
  repo = this.remult.repo(col.valueType);
296
286
  toLoad = [];
297
287
  try {
298
- 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()) {
288
+ for (rawRows_1 = (e_5 = void 0, tslib_1.__values(rawRows)), rawRows_1_1 = rawRows_1.next(); !rawRows_1_1.done; rawRows_1_1 = rawRows_1.next()) {
299
289
  r = rawRows_1_1.value;
300
290
  val = r[col.key];
301
291
  if (val !== undefined && val !== null && !toLoad.includes(val) && !repo.idCache.has(val)) {
@@ -303,29 +293,29 @@ var RepositoryImplementation = /** @class */ (function () {
303
293
  }
304
294
  }
305
295
  }
306
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
296
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
307
297
  finally {
308
298
  try {
309
299
  if (rawRows_1_1 && !rawRows_1_1.done && (_e = rawRows_1.return)) _e.call(rawRows_1);
310
300
  }
311
- finally { if (e_6) throw e_6.error; }
301
+ finally { if (e_5) throw e_5.error; }
312
302
  }
313
303
  if (!(toLoad.length > 0)) return [3 /*break*/, 6];
314
304
  return [4 /*yield*/, repo.find({ where: (_f = repo.metadata.idMetadata).getIdFilter.apply(_f, tslib_1.__spread(toLoad)) })];
315
305
  case 5:
316
306
  rows = _h.sent();
317
307
  try {
318
- 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()) {
308
+ for (rows_1 = (e_6 = void 0, tslib_1.__values(rows)), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
319
309
  r = rows_1_1.value;
320
310
  repo.addToCache(r);
321
311
  }
322
312
  }
323
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
313
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
324
314
  finally {
325
315
  try {
326
316
  if (rows_1_1 && !rows_1_1.done && (_g = rows_1.return)) _g.call(rows_1);
327
317
  }
328
- finally { if (e_7) throw e_7.error; }
318
+ finally { if (e_6) throw e_6.error; }
329
319
  }
330
320
  _h.label = 6;
331
321
  case 6:
@@ -333,14 +323,14 @@ var RepositoryImplementation = /** @class */ (function () {
333
323
  return [3 /*break*/, 4];
334
324
  case 7: return [3 /*break*/, 10];
335
325
  case 8:
336
- e_5_1 = _h.sent();
337
- e_5 = { error: e_5_1 };
326
+ e_4_1 = _h.sent();
327
+ e_4 = { error: e_4_1 };
338
328
  return [3 /*break*/, 10];
339
329
  case 9:
340
330
  try {
341
331
  if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
342
332
  }
343
- finally { if (e_5) throw e_5.error; }
333
+ finally { if (e_4) throw e_4.error; }
344
334
  return [7 /*endfinally*/];
345
335
  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) {
346
336
  switch (_a.label) {
@@ -475,7 +465,7 @@ var RepositoryImplementation = /** @class */ (function () {
475
465
  RepositoryImplementation.prototype.fromJson = function (json, newRow) {
476
466
  return tslib_1.__awaiter(this, void 0, void 0, function () {
477
467
  var obj, _a, _b, col, r, helper;
478
- var e_8, _c;
468
+ var e_7, _c;
479
469
  return tslib_1.__generator(this, function (_d) {
480
470
  switch (_d.label) {
481
471
  case 0:
@@ -488,12 +478,12 @@ var RepositoryImplementation = /** @class */ (function () {
488
478
  }
489
479
  }
490
480
  }
491
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
481
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
492
482
  finally {
493
483
  try {
494
484
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
495
485
  }
496
- finally { if (e_8) throw e_8.error; }
486
+ finally { if (e_7) throw e_7.error; }
497
487
  }
498
488
  if (!newRow) return [3 /*break*/, 2];
499
489
  r = this.create();
@@ -597,7 +587,7 @@ function createOldEntity(entity, remult) {
597
587
  var key = getEntityKey(entity);
598
588
  var base = Object.getPrototypeOf(entity);
599
589
  var _loop_1 = function () {
600
- var e_9, _a;
590
+ var e_8, _a;
601
591
  var baseCols = exports.columnsOfType.get(base);
602
592
  if (baseCols) {
603
593
  r.unshift.apply(r, tslib_1.__spread(baseCols.filter(function (x) { return !r.find(function (y) { return y.key == x.key; }); })));
@@ -617,17 +607,17 @@ function createOldEntity(entity, remult) {
617
607
  }
618
608
  };
619
609
  try {
620
- for (var _b = (e_9 = void 0, tslib_1.__values(functions)), _c = _b.next(); !_c.done; _c = _b.next()) {
610
+ for (var _b = (e_8 = void 0, tslib_1.__values(functions)), _c = _b.next(); !_c.done; _c = _b.next()) {
621
611
  var key_1 = _c.value;
622
612
  _loop_2(key_1);
623
613
  }
624
614
  }
625
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
615
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
626
616
  finally {
627
617
  try {
628
618
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
629
619
  }
630
- finally { if (e_9) throw e_9.error; }
620
+ finally { if (e_8) throw e_8.error; }
631
621
  }
632
622
  }
633
623
  base = Object.getPrototypeOf(base);
@@ -640,7 +630,7 @@ function createOldEntity(entity, remult) {
640
630
  exports.createOldEntity = createOldEntity;
641
631
  var rowHelperBase = /** @class */ (function () {
642
632
  function rowHelperBase(columnsInfo, instance, remult) {
643
- var e_10, _a;
633
+ var e_9, _a;
644
634
  var _this = this;
645
635
  this.columnsInfo = columnsInfo;
646
636
  this.instance = instance;
@@ -695,12 +685,12 @@ var rowHelperBase = /** @class */ (function () {
695
685
  _loop_3(col);
696
686
  }
697
687
  }
698
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
688
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
699
689
  finally {
700
690
  try {
701
691
  if (columnsInfo_1_1 && !columnsInfo_1_1.done && (_a = columnsInfo_1.return)) _a.call(columnsInfo_1);
702
692
  }
703
- finally { if (e_10) throw e_10.error; }
693
+ finally { if (e_9) throw e_9.error; }
704
694
  }
705
695
  }
706
696
  Object.defineProperty(rowHelperBase.prototype, "error", {
@@ -722,7 +712,7 @@ var rowHelperBase = /** @class */ (function () {
722
712
  return this._subscribers.subscribe(listener);
723
713
  };
724
714
  rowHelperBase.prototype.initSubscribers = function () {
725
- var e_11, _a;
715
+ var e_10, _a;
726
716
  var _this = this;
727
717
  if (!this._subscribers) {
728
718
  this._subscribers = new SubscribableImp();
@@ -757,12 +747,12 @@ var rowHelperBase = /** @class */ (function () {
757
747
  _loop_4(col);
758
748
  }
759
749
  }
760
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
750
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
761
751
  finally {
762
752
  try {
763
753
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
764
754
  }
765
- finally { if (e_11) throw e_11.error; }
755
+ finally { if (e_10) throw e_10.error; }
766
756
  }
767
757
  }
768
758
  };
@@ -793,7 +783,7 @@ var rowHelperBase = /** @class */ (function () {
793
783
  });
794
784
  };
795
785
  rowHelperBase.prototype.__assertValidity = function () {
796
- var e_12, _a;
786
+ var e_11, _a;
797
787
  if (!this.hasErrors()) {
798
788
  var error = {
799
789
  modelState: Object.assign({}, this.errors),
@@ -810,12 +800,12 @@ var rowHelperBase = /** @class */ (function () {
810
800
  }
811
801
  }
812
802
  }
813
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
803
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
814
804
  finally {
815
805
  try {
816
806
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
817
807
  }
818
- finally { if (e_12) throw e_12.error; }
808
+ finally { if (e_11) throw e_11.error; }
819
809
  }
820
810
  }
821
811
  throw error;
@@ -850,7 +840,7 @@ var rowHelperBase = /** @class */ (function () {
850
840
  this._reportChangedToEntityAndFields();
851
841
  };
852
842
  rowHelperBase.prototype._reportChangedToEntityAndFields = function () {
853
- var e_13, _a;
843
+ var e_12, _a;
854
844
  if (this._subscribers) {
855
845
  this._subscribers.reportChanged();
856
846
  try {
@@ -860,12 +850,12 @@ var rowHelperBase = /** @class */ (function () {
860
850
  ref._subscribers.reportChanged();
861
851
  }
862
852
  }
863
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
853
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
864
854
  finally {
865
855
  try {
866
856
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
867
857
  }
868
- finally { if (e_13) throw e_13.error; }
858
+ finally { if (e_12) throw e_12.error; }
869
859
  }
870
860
  }
871
861
  };
@@ -875,7 +865,7 @@ var rowHelperBase = /** @class */ (function () {
875
865
  return !!!this.error && this.errors == undefined;
876
866
  };
877
867
  rowHelperBase.prototype.copyDataToObject = function () {
878
- var e_14, _a;
868
+ var e_13, _a;
879
869
  var d = {};
880
870
  try {
881
871
  for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -888,18 +878,18 @@ var rowHelperBase = /** @class */ (function () {
888
878
  val = this.instance[col.key];
889
879
  if (val !== undefined) {
890
880
  val = col.valueConverter.toJson(val);
891
- if (val !== undefined)
881
+ if (val !== undefined && val !== null)
892
882
  val = col.valueConverter.fromJson(JSON.parse(JSON.stringify(val)));
893
883
  }
894
884
  d[col.key] = val;
895
885
  }
896
886
  }
897
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
887
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
898
888
  finally {
899
889
  try {
900
890
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
901
891
  }
902
- finally { if (e_14) throw e_14.error; }
892
+ finally { if (e_13) throw e_13.error; }
903
893
  }
904
894
  return d;
905
895
  };
@@ -955,7 +945,7 @@ var rowHelperBase = /** @class */ (function () {
955
945
  });
956
946
  };
957
947
  rowHelperBase.prototype.toApiJson = function () {
958
- var e_15, _a;
948
+ var e_14, _a;
959
949
  var result = {};
960
950
  try {
961
951
  for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
@@ -980,19 +970,19 @@ var rowHelperBase = /** @class */ (function () {
980
970
  }
981
971
  }
982
972
  }
983
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
973
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
984
974
  finally {
985
975
  try {
986
976
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
987
977
  }
988
- finally { if (e_15) throw e_15.error; }
978
+ finally { if (e_14) throw e_14.error; }
989
979
  }
990
980
  return result;
991
981
  };
992
982
  rowHelperBase.prototype._updateEntityBasedOnApi = function (body) {
993
983
  return tslib_1.__awaiter(this, void 0, void 0, function () {
994
984
  var keys, _a, _b, col, lu;
995
- var e_16, _c;
985
+ var e_15, _c;
996
986
  return tslib_1.__generator(this, function (_d) {
997
987
  switch (_d.label) {
998
988
  case 0:
@@ -1012,12 +1002,12 @@ var rowHelperBase = /** @class */ (function () {
1012
1002
  }
1013
1003
  }
1014
1004
  }
1015
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
1005
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
1016
1006
  finally {
1017
1007
  try {
1018
1008
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1019
1009
  }
1020
- finally { if (e_16) throw e_16.error; }
1010
+ finally { if (e_15) throw e_15.error; }
1021
1011
  }
1022
1012
  return [4 /*yield*/, Promise.all(tslib_1.__spread(this.fields).map(function (x) { return x.load(); }))];
1023
1013
  case 1:
@@ -1032,7 +1022,7 @@ var rowHelperBase = /** @class */ (function () {
1032
1022
  var rowHelperImplementation = /** @class */ (function (_super) {
1033
1023
  tslib_1.__extends(rowHelperImplementation, _super);
1034
1024
  function rowHelperImplementation(info, instance, repository, edp, remult, _isNew) {
1035
- var e_17, _a;
1025
+ var e_16, _a;
1036
1026
  var _this = _super.call(this, info.columnsInfo, instance, remult) || this;
1037
1027
  _this.info = info;
1038
1028
  _this.repository = repository;
@@ -1053,12 +1043,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1053
1043
  }
1054
1044
  }
1055
1045
  }
1056
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
1046
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
1057
1047
  finally {
1058
1048
  try {
1059
1049
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1060
1050
  }
1061
- finally { if (e_17) throw e_17.error; }
1051
+ finally { if (e_16) throw e_16.error; }
1062
1052
  }
1063
1053
  }
1064
1054
  if (_this.info.options.entityRefInit)
@@ -1123,13 +1113,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1123
1113
  };
1124
1114
  Object.defineProperty(rowHelperImplementation.prototype, "fields", {
1125
1115
  get: function () {
1126
- var _a, e_18, _b;
1116
+ var _a, e_17, _b;
1127
1117
  if (!this._columns) {
1128
1118
  var _items_1 = [];
1129
1119
  var r_1 = (_a = {
1130
1120
  find: function (c) { return r_1[typeof c === "string" ? c : c.key]; }
1131
1121
  },
1132
1122
  _a[Symbol.iterator] = function () { return _items_1[Symbol.iterator](); },
1123
+ _a.toArray = function () { return _items_1; },
1133
1124
  _a);
1134
1125
  try {
1135
1126
  for (var _c = tslib_1.__values(this.info.columnsInfo), _d = _c.next(); !_d.done; _d = _c.next()) {
@@ -1137,12 +1128,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1137
1128
  _items_1.push(r_1[c.key] = new FieldRefImplementation(c, this.info.fields[c.key], this.instance, this, this));
1138
1129
  }
1139
1130
  }
1140
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
1131
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
1141
1132
  finally {
1142
1133
  try {
1143
1134
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1144
1135
  }
1145
- finally { if (e_18) throw e_18.error; }
1136
+ finally { if (e_17) throw e_17.error; }
1146
1137
  }
1147
1138
  this._columns = r_1;
1148
1139
  }
@@ -1155,7 +1146,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1155
1146
  var _a;
1156
1147
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1157
1148
  var doNotSave_1, d, ignoreKeys, _b, _c, field, f, updatedRow, changesOnly, wasChanged, key, element, err_1;
1158
- var e_19, _d;
1149
+ var e_18, _d;
1159
1150
  return tslib_1.__generator(this, function (_e) {
1160
1151
  switch (_e.label) {
1161
1152
  case 0:
@@ -1185,15 +1176,15 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1185
1176
  }
1186
1177
  }
1187
1178
  }
1188
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
1179
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
1189
1180
  finally {
1190
1181
  try {
1191
1182
  if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
1192
1183
  }
1193
- finally { if (e_19) throw e_19.error; }
1184
+ finally { if (e_18) throw e_18.error; }
1194
1185
  }
1195
1186
  if (this.info.idMetadata.field instanceof column_1.CompoundIdField)
1196
- d.id = undefined;
1187
+ delete (d.id);
1197
1188
  updatedRow = void 0;
1198
1189
  _e.label = 4;
1199
1190
  case 4:
@@ -1210,7 +1201,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1210
1201
  for (key in d) {
1211
1202
  if (Object.prototype.hasOwnProperty.call(d, key)) {
1212
1203
  element = d[key];
1213
- if (element !== this.originalValues[key] && !ignoreKeys.includes(key)) {
1204
+ if (this.fields.find(key).valueChanged() && !ignoreKeys.includes(key)) {
1214
1205
  changesOnly[key] = element;
1215
1206
  wasChanged = true;
1216
1207
  }
@@ -1260,8 +1251,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1260
1251
  };
1261
1252
  rowHelperImplementation.prototype.delete = function () {
1262
1253
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1263
- var _a, _b, listener, e_20_1, err_2;
1264
- var e_20, _c;
1254
+ var _a, _b, listener, e_19_1, err_2;
1255
+ var e_19, _c;
1265
1256
  return tslib_1.__generator(this, function (_d) {
1266
1257
  switch (_d.label) {
1267
1258
  case 0:
@@ -1303,14 +1294,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1303
1294
  return [3 /*break*/, 8];
1304
1295
  case 11: return [3 /*break*/, 14];
1305
1296
  case 12:
1306
- e_20_1 = _d.sent();
1307
- e_20 = { error: e_20_1 };
1297
+ e_19_1 = _d.sent();
1298
+ e_19 = { error: e_19_1 };
1308
1299
  return [3 /*break*/, 14];
1309
1300
  case 13:
1310
1301
  try {
1311
1302
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1312
1303
  }
1313
- finally { if (e_20) throw e_20.error; }
1304
+ finally { if (e_19) throw e_19.error; }
1314
1305
  return [7 /*endfinally*/];
1315
1306
  case 14:
1316
1307
  this._wasDeleted = true;
@@ -1328,8 +1319,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1328
1319
  };
1329
1320
  rowHelperImplementation.prototype.loadDataFrom = function (data, loadItems) {
1330
1321
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1331
- var _a, _b, col, lu, e_21_1;
1332
- var e_21, _c;
1322
+ var _a, _b, col, lu, e_20_1;
1323
+ var e_20, _c;
1333
1324
  return tslib_1.__generator(this, function (_d) {
1334
1325
  switch (_d.label) {
1335
1326
  case 0:
@@ -1364,14 +1355,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1364
1355
  return [3 /*break*/, 1];
1365
1356
  case 9: return [3 /*break*/, 12];
1366
1357
  case 10:
1367
- e_21_1 = _d.sent();
1368
- e_21 = { error: e_21_1 };
1358
+ e_20_1 = _d.sent();
1359
+ e_20 = { error: e_20_1 };
1369
1360
  return [3 /*break*/, 12];
1370
1361
  case 11:
1371
1362
  try {
1372
1363
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1373
1364
  }
1374
- finally { if (e_21) throw e_21.error; }
1365
+ finally { if (e_20) throw e_20.error; }
1375
1366
  return [7 /*endfinally*/];
1376
1367
  case 12: return [4 /*yield*/, this.calcServerExpression()];
1377
1368
  case 13:
@@ -1391,8 +1382,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1391
1382
  };
1392
1383
  rowHelperImplementation.prototype.calcServerExpression = function () {
1393
1384
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1394
- var _a, _b, col, _c, _d, e_22_1;
1395
- var e_22, _e;
1385
+ var _a, _b, col, _c, _d, e_21_1;
1386
+ var e_21, _e;
1396
1387
  return tslib_1.__generator(this, function (_f) {
1397
1388
  switch (_f.label) {
1398
1389
  case 0:
@@ -1417,14 +1408,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1417
1408
  return [3 /*break*/, 2];
1418
1409
  case 5: return [3 /*break*/, 8];
1419
1410
  case 6:
1420
- e_22_1 = _f.sent();
1421
- e_22 = { error: e_22_1 };
1411
+ e_21_1 = _f.sent();
1412
+ e_21 = { error: e_21_1 };
1422
1413
  return [3 /*break*/, 8];
1423
1414
  case 7:
1424
1415
  try {
1425
1416
  if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
1426
1417
  }
1427
- finally { if (e_22) throw e_22.error; }
1418
+ finally { if (e_21) throw e_21.error; }
1428
1419
  return [7 /*endfinally*/];
1429
1420
  case 8: return [2 /*return*/];
1430
1421
  }
@@ -1437,7 +1428,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1437
1428
  return this._isNew;
1438
1429
  };
1439
1430
  rowHelperImplementation.prototype.wasChanged = function () {
1440
- var e_23, _a;
1431
+ var e_22, _a;
1441
1432
  var _b;
1442
1433
  (_b = this._subscribers) === null || _b === void 0 ? void 0 : _b.reportObserved();
1443
1434
  try {
@@ -1447,19 +1438,19 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1447
1438
  return true;
1448
1439
  }
1449
1440
  }
1450
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
1441
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
1451
1442
  finally {
1452
1443
  try {
1453
1444
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
1454
1445
  }
1455
- finally { if (e_23) throw e_23.error; }
1446
+ finally { if (e_22) throw e_22.error; }
1456
1447
  }
1457
1448
  return false;
1458
1449
  };
1459
1450
  rowHelperImplementation.prototype.__performColumnAndEntityValidations = function () {
1460
1451
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1461
- var _a, _b, c, col, e_24_1, _c, _d, listener, e_25_1;
1462
- var e_24, _e, e_25, _f;
1452
+ var _a, _b, c, col, e_23_1, _c, _d, listener, e_24_1;
1453
+ var e_23, _e, e_24, _f;
1463
1454
  return tslib_1.__generator(this, function (_g) {
1464
1455
  switch (_g.label) {
1465
1456
  case 0:
@@ -1480,14 +1471,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1480
1471
  return [3 /*break*/, 1];
1481
1472
  case 4: return [3 /*break*/, 7];
1482
1473
  case 5:
1483
- e_24_1 = _g.sent();
1484
- e_24 = { error: e_24_1 };
1474
+ e_23_1 = _g.sent();
1475
+ e_23 = { error: e_23_1 };
1485
1476
  return [3 /*break*/, 7];
1486
1477
  case 6:
1487
1478
  try {
1488
1479
  if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
1489
1480
  }
1490
- finally { if (e_24) throw e_24.error; }
1481
+ finally { if (e_23) throw e_23.error; }
1491
1482
  return [7 /*endfinally*/];
1492
1483
  case 7:
1493
1484
  if (!this.info.entityInfo.validation) return [3 /*break*/, 9];
@@ -1514,14 +1505,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
1514
1505
  return [3 /*break*/, 11];
1515
1506
  case 14: return [3 /*break*/, 17];
1516
1507
  case 15:
1517
- e_25_1 = _g.sent();
1518
- e_25 = { error: e_25_1 };
1508
+ e_24_1 = _g.sent();
1509
+ e_24 = { error: e_24_1 };
1519
1510
  return [3 /*break*/, 17];
1520
1511
  case 16:
1521
1512
  try {
1522
1513
  if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
1523
1514
  }
1524
- finally { if (e_25) throw e_25.error; }
1515
+ finally { if (e_24) throw e_24.error; }
1525
1516
  return [7 /*endfinally*/];
1526
1517
  case 17: return [2 /*return*/];
1527
1518
  }
@@ -1563,13 +1554,14 @@ exports.getControllerRef = getControllerRef;
1563
1554
  var controllerRefImpl = /** @class */ (function (_super) {
1564
1555
  tslib_1.__extends(controllerRefImpl, _super);
1565
1556
  function controllerRefImpl(columnsInfo, instance, remult) {
1566
- var _a, e_26, _b;
1557
+ var _a, e_25, _b;
1567
1558
  var _this = _super.call(this, columnsInfo, instance, remult) || this;
1568
1559
  var _items = [];
1569
1560
  var r = (_a = {
1570
1561
  find: function (c) { return r[typeof c === "string" ? c : c.key]; }
1571
1562
  },
1572
1563
  _a[Symbol.iterator] = function () { return _items[Symbol.iterator](); },
1564
+ _a.toArray = function () { return _items; },
1573
1565
  _a);
1574
1566
  try {
1575
1567
  for (var columnsInfo_2 = tslib_1.__values(columnsInfo), columnsInfo_2_1 = columnsInfo_2.next(); !columnsInfo_2_1.done; columnsInfo_2_1 = columnsInfo_2.next()) {
@@ -1577,20 +1569,20 @@ var controllerRefImpl = /** @class */ (function (_super) {
1577
1569
  _items.push(r[col.key] = new FieldRefImplementation(col, new columnDefsImpl(col, undefined, remult), instance, undefined, _this));
1578
1570
  }
1579
1571
  }
1580
- catch (e_26_1) { e_26 = { error: e_26_1 }; }
1572
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
1581
1573
  finally {
1582
1574
  try {
1583
1575
  if (columnsInfo_2_1 && !columnsInfo_2_1.done && (_b = columnsInfo_2.return)) _b.call(columnsInfo_2);
1584
1576
  }
1585
- finally { if (e_26) throw e_26.error; }
1577
+ finally { if (e_25) throw e_25.error; }
1586
1578
  }
1587
1579
  _this.fields = r;
1588
1580
  return _this;
1589
1581
  }
1590
1582
  controllerRefImpl.prototype.__performColumnAndEntityValidations = function () {
1591
1583
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1592
- var _a, _b, col, e_27_1;
1593
- var e_27, _c;
1584
+ var _a, _b, col, e_26_1;
1585
+ var e_26, _c;
1594
1586
  return tslib_1.__generator(this, function (_d) {
1595
1587
  switch (_d.label) {
1596
1588
  case 0:
@@ -1610,14 +1602,14 @@ var controllerRefImpl = /** @class */ (function (_super) {
1610
1602
  return [3 /*break*/, 1];
1611
1603
  case 4: return [3 /*break*/, 7];
1612
1604
  case 5:
1613
- e_27_1 = _d.sent();
1614
- e_27 = { error: e_27_1 };
1605
+ e_26_1 = _d.sent();
1606
+ e_26 = { error: e_26_1 };
1615
1607
  return [3 /*break*/, 7];
1616
1608
  case 6:
1617
1609
  try {
1618
1610
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1619
1611
  }
1620
- finally { if (e_27) throw e_27.error; }
1612
+ finally { if (e_26) throw e_26.error; }
1621
1613
  return [7 /*endfinally*/];
1622
1614
  case 7: return [2 /*return*/];
1623
1615
  }
@@ -1773,8 +1765,8 @@ var FieldRefImplementation = /** @class */ (function () {
1773
1765
  };
1774
1766
  FieldRefImplementation.prototype.__performValidation = function () {
1775
1767
  return tslib_1.__awaiter(this, void 0, void 0, function () {
1776
- var x, _a, _b, v, e_28_1;
1777
- var e_28, _c;
1768
+ var x, _a, _b, v, e_27_1;
1769
+ var e_27, _c;
1778
1770
  return tslib_1.__generator(this, function (_d) {
1779
1771
  switch (_d.label) {
1780
1772
  case 0:
@@ -1797,14 +1789,14 @@ var FieldRefImplementation = /** @class */ (function () {
1797
1789
  return [3 /*break*/, 2];
1798
1790
  case 5: return [3 /*break*/, 8];
1799
1791
  case 6:
1800
- e_28_1 = _d.sent();
1801
- e_28 = { error: e_28_1 };
1792
+ e_27_1 = _d.sent();
1793
+ e_27 = { error: e_27_1 };
1802
1794
  return [3 /*break*/, 8];
1803
1795
  case 7:
1804
1796
  try {
1805
1797
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
1806
1798
  }
1807
- finally { if (e_28) throw e_28.error; }
1799
+ finally { if (e_27) throw e_27.error; }
1808
1800
  return [7 /*endfinally*/];
1809
1801
  case 8: return [3 /*break*/, 11];
1810
1802
  case 9:
@@ -1931,7 +1923,7 @@ var columnDefsImpl = /** @class */ (function () {
1931
1923
  exports.columnDefsImpl = columnDefsImpl;
1932
1924
  var EntityFullInfo = /** @class */ (function () {
1933
1925
  function EntityFullInfo(columnsInfo, entityInfo, remult, entityType, key) {
1934
- var _a, e_29, _b;
1926
+ var _a, e_28, _b;
1935
1927
  var _this = this;
1936
1928
  this.columnsInfo = columnsInfo;
1937
1929
  this.entityInfo = entityInfo;
@@ -1993,6 +1985,7 @@ var EntityFullInfo = /** @class */ (function () {
1993
1985
  find: function (c) { return r[typeof c === "string" ? c : c.key]; }
1994
1986
  },
1995
1987
  _a[Symbol.iterator] = function () { return _items[Symbol.iterator](); },
1988
+ _a.toArray = function () { return _items; },
1996
1989
  _a);
1997
1990
  try {
1998
1991
  for (var columnsInfo_3 = tslib_1.__values(columnsInfo), columnsInfo_3_1 = columnsInfo_3.next(); !columnsInfo_3_1.done; columnsInfo_3_1 = columnsInfo_3.next()) {
@@ -2000,12 +1993,12 @@ var EntityFullInfo = /** @class */ (function () {
2000
1993
  _items.push(r[x.key] = new columnDefsImpl(x, this, remult));
2001
1994
  }
2002
1995
  }
2003
- catch (e_29_1) { e_29 = { error: e_29_1 }; }
1996
+ catch (e_28_1) { e_28 = { error: e_28_1 }; }
2004
1997
  finally {
2005
1998
  try {
2006
1999
  if (columnsInfo_3_1 && !columnsInfo_3_1.done && (_b = columnsInfo_3.return)) _b.call(columnsInfo_3);
2007
2000
  }
2008
- finally { if (e_29) throw e_29.error; }
2001
+ finally { if (e_28) throw e_28.error; }
2009
2002
  }
2010
2003
  this.fields = r;
2011
2004
  this.dbAutoIncrementId = entityInfo.dbAutoIncrementId;
@@ -2126,7 +2119,7 @@ function ValueListFieldType(type) {
2126
2119
  }], options));
2127
2120
  }
2128
2121
  exports.ValueListFieldType = ValueListFieldType;
2129
- function UUIDField() {
2122
+ function UuidField() {
2130
2123
  var options = [];
2131
2124
  for (var _i = 0; _i < arguments.length; _i++) {
2132
2125
  options[_i] = arguments[_i];
@@ -2136,7 +2129,7 @@ function UUIDField() {
2136
2129
  defaultValue: function () { return uuid_1.v4(); }
2137
2130
  }], options));
2138
2131
  }
2139
- exports.UUIDField = UUIDField;
2132
+ exports.UuidField = UuidField;
2140
2133
  function Field() {
2141
2134
  var options = [];
2142
2135
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -2183,7 +2176,7 @@ function Field() {
2183
2176
  exports.Field = Field;
2184
2177
  var storableMember = Symbol("storableMember");
2185
2178
  function buildOptions(options, remult) {
2186
- var e_30, _a;
2179
+ var e_29, _a;
2187
2180
  var r = {};
2188
2181
  try {
2189
2182
  for (var options_1 = tslib_1.__values(options), options_1_1 = options_1.next(); !options_1_1.done; options_1_1 = options_1.next()) {
@@ -2196,12 +2189,12 @@ function buildOptions(options, remult) {
2196
2189
  }
2197
2190
  }
2198
2191
  }
2199
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
2192
+ catch (e_29_1) { e_29 = { error: e_29_1 }; }
2200
2193
  finally {
2201
2194
  try {
2202
2195
  if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1);
2203
2196
  }
2204
- finally { if (e_30) throw e_30.error; }
2197
+ finally { if (e_29) throw e_29.error; }
2205
2198
  }
2206
2199
  return r;
2207
2200
  }
@@ -2284,7 +2277,7 @@ function Entity(key) {
2284
2277
  }
2285
2278
  }
2286
2279
  var factory = function (remult) {
2287
- var e_31, _a;
2280
+ var e_30, _a;
2288
2281
  var r = {};
2289
2282
  try {
2290
2283
  for (var options_2 = tslib_1.__values(options), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) {
@@ -2297,12 +2290,12 @@ function Entity(key) {
2297
2290
  }
2298
2291
  }
2299
2292
  }
2300
- catch (e_31_1) { e_31 = { error: e_31_1 }; }
2293
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
2301
2294
  finally {
2302
2295
  try {
2303
2296
  if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2);
2304
2297
  }
2305
- finally { if (e_31) throw e_31.error; }
2298
+ finally { if (e_30) throw e_30.error; }
2306
2299
  }
2307
2300
  var base = Object.getPrototypeOf(target);
2308
2301
  if (base) {
@@ -2408,9 +2401,9 @@ var QueryResultImpl = /** @class */ (function () {
2408
2401
  });
2409
2402
  };
2410
2403
  QueryResultImpl.prototype.forEach = function (what) {
2411
- var e_32, _a;
2404
+ var e_31, _a;
2412
2405
  return tslib_1.__awaiter(this, void 0, void 0, function () {
2413
- var i, _b, _c, x, e_32_1;
2406
+ var i, _b, _c, x, e_31_1;
2414
2407
  return tslib_1.__generator(this, function (_d) {
2415
2408
  switch (_d.label) {
2416
2409
  case 0:
@@ -2432,8 +2425,8 @@ var QueryResultImpl = /** @class */ (function () {
2432
2425
  case 5: return [3 /*break*/, 2];
2433
2426
  case 6: return [3 /*break*/, 13];
2434
2427
  case 7:
2435
- e_32_1 = _d.sent();
2436
- e_32 = { error: e_32_1 };
2428
+ e_31_1 = _d.sent();
2429
+ e_31 = { error: e_31_1 };
2437
2430
  return [3 /*break*/, 13];
2438
2431
  case 8:
2439
2432
  _d.trys.push([8, , 11, 12]);
@@ -2444,7 +2437,7 @@ var QueryResultImpl = /** @class */ (function () {
2444
2437
  _d.label = 10;
2445
2438
  case 10: return [3 /*break*/, 12];
2446
2439
  case 11:
2447
- if (e_32) throw e_32.error;
2440
+ if (e_31) throw e_31.error;
2448
2441
  return [7 /*endfinally*/];
2449
2442
  case 12: return [7 /*endfinally*/];
2450
2443
  case 13: return [2 /*return*/, i];