@berish/orm
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -13,2 +13,3 @@ import type { Manager } from '../manager'; | ||
}): TEntity; | ||
static isEquals(entity1: Entity, entity2: Entity): boolean; | ||
constructor(); | ||
@@ -15,0 +16,0 @@ get attributes(): methods.IAttributes; |
@@ -23,2 +23,5 @@ "use strict"; | ||
} | ||
static isEquals(entity1, entity2) { | ||
return methods.isEquals(entity1, entity2); | ||
} | ||
get attributes() { | ||
@@ -25,0 +28,0 @@ return methods.getAttributes(this); |
@@ -9,2 +9,3 @@ /// <reference types="node" /> | ||
}): FileEntity; | ||
static isEquals(entity1: FileEntity, entity2: FileEntity): boolean; | ||
constructor(); | ||
@@ -11,0 +12,0 @@ get attributes(): methods.IAttributes; |
@@ -23,2 +23,5 @@ "use strict"; | ||
} | ||
static isEquals(entity1, entity2) { | ||
return methods.isEquals(entity1, entity2); | ||
} | ||
get attributes() { | ||
@@ -25,0 +28,0 @@ return methods.getAttributes(this); |
@@ -16,2 +16,3 @@ export * from './fetch'; | ||
export * from './getUpdatedAt'; | ||
export * from './isEquals'; | ||
export * from './setFileName'; | ||
@@ -18,0 +19,0 @@ export * from './setIsFetched'; |
@@ -28,2 +28,3 @@ "use strict"; | ||
__exportStar(require("./getUpdatedAt"), exports); | ||
__exportStar(require("./isEquals"), exports); | ||
__exportStar(require("./setFileName"), exports); | ||
@@ -30,0 +31,0 @@ __exportStar(require("./setIsFetched"), exports); |
@@ -28,3 +28,3 @@ import EventEmitter from '@berish/emitter'; | ||
find: (data: QueryData<QueryDataSchema>) => Promise<IBaseDBItem[]>; | ||
subscribe: (data: QueryData<QueryDataSchema>, callback: (oldValue: IBaseDBItem, newValue: IBaseDBItem) => any, onError?: (reason: any) => any) => () => any; | ||
subscribe: (data: QueryData<QueryDataSchema>, callback: (oldValue: IBaseDBItem, newValue: IBaseDBItem, newValueIndex?: number) => any, onError?: (reason: any) => any) => () => any; | ||
}; | ||
@@ -31,0 +31,0 @@ /** |
@@ -61,3 +61,13 @@ "use strict"; | ||
const eventHash = this.emitter.cacheSubscribe(eventName, (callback) => { | ||
const onDisconnect = this._dbAdapter.subscribe(data, (oldValue, newValue) => callback({ oldValue, newValue }), (reason) => onError && onError(reason)); | ||
const onDisconnect = this._dbAdapter.subscribe(data, (oldValue, newValue) => __awaiter(this, void 0, void 0, function* () { | ||
if (!oldValue && newValue) { | ||
const items = yield this.db.find(query_1.Query.fromJSON(data).pluck('id').json); | ||
const valueIndex = (items || []).map((m) => m && m.id).indexOf(newValue.id); | ||
const newValueIndex = valueIndex === -1 ? undefined : valueIndex; | ||
callback({ oldValue, newValue, newValueIndex }); | ||
} | ||
else { | ||
callback({ oldValue, newValue }); | ||
} | ||
}), (reason) => onError && onError(reason)); | ||
return () => __awaiter(this, void 0, void 0, function* () { | ||
@@ -67,3 +77,3 @@ const disconnect = yield onDisconnect; | ||
}); | ||
}, ({ oldValue, newValue }) => callback(oldValue, newValue)); | ||
}, ({ oldValue, newValue, newValueIndex }) => callback(oldValue, newValue, newValueIndex)); | ||
return () => this.emitter.off(eventHash); | ||
@@ -70,0 +80,0 @@ }; |
@@ -5,3 +5,4 @@ export declare enum RawTypeEnum { | ||
fullEntity = "fe", | ||
fullFileEntity = "ffe" | ||
fullFileEntity = "ffe", | ||
fullQuery = "fq" | ||
} | ||
@@ -8,0 +9,0 @@ /** |
@@ -10,2 +10,3 @@ "use strict"; | ||
RawTypeEnum["fullFileEntity"] = "ffe"; | ||
RawTypeEnum["fullQuery"] = "fq"; | ||
})(RawTypeEnum = exports.RawTypeEnum || (exports.RawTypeEnum = {})); | ||
@@ -12,0 +13,0 @@ /** |
@@ -12,2 +12,3 @@ "use strict"; | ||
const fileEntityToFileEntityPointerPlugin_1 = require("./plugins/fileEntityToFileEntityPointerPlugin"); | ||
const queryToFullQueryPlugin_1 = require("./plugins/queryToFullQueryPlugin"); | ||
const undefinedDBPlugin_1 = require("./plugins/undefinedDBPlugin"); | ||
@@ -73,2 +74,3 @@ class SerberInstances { | ||
.addPlugin(fileEntitiyToFullFileEntityPlugin_1.fileEntityToFullFileEntityPlugin) | ||
.addPlugin(queryToFullQueryPlugin_1.queryToFullQueryPlugin) | ||
.addPlugin(serber_1.plugins.loopObjectPlugin); | ||
@@ -75,0 +77,0 @@ } |
@@ -7,2 +7,3 @@ export * from './entityToBaseDBItemPlugin'; | ||
export * from './fileEntityToFileEntityPointerPlugin'; | ||
export * from './queryToFullQueryPlugin'; | ||
export * from './undefinedDBPlugin'; |
@@ -19,3 +19,4 @@ "use strict"; | ||
__exportStar(require("./fileEntityToFileEntityPointerPlugin"), exports); | ||
__exportStar(require("./queryToFullQueryPlugin"), exports); | ||
__exportStar(require("./undefinedDBPlugin"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@berish/orm", | ||
"version": "0.5.1", | ||
"version": "0.6.0", | ||
"description": "ORM", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
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 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
227642
236
3156