@statelyai/sdk 0.40.0 → 0.41.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 +10 -0
- package/dist/assetStorage.d.mts +1 -1
- package/dist/chunk-D1OLi6Wq.mjs +46 -0
- package/dist/editorHostProtocol.d.mts +3 -3
- package/dist/embed.d.mts +4 -3
- package/dist/embed.mjs +1 -1
- package/dist/{graph-9CApplKH.d.mts → graph-DbZdSisK.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{index-gyYPC8rD.d.mts → index-DqF1xP8P.d.mts} +50 -399
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +3 -3
- package/dist/{inspect-COd1d8sJ.mjs → inspect-CDjr4saL.mjs} +1 -1
- package/dist/{inspect-C8SpNJKF.d.mts → inspect-ruD95iBM.d.mts} +1 -1
- package/dist/inspect.d.mts +2 -2
- package/dist/inspect.mjs +2 -2
- package/dist/machineGraph-DYtFKHlq-BpWpGU22.mjs +3 -0
- package/dist/machineGraph-DYtFKHlq-ChbeTHlv.mjs +1023 -0
- package/dist/patchTypes.d.mts +1 -1
- package/dist/{protocol-DUehXGus.d.mts → protocol-BvElOcXs.d.mts} +4 -3
- package/dist/protocol.d.mts +1 -1
- package/dist/relay.d.mts +1 -1
- package/dist/rolldown-runtime-95iHPtFO-Bo6l7CbO.mjs +114 -0
- package/dist/{studio-D0XNCqKr.mjs → schemas-DsQ8UYlM.mjs} +36 -1649
- package/dist/sourceCoverage.d.mts +101 -0
- package/dist/sourceCoverage.mjs +3572 -0
- package/dist/studio-DH7OeLao.mjs +1604 -0
- package/dist/{studio-DeFtdrGS.d.mts → studio-DRw9sxCm.d.mts} +10 -2
- package/dist/studio.d.mts +1 -1
- package/dist/studio.mjs +1 -1
- package/dist/{version-CRlxeCo2.mjs → version-eag6cuvm.mjs} +1 -1
- package/dist/xstateSource-BUCx2xA4-CWteIFJn.d.mts +451 -0
- package/dist/xstateSource-JvwXWv6G-KnMMoZlG.mjs +151753 -0
- package/package.json +7 -3
- /package/dist/{editor-sync-types-Ch5P5XRj.d.mts → editor-sync-types-BjgSBGxf.d.mts} +0 -0
- /package/dist/{patchTypes-BZ7gzwAP.d.mts → patchTypes-BFlvJTDJ.d.mts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as ZodUnknown, b as $strip, c as ZodEnum, d as ZodNumber, f as ZodObject, g as ZodUnion, h as ZodString, l as ZodLiteral, m as ZodRecord, o as ZodArray, p as ZodOptional, s as ZodBoolean, u as ZodNullable, v as output, y as $loose } from "./index-DqF1xP8P.mjs";
|
|
2
2
|
import { StatelyAuthMode, StatelyCredential } from "./auth.mjs";
|
|
3
3
|
|
|
4
4
|
//#region ../api-contract/dist/errors.d.mts
|
|
@@ -11,6 +11,7 @@ declare const resourceErrorCodeSchema: ZodEnum<{
|
|
|
11
11
|
bad_request: "bad_request";
|
|
12
12
|
unauthenticated: "unauthenticated";
|
|
13
13
|
forbidden: "forbidden";
|
|
14
|
+
machine_locked: "machine_locked";
|
|
14
15
|
not_found: "not_found";
|
|
15
16
|
conflict: "conflict";
|
|
16
17
|
payload_too_large: "payload_too_large";
|
|
@@ -56,17 +57,19 @@ type VerifyResult = output<typeof verifyResultSchema>;
|
|
|
56
57
|
* ignored rather than rejected.
|
|
57
58
|
*/
|
|
58
59
|
/**
|
|
59
|
-
* `name` and
|
|
60
|
+
* `name` and timestamps are optional: some upstream project envelopes only
|
|
60
61
|
* return machine ids. Providers that can supply them cheaply should.
|
|
61
62
|
*/
|
|
62
63
|
declare const projectMachineSummarySchema: ZodObject<{
|
|
63
64
|
machineId: ZodString;
|
|
64
65
|
name: ZodOptional<ZodString>;
|
|
66
|
+
createdAt: ZodOptional<ZodString>;
|
|
65
67
|
updatedAt: ZodOptional<ZodString>;
|
|
66
68
|
format: ZodOptional<ZodEnum<{
|
|
67
69
|
digraph: "digraph";
|
|
68
70
|
xgraph: "xgraph";
|
|
69
71
|
}>>;
|
|
72
|
+
locked: ZodOptional<ZodBoolean>;
|
|
70
73
|
}, $strip>;
|
|
71
74
|
type ProjectMachineSummary = output<typeof projectMachineSummarySchema>;
|
|
72
75
|
/**
|
|
@@ -94,11 +97,13 @@ declare const projectSummarySchema: ZodObject<{
|
|
|
94
97
|
machines: ZodOptional<ZodArray<ZodObject<{
|
|
95
98
|
machineId: ZodString;
|
|
96
99
|
name: ZodOptional<ZodString>;
|
|
100
|
+
createdAt: ZodOptional<ZodString>;
|
|
97
101
|
updatedAt: ZodOptional<ZodString>;
|
|
98
102
|
format: ZodOptional<ZodEnum<{
|
|
99
103
|
digraph: "digraph";
|
|
100
104
|
xgraph: "xgraph";
|
|
101
105
|
}>>;
|
|
106
|
+
locked: ZodOptional<ZodBoolean>;
|
|
102
107
|
}, $strip>>>;
|
|
103
108
|
permissions: ZodOptional<ZodObject<{
|
|
104
109
|
canEdit: ZodBoolean;
|
|
@@ -135,11 +140,13 @@ declare const projectSchema: ZodObject<{
|
|
|
135
140
|
machines: ZodArray<ZodObject<{
|
|
136
141
|
machineId: ZodString;
|
|
137
142
|
name: ZodOptional<ZodString>;
|
|
143
|
+
createdAt: ZodOptional<ZodString>;
|
|
138
144
|
updatedAt: ZodOptional<ZodString>;
|
|
139
145
|
format: ZodOptional<ZodEnum<{
|
|
140
146
|
digraph: "digraph";
|
|
141
147
|
xgraph: "xgraph";
|
|
142
148
|
}>>;
|
|
149
|
+
locked: ZodOptional<ZodBoolean>;
|
|
143
150
|
}, $strip>>;
|
|
144
151
|
permissions: ZodObject<{
|
|
145
152
|
canEdit: ZodBoolean;
|
|
@@ -222,6 +229,7 @@ declare const machineSchema: ZodObject<{
|
|
|
222
229
|
digraph: "digraph";
|
|
223
230
|
xgraph: "xgraph";
|
|
224
231
|
}>>;
|
|
232
|
+
locked: ZodOptional<ZodBoolean>;
|
|
225
233
|
}, $strip>;
|
|
226
234
|
type Machine = output<typeof machineSchema>;
|
|
227
235
|
declare const machineVersionSchema: ZodObject<{
|
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-
|
|
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-DRw9sxCm.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
|
-
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-
|
|
1
|
+
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-DH7OeLao.mjs";
|
|
2
2
|
import "./auth.mjs";
|
|
3
3
|
|
|
4
4
|
export { DEFAULT_STATELY_BASE_URL, StudioApiError, createStatelyClient };
|
|
@@ -383,7 +383,7 @@ function createWebSocketTransport(options) {
|
|
|
383
383
|
|
|
384
384
|
//#endregion
|
|
385
385
|
//#region src/version.ts
|
|
386
|
-
const SDK_VERSION = "0.
|
|
386
|
+
const SDK_VERSION = "0.41.0";
|
|
387
387
|
function inspectionRuntime() {
|
|
388
388
|
if (typeof window !== "undefined") return "browser";
|
|
389
389
|
if (typeof process !== "undefined" && process.versions?.node) return "node";
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/xstate@6.0.0-alpha.65/node_modules/xstate/dist/declarations/src/base.types.d.ts
|
|
2
|
+
declare global {
|
|
3
|
+
interface SymbolConstructor {
|
|
4
|
+
readonly observable: symbol;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The full definition of an event, with a string `type`.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
|
|
14
|
+
// ==================================================================================================
|
|
15
|
+
// JSON Schema Draft 07
|
|
16
|
+
// ==================================================================================================
|
|
17
|
+
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
18
|
+
// --------------------------------------------------------------------------------------------------
|
|
19
|
+
/**
|
|
20
|
+
* Primitive type
|
|
21
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
22
|
+
*/
|
|
23
|
+
type JSONSchema7TypeName = "string" //
|
|
24
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
25
|
+
/**
|
|
26
|
+
* Primitive type
|
|
27
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
|
|
28
|
+
*/
|
|
29
|
+
type JSONSchema7Type = string //
|
|
30
|
+
| number | boolean | JSONSchema7Object | JSONSchema7Array | null;
|
|
31
|
+
// Workaround for infinite type recursion
|
|
32
|
+
interface JSONSchema7Object {
|
|
33
|
+
[key: string]: JSONSchema7Type;
|
|
34
|
+
}
|
|
35
|
+
// Workaround for infinite type recursion
|
|
36
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
37
|
+
interface JSONSchema7Array extends Array<JSONSchema7Type> {}
|
|
38
|
+
/**
|
|
39
|
+
* Meta schema
|
|
40
|
+
*
|
|
41
|
+
* Recommended values:
|
|
42
|
+
* - 'http://json-schema.org/schema#'
|
|
43
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
44
|
+
* - 'http://json-schema.org/draft-07/schema#'
|
|
45
|
+
* - 'http://json-schema.org/draft-07/hyper-schema#'
|
|
46
|
+
*
|
|
47
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
48
|
+
*/
|
|
49
|
+
type JSONSchema7Version = string;
|
|
50
|
+
/**
|
|
51
|
+
* JSON Schema v7
|
|
52
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
53
|
+
*/
|
|
54
|
+
type JSONSchema7Definition = JSONSchema7 | boolean;
|
|
55
|
+
interface JSONSchema7 {
|
|
56
|
+
$id?: string | undefined;
|
|
57
|
+
$ref?: string | undefined;
|
|
58
|
+
$schema?: JSONSchema7Version | undefined;
|
|
59
|
+
$comment?: string | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
62
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
63
|
+
*/
|
|
64
|
+
$defs?: {
|
|
65
|
+
[key: string]: JSONSchema7Definition;
|
|
66
|
+
} | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
69
|
+
*/
|
|
70
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
71
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
72
|
+
const?: JSONSchema7Type | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
75
|
+
*/
|
|
76
|
+
multipleOf?: number | undefined;
|
|
77
|
+
maximum?: number | undefined;
|
|
78
|
+
exclusiveMaximum?: number | undefined;
|
|
79
|
+
minimum?: number | undefined;
|
|
80
|
+
exclusiveMinimum?: number | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
83
|
+
*/
|
|
84
|
+
maxLength?: number | undefined;
|
|
85
|
+
minLength?: number | undefined;
|
|
86
|
+
pattern?: string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
89
|
+
*/
|
|
90
|
+
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
|
|
91
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
92
|
+
maxItems?: number | undefined;
|
|
93
|
+
minItems?: number | undefined;
|
|
94
|
+
uniqueItems?: boolean | undefined;
|
|
95
|
+
contains?: JSONSchema7Definition | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
98
|
+
*/
|
|
99
|
+
maxProperties?: number | undefined;
|
|
100
|
+
minProperties?: number | undefined;
|
|
101
|
+
required?: string[] | undefined;
|
|
102
|
+
properties?: {
|
|
103
|
+
[key: string]: JSONSchema7Definition;
|
|
104
|
+
} | undefined;
|
|
105
|
+
patternProperties?: {
|
|
106
|
+
[key: string]: JSONSchema7Definition;
|
|
107
|
+
} | undefined;
|
|
108
|
+
additionalProperties?: JSONSchema7Definition | undefined;
|
|
109
|
+
dependencies?: {
|
|
110
|
+
[key: string]: JSONSchema7Definition | string[];
|
|
111
|
+
} | undefined;
|
|
112
|
+
propertyNames?: JSONSchema7Definition | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
115
|
+
*/
|
|
116
|
+
if?: JSONSchema7Definition | undefined;
|
|
117
|
+
then?: JSONSchema7Definition | undefined;
|
|
118
|
+
else?: JSONSchema7Definition | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
121
|
+
*/
|
|
122
|
+
allOf?: JSONSchema7Definition[] | undefined;
|
|
123
|
+
anyOf?: JSONSchema7Definition[] | undefined;
|
|
124
|
+
oneOf?: JSONSchema7Definition[] | undefined;
|
|
125
|
+
not?: JSONSchema7Definition | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
128
|
+
*/
|
|
129
|
+
format?: string | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
132
|
+
*/
|
|
133
|
+
contentMediaType?: string | undefined;
|
|
134
|
+
contentEncoding?: string | undefined;
|
|
135
|
+
/**
|
|
136
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
137
|
+
*/
|
|
138
|
+
definitions?: {
|
|
139
|
+
[key: string]: JSONSchema7Definition;
|
|
140
|
+
} | undefined;
|
|
141
|
+
/**
|
|
142
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
143
|
+
*/
|
|
144
|
+
title?: string | undefined;
|
|
145
|
+
description?: string | undefined;
|
|
146
|
+
default?: JSONSchema7Type | undefined;
|
|
147
|
+
readOnly?: boolean | undefined;
|
|
148
|
+
writeOnly?: boolean | undefined;
|
|
149
|
+
examples?: JSONSchema7Type | undefined;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region ../graph-tools/dist/xstateSource-BUCx2xA4.d.mts
|
|
153
|
+
//#region ../../node_modules/.pnpm/@statelyai+graph@2.1.0_@statelyai+layout@0.5.0_cytoscape@3.34.0_d3-force@3.0.0_d3-hiera_b5a11f1847a44c5e54d10b16dab0c7b9/node_modules/@statelyai/graph/dist/types-BAEQTwK_.d.mts
|
|
154
|
+
//#region src/types.d.ts
|
|
155
|
+
/**
|
|
156
|
+
* Directedness of a graph or an individual edge.
|
|
157
|
+
*
|
|
158
|
+
* - `'directed'` — edge points from source to target.
|
|
159
|
+
* - `'undirected'` — edge has no direction; traversable both ways.
|
|
160
|
+
* - `'bidirectional'` — edge points both ways (arrows on both ends).
|
|
161
|
+
*
|
|
162
|
+
* Set at the graph level as the default ({@link Graph.mode}); individual edges
|
|
163
|
+
* may override it ({@link GraphEdge.mode}).
|
|
164
|
+
*/
|
|
165
|
+
type GraphMode = 'directed' | 'undirected' | 'bidirectional';
|
|
166
|
+
/** A 2D point, used for edge routing waypoints. */
|
|
167
|
+
interface Point {
|
|
168
|
+
x: number;
|
|
169
|
+
y: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* How an edge's {@link GraphEdge.points} should be interpreted by renderers:
|
|
173
|
+
*
|
|
174
|
+
* - `'polyline'` — straight segments through the points.
|
|
175
|
+
* - `'orthogonal'` — axis-aligned segments (ELK layered routing).
|
|
176
|
+
* - `'splines'` — bezier control points (Graphviz convention: 3n+1 chained
|
|
177
|
+
* cubic curves, tail → head).
|
|
178
|
+
*/
|
|
179
|
+
type EdgeRouting = 'polyline' | 'orthogonal' | 'splines';
|
|
180
|
+
/** Shared optional visual/style props for nodes, edges, ports. */
|
|
181
|
+
interface GraphEntity {
|
|
182
|
+
x?: number;
|
|
183
|
+
y?: number;
|
|
184
|
+
width?: number;
|
|
185
|
+
height?: number;
|
|
186
|
+
style?: Record<string, string | number | boolean>;
|
|
187
|
+
}
|
|
188
|
+
/** Visual entity base — required position/size. */
|
|
189
|
+
type PortDirection = 'in' | 'out' | 'inout';
|
|
190
|
+
interface GraphPort<TPortData = any> extends GraphEntity {
|
|
191
|
+
name: string;
|
|
192
|
+
direction: PortDirection;
|
|
193
|
+
label?: string;
|
|
194
|
+
data: TPortData;
|
|
195
|
+
}
|
|
196
|
+
interface Graph<TNodeData = any, TEdgeData = any, TGraphData = any, TPortData = any> {
|
|
197
|
+
id: string;
|
|
198
|
+
/** Default directedness for all edges. */
|
|
199
|
+
mode: GraphMode;
|
|
200
|
+
initialNodeId?: string | null;
|
|
201
|
+
nodes: GraphNode<TNodeData, TPortData>[];
|
|
202
|
+
edges: GraphEdge<TEdgeData>[];
|
|
203
|
+
data: TGraphData;
|
|
204
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
205
|
+
style?: Record<string, string | number | boolean>;
|
|
206
|
+
}
|
|
207
|
+
interface GraphNode<TNodeData = any, TPortData = any> extends GraphEntity {
|
|
208
|
+
type: 'node';
|
|
209
|
+
id: string;
|
|
210
|
+
parentId?: string | null;
|
|
211
|
+
initialNodeId?: string | null;
|
|
212
|
+
label?: string | null;
|
|
213
|
+
data: TNodeData;
|
|
214
|
+
ports?: GraphPort<TPortData>[];
|
|
215
|
+
shape?: string;
|
|
216
|
+
color?: string;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Note on edge geometry: an edge's `x`/`y`/`width`/`height` are canonically
|
|
220
|
+
* the **label rect** (top-left + size); the edge's *route* lives in
|
|
221
|
+
* {@link GraphEdge.points}. See {@link EdgeConfig} for details.
|
|
222
|
+
*/
|
|
223
|
+
interface GraphEdge<TEdgeData = any> extends GraphEntity {
|
|
224
|
+
type: 'edge';
|
|
225
|
+
id: string;
|
|
226
|
+
sourceId: string;
|
|
227
|
+
targetId: string;
|
|
228
|
+
label?: string | null;
|
|
229
|
+
/**
|
|
230
|
+
* Optional numeric weight for the edge.
|
|
231
|
+
* Used by pathfinding, MST, and other weighted algorithms.
|
|
232
|
+
* When `getWeight` is not provided, algorithms default to `edge.weight ?? 1`.
|
|
233
|
+
*/
|
|
234
|
+
weight?: number;
|
|
235
|
+
/** Port name on the source node this edge connects from. */
|
|
236
|
+
sourcePort?: string;
|
|
237
|
+
/** Port name on the target node this edge connects to. */
|
|
238
|
+
targetPort?: string;
|
|
239
|
+
/**
|
|
240
|
+
* Per-edge directedness override. When absent, the edge inherits the graph's
|
|
241
|
+
* {@link Graph.mode}.
|
|
242
|
+
*/
|
|
243
|
+
mode?: GraphMode;
|
|
244
|
+
/**
|
|
245
|
+
* Edge route waypoints (including endpoints, tail → head), as computed by a
|
|
246
|
+
* layout engine. Interpretation is governed by {@link GraphEdge.routing}.
|
|
247
|
+
*/
|
|
248
|
+
points?: Point[];
|
|
249
|
+
/** How {@link GraphEdge.points} should be interpreted. Default: polyline. */
|
|
250
|
+
routing?: EdgeRouting;
|
|
251
|
+
data: TEdgeData;
|
|
252
|
+
color?: string;
|
|
253
|
+
}
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/profiles/profileRefs.d.ts
|
|
256
|
+
type ProfileName = `@${string}/${string}`;
|
|
257
|
+
type ProfileSpecifier = `${ProfileName}@${string}`;
|
|
258
|
+
type ResolvedProfileRef = ProfileSpecifier;
|
|
259
|
+
/**
|
|
260
|
+
* Serialized inline expression directive.
|
|
261
|
+
*
|
|
262
|
+
* Code generation treats this object as JavaScript/TypeScript source, not as a
|
|
263
|
+
* machine config object. It is used for fields such as invoke `input` and
|
|
264
|
+
* `output` where XState accepts mapper expressions.
|
|
265
|
+
*/
|
|
266
|
+
interface CodeExpression {
|
|
267
|
+
'@type': 'code';
|
|
268
|
+
lang: 'js' | 'ts';
|
|
269
|
+
expr: string;
|
|
270
|
+
imports?: CodeImport[];
|
|
271
|
+
}
|
|
272
|
+
interface CodeImport {
|
|
273
|
+
package: string;
|
|
274
|
+
import: string;
|
|
275
|
+
/** Local binding name when it differs from the imported name. */
|
|
276
|
+
local?: string;
|
|
277
|
+
importKind?: 'named' | 'default' | 'namespace';
|
|
278
|
+
version?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* A scalar `context`/`input`/`output` literal, kept verbatim from the source
|
|
282
|
+
* instead of being wrapped as a code expression.
|
|
283
|
+
*/
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/profiles/types.d.ts
|
|
286
|
+
/**
|
|
287
|
+
* The profile boundary only relies on XGraph's stable structural fields. This
|
|
288
|
+
* keeps profile packages independent from a particular editor's richer graph
|
|
289
|
+
* types while still allowing them to own semantic projection.
|
|
290
|
+
*/
|
|
291
|
+
type ProfileGraph = {
|
|
292
|
+
data: Record<string, unknown> & {
|
|
293
|
+
profile?: ProfileSpecifier;
|
|
294
|
+
schemas?: Record<string, unknown> | null;
|
|
295
|
+
importMetadata?: (Record<string, unknown> & {
|
|
296
|
+
warnings?: string[];
|
|
297
|
+
}) | null;
|
|
298
|
+
};
|
|
299
|
+
nodes: Array<{
|
|
300
|
+
id: string;
|
|
301
|
+
parentId: string | null;
|
|
302
|
+
initialNodeId?: string;
|
|
303
|
+
data: Record<string, unknown> & {
|
|
304
|
+
key?: string;
|
|
305
|
+
kind?: string;
|
|
306
|
+
type?: string | null;
|
|
307
|
+
initialId?: string | null;
|
|
308
|
+
meta?: Record<string, unknown> | null;
|
|
309
|
+
};
|
|
310
|
+
}>;
|
|
311
|
+
edges: Array<{
|
|
312
|
+
id: string;
|
|
313
|
+
sourceId: string;
|
|
314
|
+
targetId: string | null;
|
|
315
|
+
data: Record<string, unknown> & {
|
|
316
|
+
kind?: string;
|
|
317
|
+
eventType?: string;
|
|
318
|
+
transitionType?: string;
|
|
319
|
+
guard?: {
|
|
320
|
+
type?: string;
|
|
321
|
+
} | null;
|
|
322
|
+
meta?: Record<string, unknown> | null;
|
|
323
|
+
};
|
|
324
|
+
}>;
|
|
325
|
+
[key: string]: unknown;
|
|
326
|
+
};
|
|
327
|
+
type ProfileCompatibilityIssue = {
|
|
328
|
+
level: 'info' | 'warning' | 'error';
|
|
329
|
+
message: string; /** Canonical data paths that remain stored but must not be authored here. */
|
|
330
|
+
readOnlyPaths?: string[];
|
|
331
|
+
nodeIds?: string[];
|
|
332
|
+
edgeIds?: string[];
|
|
333
|
+
};
|
|
334
|
+
/** Additive data written only inside the target profile namespace. */
|
|
335
|
+
type ProfileDataSet = {
|
|
336
|
+
graph?: Record<string, unknown>;
|
|
337
|
+
nodes?: Record<string, Record<string, unknown>>;
|
|
338
|
+
edges?: Record<string, Record<string, unknown>>;
|
|
339
|
+
};
|
|
340
|
+
type ProfileProjectionResult = {
|
|
341
|
+
data?: ProfileDataSet;
|
|
342
|
+
warnings?: string[];
|
|
343
|
+
};
|
|
344
|
+
type ProfileProjectionContext = {
|
|
345
|
+
sourceProfile: ResolvedProfileRef;
|
|
346
|
+
targetProfile: ResolvedProfileRef;
|
|
347
|
+
};
|
|
348
|
+
type ProfileProjection = {
|
|
349
|
+
/** Canonical paths this profile cannot author. `*` matches one path segment. */readOnlyPaths?: readonly string[]; /** Derive additive target-namespaced data without rewriting canonical data. */
|
|
350
|
+
adapt?: (graph: Readonly<ProfileGraph>, context: ProfileProjectionContext) => ProfileProjectionResult; /** Report retained canonical fields this target cannot safely author. */
|
|
351
|
+
analyzeCompatibility?: (graph: ProfileGraph) => ProfileCompatibilityIssue[];
|
|
352
|
+
};
|
|
353
|
+
type ProfileMigration = {
|
|
354
|
+
/** Exact earlier profile version in the same lineage. */from: ResolvedProfileRef; /** Adapt source-namespaced data into target-namespaced data. */
|
|
355
|
+
migrate: (data: Readonly<ProfileDataSet>, context: ProfileProjectionContext) => ProfileProjectionResult;
|
|
356
|
+
};
|
|
357
|
+
type FormatId = string;
|
|
358
|
+
type ProfileCodeLocation = {
|
|
359
|
+
graph: Readonly<ProfileGraph>;
|
|
360
|
+
path: readonly (string | number)[];
|
|
361
|
+
parent: unknown;
|
|
362
|
+
ancestors: readonly unknown[];
|
|
363
|
+
};
|
|
364
|
+
type ProfileCodeTarget = {
|
|
365
|
+
kind: 'entity';
|
|
366
|
+
id: string;
|
|
367
|
+
label: string;
|
|
368
|
+
} | {
|
|
369
|
+
kind: 'source';
|
|
370
|
+
id: string;
|
|
371
|
+
label: string;
|
|
372
|
+
sourceType: string;
|
|
373
|
+
};
|
|
374
|
+
type ProfileCodeBlock = {
|
|
375
|
+
name: string;
|
|
376
|
+
matches: (location: ProfileCodeLocation) => boolean;
|
|
377
|
+
isValid: (code: string) => boolean;
|
|
378
|
+
exportInvalid: (invalidCode: string) => string; /** Editor destination used to surface and navigate code diagnostics. */
|
|
379
|
+
getTarget?: (location: ProfileCodeLocation) => ProfileCodeTarget | undefined; /** Object used by source generation to locate this block in a full document. */
|
|
380
|
+
getSourceValue?: (location: ProfileCodeLocation) => object | undefined;
|
|
381
|
+
};
|
|
382
|
+
type ProfileFormatManifest = {
|
|
383
|
+
format: FormatId;
|
|
384
|
+
import?: boolean;
|
|
385
|
+
export?: boolean;
|
|
386
|
+
sourcePreserving?: boolean;
|
|
387
|
+
warning?: string;
|
|
388
|
+
};
|
|
389
|
+
type ProfileEntityType = {
|
|
390
|
+
kind: string;
|
|
391
|
+
label: string;
|
|
392
|
+
description?: string;
|
|
393
|
+
authorable?: boolean;
|
|
394
|
+
terminal?: boolean;
|
|
395
|
+
canContain?: boolean; /** Logical, unnamespaced profile data stored canonically under the profile namespace. */
|
|
396
|
+
dataSchema?: JSONSchema7;
|
|
397
|
+
children?: {
|
|
398
|
+
types: readonly string[];
|
|
399
|
+
min?: number;
|
|
400
|
+
max?: number;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
type ProfileValidationDefinition = {
|
|
404
|
+
name: string;
|
|
405
|
+
description: string;
|
|
406
|
+
};
|
|
407
|
+
type ProfileAuthoringManifest = {
|
|
408
|
+
terminology: {
|
|
409
|
+
node: string;
|
|
410
|
+
edge: string;
|
|
411
|
+
graph: string;
|
|
412
|
+
};
|
|
413
|
+
nodeTypes: readonly ProfileEntityType[];
|
|
414
|
+
edgeTypes: readonly ProfileEntityType[];
|
|
415
|
+
attachments?: Partial<Record<'actions' | 'guards' | 'invokes' | 'tags', boolean>>;
|
|
416
|
+
supportsInitialNode?: boolean;
|
|
417
|
+
supportsTargetlessEdges?: boolean;
|
|
418
|
+
supportsReenterEdges?: boolean;
|
|
419
|
+
};
|
|
420
|
+
type ProfileManifest = {
|
|
421
|
+
profile: ResolvedProfileRef;
|
|
422
|
+
name: string;
|
|
423
|
+
description?: string; /** Namespace for canonical profile data, for example `@mastra`. */
|
|
424
|
+
namespace?: `@${string}`;
|
|
425
|
+
extends?: ProfileSpecifier; /** Stable semantic family. Migrations may only run within this lineage. */
|
|
426
|
+
lineage?: string;
|
|
427
|
+
projection?: ProfileProjection;
|
|
428
|
+
migrations?: readonly ProfileMigration[]; /** Whether the built-in editor profile picker should offer this profile. */
|
|
429
|
+
selectable?: boolean;
|
|
430
|
+
formats: ProfileFormatManifest[];
|
|
431
|
+
defaultFormat?: FormatId;
|
|
432
|
+
graph?: {
|
|
433
|
+
dataSchema?: JSONSchema7;
|
|
434
|
+
}; /** Profile-owned editor vocabulary. The canvas itself only assumes a graph. */
|
|
435
|
+
authoring?: ProfileAuthoringManifest; /** Profile-owned authored code locations and syntax-safe export fallbacks. */
|
|
436
|
+
code?: {
|
|
437
|
+
blocks: readonly ProfileCodeBlock[];
|
|
438
|
+
};
|
|
439
|
+
operations?: Partial<Record<'simulate' | 'validate' | 'export', boolean>>;
|
|
440
|
+
restrictFormatsToListed?: boolean;
|
|
441
|
+
features?: Record<string, boolean | Record<string, unknown>>;
|
|
442
|
+
implementations?: Partial<Record<'actions' | 'guards' | 'actors' | 'delays', {
|
|
443
|
+
mode: 'allowlist' | 'any';
|
|
444
|
+
items: Record<string, Record<string, unknown>>;
|
|
445
|
+
}>>;
|
|
446
|
+
rules?: Array<Record<string, unknown>>;
|
|
447
|
+
validation?: ProfileValidationDefinition[];
|
|
448
|
+
editorDefaults?: Record<string, unknown>;
|
|
449
|
+
};
|
|
450
|
+
//#endregion
|
|
451
|
+
export { Graph as n, ProfileManifest as r, CodeExpression as t };
|