@raisindb/client 0.1.5 → 0.1.17

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,301 @@
1
+ import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-CNcVagmw.js';
2
+
3
+ /**
4
+ * React adapters for the RaisinDB conversation stores.
5
+ *
6
+ * Since the SDK does not depend on React, the hooks accept React as a
7
+ * parameter to avoid a hard dependency while providing full type safety.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import React from 'react';
12
+ * import { useConversation, useConversationList } from '@raisindb/client';
13
+ *
14
+ * function Chat() {
15
+ * const chat = useConversation(React, {
16
+ * database: db,
17
+ * conversationPath: '/...',
18
+ * });
19
+ * return (
20
+ * <div>
21
+ * {chat.messages.map((m, i) => <div key={i}>{m.content}</div>)}
22
+ * {chat.isStreaming && <p>{chat.streamingText}</p>}
23
+ * </div>
24
+ * );
25
+ * }
26
+ * ```
27
+ */
28
+
29
+ /** Minimal subset of the React API needed by the hooks */
30
+ interface ReactLike {
31
+ useState<T>(initial: T | (() => T)): [T, (value: T | ((prev: T) => T)) => void];
32
+ useEffect(effect: () => void | (() => void), deps?: unknown[]): void;
33
+ useRef<T>(initial: T): {
34
+ current: T;
35
+ };
36
+ useCallback<T extends (...args: never[]) => unknown>(fn: T, deps: unknown[]): T;
37
+ }
38
+ interface UseConversationReturn extends ConversationStoreSnapshot {
39
+ sendMessage: (content: string) => Promise<void>;
40
+ approvePlan: (planPath: string) => Promise<void>;
41
+ rejectPlan: (planPath: string, feedback?: string) => Promise<void>;
42
+ stop: () => void;
43
+ loadMessages: () => Promise<ChatMessage[]>;
44
+ }
45
+ declare function useConversation(react: ReactLike, options: ConversationStoreOptions): UseConversationReturn;
46
+ interface UseConversationListReturn extends ConversationListSnapshot {
47
+ createConversation: (options: {
48
+ participant: string;
49
+ subject?: string;
50
+ }) => Promise<ConversationListItem>;
51
+ deleteConversation: (conversationPath: string) => Promise<void>;
52
+ markAsRead: (conversationPath: string) => Promise<void>;
53
+ }
54
+ declare function useConversationList(react: ReactLike, options: ConversationListStoreOptions): UseConversationListReturn;
55
+
56
+ /**
57
+ * Extended React-like interface that includes context and rendering APIs
58
+ * needed by the Provider and context-consuming hooks.
59
+ */
60
+ interface ReactLikeWithContext extends ReactLike {
61
+ createContext<T>(defaultValue: T): ReactContext<T>;
62
+ useContext<T>(context: ReactContext<T>): T;
63
+ useMemo<T>(factory: () => T, deps: unknown[]): T;
64
+ createElement(type: unknown, props: unknown, ...children: unknown[]): any;
65
+ }
66
+ /** Minimal React context interface */
67
+ interface ReactContext<T> {
68
+ Provider: unknown;
69
+ Consumer?: unknown;
70
+ displayName?: string;
71
+ /** Default value (used internally by React) */
72
+ _currentValue?: T;
73
+ }
74
+ /** Props for the RaisinProvider component */
75
+ interface RaisinProviderProps {
76
+ client: RaisinClient;
77
+ repository?: string;
78
+ children?: unknown;
79
+ }
80
+ /** Value stored in the Raisin context */
81
+ interface RaisinContextValue {
82
+ client: RaisinClient;
83
+ repository?: string;
84
+ }
85
+ /** Return type for useAuth() */
86
+ interface UseAuthReturn {
87
+ user: IdentityUser | null;
88
+ isAuthenticated: boolean;
89
+ isLoading: boolean;
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
+ }
98
+ /** Return type for useConnection() */
99
+ interface UseConnectionReturn {
100
+ state: ConnectionState;
101
+ isConnected: boolean;
102
+ isReady: boolean;
103
+ connect: () => Promise<void>;
104
+ disconnect: () => void;
105
+ }
106
+ /** Options for useSql() */
107
+ interface UseSqlOptions {
108
+ enabled?: boolean;
109
+ repository?: string;
110
+ refetchOnReconnect?: boolean;
111
+ realtime?: {
112
+ workspace: string;
113
+ eventTypes?: string[];
114
+ path?: string;
115
+ nodeType?: string;
116
+ };
117
+ }
118
+ /** Return type for useSql<T>() */
119
+ interface UseSqlReturn<T> {
120
+ data: T[] | null;
121
+ isLoading: boolean;
122
+ error: Error | null;
123
+ refetch: () => Promise<void>;
124
+ }
125
+ /** Options for useSubscription() */
126
+ interface UseSubscriptionOptions extends SubscriptionFilters {
127
+ enabled?: boolean;
128
+ }
129
+
130
+ /**
131
+ * React flow adapter for RaisinDB.
132
+ *
133
+ * Provides a `useFlow` hook that wraps the FlowClient for executing
134
+ * and monitoring RaisinDB flows in React applications. Returns reactive
135
+ * state tracking flow events, status, and providing control actions.
136
+ *
137
+ * Since this SDK package does not depend on React, the hook accepts
138
+ * React as a parameter via the `ReactLike` interface.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * import React from 'react';
143
+ * import { useFlow } from '@raisindb/client';
144
+ *
145
+ * function OrderProcessor() {
146
+ * const flow = useFlow(React, {
147
+ * baseUrl: 'http://localhost:8081',
148
+ * repository: 'my-repo',
149
+ * authManager,
150
+ * });
151
+ *
152
+ * const handleRun = async () => {
153
+ * await flow.run('/flows/process-order', { orderId: 'ord-123' });
154
+ * };
155
+ *
156
+ * return (
157
+ * <div>
158
+ * <button onClick={handleRun} disabled={flow.isRunning}>Run</button>
159
+ * <p>Status: {flow.status}</p>
160
+ * {flow.events.map((e, i) => <div key={i}>{e.type}</div>)}
161
+ * {flow.error && <p className="error">{flow.error}</p>}
162
+ * </div>
163
+ * );
164
+ * }
165
+ * ```
166
+ */
167
+
168
+ /** Options for creating the FlowClient within useFlow */
169
+ interface UseFlowOptions {
170
+ /**
171
+ * Pre-configured Database instance (from `client.database()`).
172
+ * When provided, `baseUrl`, `repository`, `authManager`, and `flowsApi` are derived
173
+ * automatically — no manual wiring needed.
174
+ */
175
+ database?: Database;
176
+ /** Base HTTP URL of the RaisinDB server */
177
+ baseUrl?: string;
178
+ /** Repository name */
179
+ repository?: string;
180
+ /** Auth manager for token access */
181
+ authManager?: AuthManager;
182
+ /** Additional FlowClient options */
183
+ clientOptions?: FlowClientOptions;
184
+ /** Optional FlowsApi for WebSocket-based flow operations */
185
+ flowsApi?: FlowsApi;
186
+ }
187
+ /** Flow execution status */
188
+ type FlowStatus = 'idle' | 'running' | 'waiting' | 'completed' | 'failed';
189
+ /** Return value from the useFlow hook */
190
+ interface UseFlowReturn {
191
+ /** Collected flow execution events */
192
+ events: FlowExecutionEvent[];
193
+ /** Current flow status */
194
+ status: FlowStatus;
195
+ /** Whether a flow is currently running */
196
+ isRunning: boolean;
197
+ /** Current error, if any */
198
+ error: string | null;
199
+ /** Output from the completed flow */
200
+ output: unknown | null;
201
+ /** Current flow instance ID, if running */
202
+ instanceId: string | null;
203
+ /** Run a flow by path with optional input data */
204
+ run: (flowPath: string, input?: Record<string, unknown>) => Promise<void>;
205
+ /** Resume a waiting flow with data */
206
+ resume: (data: unknown) => Promise<void>;
207
+ /** Reset the hook state (clear events, status, error) */
208
+ reset: () => void;
209
+ }
210
+ /**
211
+ * React hook for executing and monitoring RaisinDB flows.
212
+ *
213
+ * Manages the full lifecycle: starting a flow, streaming events,
214
+ * resuming waiting flows, and tracking completion status.
215
+ * Auto-cleans up on component unmount.
216
+ *
217
+ * @param react - The React instance (pass `React` or `{ useState, useEffect, useRef, useCallback }`)
218
+ * @param options - Flow client options (baseUrl, repository, authManager, etc.)
219
+ * @returns Reactive flow state and action functions
220
+ *
221
+ * @example
222
+ * ```tsx
223
+ * import React from 'react';
224
+ * import { useFlow } from '@raisindb/client';
225
+ *
226
+ * function DataPipeline() {
227
+ * const flow = useFlow(React, {
228
+ * baseUrl: 'http://localhost:8081',
229
+ * repository: 'my-repo',
230
+ * authManager,
231
+ * });
232
+ *
233
+ * return (
234
+ * <div>
235
+ * <button onClick={() => flow.run('/flows/etl', { source: 'api' })}>
236
+ * Start Pipeline
237
+ * </button>
238
+ * <p>Status: {flow.status}</p>
239
+ * <p>Events: {flow.events.length}</p>
240
+ * {flow.status === 'waiting' && (
241
+ * <button onClick={() => flow.resume({ approved: true })}>
242
+ * Approve
243
+ * </button>
244
+ * )}
245
+ * {flow.output && <pre>{JSON.stringify(flow.output, null, 2)}</pre>}
246
+ * </div>
247
+ * );
248
+ * }
249
+ * ```
250
+ */
251
+ declare function useFlow(react: ReactLike, options: UseFlowOptions): UseFlowReturn;
252
+
253
+ /**
254
+ * React integration layer for RaisinDB.
255
+ *
256
+ * Provides a `createRaisinReact(React)` factory that returns a Provider
257
+ * component and hooks for auth, connection, queries, and subscriptions.
258
+ *
259
+ * Uses the "bring your own React" pattern to avoid a peer dependency.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * import React from 'react';
264
+ * import { RaisinClient, LocalStorageTokenStorage, createRaisinReact } from '@raisindb/client';
265
+ *
266
+ * const client = new RaisinClient('wss://localhost:8443/sys/default/myrepo', {
267
+ * tokenStorage: new LocalStorageTokenStorage('myrepo'),
268
+ * });
269
+ *
270
+ * export const {
271
+ * RaisinProvider, useAuth, useConnection, useDatabase,
272
+ * useSql, useSubscription, useConversation, useFlow,
273
+ * } = createRaisinReact(React);
274
+ * ```
275
+ */
276
+
277
+ interface RaisinReact {
278
+ RaisinProvider: (props: RaisinProviderProps) => any;
279
+ useRaisinClient: () => RaisinClient;
280
+ useDatabase: (repository?: string) => Database;
281
+ useAuth: () => UseAuthReturn;
282
+ useConnection: () => UseConnectionReturn;
283
+ useSql: <T = Record<string, unknown>>(sql: string, params?: unknown[], options?: UseSqlOptions) => UseSqlReturn<T>;
284
+ useSubscription: (options: UseSubscriptionOptions, callback: (event: EventMessage) => void) => void;
285
+ useConversation: (options: ConversationStoreOptions) => UseConversationReturn;
286
+ useConversationList: (options: ConversationListStoreOptions) => UseConversationListReturn;
287
+ useFlow: (options: UseFlowOptions) => UseFlowReturn;
288
+ }
289
+ /**
290
+ * Create the full React integration for RaisinDB.
291
+ *
292
+ * Accepts a React instance and returns a Provider component plus hooks.
293
+ * The React instance must include `createContext`, `useContext`, `useMemo`,
294
+ * and `createElement` in addition to the base `ReactLike` interface.
295
+ *
296
+ * @param react - The React instance
297
+ * @returns Provider component and hooks
298
+ */
299
+ declare function createRaisinReact(react: ReactLikeWithContext): RaisinReact;
300
+
301
+ export { type FlowStatus as F, type ReactLike as R, type UseConversationReturn as U, useConversationList as a, type UseConversationListReturn as b, useFlow as c, type UseFlowOptions as d, type UseFlowReturn as e, createRaisinReact as f, type RaisinReact as g, type ReactLikeWithContext as h, type RaisinProviderProps as i, type RaisinContextValue as j, type UseAuthReturn as k, type UseConnectionReturn as l, type UseSqlOptions as m, type UseSqlReturn as n, type UseSubscriptionOptions as o, useConversation as u };
@@ -0,0 +1,301 @@
1
+ import { f as ConversationStoreOptions, a as ConversationStoreSnapshot, b as ChatMessage, g as ConversationListStoreOptions, h as ConversationListSnapshot, d as ConversationListItem, R as RaisinClient, I as IdentityUser, C as ConnectionState, S as SubscriptionFilters, D as Database, A as AuthManager, F as FlowClientOptions, i as FlowsApi, j as FlowExecutionEvent, E as EventMessage } from './conversation-list-store-CNcVagmw.mjs';
2
+
3
+ /**
4
+ * React adapters for the RaisinDB conversation stores.
5
+ *
6
+ * Since the SDK does not depend on React, the hooks accept React as a
7
+ * parameter to avoid a hard dependency while providing full type safety.
8
+ *
9
+ * @example
10
+ * ```tsx
11
+ * import React from 'react';
12
+ * import { useConversation, useConversationList } from '@raisindb/client';
13
+ *
14
+ * function Chat() {
15
+ * const chat = useConversation(React, {
16
+ * database: db,
17
+ * conversationPath: '/...',
18
+ * });
19
+ * return (
20
+ * <div>
21
+ * {chat.messages.map((m, i) => <div key={i}>{m.content}</div>)}
22
+ * {chat.isStreaming && <p>{chat.streamingText}</p>}
23
+ * </div>
24
+ * );
25
+ * }
26
+ * ```
27
+ */
28
+
29
+ /** Minimal subset of the React API needed by the hooks */
30
+ interface ReactLike {
31
+ useState<T>(initial: T | (() => T)): [T, (value: T | ((prev: T) => T)) => void];
32
+ useEffect(effect: () => void | (() => void), deps?: unknown[]): void;
33
+ useRef<T>(initial: T): {
34
+ current: T;
35
+ };
36
+ useCallback<T extends (...args: never[]) => unknown>(fn: T, deps: unknown[]): T;
37
+ }
38
+ interface UseConversationReturn extends ConversationStoreSnapshot {
39
+ sendMessage: (content: string) => Promise<void>;
40
+ approvePlan: (planPath: string) => Promise<void>;
41
+ rejectPlan: (planPath: string, feedback?: string) => Promise<void>;
42
+ stop: () => void;
43
+ loadMessages: () => Promise<ChatMessage[]>;
44
+ }
45
+ declare function useConversation(react: ReactLike, options: ConversationStoreOptions): UseConversationReturn;
46
+ interface UseConversationListReturn extends ConversationListSnapshot {
47
+ createConversation: (options: {
48
+ participant: string;
49
+ subject?: string;
50
+ }) => Promise<ConversationListItem>;
51
+ deleteConversation: (conversationPath: string) => Promise<void>;
52
+ markAsRead: (conversationPath: string) => Promise<void>;
53
+ }
54
+ declare function useConversationList(react: ReactLike, options: ConversationListStoreOptions): UseConversationListReturn;
55
+
56
+ /**
57
+ * Extended React-like interface that includes context and rendering APIs
58
+ * needed by the Provider and context-consuming hooks.
59
+ */
60
+ interface ReactLikeWithContext extends ReactLike {
61
+ createContext<T>(defaultValue: T): ReactContext<T>;
62
+ useContext<T>(context: ReactContext<T>): T;
63
+ useMemo<T>(factory: () => T, deps: unknown[]): T;
64
+ createElement(type: unknown, props: unknown, ...children: unknown[]): any;
65
+ }
66
+ /** Minimal React context interface */
67
+ interface ReactContext<T> {
68
+ Provider: unknown;
69
+ Consumer?: unknown;
70
+ displayName?: string;
71
+ /** Default value (used internally by React) */
72
+ _currentValue?: T;
73
+ }
74
+ /** Props for the RaisinProvider component */
75
+ interface RaisinProviderProps {
76
+ client: RaisinClient;
77
+ repository?: string;
78
+ children?: unknown;
79
+ }
80
+ /** Value stored in the Raisin context */
81
+ interface RaisinContextValue {
82
+ client: RaisinClient;
83
+ repository?: string;
84
+ }
85
+ /** Return type for useAuth() */
86
+ interface UseAuthReturn {
87
+ user: IdentityUser | null;
88
+ isAuthenticated: boolean;
89
+ isLoading: boolean;
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
+ }
98
+ /** Return type for useConnection() */
99
+ interface UseConnectionReturn {
100
+ state: ConnectionState;
101
+ isConnected: boolean;
102
+ isReady: boolean;
103
+ connect: () => Promise<void>;
104
+ disconnect: () => void;
105
+ }
106
+ /** Options for useSql() */
107
+ interface UseSqlOptions {
108
+ enabled?: boolean;
109
+ repository?: string;
110
+ refetchOnReconnect?: boolean;
111
+ realtime?: {
112
+ workspace: string;
113
+ eventTypes?: string[];
114
+ path?: string;
115
+ nodeType?: string;
116
+ };
117
+ }
118
+ /** Return type for useSql<T>() */
119
+ interface UseSqlReturn<T> {
120
+ data: T[] | null;
121
+ isLoading: boolean;
122
+ error: Error | null;
123
+ refetch: () => Promise<void>;
124
+ }
125
+ /** Options for useSubscription() */
126
+ interface UseSubscriptionOptions extends SubscriptionFilters {
127
+ enabled?: boolean;
128
+ }
129
+
130
+ /**
131
+ * React flow adapter for RaisinDB.
132
+ *
133
+ * Provides a `useFlow` hook that wraps the FlowClient for executing
134
+ * and monitoring RaisinDB flows in React applications. Returns reactive
135
+ * state tracking flow events, status, and providing control actions.
136
+ *
137
+ * Since this SDK package does not depend on React, the hook accepts
138
+ * React as a parameter via the `ReactLike` interface.
139
+ *
140
+ * @example
141
+ * ```tsx
142
+ * import React from 'react';
143
+ * import { useFlow } from '@raisindb/client';
144
+ *
145
+ * function OrderProcessor() {
146
+ * const flow = useFlow(React, {
147
+ * baseUrl: 'http://localhost:8081',
148
+ * repository: 'my-repo',
149
+ * authManager,
150
+ * });
151
+ *
152
+ * const handleRun = async () => {
153
+ * await flow.run('/flows/process-order', { orderId: 'ord-123' });
154
+ * };
155
+ *
156
+ * return (
157
+ * <div>
158
+ * <button onClick={handleRun} disabled={flow.isRunning}>Run</button>
159
+ * <p>Status: {flow.status}</p>
160
+ * {flow.events.map((e, i) => <div key={i}>{e.type}</div>)}
161
+ * {flow.error && <p className="error">{flow.error}</p>}
162
+ * </div>
163
+ * );
164
+ * }
165
+ * ```
166
+ */
167
+
168
+ /** Options for creating the FlowClient within useFlow */
169
+ interface UseFlowOptions {
170
+ /**
171
+ * Pre-configured Database instance (from `client.database()`).
172
+ * When provided, `baseUrl`, `repository`, `authManager`, and `flowsApi` are derived
173
+ * automatically — no manual wiring needed.
174
+ */
175
+ database?: Database;
176
+ /** Base HTTP URL of the RaisinDB server */
177
+ baseUrl?: string;
178
+ /** Repository name */
179
+ repository?: string;
180
+ /** Auth manager for token access */
181
+ authManager?: AuthManager;
182
+ /** Additional FlowClient options */
183
+ clientOptions?: FlowClientOptions;
184
+ /** Optional FlowsApi for WebSocket-based flow operations */
185
+ flowsApi?: FlowsApi;
186
+ }
187
+ /** Flow execution status */
188
+ type FlowStatus = 'idle' | 'running' | 'waiting' | 'completed' | 'failed';
189
+ /** Return value from the useFlow hook */
190
+ interface UseFlowReturn {
191
+ /** Collected flow execution events */
192
+ events: FlowExecutionEvent[];
193
+ /** Current flow status */
194
+ status: FlowStatus;
195
+ /** Whether a flow is currently running */
196
+ isRunning: boolean;
197
+ /** Current error, if any */
198
+ error: string | null;
199
+ /** Output from the completed flow */
200
+ output: unknown | null;
201
+ /** Current flow instance ID, if running */
202
+ instanceId: string | null;
203
+ /** Run a flow by path with optional input data */
204
+ run: (flowPath: string, input?: Record<string, unknown>) => Promise<void>;
205
+ /** Resume a waiting flow with data */
206
+ resume: (data: unknown) => Promise<void>;
207
+ /** Reset the hook state (clear events, status, error) */
208
+ reset: () => void;
209
+ }
210
+ /**
211
+ * React hook for executing and monitoring RaisinDB flows.
212
+ *
213
+ * Manages the full lifecycle: starting a flow, streaming events,
214
+ * resuming waiting flows, and tracking completion status.
215
+ * Auto-cleans up on component unmount.
216
+ *
217
+ * @param react - The React instance (pass `React` or `{ useState, useEffect, useRef, useCallback }`)
218
+ * @param options - Flow client options (baseUrl, repository, authManager, etc.)
219
+ * @returns Reactive flow state and action functions
220
+ *
221
+ * @example
222
+ * ```tsx
223
+ * import React from 'react';
224
+ * import { useFlow } from '@raisindb/client';
225
+ *
226
+ * function DataPipeline() {
227
+ * const flow = useFlow(React, {
228
+ * baseUrl: 'http://localhost:8081',
229
+ * repository: 'my-repo',
230
+ * authManager,
231
+ * });
232
+ *
233
+ * return (
234
+ * <div>
235
+ * <button onClick={() => flow.run('/flows/etl', { source: 'api' })}>
236
+ * Start Pipeline
237
+ * </button>
238
+ * <p>Status: {flow.status}</p>
239
+ * <p>Events: {flow.events.length}</p>
240
+ * {flow.status === 'waiting' && (
241
+ * <button onClick={() => flow.resume({ approved: true })}>
242
+ * Approve
243
+ * </button>
244
+ * )}
245
+ * {flow.output && <pre>{JSON.stringify(flow.output, null, 2)}</pre>}
246
+ * </div>
247
+ * );
248
+ * }
249
+ * ```
250
+ */
251
+ declare function useFlow(react: ReactLike, options: UseFlowOptions): UseFlowReturn;
252
+
253
+ /**
254
+ * React integration layer for RaisinDB.
255
+ *
256
+ * Provides a `createRaisinReact(React)` factory that returns a Provider
257
+ * component and hooks for auth, connection, queries, and subscriptions.
258
+ *
259
+ * Uses the "bring your own React" pattern to avoid a peer dependency.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * import React from 'react';
264
+ * import { RaisinClient, LocalStorageTokenStorage, createRaisinReact } from '@raisindb/client';
265
+ *
266
+ * const client = new RaisinClient('wss://localhost:8443/sys/default/myrepo', {
267
+ * tokenStorage: new LocalStorageTokenStorage('myrepo'),
268
+ * });
269
+ *
270
+ * export const {
271
+ * RaisinProvider, useAuth, useConnection, useDatabase,
272
+ * useSql, useSubscription, useConversation, useFlow,
273
+ * } = createRaisinReact(React);
274
+ * ```
275
+ */
276
+
277
+ interface RaisinReact {
278
+ RaisinProvider: (props: RaisinProviderProps) => any;
279
+ useRaisinClient: () => RaisinClient;
280
+ useDatabase: (repository?: string) => Database;
281
+ useAuth: () => UseAuthReturn;
282
+ useConnection: () => UseConnectionReturn;
283
+ useSql: <T = Record<string, unknown>>(sql: string, params?: unknown[], options?: UseSqlOptions) => UseSqlReturn<T>;
284
+ useSubscription: (options: UseSubscriptionOptions, callback: (event: EventMessage) => void) => void;
285
+ useConversation: (options: ConversationStoreOptions) => UseConversationReturn;
286
+ useConversationList: (options: ConversationListStoreOptions) => UseConversationListReturn;
287
+ useFlow: (options: UseFlowOptions) => UseFlowReturn;
288
+ }
289
+ /**
290
+ * Create the full React integration for RaisinDB.
291
+ *
292
+ * Accepts a React instance and returns a Provider component plus hooks.
293
+ * The React instance must include `createContext`, `useContext`, `useMemo`,
294
+ * and `createElement` in addition to the base `ReactLike` interface.
295
+ *
296
+ * @param react - The React instance
297
+ * @returns Provider component and hooks
298
+ */
299
+ declare function createRaisinReact(react: ReactLikeWithContext): RaisinReact;
300
+
301
+ export { type FlowStatus as F, type ReactLike as R, type UseConversationReturn as U, useConversationList as a, type UseConversationListReturn as b, useFlow as c, type UseFlowOptions as d, type UseFlowReturn as e, createRaisinReact as f, type RaisinReact as g, type ReactLikeWithContext as h, type RaisinProviderProps as i, type RaisinContextValue as j, type UseAuthReturn as k, type UseConnectionReturn as l, type UseSqlOptions as m, type UseSqlReturn as n, type UseSubscriptionOptions as o, useConversation as u };