@typeonce/effect-machine-devtools 0.34.0 → 0.36.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typeonce/effect-machine-devtools",
3
- "version": "0.34.0",
3
+ "version": "0.36.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.34.0"
36
+ "@typeonce/effect-machine": "^0.36.0"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "effect": "4.0.0-rc.112"
@@ -1,31 +1,41 @@
1
1
  import { Machine } from "@typeonce/effect-machine"
2
2
  import { Schema } from "effect"
3
-
4
3
  // Shared by the live browser UI and its project-inspection fixture.
5
-
6
4
  class Application extends Schema.TaggedClass<Application>("Application")("Application", {
7
5
  workspace: Schema.String,
8
6
  revision: Schema.Number
9
- }) {}
7
+ }) {
8
+ }
10
9
  class Workflow extends Schema.TaggedClass<Workflow>("Workflow")("Workflow", {
11
10
  document: Schema.String,
12
11
  unsavedChanges: Schema.Number
13
- }) {}
14
- class Idle extends Schema.TaggedClass<Idle>("Idle")("Idle", {}) {}
15
- class Running extends Schema.TaggedClass<Running>("Running")("Running", {}) {}
16
- class Editing extends Schema.TaggedClass<Editing>("Editing")("Editing", {}) {}
17
- class Complete extends Schema.TaggedClass<Complete>("Complete")("Complete", {}) {}
18
- class Connection extends Schema.TaggedClass<Connection>("Connection")("Connection", {}) {}
19
- class Online extends Schema.TaggedClass<Online>("Online")("Online", {}) {}
20
- class Offline extends Schema.TaggedClass<Offline>("Offline")("Offline", {}) {}
21
- class Disabled extends Schema.TaggedClass<Disabled>("Disabled")("Disabled", {}) {}
22
- class Start extends Schema.TaggedClass<Start>("Start")("Start", {}) {}
23
- class Finish extends Schema.TaggedClass<Finish>("Finish")("Finish", {}) {}
24
- class Disconnect extends Schema.TaggedClass<Disconnect>("Disconnect")("Disconnect", {}) {}
25
- class Refresh extends Schema.TaggedClass<Refresh>("Refresh")("Refresh", {}) {}
26
-
12
+ }) {
13
+ }
14
+ class Idle extends Schema.TaggedClass<Idle>("Idle")("Idle", {}) {
15
+ }
16
+ class Running extends Schema.TaggedClass<Running>("Running")("Running", {}) {
17
+ }
18
+ class Editing extends Schema.TaggedClass<Editing>("Editing")("Editing", {}) {
19
+ }
20
+ class Complete extends Schema.TaggedClass<Complete>("Complete")("Complete", {}) {
21
+ }
22
+ class Connection extends Schema.TaggedClass<Connection>("Connection")("Connection", {}) {
23
+ }
24
+ class Online extends Schema.TaggedClass<Online>("Online")("Online", {}) {
25
+ }
26
+ class Offline extends Schema.TaggedClass<Offline>("Offline")("Offline", {}) {
27
+ }
28
+ class Disabled extends Schema.TaggedClass<Disabled>("Disabled")("Disabled", {}) {
29
+ }
30
+ class Start extends Schema.TaggedClass<Start>("Start")("Start", {}) {
31
+ }
32
+ class Finish extends Schema.TaggedClass<Finish>("Finish")("Finish", {}) {
33
+ }
34
+ class Disconnect extends Schema.TaggedClass<Disconnect>("Disconnect")("Disconnect", {}) {
35
+ }
36
+ class Refresh extends Schema.TaggedClass<Refresh>("Refresh")("Refresh", {}) {
37
+ }
27
38
  const States = Machine.state({
28
- initial: "application",
29
39
  states: {
30
40
  application: {
31
41
  schema: Application,
@@ -33,12 +43,10 @@ const States = Machine.state({
33
43
  states: {
34
44
  workflow: {
35
45
  schema: Workflow,
36
- initial: "idle",
37
46
  states: {
38
47
  idle: Idle,
39
48
  running: {
40
49
  schema: Running,
41
- initial: "editing",
42
50
  states: {
43
51
  editing: Editing,
44
52
  complete: {
@@ -54,7 +62,6 @@ const States = Machine.state({
54
62
  },
55
63
  connection: {
56
64
  schema: Connection,
57
- initial: "online",
58
65
  states: {
59
66
  online: Online,
60
67
  offline: Offline
@@ -65,7 +72,6 @@ const States = Machine.state({
65
72
  disabled: Disabled
66
73
  }
67
74
  })
68
-
69
75
  export const snapshot = {
70
76
  path: "" as const,
71
77
  value: undefined,
@@ -86,12 +92,9 @@ export const snapshot = {
86
92
  }
87
93
  }
88
94
  }
89
-
90
- const initialWorkflow = (): Machine.Machine.CompleteSnapshotContaining<
91
- { readonly "": typeof States.node },
92
- "application.workflow"
93
- > => snapshot
94
-
95
+ const initialWorkflow = (): Machine.Machine.CompleteSnapshotContaining<{
96
+ readonly "": typeof States.node
97
+ }, "application.workflow"> => snapshot
95
98
  const targets1 = Machine.targets(States)
96
99
  export const machine = Machine.make({
97
100
  branches: {
@@ -99,16 +102,34 @@ export const machine = Machine.make({
99
102
  destination: { target: targets1.root.application.workflow.running, update: targets1.root.application.workflow }
100
103
  }
101
104
  },
102
-
103
105
  id: "inspection-example",
104
106
  root: States,
105
- events: Machine.eventsFromSchemas(Start, Finish, Disconnect, Refresh),
106
- initialConfiguration: (to) => to.resolve(() => snapshot)
107
+ events: Machine.eventsFromSchemas(Start, Finish, Disconnect, Refresh)
107
108
  }).handle({
109
+ initial: {
110
+ target: Machine.targets(States).root.application,
111
+ decoded: true,
112
+ data: new Application({ workspace: "effect-machine", revision: 7 })
113
+ },
108
114
  states: {
109
115
  application: {
116
+ initial: {
117
+ workflow: {
118
+ decoded: true,
119
+ data: new Workflow({ document: "Machine.ts", unsavedChanges: 2 })
120
+ },
121
+ connection: {
122
+ decoded: true,
123
+ data: new Connection({})
124
+ }
125
+ },
110
126
  states: {
111
127
  workflow: {
128
+ initial: {
129
+ target: Machine.targets(States).root.application.workflow.idle,
130
+ decoded: true,
131
+ data: new Idle({})
132
+ },
112
133
  history: {
113
134
  recent: {
114
135
  default: initialWorkflow
@@ -120,42 +141,62 @@ export const machine = Machine.make({
120
141
  Start: {
121
142
  branches: "transition1",
122
143
  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 }))
144
+ target({
145
+ data: new Running({}),
146
+ decoded: true,
147
+ states: { editing: { data: new Editing({}), decoded: true } },
148
+ update: { data: new Workflow({ document: "Machine.ts", unsavedChanges: 3 }), decoded: true }
149
+ })
127
150
  },
128
151
  Refresh: {
129
152
  update: targets1.root.application.workflow,
130
- decoded: () => (new Workflow({ document: "Machine.ts", unsavedChanges: 0 }))
153
+ decoded: true,
154
+ data: () => (new Workflow({ document: "Machine.ts", unsavedChanges: 0 }))
131
155
  }
132
156
  }
133
157
  },
134
158
  running: {
135
- initialize: ({ builder }) => builder.decoded(new Editing({})),
159
+ initial: {
160
+ target: Machine.targets(States).root.application.workflow.running.editing,
161
+ decoded: true,
162
+ data: ({}) => new Editing({})
163
+ },
136
164
  states: {
137
165
  editing: {
138
166
  on: {
139
167
  Finish: {
140
168
  target: targets1.root.application.workflow.running.complete,
141
- decoded: () => (new Complete({}))
169
+ decoded: true,
170
+ data: () => (new Complete({}))
142
171
  }
143
172
  }
144
- }
173
+ },
174
+ complete: {}
145
175
  }
146
176
  }
147
177
  }
148
178
  },
149
179
  connection: {
180
+ initial: {
181
+ target: Machine.targets(States).root.application.connection.online,
182
+ decoded: true,
183
+ data: new Online({})
184
+ },
150
185
  states: {
151
186
  online: {
152
187
  on: {
153
- Disconnect: { target: targets1.root.application.connection.offline, decoded: () => (new Offline({})) }
188
+ Disconnect: {
189
+ target: targets1.root.application.connection.offline,
190
+ decoded: true,
191
+ data: () => (new Offline({}))
192
+ }
154
193
  }
155
- }
194
+ },
195
+ offline: {}
156
196
  }
157
197
  }
158
198
  }
159
- }
199
+ },
200
+ disabled: {}
160
201
  }
161
202
  })
@@ -1,21 +1,16 @@
1
1
  import { Machine } from "@typeonce/effect-machine"
2
2
  import { Effect, Schema } from "effect"
3
-
4
3
  const ReviewState = Schema.TaggedUnion({
5
4
  Review: { title: Schema.String },
6
5
  ReviewFailed: { message: Schema.String },
7
6
  Complete: { slug: Schema.String }
8
7
  })
9
-
10
8
  const ReviewStates = Machine.state({
11
- initial: "Workflow",
12
9
  states: {
13
10
  Workflow: {
14
- initial: "Review",
15
11
  states: {
16
12
  Review: {
17
13
  schema: ReviewState.cases.Review,
18
- initial: "Form",
19
14
  states: {
20
15
  Form: {},
21
16
  Failed: ReviewState.cases.ReviewFailed
@@ -28,16 +23,11 @@ const ReviewStates = Machine.state({
28
23
  }
29
24
  }
30
25
  })
31
-
32
- const ReviewEvents = Machine.eventsFromSchemas(
33
- Schema.TaggedUnion({
34
- Submit: { route: Schema.Literals(["save", "invalid"]) }
35
- })
36
- )
37
-
26
+ const ReviewEvents = Machine.eventsFromSchemas(Schema.TaggedUnion({
27
+ Submit: { route: Schema.Literals(["save", "invalid"]) }
28
+ }))
38
29
  const saveReview: Effect.Effect<string, string> = Effect.succeed("deterministic-chart")
39
30
  const publishReview = Effect.succeed("deterministic-chart")
40
-
41
31
  const targets1 = Machine.targets(ReviewStates)
42
32
  export const hierarchyRoutingMachine = Machine.make({
43
33
  branches: {
@@ -47,30 +37,31 @@ export const hierarchyRoutingMachine = Machine.make({
47
37
  }
48
38
  },
49
39
  effects: { source1: Effect.suspend(() => saveReview), source2: Effect.suspend(() => publishReview) },
50
-
51
40
  id: "hierarchy-routing",
52
41
  root: ReviewStates,
53
- events: ReviewEvents,
54
- initialConfiguration: (root) =>
55
- root.resolve(({ target }) =>
56
- target.from((to) =>
57
- to.Workflow.from((workflow) =>
58
- workflow.Review.from({ title: "A deterministic chart" }, (review) => review.Form.from())
59
- )
60
- )
61
- )
42
+ events: ReviewEvents
62
43
  }).handle({
44
+ initial: {
45
+ target: Machine.targets(ReviewStates).root.Workflow
46
+ },
63
47
  states: {
64
48
  Workflow: {
49
+ initial: {
50
+ target: Machine.targets(ReviewStates).root.Workflow.Review,
51
+ data: { title: "A deterministic chart" }
52
+ },
65
53
  states: {
66
54
  Review: {
55
+ initial: {
56
+ target: Machine.targets(ReviewStates).root.Workflow.Review.Form
57
+ },
67
58
  on: {
68
59
  Submit: {
69
60
  branches: "transition1",
70
61
  resolve: ({ event, select }) =>
71
62
  event.route === "save"
72
- ? select.save.from()
73
- : select.invalid.from({ message: "Add a title before continuing." })
63
+ ? select.save({})
64
+ : select.invalid({ data: { message: "Add a title before continuing." } })
74
65
  }
75
66
  },
76
67
  states: {
@@ -85,7 +76,7 @@ export const hierarchyRoutingMachine = Machine.make({
85
76
  onDone: { target: targets1.root.Workflow.Publishing },
86
77
  onFailure: {
87
78
  target: targets1.root.Workflow.Review.Failed,
88
- from: () => ({ message: "The review could not be saved." })
79
+ data: () => ({ message: "The review could not be saved." })
89
80
  }
90
81
  }
91
82
  },
@@ -93,7 +84,7 @@ export const hierarchyRoutingMachine = Machine.make({
93
84
  invoke: {
94
85
  src: "source2",
95
86
  id: "publish-review",
96
- onDone: { target: targets1.root.Workflow.Complete, from: ({ output }) => ({ slug: output }) }
87
+ onDone: { target: targets1.root.Workflow.Complete, data: ({ output }) => ({ slug: output }) }
97
88
  }
98
89
  },
99
90
  Complete: {}
@@ -1,36 +1,39 @@
1
1
  import { Machine } from "@typeonce/effect-machine"
2
2
  import { Effect, Schema, Stream } from "effect"
3
-
4
3
  class ChildWorking extends Schema.TaggedClass<ChildWorking>("InvokeGalleryChildWorking")("Working", {
5
4
  task: Schema.String
6
- }) {}
5
+ }) {
6
+ }
7
7
  class ChildDone extends Schema.TaggedClass<ChildDone>("InvokeGalleryChildDone")("Done", {
8
8
  result: Schema.String
9
- }) {}
10
- class FinishChild extends Schema.TaggedClass<FinishChild>("InvokeGalleryFinishChild")("FinishChild", {}) {}
11
-
9
+ }) {
10
+ }
11
+ class FinishChild extends Schema.TaggedClass<FinishChild>("InvokeGalleryFinishChild")("FinishChild", {}) {
12
+ }
12
13
  const ChildStates = Machine.state({
13
- initial: "Working",
14
14
  states: {
15
15
  Working: ChildWorking,
16
16
  Done: { schema: ChildDone, type: "final", output: Schema.String }
17
17
  }
18
18
  })
19
-
20
19
  const targets1 = Machine.targets(ChildStates)
21
20
  export const invokeGalleryChildMachine = Machine.make({
22
21
  id: "invoke-gallery-child",
23
22
  root: ChildStates,
24
- events: Machine.eventsFromSchemas(FinishChild),
25
- initialConfiguration: (root) =>
26
- root.resolve(({ target }) => target.from((to) => to.Working.decoded(new ChildWorking({ task: "render-preview" }))))
23
+ events: Machine.eventsFromSchemas(FinishChild)
27
24
  }).handle({
25
+ initial: {
26
+ target: Machine.targets(ChildStates).root.Working,
27
+ decoded: true,
28
+ data: new ChildWorking({ task: "render-preview" })
29
+ },
28
30
  states: {
29
31
  Working: {
30
32
  on: {
31
33
  FinishChild: {
32
34
  target: targets1.root.Done,
33
- decoded: ({ state }) => (new ChildDone({ result: `${state.task}:complete` }))
35
+ decoded: true,
36
+ data: ({ state }) => (new ChildDone({ result: `${state.task}:complete` }))
34
37
  }
35
38
  }
36
39
  },
@@ -39,64 +42,73 @@ export const invokeGalleryChildMachine = Machine.make({
39
42
  }
40
43
  }
41
44
  })
42
-
43
45
  const InvokedChild = Machine.child("preview-worker", invokeGalleryChildMachine)
44
-
45
46
  class Gallery extends Schema.TaggedClass<Gallery>("InvokeGallery")("Gallery", {
46
47
  selectedDemo: Schema.NullOr(Schema.String)
47
- }) {}
48
- class Choose extends Schema.TaggedClass<Choose>("InvokeGalleryChoose")("Choose", {}) {}
49
- class LoadingDocument extends Schema.TaggedClass<LoadingDocument>("InvokeGalleryLoadingDocument")(
50
- "LoadingDocument",
51
- { request: Schema.String }
52
- ) {}
53
- class StreamingUpdates extends Schema.TaggedClass<StreamingUpdates>("InvokeGalleryStreamingUpdates")(
54
- "StreamingUpdates",
55
- { values: Schema.Array(Schema.Number) }
56
- ) {}
57
- class WaitingForTimeout extends Schema.TaggedClass<WaitingForTimeout>("InvokeGalleryWaitingForTimeout")(
58
- "WaitingForTimeout",
59
- { delay: Schema.Literal("2 seconds") }
60
- ) {}
61
- class WatchingProcess extends Schema.TaggedClass<WatchingProcess>("InvokeGalleryWatchingProcess")(
62
- "WatchingProcess",
63
- { revision: Schema.Number }
64
- ) {}
65
- class RunningChild extends Schema.TaggedClass<RunningChild>("InvokeGalleryRunningChild")("RunningChild", {}) {}
48
+ }) {
49
+ }
50
+ class Choose extends Schema.TaggedClass<Choose>("InvokeGalleryChoose")("Choose", {}) {
51
+ }
52
+ class LoadingDocument extends Schema.TaggedClass<LoadingDocument>("InvokeGalleryLoadingDocument")("LoadingDocument", {
53
+ request: Schema.String
54
+ }) {
55
+ }
56
+ class StreamingUpdates
57
+ extends Schema.TaggedClass<StreamingUpdates>("InvokeGalleryStreamingUpdates")("StreamingUpdates", {
58
+ values: Schema.Array(Schema.Number)
59
+ })
60
+ {
61
+ }
62
+ class WaitingForTimeout
63
+ extends Schema.TaggedClass<WaitingForTimeout>("InvokeGalleryWaitingForTimeout")("WaitingForTimeout", {
64
+ delay: Schema.Literal("2 seconds")
65
+ })
66
+ {
67
+ }
68
+ class WatchingProcess extends Schema.TaggedClass<WatchingProcess>("InvokeGalleryWatchingProcess")("WatchingProcess", {
69
+ revision: Schema.Number
70
+ }) {
71
+ }
72
+ class RunningChild extends Schema.TaggedClass<RunningChild>("InvokeGalleryRunningChild")("RunningChild", {}) {
73
+ }
66
74
  class Completed extends Schema.TaggedClass<Completed>("InvokeGalleryCompleted")("Completed", {
67
75
  source: Schema.String,
68
76
  result: Schema.String
69
- }) {}
77
+ }) {
78
+ }
70
79
  class Failed extends Schema.TaggedClass<Failed>("InvokeGalleryFailed")("Failed", {
71
80
  source: Schema.String,
72
81
  message: Schema.String
73
- }) {}
74
-
82
+ }) {
83
+ }
75
84
  class RunEffect extends Schema.TaggedClass<RunEffect>("InvokeGalleryRunEffect")("RunEffect", {
76
85
  request: Schema.String
77
- }) {}
78
- class RunStream extends Schema.TaggedClass<RunStream>("InvokeGalleryRunStream")("RunStream", {}) {}
79
- class RunTimer extends Schema.TaggedClass<RunTimer>("InvokeGalleryRunTimer")("RunTimer", {}) {}
80
- class RunProcess extends Schema.TaggedClass<RunProcess>("InvokeGalleryRunProcess")("RunProcess", {}) {}
81
- class RunChild extends Schema.TaggedClass<RunChild>("InvokeGalleryRunChild")("RunChild", {}) {}
82
- class Reset extends Schema.TaggedClass<Reset>("InvokeGalleryReset")("Reset", {}) {}
86
+ }) {
87
+ }
88
+ class RunStream extends Schema.TaggedClass<RunStream>("InvokeGalleryRunStream")("RunStream", {}) {
89
+ }
90
+ class RunTimer extends Schema.TaggedClass<RunTimer>("InvokeGalleryRunTimer")("RunTimer", {}) {
91
+ }
92
+ class RunProcess extends Schema.TaggedClass<RunProcess>("InvokeGalleryRunProcess")("RunProcess", {}) {
93
+ }
94
+ class RunChild extends Schema.TaggedClass<RunChild>("InvokeGalleryRunChild")("RunChild", {}) {
95
+ }
96
+ class Reset extends Schema.TaggedClass<Reset>("InvokeGalleryReset")("Reset", {}) {
97
+ }
83
98
  class StreamValue extends Schema.TaggedClass<StreamValue>("InvokeGalleryStreamValue")("StreamValue", {
84
99
  value: Schema.Number
85
- }) {}
86
-
100
+ }) {
101
+ }
87
102
  const GalleryEvents = Machine.eventsFromSchemas(RunEffect, RunStream, RunTimer, RunProcess, RunChild, Reset)
88
103
  const GalleryInternalEvents = Machine.internalEventsFromSchemas(StreamValue)
89
104
  const processLogic = Machine.logic({
90
105
  initial: "starting" as "starting" | "ready",
91
106
  run: () => Effect.fail("process stopped")
92
107
  })
93
-
94
108
  const GalleryStates = Machine.state({
95
- initial: "Gallery",
96
109
  states: {
97
110
  Gallery: {
98
111
  schema: Gallery,
99
- initial: "Choose",
100
112
  states: {
101
113
  Choose,
102
114
  LoadingDocument,
@@ -110,7 +122,6 @@ const GalleryStates = Machine.state({
110
122
  Failed
111
123
  }
112
124
  })
113
-
114
125
  const targets2 = Machine.targets(GalleryStates)
115
126
  export const invokeOutcomesMachine = Machine.make({
116
127
  branches: {
@@ -120,8 +131,9 @@ export const invokeOutcomesMachine = Machine.make({
120
131
  }
121
132
  },
122
133
  effects: {
123
- source1: ({ state }: { readonly state: LoadingDocument }) =>
124
- state.request === "fail" ? Effect.fail("document unavailable") : Effect.succeed("document loaded")
134
+ source1: ({ state }: {
135
+ readonly state: LoadingDocument
136
+ }) => state.request === "fail" ? Effect.fail("document unavailable") : Effect.succeed("document loaded")
125
137
  },
126
138
  streams: {
127
139
  source2: Stream.suspend(() =>
@@ -131,44 +143,50 @@ export const invokeOutcomesMachine = Machine.make({
131
143
  timers: { source3: "2 seconds" },
132
144
  logic: { source4: processLogic },
133
145
  children: { source5: InvokedChild },
134
-
135
146
  id: "invoke-outcomes",
136
147
  root: GalleryStates,
137
148
  events: GalleryEvents,
138
- internalEvents: GalleryInternalEvents,
139
- initialConfiguration: (root) =>
140
- root.resolve(({ target }) =>
141
- target.from((to) =>
142
- to.Gallery.decoded(new Gallery({ selectedDemo: null }), (gallery) => gallery.Choose.decoded(new Choose({})))
143
- )
144
- )
149
+ internalEvents: GalleryInternalEvents
145
150
  }).handle({
151
+ initial: {
152
+ target: Machine.targets(GalleryStates).root.Gallery,
153
+ decoded: true,
154
+ data: new Gallery({ selectedDemo: null })
155
+ },
146
156
  states: {
147
157
  Gallery: {
148
- initialize: ({ builder }) => builder.decoded(new Choose({})),
158
+ initial: {
159
+ target: Machine.targets(GalleryStates).root.Gallery.Choose,
160
+ decoded: true,
161
+ data: ({}) => new Choose({})
162
+ },
149
163
  on: {
150
- Reset: { target: targets2.root.Gallery.Choose, decoded: () => (new Choose({})) }
164
+ Reset: { target: targets2.root.Gallery.Choose, decoded: true, data: () => (new Choose({})) }
151
165
  },
152
166
  states: {
153
167
  Choose: {
154
168
  on: {
155
169
  RunEffect: {
156
170
  target: targets2.root.Gallery.LoadingDocument,
157
- decoded: ({ event }) => (new LoadingDocument({ request: event.request }))
171
+ decoded: true,
172
+ data: ({ event }) => (new LoadingDocument({ request: event.request }))
158
173
  },
159
174
  RunStream: {
160
175
  target: targets2.root.Gallery.StreamingUpdates,
161
- decoded: () => (new StreamingUpdates({ values: [] }))
176
+ decoded: true,
177
+ data: () => (new StreamingUpdates({ values: [] }))
162
178
  },
163
179
  RunTimer: {
164
180
  target: targets2.root.Gallery.WaitingForTimeout,
165
- decoded: () => (new WaitingForTimeout({ delay: "2 seconds" }))
181
+ decoded: true,
182
+ data: () => (new WaitingForTimeout({ delay: "2 seconds" }))
166
183
  },
167
184
  RunProcess: {
168
185
  target: targets2.root.Gallery.WatchingProcess,
169
- decoded: () => (new WatchingProcess({ revision: 1 }))
186
+ decoded: true,
187
+ data: () => (new WatchingProcess({ revision: 1 }))
170
188
  },
171
- RunChild: { target: targets2.root.Gallery.RunningChild, decoded: () => (new RunningChild({})) }
189
+ RunChild: { target: targets2.root.Gallery.RunningChild, decoded: true, data: () => (new RunningChild({})) }
172
190
  }
173
191
  },
174
192
  LoadingDocument: {
@@ -178,11 +196,13 @@ export const invokeOutcomesMachine = Machine.make({
178
196
  input: (context) => context,
179
197
  onDone: {
180
198
  target: targets2.root.Completed,
181
- decoded: ({ output }) => (new Completed({ source: "effect", result: output }))
199
+ decoded: true,
200
+ data: ({ output }) => (new Completed({ source: "effect", result: output }))
182
201
  },
183
202
  onFailure: {
184
203
  target: targets2.root.Failed,
185
- decoded: ({ error }) => (new Failed({ source: "effect", message: error }))
204
+ decoded: true,
205
+ data: ({ error }) => (new Failed({ source: "effect", message: error }))
186
206
  }
187
207
  }
188
208
  },
@@ -198,17 +218,20 @@ export const invokeOutcomesMachine = Machine.make({
198
218
  },
199
219
  onDone: {
200
220
  target: targets2.root.Completed,
201
- decoded: ({ state }) => (new Completed({ source: "stream", result: state.values.join(", ") }))
221
+ decoded: true,
222
+ data: ({ state }) => (new Completed({ source: "stream", result: state.values.join(", ") }))
202
223
  },
203
224
  onFailure: {
204
225
  target: targets2.root.Failed,
205
- decoded: ({ error }) => (new Failed({ source: "stream", message: error }))
226
+ decoded: true,
227
+ data: ({ error }) => (new Failed({ source: "stream", message: error }))
206
228
  }
207
229
  },
208
230
  on: {
209
231
  StreamValue: {
210
232
  target: targets2.root.Gallery.StreamingUpdates,
211
- decoded: ({ event, state }) => (new StreamingUpdates({ values: [...state.values, event.value] }))
233
+ decoded: true,
234
+ data: ({ event, state }) => (new StreamingUpdates({ values: [...state.values, event.value] }))
212
235
  }
213
236
  }
214
237
  },
@@ -218,7 +241,8 @@ export const invokeOutcomesMachine = Machine.make({
218
241
  id: "request-timeout",
219
242
  onDone: {
220
243
  target: targets2.root.Completed,
221
- decoded: () => (new Completed({ source: "timer", result: "timeout elapsed" }))
244
+ decoded: true,
245
+ data: () => (new Completed({ source: "timer", result: "timeout elapsed" }))
222
246
  }
223
247
  }
224
248
  },
@@ -229,13 +253,14 @@ export const invokeOutcomesMachine = Machine.make({
229
253
  address: Machine.childAddress("status-worker"),
230
254
  onFailure: {
231
255
  target: targets2.root.Failed,
232
- decoded: ({ error }) => (new Failed({ source: "process", message: String(error) }))
256
+ decoded: true,
257
+ data: ({ error }) => (new Failed({ source: "process", message: String(error) }))
233
258
  },
234
259
  onSnapshot: {
235
260
  branches: "transition13",
236
261
  resolve: ({ select, snapshot }) =>
237
262
  snapshot.state === "ready"
238
- ? select.ready.decoded(new Completed({ source: "process", result: "ready" }))
263
+ ? select.ready({ data: new Completed({ source: "process", result: "ready" }), decoded: true })
239
264
  : select.waiting()
240
265
  }
241
266
  }
@@ -245,7 +270,8 @@ export const invokeOutcomesMachine = Machine.make({
245
270
  src: "source5",
246
271
  onDone: {
247
272
  target: targets2.root.Completed,
248
- decoded: ({ output }) => (new Completed({ source: "child machine", result: output }))
273
+ decoded: true,
274
+ data: ({ output }) => (new Completed({ source: "child machine", result: output }))
249
275
  }
250
276
  }
251
277
  }
@@ -253,12 +279,12 @@ export const invokeOutcomesMachine = Machine.make({
253
279
  },
254
280
  Completed: {
255
281
  on: {
256
- Reset: { initial: targets2.root.Gallery, decoded: () => (new Gallery({ selectedDemo: null })) }
282
+ Reset: { target: targets2.root.Gallery, decoded: true, data: () => (new Gallery({ selectedDemo: null })) }
257
283
  }
258
284
  },
259
285
  Failed: {
260
286
  on: {
261
- Reset: { initial: targets2.root.Gallery, decoded: () => (new Gallery({ selectedDemo: null })) }
287
+ Reset: { target: targets2.root.Gallery, decoded: true, data: () => (new Gallery({ selectedDemo: null })) }
262
288
  }
263
289
  }
264
290
  }