@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.
- package/README.md +26 -0
- package/dist/dts/core/actions.d.ts +61 -0
- package/dist/dts/core/actions.d.ts.map +1 -0
- package/dist/dts/core/binding.d.ts +37 -0
- package/dist/dts/core/binding.d.ts.map +1 -0
- package/dist/dts/core/errors.d.ts +41 -0
- package/dist/dts/core/errors.d.ts.map +1 -0
- package/dist/dts/core/guards.d.ts +67 -0
- package/dist/dts/core/guards.d.ts.map +1 -0
- package/dist/dts/core/index.d.ts +8 -0
- package/dist/dts/core/index.d.ts.map +1 -0
- package/dist/dts/core/inputs.d.ts +19 -0
- package/dist/dts/core/inputs.d.ts.map +1 -0
- package/dist/dts/core/machine.d.ts +338 -0
- package/dist/dts/core/machine.d.ts.map +1 -0
- package/dist/dts/core/state.d.ts +11 -0
- package/dist/dts/core/state.d.ts.map +1 -0
- package/dist/dts/index.d.ts +4 -0
- package/dist/dts/index.d.ts.map +1 -0
- package/dist/dts/index.federated.d.ts +1 -0
- package/dist/dts/index.federated.d.ts.map +1 -0
- package/dist/dts/machines/fetch/errors.d.ts +39 -0
- package/dist/dts/machines/fetch/errors.d.ts.map +1 -0
- package/dist/dts/machines/fetch/index.d.ts +5 -0
- package/dist/dts/machines/fetch/index.d.ts.map +1 -0
- package/dist/dts/machines/fetch/machine.d.ts +57 -0
- package/dist/dts/machines/fetch/machine.d.ts.map +1 -0
- package/dist/dts/machines/fetch/policies.d.ts +25 -0
- package/dist/dts/machines/fetch/policies.d.ts.map +1 -0
- package/dist/dts/machines/fetch/types.d.ts +118 -0
- package/dist/dts/machines/fetch/types.d.ts.map +1 -0
- package/dist/dts/machines/index.d.ts +2 -0
- package/dist/dts/machines/index.d.ts.map +1 -0
- package/dist/dts/tsdoc-metadata.json +11 -0
- package/dist/dts/utils/index.d.ts +2 -0
- package/dist/dts/utils/index.d.ts.map +1 -0
- package/dist/dts/utils/logger.d.ts +5 -0
- package/dist/dts/utils/logger.d.ts.map +1 -0
- package/dist/esm/core/actions.js +46 -0
- package/dist/esm/core/binding.js +16 -0
- package/dist/esm/core/errors.js +70 -0
- package/dist/esm/core/guards.js +73 -0
- package/dist/esm/core/index.js +7 -0
- package/dist/esm/core/inputs.js +10 -0
- package/dist/esm/core/machine.js +180 -0
- package/dist/esm/core/state.js +26 -0
- package/dist/esm/index.federated.js +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/machines/fetch/errors.js +46 -0
- package/dist/esm/machines/fetch/index.js +4 -0
- package/dist/esm/machines/fetch/machine.js +216 -0
- package/dist/esm/machines/fetch/policies.js +48 -0
- package/dist/esm/machines/fetch/types.js +48 -0
- package/dist/esm/machines/index.js +1 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/logger.js +5 -0
- package/dist/foundation-state-machine.api.json +5594 -0
- package/dist/foundation-state-machine.d.ts +884 -0
- package/docs/.gitattributes +2 -0
- package/docs/api/foundation-state-machine.abstractmachine.actor.md +18 -0
- package/docs/api/foundation-state-machine.abstractmachine.binding.md +27 -0
- package/docs/api/foundation-state-machine.abstractmachine.complete.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.context.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.error.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.errors.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.getfromcontainer.md +23 -0
- package/docs/api/foundation-state-machine.abstractmachine.hastag.md +28 -0
- package/docs/api/foundation-state-machine.abstractmachine.machine.md +18 -0
- package/docs/api/foundation-state-machine.abstractmachine.matches.md +28 -0
- package/docs/api/foundation-state-machine.abstractmachine.md +44 -0
- package/docs/api/foundation-state-machine.abstractmachine.onsendevent.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.output.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.provide.md +24 -0
- package/docs/api/foundation-state-machine.abstractmachine.send.md +24 -0
- package/docs/api/foundation-state-machine.abstractmachine.start.md +28 -0
- package/docs/api/foundation-state-machine.abstractmachine.startingcontext.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.startingstate.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.state.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.stop.md +17 -0
- package/docs/api/foundation-state-machine.apierror._constructor_.md +22 -0
- package/docs/api/foundation-state-machine.apierror.data.md +11 -0
- package/docs/api/foundation-state-machine.apierror.md +32 -0
- package/docs/api/foundation-state-machine.apierror.status.md +11 -0
- package/docs/api/foundation-state-machine.assertevent.md +27 -0
- package/docs/api/foundation-state-machine.createerrorstatenode.md +13 -0
- package/docs/api/foundation-state-machine.createfetchpolicy.md +18 -0
- package/docs/api/foundation-state-machine.createresponsedataextractorwithdeserializer.md +13 -0
- package/docs/api/foundation-state-machine.defaultfetchconfig.md +13 -0
- package/docs/api/foundation-state-machine.defaultfetchmachine._constructor_.md +20 -0
- package/docs/api/foundation-state-machine.defaultfetchmachine.getfromcontainer.md +23 -0
- package/docs/api/foundation-state-machine.defaultfetchmachine.md +30 -0
- package/docs/api/foundation-state-machine.defaultfetchmachine.start.md +28 -0
- package/docs/api/foundation-state-machine.defaultfetchmachinecontext.md +13 -0
- package/docs/api/foundation-state-machine.defaultfetchpolicy.md +13 -0
- package/docs/api/foundation-state-machine.defaultresponsedataextractor.md +18 -0
- package/docs/api/foundation-state-machine.defaultresponseokchecker.md +13 -0
- package/docs/api/foundation-state-machine.defaultretrystatscodes.md +13 -0
- package/docs/api/foundation-state-machine.errorworkflowinput.md +15 -0
- package/docs/api/foundation-state-machine.escalateerror.md +42 -0
- package/docs/api/foundation-state-machine.fetchconfig.fetcher.md +13 -0
- package/docs/api/foundation-state-machine.fetchconfig.fetchpolicy.md +13 -0
- package/docs/api/foundation-state-machine.fetchconfig.md +23 -0
- package/docs/api/foundation-state-machine.fetchconfig.responsedataextractor.md +13 -0
- package/docs/api/foundation-state-machine.fetchconfig.responseokchecker.md +13 -0
- package/docs/api/foundation-state-machine.fetchmachine.md +15 -0
- package/docs/api/foundation-state-machine.fetchmachinecontext.controller.md +13 -0
- package/docs/api/foundation-state-machine.fetchmachinecontext.data.md +13 -0
- package/docs/api/foundation-state-machine.fetchmachinecontext.md +28 -0
- package/docs/api/foundation-state-machine.fetchmachinecontext.params.md +17 -0
- package/docs/api/foundation-state-machine.fetchmachinecontext.response.md +13 -0
- package/docs/api/foundation-state-machine.fetchmachineevent.md +24 -0
- package/docs/api/foundation-state-machine.fetchmachineeventmap.md +21 -0
- package/docs/api/foundation-state-machine.fetchmachineoutput.md +21 -0
- package/docs/api/foundation-state-machine.genesisservererror._constructor_.md +22 -0
- package/docs/api/foundation-state-machine.genesisservererror.getdetailserror.md +15 -0
- package/docs/api/foundation-state-machine.genesisservererror.getmessageerror.md +15 -0
- package/docs/api/foundation-state-machine.genesisservererror.haserrorcode.md +22 -0
- package/docs/api/foundation-state-machine.genesisservererror.isignorableerror.md +17 -0
- package/docs/api/foundation-state-machine.genesisservererror.md +41 -0
- package/docs/api/foundation-state-machine.genesisservererror.received.md +11 -0
- package/docs/api/foundation-state-machine.genesisservererror.sent.md +11 -0
- package/docs/api/foundation-state-machine.isaborterror.md +15 -0
- package/docs/api/foundation-state-machine.isactorerrorevent.md +13 -0
- package/docs/api/foundation-state-machine.isapierror.md +11 -0
- package/docs/api/foundation-state-machine.isdoneinvokeevent.md +13 -0
- package/docs/api/foundation-state-machine.iserrorcustomevent.md +18 -0
- package/docs/api/foundation-state-machine.iserrorevent.md +13 -0
- package/docs/api/foundation-state-machine.iserrortype.md +13 -0
- package/docs/api/foundation-state-machine.isgenesisservererror.md +11 -0
- package/docs/api/foundation-state-machine.ismappingerror.md +11 -0
- package/docs/api/foundation-state-machine.isnetworkerror.md +11 -0
- package/docs/api/foundation-state-machine.isnotfounderror.md +13 -0
- package/docs/api/foundation-state-machine.issyntaxerror.md +15 -0
- package/docs/api/foundation-state-machine.istypeerror.md +15 -0
- package/docs/api/foundation-state-machine.logger.md +12 -0
- package/docs/api/foundation-state-machine.machine.actor.md +18 -0
- package/docs/api/foundation-state-machine.machine.binding.md +47 -0
- package/docs/api/foundation-state-machine.machine.complete.md +13 -0
- package/docs/api/foundation-state-machine.machine.context.md +13 -0
- package/docs/api/foundation-state-machine.machine.error.md +13 -0
- package/docs/api/foundation-state-machine.machine.errors.md +13 -0
- package/docs/api/foundation-state-machine.machine.getfromcontainer.md +35 -0
- package/docs/api/foundation-state-machine.machine.hastag.md +35 -0
- package/docs/api/foundation-state-machine.machine.machine.md +18 -0
- package/docs/api/foundation-state-machine.machine.matches.md +35 -0
- package/docs/api/foundation-state-machine.machine.md +101 -0
- package/docs/api/foundation-state-machine.machine.onsendevent.md +24 -0
- package/docs/api/foundation-state-machine.machine.output.md +13 -0
- package/docs/api/foundation-state-machine.machine.provide.md +44 -0
- package/docs/api/foundation-state-machine.machine.send.md +24 -0
- package/docs/api/foundation-state-machine.machine.start.md +28 -0
- package/docs/api/foundation-state-machine.machine.startingcontext.md +13 -0
- package/docs/api/foundation-state-machine.machine.startingstate.md +13 -0
- package/docs/api/foundation-state-machine.machine.state.md +13 -0
- package/docs/api/foundation-state-machine.machine.stop.md +17 -0
- package/docs/api/foundation-state-machine.machinecontext.error.md +13 -0
- package/docs/api/foundation-state-machine.machinecontext.errors.md +13 -0
- package/docs/api/foundation-state-machine.machinecontext.md +36 -0
- package/docs/api/foundation-state-machine.mappingerror._constructor_.md +21 -0
- package/docs/api/foundation-state-machine.mappingerror.dto.md +11 -0
- package/docs/api/foundation-state-machine.mappingerror.md +27 -0
- package/docs/api/foundation-state-machine.md +81 -0
- package/docs/api/foundation-state-machine.networkerror._constructor_.md +21 -0
- package/docs/api/foundation-state-machine.networkerror.md +31 -0
- package/docs/api/foundation-state-machine.networkerror.url.md +11 -0
- package/docs/api/foundation-state-machine.responsedataextractor.md +18 -0
- package/docs/api/foundation-state-machine.responseokchecker.md +13 -0
- package/docs/api/foundation-state-machine.seterror.md +25 -0
- package/docs/api/foundation-state-machine.seterrorbykey.md +25 -0
- package/docs/api/index.md +12 -0
- package/docs/api-report.md +393 -0
- package/license.txt +46 -0
- 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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) => TReturn) \| keyof this | A target lookup token which can take various forms. |
|
|
20
|
+
| subscriberChangeCallback | SubscriberChangeCallback<TReturn> \| undefined | _(Optional)_ . |
|
|
21
|
+
| isVolatileBinding | boolean | _(Optional)_ Indicates the binding is volatile. |
|
|
22
|
+
| context | ExecutionContext | _(Optional)_ . |
|
|
23
|
+
|
|
24
|
+
**Returns:**
|
|
25
|
+
|
|
26
|
+
BindingObserver<this, TReturn, TParent>
|
|
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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>> | 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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [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<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>> | _(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<TContext> | 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<ErrorDetailMap> | An of errors that may have occurred during the machine's workflows. |
|
|
82
|
+
| [machine](./foundation-state-machine.machine.machine.md) | <code>readonly</code> | StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta> | 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<TContext> | 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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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<TEvent> | 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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true> | <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) > [@genesislcap/foundation-state-machine](./foundation-state-machine.md) > [Machine](./foundation-state-machine.machine.md) > [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
|
+
|