remult 0.20.0-exp.7 → 0.20.0-exp.9

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.
@@ -291,7 +291,7 @@ export class RemultServerImplementation {
291
291
  });
292
292
  }
293
293
  }
294
- await what(remult, myReq, myRes, req, origRes);
294
+ await what(remult, myReq, myRes, genReq, origRes);
295
295
  });
296
296
  };
297
297
  }
@@ -15,7 +15,7 @@ export declare class DataApi<T = any> {
15
15
  findOptions: FindOptions<T>;
16
16
  }>;
17
17
  getArray(response: DataApiResponse, request: DataApiRequest, filterBody?: any): Promise<void>;
18
- liveQuery(response: DataApiResponse, request: DataApiRequest, filterBody: any, serializeRequest: () => any, queryChannel: string): Promise<void>;
18
+ liveQuery(response: DataApiResponse, request: DataApiRequest, filterBody: any, serializeRequest: () => Promise<any>, queryChannel: string): Promise<void>;
19
19
  private buildWhere;
20
20
  private doOnId;
21
21
  put(response: DataApiResponse, id: any, body: any): Promise<void>;
@@ -128,7 +128,7 @@ export class DataApi {
128
128
  try {
129
129
  const r = await this.getArrayImpl(response, request, filterBody);
130
130
  const data = {
131
- requestJson: serializeRequest(),
131
+ requestJson: await serializeRequest(),
132
132
  findOptionsJson: findOptionsToJson(r.findOptions, this.repository.metadata),
133
133
  lastIds: r.r.map(y => this.repository.metadata.idMetadata.getId(y))
134
134
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remult",
3
- "version": "0.20.0-exp.7",
3
+ "version": "0.20.0-exp.9",
4
4
  "description": "A CRUD framework for full-stack TypeScript",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -525,7 +525,7 @@ var RemultServerImplementation = /** @class */ (function () {
525
525
  case 5:
526
526
  _b.sent();
527
527
  _b.label = 6;
528
- case 6: return [4 /*yield*/, what(remult, myReq, myRes, req, origRes)];
528
+ case 6: return [4 /*yield*/, what(remult, myReq, myRes, genReq, origRes)];
529
529
  case 7:
530
530
  _b.sent();
531
531
  return [2 /*return*/];
package/src/data-api.d.ts CHANGED
@@ -15,7 +15,7 @@ export declare class DataApi<T = any> {
15
15
  findOptions: FindOptions<T>;
16
16
  }>;
17
17
  getArray(response: DataApiResponse, request: DataApiRequest, filterBody?: any): Promise<void>;
18
- liveQuery(response: DataApiResponse, request: DataApiRequest, filterBody: any, serializeRequest: () => any, queryChannel: string): Promise<void>;
18
+ liveQuery(response: DataApiResponse, request: DataApiRequest, filterBody: any, serializeRequest: () => Promise<any>, queryChannel: string): Promise<void>;
19
19
  private buildWhere;
20
20
  private doOnId;
21
21
  put(response: DataApiResponse, id: any, body: any): Promise<void>;
package/src/data-api.js CHANGED
@@ -210,42 +210,45 @@ var DataApi = /** @class */ (function () {
210
210
  DataApi.prototype.liveQuery = function (response, request, filterBody, serializeRequest, queryChannel) {
211
211
  return tslib_1.__awaiter(this, void 0, void 0, function () {
212
212
  var r, data, err_3;
213
+ var _a;
213
214
  var _this = this;
214
- return tslib_1.__generator(this, function (_a) {
215
- switch (_a.label) {
215
+ return tslib_1.__generator(this, function (_b) {
216
+ switch (_b.label) {
216
217
  case 0:
217
218
  if (!this.repository.metadata.apiReadAllowed) {
218
219
  response.forbidden();
219
220
  return [2 /*return*/];
220
221
  }
221
- _a.label = 1;
222
+ _b.label = 1;
222
223
  case 1:
223
- _a.trys.push([1, 4, , 5]);
224
+ _b.trys.push([1, 5, , 6]);
224
225
  return [4 /*yield*/, this.getArrayImpl(response, request, filterBody)];
225
226
  case 2:
226
- r = _a.sent();
227
- data = {
228
- requestJson: serializeRequest(),
229
- findOptionsJson: rest_data_provider_1.findOptionsToJson(r.findOptions, this.repository.metadata),
230
- lastIds: r.r.map(function (y) { return _this.repository.metadata.idMetadata.getId(y); })
231
- };
227
+ r = _b.sent();
228
+ _a = {};
229
+ return [4 /*yield*/, serializeRequest()];
230
+ case 3:
231
+ data = (_a.requestJson = _b.sent(),
232
+ _a.findOptionsJson = rest_data_provider_1.findOptionsToJson(r.findOptions, this.repository.metadata),
233
+ _a.lastIds = r.r.map(function (y) { return _this.repository.metadata.idMetadata.getId(y); }),
234
+ _a);
232
235
  return [4 /*yield*/, this.remult.liveQueryStorage.add({
233
236
  entityKey: this.repository.metadata.key,
234
237
  id: queryChannel,
235
238
  data: data
236
239
  })];
237
- case 3:
238
- _a.sent();
239
- response.success(r.r);
240
- return [3 /*break*/, 5];
241
240
  case 4:
242
- err_3 = _a.sent();
241
+ _b.sent();
242
+ response.success(r.r);
243
+ return [3 /*break*/, 6];
244
+ case 5:
245
+ err_3 = _b.sent();
243
246
  if (err_3.isForbiddenError)
244
247
  response.forbidden();
245
248
  else
246
249
  response.error(err_3);
247
- return [3 /*break*/, 5];
248
- case 5: return [2 /*return*/];
250
+ return [3 /*break*/, 6];
251
+ case 6: return [2 /*return*/];
249
252
  }
250
253
  });
251
254
  });