xstate 6.0.0-alpha.68 → 6.0.0-alpha.69
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/declarations/src/actors/promise.d.ts +33 -13
- package/dist/{index-e37fe162.development.cjs.js → index-43ce8782.development.cjs.js} +18 -0
- package/dist/{index-87254d79.development.esm.js → index-52951124.development.esm.js} +18 -0
- package/dist/{index-45b828dc.cjs.js → index-a2835490.cjs.js} +18 -0
- package/dist/{index-da387f5d.esm.js → index-d064963f.esm.js} +18 -0
- package/dist/xstate-actors.cjs.js +1 -1
- package/dist/xstate-actors.development.cjs.js +1 -1
- package/dist/xstate-actors.development.esm.js +1 -1
- package/dist/xstate-actors.esm.js +1 -1
- package/dist/xstate-actors.umd.min.js.map +1 -1
- package/dist/xstate-graph.cjs.js +1 -1
- package/dist/xstate-graph.development.cjs.js +1 -1
- package/dist/xstate-graph.development.esm.js +1 -1
- package/dist/xstate-graph.esm.js +1 -1
- package/dist/xstate.cjs.js +1 -1
- package/dist/xstate.development.cjs.js +1 -1
- package/dist/xstate.development.esm.js +2 -2
- package/dist/xstate.esm.js +2 -2
- package/dist/xstate.umd.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -85,6 +85,26 @@ export declare class TimeoutError extends Error {
|
|
|
85
85
|
export type AsyncLogicError<TErrorSchema extends StandardSchemaV1, TTimeout> = [
|
|
86
86
|
TTimeout
|
|
87
87
|
] extends [undefined] ? StandardSchemaV1.InferOutput<TErrorSchema> : StandardSchemaV1.InferOutput<TErrorSchema> | TimeoutError;
|
|
88
|
+
type AsyncLogicLiteralOutput<T> = string | number | bigint | boolean | null | undefined | {
|
|
89
|
+
[key: string]: T;
|
|
90
|
+
} | readonly T[];
|
|
91
|
+
/**
|
|
92
|
+
* Contextual typing aid for the schema-free `createAsyncLogic` overload. It
|
|
93
|
+
* never matches a call (`schemas: never`).
|
|
94
|
+
*
|
|
95
|
+
* TypeScript fixes the return type of a parameterless `run` the first time an
|
|
96
|
+
* overload contextually types it, and the schema-free overload is checked
|
|
97
|
+
* first. Configs without `schemas` are discriminated to the schema-free member,
|
|
98
|
+
* so their output widens as usual. Configs with `schemas` see this member too:
|
|
99
|
+
* its `TLiteralOutput` return keeps literals such as `{ kind: 'a' }` from
|
|
100
|
+
* widening to `{ kind: string }` before the schema overloads check `run`
|
|
101
|
+
* against `schemas.output`. The member cannot tell which schemas are present,
|
|
102
|
+
* so input-only and error-only configs keep those literals as well.
|
|
103
|
+
*/
|
|
104
|
+
type AsyncLogicSchemaContext<TOutput, TInput, TEmitted extends EventObject, TLiteralOutput> = {
|
|
105
|
+
schemas: never;
|
|
106
|
+
run: (args: AsyncLogicArgs<TOutput, TInput>, enq: AsyncLogicEnqueue<TEmitted>) => PromiseLike<TLiteralOutput>;
|
|
107
|
+
};
|
|
88
108
|
/**
|
|
89
109
|
* Represents an actor created by `createAsyncLogic`.
|
|
90
110
|
*
|
|
@@ -183,20 +203,9 @@ export type AsyncLogicError<TErrorSchema extends StandardSchemaV1, TTimeout> = [
|
|
|
183
203
|
* @see {@link https://stately.ai/docs/input | Input docs} for more information about how input is passed
|
|
184
204
|
* @public
|
|
185
205
|
*/
|
|
186
|
-
export declare function createAsyncLogic<TOutput, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject>(asyncLogic: Omit<AsyncLogicConfig<TOutput, TInput, TEmitted>, 'schemas'> & {
|
|
206
|
+
export declare function createAsyncLogic<TOutput, TInput = NonReducibleUnknown, TEmitted extends EventObject = EventObject, TLiteralOutput extends AsyncLogicLiteralOutput<TLiteralOutput> = never>(asyncLogic: (Omit<AsyncLogicConfig<TOutput, TInput, TEmitted>, 'schemas'> & {
|
|
187
207
|
schemas?: undefined;
|
|
188
|
-
}): AsyncActorLogic<TOutput, TInput, TEmitted> & {
|
|
189
|
-
id?: string;
|
|
190
|
-
};
|
|
191
|
-
export declare function createAsyncLogic<const TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TEmitted extends EventObject = EventObject, const TErrorSchema extends StandardSchemaV1 = StandardSchemaV1, TTimeout extends number | string | undefined = undefined>(asyncLogic: AsyncLogicConfig<StandardSchemaV1.InferOutput<TOutputSchema>, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema, TOutputSchema, TErrorSchema> & {
|
|
192
|
-
schemas: {
|
|
193
|
-
input: TInputSchema;
|
|
194
|
-
output: TOutputSchema;
|
|
195
|
-
error?: TErrorSchema;
|
|
196
|
-
};
|
|
197
|
-
} & {
|
|
198
|
-
timeout?: TTimeout;
|
|
199
|
-
}): AsyncActorLogic<StandardSchemaV1.InferOutput<TOutputSchema>, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, AsyncLogicError<TErrorSchema, TTimeout>> & {
|
|
208
|
+
}) | AsyncLogicSchemaContext<TOutput, TInput, TEmitted, TLiteralOutput>): AsyncActorLogic<TOutput, TInput, TEmitted> & {
|
|
200
209
|
id?: string;
|
|
201
210
|
};
|
|
202
211
|
export declare function createAsyncLogic<const TInputSchema extends StandardSchemaV1, TEmitted extends EventObject = EventObject, TLogicFunction extends AsyncLogicFunction<any, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted> = AsyncLogicFunction<any, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted>, const TErrorSchema extends StandardSchemaV1 = StandardSchemaV1, TTimeout extends number | string | undefined = undefined>(asyncLogic: Omit<AsyncLogicConfig<never, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema>, 'run' | 'schemas'> & {
|
|
@@ -233,4 +242,15 @@ export declare function createAsyncLogic<TOutput, TInput = NonReducibleUnknown,
|
|
|
233
242
|
}): AsyncActorLogic<TOutput, TInput, TEmitted, AsyncLogicError<TErrorSchema, TTimeout>> & {
|
|
234
243
|
id?: string;
|
|
235
244
|
};
|
|
245
|
+
export declare function createAsyncLogic<const TInputSchema extends StandardSchemaV1, const TOutputSchema extends StandardSchemaV1, TEmitted extends EventObject = EventObject, const TErrorSchema extends StandardSchemaV1 = StandardSchemaV1, TTimeout extends number | string | undefined = undefined>(asyncLogic: AsyncLogicConfig<StandardSchemaV1.InferOutput<TOutputSchema>, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, TInputSchema, TOutputSchema, TErrorSchema> & {
|
|
246
|
+
schemas: {
|
|
247
|
+
input?: TInputSchema;
|
|
248
|
+
output: TOutputSchema;
|
|
249
|
+
error?: TErrorSchema;
|
|
250
|
+
};
|
|
251
|
+
} & {
|
|
252
|
+
timeout?: TTimeout;
|
|
253
|
+
}): AsyncActorLogic<StandardSchemaV1.InferOutput<TOutputSchema>, StandardSchemaV1.InferOutput<TInputSchema>, TEmitted, AsyncLogicError<TErrorSchema, TTimeout>> & {
|
|
254
|
+
id?: string;
|
|
255
|
+
};
|
|
236
256
|
export {};
|
|
@@ -796,6 +796,20 @@ class TimeoutError extends Error {
|
|
|
796
796
|
* @public
|
|
797
797
|
*/
|
|
798
798
|
|
|
799
|
+
/**
|
|
800
|
+
* Contextual typing aid for the schema-free `createAsyncLogic` overload. It
|
|
801
|
+
* never matches a call (`schemas: never`).
|
|
802
|
+
*
|
|
803
|
+
* TypeScript fixes the return type of a parameterless `run` the first time an
|
|
804
|
+
* overload contextually types it, and the schema-free overload is checked
|
|
805
|
+
* first. Configs without `schemas` are discriminated to the schema-free member,
|
|
806
|
+
* so their output widens as usual. Configs with `schemas` see this member too:
|
|
807
|
+
* its `TLiteralOutput` return keeps literals such as `{ kind: 'a' }` from
|
|
808
|
+
* widening to `{ kind: string }` before the schema overloads check `run`
|
|
809
|
+
* against `schemas.output`. The member cannot tell which schemas are present,
|
|
810
|
+
* so input-only and error-only configs keep those literals as well.
|
|
811
|
+
*/
|
|
812
|
+
|
|
799
813
|
/**
|
|
800
814
|
* Represents an actor created by `createAsyncLogic`.
|
|
801
815
|
*
|
|
@@ -896,6 +910,10 @@ class TimeoutError extends Error {
|
|
|
896
910
|
* @public
|
|
897
911
|
*/
|
|
898
912
|
|
|
913
|
+
// Last so that a `run` that does not match `schemas.output` reports the
|
|
914
|
+
// output mismatch. `input` is optional here only for that report: output-only
|
|
915
|
+
// configs match the output-only overload above first.
|
|
916
|
+
|
|
899
917
|
function createAsyncLogic(asyncLogic) {
|
|
900
918
|
const config = asyncLogic;
|
|
901
919
|
const logic = createStepLogic({
|
|
@@ -794,6 +794,20 @@ class TimeoutError extends Error {
|
|
|
794
794
|
* @public
|
|
795
795
|
*/
|
|
796
796
|
|
|
797
|
+
/**
|
|
798
|
+
* Contextual typing aid for the schema-free `createAsyncLogic` overload. It
|
|
799
|
+
* never matches a call (`schemas: never`).
|
|
800
|
+
*
|
|
801
|
+
* TypeScript fixes the return type of a parameterless `run` the first time an
|
|
802
|
+
* overload contextually types it, and the schema-free overload is checked
|
|
803
|
+
* first. Configs without `schemas` are discriminated to the schema-free member,
|
|
804
|
+
* so their output widens as usual. Configs with `schemas` see this member too:
|
|
805
|
+
* its `TLiteralOutput` return keeps literals such as `{ kind: 'a' }` from
|
|
806
|
+
* widening to `{ kind: string }` before the schema overloads check `run`
|
|
807
|
+
* against `schemas.output`. The member cannot tell which schemas are present,
|
|
808
|
+
* so input-only and error-only configs keep those literals as well.
|
|
809
|
+
*/
|
|
810
|
+
|
|
797
811
|
/**
|
|
798
812
|
* Represents an actor created by `createAsyncLogic`.
|
|
799
813
|
*
|
|
@@ -894,6 +908,10 @@ class TimeoutError extends Error {
|
|
|
894
908
|
* @public
|
|
895
909
|
*/
|
|
896
910
|
|
|
911
|
+
// Last so that a `run` that does not match `schemas.output` reports the
|
|
912
|
+
// output mismatch. `input` is optional here only for that report: output-only
|
|
913
|
+
// configs match the output-only overload above first.
|
|
914
|
+
|
|
897
915
|
function createAsyncLogic(asyncLogic) {
|
|
898
916
|
const config = asyncLogic;
|
|
899
917
|
const logic = createStepLogic({
|
|
@@ -796,6 +796,20 @@ class TimeoutError extends Error {
|
|
|
796
796
|
* @public
|
|
797
797
|
*/
|
|
798
798
|
|
|
799
|
+
/**
|
|
800
|
+
* Contextual typing aid for the schema-free `createAsyncLogic` overload. It
|
|
801
|
+
* never matches a call (`schemas: never`).
|
|
802
|
+
*
|
|
803
|
+
* TypeScript fixes the return type of a parameterless `run` the first time an
|
|
804
|
+
* overload contextually types it, and the schema-free overload is checked
|
|
805
|
+
* first. Configs without `schemas` are discriminated to the schema-free member,
|
|
806
|
+
* so their output widens as usual. Configs with `schemas` see this member too:
|
|
807
|
+
* its `TLiteralOutput` return keeps literals such as `{ kind: 'a' }` from
|
|
808
|
+
* widening to `{ kind: string }` before the schema overloads check `run`
|
|
809
|
+
* against `schemas.output`. The member cannot tell which schemas are present,
|
|
810
|
+
* so input-only and error-only configs keep those literals as well.
|
|
811
|
+
*/
|
|
812
|
+
|
|
799
813
|
/**
|
|
800
814
|
* Represents an actor created by `createAsyncLogic`.
|
|
801
815
|
*
|
|
@@ -896,6 +910,10 @@ class TimeoutError extends Error {
|
|
|
896
910
|
* @public
|
|
897
911
|
*/
|
|
898
912
|
|
|
913
|
+
// Last so that a `run` that does not match `schemas.output` reports the
|
|
914
|
+
// output mismatch. `input` is optional here only for that report: output-only
|
|
915
|
+
// configs match the output-only overload above first.
|
|
916
|
+
|
|
899
917
|
function createAsyncLogic(asyncLogic) {
|
|
900
918
|
const config = asyncLogic;
|
|
901
919
|
const logic = createStepLogic({
|
|
@@ -794,6 +794,20 @@ class TimeoutError extends Error {
|
|
|
794
794
|
* @public
|
|
795
795
|
*/
|
|
796
796
|
|
|
797
|
+
/**
|
|
798
|
+
* Contextual typing aid for the schema-free `createAsyncLogic` overload. It
|
|
799
|
+
* never matches a call (`schemas: never`).
|
|
800
|
+
*
|
|
801
|
+
* TypeScript fixes the return type of a parameterless `run` the first time an
|
|
802
|
+
* overload contextually types it, and the schema-free overload is checked
|
|
803
|
+
* first. Configs without `schemas` are discriminated to the schema-free member,
|
|
804
|
+
* so their output widens as usual. Configs with `schemas` see this member too:
|
|
805
|
+
* its `TLiteralOutput` return keeps literals such as `{ kind: 'a' }` from
|
|
806
|
+
* widening to `{ kind: string }` before the schema overloads check `run`
|
|
807
|
+
* against `schemas.output`. The member cannot tell which schemas are present,
|
|
808
|
+
* so input-only and error-only configs keep those literals as well.
|
|
809
|
+
*/
|
|
810
|
+
|
|
797
811
|
/**
|
|
798
812
|
* Represents an actor created by `createAsyncLogic`.
|
|
799
813
|
*
|
|
@@ -894,6 +908,10 @@ class TimeoutError extends Error {
|
|
|
894
908
|
* @public
|
|
895
909
|
*/
|
|
896
910
|
|
|
911
|
+
// Last so that a `run` that does not match `schemas.output` reports the
|
|
912
|
+
// output mismatch. `input` is optional here only for that report: output-only
|
|
913
|
+
// configs match the output-only overload above first.
|
|
914
|
+
|
|
897
915
|
function createAsyncLogic(asyncLogic) {
|
|
898
916
|
const config = asyncLogic;
|
|
899
917
|
const logic = createStepLogic({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var createActor = require('./createActor-b14a387c.development.cjs.js');
|
|
6
|
-
var dist_xstateActors = require('./index-
|
|
6
|
+
var dist_xstateActors = require('./index-43ce8782.development.cjs.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { al as createListenerLogic, am as createSubscriptionLogic } from './createActor-c121cbf9.development.esm.js';
|
|
2
|
-
export { T as TimeoutError, c as createAsyncLogic, b as createCallbackLogic, d as createEmptyActor, e as createEventObservableLogic, g as createObservableLogic, f as createStepLogic } from './index-
|
|
2
|
+
export { T as TimeoutError, c as createAsyncLogic, b as createCallbackLogic, d as createEmptyActor, e as createEventObservableLogic, g as createObservableLogic, f as createStepLogic } from './index-52951124.development.esm.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { ak as createListenerLogic, al as createSubscriptionLogic } from './createActor-a8baa71f.esm.js';
|
|
2
|
-
export { T as TimeoutError, c as createAsyncLogic, b as createCallbackLogic, d as createEmptyActor, e as createEventObservableLogic, g as createObservableLogic, f as createStepLogic } from './index-
|
|
2
|
+
export { T as TimeoutError, c as createAsyncLogic, b as createCallbackLogic, d as createEmptyActor, e as createEventObservableLogic, g as createObservableLogic, f as createStepLogic } from './index-d064963f.esm.js';
|