@arque/core
Advanced tools
Comparing version 0.2.0-alpha.3 to 0.2.0
@@ -6,1 +6,3 @@ export * from './libs/event-id'; | ||
export * from './libs/aggregate-factory'; | ||
export * from './libs/broker'; | ||
export * from './libs/projection'; |
@@ -9,2 +9,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./libs/aggregate-factory"), exports); | ||
tslib_1.__exportStar(require("./libs/broker"), exports); | ||
tslib_1.__exportStar(require("./libs/projection"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -37,3 +37,17 @@ /// <reference types="node" /> | ||
}): Promise<Snapshot<TState> | null>; | ||
saveProjectionCheckpoint(params: { | ||
projection: string; | ||
aggregate: { | ||
id: Buffer; | ||
version: number; | ||
}; | ||
}): Promise<void>; | ||
checkProjectionCheckpoint(params: { | ||
projection: string; | ||
aggregate: { | ||
id: Buffer; | ||
version: number; | ||
}; | ||
}): Promise<boolean>; | ||
close(): Promise<void>; | ||
} |
/// <reference types="node" /> | ||
import { Event } from '../types'; | ||
import { Event as GlobalEvent } from '../types'; | ||
type Event = Pick<GlobalEvent, 'id' | 'type' | 'aggregate' | 'meta' | 'timestamp'> & { | ||
body: Buffer | Record<string, unknown> | null; | ||
}; | ||
export interface Subscriber { | ||
@@ -7,8 +10,13 @@ stop(): Promise<void>; | ||
export interface StreamAdapter { | ||
sendEvents(events: Event[], stream: string, ctx?: Buffer): Promise<void>; | ||
subscribe(params: { | ||
sendEvents(events: { | ||
stream: string; | ||
handle: (event: Event) => Promise<void>; | ||
events: Event[]; | ||
}[], opts?: { | ||
raw?: true; | ||
}): Promise<void>; | ||
subscribe(stream: string, handle: (event: Event) => Promise<void>, opts?: { | ||
raw?: true; | ||
}): Promise<Subscriber>; | ||
close(): Promise<void>; | ||
} | ||
export {}; |
/// <reference types="node" /> | ||
import { Aggregate, AggregateOpts } from './aggregate'; | ||
import { Aggregate, AggregateOptions } from './aggregate'; | ||
import { StoreAdapter } from './adapters/store-adapter'; | ||
@@ -19,3 +19,3 @@ import { StreamAdapter } from './adapters/stream-adapter'; | ||
readonly cacheTTL?: number; | ||
} & Partial<AggregateOpts<ExtractState<T>>>); | ||
} & Partial<AggregateOptions<ExtractState<T>>>); | ||
clear(): Promise<void>; | ||
@@ -22,0 +22,0 @@ load(id: Buffer, opts?: { |
@@ -6,3 +6,3 @@ /// <reference types="node" /> | ||
type ExtractCommand<T> = T extends CommandHandler<infer Command, any, any> ? Command : never; | ||
export type AggregateOpts<TState> = { | ||
export type AggregateOptions<TState> = { | ||
readonly shouldTakeSnapshot?: (ctx: { | ||
@@ -28,3 +28,3 @@ aggregate: { | ||
private _lastEvent; | ||
constructor(store: StoreAdapter, stream: StreamAdapter, commandHandlers: TCommandHandler[], eventHandlers: TEventHandler[], _id: Buffer, _version: number, _state: TState, opts?: Partial<AggregateOpts<TState>>); | ||
constructor(store: StoreAdapter, stream: StreamAdapter, commandHandlers: TCommandHandler[], eventHandlers: TEventHandler[], _id: Buffer, _version: number, _state: TState, opts?: Partial<AggregateOptions<TState>>); | ||
get id(): Buffer; | ||
@@ -31,0 +31,0 @@ get version(): number; |
@@ -118,4 +118,9 @@ "use strict"; | ||
version: this.version + index + 1, | ||
}, meta: item.meta }))); | ||
await this.stream.sendEvents(events, 'main', ctx); | ||
}, meta: Object.assign(Object.assign({}, item.meta), { __ctx: ctx }) }))); | ||
await this.stream.sendEvents([ | ||
{ | ||
stream: 'main', | ||
events, | ||
}, | ||
]); | ||
await this.digest(events); | ||
@@ -122,0 +127,0 @@ if (this.shoudTakeSnapshot()) { |
{ | ||
"name": "@arque/core", | ||
"version": "0.2.0-alpha.3", | ||
"version": "0.2.0", | ||
"description": "`arque` core library", | ||
@@ -27,2 +27,3 @@ "author": "ScaleForge", | ||
"bs58": "5.0.0", | ||
"debug": "4.3.4", | ||
"exponential-backoff": "3.1.1", | ||
@@ -34,3 +35,3 @@ "lru-cache": "10.0.1" | ||
}, | ||
"gitHead": "88c42a3542c74ce241444b40dd4f0efdd36e22a3" | ||
"gitHead": "859a27ee9e3527e2020645bc3fbbe8f66fa1f4cf" | ||
} |
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
41181
37
704
5
+ Addeddebug@4.3.4
+ Addeddebug@4.3.4(transitive)
+ Addedms@2.1.2(transitive)