@typeonce/effect-machine-devtools 0.33.0 → 0.34.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/dist/client/assets/index-s8iI2tep.js +37 -0
- package/dist/client/index.html +1 -1
- package/package.json +2 -2
- package/src/internal/browser/example-machine.ts +24 -15
- package/src/internal/browser/hierarchy-routing-example.ts +27 -24
- package/src/internal/browser/invoke-outcomes-example.ts +107 -83
- package/src/internal/browser/layout-resilience-example.ts +66 -52
- package/src/internal/browser/parallel-completion-example.ts +58 -51
- package/src/internal/browser/parallel-owner-routing-example.ts +32 -11
- package/src/internal/browser/planner-example.ts +20 -13
- package/src/internal/browser/protocol-events-example.ts +80 -50
- package/src/internal/browser/shared-terminal-routing-example.ts +90 -59
- package/src/internal/browser/transition-semantics-example.ts +73 -66
- package/src/internal/browser/visualizer-app.ts +8 -18
- package/src/internal/browser/visualizer-model.ts +10 -95
- package/dist/client/assets/index-2uvShdlX.js +0 -37
package/dist/client/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<meta name="description" content="Interactive statechart visualization for Effect Machine" />
|
|
7
7
|
<title>Effect Machine · Statechart</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-s8iI2tep.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-DkC3PbTy.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typeonce/effect-machine-devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "Local development tools for Effect Machine",
|
|
5
5
|
"author": "Sandro Maglione",
|
|
6
6
|
"repository": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"elkjs": "0.12.0",
|
|
34
34
|
"typescript": "6.0.3",
|
|
35
35
|
"vite": "8.1.5",
|
|
36
|
-
"@typeonce/effect-machine": "^0.
|
|
36
|
+
"@typeonce/effect-machine": "^0.34.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"effect": "4.0.0-rc.112"
|
|
@@ -92,7 +92,14 @@ const initialWorkflow = (): Machine.Machine.CompleteSnapshotContaining<
|
|
|
92
92
|
"application.workflow"
|
|
93
93
|
> => snapshot
|
|
94
94
|
|
|
95
|
+
const targets1 = Machine.targets(States)
|
|
95
96
|
export const machine = Machine.make({
|
|
97
|
+
branches: {
|
|
98
|
+
transition1: {
|
|
99
|
+
destination: { target: targets1.root.application.workflow.running, update: targets1.root.application.workflow }
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
96
103
|
id: "inspection-example",
|
|
97
104
|
root: States,
|
|
98
105
|
events: Machine.eventsFromSchemas(Start, Finish, Disconnect, Refresh),
|
|
@@ -110,19 +117,18 @@ export const machine = Machine.make({
|
|
|
110
117
|
states: {
|
|
111
118
|
idle: {
|
|
112
119
|
on: {
|
|
113
|
-
Start:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
.
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
)
|
|
120
|
+
Start: {
|
|
121
|
+
branches: "transition1",
|
|
122
|
+
resolve: ({ select: { destination: target } }) =>
|
|
123
|
+
target.decoded(
|
|
124
|
+
new Running({}),
|
|
125
|
+
(running) => running.editing.decoded(new Editing({}))
|
|
126
|
+
).update.decoded(new Workflow({ document: "Machine.ts", unsavedChanges: 3 }))
|
|
127
|
+
},
|
|
128
|
+
Refresh: {
|
|
129
|
+
update: targets1.root.application.workflow,
|
|
130
|
+
decoded: () => (new Workflow({ document: "Machine.ts", unsavedChanges: 0 }))
|
|
131
|
+
}
|
|
126
132
|
}
|
|
127
133
|
},
|
|
128
134
|
running: {
|
|
@@ -130,7 +136,10 @@ export const machine = Machine.make({
|
|
|
130
136
|
states: {
|
|
131
137
|
editing: {
|
|
132
138
|
on: {
|
|
133
|
-
Finish:
|
|
139
|
+
Finish: {
|
|
140
|
+
target: targets1.root.application.workflow.running.complete,
|
|
141
|
+
decoded: () => (new Complete({}))
|
|
142
|
+
}
|
|
134
143
|
}
|
|
135
144
|
}
|
|
136
145
|
}
|
|
@@ -141,7 +150,7 @@ export const machine = Machine.make({
|
|
|
141
150
|
states: {
|
|
142
151
|
online: {
|
|
143
152
|
on: {
|
|
144
|
-
Disconnect:
|
|
153
|
+
Disconnect: { target: targets1.root.application.connection.offline, decoded: () => (new Offline({})) }
|
|
145
154
|
}
|
|
146
155
|
}
|
|
147
156
|
}
|
|
@@ -38,7 +38,16 @@ const ReviewEvents = Machine.eventsFromSchemas(
|
|
|
38
38
|
const saveReview: Effect.Effect<string, string> = Effect.succeed("deterministic-chart")
|
|
39
39
|
const publishReview = Effect.succeed("deterministic-chart")
|
|
40
40
|
|
|
41
|
+
const targets1 = Machine.targets(ReviewStates)
|
|
41
42
|
export const hierarchyRoutingMachine = Machine.make({
|
|
43
|
+
branches: {
|
|
44
|
+
transition1: {
|
|
45
|
+
save: { target: targets1.root.Workflow.Saving, title: "Save the review" },
|
|
46
|
+
invalid: { target: targets1.root.Workflow.Review.Failed, title: "Show validation failure" }
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
effects: { source1: Effect.suspend(() => saveReview), source2: Effect.suspend(() => publishReview) },
|
|
50
|
+
|
|
42
51
|
id: "hierarchy-routing",
|
|
43
52
|
root: ReviewStates,
|
|
44
53
|
events: ReviewEvents,
|
|
@@ -56,21 +65,13 @@ export const hierarchyRoutingMachine = Machine.make({
|
|
|
56
65
|
states: {
|
|
57
66
|
Review: {
|
|
58
67
|
on: {
|
|
59
|
-
Submit:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
title: "Save the review",
|
|
63
|
-
target: to.branch.Workflow.Saving()
|
|
64
|
-
},
|
|
65
|
-
invalid: {
|
|
66
|
-
title: "Show validation failure",
|
|
67
|
-
target: to.local.Failed()
|
|
68
|
-
}
|
|
69
|
-
}).resolve(({ event, select }) =>
|
|
68
|
+
Submit: {
|
|
69
|
+
branches: "transition1",
|
|
70
|
+
resolve: ({ event, select }) =>
|
|
70
71
|
event.route === "save"
|
|
71
72
|
? select.save.from()
|
|
72
73
|
: select.invalid.from({ message: "Add a title before continuing." })
|
|
73
|
-
|
|
74
|
+
}
|
|
74
75
|
},
|
|
75
76
|
states: {
|
|
76
77
|
Form: {},
|
|
@@ -78,20 +79,22 @@ export const hierarchyRoutingMachine = Machine.make({
|
|
|
78
79
|
}
|
|
79
80
|
},
|
|
80
81
|
Saving: {
|
|
81
|
-
invoke:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
|
|
82
|
+
invoke: {
|
|
83
|
+
src: "source1",
|
|
84
|
+
id: "save-review",
|
|
85
|
+
onDone: { target: targets1.root.Workflow.Publishing },
|
|
86
|
+
onFailure: {
|
|
87
|
+
target: targets1.root.Workflow.Review.Failed,
|
|
88
|
+
from: () => ({ message: "The review could not be saved." })
|
|
89
|
+
}
|
|
90
|
+
}
|
|
89
91
|
},
|
|
90
92
|
Publishing: {
|
|
91
|
-
invoke:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
)
|
|
93
|
+
invoke: {
|
|
94
|
+
src: "source2",
|
|
95
|
+
id: "publish-review",
|
|
96
|
+
onDone: { target: targets1.root.Workflow.Complete, from: ({ output }) => ({ slug: output }) }
|
|
97
|
+
}
|
|
95
98
|
},
|
|
96
99
|
Complete: {}
|
|
97
100
|
}
|
|
@@ -17,6 +17,7 @@ const ChildStates = Machine.state({
|
|
|
17
17
|
}
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
+
const targets1 = Machine.targets(ChildStates)
|
|
20
21
|
export const invokeGalleryChildMachine = Machine.make({
|
|
21
22
|
id: "invoke-gallery-child",
|
|
22
23
|
root: ChildStates,
|
|
@@ -27,10 +28,10 @@ export const invokeGalleryChildMachine = Machine.make({
|
|
|
27
28
|
states: {
|
|
28
29
|
Working: {
|
|
29
30
|
on: {
|
|
30
|
-
FinishChild:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
FinishChild: {
|
|
32
|
+
target: targets1.root.Done,
|
|
33
|
+
decoded: ({ state }) => (new ChildDone({ result: `${state.task}:complete` }))
|
|
34
|
+
}
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
Done: {
|
|
@@ -110,7 +111,27 @@ const GalleryStates = Machine.state({
|
|
|
110
111
|
}
|
|
111
112
|
})
|
|
112
113
|
|
|
114
|
+
const targets2 = Machine.targets(GalleryStates)
|
|
113
115
|
export const invokeOutcomesMachine = Machine.make({
|
|
116
|
+
branches: {
|
|
117
|
+
transition13: {
|
|
118
|
+
ready: { target: targets2.root.Completed, title: "Worker reports ready" },
|
|
119
|
+
waiting: { none: true, title: "Worker is still starting" }
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
effects: {
|
|
123
|
+
source1: ({ state }: { readonly state: LoadingDocument }) =>
|
|
124
|
+
state.request === "fail" ? Effect.fail("document unavailable") : Effect.succeed("document loaded")
|
|
125
|
+
},
|
|
126
|
+
streams: {
|
|
127
|
+
source2: Stream.suspend(() =>
|
|
128
|
+
Stream.fromIterable([1, 2, 3]).pipe(Stream.concat(Stream.fail("stream disconnected")))
|
|
129
|
+
)
|
|
130
|
+
},
|
|
131
|
+
timers: { source3: "2 seconds" },
|
|
132
|
+
logic: { source4: processLogic },
|
|
133
|
+
children: { source5: InvokedChild },
|
|
134
|
+
|
|
114
135
|
id: "invoke-outcomes",
|
|
115
136
|
root: GalleryStates,
|
|
116
137
|
events: GalleryEvents,
|
|
@@ -126,115 +147,118 @@ export const invokeOutcomesMachine = Machine.make({
|
|
|
126
147
|
Gallery: {
|
|
127
148
|
initialize: ({ builder }) => builder.decoded(new Choose({})),
|
|
128
149
|
on: {
|
|
129
|
-
Reset:
|
|
150
|
+
Reset: { target: targets2.root.Gallery.Choose, decoded: () => (new Choose({})) }
|
|
130
151
|
},
|
|
131
152
|
states: {
|
|
132
153
|
Choose: {
|
|
133
154
|
on: {
|
|
134
|
-
RunEffect:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
RunStream:
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
155
|
+
RunEffect: {
|
|
156
|
+
target: targets2.root.Gallery.LoadingDocument,
|
|
157
|
+
decoded: ({ event }) => (new LoadingDocument({ request: event.request }))
|
|
158
|
+
},
|
|
159
|
+
RunStream: {
|
|
160
|
+
target: targets2.root.Gallery.StreamingUpdates,
|
|
161
|
+
decoded: () => (new StreamingUpdates({ values: [] }))
|
|
162
|
+
},
|
|
163
|
+
RunTimer: {
|
|
164
|
+
target: targets2.root.Gallery.WaitingForTimeout,
|
|
165
|
+
decoded: () => (new WaitingForTimeout({ delay: "2 seconds" }))
|
|
166
|
+
},
|
|
167
|
+
RunProcess: {
|
|
168
|
+
target: targets2.root.Gallery.WatchingProcess,
|
|
169
|
+
decoded: () => (new WatchingProcess({ revision: 1 }))
|
|
170
|
+
},
|
|
171
|
+
RunChild: { target: targets2.root.Gallery.RunningChild, decoded: () => (new RunningChild({})) }
|
|
147
172
|
}
|
|
148
173
|
},
|
|
149
174
|
LoadingDocument: {
|
|
150
|
-
invoke:
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
)
|
|
175
|
+
invoke: {
|
|
176
|
+
src: "source1",
|
|
177
|
+
id: "load-document",
|
|
178
|
+
input: (context) => context,
|
|
179
|
+
onDone: {
|
|
180
|
+
target: targets2.root.Completed,
|
|
181
|
+
decoded: ({ output }) => (new Completed({ source: "effect", result: output }))
|
|
182
|
+
},
|
|
183
|
+
onFailure: {
|
|
184
|
+
target: targets2.root.Failed,
|
|
185
|
+
decoded: ({ error }) => (new Failed({ source: "effect", message: error }))
|
|
186
|
+
}
|
|
187
|
+
}
|
|
164
188
|
},
|
|
165
189
|
StreamingUpdates: {
|
|
166
|
-
invoke:
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
190
|
+
invoke: {
|
|
191
|
+
src: "source2",
|
|
192
|
+
id: "document-updates",
|
|
193
|
+
onElement: {
|
|
194
|
+
none: true,
|
|
195
|
+
resolve: ({ element }, enqueue) => {
|
|
172
196
|
enqueue.raise(GalleryInternalEvents.StreamValue({ value: element }))
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
)
|
|
182
|
-
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
onDone: {
|
|
200
|
+
target: targets2.root.Completed,
|
|
201
|
+
decoded: ({ state }) => (new Completed({ source: "stream", result: state.values.join(", ") }))
|
|
202
|
+
},
|
|
203
|
+
onFailure: {
|
|
204
|
+
target: targets2.root.Failed,
|
|
205
|
+
decoded: ({ error }) => (new Failed({ source: "stream", message: error }))
|
|
206
|
+
}
|
|
207
|
+
},
|
|
183
208
|
on: {
|
|
184
|
-
StreamValue:
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
209
|
+
StreamValue: {
|
|
210
|
+
target: targets2.root.Gallery.StreamingUpdates,
|
|
211
|
+
decoded: ({ event, state }) => (new StreamingUpdates({ values: [...state.values, event.value] }))
|
|
212
|
+
}
|
|
188
213
|
}
|
|
189
214
|
},
|
|
190
215
|
WaitingForTimeout: {
|
|
191
|
-
invoke:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
216
|
+
invoke: {
|
|
217
|
+
src: "source3",
|
|
218
|
+
id: "request-timeout",
|
|
219
|
+
onDone: {
|
|
220
|
+
target: targets2.root.Completed,
|
|
221
|
+
decoded: () => (new Completed({ source: "timer", result: "timeout elapsed" }))
|
|
222
|
+
}
|
|
223
|
+
}
|
|
197
224
|
},
|
|
198
225
|
WatchingProcess: {
|
|
199
|
-
invoke:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
waiting: { title: "Worker is still starting", target: to.none }
|
|
211
|
-
}).resolve(({ select, snapshot }) =>
|
|
226
|
+
invoke: {
|
|
227
|
+
src: "source4",
|
|
228
|
+
id: "status-worker",
|
|
229
|
+
address: Machine.childAddress("status-worker"),
|
|
230
|
+
onFailure: {
|
|
231
|
+
target: targets2.root.Failed,
|
|
232
|
+
decoded: ({ error }) => (new Failed({ source: "process", message: String(error) }))
|
|
233
|
+
},
|
|
234
|
+
onSnapshot: {
|
|
235
|
+
branches: "transition13",
|
|
236
|
+
resolve: ({ select, snapshot }) =>
|
|
212
237
|
snapshot.state === "ready"
|
|
213
238
|
? select.ready.decoded(new Completed({ source: "process", result: "ready" }))
|
|
214
239
|
: select.waiting()
|
|
215
|
-
|
|
216
|
-
|
|
240
|
+
}
|
|
241
|
+
}
|
|
217
242
|
},
|
|
218
243
|
RunningChild: {
|
|
219
|
-
invoke:
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
)
|
|
224
|
-
|
|
244
|
+
invoke: {
|
|
245
|
+
src: "source5",
|
|
246
|
+
onDone: {
|
|
247
|
+
target: targets2.root.Completed,
|
|
248
|
+
decoded: ({ output }) => (new Completed({ source: "child machine", result: output }))
|
|
249
|
+
}
|
|
250
|
+
}
|
|
225
251
|
}
|
|
226
252
|
}
|
|
227
253
|
},
|
|
228
254
|
Completed: {
|
|
229
255
|
on: {
|
|
230
|
-
Reset: (
|
|
231
|
-
to.branch.Gallery.initial.resolve(({ target }) => target.decoded(new Gallery({ selectedDemo: null })))
|
|
256
|
+
Reset: { initial: targets2.root.Gallery, decoded: () => (new Gallery({ selectedDemo: null })) }
|
|
232
257
|
}
|
|
233
258
|
},
|
|
234
259
|
Failed: {
|
|
235
260
|
on: {
|
|
236
|
-
Reset: (
|
|
237
|
-
to.branch.Gallery.initial.resolve(({ target }) => target.decoded(new Gallery({ selectedDemo: null })))
|
|
261
|
+
Reset: { initial: targets2.root.Gallery, decoded: () => (new Gallery({ selectedDemo: null })) }
|
|
238
262
|
}
|
|
239
263
|
}
|
|
240
264
|
}
|
|
@@ -58,7 +58,29 @@ const AuthEvents = Machine.eventsFromSchemas(
|
|
|
58
58
|
})
|
|
59
59
|
)
|
|
60
60
|
|
|
61
|
+
const targets1 = Machine.targets(AuthStates)
|
|
61
62
|
export const layoutResilienceMachine = Machine.make({
|
|
63
|
+
branches: {
|
|
64
|
+
transition4: {
|
|
65
|
+
requestVerification: {
|
|
66
|
+
target: targets1.root.Editing.RequestingVerification,
|
|
67
|
+
title: "Request a verification code"
|
|
68
|
+
},
|
|
69
|
+
login: { target: targets1.root.Editing.SubmittingLogin, title: "Submit password login" },
|
|
70
|
+
invalid: { target: targets1.root.Editing.Form.Failed, title: "Show validation failure" }
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
effects: {
|
|
74
|
+
source1: ({ containingState }: { readonly containingState: { readonly email: string } }) =>
|
|
75
|
+
containingState.email === "fail"
|
|
76
|
+
? Effect.fail("invalid credentials")
|
|
77
|
+
: Effect.succeed("/creator"),
|
|
78
|
+
source2: ({ containingState }: { readonly containingState: { readonly email: string } }) =>
|
|
79
|
+
containingState.email === "fail"
|
|
80
|
+
? Effect.fail("verification unavailable")
|
|
81
|
+
: Effect.succeed(undefined)
|
|
82
|
+
},
|
|
83
|
+
|
|
62
84
|
id: "layout-resilience",
|
|
63
85
|
root: AuthStates,
|
|
64
86
|
events: AuthEvents,
|
|
@@ -79,37 +101,26 @@ export const layoutResilienceMachine = Machine.make({
|
|
|
79
101
|
states: {
|
|
80
102
|
Form: {
|
|
81
103
|
on: {
|
|
82
|
-
EmailChanged:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
LoginMethodChanged:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
PasswordChanged:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Submit:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
title: "Request a verification code",
|
|
98
|
-
target: to.branch.Editing.RequestingVerification()
|
|
99
|
-
},
|
|
100
|
-
login: {
|
|
101
|
-
title: "Submit password login",
|
|
102
|
-
target: to.branch.Editing.SubmittingLogin()
|
|
103
|
-
},
|
|
104
|
-
invalid: {
|
|
105
|
-
title: "Show validation failure",
|
|
106
|
-
target: to.local.Failed()
|
|
107
|
-
}
|
|
108
|
-
}).resolve(({ event, select }) => {
|
|
104
|
+
EmailChanged: {
|
|
105
|
+
update: targets1.root.Editing,
|
|
106
|
+
from: ({ ancestors: { "Editing": current }, event }) => ({ ...current, email: event.value })
|
|
107
|
+
},
|
|
108
|
+
LoginMethodChanged: {
|
|
109
|
+
update: targets1.root.Editing,
|
|
110
|
+
from: ({ ancestors: { "Editing": current }, event }) => ({ ...current, loginMethod: event.value })
|
|
111
|
+
},
|
|
112
|
+
PasswordChanged: {
|
|
113
|
+
update: targets1.root.Editing,
|
|
114
|
+
from: ({ ancestors: { "Editing": current }, event }) => ({ ...current, password: event.value })
|
|
115
|
+
},
|
|
116
|
+
Submit: {
|
|
117
|
+
branches: "transition4",
|
|
118
|
+
resolve: ({ event, select }) => {
|
|
109
119
|
if (event.route === "login") return select.login.from()
|
|
110
120
|
if (event.route === "verification") return select.requestVerification.from()
|
|
111
121
|
return select.invalid.from({ message: "Enter valid authentication details." })
|
|
112
|
-
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
113
124
|
},
|
|
114
125
|
states: {
|
|
115
126
|
Ready: {},
|
|
@@ -117,32 +128,35 @@ export const layoutResilienceMachine = Machine.make({
|
|
|
117
128
|
}
|
|
118
129
|
},
|
|
119
130
|
SubmittingLogin: {
|
|
120
|
-
invoke:
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
131
|
+
invoke: {
|
|
132
|
+
src: "source1",
|
|
133
|
+
id: "submit-login",
|
|
134
|
+
input: (context) => context,
|
|
135
|
+
onDone: { target: targets1.root.Navigating, from: ({ output }) => ({ href: output }) },
|
|
136
|
+
onFailure: {
|
|
137
|
+
target: targets1.root.Editing.Form.Failed,
|
|
138
|
+
from: () => ({ message: "Email or password is incorrect." })
|
|
139
|
+
}
|
|
140
|
+
}
|
|
129
141
|
},
|
|
130
142
|
RequestingVerification: {
|
|
131
|
-
invoke:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
invoke: {
|
|
144
|
+
src: "source2",
|
|
145
|
+
id: "request-verification",
|
|
146
|
+
input: (context) => context,
|
|
147
|
+
onDone: {
|
|
148
|
+
initial: targets1.root.Verification,
|
|
149
|
+
from: ({ containingState }) => ({
|
|
150
|
+
mode: containingState.mode,
|
|
151
|
+
email: containingState.email,
|
|
152
|
+
code: ""
|
|
153
|
+
})
|
|
154
|
+
},
|
|
155
|
+
onFailure: {
|
|
156
|
+
target: targets1.root.Editing.Form.Failed,
|
|
157
|
+
from: () => ({ message: "The verification code could not be sent." })
|
|
158
|
+
}
|
|
159
|
+
}
|
|
146
160
|
}
|
|
147
161
|
}
|
|
148
162
|
},
|