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;