@raisindb/client 0.1.16 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +281 -70
  2. package/dist/chunk-DJDP5CX6.mjs +866 -0
  3. package/dist/chunk-DJDP5CX6.mjs.map +1 -0
  4. package/dist/chunk-JRFBP4WK.mjs +170 -0
  5. package/dist/chunk-JRFBP4WK.mjs.map +1 -0
  6. package/dist/chunk-OLJOZIIU.mjs +1348 -0
  7. package/dist/chunk-OLJOZIIU.mjs.map +1 -0
  8. package/dist/chunk-T2ZSNYFG.mjs +248 -0
  9. package/dist/chunk-T2ZSNYFG.mjs.map +1 -0
  10. package/dist/chunk-VZX3ACSO.mjs +190 -0
  11. package/dist/chunk-VZX3ACSO.mjs.map +1 -0
  12. package/dist/chunk-WFBAWOVM.mjs +532 -0
  13. package/dist/chunk-WFBAWOVM.mjs.map +1 -0
  14. package/dist/conversation-list-store-CNcVagmw.d.mts +6120 -0
  15. package/dist/conversation-list-store-CNcVagmw.d.ts +6120 -0
  16. package/dist/index-DQjE-4Oj.d.ts +301 -0
  17. package/dist/index-FkFH4HHQ.d.mts +301 -0
  18. package/dist/index.d.mts +66 -6108
  19. package/dist/index.d.ts +66 -6108
  20. package/dist/index.js +859 -109
  21. package/dist/index.js.map +1 -0
  22. package/dist/index.mjs +639 -3108
  23. package/dist/index.mjs.map +1 -0
  24. package/dist/react.d.mts +4 -0
  25. package/dist/react.d.ts +4 -0
  26. package/dist/react.js +2500 -0
  27. package/dist/react.js.map +1 -0
  28. package/dist/react.mjs +9 -0
  29. package/dist/react.mjs.map +1 -0
  30. package/dist/svelte-sql-62EaYoeM.d.ts +52 -0
  31. package/dist/svelte-sql-CgT-Ij-P.d.mts +52 -0
  32. package/dist/svelte.d.mts +288 -0
  33. package/dist/svelte.d.ts +288 -0
  34. package/dist/svelte.js +2413 -0
  35. package/dist/svelte.js.map +1 -0
  36. package/dist/svelte.mjs +25 -0
  37. package/dist/svelte.mjs.map +1 -0
  38. package/dist/vue.d.mts +197 -0
  39. package/dist/vue.d.ts +197 -0
  40. package/dist/vue.js +1441 -0
  41. package/dist/vue.js.map +1 -0
  42. package/dist/vue.mjs +9 -0
  43. package/dist/vue.mjs.map +1 -0
  44. package/package.json +18 -3
@@ -0,0 +1,288 @@
1
+ import { f as ConversationStoreOptions, c as ConversationStore, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, e as ConversationListStore, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, D as Database, S as SubscriptionFilters, E as EventMessage, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent } from './conversation-list-store-CNcVagmw.mjs';
2
+ export { b as SqlAdapter, S as SqlAdapterOptions, a as SqlSnapshot, c as createSqlAdapter } from './svelte-sql-CgT-Ij-P.mjs';
3
+ import 'events';
4
+ import 'fs/promises';
5
+
6
+ /**
7
+ * Create a conversation store adapter for Svelte 5.
8
+ *
9
+ * Returns an object with the store, a snapshot getter, actions, and a
10
+ * destroy function. In a `.svelte.ts` file, bind `snapshot` to `$state`
11
+ * to get fine-grained reactivity.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const adapter = createConversationAdapter({ database: db, conversationPath: path });
16
+ * let snapshot = $state(adapter.getSnapshot());
17
+ * adapter.subscribe(s => { snapshot = s; });
18
+ * // ...later
19
+ * adapter.destroy();
20
+ * ```
21
+ */
22
+ declare function createConversationAdapter(options: ConversationStoreOptions): {
23
+ /** The underlying ConversationStore instance */
24
+ store: ConversationStore;
25
+ /** Get the current snapshot */
26
+ getSnapshot: () => ConversationStoreSnapshot;
27
+ /** Subscribe to snapshot changes. Returns unsubscribe function. */
28
+ subscribe: (cb: (s: ConversationStoreSnapshot) => void) => () => void;
29
+ /** Send a user message */
30
+ sendMessage: (content: string) => Promise<void>;
31
+ /** Load persisted messages */
32
+ loadMessages: () => Promise<ChatMessage[]>;
33
+ /** Approve a pending plan */
34
+ approvePlan: (planPath: string) => Promise<void>;
35
+ /** Reject a pending plan */
36
+ rejectPlan: (planPath: string, feedback?: string) => Promise<void>;
37
+ /** Mark a message as read */
38
+ markMessageAsRead: (messagePath: string) => Promise<void>;
39
+ /** Stop streaming */
40
+ stop: () => void;
41
+ /** Get the conversation path */
42
+ getConversationPath: () => string | null;
43
+ /** Destroy the store and release resources */
44
+ destroy: () => void;
45
+ };
46
+ /**
47
+ * Create a conversation list store adapter for Svelte 5.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const adapter = createConversationListAdapter({ database: db, realtime: true });
52
+ * let snapshot = $state(adapter.getSnapshot());
53
+ * adapter.subscribe(s => { snapshot = s; });
54
+ * await adapter.load();
55
+ * ```
56
+ */
57
+ declare function createConversationListAdapter(options: ConversationListStoreOptions): {
58
+ /** The underlying ConversationListStore instance */
59
+ store: ConversationListStore;
60
+ /** Get the current snapshot */
61
+ getSnapshot: () => ConversationListSnapshot;
62
+ /** Subscribe to snapshot changes. Returns unsubscribe function. */
63
+ subscribe: (cb: (s: ConversationListSnapshot) => void) => () => void;
64
+ /** Load conversations from the server */
65
+ load: () => Promise<void>;
66
+ /** Create a new conversation */
67
+ createConversation: (opts: {
68
+ participant: string;
69
+ subject?: string;
70
+ input?: Record<string, unknown>;
71
+ }) => Promise<ConversationListItem>;
72
+ /** Delete a conversation */
73
+ deleteConversation: (path: string) => Promise<void>;
74
+ /** Mark a conversation as read */
75
+ markAsRead: (path: string) => Promise<void>;
76
+ /** Get or create a ConversationStore for a specific path */
77
+ getConversationStore: (path: string) => ConversationStore;
78
+ /** Destroy the store and release resources */
79
+ destroy: () => void;
80
+ };
81
+
82
+ interface AuthSnapshot {
83
+ user: IdentityUser | null;
84
+ isAuthenticated: boolean;
85
+ isLoading: boolean;
86
+ }
87
+ interface AuthAdapter {
88
+ subscribe: (cb: (snapshot: AuthSnapshot) => void) => () => void;
89
+ getSnapshot: () => AuthSnapshot;
90
+ login: (email: string, password: string, repository: string) => Promise<IdentityUser>;
91
+ register: (email: string, password: string, repository: string, displayName?: string) => Promise<IdentityUser>;
92
+ logout: (options?: {
93
+ disconnect?: boolean;
94
+ reconnect?: boolean;
95
+ }) => Promise<void>;
96
+ initSession: (repository: string) => Promise<IdentityUser | null>;
97
+ destroy: () => void;
98
+ }
99
+ /**
100
+ * Create an auth adapter for Svelte 5.
101
+ *
102
+ * Returns a plain object with `subscribe`, `getSnapshot`, auth actions, and `destroy`.
103
+ * Bind `getSnapshot()` to `$state` in a `.svelte.ts` file for reactivity.
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * // lib/auth.svelte.ts
108
+ * import { createAuthAdapter } from '@raisindb/client/svelte';
109
+ * import { client } from '$lib/raisin';
110
+ *
111
+ * const adapter = createAuthAdapter(client);
112
+ * let snapshot = $state(adapter.getSnapshot());
113
+ * adapter.subscribe(s => { snapshot = s; });
114
+ *
115
+ * export const auth = {
116
+ * get user() { return snapshot.user; },
117
+ * get isAuthenticated() { return snapshot.isAuthenticated; },
118
+ * get isLoading() { return snapshot.isLoading; },
119
+ * login: adapter.login,
120
+ * register: adapter.register,
121
+ * logout: adapter.logout,
122
+ * initSession: adapter.initSession,
123
+ * };
124
+ * ```
125
+ */
126
+ declare function createAuthAdapter(client: RaisinClient): AuthAdapter;
127
+
128
+ interface ConnectionSnapshot {
129
+ state: ConnectionState;
130
+ isConnected: boolean;
131
+ isReady: boolean;
132
+ }
133
+ interface ConnectionAdapter {
134
+ subscribe: (cb: (snapshot: ConnectionSnapshot) => void) => () => void;
135
+ getSnapshot: () => ConnectionSnapshot;
136
+ connect: () => Promise<void>;
137
+ disconnect: () => void;
138
+ destroy: () => void;
139
+ }
140
+ /**
141
+ * Create a connection adapter for Svelte 5.
142
+ *
143
+ * Tracks WebSocket connection state and ready state. Bind to `$state` in
144
+ * a `.svelte.ts` file for reactivity.
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // lib/connection.svelte.ts
149
+ * import { createConnectionAdapter } from '@raisindb/client/svelte';
150
+ * import { client } from '$lib/raisin';
151
+ *
152
+ * const adapter = createConnectionAdapter(client);
153
+ * let snapshot = $state(adapter.getSnapshot());
154
+ * adapter.subscribe(s => { snapshot = s; });
155
+ *
156
+ * export const connection = {
157
+ * get state() { return snapshot.state; },
158
+ * get isConnected() { return snapshot.isConnected; },
159
+ * get isReady() { return snapshot.isReady; },
160
+ * connect: adapter.connect,
161
+ * disconnect: adapter.disconnect,
162
+ * };
163
+ * ```
164
+ */
165
+ declare function createConnectionAdapter(client: RaisinClient): ConnectionAdapter;
166
+
167
+ interface SubscriptionAdapter {
168
+ destroy: () => void;
169
+ }
170
+ /**
171
+ * Create an event subscription adapter for Svelte 5.
172
+ *
173
+ * Pure side-effect adapter — subscribes to database events and invokes the
174
+ * callback on each matching event. Call `destroy()` to unsubscribe.
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // In a .svelte component's script block or .svelte.ts file
179
+ * import { createSubscriptionAdapter } from '@raisindb/client/svelte';
180
+ * import { db } from '$lib/raisin';
181
+ *
182
+ * const sub = createSubscriptionAdapter(
183
+ * db,
184
+ * { workspace: 'content', node_type: 'Post' },
185
+ * (event) => { console.log('Post changed:', event); },
186
+ * );
187
+ *
188
+ * // In onDestroy or $effect cleanup:
189
+ * sub.destroy();
190
+ * ```
191
+ */
192
+ declare function createSubscriptionAdapter(database: Database, filters: SubscriptionFilters, callback: (event: EventMessage) => void): SubscriptionAdapter;
193
+
194
+ type FlowStatus = 'idle' | 'running' | 'waiting' | 'completed' | 'failed';
195
+ interface FlowSnapshot {
196
+ events: FlowExecutionEvent[];
197
+ status: FlowStatus;
198
+ isRunning: boolean;
199
+ error: string | null;
200
+ output: unknown | null;
201
+ instanceId: string | null;
202
+ }
203
+ interface FlowAdapterOptions {
204
+ database?: Database;
205
+ baseUrl?: string;
206
+ repository?: string;
207
+ authManager?: AuthManager;
208
+ clientOptions?: FlowClientOptions;
209
+ flowsApi?: FlowsApi;
210
+ }
211
+ interface FlowAdapter {
212
+ subscribe: (cb: (snapshot: FlowSnapshot) => void) => () => void;
213
+ getSnapshot: () => FlowSnapshot;
214
+ run: (flowPath: string, input?: Record<string, unknown>) => Promise<void>;
215
+ resume: (data: unknown) => Promise<void>;
216
+ reset: () => void;
217
+ destroy: () => void;
218
+ }
219
+ /**
220
+ * Create a flow execution adapter for Svelte 5.
221
+ *
222
+ * Manages the full flow lifecycle: starting, streaming events, resuming
223
+ * waiting flows, and tracking completion. Bind snapshot to `$state` for reactivity.
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * // lib/flow.svelte.ts
228
+ * import { createFlowAdapter } from '@raisindb/client/svelte';
229
+ * import { db } from '$lib/raisin';
230
+ *
231
+ * const adapter = createFlowAdapter({ database: db });
232
+ * let snapshot = $state(adapter.getSnapshot());
233
+ * adapter.subscribe(s => { snapshot = s; });
234
+ *
235
+ * export const flow = {
236
+ * get events() { return snapshot.events; },
237
+ * get status() { return snapshot.status; },
238
+ * get isRunning() { return snapshot.isRunning; },
239
+ * get error() { return snapshot.error; },
240
+ * get output() { return snapshot.output; },
241
+ * run: adapter.run,
242
+ * resume: adapter.resume,
243
+ * reset: adapter.reset,
244
+ * };
245
+ * ```
246
+ */
247
+ declare function createFlowAdapter(options: FlowAdapterOptions): FlowAdapter;
248
+
249
+ /**
250
+ * Context value for the RaisinDB Svelte integration.
251
+ *
252
+ * Use with Svelte's `setContext`/`getContext` in `.svelte` files.
253
+ *
254
+ * @example Setup in `+layout.svelte`:
255
+ * ```svelte
256
+ * <script>
257
+ * import { setContext } from 'svelte';
258
+ * import { RAISIN_CONTEXT_KEY, type RaisinContext } from '@raisindb/client/svelte';
259
+ * import { client } from '$lib/raisin';
260
+ *
261
+ * setContext<RaisinContext>(RAISIN_CONTEXT_KEY, { client, repository: 'myrepo' });
262
+ * </script>
263
+ *
264
+ * {@render children()}
265
+ * ```
266
+ *
267
+ * @example Usage in a child component:
268
+ * ```svelte
269
+ * <script>
270
+ * import { getContext } from 'svelte';
271
+ * import { RAISIN_CONTEXT_KEY, type RaisinContext } from '@raisindb/client/svelte';
272
+ *
273
+ * const { client, repository } = getContext<RaisinContext>(RAISIN_CONTEXT_KEY);
274
+ * const db = client.database(repository!);
275
+ * </script>
276
+ * ```
277
+ */
278
+ interface RaisinContext {
279
+ client: RaisinClient;
280
+ repository?: string;
281
+ }
282
+ /**
283
+ * Shared context key for RaisinDB. Use this with `setContext` and `getContext`
284
+ * to ensure consistent key usage across your application.
285
+ */
286
+ declare const RAISIN_CONTEXT_KEY: unique symbol;
287
+
288
+ export { type AuthAdapter, type AuthSnapshot, type ConnectionAdapter, type ConnectionSnapshot, type FlowAdapter, type FlowAdapterOptions, type FlowSnapshot, type FlowStatus, RAISIN_CONTEXT_KEY, type RaisinContext, type SubscriptionAdapter, createAuthAdapter, createConnectionAdapter, createConversationAdapter, createConversationListAdapter, createFlowAdapter, createSubscriptionAdapter };
@@ -0,0 +1,288 @@
1
+ import { f as ConversationStoreOptions, c as ConversationStore, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, e as ConversationListStore, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, D as Database, S as SubscriptionFilters, E as EventMessage, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent } from './conversation-list-store-CNcVagmw.js';
2
+ export { b as SqlAdapter, S as SqlAdapterOptions, a as SqlSnapshot, c as createSqlAdapter } from './svelte-sql-62EaYoeM.js';
3
+ import 'events';
4
+ import 'fs/promises';
5
+
6
+ /**
7
+ * Create a conversation store adapter for Svelte 5.
8
+ *
9
+ * Returns an object with the store, a snapshot getter, actions, and a
10
+ * destroy function. In a `.svelte.ts` file, bind `snapshot` to `$state`
11
+ * to get fine-grained reactivity.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const adapter = createConversationAdapter({ database: db, conversationPath: path });
16
+ * let snapshot = $state(adapter.getSnapshot());
17
+ * adapter.subscribe(s => { snapshot = s; });
18
+ * // ...later
19
+ * adapter.destroy();
20
+ * ```
21
+ */
22
+ declare function createConversationAdapter(options: ConversationStoreOptions): {
23
+ /** The underlying ConversationStore instance */
24
+ store: ConversationStore;
25
+ /** Get the current snapshot */
26
+ getSnapshot: () => ConversationStoreSnapshot;
27
+ /** Subscribe to snapshot changes. Returns unsubscribe function. */
28
+ subscribe: (cb: (s: ConversationStoreSnapshot) => void) => () => void;
29
+ /** Send a user message */
30
+ sendMessage: (content: string) => Promise<void>;
31
+ /** Load persisted messages */
32
+ loadMessages: () => Promise<ChatMessage[]>;
33
+ /** Approve a pending plan */
34
+ approvePlan: (planPath: string) => Promise<void>;
35
+ /** Reject a pending plan */
36
+ rejectPlan: (planPath: string, feedback?: string) => Promise<void>;
37
+ /** Mark a message as read */
38
+ markMessageAsRead: (messagePath: string) => Promise<void>;
39
+ /** Stop streaming */
40
+ stop: () => void;
41
+ /** Get the conversation path */
42
+ getConversationPath: () => string | null;
43
+ /** Destroy the store and release resources */
44
+ destroy: () => void;
45
+ };
46
+ /**
47
+ * Create a conversation list store adapter for Svelte 5.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const adapter = createConversationListAdapter({ database: db, realtime: true });
52
+ * let snapshot = $state(adapter.getSnapshot());
53
+ * adapter.subscribe(s => { snapshot = s; });
54
+ * await adapter.load();
55
+ * ```
56
+ */
57
+ declare function createConversationListAdapter(options: ConversationListStoreOptions): {
58
+ /** The underlying ConversationListStore instance */
59
+ store: ConversationListStore;
60
+ /** Get the current snapshot */
61
+ getSnapshot: () => ConversationListSnapshot;
62
+ /** Subscribe to snapshot changes. Returns unsubscribe function. */
63
+ subscribe: (cb: (s: ConversationListSnapshot) => void) => () => void;
64
+ /** Load conversations from the server */
65
+ load: () => Promise<void>;
66
+ /** Create a new conversation */
67
+ createConversation: (opts: {
68
+ participant: string;
69
+ subject?: string;
70
+ input?: Record<string, unknown>;
71
+ }) => Promise<ConversationListItem>;
72
+ /** Delete a conversation */
73
+ deleteConversation: (path: string) => Promise<void>;
74
+ /** Mark a conversation as read */
75
+ markAsRead: (path: string) => Promise<void>;
76
+ /** Get or create a ConversationStore for a specific path */
77
+ getConversationStore: (path: string) => ConversationStore;
78
+ /** Destroy the store and release resources */
79
+ destroy: () => void;
80
+ };
81
+
82
+ interface AuthSnapshot {
83
+ user: IdentityUser | null;
84
+ isAuthenticated: boolean;
85
+ isLoading: boolean;
86
+ }
87
+ interface AuthAdapter {
88
+ subscribe: (cb: (snapshot: AuthSnapshot) => void) => () => void;
89
+ getSnapshot: () => AuthSnapshot;
90
+ login: (email: string, password: string, repository: string) => Promise<IdentityUser>;
91
+ register: (email: string, password: string, repository: string, displayName?: string) => Promise<IdentityUser>;
92
+ logout: (options?: {
93
+ disconnect?: boolean;
94
+ reconnect?: boolean;
95
+ }) => Promise<void>;
96
+ initSession: (repository: string) => Promise<IdentityUser | null>;
97
+ destroy: () => void;
98
+ }
99
+ /**
100
+ * Create an auth adapter for Svelte 5.
101
+ *
102
+ * Returns a plain object with `subscribe`, `getSnapshot`, auth actions, and `destroy`.
103
+ * Bind `getSnapshot()` to `$state` in a `.svelte.ts` file for reactivity.
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * // lib/auth.svelte.ts
108
+ * import { createAuthAdapter } from '@raisindb/client/svelte';
109
+ * import { client } from '$lib/raisin';
110
+ *
111
+ * const adapter = createAuthAdapter(client);
112
+ * let snapshot = $state(adapter.getSnapshot());
113
+ * adapter.subscribe(s => { snapshot = s; });
114
+ *
115
+ * export const auth = {
116
+ * get user() { return snapshot.user; },
117
+ * get isAuthenticated() { return snapshot.isAuthenticated; },
118
+ * get isLoading() { return snapshot.isLoading; },
119
+ * login: adapter.login,
120
+ * register: adapter.register,
121
+ * logout: adapter.logout,
122
+ * initSession: adapter.initSession,
123
+ * };
124
+ * ```
125
+ */
126
+ declare function createAuthAdapter(client: RaisinClient): AuthAdapter;
127
+
128
+ interface ConnectionSnapshot {
129
+ state: ConnectionState;
130
+ isConnected: boolean;
131
+ isReady: boolean;
132
+ }
133
+ interface ConnectionAdapter {
134
+ subscribe: (cb: (snapshot: ConnectionSnapshot) => void) => () => void;
135
+ getSnapshot: () => ConnectionSnapshot;
136
+ connect: () => Promise<void>;
137
+ disconnect: () => void;
138
+ destroy: () => void;
139
+ }
140
+ /**
141
+ * Create a connection adapter for Svelte 5.
142
+ *
143
+ * Tracks WebSocket connection state and ready state. Bind to `$state` in
144
+ * a `.svelte.ts` file for reactivity.
145
+ *
146
+ * @example
147
+ * ```typescript
148
+ * // lib/connection.svelte.ts
149
+ * import { createConnectionAdapter } from '@raisindb/client/svelte';
150
+ * import { client } from '$lib/raisin';
151
+ *
152
+ * const adapter = createConnectionAdapter(client);
153
+ * let snapshot = $state(adapter.getSnapshot());
154
+ * adapter.subscribe(s => { snapshot = s; });
155
+ *
156
+ * export const connection = {
157
+ * get state() { return snapshot.state; },
158
+ * get isConnected() { return snapshot.isConnected; },
159
+ * get isReady() { return snapshot.isReady; },
160
+ * connect: adapter.connect,
161
+ * disconnect: adapter.disconnect,
162
+ * };
163
+ * ```
164
+ */
165
+ declare function createConnectionAdapter(client: RaisinClient): ConnectionAdapter;
166
+
167
+ interface SubscriptionAdapter {
168
+ destroy: () => void;
169
+ }
170
+ /**
171
+ * Create an event subscription adapter for Svelte 5.
172
+ *
173
+ * Pure side-effect adapter — subscribes to database events and invokes the
174
+ * callback on each matching event. Call `destroy()` to unsubscribe.
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // In a .svelte component's script block or .svelte.ts file
179
+ * import { createSubscriptionAdapter } from '@raisindb/client/svelte';
180
+ * import { db } from '$lib/raisin';
181
+ *
182
+ * const sub = createSubscriptionAdapter(
183
+ * db,
184
+ * { workspace: 'content', node_type: 'Post' },
185
+ * (event) => { console.log('Post changed:', event); },
186
+ * );
187
+ *
188
+ * // In onDestroy or $effect cleanup:
189
+ * sub.destroy();
190
+ * ```
191
+ */
192
+ declare function createSubscriptionAdapter(database: Database, filters: SubscriptionFilters, callback: (event: EventMessage) => void): SubscriptionAdapter;
193
+
194
+ type FlowStatus = 'idle' | 'running' | 'waiting' | 'completed' | 'failed';
195
+ interface FlowSnapshot {
196
+ events: FlowExecutionEvent[];
197
+ status: FlowStatus;
198
+ isRunning: boolean;
199
+ error: string | null;
200
+ output: unknown | null;
201
+ instanceId: string | null;
202
+ }
203
+ interface FlowAdapterOptions {
204
+ database?: Database;
205
+ baseUrl?: string;
206
+ repository?: string;
207
+ authManager?: AuthManager;
208
+ clientOptions?: FlowClientOptions;
209
+ flowsApi?: FlowsApi;
210
+ }
211
+ interface FlowAdapter {
212
+ subscribe: (cb: (snapshot: FlowSnapshot) => void) => () => void;
213
+ getSnapshot: () => FlowSnapshot;
214
+ run: (flowPath: string, input?: Record<string, unknown>) => Promise<void>;
215
+ resume: (data: unknown) => Promise<void>;
216
+ reset: () => void;
217
+ destroy: () => void;
218
+ }
219
+ /**
220
+ * Create a flow execution adapter for Svelte 5.
221
+ *
222
+ * Manages the full flow lifecycle: starting, streaming events, resuming
223
+ * waiting flows, and tracking completion. Bind snapshot to `$state` for reactivity.
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * // lib/flow.svelte.ts
228
+ * import { createFlowAdapter } from '@raisindb/client/svelte';
229
+ * import { db } from '$lib/raisin';
230
+ *
231
+ * const adapter = createFlowAdapter({ database: db });
232
+ * let snapshot = $state(adapter.getSnapshot());
233
+ * adapter.subscribe(s => { snapshot = s; });
234
+ *
235
+ * export const flow = {
236
+ * get events() { return snapshot.events; },
237
+ * get status() { return snapshot.status; },
238
+ * get isRunning() { return snapshot.isRunning; },
239
+ * get error() { return snapshot.error; },
240
+ * get output() { return snapshot.output; },
241
+ * run: adapter.run,
242
+ * resume: adapter.resume,
243
+ * reset: adapter.reset,
244
+ * };
245
+ * ```
246
+ */
247
+ declare function createFlowAdapter(options: FlowAdapterOptions): FlowAdapter;
248
+
249
+ /**
250
+ * Context value for the RaisinDB Svelte integration.
251
+ *
252
+ * Use with Svelte's `setContext`/`getContext` in `.svelte` files.
253
+ *
254
+ * @example Setup in `+layout.svelte`:
255
+ * ```svelte
256
+ * <script>
257
+ * import { setContext } from 'svelte';
258
+ * import { RAISIN_CONTEXT_KEY, type RaisinContext } from '@raisindb/client/svelte';
259
+ * import { client } from '$lib/raisin';
260
+ *
261
+ * setContext<RaisinContext>(RAISIN_CONTEXT_KEY, { client, repository: 'myrepo' });
262
+ * </script>
263
+ *
264
+ * {@render children()}
265
+ * ```
266
+ *
267
+ * @example Usage in a child component:
268
+ * ```svelte
269
+ * <script>
270
+ * import { getContext } from 'svelte';
271
+ * import { RAISIN_CONTEXT_KEY, type RaisinContext } from '@raisindb/client/svelte';
272
+ *
273
+ * const { client, repository } = getContext<RaisinContext>(RAISIN_CONTEXT_KEY);
274
+ * const db = client.database(repository!);
275
+ * </script>
276
+ * ```
277
+ */
278
+ interface RaisinContext {
279
+ client: RaisinClient;
280
+ repository?: string;
281
+ }
282
+ /**
283
+ * Shared context key for RaisinDB. Use this with `setContext` and `getContext`
284
+ * to ensure consistent key usage across your application.
285
+ */
286
+ declare const RAISIN_CONTEXT_KEY: unique symbol;
287
+
288
+ export { type AuthAdapter, type AuthSnapshot, type ConnectionAdapter, type ConnectionSnapshot, type FlowAdapter, type FlowAdapterOptions, type FlowSnapshot, type FlowStatus, RAISIN_CONTEXT_KEY, type RaisinContext, type SubscriptionAdapter, createAuthAdapter, createConnectionAdapter, createConversationAdapter, createConversationListAdapter, createFlowAdapter, createSubscriptionAdapter };