@genesislcap/foundation-state-machine 14.71.1-auth-mf.3 → 14.71.1-auth-mf.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dts/core/actions.d.ts +1 -1
- package/dist/dts/core/actions.d.ts.map +1 -1
- package/dist/dts/core/errors.d.ts +2 -2
- package/dist/dts/core/errors.d.ts.map +1 -1
- package/dist/dts/core/machine.d.ts +28 -1
- package/dist/dts/core/machine.d.ts.map +1 -1
- package/dist/dts/core/state.d.ts.map +1 -1
- package/dist/dts/machines/fetch/errors.d.ts +15 -3
- package/dist/dts/machines/fetch/errors.d.ts.map +1 -1
- package/dist/esm/core/actions.js +2 -5
- package/dist/esm/core/machine.js +39 -12
- package/dist/esm/core/state.js +18 -6
- package/dist/esm/machines/fetch/errors.js +12 -0
- package/dist/foundation-state-machine.api.json +419 -12
- package/dist/foundation-state-machine.d.ts +47 -6
- package/docs/api/foundation-state-machine.abstractmachine.getmetavaluesbykey.md +28 -0
- package/docs/api/foundation-state-machine.abstractmachine.md +3 -0
- package/docs/api/foundation-state-machine.abstractmachine.meta.md +13 -0
- package/docs/api/foundation-state-machine.abstractmachine.snapshot.md +13 -0
- package/docs/api/foundation-state-machine.apierror.isunauthorized.md +16 -0
- package/docs/api/foundation-state-machine.apierror.md +6 -0
- package/docs/api/foundation-state-machine.escalateerror.md +1 -1
- package/docs/api/foundation-state-machine.isapierror.md +3 -1
- package/docs/api/foundation-state-machine.isgenesisservererror.md +1 -1
- package/docs/api/foundation-state-machine.ismappingerror.md +1 -1
- package/docs/api/foundation-state-machine.isnetworkerror.md +1 -1
- package/docs/api/foundation-state-machine.isnotfounderror.md +1 -1
- package/docs/api/foundation-state-machine.isunauthorizederror.md +13 -0
- package/docs/api/foundation-state-machine.machine.getmetavaluesbykey.md +28 -0
- package/docs/api/foundation-state-machine.machine.md +3 -0
- package/docs/api/foundation-state-machine.machine.meta.md +13 -0
- package/docs/api/foundation-state-machine.machine.snapshot.md +13 -0
- package/docs/api/foundation-state-machine.md +3 -2
- package/docs/api-report.md +22 -6
- package/package.json +6 -6
|
@@ -34,6 +34,7 @@ import type { ProvidedActor } from 'xstate';
|
|
|
34
34
|
import type { ResolveTypegenMeta } from 'xstate';
|
|
35
35
|
import { RetryPolicy } from 'cockatiel';
|
|
36
36
|
import { SendExpr } from 'xstate';
|
|
37
|
+
import type { State } from 'xstate';
|
|
37
38
|
import type { StateMachine } from 'xstate';
|
|
38
39
|
import type { StateNodeConfig } from 'xstate';
|
|
39
40
|
import type { StateValue } from 'xstate';
|
|
@@ -56,6 +57,8 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
|
|
|
56
57
|
machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
|
|
57
58
|
/** {@inheritDoc Machine.actor} */
|
|
58
59
|
actor: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
|
|
60
|
+
/** {@inheritDoc Machine.snapshot} */
|
|
61
|
+
snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
59
62
|
/** {@inheritDoc Machine.state} */
|
|
60
63
|
state: StateValue;
|
|
61
64
|
/** {@inheritDoc Machine.startingState} */
|
|
@@ -64,6 +67,8 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
|
|
|
64
67
|
context: Partial<TContext>;
|
|
65
68
|
/** {@inheritDoc Machine.startingContext} */
|
|
66
69
|
startingContext: Partial<TContext>;
|
|
70
|
+
/** {@inheritDoc Machine.meta} */
|
|
71
|
+
meta: Record<string, any>;
|
|
67
72
|
/** {@inheritDoc Machine.complete} */
|
|
68
73
|
complete: boolean;
|
|
69
74
|
/** {@inheritDoc Machine.output} */
|
|
@@ -88,6 +93,10 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
|
|
|
88
93
|
* @internal
|
|
89
94
|
*/
|
|
90
95
|
protected subscribe(): void;
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
protected applySnapshot(snapshot?: typeof AbstractMachine.snapshot): void;
|
|
91
100
|
/**
|
|
92
101
|
* @internal
|
|
93
102
|
*/
|
|
@@ -106,6 +115,8 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
|
|
|
106
115
|
matches(value: StateValueFrom<typeof AbstractMachine.machine>): boolean;
|
|
107
116
|
/** {@inheritDoc Machine.hasTag} */
|
|
108
117
|
hasTag(tag: string): boolean;
|
|
118
|
+
/** {@inheritDoc Machine.getMetaValuesByKey} */
|
|
119
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
109
120
|
/** {@inheritDoc Machine.send} */
|
|
110
121
|
send(event: TEvent): void;
|
|
111
122
|
/** {@inheritDoc Machine.onSendEvent} */
|
|
@@ -126,6 +137,10 @@ export declare class APIError extends Error {
|
|
|
126
137
|
status: number;
|
|
127
138
|
data?: unknown;
|
|
128
139
|
constructor(status: number, data?: unknown, message?: string);
|
|
140
|
+
/**
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
143
|
+
isUnauthorized(): boolean;
|
|
129
144
|
}
|
|
130
145
|
|
|
131
146
|
/**
|
|
@@ -240,7 +255,7 @@ export declare const errorWorkflowInput: (key: string) => ({ context }: {
|
|
|
240
255
|
}) => ErrorWorkflowInput;
|
|
241
256
|
|
|
242
257
|
/**
|
|
243
|
-
* Escalate error action.
|
|
258
|
+
* Escalate context error action.
|
|
244
259
|
* @remarks
|
|
245
260
|
* Guard this call with a parent check to avoid warnings when there's no parent.
|
|
246
261
|
* @public
|
|
@@ -429,10 +444,11 @@ export declare const isAbortError: ({ event }: {
|
|
|
429
444
|
export declare const isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent_2<TData>) => event is ErrorEvent_2<TData>;
|
|
430
445
|
|
|
431
446
|
/**
|
|
447
|
+
* isAPIError.
|
|
432
448
|
* @param error - An error.
|
|
433
449
|
* @public
|
|
434
450
|
*/
|
|
435
|
-
export declare const isAPIError: (error: unknown) =>
|
|
451
|
+
export declare const isAPIError: (error: unknown) => error is APIError;
|
|
436
452
|
|
|
437
453
|
/**
|
|
438
454
|
* isDoneInvokeEvent.
|
|
@@ -468,19 +484,19 @@ export declare const isErrorType: <TType extends ErrorConstructor>(type: TType)
|
|
|
468
484
|
* @param error - An error.
|
|
469
485
|
* @public
|
|
470
486
|
*/
|
|
471
|
-
export declare const isGenesisServerError: (error: unknown) =>
|
|
487
|
+
export declare const isGenesisServerError: (error: unknown) => error is GenesisServerError;
|
|
472
488
|
|
|
473
489
|
/**
|
|
474
490
|
* @param error - An error.
|
|
475
491
|
* @public
|
|
476
492
|
*/
|
|
477
|
-
export declare const isMappingError: (error: unknown) =>
|
|
493
|
+
export declare const isMappingError: (error: unknown) => error is MappingError;
|
|
478
494
|
|
|
479
495
|
/**
|
|
480
496
|
* @param error - An error.
|
|
481
497
|
* @public
|
|
482
498
|
*/
|
|
483
|
-
export declare const isNetworkError: (error: unknown) =>
|
|
499
|
+
export declare const isNetworkError: (error: unknown) => error is NetworkError;
|
|
484
500
|
|
|
485
501
|
/**
|
|
486
502
|
* @param error - An error.
|
|
@@ -488,7 +504,7 @@ export declare const isNetworkError: (error: unknown) => boolean;
|
|
|
488
504
|
*/
|
|
489
505
|
export declare const isNotFoundError: (error: {
|
|
490
506
|
status?: number;
|
|
491
|
-
}) =>
|
|
507
|
+
}) => error is APIError;
|
|
492
508
|
|
|
493
509
|
/**
|
|
494
510
|
* isSyntaxError.
|
|
@@ -506,6 +522,14 @@ export declare const isTypeError: ({ event }: {
|
|
|
506
522
|
event: any;
|
|
507
523
|
}) => boolean;
|
|
508
524
|
|
|
525
|
+
/**
|
|
526
|
+
* @param error - An error.
|
|
527
|
+
* @public
|
|
528
|
+
*/
|
|
529
|
+
export declare const isUnauthorizedError: (error: {
|
|
530
|
+
status?: number;
|
|
531
|
+
}) => error is APIError;
|
|
532
|
+
|
|
509
533
|
/**
|
|
510
534
|
* @public
|
|
511
535
|
*/
|
|
@@ -580,6 +604,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
|
|
|
580
604
|
* Callers can decide to reuse/reference if set or create their own.
|
|
581
605
|
*/
|
|
582
606
|
readonly actor?: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
|
|
607
|
+
/**
|
|
608
|
+
* The last `snapshot` from the actor.
|
|
609
|
+
*/
|
|
610
|
+
readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
583
611
|
/**
|
|
584
612
|
* The current `state` of the machine itself. This is not to be confused with state in the data or store sense.
|
|
585
613
|
*/
|
|
@@ -599,6 +627,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
|
|
|
599
627
|
* The `context` of the machine when started.
|
|
600
628
|
*/
|
|
601
629
|
readonly startingContext: Partial<TContext>;
|
|
630
|
+
/**
|
|
631
|
+
* The `meta` from the current `state`.
|
|
632
|
+
*/
|
|
633
|
+
readonly meta: Record<string, any>;
|
|
602
634
|
/**
|
|
603
635
|
* Indicates if the machine has completed the happy path.
|
|
604
636
|
*/
|
|
@@ -684,6 +716,15 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
|
|
|
684
716
|
* @param tag - A tag.
|
|
685
717
|
*/
|
|
686
718
|
hasTag(tag: string): boolean;
|
|
719
|
+
/**
|
|
720
|
+
* Get `meta` values by key.
|
|
721
|
+
*
|
|
722
|
+
* @remarks
|
|
723
|
+
* Meta is cumulative across all state nodes represented by the state value.
|
|
724
|
+
*
|
|
725
|
+
* @param key - A key within the `meta` object. Defaults to `content`.
|
|
726
|
+
*/
|
|
727
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
687
728
|
/**
|
|
688
729
|
* An api to send events to the machine.
|
|
689
730
|
*
|
|
@@ -0,0 +1,28 @@
|
|
|
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) > [AbstractMachine](./foundation-state-machine.abstractmachine.md) > [getMetaValuesByKey](./foundation-state-machine.abstractmachine.getmetavaluesbykey.md)
|
|
4
|
+
|
|
5
|
+
## AbstractMachine.getMetaValuesByKey() method
|
|
6
|
+
|
|
7
|
+
Get `meta` values by key.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| key | string | _(Optional)_ A key within the <code>meta</code> object. Defaults to <code>content</code>. |
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
T\[\]
|
|
24
|
+
|
|
25
|
+
## Remarks
|
|
26
|
+
|
|
27
|
+
Meta is cumulative across all state nodes represented by the state value.
|
|
28
|
+
|
|
@@ -23,8 +23,10 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
|
|
|
23
23
|
| [error](./foundation-state-machine.abstractmachine.error.md) | | any | A general machine error. Likely equal to <code>errors.lastError</code>. |
|
|
24
24
|
| [errors](./foundation-state-machine.abstractmachine.errors.md) | | ErrorMap<ErrorDetailMap> | An of errors that may have occurred during the machine's workflows. |
|
|
25
25
|
| [machine](./foundation-state-machine.abstractmachine.machine.md) | | StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta> | Mandatory machine property. |
|
|
26
|
+
| [meta](./foundation-state-machine.abstractmachine.meta.md) | | Record<string, any> | The <code>meta</code> from the current <code>state</code>. |
|
|
26
27
|
| [onSendEvent](./foundation-state-machine.abstractmachine.onsendevent.md) | | (event: CustomEvent<TEvent>) => void | A custom event handler to send events to the machine. |
|
|
27
28
|
| [output](./foundation-state-machine.abstractmachine.output.md) | | any | Holds successful machine output if any. |
|
|
29
|
+
| [snapshot](./foundation-state-machine.abstractmachine.snapshot.md) | | State<TContext, TEvent, TActor, TResolvedTypesMeta> | The last <code>snapshot</code> from the actor. |
|
|
28
30
|
| [startingContext](./foundation-state-machine.abstractmachine.startingcontext.md) | | Partial<TContext> | The <code>context</code> of the machine when started. |
|
|
29
31
|
| [startingState](./foundation-state-machine.abstractmachine.startingstate.md) | | StateValue | The <code>state</code> of the machine when started. Allows consumers to start a machine from a persisted state. |
|
|
30
32
|
| [state](./foundation-state-machine.abstractmachine.state.md) | | StateValue | The current <code>state</code> of the machine itself. This is not to be confused with state in the data or store sense. |
|
|
@@ -35,6 +37,7 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
|
|
|
35
37
|
| --- | --- | --- |
|
|
36
38
|
| [binding(token, subscriberChangeCallback, isVolatileBinding, context)](./foundation-state-machine.abstractmachine.binding.md) | | An api to allow the observation of values and arbitrary bindings outside the template engine. |
|
|
37
39
|
| [getFromContainer()](./foundation-state-machine.abstractmachine.getfromcontainer.md) | <code>abstract</code> | Gets the machine from the container. |
|
|
40
|
+
| [getMetaValuesByKey(key)](./foundation-state-machine.abstractmachine.getmetavaluesbykey.md) | | Get <code>meta</code> values by key. |
|
|
38
41
|
| [hasTag(tag)](./foundation-state-machine.abstractmachine.hastag.md) | | Check <code>tags</code> contain provided tag. |
|
|
39
42
|
| [matches(value)](./foundation-state-machine.abstractmachine.matches.md) | | Check <code>state</code> matches provided value. |
|
|
40
43
|
| [provide(implementations)](./foundation-state-machine.abstractmachine.provide.md) | | Recreate the internal machine with the provided implementations. |
|
|
@@ -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) > [AbstractMachine](./foundation-state-machine.abstractmachine.md) > [meta](./foundation-state-machine.abstractmachine.meta.md)
|
|
4
|
+
|
|
5
|
+
## AbstractMachine.meta property
|
|
6
|
+
|
|
7
|
+
The `meta` from the current `state`<!-- -->.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
meta: Record<string, 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) > [AbstractMachine](./foundation-state-machine.abstractmachine.md) > [snapshot](./foundation-state-machine.abstractmachine.snapshot.md)
|
|
4
|
+
|
|
5
|
+
## AbstractMachine.snapshot property
|
|
6
|
+
|
|
7
|
+
The last `snapshot` from the actor.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
13
|
+
```
|
|
@@ -0,0 +1,16 @@
|
|
|
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) > [APIError](./foundation-state-machine.apierror.md) > [isUnauthorized](./foundation-state-machine.apierror.isunauthorized.md)
|
|
4
|
+
|
|
5
|
+
## APIError.isUnauthorized() method
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
**Signature:**
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
isUnauthorized(): boolean;
|
|
12
|
+
```
|
|
13
|
+
**Returns:**
|
|
14
|
+
|
|
15
|
+
boolean
|
|
16
|
+
|
|
@@ -30,3 +30,9 @@ Bad server `Response`<!-- -->.
|
|
|
30
30
|
| [data?](./foundation-state-machine.apierror.data.md) | | unknown | _(Optional)_ |
|
|
31
31
|
| [status](./foundation-state-machine.apierror.status.md) | | number | |
|
|
32
32
|
|
|
33
|
+
## Methods
|
|
34
|
+
|
|
35
|
+
| Method | Modifiers | Description |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| [isUnauthorized()](./foundation-state-machine.apierror.isunauthorized.md) | | |
|
|
38
|
+
|
|
@@ -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) > [isUnauthorizedError](./foundation-state-machine.isunauthorizederror.md)
|
|
4
|
+
|
|
5
|
+
## isUnauthorizedError variable
|
|
6
|
+
|
|
7
|
+
**Signature:**
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
isUnauthorizedError: (error: {
|
|
11
|
+
status?: number;
|
|
12
|
+
}) => error is APIError
|
|
13
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
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) > [getMetaValuesByKey](./foundation-state-machine.machine.getmetavaluesbykey.md)
|
|
4
|
+
|
|
5
|
+
## Machine.getMetaValuesByKey() method
|
|
6
|
+
|
|
7
|
+
Get `meta` values by key.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
| Parameter | Type | Description |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| key | string | _(Optional)_ A key within the <code>meta</code> object. Defaults to <code>content</code>. |
|
|
20
|
+
|
|
21
|
+
**Returns:**
|
|
22
|
+
|
|
23
|
+
T\[\]
|
|
24
|
+
|
|
25
|
+
## Remarks
|
|
26
|
+
|
|
27
|
+
Meta is cumulative across all state nodes represented by the state value.
|
|
28
|
+
|
|
@@ -80,7 +80,9 @@ this.myMachine.binding((x) => x.context.data, (value) => {
|
|
|
80
80
|
| [error](./foundation-state-machine.machine.error.md) | <code>readonly</code> | any | A general machine error. Likely equal to <code>errors.lastError</code>. |
|
|
81
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
82
|
| [machine](./foundation-state-machine.machine.machine.md) | <code>readonly</code> | StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta> | Mandatory machine property. |
|
|
83
|
+
| [meta](./foundation-state-machine.machine.meta.md) | <code>readonly</code> | Record<string, any> | The <code>meta</code> from the current <code>state</code>. |
|
|
83
84
|
| [output](./foundation-state-machine.machine.output.md) | <code>readonly</code> | any | Holds successful machine output if any. |
|
|
85
|
+
| [snapshot](./foundation-state-machine.machine.snapshot.md) | <code>readonly</code> | State<TContext, TEvent, TActor, TResolvedTypesMeta> | The last <code>snapshot</code> from the actor. |
|
|
84
86
|
| [startingContext](./foundation-state-machine.machine.startingcontext.md) | <code>readonly</code> | Partial<TContext> | The <code>context</code> of the machine when started. |
|
|
85
87
|
| [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
88
|
| [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. |
|
|
@@ -91,6 +93,7 @@ this.myMachine.binding((x) => x.context.data, (value) => {
|
|
|
91
93
|
| --- | --- |
|
|
92
94
|
| [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
95
|
| [getFromContainer()](./foundation-state-machine.machine.getfromcontainer.md) | Gets the machine from the container. |
|
|
96
|
+
| [getMetaValuesByKey(key)](./foundation-state-machine.machine.getmetavaluesbykey.md) | Get <code>meta</code> values by key. |
|
|
94
97
|
| [hasTag(tag)](./foundation-state-machine.machine.hastag.md) | Check <code>tags</code> contain provided tag. |
|
|
95
98
|
| [matches(value)](./foundation-state-machine.machine.matches.md) | Check <code>state</code> matches provided value. |
|
|
96
99
|
| [onSendEvent(event)](./foundation-state-machine.machine.onsendevent.md) | A custom event handler to send events to the machine. |
|
|
@@ -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) > [meta](./foundation-state-machine.machine.meta.md)
|
|
4
|
+
|
|
5
|
+
## Machine.meta property
|
|
6
|
+
|
|
7
|
+
The `meta` from the current `state`<!-- -->.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
readonly meta: Record<string, 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) > [snapshot](./foundation-state-machine.machine.snapshot.md)
|
|
4
|
+
|
|
5
|
+
## Machine.snapshot property
|
|
6
|
+
|
|
7
|
+
The last `snapshot` from the actor.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
13
|
+
```
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
| [defaultResponseOkChecker](./foundation-state-machine.defaultresponseokchecker.md) | ResponseOkChecker type. |
|
|
51
51
|
| [defaultRetryStatsCodes](./foundation-state-machine.defaultretrystatscodes.md) | Default retry stats codes. |
|
|
52
52
|
| [errorWorkflowInput](./foundation-state-machine.errorworkflowinput.md) | Error workflow input. |
|
|
53
|
-
| [escalateError](./foundation-state-machine.escalateerror.md) | Escalate error action. |
|
|
53
|
+
| [escalateError](./foundation-state-machine.escalateerror.md) | Escalate context error action. |
|
|
54
54
|
| [isAbortError](./foundation-state-machine.isaborterror.md) | isAbortError. |
|
|
55
55
|
| [isActorErrorEvent](./foundation-state-machine.isactorerrorevent.md) | isActorErrorEvent. |
|
|
56
|
-
| [isAPIError](./foundation-state-machine.isapierror.md) |
|
|
56
|
+
| [isAPIError](./foundation-state-machine.isapierror.md) | isAPIError. |
|
|
57
57
|
| [isDoneInvokeEvent](./foundation-state-machine.isdoneinvokeevent.md) | isDoneInvokeEvent. |
|
|
58
58
|
| [isErrorCustomEvent](./foundation-state-machine.iserrorcustomevent.md) | isErrorCustomEvent. |
|
|
59
59
|
| [isErrorEvent](./foundation-state-machine.iserrorevent.md) | isErrorEvent. |
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
| [isNotFoundError](./foundation-state-machine.isnotfounderror.md) | |
|
|
65
65
|
| [isSyntaxError](./foundation-state-machine.issyntaxerror.md) | isSyntaxError. |
|
|
66
66
|
| [isTypeError](./foundation-state-machine.istypeerror.md) | isTypeError. |
|
|
67
|
+
| [isUnauthorizedError](./foundation-state-machine.isunauthorizederror.md) | |
|
|
67
68
|
| [logger](./foundation-state-machine.logger.md) | |
|
|
68
69
|
| [setError](./foundation-state-machine.seterror.md) | Set error action. |
|
|
69
70
|
| [setErrorByKey](./foundation-state-machine.seterrorbykey.md) | Set error by key action. |
|
package/docs/api-report.md
CHANGED
|
@@ -40,6 +40,7 @@ import type { ProvidedActor } from 'xstate';
|
|
|
40
40
|
import type { ResolveTypegenMeta } from 'xstate';
|
|
41
41
|
import { RetryPolicy } from 'cockatiel';
|
|
42
42
|
import { SendExpr } from 'xstate';
|
|
43
|
+
import type { State } from 'xstate';
|
|
43
44
|
import type { StateMachine } from 'xstate';
|
|
44
45
|
import type { StateNodeConfig } from 'xstate';
|
|
45
46
|
import type { StateValue } from 'xstate';
|
|
@@ -52,6 +53,8 @@ import { UnifiedArg } from 'xstate';
|
|
|
52
53
|
// @public
|
|
53
54
|
export abstract class AbstractMachine<TContext extends MachineContext, TEvent extends EventObject = AnyEventObject, TAction extends ParameterizedObject = ParameterizedObject, TActor extends ProvidedActor = ProvidedActor, TInput = any, TResolvedTypesMeta = ResolveTypegenMeta<TypegenDisabled, NoInfer<TEvent>, TAction, TActor>> implements Machine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta> {
|
|
54
55
|
actor: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
|
|
56
|
+
// @internal (undocumented)
|
|
57
|
+
protected applySnapshot(snapshot?: typeof AbstractMachine.snapshot): void;
|
|
55
58
|
// Warning: (ae-incompatible-release-tags) The symbol "binding" is marked as @public, but its signature references "SubscriberChangeCallback" which is marked as @internal
|
|
56
59
|
binding<TReturn = any, TParent = any>(token: ((target: this) => TReturn) | keyof this, subscriberChangeCallback?: SubscriberChangeCallback<TReturn> | undefined, isVolatileBinding?: boolean, context?: ExecutionContext): BindingObserver<this, TReturn, TParent>;
|
|
57
60
|
complete: boolean;
|
|
@@ -61,15 +64,18 @@ export abstract class AbstractMachine<TContext extends MachineContext, TEvent ex
|
|
|
61
64
|
error: any;
|
|
62
65
|
errors: ErrorMap<ErrorDetailMap>;
|
|
63
66
|
abstract getFromContainer(): this;
|
|
67
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
64
68
|
hasTag(tag: string): boolean;
|
|
65
69
|
// @internal (undocumented)
|
|
66
70
|
protected interpret(options?: InterpreterOptions<typeof AbstractMachine.machine>): void;
|
|
67
71
|
machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
|
|
68
72
|
matches(value: StateValueFrom<typeof AbstractMachine.machine>): boolean;
|
|
73
|
+
meta: Record<string, any>;
|
|
69
74
|
onSendEvent: (event: CustomEvent<TEvent>) => void;
|
|
70
75
|
output: any;
|
|
71
76
|
provide(implementations: InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true>): void;
|
|
72
77
|
send(event: TEvent): void;
|
|
78
|
+
snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
73
79
|
start(options?: InterpreterOptions<typeof AbstractMachine.machine>): void;
|
|
74
80
|
// @internal (undocumented)
|
|
75
81
|
protected startActor(): void;
|
|
@@ -91,6 +97,8 @@ export class APIError extends Error {
|
|
|
91
97
|
// (undocumented)
|
|
92
98
|
data?: unknown;
|
|
93
99
|
// (undocumented)
|
|
100
|
+
isUnauthorized(): boolean;
|
|
101
|
+
// (undocumented)
|
|
94
102
|
status: number;
|
|
95
103
|
}
|
|
96
104
|
|
|
@@ -253,8 +261,8 @@ export const isAbortError: ({ event }: {
|
|
|
253
261
|
// @public
|
|
254
262
|
export const isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent_2<TData>) => event is ErrorEvent_2<TData>;
|
|
255
263
|
|
|
256
|
-
// @public
|
|
257
|
-
export const isAPIError: (error: unknown) =>
|
|
264
|
+
// @public
|
|
265
|
+
export const isAPIError: (error: unknown) => error is APIError;
|
|
258
266
|
|
|
259
267
|
// @public
|
|
260
268
|
export const isDoneInvokeEvent: <TData = any>(event: EventObject | DoneInvokeEvent<TData>) => event is DoneInvokeEvent<TData>;
|
|
@@ -269,18 +277,18 @@ export const isErrorEvent: <TData = any>(event: EventObject | ErrorEvent_2<TData
|
|
|
269
277
|
export const isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean;
|
|
270
278
|
|
|
271
279
|
// @public (undocumented)
|
|
272
|
-
export const isGenesisServerError: (error: unknown) =>
|
|
280
|
+
export const isGenesisServerError: (error: unknown) => error is GenesisServerError;
|
|
273
281
|
|
|
274
282
|
// @public (undocumented)
|
|
275
|
-
export const isMappingError: (error: unknown) =>
|
|
283
|
+
export const isMappingError: (error: unknown) => error is MappingError;
|
|
276
284
|
|
|
277
285
|
// @public (undocumented)
|
|
278
|
-
export const isNetworkError: (error: unknown) =>
|
|
286
|
+
export const isNetworkError: (error: unknown) => error is NetworkError;
|
|
279
287
|
|
|
280
288
|
// @public (undocumented)
|
|
281
289
|
export const isNotFoundError: (error: {
|
|
282
290
|
status?: number;
|
|
283
|
-
}) =>
|
|
291
|
+
}) => error is APIError;
|
|
284
292
|
|
|
285
293
|
// @public
|
|
286
294
|
export const isSyntaxError: ({ event }: {
|
|
@@ -292,6 +300,11 @@ export const isTypeError: ({ event }: {
|
|
|
292
300
|
event: any;
|
|
293
301
|
}) => boolean;
|
|
294
302
|
|
|
303
|
+
// @public (undocumented)
|
|
304
|
+
export const isUnauthorizedError: (error: {
|
|
305
|
+
status?: number;
|
|
306
|
+
}) => error is APIError;
|
|
307
|
+
|
|
295
308
|
// @public (undocumented)
|
|
296
309
|
export const logger: Logger;
|
|
297
310
|
|
|
@@ -305,13 +318,16 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
|
|
|
305
318
|
readonly error: any;
|
|
306
319
|
readonly errors: ErrorMap<ErrorDetailMap>;
|
|
307
320
|
getFromContainer(): this;
|
|
321
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
308
322
|
hasTag(tag: string): boolean;
|
|
309
323
|
readonly machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
|
|
310
324
|
matches(value: StateValueFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): boolean;
|
|
325
|
+
readonly meta: Record<string, any>;
|
|
311
326
|
onSendEvent(event: CustomEvent<TEvent>): void;
|
|
312
327
|
readonly output: any;
|
|
313
328
|
provide(implementations: InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true>): void;
|
|
314
329
|
send(event: TEvent): void;
|
|
330
|
+
readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
315
331
|
start(options?: InterpreterOptions<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): any;
|
|
316
332
|
readonly startingContext: Partial<TContext>;
|
|
317
333
|
readonly startingState: StateValue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-state-machine",
|
|
3
3
|
"description": "Genesis Foundation State Machine",
|
|
4
|
-
"version": "14.71.1-auth-mf.
|
|
4
|
+
"version": "14.71.1-auth-mf.6",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test": "genx test"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@genesislcap/foundation-testing": "14.71.1-auth-mf.
|
|
38
|
-
"@genesislcap/genx": "14.71.1-auth-mf.
|
|
37
|
+
"@genesislcap/foundation-testing": "14.71.1-auth-mf.6",
|
|
38
|
+
"@genesislcap/genx": "14.71.1-auth-mf.6",
|
|
39
39
|
"rimraf": "^3.0.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@genesislcap/foundation-comms": "14.71.1-auth-mf.
|
|
43
|
-
"@genesislcap/foundation-utils": "14.71.1-auth-mf.
|
|
42
|
+
"@genesislcap/foundation-comms": "14.71.1-auth-mf.6",
|
|
43
|
+
"@genesislcap/foundation-utils": "14.71.1-auth-mf.6",
|
|
44
44
|
"@microsoft/fast-element": "^1.7.0",
|
|
45
45
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
46
46
|
"cockatiel": "^3.1.1",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "cc206db0175582626b829d06ca03b5aaedc3c55d"
|
|
60
60
|
}
|