remult 3.3.18 → 3.3.19-next.2

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.
Files changed (38) hide show
  1. package/esm/index.js +7 -6
  2. package/esm/remult-d1.js +1 -0
  3. package/esm/remult-knex/index.js +112 -2
  4. package/esm/remult-mongo.js +17 -8
  5. package/esm/remult-sqlite-core.js +1 -0
  6. package/esm/src/data-interfaces.js +4 -4
  7. package/esm/src/data-providers/array-entity-data-provider.js +14 -2
  8. package/esm/src/data-providers/indexed-db-data-provider.js +811 -0
  9. package/esm/src/data-providers/json-data-provider.js +2 -2
  10. package/esm/src/data-providers/rest-data-provider.js +11 -12
  11. package/esm/src/data-providers/sql-database.js +110 -43
  12. package/esm/src/remult3/RepositoryImplementation.js +90 -60
  13. package/index.d.ts +31 -17
  14. package/index.js +5 -2
  15. package/package.json +1 -1
  16. package/remult-d1.d.ts +1 -0
  17. package/remult-d1.js +1 -0
  18. package/remult-knex/index.d.ts +2 -2
  19. package/remult-knex/index.js +329 -44
  20. package/remult-mongo.js +80 -36
  21. package/remult-sqlite-core.d.ts +1 -0
  22. package/remult-sqlite-core.js +1 -0
  23. package/src/column-interfaces.d.ts +4 -0
  24. package/src/data-interfaces.d.ts +2 -3
  25. package/src/data-interfaces.js +4 -4
  26. package/src/data-providers/array-entity-data-provider.d.ts +2 -2
  27. package/src/data-providers/array-entity-data-provider.js +92 -14
  28. package/src/data-providers/indexed-db-data-provider.d.ts +39 -0
  29. package/src/data-providers/indexed-db-data-provider.js +1387 -0
  30. package/src/data-providers/json-data-provider.js +2 -2
  31. package/src/data-providers/rest-data-provider.d.ts +2 -3
  32. package/src/data-providers/rest-data-provider.js +18 -17
  33. package/src/data-providers/sql-database.js +254 -105
  34. package/src/remult3/RepositoryImplementation.d.ts +1 -1
  35. package/src/remult3/RepositoryImplementation.js +384 -270
  36. package/src/remult3/remult3.d.ts +2 -2
  37. package/src/sql-command.d.ts +2 -0
  38. package/src/standard-schema/index.d.ts +1 -1
@@ -185,6 +185,8 @@ var SqlDatabase = /** @class */ (function () {
185
185
  doesNotSupportReturningSyntax: this.sql.doesNotSupportReturningSyntax,
186
186
  doesNotSupportReturningSyntaxOnlyForUpdate: this.sql.doesNotSupportReturningSyntaxOnlyForUpdate,
187
187
  orderByNullsFirst: this.sql.orderByNullsFirst,
188
+ afterMutation: this.sql.afterMutation,
189
+ maxParametersInOneSqlStatement: this.sql.maxParametersInOneSqlStatement,
188
190
  }))];
189
191
  case 2:
190
192
  _a.sent();
@@ -270,6 +272,57 @@ var SqlDatabase = /** @class */ (function () {
270
272
  return SqlDatabase;
271
273
  }());
272
274
  exports.SqlDatabase = SqlDatabase;
275
+ var defaultMaxParametersInOneSqlStatement = 2000;
276
+ function splitByMaxParameters(items, parametersInItem, maxParameters) {
277
+ var e_2, _a;
278
+ var batches = [];
279
+ var batch = [];
280
+ var params = 0;
281
+ try {
282
+ for (var items_1 = tslib_1.__values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
283
+ var item = items_1_1.value;
284
+ var n = parametersInItem(item);
285
+ if (batch.length > 0 && params + n > maxParameters) {
286
+ batches.push(batch);
287
+ batch = [];
288
+ params = 0;
289
+ }
290
+ batch.push(item);
291
+ params += n;
292
+ }
293
+ }
294
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
295
+ finally {
296
+ try {
297
+ if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
298
+ }
299
+ finally { if (e_2) throw e_2.error; }
300
+ }
301
+ if (batch.length)
302
+ batches.push(batch);
303
+ return batches;
304
+ }
305
+ function countInsertBindParameters(entity, e, row) {
306
+ var e_3, _a;
307
+ var n = 0;
308
+ try {
309
+ for (var _b = tslib_1.__values(entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
310
+ var x = _c.value;
311
+ if ((0, filter_consumer_bridge_to_sql_request_js_1.isDbReadonly)(x, e))
312
+ continue;
313
+ if (x.valueConverter.toDb(row[x.key]) != undefined)
314
+ n++;
315
+ }
316
+ }
317
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
318
+ finally {
319
+ try {
320
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
321
+ }
322
+ finally { if (e_3) throw e_3.error; }
323
+ }
324
+ return n;
325
+ }
273
326
  var icons = new Map([
274
327
  // CRUD
275
328
  ['INSERT', '⚪'], // Used to insert new data into a database.
@@ -414,8 +467,8 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
414
467
  };
415
468
  ActualSQLEntityDataProvider.prototype.find = function (options) {
416
469
  return tslib_1.__awaiter(this, void 0, void 0, function () {
417
- var e, r, _a, colKeys, select, where, _b, first, segs, _c, _d, s, segs_1, segs_1_1, c, _e, _f, e_2_1, page;
418
- var e_3, _g, e_2, _h;
470
+ var e, r, _a, colKeys, select, where, _b, first, segs, _c, _d, s, segs_1, segs_1_1, c, _e, _f, e_4_1, page;
471
+ var e_5, _g, e_4, _h;
419
472
  var _this = this;
420
473
  return tslib_1.__generator(this, function (_j) {
421
474
  switch (_j.label) {
@@ -453,12 +506,12 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
453
506
  segs.push(s);
454
507
  }
455
508
  }
456
- catch (e_3_1) { e_3 = { error: e_3_1 }; }
509
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
457
510
  finally {
458
511
  try {
459
512
  if (_d && !_d.done && (_g = _c.return)) _g.call(_c);
460
513
  }
461
- finally { if (e_3) throw e_3.error; }
514
+ finally { if (e_5) throw e_5.error; }
462
515
  }
463
516
  _j.label = 5;
464
517
  case 5:
@@ -498,14 +551,14 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
498
551
  return [3 /*break*/, 6];
499
552
  case 11: return [3 /*break*/, 14];
500
553
  case 12:
501
- e_2_1 = _j.sent();
502
- e_2 = { error: e_2_1 };
554
+ e_4_1 = _j.sent();
555
+ e_4 = { error: e_4_1 };
503
556
  return [3 /*break*/, 14];
504
557
  case 13:
505
558
  try {
506
559
  if (segs_1_1 && !segs_1_1.done && (_h = segs_1.return)) _h.call(segs_1);
507
560
  }
508
- finally { if (e_2) throw e_2.error; }
561
+ finally { if (e_4) throw e_4.error; }
509
562
  return [7 /*endfinally*/];
510
563
  case 14:
511
564
  if (options.limit) {
@@ -543,8 +596,8 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
543
596
  };
544
597
  ActualSQLEntityDataProvider.prototype.buildSelect = function (e, r, selectedFields, args) {
545
598
  return tslib_1.__awaiter(this, void 0, void 0, function () {
546
- var select, colKeys, _a, _b, x, sql, e_4_1;
547
- var e_4, _c;
599
+ var select, colKeys, _a, _b, x, sql, e_6_1;
600
+ var e_6, _c;
548
601
  return tslib_1.__generator(this, function (_d) {
549
602
  switch (_d.label) {
550
603
  case 0:
@@ -587,14 +640,14 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
587
640
  return [3 /*break*/, 2];
588
641
  case 8: return [3 /*break*/, 11];
589
642
  case 9:
590
- e_4_1 = _d.sent();
591
- e_4 = { error: e_4_1 };
643
+ e_6_1 = _d.sent();
644
+ e_6 = { error: e_6_1 };
592
645
  return [3 /*break*/, 11];
593
646
  case 10:
594
647
  try {
595
648
  if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
596
649
  }
597
- finally { if (e_4) throw e_4.error; }
650
+ finally { if (e_6) throw e_6.error; }
598
651
  return [7 /*endfinally*/];
599
652
  case 11: return [2 /*return*/, { colKeys: colKeys, select: select }];
600
653
  }
@@ -604,7 +657,7 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
604
657
  ActualSQLEntityDataProvider.prototype.update = function (id, data, options) {
605
658
  return tslib_1.__awaiter(this, void 0, void 0, function () {
606
659
  var e, r, statement, added, _a, _b, x, v, idFilter, f, _c, _d, colKeys, select, returning;
607
- var e_5, _e;
660
+ var e_7, _e;
608
661
  var _this = this;
609
662
  return tslib_1.__generator(this, function (_f) {
610
663
  switch (_f.label) {
@@ -631,12 +684,12 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
631
684
  }
632
685
  }
633
686
  }
634
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
687
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
635
688
  finally {
636
689
  try {
637
690
  if (_b && !_b.done && (_e = _a.return)) _e.call(_a);
638
691
  }
639
- finally { if (e_5) throw e_5.error; }
692
+ finally { if (e_7) throw e_7.error; }
640
693
  }
641
694
  idFilter = this.entity.idMetadata.getIdFilter(id);
642
695
  f = new filter_consumer_bridge_to_sql_request_js_1.FilterConsumerBridgeToSqlRequest(r, e);
@@ -677,23 +730,27 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
677
730
  });
678
731
  });
679
732
  };
680
- ActualSQLEntityDataProvider.prototype.delete = function (id) {
733
+ ActualSQLEntityDataProvider.prototype.delete = function (ids) {
681
734
  return tslib_1.__awaiter(this, void 0, void 0, function () {
682
735
  var e, r, f, statement, _a;
736
+ var _b;
683
737
  var _this = this;
684
- return tslib_1.__generator(this, function (_b) {
685
- switch (_b.label) {
686
- case 0: return [4 /*yield*/, this.init()];
738
+ return tslib_1.__generator(this, function (_c) {
739
+ switch (_c.label) {
740
+ case 0:
741
+ if (ids.length === 0)
742
+ return [2 /*return*/];
743
+ return [4 /*yield*/, this.init()];
687
744
  case 1:
688
- e = _b.sent();
745
+ e = _c.sent();
689
746
  r = this.sql.createCommand();
690
747
  f = new filter_consumer_bridge_to_sql_request_js_1.FilterConsumerBridgeToSqlRequest(r, e);
691
- filter_interfaces_js_1.Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
748
+ filter_interfaces_js_1.Filter.fromEntityFilter(this.entity, (_b = this.entity.idMetadata).getIdFilter.apply(_b, tslib_1.__spreadArray([], tslib_1.__read(ids), false))).__applyToConsumer(f);
692
749
  statement = 'delete from ' + e.$entityName;
693
750
  _a = statement;
694
751
  return [4 /*yield*/, f.resolveWhere()];
695
752
  case 2:
696
- statement = _a + _b.sent();
753
+ statement = _a + _c.sent();
697
754
  return [2 /*return*/, r.execute(statement).then(function () {
698
755
  var _a, _b;
699
756
  (_b = (_a = _this.sql._getSourceSql()).afterMutation) === null || _b === void 0 ? void 0 : _b.call(_a);
@@ -704,80 +761,172 @@ var ActualSQLEntityDataProvider = /** @class */ (function () {
704
761
  };
705
762
  ActualSQLEntityDataProvider.prototype.insert = function (data, options) {
706
763
  return tslib_1.__awaiter(this, void 0, void 0, function () {
707
- var e, r, cols, vals, added, _a, _b, x, v, statement, _c, colKeys, select;
708
- var e_6, _d;
764
+ var e, maxParams, batches, result, batches_1, batches_1_1, batch, _a, _b, _c, _d, e_8_1;
765
+ var e_8, _e;
709
766
  var _this = this;
710
- return tslib_1.__generator(this, function (_e) {
711
- switch (_e.label) {
712
- case 0: return [4 /*yield*/, this.init()];
767
+ var _f;
768
+ return tslib_1.__generator(this, function (_g) {
769
+ switch (_g.label) {
770
+ case 0:
771
+ if (data.length === 0)
772
+ return [2 /*return*/, []];
773
+ return [4 /*yield*/, this.init()];
713
774
  case 1:
714
- e = _e.sent();
775
+ e = _g.sent();
776
+ maxParams = (_f = this.strategy.maxParametersInOneSqlStatement) !== null && _f !== void 0 ? _f : defaultMaxParametersInOneSqlStatement;
777
+ batches = splitByMaxParameters(data, function (row) { return countInsertBindParameters(_this.entity, e, row); }, maxParams);
778
+ result = [];
779
+ _g.label = 2;
780
+ case 2:
781
+ _g.trys.push([2, 7, 8, 9]);
782
+ batches_1 = tslib_1.__values(batches), batches_1_1 = batches_1.next();
783
+ _g.label = 3;
784
+ case 3:
785
+ if (!!batches_1_1.done) return [3 /*break*/, 6];
786
+ batch = batches_1_1.value;
787
+ _b = (_a = result.push).apply;
788
+ _c = [result];
789
+ _d = [[]];
790
+ return [4 /*yield*/, this.insertBatch(batch, e, options)];
791
+ case 4:
792
+ _b.apply(_a, _c.concat([tslib_1.__spreadArray.apply(void 0, _d.concat([tslib_1.__read.apply(void 0, [(_g.sent())]), false]))]));
793
+ _g.label = 5;
794
+ case 5:
795
+ batches_1_1 = batches_1.next();
796
+ return [3 /*break*/, 3];
797
+ case 6: return [3 /*break*/, 9];
798
+ case 7:
799
+ e_8_1 = _g.sent();
800
+ e_8 = { error: e_8_1 };
801
+ return [3 /*break*/, 9];
802
+ case 8:
803
+ try {
804
+ if (batches_1_1 && !batches_1_1.done && (_e = batches_1.return)) _e.call(batches_1);
805
+ }
806
+ finally { if (e_8) throw e_8.error; }
807
+ return [7 /*endfinally*/];
808
+ case 9: return [2 /*return*/, result];
809
+ }
810
+ });
811
+ });
812
+ };
813
+ //@internal
814
+ ActualSQLEntityDataProvider.prototype.insertOne = function (data, options) {
815
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
816
+ return tslib_1.__generator(this, function (_a) {
817
+ switch (_a.label) {
818
+ case 0: return [4 /*yield*/, this.insert([data], options)];
819
+ case 1: return [2 /*return*/, (_a.sent())[0]];
820
+ }
821
+ });
822
+ });
823
+ };
824
+ ActualSQLEntityDataProvider.prototype.insertBatch = function (batch, e, options) {
825
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
826
+ var r, cols, _loop_1, _a, _b, x, colSql, vals, i, i, j, x, v, statement, _c, colKeys, select, source, wantRows, sql, lastId, ids, id;
827
+ var e_9, _d;
828
+ var _this = this;
829
+ var _e;
830
+ return tslib_1.__generator(this, function (_f) {
831
+ switch (_f.label) {
832
+ case 0:
715
833
  r = this.sql.createCommand();
716
- cols = '';
717
- vals = '';
718
- added = false;
834
+ cols = [];
835
+ _loop_1 = function (x) {
836
+ if ((0, filter_consumer_bridge_to_sql_request_js_1.isDbReadonly)(x, e))
837
+ return "continue";
838
+ if (batch.some(function (row) { return x.valueConverter.toDb(row[x.key]) != undefined; }))
839
+ cols.push(x);
840
+ };
719
841
  try {
720
842
  for (_a = tslib_1.__values(this.entity.fields), _b = _a.next(); !_b.done; _b = _a.next()) {
721
843
  x = _b.value;
722
- if ((0, filter_consumer_bridge_to_sql_request_js_1.isDbReadonly)(x, e)) {
723
- }
724
- else {
725
- v = x.valueConverter.toDb(data[x.key]);
726
- if (v != undefined) {
727
- if (!added)
728
- added = true;
729
- else {
730
- cols += ', ';
731
- vals += ', ';
732
- }
733
- cols += e.$dbNameOf(x);
734
- vals += (0, filter_consumer_bridge_to_sql_request_js_1.toDbSql)(r, x, v);
735
- }
736
- }
844
+ _loop_1(x);
737
845
  }
738
846
  }
739
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
847
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
740
848
  finally {
741
849
  try {
742
850
  if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
743
851
  }
744
- finally { if (e_6) throw e_6.error; }
852
+ finally { if (e_9) throw e_9.error; }
853
+ }
854
+ colSql = '';
855
+ vals = '';
856
+ for (i = 0; i < cols.length; i++) {
857
+ if (i)
858
+ colSql += ', ';
859
+ colSql += e.$dbNameOf(cols[i]);
860
+ }
861
+ for (i = 0; i < batch.length; i++) {
862
+ if (i)
863
+ vals += ',';
864
+ vals += '(';
865
+ for (j = 0; j < cols.length; j++) {
866
+ if (j)
867
+ vals += ', ';
868
+ x = cols[j];
869
+ v = x.valueConverter.toDb(batch[i][x.key]);
870
+ if (v != undefined)
871
+ vals += (0, filter_consumer_bridge_to_sql_request_js_1.toDbSql)(r, x, v);
872
+ else if (x.allowNull)
873
+ vals += 'null';
874
+ else
875
+ vals += 'DEFAULT';
876
+ }
877
+ vals += ')';
745
878
  }
746
- statement = "insert into ".concat(e.$entityName, " (").concat(cols, ") values (").concat(vals, ")");
879
+ statement = "insert into ".concat(e.$entityName, " (").concat(colSql, ") values ").concat(vals);
747
880
  return [4 /*yield*/, this.buildSelect(e, r, undefined, undefined)];
748
- case 2:
749
- _c = _e.sent(), colKeys = _c.colKeys, select = _c.select;
750
- if (!this.sql._getSourceSql().doesNotSupportReturningSyntax &&
751
- !((options === null || options === void 0 ? void 0 : options.select) === 'none'))
881
+ case 1:
882
+ _c = _f.sent(), colKeys = _c.colKeys, select = _c.select;
883
+ source = this.sql._getSourceSql();
884
+ wantRows = (options === null || options === void 0 ? void 0 : options.select) !== 'none';
885
+ if (!source.doesNotSupportReturningSyntax && wantRows)
752
886
  statement += ' returning ' + select;
753
- return [4 /*yield*/, r.execute(statement).then(function (sql) {
754
- var _a, _b;
755
- (_b = (_a = _this.sql._getSourceSql()).afterMutation) === null || _b === void 0 ? void 0 : _b.call(_a);
756
- if (_this.sql._getSourceSql().doesNotSupportReturningSyntax) {
757
- if ((0, RepositoryImplementation_js_1.isAutoIncrement)(_this.entity.idMetadata.field)) {
758
- var id_1 = sql.rows[0];
759
- if (typeof id_1 !== 'number')
760
- throw new Error('Auto increment, for a database that is does not support returning syntax, should return an array with the single last added id. Instead it returned: ' +
761
- JSON.stringify(id_1));
762
- if ((options === null || options === void 0 ? void 0 : options.select) === 'none')
763
- return undefined;
764
- return _this.find({
765
- where: new filter_interfaces_js_1.Filter(function (x) {
766
- return x.isEqualTo(_this.entity.idMetadata.field, id_1);
767
- }),
768
- }).then(function (r) { return r[0]; });
769
- }
770
- else {
771
- if ((options === null || options === void 0 ? void 0 : options.select) === 'none')
772
- return undefined;
773
- return getRowAfterUpdate(_this.entity, _this, data, undefined, 'insert');
774
- }
775
- }
776
- if ((options === null || options === void 0 ? void 0 : options.select) === 'none')
777
- return undefined;
778
- return _this.buildResultRow(colKeys, sql.rows[0], sql);
887
+ return [4 /*yield*/, r.execute(statement)];
888
+ case 2:
889
+ sql = _f.sent();
890
+ (_e = source.afterMutation) === null || _e === void 0 ? void 0 : _e.call(source);
891
+ if (!wantRows)
892
+ return [2 /*return*/, batch.map(function () { return undefined; })];
893
+ if (source.doesNotSupportReturningSyntax) {
894
+ if ((0, RepositoryImplementation_js_1.isAutoIncrement)(this.entity.idMetadata.field)) {
895
+ lastId = sql.rows[0];
896
+ if (typeof lastId !== 'number')
897
+ throw new Error('Auto increment, for a database that is does not support returning syntax, should return an array with the single last added id. Instead it returned: ' +
898
+ JSON.stringify(lastId));
899
+ ids = [];
900
+ for (id = lastId - batch.length + 1; id <= lastId; id++)
901
+ ids.push(id);
902
+ return [2 /*return*/, this.loadRowsByIds(ids)];
903
+ }
904
+ return [2 /*return*/, this.loadRowsByIds(batch.map(function (row) { return _this.entity.idMetadata.getId(row); }))];
905
+ }
906
+ return [2 /*return*/, sql.rows.map(function (row) { return _this.buildResultRow(colKeys, row, sql); })];
907
+ }
908
+ });
909
+ });
910
+ };
911
+ ActualSQLEntityDataProvider.prototype.loadRowsByIds = function (ids) {
912
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
913
+ var found, byId;
914
+ var _a;
915
+ var _this = this;
916
+ return tslib_1.__generator(this, function (_b) {
917
+ switch (_b.label) {
918
+ case 0: return [4 /*yield*/, this.find({
919
+ where: filter_interfaces_js_1.Filter.fromEntityFilter(this.entity, (_a = this.entity.idMetadata).getIdFilter.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(ids), false))),
920
+ })];
921
+ case 1:
922
+ found = _b.sent();
923
+ byId = new Map(found.map(function (row) { return [_this.entity.idMetadata.getId(row) + '', row]; }));
924
+ return [2 /*return*/, ids.map(function (id) {
925
+ var row = byId.get(id + '');
926
+ if (!row)
927
+ throw new Error("Failed to insert row - result contained ".concat(found.length, " rows"));
928
+ return row;
779
929
  })];
780
- case 3: return [2 /*return*/, _e.sent()];
781
930
  }
782
931
  });
783
932
  });
@@ -813,7 +962,7 @@ function getRowAfterUpdate(meta, dataProvider, data, id, operation) {
813
962
  return dataProvider
814
963
  .find({
815
964
  where: new filter_interfaces_js_1.Filter(function (x) {
816
- var e_7, _a;
965
+ var e_10, _a;
817
966
  var _b;
818
967
  try {
819
968
  for (var _c = tslib_1.__values(meta.idMetadata.fields), _d = _c.next(); !_d.done; _d = _c.next()) {
@@ -821,12 +970,12 @@ function getRowAfterUpdate(meta, dataProvider, data, id, operation) {
821
970
  x.isEqualTo(field, (_b = data[field.key]) !== null && _b !== void 0 ? _b : idFilter[field.key]);
822
971
  }
823
972
  }
824
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
973
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
825
974
  finally {
826
975
  try {
827
976
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
828
977
  }
829
- finally { if (e_7) throw e_7.error; }
978
+ finally { if (e_10) throw e_10.error; }
830
979
  }
831
980
  }),
832
981
  })
@@ -843,8 +992,8 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
843
992
  ? "count (distinct ".concat(dbName, ")")
844
993
  : "".concat(operator, "( ").concat(dbName, " )");
845
994
  }
846
- var select, groupBy, groupByCols, processResultRow, _loop_1, _a, _b, x, _loop_2, GroupByOperators_1, GroupByOperators_1_1, operator, e_8_1, where, _c, orderBy, _d, _e, x, field, _f, e_9_1, page, result;
847
- var e_10, _g, e_8, _h, e_9, _j;
995
+ var select, groupBy, groupByCols, processResultRow, _loop_2, _a, _b, x, _loop_3, GroupByOperators_1, GroupByOperators_1_1, operator, e_11_1, where, _c, orderBy, _d, _e, x, field, _f, e_12_1, page, result;
996
+ var e_13, _g, e_11, _h, e_12, _j;
848
997
  return tslib_1.__generator(this, function (_k) {
849
998
  switch (_k.label) {
850
999
  case 0:
@@ -856,7 +1005,7 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
856
1005
  theResult[remult3_js_1.GroupByCountMember] = Number(sqlVal);
857
1006
  });
858
1007
  if (options === null || options === void 0 ? void 0 : options.group) {
859
- _loop_1 = function (x) {
1008
+ _loop_2 = function (x) {
860
1009
  if (x.isServerExpression) {
861
1010
  }
862
1011
  else {
@@ -877,26 +1026,26 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
877
1026
  try {
878
1027
  for (_a = tslib_1.__values(options === null || options === void 0 ? void 0 : options.group), _b = _a.next(); !_b.done; _b = _a.next()) {
879
1028
  x = _b.value;
880
- _loop_1(x);
1029
+ _loop_2(x);
881
1030
  }
882
1031
  }
883
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
1032
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
884
1033
  finally {
885
1034
  try {
886
1035
  if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
887
1036
  }
888
- finally { if (e_10) throw e_10.error; }
1037
+ finally { if (e_13) throw e_13.error; }
889
1038
  }
890
1039
  }
891
- _loop_2 = function (operator) {
892
- var fields, _loop_3, fields_1, fields_1_1, x, e_11_1;
893
- var e_11, _l;
1040
+ _loop_3 = function (operator) {
1041
+ var fields, _loop_4, fields_1, fields_1_1, x, e_14_1;
1042
+ var e_14, _l;
894
1043
  return tslib_1.__generator(this, function (_m) {
895
1044
  switch (_m.label) {
896
1045
  case 0:
897
1046
  fields = options === null || options === void 0 ? void 0 : options[operator];
898
1047
  if (!fields) return [3 /*break*/, 8];
899
- _loop_3 = function (x) {
1048
+ _loop_4 = function (x) {
900
1049
  var dbName, turnToNumber;
901
1050
  return tslib_1.__generator(this, function (_o) {
902
1051
  switch (_o.label) {
@@ -925,12 +1074,12 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
925
1074
  _m.label = 1;
926
1075
  case 1:
927
1076
  _m.trys.push([1, 6, 7, 8]);
928
- fields_1 = (e_11 = void 0, tslib_1.__values(fields)), fields_1_1 = fields_1.next();
1077
+ fields_1 = (e_14 = void 0, tslib_1.__values(fields)), fields_1_1 = fields_1.next();
929
1078
  _m.label = 2;
930
1079
  case 2:
931
1080
  if (!!fields_1_1.done) return [3 /*break*/, 5];
932
1081
  x = fields_1_1.value;
933
- return [5 /*yield**/, _loop_3(x)];
1082
+ return [5 /*yield**/, _loop_4(x)];
934
1083
  case 3:
935
1084
  _m.sent();
936
1085
  _m.label = 4;
@@ -939,14 +1088,14 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
939
1088
  return [3 /*break*/, 2];
940
1089
  case 5: return [3 /*break*/, 8];
941
1090
  case 6:
942
- e_11_1 = _m.sent();
943
- e_11 = { error: e_11_1 };
1091
+ e_14_1 = _m.sent();
1092
+ e_14 = { error: e_14_1 };
944
1093
  return [3 /*break*/, 8];
945
1094
  case 7:
946
1095
  try {
947
1096
  if (fields_1_1 && !fields_1_1.done && (_l = fields_1.return)) _l.call(fields_1);
948
1097
  }
949
- finally { if (e_11) throw e_11.error; }
1098
+ finally { if (e_14) throw e_14.error; }
950
1099
  return [7 /*endfinally*/];
951
1100
  case 8: return [2 /*return*/];
952
1101
  }
@@ -960,7 +1109,7 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
960
1109
  case 2:
961
1110
  if (!!GroupByOperators_1_1.done) return [3 /*break*/, 5];
962
1111
  operator = GroupByOperators_1_1.value;
963
- return [5 /*yield**/, _loop_2(operator)];
1112
+ return [5 /*yield**/, _loop_3(operator)];
964
1113
  case 3:
965
1114
  _k.sent();
966
1115
  _k.label = 4;
@@ -969,14 +1118,14 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
969
1118
  return [3 /*break*/, 2];
970
1119
  case 5: return [3 /*break*/, 8];
971
1120
  case 6:
972
- e_8_1 = _k.sent();
973
- e_8 = { error: e_8_1 };
1121
+ e_11_1 = _k.sent();
1122
+ e_11 = { error: e_11_1 };
974
1123
  return [3 /*break*/, 8];
975
1124
  case 7:
976
1125
  try {
977
1126
  if (GroupByOperators_1_1 && !GroupByOperators_1_1.done && (_h = GroupByOperators_1.return)) _h.call(GroupByOperators_1);
978
1127
  }
979
- finally { if (e_8) throw e_8.error; }
1128
+ finally { if (e_11) throw e_11.error; }
980
1129
  return [7 /*endfinally*/];
981
1130
  case 8:
982
1131
  select += '\n from ' + e.$entityName;
@@ -1037,14 +1186,14 @@ function groupByImpl(options, e, r, orderByNullFirst, limitSyntax) {
1037
1186
  return [3 /*break*/, 12];
1038
1187
  case 16: return [3 /*break*/, 19];
1039
1188
  case 17:
1040
- e_9_1 = _k.sent();
1041
- e_9 = { error: e_9_1 };
1189
+ e_12_1 = _k.sent();
1190
+ e_12 = { error: e_12_1 };
1042
1191
  return [3 /*break*/, 19];
1043
1192
  case 18:
1044
1193
  try {
1045
1194
  if (_e && !_e.done && (_j = _d.return)) _j.call(_d);
1046
1195
  }
1047
- finally { if (e_9) throw e_9.error; }
1196
+ finally { if (e_12) throw e_12.error; }
1048
1197
  return [7 /*endfinally*/];
1049
1198
  case 19:
1050
1199
  if (orderBy)
@@ -53,7 +53,7 @@ export declare class RepositoryImplementation<entityType> implements Repository<
53
53
  insert(item: Partial<MembersOnly<entityType>>[], options?: InsertOrUpdateOptions): Promise<entityType[]>;
54
54
  insert(item: Partial<MembersOnly<entityType>>, options?: InsertOrUpdateOptions): Promise<entityType>;
55
55
  get fields(): FieldsMetadata<entityType>;
56
- validate(entity: Partial<MembersOnly<entityType>>, ...fields: Extract<keyof MembersOnly<entityType>, string>[]): Promise<ErrorInfo<entityType> | undefined>;
56
+ validate(entity: Partial<MembersOnly<entityType>>, ...fields: (keyof MembersOnly<entityType>)[]): Promise<ErrorInfo<entityType> | undefined>;
57
57
  private __createDto;
58
58
  updateMany({ where, set, }: {
59
59
  where: EntityFilter<entityType>;