@typeonce/effect-machine-devtools 0.23.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/LICENSE +21 -0
- package/NOTICE +3 -0
- package/README.md +81 -0
- package/dist/DevServer.d.ts +42 -0
- package/dist/DevServer.d.ts.map +1 -0
- package/dist/DevServer.js +28 -0
- package/dist/DevServer.js.map +1 -0
- package/dist/DevToolsProtocol.d.ts +954 -0
- package/dist/DevToolsProtocol.d.ts.map +1 -0
- package/dist/DevToolsProtocol.js +96 -0
- package/dist/DevToolsProtocol.js.map +1 -0
- package/dist/MachineDocument.d.ts +396 -0
- package/dist/MachineDocument.d.ts.map +1 -0
- package/dist/MachineDocument.js +172 -0
- package/dist/MachineDocument.js.map +1 -0
- package/dist/MachineRegistry.d.ts +349 -0
- package/dist/MachineRegistry.d.ts.map +1 -0
- package/dist/MachineRegistry.js +46 -0
- package/dist/MachineRegistry.js.map +1 -0
- package/dist/MachineSimulator.d.ts +169 -0
- package/dist/MachineSimulator.d.ts.map +1 -0
- package/dist/MachineSimulator.js +98 -0
- package/dist/MachineSimulator.js.map +1 -0
- package/dist/ProjectInspector.d.ts +116 -0
- package/dist/ProjectInspector.d.ts.map +1 -0
- package/dist/ProjectInspector.js +82 -0
- package/dist/ProjectInspector.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +23 -0
- package/dist/bin.js.map +1 -0
- package/dist/client/assets/index-BGOhE3Ng.css +1 -0
- package/dist/client/assets/index-DiqGhsGR.js +14 -0
- package/dist/client/index.html +14 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/devServer.d.ts +9 -0
- package/dist/internal/devServer.d.ts.map +1 -0
- package/dist/internal/devServer.js +119 -0
- package/dist/internal/devServer.js.map +1 -0
- package/dist/internal/evaluationWorker.d.ts +3 -0
- package/dist/internal/evaluationWorker.d.ts.map +1 -0
- package/dist/internal/evaluationWorker.js +69 -0
- package/dist/internal/evaluationWorker.js.map +1 -0
- package/dist/internal/evaluationWorkerBootstrap.d.ts +2 -0
- package/dist/internal/evaluationWorkerBootstrap.d.ts.map +1 -0
- package/dist/internal/evaluationWorkerBootstrap.js +21 -0
- package/dist/internal/evaluationWorkerBootstrap.js.map +1 -0
- package/dist/internal/machineDocument.d.ts +4 -0
- package/dist/internal/machineDocument.d.ts.map +1 -0
- package/dist/internal/machineDocument.js +122 -0
- package/dist/internal/machineDocument.js.map +1 -0
- package/dist/internal/machineRegistry.d.ts +12 -0
- package/dist/internal/machineRegistry.d.ts.map +1 -0
- package/dist/internal/machineRegistry.js +97 -0
- package/dist/internal/machineRegistry.js.map +1 -0
- package/dist/internal/machineSimulator.d.ts +5 -0
- package/dist/internal/machineSimulator.d.ts.map +1 -0
- package/dist/internal/machineSimulator.js +156 -0
- package/dist/internal/machineSimulator.js.map +1 -0
- package/dist/internal/projectInspector.d.ts +11 -0
- package/dist/internal/projectInspector.d.ts.map +1 -0
- package/dist/internal/projectInspector.js +150 -0
- package/dist/internal/projectInspector.js.map +1 -0
- package/index.html +13 -0
- package/package.json +69 -0
- package/src/DevServer.ts +45 -0
- package/src/DevToolsProtocol.ts +146 -0
- package/src/MachineDocument.ts +264 -0
- package/src/MachineRegistry.ts +69 -0
- package/src/MachineSimulator.ts +154 -0
- package/src/ProjectInspector.ts +140 -0
- package/src/bin.ts +56 -0
- package/src/index.ts +20 -0
- package/src/internal/browser/example-machine.ts +134 -0
- package/src/internal/browser/machine-index.ts +81 -0
- package/src/internal/browser/main.ts +42 -0
- package/src/internal/browser/styles.css +817 -0
- package/src/internal/browser/text-tree.ts +214 -0
- package/src/internal/browser/visualizer-app.ts +659 -0
- package/src/internal/browser/visualizer-model.ts +173 -0
- package/src/internal/browser/visualizer.ts +31 -0
- package/src/internal/devServer.ts +171 -0
- package/src/internal/evaluationWorker.ts +138 -0
- package/src/internal/evaluationWorkerBootstrap.js +21 -0
- package/src/internal/machineDocument.ts +138 -0
- package/src/internal/machineRegistry.ts +128 -0
- package/src/internal/machineSimulator.ts +199 -0
- package/src/internal/projectInspector.ts +226 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevToolsProtocol.d.ts","sourceRoot":"","sources":["../src/DevToolsProtocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAG,CAAU,CAAA;AAEzC;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;EAInB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;EAMrB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAA;AAO9D;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKhB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,KAAK,CAAC,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKlB,CAAA;AAEF;;;GA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,IAAI,CAAC,OAAO,gBAAgB,CAAC,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Versioned messages exchanged by Effect Machine devtools processes.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.23.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Schema from "effect/Schema";
|
|
7
|
+
import * as MachineDocument from "./MachineDocument.js";
|
|
8
|
+
/**
|
|
9
|
+
* Current devtools protocol version.
|
|
10
|
+
*
|
|
11
|
+
* @category models
|
|
12
|
+
* @since 0.23.0
|
|
13
|
+
*/
|
|
14
|
+
export const protocolVersion = 1;
|
|
15
|
+
/**
|
|
16
|
+
* @category schemas
|
|
17
|
+
* @since 0.23.0
|
|
18
|
+
*/
|
|
19
|
+
export const Location = Schema.Struct({
|
|
20
|
+
file: Schema.String,
|
|
21
|
+
line: Schema.NullOr(Schema.Natural),
|
|
22
|
+
column: Schema.NullOr(Schema.Natural)
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* A recoverable or terminal problem associated with one machine candidate.
|
|
26
|
+
*
|
|
27
|
+
* @category schemas
|
|
28
|
+
* @since 0.23.0
|
|
29
|
+
*/
|
|
30
|
+
export const Diagnostic = Schema.Struct({
|
|
31
|
+
severity: Schema.Literals(["warning", "error"]),
|
|
32
|
+
code: Schema.String,
|
|
33
|
+
message: Schema.String,
|
|
34
|
+
location: Schema.NullOr(Location),
|
|
35
|
+
statePath: Schema.NullOr(Schema.String)
|
|
36
|
+
});
|
|
37
|
+
const ResultFields = {
|
|
38
|
+
protocolVersion: Schema.Literal(protocolVersion),
|
|
39
|
+
key: Schema.String
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A complete machine inspection result.
|
|
43
|
+
*
|
|
44
|
+
* @category schemas
|
|
45
|
+
* @since 0.23.0
|
|
46
|
+
*/
|
|
47
|
+
export const Ready = Schema.Struct({
|
|
48
|
+
...ResultFields,
|
|
49
|
+
_tag: Schema.tag("Ready"),
|
|
50
|
+
document: MachineDocument.MachineDocument,
|
|
51
|
+
diagnostics: Schema.Array(Diagnostic)
|
|
52
|
+
});
|
|
53
|
+
/**
|
|
54
|
+
* A usable document accompanied by diagnostics from an incomplete reload.
|
|
55
|
+
*
|
|
56
|
+
* @category schemas
|
|
57
|
+
* @since 0.23.0
|
|
58
|
+
*/
|
|
59
|
+
export const Partial = Schema.Struct({
|
|
60
|
+
...ResultFields,
|
|
61
|
+
_tag: Schema.tag("Partial"),
|
|
62
|
+
document: MachineDocument.MachineDocument,
|
|
63
|
+
diagnostics: Schema.Array(Diagnostic)
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* A machine candidate that could not produce a document.
|
|
67
|
+
*
|
|
68
|
+
* @category schemas
|
|
69
|
+
* @since 0.23.0
|
|
70
|
+
*/
|
|
71
|
+
export const Failed = Schema.Struct({
|
|
72
|
+
...ResultFields,
|
|
73
|
+
_tag: Schema.tag("Failed"),
|
|
74
|
+
source: MachineDocument.Source,
|
|
75
|
+
machineId: Schema.NullOr(Schema.String),
|
|
76
|
+
diagnostics: Schema.Array(Diagnostic)
|
|
77
|
+
});
|
|
78
|
+
/**
|
|
79
|
+
* Schema for every result returned by discovery and evaluation.
|
|
80
|
+
*
|
|
81
|
+
* @category schemas
|
|
82
|
+
* @since 0.23.0
|
|
83
|
+
*/
|
|
84
|
+
export const MachineResult = Schema.Union([Ready, Partial, Failed]);
|
|
85
|
+
/**
|
|
86
|
+
* A complete live-registry update sent to browser clients.
|
|
87
|
+
*
|
|
88
|
+
* @category schemas
|
|
89
|
+
* @since 0.23.0
|
|
90
|
+
*/
|
|
91
|
+
export const RegistrySnapshot = Schema.Struct({
|
|
92
|
+
protocolVersion: Schema.Literal(protocolVersion),
|
|
93
|
+
revision: Schema.Natural,
|
|
94
|
+
results: Schema.Array(MachineResult)
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=DevToolsProtocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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CAAC;CACtC,CAAC,CAAA;AAQF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,GAAG,YAAY;IACf,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;IAC3B,QAAQ,EAAE,eAAe,CAAC,eAAe;IACzC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;CACtC,CAAC,CAAA;AAQF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAClC,GAAG,YAAY;IACf,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC1B,MAAM,EAAE,eAAe,CAAC,MAAM;IAC9B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;CACtC,CAAC,CAAA;AAQF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AAQnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5C,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;IAChD,QAAQ,EAAE,MAAM,CAAC,OAAO;IACxB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;CACrC,CAAC,CAAA"}
|
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializable inspection documents for Effect Machine devtools.
|
|
3
|
+
*
|
|
4
|
+
* @since 0.23.0
|
|
5
|
+
*/
|
|
6
|
+
import type { Machine } from "@typeonce/effect-machine";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
/**
|
|
9
|
+
* Current machine document schema version.
|
|
10
|
+
*
|
|
11
|
+
* @category models
|
|
12
|
+
* @since 0.23.0
|
|
13
|
+
*/
|
|
14
|
+
export declare const schemaVersion: 1;
|
|
15
|
+
/**
|
|
16
|
+
* Source module and export that produced a machine.
|
|
17
|
+
*
|
|
18
|
+
* @category schemas
|
|
19
|
+
* @since 0.23.0
|
|
20
|
+
*/
|
|
21
|
+
export declare const Source: Schema.Struct<{
|
|
22
|
+
readonly file: Schema.String;
|
|
23
|
+
readonly exportName: Schema.NullOr<Schema.String>;
|
|
24
|
+
}>;
|
|
25
|
+
/**
|
|
26
|
+
* @category models
|
|
27
|
+
* @since 0.23.0
|
|
28
|
+
*/
|
|
29
|
+
export type Source = Schema.Schema.Type<typeof Source>;
|
|
30
|
+
/**
|
|
31
|
+
* Static target selection retained from a transition definition.
|
|
32
|
+
*
|
|
33
|
+
* @category schemas
|
|
34
|
+
* @since 0.23.0
|
|
35
|
+
*/
|
|
36
|
+
export declare const Selection: Schema.Struct<{
|
|
37
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
38
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
39
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* @category models
|
|
43
|
+
* @since 0.23.0
|
|
44
|
+
*/
|
|
45
|
+
export type Selection = Schema.Schema.Type<typeof Selection>;
|
|
46
|
+
/**
|
|
47
|
+
* @category schemas
|
|
48
|
+
* @since 0.23.0
|
|
49
|
+
*/
|
|
50
|
+
export declare const Initial: Schema.Struct<{
|
|
51
|
+
readonly target: Schema.String;
|
|
52
|
+
readonly selection: Schema.Struct<{
|
|
53
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
54
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
55
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
56
|
+
}>;
|
|
57
|
+
}>;
|
|
58
|
+
/**
|
|
59
|
+
* @category models
|
|
60
|
+
* @since 0.23.0
|
|
61
|
+
*/
|
|
62
|
+
export type Initial = Schema.Schema.Type<typeof Initial>;
|
|
63
|
+
/**
|
|
64
|
+
* @category schemas
|
|
65
|
+
* @since 0.23.0
|
|
66
|
+
*/
|
|
67
|
+
export declare const State: Schema.Struct<{
|
|
68
|
+
readonly path: Schema.String;
|
|
69
|
+
readonly key: Schema.String;
|
|
70
|
+
readonly order: Schema.Natural;
|
|
71
|
+
readonly title: Schema.NullOr<Schema.String>;
|
|
72
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
73
|
+
readonly documentation: Schema.NullOr<Schema.String>;
|
|
74
|
+
readonly type: Schema.Literals<readonly ["atomic", "compound", "parallel", "final", "history", "choice"]>;
|
|
75
|
+
readonly history: Schema.NullOr<Schema.Literals<readonly ["shallow", "deep"]>>;
|
|
76
|
+
readonly parent: Schema.NullOr<Schema.String>;
|
|
77
|
+
readonly children: Schema.$Array<Schema.String>;
|
|
78
|
+
readonly initial: Schema.NullOr<Schema.String>;
|
|
79
|
+
readonly transitionIds: Schema.$Array<Schema.String>;
|
|
80
|
+
readonly activityIds: Schema.$Array<Schema.String>;
|
|
81
|
+
}>;
|
|
82
|
+
/**
|
|
83
|
+
* @category models
|
|
84
|
+
* @since 0.23.0
|
|
85
|
+
*/
|
|
86
|
+
export type State = Schema.Schema.Type<typeof State>;
|
|
87
|
+
/**
|
|
88
|
+
* @category schemas
|
|
89
|
+
* @since 0.23.0
|
|
90
|
+
*/
|
|
91
|
+
export declare const Trigger: Schema.Union<readonly [Schema.Struct<{
|
|
92
|
+
readonly type: Schema.tag<"event">;
|
|
93
|
+
readonly event: Schema.String;
|
|
94
|
+
}>, Schema.Struct<{
|
|
95
|
+
readonly type: Schema.tag<"always">;
|
|
96
|
+
}>, Schema.Struct<{
|
|
97
|
+
readonly type: Schema.tag<"done">;
|
|
98
|
+
}>, Schema.Struct<{
|
|
99
|
+
readonly type: Schema.tag<"choice">;
|
|
100
|
+
}>, Schema.Struct<{
|
|
101
|
+
readonly type: Schema.tag<"invoke">;
|
|
102
|
+
readonly id: Schema.String;
|
|
103
|
+
readonly outcome: Schema.Literals<readonly ["element", "done", "failure", "snapshot"]>;
|
|
104
|
+
}>]>;
|
|
105
|
+
/**
|
|
106
|
+
* @category models
|
|
107
|
+
* @since 0.23.0
|
|
108
|
+
*/
|
|
109
|
+
export type Trigger = Schema.Schema.Type<typeof Trigger>;
|
|
110
|
+
/**
|
|
111
|
+
* @category schemas
|
|
112
|
+
* @since 0.23.0
|
|
113
|
+
*/
|
|
114
|
+
export declare const Branch: Schema.Union<readonly [Schema.Struct<{
|
|
115
|
+
readonly type: Schema.tag<"direct">;
|
|
116
|
+
readonly id: Schema.String;
|
|
117
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
118
|
+
readonly selection: Schema.Struct<{
|
|
119
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
120
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
121
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
122
|
+
}>;
|
|
123
|
+
readonly updates: Schema.$Array<Schema.String>;
|
|
124
|
+
}>, Schema.Struct<{
|
|
125
|
+
readonly type: Schema.tag<"branch">;
|
|
126
|
+
readonly key: Schema.String;
|
|
127
|
+
readonly title: Schema.String;
|
|
128
|
+
readonly id: Schema.String;
|
|
129
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
130
|
+
readonly selection: Schema.Struct<{
|
|
131
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
132
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
133
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
134
|
+
}>;
|
|
135
|
+
readonly updates: Schema.$Array<Schema.String>;
|
|
136
|
+
}>]>;
|
|
137
|
+
/**
|
|
138
|
+
* @category models
|
|
139
|
+
* @since 0.23.0
|
|
140
|
+
*/
|
|
141
|
+
export type Branch = Schema.Schema.Type<typeof Branch>;
|
|
142
|
+
/**
|
|
143
|
+
* @category schemas
|
|
144
|
+
* @since 0.23.0
|
|
145
|
+
*/
|
|
146
|
+
export declare const Transition: Schema.Struct<{
|
|
147
|
+
readonly id: Schema.String;
|
|
148
|
+
readonly source: Schema.String;
|
|
149
|
+
readonly trigger: Schema.Union<readonly [Schema.Struct<{
|
|
150
|
+
readonly type: Schema.tag<"event">;
|
|
151
|
+
readonly event: Schema.String;
|
|
152
|
+
}>, Schema.Struct<{
|
|
153
|
+
readonly type: Schema.tag<"always">;
|
|
154
|
+
}>, Schema.Struct<{
|
|
155
|
+
readonly type: Schema.tag<"done">;
|
|
156
|
+
}>, Schema.Struct<{
|
|
157
|
+
readonly type: Schema.tag<"choice">;
|
|
158
|
+
}>, Schema.Struct<{
|
|
159
|
+
readonly type: Schema.tag<"invoke">;
|
|
160
|
+
readonly id: Schema.String;
|
|
161
|
+
readonly outcome: Schema.Literals<readonly ["element", "done", "failure", "snapshot"]>;
|
|
162
|
+
}>]>;
|
|
163
|
+
readonly reenter: Schema.Boolean;
|
|
164
|
+
readonly acceptance: Schema.Literals<readonly ["required", "declinable"]>;
|
|
165
|
+
readonly branches: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
166
|
+
readonly type: Schema.tag<"direct">;
|
|
167
|
+
readonly id: Schema.String;
|
|
168
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
169
|
+
readonly selection: Schema.Struct<{
|
|
170
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
171
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
172
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
173
|
+
}>;
|
|
174
|
+
readonly updates: Schema.$Array<Schema.String>;
|
|
175
|
+
}>, Schema.Struct<{
|
|
176
|
+
readonly type: Schema.tag<"branch">;
|
|
177
|
+
readonly key: Schema.String;
|
|
178
|
+
readonly title: Schema.String;
|
|
179
|
+
readonly id: Schema.String;
|
|
180
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
181
|
+
readonly selection: Schema.Struct<{
|
|
182
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
183
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
184
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
185
|
+
}>;
|
|
186
|
+
readonly updates: Schema.$Array<Schema.String>;
|
|
187
|
+
}>]>>;
|
|
188
|
+
}>;
|
|
189
|
+
/**
|
|
190
|
+
* @category models
|
|
191
|
+
* @since 0.23.0
|
|
192
|
+
*/
|
|
193
|
+
export type Transition = Schema.Schema.Type<typeof Transition>;
|
|
194
|
+
/**
|
|
195
|
+
* @category schemas
|
|
196
|
+
* @since 0.23.0
|
|
197
|
+
*/
|
|
198
|
+
export declare const Activity: Schema.Union<readonly [Schema.Struct<{
|
|
199
|
+
readonly type: Schema.tag<"process">;
|
|
200
|
+
readonly id: Schema.String;
|
|
201
|
+
readonly source: Schema.String;
|
|
202
|
+
readonly lifecycleId: Schema.String;
|
|
203
|
+
}>, Schema.Struct<{
|
|
204
|
+
readonly type: Schema.tag<"effect">;
|
|
205
|
+
readonly outcomes: Schema.Struct<{
|
|
206
|
+
readonly success: Schema.Literal<"dynamic">;
|
|
207
|
+
readonly failure: Schema.Literals<readonly ["dynamic", "none"]>;
|
|
208
|
+
}>;
|
|
209
|
+
readonly id: Schema.String;
|
|
210
|
+
readonly source: Schema.String;
|
|
211
|
+
readonly lifecycleId: Schema.String;
|
|
212
|
+
}>, Schema.Struct<{
|
|
213
|
+
readonly type: Schema.tag<"timer">;
|
|
214
|
+
readonly duration: Schema.String;
|
|
215
|
+
readonly id: Schema.String;
|
|
216
|
+
readonly source: Schema.String;
|
|
217
|
+
readonly lifecycleId: Schema.String;
|
|
218
|
+
}>, Schema.Struct<{
|
|
219
|
+
readonly type: Schema.tag<"stream">;
|
|
220
|
+
readonly id: Schema.String;
|
|
221
|
+
readonly source: Schema.String;
|
|
222
|
+
readonly lifecycleId: Schema.String;
|
|
223
|
+
}>, Schema.Struct<{
|
|
224
|
+
readonly type: Schema.tag<"machine">;
|
|
225
|
+
readonly child: Schema.Struct<{
|
|
226
|
+
readonly id: Schema.String;
|
|
227
|
+
readonly machineId: Schema.NullOr<Schema.String>;
|
|
228
|
+
}>;
|
|
229
|
+
readonly id: Schema.String;
|
|
230
|
+
readonly source: Schema.String;
|
|
231
|
+
readonly lifecycleId: Schema.String;
|
|
232
|
+
}>]>;
|
|
233
|
+
/**
|
|
234
|
+
* @category models
|
|
235
|
+
* @since 0.23.0
|
|
236
|
+
*/
|
|
237
|
+
export type Activity = Schema.Schema.Type<typeof Activity>;
|
|
238
|
+
/**
|
|
239
|
+
* @category schemas
|
|
240
|
+
* @since 0.23.0
|
|
241
|
+
*/
|
|
242
|
+
export declare const Snapshot: Schema.Struct<{
|
|
243
|
+
readonly activePaths: Schema.$Array<Schema.String>;
|
|
244
|
+
readonly candidateEvents: Schema.$Array<Schema.String>;
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* @category models
|
|
248
|
+
* @since 0.23.0
|
|
249
|
+
*/
|
|
250
|
+
export type Snapshot = Schema.Schema.Type<typeof Snapshot>;
|
|
251
|
+
/**
|
|
252
|
+
* Complete, versioned, JSON-safe machine inspection document.
|
|
253
|
+
*
|
|
254
|
+
* @category schemas
|
|
255
|
+
* @since 0.23.0
|
|
256
|
+
*/
|
|
257
|
+
export declare const MachineDocument: Schema.Struct<{
|
|
258
|
+
readonly schemaVersion: Schema.Literal<1>;
|
|
259
|
+
readonly revision: Schema.Natural;
|
|
260
|
+
readonly source: Schema.NullOr<Schema.Struct<{
|
|
261
|
+
readonly file: Schema.String;
|
|
262
|
+
readonly exportName: Schema.NullOr<Schema.String>;
|
|
263
|
+
}>>;
|
|
264
|
+
readonly machineId: Schema.String;
|
|
265
|
+
readonly initial: Schema.Struct<{
|
|
266
|
+
readonly target: Schema.String;
|
|
267
|
+
readonly selection: Schema.Struct<{
|
|
268
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
269
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
270
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
271
|
+
}>;
|
|
272
|
+
}>;
|
|
273
|
+
readonly roots: Schema.$Array<Schema.String>;
|
|
274
|
+
readonly states: Schema.$Array<Schema.Struct<{
|
|
275
|
+
readonly path: Schema.String;
|
|
276
|
+
readonly key: Schema.String;
|
|
277
|
+
readonly order: Schema.Natural;
|
|
278
|
+
readonly title: Schema.NullOr<Schema.String>;
|
|
279
|
+
readonly description: Schema.NullOr<Schema.String>;
|
|
280
|
+
readonly documentation: Schema.NullOr<Schema.String>;
|
|
281
|
+
readonly type: Schema.Literals<readonly ["atomic", "compound", "parallel", "final", "history", "choice"]>;
|
|
282
|
+
readonly history: Schema.NullOr<Schema.Literals<readonly ["shallow", "deep"]>>;
|
|
283
|
+
readonly parent: Schema.NullOr<Schema.String>;
|
|
284
|
+
readonly children: Schema.$Array<Schema.String>;
|
|
285
|
+
readonly initial: Schema.NullOr<Schema.String>;
|
|
286
|
+
readonly transitionIds: Schema.$Array<Schema.String>;
|
|
287
|
+
readonly activityIds: Schema.$Array<Schema.String>;
|
|
288
|
+
}>>;
|
|
289
|
+
readonly transitions: Schema.$Array<Schema.Struct<{
|
|
290
|
+
readonly id: Schema.String;
|
|
291
|
+
readonly source: Schema.String;
|
|
292
|
+
readonly trigger: Schema.Union<readonly [Schema.Struct<{
|
|
293
|
+
readonly type: Schema.tag<"event">;
|
|
294
|
+
readonly event: Schema.String;
|
|
295
|
+
}>, Schema.Struct<{
|
|
296
|
+
readonly type: Schema.tag<"always">;
|
|
297
|
+
}>, Schema.Struct<{
|
|
298
|
+
readonly type: Schema.tag<"done">;
|
|
299
|
+
}>, Schema.Struct<{
|
|
300
|
+
readonly type: Schema.tag<"choice">;
|
|
301
|
+
}>, Schema.Struct<{
|
|
302
|
+
readonly type: Schema.tag<"invoke">;
|
|
303
|
+
readonly id: Schema.String;
|
|
304
|
+
readonly outcome: Schema.Literals<readonly ["element", "done", "failure", "snapshot"]>;
|
|
305
|
+
}>]>;
|
|
306
|
+
readonly reenter: Schema.Boolean;
|
|
307
|
+
readonly acceptance: Schema.Literals<readonly ["required", "declinable"]>;
|
|
308
|
+
readonly branches: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
309
|
+
readonly type: Schema.tag<"direct">;
|
|
310
|
+
readonly id: Schema.String;
|
|
311
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
312
|
+
readonly selection: Schema.Struct<{
|
|
313
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
314
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
315
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
316
|
+
}>;
|
|
317
|
+
readonly updates: Schema.$Array<Schema.String>;
|
|
318
|
+
}>, Schema.Struct<{
|
|
319
|
+
readonly type: Schema.tag<"branch">;
|
|
320
|
+
readonly key: Schema.String;
|
|
321
|
+
readonly title: Schema.String;
|
|
322
|
+
readonly id: Schema.String;
|
|
323
|
+
readonly target: Schema.NullOr<Schema.String>;
|
|
324
|
+
readonly selection: Schema.Struct<{
|
|
325
|
+
readonly path: Schema.NullOr<Schema.String>;
|
|
326
|
+
readonly kind: Schema.Literals<readonly ["state", "initial", "history", "choice", "update", "none"]>;
|
|
327
|
+
readonly scope: Schema.NullOr<Schema.Literals<readonly ["local", "branch", "full", "initial"]>>;
|
|
328
|
+
}>;
|
|
329
|
+
readonly updates: Schema.$Array<Schema.String>;
|
|
330
|
+
}>]>>;
|
|
331
|
+
}>>;
|
|
332
|
+
readonly activities: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
333
|
+
readonly type: Schema.tag<"process">;
|
|
334
|
+
readonly id: Schema.String;
|
|
335
|
+
readonly source: Schema.String;
|
|
336
|
+
readonly lifecycleId: Schema.String;
|
|
337
|
+
}>, Schema.Struct<{
|
|
338
|
+
readonly type: Schema.tag<"effect">;
|
|
339
|
+
readonly outcomes: Schema.Struct<{
|
|
340
|
+
readonly success: Schema.Literal<"dynamic">;
|
|
341
|
+
readonly failure: Schema.Literals<readonly ["dynamic", "none"]>;
|
|
342
|
+
}>;
|
|
343
|
+
readonly id: Schema.String;
|
|
344
|
+
readonly source: Schema.String;
|
|
345
|
+
readonly lifecycleId: Schema.String;
|
|
346
|
+
}>, Schema.Struct<{
|
|
347
|
+
readonly type: Schema.tag<"timer">;
|
|
348
|
+
readonly duration: Schema.String;
|
|
349
|
+
readonly id: Schema.String;
|
|
350
|
+
readonly source: Schema.String;
|
|
351
|
+
readonly lifecycleId: Schema.String;
|
|
352
|
+
}>, Schema.Struct<{
|
|
353
|
+
readonly type: Schema.tag<"stream">;
|
|
354
|
+
readonly id: Schema.String;
|
|
355
|
+
readonly source: Schema.String;
|
|
356
|
+
readonly lifecycleId: Schema.String;
|
|
357
|
+
}>, Schema.Struct<{
|
|
358
|
+
readonly type: Schema.tag<"machine">;
|
|
359
|
+
readonly child: Schema.Struct<{
|
|
360
|
+
readonly id: Schema.String;
|
|
361
|
+
readonly machineId: Schema.NullOr<Schema.String>;
|
|
362
|
+
}>;
|
|
363
|
+
readonly id: Schema.String;
|
|
364
|
+
readonly source: Schema.String;
|
|
365
|
+
readonly lifecycleId: Schema.String;
|
|
366
|
+
}>]>>;
|
|
367
|
+
readonly snapshot: Schema.NullOr<Schema.Struct<{
|
|
368
|
+
readonly activePaths: Schema.$Array<Schema.String>;
|
|
369
|
+
readonly candidateEvents: Schema.$Array<Schema.String>;
|
|
370
|
+
}>>;
|
|
371
|
+
}>;
|
|
372
|
+
/**
|
|
373
|
+
* @category models
|
|
374
|
+
* @since 0.23.0
|
|
375
|
+
*/
|
|
376
|
+
export type MachineDocument = Schema.Schema.Type<typeof MachineDocument>;
|
|
377
|
+
/**
|
|
378
|
+
* Options for capturing a machine document.
|
|
379
|
+
*
|
|
380
|
+
* @category models
|
|
381
|
+
* @since 0.23.0
|
|
382
|
+
*/
|
|
383
|
+
export interface MakeOptions<M extends Machine.Machine.Any> {
|
|
384
|
+
readonly revision?: number | undefined;
|
|
385
|
+
readonly source?: Source | undefined;
|
|
386
|
+
readonly snapshot?: Machine.Machine.Snapshot<Machine.Machine.States<M>> | undefined;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Captures every serializable definition exposed by Effect Machine inspection.
|
|
390
|
+
* It never evaluates transition resolvers or activity sources.
|
|
391
|
+
*
|
|
392
|
+
* @category constructors
|
|
393
|
+
* @since 0.23.0
|
|
394
|
+
*/
|
|
395
|
+
export declare const make: <M extends Machine.Machine.Any>(machine: M, options?: MakeOptions<M>) => MachineDocument;
|
|
396
|
+
//# sourceMappingURL=MachineDocument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MachineDocument.d.ts","sourceRoot":"","sources":["../src/MachineDocument.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AACvD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAG,CAAU,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;EAGjB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,CAAA;AAEtD;;;;;GAKG;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1D;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;EAGnB,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAA;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW1B,CAAA;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,eAAe,CAAC,CAAA;AAExE;;;;;GAKG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,GAAG;IACxD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACpF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,IAAI,EAAE,CAAC,CAAC,SAAS,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,eAC7E,CAAA"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import * as internal from "./internal/machineDocument.js";
|
|
3
|
+
/**
|
|
4
|
+
* Current machine document schema version.
|
|
5
|
+
*
|
|
6
|
+
* @category models
|
|
7
|
+
* @since 0.23.0
|
|
8
|
+
*/
|
|
9
|
+
export const schemaVersion = 1;
|
|
10
|
+
/**
|
|
11
|
+
* Source module and export that produced a machine.
|
|
12
|
+
*
|
|
13
|
+
* @category schemas
|
|
14
|
+
* @since 0.23.0
|
|
15
|
+
*/
|
|
16
|
+
export const Source = Schema.Struct({
|
|
17
|
+
file: Schema.String,
|
|
18
|
+
exportName: Schema.NullOr(Schema.String)
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Static target selection retained from a transition definition.
|
|
22
|
+
*
|
|
23
|
+
* @category schemas
|
|
24
|
+
* @since 0.23.0
|
|
25
|
+
*/
|
|
26
|
+
export const Selection = Schema.Struct({
|
|
27
|
+
path: Schema.NullOr(Schema.String),
|
|
28
|
+
kind: Schema.Literals(["state", "initial", "history", "choice", "update", "none"]),
|
|
29
|
+
scope: Schema.NullOr(Schema.Literals(["local", "branch", "full", "initial"]))
|
|
30
|
+
});
|
|
31
|
+
/**
|
|
32
|
+
* @category schemas
|
|
33
|
+
* @since 0.23.0
|
|
34
|
+
*/
|
|
35
|
+
export const Initial = Schema.Struct({
|
|
36
|
+
target: Schema.String,
|
|
37
|
+
selection: Selection
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* @category schemas
|
|
41
|
+
* @since 0.23.0
|
|
42
|
+
*/
|
|
43
|
+
export const State = Schema.Struct({
|
|
44
|
+
path: Schema.String,
|
|
45
|
+
key: Schema.String,
|
|
46
|
+
order: Schema.Natural,
|
|
47
|
+
title: Schema.NullOr(Schema.String),
|
|
48
|
+
description: Schema.NullOr(Schema.String),
|
|
49
|
+
documentation: Schema.NullOr(Schema.String),
|
|
50
|
+
type: Schema.Literals(["atomic", "compound", "parallel", "final", "history", "choice"]),
|
|
51
|
+
history: Schema.NullOr(Schema.Literals(["shallow", "deep"])),
|
|
52
|
+
parent: Schema.NullOr(Schema.String),
|
|
53
|
+
children: Schema.Array(Schema.String),
|
|
54
|
+
initial: Schema.NullOr(Schema.String),
|
|
55
|
+
transitionIds: Schema.Array(Schema.String),
|
|
56
|
+
activityIds: Schema.Array(Schema.String)
|
|
57
|
+
});
|
|
58
|
+
/**
|
|
59
|
+
* @category schemas
|
|
60
|
+
* @since 0.23.0
|
|
61
|
+
*/
|
|
62
|
+
export const Trigger = Schema.Union([
|
|
63
|
+
Schema.Struct({ type: Schema.tag("event"), event: Schema.String }),
|
|
64
|
+
Schema.Struct({ type: Schema.tag("always") }),
|
|
65
|
+
Schema.Struct({ type: Schema.tag("done") }),
|
|
66
|
+
Schema.Struct({ type: Schema.tag("choice") }),
|
|
67
|
+
Schema.Struct({
|
|
68
|
+
type: Schema.tag("invoke"),
|
|
69
|
+
id: Schema.String,
|
|
70
|
+
outcome: Schema.Literals(["element", "done", "failure", "snapshot"])
|
|
71
|
+
})
|
|
72
|
+
]);
|
|
73
|
+
const BranchFields = {
|
|
74
|
+
id: Schema.String,
|
|
75
|
+
target: Schema.NullOr(Schema.String),
|
|
76
|
+
selection: Selection,
|
|
77
|
+
updates: Schema.Array(Schema.String)
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* @category schemas
|
|
81
|
+
* @since 0.23.0
|
|
82
|
+
*/
|
|
83
|
+
export const Branch = Schema.Union([
|
|
84
|
+
Schema.Struct({ ...BranchFields, type: Schema.tag("direct") }),
|
|
85
|
+
Schema.Struct({
|
|
86
|
+
...BranchFields,
|
|
87
|
+
type: Schema.tag("branch"),
|
|
88
|
+
key: Schema.String,
|
|
89
|
+
title: Schema.String
|
|
90
|
+
})
|
|
91
|
+
]);
|
|
92
|
+
/**
|
|
93
|
+
* @category schemas
|
|
94
|
+
* @since 0.23.0
|
|
95
|
+
*/
|
|
96
|
+
export const Transition = Schema.Struct({
|
|
97
|
+
id: Schema.String,
|
|
98
|
+
source: Schema.String,
|
|
99
|
+
trigger: Trigger,
|
|
100
|
+
reenter: Schema.Boolean,
|
|
101
|
+
acceptance: Schema.Literals(["required", "declinable"]),
|
|
102
|
+
branches: Schema.Array(Branch)
|
|
103
|
+
});
|
|
104
|
+
const ActivityFields = {
|
|
105
|
+
id: Schema.String,
|
|
106
|
+
source: Schema.String,
|
|
107
|
+
lifecycleId: Schema.String
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* @category schemas
|
|
111
|
+
* @since 0.23.0
|
|
112
|
+
*/
|
|
113
|
+
export const Activity = Schema.Union([
|
|
114
|
+
Schema.Struct({ ...ActivityFields, type: Schema.tag("process") }),
|
|
115
|
+
Schema.Struct({
|
|
116
|
+
...ActivityFields,
|
|
117
|
+
type: Schema.tag("effect"),
|
|
118
|
+
outcomes: Schema.Struct({
|
|
119
|
+
success: Schema.Literal("dynamic"),
|
|
120
|
+
failure: Schema.Literals(["dynamic", "none"])
|
|
121
|
+
})
|
|
122
|
+
}),
|
|
123
|
+
Schema.Struct({
|
|
124
|
+
...ActivityFields,
|
|
125
|
+
type: Schema.tag("timer"),
|
|
126
|
+
duration: Schema.String
|
|
127
|
+
}),
|
|
128
|
+
Schema.Struct({ ...ActivityFields, type: Schema.tag("stream") }),
|
|
129
|
+
Schema.Struct({
|
|
130
|
+
...ActivityFields,
|
|
131
|
+
type: Schema.tag("machine"),
|
|
132
|
+
child: Schema.Struct({
|
|
133
|
+
id: Schema.String,
|
|
134
|
+
machineId: Schema.NullOr(Schema.String)
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
]);
|
|
138
|
+
/**
|
|
139
|
+
* @category schemas
|
|
140
|
+
* @since 0.23.0
|
|
141
|
+
*/
|
|
142
|
+
export const Snapshot = Schema.Struct({
|
|
143
|
+
activePaths: Schema.Array(Schema.String),
|
|
144
|
+
candidateEvents: Schema.Array(Schema.String)
|
|
145
|
+
});
|
|
146
|
+
/**
|
|
147
|
+
* Complete, versioned, JSON-safe machine inspection document.
|
|
148
|
+
*
|
|
149
|
+
* @category schemas
|
|
150
|
+
* @since 0.23.0
|
|
151
|
+
*/
|
|
152
|
+
export const MachineDocument = Schema.Struct({
|
|
153
|
+
schemaVersion: Schema.Literal(schemaVersion),
|
|
154
|
+
revision: Schema.Natural,
|
|
155
|
+
source: Schema.NullOr(Source),
|
|
156
|
+
machineId: Schema.String,
|
|
157
|
+
initial: Initial,
|
|
158
|
+
roots: Schema.Array(Schema.String),
|
|
159
|
+
states: Schema.Array(State),
|
|
160
|
+
transitions: Schema.Array(Transition),
|
|
161
|
+
activities: Schema.Array(Activity),
|
|
162
|
+
snapshot: Schema.NullOr(Snapshot)
|
|
163
|
+
});
|
|
164
|
+
/**
|
|
165
|
+
* Captures every serializable definition exposed by Effect Machine inspection.
|
|
166
|
+
* It never evaluates transition resolvers or activity sources.
|
|
167
|
+
*
|
|
168
|
+
* @category constructors
|
|
169
|
+
* @since 0.23.0
|
|
170
|
+
*/
|
|
171
|
+
export const make = internal.make;
|
|
172
|
+
//# sourceMappingURL=MachineDocument.js.map
|