From 21ab49845fa8c0c5c374b8096aa5eee3395c7e01 Mon Sep 17 00:00:00 2001 From: Nicolas Dextraze Date: Fri, 30 Jun 2017 18:54:56 -0700 Subject: [PATCH] Adding persistent subscription API to typescript definition --- index.d.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 8bc4a6d..b341d16 100644 --- a/index.d.ts +++ b/index.d.ts @@ -174,7 +174,20 @@ export interface EventStoreSubscription { } export interface EventStoreCatchUpSubscription { - start(): void; + stop(): void; +} + +export enum PersistentSubscriptionNakEventAction { + Unknown = 0, + Park = 1, + Retry = 2, + Skip = 3, + Stop = 4 +} + +export interface EventStorePersistentSubscription { + acknowledge(events: ResolvedEvent | ResolvedEvent[]): void; + fail(events: ResolvedEvent | ResolvedEvent[], action: PersistentSubscriptionNakEventAction, reason: string): void; stop(): void; } @@ -185,6 +198,18 @@ export interface RawStreamMetadataResult { readonly streamMetadata: any; } +export interface PersistentSubscriptionCreateResult { + readonly status: string; +} + +export interface PersistentSubscriptionUpdateResult { + readonly status: string; +} + +export interface PersistentSubscriptionDeleteResult { + readonly status: string; +} + // Callbacks export interface EventAppearedCallback { (subscription: TSubscription, event: ResolvedEvent): void; @@ -239,6 +264,11 @@ export interface EventStoreNodeConnection { subscribeToStreamFrom(stream: string, lastCheckpoint: number | null, resolveLinkTos: boolean, eventAppeared: EventAppearedCallback, liveProcessingStarted?: LiveProcessingStartedCallback, subscriptionDropped?: SubscriptionDroppedCallback, userCredentials?: UserCredentials, readBatchSize?: number): EventStoreCatchUpSubscription; subscribeToAll(resolveLinkTos: boolean, eventAppeared: EventAppearedCallback, subscriptionDropped?: SubscriptionDroppedCallback, userCredentials?: UserCredentials): Promise; subscribeToAllFrom(lastCheckpoint: Position | null, resolveLinkTos: boolean, eventAppeared: EventAppearedCallback, liveProcessingStarted?: LiveProcessingStartedCallback, subscriptionDropped?: SubscriptionDroppedCallback, userCredentials?: UserCredentials, readBatchSize?: number): EventStoreCatchUpSubscription; + // persistent subscriptions + createPersistentSubscription(stream: string, groupName: string, settings: PersistentSubscriptionSettings, userCredentials?: PersistentSubscriptionSettings): Promise; + updatePersistentSubscription(stream: string, groupName: string, settings: PersistentSubscriptionSettings, userCredentials?: PersistentSubscriptionSettings): Promise; + deletePersistentSubscription(stream: string, groupName: string, userCredentials?: PersistentSubscriptionSettings): Promise + connectToPersistentSubscription(stream: string, groupName: string, eventAppeared: EventAppearedCallback, subscriptionDropped?: SubscriptionDroppedCallback, userCredentials?: UserCredentials, bufferSize?: number, autoAck?: boolean): Promise; // metadata actions setStreamMetadataRaw(stream: string, expectedMetastreamVersion: number, metadata: any, userCredentials?: UserCredentials): Promise; getStreamMetadataRaw(stream: string, userCredentials?: UserCredentials): Promise;