remult 0.11.1 → 0.12.1

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/remult-mongo.js CHANGED
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MongoDataProvider = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var _1 = require(".");
6
+ var filter_consumer_bridge_to_sql_request_1 = require("./src/filter/filter-consumer-bridge-to-sql-request");
6
7
  var MongoDataProvider = /** @class */ (function () {
7
8
  function MongoDataProvider(db, client) {
8
9
  this.db = db;
@@ -53,123 +54,77 @@ var MongoEntityDataProvider = /** @class */ (function () {
53
54
  this.db = db;
54
55
  this.entity = entity;
55
56
  }
56
- MongoEntityDataProvider.prototype.translateFromJson = function (row) {
57
- return tslib_1.__awaiter(this, void 0, void 0, function () {
58
- var result, _a, _b, col, _c, _d, _e, _f, _g, e_1_1;
59
- var e_1, _h;
60
- return tslib_1.__generator(this, function (_j) {
61
- switch (_j.label) {
62
- case 0:
63
- result = {};
64
- _j.label = 1;
65
- case 1:
66
- _j.trys.push([1, 6, 7, 8]);
67
- _a = tslib_1.__values(this.entity.fields), _b = _a.next();
68
- _j.label = 2;
69
- case 2:
70
- if (!!_b.done) return [3 /*break*/, 5];
71
- col = _b.value;
72
- _c = result;
73
- _d = col.key;
74
- _f = (_e = col.valueConverter).fromDb;
75
- _g = row;
76
- return [4 /*yield*/, col.getDbName()];
77
- case 3:
78
- _c[_d] = _f.apply(_e, [_g[_j.sent()]]);
79
- if (isNull(result[col.key]))
80
- result[col.key] = null;
81
- _j.label = 4;
82
- case 4:
83
- _b = _a.next();
84
- return [3 /*break*/, 2];
85
- case 5: return [3 /*break*/, 8];
86
- case 6:
87
- e_1_1 = _j.sent();
88
- e_1 = { error: e_1_1 };
89
- return [3 /*break*/, 8];
90
- case 7:
91
- try {
92
- if (_b && !_b.done && (_h = _a.return)) _h.call(_a);
93
- }
94
- finally { if (e_1) throw e_1.error; }
95
- return [7 /*endfinally*/];
96
- case 8: return [2 /*return*/, result];
97
- }
98
- });
99
- });
57
+ MongoEntityDataProvider.prototype.translateFromJson = function (row, nameProvider) {
58
+ var e_1, _a;
59
+ var result = {};
60
+ try {
61
+ for (var _b = tslib_1.__values(this.entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
62
+ var col = _c.value;
63
+ result[col.key] = col.valueConverter.fromDb(row[nameProvider.nameOf(col)]);
64
+ if (isNull(result[col.key]))
65
+ result[col.key] = null;
66
+ }
67
+ }
68
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
69
+ finally {
70
+ try {
71
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
72
+ }
73
+ finally { if (e_1) throw e_1.error; }
74
+ }
75
+ return result;
100
76
  };
101
- MongoEntityDataProvider.prototype.translateToJson = function (row) {
102
- return tslib_1.__awaiter(this, void 0, void 0, function () {
103
- var result, _a, _b, col, val, _c, e_2_1;
104
- var e_2, _d;
105
- return tslib_1.__generator(this, function (_e) {
106
- switch (_e.label) {
107
- case 0:
108
- result = {};
109
- _e.label = 1;
110
- case 1:
111
- _e.trys.push([1, 6, 7, 8]);
112
- _a = tslib_1.__values(this.entity.fields), _b = _a.next();
113
- _e.label = 2;
114
- case 2:
115
- if (!!_b.done) return [3 /*break*/, 5];
116
- col = _b.value;
117
- val = col.valueConverter.toDb(row[col.key]);
118
- if (val === null)
119
- val = NULL;
120
- _c = result;
121
- return [4 /*yield*/, col.getDbName()];
122
- case 3:
123
- _c[_e.sent()] = val;
124
- _e.label = 4;
125
- case 4:
126
- _b = _a.next();
127
- return [3 /*break*/, 2];
128
- case 5: return [3 /*break*/, 8];
129
- case 6:
130
- e_2_1 = _e.sent();
131
- e_2 = { error: e_2_1 };
132
- return [3 /*break*/, 8];
133
- case 7:
134
- try {
135
- if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
136
- }
137
- finally { if (e_2) throw e_2.error; }
138
- return [7 /*endfinally*/];
139
- case 8: return [2 /*return*/, result];
140
- }
141
- });
142
- });
77
+ MongoEntityDataProvider.prototype.translateToJson = function (row, nameProvider) {
78
+ var e_2, _a;
79
+ var result = {};
80
+ try {
81
+ for (var _b = tslib_1.__values(this.entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
82
+ var col = _c.value;
83
+ var val = col.valueConverter.toDb(row[col.key]);
84
+ if (val === null)
85
+ val = NULL;
86
+ result[nameProvider.nameOf(col)] = val;
87
+ }
88
+ }
89
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
90
+ finally {
91
+ try {
92
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
93
+ }
94
+ finally { if (e_2) throw e_2.error; }
95
+ }
96
+ return result;
143
97
  };
144
98
  MongoEntityDataProvider.prototype.count = function (where) {
145
99
  return tslib_1.__awaiter(this, void 0, void 0, function () {
146
- var x, w;
147
- return tslib_1.__generator(this, function (_a) {
148
- switch (_a.label) {
149
- case 0:
150
- x = new FilterConsumerBridgeToKnexMongo();
100
+ var _a, collection, e, x, w;
101
+ return tslib_1.__generator(this, function (_b) {
102
+ switch (_b.label) {
103
+ case 0: return [4 /*yield*/, this.collection()];
104
+ case 1:
105
+ _a = _b.sent(), collection = _a.collection, e = _a.e;
106
+ x = new FilterConsumerBridgeToMongo(e);
151
107
  where.__applyToConsumer(x);
152
108
  return [4 /*yield*/, x.resolveWhere()];
153
- case 1:
154
- w = _a.sent();
155
- return [4 /*yield*/, this.collection()];
156
- case 2: return [4 /*yield*/, (_a.sent()).countDocuments(w)];
157
- case 3: return [2 /*return*/, _a.sent()];
109
+ case 2:
110
+ w = _b.sent();
111
+ return [4 /*yield*/, collection.countDocuments(w)];
112
+ case 3: return [2 /*return*/, _b.sent()];
158
113
  }
159
114
  });
160
115
  });
161
116
  };
162
117
  MongoEntityDataProvider.prototype.find = function (options) {
163
118
  return tslib_1.__awaiter(this, void 0, void 0, function () {
164
- var collection, x, where, op, _a, _b, s, _c, e_3_1, _d, _e;
119
+ var _a, collection, e, x, where, op, _b, _c, s, _d, _e;
165
120
  var e_3, _f;
166
121
  var _this = this;
167
122
  return tslib_1.__generator(this, function (_g) {
168
123
  switch (_g.label) {
169
124
  case 0: return [4 /*yield*/, this.collection()];
170
125
  case 1:
171
- collection = _g.sent();
172
- x = new FilterConsumerBridgeToKnexMongo();
126
+ _a = _g.sent(), collection = _a.collection, e = _a.e;
127
+ x = new FilterConsumerBridgeToMongo(e);
173
128
  if (options === null || options === void 0 ? void 0 : options.where)
174
129
  options.where.__applyToConsumer(x);
175
130
  return [4 /*yield*/, x.resolveWhere()];
@@ -182,61 +137,47 @@ var MongoEntityDataProvider = /** @class */ (function () {
182
137
  op.skip = (options.page - 1) * options.limit;
183
138
  }
184
139
  }
185
- if (!options.orderBy) return [3 /*break*/, 10];
186
- op.sort = {};
187
- _g.label = 3;
188
- case 3:
189
- _g.trys.push([3, 8, 9, 10]);
190
- _a = tslib_1.__values(options.orderBy.Segments), _b = _a.next();
191
- _g.label = 4;
192
- case 4:
193
- if (!!_b.done) return [3 /*break*/, 7];
194
- s = _b.value;
195
- _c = op.sort;
196
- return [4 /*yield*/, s.field.getDbName()];
197
- case 5:
198
- _c[_g.sent()] = s.isDescending ? -1 : 1;
199
- _g.label = 6;
200
- case 6:
201
- _b = _a.next();
202
- return [3 /*break*/, 4];
203
- case 7: return [3 /*break*/, 10];
204
- case 8:
205
- e_3_1 = _g.sent();
206
- e_3 = { error: e_3_1 };
207
- return [3 /*break*/, 10];
208
- case 9:
209
- try {
210
- if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
140
+ if (options.orderBy) {
141
+ op.sort = {};
142
+ try {
143
+ for (_b = tslib_1.__values(options.orderBy.Segments), _c = _b.next(); !_c.done; _c = _b.next()) {
144
+ s = _c.value;
145
+ op.sort[e.nameOf(s.field)] = s.isDescending ? -1 : 1;
146
+ }
147
+ }
148
+ catch (e_3_1) { e_3 = { error: e_3_1 }; }
149
+ finally {
150
+ try {
151
+ if (_c && !_c.done && (_f = _b.return)) _f.call(_b);
152
+ }
153
+ finally { if (e_3) throw e_3.error; }
154
+ }
211
155
  }
212
- finally { if (e_3) throw e_3.error; }
213
- return [7 /*endfinally*/];
214
- case 10:
215
156
  _e = (_d = Promise).all;
216
- return [4 /*yield*/, collection.find(where, op).map(function (x) { return _this.translateFromJson(x); }).toArray()];
217
- case 11: return [4 /*yield*/, _e.apply(_d, [_g.sent()])];
218
- case 12: return [2 /*return*/, _g.sent()];
157
+ return [4 /*yield*/, collection.find(where, op).map(function (x) { return _this.translateFromJson(x, e); }).toArray()];
158
+ case 3: return [4 /*yield*/, _e.apply(_d, [_g.sent()])];
159
+ case 4: return [2 /*return*/, _g.sent()];
219
160
  }
220
161
  });
221
162
  });
222
163
  };
223
164
  MongoEntityDataProvider.prototype.update = function (id, data) {
224
165
  return tslib_1.__awaiter(this, void 0, void 0, function () {
225
- var collection, f, resultFilter, _a, _b, x, newR, keys, _c, _d, f_1, r, _e, _f;
226
- var e_4, _g, e_5, _h;
227
- return tslib_1.__generator(this, function (_j) {
228
- switch (_j.label) {
166
+ var _a, collection, e, f, resultFilter, _b, _c, x, newR, keys, _d, _e, f_1, r, _f, _g;
167
+ var e_4, _h, e_5, _j;
168
+ return tslib_1.__generator(this, function (_k) {
169
+ switch (_k.label) {
229
170
  case 0: return [4 /*yield*/, this.collection()];
230
171
  case 1:
231
- collection = _j.sent();
232
- f = new FilterConsumerBridgeToKnexMongo();
172
+ _a = _k.sent(), collection = _a.collection, e = _a.e;
173
+ f = new FilterConsumerBridgeToMongo(e);
233
174
  _1.Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
234
175
  resultFilter = this.entity.idMetadata.getIdFilter(id);
235
176
  if (data.id != undefined)
236
177
  resultFilter = this.entity.idMetadata.getIdFilter(data.id);
237
178
  try {
238
- for (_a = tslib_1.__values(this.entity.fields), _b = _a.next(); !_b.done; _b = _a.next()) {
239
- x = _b.value;
179
+ for (_b = tslib_1.__values(this.entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) {
180
+ x = _c.value;
240
181
  if (x instanceof _1.CompoundIdField) {
241
182
  resultFilter = x.resultIdFilter(id, data);
242
183
  }
@@ -245,15 +186,15 @@ var MongoEntityDataProvider = /** @class */ (function () {
245
186
  catch (e_4_1) { e_4 = { error: e_4_1 }; }
246
187
  finally {
247
188
  try {
248
- if (_b && !_b.done && (_g = _a.return)) _g.call(_a);
189
+ if (_c && !_c.done && (_h = _b.return)) _h.call(_b);
249
190
  }
250
191
  finally { if (e_4) throw e_4.error; }
251
192
  }
252
193
  newR = {};
253
194
  keys = Object.keys(data);
254
195
  try {
255
- for (_c = tslib_1.__values(this.entity.fields), _d = _c.next(); !_d.done; _d = _c.next()) {
256
- f_1 = _d.value;
196
+ for (_d = tslib_1.__values(this.entity.fields), _e = _d.next(); !_e.done; _e = _d.next()) {
197
+ f_1 = _e.value;
257
198
  if (!f_1.dbReadOnly && !f_1.isServerExpression && !(f_1 == this.entity.idMetadata.field && this.entity.options.dbAutoIncrementId)) {
258
199
  if (keys.includes(f_1.key)) {
259
200
  newR[f_1.key] = f_1.valueConverter.toJson(data[f_1.key]);
@@ -264,17 +205,17 @@ var MongoEntityDataProvider = /** @class */ (function () {
264
205
  catch (e_5_1) { e_5 = { error: e_5_1 }; }
265
206
  finally {
266
207
  try {
267
- if (_d && !_d.done && (_h = _c.return)) _h.call(_c);
208
+ if (_e && !_e.done && (_j = _d.return)) _j.call(_d);
268
209
  }
269
210
  finally { if (e_5) throw e_5.error; }
270
211
  }
271
- _f = (_e = collection).updateOne;
212
+ _g = (_f = collection).updateOne;
272
213
  return [4 /*yield*/, f.resolveWhere()];
273
- case 2: return [4 /*yield*/, _f.apply(_e, [_j.sent(), {
214
+ case 2: return [4 /*yield*/, _g.apply(_f, [_k.sent(), {
274
215
  $set: newR
275
216
  }])];
276
217
  case 3:
277
- r = _j.sent();
218
+ r = _k.sent();
278
219
  return [2 /*return*/, this.find({ where: _1.Filter.fromEntityFilter(this.entity, resultFilter) }).then(function (y) { return y[0]; })];
279
220
  }
280
221
  });
@@ -282,18 +223,18 @@ var MongoEntityDataProvider = /** @class */ (function () {
282
223
  };
283
224
  MongoEntityDataProvider.prototype.delete = function (id) {
284
225
  return tslib_1.__awaiter(this, void 0, void 0, function () {
285
- var f, _a, _b;
286
- return tslib_1.__generator(this, function (_c) {
287
- switch (_c.label) {
288
- case 0:
289
- f = new FilterConsumerBridgeToKnexMongo();
290
- _1.Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
291
- return [4 /*yield*/, this.collection()];
226
+ var _a, e, collection, f, _b, _c;
227
+ return tslib_1.__generator(this, function (_d) {
228
+ switch (_d.label) {
229
+ case 0: return [4 /*yield*/, this.collection()];
292
230
  case 1:
293
- _b = (_a = (_c.sent())).deleteOne;
231
+ _a = _d.sent(), e = _a.e, collection = _a.collection;
232
+ f = new FilterConsumerBridgeToMongo(e);
233
+ _1.Filter.fromEntityFilter(this.entity, this.entity.idMetadata.getIdFilter(id)).__applyToConsumer(f);
234
+ _c = (_b = collection).deleteOne;
294
235
  return [4 /*yield*/, f.resolveWhere()];
295
236
  case 2:
296
- _b.apply(_a, [_c.sent()]);
237
+ _c.apply(_b, [_d.sent()]);
297
238
  return [2 /*return*/];
298
239
  }
299
240
  });
@@ -301,47 +242,49 @@ var MongoEntityDataProvider = /** @class */ (function () {
301
242
  };
302
243
  MongoEntityDataProvider.prototype.insert = function (data) {
303
244
  return tslib_1.__awaiter(this, void 0, void 0, function () {
304
- var collection, r, _a, _b, _c;
305
- return tslib_1.__generator(this, function (_d) {
306
- switch (_d.label) {
245
+ var _a, collection, e, r, _b, _c, _d;
246
+ return tslib_1.__generator(this, function (_e) {
247
+ switch (_e.label) {
307
248
  case 0: return [4 /*yield*/, this.collection()];
308
249
  case 1:
309
- collection = _d.sent();
310
- _b = (_a = collection).insertOne;
311
- return [4 /*yield*/, this.translateToJson(data)];
312
- case 2: return [4 /*yield*/, _b.apply(_a, [_d.sent()])];
250
+ _a = _e.sent(), collection = _a.collection, e = _a.e;
251
+ _c = (_b = collection).insertOne;
252
+ return [4 /*yield*/, this.translateToJson(data, e)];
253
+ case 2: return [4 /*yield*/, _c.apply(_b, [_e.sent()])];
313
254
  case 3:
314
- r = _d.sent();
315
- _c = this.translateFromJson;
255
+ r = _e.sent();
256
+ _d = this.translateFromJson;
316
257
  return [4 /*yield*/, collection.findOne({ _id: r.insertedId })];
317
- case 4: return [4 /*yield*/, _c.apply(this, [_d.sent()])];
318
- case 5: return [2 /*return*/, _d.sent()];
258
+ case 4: return [4 /*yield*/, _d.apply(this, [_e.sent(), e])];
259
+ case 5: return [2 /*return*/, _e.sent()];
319
260
  }
320
261
  });
321
262
  });
322
263
  };
323
264
  MongoEntityDataProvider.prototype.collection = function () {
324
265
  return tslib_1.__awaiter(this, void 0, void 0, function () {
325
- var _a, _b;
326
- return tslib_1.__generator(this, function (_c) {
327
- switch (_c.label) {
328
- case 0:
329
- _b = (_a = this.db).collection;
330
- return [4 /*yield*/, this.entity.getDbName()];
331
- case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
266
+ var e, collection;
267
+ return tslib_1.__generator(this, function (_a) {
268
+ switch (_a.label) {
269
+ case 0: return [4 /*yield*/, filter_consumer_bridge_to_sql_request_1.getDbNameProvider(this.entity)];
270
+ case 1:
271
+ e = _a.sent();
272
+ collection = this.db.collection(e.entityName);
273
+ return [2 /*return*/, { e: e, collection: collection }];
332
274
  }
333
275
  });
334
276
  });
335
277
  };
336
278
  return MongoEntityDataProvider;
337
279
  }());
338
- var FilterConsumerBridgeToKnexMongo = /** @class */ (function () {
339
- function FilterConsumerBridgeToKnexMongo() {
280
+ var FilterConsumerBridgeToMongo = /** @class */ (function () {
281
+ function FilterConsumerBridgeToMongo(nameProvider) {
282
+ this.nameProvider = nameProvider;
340
283
  this._addWhere = true;
341
284
  this.promises = [];
342
285
  this.result = [];
343
286
  }
344
- FilterConsumerBridgeToKnexMongo.prototype.resolveWhere = function () {
287
+ FilterConsumerBridgeToMongo.prototype.resolveWhere = function () {
345
288
  return tslib_1.__awaiter(this, void 0, void 0, function () {
346
289
  var p, p_1, p_1_1, pr, e_6_1;
347
290
  var e_6, _a;
@@ -388,10 +331,10 @@ var FilterConsumerBridgeToKnexMongo = /** @class */ (function () {
388
331
  });
389
332
  });
390
333
  };
391
- FilterConsumerBridgeToKnexMongo.prototype.custom = function (key, customItem) {
334
+ FilterConsumerBridgeToMongo.prototype.custom = function (key, customItem) {
392
335
  throw new Error("Custom filter should be translated before it gets here");
393
336
  };
394
- FilterConsumerBridgeToKnexMongo.prototype.or = function (orElements) {
337
+ FilterConsumerBridgeToMongo.prototype.or = function (orElements) {
395
338
  var _this = this;
396
339
  this.promises.push((function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
397
340
  var result, orElements_1, orElements_1_1, element, f, where, e_7_1;
@@ -408,7 +351,7 @@ var FilterConsumerBridgeToKnexMongo = /** @class */ (function () {
408
351
  case 2:
409
352
  if (!!orElements_1_1.done) return [3 /*break*/, 5];
410
353
  element = orElements_1_1.value;
411
- f = new FilterConsumerBridgeToKnexMongo();
354
+ f = new FilterConsumerBridgeToMongo(this.nameProvider);
412
355
  f._addWhere = false;
413
356
  element.__applyToConsumer(f);
414
357
  return [4 /*yield*/, f.resolveWhere()];
@@ -441,68 +384,58 @@ var FilterConsumerBridgeToKnexMongo = /** @class */ (function () {
441
384
  });
442
385
  }); })());
443
386
  };
444
- FilterConsumerBridgeToKnexMongo.prototype.isNull = function (col) {
387
+ FilterConsumerBridgeToMongo.prototype.isNull = function (col) {
445
388
  this.add(col, NULL, "$eq");
446
389
  };
447
- FilterConsumerBridgeToKnexMongo.prototype.isNotNull = function (col) {
390
+ FilterConsumerBridgeToMongo.prototype.isNotNull = function (col) {
448
391
  this.add(col, NULL, "$ne");
449
392
  };
450
- FilterConsumerBridgeToKnexMongo.prototype.isIn = function (col, val) {
393
+ FilterConsumerBridgeToMongo.prototype.isIn = function (col, val) {
451
394
  var _this = this;
452
- this.promises.push(col.getDbName().then(function (colName) {
453
- _this.result.push(function () {
454
- var _a;
455
- return (_a = {},
456
- _a[colName] = {
457
- $in: val.map(function (x) { return col.valueConverter.toDb(x); })
458
- },
459
- _a);
460
- });
461
- }));
395
+ this.result.push(function () {
396
+ var _a;
397
+ return (_a = {},
398
+ _a[_this.nameProvider.nameOf(col)] = {
399
+ $in: val.map(function (x) { return col.valueConverter.toDb(x); })
400
+ },
401
+ _a);
402
+ });
462
403
  };
463
- FilterConsumerBridgeToKnexMongo.prototype.isEqualTo = function (col, val) {
404
+ FilterConsumerBridgeToMongo.prototype.isEqualTo = function (col, val) {
464
405
  this.add(col, val, "$eq");
465
406
  };
466
- FilterConsumerBridgeToKnexMongo.prototype.isDifferentFrom = function (col, val) {
407
+ FilterConsumerBridgeToMongo.prototype.isDifferentFrom = function (col, val) {
467
408
  this.add(col, val, "$ne");
468
409
  };
469
- FilterConsumerBridgeToKnexMongo.prototype.isGreaterOrEqualTo = function (col, val) {
410
+ FilterConsumerBridgeToMongo.prototype.isGreaterOrEqualTo = function (col, val) {
470
411
  this.add(col, val, "$gte");
471
412
  };
472
- FilterConsumerBridgeToKnexMongo.prototype.isGreaterThan = function (col, val) {
413
+ FilterConsumerBridgeToMongo.prototype.isGreaterThan = function (col, val) {
473
414
  this.add(col, val, "$gt");
474
415
  };
475
- FilterConsumerBridgeToKnexMongo.prototype.isLessOrEqualTo = function (col, val) {
416
+ FilterConsumerBridgeToMongo.prototype.isLessOrEqualTo = function (col, val) {
476
417
  this.add(col, val, "$lte");
477
418
  };
478
- FilterConsumerBridgeToKnexMongo.prototype.isLessThan = function (col, val) {
419
+ FilterConsumerBridgeToMongo.prototype.isLessThan = function (col, val) {
479
420
  this.add(col, val, "$lt");
480
421
  };
481
- FilterConsumerBridgeToKnexMongo.prototype.containsCaseInsensitive = function (col, val) {
482
- var _this = this;
483
- throw "error";
422
+ FilterConsumerBridgeToMongo.prototype.containsCaseInsensitive = function (col, val) {
423
+ throw "containsCaseInsensitive not yet implemented";
484
424
  // this.promises.push(col.getDbName().then(colName => {
485
425
  // this.result.push(b => b.whereRaw(
486
426
  // 'lower (' + colName + ") like lower ('%" + val.replace(/'/g, '\'\'') + "%')"));
487
427
  // }));
488
- this.promises.push((function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
489
- return tslib_1.__generator(this, function (_a) {
490
- return [2 /*return*/];
491
- });
492
- }); })());
493
428
  };
494
- FilterConsumerBridgeToKnexMongo.prototype.add = function (col, val, operator) {
429
+ FilterConsumerBridgeToMongo.prototype.add = function (col, val, operator) {
495
430
  var _this = this;
496
- this.promises.push(col.getDbName().then(function (colName) {
497
- _this.result.push(function () {
498
- var _a, _b;
499
- return (_a = {},
500
- _a[colName] = (_b = {}, _b[operator] = isNull(val) ? val : col.valueConverter.toDb(val), _b),
501
- _a);
502
- });
503
- }));
431
+ this.result.push(function () {
432
+ var _a, _b;
433
+ return (_a = {},
434
+ _a[_this.nameProvider.nameOf(col)] = (_b = {}, _b[operator] = isNull(val) ? val : col.valueConverter.toDb(val), _b),
435
+ _a);
436
+ });
504
437
  };
505
- FilterConsumerBridgeToKnexMongo.prototype.databaseCustom = function (databaseCustom) {
438
+ FilterConsumerBridgeToMongo.prototype.databaseCustom = function (databaseCustom) {
506
439
  throw "error";
507
440
  // this.promises.push((async () => {
508
441
  // if (databaseCustom?.buildSql) {
@@ -514,5 +447,5 @@ var FilterConsumerBridgeToKnexMongo = /** @class */ (function () {
514
447
  // }
515
448
  // })());
516
449
  };
517
- return FilterConsumerBridgeToKnexMongo;
450
+ return FilterConsumerBridgeToMongo;
518
451
  }());
@@ -191,7 +191,7 @@ var ExpressBridge = /** @class */ (function () {
191
191
  var apiPathWithId = spec.paths['/api/' + key + "/{id}"] = {};
192
192
  //https://github.com/2fd/open-api.d.ts
193
193
  apiPath.get = secure(meta.options.allowApiRead, true, {
194
- description: "return an array of " + key + ". supports filter operators. For more info on filtering [see this article](https://remult.dev/guide/rest-api.html#filter)",
194
+ description: "return an array of " + key + ". supports filter operators. For more info on filtering [see this article](https://remult.dev/docs/rest-api.html#filter)",
195
195
  parameters: tslib_1.__spread([{
196
196
  "name": "_limit",
197
197
  "in": "query",
@@ -1,5 +1,5 @@
1
1
  import { dbTestWhatSignature } from "../shared-tests/db-tests-setup";
2
- export declare function testKnexSqlImpl(key: string, what: dbTestWhatSignature, focus?: boolean): void;
2
+ export declare const testKnexPGSqlImpl: (key: string, what: dbTestWhatSignature, focus?: boolean) => void;
3
3
  export declare function testPostgresImplementation(key: string, what: dbTestWhatSignature, focus?: boolean): void;
4
4
  import '../shared-tests';
5
5
  export declare function testMongo(key: string, what: dbTestWhatSignature, focus?: boolean): void;