xstate 5.17.1 → 5.17.3

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.
@@ -764,6 +764,7 @@ export type UnknownActorRef = ActorRef<Snapshot<unknown>, EventObject>;
764
764
  export type ActorLogicFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<any, any, any, any, any, any, any, any, any, any, any, any, any, // TMeta
765
765
  any> ? R : R extends Promise<infer U> ? PromiseActorLogic<U> : never : never;
766
766
  export type ActorRefFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<infer TContext, infer TEvent, infer TChildren, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TStateValue, infer TTag, infer _TInput, infer TOutput, infer TEmitted, infer TMeta, infer TStateSchema> ? ActorRef<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, TEvent, TEmitted> : R extends Promise<infer U> ? ActorRefFrom<PromiseActorLogic<U>> : R extends ActorLogic<infer TSnapshot, infer TEvent, infer _TInput, infer _TSystem, infer TEmitted> ? ActorRef<TSnapshot, TEvent, TEmitted> : never : never;
767
+ export type ActorRefFromLogic<T extends AnyActorLogic> = ActorRef<SnapshotFrom<T>, EventFromLogic<T>, EmittedFrom<T>>;
767
768
  export type DevToolsAdapter = (service: AnyActor) => void;
768
769
  /** @deprecated Use `Actor<T>` instead. */
769
770
  export type InterpreterFrom<T extends AnyStateMachine | ((...args: any[]) => AnyStateMachine)> = ReturnTypeOrValue<T> extends StateMachine<infer TContext, infer TEvent, infer TChildren, infer _TActor, infer _TAction, infer _TGuard, infer _TDelay, infer TStateValue, infer TTag, infer TInput, infer TOutput, infer TEmitted, infer TMeta, infer TStateSchema> ? Actor<ActorLogic<MachineSnapshot<TContext, TEvent, TChildren, TStateValue, TTag, TOutput, TMeta, TStateSchema>, TEvent, TInput, AnyActorSystem, TEmitted>> : never;
@@ -863,7 +864,7 @@ any, // system
863
864
  any>;
864
865
  export type UnknownActorLogic = ActorLogic<any, // snapshot
865
866
  any, // event
866
- never, // input
867
+ any, // input
867
868
  AnyActorSystem, any>;
868
869
  export type SnapshotFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends ActorRef<infer TSnapshot, infer _, infer __> ? TSnapshot : R extends Actor<infer TLogic> ? SnapshotFrom<TLogic> : R extends ActorLogic<infer _TSnapshot, infer _TEvent, infer _TInput, infer _TEmitted, infer _TSystem> ? ReturnType<R['transition']> : R extends ActorScope<infer TSnapshot, infer _TEvent, infer _TEmitted, infer _TSystem> ? TSnapshot : never : never;
869
870
  export type EventFromLogic<TLogic extends AnyActorLogic> = TLogic extends ActorLogic<infer _TSnapshot, infer TEvent, infer _TInput, infer _TEmitted, infer _TSystem> ? TEvent : never;
@@ -887,17 +888,29 @@ export interface ActorSystemInfo {
887
888
  export type RequiredActorOptions<TActor extends ProvidedActor> = (undefined extends TActor['id'] ? never : 'id') | (undefined extends InputFrom<TActor['logic']> ? never : 'input');
888
889
  type ExtractLiteralString<T extends string | undefined> = T extends string ? string extends T ? never : T : never;
889
890
  type ToConcreteChildren<TActor extends ProvidedActor> = {
890
- [A in TActor as ExtractLiteralString<A['id']>]?: ActorRefFrom<A['logic']>;
891
+ [A in TActor as ExtractLiteralString<A['id']>]?: ActorRefFromLogic<A['logic']>;
891
892
  };
892
893
  export type ToChildren<TActor extends ProvidedActor> = string extends TActor['src'] ? Record<string, AnyActorRef> : Compute<ToConcreteChildren<TActor> & {
893
894
  include: {
894
- [id: string]: TActor extends any ? ActorRefFrom<TActor['logic']> | undefined : never;
895
+ [id: string]: TActor extends any ? ActorRefFromLogic<TActor['logic']> | undefined : never;
895
896
  };
896
897
  exclude: {};
897
898
  }[undefined extends TActor['id'] ? 'include' : string extends TActor['id'] ? 'include' : 'exclude']>;
898
899
  export type StateSchema = {
899
900
  id?: string;
900
901
  states?: Record<string, StateSchema>;
902
+ type?: unknown;
903
+ invoke?: unknown;
904
+ on?: unknown;
905
+ entry?: unknown;
906
+ exit?: unknown;
907
+ onDone?: unknown;
908
+ after?: unknown;
909
+ always?: unknown;
910
+ meta?: unknown;
911
+ output?: unknown;
912
+ tags?: unknown;
913
+ description?: unknown;
901
914
  };
902
915
  export type StateId<TSchema extends StateSchema, TKey extends string = '(machine)', TParentKey extends string | null = null> = (TSchema extends {
903
916
  id: string;
@@ -251,6 +251,8 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
251
251
 
252
252
  // Based on RxJS types
253
253
 
254
+ // TODO: in v6, this should only accept AnyActorLogic, like ActorRefFromLogic
255
+
254
256
  /** @deprecated Use `Actor<T>` instead. */
255
257
 
256
258
  /**
@@ -249,6 +249,8 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
249
249
 
250
250
  // Based on RxJS types
251
251
 
252
+ // TODO: in v6, this should only accept AnyActorLogic, like ActorRefFromLogic
253
+
252
254
  /** @deprecated Use `Actor<T>` instead. */
253
255
 
254
256
  /**
@@ -234,6 +234,8 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
234
234
 
235
235
  // Based on RxJS types
236
236
 
237
+ // TODO: in v6, this should only accept AnyActorLogic, like ActorRefFromLogic
238
+
237
239
  /** @deprecated Use `Actor<T>` instead. */
238
240
 
239
241
  /**
@@ -236,6 +236,8 @@ let SpecialTargets = /*#__PURE__*/function (SpecialTargets) {
236
236
 
237
237
  // Based on RxJS types
238
238
 
239
+ // TODO: in v6, this should only accept AnyActorLogic, like ActorRefFromLogic
240
+
239
241
  /** @deprecated Use `Actor<T>` instead. */
240
242
 
241
243
  /**
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var guards_dist_xstateGuards = require('./State-30c95050.cjs.js');
6
- var log = require('./log-19086852.cjs.js');
6
+ var log = require('./log-f7dcaa97.cjs.js');
7
7
  var actors_dist_xstateActors = require('../actors/dist/xstate-actors.cjs.js');
8
8
  require('../dev/dist/xstate-dev.cjs.js');
9
9
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var guards_dist_xstateGuards = require('./State-a2464a1e.development.cjs.js');
6
- var log = require('./log-ec36113c.development.cjs.js');
6
+ var log = require('./log-40d606d3.development.cjs.js');
7
7
  var actors_dist_xstateActors = require('../actors/dist/xstate-actors.development.cjs.js');
8
8
  require('../dev/dist/xstate-dev.development.cjs.js');
9
9
 
@@ -1,7 +1,7 @@
1
1
  import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as toStatePath, w as isStateId, x as getStateNodeByPath, y as getPersistedSnapshot, z as resolveReferencedActor, A as createActor, $ as $$ACTOR_TYPE } from './State-34039d2a.development.esm.js';
2
2
  export { C as Actor, I as __unsafe_getAllOwnEventDescriptors, E as and, M as cancel, A as createActor, j as getStateNodes, D as interpret, B as isMachineSnapshot, J as matchesState, F as not, G as or, K as pathToStateValue, O as raise, P as spawnChild, H as stateIn, Q as stop, R as stopChild, L as toObserver } from './State-34039d2a.development.esm.js';
3
- import { a as assign } from './log-62f17756.development.esm.js';
4
- export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-62f17756.development.esm.js';
3
+ import { a as assign } from './log-4f8360d3.development.esm.js';
4
+ export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-4f8360d3.development.esm.js';
5
5
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.development.esm.js';
6
6
  import '../dev/dist/xstate-dev.development.esm.js';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { S as STATE_DELIMITER, m as mapValues, t as toArray, f as formatTransitions, a as toTransitionConfigArray, b as formatTransition, N as NULL_EVENT, e as evaluateGuard, c as createInvokeId, g as getDelayedTransitions, d as formatInitialTransition, h as getCandidates, r as resolveStateValue, i as getAllStateNodes, j as getStateNodes, k as createMachineSnapshot, l as isInFinalState, n as macrostep, o as transitionNode, p as resolveActionsAndContext, q as createInitEvent, s as microstep, u as getInitialStateNodes, v as toStatePath, w as isStateId, x as getStateNodeByPath, y as getPersistedSnapshot, z as resolveReferencedActor, A as createActor, $ as $$ACTOR_TYPE } from './State-cdbc7940.esm.js';
2
2
  export { C as Actor, I as __unsafe_getAllOwnEventDescriptors, E as and, M as cancel, A as createActor, j as getStateNodes, D as interpret, B as isMachineSnapshot, J as matchesState, F as not, G as or, K as pathToStateValue, O as raise, P as spawnChild, H as stateIn, Q as stop, R as stopChild, L as toObserver } from './State-cdbc7940.esm.js';
3
- import { a as assign } from './log-4a38a98a.esm.js';
4
- export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-4a38a98a.esm.js';
3
+ import { a as assign } from './log-54d038f7.esm.js';
4
+ export { S as SpecialTargets, a as assign, e as emit, b as enqueueActions, f as forwardTo, l as log, s as sendParent, c as sendTo } from './log-54d038f7.esm.js';
5
5
  export { createEmptyActor, fromCallback, fromEventObservable, fromObservable, fromPromise, fromTransition } from '../actors/dist/xstate-actors.esm.js';
6
6
  import '../dev/dist/xstate-dev.esm.js';
7
7