@genesislcap/foundation-state-machine 14.70.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.
Files changed (173) hide show
  1. package/README.md +26 -0
  2. package/dist/dts/core/actions.d.ts +61 -0
  3. package/dist/dts/core/actions.d.ts.map +1 -0
  4. package/dist/dts/core/binding.d.ts +37 -0
  5. package/dist/dts/core/binding.d.ts.map +1 -0
  6. package/dist/dts/core/errors.d.ts +41 -0
  7. package/dist/dts/core/errors.d.ts.map +1 -0
  8. package/dist/dts/core/guards.d.ts +67 -0
  9. package/dist/dts/core/guards.d.ts.map +1 -0
  10. package/dist/dts/core/index.d.ts +8 -0
  11. package/dist/dts/core/index.d.ts.map +1 -0
  12. package/dist/dts/core/inputs.d.ts +19 -0
  13. package/dist/dts/core/inputs.d.ts.map +1 -0
  14. package/dist/dts/core/machine.d.ts +338 -0
  15. package/dist/dts/core/machine.d.ts.map +1 -0
  16. package/dist/dts/core/state.d.ts +11 -0
  17. package/dist/dts/core/state.d.ts.map +1 -0
  18. package/dist/dts/index.d.ts +4 -0
  19. package/dist/dts/index.d.ts.map +1 -0
  20. package/dist/dts/index.federated.d.ts +1 -0
  21. package/dist/dts/index.federated.d.ts.map +1 -0
  22. package/dist/dts/machines/fetch/errors.d.ts +39 -0
  23. package/dist/dts/machines/fetch/errors.d.ts.map +1 -0
  24. package/dist/dts/machines/fetch/index.d.ts +5 -0
  25. package/dist/dts/machines/fetch/index.d.ts.map +1 -0
  26. package/dist/dts/machines/fetch/machine.d.ts +57 -0
  27. package/dist/dts/machines/fetch/machine.d.ts.map +1 -0
  28. package/dist/dts/machines/fetch/policies.d.ts +25 -0
  29. package/dist/dts/machines/fetch/policies.d.ts.map +1 -0
  30. package/dist/dts/machines/fetch/types.d.ts +118 -0
  31. package/dist/dts/machines/fetch/types.d.ts.map +1 -0
  32. package/dist/dts/machines/index.d.ts +2 -0
  33. package/dist/dts/machines/index.d.ts.map +1 -0
  34. package/dist/dts/tsdoc-metadata.json +11 -0
  35. package/dist/dts/utils/index.d.ts +2 -0
  36. package/dist/dts/utils/index.d.ts.map +1 -0
  37. package/dist/dts/utils/logger.d.ts +5 -0
  38. package/dist/dts/utils/logger.d.ts.map +1 -0
  39. package/dist/esm/core/actions.js +46 -0
  40. package/dist/esm/core/binding.js +16 -0
  41. package/dist/esm/core/errors.js +70 -0
  42. package/dist/esm/core/guards.js +73 -0
  43. package/dist/esm/core/index.js +7 -0
  44. package/dist/esm/core/inputs.js +10 -0
  45. package/dist/esm/core/machine.js +180 -0
  46. package/dist/esm/core/state.js +26 -0
  47. package/dist/esm/index.federated.js +1 -0
  48. package/dist/esm/index.js +3 -0
  49. package/dist/esm/machines/fetch/errors.js +46 -0
  50. package/dist/esm/machines/fetch/index.js +4 -0
  51. package/dist/esm/machines/fetch/machine.js +216 -0
  52. package/dist/esm/machines/fetch/policies.js +48 -0
  53. package/dist/esm/machines/fetch/types.js +48 -0
  54. package/dist/esm/machines/index.js +1 -0
  55. package/dist/esm/utils/index.js +1 -0
  56. package/dist/esm/utils/logger.js +5 -0
  57. package/dist/foundation-state-machine.api.json +5594 -0
  58. package/dist/foundation-state-machine.d.ts +884 -0
  59. package/docs/.gitattributes +2 -0
  60. package/docs/api/foundation-state-machine.abstractmachine.actor.md +18 -0
  61. package/docs/api/foundation-state-machine.abstractmachine.binding.md +27 -0
  62. package/docs/api/foundation-state-machine.abstractmachine.complete.md +13 -0
  63. package/docs/api/foundation-state-machine.abstractmachine.context.md +13 -0
  64. package/docs/api/foundation-state-machine.abstractmachine.error.md +13 -0
  65. package/docs/api/foundation-state-machine.abstractmachine.errors.md +13 -0
  66. package/docs/api/foundation-state-machine.abstractmachine.getfromcontainer.md +23 -0
  67. package/docs/api/foundation-state-machine.abstractmachine.hastag.md +28 -0
  68. package/docs/api/foundation-state-machine.abstractmachine.machine.md +18 -0
  69. package/docs/api/foundation-state-machine.abstractmachine.matches.md +28 -0
  70. package/docs/api/foundation-state-machine.abstractmachine.md +44 -0
  71. package/docs/api/foundation-state-machine.abstractmachine.onsendevent.md +13 -0
  72. package/docs/api/foundation-state-machine.abstractmachine.output.md +13 -0
  73. package/docs/api/foundation-state-machine.abstractmachine.provide.md +24 -0
  74. package/docs/api/foundation-state-machine.abstractmachine.send.md +24 -0
  75. package/docs/api/foundation-state-machine.abstractmachine.start.md +28 -0
  76. package/docs/api/foundation-state-machine.abstractmachine.startingcontext.md +13 -0
  77. package/docs/api/foundation-state-machine.abstractmachine.startingstate.md +13 -0
  78. package/docs/api/foundation-state-machine.abstractmachine.state.md +13 -0
  79. package/docs/api/foundation-state-machine.abstractmachine.stop.md +17 -0
  80. package/docs/api/foundation-state-machine.apierror._constructor_.md +22 -0
  81. package/docs/api/foundation-state-machine.apierror.data.md +11 -0
  82. package/docs/api/foundation-state-machine.apierror.md +32 -0
  83. package/docs/api/foundation-state-machine.apierror.status.md +11 -0
  84. package/docs/api/foundation-state-machine.assertevent.md +27 -0
  85. package/docs/api/foundation-state-machine.createerrorstatenode.md +13 -0
  86. package/docs/api/foundation-state-machine.createfetchpolicy.md +18 -0
  87. package/docs/api/foundation-state-machine.createresponsedataextractorwithdeserializer.md +13 -0
  88. package/docs/api/foundation-state-machine.defaultfetchconfig.md +13 -0
  89. package/docs/api/foundation-state-machine.defaultfetchmachine._constructor_.md +20 -0
  90. package/docs/api/foundation-state-machine.defaultfetchmachine.getfromcontainer.md +23 -0
  91. package/docs/api/foundation-state-machine.defaultfetchmachine.md +30 -0
  92. package/docs/api/foundation-state-machine.defaultfetchmachine.start.md +28 -0
  93. package/docs/api/foundation-state-machine.defaultfetchmachinecontext.md +13 -0
  94. package/docs/api/foundation-state-machine.defaultfetchpolicy.md +13 -0
  95. package/docs/api/foundation-state-machine.defaultresponsedataextractor.md +18 -0
  96. package/docs/api/foundation-state-machine.defaultresponseokchecker.md +13 -0
  97. package/docs/api/foundation-state-machine.defaultretrystatscodes.md +13 -0
  98. package/docs/api/foundation-state-machine.errorworkflowinput.md +15 -0
  99. package/docs/api/foundation-state-machine.escalateerror.md +42 -0
  100. package/docs/api/foundation-state-machine.fetchconfig.fetcher.md +13 -0
  101. package/docs/api/foundation-state-machine.fetchconfig.fetchpolicy.md +13 -0
  102. package/docs/api/foundation-state-machine.fetchconfig.md +23 -0
  103. package/docs/api/foundation-state-machine.fetchconfig.responsedataextractor.md +13 -0
  104. package/docs/api/foundation-state-machine.fetchconfig.responseokchecker.md +13 -0
  105. package/docs/api/foundation-state-machine.fetchmachine.md +15 -0
  106. package/docs/api/foundation-state-machine.fetchmachinecontext.controller.md +13 -0
  107. package/docs/api/foundation-state-machine.fetchmachinecontext.data.md +13 -0
  108. package/docs/api/foundation-state-machine.fetchmachinecontext.md +28 -0
  109. package/docs/api/foundation-state-machine.fetchmachinecontext.params.md +17 -0
  110. package/docs/api/foundation-state-machine.fetchmachinecontext.response.md +13 -0
  111. package/docs/api/foundation-state-machine.fetchmachineevent.md +24 -0
  112. package/docs/api/foundation-state-machine.fetchmachineeventmap.md +21 -0
  113. package/docs/api/foundation-state-machine.fetchmachineoutput.md +21 -0
  114. package/docs/api/foundation-state-machine.genesisservererror._constructor_.md +22 -0
  115. package/docs/api/foundation-state-machine.genesisservererror.getdetailserror.md +15 -0
  116. package/docs/api/foundation-state-machine.genesisservererror.getmessageerror.md +15 -0
  117. package/docs/api/foundation-state-machine.genesisservererror.haserrorcode.md +22 -0
  118. package/docs/api/foundation-state-machine.genesisservererror.isignorableerror.md +17 -0
  119. package/docs/api/foundation-state-machine.genesisservererror.md +41 -0
  120. package/docs/api/foundation-state-machine.genesisservererror.received.md +11 -0
  121. package/docs/api/foundation-state-machine.genesisservererror.sent.md +11 -0
  122. package/docs/api/foundation-state-machine.isaborterror.md +15 -0
  123. package/docs/api/foundation-state-machine.isactorerrorevent.md +13 -0
  124. package/docs/api/foundation-state-machine.isapierror.md +11 -0
  125. package/docs/api/foundation-state-machine.isdoneinvokeevent.md +13 -0
  126. package/docs/api/foundation-state-machine.iserrorcustomevent.md +18 -0
  127. package/docs/api/foundation-state-machine.iserrorevent.md +13 -0
  128. package/docs/api/foundation-state-machine.iserrortype.md +13 -0
  129. package/docs/api/foundation-state-machine.isgenesisservererror.md +11 -0
  130. package/docs/api/foundation-state-machine.ismappingerror.md +11 -0
  131. package/docs/api/foundation-state-machine.isnetworkerror.md +11 -0
  132. package/docs/api/foundation-state-machine.isnotfounderror.md +13 -0
  133. package/docs/api/foundation-state-machine.issyntaxerror.md +15 -0
  134. package/docs/api/foundation-state-machine.istypeerror.md +15 -0
  135. package/docs/api/foundation-state-machine.logger.md +12 -0
  136. package/docs/api/foundation-state-machine.machine.actor.md +18 -0
  137. package/docs/api/foundation-state-machine.machine.binding.md +47 -0
  138. package/docs/api/foundation-state-machine.machine.complete.md +13 -0
  139. package/docs/api/foundation-state-machine.machine.context.md +13 -0
  140. package/docs/api/foundation-state-machine.machine.error.md +13 -0
  141. package/docs/api/foundation-state-machine.machine.errors.md +13 -0
  142. package/docs/api/foundation-state-machine.machine.getfromcontainer.md +35 -0
  143. package/docs/api/foundation-state-machine.machine.hastag.md +35 -0
  144. package/docs/api/foundation-state-machine.machine.machine.md +18 -0
  145. package/docs/api/foundation-state-machine.machine.matches.md +35 -0
  146. package/docs/api/foundation-state-machine.machine.md +101 -0
  147. package/docs/api/foundation-state-machine.machine.onsendevent.md +24 -0
  148. package/docs/api/foundation-state-machine.machine.output.md +13 -0
  149. package/docs/api/foundation-state-machine.machine.provide.md +44 -0
  150. package/docs/api/foundation-state-machine.machine.send.md +24 -0
  151. package/docs/api/foundation-state-machine.machine.start.md +28 -0
  152. package/docs/api/foundation-state-machine.machine.startingcontext.md +13 -0
  153. package/docs/api/foundation-state-machine.machine.startingstate.md +13 -0
  154. package/docs/api/foundation-state-machine.machine.state.md +13 -0
  155. package/docs/api/foundation-state-machine.machine.stop.md +17 -0
  156. package/docs/api/foundation-state-machine.machinecontext.error.md +13 -0
  157. package/docs/api/foundation-state-machine.machinecontext.errors.md +13 -0
  158. package/docs/api/foundation-state-machine.machinecontext.md +36 -0
  159. package/docs/api/foundation-state-machine.mappingerror._constructor_.md +21 -0
  160. package/docs/api/foundation-state-machine.mappingerror.dto.md +11 -0
  161. package/docs/api/foundation-state-machine.mappingerror.md +27 -0
  162. package/docs/api/foundation-state-machine.md +81 -0
  163. package/docs/api/foundation-state-machine.networkerror._constructor_.md +21 -0
  164. package/docs/api/foundation-state-machine.networkerror.md +31 -0
  165. package/docs/api/foundation-state-machine.networkerror.url.md +11 -0
  166. package/docs/api/foundation-state-machine.responsedataextractor.md +18 -0
  167. package/docs/api/foundation-state-machine.responseokchecker.md +13 -0
  168. package/docs/api/foundation-state-machine.seterror.md +25 -0
  169. package/docs/api/foundation-state-machine.seterrorbykey.md +25 -0
  170. package/docs/api/index.md +12 -0
  171. package/docs/api-report.md +393 -0
  172. package/license.txt +46 -0
  173. package/package.json +60 -0
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isActorErrorEvent](./foundation-state-machine.isactorerrorevent.md)
4
+
5
+ ## isActorErrorEvent variable
6
+
7
+ isActorErrorEvent.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent<TData>) => event is ErrorEvent<TData>
13
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isAPIError](./foundation-state-machine.isapierror.md)
4
+
5
+ ## isAPIError variable
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ isAPIError: (error: unknown) => boolean
11
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isDoneInvokeEvent](./foundation-state-machine.isdoneinvokeevent.md)
4
+
5
+ ## isDoneInvokeEvent variable
6
+
7
+ isDoneInvokeEvent.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isDoneInvokeEvent: <TData = any>(event: EventObject | DoneInvokeEvent<TData>) => event is DoneInvokeEvent<TData>
13
+ ```
@@ -0,0 +1,18 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isErrorCustomEvent](./foundation-state-machine.iserrorcustomevent.md)
4
+
5
+ ## isErrorCustomEvent variable
6
+
7
+ isErrorCustomEvent.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isErrorCustomEvent: <TData = any>(event: EventObject | ErrorEvent<TData>) => event is ErrorEvent<TData>
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ What `escalate` from a child is typed as.
18
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isErrorEvent](./foundation-state-machine.iserrorevent.md)
4
+
5
+ ## isErrorEvent variable
6
+
7
+ isErrorEvent.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isErrorEvent: <TData = any>(event: EventObject | ErrorEvent<TData>) => event is ErrorEvent<TData>
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isErrorType](./foundation-state-machine.iserrortype.md)
4
+
5
+ ## isErrorType variable
6
+
7
+ isErrorType.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean
13
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isGenesisServerError](./foundation-state-machine.isgenesisservererror.md)
4
+
5
+ ## isGenesisServerError variable
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ isGenesisServerError: (error: unknown) => boolean
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isMappingError](./foundation-state-machine.ismappingerror.md)
4
+
5
+ ## isMappingError variable
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ isMappingError: (error: unknown) => boolean
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isNetworkError](./foundation-state-machine.isnetworkerror.md)
4
+
5
+ ## isNetworkError variable
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ isNetworkError: (error: unknown) => boolean
11
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isNotFoundError](./foundation-state-machine.isnotfounderror.md)
4
+
5
+ ## isNotFoundError variable
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ isNotFoundError: (error: {
11
+ status?: number;
12
+ }) => boolean
13
+ ```
@@ -0,0 +1,15 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isSyntaxError](./foundation-state-machine.issyntaxerror.md)
4
+
5
+ ## isSyntaxError variable
6
+
7
+ isSyntaxError.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isSyntaxError: ({ event }: {
13
+ event: any;
14
+ }) => boolean
15
+ ```
@@ -0,0 +1,15 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [isTypeError](./foundation-state-machine.istypeerror.md)
4
+
5
+ ## isTypeError variable
6
+
7
+ isTypeError.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isTypeError: ({ event }: {
13
+ event: any;
14
+ }) => boolean
15
+ ```
@@ -0,0 +1,12 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [logger](./foundation-state-machine.logger.md)
4
+
5
+ ## logger variable
6
+
7
+
8
+ **Signature:**
9
+
10
+ ```typescript
11
+ logger: import("@genesislcap/foundation-utils").Logger
12
+ ```
@@ -0,0 +1,18 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [actor](./foundation-state-machine.machine.actor.md)
4
+
5
+ ## Machine.actor property
6
+
7
+ Optional actor
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly actor?: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ Callers can decide to reuse/reference if set or create their own.
18
+
@@ -0,0 +1,47 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [binding](./foundation-state-machine.machine.binding.md)
4
+
5
+ ## Machine.binding() method
6
+
7
+ An api to allow the observation of values and arbitrary bindings outside the template engine.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ binding<TReturn = any, TParent = any>(token: ((target: this) => TReturn) | keyof this, subscriberChangeCallback?: SubscriberChangeCallback<TReturn> | undefined, isVolatileBinding?: boolean, context?: ExecutionContext): BindingObserver<this, TReturn, TParent>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | token | ((target: this) =&gt; TReturn) \| keyof this | A target lookup token which can take various forms. |
20
+ | subscriberChangeCallback | SubscriberChangeCallback&lt;TReturn&gt; \| undefined | _(Optional)_ . |
21
+ | isVolatileBinding | boolean | _(Optional)_ Indicates the binding is volatile. |
22
+ | context | ExecutionContext | _(Optional)_ . |
23
+
24
+ **Returns:**
25
+
26
+ BindingObserver&lt;this, TReturn, TParent&gt;
27
+
28
+ ## Example 1
29
+
30
+ TS attains the value type information from the machine's interface.
31
+
32
+ ```ts
33
+ this.myMachine.binding(x => x.context.data, value => {...}); // value is typeof data
34
+ ```
35
+
36
+ ## Example 2
37
+
38
+ You can also use the underlying BindingObserver api should you prefer.
39
+
40
+ ```ts
41
+ this.myMachine.binding(x => x.error).subscribe({
42
+ handleChange(binding, args) {
43
+ ...
44
+ }
45
+ })
46
+ ```
47
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [complete](./foundation-state-machine.machine.complete.md)
4
+
5
+ ## Machine.complete property
6
+
7
+ Indicates if the machine has completed the happy path.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly complete: boolean;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [context](./foundation-state-machine.machine.context.md)
4
+
5
+ ## Machine.context property
6
+
7
+ The current `context` of the machine. The data points in context may be considered transient in nature.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly context: Partial<TContext>;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [error](./foundation-state-machine.machine.error.md)
4
+
5
+ ## Machine.error property
6
+
7
+ A general machine error. Likely equal to `errors.lastError`<!-- -->.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly error: any;
13
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [errors](./foundation-state-machine.machine.errors.md)
4
+
5
+ ## Machine.errors property
6
+
7
+ An of errors that may have occurred during the machine's workflows.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly errors: ErrorMap<ErrorDetailMap>;
13
+ ```
@@ -0,0 +1,35 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [getFromContainer](./foundation-state-machine.machine.getfromcontainer.md)
4
+
5
+ ## Machine.getFromContainer() method
6
+
7
+ Gets the machine from the container.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getFromContainer(): this;
13
+ ```
14
+ **Returns:**
15
+
16
+ this
17
+
18
+ ## Remarks
19
+
20
+ Calling `getFromContainer` on an injected machine will return a new instance providing it was registered with the DI as `transient`<!-- -->. This is simply a convenience method, and may be useful as some machines contain 'final' states, meaning once they complete they can no longer receive events. However, if you want to continue to work with your injected machine reference, re-calling [start](./foundation-state-machine.machine.start.md) may also be a viable option.
21
+
22
+ Please note that machines are injected into other machines to form parts of complex workflows. In such cases, the parent machine will `invoke` or `spawn` the injected machine's `logic` directly to always create a new actor.
23
+
24
+ ## Example
25
+
26
+ Invoke an injected machine's `logic` from a parent machine
27
+
28
+ ```ts
29
+ invoke: {
30
+ id: 'dataFetcher',
31
+ src: fetchMachine.machine, // < Or `src: 'fetcher'`, and create that actor to interact with the injected machine.
32
+ ...
33
+ }
34
+ ```
35
+
@@ -0,0 +1,35 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [hasTag](./foundation-state-machine.machine.hastag.md)
4
+
5
+ ## Machine.hasTag() method
6
+
7
+ Check `tags` contain provided tag.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ hasTag(tag: string): boolean;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | tag | string | A tag. |
20
+
21
+ **Returns:**
22
+
23
+ boolean
24
+
25
+ ## Remarks
26
+
27
+ This differs from `matches`<!-- -->, as multiple states may use common tags such as `pending` to indicate some async work is occurring. As with `matches`<!-- -->, `hasTag` can be useful if you need to conditionally run logic or render markup.
28
+
29
+ ## Example
30
+
31
+
32
+ ```ts
33
+ if (machine.hasTag('pending')) { ... }
34
+ ```
35
+
@@ -0,0 +1,18 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [machine](./foundation-state-machine.machine.machine.md)
4
+
5
+ ## Machine.machine property
6
+
7
+ Mandatory machine property.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ The logic / config that goes into a machine is not accessible from the outside, and is owned by the implementing class. However, consumers of that may provide custom `implementations` in the xstate sense via the `provide()` api.
18
+
@@ -0,0 +1,35 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [matches](./foundation-state-machine.machine.matches.md)
4
+
5
+ ## Machine.matches() method
6
+
7
+ Check `state` matches provided value.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ matches(value: StateValueFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): boolean;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | value | StateValueFrom&lt;StateMachine&lt;TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta&gt;&gt; | A state value. |
20
+
21
+ **Returns:**
22
+
23
+ boolean
24
+
25
+ ## Remarks
26
+
27
+ Can be useful if you need to conditionally run logic or render markup.
28
+
29
+ ## Example
30
+
31
+
32
+ ```ts
33
+ if (machine.matches('inactive')) { ... }
34
+ ```
35
+
@@ -0,0 +1,101 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md)
4
+
5
+ ## Machine interface
6
+
7
+ Machine interface.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface Machine<TContext extends MachineContext, TEvent extends EventObject = AnyEventObject, TAction extends ParameterizedObject = ParameterizedObject, TActor extends ProvidedActor = ProvidedActor, TInput = any, TResolvedTypesMeta = ResolveTypegenMeta<TypegenDisabled, NoInfer<TEvent>, TAction, TActor>>
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ The interface of our xstate based machines or logic workflows. These contain bindable properties for convenience. Should be extended.
18
+
19
+ ## Example 1
20
+
21
+ Creating a machine in the DI.
22
+
23
+ ```ts
24
+ export interface MyMachine extends Machine<MyMachineContext, MyMachineEvent> {
25
+ readonly service: MyService;
26
+ ...
27
+ }
28
+ export class DefaultMyMachine
29
+ extends AbstractMachine<MyMachineContext, MyMachineEvent>
30
+ implements MyMachine
31
+ {
32
+ constructor(@MyService readonly service: MyService) {
33
+ super();
34
+ this.machine = createMachine<MyMachineContext, MyMachineEvent>(...);
35
+ this.start(); // < Call now or later to ready the machine.
36
+ }
37
+ start(
38
+ options: InterpreterOptions<typeof this.machine> = {
39
+ input: myDefaultContext,
40
+ },
41
+ ) {
42
+ super.start(options);
43
+ }
44
+ }
45
+ // Whether the machine should be `transient` or a `singleton` probably depends on the use case and if it contains a `final` state.
46
+ export const MyMachine = DI.createInterface<MyMachine>((x) => x.transient(DefaultMyMachine));
47
+ ```
48
+ Machines are bindable from templates and other logic.
49
+
50
+ ## Example 2
51
+
52
+ Surface errors in a template.
53
+
54
+ ```ts
55
+ ${when(
56
+ (x) => !!x.myMachine.errors.size,
57
+ html<MyComponent>`
58
+ <span>${(x) => x.myMachine.errors.messages}</span>
59
+ `,
60
+ )}
61
+ ```
62
+
63
+ ## Example 3
64
+
65
+ Use context data in a class.
66
+
67
+ ```ts
68
+ this.myMachine.binding((x) => x.context.data, (value) => {
69
+ // use data
70
+ });
71
+ ```
72
+
73
+ ## Properties
74
+
75
+ | Property | Modifiers | Type | Description |
76
+ | --- | --- | --- | --- |
77
+ | [actor?](./foundation-state-machine.machine.actor.md) | <code>readonly</code> | InterpreterFrom&lt;StateMachine&lt;TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta&gt;&gt; | _(Optional)_ Optional actor |
78
+ | [complete](./foundation-state-machine.machine.complete.md) | <code>readonly</code> | boolean | Indicates if the machine has completed the happy path. |
79
+ | [context](./foundation-state-machine.machine.context.md) | <code>readonly</code> | Partial&lt;TContext&gt; | The current <code>context</code> of the machine. The data points in context may be considered transient in nature. |
80
+ | [error](./foundation-state-machine.machine.error.md) | <code>readonly</code> | any | A general machine error. Likely equal to <code>errors.lastError</code>. |
81
+ | [errors](./foundation-state-machine.machine.errors.md) | <code>readonly</code> | ErrorMap&lt;ErrorDetailMap&gt; | An of errors that may have occurred during the machine's workflows. |
82
+ | [machine](./foundation-state-machine.machine.machine.md) | <code>readonly</code> | StateMachine&lt;TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta&gt; | Mandatory machine property. |
83
+ | [output](./foundation-state-machine.machine.output.md) | <code>readonly</code> | any | Holds successful machine output if any. |
84
+ | [startingContext](./foundation-state-machine.machine.startingcontext.md) | <code>readonly</code> | Partial&lt;TContext&gt; | The <code>context</code> of the machine when started. |
85
+ | [startingState](./foundation-state-machine.machine.startingstate.md) | <code>readonly</code> | StateValue | The <code>state</code> of the machine when started. Allows consumers to start a machine from a persisted state. |
86
+ | [state](./foundation-state-machine.machine.state.md) | <code>readonly</code> | StateValue | The current <code>state</code> of the machine itself. This is not to be confused with state in the data or store sense. |
87
+
88
+ ## Methods
89
+
90
+ | Method | Description |
91
+ | --- | --- |
92
+ | [binding(token, subscriberChangeCallback, isVolatileBinding, context)](./foundation-state-machine.machine.binding.md) | An api to allow the observation of values and arbitrary bindings outside the template engine. |
93
+ | [getFromContainer()](./foundation-state-machine.machine.getfromcontainer.md) | Gets the machine from the container. |
94
+ | [hasTag(tag)](./foundation-state-machine.machine.hastag.md) | Check <code>tags</code> contain provided tag. |
95
+ | [matches(value)](./foundation-state-machine.machine.matches.md) | Check <code>state</code> matches provided value. |
96
+ | [onSendEvent(event)](./foundation-state-machine.machine.onsendevent.md) | A custom event handler to send events to the machine. |
97
+ | [provide(implementations)](./foundation-state-machine.machine.provide.md) | Recreate the internal machine with the provided implementations. |
98
+ | [send(event)](./foundation-state-machine.machine.send.md) | An api to send events to the machine. |
99
+ | [start(options)](./foundation-state-machine.machine.start.md) | Start the machine. |
100
+ | [stop()](./foundation-state-machine.machine.stop.md) | Stop the machine. |
101
+
@@ -0,0 +1,24 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [onSendEvent](./foundation-state-machine.machine.onsendevent.md)
4
+
5
+ ## Machine.onSendEvent() method
6
+
7
+ A custom event handler to send events to the machine.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ onSendEvent(event: CustomEvent<TEvent>): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | event | CustomEvent&lt;TEvent&gt; | A custom event. |
20
+
21
+ **Returns:**
22
+
23
+ void
24
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [output](./foundation-state-machine.machine.output.md)
4
+
5
+ ## Machine.output property
6
+
7
+ Holds successful machine output if any.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ readonly output: any;
13
+ ```
@@ -0,0 +1,44 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [provide](./foundation-state-machine.machine.provide.md)
4
+
5
+ ## Machine.provide() method
6
+
7
+ Recreate the internal machine with the provided implementations.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ provide(implementations: InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true>): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | implementations | InternalMachineImplementations&lt;TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true&gt; | <code>actions</code>, <code>guards</code>, <code>actors</code>... to merge with existing options. |
20
+
21
+ **Returns:**
22
+
23
+ void
24
+
25
+ ## Example
26
+
27
+ Using an existing machine with a custom implementation.
28
+
29
+ ```ts
30
+ @MyMachine readonly machine: MyMachine;
31
+ ...
32
+ this.machine.provide({
33
+ actors: {
34
+ serviceCallX: fromPromise(async ({ input }) => Promise.resolve(new Error('Overridden serviceCallX'))),
35
+ onSuccess: (context) => successHandlerInHost(context.data)
36
+ },
37
+ guards: {
38
+ isAssured: ({ context }) => true,
39
+ },
40
+ });
41
+ // When you change the machine it will stop if running, so you'll have to call {@link Machine.start | start} again.
42
+ this.machine.start();
43
+ ```
44
+
@@ -0,0 +1,24 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [send](./foundation-state-machine.machine.send.md)
4
+
5
+ ## Machine.send() method
6
+
7
+ An api to send events to the machine.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ send(event: TEvent): void;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ | Parameter | Type | Description |
18
+ | --- | --- | --- |
19
+ | event | TEvent | An event. |
20
+
21
+ **Returns:**
22
+
23
+ void
24
+