@genesislcap/foundation-state-machine 14.95.0 → 14.96.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/dts/core/actions.d.ts +6 -1
  2. package/dist/dts/core/actions.d.ts.map +1 -1
  3. package/dist/dts/core/errors.d.ts +2 -2
  4. package/dist/dts/core/errors.d.ts.map +1 -1
  5. package/dist/dts/core/guards.d.ts +7 -1
  6. package/dist/dts/core/guards.d.ts.map +1 -1
  7. package/dist/dts/core/machine.d.ts +28 -1
  8. package/dist/dts/core/machine.d.ts.map +1 -1
  9. package/dist/dts/core/state.d.ts.map +1 -1
  10. package/dist/dts/machines/fetch/errors.d.ts +14 -3
  11. package/dist/dts/machines/fetch/errors.d.ts.map +1 -1
  12. package/dist/esm/core/actions.js +23 -8
  13. package/dist/esm/core/guards.js +6 -0
  14. package/dist/esm/core/machine.js +39 -12
  15. package/dist/esm/core/state.js +18 -6
  16. package/dist/esm/machines/fetch/errors.js +11 -0
  17. package/dist/esm/machines/fetch/policies.js +5 -5
  18. package/dist/foundation-state-machine.api.json +464 -11
  19. package/dist/foundation-state-machine.d.ts +59 -7
  20. package/docs/api/foundation-state-machine.abstractmachine.getmetavaluesbykey.md +28 -0
  21. package/docs/api/foundation-state-machine.abstractmachine.md +3 -0
  22. package/docs/api/foundation-state-machine.abstractmachine.meta.md +13 -0
  23. package/docs/api/foundation-state-machine.abstractmachine.snapshot.md +13 -0
  24. package/docs/api/foundation-state-machine.apierror.isunauthorized.md +16 -0
  25. package/docs/api/foundation-state-machine.apierror.md +6 -0
  26. package/docs/api/foundation-state-machine.escalateerror.md +1 -1
  27. package/docs/api/foundation-state-machine.isapierror.md +1 -1
  28. package/docs/api/foundation-state-machine.iseventwithparams.md +13 -0
  29. package/docs/api/foundation-state-machine.isgenesisservererror.md +1 -1
  30. package/docs/api/foundation-state-machine.ismappingerror.md +1 -1
  31. package/docs/api/foundation-state-machine.isnetworkerror.md +1 -1
  32. package/docs/api/foundation-state-machine.isnotfounderror.md +1 -1
  33. package/docs/api/foundation-state-machine.isunauthorizederror.md +13 -0
  34. package/docs/api/foundation-state-machine.machine.getmetavaluesbykey.md +28 -0
  35. package/docs/api/foundation-state-machine.machine.md +3 -0
  36. package/docs/api/foundation-state-machine.machine.meta.md +13 -0
  37. package/docs/api/foundation-state-machine.machine.snapshot.md +13 -0
  38. package/docs/api/foundation-state-machine.md +3 -1
  39. package/docs/api-report.md +25 -6
  40. package/package.json +7 -7
@@ -3,7 +3,7 @@
3
3
  import { ActionArgs } from 'xstate';
4
4
  import { AnyActorContext } from 'xstate';
5
5
  import { AnyActorRef } from 'xstate';
6
- import type { AnyEventObject } from 'xstate';
6
+ import { AnyEventObject } from 'xstate';
7
7
  import { AnyState } from 'xstate';
8
8
  import { Assigner } from 'xstate';
9
9
  import { BindingObserver } from '@microsoft/fast-element';
@@ -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
@@ -432,7 +447,7 @@ export declare const isActorErrorEvent: <TData = any>(actorId: string, event: Ev
432
447
  * @param error - An error.
433
448
  * @public
434
449
  */
435
- export declare const isAPIError: (error: unknown) => boolean;
450
+ export declare const isAPIError: (error: unknown) => error is APIError;
436
451
 
437
452
  /**
438
453
  * isDoneInvokeEvent.
@@ -464,23 +479,30 @@ export declare const isErrorEvent: <TData = any>(event: EventObject | ErrorEvent
464
479
  */
465
480
  export declare const isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean;
466
481
 
482
+ /**
483
+ * isEventWithParams.
484
+ * @param event - An event.
485
+ * @public
486
+ */
487
+ export declare const isEventWithParams: (event: AnyEventObject) => event is ParameterizedObject;
488
+
467
489
  /**
468
490
  * @param error - An error.
469
491
  * @public
470
492
  */
471
- export declare const isGenesisServerError: (error: unknown) => boolean;
493
+ export declare const isGenesisServerError: (error: unknown) => error is GenesisServerError;
472
494
 
473
495
  /**
474
496
  * @param error - An error.
475
497
  * @public
476
498
  */
477
- export declare const isMappingError: (error: unknown) => boolean;
499
+ export declare const isMappingError: (error: unknown) => error is MappingError;
478
500
 
479
501
  /**
480
502
  * @param error - An error.
481
503
  * @public
482
504
  */
483
- export declare const isNetworkError: (error: unknown) => boolean;
505
+ export declare const isNetworkError: (error: unknown) => error is NetworkError;
484
506
 
485
507
  /**
486
508
  * @param error - An error.
@@ -488,7 +510,7 @@ export declare const isNetworkError: (error: unknown) => boolean;
488
510
  */
489
511
  export declare const isNotFoundError: (error: {
490
512
  status?: number;
491
- }) => boolean;
513
+ }) => error is APIError;
492
514
 
493
515
  /**
494
516
  * isSyntaxError.
@@ -506,6 +528,14 @@ export declare const isTypeError: ({ event }: {
506
528
  event: any;
507
529
  }) => boolean;
508
530
 
531
+ /**
532
+ * @param error - An error.
533
+ * @public
534
+ */
535
+ export declare const isUnauthorizedError: (error: {
536
+ status?: number;
537
+ }) => error is APIError;
538
+
509
539
  /**
510
540
  * @public
511
541
  */
@@ -580,6 +610,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
580
610
  * Callers can decide to reuse/reference if set or create their own.
581
611
  */
582
612
  readonly actor?: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
613
+ /**
614
+ * The last `snapshot` from the actor.
615
+ */
616
+ readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
583
617
  /**
584
618
  * The current `state` of the machine itself. This is not to be confused with state in the data or store sense.
585
619
  */
@@ -599,6 +633,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
599
633
  * The `context` of the machine when started.
600
634
  */
601
635
  readonly startingContext: Partial<TContext>;
636
+ /**
637
+ * The `meta` from the current `state`.
638
+ */
639
+ readonly meta: Record<string, any>;
602
640
  /**
603
641
  * Indicates if the machine has completed the happy path.
604
642
  */
@@ -684,6 +722,15 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
684
722
  * @param tag - A tag.
685
723
  */
686
724
  hasTag(tag: string): boolean;
725
+ /**
726
+ * Get `meta` values by key.
727
+ *
728
+ * @remarks
729
+ * Meta is cumulative across all state nodes represented by the state value.
730
+ *
731
+ * @param key - A key within the `meta` object. Defaults to `content`.
732
+ */
733
+ getMetaValuesByKey<T = string>(key?: string): T[];
687
734
  /**
688
735
  * An api to send events to the machine.
689
736
  *
@@ -821,6 +868,8 @@ export declare type ResponseOkChecker = (response: Response) => boolean;
821
868
  * Set error action.
822
869
  * @remarks
823
870
  * Used to set a top level error on the machine. This may equal to {@link @genesislcap/foundation-utils#ErrorMap} `lastError` in the `errors` property.
871
+ * @privateRemarks
872
+ * Contains done event handling to deal with 200 Nacks.
824
873
  * @public
825
874
  */
826
875
  export declare const setError: {
@@ -836,6 +885,9 @@ export declare const setError: {
836
885
  * Set error by key action.
837
886
  * @remarks
838
887
  * Used to set an error in the {@link @genesislcap/foundation-utils#ErrorMap} by key.
888
+ * @privateRemarks
889
+ * Contains done event handling to deal with 200 Nacks. If done output is an error use it, or fallback to `context.error`
890
+ * and set that under the provided key.
839
891
  * @param key - The error key.
840
892
  * @public
841
893
  */
@@ -0,0 +1,28 @@
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; [AbstractMachine](./foundation-state-machine.abstractmachine.md) &gt; [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&lt;ErrorDetailMap&gt; | An of errors that may have occurred during the machine's workflows. |
25
25
  | [machine](./foundation-state-machine.abstractmachine.machine.md) | | StateMachine&lt;TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta&gt; | Mandatory machine property. |
26
+ | [meta](./foundation-state-machine.abstractmachine.meta.md) | | Record&lt;string, any&gt; | The <code>meta</code> from the current <code>state</code>. |
26
27
  | [onSendEvent](./foundation-state-machine.abstractmachine.onsendevent.md) | | (event: CustomEvent&lt;TEvent&gt;) =&gt; 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&lt;TContext, TEvent, TActor, TResolvedTypesMeta&gt; | The last <code>snapshot</code> from the actor. |
28
30
  | [startingContext](./foundation-state-machine.abstractmachine.startingcontext.md) | | Partial&lt;TContext&gt; | 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) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [AbstractMachine](./foundation-state-machine.abstractmachine.md) &gt; [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) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [AbstractMachine](./foundation-state-machine.abstractmachine.md) &gt; [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) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [APIError](./foundation-state-machine.apierror.md) &gt; [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
+
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## escalateError variable
6
6
 
7
- Escalate error action.
7
+ Escalate context error action.
8
8
 
9
9
  **Signature:**
10
10
 
@@ -7,5 +7,5 @@
7
7
  **Signature:**
8
8
 
9
9
  ```typescript
10
- isAPIError: (error: unknown) => boolean
10
+ isAPIError: (error: unknown) => error is APIError
11
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; [isEventWithParams](./foundation-state-machine.iseventwithparams.md)
4
+
5
+ ## isEventWithParams variable
6
+
7
+ isEventWithParams.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ isEventWithParams: (event: AnyEventObject) => event is ParameterizedObject
13
+ ```
@@ -7,5 +7,5 @@
7
7
  **Signature:**
8
8
 
9
9
  ```typescript
10
- isGenesisServerError: (error: unknown) => boolean
10
+ isGenesisServerError: (error: unknown) => error is GenesisServerError
11
11
  ```
@@ -7,5 +7,5 @@
7
7
  **Signature:**
8
8
 
9
9
  ```typescript
10
- isMappingError: (error: unknown) => boolean
10
+ isMappingError: (error: unknown) => error is MappingError
11
11
  ```
@@ -7,5 +7,5 @@
7
7
  **Signature:**
8
8
 
9
9
  ```typescript
10
- isNetworkError: (error: unknown) => boolean
10
+ isNetworkError: (error: unknown) => error is NetworkError
11
11
  ```
@@ -9,5 +9,5 @@
9
9
  ```typescript
10
10
  isNotFoundError: (error: {
11
11
  status?: number;
12
- }) => boolean
12
+ }) => error is APIError
13
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; [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) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [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&lt;ErrorDetailMap&gt; | 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&lt;TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta&gt; | Mandatory machine property. |
83
+ | [meta](./foundation-state-machine.machine.meta.md) | <code>readonly</code> | Record&lt;string, any&gt; | 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&lt;TContext, TEvent, TActor, TResolvedTypesMeta&gt; | The last <code>snapshot</code> from the actor. |
84
86
  | [startingContext](./foundation-state-machine.machine.startingcontext.md) | <code>readonly</code> | Partial&lt;TContext&gt; | 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) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [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) &gt; [@genesislcap/foundation-state-machine](./foundation-state-machine.md) &gt; [Machine](./foundation-state-machine.machine.md) &gt; [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,7 +50,7 @@
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
56
  | [isAPIError](./foundation-state-machine.isapierror.md) | |
@@ -58,12 +58,14 @@
58
58
  | [isErrorCustomEvent](./foundation-state-machine.iserrorcustomevent.md) | isErrorCustomEvent. |
59
59
  | [isErrorEvent](./foundation-state-machine.iserrorevent.md) | isErrorEvent. |
60
60
  | [isErrorType](./foundation-state-machine.iserrortype.md) | isErrorType. |
61
+ | [isEventWithParams](./foundation-state-machine.iseventwithparams.md) | isEventWithParams. |
61
62
  | [isGenesisServerError](./foundation-state-machine.isgenesisservererror.md) | |
62
63
  | [isMappingError](./foundation-state-machine.ismappingerror.md) | |
63
64
  | [isNetworkError](./foundation-state-machine.isnetworkerror.md) | |
64
65
  | [isNotFoundError](./foundation-state-machine.isnotfounderror.md) | |
65
66
  | [isSyntaxError](./foundation-state-machine.issyntaxerror.md) | isSyntaxError. |
66
67
  | [isTypeError](./foundation-state-machine.istypeerror.md) | isTypeError. |
68
+ | [isUnauthorizedError](./foundation-state-machine.isunauthorizederror.md) | |
67
69
  | [logger](./foundation-state-machine.logger.md) | |
68
70
  | [setError](./foundation-state-machine.seterror.md) | Set error action. |
69
71
  | [setErrorByKey](./foundation-state-machine.seterrorbykey.md) | Set error by key action. |
@@ -9,7 +9,7 @@
9
9
  import { ActionArgs } from 'xstate';
10
10
  import { AnyActorContext } from 'xstate';
11
11
  import { AnyActorRef } from 'xstate';
12
- import type { AnyEventObject } from 'xstate';
12
+ import { AnyEventObject } from 'xstate';
13
13
  import { AnyState } from 'xstate';
14
14
  import { Assigner } from 'xstate';
15
15
  import { BindingObserver } from '@microsoft/fast-element';
@@ -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
 
@@ -254,7 +262,7 @@ export const isAbortError: ({ event }: {
254
262
  export const isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent_2<TData>) => event is ErrorEvent_2<TData>;
255
263
 
256
264
  // @public (undocumented)
257
- export const isAPIError: (error: unknown) => boolean;
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>;
@@ -268,19 +276,22 @@ export const isErrorEvent: <TData = any>(event: EventObject | ErrorEvent_2<TData
268
276
  // @public
269
277
  export const isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean;
270
278
 
279
+ // @public
280
+ export const isEventWithParams: (event: AnyEventObject) => event is ParameterizedObject;
281
+
271
282
  // @public (undocumented)
272
- export const isGenesisServerError: (error: unknown) => boolean;
283
+ export const isGenesisServerError: (error: unknown) => error is GenesisServerError;
273
284
 
274
285
  // @public (undocumented)
275
- export const isMappingError: (error: unknown) => boolean;
286
+ export const isMappingError: (error: unknown) => error is MappingError;
276
287
 
277
288
  // @public (undocumented)
278
- export const isNetworkError: (error: unknown) => boolean;
289
+ export const isNetworkError: (error: unknown) => error is NetworkError;
279
290
 
280
291
  // @public (undocumented)
281
292
  export const isNotFoundError: (error: {
282
293
  status?: number;
283
- }) => boolean;
294
+ }) => error is APIError;
284
295
 
285
296
  // @public
286
297
  export const isSyntaxError: ({ event }: {
@@ -292,6 +303,11 @@ export const isTypeError: ({ event }: {
292
303
  event: any;
293
304
  }) => boolean;
294
305
 
306
+ // @public (undocumented)
307
+ export const isUnauthorizedError: (error: {
308
+ status?: number;
309
+ }) => error is APIError;
310
+
295
311
  // @public (undocumented)
296
312
  export const logger: Logger;
297
313
 
@@ -305,13 +321,16 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
305
321
  readonly error: any;
306
322
  readonly errors: ErrorMap<ErrorDetailMap>;
307
323
  getFromContainer(): this;
324
+ getMetaValuesByKey<T = string>(key?: string): T[];
308
325
  hasTag(tag: string): boolean;
309
326
  readonly machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
310
327
  matches(value: StateValueFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): boolean;
328
+ readonly meta: Record<string, any>;
311
329
  onSendEvent(event: CustomEvent<TEvent>): void;
312
330
  readonly output: any;
313
331
  provide(implementations: InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true>): void;
314
332
  send(event: TEvent): void;
333
+ readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
315
334
  start(options?: InterpreterOptions<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): any;
316
335
  readonly startingContext: Partial<TContext>;
317
336
  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.95.0",
4
+ "version": "14.96.1",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -34,14 +34,14 @@
34
34
  "test": "genx test"
35
35
  },
36
36
  "devDependencies": {
37
- "@genesislcap/foundation-testing": "14.95.0",
38
- "@genesislcap/genx": "14.95.0",
37
+ "@genesislcap/foundation-testing": "14.96.1",
38
+ "@genesislcap/genx": "14.96.1",
39
39
  "rimraf": "^3.0.2"
40
40
  },
41
41
  "dependencies": {
42
- "@genesislcap/foundation-comms": "14.95.0",
43
- "@genesislcap/foundation-logger": "14.95.0",
44
- "@genesislcap/foundation-utils": "14.95.0",
42
+ "@genesislcap/foundation-comms": "14.96.1",
43
+ "@genesislcap/foundation-logger": "14.96.1",
44
+ "@genesislcap/foundation-utils": "14.96.1",
45
45
  "@microsoft/fast-element": "^1.7.0",
46
46
  "@microsoft/fast-foundation": "^2.33.2",
47
47
  "cockatiel": "^3.1.1",
@@ -57,5 +57,5 @@
57
57
  "publishConfig": {
58
58
  "access": "public"
59
59
  },
60
- "gitHead": "c104bd1dbc712b08c2e279f71f1f3ba2fca5c34c"
60
+ "gitHead": "48d09fe0db8cfe16fa806a5f098a0fb0405ffcbb"
61
61
  }