remult 0.13.19 → 0.13.22
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/graphql.js +3 -3
- package/package.json +2 -2
- package/readme.md +32 -19
- package/server/expressBridge.d.ts +4 -4
- package/server/expressBridge.js +2 -0
- package/src/column-interfaces.d.ts +51 -10
- package/src/column.d.ts +0 -1
- package/src/column.js +0 -12
- package/src/context.d.ts +57 -14
- package/src/context.js +103 -75
- package/src/data-providers/rest-data-provider.d.ts +3 -2
- package/src/data-providers/rest-data-provider.js +56 -51
- package/src/data-providers/sql-database.js +2 -6
- package/src/entity.d.ts +31 -28
- package/src/remult3/RepositoryImplementation.d.ts +41 -4
- package/src/remult3/RepositoryImplementation.js +208 -138
- package/src/remult3/remult3.d.ts +100 -34
- package/src/server-action.d.ts +5 -1
- package/src/server-action.js +1 -0
- package/src/shared-tests/db-tests.db-tests.js +52 -1
- package/src/shared-tests/entityWithValidations.js +5 -19
- package/src/tests/TestDataApiResponse.js +6 -6
- package/src/tests/d.d.ts +0 -1
- package/src/tests/d.js +0 -16
- package/src/tests/testHelper.spec.js +2 -2
- package/src/tests/testModel/models.d.ts +0 -1
- package/src/tests/testModel/models.js +0 -3
|
@@ -200,22 +200,50 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
200
200
|
};
|
|
201
201
|
RepositoryImplementation.prototype.insert = function (entity) {
|
|
202
202
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
203
|
-
var ref;
|
|
204
|
-
var
|
|
205
|
-
return tslib_1.__generator(this, function (
|
|
206
|
-
switch (
|
|
203
|
+
var r, entity_1, entity_1_1, item, _a, _b, e_4_1, ref;
|
|
204
|
+
var e_4, _c;
|
|
205
|
+
return tslib_1.__generator(this, function (_d) {
|
|
206
|
+
switch (_d.label) {
|
|
207
207
|
case 0:
|
|
208
|
-
if (!Array.isArray(entity)) return [3 /*break*/,
|
|
209
|
-
|
|
208
|
+
if (!Array.isArray(entity)) return [3 /*break*/, 9];
|
|
209
|
+
r = [];
|
|
210
|
+
_d.label = 1;
|
|
210
211
|
case 1:
|
|
212
|
+
_d.trys.push([1, 6, 7, 8]);
|
|
213
|
+
entity_1 = tslib_1.__values(entity), entity_1_1 = entity_1.next();
|
|
214
|
+
_d.label = 2;
|
|
215
|
+
case 2:
|
|
216
|
+
if (!!entity_1_1.done) return [3 /*break*/, 5];
|
|
217
|
+
item = entity_1_1.value;
|
|
218
|
+
_b = (_a = r).push;
|
|
219
|
+
return [4 /*yield*/, this.insert(item)];
|
|
220
|
+
case 3:
|
|
221
|
+
_b.apply(_a, [_d.sent()]);
|
|
222
|
+
_d.label = 4;
|
|
223
|
+
case 4:
|
|
224
|
+
entity_1_1 = entity_1.next();
|
|
225
|
+
return [3 /*break*/, 2];
|
|
226
|
+
case 5: return [3 /*break*/, 8];
|
|
227
|
+
case 6:
|
|
228
|
+
e_4_1 = _d.sent();
|
|
229
|
+
e_4 = { error: e_4_1 };
|
|
230
|
+
return [3 /*break*/, 8];
|
|
231
|
+
case 7:
|
|
232
|
+
try {
|
|
233
|
+
if (entity_1_1 && !entity_1_1.done && (_c = entity_1.return)) _c.call(entity_1);
|
|
234
|
+
}
|
|
235
|
+
finally { if (e_4) throw e_4.error; }
|
|
236
|
+
return [7 /*endfinally*/];
|
|
237
|
+
case 8: return [2 /*return*/, r];
|
|
238
|
+
case 9:
|
|
211
239
|
ref = getEntityRef(entity, false);
|
|
212
|
-
if (!ref) return [3 /*break*/,
|
|
240
|
+
if (!ref) return [3 /*break*/, 11];
|
|
213
241
|
if (!ref.isNew())
|
|
214
242
|
throw "Item is not new";
|
|
215
243
|
return [4 /*yield*/, ref.save()];
|
|
216
|
-
case
|
|
217
|
-
case
|
|
218
|
-
case
|
|
244
|
+
case 10: return [2 /*return*/, _d.sent()];
|
|
245
|
+
case 11: return [4 /*yield*/, this.getEntityRef(this.create(entity)).save()];
|
|
246
|
+
case 12: return [2 /*return*/, _d.sent()];
|
|
219
247
|
}
|
|
220
248
|
});
|
|
221
249
|
});
|
|
@@ -234,7 +262,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
234
262
|
});
|
|
235
263
|
};
|
|
236
264
|
RepositoryImplementation.prototype.getRefForExistingRow = function (entity, id) {
|
|
237
|
-
var
|
|
265
|
+
var e_5, _a;
|
|
238
266
|
var ref = getEntityRef(entity, false);
|
|
239
267
|
if (!ref) {
|
|
240
268
|
var instance = new this.entity(this.remult);
|
|
@@ -244,12 +272,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
244
272
|
instance[field.key] = entity[field.key];
|
|
245
273
|
}
|
|
246
274
|
}
|
|
247
|
-
catch (
|
|
275
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
248
276
|
finally {
|
|
249
277
|
try {
|
|
250
278
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
251
279
|
}
|
|
252
|
-
finally { if (
|
|
280
|
+
finally { if (e_5) throw e_5.error; }
|
|
253
281
|
}
|
|
254
282
|
var row_1 = new rowHelperImplementation(this._info, instance, this, this.edp, this.remult, false);
|
|
255
283
|
if (id)
|
|
@@ -271,7 +299,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
271
299
|
switch (_a.label) {
|
|
272
300
|
case 0:
|
|
273
301
|
if (!Array.isArray(entity)) return [3 /*break*/, 1];
|
|
274
|
-
return [2 /*return*/, Promise.all(entity.map(function (x) { return _this.
|
|
302
|
+
return [2 /*return*/, Promise.all(entity.map(function (x) { return _this.save(x); }))];
|
|
275
303
|
case 1:
|
|
276
304
|
ref = getEntityRef(entity, false);
|
|
277
305
|
if (!ref) return [3 /*break*/, 3];
|
|
@@ -295,7 +323,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
295
323
|
function loadManyToOne(repo, toLoad) {
|
|
296
324
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
297
325
|
var rows, rows_1, rows_1_1, r;
|
|
298
|
-
var _a,
|
|
326
|
+
var _a, e_8, _b;
|
|
299
327
|
return tslib_1.__generator(this, function (_c) {
|
|
300
328
|
switch (_c.label) {
|
|
301
329
|
case 0: return [4 /*yield*/, repo.find({ where: (_a = repo.metadata.idMetadata).getIdFilter.apply(_a, tslib_1.__spread(toLoad)) })];
|
|
@@ -307,26 +335,25 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
307
335
|
repo.addToCache(r);
|
|
308
336
|
}
|
|
309
337
|
}
|
|
310
|
-
catch (
|
|
338
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
311
339
|
finally {
|
|
312
340
|
try {
|
|
313
341
|
if (rows_1_1 && !rows_1_1.done && (_b = rows_1.return)) _b.call(rows_1);
|
|
314
342
|
}
|
|
315
|
-
finally { if (
|
|
343
|
+
finally { if (e_8) throw e_8.error; }
|
|
316
344
|
}
|
|
317
345
|
return [2 /*return*/];
|
|
318
346
|
}
|
|
319
347
|
});
|
|
320
348
|
});
|
|
321
349
|
}
|
|
322
|
-
var opt, _a, rawRows, loadFields, _b, _c, col, ei, load, repo, toLoad, rawRows_1, rawRows_1_1, r, val,
|
|
323
|
-
var
|
|
350
|
+
var opt, _a, rawRows, loadFields, _b, _c, col, ei, load, repo, toLoad, rawRows_1, rawRows_1_1, r, val, e_6_1, result;
|
|
351
|
+
var e_6, _d, e_7, _e;
|
|
324
352
|
var _this = this;
|
|
325
353
|
return tslib_1.__generator(this, function (_f) {
|
|
326
354
|
switch (_f.label) {
|
|
327
355
|
case 0:
|
|
328
356
|
context_1.Remult.onFind(this._info, options);
|
|
329
|
-
;
|
|
330
357
|
opt = {};
|
|
331
358
|
if (!options)
|
|
332
359
|
options = {};
|
|
@@ -364,7 +391,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
364
391
|
repo = this.remult.repo(col.valueType);
|
|
365
392
|
toLoad = [];
|
|
366
393
|
try {
|
|
367
|
-
for (rawRows_1 = (
|
|
394
|
+
for (rawRows_1 = (e_7 = void 0, tslib_1.__values(rawRows)), rawRows_1_1 = rawRows_1.next(); !rawRows_1_1.done; rawRows_1_1 = rawRows_1.next()) {
|
|
368
395
|
r = rawRows_1_1.value;
|
|
369
396
|
val = r[col.key];
|
|
370
397
|
if (val !== undefined && val !== null && !toLoad.includes(val) && !repo.idCache.has(val)) {
|
|
@@ -372,12 +399,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
372
399
|
}
|
|
373
400
|
}
|
|
374
401
|
}
|
|
375
|
-
catch (
|
|
402
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
376
403
|
finally {
|
|
377
404
|
try {
|
|
378
405
|
if (rawRows_1_1 && !rawRows_1_1.done && (_e = rawRows_1.return)) _e.call(rawRows_1);
|
|
379
406
|
}
|
|
380
|
-
finally { if (
|
|
407
|
+
finally { if (e_7) throw e_7.error; }
|
|
381
408
|
}
|
|
382
409
|
if (!(toLoad.length > 0)) return [3 /*break*/, 6];
|
|
383
410
|
return [4 /*yield*/, loadManyToOne(repo, toLoad)];
|
|
@@ -389,14 +416,14 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
389
416
|
return [3 /*break*/, 4];
|
|
390
417
|
case 7: return [3 /*break*/, 10];
|
|
391
418
|
case 8:
|
|
392
|
-
|
|
393
|
-
|
|
419
|
+
e_6_1 = _f.sent();
|
|
420
|
+
e_6 = { error: e_6_1 };
|
|
394
421
|
return [3 /*break*/, 10];
|
|
395
422
|
case 9:
|
|
396
423
|
try {
|
|
397
424
|
if (_c && !_c.done && (_d = _b.return)) _d.call(_b);
|
|
398
425
|
}
|
|
399
|
-
finally { if (
|
|
426
|
+
finally { if (e_6) throw e_6.error; }
|
|
400
427
|
return [7 /*endfinally*/];
|
|
401
428
|
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) {
|
|
402
429
|
switch (_a.label) {
|
|
@@ -526,7 +553,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
526
553
|
return this.metadata.fields.toArray().filter(function (x) { return keys.includes(x.key); });
|
|
527
554
|
};
|
|
528
555
|
RepositoryImplementation.prototype.create = function (item) {
|
|
529
|
-
var
|
|
556
|
+
var e_9, _a;
|
|
530
557
|
var r = new this.entity(this.remult);
|
|
531
558
|
if (item)
|
|
532
559
|
try {
|
|
@@ -535,12 +562,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
535
562
|
r[field.key] = item[field.key];
|
|
536
563
|
}
|
|
537
564
|
}
|
|
538
|
-
catch (
|
|
565
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
539
566
|
finally {
|
|
540
567
|
try {
|
|
541
568
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
542
569
|
}
|
|
543
|
-
finally { if (
|
|
570
|
+
finally { if (e_9) throw e_9.error; }
|
|
544
571
|
}
|
|
545
572
|
var z = this.getEntityRef(r);
|
|
546
573
|
return r;
|
|
@@ -548,7 +575,7 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
548
575
|
RepositoryImplementation.prototype.fromJson = function (json, newRow) {
|
|
549
576
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
550
577
|
var obj, _a, _b, col, r, helper;
|
|
551
|
-
var
|
|
578
|
+
var e_10, _c;
|
|
552
579
|
return tslib_1.__generator(this, function (_d) {
|
|
553
580
|
switch (_d.label) {
|
|
554
581
|
case 0:
|
|
@@ -561,12 +588,12 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
561
588
|
}
|
|
562
589
|
}
|
|
563
590
|
}
|
|
564
|
-
catch (
|
|
591
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
565
592
|
finally {
|
|
566
593
|
try {
|
|
567
594
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
568
595
|
}
|
|
569
|
-
finally { if (
|
|
596
|
+
finally { if (e_10) throw e_10.error; }
|
|
570
597
|
}
|
|
571
598
|
if (!newRow) return [3 /*break*/, 2];
|
|
572
599
|
r = this.create();
|
|
@@ -623,23 +650,24 @@ var RepositoryImplementation = /** @class */ (function () {
|
|
|
623
650
|
exports.RepositoryImplementation = RepositoryImplementation;
|
|
624
651
|
function __updateEntityBasedOnWhere(entityDefs, where, r) {
|
|
625
652
|
var w = filter_interfaces_1.Filter.fromEntityFilter(entityDefs, where);
|
|
653
|
+
var emptyFunction = function () { };
|
|
626
654
|
if (w) {
|
|
627
655
|
w.__applyToConsumer({
|
|
628
|
-
custom:
|
|
629
|
-
databaseCustom:
|
|
630
|
-
containsCaseInsensitive:
|
|
631
|
-
isDifferentFrom:
|
|
656
|
+
custom: emptyFunction,
|
|
657
|
+
databaseCustom: emptyFunction,
|
|
658
|
+
containsCaseInsensitive: emptyFunction,
|
|
659
|
+
isDifferentFrom: emptyFunction,
|
|
632
660
|
isEqualTo: function (col, val) {
|
|
633
661
|
r[col.key] = val;
|
|
634
662
|
},
|
|
635
|
-
isGreaterOrEqualTo:
|
|
636
|
-
isGreaterThan:
|
|
637
|
-
isIn:
|
|
638
|
-
isLessOrEqualTo:
|
|
639
|
-
isLessThan:
|
|
640
|
-
isNotNull:
|
|
641
|
-
isNull:
|
|
642
|
-
or:
|
|
663
|
+
isGreaterOrEqualTo: emptyFunction,
|
|
664
|
+
isGreaterThan: emptyFunction,
|
|
665
|
+
isIn: emptyFunction,
|
|
666
|
+
isLessOrEqualTo: emptyFunction,
|
|
667
|
+
isLessThan: emptyFunction,
|
|
668
|
+
isNotNull: emptyFunction,
|
|
669
|
+
isNull: emptyFunction,
|
|
670
|
+
or: emptyFunction
|
|
643
671
|
});
|
|
644
672
|
}
|
|
645
673
|
}
|
|
@@ -675,7 +703,7 @@ function createOldEntity(entity, remult) {
|
|
|
675
703
|
var key = getEntityKey(entity);
|
|
676
704
|
var base = Object.getPrototypeOf(entity);
|
|
677
705
|
var _loop_1 = function () {
|
|
678
|
-
var
|
|
706
|
+
var e_11, _a;
|
|
679
707
|
var baseCols = exports.columnsOfType.get(base);
|
|
680
708
|
if (baseCols) {
|
|
681
709
|
r.unshift.apply(r, tslib_1.__spread(baseCols.filter(function (x) { return !r.find(function (y) { return y.key == x.key; }); })));
|
|
@@ -704,17 +732,17 @@ function createOldEntity(entity, remult) {
|
|
|
704
732
|
}
|
|
705
733
|
};
|
|
706
734
|
try {
|
|
707
|
-
for (var _b = (
|
|
735
|
+
for (var _b = (e_11 = void 0, tslib_1.__values(functions)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
708
736
|
var key_1 = _c.value;
|
|
709
737
|
_loop_2(key_1);
|
|
710
738
|
}
|
|
711
739
|
}
|
|
712
|
-
catch (
|
|
740
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
713
741
|
finally {
|
|
714
742
|
try {
|
|
715
743
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
716
744
|
}
|
|
717
|
-
finally { if (
|
|
745
|
+
finally { if (e_11) throw e_11.error; }
|
|
718
746
|
}
|
|
719
747
|
}
|
|
720
748
|
base = Object.getPrototypeOf(base);
|
|
@@ -727,7 +755,7 @@ function createOldEntity(entity, remult) {
|
|
|
727
755
|
exports.createOldEntity = createOldEntity;
|
|
728
756
|
var rowHelperBase = /** @class */ (function () {
|
|
729
757
|
function rowHelperBase(columnsInfo, instance, remult) {
|
|
730
|
-
var
|
|
758
|
+
var e_12, _a;
|
|
731
759
|
var _this = this;
|
|
732
760
|
this.columnsInfo = columnsInfo;
|
|
733
761
|
this.instance = instance;
|
|
@@ -782,12 +810,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
782
810
|
_loop_3(col);
|
|
783
811
|
}
|
|
784
812
|
}
|
|
785
|
-
catch (
|
|
813
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
786
814
|
finally {
|
|
787
815
|
try {
|
|
788
816
|
if (columnsInfo_1_1 && !columnsInfo_1_1.done && (_a = columnsInfo_1.return)) _a.call(columnsInfo_1);
|
|
789
817
|
}
|
|
790
|
-
finally { if (
|
|
818
|
+
finally { if (e_12) throw e_12.error; }
|
|
791
819
|
}
|
|
792
820
|
}
|
|
793
821
|
Object.defineProperty(rowHelperBase.prototype, "error", {
|
|
@@ -809,7 +837,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
809
837
|
return this._subscribers.subscribe(listener);
|
|
810
838
|
};
|
|
811
839
|
rowHelperBase.prototype.initSubscribers = function () {
|
|
812
|
-
var
|
|
840
|
+
var e_13, _a;
|
|
813
841
|
var _this = this;
|
|
814
842
|
if (!this._subscribers) {
|
|
815
843
|
this._subscribers = new SubscribableImp();
|
|
@@ -844,12 +872,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
844
872
|
_loop_4(col);
|
|
845
873
|
}
|
|
846
874
|
}
|
|
847
|
-
catch (
|
|
875
|
+
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
848
876
|
finally {
|
|
849
877
|
try {
|
|
850
878
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
851
879
|
}
|
|
852
|
-
finally { if (
|
|
880
|
+
finally { if (e_13) throw e_13.error; }
|
|
853
881
|
}
|
|
854
882
|
}
|
|
855
883
|
};
|
|
@@ -880,7 +908,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
880
908
|
});
|
|
881
909
|
};
|
|
882
910
|
rowHelperBase.prototype.__assertValidity = function () {
|
|
883
|
-
var
|
|
911
|
+
var e_14, _a;
|
|
884
912
|
if (!this.hasErrors()) {
|
|
885
913
|
var error = {
|
|
886
914
|
modelState: Object.assign({}, this.errors),
|
|
@@ -897,12 +925,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
897
925
|
}
|
|
898
926
|
}
|
|
899
927
|
}
|
|
900
|
-
catch (
|
|
928
|
+
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
901
929
|
finally {
|
|
902
930
|
try {
|
|
903
931
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
904
932
|
}
|
|
905
|
-
finally { if (
|
|
933
|
+
finally { if (e_14) throw e_14.error; }
|
|
906
934
|
}
|
|
907
935
|
}
|
|
908
936
|
throw error;
|
|
@@ -937,7 +965,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
937
965
|
this._reportChangedToEntityAndFields();
|
|
938
966
|
};
|
|
939
967
|
rowHelperBase.prototype._reportChangedToEntityAndFields = function () {
|
|
940
|
-
var
|
|
968
|
+
var e_15, _a;
|
|
941
969
|
if (this._subscribers) {
|
|
942
970
|
this._subscribers.reportChanged();
|
|
943
971
|
try {
|
|
@@ -947,12 +975,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
947
975
|
ref._subscribers.reportChanged();
|
|
948
976
|
}
|
|
949
977
|
}
|
|
950
|
-
catch (
|
|
978
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
951
979
|
finally {
|
|
952
980
|
try {
|
|
953
981
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
954
982
|
}
|
|
955
|
-
finally { if (
|
|
983
|
+
finally { if (e_15) throw e_15.error; }
|
|
956
984
|
}
|
|
957
985
|
}
|
|
958
986
|
};
|
|
@@ -962,7 +990,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
962
990
|
return !!!this.error && this.errors == undefined;
|
|
963
991
|
};
|
|
964
992
|
rowHelperBase.prototype.copyDataToObject = function () {
|
|
965
|
-
var
|
|
993
|
+
var e_16, _a;
|
|
966
994
|
var d = {};
|
|
967
995
|
try {
|
|
968
996
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -981,12 +1009,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
981
1009
|
d[col.key] = val;
|
|
982
1010
|
}
|
|
983
1011
|
}
|
|
984
|
-
catch (
|
|
1012
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
985
1013
|
finally {
|
|
986
1014
|
try {
|
|
987
1015
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
988
1016
|
}
|
|
989
|
-
finally { if (
|
|
1017
|
+
finally { if (e_16) throw e_16.error; }
|
|
990
1018
|
}
|
|
991
1019
|
return d;
|
|
992
1020
|
};
|
|
@@ -1042,7 +1070,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
1042
1070
|
});
|
|
1043
1071
|
};
|
|
1044
1072
|
rowHelperBase.prototype.toApiJson = function () {
|
|
1045
|
-
var
|
|
1073
|
+
var e_17, _a;
|
|
1046
1074
|
var result = {};
|
|
1047
1075
|
try {
|
|
1048
1076
|
for (var _b = tslib_1.__values(this.columnsInfo), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
@@ -1067,19 +1095,19 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
1067
1095
|
}
|
|
1068
1096
|
}
|
|
1069
1097
|
}
|
|
1070
|
-
catch (
|
|
1098
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
1071
1099
|
finally {
|
|
1072
1100
|
try {
|
|
1073
1101
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1074
1102
|
}
|
|
1075
|
-
finally { if (
|
|
1103
|
+
finally { if (e_17) throw e_17.error; }
|
|
1076
1104
|
}
|
|
1077
1105
|
return result;
|
|
1078
1106
|
};
|
|
1079
1107
|
rowHelperBase.prototype._updateEntityBasedOnApi = function (body) {
|
|
1080
1108
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1081
1109
|
var keys, _a, _b, col, lu;
|
|
1082
|
-
var
|
|
1110
|
+
var e_18, _c;
|
|
1083
1111
|
return tslib_1.__generator(this, function (_d) {
|
|
1084
1112
|
switch (_d.label) {
|
|
1085
1113
|
case 0:
|
|
@@ -1099,12 +1127,12 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
1099
1127
|
}
|
|
1100
1128
|
}
|
|
1101
1129
|
}
|
|
1102
|
-
catch (
|
|
1130
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
1103
1131
|
finally {
|
|
1104
1132
|
try {
|
|
1105
1133
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1106
1134
|
}
|
|
1107
|
-
finally { if (
|
|
1135
|
+
finally { if (e_18) throw e_18.error; }
|
|
1108
1136
|
}
|
|
1109
1137
|
return [4 /*yield*/, Promise.all(tslib_1.__spread(this.fields).map(function (x) { return x.load(); }))];
|
|
1110
1138
|
case 1:
|
|
@@ -1119,7 +1147,7 @@ var rowHelperBase = /** @class */ (function () {
|
|
|
1119
1147
|
var rowHelperImplementation = /** @class */ (function (_super) {
|
|
1120
1148
|
tslib_1.__extends(rowHelperImplementation, _super);
|
|
1121
1149
|
function rowHelperImplementation(info, instance, repository, edp, remult, _isNew) {
|
|
1122
|
-
var
|
|
1150
|
+
var e_19, _a;
|
|
1123
1151
|
var _this = _super.call(this, info.columnsInfo, instance, remult) || this;
|
|
1124
1152
|
_this.info = info;
|
|
1125
1153
|
_this.repository = repository;
|
|
@@ -1141,12 +1169,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1141
1169
|
}
|
|
1142
1170
|
}
|
|
1143
1171
|
}
|
|
1144
|
-
catch (
|
|
1172
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
1145
1173
|
finally {
|
|
1146
1174
|
try {
|
|
1147
1175
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
1148
1176
|
}
|
|
1149
|
-
finally { if (
|
|
1177
|
+
finally { if (e_19) throw e_19.error; }
|
|
1150
1178
|
}
|
|
1151
1179
|
}
|
|
1152
1180
|
if (_this.info.options.entityRefInit)
|
|
@@ -1211,7 +1239,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1211
1239
|
};
|
|
1212
1240
|
Object.defineProperty(rowHelperImplementation.prototype, "fields", {
|
|
1213
1241
|
get: function () {
|
|
1214
|
-
var _a,
|
|
1242
|
+
var _a, e_20, _b;
|
|
1215
1243
|
if (!this._columns) {
|
|
1216
1244
|
var _items_1 = [];
|
|
1217
1245
|
var r_1 = (_a = {
|
|
@@ -1226,12 +1254,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1226
1254
|
_items_1.push(r_1[c.key] = new FieldRefImplementation(c, this.info.fields[c.key], this.instance, this, this));
|
|
1227
1255
|
}
|
|
1228
1256
|
}
|
|
1229
|
-
catch (
|
|
1257
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
1230
1258
|
finally {
|
|
1231
1259
|
try {
|
|
1232
1260
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
1233
1261
|
}
|
|
1234
|
-
finally { if (
|
|
1262
|
+
finally { if (e_20) throw e_20.error; }
|
|
1235
1263
|
}
|
|
1236
1264
|
this._columns = r_1;
|
|
1237
1265
|
}
|
|
@@ -1243,8 +1271,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1243
1271
|
rowHelperImplementation.prototype.save = function () {
|
|
1244
1272
|
var _a;
|
|
1245
1273
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1246
|
-
var doNotSave_1, _b, _c, col,
|
|
1247
|
-
var
|
|
1274
|
+
var doNotSave_1, _b, _c, col, e_21_1, d, ignoreKeys, _d, _e, field, f, updatedRow, changesOnly, wasChanged, key, element, err_1;
|
|
1275
|
+
var e_21, _f, e_22, _g;
|
|
1248
1276
|
return tslib_1.__generator(this, function (_h) {
|
|
1249
1277
|
switch (_h.label) {
|
|
1250
1278
|
case 0:
|
|
@@ -1277,14 +1305,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1277
1305
|
return [3 /*break*/, 3];
|
|
1278
1306
|
case 6: return [3 /*break*/, 9];
|
|
1279
1307
|
case 7:
|
|
1280
|
-
|
|
1281
|
-
|
|
1308
|
+
e_21_1 = _h.sent();
|
|
1309
|
+
e_21 = { error: e_21_1 };
|
|
1282
1310
|
return [3 /*break*/, 9];
|
|
1283
1311
|
case 8:
|
|
1284
1312
|
try {
|
|
1285
1313
|
if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
|
|
1286
1314
|
}
|
|
1287
|
-
finally { if (
|
|
1315
|
+
finally { if (e_21) throw e_21.error; }
|
|
1288
1316
|
return [7 /*endfinally*/];
|
|
1289
1317
|
case 9:
|
|
1290
1318
|
if (!this.info.entityInfo.saving) return [3 /*break*/, 11];
|
|
@@ -1307,12 +1335,12 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1307
1335
|
}
|
|
1308
1336
|
}
|
|
1309
1337
|
}
|
|
1310
|
-
catch (
|
|
1338
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
1311
1339
|
finally {
|
|
1312
1340
|
try {
|
|
1313
1341
|
if (_e && !_e.done && (_g = _d.return)) _g.call(_d);
|
|
1314
1342
|
}
|
|
1315
|
-
finally { if (
|
|
1343
|
+
finally { if (e_22) throw e_22.error; }
|
|
1316
1344
|
}
|
|
1317
1345
|
if (this.info.idMetadata.field instanceof column_1.CompoundIdField)
|
|
1318
1346
|
delete (d.id);
|
|
@@ -1383,8 +1411,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1383
1411
|
};
|
|
1384
1412
|
rowHelperImplementation.prototype.delete = function () {
|
|
1385
1413
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1386
|
-
var _a, _b, listener,
|
|
1387
|
-
var
|
|
1414
|
+
var _a, _b, listener, e_23_1, err_2;
|
|
1415
|
+
var e_23, _c;
|
|
1388
1416
|
return tslib_1.__generator(this, function (_d) {
|
|
1389
1417
|
switch (_d.label) {
|
|
1390
1418
|
case 0:
|
|
@@ -1426,14 +1454,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1426
1454
|
return [3 /*break*/, 8];
|
|
1427
1455
|
case 11: return [3 /*break*/, 14];
|
|
1428
1456
|
case 12:
|
|
1429
|
-
|
|
1430
|
-
|
|
1457
|
+
e_23_1 = _d.sent();
|
|
1458
|
+
e_23 = { error: e_23_1 };
|
|
1431
1459
|
return [3 /*break*/, 14];
|
|
1432
1460
|
case 13:
|
|
1433
1461
|
try {
|
|
1434
1462
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1435
1463
|
}
|
|
1436
|
-
finally { if (
|
|
1464
|
+
finally { if (e_23) throw e_23.error; }
|
|
1437
1465
|
return [7 /*endfinally*/];
|
|
1438
1466
|
case 14:
|
|
1439
1467
|
this._wasDeleted = true;
|
|
@@ -1451,8 +1479,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1451
1479
|
};
|
|
1452
1480
|
rowHelperImplementation.prototype.loadDataFrom = function (data, loadItems) {
|
|
1453
1481
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1454
|
-
var _a, _b, col, lu,
|
|
1455
|
-
var
|
|
1482
|
+
var _a, _b, col, lu, e_24_1;
|
|
1483
|
+
var e_24, _c;
|
|
1456
1484
|
return tslib_1.__generator(this, function (_d) {
|
|
1457
1485
|
switch (_d.label) {
|
|
1458
1486
|
case 0:
|
|
@@ -1487,14 +1515,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1487
1515
|
return [3 /*break*/, 1];
|
|
1488
1516
|
case 9: return [3 /*break*/, 12];
|
|
1489
1517
|
case 10:
|
|
1490
|
-
|
|
1491
|
-
|
|
1518
|
+
e_24_1 = _d.sent();
|
|
1519
|
+
e_24 = { error: e_24_1 };
|
|
1492
1520
|
return [3 /*break*/, 12];
|
|
1493
1521
|
case 11:
|
|
1494
1522
|
try {
|
|
1495
1523
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1496
1524
|
}
|
|
1497
|
-
finally { if (
|
|
1525
|
+
finally { if (e_24) throw e_24.error; }
|
|
1498
1526
|
return [7 /*endfinally*/];
|
|
1499
1527
|
case 12: return [4 /*yield*/, this.calcServerExpression()];
|
|
1500
1528
|
case 13:
|
|
@@ -1514,8 +1542,8 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1514
1542
|
};
|
|
1515
1543
|
rowHelperImplementation.prototype.calcServerExpression = function () {
|
|
1516
1544
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1517
|
-
var _a, _b, col, _c, _d,
|
|
1518
|
-
var
|
|
1545
|
+
var _a, _b, col, _c, _d, e_25_1;
|
|
1546
|
+
var e_25, _e;
|
|
1519
1547
|
return tslib_1.__generator(this, function (_f) {
|
|
1520
1548
|
switch (_f.label) {
|
|
1521
1549
|
case 0:
|
|
@@ -1540,14 +1568,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1540
1568
|
return [3 /*break*/, 2];
|
|
1541
1569
|
case 5: return [3 /*break*/, 8];
|
|
1542
1570
|
case 6:
|
|
1543
|
-
|
|
1544
|
-
|
|
1571
|
+
e_25_1 = _f.sent();
|
|
1572
|
+
e_25 = { error: e_25_1 };
|
|
1545
1573
|
return [3 /*break*/, 8];
|
|
1546
1574
|
case 7:
|
|
1547
1575
|
try {
|
|
1548
1576
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1549
1577
|
}
|
|
1550
|
-
finally { if (
|
|
1578
|
+
finally { if (e_25) throw e_25.error; }
|
|
1551
1579
|
return [7 /*endfinally*/];
|
|
1552
1580
|
case 8: return [2 /*return*/];
|
|
1553
1581
|
}
|
|
@@ -1560,7 +1588,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1560
1588
|
return this._isNew;
|
|
1561
1589
|
};
|
|
1562
1590
|
rowHelperImplementation.prototype.wasChanged = function () {
|
|
1563
|
-
var
|
|
1591
|
+
var e_26, _a;
|
|
1564
1592
|
var _b;
|
|
1565
1593
|
(_b = this._subscribers) === null || _b === void 0 ? void 0 : _b.reportObserved();
|
|
1566
1594
|
try {
|
|
@@ -1570,19 +1598,19 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1570
1598
|
return true;
|
|
1571
1599
|
}
|
|
1572
1600
|
}
|
|
1573
|
-
catch (
|
|
1601
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
1574
1602
|
finally {
|
|
1575
1603
|
try {
|
|
1576
1604
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
1577
1605
|
}
|
|
1578
|
-
finally { if (
|
|
1606
|
+
finally { if (e_26) throw e_26.error; }
|
|
1579
1607
|
}
|
|
1580
1608
|
return false;
|
|
1581
1609
|
};
|
|
1582
1610
|
rowHelperImplementation.prototype.__performColumnAndEntityValidations = function () {
|
|
1583
1611
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1584
|
-
var _a, _b, c, col,
|
|
1585
|
-
var
|
|
1612
|
+
var _a, _b, c, col, e_27_1, _c, _d, listener, e_28_1;
|
|
1613
|
+
var e_27, _e, e_28, _f;
|
|
1586
1614
|
return tslib_1.__generator(this, function (_g) {
|
|
1587
1615
|
switch (_g.label) {
|
|
1588
1616
|
case 0:
|
|
@@ -1603,14 +1631,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1603
1631
|
return [3 /*break*/, 1];
|
|
1604
1632
|
case 4: return [3 /*break*/, 7];
|
|
1605
1633
|
case 5:
|
|
1606
|
-
|
|
1607
|
-
|
|
1634
|
+
e_27_1 = _g.sent();
|
|
1635
|
+
e_27 = { error: e_27_1 };
|
|
1608
1636
|
return [3 /*break*/, 7];
|
|
1609
1637
|
case 6:
|
|
1610
1638
|
try {
|
|
1611
1639
|
if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
|
|
1612
1640
|
}
|
|
1613
|
-
finally { if (
|
|
1641
|
+
finally { if (e_27) throw e_27.error; }
|
|
1614
1642
|
return [7 /*endfinally*/];
|
|
1615
1643
|
case 7:
|
|
1616
1644
|
if (!this.info.entityInfo.validation) return [3 /*break*/, 9];
|
|
@@ -1637,14 +1665,14 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
1637
1665
|
return [3 /*break*/, 11];
|
|
1638
1666
|
case 14: return [3 /*break*/, 17];
|
|
1639
1667
|
case 15:
|
|
1640
|
-
|
|
1641
|
-
|
|
1668
|
+
e_28_1 = _g.sent();
|
|
1669
|
+
e_28 = { error: e_28_1 };
|
|
1642
1670
|
return [3 /*break*/, 17];
|
|
1643
1671
|
case 16:
|
|
1644
1672
|
try {
|
|
1645
1673
|
if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
|
|
1646
1674
|
}
|
|
1647
|
-
finally { if (
|
|
1675
|
+
finally { if (e_28) throw e_28.error; }
|
|
1648
1676
|
return [7 /*endfinally*/];
|
|
1649
1677
|
case 17: return [2 /*return*/];
|
|
1650
1678
|
}
|
|
@@ -1686,7 +1714,7 @@ exports.getControllerRef = getControllerRef;
|
|
|
1686
1714
|
var controllerRefImpl = /** @class */ (function (_super) {
|
|
1687
1715
|
tslib_1.__extends(controllerRefImpl, _super);
|
|
1688
1716
|
function controllerRefImpl(columnsInfo, instance, remult) {
|
|
1689
|
-
var _a,
|
|
1717
|
+
var _a, e_29, _b;
|
|
1690
1718
|
var _this = _super.call(this, columnsInfo, instance, remult) || this;
|
|
1691
1719
|
var _items = [];
|
|
1692
1720
|
var r = (_a = {
|
|
@@ -1701,20 +1729,20 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1701
1729
|
_items.push(r[col.key] = new FieldRefImplementation(col, new columnDefsImpl(col, undefined, remult), instance, undefined, _this));
|
|
1702
1730
|
}
|
|
1703
1731
|
}
|
|
1704
|
-
catch (
|
|
1732
|
+
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
1705
1733
|
finally {
|
|
1706
1734
|
try {
|
|
1707
1735
|
if (columnsInfo_2_1 && !columnsInfo_2_1.done && (_b = columnsInfo_2.return)) _b.call(columnsInfo_2);
|
|
1708
1736
|
}
|
|
1709
|
-
finally { if (
|
|
1737
|
+
finally { if (e_29) throw e_29.error; }
|
|
1710
1738
|
}
|
|
1711
1739
|
_this.fields = r;
|
|
1712
1740
|
return _this;
|
|
1713
1741
|
}
|
|
1714
1742
|
controllerRefImpl.prototype.__performColumnAndEntityValidations = function () {
|
|
1715
1743
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1716
|
-
var _a, _b, col,
|
|
1717
|
-
var
|
|
1744
|
+
var _a, _b, col, e_30_1;
|
|
1745
|
+
var e_30, _c;
|
|
1718
1746
|
return tslib_1.__generator(this, function (_d) {
|
|
1719
1747
|
switch (_d.label) {
|
|
1720
1748
|
case 0:
|
|
@@ -1734,14 +1762,14 @@ var controllerRefImpl = /** @class */ (function (_super) {
|
|
|
1734
1762
|
return [3 /*break*/, 1];
|
|
1735
1763
|
case 4: return [3 /*break*/, 7];
|
|
1736
1764
|
case 5:
|
|
1737
|
-
|
|
1738
|
-
|
|
1765
|
+
e_30_1 = _d.sent();
|
|
1766
|
+
e_30 = { error: e_30_1 };
|
|
1739
1767
|
return [3 /*break*/, 7];
|
|
1740
1768
|
case 6:
|
|
1741
1769
|
try {
|
|
1742
1770
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1743
1771
|
}
|
|
1744
|
-
finally { if (
|
|
1772
|
+
finally { if (e_30) throw e_30.error; }
|
|
1745
1773
|
return [7 /*endfinally*/];
|
|
1746
1774
|
case 7: return [2 /*return*/];
|
|
1747
1775
|
}
|
|
@@ -1869,6 +1897,12 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1869
1897
|
FieldRefImplementation.prototype.setId = function (id) {
|
|
1870
1898
|
this.value = id;
|
|
1871
1899
|
};
|
|
1900
|
+
FieldRefImplementation.prototype.getId = function () {
|
|
1901
|
+
var lu = this.rowBase.lookups.get(this.metadata.key);
|
|
1902
|
+
if (lu)
|
|
1903
|
+
return lu.id != undefined ? lu.id : null;
|
|
1904
|
+
return this.value;
|
|
1905
|
+
};
|
|
1872
1906
|
Object.defineProperty(FieldRefImplementation.prototype, "inputValue", {
|
|
1873
1907
|
get: function () {
|
|
1874
1908
|
this.reportObserved();
|
|
@@ -1900,8 +1934,8 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1900
1934
|
};
|
|
1901
1935
|
FieldRefImplementation.prototype.__performValidation = function () {
|
|
1902
1936
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
1903
|
-
var x, _a, _b, v,
|
|
1904
|
-
var
|
|
1937
|
+
var x, _a, _b, v, e_31_1, error_1;
|
|
1938
|
+
var e_31, _c;
|
|
1905
1939
|
return tslib_1.__generator(this, function (_d) {
|
|
1906
1940
|
switch (_d.label) {
|
|
1907
1941
|
case 0:
|
|
@@ -1925,14 +1959,14 @@ var FieldRefImplementation = /** @class */ (function () {
|
|
|
1925
1959
|
return [3 /*break*/, 2];
|
|
1926
1960
|
case 5: return [3 /*break*/, 8];
|
|
1927
1961
|
case 6:
|
|
1928
|
-
|
|
1929
|
-
|
|
1962
|
+
e_31_1 = _d.sent();
|
|
1963
|
+
e_31 = { error: e_31_1 };
|
|
1930
1964
|
return [3 /*break*/, 8];
|
|
1931
1965
|
case 7:
|
|
1932
1966
|
try {
|
|
1933
1967
|
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
|
|
1934
1968
|
}
|
|
1935
|
-
finally { if (
|
|
1969
|
+
finally { if (e_31) throw e_31.error; }
|
|
1936
1970
|
return [7 /*endfinally*/];
|
|
1937
1971
|
case 8: return [3 /*break*/, 11];
|
|
1938
1972
|
case 9:
|
|
@@ -2067,7 +2101,7 @@ var columnDefsImpl = /** @class */ (function () {
|
|
|
2067
2101
|
exports.columnDefsImpl = columnDefsImpl;
|
|
2068
2102
|
var EntityFullInfo = /** @class */ (function () {
|
|
2069
2103
|
function EntityFullInfo(columnsInfo, entityInfo, remult, entityType, key) {
|
|
2070
|
-
var _a,
|
|
2104
|
+
var _a, e_32, _b;
|
|
2071
2105
|
var _this = this;
|
|
2072
2106
|
this.columnsInfo = columnsInfo;
|
|
2073
2107
|
this.entityInfo = entityInfo;
|
|
@@ -2137,12 +2171,12 @@ var EntityFullInfo = /** @class */ (function () {
|
|
|
2137
2171
|
_items.push(r[x.key] = new columnDefsImpl(x, this, remult));
|
|
2138
2172
|
}
|
|
2139
2173
|
}
|
|
2140
|
-
catch (
|
|
2174
|
+
catch (e_32_1) { e_32 = { error: e_32_1 }; }
|
|
2141
2175
|
finally {
|
|
2142
2176
|
try {
|
|
2143
2177
|
if (columnsInfo_3_1 && !columnsInfo_3_1.done && (_b = columnsInfo_3.return)) _b.call(columnsInfo_3);
|
|
2144
2178
|
}
|
|
2145
|
-
finally { if (
|
|
2179
|
+
finally { if (e_32) throw e_32.error; }
|
|
2146
2180
|
}
|
|
2147
2181
|
this.fields = r;
|
|
2148
2182
|
this.caption = buildCaption(entityInfo.caption, this.key, remult);
|
|
@@ -2316,7 +2350,7 @@ function ValueListFieldType() {
|
|
|
2316
2350
|
exports.ValueListFieldType = ValueListFieldType;
|
|
2317
2351
|
var ValueListInfo = /** @class */ (function () {
|
|
2318
2352
|
function ValueListInfo(valueListType) {
|
|
2319
|
-
var
|
|
2353
|
+
var e_33, _a, _b;
|
|
2320
2354
|
var _this = this;
|
|
2321
2355
|
this.valueListType = valueListType;
|
|
2322
2356
|
this.byIdMap = new Map();
|
|
@@ -2354,12 +2388,12 @@ var ValueListInfo = /** @class */ (function () {
|
|
|
2354
2388
|
}
|
|
2355
2389
|
}
|
|
2356
2390
|
}
|
|
2357
|
-
catch (
|
|
2391
|
+
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
2358
2392
|
finally {
|
|
2359
2393
|
try {
|
|
2360
2394
|
if (options_1_1 && !options_1_1.done && (_a = options_1.return)) _a.call(options_1);
|
|
2361
2395
|
}
|
|
2362
|
-
finally { if (
|
|
2396
|
+
finally { if (e_33) throw e_33.error; }
|
|
2363
2397
|
}
|
|
2364
2398
|
if (this.values.find(function (s) { return s.id === undefined; }))
|
|
2365
2399
|
throw new Error("ValueType " + this.valueListType + " has values without an id");
|
|
@@ -2427,6 +2461,19 @@ function getValueList(type) {
|
|
|
2427
2461
|
return ValueListInfo.get(type).getValues();
|
|
2428
2462
|
}
|
|
2429
2463
|
exports.getValueList = getValueList;
|
|
2464
|
+
/**Decorates fields that should be used as fields.
|
|
2465
|
+
* for more info see: [Field Types](https://remult.dev/docs/field-types.html)
|
|
2466
|
+
*
|
|
2467
|
+
* FieldOptions can be set in two ways:
|
|
2468
|
+
* @example
|
|
2469
|
+
* // as an object
|
|
2470
|
+
* .@Fields.string({ includeInApi:false })
|
|
2471
|
+
* title='';
|
|
2472
|
+
* @example
|
|
2473
|
+
* // as an arrow function that receives `remult` as a parameter
|
|
2474
|
+
* .@Fields.string((options,remult) => options.includeInApi = true)
|
|
2475
|
+
* title='';
|
|
2476
|
+
*/
|
|
2430
2477
|
function Field(valueType) {
|
|
2431
2478
|
var options = [];
|
|
2432
2479
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -2476,7 +2523,7 @@ function Field(valueType) {
|
|
|
2476
2523
|
exports.Field = Field;
|
|
2477
2524
|
exports.storableMember = Symbol("storableMember");
|
|
2478
2525
|
function buildOptions(options, remult) {
|
|
2479
|
-
var
|
|
2526
|
+
var e_34, _a;
|
|
2480
2527
|
var r = {};
|
|
2481
2528
|
try {
|
|
2482
2529
|
for (var options_2 = tslib_1.__values(options), options_2_1 = options_2.next(); !options_2_1.done; options_2_1 = options_2.next()) {
|
|
@@ -2489,12 +2536,12 @@ function buildOptions(options, remult) {
|
|
|
2489
2536
|
}
|
|
2490
2537
|
}
|
|
2491
2538
|
}
|
|
2492
|
-
catch (
|
|
2539
|
+
catch (e_34_1) { e_34 = { error: e_34_1 }; }
|
|
2493
2540
|
finally {
|
|
2494
2541
|
try {
|
|
2495
2542
|
if (options_2_1 && !options_2_1.done && (_a = options_2.return)) _a.call(options_2);
|
|
2496
2543
|
}
|
|
2497
|
-
finally { if (
|
|
2544
|
+
finally { if (e_34) throw e_34.error; }
|
|
2498
2545
|
}
|
|
2499
2546
|
return r;
|
|
2500
2547
|
}
|
|
@@ -2575,6 +2622,29 @@ function BuildEntity(c, key, fields) {
|
|
|
2575
2622
|
}
|
|
2576
2623
|
}
|
|
2577
2624
|
exports.BuildEntity = BuildEntity;
|
|
2625
|
+
/**Decorates classes that should be used as entities.
|
|
2626
|
+
* Receives a key and an array of EntityOptions.
|
|
2627
|
+
* @example
|
|
2628
|
+
* import { Entity, Fields } from "remult";
|
|
2629
|
+
* @Entity("tasks", {
|
|
2630
|
+
* allowApiCrud: true
|
|
2631
|
+
* })
|
|
2632
|
+
* export class Task {
|
|
2633
|
+
* @Fields.uuid()
|
|
2634
|
+
* id!: string;
|
|
2635
|
+
* @Fields.string()
|
|
2636
|
+
* title = '';
|
|
2637
|
+
* @Fields.boolean()
|
|
2638
|
+
* completed = false;
|
|
2639
|
+
* }
|
|
2640
|
+
* *EntityOptions can be set in two ways:*
|
|
2641
|
+
* @example
|
|
2642
|
+
* // as an object
|
|
2643
|
+
* .@Entity("tasks",{ allowApiCrud:true })
|
|
2644
|
+
* @example
|
|
2645
|
+
* // as an arrow function that receives `remult` as a parameter
|
|
2646
|
+
* .@Entity("tasks", (options,remult) => options.allowApiCrud = true)
|
|
2647
|
+
*/
|
|
2578
2648
|
function Entity(key) {
|
|
2579
2649
|
var options = [];
|
|
2580
2650
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
@@ -2592,7 +2662,7 @@ function Entity(key) {
|
|
|
2592
2662
|
}
|
|
2593
2663
|
}
|
|
2594
2664
|
var factory = function (remult) {
|
|
2595
|
-
var
|
|
2665
|
+
var e_35, _a;
|
|
2596
2666
|
var r = {};
|
|
2597
2667
|
try {
|
|
2598
2668
|
for (var options_3 = tslib_1.__values(options), options_3_1 = options_3.next(); !options_3_1.done; options_3_1 = options_3.next()) {
|
|
@@ -2605,12 +2675,12 @@ function Entity(key) {
|
|
|
2605
2675
|
}
|
|
2606
2676
|
}
|
|
2607
2677
|
}
|
|
2608
|
-
catch (
|
|
2678
|
+
catch (e_35_1) { e_35 = { error: e_35_1 }; }
|
|
2609
2679
|
finally {
|
|
2610
2680
|
try {
|
|
2611
2681
|
if (options_3_1 && !options_3_1.done && (_a = options_3.return)) _a.call(options_3);
|
|
2612
2682
|
}
|
|
2613
|
-
finally { if (
|
|
2683
|
+
finally { if (e_35) throw e_35.error; }
|
|
2614
2684
|
}
|
|
2615
2685
|
var base = Object.getPrototypeOf(target);
|
|
2616
2686
|
if (base) {
|
|
@@ -2716,9 +2786,9 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2716
2786
|
});
|
|
2717
2787
|
};
|
|
2718
2788
|
QueryResultImpl.prototype.forEach = function (what) {
|
|
2719
|
-
var
|
|
2789
|
+
var e_36, _a;
|
|
2720
2790
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
2721
|
-
var i, _b, _c, x,
|
|
2791
|
+
var i, _b, _c, x, e_36_1;
|
|
2722
2792
|
return tslib_1.__generator(this, function (_d) {
|
|
2723
2793
|
switch (_d.label) {
|
|
2724
2794
|
case 0:
|
|
@@ -2740,8 +2810,8 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2740
2810
|
case 5: return [3 /*break*/, 2];
|
|
2741
2811
|
case 6: return [3 /*break*/, 13];
|
|
2742
2812
|
case 7:
|
|
2743
|
-
|
|
2744
|
-
|
|
2813
|
+
e_36_1 = _d.sent();
|
|
2814
|
+
e_36 = { error: e_36_1 };
|
|
2745
2815
|
return [3 /*break*/, 13];
|
|
2746
2816
|
case 8:
|
|
2747
2817
|
_d.trys.push([8, , 11, 12]);
|
|
@@ -2752,7 +2822,7 @@ var QueryResultImpl = /** @class */ (function () {
|
|
|
2752
2822
|
_d.label = 10;
|
|
2753
2823
|
case 10: return [3 /*break*/, 12];
|
|
2754
2824
|
case 11:
|
|
2755
|
-
if (
|
|
2825
|
+
if (e_36) throw e_36.error;
|
|
2756
2826
|
return [7 /*endfinally*/];
|
|
2757
2827
|
case 12: return [7 /*endfinally*/];
|
|
2758
2828
|
case 13: return [2 /*return*/, i];
|