Socket
Socket
Sign inDemoInstall

xstate

Package Overview
Dependencies
Maintainers
3
Versions
248
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xstate - npm Package Compare versions

Comparing version 5.0.1 to 5.0.2

1

actors/dist/xstate-actors.cjs.js

@@ -533,3 +533,2 @@ 'use strict';

function fromPromise(promiseCreator) {
// TODO: add event types
const logic = {

@@ -536,0 +535,0 @@ config: promiseCreator,

@@ -533,3 +533,2 @@ 'use strict';

function fromPromise(promiseCreator) {
// TODO: add event types
const logic = {

@@ -536,0 +535,0 @@ config: promiseCreator,

@@ -529,3 +529,2 @@ import { X as XSTATE_STOP, z as createActor } from '../../dist/raise-89c581c4.development.esm.js';

function fromPromise(promiseCreator) {
// TODO: add event types
const logic = {

@@ -532,0 +531,0 @@ config: promiseCreator,

@@ -529,3 +529,2 @@ import { X as XSTATE_STOP, z as createActor } from '../../dist/raise-8bc422d1.esm.js';

function fromPromise(promiseCreator) {
// TODO: add event types
const logic = {

@@ -532,0 +531,0 @@ config: promiseCreator,

@@ -1,2 +0,1 @@

import { XSTATE_STOP } from "../constants.js";
import { ActorLogic, ActorRefFrom, ActorSystem, AnyActorSystem, NonReducibleUnknown, Snapshot } from "../types.js";

@@ -6,13 +5,2 @@ export type PromiseSnapshot<TOutput, TInput> = Snapshot<TOutput> & {

};
declare const XSTATE_PROMISE_RESOLVE = "xstate.promise.resolve";
declare const XSTATE_PROMISE_REJECT = "xstate.promise.reject";
export type PromiseActorEvents<T> = {
type: typeof XSTATE_PROMISE_RESOLVE;
data: T;
} | {
type: typeof XSTATE_PROMISE_REJECT;
data: any;
} | {
type: typeof XSTATE_STOP;
};
export type PromiseActorLogic<TOutput, TInput = unknown> = ActorLogic<PromiseSnapshot<TOutput, TInput>, {

@@ -82,2 +70,1 @@ type: string;

}) => PromiseLike<TOutput>): PromiseActorLogic<TOutput, TInput>;
export {};

10

dist/declarations/src/setup.d.ts
import { StateMachine } from "./StateMachine.js";
import { GuardPredicate } from "./guards.js";
import { ResolveTypegenMeta, TypegenDisabled } from "./typegenTypes.js";
import { ActionFunction, AnyActorLogic, AnyActorRef, AnyEventObject, Cast, ConditionalRequired, DelayConfig, Invert, IsNever, MachineConfig, MachineContext, NonReducibleUnknown, ParameterizedObject, SetupTypes, StateSchema, ToChildren, UnknownActorLogic, Values } from "./types.js";
import { ActionFunction, AnyActorRef, AnyEventObject, Cast, ConditionalRequired, DelayConfig, Invert, IsNever, MachineConfig, MachineContext, NonReducibleUnknown, ParameterizedObject, SetupTypes, StateSchema, ToChildren, UnknownActorLogic, Values } from "./types.js";
type ToParameterizedObject<TParameterizedMap extends Record<string, ParameterizedObject['params'] | undefined>> = Values<{

@@ -11,4 +11,4 @@ [K in keyof TParameterizedMap & string]: {

}>;
type DefaultToAnyActors<TActors extends Record<string, AnyActorLogic>> = IsNever<keyof TActors> extends true ? Record<string, AnyActorLogic> : TActors;
type ToProvidedActor<TChildrenMap extends Record<string, string>, TActors extends Record<Values<TChildrenMap>, AnyActorLogic>, TResolvedActors extends Record<string, AnyActorLogic> = DefaultToAnyActors<TActors>> = Values<{
type DefaultToUnknownActorLogic<TActors extends Record<string, UnknownActorLogic>> = IsNever<keyof TActors> extends true ? Record<string, UnknownActorLogic> : TActors;
type ToProvidedActor<TChildrenMap extends Record<string, string>, TActors extends Record<Values<TChildrenMap>, UnknownActorLogic>, TResolvedActors extends Record<string, UnknownActorLogic> = DefaultToUnknownActorLogic<TActors>> = Values<{
[K in keyof TResolvedActors & string]: {

@@ -39,3 +39,5 @@ src: K;

types?: SetupTypes<TContext, TEvent, TChildrenMap, TTag, TInput, TOutput>;
actors?: TActors;
actors?: {
[K in keyof TActors]: TActors[K];
};
actions?: {

@@ -42,0 +44,0 @@ [K in keyof TActions]: ActionFunction<TContext, TEvent, TEvent, TActions[K], ToProvidedActor<TChildrenMap, TActors>, ToParameterizedObject<TActions>, ToParameterizedObject<TGuards>, TDelay>;

@@ -67,3 +67,3 @@ import type { StateNode } from "./StateNode.js";

*/
export interface EventObject {
export type EventObject = {
/**

@@ -73,3 +73,3 @@ * The type of event that is sent.

type: string;
}
};
export interface AnyEventObject extends EventObject {

@@ -92,4 +92,4 @@ [key: string]: any;

}
export type InputFrom<T extends AnyActorLogic> = 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 _TResolvedTypesMeta> ? TInput : T extends ActorLogic<infer _TSnapshot, infer _TEvent, infer TInput, infer _TSystem> ? TInput : never;
export type OutputFrom<T extends AnyActorLogic> = T extends ActorLogic<infer TSnapshot, infer _TEvent, infer _TInput, infer _TSystem> ? (TSnapshot & {
export type InputFrom<T> = 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 _TResolvedTypesMeta> ? TInput : T extends ActorLogic<infer _TSnapshot, infer _TEvent, infer TInput, infer _TSystem> ? TInput : never;
export type OutputFrom<T> = T extends ActorLogic<infer TSnapshot, infer _TEvent, infer _TInput, infer _TSystem> ? (TSnapshot & {
status: 'done';

@@ -458,3 +458,3 @@ })['output'] : never;

src: string;
logic: AnyActorLogic;
logic: UnknownActorLogic;
id?: string;

@@ -811,3 +811,5 @@ }

*/
export interface ActorLogic<TSnapshot extends Snapshot<unknown>, TEvent extends EventObject, TInput = NonReducibleUnknown, TSystem extends ActorSystem<any> = ActorSystem<any>> {
export interface ActorLogic<in out TSnapshot extends Snapshot<unknown>, // it's invariant because it's also part of `ActorScope["self"]["getSnapshot"]`
in out TEvent extends EventObject, // it's invariant because it's also part of `ActorScope["self"]["send"]`
in TInput = NonReducibleUnknown, TSystem extends ActorSystem<any> = ActorSystem<any>> {
/** The initial setup/configuration used to create the actor logic. */

@@ -820,6 +822,6 @@ config?: unknown;

* @param message - The incoming message.
* @param ctx - The actor scope.
* @param actorScope - The actor scope.
* @returns The new state.
*/
transition: (snapshot: TSnapshot, message: TEvent, ctx: ActorScope<TSnapshot, TEvent, TSystem>) => TSnapshot;
transition: (snapshot: TSnapshot, message: TEvent, actorScope: ActorScope<TSnapshot, TEvent, TSystem>) => TSnapshot;
/**

@@ -858,4 +860,3 @@ * Called to provide the initial state of the actor.

any>;
export type UnknownActorLogic = ActorLogic<any, // this is invariant and it's hard to figure out a better default than `any`
EventObject, NonReducibleUnknown, ActorSystem<any>>;
export type UnknownActorLogic = ActorLogic<any, any, never, ActorSystem<any>>;
export type SnapshotFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends ActorRef<infer TSnapshot, infer _> ? TSnapshot : R extends Actor<infer TLogic> ? SnapshotFrom<TLogic> : R extends ActorLogic<infer _, infer __, infer ___, infer ____> ? ReturnType<R['transition']> : R extends ActorScope<infer TSnapshot, infer _, infer __> ? TSnapshot : never : never;

@@ -862,0 +863,0 @@ export type EventFromLogic<TLogic extends ActorLogic<any, any, any, any>> = TLogic extends ActorLogic<infer _, infer TEvent, infer __, infer _____> ? TEvent : never;

{
"name": "xstate",
"version": "5.0.1",
"version": "5.0.2",
"description": "Finite State Machines and Statecharts for the Modern Web.",

@@ -5,0 +5,0 @@ "main": "dist/xstate.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc