Comparing version 0.1.16 to 0.1.17
{ | ||
"name": "remult", | ||
"version": "0.1.16", | ||
"version": "0.1.17", | ||
"description": "remult core lib", | ||
@@ -5,0 +5,0 @@ "homepage": "https://remult.github.io/", |
@@ -232,4 +232,5 @@ "use strict"; | ||
switch (_a.label) { | ||
case 0: | ||
this.repository.getEntityRef(row)._updateEntityBasedOnApi(body); | ||
case 0: return [4 /*yield*/, this.repository.getEntityRef(row)._updateEntityBasedOnApi(body)]; | ||
case 1: | ||
_a.sent(); | ||
if (!this._getApiSettings().allowUpdate(row)) { | ||
@@ -240,3 +241,3 @@ response.forbidden(); | ||
return [4 /*yield*/, this.repository.getEntityRef(row).save()]; | ||
case 1: | ||
case 2: | ||
_a.sent(); | ||
@@ -319,5 +320,7 @@ response.success(this.repository.getEntityRef(row).toApiJson()); | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
_a.trys.push([0, 3, , 4]); | ||
newr = this.repository.create(); | ||
this.repository.getEntityRef(newr)._updateEntityBasedOnApi(body); | ||
return [4 /*yield*/, this.repository.getEntityRef(newr)._updateEntityBasedOnApi(body)]; | ||
case 1: | ||
_a.sent(); | ||
if (!this._getApiSettings().allowInsert(newr)) { | ||
@@ -328,11 +331,11 @@ response.forbidden(); | ||
return [4 /*yield*/, this.repository.getEntityRef(newr).save()]; | ||
case 1: | ||
case 2: | ||
_a.sent(); | ||
response.created(this.repository.getEntityRef(newr).toApiJson()); | ||
return [3 /*break*/, 3]; | ||
case 2: | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_4 = _a.sent(); | ||
response.error(err_4); | ||
return [3 /*break*/, 3]; | ||
case 3: return [2 /*return*/]; | ||
return [3 /*break*/, 4]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
@@ -339,0 +342,0 @@ }); |
@@ -66,3 +66,3 @@ import { FieldMetadata, FieldOptions, ValueListItem } from "../column-interfaces"; | ||
toApiJson(): any; | ||
_updateEntityBasedOnApi(body: any): void; | ||
_updateEntityBasedOnApi(body: any): Promise<void>; | ||
} | ||
@@ -69,0 +69,0 @@ export declare class rowHelperImplementation<T> extends rowHelperBase<T> implements EntityRef<T> { |
@@ -258,11 +258,13 @@ "use strict"; | ||
_a.args = _e.sent(); | ||
if (!context_1.allEntities.includes(constructor)) return [3 /*break*/, 11]; | ||
if (!context_1.allEntities.includes(constructor)) return [3 /*break*/, 13]; | ||
repo_1 = context_2.for(constructor); | ||
y = void 0; | ||
if (!d.rowInfo.isNewRow) return [3 /*break*/, 2]; | ||
if (!d.rowInfo.isNewRow) return [3 /*break*/, 3]; | ||
y = repo_1.create(); | ||
rowHelper = repo_1.getEntityRef(y); | ||
rowHelper._updateEntityBasedOnApi(d.rowInfo.data); | ||
return [3 /*break*/, 4]; | ||
case 2: return [4 /*yield*/, repo_1.find({ | ||
return [4 /*yield*/, rowHelper._updateEntityBasedOnApi(d.rowInfo.data)]; | ||
case 2: | ||
_e.sent(); | ||
return [3 /*break*/, 6]; | ||
case 3: return [4 /*yield*/, repo_1.find({ | ||
where: function (x) { | ||
@@ -275,3 +277,3 @@ var where = repo_1.metadata.idMetadata.getIdFilter(d.rowInfo.id); | ||
})]; | ||
case 3: | ||
case 4: | ||
rows = _e.sent(); | ||
@@ -281,5 +283,7 @@ if (rows.length != 1) | ||
y = rows[0]; | ||
repo_1.getEntityRef(y)._updateEntityBasedOnApi(d.rowInfo.data); | ||
_e.label = 4; | ||
case 4: | ||
return [4 /*yield*/, repo_1.getEntityRef(y)._updateEntityBasedOnApi(d.rowInfo.data)]; | ||
case 5: | ||
_e.sent(); | ||
_e.label = 6; | ||
case 6: | ||
if (!context_2.isAllowedForInstance(y, allowed)) | ||
@@ -289,14 +293,14 @@ throw 'not allowed'; | ||
return [4 /*yield*/, defs.__validateEntity()]; | ||
case 5: | ||
case 7: | ||
_e.sent(); | ||
_e.label = 6; | ||
case 6: | ||
_e.trys.push([6, 9, , 10]); | ||
_e.label = 8; | ||
case 8: | ||
_e.trys.push([8, 11, , 12]); | ||
_b = {}; | ||
return [4 /*yield*/, originalMethod.apply(y, d.args)]; | ||
case 7: | ||
case 9: | ||
_b.result = _e.sent(); | ||
_c = {}; | ||
return [4 /*yield*/, defs.toApiJson()]; | ||
case 8: | ||
case 10: | ||
r_1 = (_b.rowInfo = (_c.data = _e.sent(), | ||
@@ -308,13 +312,12 @@ _c.isNewRow = defs.isNew(), | ||
_b); | ||
return [3 /*break*/, 10]; | ||
case 9: | ||
return [3 /*break*/, 12]; | ||
case 11: | ||
err_4 = _e.sent(); | ||
throw defs.catchSaveErrors(err_4); | ||
case 10: return [3 /*break*/, 18]; | ||
case 11: | ||
case 12: return [3 /*break*/, 20]; | ||
case 13: | ||
y = new constructor(context_2, ds); | ||
controllerRef = remult3_1.getControllerRef(y, context_2); | ||
controllerRef._updateEntityBasedOnApi(d.fields); | ||
return [4 /*yield*/, Promise.all(tslib_1.__spread(controllerRef.fields).map(function (x) { return x.load(); }))]; | ||
case 12: | ||
return [4 /*yield*/, controllerRef._updateEntityBasedOnApi(d.fields)]; | ||
case 14: | ||
_e.sent(); | ||
@@ -324,20 +327,20 @@ if (!context_2.isAllowedForInstance(y, allowed)) | ||
return [4 /*yield*/, controllerRef.__validateEntity()]; | ||
case 13: | ||
case 15: | ||
_e.sent(); | ||
_e.label = 14; | ||
case 14: | ||
_e.trys.push([14, 17, , 18]); | ||
_e.label = 16; | ||
case 16: | ||
_e.trys.push([16, 19, , 20]); | ||
_d = {}; | ||
return [4 /*yield*/, originalMethod.apply(y, d.args)]; | ||
case 15: | ||
case 17: | ||
_d.result = _e.sent(); | ||
return [4 /*yield*/, controllerRef.toApiJson()]; | ||
case 16: | ||
case 18: | ||
r_1 = (_d.fields = _e.sent(), | ||
_d); | ||
return [3 /*break*/, 18]; | ||
case 17: | ||
return [3 /*break*/, 20]; | ||
case 19: | ||
err_5 = _e.sent(); | ||
throw controllerRef.catchSaveErrors(err_5); | ||
case 18: return [2 /*return*/]; | ||
case 20: return [2 /*return*/]; | ||
} | ||
@@ -385,3 +388,3 @@ }); | ||
case 0: | ||
if (!!exports.actionInfo.runningOnServer) return [3 /*break*/, 15]; | ||
if (!!exports.actionInfo.runningOnServer) return [3 /*break*/, 16]; | ||
self_1 = this; | ||
@@ -436,3 +439,3 @@ args = prepareArgsToSend(types, args); | ||
throw err_6; | ||
case 7: return [3 /*break*/, 14]; | ||
case 7: return [3 /*break*/, 15]; | ||
case 8: | ||
@@ -442,3 +445,3 @@ defs = remult3_1.getControllerRef(self_1, undefined); | ||
case 9: | ||
_h.trys.push([9, 13, , 14]); | ||
_h.trys.push([9, 14, , 15]); | ||
return [4 /*yield*/, defs.__validateEntity()]; | ||
@@ -469,11 +472,13 @@ case 10: | ||
r = _h.sent(); | ||
defs._updateEntityBasedOnApi(r.fields); | ||
return [4 /*yield*/, defs._updateEntityBasedOnApi(r.fields)]; | ||
case 13: | ||
_h.sent(); | ||
return [2 /*return*/, r.result]; | ||
case 13: | ||
case 14: | ||
e_2 = _h.sent(); | ||
throw defs.catchSaveErrors(e_2); | ||
case 14: return [3 /*break*/, 17]; | ||
case 15: return [4 /*yield*/, originalMethod.apply(this, args)]; | ||
case 16: return [2 /*return*/, (_h.sent())]; | ||
case 17: return [2 /*return*/]; | ||
case 15: return [3 /*break*/, 18]; | ||
case 16: return [4 /*yield*/, originalMethod.apply(this, args)]; | ||
case 17: return [2 /*return*/, (_h.sent())]; | ||
case 18: return [2 /*return*/]; | ||
} | ||
@@ -480,0 +485,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
576276
8744