@remult/core
Advanced tools
Comparing version 3.0.13 to 3.0.14
{ | ||
"name": "@remult/core", | ||
"schematics": "./schematics/collection.json", | ||
"version": "3.0.13", | ||
"version": "3.0.14", | ||
"description": "remult core lib", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -205,4 +205,3 @@ "use strict"; | ||
result += '\r\n '; | ||
//@ts-ignore | ||
if (x == e.idField && e.__options.dbAutoIncrementId) | ||
if (x == e.idField && e.evilOriginalSettings.dbAutoIncrementId) | ||
result += x.dbName + ' serial'; | ||
@@ -209,0 +208,0 @@ else { |
@@ -89,3 +89,6 @@ "use strict"; | ||
z = _a.sent(); | ||
error = z.error; | ||
if (z.error) | ||
error = z.error; | ||
else | ||
error = z.message; | ||
if (typeof error === 'string') { | ||
@@ -92,0 +95,0 @@ error = { |
@@ -386,3 +386,3 @@ "use strict"; | ||
statement = "insert into " + this.entity.dbName + " (" + cols + ") values (" + vals + ")"; | ||
if (!this.entity.dbAutoIncrementId) return [3 /*break*/, 3]; | ||
if (!this.entity.evilOriginalSettings.dbAutoIncrementId) return [3 /*break*/, 3]; | ||
return [4 /*yield*/, this.strategy.insertAndReturnAutoIncrementId(r, statement, this.entity)]; | ||
@@ -389,0 +389,0 @@ case 2: |
@@ -71,3 +71,3 @@ "use strict"; | ||
result += ' primary key'; | ||
if (entity.dbAutoIncrementId) | ||
if (entity.evilOriginalSettings.dbAutoIncrementId) | ||
result += " autoincrement"; | ||
@@ -74,0 +74,0 @@ } |
@@ -41,2 +41,3 @@ "use strict"; | ||
Filter.translateWhereToFilter = function (entity, where) { | ||
var _this = this; | ||
if (Array.isArray(where)) { | ||
@@ -50,3 +51,7 @@ return new (AndFilter.bind.apply(AndFilter, tslib_1.__spread([void 0], where.map(function (x) { | ||
if (Array.isArray(r)) | ||
return new (AndFilter.bind.apply(AndFilter, tslib_1.__spread([void 0], r)))(); | ||
return new (AndFilter.bind.apply(AndFilter, tslib_1.__spread([void 0], r.map(function (x) { | ||
if (typeof x === "function") | ||
return _this.translateWhereToFilter(entity, x); | ||
return x; | ||
}))))(); | ||
else if (typeof r === 'function') | ||
@@ -80,2 +85,4 @@ return this.translateWhereToFilter(entity, r); | ||
return null; | ||
if (typeof val === "string" || typeof val === "number") | ||
return val; | ||
return val.id; | ||
@@ -271,3 +278,3 @@ } | ||
var val = filterInfo.get(col.key + operation); | ||
if (val != undefined) { | ||
if (val !== undefined) { | ||
var addFilter_1 = function (val) { | ||
@@ -274,0 +281,0 @@ var theVal = val; |
@@ -54,3 +54,2 @@ import { FieldDefinitions } from "../column-interfaces"; | ||
export interface EntityDefinitions<entityType = any> { | ||
readonly dbAutoIncrementId: boolean; | ||
readonly idField: FieldDefinitions<any>; | ||
@@ -67,3 +66,3 @@ getIdFilter(id: any): Filter; | ||
export interface Repository<entityType> { | ||
fromJson(x: any): entityType; | ||
fromJson(x: any, isNew?: boolean): Promise<entityType>; | ||
defs: EntityDefinitions<entityType>; | ||
@@ -70,0 +69,0 @@ find(options?: FindOptions<entityType>): Promise<entityType[]>; |
@@ -23,3 +23,2 @@ import { FieldDefinitions, FieldSettings, ValueConverter, ValueListItem } from "../column-interfaces"; | ||
addToCache(item: T): void; | ||
fromJson(x: any): T; | ||
get defs(): EntityDefinitions; | ||
@@ -40,2 +39,3 @@ listeners: entityEventListener<T>[]; | ||
create(item?: Partial<T>): T; | ||
fromJson(json: any, newRow?: boolean): Promise<T>; | ||
findId(id: any): Promise<T>; | ||
@@ -151,3 +151,3 @@ private translateWhereToFilter; | ||
key: string; | ||
dbReadOnly: boolean; | ||
get dbReadOnly(): boolean; | ||
isServerExpression: boolean; | ||
@@ -154,0 +154,0 @@ dataType: any; |
@@ -316,3 +316,3 @@ "use strict"; | ||
defs = remult3_1.getControllerDefs(y, context_2); | ||
defs._updateEntityBasedOnApi(d.columns); | ||
defs._updateEntityBasedOnApi(d.fields); | ||
return [4 /*yield*/, Promise.all(tslib_1.__spread(defs.fields).map(function (x) { return x.load(); }))]; | ||
@@ -333,3 +333,3 @@ case 12: | ||
case 16: | ||
r_1 = (_d.columns = _e.sent(), | ||
r_1 = (_d.fields = _e.sent(), | ||
_d); | ||
@@ -460,7 +460,7 @@ return [3 /*break*/, 18]; | ||
return [4 /*yield*/, defs.toApiJson()]; | ||
case 11: return [4 /*yield*/, (_d.apply(_c, [(_g.columns = _h.sent(), | ||
case 11: return [4 /*yield*/, (_d.apply(_c, [(_g.fields = _h.sent(), | ||
_g)]))]; | ||
case 12: | ||
r = _h.sent(); | ||
defs._updateEntityBasedOnApi(r.columns); | ||
defs._updateEntityBasedOnApi(r.fields); | ||
return [2 /*return*/, r.result]; | ||
@@ -467,0 +467,0 @@ case 13: |
@@ -45,3 +45,3 @@ "use strict"; | ||
return ''; | ||
return d.toISOString().substring(0, 10); | ||
return new Date(val.valueOf() - val.getTimezoneOffset() * 60000).toISOString().substring(0, 10); | ||
}, | ||
@@ -48,0 +48,0 @@ fromJson: function (value) { |
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
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
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
1221083
18877