@arque/core
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -9,7 +9,15 @@ import { ConfigAdapter, StoreAdapter, StreamAdapter } from './adapters'; | ||
private readonly _state; | ||
private readonly logger; | ||
private readonly opts?; | ||
protected readonly logger: { | ||
info: any; | ||
error: any; | ||
warn: any; | ||
verbose: any; | ||
}; | ||
private readonly eventHandlers; | ||
private subscriber; | ||
private timestampLastEventReceived; | ||
constructor(store: StoreAdapter, stream: StreamAdapter, config: ConfigAdapter, eventHandlers: TEventHandler[], _id: string, _state: TState); | ||
constructor(store: StoreAdapter, stream: StreamAdapter, config: ConfigAdapter, eventHandlers: TEventHandler[], _id: string, _state: TState, opts?: { | ||
disableSaveStream?: true; | ||
}); | ||
get id(): string; | ||
@@ -16,0 +24,0 @@ get state(): TState; |
@@ -8,3 +8,3 @@ "use strict"; | ||
class Projection { | ||
constructor(store, stream, config, eventHandlers, _id, _state) { | ||
constructor(store, stream, config, eventHandlers, _id, _state, opts) { | ||
this.store = store; | ||
@@ -15,2 +15,3 @@ this.stream = stream; | ||
this._state = _state; | ||
this.opts = opts; | ||
this.logger = { | ||
@@ -51,9 +52,12 @@ info: (0, debug_1.default)('Broker:info'), | ||
async start() { | ||
var _a; | ||
if (this.subscriber) { | ||
throw new Error('already started'); | ||
} | ||
await this.config.saveStream({ | ||
id: this.id, | ||
events: [...new Set([...this.eventHandlers.values()].map(item => item.type)).values()], | ||
}); | ||
if (!((_a = this.opts) === null || _a === void 0 ? void 0 : _a.disableSaveStream)) { | ||
await this.config.saveStream({ | ||
id: this.id, | ||
events: [...new Set([...this.eventHandlers.values()].map(item => item.type)).values()], | ||
}); | ||
} | ||
this.subscriber = await this.stream.subscribe(this.id, async (event) => { | ||
@@ -60,0 +64,0 @@ await this.handleEvent(event); |
{ | ||
"name": "@arque/core", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "`arque` core library", | ||
@@ -34,3 +34,3 @@ "author": "ScaleForge", | ||
}, | ||
"gitHead": "673ab93d4cbf92ca13dc1b88d7277db49af7d295" | ||
"gitHead": "23c0b82bc66e088d1bf50a2f06c7c009870950d0" | ||
} |
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
44298
736