ddd-es-node
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -1,2 +0,3 @@ | ||
export declare const useIncrementalUUID: (value: boolean) => void; | ||
export declare const freezeUUID: (value?: string) => void; | ||
export declare const unfreezeUUID: () => void; | ||
export declare const uuid: () => string; | ||
@@ -3,0 +4,0 @@ export declare class EntityEvent { |
@@ -5,9 +5,11 @@ "use strict"; | ||
const index_1 = require("./../index"); | ||
let incrementalUUID = false; | ||
let uidCount = 0; | ||
exports.useIncrementalUUID = (value) => { | ||
incrementalUUID = value; | ||
let frozenUUID = null; | ||
exports.freezeUUID = (value) => { | ||
frozenUUID = value || uuid_1.v4(); | ||
}; | ||
exports.unfreezeUUID = () => { | ||
frozenUUID = null; | ||
}; | ||
exports.uuid = () => { | ||
return incrementalUUID ? `${uidCount++}` : uuid_1.v4(); | ||
return frozenUUID === null ? uuid_1.v4() : frozenUUID; | ||
}; | ||
@@ -14,0 +16,0 @@ class EntityEvent { |
import { Clock } from './core/clock'; | ||
import { useIncrementalUUID } from './core/entity'; | ||
import { freezeUUID, unfreezeUUID } from './core/entity'; | ||
export { Entity, EntityRepository, EntityEvent, EventBus, EventBusSubscription, EventDispatcher, EventHandler, EventProcessor, EventStore, BaseEntityRepository, uuid } from './core/entity'; | ||
export { useIncrementalUUID }; | ||
export { freezeUUID, unfreezeUUID }; | ||
export { Clock }; | ||
export { eventBus, entityRepository, eventStore } from './runtime/es'; | ||
export declare const testMode: (value: boolean) => void; |
@@ -6,3 +6,4 @@ "use strict"; | ||
const entity_1 = require("./core/entity"); | ||
exports.useIncrementalUUID = entity_1.useIncrementalUUID; | ||
exports.freezeUUID = entity_1.freezeUUID; | ||
exports.unfreezeUUID = entity_1.unfreezeUUID; | ||
var entity_2 = require("./core/entity"); | ||
@@ -21,9 +22,9 @@ exports.Entity = entity_2.Entity; | ||
clock_1.Clock.freeze(); | ||
entity_1.useIncrementalUUID(true); | ||
entity_1.freezeUUID(); | ||
} | ||
else { | ||
clock_1.Clock.unfreeze(); | ||
entity_1.useIncrementalUUID(false); | ||
entity_1.unfreezeUUID(); | ||
} | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "ddd-es-node", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"description": "ddd-es-node", | ||
@@ -5,0 +5,0 @@ "main": "./dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
66235
1473