remult 0.27.5-next.0 → 0.27.5
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/esm/remult-knex/index.js +2 -2
- package/esm/src/live-query/SubscriptionServer.js +2 -2
- package/esm/src/remult3/RepositoryImplementation.js +2 -4
- package/esm/src/remult3/remult3.js +1 -0
- package/package.json +1 -1
- package/remult-knex/index.js +2 -2
- package/src/live-query/SubscriptionServer.js +2 -2
- package/src/remult3/RepositoryImplementation.js +18 -18
- package/src/remult3/remult3.js +1 -0
package/esm/remult-knex/index.js
CHANGED
|
@@ -251,8 +251,8 @@ class KnexEntityDataProvider {
|
|
|
251
251
|
newId = result[0];
|
|
252
252
|
}
|
|
253
253
|
else {
|
|
254
|
-
let result = await insert.returning(this.entity.idMetadata.field.
|
|
255
|
-
newId = result[0][this.entity.idMetadata.field.
|
|
254
|
+
let result = await insert.returning(this.entity.idMetadata.field.dbName);
|
|
255
|
+
newId = result[0][this.entity.idMetadata.field.dbName];
|
|
256
256
|
}
|
|
257
257
|
return this.find({
|
|
258
258
|
where: new Filter((x) => x.isEqualTo(this.entity.idMetadata.field, newId)),
|
|
@@ -12,7 +12,7 @@ export class LiveQueryPublisher {
|
|
|
12
12
|
runPromise(p) { }
|
|
13
13
|
debugFileSaver = (x) => { };
|
|
14
14
|
async itemChanged(entityKey, changes) {
|
|
15
|
-
await this.
|
|
15
|
+
await this.liveQueryStorage().forEach(entityKey, async ({ query: q, setData }) => {
|
|
16
16
|
let query = { ...q.data };
|
|
17
17
|
await this.performWithContext(query.requestJson, entityKey, async (repo) => {
|
|
18
18
|
const messages = [];
|
|
@@ -61,7 +61,7 @@ export class LiveQueryPublisher {
|
|
|
61
61
|
if (messages.length > 0)
|
|
62
62
|
this.subscriptionServer().publishMessage(q.id, messages);
|
|
63
63
|
});
|
|
64
|
-
})
|
|
64
|
+
});
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export class InMemoryLiveQueryStorage {
|
|
@@ -1348,7 +1348,7 @@ export class rowHelperImplementation extends rowHelperBase {
|
|
|
1348
1348
|
await listener.saved?.(this.instance, isNew);
|
|
1349
1349
|
}
|
|
1350
1350
|
}
|
|
1351
|
-
this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }]);
|
|
1351
|
+
await this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }]);
|
|
1352
1352
|
this.saveOriginalData();
|
|
1353
1353
|
this._isNew = false;
|
|
1354
1354
|
return this.instance;
|
|
@@ -1420,9 +1420,7 @@ export class rowHelperImplementation extends rowHelperBase {
|
|
|
1420
1420
|
for (const listener of this.repo.listeners) {
|
|
1421
1421
|
await listener.deleted?.(this.instance);
|
|
1422
1422
|
}
|
|
1423
|
-
this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [
|
|
1424
|
-
{ id: this.getId(), oldId: this.getOriginalId(), deleted: true },
|
|
1425
|
-
]);
|
|
1423
|
+
await this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: true }]);
|
|
1426
1424
|
this._wasDeleted = true;
|
|
1427
1425
|
}
|
|
1428
1426
|
catch (err) {
|
|
@@ -10,6 +10,7 @@ export const flags = {
|
|
|
10
10
|
*/
|
|
11
11
|
//y1 - add parameter all to deleteMany, and updateMany
|
|
12
12
|
//p1 - fix query docs to also explain how it can be used for infinite scroll and pagination.
|
|
13
|
+
//p1 - when like doesn't have a string - don't send it to the db
|
|
13
14
|
//y1 - 'test expression columns without aliases'
|
|
14
15
|
//y1 - live query update waits for last
|
|
15
16
|
//p1 - add luid - it's cool for order by. - NO
|
package/package.json
CHANGED
package/remult-knex/index.js
CHANGED
|
@@ -465,10 +465,10 @@ var KnexEntityDataProvider = /** @class */ (function () {
|
|
|
465
465
|
result = _d.sent();
|
|
466
466
|
newId_1 = result[0];
|
|
467
467
|
return [3 /*break*/, 14];
|
|
468
|
-
case 12: return [4 /*yield*/, insert.returning(this.entity.idMetadata.field.
|
|
468
|
+
case 12: return [4 /*yield*/, insert.returning(this.entity.idMetadata.field.dbName)];
|
|
469
469
|
case 13:
|
|
470
470
|
result = _d.sent();
|
|
471
|
-
newId_1 = result[0][this.entity.idMetadata.field.
|
|
471
|
+
newId_1 = result[0][this.entity.idMetadata.field.dbName];
|
|
472
472
|
_d.label = 14;
|
|
473
473
|
case 14: return [2 /*return*/, this.find({
|
|
474
474
|
where: new filter_interfaces_js_1.Filter(function (x) {
|
|
@@ -17,7 +17,7 @@ var LiveQueryPublisher = /** @class */ (function () {
|
|
|
17
17
|
var _this = this;
|
|
18
18
|
return tslib_1.__generator(this, function (_a) {
|
|
19
19
|
switch (_a.label) {
|
|
20
|
-
case 0: return [4 /*yield*/, this.
|
|
20
|
+
case 0: return [4 /*yield*/, this.liveQueryStorage().forEach(entityKey, function (_a) { return tslib_1.__awaiter(_this, [_a], void 0, function (_b) {
|
|
21
21
|
var query;
|
|
22
22
|
var _this = this;
|
|
23
23
|
var q = _b.query, setData = _b.setData;
|
|
@@ -117,7 +117,7 @@ var LiveQueryPublisher = /** @class */ (function () {
|
|
|
117
117
|
return [2 /*return*/];
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
}); })
|
|
120
|
+
}); })];
|
|
121
121
|
case 1:
|
|
122
122
|
_a.sent();
|
|
123
123
|
return [2 /*return*/];
|
|
@@ -2100,7 +2100,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
2100
2100
|
return tslib_1.__generator(this, function (_t) {
|
|
2101
2101
|
switch (_t.label) {
|
|
2102
2102
|
case 0:
|
|
2103
|
-
_t.trys.push([0, ,
|
|
2103
|
+
_t.trys.push([0, , 41, 42]);
|
|
2104
2104
|
if (this._saving)
|
|
2105
2105
|
throw new Error('cannot save while entity is already saving');
|
|
2106
2106
|
this._saving = true;
|
|
@@ -2181,7 +2181,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
2181
2181
|
isNew = this.isNew();
|
|
2182
2182
|
_t.label = 13;
|
|
2183
2183
|
case 13:
|
|
2184
|
-
_t.trys.push([13,
|
|
2184
|
+
_t.trys.push([13, 38, , 40]);
|
|
2185
2185
|
(_r = this._subscribers) === null || _r === void 0 ? void 0 : _r.reportChanged();
|
|
2186
2186
|
if (!this.isNew()) return [3 /*break*/, 19];
|
|
2187
2187
|
if (!doNotSave_1) return [3 /*break*/, 16];
|
|
@@ -2267,22 +2267,23 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
2267
2267
|
}
|
|
2268
2268
|
finally { if (e_33) throw e_33.error; }
|
|
2269
2269
|
return [7 /*endfinally*/];
|
|
2270
|
-
case 36:
|
|
2271
|
-
|
|
2270
|
+
case 36: return [4 /*yield*/, this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: false }])];
|
|
2271
|
+
case 37:
|
|
2272
|
+
_t.sent();
|
|
2272
2273
|
this.saveOriginalData();
|
|
2273
2274
|
this._isNew = false;
|
|
2274
2275
|
return [2 /*return*/, this.instance];
|
|
2275
|
-
case
|
|
2276
|
+
case 38:
|
|
2276
2277
|
err_1 = _t.sent();
|
|
2277
2278
|
return [4 /*yield*/, this.catchSaveErrors(err_1)];
|
|
2278
|
-
case
|
|
2279
|
-
case
|
|
2280
|
-
case
|
|
2279
|
+
case 39: throw _t.sent();
|
|
2280
|
+
case 40: return [3 /*break*/, 42];
|
|
2281
|
+
case 41:
|
|
2281
2282
|
this.isLoading = false;
|
|
2282
2283
|
this._reportChangedToEntityAndFields();
|
|
2283
2284
|
this._saving = false;
|
|
2284
2285
|
return [7 /*endfinally*/];
|
|
2285
|
-
case
|
|
2286
|
+
case 42: return [2 /*return*/];
|
|
2286
2287
|
}
|
|
2287
2288
|
});
|
|
2288
2289
|
});
|
|
@@ -2381,7 +2382,7 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
2381
2382
|
this.__assertValidity();
|
|
2382
2383
|
_e.label = 3;
|
|
2383
2384
|
case 3:
|
|
2384
|
-
_e.trys.push([3,
|
|
2385
|
+
_e.trys.push([3, 17, , 19]);
|
|
2385
2386
|
if (!doDelete) return [3 /*break*/, 5];
|
|
2386
2387
|
return [4 /*yield*/, this.edp.delete(this.id)];
|
|
2387
2388
|
case 4:
|
|
@@ -2422,17 +2423,16 @@ var rowHelperImplementation = /** @class */ (function (_super) {
|
|
|
2422
2423
|
}
|
|
2423
2424
|
finally { if (e_36) throw e_36.error; }
|
|
2424
2425
|
return [7 /*endfinally*/];
|
|
2425
|
-
case 15:
|
|
2426
|
-
this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [
|
|
2427
|
-
{ id: this.getId(), oldId: this.getOriginalId(), deleted: true },
|
|
2428
|
-
]);
|
|
2429
|
-
this._wasDeleted = true;
|
|
2430
|
-
return [3 /*break*/, 18];
|
|
2426
|
+
case 15: return [4 /*yield*/, this.repo._remult.liveQueryPublisher.itemChanged(this.repo.metadata.key, [{ id: this.getId(), oldId: this.getOriginalId(), deleted: true }])];
|
|
2431
2427
|
case 16:
|
|
2428
|
+
_e.sent();
|
|
2429
|
+
this._wasDeleted = true;
|
|
2430
|
+
return [3 /*break*/, 19];
|
|
2431
|
+
case 17:
|
|
2432
2432
|
err_2 = _e.sent();
|
|
2433
2433
|
return [4 /*yield*/, this.catchSaveErrors(err_2)];
|
|
2434
|
-
case
|
|
2435
|
-
case
|
|
2434
|
+
case 18: throw _e.sent();
|
|
2435
|
+
case 19: return [2 /*return*/];
|
|
2436
2436
|
}
|
|
2437
2437
|
});
|
|
2438
2438
|
});
|
package/src/remult3/remult3.js
CHANGED
|
@@ -13,6 +13,7 @@ exports.flags = {
|
|
|
13
13
|
*/
|
|
14
14
|
//y1 - add parameter all to deleteMany, and updateMany
|
|
15
15
|
//p1 - fix query docs to also explain how it can be used for infinite scroll and pagination.
|
|
16
|
+
//p1 - when like doesn't have a string - don't send it to the db
|
|
16
17
|
//y1 - 'test expression columns without aliases'
|
|
17
18
|
//y1 - live query update waits for last
|
|
18
19
|
//p1 - add luid - it's cool for order by. - NO
|