@typeonce/effect-machine 0.5.1 → 0.6.1

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/package.json +8 -8
  3. package/src/Machine.ts +6873 -0
  4. package/src/index.ts +1 -0
  5. package/src/internal/machine/activities.ts +108 -0
  6. package/src/internal/machine/atom.ts +636 -0
  7. package/src/internal/machine/cluster.ts +394 -0
  8. package/src/internal/machine/command.ts +58 -0
  9. package/src/internal/machine/commandRuntime.ts +43 -0
  10. package/src/internal/machine/configuration.ts +1331 -0
  11. package/src/internal/machine/errors.ts +87 -0
  12. package/src/internal/machine/executionPlan.ts +996 -0
  13. package/src/internal/machine/invocation.ts +119 -0
  14. package/src/internal/machine/machine.ts +1747 -0
  15. package/src/internal/machine/planner.ts +1933 -0
  16. package/src/internal/machine/process.ts +906 -0
  17. package/src/internal/machine/protocol.ts +322 -0
  18. package/src/internal/machine/readiness.ts +10 -0
  19. package/src/internal/machine/runtime.ts +2512 -0
  20. package/src/internal/machine/serialization.ts +498 -0
  21. package/src/internal/machine/stateDefinition.ts +270 -0
  22. package/src/internal/machine/symbols.ts +2 -0
  23. package/src/internal/machine/topology.ts +479 -0
  24. package/src/internal/testing/machine/arbitrary.ts +102 -0
  25. package/src/internal/testing/machine/exploration.ts +331 -0
  26. package/src/internal/testing/machine/finiteModel.ts +1498 -0
  27. package/src/internal/testing/machine/invariant.ts +372 -0
  28. package/src/internal/testing/machine/probe.ts +79 -0
  29. package/src/internal/testing/machine/referenceModel.ts +1505 -0
  30. package/src/internal/testing/machine/runtime.ts +1710 -0
  31. package/src/internal/testing/machine/runtimeInvariant.ts +486 -0
  32. package/src/internal/testing/machine/trace.ts +150 -0
  33. package/src/internal/testing/machine/verification.ts +1890 -0
  34. package/src/testing/MachineTest.ts +2067 -0
  35. package/src/testing/index.ts +7 -0
  36. package/src/unstable/cluster/ClusterMachine.ts +390 -0
  37. package/src/unstable/cluster/index.ts +1 -0
  38. package/src/unstable/reactivity/AtomMachine.ts +649 -0
  39. package/src/unstable/reactivity/index.ts +1 -0
@@ -0,0 +1,87 @@
1
+ import type * as Cause from "effect/Cause"
2
+ import * as Data from "effect/Data"
3
+ import type * as Schema from "effect/Schema"
4
+
5
+ /**
6
+ * Error returned when a decoded machine snapshot cannot be encoded through its
7
+ * declared state or output schemas.
8
+ *
9
+ * @category errors
10
+ * @since 0.4.0
11
+ */
12
+ export class MachineSchemaEncodeError extends Data.TaggedError("MachineSchemaEncodeError")<{
13
+ readonly machineId: string | undefined
14
+ readonly boundary: "state" | "output" | "history" | "configuration"
15
+ readonly state?: string
16
+ readonly cause: Schema.SchemaError | Cause.Cause<unknown>
17
+ }> {}
18
+
19
+ /**
20
+ * Error returned when a machine contract value does not match the schema or
21
+ * structural configuration declared for a machine boundary.
22
+ *
23
+ * @category errors
24
+ * @since 0.4.0
25
+ */
26
+ export class MachineSchemaDecodeError extends Data.TaggedError("MachineSchemaDecodeError")<{
27
+ readonly machineId: string | undefined
28
+ readonly boundary: "input" | "event" | "emit" | "state" | "output" | "history" | "configuration"
29
+ readonly state?: string
30
+ readonly event?: string
31
+ readonly cause: Schema.SchemaError | Cause.Cause<unknown>
32
+ }> {}
33
+
34
+ /**
35
+ * Error returned when a machine does not stabilize within the maximum
36
+ * number of macrostep iterations.
37
+ *
38
+ * @category errors
39
+ * @since 0.4.0
40
+ */
41
+ export class InfiniteTransitionError extends Data.TaggedError("InfiniteTransitionError")<{
42
+ readonly machineId: string | undefined
43
+ readonly state: string
44
+ readonly maxIterations: number
45
+ }> {}
46
+
47
+ /**
48
+ * Error returned when a machine fails while running startup lifecycle
49
+ * logic after the initial state has been computed.
50
+ *
51
+ * @category errors
52
+ * @since 0.4.0
53
+ */
54
+ export class StartupError extends Data.TaggedError("StartupError")<{
55
+ readonly cause: Cause.Cause<unknown>
56
+ }> {}
57
+
58
+ /**
59
+ * Error returned by `spawn` when a child process with the same id already
60
+ * exists for the current machine.
61
+ *
62
+ * @category errors
63
+ * @since 0.4.0
64
+ */
65
+ export class ChildAlreadyExistsError extends Data.TaggedError("ChildAlreadyExistsError")<{
66
+ readonly id: string
67
+ }> {}
68
+
69
+ /**
70
+ * Error returned when standalone action execution attempts an operation that
71
+ * requires a managed machine process.
72
+ *
73
+ * @category errors
74
+ * @since 0.4.0
75
+ */
76
+ export class ProcessLocalError extends Data.TaggedError("ProcessLocalError")<{
77
+ readonly operation: string
78
+ }> {}
79
+
80
+ /**
81
+ * Error returned by `join` when a running machine is stopped before
82
+ * producing an output.
83
+ *
84
+ * @category errors
85
+ * @since 0.4.0
86
+ */
87
+ export class StoppedError extends Data.TaggedError("StoppedError") {}