@statelyai/sdk 0.12.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/index.d.mts CHANGED
@@ -3,13 +3,12 @@ import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, Edit
3
3
  import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
4
4
  import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-DO1-eQcU.mjs";
5
5
  import { AssetConfig, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
6
- import { C as EventTypeData, E as JSONSchema7, S as DigraphNodeConfig, T as CodeGenGraph, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-CszT5J6W.mjs";
7
- import { a as ManualActorOptions, c as createPostMessageTransport, i as InspectorEvents, l as createWebSocketTransport, n as CreateInspectorOptions, o as createStatelyInspector, r as Inspector, s as Transport, t as AdoptedActor } from "./inspect-BibyPhFj.mjs";
6
+ import { _ as serializeJS, c as MachineConfigOptions, d as contextSchemaToTSType, f as eventsSchemaToTSType, g as raw, h as jsonSchemaToTSType, i as CodeGenGraph, l as RawCode, m as graphToXStateTS, o as GraphPatch, p as graphToMachineConfig, t as ActionLocation, u as XStateTSOptions } from "./index-BpUKBSiq.mjs";
7
+ import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-Bm4_GZX_.mjs";
8
+ import { a as ManualActorOptions, c as createPostMessageTransport, i as InspectorEvents, l as createWebSocketTransport, n as CreateInspectorOptions, o as createStatelyInspector, r as Inspector, s as Transport, t as AdoptedActor } from "./inspect-BmZUcnZB.mjs";
8
9
  import { ConnectedRepo, CreateMachineFromDefinitionInput, CreateMachineFromTemplateInput, CreateMachineInput, CreateMachineTemplate, CreateProjectInput, EnsureProjectInput, ExtractMachinesResponse, ExtractedMachine, GetMachineOptions, ProjectData, ProjectMachine, ProjectVisibility, RepoType, StudioApiError, StudioClient, StudioClientOptions, StudioMachineRecord, UpdateMachineInput, VerifyApiKeyResponse, XStateVersion, createStatelyClient } from "./studio.mjs";
9
- import { OAuthAuthorizationServerMetadata, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken } from "./oauth.mjs";
10
+ import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
10
11
  import { PlanSyncOptions, PullSyncResult, PushLocalMachineLinksResult, PushSyncOptions, PushSyncProjectOptions, PushSyncResult, ResolvedSyncInput, SyncInputFormat, SyncPlan, SyncPlanSummary } from "./sync.mjs";
11
- import { ActionLocation, GraphPatch } from "./patchTypes.mjs";
12
- import { UnknownMachineConfig } from "xstate";
13
12
 
14
13
  //#region src/statelyPragma.d.ts
15
14
  interface StatelyPragma {
@@ -33,56 +32,4 @@ declare function findStatelyPragmaAttachments(sourceText: string, fileName?: str
33
32
  declare function getStatelyPragma(sourceText: string, fileName?: string, machineIndex?: number): StatelyPragma | undefined;
34
33
  declare function upsertStatelyPragma(sourceText: string, id: string, options?: UpsertStatelyPragmaOptions): string;
35
34
  //#endregion
36
- //#region ../graph-tools/src/graphToMachineConfig.d.ts
37
- interface MachineConfigOptions {
38
- showDescriptions?: boolean;
39
- showMeta?: boolean;
40
- /**
41
- * Emit inline-code guards as a `{ type }` reference instead of an inline code
42
- * expression directive. The simulation needs this: it can't evaluate guard
43
- * source, so it stubs each guard by `type` (see getSimImplementations). A
44
- * code-expression guard has no `type`, so XState reads `undefined` and throws
45
- * "Guard 'undefined' is not implemented" the moment that transition is taken.
46
- */
47
- inlineGuardsAsTypeRef?: boolean;
48
- }
49
- declare function graphToMachineConfig(graph: CodeGenGraph, options?: MachineConfigOptions): UnknownMachineConfig;
50
- //#endregion
51
- //#region src/graphToXStateTS.d.ts
52
- interface XStateTSOptions extends MachineConfigOptions {
53
- exportStyle?: 'named' | 'default' | 'none';
54
- targetLanguage?: 'typescript' | 'javascript';
55
- xstateVersion?: 5 | 6;
56
- }
57
- declare function graphToXStateTS(graph: CodeGenGraph, options?: XStateTSOptions): string;
58
- //#endregion
59
- //#region ../graph-tools/src/serializeJS.d.ts
60
- /**
61
- * Serializes JavaScript values as JS source code (not JSON).
62
- * - Unquoted keys for valid identifiers
63
- * - Single-quoted strings
64
- * - Omits undefined values
65
- * - Supports RawCode for verbatim expressions
66
- * - Supports inline expression directives for verbatim expressions
67
- */
68
- declare class RawCode {
69
- code: string;
70
- constructor(code: string);
71
- }
72
- declare function raw(code: string): RawCode;
73
- declare function serializeJS(value: unknown, indent?: number, step?: number): string;
74
- //#endregion
75
- //#region src/jsonSchemaToTSType.d.ts
76
- declare function jsonSchemaToTSType(schema: JSONSchema7 | undefined | null): string;
77
- /**
78
- * Build an inline context type string from the schemas.context record.
79
- * Each key is a context property name, value is its JSONSchema7.
80
- */
81
- declare function contextSchemaToTSType(context: Record<string, JSONSchema7> | null | undefined): string | null;
82
- /**
83
- * Build an event union type from the schemas.events record.
84
- * Each key is the event type name, value describes the payload properties.
85
- */
86
- declare function eventsSchemaToTSType(events: Record<string, JSONSchema7> | null | undefined): string | null;
87
- //#endregion
88
- export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CodeGenGraph, type CommentsConfig, type ConnectedRepo, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesResponse, type ExtractedMachine, type GetMachineOptions, type GraphPatch, type InitOptions, type Inspector, type InspectorEvents, type MachineConfigOptions, type ManualActorOptions, type OAuthAuthorizationServerMetadata, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSyncOptions, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectVisibility, type PullSyncResult, type PushLocalMachineLinksResult, type PushSyncOptions, type PushSyncProjectOptions, type PushSyncResult, RawCode, type RepoType, type ResolvedSyncInput, type S3UploadTarget, type StateNodeJSONData, type StatelyAction, type StatelyApiClientOptions, StatelyApiError, type StatelyApiUrlOptions, type StatelyAuthMode, type StatelyCredential, type StatelyEdgeData, type StatelyEmbed, type StatelyEmbedOptions, type StatelyGraph, type StatelyGraphData, type StatelyGuard, type StatelyInvoke, type StatelyNodeData, type StatelyPragma, type StatelyPragmaAttachment, type StudioAction, StudioApiError, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type SupabaseStorageClient, type SyncInputFormat, type SyncPlan, type SyncPlanSummary, type Transport, type UpdateMachineInput, type UploadResult, type UpsertStatelyPragmaOptions, type VerifyApiKeyResponse, type XStateTSOptions, type XStateVersion, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
35
+ export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CodeGenGraph, type CommentsConfig, type ConnectedRepo, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesResponse, type ExtractedMachine, type GetMachineOptions, type GraphPatch, type InitOptions, type Inspector, type InspectorEvents, type MachineConfigOptions, type ManualActorOptions, type OAuthAuthorizationServerMetadata, type OAuthClientRegistrationResponse, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSyncOptions, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectVisibility, type PullSyncResult, type PushLocalMachineLinksResult, type PushSyncOptions, type PushSyncProjectOptions, type PushSyncResult, RawCode, type RepoType, type ResolvedSyncInput, type S3UploadTarget, type StateNodeJSONData, type StatelyAction, type StatelyApiClientOptions, StatelyApiError, type StatelyApiUrlOptions, type StatelyAuthMode, type StatelyCredential, type StatelyEdgeData, type StatelyEmbed, type StatelyEmbedOptions, type StatelyGraph, type StatelyGraphData, type StatelyGuard, type StatelyInvoke, type StatelyNodeData, type StatelyPragma, type StatelyPragmaAttachment, type StudioAction, StudioApiError, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type SupabaseStorageClient, type SyncInputFormat, type SyncPlan, type SyncPlanSummary, type Transport, type UpdateMachineInput, type UploadResult, type UpsertStatelyPragmaOptions, type VerifyApiKeyResponse, type XStateTSOptions, type XStateVersion, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
package/dist/index.mjs CHANGED
@@ -4,9 +4,9 @@ import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./
4
4
  import { createStatelyInspector } from "./inspect.mjs";
5
5
  import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
6
6
  import { StudioApiError, createStatelyClient } from "./studio.mjs";
7
- import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken } from "./oauth.mjs";
7
+ import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
8
8
  import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
9
- import { S as upsertStatelyPragma, a as graphToMachineConfig, b as findStatelyPragmaAttachments, c as serializeJS, i as jsonSchemaToTSType, n as contextSchemaToTSType, o as RawCode, r as eventsSchemaToTSType, s as raw, t as graphToXStateTS, x as getStatelyPragma } from "./graphToXStateTS-D12GTMBp.mjs";
9
+ import { a as eventsSchemaToTSType, c as jsonSchemaToTSType, f as findStatelyPragmaAttachments, l as raw, m as upsertStatelyPragma, n as RawCode, o as graphToMachineConfig, p as getStatelyPragma, r as contextSchemaToTSType, s as graphToXStateTS, u as serializeJS } from "./dist-cQdIPK_n.mjs";
10
10
  import { fromStudioMachine, studioMachineConverter, toStudioMachine } from "./graph.mjs";
11
11
 
12
- export { RawCode, StatelyApiError, StudioApiError, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
12
+ export { RawCode, StatelyApiError, StudioApiError, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
@@ -1,3 +1,3 @@
1
1
  import { EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap } from "./protocol.mjs";
2
- import { a as ManualActorOptions, i as InspectorEvents, n as CreateInspectorOptions, o as createStatelyInspector, r as Inspector, s as Transport, t as AdoptedActor } from "./inspect-BibyPhFj.mjs";
2
+ import { a as ManualActorOptions, i as InspectorEvents, n as CreateInspectorOptions, o as createStatelyInspector, r as Inspector, s as Transport, t as AdoptedActor } from "./inspect-BmZUcnZB.mjs";
3
3
  export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, Inspector, InspectorEvents, ManualActorOptions, Transport, createStatelyInspector };
package/dist/oauth.d.mts CHANGED
@@ -9,11 +9,21 @@ interface OAuthProtectedResourceMetadata {
9
9
  interface OAuthAuthorizationServerMetadata {
10
10
  issuer: string;
11
11
  authorization_endpoint?: string;
12
+ registration_endpoint?: string;
12
13
  token_endpoint?: string;
13
14
  code_challenge_methods_supported?: string[];
14
15
  scopes_supported?: string[];
15
16
  [key: string]: unknown;
16
17
  }
18
+ interface OAuthClientRegistrationResponse {
19
+ client_id: string;
20
+ client_id_issued_at?: number;
21
+ client_name?: string;
22
+ client_secret?: string;
23
+ client_secret_expires_at?: number;
24
+ redirect_uris?: string[];
25
+ [key: string]: unknown;
26
+ }
17
27
  interface PkcePair {
18
28
  codeVerifier: string;
19
29
  codeChallenge: string;
@@ -33,6 +43,13 @@ declare function discoverProtectedResource(resourceUrl: string | URL, options?:
33
43
  declare function discoverAuthorizationServer(issuer: string | URL, options?: {
34
44
  fetch?: typeof fetch;
35
45
  }): Promise<OAuthAuthorizationServerMetadata>;
46
+ declare function registerOAuthClient(options: {
47
+ registrationEndpoint: string | URL;
48
+ redirectUri: string;
49
+ clientName?: string;
50
+ scopes?: string[];
51
+ fetch?: typeof fetch;
52
+ }): Promise<OAuthClientRegistrationResponse>;
36
53
  declare function createPkcePair(): Promise<PkcePair>;
37
54
  declare function buildAuthorizeUrl(options: {
38
55
  authorizationEndpoint: string | URL;
@@ -57,4 +74,4 @@ declare function refreshToken(options: {
57
74
  fetch?: typeof fetch;
58
75
  }): Promise<OAuthTokenResponse>;
59
76
  //#endregion
60
- export { OAuthAuthorizationServerMetadata, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken };
77
+ export { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient };
package/dist/oauth.mjs CHANGED
@@ -9,6 +9,10 @@ async function fetchJson(url, fetchImpl) {
9
9
  if (!response.ok) throw new Error(`${url} failed with HTTP ${response.status}`);
10
10
  return response.json();
11
11
  }
12
+ async function getOAuthResponseError(response) {
13
+ const detail = (await response.text().catch(() => "")).trim();
14
+ return detail ? `: ${detail}` : "";
15
+ }
12
16
  async function discoverProtectedResource(resourceUrl, options = {}) {
13
17
  const resource = new URL(String(resourceUrl));
14
18
  const pathParts = resource.pathname.split("/").filter(Boolean);
@@ -23,20 +27,36 @@ async function discoverProtectedResource(resourceUrl, options = {}) {
23
27
  return fetchJson(metadataUrl.toString(), options.fetch);
24
28
  }
25
29
  async function discoverAuthorizationServer(issuer, options = {}) {
26
- const issuerUrl = new URL(String(issuer));
27
- const metadataUrls = [new URL(".well-known/oauth-authorization-server", ensureTrailingSlash(issuerUrl)), new URL(".well-known/openid-configuration", ensureTrailingSlash(issuerUrl))];
28
- let lastError;
29
- for (const metadataUrl of metadataUrls) try {
30
- return await fetchJson(metadataUrl.toString(), options.fetch);
31
- } catch (error) {
32
- lastError = error;
33
- }
34
- throw lastError instanceof Error ? lastError : /* @__PURE__ */ new Error(`Unable to discover authorization server metadata for ${issuerUrl}`);
30
+ return fetchJson(getAuthorizationServerMetadataUrl(new URL(String(issuer))).toString(), options.fetch);
35
31
  }
36
- function ensureTrailingSlash(url) {
37
- const next = new URL(url);
38
- if (!next.pathname.endsWith("/")) next.pathname = `${next.pathname}/`;
39
- return next;
32
+ async function registerOAuthClient(options) {
33
+ const response = await getFetch(options.fetch)(String(options.registrationEndpoint), {
34
+ method: "POST",
35
+ headers: {
36
+ Accept: "application/json",
37
+ "Content-Type": "application/json"
38
+ },
39
+ body: JSON.stringify({
40
+ client_name: options.clientName ?? "Stately CLI",
41
+ redirect_uris: [options.redirectUri],
42
+ token_endpoint_auth_method: "none",
43
+ grant_types: ["authorization_code", "refresh_token"],
44
+ response_types: ["code"],
45
+ ...options.scopes?.length ? { scope: options.scopes.join(" ") } : {}
46
+ })
47
+ });
48
+ if (!response.ok) throw new Error(`OAuth client registration failed with HTTP ${response.status}${await getOAuthResponseError(response)}`);
49
+ return response.json();
50
+ }
51
+ function getAuthorizationServerMetadataUrl(issuerUrl) {
52
+ const issuerPathParts = issuerUrl.pathname.split("/").filter(Boolean);
53
+ const oauthMetadataUrl = new URL(issuerUrl.origin);
54
+ oauthMetadataUrl.pathname = [
55
+ ".well-known",
56
+ "oauth-authorization-server",
57
+ ...issuerPathParts
58
+ ].join("/");
59
+ return oauthMetadataUrl;
40
60
  }
41
61
  function base64UrlEncode(bytes) {
42
62
  let binary = "";
@@ -76,7 +96,7 @@ async function exchangeCodeForToken(options) {
76
96
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
77
97
  body
78
98
  });
79
- if (!response.ok) throw new Error(`Token exchange failed with HTTP ${response.status}`);
99
+ if (!response.ok) throw new Error(`Token exchange failed with HTTP ${response.status}${await getOAuthResponseError(response)}`);
80
100
  return response.json();
81
101
  }
82
102
  async function refreshToken(options) {
@@ -90,9 +110,9 @@ async function refreshToken(options) {
90
110
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
91
111
  body
92
112
  });
93
- if (!response.ok) throw new Error(`Token refresh failed with HTTP ${response.status}`);
113
+ if (!response.ok) throw new Error(`Token refresh failed with HTTP ${response.status}${await getOAuthResponseError(response)}`);
94
114
  return response.json();
95
115
  }
96
116
 
97
117
  //#endregion
98
- export { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken };
118
+ export { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient };
@@ -1,249 +1,2 @@
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 ImplementationSourceType = 'action' | 'guard' | 'actor' | 'delay';
12
- type GraphPatch = {
13
- op: 'createNode';
14
- description?: string;
15
- id?: string;
16
- parentId: string;
17
- key: string;
18
- type?: EditorStateType;
19
- x?: number;
20
- y?: number;
21
- } | {
22
- op: 'updateNode';
23
- description?: string;
24
- nodeId: string;
25
- data: {
26
- key?: string;
27
- type?: EditorStateType;
28
- description?: string;
29
- initialId?: string | null;
30
- };
31
- } | {
32
- op: 'deleteNode';
33
- description?: string;
34
- nodeId: string;
35
- } | {
36
- op: 'createEdge';
37
- description?: string;
38
- id?: string;
39
- sourceId: string;
40
- targetId: string;
41
- eventType: string;
42
- transitionType?: 'normal' | 'targetless' | 'reenter';
43
- } | {
44
- op: 'updateEdge';
45
- description?: string;
46
- edgeId: string;
47
- data: {
48
- sourceId?: string;
49
- targetId?: string;
50
- eventType?: string;
51
- transitionType?: 'normal' | 'targetless' | 'reenter';
52
- description?: string | null;
53
- };
54
- } | {
55
- op: 'deleteEdge';
56
- description?: string;
57
- edgeId: string;
58
- } | {
59
- op: 'createState';
60
- description?: string;
61
- id?: string;
62
- parentId: string;
63
- key: string;
64
- type?: EditorStateType;
65
- x?: number;
66
- y?: number;
67
- color?: CanvasColor | null;
68
- initial?: boolean;
69
- } | {
70
- op: 'updateState';
71
- description?: string;
72
- stateId: string;
73
- key?: string;
74
- type?: EditorStateType;
75
- stateDescription?: string;
76
- initialId?: string | null;
77
- color?: CanvasColor | null;
78
- meta?: Record<string, unknown> | null;
79
- history?: 'shallow' | 'deep' | null;
80
- } | {
81
- op: 'deleteState';
82
- description?: string;
83
- stateId: string;
84
- } | {
85
- op: 'createTransition';
86
- description?: string;
87
- id?: string;
88
- sourceId: string;
89
- targetId: string;
90
- eventType: string;
91
- transitionType?: 'normal' | 'targetless' | 'reenter';
92
- guard?: {
93
- type: string;
94
- code?: string;
95
- params?: Record<string, unknown>;
96
- };
97
- color?: CanvasColor | null;
98
- transitionDescription?: string | null;
99
- } | {
100
- op: 'updateTransition';
101
- description?: string;
102
- transitionId: string;
103
- sourceId?: string;
104
- targetId?: string;
105
- eventType?: string;
106
- transitionType?: 'normal' | 'targetless' | 'reenter';
107
- transitionDescription?: string | null;
108
- color?: CanvasColor | null;
109
- meta?: Record<string, unknown> | null;
110
- } | {
111
- op: 'deleteTransition';
112
- description?: string;
113
- transitionId: string;
114
- } | {
115
- op: 'createAction';
116
- description?: string;
117
- location: ActionLocation;
118
- action: {
119
- id?: string;
120
- type: string;
121
- params?: Record<string, unknown>;
122
- code?: string;
123
- };
124
- index?: number;
125
- } | {
126
- op: 'updateAction';
127
- description?: string;
128
- location: ActionLocation;
129
- actionId: string;
130
- data: {
131
- type?: string;
132
- params?: Record<string, unknown>;
133
- code?: string;
134
- };
135
- } | {
136
- op: 'deleteAction';
137
- description?: string;
138
- location: ActionLocation;
139
- actionId: string;
140
- } | {
141
- op: 'createInvoke';
142
- description?: string;
143
- nodeId: string;
144
- invoke: {
145
- id?: string;
146
- src: string;
147
- code?: string;
148
- input?: Record<string, unknown>;
149
- output?: Record<string, unknown>;
150
- };
151
- } | {
152
- op: 'updateInvoke';
153
- description?: string;
154
- nodeId: string;
155
- invokeId: string;
156
- data: {
157
- src?: string;
158
- code?: string;
159
- input?: Record<string, unknown>;
160
- output?: Record<string, unknown>;
161
- };
162
- } | {
163
- op: 'deleteInvoke';
164
- description?: string;
165
- nodeId: string;
166
- invokeId: string;
167
- } | {
168
- op: 'createImplementation';
169
- description?: string;
170
- sourceType: ImplementationSourceType;
171
- implementation: {
172
- id: string;
173
- name?: string;
174
- code?: string;
175
- };
176
- } | {
177
- op: 'updateImplementation';
178
- description?: string;
179
- sourceType: ImplementationSourceType;
180
- implementationId: string;
181
- data: {
182
- name?: string;
183
- code?: string;
184
- };
185
- } | {
186
- op: 'deleteImplementation';
187
- description?: string;
188
- sourceType: ImplementationSourceType;
189
- implementationId: string;
190
- } | {
191
- op: 'setGuard';
192
- description?: string;
193
- edgeId: string;
194
- guard: {
195
- type: string;
196
- code?: string;
197
- params?: Record<string, unknown>;
198
- };
199
- } | {
200
- op: 'deleteGuard';
201
- description?: string;
202
- edgeId: string;
203
- } | {
204
- op: 'createTag';
205
- description?: string;
206
- nodeId: string;
207
- tag: {
208
- name: string;
209
- };
210
- } | {
211
- op: 'deleteTag';
212
- description?: string;
213
- nodeId: string;
214
- tagName: string;
215
- } | {
216
- op: 'createAnnotation';
217
- description?: string;
218
- id?: string;
219
- parentId: string | null;
220
- content: string;
221
- x?: number;
222
- y?: number;
223
- } | {
224
- op: 'updateAnnotation';
225
- description?: string;
226
- annotationId: string;
227
- data: {
228
- content?: string;
229
- };
230
- } | {
231
- op: 'deleteAnnotation';
232
- description?: string;
233
- annotationId: string;
234
- } | {
235
- op: 'setContext';
236
- description?: string;
237
- context: Record<string, unknown>;
238
- } | {
239
- op: 'updateSchemas';
240
- description?: string;
241
- schemas: {
242
- context?: Record<string, unknown> | null;
243
- events?: Record<string, unknown> | null;
244
- input?: unknown | null;
245
- output?: unknown | null;
246
- };
247
- };
248
- //#endregion
249
- export { ActionLocation, CanvasColor, EditorStateType, GraphPatch, ImplementationSourceType };
1
+ import { a as EditorStateType, n as CanvasColor, o as GraphPatch, s as ImplementationSourceType, t as ActionLocation } from "./index-BpUKBSiq.mjs";
2
+ export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
package/dist/sync.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { b as DigraphConfig, i as StatelyGraph } from "./graph-CszT5J6W.mjs";
1
+ import { b as DigraphConfig, i as StatelyGraph } from "./graph-Bm4_GZX_.mjs";
2
2
  import { CreateProjectInput, ProjectData, StudioClient, StudioMachineRecord, XStateVersion } from "./studio.mjs";
3
3
  import { GraphDiff } from "@statelyai/graph";
4
4