Comparing version 0.3.12 to 0.4.1
{ | ||
"name": "remult", | ||
"version": "0.3.12", | ||
"version": "0.4.1", | ||
"description": "remult core lib", | ||
@@ -5,0 +5,0 @@ "homepage": "https://remult.github.io/", |
@@ -5,3 +5,3 @@ "use strict"; | ||
var tslib_1 = require("tslib"); | ||
var set_1 = require("../set"); | ||
var assign_1 = require("../assign"); | ||
var filter_interfaces_1 = require("./filter/filter-interfaces"); | ||
@@ -189,3 +189,3 @@ var remult3_1 = require("./remult3"); | ||
_a.sent(); | ||
set_1.set(r, item); | ||
assign_1.assign(r, item); | ||
if (this.settings.create) | ||
@@ -192,0 +192,0 @@ this.settings.create(r); |
@@ -9,2 +9,3 @@ import { EntityDataProvider, EntityDataProviderFindOptions } from '../data-interfaces'; | ||
constructor(entity: EntityMetadata, rows?: any[]); | ||
private verifyThatRowHasAllNotNullColumns; | ||
count(where?: Filter): Promise<number>; | ||
@@ -11,0 +12,0 @@ find(options?: EntityDataProviderFindOptions): Promise<any[]>; |
@@ -10,2 +10,3 @@ "use strict"; | ||
function ArrayEntityDataProvider(entity, rows) { | ||
var e_1, _a; | ||
this.entity = entity; | ||
@@ -15,2 +16,17 @@ this.rows = rows; | ||
rows = []; | ||
else { | ||
try { | ||
for (var rows_1 = tslib_1.__values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) { | ||
var r = rows_1_1.value; | ||
this.verifyThatRowHasAllNotNullColumns(r); | ||
} | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
} | ||
@@ -22,2 +38,29 @@ ArrayEntityDataProvider.customFilter = function (filter) { | ||
}; | ||
ArrayEntityDataProvider.prototype.verifyThatRowHasAllNotNullColumns = function (r) { | ||
var e_2, _a; | ||
try { | ||
for (var _b = tslib_1.__values(this.entity.fields), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var f = _c.value; | ||
if (!f.allowNull) { | ||
if (r[f.key] === undefined || r[f.key] === null) { | ||
var val = undefined; | ||
if (f.valueType === Boolean) | ||
val = false; | ||
else if (f.valueType === Number) | ||
val = 0; | ||
else if (f.valueType === String) | ||
val = ''; | ||
r[f.key] = val; | ||
} | ||
} | ||
} | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
} | ||
}; | ||
ArrayEntityDataProvider.prototype.count = function (where) { | ||
@@ -89,3 +132,3 @@ return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
ArrayEntityDataProvider.prototype.translateFromJson = function (row) { | ||
var e_1, _a; | ||
var e_3, _a; | ||
var result = {}; | ||
@@ -98,3 +141,3 @@ try { | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
finally { | ||
@@ -104,3 +147,3 @@ try { | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
finally { if (e_3) throw e_3.error; } | ||
} | ||
@@ -110,3 +153,3 @@ return result; | ||
ArrayEntityDataProvider.prototype.translateToJson = function (row) { | ||
var e_2, _a; | ||
var e_4, _a; | ||
var result = {}; | ||
@@ -119,3 +162,3 @@ try { | ||
} | ||
catch (e_2_1) { e_2 = { error: e_2_1 }; } | ||
catch (e_4_1) { e_4 = { error: e_4_1 }; } | ||
finally { | ||
@@ -125,3 +168,3 @@ try { | ||
} | ||
finally { if (e_2) throw e_2.error; } | ||
finally { if (e_4) throw e_4.error; } | ||
} | ||
@@ -139,3 +182,3 @@ return result; | ||
ArrayEntityDataProvider.prototype.update = function (id, data) { | ||
var e_3, _a; | ||
var e_5, _a; | ||
var idMatches = this.idMatches(id); | ||
@@ -148,3 +191,3 @@ var keys = Object.keys(data); | ||
try { | ||
for (var _b = (e_3 = void 0, tslib_1.__values(this.entity.fields)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
for (var _b = (e_5 = void 0, tslib_1.__values(this.entity.fields)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var f = _c.value; | ||
@@ -158,3 +201,3 @@ if (!f.dbReadOnly && !f.isServerExpression) { | ||
} | ||
catch (e_3_1) { e_3 = { error: e_3_1 }; } | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
finally { | ||
@@ -164,4 +207,5 @@ try { | ||
} | ||
finally { if (e_3) throw e_3.error; } | ||
finally { if (e_5) throw e_5.error; } | ||
} | ||
this.verifyThatRowHasAllNotNullColumns(newR); | ||
this.rows[i] = newR; | ||
@@ -251,3 +295,3 @@ return Promise.resolve(this.translateFromJson(this.rows[i])); | ||
FilterConsumerBridgeToObject.prototype.or = function (orElements) { | ||
var e_4, _a; | ||
var e_6, _a; | ||
try { | ||
@@ -263,3 +307,3 @@ for (var orElements_1 = tslib_1.__values(orElements), orElements_1_1 = orElements_1.next(); !orElements_1_1.done; orElements_1_1 = orElements_1.next()) { | ||
} | ||
catch (e_4_1) { e_4 = { error: e_4_1 }; } | ||
catch (e_6_1) { e_6 = { error: e_6_1 }; } | ||
finally { | ||
@@ -269,3 +313,3 @@ try { | ||
} | ||
finally { if (e_4) throw e_4.error; } | ||
finally { if (e_6) throw e_6.error; } | ||
} | ||
@@ -283,3 +327,3 @@ this.ok = false; | ||
FilterConsumerBridgeToObject.prototype.isIn = function (col, val) { | ||
var e_5, _a; | ||
var e_7, _a; | ||
try { | ||
@@ -293,3 +337,3 @@ for (var val_1 = tslib_1.__values(val), val_1_1 = val_1.next(); !val_1_1.done; val_1_1 = val_1.next()) { | ||
} | ||
catch (e_5_1) { e_5 = { error: e_5_1 }; } | ||
catch (e_7_1) { e_7 = { error: e_7_1 }; } | ||
finally { | ||
@@ -299,3 +343,3 @@ try { | ||
} | ||
finally { if (e_5) throw e_5.error; } | ||
finally { if (e_7) throw e_7.error; } | ||
} | ||
@@ -302,0 +346,0 @@ this.ok = false; |
@@ -51,3 +51,3 @@ "use strict"; | ||
tslib_1.__decorate([ | ||
remult3_1.Field(), | ||
remult3_1.Field({ allowNull: true }), | ||
tslib_1.__metadata("design:type", String) | ||
@@ -54,0 +54,0 @@ ], Categories.prototype, "categoryName", void 0); |
@@ -95,3 +95,3 @@ "use strict"; | ||
return value; | ||
if (value !== undefined) { | ||
if (value !== undefined && value !== null) { | ||
return value.toString().trim().toLowerCase() == 'true'; | ||
@@ -98,0 +98,0 @@ } |
Sorry, the diff of this file is not supported yet
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
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
591286
128
8926