@statelyai/sdk 0.7.1 → 0.9.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.
- package/README.md +12 -637
- package/dist/assetStorage.d.mts +1 -1
- package/dist/embed.d.mts +1 -1
- package/dist/embed.mjs +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{graphToXStateTS-Gzh0ZqbN.mjs → graphToXStateTS-moihsH_U.mjs} +17 -16
- package/dist/index.d.mts +144 -5
- package/dist/index.mjs +2 -2
- package/dist/{inspect-YoEwfiKb.d.mts → inspect-BLlM3qKf.d.mts} +1 -1
- package/dist/inspect.d.mts +2 -2
- package/dist/inspect.mjs +1 -1
- package/dist/{protocol-s9zwsiCW.d.mts → protocol.d.mts} +2 -1
- package/dist/protocol.mjs +5 -0
- package/dist/sync.d.mts +1 -1
- package/dist/sync.mjs +1254 -3
- package/dist/{transport-C8UTS3Fa.mjs → transport-CVZGF0w9.mjs} +2 -4
- package/package.json +5 -18
- package/schemas/statelyai.schema.json +13 -72
- package/dist/cli.d.mts +0 -203
- package/dist/cli.mjs +0 -1760
- package/dist/sync-DLkTmSyA.mjs +0 -2513
- /package/dist/{graph-zuNj3kfa.d.mts → graph-CJ3N2r43.d.mts} +0 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { PREFIX } from "./protocol.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/clientUtils.ts
|
|
2
4
|
const jsonResultFormats = new Set([
|
|
3
5
|
"digraph",
|
|
@@ -120,10 +122,6 @@ function toInitMessage(options) {
|
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/protocol.ts
|
|
125
|
-
const PREFIX = "@statelyai.";
|
|
126
|
-
|
|
127
125
|
//#endregion
|
|
128
126
|
//#region src/transport.ts
|
|
129
127
|
function createPostMessageTransport(options) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statelyai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"bin": {
|
|
6
|
-
"statelyai": "./dist/cli.mjs"
|
|
7
|
-
},
|
|
8
5
|
"files": [
|
|
9
6
|
"dist",
|
|
10
7
|
"schemas"
|
|
@@ -37,10 +34,6 @@
|
|
|
37
34
|
"types": "./dist/sync.d.mts",
|
|
38
35
|
"import": "./dist/sync.mjs"
|
|
39
36
|
},
|
|
40
|
-
"./cli": {
|
|
41
|
-
"types": "./dist/cli.d.mts",
|
|
42
|
-
"import": "./dist/cli.mjs"
|
|
43
|
-
},
|
|
44
37
|
"./studio": {
|
|
45
38
|
"types": "./dist/studio.d.mts",
|
|
46
39
|
"import": "./dist/studio.mjs"
|
|
@@ -53,13 +46,16 @@
|
|
|
53
46
|
"types": "./dist/assetStorage.d.mts",
|
|
54
47
|
"import": "./dist/assetStorage.mjs"
|
|
55
48
|
},
|
|
49
|
+
"./protocol": {
|
|
50
|
+
"types": "./dist/protocol.d.mts",
|
|
51
|
+
"import": "./dist/protocol.mjs"
|
|
52
|
+
},
|
|
56
53
|
"./statelyai.schema.json": "./schemas/statelyai.schema.json",
|
|
57
54
|
"./schemas/statelyai.schema.json": "./schemas/statelyai.schema.json",
|
|
58
55
|
"./xstate-json.schema.json": "./schemas/xstate-json.schema.json",
|
|
59
56
|
"./schemas/xstate-json.schema.json": "./schemas/xstate-json.schema.json"
|
|
60
57
|
},
|
|
61
58
|
"dependencies": {
|
|
62
|
-
"@oclif/core": "^4.10.3",
|
|
63
59
|
"@statelyai/graph": "^0.9.0",
|
|
64
60
|
"esbuild": "^0.27.0",
|
|
65
61
|
"typescript": "^5.9.3",
|
|
@@ -71,15 +67,6 @@
|
|
|
71
67
|
"tsdown": "0.21.0-beta.2",
|
|
72
68
|
"vitest": "^3.2.4"
|
|
73
69
|
},
|
|
74
|
-
"oclif": {
|
|
75
|
-
"bin": "statelyai",
|
|
76
|
-
"commands": {
|
|
77
|
-
"identifier": "COMMANDS",
|
|
78
|
-
"strategy": "explicit",
|
|
79
|
-
"target": "./dist/cli.mjs"
|
|
80
|
-
},
|
|
81
|
-
"topicSeparator": " "
|
|
82
|
-
},
|
|
83
70
|
"scripts": {
|
|
84
71
|
"build": "tsdown",
|
|
85
72
|
"test": "vitest run",
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"$id": "https://stately.ai/schemas/statelyai.json",
|
|
4
4
|
"title": "Stately CLI project configuration",
|
|
5
|
-
"description": "Configuration for mapping local machine
|
|
5
|
+
"description": "Configuration for mapping local machine files to a Stately Studio project.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
|
-
"required": ["version", "projectId", "
|
|
8
|
+
"required": ["version", "projectId", "include"],
|
|
9
9
|
"properties": {
|
|
10
10
|
"$schema": {
|
|
11
11
|
"type": "string",
|
|
@@ -34,12 +34,17 @@
|
|
|
34
34
|
"default": 5,
|
|
35
35
|
"description": "Default XState major version for sources that do not override it. Only XState 5+ is supported."
|
|
36
36
|
},
|
|
37
|
-
"
|
|
37
|
+
"include": {
|
|
38
38
|
"type": "array",
|
|
39
|
-
"minItems": 1,
|
|
40
|
-
"description": "Source groups used to discover and classify local machine files.",
|
|
41
39
|
"items": {
|
|
42
|
-
"$ref": "#/$defs/
|
|
40
|
+
"$ref": "#/$defs/globPattern"
|
|
41
|
+
},
|
|
42
|
+
"description": "Glob patterns for local files to scan."
|
|
43
|
+
},
|
|
44
|
+
"exclude": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"items": {
|
|
47
|
+
"$ref": "#/$defs/globPattern"
|
|
43
48
|
}
|
|
44
49
|
}
|
|
45
50
|
},
|
|
@@ -48,59 +53,6 @@
|
|
|
48
53
|
"type": "string",
|
|
49
54
|
"minLength": 1,
|
|
50
55
|
"description": "A glob pattern evaluated relative to the statelyai.json location."
|
|
51
|
-
},
|
|
52
|
-
"sourceFormat": {
|
|
53
|
-
"type": "string",
|
|
54
|
-
"enum": [
|
|
55
|
-
"auto",
|
|
56
|
-
"xstate",
|
|
57
|
-
"xstate-json",
|
|
58
|
-
"xgraph",
|
|
59
|
-
"digraph",
|
|
60
|
-
"mermaid",
|
|
61
|
-
"scxml",
|
|
62
|
-
"asl-json",
|
|
63
|
-
"asl-yaml",
|
|
64
|
-
"redux",
|
|
65
|
-
"zustand"
|
|
66
|
-
],
|
|
67
|
-
"description": "Machine format for matching sources. Use xstate for JavaScript or TypeScript machine source files."
|
|
68
|
-
},
|
|
69
|
-
"source": {
|
|
70
|
-
"type": "object",
|
|
71
|
-
"additionalProperties": false,
|
|
72
|
-
"required": ["include"],
|
|
73
|
-
"properties": {
|
|
74
|
-
"name": {
|
|
75
|
-
"type": "string",
|
|
76
|
-
"minLength": 1,
|
|
77
|
-
"description": "Optional label for this source group."
|
|
78
|
-
},
|
|
79
|
-
"include": {
|
|
80
|
-
"type": "array",
|
|
81
|
-
"minItems": 1,
|
|
82
|
-
"items": {
|
|
83
|
-
"$ref": "#/$defs/globPattern"
|
|
84
|
-
},
|
|
85
|
-
"description": "Glob patterns for files to include in this source group."
|
|
86
|
-
},
|
|
87
|
-
"exclude": {
|
|
88
|
-
"type": "array",
|
|
89
|
-
"items": {
|
|
90
|
-
"$ref": "#/$defs/globPattern"
|
|
91
|
-
},
|
|
92
|
-
"description": "Glob patterns excluded from this source group."
|
|
93
|
-
},
|
|
94
|
-
"format": {
|
|
95
|
-
"$ref": "#/$defs/sourceFormat",
|
|
96
|
-
"default": "auto"
|
|
97
|
-
},
|
|
98
|
-
"xstateVersion": {
|
|
99
|
-
"type": "integer",
|
|
100
|
-
"minimum": 5,
|
|
101
|
-
"description": "Optional XState major version override for this source group. Only XState 5+ is supported."
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
56
|
}
|
|
105
57
|
},
|
|
106
58
|
"examples": [
|
|
@@ -110,19 +62,8 @@
|
|
|
110
62
|
"projectId": "project_123",
|
|
111
63
|
"studioUrl": "https://stately.ai",
|
|
112
64
|
"defaultXStateVersion": 5,
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
"name": "app-machines",
|
|
116
|
-
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
117
|
-
"exclude": ["**/*.test.ts", "**/*.spec.ts", "**/dist/**"],
|
|
118
|
-
"format": "xstate"
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
"name": "docs",
|
|
122
|
-
"include": ["docs/**/*.mmd"],
|
|
123
|
-
"format": "mermaid"
|
|
124
|
-
}
|
|
125
|
-
]
|
|
65
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
66
|
+
"exclude": ["**/*.test.ts", "**/*.spec.ts"]
|
|
126
67
|
}
|
|
127
68
|
]
|
|
128
69
|
}
|
package/dist/cli.d.mts
DELETED
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
import { ConnectedRepo, CreateProjectInput, ProjectData, StudioClient } from "./studio.mjs";
|
|
2
|
-
import { SyncPlan } from "./sync.mjs";
|
|
3
|
-
import { Command } from "@oclif/core";
|
|
4
|
-
import * as _oclif_core_interfaces0 from "@oclif/core/interfaces";
|
|
5
|
-
|
|
6
|
-
//#region src/projectConfig.d.ts
|
|
7
|
-
interface StatelySourceConfig {
|
|
8
|
-
include: string[];
|
|
9
|
-
exclude?: string[];
|
|
10
|
-
format: 'xstate' | 'redux' | 'zustand' | 'xgraph' | 'digraph' | 'mermaid' | 'scxml' | 'xstate-json' | 'asl-json' | 'asl-yaml' | 'auto';
|
|
11
|
-
xstateVersion?: number;
|
|
12
|
-
}
|
|
13
|
-
interface StatelyProjectConfig {
|
|
14
|
-
$schema: string;
|
|
15
|
-
version: string;
|
|
16
|
-
projectId: string;
|
|
17
|
-
studioUrl: string;
|
|
18
|
-
defaultXStateVersion: number;
|
|
19
|
-
sources: StatelySourceConfig[];
|
|
20
|
-
}
|
|
21
|
-
declare function createStatelyProjectConfig(options: {
|
|
22
|
-
projectId: string;
|
|
23
|
-
studioUrl: string;
|
|
24
|
-
defaultXStateVersion?: number;
|
|
25
|
-
}): StatelyProjectConfig;
|
|
26
|
-
//#endregion
|
|
27
|
-
//#region src/cli.d.ts
|
|
28
|
-
interface InitProjectOptions {
|
|
29
|
-
apiKey: string;
|
|
30
|
-
baseUrl?: string;
|
|
31
|
-
cwd?: string;
|
|
32
|
-
client?: StudioClient;
|
|
33
|
-
configPath?: string;
|
|
34
|
-
defaultXStateVersion?: number;
|
|
35
|
-
force?: boolean;
|
|
36
|
-
project?: Partial<CreateProjectInput>;
|
|
37
|
-
}
|
|
38
|
-
interface InitProjectResult {
|
|
39
|
-
config: StatelyProjectConfig;
|
|
40
|
-
configPath: string;
|
|
41
|
-
project: ProjectData;
|
|
42
|
-
}
|
|
43
|
-
interface ScanProjectSourcesOptions {
|
|
44
|
-
cwd?: string;
|
|
45
|
-
defaultXStateVersion?: number;
|
|
46
|
-
}
|
|
47
|
-
type ApiKeyResolution = {
|
|
48
|
-
apiKey: string;
|
|
49
|
-
detail: string;
|
|
50
|
-
source: 'env' | 'flag' | 'stored';
|
|
51
|
-
} | {
|
|
52
|
-
apiKey?: undefined;
|
|
53
|
-
detail?: undefined;
|
|
54
|
-
source: 'missing';
|
|
55
|
-
};
|
|
56
|
-
declare function getEnvApiKey(): {
|
|
57
|
-
apiKey: string;
|
|
58
|
-
variable: 'NEXT_PUBLIC_STATELY_API_KEY' | 'STATELY_API_KEY';
|
|
59
|
-
} | undefined;
|
|
60
|
-
declare function resolveApiKey(explicitApiKey?: string): Promise<ApiKeyResolution>;
|
|
61
|
-
declare function inferInitProjectName(cwd: string, repo?: ConnectedRepo): string;
|
|
62
|
-
declare function initProject(options: InitProjectOptions): Promise<InitProjectResult>;
|
|
63
|
-
declare function scanProjectSources(options: ScanProjectSourcesOptions): Promise<StatelySourceConfig[]>;
|
|
64
|
-
declare function formatPlanSummary(plan: SyncPlan): string;
|
|
65
|
-
declare abstract class BaseSyncCommand extends Command {
|
|
66
|
-
static enableJsonFlag: boolean;
|
|
67
|
-
static flags: {
|
|
68
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
69
|
-
'fail-on-changes': _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
70
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
71
|
-
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
declare abstract class ParsedSyncCommand extends BaseSyncCommand {
|
|
75
|
-
protected parseSync<T extends typeof BaseSyncCommand>(command: T): Promise<_oclif_core_interfaces0.ParserOutput<{
|
|
76
|
-
help: void;
|
|
77
|
-
'fail-on-changes': boolean;
|
|
78
|
-
'api-key': string | undefined;
|
|
79
|
-
'base-url': string | undefined;
|
|
80
|
-
}, {
|
|
81
|
-
[flag: string]: any;
|
|
82
|
-
}, {
|
|
83
|
-
[arg: string]: any;
|
|
84
|
-
}>>;
|
|
85
|
-
}
|
|
86
|
-
declare class PlanCommand extends ParsedSyncCommand {
|
|
87
|
-
static summary: string;
|
|
88
|
-
static description: string;
|
|
89
|
-
static args: {
|
|
90
|
-
source: _oclif_core_interfaces0.Arg<string, Record<string, unknown>>;
|
|
91
|
-
target: _oclif_core_interfaces0.Arg<string, Record<string, unknown>>;
|
|
92
|
-
};
|
|
93
|
-
run(): Promise<void>;
|
|
94
|
-
}
|
|
95
|
-
declare class DiffCommand extends ParsedSyncCommand {
|
|
96
|
-
static summary: string;
|
|
97
|
-
static description: string;
|
|
98
|
-
static args: {
|
|
99
|
-
source: _oclif_core_interfaces0.Arg<string, Record<string, unknown>>;
|
|
100
|
-
target: _oclif_core_interfaces0.Arg<string, Record<string, unknown>>;
|
|
101
|
-
};
|
|
102
|
-
run(): Promise<void>;
|
|
103
|
-
}
|
|
104
|
-
declare class PullCommand extends ParsedSyncCommand {
|
|
105
|
-
static summary: string;
|
|
106
|
-
static description: string;
|
|
107
|
-
static args: {
|
|
108
|
-
source: _oclif_core_interfaces0.Arg<string, Record<string, unknown>>;
|
|
109
|
-
target: _oclif_core_interfaces0.Arg<string | undefined, Record<string, unknown>>;
|
|
110
|
-
};
|
|
111
|
-
run(): Promise<void>;
|
|
112
|
-
}
|
|
113
|
-
declare class PushCommand extends Command {
|
|
114
|
-
static enableJsonFlag: boolean;
|
|
115
|
-
static summary: string;
|
|
116
|
-
static description: string;
|
|
117
|
-
static args: {
|
|
118
|
-
file: _oclif_core_interfaces0.Arg<string | undefined, Record<string, unknown>>;
|
|
119
|
-
};
|
|
120
|
-
static flags: {
|
|
121
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
122
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
123
|
-
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
124
|
-
config: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
125
|
-
};
|
|
126
|
-
run(): Promise<void>;
|
|
127
|
-
}
|
|
128
|
-
declare class OpenCommand extends Command {
|
|
129
|
-
static enableJsonFlag: boolean;
|
|
130
|
-
static summary: string;
|
|
131
|
-
static description: string;
|
|
132
|
-
static args: {
|
|
133
|
-
file: _oclif_core_interfaces0.Arg<string, Record<string, unknown>>;
|
|
134
|
-
};
|
|
135
|
-
static flags: {
|
|
136
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
137
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
138
|
-
'editor-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
139
|
-
host: _oclif_core_interfaces0.OptionFlag<string, _oclif_core_interfaces0.CustomOptions>;
|
|
140
|
-
port: _oclif_core_interfaces0.OptionFlag<number, _oclif_core_interfaces0.CustomOptions>;
|
|
141
|
-
open: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
142
|
-
debug: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
143
|
-
};
|
|
144
|
-
run(): Promise<void>;
|
|
145
|
-
}
|
|
146
|
-
declare class InitCommand extends Command {
|
|
147
|
-
static enableJsonFlag: boolean;
|
|
148
|
-
static summary: string;
|
|
149
|
-
static description: string;
|
|
150
|
-
static flags: {
|
|
151
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
152
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
153
|
-
'base-url': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
154
|
-
name: _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
155
|
-
visibility: _oclif_core_interfaces0.OptionFlag<string, _oclif_core_interfaces0.CustomOptions>;
|
|
156
|
-
force: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
157
|
-
scan: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
158
|
-
};
|
|
159
|
-
run(): Promise<void>;
|
|
160
|
-
}
|
|
161
|
-
declare class LoginCommand extends Command {
|
|
162
|
-
static enableJsonFlag: boolean;
|
|
163
|
-
static summary: string;
|
|
164
|
-
static description: string;
|
|
165
|
-
static flags: {
|
|
166
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
167
|
-
'api-key': _oclif_core_interfaces0.OptionFlag<string | undefined, _oclif_core_interfaces0.CustomOptions>;
|
|
168
|
-
stdin: _oclif_core_interfaces0.BooleanFlag<boolean>;
|
|
169
|
-
};
|
|
170
|
-
run(): Promise<void>;
|
|
171
|
-
}
|
|
172
|
-
declare class LogoutCommand extends Command {
|
|
173
|
-
static enableJsonFlag: boolean;
|
|
174
|
-
static summary: string;
|
|
175
|
-
static description: string;
|
|
176
|
-
static flags: {
|
|
177
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
178
|
-
};
|
|
179
|
-
run(): Promise<void>;
|
|
180
|
-
}
|
|
181
|
-
declare class AuthStatusCommand extends Command {
|
|
182
|
-
static enableJsonFlag: boolean;
|
|
183
|
-
static summary: string;
|
|
184
|
-
static description: string;
|
|
185
|
-
static flags: {
|
|
186
|
-
help: _oclif_core_interfaces0.BooleanFlag<void>;
|
|
187
|
-
};
|
|
188
|
-
run(): Promise<void>;
|
|
189
|
-
}
|
|
190
|
-
declare const COMMANDS: {
|
|
191
|
-
plan: typeof PlanCommand;
|
|
192
|
-
diff: typeof DiffCommand;
|
|
193
|
-
pull: typeof PullCommand;
|
|
194
|
-
push: typeof PushCommand;
|
|
195
|
-
open: typeof OpenCommand;
|
|
196
|
-
init: typeof InitCommand;
|
|
197
|
-
login: typeof LoginCommand;
|
|
198
|
-
logout: typeof LogoutCommand;
|
|
199
|
-
'auth:status': typeof AuthStatusCommand;
|
|
200
|
-
};
|
|
201
|
-
declare function run(argv?: string[], entryUrl?: string): Promise<void>;
|
|
202
|
-
//#endregion
|
|
203
|
-
export { ApiKeyResolution, COMMANDS, InitProjectOptions, InitProjectResult, ScanProjectSourcesOptions, createStatelyProjectConfig, formatPlanSummary, getEnvApiKey, inferInitProjectName, initProject, resolveApiKey, run, scanProjectSources };
|