import { SqlClient } from '@effect/sql'; import { Effect, Layer, Schema, Stream } from 'effect'; import { EventStreamId, type EventStore, EventStoreError } from '@codeforbreakfast/eventsourcing-store'; import { NotificationListener, type NotificationPayload } from './notificationListener'; import { SubscriptionManager, type SubscriptionManagerService } from './subscriptionManager'; interface EventRowServiceInterface { readonly insert: (row: EventRow) => Effect.Effect; readonly selectAllEventsInStream: (streamId: EventStreamId) => Effect.Effect; readonly selectAllEvents: (nullValue: Schema.Schema.Type) => Effect.Effect; } declare const EventRowService_base: import("effect/Context").TagClass & Effect.Tag.Proxy & { use: (body: (_: EventRowServiceInterface) => X) => [X] extends [Effect.Effect] ? Effect.Effect : [X] extends [PromiseLike] ? Effect.Effect : Effect.Effect; }; export declare class EventRowService extends EventRowService_base { } declare const EventRow_base: Schema.Class, "EventStreamId">; event_number: Schema.filter; event_payload: typeof Schema.String; }, Schema.Struct.Encoded<{ stream_id: Schema.brand, "EventStreamId">; event_number: Schema.filter; event_payload: typeof Schema.String; }>, never, { readonly stream_id: string & import("effect/Brand").Brand<"EventStreamId">; } & { readonly event_number: number; } & { readonly event_payload: string; }, {}, {}>; declare class EventRow extends EventRow_base { } /** * Layer that provides EventRowService */ export declare const EventRowServiceLive: Layer.Layer; /** * Combined layer that provides all the required services for real-time event subscriptions * Organized into logical groups for better understanding and testability */ export declare const EventSubscriptionServicesLive: Layer.Layer; /** * Create a SQL-based EventStore with subscription support and PostgreSQL LISTEN/NOTIFY */ export declare const makeSqlEventStoreWithSubscriptionManager: (subscriptionManager: SubscriptionManagerService, notificationListener: Readonly<{ readonly listen: (streamId: EventStreamId) => Effect.Effect; readonly unlisten: (streamId: EventStreamId) => Effect.Effect; readonly listenAll: Effect.Effect; readonly unlistenAll: Effect.Effect; readonly notifications: Stream.Stream<{ readonly streamId: EventStreamId; readonly payload: NotificationPayload; readonly isAllEvents: boolean; }, EventStoreError, never>; readonly start: Effect.Effect; readonly stop: Effect.Effect; }>) => Effect.Effect, EventStoreError, EventRowService>; declare const SqlEventStore_base: import("effect/Context").TagClass> & Effect.Tag.Proxy> & { use: (body: (_: EventStore) => X) => [X] extends [Effect.Effect] ? Effect.Effect : [X] extends [PromiseLike] ? Effect.Effect : Effect.Effect; }; /** * Layer that provides a SQL EventStore with properly shared SubscriptionManager and NotificationListener */ export declare class SqlEventStore extends SqlEventStore_base { } /** * Main SQL EventStore layer with simplified dependency management * Uses the logical layer groups defined above for clearer composition */ export declare const SqlEventStoreLive: Layer.Layer; /** * Backward-compatible function - requires SubscriptionManager and NotificationListener in context */ export declare const sqlEventStore: Effect.Effect, EventStoreError, EventRowService | SubscriptionManager | NotificationListener>; export {}; //# sourceMappingURL=sqlEventStore.d.ts.map