@plyaz/types 1.35.4 → 1.36.1
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.
- package/dist/api/index.cjs +199 -1
- package/dist/api/index.cjs.map +1 -1
- package/dist/api/index.js +199 -1
- package/dist/api/index.js.map +1 -1
- package/dist/auth/index.cjs +1 -2
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.js +1 -2
- package/dist/auth/index.js.map +1 -1
- package/dist/campaign/schemas.d.ts +1 -1
- package/dist/core/domain/files/enums.d.ts +36 -0
- package/dist/core/domain/files/index.d.ts +6 -1
- package/dist/core/domain/files/schemas.d.ts +183 -0
- package/dist/core/domain/files/streaming.d.ts +167 -0
- package/dist/core/domain/files/types.d.ts +5 -67
- package/dist/core/events/index.d.ts +2 -0
- package/dist/core/events/streaming/index.d.ts +18 -0
- package/dist/core/events/streaming/responses.d.ts +164 -0
- package/dist/core/events/streaming/types.d.ts +408 -0
- package/dist/core/frontend/index.d.ts +1 -1
- package/dist/core/frontend/types.d.ts +179 -5
- package/dist/core/index.cjs +221 -0
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +192 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/init/index.d.ts +1 -1
- package/dist/core/init/types.d.ts +51 -0
- package/dist/errors/codes.d.ts +47 -0
- package/dist/errors/enums.d.ts +1 -0
- package/dist/errors/index.cjs +231 -1
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.js +231 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/errors/types.d.ts +15 -0
- package/dist/examples/schemas.d.ts +1 -1
- package/dist/index.cjs +450 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +420 -2
- package/dist/index.js.map +1 -1
- package/dist/store/files/index.d.ts +1 -1
- package/dist/store/files/types.d.ts +47 -1
- package/dist/store/index.d.ts +1 -0
- package/dist/store/stream/index.d.ts +9 -0
- package/dist/store/stream/types.d.ts +303 -0
- package/dist/store/types.d.ts +3 -0
- package/package.json +1 -1
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Store types for files/media domain.
|
|
5
5
|
*/
|
|
6
|
-
export type { FilesStoreItem, GeneratedFileItem, FilesFrontendStoreState, FilesFrontendStoreData, FilesFrontendStoreActions, FilesFrontendStoreSlice, FilesStoreSelectors, } from './types';
|
|
6
|
+
export type { FilesStoreItem, GeneratedFileItem, FileUploadProgressState, FileDownloadProgressState, FileGenerateProgress, FilesFrontendStoreState, FilesFrontendStoreData, FilesFrontendStoreActions, FilesFrontendStoreSlice, FilesStoreSelectors, } from './types';
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* API types are in @plyaz/types/api/endpoints/files.
|
|
7
7
|
*/
|
|
8
8
|
import type { CoreBaseFrontendStore } from '../../core/frontend';
|
|
9
|
-
import type { FilesEntity, FileType } from '../../core/domain/files';
|
|
9
|
+
import type { FilesEntity, FileType, FilesDownloadStreamProgress } from '../../core/domain/files';
|
|
10
|
+
import type { UploadProgressEvent } from '../../storage';
|
|
10
11
|
/**
|
|
11
12
|
* Serializable store item for files
|
|
12
13
|
*/
|
|
@@ -41,6 +42,35 @@ export interface GeneratedFileItem {
|
|
|
41
42
|
filename: string;
|
|
42
43
|
generatedAt: string;
|
|
43
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Extended upload progress with status for store tracking
|
|
47
|
+
* Extends storage's UploadProgressEvent with additional UI state
|
|
48
|
+
*/
|
|
49
|
+
export interface FileUploadProgressState extends UploadProgressEvent {
|
|
50
|
+
/** Upload status for UI display */
|
|
51
|
+
status: 'pending' | 'uploading' | 'downloading' | 'processing' | 'generating' | 'completed' | 'failed' | 'cancelled';
|
|
52
|
+
/** Error message if failed */
|
|
53
|
+
error?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Download progress state for store tracking
|
|
57
|
+
* Extends core's FilesDownloadStreamProgress with additional UI state
|
|
58
|
+
*/
|
|
59
|
+
export interface FileDownloadProgressState extends FilesDownloadStreamProgress {
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Progress state for document generation
|
|
63
|
+
*/
|
|
64
|
+
export interface FileGenerateProgress {
|
|
65
|
+
/** Template ID being generated */
|
|
66
|
+
templateId: string;
|
|
67
|
+
/** Progress percentage (0-100) */
|
|
68
|
+
percentage: number;
|
|
69
|
+
/** Generation status */
|
|
70
|
+
status: 'pending' | 'uploading' | 'downloading' | 'processing' | 'generating' | 'completed' | 'failed' | 'cancelled';
|
|
71
|
+
/** Error message if failed */
|
|
72
|
+
error?: string;
|
|
73
|
+
}
|
|
44
74
|
/**
|
|
45
75
|
* Files store state
|
|
46
76
|
*/
|
|
@@ -55,6 +85,14 @@ export interface FilesFrontendStoreState {
|
|
|
55
85
|
isLoading: boolean;
|
|
56
86
|
isUploading: boolean;
|
|
57
87
|
isGenerating: boolean;
|
|
88
|
+
/** Progress tracking for uploads (keyed by fileId) */
|
|
89
|
+
uploadProgress: Record<string, FileUploadProgressState>;
|
|
90
|
+
/** Progress tracking for downloads (keyed by fileId) */
|
|
91
|
+
downloadProgress: Record<string, FileDownloadProgressState>;
|
|
92
|
+
/** Progress tracking for document generation */
|
|
93
|
+
generateProgress: FileGenerateProgress | null;
|
|
94
|
+
/** Overall upload progress percentage (0-100) for bulk uploads */
|
|
95
|
+
overallUploadProgress: number;
|
|
58
96
|
}
|
|
59
97
|
/**
|
|
60
98
|
* Files store data for setData()
|
|
@@ -85,6 +123,14 @@ export interface FilesFrontendStoreActions extends CoreBaseFrontendStore<FilesFr
|
|
|
85
123
|
setLoading: (isLoading: boolean) => void;
|
|
86
124
|
setUploading: (isUploading: boolean) => void;
|
|
87
125
|
setGenerating: (isGenerating: boolean) => void;
|
|
126
|
+
setUploadProgress: (fileId: string, progress: Partial<FileUploadProgressState>) => void;
|
|
127
|
+
removeUploadProgress: (fileId: string) => void;
|
|
128
|
+
clearUploadProgress: () => void;
|
|
129
|
+
setDownloadProgress: (fileId: string, progress: Partial<FileDownloadProgressState>) => void;
|
|
130
|
+
removeDownloadProgress: (fileId: string) => void;
|
|
131
|
+
clearDownloadProgress: () => void;
|
|
132
|
+
setGenerateProgress: (progress: FileGenerateProgress | null) => void;
|
|
133
|
+
setOverallUploadProgress: (percentage: number) => void;
|
|
88
134
|
reset: () => void;
|
|
89
135
|
}
|
|
90
136
|
/**
|
package/dist/store/index.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream Store Types
|
|
3
|
+
*
|
|
4
|
+
* Export all stream store types.
|
|
5
|
+
*
|
|
6
|
+
* Note: This store is CONNECTION-ONLY.
|
|
7
|
+
* Domain-specific progress belongs in domain stores (files, etc.)
|
|
8
|
+
*/
|
|
9
|
+
export type { StreamMessageHandler, RegisteredStreamHandler, StreamMessageFilter, StreamStoreState, StreamStoreActions, StreamStoreSlice, StreamStoreSelectors, UseStreamStoreResult, UseStreamHandlerOptions, StreamErrorData, StreamSliceConfig, } from './types';
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream Store Types
|
|
3
|
+
*
|
|
4
|
+
* Store state, actions, and slice types for real-time streaming.
|
|
5
|
+
* This is a GLOBAL store slice (like errors, featureFlags), NOT per-service.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: This store handles CONNECTION STATE and MESSAGE HISTORY only.
|
|
8
|
+
* - Domain-specific progress belongs in domain stores (files, etc.)
|
|
9
|
+
* - Stream errors go to the GLOBAL errors store (not stream store)
|
|
10
|
+
*
|
|
11
|
+
* Domain stores (like files) use selectors to filter messages from this store
|
|
12
|
+
* by type, subtype, scope, transport, etc.
|
|
13
|
+
*/
|
|
14
|
+
import type { PackageErrorLike } from '../../errors';
|
|
15
|
+
import type { StreamMessage, StreamMessageType, StreamMessageSubtype, StreamMessageScope, StreamTransportType } from '../../core/events/streaming';
|
|
16
|
+
/**
|
|
17
|
+
* Stream message handler function.
|
|
18
|
+
* Domain services register handlers to receive and process stream messages.
|
|
19
|
+
*
|
|
20
|
+
* @typeParam T - Type of message.data payload (default: unknown)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // Type-safe handler for upload progress
|
|
25
|
+
* const handler: StreamMessageHandler<FilesUploadStreamProgress> = (message) => {
|
|
26
|
+
* // message.data is typed as FilesUploadStreamProgress
|
|
27
|
+
* console.log(message.data.percentage);
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export type StreamMessageHandler<T = unknown> = (message: StreamMessage<T>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Registered message handler with metadata
|
|
34
|
+
*/
|
|
35
|
+
export interface RegisteredStreamHandler {
|
|
36
|
+
/** Handler function (stores as unknown for registry, typed at call site) */
|
|
37
|
+
handler: StreamMessageHandler<unknown>;
|
|
38
|
+
/** Channels this handler is interested in (empty = all channels) */
|
|
39
|
+
channels: string[];
|
|
40
|
+
/** Event types this handler is interested in (empty = all events) */
|
|
41
|
+
events: string[];
|
|
42
|
+
/** Handler priority (higher = called first) */
|
|
43
|
+
priority: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for filtering stream messages
|
|
47
|
+
*/
|
|
48
|
+
export interface StreamMessageFilter {
|
|
49
|
+
/** Filter by message type */
|
|
50
|
+
type?: StreamMessageType | StreamMessageType[];
|
|
51
|
+
/** Filter by message subtype */
|
|
52
|
+
subtype?: StreamMessageSubtype | StreamMessageSubtype[];
|
|
53
|
+
/** Filter by domain scope */
|
|
54
|
+
scope?: StreamMessageScope | StreamMessageScope[];
|
|
55
|
+
/** Filter by transport */
|
|
56
|
+
transport?: StreamTransportType | StreamTransportType[];
|
|
57
|
+
/** Filter by channel (exact or prefix match) */
|
|
58
|
+
channel?: string | string[];
|
|
59
|
+
/** Filter by event name */
|
|
60
|
+
event?: string | string[];
|
|
61
|
+
/** Limit number of results */
|
|
62
|
+
limit?: number;
|
|
63
|
+
/** Only messages after this timestamp */
|
|
64
|
+
since?: number;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Global stream store state
|
|
68
|
+
*
|
|
69
|
+
* This is a GLOBAL slice (like errors, featureFlags), NOT per-service like primaryStore.
|
|
70
|
+
* Handles CONNECTION STATE and MESSAGE HISTORY only.
|
|
71
|
+
*
|
|
72
|
+
* NOTE: Stream errors go to the GLOBAL errors store, NOT here.
|
|
73
|
+
* Domain progress belongs in domain stores (files, etc.).
|
|
74
|
+
*/
|
|
75
|
+
export interface StreamStoreState {
|
|
76
|
+
/** Whether SSE/WebSocket connection is established */
|
|
77
|
+
connected: boolean;
|
|
78
|
+
/** Connection error (if any) - also added to global errors store */
|
|
79
|
+
connectionError: PackageErrorLike | null;
|
|
80
|
+
/** Connection ID (from server) */
|
|
81
|
+
connectionId: string | null;
|
|
82
|
+
/** Transport type in use */
|
|
83
|
+
transport: 'sse' | 'websocket' | null;
|
|
84
|
+
/** Reconnect attempt count */
|
|
85
|
+
reconnectAttempts: number;
|
|
86
|
+
/**
|
|
87
|
+
* Recent messages with full metadata (type, subtype, scope, transport).
|
|
88
|
+
* Domain stores use selectors to filter messages from this list.
|
|
89
|
+
* Automatically trimmed to last N messages (configurable).
|
|
90
|
+
*/
|
|
91
|
+
messages: StreamMessage[];
|
|
92
|
+
/** Maximum messages to keep */
|
|
93
|
+
maxMessages: number;
|
|
94
|
+
/**
|
|
95
|
+
* Currently subscribed channels
|
|
96
|
+
* Updated by domain services via subscribeToChannel/unsubscribeFromChannel
|
|
97
|
+
*/
|
|
98
|
+
subscribedChannels: string[];
|
|
99
|
+
/**
|
|
100
|
+
* Registered message handlers by ID
|
|
101
|
+
* Domain services register handlers to receive their stream messages
|
|
102
|
+
*/
|
|
103
|
+
handlers: Record<string, RegisteredStreamHandler>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Stream store actions
|
|
107
|
+
*
|
|
108
|
+
* Note: No progress actions here - those belong in domain stores!
|
|
109
|
+
* Stream errors go to the GLOBAL errors store.
|
|
110
|
+
* This store manages connection state, message history, and routing.
|
|
111
|
+
*/
|
|
112
|
+
export interface StreamStoreActions {
|
|
113
|
+
/** Set connection state */
|
|
114
|
+
setConnected(connected: boolean): void;
|
|
115
|
+
/**
|
|
116
|
+
* Set connection error.
|
|
117
|
+
* NOTE: This also adds the error to the GLOBAL errors store.
|
|
118
|
+
*/
|
|
119
|
+
setConnectionError(error: PackageErrorLike | null): void;
|
|
120
|
+
/** Set connection ID */
|
|
121
|
+
setConnectionId(id: string | null): void;
|
|
122
|
+
/** Set transport type */
|
|
123
|
+
setTransport(transport: 'sse' | 'websocket' | null): void;
|
|
124
|
+
/** Increment reconnect attempts */
|
|
125
|
+
incrementReconnectAttempts(): void;
|
|
126
|
+
/** Reset reconnect attempts */
|
|
127
|
+
resetReconnectAttempts(): void;
|
|
128
|
+
/**
|
|
129
|
+
* Add a message to history.
|
|
130
|
+
* Messages are stored with full metadata (type, subtype, scope, transport).
|
|
131
|
+
*/
|
|
132
|
+
addMessage(message: StreamMessage): void;
|
|
133
|
+
/** Clear all messages */
|
|
134
|
+
clearMessages(): void;
|
|
135
|
+
/** Set max messages to keep */
|
|
136
|
+
setMaxMessages(max: number): void;
|
|
137
|
+
/**
|
|
138
|
+
* Get messages matching filter criteria.
|
|
139
|
+
* Domain stores use this to select their relevant messages.
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* // Get all upload progress messages
|
|
144
|
+
* const uploadMessages = getMessages({
|
|
145
|
+
* type: 'progress',
|
|
146
|
+
* subtype: 'upload',
|
|
147
|
+
* scope: 'files',
|
|
148
|
+
* });
|
|
149
|
+
*
|
|
150
|
+
* // Get recent SSE messages
|
|
151
|
+
* const sseMessages = getMessages({
|
|
152
|
+
* transport: 'sse',
|
|
153
|
+
* limit: 10,
|
|
154
|
+
* });
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
getMessages(filter?: StreamMessageFilter): StreamMessage[];
|
|
158
|
+
/**
|
|
159
|
+
* Get the latest message matching filter criteria.
|
|
160
|
+
*/
|
|
161
|
+
getLatestMessage(filter?: StreamMessageFilter): StreamMessage | undefined;
|
|
162
|
+
/** Subscribe to a channel */
|
|
163
|
+
subscribeToChannel(channel: string): void;
|
|
164
|
+
/** Subscribe to multiple channels */
|
|
165
|
+
subscribeToChannels(channels: string[]): void;
|
|
166
|
+
/** Unsubscribe from a channel */
|
|
167
|
+
unsubscribeFromChannel(channel: string): void;
|
|
168
|
+
/** Unsubscribe from all channels */
|
|
169
|
+
unsubscribeFromAllChannels(): void;
|
|
170
|
+
/** Check if subscribed to a channel */
|
|
171
|
+
isSubscribedToChannel(channel: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Register a message handler.
|
|
174
|
+
* Domain services use this to receive stream messages and update their own stores.
|
|
175
|
+
*
|
|
176
|
+
* @typeParam T - Type of message.data payload for type-safe handlers
|
|
177
|
+
* @param id - Unique handler ID (e.g., 'files', 'notifications')
|
|
178
|
+
* @param handler - Handler function (generic for type-safe message.data)
|
|
179
|
+
* @param options - Handler options (channels, events, priority)
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* // Type-safe handler for upload progress
|
|
184
|
+
* streamStore.registerHandler<FilesUploadStreamProgress>(
|
|
185
|
+
* 'files:upload',
|
|
186
|
+
* (message) => {
|
|
187
|
+
* // message.data is typed as FilesUploadStreamProgress
|
|
188
|
+
* console.log(message.data.percentage);
|
|
189
|
+
* },
|
|
190
|
+
* { channels: ['uploads'], events: ['upload:progress'] }
|
|
191
|
+
* );
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
registerHandler<T = unknown>(id: string, handler: StreamMessageHandler<T>, options?: {
|
|
195
|
+
channels?: string[];
|
|
196
|
+
events?: string[];
|
|
197
|
+
priority?: number;
|
|
198
|
+
}): void;
|
|
199
|
+
/**
|
|
200
|
+
* Unregister a message handler.
|
|
201
|
+
*
|
|
202
|
+
* @param id - Handler ID to unregister
|
|
203
|
+
*/
|
|
204
|
+
unregisterHandler(id: string): void;
|
|
205
|
+
/**
|
|
206
|
+
* Handle incoming stream message.
|
|
207
|
+
* - Adds message to history with metadata
|
|
208
|
+
* - Routes to registered handlers based on channel/event matching
|
|
209
|
+
* - Handles connection events (connected, heartbeat, close)
|
|
210
|
+
* - Adds error events to global errors store
|
|
211
|
+
*/
|
|
212
|
+
handleMessage(message: StreamMessage): void;
|
|
213
|
+
/** Reset store to initial state */
|
|
214
|
+
reset(): void;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Complete stream store slice (state + actions)
|
|
218
|
+
*/
|
|
219
|
+
export interface StreamStoreSlice extends StreamStoreState, StreamStoreActions {
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Stream store selectors
|
|
223
|
+
*
|
|
224
|
+
* Note: No progress/completed selectors - use domain store selectors instead!
|
|
225
|
+
* e.g., useUploadProgress() from files store
|
|
226
|
+
*
|
|
227
|
+
* Note: No error selectors - stream errors go to GLOBAL errors store.
|
|
228
|
+
* Use useErrors({ scope: 'stream' }) from errors store.
|
|
229
|
+
*/
|
|
230
|
+
export interface StreamStoreSelectors {
|
|
231
|
+
/** Select connection state */
|
|
232
|
+
selectConnected: (state: StreamStoreState) => boolean;
|
|
233
|
+
/** Select connection error */
|
|
234
|
+
selectConnectionError: (state: StreamStoreState) => Error | null;
|
|
235
|
+
/** Select connection ID */
|
|
236
|
+
selectConnectionId: (state: StreamStoreState) => string | null;
|
|
237
|
+
/** Select transport type */
|
|
238
|
+
selectTransport: (state: StreamStoreState) => 'sse' | 'websocket' | null;
|
|
239
|
+
/** Select subscribed channels */
|
|
240
|
+
selectSubscribedChannels: (state: StreamStoreState) => string[];
|
|
241
|
+
/** Select messages (with optional filter) */
|
|
242
|
+
selectMessages: (state: StreamStoreState, filter?: StreamMessageFilter) => StreamMessage[];
|
|
243
|
+
/** Check if connected */
|
|
244
|
+
selectIsConnected: (state: StreamStoreState) => boolean;
|
|
245
|
+
/** Check if reconnecting */
|
|
246
|
+
selectIsReconnecting: (state: StreamStoreState) => boolean;
|
|
247
|
+
/** Select registered handler IDs */
|
|
248
|
+
selectHandlerIds: (state: StreamStoreState) => string[];
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Result type for useStreamStore hook
|
|
252
|
+
*/
|
|
253
|
+
export interface UseStreamStoreResult extends StreamStoreState {
|
|
254
|
+
/** Store actions */
|
|
255
|
+
actions: StreamStoreActions;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Stream error data from an error event message.
|
|
259
|
+
* Used by `onError` callback to create SerializedError.
|
|
260
|
+
*/
|
|
261
|
+
export interface StreamErrorData {
|
|
262
|
+
/** Error code (from STREAM_ERROR_CODES or custom) */
|
|
263
|
+
code?: string;
|
|
264
|
+
/** Error message */
|
|
265
|
+
message: string;
|
|
266
|
+
/** Error context/details */
|
|
267
|
+
context?: Record<string, unknown>;
|
|
268
|
+
/** Original error (if available) */
|
|
269
|
+
originalError?: Error;
|
|
270
|
+
/** Channel where error occurred */
|
|
271
|
+
channel?: string;
|
|
272
|
+
/** Event type that caused error */
|
|
273
|
+
event?: string;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Configuration for creating a stream slice.
|
|
277
|
+
* Used to wire up error routing to the global errors store.
|
|
278
|
+
*/
|
|
279
|
+
export interface StreamSliceConfig {
|
|
280
|
+
/**
|
|
281
|
+
* Callback to add errors to the global errors store.
|
|
282
|
+
* Called when:
|
|
283
|
+
* - setConnectionError is called with an error
|
|
284
|
+
* - handleMessage receives an 'error' event
|
|
285
|
+
* - A registered handler throws an error
|
|
286
|
+
*
|
|
287
|
+
* @param error - Stream error data to be serialized and added
|
|
288
|
+
*/
|
|
289
|
+
onError?: (error: StreamErrorData) => void;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Options for useStreamHandler hook
|
|
293
|
+
*/
|
|
294
|
+
export interface UseStreamHandlerOptions {
|
|
295
|
+
/** Handler ID (must be unique) */
|
|
296
|
+
id: string;
|
|
297
|
+
/** Channels to listen to (empty = all) */
|
|
298
|
+
channels?: string[];
|
|
299
|
+
/** Event types to listen to (empty = all) */
|
|
300
|
+
events?: string[];
|
|
301
|
+
/** Handler priority (higher = called first, default: 0) */
|
|
302
|
+
priority?: number;
|
|
303
|
+
}
|
package/dist/store/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { SerializedError, ErrorStoreActions, ErrorStoreSlice } from '../err
|
|
|
10
10
|
import type { FeatureFlagStoreState, FeatureFlagStoreSlice } from '../features/feature-flag/store.types';
|
|
11
11
|
import type { ExampleFrontendStoreSlice } from '../examples';
|
|
12
12
|
import type { FilesFrontendStoreSlice } from './files/types';
|
|
13
|
+
import type { StreamStoreSlice } from './stream/types';
|
|
13
14
|
/**
|
|
14
15
|
* Configuration for creating an error store.
|
|
15
16
|
*/
|
|
@@ -84,6 +85,8 @@ export interface RootStoreSlice {
|
|
|
84
85
|
errors: ErrorStoreSlice;
|
|
85
86
|
/** Feature flags slice (global) */
|
|
86
87
|
featureFlags: FeatureFlagStoreSlice;
|
|
88
|
+
/** Stream events slice (global) - for real-time SSE/WebSocket */
|
|
89
|
+
stream: StreamStoreSlice;
|
|
87
90
|
/** Example domain slice */
|
|
88
91
|
example: ExampleFrontendStoreSlice;
|
|
89
92
|
/** Files/media domain slice */
|
package/package.json
CHANGED