@genesislcap/foundation-state-machine 14.71.1-auth-mf.4 → 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.
@@ -1,7 +1,7 @@
1
1
  import { ErrorDetailMap, ErrorMap } from '@genesislcap/foundation-utils';
2
2
  import { BindingObserver, ExecutionContext } from '@microsoft/fast-element';
3
3
  import { Container } from '@microsoft/fast-foundation';
4
- import type { AnyEventObject, EventObject, InternalMachineImplementations, InterpreterFrom, InterpreterOptions, MachineContext as XMachineContext, NoInfer, ParameterizedObject, ProvidedActor, ResolveTypegenMeta, StateMachine, StateValue, StateValueFrom, TypegenDisabled } from 'xstate';
4
+ import type { AnyEventObject, EventObject, InternalMachineImplementations, InterpreterFrom, InterpreterOptions, MachineContext as XMachineContext, NoInfer, ParameterizedObject, ProvidedActor, ResolveTypegenMeta, State, StateMachine, StateValue, StateValueFrom, TypegenDisabled } from 'xstate';
5
5
  import { SubscriberChangeCallback } from './binding';
6
6
  /**
7
7
  * MachineContext interface.
@@ -97,6 +97,10 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
97
97
  * Callers can decide to reuse/reference if set or create their own.
98
98
  */
99
99
  readonly actor?: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
100
+ /**
101
+ * The last `snapshot` from the actor.
102
+ */
103
+ readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
100
104
  /**
101
105
  * The current `state` of the machine itself. This is not to be confused with state in the data or store sense.
102
106
  */
@@ -116,6 +120,10 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
116
120
  * The `context` of the machine when started.
117
121
  */
118
122
  readonly startingContext: Partial<TContext>;
123
+ /**
124
+ * The `meta` from the current `state`.
125
+ */
126
+ readonly meta: Record<string, any>;
119
127
  /**
120
128
  * Indicates if the machine has completed the happy path.
121
129
  */
@@ -201,6 +209,15 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
201
209
  * @param tag - A tag.
202
210
  */
203
211
  hasTag(tag: string): boolean;
212
+ /**
213
+ * Get `meta` values by key.
214
+ *
215
+ * @remarks
216
+ * Meta is cumulative across all state nodes represented by the state value.
217
+ *
218
+ * @param key - A key within the `meta` object. Defaults to `content`.
219
+ */
220
+ getMetaValuesByKey<T = string>(key?: string): T[];
204
221
  /**
205
222
  * An api to send events to the machine.
206
223
  *
@@ -276,6 +293,8 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
276
293
  machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
277
294
  /** {@inheritDoc Machine.actor} */
278
295
  actor: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
296
+ /** {@inheritDoc Machine.snapshot} */
297
+ snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
279
298
  /** {@inheritDoc Machine.state} */
280
299
  state: StateValue;
281
300
  /** {@inheritDoc Machine.startingState} */
@@ -284,6 +303,8 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
284
303
  context: Partial<TContext>;
285
304
  /** {@inheritDoc Machine.startingContext} */
286
305
  startingContext: Partial<TContext>;
306
+ /** {@inheritDoc Machine.meta} */
307
+ meta: Record<string, any>;
287
308
  /** {@inheritDoc Machine.complete} */
288
309
  complete: boolean;
289
310
  /** {@inheritDoc Machine.output} */
@@ -308,6 +329,10 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
308
329
  * @internal
309
330
  */
310
331
  protected subscribe(): void;
332
+ /**
333
+ * @internal
334
+ */
335
+ protected applySnapshot(snapshot?: typeof this.snapshot): void;
311
336
  /**
312
337
  * @internal
313
338
  */
@@ -326,6 +351,8 @@ export declare abstract class AbstractMachine<TContext extends MachineContext, T
326
351
  matches(value: StateValueFrom<typeof this.machine>): boolean;
327
352
  /** {@inheritDoc Machine.hasTag} */
328
353
  hasTag(tag: string): boolean;
354
+ /** {@inheritDoc Machine.getMetaValuesByKey} */
355
+ getMetaValuesByKey<T = string>(key?: string): T[];
329
356
  /** {@inheritDoc Machine.send} */
330
357
  send(event: TEvent): void;
331
358
  /** {@inheritDoc Machine.onSendEvent} */
@@ -1 +1 @@
1
- {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/core/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EACL,eAAe,EAEf,gBAAgB,EAGjB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,8BAA8B,EAC9B,eAAe,EACf,kBAAkB,EAClB,cAAc,IAAI,eAAe,EACjC,OAAO,EACP,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,cAAc,EAEd,eAAe,EAChB,MAAM,QAAQ,CAAC;AAGhB,OAAO,EAAe,wBAAwB,EAAoB,MAAM,WAAW,CAAC;AAEpF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAC1C;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AACH,MAAM,WAAW,OAAO,CACtB,QAAQ,SAAS,cAAc,EAC/B,MAAM,SAAS,WAAW,GAAG,cAAc,EAC3C,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EACzD,MAAM,SAAS,aAAa,GAAG,aAAa,EAC5C,MAAM,GAAG,GAAG,EACZ,kBAAkB,GAAG,kBAAkB,CAAC,eAAe,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,OAA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ACN,kBAAkB,EAClB,IAAI,CACL;IAYH,oCAAoC;IACpC,OAAO,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC;IAOlD,mCAAmC;IACnC,MAAM,CAAC,GAAG,EAAE,MAAM;IAOlB,+CAA+C;IAC/C,kBAAkB,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,GAAE,MAAkB,GAAG,CAAC,EAAE;IAU5D,iCAAiC;IACjC,IAAI,CAAC,KAAK,EAAE,MAAM;IAIlB,wCAAwC;IACxC,WAAW,UAAW,YAAY,MAAM,CAAC,UAEvC;IAEF,oCAAoC;IACpC,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,OAAO,GAAG,GAAG,EAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,MAAM,IAAI,EAC/C,wBAAwB,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,GAAG,SAAS,EACxE,iBAAiB,GAAE,OAAe,EAClC,OAAO,GAAE,gBAA0C,GAClD,eAAe,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC;IAc1C,6CAA6C;IAC7C,QAAQ,CAAC,gBAAgB,IAAI,IAAI;CAClC"}
@@ -42,12 +42,13 @@ export class AbstractMachine {
42
42
  this.startingContext = (options.input
43
43
  ? Object.assign(Object.assign({}, contextWithErrors), options.input) : contextWithErrors);
44
44
  this.actor = interpret(this.machine, Object.assign(Object.assign({}, options), { input: this.startingContext, state: this.startingState }));
45
- const { value: currentValue, context: currentContext } = this.actor.getSnapshot();
46
- this.state = currentValue;
47
- this.context = currentContext;
45
+ this.snapshot = this.actor.getSnapshot();
46
+ this.state = this.snapshot.value;
47
+ this.context = this.snapshot.context;
48
+ this.meta = this.snapshot.meta;
48
49
  this.complete = false;
49
50
  this.output = undefined;
50
- this.errors = currentContext.errors;
51
+ this.errors = this.context.errors;
51
52
  this.error = undefined;
52
53
  }
53
54
  /**
@@ -59,24 +60,34 @@ export class AbstractMachine {
59
60
  }
60
61
  this.subscription = this.actor.subscribe({
61
62
  next: (snapshot) => {
62
- var _a;
63
- this.state = snapshot.value;
64
- this.context = snapshot.context;
65
- this.errors = this.context.errors;
66
- this.error = (_a = this.context.error) !== null && _a !== void 0 ? _a : this.errors.lastError;
63
+ this.applySnapshot(snapshot);
67
64
  logger.debug(`${this.machine.id} changed, state:`, this.state, `context:`, this.context);
68
65
  },
69
66
  error: (err) => {
67
+ this.applySnapshot();
70
68
  this.error = err;
71
69
  logger.error(`${this.machine.id} error:`, err);
72
70
  },
73
71
  complete: () => {
72
+ this.applySnapshot();
74
73
  this.complete = true;
75
- this.output = this.actor.getSnapshot().output;
74
+ this.output = this.snapshot.output;
76
75
  logger.debug(`${this.machine.id} complete:`, this.output);
77
76
  },
78
77
  });
79
78
  }
79
+ /**
80
+ * @internal
81
+ */
82
+ applySnapshot(snapshot = this.actor.getSnapshot()) {
83
+ var _a;
84
+ this.snapshot = snapshot;
85
+ this.state = this.snapshot.value;
86
+ this.context = this.snapshot.context;
87
+ this.meta = this.snapshot.meta;
88
+ this.errors = this.context.errors;
89
+ this.error = (_a = this.context.error) !== null && _a !== void 0 ? _a : this.errors.lastError;
90
+ }
80
91
  /**
81
92
  * @internal
82
93
  */
@@ -117,14 +128,24 @@ export class AbstractMachine {
117
128
  if (!this.actor) {
118
129
  throw new Error('Call interpret() before calling matches()');
119
130
  }
120
- return this.actor.getSnapshot().matches(value);
131
+ return this.snapshot.matches(value);
121
132
  }
122
133
  /** {@inheritDoc Machine.hasTag} */
123
134
  hasTag(tag) {
124
135
  if (!this.actor) {
125
136
  throw new Error('Call interpret() before calling hasTag()');
126
137
  }
127
- return this.actor.getSnapshot().hasTag(tag);
138
+ return this.snapshot.hasTag(tag);
139
+ }
140
+ /** {@inheritDoc Machine.getMetaValuesByKey} */
141
+ getMetaValuesByKey(key = 'content') {
142
+ const metaValues = [];
143
+ if (this.meta) {
144
+ for (const value of Object.values(this.meta)) {
145
+ metaValues.push(typeof value === 'object' ? value[key] : value);
146
+ }
147
+ }
148
+ return metaValues;
128
149
  }
129
150
  /** {@inheritDoc Machine.send} */
130
151
  send(event) {
@@ -154,6 +175,9 @@ __decorate([
154
175
  __decorate([
155
176
  observable
156
177
  ], AbstractMachine.prototype, "actor", void 0);
178
+ __decorate([
179
+ observable
180
+ ], AbstractMachine.prototype, "snapshot", void 0);
157
181
  __decorate([
158
182
  observable
159
183
  ], AbstractMachine.prototype, "state", void 0);
@@ -166,6 +190,9 @@ __decorate([
166
190
  __decorate([
167
191
  observable
168
192
  ], AbstractMachine.prototype, "startingContext", void 0);
193
+ __decorate([
194
+ observable
195
+ ], AbstractMachine.prototype, "meta", void 0);
169
196
  __decorate([
170
197
  observable
171
198
  ], AbstractMachine.prototype, "complete", void 0);
@@ -732,6 +732,75 @@
732
732
  "isAbstract": true,
733
733
  "name": "getFromContainer"
734
734
  },
735
+ {
736
+ "kind": "Method",
737
+ "canonicalReference": "@genesislcap/foundation-state-machine!AbstractMachine#getMetaValuesByKey:member(1)",
738
+ "docComment": "/**\n * Get `meta` values by key.\n *\n * @remarks\n *\n * Meta is cumulative across all state nodes represented by the state value.\n *\n * @param key - A key within the `meta` object. Defaults to `content`.\n */\n",
739
+ "excerptTokens": [
740
+ {
741
+ "kind": "Content",
742
+ "text": "getMetaValuesByKey<T = "
743
+ },
744
+ {
745
+ "kind": "Content",
746
+ "text": "string"
747
+ },
748
+ {
749
+ "kind": "Content",
750
+ "text": ">(key?: "
751
+ },
752
+ {
753
+ "kind": "Content",
754
+ "text": "string"
755
+ },
756
+ {
757
+ "kind": "Content",
758
+ "text": "): "
759
+ },
760
+ {
761
+ "kind": "Content",
762
+ "text": "T[]"
763
+ },
764
+ {
765
+ "kind": "Content",
766
+ "text": ";"
767
+ }
768
+ ],
769
+ "typeParameters": [
770
+ {
771
+ "typeParameterName": "T",
772
+ "constraintTokenRange": {
773
+ "startIndex": 0,
774
+ "endIndex": 0
775
+ },
776
+ "defaultTypeTokenRange": {
777
+ "startIndex": 1,
778
+ "endIndex": 2
779
+ }
780
+ }
781
+ ],
782
+ "isStatic": false,
783
+ "returnTypeTokenRange": {
784
+ "startIndex": 5,
785
+ "endIndex": 6
786
+ },
787
+ "releaseTag": "Public",
788
+ "isProtected": false,
789
+ "overloadIndex": 1,
790
+ "parameters": [
791
+ {
792
+ "parameterName": "key",
793
+ "parameterTypeTokenRange": {
794
+ "startIndex": 3,
795
+ "endIndex": 4
796
+ },
797
+ "isOptional": true
798
+ }
799
+ ],
800
+ "isOptional": false,
801
+ "isAbstract": false,
802
+ "name": "getMetaValuesByKey"
803
+ },
735
804
  {
736
805
  "kind": "Method",
737
806
  "canonicalReference": "@genesislcap/foundation-state-machine!AbstractMachine#hasTag:member(1)",
@@ -877,6 +946,41 @@
877
946
  "isAbstract": false,
878
947
  "name": "matches"
879
948
  },
949
+ {
950
+ "kind": "Property",
951
+ "canonicalReference": "@genesislcap/foundation-state-machine!AbstractMachine#meta:member",
952
+ "docComment": "/**\n * The `meta` from the current `state`.\n */\n",
953
+ "excerptTokens": [
954
+ {
955
+ "kind": "Content",
956
+ "text": "meta: "
957
+ },
958
+ {
959
+ "kind": "Reference",
960
+ "text": "Record",
961
+ "canonicalReference": "!Record:type"
962
+ },
963
+ {
964
+ "kind": "Content",
965
+ "text": "<string, any>"
966
+ },
967
+ {
968
+ "kind": "Content",
969
+ "text": ";"
970
+ }
971
+ ],
972
+ "isReadonly": false,
973
+ "isOptional": false,
974
+ "releaseTag": "Public",
975
+ "name": "meta",
976
+ "propertyTypeTokenRange": {
977
+ "startIndex": 1,
978
+ "endIndex": 3
979
+ },
980
+ "isStatic": false,
981
+ "isProtected": false,
982
+ "isAbstract": false
983
+ },
880
984
  {
881
985
  "kind": "Property",
882
986
  "canonicalReference": "@genesislcap/foundation-state-machine!AbstractMachine#onSendEvent:member",
@@ -1047,6 +1151,41 @@
1047
1151
  "isAbstract": false,
1048
1152
  "name": "send"
1049
1153
  },
1154
+ {
1155
+ "kind": "Property",
1156
+ "canonicalReference": "@genesislcap/foundation-state-machine!AbstractMachine#snapshot:member",
1157
+ "docComment": "/**\n * The last `snapshot` from the actor.\n */\n",
1158
+ "excerptTokens": [
1159
+ {
1160
+ "kind": "Content",
1161
+ "text": "snapshot: "
1162
+ },
1163
+ {
1164
+ "kind": "Reference",
1165
+ "text": "State",
1166
+ "canonicalReference": "xstate!State:class"
1167
+ },
1168
+ {
1169
+ "kind": "Content",
1170
+ "text": "<TContext, TEvent, TActor, TResolvedTypesMeta>"
1171
+ },
1172
+ {
1173
+ "kind": "Content",
1174
+ "text": ";"
1175
+ }
1176
+ ],
1177
+ "isReadonly": false,
1178
+ "isOptional": false,
1179
+ "releaseTag": "Public",
1180
+ "name": "snapshot",
1181
+ "propertyTypeTokenRange": {
1182
+ "startIndex": 1,
1183
+ "endIndex": 3
1184
+ },
1185
+ "isStatic": false,
1186
+ "isProtected": false,
1187
+ "isAbstract": false
1188
+ },
1050
1189
  {
1051
1190
  "kind": "Method",
1052
1191
  "canonicalReference": "@genesislcap/foundation-state-machine!AbstractMachine#start:member(1)",
@@ -4468,6 +4607,72 @@
4468
4607
  "parameters": [],
4469
4608
  "name": "getFromContainer"
4470
4609
  },
4610
+ {
4611
+ "kind": "MethodSignature",
4612
+ "canonicalReference": "@genesislcap/foundation-state-machine!Machine#getMetaValuesByKey:member(1)",
4613
+ "docComment": "/**\n * Get `meta` values by key.\n *\n * @remarks\n *\n * Meta is cumulative across all state nodes represented by the state value.\n *\n * @param key - A key within the `meta` object. Defaults to `content`.\n */\n",
4614
+ "excerptTokens": [
4615
+ {
4616
+ "kind": "Content",
4617
+ "text": "getMetaValuesByKey<T = "
4618
+ },
4619
+ {
4620
+ "kind": "Content",
4621
+ "text": "string"
4622
+ },
4623
+ {
4624
+ "kind": "Content",
4625
+ "text": ">(key?: "
4626
+ },
4627
+ {
4628
+ "kind": "Content",
4629
+ "text": "string"
4630
+ },
4631
+ {
4632
+ "kind": "Content",
4633
+ "text": "): "
4634
+ },
4635
+ {
4636
+ "kind": "Content",
4637
+ "text": "T[]"
4638
+ },
4639
+ {
4640
+ "kind": "Content",
4641
+ "text": ";"
4642
+ }
4643
+ ],
4644
+ "isOptional": false,
4645
+ "returnTypeTokenRange": {
4646
+ "startIndex": 5,
4647
+ "endIndex": 6
4648
+ },
4649
+ "releaseTag": "Public",
4650
+ "overloadIndex": 1,
4651
+ "parameters": [
4652
+ {
4653
+ "parameterName": "key",
4654
+ "parameterTypeTokenRange": {
4655
+ "startIndex": 3,
4656
+ "endIndex": 4
4657
+ },
4658
+ "isOptional": true
4659
+ }
4660
+ ],
4661
+ "typeParameters": [
4662
+ {
4663
+ "typeParameterName": "T",
4664
+ "constraintTokenRange": {
4665
+ "startIndex": 0,
4666
+ "endIndex": 0
4667
+ },
4668
+ "defaultTypeTokenRange": {
4669
+ "startIndex": 1,
4670
+ "endIndex": 2
4671
+ }
4672
+ }
4673
+ ],
4674
+ "name": "getMetaValuesByKey"
4675
+ },
4471
4676
  {
4472
4677
  "kind": "MethodSignature",
4473
4678
  "canonicalReference": "@genesislcap/foundation-state-machine!Machine#hasTag:member(1)",
@@ -4604,6 +4809,38 @@
4604
4809
  ],
4605
4810
  "name": "matches"
4606
4811
  },
4812
+ {
4813
+ "kind": "PropertySignature",
4814
+ "canonicalReference": "@genesislcap/foundation-state-machine!Machine#meta:member",
4815
+ "docComment": "/**\n * The `meta` from the current `state`.\n */\n",
4816
+ "excerptTokens": [
4817
+ {
4818
+ "kind": "Content",
4819
+ "text": "readonly meta: "
4820
+ },
4821
+ {
4822
+ "kind": "Reference",
4823
+ "text": "Record",
4824
+ "canonicalReference": "!Record:type"
4825
+ },
4826
+ {
4827
+ "kind": "Content",
4828
+ "text": "<string, any>"
4829
+ },
4830
+ {
4831
+ "kind": "Content",
4832
+ "text": ";"
4833
+ }
4834
+ ],
4835
+ "isReadonly": true,
4836
+ "isOptional": false,
4837
+ "releaseTag": "Public",
4838
+ "name": "meta",
4839
+ "propertyTypeTokenRange": {
4840
+ "startIndex": 1,
4841
+ "endIndex": 3
4842
+ }
4843
+ },
4607
4844
  {
4608
4845
  "kind": "MethodSignature",
4609
4846
  "canonicalReference": "@genesislcap/foundation-state-machine!Machine#onSendEvent:member(1)",
@@ -4776,6 +5013,38 @@
4776
5013
  ],
4777
5014
  "name": "send"
4778
5015
  },
5016
+ {
5017
+ "kind": "PropertySignature",
5018
+ "canonicalReference": "@genesislcap/foundation-state-machine!Machine#snapshot:member",
5019
+ "docComment": "/**\n * The last `snapshot` from the actor.\n */\n",
5020
+ "excerptTokens": [
5021
+ {
5022
+ "kind": "Content",
5023
+ "text": "readonly snapshot: "
5024
+ },
5025
+ {
5026
+ "kind": "Reference",
5027
+ "text": "State",
5028
+ "canonicalReference": "xstate!State:class"
5029
+ },
5030
+ {
5031
+ "kind": "Content",
5032
+ "text": "<TContext, TEvent, TActor, TResolvedTypesMeta>"
5033
+ },
5034
+ {
5035
+ "kind": "Content",
5036
+ "text": ";"
5037
+ }
5038
+ ],
5039
+ "isReadonly": true,
5040
+ "isOptional": false,
5041
+ "releaseTag": "Public",
5042
+ "name": "snapshot",
5043
+ "propertyTypeTokenRange": {
5044
+ "startIndex": 1,
5045
+ "endIndex": 3
5046
+ }
5047
+ },
4779
5048
  {
4780
5049
  "kind": "MethodSignature",
4781
5050
  "canonicalReference": "@genesislcap/foundation-state-machine!Machine#start:member(1)",
@@ -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} */
@@ -593,6 +604,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
593
604
  * Callers can decide to reuse/reference if set or create their own.
594
605
  */
595
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>;
596
611
  /**
597
612
  * The current `state` of the machine itself. This is not to be confused with state in the data or store sense.
598
613
  */
@@ -612,6 +627,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
612
627
  * The `context` of the machine when started.
613
628
  */
614
629
  readonly startingContext: Partial<TContext>;
630
+ /**
631
+ * The `meta` from the current `state`.
632
+ */
633
+ readonly meta: Record<string, any>;
615
634
  /**
616
635
  * Indicates if the machine has completed the happy path.
617
636
  */
@@ -697,6 +716,15 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
697
716
  * @param tag - A tag.
698
717
  */
699
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[];
700
728
  /**
701
729
  * An api to send events to the machine.
702
730
  *
@@ -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,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
+ ```
@@ -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;
@@ -312,13 +318,16 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
312
318
  readonly error: any;
313
319
  readonly errors: ErrorMap<ErrorDetailMap>;
314
320
  getFromContainer(): this;
321
+ getMetaValuesByKey<T = string>(key?: string): T[];
315
322
  hasTag(tag: string): boolean;
316
323
  readonly machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
317
324
  matches(value: StateValueFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): boolean;
325
+ readonly meta: Record<string, any>;
318
326
  onSendEvent(event: CustomEvent<TEvent>): void;
319
327
  readonly output: any;
320
328
  provide(implementations: InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true>): void;
321
329
  send(event: TEvent): void;
330
+ readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
322
331
  start(options?: InterpreterOptions<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): any;
323
332
  readonly startingContext: Partial<TContext>;
324
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",
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.4",
38
- "@genesislcap/genx": "14.71.1-auth-mf.4",
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.4",
43
- "@genesislcap/foundation-utils": "14.71.1-auth-mf.4",
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": "349e46c5dc26cf11b292dc5cc9c24e88908f3333"
59
+ "gitHead": "cc206db0175582626b829d06ca03b5aaedc3c55d"
60
60
  }