@statelyai/sdk 0.12.0 → 0.12.2
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/{graphToXStateTS-D12GTMBp.mjs → dist-C-AdA8Iw.mjs} +3736 -52
- package/dist/{graph-CszT5J6W.d.mts → graph-Dq5ycdSq.d.mts} +2 -264
- package/dist/graph.d.mts +1 -1
- package/dist/index-BRW2DecD.d.mts +2843 -0
- package/dist/index.d.mts +5 -59
- package/dist/index.mjs +3 -3
- package/dist/inspect.d.mts +1 -1
- package/dist/oauth.d.mts +18 -1
- package/dist/oauth.mjs +36 -16
- package/dist/patchTypes.d.mts +2 -249
- package/dist/protocol.d.mts +6 -2
- package/dist/sync.d.mts +1 -1
- package/dist/sync.mjs +1 -3576
- package/package.json +3 -2
- /package/dist/{inspect-BibyPhFj.d.mts → inspect-BmZUcnZB.d.mts} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -3,14 +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 {
|
|
7
|
-
import { a as
|
|
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-BRW2DecD.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-Dq5ycdSq.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
|
-
|
|
14
12
|
//#region src/statelyPragma.d.ts
|
|
15
13
|
interface StatelyPragma {
|
|
16
14
|
tag: '@statelyai';
|
|
@@ -33,56 +31,4 @@ declare function findStatelyPragmaAttachments(sourceText: string, fileName?: str
|
|
|
33
31
|
declare function getStatelyPragma(sourceText: string, fileName?: string, machineIndex?: number): StatelyPragma | undefined;
|
|
34
32
|
declare function upsertStatelyPragma(sourceText: string, id: string, options?: UpsertStatelyPragmaOptions): string;
|
|
35
33
|
//#endregion
|
|
36
|
-
|
|
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 };
|
|
34
|
+
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 {
|
|
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-C-AdA8Iw.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 };
|
package/dist/inspect.d.mts
CHANGED
|
@@ -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-
|
|
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
|
-
|
|
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
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
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 };
|
package/dist/patchTypes.d.mts
CHANGED
|
@@ -1,249 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type
|
|
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-BRW2DecD.mjs";
|
|
2
|
+
export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -249,6 +249,10 @@ interface InitMessage {
|
|
|
249
249
|
/** Optional session id override (multiplexed clients only). */
|
|
250
250
|
sessionId?: string;
|
|
251
251
|
}
|
|
252
|
+
interface SetApiKeyMessage {
|
|
253
|
+
type: "@statelyai.setApiKey";
|
|
254
|
+
apiKey: string;
|
|
255
|
+
}
|
|
252
256
|
interface ProjectInitMessage {
|
|
253
257
|
type: "@statelyai.project.init";
|
|
254
258
|
machines: ProjectEmbedMachine[];
|
|
@@ -456,7 +460,7 @@ interface UploadResponseMessage {
|
|
|
456
460
|
result: UploadResult;
|
|
457
461
|
}
|
|
458
462
|
/** All messages a client (embed/inspector) can send to the viz. */
|
|
459
|
-
type ClientMessage = InitMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemActorRegisteredMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ErrorMessage;
|
|
463
|
+
type ClientMessage = InitMessage | SetApiKeyMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemActorRegisteredMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ErrorMessage;
|
|
460
464
|
/** All messages the viz can send back to a client. */
|
|
461
465
|
type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | ProjectMachineSelectedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | UploadRequestMessage;
|
|
462
466
|
interface RegisterMessage {
|
|
@@ -506,4 +510,4 @@ type SessionMessage = RegisterMessage | RegisteredMessage | RequestOpenMessage |
|
|
|
506
510
|
type ProtocolMessage = ClientMessage | VizMessage | SessionMessage;
|
|
507
511
|
declare const PREFIX = "@statelyai.";
|
|
508
512
|
//#endregion
|
|
509
|
-
export { ActorSystemEntry, AddSessionMessage, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, InitMessage, InitOptions, InspectSnapshotMessage, LoadedMessage, MachineInitOptions, MachineSourceLocations, PREFIX, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectUpdateMessage, ProtocolMessage, ReadyMessage, RegisterMessage, RegisteredMessage, RequestOpenMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SessionAddedMessage, SessionMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VizMessage };
|
|
513
|
+
export { ActorSystemEntry, AddSessionMessage, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, InitMessage, InitOptions, InspectSnapshotMessage, LoadedMessage, MachineInitOptions, MachineSourceLocations, PREFIX, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectUpdateMessage, ProtocolMessage, ReadyMessage, RegisterMessage, RegisteredMessage, RequestOpenMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SessionAddedMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VizMessage };
|
package/dist/sync.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as DigraphConfig, i as StatelyGraph } from "./graph-
|
|
1
|
+
import { b as DigraphConfig, i as StatelyGraph } from "./graph-Dq5ycdSq.mjs";
|
|
2
2
|
import { CreateProjectInput, ProjectData, StudioClient, StudioMachineRecord, XStateVersion } from "./studio.mjs";
|
|
3
3
|
import { GraphDiff } from "@statelyai/graph";
|
|
4
4
|
|