@typeonce/effect-machine-devtools 0.38.0 → 0.39.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 +2 -2
- package/dist/client/assets/{index-De9zZEnz.js → index-azZg5fx9.js} +11 -11
- package/dist/client/index.html +1 -1
- package/package.json +7 -7
- package/src/internal/browser/example-machine.ts +8 -9
- package/src/internal/browser/hierarchy-routing-example.ts +8 -9
- package/src/internal/browser/invoke-outcomes-example.ts +21 -23
- package/src/internal/browser/layout-resilience-example.ts +14 -15
- package/src/internal/browser/parallel-completion-example.ts +16 -17
- package/src/internal/browser/parallel-owner-routing-example.ts +6 -7
- package/src/internal/browser/planner-example.ts +5 -6
- package/src/internal/browser/protocol-events-example.ts +19 -22
- package/src/internal/browser/shared-terminal-routing-example.ts +41 -42
- package/src/internal/browser/transition-semantics-example.ts +21 -22
- package/src/internal/browser/visualizer-model.ts +4 -5
|
@@ -57,11 +57,10 @@ const ChildStates = Machine.state({
|
|
|
57
57
|
Cancelled: { schema: ChildCancelled, type: "final", output: Schema.String }
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
|
-
const targets1 = Machine.targets(ChildStates)
|
|
61
60
|
export const requiredParentChildMachine = Machine.make({
|
|
62
61
|
branches: {
|
|
63
|
-
transition1: { destination: { target:
|
|
64
|
-
transition3: { destination: { target:
|
|
62
|
+
transition1: { destination: { target: "Working" } },
|
|
63
|
+
transition3: { destination: { target: "Working" } }
|
|
65
64
|
},
|
|
66
65
|
effects: {
|
|
67
66
|
source1: ({ parent, state }: {
|
|
@@ -77,7 +76,7 @@ export const requiredParentChildMachine = Machine.make({
|
|
|
77
76
|
parent: Machine.parent(ParentEvents)
|
|
78
77
|
}).handle({
|
|
79
78
|
initial: {
|
|
80
|
-
target:
|
|
79
|
+
target: "Idle",
|
|
81
80
|
decoded: true,
|
|
82
81
|
data: new ChildIdle({})
|
|
83
82
|
},
|
|
@@ -101,7 +100,7 @@ export const requiredParentChildMachine = Machine.make({
|
|
|
101
100
|
input: (context) => context,
|
|
102
101
|
onDone: { none: true },
|
|
103
102
|
onFailure: {
|
|
104
|
-
target:
|
|
103
|
+
target: "Cancelled",
|
|
105
104
|
decoded: true,
|
|
106
105
|
data: ({ error }) => (new ChildCancelled({ reason: String(error) }))
|
|
107
106
|
}
|
|
@@ -115,12 +114,12 @@ export const requiredParentChildMachine = Machine.make({
|
|
|
115
114
|
}
|
|
116
115
|
},
|
|
117
116
|
CommitChildWork: {
|
|
118
|
-
target:
|
|
117
|
+
target: "Done",
|
|
119
118
|
decoded: true,
|
|
120
119
|
data: ({ state }) => (new ChildDone({ result: `${state.job}:complete` }))
|
|
121
120
|
},
|
|
122
121
|
CancelChildWork: {
|
|
123
|
-
target:
|
|
122
|
+
target: "Cancelled",
|
|
124
123
|
decoded: true,
|
|
125
124
|
data: ({ event }) => (new ChildCancelled({ reason: event.reason }))
|
|
126
125
|
}
|
|
@@ -161,11 +160,10 @@ const ParentStates = Machine.state({
|
|
|
161
160
|
Failed: ParentFailed
|
|
162
161
|
}
|
|
163
162
|
})
|
|
164
|
-
const targets2 = Machine.targets(ParentStates)
|
|
165
163
|
export const parentProtocolMachine = Machine.make({
|
|
166
164
|
branches: {
|
|
167
|
-
transition1: { destination: { target:
|
|
168
|
-
transition3: { destination: { target:
|
|
165
|
+
transition1: { destination: { target: "Supervising" } },
|
|
166
|
+
transition3: { destination: { target: "Complete" } }
|
|
169
167
|
},
|
|
170
168
|
children: { source1: ProtocolChild },
|
|
171
169
|
id: "parent-child-protocol",
|
|
@@ -173,7 +171,7 @@ export const parentProtocolMachine = Machine.make({
|
|
|
173
171
|
events: Machine.eventsFromSchemas(LaunchChild, ResetParent, ParentEvents)
|
|
174
172
|
}).handle({
|
|
175
173
|
initial: {
|
|
176
|
-
target:
|
|
174
|
+
target: "Idle",
|
|
177
175
|
decoded: true,
|
|
178
176
|
data: new ParentIdle({})
|
|
179
177
|
},
|
|
@@ -181,7 +179,7 @@ export const parentProtocolMachine = Machine.make({
|
|
|
181
179
|
Idle: {
|
|
182
180
|
on: {
|
|
183
181
|
LaunchChild: {
|
|
184
|
-
target:
|
|
182
|
+
target: "Supervising",
|
|
185
183
|
decoded: true,
|
|
186
184
|
data: () => (new Supervising({ latestProgress: 0 }))
|
|
187
185
|
}
|
|
@@ -191,33 +189,33 @@ export const parentProtocolMachine = Machine.make({
|
|
|
191
189
|
invoke: {
|
|
192
190
|
src: "source1",
|
|
193
191
|
onDone: {
|
|
194
|
-
target:
|
|
192
|
+
target: "Complete",
|
|
195
193
|
decoded: true,
|
|
196
194
|
data: ({ output }) => (new ParentComplete({ result: output }))
|
|
197
195
|
},
|
|
198
196
|
onFailure: {
|
|
199
|
-
target:
|
|
197
|
+
target: "Failed",
|
|
200
198
|
decoded: true,
|
|
201
199
|
data: ({ error }) => (new ParentFailed({ message: String(error) }))
|
|
202
200
|
}
|
|
203
201
|
},
|
|
204
202
|
on: {
|
|
205
203
|
ChildProgress: {
|
|
206
|
-
target:
|
|
204
|
+
target: "Supervising",
|
|
207
205
|
decoded: true,
|
|
208
206
|
data: ({ event }) => (new Supervising({ latestProgress: event.percent }))
|
|
209
207
|
},
|
|
210
208
|
ChildFinished: {
|
|
211
|
-
target:
|
|
209
|
+
target: "Complete",
|
|
212
210
|
decoded: true,
|
|
213
211
|
data: ({ event }) => (new ParentComplete({ result: event.result }))
|
|
214
212
|
},
|
|
215
213
|
ChildProblem: {
|
|
216
|
-
target:
|
|
214
|
+
target: "Failed",
|
|
217
215
|
decoded: true,
|
|
218
216
|
data: ({ event }) => (new ParentFailed({ message: event.message }))
|
|
219
217
|
},
|
|
220
|
-
ResetParent: { target:
|
|
218
|
+
ResetParent: { target: "Idle", decoded: true, data: () => (new ParentIdle({})) }
|
|
221
219
|
}
|
|
222
220
|
},
|
|
223
221
|
Complete: {
|
|
@@ -225,7 +223,7 @@ export const parentProtocolMachine = Machine.make({
|
|
|
225
223
|
},
|
|
226
224
|
Failed: {
|
|
227
225
|
on: {
|
|
228
|
-
ResetParent: { target:
|
|
226
|
+
ResetParent: { target: "Idle", decoded: true, data: () => (new ParentIdle({})) }
|
|
229
227
|
}
|
|
230
228
|
}
|
|
231
229
|
}
|
|
@@ -241,16 +239,15 @@ class PublishOutside extends Schema.TaggedClass<PublishOutside>("OptionalParentP
|
|
|
241
239
|
}) {
|
|
242
240
|
}
|
|
243
241
|
const OptionalParentStates = Machine.state({ states: { Detached, Published } })
|
|
244
|
-
const targets3 = Machine.targets(OptionalParentStates)
|
|
245
242
|
export const optionalParentMachine = Machine.make({
|
|
246
|
-
branches: { transition1: { destination: { target:
|
|
243
|
+
branches: { transition1: { destination: { target: "Published" } } },
|
|
247
244
|
id: "optional-parent-protocol",
|
|
248
245
|
root: OptionalParentStates,
|
|
249
246
|
events: Machine.eventsFromSchemas(PublishOutside),
|
|
250
247
|
parent: Machine.optionalParent(ParentEvents)
|
|
251
248
|
}).handle({
|
|
252
249
|
initial: {
|
|
253
|
-
target:
|
|
250
|
+
target: "Detached",
|
|
254
251
|
decoded: true,
|
|
255
252
|
data: new Detached({})
|
|
256
253
|
},
|
|
@@ -23,7 +23,6 @@ const ReplicationEvents = Machine.eventsFromSchemas(Schema.TaggedUnion({
|
|
|
23
23
|
StopRequested: {}
|
|
24
24
|
}))
|
|
25
25
|
const operation: Effect.Effect<void, string> = Effect.succeed(undefined)
|
|
26
|
-
const targets1 = Machine.targets(ReplicationStates)
|
|
27
26
|
export const sharedTerminalRoutingMachine = Machine.make({
|
|
28
27
|
effects: {
|
|
29
28
|
source1: operation,
|
|
@@ -41,130 +40,130 @@ export const sharedTerminalRoutingMachine = Machine.make({
|
|
|
41
40
|
events: ReplicationEvents
|
|
42
41
|
}).handle({
|
|
43
42
|
initial: {
|
|
44
|
-
target:
|
|
43
|
+
target: "Connecting"
|
|
45
44
|
},
|
|
46
45
|
states: {
|
|
47
46
|
Connecting: {
|
|
48
47
|
invoke: {
|
|
49
48
|
src: "source1",
|
|
50
49
|
id: "connect",
|
|
51
|
-
onDone: { target:
|
|
52
|
-
onFailure: { target:
|
|
50
|
+
onDone: { target: "IdentifyingSource" },
|
|
51
|
+
onFailure: { target: "Failed" }
|
|
53
52
|
},
|
|
54
53
|
on: {
|
|
55
|
-
SessionUnavailable: { target:
|
|
56
|
-
StopRequested: { target:
|
|
54
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
55
|
+
StopRequested: { target: "Stopping" }
|
|
57
56
|
}
|
|
58
57
|
},
|
|
59
58
|
IdentifyingSource: {
|
|
60
59
|
invoke: {
|
|
61
60
|
src: "source2",
|
|
62
61
|
id: "identify-source",
|
|
63
|
-
onDone: { target:
|
|
64
|
-
onFailure: { target:
|
|
62
|
+
onDone: { target: "ReadingServerInfo" },
|
|
63
|
+
onFailure: { target: "Failed" }
|
|
65
64
|
},
|
|
66
65
|
on: {
|
|
67
|
-
SessionUnavailable: { target:
|
|
68
|
-
StopRequested: { target:
|
|
66
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
67
|
+
StopRequested: { target: "Stopping" }
|
|
69
68
|
}
|
|
70
69
|
},
|
|
71
70
|
ReadingServerInfo: {
|
|
72
71
|
invoke: {
|
|
73
72
|
src: "source3",
|
|
74
73
|
id: "read-server-info",
|
|
75
|
-
onDone: { target:
|
|
76
|
-
onFailure: { target:
|
|
74
|
+
onDone: { target: "ReadingSlot" },
|
|
75
|
+
onFailure: { target: "Failed" }
|
|
77
76
|
},
|
|
78
77
|
on: {
|
|
79
|
-
SessionUnavailable: { target:
|
|
80
|
-
StopRequested: { target:
|
|
78
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
79
|
+
StopRequested: { target: "Stopping" }
|
|
81
80
|
}
|
|
82
81
|
},
|
|
83
82
|
ReadingSlot: {
|
|
84
83
|
invoke: {
|
|
85
84
|
src: "source4",
|
|
86
85
|
id: "read-slot",
|
|
87
|
-
onDone: { target:
|
|
88
|
-
onFailure: { target:
|
|
86
|
+
onDone: { target: "CreatingSlot" },
|
|
87
|
+
onFailure: { target: "Failed" }
|
|
89
88
|
},
|
|
90
89
|
on: {
|
|
91
|
-
SessionUnavailable: { target:
|
|
92
|
-
StopRequested: { target:
|
|
90
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
91
|
+
StopRequested: { target: "Stopping" }
|
|
93
92
|
}
|
|
94
93
|
},
|
|
95
94
|
CreatingSlot: {
|
|
96
95
|
invoke: {
|
|
97
96
|
src: "source5",
|
|
98
97
|
id: "create-slot",
|
|
99
|
-
onDone: { target:
|
|
100
|
-
onFailure: { target:
|
|
98
|
+
onDone: { target: "CopyingSnapshot" },
|
|
99
|
+
onFailure: { target: "Failed" }
|
|
101
100
|
},
|
|
102
101
|
on: {
|
|
103
|
-
SessionUnavailable: { target:
|
|
104
|
-
StopRequested: { target:
|
|
102
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
103
|
+
StopRequested: { target: "Stopping" }
|
|
105
104
|
}
|
|
106
105
|
},
|
|
107
106
|
CopyingSnapshot: {
|
|
108
107
|
invoke: {
|
|
109
108
|
src: "source6",
|
|
110
109
|
id: "copy-snapshot",
|
|
111
|
-
onDone: { target:
|
|
112
|
-
onFailure: { target:
|
|
110
|
+
onDone: { target: "CatchingUp" },
|
|
111
|
+
onFailure: { target: "Failed" }
|
|
113
112
|
},
|
|
114
113
|
on: {
|
|
115
|
-
SessionUnavailable: { target:
|
|
116
|
-
StopRequested: { target:
|
|
114
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
115
|
+
StopRequested: { target: "Stopping" }
|
|
117
116
|
}
|
|
118
117
|
},
|
|
119
118
|
CatchingUp: {
|
|
120
119
|
invoke: {
|
|
121
120
|
src: "source7",
|
|
122
121
|
id: "catch-up",
|
|
123
|
-
onDone: { target:
|
|
124
|
-
onFailure: { target:
|
|
122
|
+
onDone: { target: "ApplyingChanges" },
|
|
123
|
+
onFailure: { target: "Failed" }
|
|
125
124
|
},
|
|
126
125
|
on: {
|
|
127
|
-
SessionUnavailable: { target:
|
|
128
|
-
StopRequested: { target:
|
|
126
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
127
|
+
StopRequested: { target: "Stopping" }
|
|
129
128
|
}
|
|
130
129
|
},
|
|
131
130
|
ApplyingChanges: {
|
|
132
131
|
invoke: {
|
|
133
132
|
src: "source8",
|
|
134
133
|
id: "apply-changes",
|
|
135
|
-
onDone: { target:
|
|
136
|
-
onFailure: { target:
|
|
134
|
+
onDone: { target: "Ready" },
|
|
135
|
+
onFailure: { target: "Failed" }
|
|
137
136
|
},
|
|
138
137
|
on: {
|
|
139
|
-
SessionUnavailable: { target:
|
|
140
|
-
StopRequested: { target:
|
|
138
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
139
|
+
StopRequested: { target: "Stopping" }
|
|
141
140
|
}
|
|
142
141
|
},
|
|
143
142
|
Ready: {
|
|
144
143
|
on: {
|
|
145
|
-
SessionUnavailable: { target:
|
|
146
|
-
StopRequested: { target:
|
|
144
|
+
SessionUnavailable: { target: "SessionUnavailable" },
|
|
145
|
+
StopRequested: { target: "Stopping" }
|
|
147
146
|
}
|
|
148
147
|
},
|
|
149
148
|
SessionUnavailable: {
|
|
150
149
|
on: {
|
|
151
|
-
Retry: { target:
|
|
152
|
-
StopRequested: { target:
|
|
150
|
+
Retry: { target: "Connecting" },
|
|
151
|
+
StopRequested: { target: "Stopping" }
|
|
153
152
|
}
|
|
154
153
|
},
|
|
155
154
|
Stopping: {
|
|
156
155
|
invoke: {
|
|
157
156
|
src: "source9",
|
|
158
157
|
id: "stop-session",
|
|
159
|
-
onDone: { target:
|
|
160
|
-
onFailure: { target:
|
|
158
|
+
onDone: { target: "Stopped" },
|
|
159
|
+
onFailure: { target: "Failed" }
|
|
161
160
|
}
|
|
162
161
|
},
|
|
163
162
|
Stopped: {},
|
|
164
163
|
Failed: {
|
|
165
164
|
on: {
|
|
166
|
-
Retry: { target:
|
|
167
|
-
StopRequested: { target:
|
|
165
|
+
Retry: { target: "Connecting" },
|
|
166
|
+
StopRequested: { target: "Stopping" }
|
|
168
167
|
}
|
|
169
168
|
}
|
|
170
169
|
}
|
|
@@ -128,19 +128,18 @@ const defaultWorkspaceSnapshot = () => ({
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
})
|
|
131
|
-
const targets1 = Machine.targets(TransitionStates)
|
|
132
131
|
export const transitionSemanticsMachine = Machine.make({
|
|
133
132
|
branches: {
|
|
134
133
|
transition4: {
|
|
135
|
-
draft: { target:
|
|
136
|
-
review: { target:
|
|
134
|
+
draft: { target: "Workspace.Draft", title: "Preferred route is draft" },
|
|
135
|
+
review: { target: "Workspace.Review", title: "Preferred route is review" }
|
|
137
136
|
},
|
|
138
137
|
transition7: {
|
|
139
|
-
review: { target:
|
|
140
|
-
publish: { target:
|
|
138
|
+
review: { target: "Workspace.Review", title: "Enter the review flow" },
|
|
139
|
+
publish: { target: "Workspace.Finished", title: "Publish without review" }
|
|
141
140
|
},
|
|
142
|
-
transition14: { destination: { history:
|
|
143
|
-
transition15: { destination: { history:
|
|
141
|
+
transition14: { destination: { history: "Workspace.recent" } },
|
|
142
|
+
transition15: { destination: { history: "Workspace.exact" } }
|
|
144
143
|
},
|
|
145
144
|
id: "transition-semantics",
|
|
146
145
|
root: TransitionStates,
|
|
@@ -164,14 +163,14 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
164
163
|
)
|
|
165
164
|
}).handle({
|
|
166
165
|
initial: {
|
|
167
|
-
target:
|
|
166
|
+
target: "Paused",
|
|
168
167
|
decoded: true,
|
|
169
168
|
data: new Paused({ reason: "not started" })
|
|
170
169
|
},
|
|
171
170
|
states: {
|
|
172
171
|
Workspace: {
|
|
173
172
|
initial: {
|
|
174
|
-
target:
|
|
173
|
+
target: "Workspace.Routing"
|
|
175
174
|
},
|
|
176
175
|
history: {
|
|
177
176
|
recent: { default: defaultWorkspaceSnapshot },
|
|
@@ -179,12 +178,12 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
179
178
|
},
|
|
180
179
|
on: {
|
|
181
180
|
Pause: {
|
|
182
|
-
target:
|
|
181
|
+
target: "Paused",
|
|
183
182
|
decoded: true,
|
|
184
183
|
data: ({ event }) => (new Paused({ reason: event.reason }))
|
|
185
184
|
},
|
|
186
185
|
BumpWorkspace: {
|
|
187
|
-
update:
|
|
186
|
+
update: "Workspace",
|
|
188
187
|
decoded: true,
|
|
189
188
|
data: ({ state: current }) => (new Workspace({
|
|
190
189
|
revision: current.revision + 1,
|
|
@@ -193,7 +192,7 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
193
192
|
}
|
|
194
193
|
},
|
|
195
194
|
onDone: {
|
|
196
|
-
target:
|
|
195
|
+
target: "Published",
|
|
197
196
|
decoded: true,
|
|
198
197
|
data: () => (new Published({ result: "workspace published" }))
|
|
199
198
|
},
|
|
@@ -210,11 +209,11 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
210
209
|
Draft: {
|
|
211
210
|
on: {
|
|
212
211
|
Edit: {
|
|
213
|
-
target:
|
|
212
|
+
target: "Workspace.Draft",
|
|
214
213
|
decoded: true,
|
|
215
214
|
data: ({ event, state }) => (new Draft({ text: event.text, autosaves: state.autosaves }))
|
|
216
215
|
},
|
|
217
|
-
Save: { target:
|
|
216
|
+
Save: { target: "Workspace.AutoSaving", decoded: true, data: () => (new AutoSaving({})) },
|
|
218
217
|
Submit: {
|
|
219
218
|
branches: "transition7",
|
|
220
219
|
resolve: ({ event, select }) =>
|
|
@@ -233,19 +232,19 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
233
232
|
},
|
|
234
233
|
AutoSaving: {
|
|
235
234
|
always: {
|
|
236
|
-
target:
|
|
235
|
+
target: "Workspace.Draft",
|
|
237
236
|
decoded: true,
|
|
238
237
|
data: () => (new Draft({ text: "Autosaved draft", autosaves: 1 }))
|
|
239
238
|
}
|
|
240
239
|
},
|
|
241
240
|
Review: {
|
|
242
241
|
initial: {
|
|
243
|
-
target:
|
|
242
|
+
target: "Workspace.Review.Checking",
|
|
244
243
|
decoded: true,
|
|
245
244
|
data: ({}) => new Checking({ checks: ["types", "tests"] })
|
|
246
245
|
},
|
|
247
246
|
onDone: {
|
|
248
|
-
target:
|
|
247
|
+
target: "Workspace.Finished",
|
|
249
248
|
decoded: true,
|
|
250
249
|
data: () => (new WorkspaceFinished({ result: "approved review" }))
|
|
251
250
|
},
|
|
@@ -253,12 +252,12 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
253
252
|
Checking: {
|
|
254
253
|
on: {
|
|
255
254
|
Approve: {
|
|
256
|
-
target:
|
|
255
|
+
target: "Workspace.Review.Approved",
|
|
257
256
|
decoded: true,
|
|
258
257
|
data: ({ event }) => (new Approved({ reviewer: event.reviewer }))
|
|
259
258
|
},
|
|
260
259
|
Reject: {
|
|
261
|
-
target:
|
|
260
|
+
target: "Workspace.Review.ChangesRequested",
|
|
262
261
|
decoded: true,
|
|
263
262
|
data: ({ event }) => (new ChangesRequested({ reason: event.reason }))
|
|
264
263
|
}
|
|
@@ -267,7 +266,7 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
267
266
|
ChangesRequested: {
|
|
268
267
|
on: {
|
|
269
268
|
Revise: {
|
|
270
|
-
target:
|
|
269
|
+
target: "Workspace.Draft",
|
|
271
270
|
decoded: true,
|
|
272
271
|
data: () => (new Draft({ text: "Revised draft", autosaves: 0 }))
|
|
273
272
|
}
|
|
@@ -282,14 +281,14 @@ export const transitionSemanticsMachine = Machine.make({
|
|
|
282
281
|
Paused: {
|
|
283
282
|
on: {
|
|
284
283
|
Create: {
|
|
285
|
-
target:
|
|
284
|
+
target: "Workspace",
|
|
286
285
|
decoded: true,
|
|
287
286
|
data: ({ event }) => (new Workspace({ revision: 0, preferredRoute: event.route }))
|
|
288
287
|
},
|
|
289
288
|
ResumeShallow: { branches: "transition14", resolve: ({ select: { destination: target } }) => target() },
|
|
290
289
|
ResumeDeep: { branches: "transition15", resolve: ({ select: { destination: target } }) => target() },
|
|
291
290
|
Restart: {
|
|
292
|
-
target:
|
|
291
|
+
target: "Workspace",
|
|
293
292
|
decoded: true,
|
|
294
293
|
data: () => (new Workspace({ revision: 0, preferredRoute: "draft" }))
|
|
295
294
|
}
|
|
@@ -72,9 +72,7 @@ export const triggerLabel = (transition: VisualizationTransition): string => {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const pathAccess = (path: string): string => path === "" ? "" : path.split(".").map(propertyAccess).join("")
|
|
75
|
+
const pathName = (path: string): string => JSON.stringify(path === "" ? "root" : path)
|
|
78
76
|
|
|
79
77
|
/** Public declaration represented by a retained transition branch. */
|
|
80
78
|
export const branchTargetApi = (branch: VisualizationBranch): string | undefined => {
|
|
@@ -84,9 +82,10 @@ export const branchTargetApi = (branch: VisualizationBranch): string | undefined
|
|
|
84
82
|
if (path === null) return undefined
|
|
85
83
|
if (selection.scope === "initial") return "initialConfiguration"
|
|
86
84
|
const operation = selection.kind === "state" || selection.kind === "choice" ? "target" : selection.kind
|
|
87
|
-
|
|
85
|
+
if (operation === "target" && path === "") return "{ initialize: … }"
|
|
86
|
+
const fields = [`${operation}: ${pathName(path)}`]
|
|
88
87
|
if (operation !== "update") {
|
|
89
|
-
for (const owner of branch.updates) fields.push(`update:
|
|
88
|
+
for (const owner of branch.updates) fields.push(`update: ${pathName(owner)}`)
|
|
90
89
|
}
|
|
91
90
|
return `{ ${fields.join(", ")} }`
|
|
92
91
|
}
|