@statelyai/sdk 0.11.0 → 0.12.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/embed.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { CommentsConfig, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
1
+ import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
2
2
  import { AssetUploadAdapter } from "./assetStorage.mjs";
3
3
 
4
4
  //#region src/embed.d.ts
@@ -56,6 +56,7 @@ interface StatelyEmbedOptions extends Partial<MachineInitOptions> {
56
56
  code: string;
57
57
  message: string;
58
58
  }) => void;
59
+ onCapabilityDenied?: (event: CapabilityDeniedEvent) => void;
59
60
  }
60
61
  interface StatelyEmbed {
61
62
  /** Attach to an existing iframe element. Sets src and begins handshake. */
@@ -89,4 +90,4 @@ interface StatelyEmbed {
89
90
  }
90
91
  declare function createStatelyEmbed(options: StatelyEmbedOptions): StatelyEmbed;
91
92
  //#endregion
92
- export { AssetConfig, type CommentsConfig, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type ProjectEmbedMachine, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
93
+ export { AssetConfig, type CapabilityDeniedEvent, type CommentsConfig, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type ProjectEmbedMachine, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
package/dist/embed.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as toInitMessage, i as createPendingExportManager, r as createEventRegistry, t as createPostMessageTransport } from "./transport-CVZGF0w9.mjs";
1
+ import { a as toInitMessage, i as createPendingExportManager, r as createEventRegistry, t as createPostMessageTransport } from "./transport-D0nlFaLn.mjs";
2
2
 
3
3
  //#region src/embed.ts
4
4
  function buildEmbedUrl(options) {
@@ -15,6 +15,7 @@ function extractInitOptions(options) {
15
15
  theme: options.theme,
16
16
  readOnly: options.readOnly,
17
17
  depth: options.depth,
18
+ capabilities: options.capabilities,
18
19
  panels: options.panels,
19
20
  commentsByMachineId: options.commentsByMachineId,
20
21
  unsavedIndicator: options.unsavedIndicator
@@ -26,6 +27,7 @@ function extractInitOptions(options) {
26
27
  theme: options.theme,
27
28
  readOnly: options.readOnly,
28
29
  depth: options.depth,
30
+ capabilities: options.capabilities,
29
31
  panels: options.panels,
30
32
  comments: options.comments,
31
33
  sourceLocations: options.sourceLocations,
@@ -134,6 +136,12 @@ function createStatelyEmbed(options) {
134
136
  events.emit("error", err);
135
137
  break;
136
138
  }
139
+ case "@statelyai.capabilityDenied": {
140
+ const { type: _type, ...event } = data;
141
+ options.onCapabilityDenied?.(event);
142
+ events.emit("capabilityDenied", event);
143
+ break;
144
+ }
137
145
  case "@statelyai.uploadRequest": {
138
146
  const req = data;
139
147
  if (!uploadAsset) {
@@ -1,267 +1,7 @@
1
+ import { r as CodeExpression } from "./index-BpUKBSiq.mjs";
1
2
  import * as _statelyai_graph0 from "@statelyai/graph";
2
3
  import { Graph } from "@statelyai/graph";
3
4
 
4
- //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
5
- // ==================================================================================================
6
- // JSON Schema Draft 07
7
- // ==================================================================================================
8
- // https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
9
- // --------------------------------------------------------------------------------------------------
10
- /**
11
- * Primitive type
12
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
13
- */
14
- type JSONSchema7TypeName = "string" //
15
- | "number" | "integer" | "boolean" | "object" | "array" | "null";
16
- /**
17
- * Primitive type
18
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
19
- */
20
- type JSONSchema7Type = string //
21
- | number | boolean | JSONSchema7Object | JSONSchema7Array | null;
22
- // Workaround for infinite type recursion
23
- interface JSONSchema7Object {
24
- [key: string]: JSONSchema7Type;
25
- }
26
- // Workaround for infinite type recursion
27
- // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
28
- interface JSONSchema7Array extends Array<JSONSchema7Type> {}
29
- /**
30
- * Meta schema
31
- *
32
- * Recommended values:
33
- * - 'http://json-schema.org/schema#'
34
- * - 'http://json-schema.org/hyper-schema#'
35
- * - 'http://json-schema.org/draft-07/schema#'
36
- * - 'http://json-schema.org/draft-07/hyper-schema#'
37
- *
38
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
39
- */
40
- type JSONSchema7Version = string;
41
- /**
42
- * JSON Schema v7
43
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
44
- */
45
- type JSONSchema7Definition = JSONSchema7 | boolean;
46
- interface JSONSchema7 {
47
- $id?: string | undefined;
48
- $ref?: string | undefined;
49
- $schema?: JSONSchema7Version | undefined;
50
- $comment?: string | undefined;
51
- /**
52
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
53
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
54
- */
55
- $defs?: {
56
- [key: string]: JSONSchema7Definition;
57
- } | undefined;
58
- /**
59
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
60
- */
61
- type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
62
- enum?: JSONSchema7Type[] | undefined;
63
- const?: JSONSchema7Type | undefined;
64
- /**
65
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
66
- */
67
- multipleOf?: number | undefined;
68
- maximum?: number | undefined;
69
- exclusiveMaximum?: number | undefined;
70
- minimum?: number | undefined;
71
- exclusiveMinimum?: number | undefined;
72
- /**
73
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
74
- */
75
- maxLength?: number | undefined;
76
- minLength?: number | undefined;
77
- pattern?: string | undefined;
78
- /**
79
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
80
- */
81
- items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
82
- additionalItems?: JSONSchema7Definition | undefined;
83
- maxItems?: number | undefined;
84
- minItems?: number | undefined;
85
- uniqueItems?: boolean | undefined;
86
- contains?: JSONSchema7Definition | undefined;
87
- /**
88
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
89
- */
90
- maxProperties?: number | undefined;
91
- minProperties?: number | undefined;
92
- required?: string[] | undefined;
93
- properties?: {
94
- [key: string]: JSONSchema7Definition;
95
- } | undefined;
96
- patternProperties?: {
97
- [key: string]: JSONSchema7Definition;
98
- } | undefined;
99
- additionalProperties?: JSONSchema7Definition | undefined;
100
- dependencies?: {
101
- [key: string]: JSONSchema7Definition | string[];
102
- } | undefined;
103
- propertyNames?: JSONSchema7Definition | undefined;
104
- /**
105
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
106
- */
107
- if?: JSONSchema7Definition | undefined;
108
- then?: JSONSchema7Definition | undefined;
109
- else?: JSONSchema7Definition | undefined;
110
- /**
111
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
112
- */
113
- allOf?: JSONSchema7Definition[] | undefined;
114
- anyOf?: JSONSchema7Definition[] | undefined;
115
- oneOf?: JSONSchema7Definition[] | undefined;
116
- not?: JSONSchema7Definition | undefined;
117
- /**
118
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
119
- */
120
- format?: string | undefined;
121
- /**
122
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
123
- */
124
- contentMediaType?: string | undefined;
125
- contentEncoding?: string | undefined;
126
- /**
127
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
128
- */
129
- definitions?: {
130
- [key: string]: JSONSchema7Definition;
131
- } | undefined;
132
- /**
133
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
134
- */
135
- title?: string | undefined;
136
- description?: string | undefined;
137
- default?: JSONSchema7Type | undefined;
138
- readOnly?: boolean | undefined;
139
- writeOnly?: boolean | undefined;
140
- examples?: JSONSchema7Type | undefined;
141
- }
142
- //#endregion
143
- //#region ../graph-tools/src/codegenTypes.d.ts
144
- interface CodeGenAction {
145
- /** Graph-native block id, referenced by `@statelyai.action.*` transitions. */
146
- id?: string;
147
- type: string;
148
- params?: Record<string, unknown>;
149
- }
150
- interface CodeGenGuard {
151
- type: string;
152
- code?: string;
153
- params?: Record<string, unknown>;
154
- }
155
- /**
156
- * Serialized inline expression directive.
157
- *
158
- * Code generation treats this object as JavaScript/TypeScript source, not as a
159
- * machine config object. It is used for fields such as invoke `input` and
160
- * `output` where XState accepts mapper expressions.
161
- */
162
- interface CodeExpression {
163
- '@type': 'code';
164
- lang: 'js' | 'ts';
165
- expr: string;
166
- imports?: CodeImport[];
167
- }
168
- interface CodeImport {
169
- package: string;
170
- import: string;
171
- importKind?: 'named' | 'default' | 'namespace';
172
- version?: string;
173
- }
174
- interface CodeGenInvoke {
175
- src: string;
176
- id: string;
177
- invocationId?: string;
178
- input?: Record<string, unknown> | CodeExpression;
179
- output?: Record<string, unknown> | CodeExpression;
180
- }
181
- interface CodeGenNodeData {
182
- nodeId?: string | null;
183
- key: string;
184
- type?: 'normal' | 'parallel' | 'final' | 'history' | null;
185
- initialId?: string | null;
186
- history?: 'shallow' | 'deep' | boolean;
187
- entry?: CodeGenAction[];
188
- exit?: CodeGenAction[];
189
- invokes?: CodeGenInvoke[];
190
- tags?: Array<string | {
191
- name: string;
192
- }>;
193
- description?: string | null;
194
- meta?: Record<string, unknown> | null;
195
- color?: string;
196
- parentId?: string | null;
197
- temp?: unknown;
198
- }
199
- interface CodeGenEdgeData {
200
- eventType: string;
201
- transitionType?: 'normal' | 'targetless' | 'reenter';
202
- guard?: CodeGenGuard | null;
203
- actions?: CodeGenAction[];
204
- description?: string | null;
205
- color?: string;
206
- meta?: Record<string, unknown> | null;
207
- temp?: unknown;
208
- }
209
- interface CodeGenImplementation {
210
- id: string;
211
- name: string;
212
- description?: string | null;
213
- icon?: string;
214
- paramsSchema?: JSONSchema7 | null;
215
- code?: {
216
- body: string;
217
- lang?: string;
218
- } | null;
219
- }
220
- interface CodeGenActorImplementation {
221
- id: string;
222
- name: string;
223
- description?: string | null;
224
- icon?: string;
225
- inputSchema?: JSONSchema7 | null;
226
- outputSchema?: JSONSchema7 | null;
227
- code?: {
228
- body: string;
229
- lang?: string;
230
- } | null;
231
- }
232
- interface CodeGenGraphData {
233
- context?: Record<string, unknown> | CodeExpression | null;
234
- schemas?: {
235
- context?: Record<string, JSONSchema7> | null;
236
- events?: Record<string, JSONSchema7> | null;
237
- input?: JSONSchema7 | null;
238
- output?: JSONSchema7 | null;
239
- } | null;
240
- implementations?: {
241
- actions: CodeGenImplementation[];
242
- guards: CodeGenImplementation[];
243
- actors: CodeGenActorImplementation[];
244
- delays: CodeGenImplementation[];
245
- } | null;
246
- }
247
- interface CodeGenNode {
248
- id: string;
249
- parentId?: string | null;
250
- data: CodeGenNodeData;
251
- }
252
- interface CodeGenEdge {
253
- id: string;
254
- sourceId: string;
255
- targetId: string;
256
- data: CodeGenEdgeData;
257
- }
258
- interface CodeGenGraph {
259
- id: string;
260
- nodes: CodeGenNode[];
261
- edges: CodeGenEdge[];
262
- data: CodeGenGraphData;
263
- }
264
- //#endregion
265
5
  //#region src/digraphTypes.d.ts
266
6
  type CanvasColor = undefined | 'green' | 'red' | 'purple' | 'blue' | 'orange' | 'yellow' | 'pink' | 'teal';
267
7
  type ExtractorGuard = {
@@ -651,4 +391,4 @@ declare function toStudioMachine(graph: StatelyGraph): StudioMachine;
651
391
  declare function fromStudioMachine(studioMachine: StudioMachine): StatelyGraph;
652
392
  declare const studioMachineConverter: _statelyai_graph0.GraphFormatConverter<DigraphConfig, StatelyNodeData, StatelyEdgeData, StatelyGraphData>;
653
393
  //#endregion
654
- export { EventTypeData as C, JSONSchema7 as E, DigraphNodeConfig as S, CodeGenGraph as T, studioMachineConverter as _, StatelyGraphData as a, DigraphConfig as b, StatelyInvoke as c, StudioAction as d, StudioEdge as f, fromStudioMachine as g, StudioNode as h, StatelyGraph as i, StatelyNodeData as l, StudioMachine as m, StatelyActorImplementation as n, StatelyGuard as o, StudioEventTypeData as p, StatelyEdgeData as r, StatelyImplementation as s, StatelyAction as t, StatelyTagImplementation as u, toStudioMachine as v, StateNodeJSONData as w, DigraphEdgeConfig as x, DigraphAction as y };
394
+ export { EventTypeData as C, DigraphNodeConfig as S, studioMachineConverter as _, StatelyGraphData as a, DigraphConfig as b, StatelyInvoke as c, StudioAction as d, StudioEdge as f, fromStudioMachine as g, StudioNode as h, StatelyGraph as i, StatelyNodeData as l, StudioMachine as m, StatelyActorImplementation as n, StatelyGuard as o, StudioEventTypeData as p, StatelyEdgeData as r, StatelyImplementation as s, StatelyAction as t, StatelyTagImplementation as u, toStudioMachine as v, StateNodeJSONData as w, DigraphEdgeConfig as x, DigraphAction as y };
package/dist/graph.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-GeuH-mFK.mjs";
1
+ import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-Bm4_GZX_.mjs";
2
2
  export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };