xstate 6.0.0-alpha.7 → 6.0.0-alpha.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.
Files changed (35) hide show
  1. package/dist/{StateMachine-2b259bff.development.esm.js → StateMachine-0aa98f54.development.esm.js} +10 -10
  2. package/dist/{StateMachine-6673bf76.cjs.js → StateMachine-aef700df.cjs.js} +9 -9
  3. package/dist/{StateMachine-1ff90553.esm.js → StateMachine-d4931336.esm.js} +9 -9
  4. package/dist/{StateMachine-68fe6077.development.cjs.js → StateMachine-da872dde.development.cjs.js} +10 -10
  5. package/dist/declarations/src/StateMachine.d.ts +13 -6
  6. package/dist/declarations/src/createMachine.d.ts +4 -4
  7. package/dist/declarations/src/createMachineFromConfig.d.ts +2 -2
  8. package/dist/declarations/src/index.d.ts +1 -0
  9. package/dist/declarations/src/serialize.d.ts +2 -1
  10. package/dist/declarations/src/setup.d.ts +56 -28
  11. package/dist/declarations/src/types.d.ts +54 -42
  12. package/dist/declarations/src/types.v6.d.ts +35 -26
  13. package/dist/declarations/src/utils.d.ts +2 -1
  14. package/dist/{index-b063a967.development.cjs.js → index-219cb621.development.cjs.js} +35 -13
  15. package/dist/{index-9594f050.development.esm.js → index-2f2fbd9b.development.esm.js} +35 -13
  16. package/dist/{index-87499be0.cjs.js → index-559ceab3.cjs.js} +35 -13
  17. package/dist/{index-aaf74d09.esm.js → index-8828376f.esm.js} +35 -13
  18. package/dist/xstate-actors.cjs.js +1 -1
  19. package/dist/xstate-actors.development.cjs.js +1 -1
  20. package/dist/xstate-actors.development.esm.js +1 -1
  21. package/dist/xstate-actors.esm.js +1 -1
  22. package/dist/xstate-actors.umd.min.js.map +1 -1
  23. package/dist/xstate-graph.cjs.js +2 -2
  24. package/dist/xstate-graph.development.cjs.js +2 -2
  25. package/dist/xstate-graph.development.esm.js +2 -2
  26. package/dist/xstate-graph.esm.js +2 -2
  27. package/dist/xstate-graph.umd.min.js +1 -1
  28. package/dist/xstate-graph.umd.min.js.map +1 -1
  29. package/dist/xstate.cjs.js +19 -17
  30. package/dist/xstate.development.cjs.js +19 -17
  31. package/dist/xstate.development.esm.js +21 -19
  32. package/dist/xstate.esm.js +21 -19
  33. package/dist/xstate.umd.min.js +1 -1
  34. package/dist/xstate.umd.min.js.map +1 -1
  35. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { P as ProcessingStatus, C as resolveReferencedActor, c as createActor, S as STATE_DELIMITER, D as mapValues, t as toArray, E as createInvokeId, F as getDelayedTransitions, G as evaluateCandidate, H as formatTransition, N as NULL_EVENT, I as toTransitionConfigArray, J as createInvokeTimeoutEvent, K as getCandidates, L as formatRouteTransitions, M as resolveStateValue, O as getAllStateNodes, f as getStateNodes, Q as createMachineSnapshot, R as isInFinalState, a as macrostep, U as transitionNode, m as matchesEventDescriptor, V as resolveActionsWithContext, b as createInitEvent, d as initialMicrostep, W as toStatePath, X as isStateId, Y as getStateNodeByPath, Z as getPersistedSnapshot, $ as $$ACTOR_TYPE } from './index-9594f050.development.esm.js';
1
+ import { P as ProcessingStatus, C as resolveReferencedActor, c as createActor, S as STATE_DELIMITER, D as mapValues, t as toArray, E as createInvokeId, F as getDelayedTransitions, G as evaluateCandidate, H as formatTransition, N as NULL_EVENT, I as toTransitionConfigArray, J as createInvokeTimeoutEvent, K as getCandidates, L as formatRouteTransitions, M as resolveStateValue, O as getAllStateNodes, f as getStateNodes, Q as createMachineSnapshot, R as isInFinalState, a as macrostep, U as transitionNode, m as matchesEventDescriptor, V as resolveActionsWithContext, b as createInitEvent, d as initialMicrostep, W as toStatePath, X as isStateId, Y as getStateNodeByPath, Z as getPersistedSnapshot, $ as $$ACTOR_TYPE } from './index-2f2fbd9b.development.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -422,7 +422,7 @@ class StateMachine {
422
422
  this._json = void 0;
423
423
  this.id = config.id || '(machine)';
424
424
  this.implementations = {
425
- actors: config.actors ?? {},
425
+ actorSources: config.actorSources ?? {},
426
426
  actions: config.actions ?? {},
427
427
  delays: config.delays ?? {},
428
428
  guards: config.guards ?? {},
@@ -431,7 +431,7 @@ class StateMachine {
431
431
  {
432
432
  // The `@xstate.` prefix is reserved for built-in serialized action and
433
433
  // guard descriptors — user implementation names must not collide.
434
- for (const kind of ['actions', 'guards', 'actors', 'delays']) {
434
+ for (const kind of ['actions', 'guards', 'actorSources', 'delays']) {
435
435
  for (const key of Object.keys(this.implementations[kind])) {
436
436
  if (key.startsWith('@xstate.')) {
437
437
  throw new Error(`Invalid ${kind} name '${key}': the '@xstate.' prefix is reserved for built-in descriptors.`);
@@ -469,15 +469,15 @@ class StateMachine {
469
469
  /**
470
470
  * Clones this state machine with the provided implementations.
471
471
  *
472
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
473
- * recursively merge with the existing options.
472
+ * @param implementations Options (`actions`, `guards`, `actorSources`,
473
+ * `delays`) to recursively merge with the existing options.
474
474
  * @returns A new `StateMachine` instance with the provided implementations.
475
475
  */
476
476
  provide(implementations) {
477
477
  const {
478
478
  actions,
479
479
  guards,
480
- actors,
480
+ actorSources,
481
481
  delays
482
482
  } = this.implementations;
483
483
  const provided = new StateMachine(this.config, {
@@ -489,9 +489,9 @@ class StateMachine {
489
489
  ...guards,
490
490
  ...implementations.guards
491
491
  },
492
- actors: {
493
- ...actors,
494
- ...implementations.actors
492
+ actorSources: {
493
+ ...actorSources,
494
+ ...implementations.actorSources
495
495
  },
496
496
  delays: {
497
497
  ...delays,
@@ -585,7 +585,7 @@ class StateMachine {
585
585
  spawn,
586
586
  input: initEvent.input,
587
587
  self: actorScope.self,
588
- actors: this.implementations.actors
588
+ actorSources: this.implementations.actorSources
589
589
  });
590
590
  const [nextState] = resolveActionsWithContext(preInitial, initEvent, actorScope, []);
591
591
  if (resolvedContext) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dist_xstateActors = require('./index-87499be0.cjs.js');
3
+ var dist_xstateActors = require('./index-559ceab3.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -424,7 +424,7 @@ class StateMachine {
424
424
  this._json = void 0;
425
425
  this.id = config.id || '(machine)';
426
426
  this.implementations = {
427
- actors: config.actors ?? {},
427
+ actorSources: config.actorSources ?? {},
428
428
  actions: config.actions ?? {},
429
429
  delays: config.delays ?? {},
430
430
  guards: config.guards ?? {},
@@ -457,15 +457,15 @@ class StateMachine {
457
457
  /**
458
458
  * Clones this state machine with the provided implementations.
459
459
  *
460
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
461
- * recursively merge with the existing options.
460
+ * @param implementations Options (`actions`, `guards`, `actorSources`,
461
+ * `delays`) to recursively merge with the existing options.
462
462
  * @returns A new `StateMachine` instance with the provided implementations.
463
463
  */
464
464
  provide(implementations) {
465
465
  const {
466
466
  actions,
467
467
  guards,
468
- actors,
468
+ actorSources,
469
469
  delays
470
470
  } = this.implementations;
471
471
  const provided = new StateMachine(this.config, {
@@ -477,9 +477,9 @@ class StateMachine {
477
477
  ...guards,
478
478
  ...implementations.guards
479
479
  },
480
- actors: {
481
- ...actors,
482
- ...implementations.actors
480
+ actorSources: {
481
+ ...actorSources,
482
+ ...implementations.actorSources
483
483
  },
484
484
  delays: {
485
485
  ...delays,
@@ -573,7 +573,7 @@ class StateMachine {
573
573
  spawn,
574
574
  input: initEvent.input,
575
575
  self: actorScope.self,
576
- actors: this.implementations.actors
576
+ actorSources: this.implementations.actorSources
577
577
  });
578
578
  const [nextState] = dist_xstateActors.resolveActionsWithContext(preInitial, initEvent, actorScope, []);
579
579
  if (resolvedContext) {
@@ -1,4 +1,4 @@
1
- import { P as ProcessingStatus, C as resolveReferencedActor, c as createActor, S as STATE_DELIMITER, D as mapValues, t as toArray, E as createInvokeId, F as getDelayedTransitions, G as evaluateCandidate, H as formatTransition, N as NULL_EVENT, I as toTransitionConfigArray, J as createInvokeTimeoutEvent, K as getCandidates, L as formatRouteTransitions, M as resolveStateValue, O as getAllStateNodes, f as getStateNodes, Q as createMachineSnapshot, R as isInFinalState, a as macrostep, U as transitionNode, m as matchesEventDescriptor, V as resolveActionsWithContext, b as createInitEvent, d as initialMicrostep, W as toStatePath, X as isStateId, Y as getStateNodeByPath, Z as getPersistedSnapshot, $ as $$ACTOR_TYPE } from './index-aaf74d09.esm.js';
1
+ import { P as ProcessingStatus, C as resolveReferencedActor, c as createActor, S as STATE_DELIMITER, D as mapValues, t as toArray, E as createInvokeId, F as getDelayedTransitions, G as evaluateCandidate, H as formatTransition, N as NULL_EVENT, I as toTransitionConfigArray, J as createInvokeTimeoutEvent, K as getCandidates, L as formatRouteTransitions, M as resolveStateValue, O as getAllStateNodes, f as getStateNodes, Q as createMachineSnapshot, R as isInFinalState, a as macrostep, U as transitionNode, m as matchesEventDescriptor, V as resolveActionsWithContext, b as createInitEvent, d as initialMicrostep, W as toStatePath, X as isStateId, Y as getStateNodeByPath, Z as getPersistedSnapshot, $ as $$ACTOR_TYPE } from './index-8828376f.esm.js';
2
2
 
3
3
  function createSpawner(actorScope, {
4
4
  machine,
@@ -422,7 +422,7 @@ class StateMachine {
422
422
  this._json = void 0;
423
423
  this.id = config.id || '(machine)';
424
424
  this.implementations = {
425
- actors: config.actors ?? {},
425
+ actorSources: config.actorSources ?? {},
426
426
  actions: config.actions ?? {},
427
427
  delays: config.delays ?? {},
428
428
  guards: config.guards ?? {},
@@ -455,15 +455,15 @@ class StateMachine {
455
455
  /**
456
456
  * Clones this state machine with the provided implementations.
457
457
  *
458
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
459
- * recursively merge with the existing options.
458
+ * @param implementations Options (`actions`, `guards`, `actorSources`,
459
+ * `delays`) to recursively merge with the existing options.
460
460
  * @returns A new `StateMachine` instance with the provided implementations.
461
461
  */
462
462
  provide(implementations) {
463
463
  const {
464
464
  actions,
465
465
  guards,
466
- actors,
466
+ actorSources,
467
467
  delays
468
468
  } = this.implementations;
469
469
  const provided = new StateMachine(this.config, {
@@ -475,9 +475,9 @@ class StateMachine {
475
475
  ...guards,
476
476
  ...implementations.guards
477
477
  },
478
- actors: {
479
- ...actors,
480
- ...implementations.actors
478
+ actorSources: {
479
+ ...actorSources,
480
+ ...implementations.actorSources
481
481
  },
482
482
  delays: {
483
483
  ...delays,
@@ -571,7 +571,7 @@ class StateMachine {
571
571
  spawn,
572
572
  input: initEvent.input,
573
573
  self: actorScope.self,
574
- actors: this.implementations.actors
574
+ actorSources: this.implementations.actorSources
575
575
  });
576
576
  const [nextState] = resolveActionsWithContext(preInitial, initEvent, actorScope, []);
577
577
  if (resolvedContext) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var dist_xstateActors = require('./index-b063a967.development.cjs.js');
3
+ var dist_xstateActors = require('./index-219cb621.development.cjs.js');
4
4
 
5
5
  function createSpawner(actorScope, {
6
6
  machine,
@@ -424,7 +424,7 @@ class StateMachine {
424
424
  this._json = void 0;
425
425
  this.id = config.id || '(machine)';
426
426
  this.implementations = {
427
- actors: config.actors ?? {},
427
+ actorSources: config.actorSources ?? {},
428
428
  actions: config.actions ?? {},
429
429
  delays: config.delays ?? {},
430
430
  guards: config.guards ?? {},
@@ -433,7 +433,7 @@ class StateMachine {
433
433
  {
434
434
  // The `@xstate.` prefix is reserved for built-in serialized action and
435
435
  // guard descriptors — user implementation names must not collide.
436
- for (const kind of ['actions', 'guards', 'actors', 'delays']) {
436
+ for (const kind of ['actions', 'guards', 'actorSources', 'delays']) {
437
437
  for (const key of Object.keys(this.implementations[kind])) {
438
438
  if (key.startsWith('@xstate.')) {
439
439
  throw new Error(`Invalid ${kind} name '${key}': the '@xstate.' prefix is reserved for built-in descriptors.`);
@@ -471,15 +471,15 @@ class StateMachine {
471
471
  /**
472
472
  * Clones this state machine with the provided implementations.
473
473
  *
474
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
475
- * recursively merge with the existing options.
474
+ * @param implementations Options (`actions`, `guards`, `actorSources`,
475
+ * `delays`) to recursively merge with the existing options.
476
476
  * @returns A new `StateMachine` instance with the provided implementations.
477
477
  */
478
478
  provide(implementations) {
479
479
  const {
480
480
  actions,
481
481
  guards,
482
- actors,
482
+ actorSources,
483
483
  delays
484
484
  } = this.implementations;
485
485
  const provided = new StateMachine(this.config, {
@@ -491,9 +491,9 @@ class StateMachine {
491
491
  ...guards,
492
492
  ...implementations.guards
493
493
  },
494
- actors: {
495
- ...actors,
496
- ...implementations.actors
494
+ actorSources: {
495
+ ...actorSources,
496
+ ...implementations.actorSources
497
497
  },
498
498
  delays: {
499
499
  ...delays,
@@ -587,7 +587,7 @@ class StateMachine {
587
587
  spawn,
588
588
  input: initEvent.input,
589
589
  self: actorScope.self,
590
- actors: this.implementations.actors
590
+ actorSources: this.implementations.actorSources
591
591
  });
592
592
  const [nextState] = dist_xstateActors.resolveActionsWithContext(preInitial, initEvent, actorScope, []);
593
593
  if (resolvedContext) {
@@ -1,9 +1,15 @@
1
1
  import { MachineSnapshot } from "./State.js";
2
2
  import { StateNode } from "./StateNode.js";
3
3
  import { AnyActorSystem } from "./system.js";
4
- import type { ActorLogic, ActorLogicTransitionResult, ActorScope, AnyActor, AnyActorRef, AnyActorScope, AnyTransitionDefinition, Equals, EventDescriptor, EventObject, ExecutableActionObjectFromLogic, HistoryValue, MachineContext, MetaObject, Snapshot, StateValue, StateSchema, SnapshotStatus } from "./types.js";
4
+ import type { ActorLogic, ActorLogicTransitionResult, ActorScope, AnyActor, AnyActorLogic, AnyActorRef, AnyActorScope, AnyTransitionDefinition, Equals, EventDescriptor, EmittedFrom, EventObject, EventFromLogic, ExecutableActionObjectFromLogic, HistoryValue, InputFrom, IsAny, MachineContext, MetaObject, OutputFrom, Snapshot, SnapshotFrom, StateValue, StateSchema, SnapshotStatus } from "./types.js";
5
5
  import { AnyMachineSchemas, Implementations, Next_MachineConfig, MachineOptions } from "./types.v6.js";
6
- export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TMeta extends MetaObject, TConfig extends StateSchema, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, TInput, AnyActorSystem, TEmitted> {
6
+ type CompatibleProvidedActorSource<TExpected extends AnyActorLogic, TActual extends AnyActorLogic> = IsAny<TActual> extends true ? TActual : [OutputFrom<TActual>] extends [OutputFrom<TExpected>] ? [Omit<SnapshotFrom<TActual>, 'input'>] extends [
7
+ Omit<SnapshotFrom<TExpected>, 'input'>
8
+ ] ? [InputFrom<TExpected>] extends [InputFrom<TActual>] ? [EventFromLogic<TExpected>] extends [EventFromLogic<TActual>] ? [EmittedFrom<TActual>] extends [EmittedFrom<TExpected>] ? TActual : never : never : never : never : never;
9
+ type ProvidedActorSources<TExpectedActorMap extends Implementations['actorSources'], TProvidedActorMap extends Partial<Record<keyof TExpectedActorMap & string, AnyActorLogic>>> = {
10
+ [K in keyof TProvidedActorMap]: K extends keyof TExpectedActorMap ? TProvidedActorMap[K] extends AnyActorLogic ? CompatibleProvidedActorSource<TExpectedActorMap[K], TProvidedActorMap[K]> : never : never;
11
+ };
12
+ export declare class StateMachine<TContext extends MachineContext, TEvent extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TStateValue extends StateValue, TTag extends string, TInput, TOutput, TEmitted extends EventObject, TMeta extends MetaObject, TConfig extends StateSchema, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actorSources'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> implements ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, TInput, AnyActorSystem, TEmitted> {
7
13
  /** The raw config used to create the machine. */
8
14
  config: Next_MachineConfig<any, any, any, any, any, any, any, any, any, any, any> & {
9
15
  schemas?: AnyMachineSchemas;
@@ -29,13 +35,13 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
29
35
  /**
30
36
  * Clones this state machine with the provided implementations.
31
37
  *
32
- * @param implementations Options (`actions`, `guards`, `actors`, `delays`) to
33
- * recursively merge with the existing options.
38
+ * @param implementations Options (`actions`, `guards`, `actorSources`,
39
+ * `delays`) to recursively merge with the existing options.
34
40
  * @returns A new `StateMachine` instance with the provided implementations.
35
41
  */
36
- provide(implementations: {
42
+ provide<const TProvidedActorMap extends Partial<Record<keyof TActorMap & string, AnyActorLogic>> = {}>(implementations: {
37
43
  actions?: Partial<TActionMap>;
38
- actors?: Partial<TActorMap>;
44
+ actorSources?: TProvidedActorMap & ProvidedActorSources<TActorMap, TProvidedActorMap>;
39
45
  guards?: Partial<TGuardMap>;
40
46
  delays?: Partial<TDelayMap>;
41
47
  }): StateMachine<TContext, TEvent, TChildren, TStateValue, TTag, TInput, TOutput, TEmitted, TMeta, TConfig, TActionMap, TActorMap, TGuardMap, TDelayMap>;
@@ -78,3 +84,4 @@ export declare class StateMachine<TContext extends MachineContext, TEvent extend
78
84
  getPersistedSnapshot(snapshot: MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, options?: unknown): Snapshot<unknown>;
79
85
  restoreSnapshot(snapshot: Snapshot<unknown>, _actorScope: ActorScope<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>, TEvent, AnyActorSystem, TEmitted>): MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TConfig>;
80
86
  }
87
+ export {};
@@ -45,7 +45,7 @@ type MergeChildren<TChildren extends Record<string, AnyActorRef | undefined>, TA
45
45
  * @param options DEPRECATED: use `setup({ ... })` or `machine.provide({ ... })`
46
46
  * to provide machine implementations instead.
47
47
  */
48
- export declare function createMachine<TContextSchema extends StandardSchemaV1, const TEventSchemaMap extends Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1>, _TEvent extends EventObject, TActor extends ProvidedActor, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays'], TDelays extends string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, TInput, const TSS extends StateSchema>(config: TSS & ValidateDelayReferences<TSS> & Next_MachineConfig<TContextSchema, TEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap, InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap> & {
48
+ export declare function createMachine<TContextSchema extends StandardSchemaV1, const TEventSchemaMap extends Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1>, _TEvent extends EventObject, TActor extends ProvidedActor, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actorSources'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays'], TDelays extends string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, TInput, const TSS extends StateSchema>(config: TSS & ValidateDelayReferences<TSS> & Next_MachineConfig<TContextSchema, TEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap, InferOutput<TContextSchema, MachineContext>, InferEvents<TEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap> & {
49
49
  schemas: {
50
50
  context: TContextSchema;
51
51
  children?: TChildrenSchemaMap;
@@ -58,13 +58,13 @@ TSS, // TStateSchema
58
58
  TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>> & {
59
59
  states: TSS;
60
60
  };
61
- export declare function createMachine<TContext extends MachineContext = never, const TEventSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1 = StandardSchemaV1, TOutputSchema extends StandardSchemaV1 = StandardSchemaV1, TMetaSchema extends StandardSchemaV1 = StandardSchemaV1, TTagSchema extends StandardSchemaV1 = StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, _TEvent extends EventObject = EventObject, TActor extends ProvidedActor = ProvidedActor, TActionMap extends Implementations['actions'] = Implementations['actions'], TActorMap extends Implementations['actors'] = Implementations['actors'], TGuardMap extends Implementations['guards'] = Implementations['guards'], TDelayMap extends Implementations['delays'] = Implementations['delays'], TDelays extends string = string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string = StandardSchemaV1.InferOutput<TTagSchema> & string, TInput = unknown, const TSS extends StateSchema = StateSchema>(config: TSS & ValidateDelayReferences<TSS> & Next_MachineConfig<StandardSchemaV1, TEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap, WidenLiterals<TContext>, InferEvents<TEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap, false> & {
61
+ export declare function createMachine<TContext extends MachineContext = never, const TEventSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TEmittedSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, TInputSchema extends StandardSchemaV1 = StandardSchemaV1, TOutputSchema extends StandardSchemaV1 = StandardSchemaV1, TMetaSchema extends StandardSchemaV1 = StandardSchemaV1, TTagSchema extends StandardSchemaV1 = StandardSchemaV1, const TChildrenSchemaMap extends Record<string, StandardSchemaV1> = Record<string, StandardSchemaV1>, _TEvent extends EventObject = EventObject, TActor extends ProvidedActor = ProvidedActor, TActionMap extends Implementations['actions'] = Implementations['actions'], TActorMap extends Implementations['actorSources'] = Implementations['actorSources'], TGuardMap extends Implementations['guards'] = Implementations['guards'], TDelayMap extends Implementations['delays'] = Implementations['delays'], TDelays extends string = string, TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string = StandardSchemaV1.InferOutput<TTagSchema> & string, TInput = unknown, const TSS extends StateSchema = StateSchema>(config: TSS & ValidateDelayReferences<TSS> & Next_MachineConfig<StandardSchemaV1, TEventSchemaMap, TEmittedSchemaMap, TInputSchema, TOutputSchema, TMetaSchema, TTagSchema, TChildrenSchemaMap, WidenLiterals<TContext>, InferEvents<TEventSchemaMap>, Cast<MergeChildren<InferChildren<TChildrenSchemaMap>, TActor>, Record<string, AnyActorRef | undefined>>, TDelays, TTag, TActionMap, TActorMap, TGuardMap, TDelayMap, false> & {
62
62
  schemas?: {
63
63
  context?: never;
64
64
  };
65
65
  context?: TContext | ((_: {
66
66
  spawn: any;
67
- actors: TActorMap;
67
+ actorSources: TActorMap;
68
68
  input: InferOutput<TInputSchema, unknown>;
69
69
  self: any;
70
70
  }) => TContext);
@@ -77,5 +77,5 @@ TActionMap, TActorMap, TGuardMap, DelayMapFromNames<TDelays, TDelayMap>> & {
77
77
  states: TSS;
78
78
  };
79
79
  export declare function createStateConfig<TContextSchema extends StandardSchemaV1, TEventSchema extends StandardSchemaV1, TEmittedSchema extends StandardSchemaV1, _TInputSchema extends StandardSchemaV1, TOutputSchema extends StandardSchemaV1, TMetaSchema extends StandardSchemaV1, TTagSchema extends StandardSchemaV1, _TEvent extends StandardSchemaV1.InferOutput<TEventSchema> & EventObject, // TODO: consider using a stricter `EventObject` here
80
- _TActor extends ProvidedActor, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays'], TDelays extends string, _TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, _TInput, const TSS extends StateSchema>(config: TSS & Next_StateNodeConfig<InferOutput<TContextSchema, MachineContext>, DoNotInfer<StandardSchemaV1.InferOutput<TEventSchema> & EventObject>, DoNotInfer<TDelays>, DoNotInfer<StandardSchemaV1.InferOutput<TTagSchema> & string>, DoNotInfer<StandardSchemaV1.InferOutput<TOutputSchema>>, DoNotInfer<StandardSchemaV1.InferOutput<TEmittedSchema> & EventObject>, DoNotInfer<InferOutput<TMetaSchema, MetaObject>>, DoNotInfer<Record<string, AnyActorRef | undefined>>, DoNotInfer<TActionMap>, DoNotInfer<TActorMap>, DoNotInfer<TGuardMap>, DoNotInfer<TDelayMap>>): typeof config;
80
+ _TActor extends ProvidedActor, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actorSources'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays'], TDelays extends string, _TTag extends StandardSchemaV1.InferOutput<TTagSchema> & string, _TInput, const TSS extends StateSchema>(config: TSS & Next_StateNodeConfig<InferOutput<TContextSchema, MachineContext>, DoNotInfer<StandardSchemaV1.InferOutput<TEventSchema> & EventObject>, DoNotInfer<TDelays>, DoNotInfer<StandardSchemaV1.InferOutput<TTagSchema> & string>, DoNotInfer<StandardSchemaV1.InferOutput<TOutputSchema>>, DoNotInfer<StandardSchemaV1.InferOutput<TEmittedSchema> & EventObject>, DoNotInfer<InferOutput<TMetaSchema, MetaObject>>, DoNotInfer<Record<string, AnyActorRef | undefined>>, DoNotInfer<TActionMap>, DoNotInfer<TActorMap>, DoNotInfer<TGuardMap>, DoNotInfer<TDelayMap>>): typeof config;
81
81
  export {};
@@ -159,7 +159,7 @@ export interface MachineJSON extends StateNodeJSON {
159
159
  version?: string;
160
160
  actions?: Record<string, unknown>;
161
161
  guards?: Record<string, unknown>;
162
- actors?: Record<string, unknown>;
162
+ actorSources?: Record<string, unknown>;
163
163
  delays?: Record<string, unknown>;
164
164
  schemas?: Record<string, unknown>;
165
165
  }
@@ -170,7 +170,7 @@ interface UnserializableMarker {
170
170
  interface MachineImplementations {
171
171
  actions?: Record<string, (...args: any[]) => unknown>;
172
172
  guards?: Record<string, (...args: any[]) => boolean>;
173
- actors?: Record<string, AnyActorLogic>;
173
+ actorSources?: Record<string, AnyActorLogic>;
174
174
  delays?: Record<string, number | ((...args: any[]) => number)>;
175
175
  }
176
176
  export declare function createMachineFromConfig(json: MachineJSON, implementations?: MachineImplementations): AnyStateMachine;
@@ -8,6 +8,7 @@ export { machineConfigToJSON, serializeMachine, type CodeExpression, type Unseri
8
8
  export { mapState } from "./mapState.js";
9
9
  export { types, isTypeSchema, type StandardSchemaV1, type TypeSchema } from "./schema.types.js";
10
10
  export { createSystem, setup } from "./setup.js";
11
+ export type { AnySetupConfig, SetupConfig, SetupReturn, SetupReturnFromConfig, SetupSchemas, SetupStateSchema, SetupStateSchemas } from "./setup.js";
11
12
  export { getInitialSnapshot, getNextSnapshot } from "./getNextSnapshot.js";
12
13
  export type { InspectionEvent, ActorInspectionEvent, TransitionInspectionEvent, ActionRecord, SentRecord } from "./inspection.js";
13
14
  export { SimulatedClock } from "./SimulatedClock.js";
@@ -11,7 +11,8 @@
11
11
  * A machine definition is fully portable iff its JSON contains no
12
12
  * `$unserializable` markers; reviving a definition that has markers requires
13
13
  * re-providing those implementations (e.g. via `machine.provide(...)` or the
14
- * `actions`/`guards`/`actors` maps on `createMachineFromConfig` revival).
14
+ * `actions`/`guards`/`actorSources` maps on `createMachineFromConfig`
15
+ * revival).
15
16
  */
16
17
  import type { AnyStateMachine } from "./types.js";
17
18
  export interface UnserializableMarker {