@genesislcap/foundation-state-machine 14.71.1-auth-mf.4 → 14.71.1-auth-mf.9
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/guards.d.ts +7 -1
- package/dist/dts/core/guards.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/esm/core/guards.js +6 -0
- package/dist/esm/core/machine.js +39 -12
- package/dist/foundation-state-machine.api.json +315 -0
- package/dist/foundation-state-machine.d.ts +36 -1
- 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.iseventwithparams.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 +1 -0
- package/docs/api-report.md +13 -1
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DoneInvokeEvent, ErrorEvent, EventObject } from 'xstate';
|
|
1
|
+
import { AnyEventObject, DoneInvokeEvent, ErrorEvent, EventObject, ParameterizedObject } from 'xstate';
|
|
2
2
|
/**
|
|
3
3
|
* assertEvent.
|
|
4
4
|
* @privateRemarks
|
|
@@ -37,6 +37,12 @@ export declare const isErrorCustomEvent: <TData = any>(event: EventObject | Erro
|
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
39
|
export declare const isActorErrorEvent: <TData = any>(actorId: string, event: EventObject | ErrorEvent<TData>) => event is ErrorEvent<TData>;
|
|
40
|
+
/**
|
|
41
|
+
* isEventWithParams.
|
|
42
|
+
* @param event - An event.
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export declare const isEventWithParams: (event: AnyEventObject) => event is ParameterizedObject;
|
|
40
46
|
/**
|
|
41
47
|
* isErrorType.
|
|
42
48
|
* @param type - An event type.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/core/guards.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../../src/core/guards.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,WAAW,EACX,mBAAmB,EACpB,MAAM,QAAQ,CAAC;AAEhB;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,SAAS,WAAW,GAAG,WAAW,EAClE,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,GACnB,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAI5D;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,+FAEuC,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,YAAY,qFAE0C,CAAC;AAEpE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,qFAEkC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,yBACnB,MAAM,uEAE8E,CAAC;AAEhG;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAW,cAAc,iCAC3B,CAAC;AAE7B;;;;GAIG;AACH,eAAO,MAAM,WAAW,0EAOrB,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,WAAW;;aAA+C,CAAC;AAExE;;;GAGG;AACH,eAAO,MAAM,aAAa;;aAAiD,CAAC;AAE5E;;;GAGG;AACH,eAAO,MAAM,YAAY;;aAQxB,CAAC"}
|
|
@@ -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,CAA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AE,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"}
|
package/dist/esm/core/guards.js
CHANGED
|
@@ -39,6 +39,12 @@ export const isErrorCustomEvent = (event) => /^xstate.error/.test(event.type);
|
|
|
39
39
|
* @public
|
|
40
40
|
*/
|
|
41
41
|
export const isActorErrorEvent = (actorId, event) => { var _a, _b; return ((_a = event.type) === null || _a === void 0 ? void 0 : _a.includes('error')) && ((_b = event.type) === null || _b === void 0 ? void 0 : _b.includes(actorId)); };
|
|
42
|
+
/**
|
|
43
|
+
* isEventWithParams.
|
|
44
|
+
* @param event - An event.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export const isEventWithParams = (event) => event.params !== undefined;
|
|
42
48
|
/**
|
|
43
49
|
* isErrorType.
|
|
44
50
|
* @param type - An event type.
|
package/dist/esm/core/machine.js
CHANGED
|
@@ -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
|
-
|
|
46
|
-
this.state =
|
|
47
|
-
this.context =
|
|
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 =
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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)",
|
|
@@ -3684,6 +3823,52 @@
|
|
|
3684
3823
|
"endIndex": 4
|
|
3685
3824
|
}
|
|
3686
3825
|
},
|
|
3826
|
+
{
|
|
3827
|
+
"kind": "Variable",
|
|
3828
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!isEventWithParams:var",
|
|
3829
|
+
"docComment": "/**\n * isEventWithParams.\n *\n * @param event - An event.\n *\n * @public\n */\n",
|
|
3830
|
+
"excerptTokens": [
|
|
3831
|
+
{
|
|
3832
|
+
"kind": "Content",
|
|
3833
|
+
"text": "isEventWithParams: "
|
|
3834
|
+
},
|
|
3835
|
+
{
|
|
3836
|
+
"kind": "Content",
|
|
3837
|
+
"text": "(event: "
|
|
3838
|
+
},
|
|
3839
|
+
{
|
|
3840
|
+
"kind": "Reference",
|
|
3841
|
+
"text": "AnyEventObject",
|
|
3842
|
+
"canonicalReference": "xstate!AnyEventObject:interface"
|
|
3843
|
+
},
|
|
3844
|
+
{
|
|
3845
|
+
"kind": "Content",
|
|
3846
|
+
"text": ") => "
|
|
3847
|
+
},
|
|
3848
|
+
{
|
|
3849
|
+
"kind": "Reference",
|
|
3850
|
+
"text": "event",
|
|
3851
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!~event"
|
|
3852
|
+
},
|
|
3853
|
+
{
|
|
3854
|
+
"kind": "Content",
|
|
3855
|
+
"text": " is "
|
|
3856
|
+
},
|
|
3857
|
+
{
|
|
3858
|
+
"kind": "Reference",
|
|
3859
|
+
"text": "ParameterizedObject",
|
|
3860
|
+
"canonicalReference": "xstate!ParameterizedObject:interface"
|
|
3861
|
+
}
|
|
3862
|
+
],
|
|
3863
|
+
"fileUrlPath": "src/core/guards.ts",
|
|
3864
|
+
"isReadonly": true,
|
|
3865
|
+
"releaseTag": "Public",
|
|
3866
|
+
"name": "isEventWithParams",
|
|
3867
|
+
"variableTypeTokenRange": {
|
|
3868
|
+
"startIndex": 1,
|
|
3869
|
+
"endIndex": 7
|
|
3870
|
+
}
|
|
3871
|
+
},
|
|
3687
3872
|
{
|
|
3688
3873
|
"kind": "Variable",
|
|
3689
3874
|
"canonicalReference": "@genesislcap/foundation-state-machine!isGenesisServerError:var",
|
|
@@ -4468,6 +4653,72 @@
|
|
|
4468
4653
|
"parameters": [],
|
|
4469
4654
|
"name": "getFromContainer"
|
|
4470
4655
|
},
|
|
4656
|
+
{
|
|
4657
|
+
"kind": "MethodSignature",
|
|
4658
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!Machine#getMetaValuesByKey:member(1)",
|
|
4659
|
+
"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",
|
|
4660
|
+
"excerptTokens": [
|
|
4661
|
+
{
|
|
4662
|
+
"kind": "Content",
|
|
4663
|
+
"text": "getMetaValuesByKey<T = "
|
|
4664
|
+
},
|
|
4665
|
+
{
|
|
4666
|
+
"kind": "Content",
|
|
4667
|
+
"text": "string"
|
|
4668
|
+
},
|
|
4669
|
+
{
|
|
4670
|
+
"kind": "Content",
|
|
4671
|
+
"text": ">(key?: "
|
|
4672
|
+
},
|
|
4673
|
+
{
|
|
4674
|
+
"kind": "Content",
|
|
4675
|
+
"text": "string"
|
|
4676
|
+
},
|
|
4677
|
+
{
|
|
4678
|
+
"kind": "Content",
|
|
4679
|
+
"text": "): "
|
|
4680
|
+
},
|
|
4681
|
+
{
|
|
4682
|
+
"kind": "Content",
|
|
4683
|
+
"text": "T[]"
|
|
4684
|
+
},
|
|
4685
|
+
{
|
|
4686
|
+
"kind": "Content",
|
|
4687
|
+
"text": ";"
|
|
4688
|
+
}
|
|
4689
|
+
],
|
|
4690
|
+
"isOptional": false,
|
|
4691
|
+
"returnTypeTokenRange": {
|
|
4692
|
+
"startIndex": 5,
|
|
4693
|
+
"endIndex": 6
|
|
4694
|
+
},
|
|
4695
|
+
"releaseTag": "Public",
|
|
4696
|
+
"overloadIndex": 1,
|
|
4697
|
+
"parameters": [
|
|
4698
|
+
{
|
|
4699
|
+
"parameterName": "key",
|
|
4700
|
+
"parameterTypeTokenRange": {
|
|
4701
|
+
"startIndex": 3,
|
|
4702
|
+
"endIndex": 4
|
|
4703
|
+
},
|
|
4704
|
+
"isOptional": true
|
|
4705
|
+
}
|
|
4706
|
+
],
|
|
4707
|
+
"typeParameters": [
|
|
4708
|
+
{
|
|
4709
|
+
"typeParameterName": "T",
|
|
4710
|
+
"constraintTokenRange": {
|
|
4711
|
+
"startIndex": 0,
|
|
4712
|
+
"endIndex": 0
|
|
4713
|
+
},
|
|
4714
|
+
"defaultTypeTokenRange": {
|
|
4715
|
+
"startIndex": 1,
|
|
4716
|
+
"endIndex": 2
|
|
4717
|
+
}
|
|
4718
|
+
}
|
|
4719
|
+
],
|
|
4720
|
+
"name": "getMetaValuesByKey"
|
|
4721
|
+
},
|
|
4471
4722
|
{
|
|
4472
4723
|
"kind": "MethodSignature",
|
|
4473
4724
|
"canonicalReference": "@genesislcap/foundation-state-machine!Machine#hasTag:member(1)",
|
|
@@ -4604,6 +4855,38 @@
|
|
|
4604
4855
|
],
|
|
4605
4856
|
"name": "matches"
|
|
4606
4857
|
},
|
|
4858
|
+
{
|
|
4859
|
+
"kind": "PropertySignature",
|
|
4860
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!Machine#meta:member",
|
|
4861
|
+
"docComment": "/**\n * The `meta` from the current `state`.\n */\n",
|
|
4862
|
+
"excerptTokens": [
|
|
4863
|
+
{
|
|
4864
|
+
"kind": "Content",
|
|
4865
|
+
"text": "readonly meta: "
|
|
4866
|
+
},
|
|
4867
|
+
{
|
|
4868
|
+
"kind": "Reference",
|
|
4869
|
+
"text": "Record",
|
|
4870
|
+
"canonicalReference": "!Record:type"
|
|
4871
|
+
},
|
|
4872
|
+
{
|
|
4873
|
+
"kind": "Content",
|
|
4874
|
+
"text": "<string, any>"
|
|
4875
|
+
},
|
|
4876
|
+
{
|
|
4877
|
+
"kind": "Content",
|
|
4878
|
+
"text": ";"
|
|
4879
|
+
}
|
|
4880
|
+
],
|
|
4881
|
+
"isReadonly": true,
|
|
4882
|
+
"isOptional": false,
|
|
4883
|
+
"releaseTag": "Public",
|
|
4884
|
+
"name": "meta",
|
|
4885
|
+
"propertyTypeTokenRange": {
|
|
4886
|
+
"startIndex": 1,
|
|
4887
|
+
"endIndex": 3
|
|
4888
|
+
}
|
|
4889
|
+
},
|
|
4607
4890
|
{
|
|
4608
4891
|
"kind": "MethodSignature",
|
|
4609
4892
|
"canonicalReference": "@genesislcap/foundation-state-machine!Machine#onSendEvent:member(1)",
|
|
@@ -4776,6 +5059,38 @@
|
|
|
4776
5059
|
],
|
|
4777
5060
|
"name": "send"
|
|
4778
5061
|
},
|
|
5062
|
+
{
|
|
5063
|
+
"kind": "PropertySignature",
|
|
5064
|
+
"canonicalReference": "@genesislcap/foundation-state-machine!Machine#snapshot:member",
|
|
5065
|
+
"docComment": "/**\n * The last `snapshot` from the actor.\n */\n",
|
|
5066
|
+
"excerptTokens": [
|
|
5067
|
+
{
|
|
5068
|
+
"kind": "Content",
|
|
5069
|
+
"text": "readonly snapshot: "
|
|
5070
|
+
},
|
|
5071
|
+
{
|
|
5072
|
+
"kind": "Reference",
|
|
5073
|
+
"text": "State",
|
|
5074
|
+
"canonicalReference": "xstate!State:class"
|
|
5075
|
+
},
|
|
5076
|
+
{
|
|
5077
|
+
"kind": "Content",
|
|
5078
|
+
"text": "<TContext, TEvent, TActor, TResolvedTypesMeta>"
|
|
5079
|
+
},
|
|
5080
|
+
{
|
|
5081
|
+
"kind": "Content",
|
|
5082
|
+
"text": ";"
|
|
5083
|
+
}
|
|
5084
|
+
],
|
|
5085
|
+
"isReadonly": true,
|
|
5086
|
+
"isOptional": false,
|
|
5087
|
+
"releaseTag": "Public",
|
|
5088
|
+
"name": "snapshot",
|
|
5089
|
+
"propertyTypeTokenRange": {
|
|
5090
|
+
"startIndex": 1,
|
|
5091
|
+
"endIndex": 3
|
|
5092
|
+
}
|
|
5093
|
+
},
|
|
4779
5094
|
{
|
|
4780
5095
|
"kind": "MethodSignature",
|
|
4781
5096
|
"canonicalReference": "@genesislcap/foundation-state-machine!Machine#start:member(1)",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { ActionArgs } from 'xstate';
|
|
4
4
|
import { AnyActorContext } from 'xstate';
|
|
5
5
|
import { AnyActorRef } from 'xstate';
|
|
6
|
-
import
|
|
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} */
|
|
@@ -469,6 +480,13 @@ export declare const isErrorEvent: <TData = any>(event: EventObject | ErrorEvent
|
|
|
469
480
|
*/
|
|
470
481
|
export declare const isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean;
|
|
471
482
|
|
|
483
|
+
/**
|
|
484
|
+
* isEventWithParams.
|
|
485
|
+
* @param event - An event.
|
|
486
|
+
* @public
|
|
487
|
+
*/
|
|
488
|
+
export declare const isEventWithParams: (event: AnyEventObject) => event is ParameterizedObject;
|
|
489
|
+
|
|
472
490
|
/**
|
|
473
491
|
* @param error - An error.
|
|
474
492
|
* @public
|
|
@@ -593,6 +611,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
|
|
|
593
611
|
* Callers can decide to reuse/reference if set or create their own.
|
|
594
612
|
*/
|
|
595
613
|
readonly actor?: InterpreterFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>;
|
|
614
|
+
/**
|
|
615
|
+
* The last `snapshot` from the actor.
|
|
616
|
+
*/
|
|
617
|
+
readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
596
618
|
/**
|
|
597
619
|
* The current `state` of the machine itself. This is not to be confused with state in the data or store sense.
|
|
598
620
|
*/
|
|
@@ -612,6 +634,10 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
|
|
|
612
634
|
* The `context` of the machine when started.
|
|
613
635
|
*/
|
|
614
636
|
readonly startingContext: Partial<TContext>;
|
|
637
|
+
/**
|
|
638
|
+
* The `meta` from the current `state`.
|
|
639
|
+
*/
|
|
640
|
+
readonly meta: Record<string, any>;
|
|
615
641
|
/**
|
|
616
642
|
* Indicates if the machine has completed the happy path.
|
|
617
643
|
*/
|
|
@@ -697,6 +723,15 @@ export declare interface Machine<TContext extends MachineContext, TEvent extends
|
|
|
697
723
|
* @param tag - A tag.
|
|
698
724
|
*/
|
|
699
725
|
hasTag(tag: string): boolean;
|
|
726
|
+
/**
|
|
727
|
+
* Get `meta` values by key.
|
|
728
|
+
*
|
|
729
|
+
* @remarks
|
|
730
|
+
* Meta is cumulative across all state nodes represented by the state value.
|
|
731
|
+
*
|
|
732
|
+
* @param key - A key within the `meta` object. Defaults to `content`.
|
|
733
|
+
*/
|
|
734
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
700
735
|
/**
|
|
701
736
|
* An api to send events to the machine.
|
|
702
737
|
*
|
|
@@ -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,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) > [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
|
+
```
|
|
@@ -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
|
+
```
|
|
@@ -58,6 +58,7 @@
|
|
|
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) | |
|
package/docs/api-report.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { ActionArgs } from 'xstate';
|
|
10
10
|
import { AnyActorContext } from 'xstate';
|
|
11
11
|
import { AnyActorRef } from 'xstate';
|
|
12
|
-
import
|
|
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;
|
|
@@ -270,6 +276,9 @@ export const isErrorEvent: <TData = any>(event: EventObject | ErrorEvent_2<TData
|
|
|
270
276
|
// @public
|
|
271
277
|
export const isErrorType: <TType extends ErrorConstructor>(type: TType) => (event: any) => boolean;
|
|
272
278
|
|
|
279
|
+
// @public
|
|
280
|
+
export const isEventWithParams: (event: AnyEventObject) => event is ParameterizedObject;
|
|
281
|
+
|
|
273
282
|
// @public (undocumented)
|
|
274
283
|
export const isGenesisServerError: (error: unknown) => error is GenesisServerError;
|
|
275
284
|
|
|
@@ -312,13 +321,16 @@ export interface Machine<TContext extends MachineContext, TEvent extends EventOb
|
|
|
312
321
|
readonly error: any;
|
|
313
322
|
readonly errors: ErrorMap<ErrorDetailMap>;
|
|
314
323
|
getFromContainer(): this;
|
|
324
|
+
getMetaValuesByKey<T = string>(key?: string): T[];
|
|
315
325
|
hasTag(tag: string): boolean;
|
|
316
326
|
readonly machine: StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>;
|
|
317
327
|
matches(value: StateValueFrom<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): boolean;
|
|
328
|
+
readonly meta: Record<string, any>;
|
|
318
329
|
onSendEvent(event: CustomEvent<TEvent>): void;
|
|
319
330
|
readonly output: any;
|
|
320
331
|
provide(implementations: InternalMachineImplementations<TContext, TEvent, TAction, TActor, TResolvedTypesMeta, true>): void;
|
|
321
332
|
send(event: TEvent): void;
|
|
333
|
+
readonly snapshot: State<TContext, TEvent, TActor, TResolvedTypesMeta>;
|
|
322
334
|
start(options?: InterpreterOptions<StateMachine<TContext, TEvent, TAction, TActor, TInput, TResolvedTypesMeta>>): any;
|
|
323
335
|
readonly startingContext: Partial<TContext>;
|
|
324
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.71.1-auth-mf.
|
|
4
|
+
"version": "14.71.1-auth-mf.9",
|
|
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.9",
|
|
38
|
+
"@genesislcap/genx": "14.71.1-auth-mf.9",
|
|
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.9",
|
|
43
|
+
"@genesislcap/foundation-utils": "14.71.1-auth-mf.9",
|
|
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": "2b76c57d885f0f1cecb509a1e9ee32f6bd527055"
|
|
60
60
|
}
|