remult 3.5.0-next.1 → 3.5.0-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.
- package/esm/remult-knex/index.js +29 -6
- package/esm/server/remult-api-server.js +13 -5
- package/esm/src/buildRestDataProvider.js +4 -4
- package/esm/src/context.js +1 -1
- package/esm/src/data-providers/array-entity-data-provider.js +4 -4
- package/esm/src/data-providers/rest-data-provider-using-fetch.js +11 -4
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +35 -4
- package/esm/src/filter/filter-interfaces.js +18 -4
- package/esm/src/remult-proxy.js +12 -0
- package/esm/src/remult-static.js +1 -0
- package/esm/src/remult3/RepositoryImplementation.js +24 -0
- package/esm/src/remult3/remult3.js +2 -0
- package/esm/src/server-action.js +43 -14
- package/index.d.ts +3 -2
- package/package.json +1 -1
- package/remult-knex/index.js +29 -6
- package/server/remult-api-server.d.ts +16 -0
- package/server/remult-api-server.js +18 -11
- package/src/buildRestDataProvider.d.ts +1 -1
- package/src/buildRestDataProvider.js +5 -5
- package/src/context.js +1 -1
- package/src/data-providers/array-entity-data-provider.js +4 -4
- package/src/data-providers/rest-data-provider-using-fetch.d.ts +1 -1
- package/src/data-providers/rest-data-provider-using-fetch.js +10 -3
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +8 -0
- package/src/filter/filter-consumer-bridge-to-sql-request.js +58 -19
- package/src/filter/filter-interfaces.js +19 -2
- package/src/remult-proxy.js +28 -0
- package/src/remult-static.d.ts +2 -0
- package/src/remult-static.js +1 -0
- package/src/remult3/RepositoryImplementation.d.ts +7 -0
- package/src/remult3/RepositoryImplementation.js +51 -0
- package/src/remult3/remult3.d.ts +62 -4
- package/src/remult3/remult3.js +2 -0
- package/src/server-action.d.ts +34 -2
- package/src/server-action.js +195 -115
package/src/server-action.js
CHANGED
|
@@ -143,28 +143,37 @@ var myServerAction = /** @class */ (function (_super) {
|
|
|
143
143
|
result = { data: {} };
|
|
144
144
|
ds = remult.dataProvider;
|
|
145
145
|
return [4 /*yield*/, decideTransaction(remult, this.options, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
146
|
-
var _a, _b, err_2;
|
|
147
|
-
return tslib_1.__generator(this, function (
|
|
148
|
-
switch (
|
|
146
|
+
var _a, _b, _c, _d, _e, err_2;
|
|
147
|
+
return tslib_1.__generator(this, function (_f) {
|
|
148
|
+
switch (_f.label) {
|
|
149
149
|
case 0:
|
|
150
150
|
if (!remult.isAllowedForInstance(undefined, this.options.allowed))
|
|
151
151
|
throw new ForbiddenError();
|
|
152
152
|
_a = info;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
_b = prepareReceivedArgs;
|
|
154
|
+
_c = [this.types()];
|
|
155
|
+
return [4 /*yield*/, fromWire(info.args, remult, this.options, 'args')];
|
|
156
|
+
case 1: return [4 /*yield*/, _b.apply(void 0, _c.concat([_f.sent(), remult,
|
|
157
|
+
ds,
|
|
158
|
+
res]))];
|
|
157
159
|
case 2:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return [4 /*yield*/, this.originalMethod(info.args)];
|
|
160
|
+
_a.args = _f.sent();
|
|
161
|
+
_f.label = 3;
|
|
161
162
|
case 3:
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
_f.trys.push([3, 6, , 7]);
|
|
164
|
+
_d = result;
|
|
165
|
+
_e = toWire;
|
|
166
|
+
return [4 /*yield*/, this.originalMethod(info.args)];
|
|
167
|
+
case 4: return [4 /*yield*/, _e.apply(void 0, [_f.sent(), remult,
|
|
168
|
+
this.options,
|
|
169
|
+
'result'])];
|
|
170
|
+
case 5:
|
|
171
|
+
_d.data = _f.sent();
|
|
172
|
+
return [3 /*break*/, 7];
|
|
173
|
+
case 6:
|
|
174
|
+
err_2 = _f.sent();
|
|
166
175
|
throw err_2;
|
|
167
|
-
case
|
|
176
|
+
case 7: return [2 /*return*/];
|
|
168
177
|
}
|
|
169
178
|
});
|
|
170
179
|
}); })];
|
|
@@ -228,22 +237,41 @@ function BackendMethod(options) {
|
|
|
228
237
|
if (target.prototype !== undefined) {
|
|
229
238
|
// if types are undefined - you've forgot to set: "emitDecoratorMetadata":true
|
|
230
239
|
var serverAction_1 = new myServerAction(((options === null || options === void 0 ? void 0 : options.apiPrefix) ? options.apiPrefix + '/' : '') + key, function () { return getTypes(); }, options, function (args) { return originalMethod.apply(undefined, args); });
|
|
231
|
-
serverAction_1.doWork = function (args, self,
|
|
240
|
+
serverAction_1.doWork = function (args, self, caller) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
241
|
+
var calling, url, http, sent, _a;
|
|
232
242
|
var _this = this;
|
|
233
|
-
return tslib_1.__generator(this, function (
|
|
234
|
-
switch (
|
|
243
|
+
return tslib_1.__generator(this, function (_b) {
|
|
244
|
+
switch (_b.label) {
|
|
235
245
|
case 0:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
calling = caller !== null && caller !== void 0 ? caller : remult_proxy_js_1.remult;
|
|
247
|
+
url = calling.apiClient.url;
|
|
248
|
+
http = (0, buildRestDataProvider_js_1.buildRestDataProvider)(calling.apiClient.httpClient);
|
|
249
|
+
return [4 /*yield*/, toWire(prepareArgsToSend(getTypes(), args), calling, options, 'args')];
|
|
250
|
+
case 1:
|
|
251
|
+
sent = _b.sent();
|
|
252
|
+
if (!(options.blockUser === false)) return [3 /*break*/, 3];
|
|
253
|
+
return [4 /*yield*/, remult_static_js_1.remultStatic.actionInfo.runActionWithoutBlockingUI(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
254
|
+
var _a;
|
|
255
|
+
return tslib_1.__generator(this, function (_b) {
|
|
256
|
+
switch (_b.label) {
|
|
257
|
+
case 0:
|
|
258
|
+
_a = fromWire;
|
|
259
|
+
return [4 /*yield*/, serverAction_1.run({ args: sent }, url, http)];
|
|
260
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [(_b.sent()).data,
|
|
261
|
+
calling,
|
|
262
|
+
options,
|
|
263
|
+
'result'])];
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}); })];
|
|
267
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
268
|
+
case 3:
|
|
269
|
+
_a = fromWire;
|
|
270
|
+
return [4 /*yield*/, serverAction_1.run({ args: sent }, url, http)];
|
|
271
|
+
case 4: return [2 /*return*/, _a.apply(void 0, [(_b.sent()).data,
|
|
272
|
+
calling,
|
|
273
|
+
options,
|
|
274
|
+
'result'])];
|
|
247
275
|
}
|
|
248
276
|
});
|
|
249
277
|
}); };
|
|
@@ -296,29 +324,32 @@ function BackendMethod(options) {
|
|
|
296
324
|
'/' +
|
|
297
325
|
((options === null || options === void 0 ? void 0 : options.apiPrefix) ? options.apiPrefix + '/' : '') +
|
|
298
326
|
key, options ? ((_b = options.queue) !== null && _b !== void 0 ? _b : false) : false, options.allowed, function (d, req, res) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
299
|
-
var allowed, remult_1, r_1, err_3;
|
|
327
|
+
var allowed, remult_1, _a, r_1, err_3;
|
|
300
328
|
var _this = this;
|
|
301
|
-
return tslib_1.__generator(this, function (
|
|
302
|
-
switch (
|
|
329
|
+
return tslib_1.__generator(this, function (_b) {
|
|
330
|
+
switch (_b.label) {
|
|
303
331
|
case 0:
|
|
304
|
-
d.args = d.args.map(function (x) { return (isCustomUndefined(x) ? undefined : x); });
|
|
305
332
|
allowed = options.allowed;
|
|
306
|
-
|
|
333
|
+
_b.label = 1;
|
|
307
334
|
case 1:
|
|
308
|
-
|
|
335
|
+
_b.trys.push([1, 4, , 5]);
|
|
309
336
|
remult_1 = req;
|
|
337
|
+
_a = d;
|
|
338
|
+
return [4 /*yield*/, fromWire(d.args, remult_1, options, 'args')];
|
|
339
|
+
case 2:
|
|
340
|
+
_a.args = (_b.sent()).map(function (x) { return (isCustomUndefined(x) ? undefined : x); });
|
|
310
341
|
return [4 /*yield*/, decideTransaction(remult_1, options, function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
311
|
-
var _a, repo, y, rowInfo, rowHelper, rows, defs, err_4, y, controllerRef, err_5;
|
|
312
|
-
var
|
|
313
|
-
var
|
|
314
|
-
return tslib_1.__generator(this, function (
|
|
315
|
-
switch (
|
|
342
|
+
var _a, repo, y, rowInfo, rowHelper, rows, defs, _b, err_4, y, controllerRef, _c, err_5;
|
|
343
|
+
var _d, _e, _f;
|
|
344
|
+
var _g;
|
|
345
|
+
return tslib_1.__generator(this, function (_h) {
|
|
346
|
+
switch (_h.label) {
|
|
316
347
|
case 0:
|
|
317
348
|
_a = d;
|
|
318
349
|
return [4 /*yield*/, prepareReceivedArgs(getTypes(), d.args, remult_1, remult_1.dataProvider, res)];
|
|
319
350
|
case 1:
|
|
320
|
-
_a.args =
|
|
321
|
-
if (!remult_static_js_1.remultStatic.allEntities.includes(constructor)) return [3 /*break*/,
|
|
351
|
+
_a.args = _h.sent();
|
|
352
|
+
if (!remult_static_js_1.remultStatic.allEntities.includes(constructor)) return [3 /*break*/, 14];
|
|
322
353
|
repo = remult_1.repo(constructor);
|
|
323
354
|
y = void 0;
|
|
324
355
|
rowInfo = d.rowInfo;
|
|
@@ -327,91 +358,107 @@ function BackendMethod(options) {
|
|
|
327
358
|
rowHelper = repo.getEntityRef(y);
|
|
328
359
|
return [4 /*yield*/, rowHelper._updateEntityBasedOnApi(rowInfo.data)];
|
|
329
360
|
case 2:
|
|
330
|
-
|
|
361
|
+
_h.sent();
|
|
331
362
|
return [3 /*break*/, 6];
|
|
332
363
|
case 3: return [4 /*yield*/, repo.find({
|
|
333
|
-
where: tslib_1.__assign(tslib_1.__assign({}, repo.metadata.idMetadata.getIdFilter(rowInfo.id)), { $and: [(
|
|
334
|
-
})
|
|
364
|
+
where: tslib_1.__assign(tslib_1.__assign({}, repo.metadata.idMetadata.getIdFilter(rowInfo.id)), { $and: [(_g = repo.metadata.options.apiPrefilter) !== null && _g !== void 0 ? _g : {}] }),
|
|
365
|
+
})
|
|
366
|
+
// The client sent a stale row id, so this is a 400 even when
|
|
367
|
+
// defaultErrorStatus is 500.
|
|
368
|
+
];
|
|
335
369
|
case 4:
|
|
336
|
-
rows =
|
|
370
|
+
rows = _h.sent();
|
|
371
|
+
// The client sent a stale row id, so this is a 400 even when
|
|
372
|
+
// defaultErrorStatus is 500.
|
|
337
373
|
if (rows.length != 1)
|
|
338
|
-
throw
|
|
374
|
+
throw {
|
|
375
|
+
message: 'not found or too many matches',
|
|
376
|
+
httpStatusCode: 400,
|
|
377
|
+
};
|
|
339
378
|
y = rows[0];
|
|
340
379
|
return [4 /*yield*/, repo.getEntityRef(y)._updateEntityBasedOnApi(rowInfo.data)];
|
|
341
380
|
case 5:
|
|
342
|
-
|
|
343
|
-
|
|
381
|
+
_h.sent();
|
|
382
|
+
_h.label = 6;
|
|
344
383
|
case 6:
|
|
345
384
|
if (!remult_1.isAllowedForInstance(y, allowed))
|
|
346
385
|
throw new ForbiddenError();
|
|
347
386
|
defs = (0, getEntityRef_js_1.getEntityRef)(y);
|
|
348
387
|
return [4 /*yield*/, defs.__validateEntity()];
|
|
349
388
|
case 7:
|
|
350
|
-
|
|
351
|
-
|
|
389
|
+
_h.sent();
|
|
390
|
+
_h.label = 8;
|
|
352
391
|
case 8:
|
|
353
|
-
|
|
354
|
-
|
|
392
|
+
_h.trys.push([8, 12, , 13]);
|
|
393
|
+
_d = {};
|
|
394
|
+
_b = toWire;
|
|
355
395
|
return [4 /*yield*/, originalMethod.apply(y, d.args)];
|
|
356
|
-
case 9:
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return [4 /*yield*/, defs.toApiJson()];
|
|
396
|
+
case 9: return [4 /*yield*/, _b.apply(void 0, [_h.sent(), remult_1,
|
|
397
|
+
options,
|
|
398
|
+
'result'])];
|
|
360
399
|
case 10:
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
_c.id = defs.getOriginalId(),
|
|
365
|
-
_c),
|
|
366
|
-
_b);
|
|
367
|
-
return [3 /*break*/, 12];
|
|
400
|
+
_d.result = _h.sent();
|
|
401
|
+
_e = {};
|
|
402
|
+
return [4 /*yield*/, defs.toApiJson()];
|
|
368
403
|
case 11:
|
|
369
|
-
|
|
404
|
+
r_1 = (_d.rowInfo = (_e.data = _h.sent(),
|
|
405
|
+
_e.isNewRow = defs.isNew(),
|
|
406
|
+
_e.wasChanged = defs.wasChanged(),
|
|
407
|
+
_e.id = defs.getOriginalId(),
|
|
408
|
+
_e),
|
|
409
|
+
_d);
|
|
410
|
+
return [3 /*break*/, 13];
|
|
411
|
+
case 12:
|
|
412
|
+
err_4 = _h.sent();
|
|
370
413
|
throw defs.catchSaveErrors(err_4);
|
|
371
|
-
case
|
|
372
|
-
case
|
|
414
|
+
case 13: return [3 /*break*/, 22];
|
|
415
|
+
case 14:
|
|
373
416
|
y = new constructor(remult_1, remult_1.dataProvider);
|
|
374
417
|
controllerRef = (0, RepositoryImplementation_js_1.getControllerRef)(y, remult_1);
|
|
375
418
|
return [4 /*yield*/, controllerRef._updateEntityBasedOnApi(d.fields)];
|
|
376
|
-
case
|
|
377
|
-
|
|
419
|
+
case 15:
|
|
420
|
+
_h.sent();
|
|
378
421
|
if (!remult_1.isAllowedForInstance(y, allowed))
|
|
379
422
|
throw new ForbiddenError();
|
|
380
423
|
return [4 /*yield*/, controllerRef.__validateEntity()];
|
|
381
|
-
case 15:
|
|
382
|
-
_f.sent();
|
|
383
|
-
_f.label = 16;
|
|
384
424
|
case 16:
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
return [4 /*yield*/, originalMethod.apply(y, d.args)];
|
|
425
|
+
_h.sent();
|
|
426
|
+
_h.label = 17;
|
|
388
427
|
case 17:
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
428
|
+
_h.trys.push([17, 21, , 22]);
|
|
429
|
+
_f = {};
|
|
430
|
+
_c = toWire;
|
|
431
|
+
return [4 /*yield*/, originalMethod.apply(y, d.args)];
|
|
432
|
+
case 18: return [4 /*yield*/, _c.apply(void 0, [_h.sent(), remult_1,
|
|
433
|
+
options,
|
|
434
|
+
'result'])];
|
|
395
435
|
case 19:
|
|
396
|
-
|
|
436
|
+
_f.result = _h.sent();
|
|
437
|
+
return [4 /*yield*/, controllerRef.toApiJson()];
|
|
438
|
+
case 20:
|
|
439
|
+
r_1 = (_f.fields = _h.sent(),
|
|
440
|
+
_f);
|
|
441
|
+
return [3 /*break*/, 22];
|
|
442
|
+
case 21:
|
|
443
|
+
err_5 = _h.sent();
|
|
397
444
|
throw controllerRef.catchSaveErrors(err_5);
|
|
398
|
-
case
|
|
445
|
+
case 22: return [2 /*return*/];
|
|
399
446
|
}
|
|
400
447
|
});
|
|
401
448
|
}); })];
|
|
402
|
-
case 2:
|
|
403
|
-
_a.sent();
|
|
404
|
-
res.success(r_1);
|
|
405
|
-
return [3 /*break*/, 4];
|
|
406
449
|
case 3:
|
|
407
|
-
|
|
450
|
+
_b.sent();
|
|
451
|
+
res.success(r_1);
|
|
452
|
+
return [3 /*break*/, 5];
|
|
453
|
+
case 4:
|
|
454
|
+
err_3 = _b.sent();
|
|
408
455
|
if (err_3.isForbiddenError)
|
|
409
456
|
// got a problem in next with instance of ForbiddenError - so replaced it with this bool
|
|
410
457
|
res.forbidden();
|
|
411
458
|
else
|
|
412
459
|
res.error(err_3, undefined);
|
|
413
|
-
return [3 /*break*/,
|
|
414
|
-
case
|
|
460
|
+
return [3 /*break*/, 5];
|
|
461
|
+
case 5: return [2 /*return*/];
|
|
415
462
|
}
|
|
416
463
|
});
|
|
417
464
|
}); });
|
|
@@ -430,27 +477,32 @@ function BackendMethod(options) {
|
|
|
430
477
|
finally { if (e_1) throw e_1.error; }
|
|
431
478
|
}
|
|
432
479
|
},
|
|
433
|
-
doWork: function (args, self,
|
|
480
|
+
doWork: function (args, self, caller) {
|
|
434
481
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
435
|
-
var defs, classOptions_1, r, _a, _b, err_6, defs, r, _c, _d, e_2;
|
|
482
|
+
var calling, baseUrl, http, defs, classOptions_1, r, _a, _b, err_6, defs, r, _c, _d, e_2;
|
|
436
483
|
var _e, _f, _g;
|
|
437
484
|
var _h, _j;
|
|
438
485
|
return tslib_1.__generator(this, function (_k) {
|
|
439
486
|
switch (_k.label) {
|
|
440
487
|
case 0:
|
|
441
|
-
|
|
442
|
-
|
|
488
|
+
calling = caller !== null && caller !== void 0 ? caller : remult_proxy_js_1.remult;
|
|
489
|
+
baseUrl = calling.apiClient.url;
|
|
490
|
+
http = (0, buildRestDataProvider_js_1.buildRestDataProvider)(calling.apiClient.httpClient);
|
|
491
|
+
return [4 /*yield*/, toWire(prepareArgsToSend(getTypes(), args), calling, options, 'args')];
|
|
492
|
+
case 1:
|
|
493
|
+
args = _k.sent();
|
|
494
|
+
if (!remult_static_js_1.remultStatic.allEntities.includes(target.constructor)) return [3 /*break*/, 9];
|
|
443
495
|
defs = (0, getEntityRef_js_1.getEntityRef)(self);
|
|
444
496
|
return [4 /*yield*/, defs.__validateEntity()];
|
|
445
|
-
case
|
|
497
|
+
case 2:
|
|
446
498
|
_k.sent();
|
|
447
499
|
classOptions_1 = x.classes.get(self.constructor);
|
|
448
500
|
if (!classOptions_1.key) {
|
|
449
501
|
classOptions_1.key = defs.repository.metadata.key + '_methods';
|
|
450
502
|
}
|
|
451
|
-
_k.label =
|
|
452
|
-
case
|
|
453
|
-
_k.trys.push([
|
|
503
|
+
_k.label = 3;
|
|
504
|
+
case 3:
|
|
505
|
+
_k.trys.push([3, 7, , 8]);
|
|
454
506
|
_b = (_a = new (/** @class */ (function (_super) {
|
|
455
507
|
tslib_1.__extends(class_1, _super);
|
|
456
508
|
function class_1() {
|
|
@@ -466,30 +518,30 @@ function BackendMethod(options) {
|
|
|
466
518
|
};
|
|
467
519
|
_f = {};
|
|
468
520
|
return [4 /*yield*/, defs.toApiJson()];
|
|
469
|
-
case
|
|
521
|
+
case 4: return [4 /*yield*/, _b.apply(_a, [(_e.rowInfo = (_f.data = _k.sent(),
|
|
470
522
|
_f.isNewRow = defs.isNew(),
|
|
471
523
|
_f.wasChanged = defs.wasChanged(),
|
|
472
524
|
_f.id = defs.getOriginalId(),
|
|
473
525
|
_f),
|
|
474
526
|
_e), baseUrl,
|
|
475
527
|
http])];
|
|
476
|
-
case
|
|
528
|
+
case 5:
|
|
477
529
|
r = _k.sent();
|
|
478
530
|
return [4 /*yield*/, defs._updateResultsFromServerAction(r.rowInfo)];
|
|
479
|
-
case 5:
|
|
480
|
-
_k.sent();
|
|
481
|
-
return [2 /*return*/, r.result];
|
|
482
531
|
case 6:
|
|
532
|
+
_k.sent();
|
|
533
|
+
return [2 /*return*/, fromWire(r.result, calling, options, 'result')];
|
|
534
|
+
case 7:
|
|
483
535
|
err_6 = _k.sent();
|
|
484
536
|
throw defs.catchSaveErrors(err_6);
|
|
485
|
-
case
|
|
486
|
-
case 8:
|
|
487
|
-
defs = (0, RepositoryImplementation_js_1.getControllerRef)(self, undefined);
|
|
488
|
-
_k.label = 9;
|
|
537
|
+
case 8: return [3 /*break*/, 16];
|
|
489
538
|
case 9:
|
|
490
|
-
|
|
491
|
-
|
|
539
|
+
defs = (0, RepositoryImplementation_js_1.getControllerRef)(self, undefined);
|
|
540
|
+
_k.label = 10;
|
|
492
541
|
case 10:
|
|
542
|
+
_k.trys.push([10, 15, , 16]);
|
|
543
|
+
return [4 /*yield*/, defs.__validateEntity()];
|
|
544
|
+
case 11:
|
|
493
545
|
_k.sent();
|
|
494
546
|
_d = (_c = new (/** @class */ (function (_super) {
|
|
495
547
|
tslib_1.__extends(class_2, _super);
|
|
@@ -505,19 +557,19 @@ function BackendMethod(options) {
|
|
|
505
557
|
args: args
|
|
506
558
|
};
|
|
507
559
|
return [4 /*yield*/, defs.toApiJson()];
|
|
508
|
-
case
|
|
560
|
+
case 12: return [4 /*yield*/, _d.apply(_c, [(_g.fields = _k.sent(),
|
|
509
561
|
_g), baseUrl,
|
|
510
562
|
http])];
|
|
511
|
-
case
|
|
563
|
+
case 13:
|
|
512
564
|
r = _k.sent();
|
|
513
565
|
return [4 /*yield*/, defs._updateEntityBasedOnApi(r.fields)];
|
|
514
|
-
case 13:
|
|
515
|
-
_k.sent();
|
|
516
|
-
return [2 /*return*/, r.result];
|
|
517
566
|
case 14:
|
|
567
|
+
_k.sent();
|
|
568
|
+
return [2 /*return*/, fromWire(r.result, calling, options, 'result')];
|
|
569
|
+
case 15:
|
|
518
570
|
e_2 = _k.sent();
|
|
519
571
|
throw defs.catchSaveErrors(e_2);
|
|
520
|
-
case
|
|
572
|
+
case 16: return [2 /*return*/];
|
|
521
573
|
}
|
|
522
574
|
});
|
|
523
575
|
});
|
|
@@ -552,6 +604,12 @@ function BackendMethod(options) {
|
|
|
552
604
|
return result;
|
|
553
605
|
};
|
|
554
606
|
}
|
|
607
|
+
Object.defineProperty(BackendMethod, 'serializer', {
|
|
608
|
+
get: function () { return remult_static_js_1.remultStatic.backendMethodSerializer; },
|
|
609
|
+
set: function (value) {
|
|
610
|
+
remult_static_js_1.remultStatic.backendMethodSerializer = value;
|
|
611
|
+
},
|
|
612
|
+
});
|
|
555
613
|
var customUndefined = {
|
|
556
614
|
_isUndefined: true,
|
|
557
615
|
};
|
|
@@ -563,6 +621,28 @@ function registerAction(target, resultMethod) {
|
|
|
563
621
|
function isCustomUndefined(x) {
|
|
564
622
|
return x && x._isUndefined;
|
|
565
623
|
}
|
|
624
|
+
function toWire(value, remult, options, part) {
|
|
625
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
626
|
+
var serializer;
|
|
627
|
+
return tslib_1.__generator(this, function (_a) {
|
|
628
|
+
serializer = remult_static_js_1.remultStatic.backendMethodSerializer;
|
|
629
|
+
return [2 /*return*/, serializer
|
|
630
|
+
? serializer[part].serialize(value, { remult: remult, options: options })
|
|
631
|
+
: value];
|
|
632
|
+
});
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
function fromWire(value, remult, options, part) {
|
|
636
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
637
|
+
var serializer;
|
|
638
|
+
return tslib_1.__generator(this, function (_a) {
|
|
639
|
+
serializer = remult_static_js_1.remultStatic.backendMethodSerializer;
|
|
640
|
+
return [2 /*return*/, serializer
|
|
641
|
+
? serializer[part].deserialize(value, { remult: remult, options: options })
|
|
642
|
+
: value];
|
|
643
|
+
});
|
|
644
|
+
});
|
|
645
|
+
}
|
|
566
646
|
var ProgressListener = /** @class */ (function () {
|
|
567
647
|
function ProgressListener(res) {
|
|
568
648
|
this.res = res;
|