@statelyai/sdk 0.4.0 → 0.5.0

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.
@@ -0,0 +1,225 @@
1
+ //#region src/patchTypes.d.ts
2
+ type EditorStateType = 'normal' | 'parallel' | 'history' | 'final' | null;
3
+ type CanvasColor = 'green' | 'red' | 'purple' | 'blue' | 'orange' | 'yellow' | 'pink' | 'teal';
4
+ type ActionLocation = {
5
+ nodeId: string;
6
+ group: 'entry' | 'exit';
7
+ } | {
8
+ edgeId: string;
9
+ group: 'transition';
10
+ };
11
+ type GraphPatch = {
12
+ op: 'createNode';
13
+ description?: string;
14
+ id?: string;
15
+ parentId: string;
16
+ key: string;
17
+ type?: EditorStateType;
18
+ x?: number;
19
+ y?: number;
20
+ } | {
21
+ op: 'updateNode';
22
+ description?: string;
23
+ nodeId: string;
24
+ data: {
25
+ key?: string;
26
+ type?: EditorStateType;
27
+ description?: string;
28
+ initialId?: string | null;
29
+ };
30
+ } | {
31
+ op: 'deleteNode';
32
+ description?: string;
33
+ nodeId: string;
34
+ } | {
35
+ op: 'createEdge';
36
+ description?: string;
37
+ id?: string;
38
+ sourceId: string;
39
+ targetId: string;
40
+ eventType: string;
41
+ transitionType?: 'normal' | 'targetless' | 'reenter';
42
+ } | {
43
+ op: 'updateEdge';
44
+ description?: string;
45
+ edgeId: string;
46
+ data: {
47
+ sourceId?: string;
48
+ targetId?: string;
49
+ eventType?: string;
50
+ transitionType?: 'normal' | 'targetless' | 'reenter';
51
+ description?: string | null;
52
+ };
53
+ } | {
54
+ op: 'deleteEdge';
55
+ description?: string;
56
+ edgeId: string;
57
+ } | {
58
+ op: 'createState';
59
+ description?: string;
60
+ id?: string;
61
+ parentId: string;
62
+ key: string;
63
+ type?: EditorStateType;
64
+ x?: number;
65
+ y?: number;
66
+ color?: CanvasColor | null;
67
+ initial?: boolean;
68
+ } | {
69
+ op: 'updateState';
70
+ description?: string;
71
+ stateId: string;
72
+ key?: string;
73
+ type?: EditorStateType;
74
+ stateDescription?: string;
75
+ initialId?: string | null;
76
+ color?: CanvasColor | null;
77
+ meta?: Record<string, unknown> | null;
78
+ history?: 'shallow' | 'deep' | null;
79
+ } | {
80
+ op: 'deleteState';
81
+ description?: string;
82
+ stateId: string;
83
+ } | {
84
+ op: 'createTransition';
85
+ description?: string;
86
+ id?: string;
87
+ sourceId: string;
88
+ targetId: string;
89
+ eventType: string;
90
+ transitionType?: 'normal' | 'targetless' | 'reenter';
91
+ guard?: {
92
+ type: string;
93
+ code?: string;
94
+ params?: Record<string, unknown>;
95
+ };
96
+ color?: CanvasColor | null;
97
+ transitionDescription?: string | null;
98
+ } | {
99
+ op: 'updateTransition';
100
+ description?: string;
101
+ transitionId: string;
102
+ sourceId?: string;
103
+ targetId?: string;
104
+ eventType?: string;
105
+ transitionType?: 'normal' | 'targetless' | 'reenter';
106
+ transitionDescription?: string | null;
107
+ color?: CanvasColor | null;
108
+ meta?: Record<string, unknown> | null;
109
+ } | {
110
+ op: 'deleteTransition';
111
+ description?: string;
112
+ transitionId: string;
113
+ } | {
114
+ op: 'createAction';
115
+ description?: string;
116
+ location: ActionLocation;
117
+ action: {
118
+ id?: string;
119
+ type: string;
120
+ params?: Record<string, unknown>;
121
+ code?: string;
122
+ };
123
+ index?: number;
124
+ } | {
125
+ op: 'updateAction';
126
+ description?: string;
127
+ location: ActionLocation;
128
+ actionId: string;
129
+ data: {
130
+ type?: string;
131
+ params?: Record<string, unknown>;
132
+ code?: string;
133
+ };
134
+ } | {
135
+ op: 'deleteAction';
136
+ description?: string;
137
+ location: ActionLocation;
138
+ actionId: string;
139
+ } | {
140
+ op: 'createInvoke';
141
+ description?: string;
142
+ nodeId: string;
143
+ invoke: {
144
+ id?: string;
145
+ src: string;
146
+ code?: string;
147
+ input?: Record<string, unknown>;
148
+ output?: Record<string, unknown>;
149
+ };
150
+ } | {
151
+ op: 'updateInvoke';
152
+ description?: string;
153
+ nodeId: string;
154
+ invokeId: string;
155
+ data: {
156
+ src?: string;
157
+ code?: string;
158
+ input?: Record<string, unknown>;
159
+ output?: Record<string, unknown>;
160
+ };
161
+ } | {
162
+ op: 'deleteInvoke';
163
+ description?: string;
164
+ nodeId: string;
165
+ invokeId: string;
166
+ } | {
167
+ op: 'setGuard';
168
+ description?: string;
169
+ edgeId: string;
170
+ guard: {
171
+ type: string;
172
+ code?: string;
173
+ params?: Record<string, unknown>;
174
+ };
175
+ } | {
176
+ op: 'deleteGuard';
177
+ description?: string;
178
+ edgeId: string;
179
+ } | {
180
+ op: 'createTag';
181
+ description?: string;
182
+ nodeId: string;
183
+ tag: {
184
+ name: string;
185
+ };
186
+ } | {
187
+ op: 'deleteTag';
188
+ description?: string;
189
+ nodeId: string;
190
+ tagName: string;
191
+ } | {
192
+ op: 'createAnnotation';
193
+ description?: string;
194
+ id?: string;
195
+ parentId: string | null;
196
+ content: string;
197
+ x?: number;
198
+ y?: number;
199
+ } | {
200
+ op: 'updateAnnotation';
201
+ description?: string;
202
+ annotationId: string;
203
+ data: {
204
+ content?: string;
205
+ };
206
+ } | {
207
+ op: 'deleteAnnotation';
208
+ description?: string;
209
+ annotationId: string;
210
+ } | {
211
+ op: 'setContext';
212
+ description?: string;
213
+ context: Record<string, unknown>;
214
+ } | {
215
+ op: 'updateSchemas';
216
+ description?: string;
217
+ schemas: {
218
+ context?: Record<string, unknown> | null;
219
+ events?: Record<string, unknown> | null;
220
+ input?: unknown | null;
221
+ output?: unknown | null;
222
+ };
223
+ };
224
+ //#endregion
225
+ export { ActionLocation, CanvasColor, EditorStateType, GraphPatch };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,397 @@
1
+ //#region src/protocol.d.ts
2
+ type EmbedMode = 'editing' | 'viewing' | 'simulating' | 'inspecting';
3
+ interface CommentsConfig {
4
+ roomId: string;
5
+ userId?: string | null;
6
+ publicApiKey?: string;
7
+ authEndpoint?: string;
8
+ baseUrl?: string;
9
+ }
10
+ interface ValidationIssue {
11
+ nodeIds: string[];
12
+ edgeIds: string[];
13
+ level: 'info' | 'warning' | 'error';
14
+ message: string;
15
+ }
16
+ interface SourceRange {
17
+ startLine: number;
18
+ startChar: number;
19
+ endLine: number;
20
+ endChar: number;
21
+ }
22
+ interface SourceLocation {
23
+ uri: string;
24
+ range: SourceRange;
25
+ }
26
+ interface StateSourceLocation extends SourceLocation {
27
+ path: string[];
28
+ kind: 'inline' | 'objectReference' | 'createStateConfig';
29
+ symbol?: string;
30
+ keyRange?: SourceRange;
31
+ referenceRange?: SourceRange;
32
+ keySource?: {
33
+ kind: 'const' | 'enumMember' | 'computedLiteral';
34
+ symbol?: string;
35
+ valueRange?: SourceRange;
36
+ machineLocal?: boolean;
37
+ };
38
+ keyReplacementText?: string;
39
+ }
40
+ interface MachineSourceLocations {
41
+ version: 1;
42
+ root?: SourceLocation;
43
+ states: StateSourceLocation[];
44
+ staticValues?: Array<SourceLocation & {
45
+ value: string;
46
+ }>;
47
+ }
48
+ interface ExportFormatMap {
49
+ xstate: {
50
+ options: {
51
+ version?: 4 | 5;
52
+ addTSTypes?: boolean;
53
+ showIds?: boolean;
54
+ showDescriptions?: boolean;
55
+ };
56
+ result: string;
57
+ };
58
+ json: {
59
+ options: {
60
+ simplifyArrays?: boolean;
61
+ version?: 4 | 5;
62
+ };
63
+ result: Record<string, unknown>;
64
+ };
65
+ digraph: {
66
+ options: object;
67
+ result: Record<string, unknown>;
68
+ };
69
+ mermaid: {
70
+ options: object;
71
+ result: string;
72
+ };
73
+ rtk: {
74
+ options: object;
75
+ result: string;
76
+ };
77
+ zustand: {
78
+ options: object;
79
+ result: string;
80
+ };
81
+ 'asl-json': {
82
+ options: object;
83
+ result: string;
84
+ };
85
+ 'asl-yaml': {
86
+ options: object;
87
+ result: string;
88
+ };
89
+ scxml: {
90
+ options: object;
91
+ result: string;
92
+ };
93
+ }
94
+ type ExportFormat = keyof ExportFormatMap;
95
+ type ExportCallOptions<F extends ExportFormat> = ExportFormatMap[F]['options'] & {
96
+ timeout?: number;
97
+ };
98
+ interface EmbedEventMap {
99
+ ready: {
100
+ version: string;
101
+ };
102
+ loaded: {
103
+ graph: unknown;
104
+ sourceLocations?: MachineSourceLocations;
105
+ };
106
+ change: {
107
+ graph: unknown;
108
+ machineConfig: unknown;
109
+ patches?: unknown[];
110
+ sourceLocations?: MachineSourceLocations;
111
+ };
112
+ save: {
113
+ graph: unknown;
114
+ machineConfig: unknown;
115
+ patches?: unknown[];
116
+ validations?: ValidationIssue[];
117
+ sourceLocations?: MachineSourceLocations;
118
+ };
119
+ error: {
120
+ code: string;
121
+ message: string;
122
+ };
123
+ snapshot: {
124
+ snapshot: unknown;
125
+ event: unknown | null;
126
+ };
127
+ }
128
+ type EmbedEventName = keyof EmbedEventMap;
129
+ type EmbedEventHandler<K extends EmbedEventName> = (data: EmbedEventMap[K]) => void;
130
+ interface InitOptions {
131
+ machine: unknown;
132
+ format?: string;
133
+ mode?: EmbedMode;
134
+ theme?: 'light' | 'dark';
135
+ readOnly?: boolean;
136
+ depth?: number;
137
+ panels?: {
138
+ leftPanels?: string[];
139
+ rightPanels?: string[];
140
+ activePanels?: string[];
141
+ };
142
+ comments?: CommentsConfig;
143
+ sourceLocations?: MachineSourceLocations;
144
+ /**
145
+ * Show a persistent "Save to apply" pill in the embed whenever Viz has
146
+ * local edits that have not yet been saved. Intended for contexts like
147
+ * editor extensions where Viz edits don't reach the source until the user
148
+ * saves.
149
+ *
150
+ * - `enabled` — whether to show the pill at all. Defaults to `false`.
151
+ * - `mode` — `'structural'` (default) only triggers on graph-structural
152
+ * changes (state/transition/action/invoke/schema edits). Pure visual
153
+ * changes like drag-to-position, color, and autolayout are ignored.
154
+ * `'all'` triggers on any graph change.
155
+ */
156
+ unsavedIndicator?: {
157
+ enabled?: boolean;
158
+ mode?: 'structural' | 'all';
159
+ };
160
+ }
161
+ interface InitMessage {
162
+ type: '@statelyai.init';
163
+ machine: unknown;
164
+ format?: string;
165
+ mode?: EmbedMode;
166
+ theme?: 'light' | 'dark';
167
+ readOnly?: boolean;
168
+ depth?: number;
169
+ leftPanels?: string[];
170
+ rightPanels?: string[];
171
+ activePanels?: string[];
172
+ comments?: CommentsConfig;
173
+ sourceLocations?: MachineSourceLocations;
174
+ /** Mirror of `InitOptions.unsavedIndicator`. */
175
+ unsavedIndicator?: {
176
+ enabled?: boolean;
177
+ mode?: 'structural' | 'all';
178
+ };
179
+ /** Optional session id override (multiplexed clients only). */
180
+ sessionId?: string;
181
+ }
182
+ interface UpdateMessage {
183
+ type: '@statelyai.update';
184
+ machine: unknown;
185
+ format?: string;
186
+ sourceLocations?: MachineSourceLocations;
187
+ }
188
+ interface SetModeMessage {
189
+ type: '@statelyai.setMode';
190
+ mode: EmbedMode;
191
+ }
192
+ interface SetThemeMessage {
193
+ type: '@statelyai.setTheme';
194
+ theme: 'light' | 'dark';
195
+ }
196
+ interface SetSettingsMessage {
197
+ type: '@statelyai.setSettings';
198
+ settings: Record<string, unknown>;
199
+ }
200
+ interface RetrieveMessage {
201
+ type: '@statelyai.retrieve';
202
+ requestId: string;
203
+ format: ExportFormat;
204
+ options?: Record<string, unknown>;
205
+ }
206
+ interface ToastMessage {
207
+ type: '@statelyai.toast';
208
+ message: string;
209
+ toastType?: 'success' | 'error' | 'info' | 'warning';
210
+ }
211
+ interface InspectSnapshotMessage {
212
+ type: '@statelyai.inspectSnapshot';
213
+ snapshot: unknown;
214
+ event: unknown | null;
215
+ /**
216
+ * Optional session id override. Used by multiplexed clients that share one
217
+ * WebSocket across many actor sessions. When omitted, the relay routes
218
+ * to the connection's primary sessionId.
219
+ */
220
+ sessionId?: string;
221
+ }
222
+ interface ActorSystemEntry {
223
+ /** The xstate `actor.sessionId` — unique within the system. */
224
+ actorId: string;
225
+ /** Parent actor's sessionId, or `null` for the root. */
226
+ parentActorId: string | null;
227
+ /** Human-facing id (`actor.id`). */
228
+ id: string;
229
+ /** Machine configuration used to render the state chart. */
230
+ machine: unknown;
231
+ /** Optional current snapshot (`{value, status, ...}`). */
232
+ snapshot?: unknown;
233
+ }
234
+ interface SystemInitMessage {
235
+ type: '@statelyai.system.init';
236
+ /** All known actors at the moment the system is first streamed. */
237
+ actors: ActorSystemEntry[];
238
+ /** Actor id the viz should focus first. Defaults to the root. */
239
+ selectedActorId?: string;
240
+ mode?: EmbedMode;
241
+ theme?: 'light' | 'dark';
242
+ readOnly?: boolean;
243
+ depth?: number;
244
+ leftPanels?: string[];
245
+ rightPanels?: string[];
246
+ activePanels?: string[];
247
+ comments?: CommentsConfig;
248
+ }
249
+ /** A new actor joined the system after init. */
250
+ interface SystemActorRegisteredMessage {
251
+ type: '@statelyai.system.actorRegistered';
252
+ actorId: string;
253
+ parentActorId: string | null;
254
+ id: string;
255
+ machine: unknown;
256
+ snapshot?: unknown;
257
+ }
258
+ /** An actor's snapshot updated. */
259
+ interface SystemActorSnapshotMessage {
260
+ type: '@statelyai.system.actorSnapshot';
261
+ actorId: string;
262
+ snapshot: unknown;
263
+ event?: unknown | null;
264
+ /** The actorId of the actor that sent the triggering event, if known. */
265
+ sourceActorId?: string | null;
266
+ }
267
+ /** An actor reached a final state / was stopped. */
268
+ interface SystemActorStoppedMessage {
269
+ type: '@statelyai.system.actorStopped';
270
+ actorId: string;
271
+ }
272
+ interface ReadyMessage {
273
+ type: '@statelyai.ready';
274
+ version: string;
275
+ }
276
+ interface LoadedMessage {
277
+ type: '@statelyai.loaded';
278
+ graph: unknown;
279
+ sourceLocations?: MachineSourceLocations;
280
+ }
281
+ interface ChangeMessage {
282
+ type: '@statelyai.change';
283
+ graph: unknown;
284
+ machineConfig: unknown;
285
+ patches?: unknown[];
286
+ sourceLocations?: MachineSourceLocations;
287
+ }
288
+ interface SaveMessage {
289
+ type: '@statelyai.save';
290
+ graph: unknown;
291
+ machineConfig: unknown;
292
+ patches?: unknown[];
293
+ validations?: ValidationIssue[];
294
+ sourceLocations?: MachineSourceLocations;
295
+ }
296
+ interface RetrievedMessage {
297
+ type: '@statelyai.retrieved';
298
+ requestId: string;
299
+ data: unknown;
300
+ }
301
+ interface ErrorMessage {
302
+ type: '@statelyai.error';
303
+ code: string;
304
+ message: string;
305
+ requestId?: string;
306
+ }
307
+ /** File metadata sent from viz to SDK when a file needs uploading. */
308
+ interface UploadFileInfo {
309
+ /** Original filename (e.g. "screenshot.png") */
310
+ name: string;
311
+ /** MIME type (e.g. "image/png") */
312
+ mimeType: string;
313
+ /** File size in bytes */
314
+ size: number;
315
+ /** File content as base64-encoded string */
316
+ data: string;
317
+ }
318
+ /** The result the consumer returns after uploading. */
319
+ interface UploadResult {
320
+ /** The publicly accessible URL of the uploaded file */
321
+ url: string;
322
+ /** Optional display name (defaults to original filename) */
323
+ name?: string;
324
+ /** Optional metadata stored on the asset */
325
+ metadata?: Record<string, unknown>;
326
+ }
327
+ /** Viz requests the parent to upload a file. */
328
+ interface UploadRequestMessage {
329
+ type: '@statelyai.uploadRequest';
330
+ requestId: string;
331
+ file: UploadFileInfo;
332
+ stateNodeId: string;
333
+ }
334
+ /** Parent tells the viz the upload capabilities on init. */
335
+ interface UploadCapabilitiesMessage {
336
+ type: '@statelyai.uploadCapabilities';
337
+ enabled: boolean;
338
+ accept?: string[];
339
+ maxFileSize?: number;
340
+ }
341
+ /** Parent sends the upload result back to the viz. */
342
+ interface UploadResponseMessage {
343
+ type: '@statelyai.uploadResponse';
344
+ requestId: string;
345
+ result: UploadResult;
346
+ }
347
+ /** All messages a client (embed/inspector) can send to the viz. */
348
+ type ClientMessage = InitMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemActorRegisteredMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ErrorMessage;
349
+ /** All messages the viz can send back to a client. */
350
+ type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | RetrievedMessage | ErrorMessage | UploadRequestMessage;
351
+ interface RegisterMessage {
352
+ type: '@statelyai.register';
353
+ role: 'client' | 'viz';
354
+ sessionId: string;
355
+ metadata?: {
356
+ name?: string;
357
+ machineId?: string;
358
+ };
359
+ }
360
+ interface RegisteredMessage {
361
+ type: '@statelyai.registered';
362
+ sessionId: string;
363
+ }
364
+ interface RequestOpenMessage {
365
+ type: '@statelyai.requestOpen';
366
+ sessionId: string;
367
+ }
368
+ /**
369
+ * Client → relay: add another sessionId to an existing connection. Used by
370
+ * multiplexed clients that want one WebSocket to serve many actor sessions.
371
+ * Order of operations for a multiplexed client:
372
+ *
373
+ * 1. Connect WebSocket
374
+ * 2. Send `@statelyai.register { sessionId: primary }`
375
+ * 3. Send `@statelyai.addSession { sessionId }` for each additional session
376
+ * 4. Send regular messages; each can include an explicit `sessionId` at
377
+ * the root to target a specific session (falls back to primary).
378
+ */
379
+ interface AddSessionMessage {
380
+ type: '@statelyai.addSession';
381
+ sessionId: string;
382
+ metadata?: {
383
+ name?: string;
384
+ machineId?: string;
385
+ };
386
+ }
387
+ /** Relay → client: acknowledgement that a session was added. */
388
+ interface SessionAddedMessage {
389
+ type: '@statelyai.sessionAdded';
390
+ sessionId: string;
391
+ }
392
+ /** All session-management messages for the WS relay. */
393
+ type SessionMessage = RegisterMessage | RegisteredMessage | RequestOpenMessage | AddSessionMessage | SessionAddedMessage;
394
+ /** Any valid protocol message. */
395
+ type ProtocolMessage = ClientMessage | VizMessage | SessionMessage;
396
+ //#endregion
397
+ export { EmbedMode as a, ExportFormatMap as c, ProtocolMessage as d, UploadResult as f, EmbedEventName as i, InitOptions as l, EmbedEventHandler as n, ExportCallOptions as o, EmbedEventMap as r, ExportFormat as s, CommentsConfig as t, MachineSourceLocations as u };
package/dist/sync.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createStatelyClient } from "./studio.mjs";
2
2
  import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
3
- import { t as graphToXStateTS } from "./graphToXStateTS-C6HQUrBB.mjs";
3
+ import { t as graphToXStateTS } from "./graphToXStateTS-BSUj97r0.mjs";
4
4
  import { getDiff, isEmptyDiff } from "@statelyai/graph";
5
5
  import fs from "node:fs/promises";
6
6
  import path from "node:path";
@@ -96,7 +96,9 @@ function toInitMessage(options) {
96
96
  leftPanels: options.panels?.leftPanels,
97
97
  rightPanels: options.panels?.rightPanels,
98
98
  activePanels: options.panels?.activePanels,
99
- comments: options.comments
99
+ comments: options.comments,
100
+ sourceLocations: options.sourceLocations,
101
+ unsavedIndicator: options.unsavedIndicator
100
102
  };
101
103
  }
102
104
 
@@ -114,9 +116,11 @@ function createPostMessageTransport(options) {
114
116
  const messageHandlers = /* @__PURE__ */ new Set();
115
117
  function handleMessage(e) {
116
118
  if (destroyed) return;
117
- const expectedSource = options.source ?? iframe.contentWindow;
118
- if (e.source !== expectedSource) return;
119
- if (targetOrigin !== "*" && e.origin !== targetOrigin) return;
119
+ if (targetOrigin !== "*") {
120
+ const expectedSource = options.source ?? iframe.contentWindow;
121
+ if (e.source !== expectedSource) return;
122
+ if (e.origin !== targetOrigin) return;
123
+ }
120
124
  const data = e.data;
121
125
  if (!data?.type?.startsWith?.(PREFIX)) return;
122
126
  if (data.type === "@statelyai.ready" && !isReady) {
@@ -192,10 +196,10 @@ function createWebSocketTransport(options) {
192
196
  if (!raw?.type || typeof raw.type !== "string") return;
193
197
  if (!raw.type.startsWith(PREFIX)) return;
194
198
  const data = raw;
195
- if (data.type === "@statelyai.registered" && !isReady) {
199
+ if (data.type === "@statelyai.registered") {
200
+ const wasReady = isReady;
196
201
  isReady = true;
197
- readyHandlers.forEach((fn) => fn());
198
- readyHandlers.clear();
202
+ if (!wasReady) readyHandlers.forEach((fn) => fn());
199
203
  }
200
204
  messageHandlers.forEach((fn) => fn(data));
201
205
  };
@@ -232,14 +236,11 @@ function createWebSocketTransport(options) {
232
236
  readyHandlers.clear();
233
237
  },
234
238
  get ready() {
235
- return isReady;
239
+ return isReady && !!ws && ws.readyState === WebSocket.OPEN;
236
240
  },
237
241
  onReady(handler) {
238
- if (isReady) {
239
- handler();
240
- return () => {};
241
- }
242
242
  readyHandlers.add(handler);
243
+ if (isReady) handler();
243
244
  return () => {
244
245
  readyHandlers.delete(handler);
245
246
  };
@@ -248,4 +249,4 @@ function createWebSocketTransport(options) {
248
249
  }
249
250
 
250
251
  //#endregion
251
- export { createRequestId as a, createPendingExportManager as i, createWebSocketTransport as n, toInitMessage as o, createEventRegistry as r, createPostMessageTransport as t };
252
+ export { toInitMessage as a, createPendingExportManager as i, createWebSocketTransport as n, createEventRegistry as r, createPostMessageTransport as t };