@statelyai/sdk 0.33.0 → 0.34.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.
Files changed (40) hide show
  1. package/README.md +15 -4
  2. package/dist/assetStorage.d.mts +1 -1
  3. package/dist/auth.d.mts +1 -1
  4. package/dist/bin.mjs +1 -0
  5. package/dist/{dist-wbhkeGh6.mjs → dist-NJFkDQjK.mjs} +170 -77
  6. package/dist/{editorHostSession-DfmHzpls.mjs → editorHostSession-Bj5YcijC.mjs} +2 -2
  7. package/dist/{editorHostSession-C6yxOmSO.d.mts → editorHostSession-DwD_9cER.d.mts} +2 -2
  8. package/dist/editorHostSession.d.mts +1 -1
  9. package/dist/editorHostSession.mjs +3 -3
  10. package/dist/embed.d.mts +4 -4
  11. package/dist/embed.mjs +5 -4
  12. package/dist/{graph-CR_g-mOq.d.mts → graph-Ciocekxl.d.mts} +1 -1
  13. package/dist/graph.d.mts +1 -1
  14. package/dist/{index-DlOZxzrW.d.mts → index-DZivqh0u.d.mts} +21 -4
  15. package/dist/index.d.mts +8 -8
  16. package/dist/index.mjs +9 -9
  17. package/dist/{inspect-C-eEfU3T.mjs → inspect-0dMcaOz_.mjs} +43 -6
  18. package/dist/{inspect-CunxIl8H.d.mts → inspect-D-L0qj9L.d.mts} +17 -9
  19. package/dist/inspect.d.mts +3 -3
  20. package/dist/inspect.mjs +3 -2
  21. package/dist/node-relay.mjs +1 -1
  22. package/dist/patchTypes.d.mts +1 -1
  23. package/dist/{protocol-CQL9Ubt9.d.mts → protocol-AeHm956D.d.mts} +46 -76
  24. package/dist/protocol-BsBGRISR.mjs +116 -0
  25. package/dist/protocol.d.mts +2 -2
  26. package/dist/protocol.mjs +2 -86
  27. package/dist/relay.d.mts +1 -1
  28. package/dist/relay.mjs +23 -3
  29. package/dist/{studio-rSI54Ese.mjs → studio-BZP6DaIO.mjs} +50 -15
  30. package/dist/{studio-DV5IIGhV.d.mts → studio-CKdEPGKY.d.mts} +56 -17
  31. package/dist/studio.d.mts +1 -1
  32. package/dist/studio.mjs +1 -1
  33. package/dist/sync.d.mts +2 -2
  34. package/dist/sync.mjs +5 -10
  35. package/dist/{version-BblbkW8-.mjs → version-DxDSBJta.mjs} +17 -5
  36. package/package.json +3 -3
  37. /package/dist/{auth-Dg7prjeL.d.mts → auth-CVFc85uF.d.mts} +0 -0
  38. /package/dist/{editor-sync-types-CPpzTSnT.d.mts → editor-sync-types-D7YYz6fb.d.mts} +0 -0
  39. /package/dist/{editorHostProtocol-Bko7wge8.mjs → editorHostProtocol-B2_t3Le7.mjs} +0 -0
  40. /package/dist/{statelyPragma-D46lczJR.mjs → statelyPragma-YtVaBuIe.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { A as ZodObject, D as ZodLiteral, E as ZodEnum, F as ZodUnknown, I as output, L as $loose, M as ZodRecord, N as ZodString, O as ZodNullable, P as ZodUnion, R as $strip, T as ZodBoolean, j as ZodOptional, k as ZodNumber, w as ZodArray } from "./index-DlOZxzrW.mjs";
2
- import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-Dg7prjeL.mjs";
1
+ import { A as ZodObject, D as ZodLiteral, E as ZodEnum, F as ZodUnknown, I as output, L as $loose, M as ZodRecord, N as ZodString, O as ZodNullable, P as ZodUnion, R as $strip, T as ZodBoolean, j as ZodOptional, k as ZodNumber, w as ZodArray } from "./index-DZivqh0u.mjs";
2
+ import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-CVFc85uF.mjs";
3
3
 
4
4
  //#region ../api-contract/dist/errors.d.mts
5
5
  /**
@@ -55,6 +55,25 @@ type VerifyResult = output<typeof verifyResultSchema>;
55
55
  * `entitlements` is an open set of provider-defined strings; unknown values are
56
56
  * ignored rather than rejected.
57
57
  */
58
+ /**
59
+ * `name` and `updatedAt` are optional: some upstream project envelopes only
60
+ * return machine ids. Providers that can supply them cheaply should.
61
+ */
62
+ declare const projectMachineSummarySchema: ZodObject<{
63
+ machineId: ZodString;
64
+ name: ZodOptional<ZodString>;
65
+ updatedAt: ZodOptional<ZodString>;
66
+ format: ZodOptional<ZodEnum<{
67
+ digraph: "digraph";
68
+ xgraph: "xgraph";
69
+ }>>;
70
+ }, $strip>;
71
+ type ProjectMachineSummary = output<typeof projectMachineSummarySchema>;
72
+ /**
73
+ * A project list row. It carries the project's machine roster, not just its
74
+ * metadata, so a client can mount a whole workspace from one `projects.list`
75
+ * response and fetch definitions lazily.
76
+ */
58
77
  declare const projectSummarySchema: ZodObject<{
59
78
  projectId: ZodString;
60
79
  projectVersionId: ZodString;
@@ -67,18 +86,26 @@ declare const projectSummarySchema: ZodObject<{
67
86
  }>;
68
87
  createdAt: ZodString;
69
88
  updatedAt: ZodString;
89
+ rootMachineId: ZodOptional<ZodNullable<ZodString>>;
90
+ machines: ZodOptional<ZodArray<ZodObject<{
91
+ machineId: ZodString;
92
+ name: ZodOptional<ZodString>;
93
+ updatedAt: ZodOptional<ZodString>;
94
+ format: ZodOptional<ZodEnum<{
95
+ digraph: "digraph";
96
+ xgraph: "xgraph";
97
+ }>>;
98
+ }, $strip>>>;
99
+ permissions: ZodOptional<ZodObject<{
100
+ canEdit: ZodBoolean;
101
+ }, $strip>>;
102
+ allowedVisibility: ZodOptional<ZodArray<ZodEnum<{
103
+ public: "public";
104
+ unlisted: "unlisted";
105
+ private: "private";
106
+ }>>>;
70
107
  }, $strip>;
71
108
  type ProjectSummary = output<typeof projectSummarySchema>;
72
- /**
73
- * `name` and `updatedAt` are optional: some upstream project envelopes only
74
- * return machine ids. Providers that can supply them cheaply should.
75
- */
76
- declare const projectMachineSummarySchema: ZodObject<{
77
- machineId: ZodString;
78
- name: ZodOptional<ZodString>;
79
- updatedAt: ZodOptional<ZodString>;
80
- }, $strip>;
81
- type ProjectMachineSummary = output<typeof projectMachineSummarySchema>;
82
109
  declare const projectSchema: ZodObject<{
83
110
  projectId: ZodString;
84
111
  projectVersionId: ZodString;
@@ -91,20 +118,24 @@ declare const projectSchema: ZodObject<{
91
118
  }>;
92
119
  createdAt: ZodString;
93
120
  updatedAt: ZodString;
121
+ allowedVisibility: ZodOptional<ZodArray<ZodEnum<{
122
+ public: "public";
123
+ unlisted: "unlisted";
124
+ private: "private";
125
+ }>>>;
94
126
  rootMachineId: ZodNullable<ZodString>;
95
127
  machines: ZodArray<ZodObject<{
96
128
  machineId: ZodString;
97
129
  name: ZodOptional<ZodString>;
98
130
  updatedAt: ZodOptional<ZodString>;
131
+ format: ZodOptional<ZodEnum<{
132
+ digraph: "digraph";
133
+ xgraph: "xgraph";
134
+ }>>;
99
135
  }, $strip>>;
100
136
  permissions: ZodObject<{
101
137
  canEdit: ZodBoolean;
102
138
  }, $strip>;
103
- allowedVisibility: ZodOptional<ZodArray<ZodEnum<{
104
- public: "public";
105
- unlisted: "unlisted";
106
- private: "private";
107
- }>>>;
108
139
  }, $strip>;
109
140
  type Project = output<typeof projectSchema>;
110
141
  declare const machineSchema: ZodObject<{
@@ -169,6 +200,10 @@ declare const machineSchema: ZodObject<{
169
200
  }, $loose>>;
170
201
  createdAt: ZodOptional<ZodString>;
171
202
  updatedAt: ZodOptional<ZodString>;
203
+ format: ZodOptional<ZodEnum<{
204
+ digraph: "digraph";
205
+ xgraph: "xgraph";
206
+ }>>;
172
207
  }, $strip>;
173
208
  type Machine = output<typeof machineSchema>;
174
209
  declare const machineVersionSchema: ZodObject<{
@@ -179,6 +214,10 @@ declare const machineVersionSchema: ZodObject<{
179
214
  definition: ZodUnknown;
180
215
  createdAt: ZodString;
181
216
  updatedAt: ZodString;
217
+ format: ZodOptional<ZodEnum<{
218
+ digraph: "digraph";
219
+ xgraph: "xgraph";
220
+ }>>;
182
221
  }, $strip>;
183
222
  type MachineVersion = output<typeof machineVersionSchema>;
184
223
  /** Version-history row without the definition payload. */
package/dist/studio.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, p as LegacyExtractMachinesOptions, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-DV5IIGhV.mjs";
1
+ import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, p as LegacyExtractMachinesOptions, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-CKdEPGKY.mjs";
2
2
  export { ConnectedRepo, CreateMachineFromDefinitionInput, CreateMachineFromTemplateInput, CreateMachineInput, CreateMachineTemplate, CreateProjectInput, DEFAULT_STATELY_BASE_URL, EnsureProjectInput, ExtractMachinesInput, ExtractMachinesResponse, ExtractedMachine, ExtractedMachines, GetMachineOptions, LegacyExtractMachinesOptions, LegacyProjectVisibility, LegacyUpdateMachineInput, Machine, MachineVersion, Project, ProjectData, ProjectMachine, ProjectMachineSummary, ProjectSummary, ProjectVisibility, RepoType, ResourceErrorCode, StudioApiError, StudioApiErrorOptions, StudioClient, StudioClientOptions, StudioMachineRecord, StudioRequestOptions, UpdateMachineInput, UpdateProjectInput, VerifyApiKeyResponse, VerifyResult, XStateVersion, createStatelyClient };
package/dist/studio.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./openapi-BTDjYWXd.mjs";
2
- import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-rSI54Ese.mjs";
2
+ import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-BZP6DaIO.mjs";
3
3
 
4
4
  export { DEFAULT_STATELY_BASE_URL, StudioApiError, createStatelyClient };
package/dist/sync.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as DigraphConfig, i as StatelyGraph } from "./graph-CR_g-mOq.mjs";
2
- import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-DV5IIGhV.mjs";
1
+ import { b as DigraphConfig, i as StatelyGraph } from "./graph-Ciocekxl.mjs";
2
+ import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-CKdEPGKY.mjs";
3
3
  import { GraphDiff } from "@statelyai/graph";
4
4
 
5
5
  //#region src/sync.d.ts
package/dist/sync.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./openapi-BTDjYWXd.mjs";
2
- import { r as createStatelyClient } from "./studio-rSI54Ese.mjs";
3
- import { S as toXStateV6MachineConfig, a as alignCompareGraphIds, c as diffGraphsSemantically, d as getDelayKeyFromEventType, g as graphToXStateTS, i as XSTATE_V6_FN_TRANSITION_META, m as graphToMachineConfig, p as graphChangeToPatchesResult, r as XSTATE_V6_BRANCH_DESCRIPTION_META, s as detectXStateSourceProfile, t as INLINE_EXPRESSION_DIRECTIVE_FIELDS, u as extractXStateMachineConfigEntries, x as serializeJS, y as normalizeMachineProfile } from "./dist-wbhkeGh6.mjs";
4
- import { n as getStatelyPragma, r as upsertStatelyPragma, t as findStatelyPragmaAttachments } from "./statelyPragma-D46lczJR.mjs";
2
+ import { r as createStatelyClient } from "./studio-BZP6DaIO.mjs";
3
+ import { C as toXStateV6MachineConfig, S as serializeJS, a as alignCompareGraphIds, b as normalizeMachineProfile, c as diffGraphsSemantically, d as getDelayKeyFromEventType, g as graphToXStateTS, i as XSTATE_V6_FN_TRANSITION_META, m as graphToMachineConfig, p as graphChangeToPatchesResult, r as XSTATE_V6_BRANCH_DESCRIPTION_META, s as detectXStateSourceProfile, t as INLINE_EXPRESSION_DIRECTIVE_FIELDS, u as extractXStateMachineConfigEntries, v as isCodeExpression } from "./dist-NJFkDQjK.mjs";
4
+ import { n as getStatelyPragma, r as upsertStatelyPragma, t as findStatelyPragmaAttachments } from "./statelyPragma-YtVaBuIe.mjs";
5
5
  import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
6
6
  import * as ts$1 from "typescript";
7
7
  import ts from "typescript";
@@ -2585,7 +2585,7 @@ function collectCodeImports(value) {
2585
2585
  for (const child of item) visit(child);
2586
2586
  return;
2587
2587
  }
2588
- if (isInlineExpressionDirective(item)) {
2588
+ if (isCodeExpression(item)) {
2589
2589
  const itemImports = item.imports;
2590
2590
  if (Array.isArray(itemImports)) {
2591
2591
  for (const candidate of itemImports) if (isCodeImport(candidate)) imports.push(candidate);
@@ -3481,14 +3481,9 @@ function containsRawCodeLike(value) {
3481
3481
  return Boolean(value) && typeof value === "object" && Object.values(value).some(containsRawCodeLike);
3482
3482
  }
3483
3483
  function inlineExpressionDirectiveToExpression(value) {
3484
- if (!isInlineExpressionDirective(value)) return null;
3484
+ if (!isCodeExpression(value)) return null;
3485
3485
  return ts$1.factory.createIdentifier(value.expr);
3486
3486
  }
3487
- function isInlineExpressionDirective(value) {
3488
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
3489
- const directive = value;
3490
- return directive["@type"] === "code" && typeof directive.expr === "string";
3491
- }
3492
3487
  function getPreservedPropertyInitializer(propertyName, nextValue, existingInitializer) {
3493
3488
  if (propertyName !== "description" || typeof nextValue !== "string" || !existingInitializer) return null;
3494
3489
  if (ts$1.isStringLiteralLike(existingInitializer)) return existingInitializer.text === nextValue ? existingInitializer : null;
@@ -1,4 +1,4 @@
1
- import { EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, PREFIX, assertEmbedExamples } from "./protocol.mjs";
1
+ import { a as PREFIX, n as EMBED_DOCUMENT_LIMITS, o as assertEmbedExamples, r as INSPECTION_PROTOCOL_VERSION, t as EMBED_DOCUMENT_LANGUAGES } from "./protocol-BsBGRISR.mjs";
2
2
 
3
3
  //#region src/clientUtils.ts
4
4
  const embedDocumentLanguages = new Set(EMBED_DOCUMENT_LANGUAGES);
@@ -147,7 +147,7 @@ function toInitMessage(options) {
147
147
  commentsByMachineId: options.commentsByMachineId,
148
148
  projectWorkspace: options.projectWorkspace,
149
149
  projectWorkspaceOpen: options.projectWorkspaceOpen,
150
- settings: options.settings,
150
+ settings: settingsWithViewMode(options),
151
151
  unsavedIndicator: options.unsavedIndicator,
152
152
  versionAutoSave: options.versionAutoSave
153
153
  };
@@ -167,11 +167,23 @@ function toInitMessage(options) {
167
167
  panels: options.panels,
168
168
  comments: options.comments,
169
169
  sourceLocations: options.sourceLocations,
170
- settings: options.settings,
170
+ settings: settingsWithViewMode(options),
171
171
  unsavedIndicator: options.unsavedIndicator,
172
172
  versionAutoSave: options.versionAutoSave
173
173
  };
174
174
  }
175
+ /** Resolve the view shorthand without replacing unrelated embed settings. */
176
+ function settingsWithViewMode(options) {
177
+ if (!options.viewMode) return options.settings;
178
+ const canvas = options.settings?.canvas;
179
+ return {
180
+ ...options.settings,
181
+ canvas: {
182
+ ...canvas && typeof canvas === "object" && !Array.isArray(canvas) ? canvas : {},
183
+ viewMode: options.viewMode
184
+ }
185
+ };
186
+ }
175
187
 
176
188
  //#endregion
177
189
  //#region src/transport.ts
@@ -366,7 +378,7 @@ function createWebSocketTransport(options) {
366
378
 
367
379
  //#endregion
368
380
  //#region src/version.ts
369
- const SDK_VERSION = "0.33.0";
381
+ const SDK_VERSION = "0.34.0";
370
382
  function inspectionRuntime() {
371
383
  if (typeof window !== "undefined") return "browser";
372
384
  if (typeof process !== "undefined" && process.versions?.node) return "node";
@@ -374,4 +386,4 @@ function inspectionRuntime() {
374
386
  }
375
387
 
376
388
  //#endregion
377
- export { createEventRegistry as a, createWebSocketTransport as i, inspectionRuntime as n, createPendingExportManager as o, createPostMessageTransport as r, toInitMessage as s, SDK_VERSION as t };
389
+ export { assertEmbedDocuments as a, createPendingExportManager as c, createWebSocketTransport as i, settingsWithViewMode as l, inspectionRuntime as n, assertEmbedPanels as o, createPostMessageTransport as r, createEventRegistry as s, SDK_VERSION as t, toInitMessage as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/sdk",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "stately-sdk": "./dist/bin.mjs"
@@ -93,8 +93,8 @@
93
93
  "jsdom": "^27.4.0",
94
94
  "tsdown": "0.21.0-beta.2",
95
95
  "vitest": "^3.2.4",
96
- "@statelyai/api-contract": "0.5.0",
97
- "@statelyai/graph-tools": "0.8.3"
96
+ "@statelyai/api-contract": "0.5.1",
97
+ "@statelyai/graph-tools": "0.8.4"
98
98
  },
99
99
  "engines": {
100
100
  "node": ">=22.4"