xstate 4.30.4 → 4.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,31 +4,30 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _tslib = require('./_virtual/_tslib.js');
6
6
  var types = require('./types.js');
7
+ var State = require('./State.js');
7
8
  var actionTypes = require('./actionTypes.js');
9
+ var actions = require('./actions.js');
8
10
  var environment = require('./environment.js');
9
11
  var utils = require('./utils.js');
10
- var actions = require('./actions.js');
11
- var serviceScope = require('./serviceScope.js');
12
+ var scheduler = require('./scheduler.js');
12
13
  var Actor = require('./Actor.js');
13
14
  var stateUtils = require('./stateUtils.js');
14
- var State = require('./State.js');
15
- var scheduler = require('./scheduler.js');
16
15
  var registry = require('./registry.js');
17
16
  var devTools = require('./devTools.js');
17
+ var serviceScope = require('./serviceScope.js');
18
18
  var behaviors = require('./behaviors.js');
19
19
 
20
20
  var DEFAULT_SPAWN_OPTIONS = {
21
21
  sync: false,
22
22
  autoForward: false
23
23
  };
24
+ exports.InterpreterStatus = void 0;
24
25
 
25
26
  (function (InterpreterStatus) {
26
27
  InterpreterStatus[InterpreterStatus["NotStarted"] = 0] = "NotStarted";
27
28
  InterpreterStatus[InterpreterStatus["Running"] = 1] = "Running";
28
29
  InterpreterStatus[InterpreterStatus["Stopped"] = 2] = "Stopped";
29
30
  })(exports.InterpreterStatus || (exports.InterpreterStatus = {}));
30
- /** @ts-ignore [symbolObservable] creates problems for people without `skipLibCheck` who are on older versions of TS, remove this comment when we drop support for TS@<4.3 */
31
-
32
31
 
33
32
  var Interpreter =
34
33
  /*#__PURE__*/
@@ -49,7 +48,6 @@ function () {
49
48
  }
50
49
 
51
50
  this.machine = machine;
52
- this.scheduler = new scheduler.Scheduler();
53
51
  this.delayedEventsMap = {};
54
52
  this.listeners = new Set();
55
53
  this.contextListeners = new Set();
@@ -366,12 +364,16 @@ function () {
366
364
 
367
365
  this.listeners.add(listener); // Send current state to listener
368
366
 
369
- if (this.status === exports.InterpreterStatus.Running) {
367
+ if (this.status !== exports.InterpreterStatus.NotStarted) {
370
368
  listener(this.state);
371
369
  }
372
370
 
373
371
  if (resolvedCompleteListener) {
374
- this.onDone(resolvedCompleteListener);
372
+ if (this.status === exports.InterpreterStatus.Stopped) {
373
+ resolvedCompleteListener();
374
+ } else {
375
+ this.onDone(resolvedCompleteListener);
376
+ }
375
377
  }
376
378
 
377
379
  return {
@@ -458,7 +460,13 @@ function () {
458
460
  if (this.status === exports.InterpreterStatus.Running) {
459
461
  // Do not restart the service if it is already started
460
462
  return this;
461
- }
463
+ } // yes, it's a hack but we need the related cache to be populated for some things to work (like delayed transitions)
464
+ // this is usually called by `machine.getInitialState` but if we rehydrate from a state we might bypass this call
465
+ // we also don't want to call this method here as it resolves the full initial state which might involve calling assign actions
466
+ // and that could potentially lead to some unwanted side-effects (even such as creating some rogue actors)
467
+
468
+
469
+ this.machine._init();
462
470
 
463
471
  registry.registry.register(this.sessionId, this);
464
472
  this.initialized = true;
@@ -593,6 +601,7 @@ function () {
593
601
  child.stop();
594
602
  }
595
603
  });
604
+ this.children.clear();
596
605
 
597
606
  try {
598
607
  // Cancel all delayed events
@@ -613,8 +622,12 @@ function () {
613
622
  }
614
623
 
615
624
  this.scheduler.clear();
625
+ this.scheduler = new scheduler.Scheduler({
626
+ deferEvents: this.options.deferEvents
627
+ });
616
628
  this.initialized = false;
617
629
  this.status = exports.InterpreterStatus.Stopped;
630
+ this._initialState = undefined;
618
631
  registry.registry.free(this.sessionId);
619
632
  return this;
620
633
  };
@@ -1313,8 +1326,6 @@ function () {
1313
1326
  id: this.id
1314
1327
  };
1315
1328
  };
1316
- /** @ts-ignore this creates problems for people without `skipLibCheck` who are on older versions of TS, remove this comment when we drop support for TS@<4.3 */
1317
-
1318
1329
 
1319
1330
  Interpreter.prototype[utils.symbolObservable] = function () {
1320
1331
  return this;
@@ -1335,23 +1346,20 @@ function () {
1335
1346
  */
1336
1347
 
1337
1348
 
1338
- Interpreter.defaultOptions = /*#__PURE__*/function (global) {
1339
- return {
1340
- execute: true,
1341
- deferEvents: true,
1342
- clock: {
1343
- setTimeout: function (fn, ms) {
1344
- return setTimeout(fn, ms);
1345
- },
1346
- clearTimeout: function (id) {
1347
- return clearTimeout(id);
1348
- }
1349
+ Interpreter.defaultOptions = {
1350
+ execute: true,
1351
+ deferEvents: true,
1352
+ clock: {
1353
+ setTimeout: function (fn, ms) {
1354
+ return setTimeout(fn, ms);
1349
1355
  },
1350
- logger: global.console.log.bind(console),
1351
- devTools: false
1352
- };
1353
- }(typeof self !== 'undefined' ? self : global);
1354
-
1356
+ clearTimeout: function (id) {
1357
+ return clearTimeout(id);
1358
+ }
1359
+ },
1360
+ logger: /*#__PURE__*/console.log.bind(console),
1361
+ devTools: false
1362
+ };
1355
1363
  Interpreter.interpret = interpret;
1356
1364
  return Interpreter;
1357
1365
  }();
@@ -5,8 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _tslib = require('./_virtual/_tslib.js');
6
6
  require('./types.js');
7
7
  var actionTypes = require('./actionTypes.js');
8
- require('./environment.js');
9
8
  require('./utils.js');
9
+ require('./environment.js');
10
10
 
11
11
  function toInvokeSource(src) {
12
12
  if (typeof src === 'string') {
@@ -29,9 +29,9 @@ function toInvokeDefinition(invokeConfig) {
29
29
  type: actionTypes.invoke
30
30
  }, invokeConfig), {
31
31
  toJSON: function () {
32
- var onDone = invokeConfig.onDone,
33
- onError = invokeConfig.onError,
34
- invokeDef = _tslib.__rest(invokeConfig, ["onDone", "onError"]);
32
+ invokeConfig.onDone;
33
+ invokeConfig.onError;
34
+ var invokeDef = _tslib.__rest(invokeConfig, ["onDone", "onError"]);
35
35
 
36
36
  return _tslib.__assign(_tslib.__assign({}, invokeDef), {
37
37
  type: actionTypes.invoke,
package/lib/json.js CHANGED
@@ -1,85 +1,94 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsonify = exports.parse = exports.stringify = exports.machineToJSON = exports.stringifyFunction = void 0;
4
- var utils_1 = require("./utils");
5
- // tslint:disable-next-line:ban-types
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var utils = require('./utils.js');
6
+
6
7
  function stringifyFunction(fn) {
7
- return {
8
- $function: fn.toString()
9
- };
8
+ return {
9
+ $function: fn.toString()
10
+ };
10
11
  }
11
- exports.stringifyFunction = stringifyFunction;
12
+
12
13
  function getStateNodeId(stateNode) {
13
- return "#".concat(stateNode.id);
14
- }
15
- // derive config from machine
14
+ return "#".concat(stateNode.id);
15
+ } // derive config from machine
16
+
17
+
16
18
  function machineToJSON(stateNode) {
17
- var config = {
18
- type: stateNode.type,
19
- initial: stateNode.initial === undefined ? undefined : String(stateNode.initial),
20
- id: stateNode.id,
21
- key: stateNode.key,
22
- entry: stateNode.onEntry,
23
- exit: stateNode.onExit,
24
- on: (0, utils_1.mapValues)(stateNode.on, function (transition) {
25
- return transition.map(function (t) {
26
- return {
27
- target: t.target ? t.target.map(getStateNodeId) : [],
28
- source: getStateNodeId(t.source),
29
- actions: t.actions,
30
- cond: t.cond,
31
- eventType: t.eventType
32
- };
33
- });
34
- }),
35
- invoke: stateNode.invoke,
36
- states: {}
37
- };
38
- Object.values(stateNode.states).forEach(function (sn) {
39
- config.states[sn.key] = machineToJSON(sn);
40
- });
41
- return config;
19
+ var config = {
20
+ type: stateNode.type,
21
+ initial: stateNode.initial === undefined ? undefined : String(stateNode.initial),
22
+ id: stateNode.id,
23
+ key: stateNode.key,
24
+ entry: stateNode.onEntry,
25
+ exit: stateNode.onExit,
26
+ on: utils.mapValues(stateNode.on, function (transition) {
27
+ return transition.map(function (t) {
28
+ return {
29
+ target: t.target ? t.target.map(getStateNodeId) : [],
30
+ source: getStateNodeId(t.source),
31
+ actions: t.actions,
32
+ cond: t.cond,
33
+ eventType: t.eventType
34
+ };
35
+ });
36
+ }),
37
+ invoke: stateNode.invoke,
38
+ states: {}
39
+ };
40
+ Object.values(stateNode.states).forEach(function (sn) {
41
+ config.states[sn.key] = machineToJSON(sn);
42
+ });
43
+ return config;
42
44
  }
43
- exports.machineToJSON = machineToJSON;
44
45
  function stringify(machine) {
45
- return JSON.stringify(machineToJSON(machine), function (_, value) {
46
- if ((0, utils_1.isFunction)(value)) {
47
- return { $function: value.toString() };
48
- }
49
- return value;
50
- });
46
+ return JSON.stringify(machineToJSON(machine), function (_, value) {
47
+ if (utils.isFunction(value)) {
48
+ return {
49
+ $function: value.toString()
50
+ };
51
+ }
52
+
53
+ return value;
54
+ });
51
55
  }
52
- exports.stringify = stringify;
53
56
  function parse(machineString) {
54
- var config = JSON.parse(machineString, function (_, value) {
55
- if (typeof value === 'object' && '$function' in value) {
56
- return new Function(value.value);
57
- }
58
- return value;
59
- });
60
- return config;
57
+ var config = JSON.parse(machineString, function (_, value) {
58
+ if (typeof value === 'object' && '$function' in value) {
59
+ return new Function(value.value);
60
+ }
61
+
62
+ return value;
63
+ });
64
+ return config;
61
65
  }
62
- exports.parse = parse;
63
66
  function jsonify(value) {
64
- Object.defineProperty(value, 'toJSON', {
65
- value: function () {
66
- return (0, utils_1.mapValues)(value, function (subValue) {
67
- if ((0, utils_1.isFunction)(subValue)) {
68
- return stringifyFunction(subValue);
69
- }
70
- else if (typeof subValue === 'object' && !Array.isArray(subValue)) {
71
- // mostly for assignments
72
- return (0, utils_1.mapValues)(subValue, function (subSubValue) {
73
- if ((0, utils_1.isFunction)(subSubValue)) {
74
- return stringifyFunction(subSubValue);
75
- }
76
- return subSubValue;
77
- });
78
- }
79
- return subValue;
80
- });
67
+ Object.defineProperty(value, 'toJSON', {
68
+ value: function () {
69
+ return utils.mapValues(value, function (subValue) {
70
+ if (utils.isFunction(subValue)) {
71
+ return stringifyFunction(subValue);
72
+ } else if (typeof subValue === 'object' && !Array.isArray(subValue)) {
73
+ // mostly for assignments
74
+ return utils.mapValues(subValue, function (subSubValue) {
75
+ if (utils.isFunction(subSubValue)) {
76
+ return stringifyFunction(subSubValue);
77
+ }
78
+
79
+ return subSubValue;
80
+ });
81
81
  }
82
- });
83
- return value;
82
+
83
+ return subValue;
84
+ });
85
+ }
86
+ });
87
+ return value;
84
88
  }
89
+
85
90
  exports.jsonify = jsonify;
91
+ exports.machineToJSON = machineToJSON;
92
+ exports.parse = parse;
93
+ exports.stringify = stringify;
94
+ exports.stringifyFunction = stringifyFunction;
package/lib/model.js CHANGED
@@ -1,74 +1,54 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __read = (this && this.__read) || function (o, n) {
14
- var m = typeof Symbol === "function" && o[Symbol.iterator];
15
- if (!m) return o;
16
- var i = m.call(o), r, ar = [], e;
17
- try {
18
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
19
- }
20
- catch (error) { e = { error: error }; }
21
- finally {
22
- try {
23
- if (r && !r.done && (m = i["return"])) m.call(i);
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('./_virtual/_tslib.js');
6
+ var actions = require('./actions.js');
7
+ var Machine = require('./Machine.js');
8
+ var utils = require('./utils.js');
9
+
10
+ function createModel(initialContext, creators) {
11
+ var eventCreators = creators === null || creators === void 0 ? void 0 : creators.events;
12
+ var actionCreators = creators === null || creators === void 0 ? void 0 : creators.actions;
13
+ var model = {
14
+ initialContext: initialContext,
15
+ assign: actions.assign,
16
+ events: eventCreators ? utils.mapValues(eventCreators, function (fn, eventType) {
17
+ return function () {
18
+ var args = [];
19
+
20
+ for (var _i = 0; _i < arguments.length; _i++) {
21
+ args[_i] = arguments[_i];
24
22
  }
25
- finally { if (e) throw e.error; }
26
- }
27
- return ar;
28
- };
29
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
30
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
31
- if (ar || !(i in from)) {
32
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
33
- ar[i] = from[i];
23
+
24
+ return _tslib.__assign(_tslib.__assign({}, fn.apply(void 0, _tslib.__spreadArray([], _tslib.__read(args), false))), {
25
+ type: eventType
26
+ });
27
+ };
28
+ }) : undefined,
29
+ actions: actionCreators ? utils.mapValues(actionCreators, function (fn, actionType) {
30
+ return function () {
31
+ var args = [];
32
+
33
+ for (var _i = 0; _i < arguments.length; _i++) {
34
+ args[_i] = arguments[_i];
34
35
  }
36
+
37
+ return _tslib.__assign(_tslib.__assign({}, fn.apply(void 0, _tslib.__spreadArray([], _tslib.__read(args), false))), {
38
+ type: actionType
39
+ });
40
+ };
41
+ }) : undefined,
42
+ reset: function () {
43
+ return actions.assign(initialContext);
44
+ },
45
+ createMachine: function (config, implementations) {
46
+ return Machine.createMachine('context' in config ? config : _tslib.__assign(_tslib.__assign({}, config), {
47
+ context: initialContext
48
+ }), implementations);
35
49
  }
36
- return to.concat(ar || Array.prototype.slice.call(from));
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.createModel = void 0;
40
- var actions_1 = require("./actions");
41
- var Machine_1 = require("./Machine");
42
- var utils_1 = require("./utils");
43
- function createModel(initialContext, creators) {
44
- var eventCreators = creators === null || creators === void 0 ? void 0 : creators.events;
45
- var actionCreators = creators === null || creators === void 0 ? void 0 : creators.actions;
46
- var model = {
47
- initialContext: initialContext,
48
- assign: actions_1.assign,
49
- events: (eventCreators
50
- ? (0, utils_1.mapValues)(eventCreators, function (fn, eventType) { return function () {
51
- var args = [];
52
- for (var _i = 0; _i < arguments.length; _i++) {
53
- args[_i] = arguments[_i];
54
- }
55
- return (__assign(__assign({}, fn.apply(void 0, __spreadArray([], __read(args), false))), { type: eventType }));
56
- }; })
57
- : undefined),
58
- actions: actionCreators
59
- ? (0, utils_1.mapValues)(actionCreators, function (fn, actionType) { return function () {
60
- var args = [];
61
- for (var _i = 0; _i < arguments.length; _i++) {
62
- args[_i] = arguments[_i];
63
- }
64
- return (__assign(__assign({}, fn.apply(void 0, __spreadArray([], __read(args), false))), { type: actionType }));
65
- }; })
66
- : undefined,
67
- reset: function () { return (0, actions_1.assign)(initialContext); },
68
- createMachine: function (config, implementations) {
69
- return (0, Machine_1.createMachine)('context' in config ? config : __assign(__assign({}, config), { context: initialContext }), implementations);
70
- }
71
- };
72
- return model;
50
+ };
51
+ return model;
73
52
  }
53
+
74
54
  exports.createModel = createModel;
package/lib/patterns.js CHANGED
@@ -1,61 +1,53 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.sequence = exports.toggle = void 0;
15
- var utils_1 = require("./utils");
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var _tslib = require('./_virtual/_tslib.js');
6
+ var utils = require('./utils.js');
7
+
16
8
  function toggle(onState, offState, eventType) {
17
- var _a, _b, _c;
18
- return _a = {},
19
- _a[onState] = {
20
- on: (_b = {}, _b[eventType] = offState, _b)
21
- },
22
- _a[offState] = {
23
- on: (_c = {}, _c[eventType] = onState, _c)
24
- },
25
- _a;
9
+ var _a, _b, _c;
10
+
11
+ return _a = {}, _a[onState] = {
12
+ on: (_b = {}, _b[eventType] = offState, _b)
13
+ }, _a[offState] = {
14
+ on: (_c = {}, _c[eventType] = onState, _c)
15
+ }, _a;
26
16
  }
27
- exports.toggle = toggle;
28
17
  var defaultSequencePatternOptions = {
29
- nextEvent: 'NEXT',
30
- prevEvent: 'PREV'
18
+ nextEvent: 'NEXT',
19
+ prevEvent: 'PREV'
31
20
  };
32
21
  function sequence(items, options) {
33
- var resolvedOptions = __assign(__assign({}, defaultSequencePatternOptions), options);
34
- var states = {};
35
- var nextEventObject = resolvedOptions.nextEvent === undefined
36
- ? undefined
37
- : (0, utils_1.toEventObject)(resolvedOptions.nextEvent);
38
- var prevEventObject = resolvedOptions.prevEvent === undefined
39
- ? undefined
40
- : (0, utils_1.toEventObject)(resolvedOptions.prevEvent);
41
- items.forEach(function (item, i) {
42
- var state = {
43
- on: {}
44
- };
45
- if (i + 1 === items.length) {
46
- state.type = 'final';
47
- }
48
- if (nextEventObject && i + 1 < items.length) {
49
- state.on[nextEventObject.type] = items[i + 1];
50
- }
51
- if (prevEventObject && i > 0) {
52
- state.on[prevEventObject.type] = items[i - 1];
53
- }
54
- states[item] = state;
55
- });
56
- return {
57
- initial: items[0],
58
- states: states
22
+ var resolvedOptions = _tslib.__assign(_tslib.__assign({}, defaultSequencePatternOptions), options);
23
+
24
+ var states = {};
25
+ var nextEventObject = resolvedOptions.nextEvent === undefined ? undefined : utils.toEventObject(resolvedOptions.nextEvent);
26
+ var prevEventObject = resolvedOptions.prevEvent === undefined ? undefined : utils.toEventObject(resolvedOptions.prevEvent);
27
+ items.forEach(function (item, i) {
28
+ var state = {
29
+ on: {}
59
30
  };
31
+
32
+ if (i + 1 === items.length) {
33
+ state.type = 'final';
34
+ }
35
+
36
+ if (nextEventObject && i + 1 < items.length) {
37
+ state.on[nextEventObject.type] = items[i + 1];
38
+ }
39
+
40
+ if (prevEventObject && i > 0) {
41
+ state.on[prevEventObject.type] = items[i - 1];
42
+ }
43
+
44
+ states[item] = state;
45
+ });
46
+ return {
47
+ initial: items[0],
48
+ states: states
49
+ };
60
50
  }
51
+
61
52
  exports.sequence = sequence;
53
+ exports.toggle = toggle;
package/lib/stateUtils.js CHANGED
@@ -11,6 +11,8 @@ var isLeafNode = function (stateNode) {
11
11
  function getChildren(stateNode) {
12
12
  return Object.keys(stateNode.states).map(function (key) {
13
13
  return stateNode.states[key];
14
+ }).filter(function (sn) {
15
+ return sn.type !== 'history';
14
16
  });
15
17
  }
16
18
  function getAllStateNodes(stateNode) {
@@ -75,10 +77,6 @@ function getConfiguration(prevStateNodes, stateNodes) {
75
77
  for (var _e = (e_3 = void 0, _tslib.__values(getChildren(s))), _f = _e.next(); !_f.done; _f = _e.next()) {
76
78
  var child = _f.value;
77
79
 
78
- if (child.type === 'history') {
79
- continue;
80
- }
81
-
82
80
  if (!configuration.has(child)) {
83
81
  configuration.add(child);
84
82
 
@@ -77,21 +77,27 @@ export interface TypegenMeta extends TypegenEnabled {
77
77
  eventsCausingServices: Record<string, string>;
78
78
  }
79
79
  export interface ResolvedTypegenMeta extends TypegenMeta {
80
- indexedActions: Record<string, BaseActionObject>;
81
- indexedEvents: Record<string, EventObject>;
80
+ resolved: TypegenMeta & {
81
+ indexedActions: Record<string, BaseActionObject>;
82
+ indexedEvents: Record<string, EventObject>;
83
+ };
82
84
  }
83
85
  export declare type TypegenConstraint = TypegenEnabled | TypegenDisabled;
84
- export declare type AreAllImplementationsAssumedToBeProvided<TResolvedTypesMeta, TMissingImplementations = Prop<TResolvedTypesMeta, 'missingImplementations'>> = IsAny<TResolvedTypesMeta> extends true ? true : TResolvedTypesMeta extends TypegenEnabled ? IsNever<Values<{
86
+ export declare type AreAllImplementationsAssumedToBeProvided<TResolvedTypesMeta, TMissingImplementations = Prop<Prop<TResolvedTypesMeta, 'resolved'>, 'missingImplementations'>> = IsAny<TResolvedTypesMeta> extends true ? true : TResolvedTypesMeta extends TypegenEnabled ? IsNever<Values<{
85
87
  [K in keyof TMissingImplementations]: TMissingImplementations[K];
86
88
  }>> extends true ? true : false : true;
87
- export declare type MarkAllImplementationsAsProvided<TResolvedTypesMeta> = TResolvedTypesMeta & {
89
+ interface AllImplementationsProvided {
88
90
  missingImplementations: {
89
91
  actions: never;
90
92
  delays: never;
91
93
  guards: never;
92
94
  services: never;
93
95
  };
94
- };
96
+ }
97
+ export interface MarkAllImplementationsAsProvided<TResolvedTypesMeta> {
98
+ '@@xstate/typegen': Prop<TResolvedTypesMeta, '@@xstate/typegen'>;
99
+ resolved: Prop<TResolvedTypesMeta, 'resolved'> & AllImplementationsProvided;
100
+ }
95
101
  declare type GenerateServiceEvent<TServiceName, TEventType, TServiceMap extends ServiceMap> = TEventType extends any ? {
96
102
  type: TEventType;
97
103
  } & Prop<TServiceMap, TServiceName> : never;
@@ -105,17 +111,20 @@ declare type AllowAllEvents = {
105
111
  eventsCausingGuards: Record<string, string>;
106
112
  eventsCausingServices: Record<string, string>;
107
113
  };
108
- export declare type ResolveTypegenMeta<TTypesMeta extends TypegenConstraint, TEvent extends EventObject, TAction extends BaseActionObject, TServiceMap extends ServiceMap> = TTypesMeta extends TypegenEnabled ? TTypesMeta & {
109
- indexedActions: IndexByType<TAction>;
110
- indexedEvents: MergeWithInternalEvents<IndexByType<(string extends TEvent['type'] ? never : TEvent) | GenerateServiceEvents<TServiceMap, Prop<TTypesMeta, 'invokeSrcNameMap'>>>, Prop<TTypesMeta, 'internalEvents'>>;
111
- } : MarkAllImplementationsAsProvided<TypegenDisabled> & AllowAllEvents & {
112
- indexedActions: IndexByType<TAction>;
113
- indexedEvents: Record<string, TEvent> & {
114
- __XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__: {
115
- data: any;
114
+ export interface ResolveTypegenMeta<TTypesMeta extends TypegenConstraint, TEvent extends EventObject, TAction extends BaseActionObject, TServiceMap extends ServiceMap> {
115
+ '@@xstate/typegen': TTypesMeta['@@xstate/typegen'];
116
+ resolved: TTypesMeta extends TypegenEnabled ? TTypesMeta & {
117
+ indexedActions: IndexByType<TAction>;
118
+ indexedEvents: MergeWithInternalEvents<IndexByType<(string extends TEvent['type'] ? never : TEvent) | GenerateServiceEvents<TServiceMap, Prop<TTypesMeta, 'invokeSrcNameMap'>>>, Prop<TTypesMeta, 'internalEvents'>>;
119
+ } : TypegenDisabled & AllImplementationsProvided & AllowAllEvents & {
120
+ indexedActions: IndexByType<TAction>;
121
+ indexedEvents: Record<string, TEvent> & {
122
+ __XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__: {
123
+ data: any;
124
+ };
116
125
  };
126
+ invokeSrcNameMap: Record<string, '__XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__'>;
117
127
  };
118
- invokeSrcNameMap: Record<string, '__XSTATE_ALLOW_ANY_INVOKE_DATA_HACK__'>;
119
- };
128
+ }
120
129
  export {};
121
130
  //# sourceMappingURL=typegenTypes.d.ts.map