1 | import { ActionArgs, ActionFunction, AnyActorLogic, ConditionalRequired, EventObject, InputFrom, IsLiteralString, IsNotNever, MachineContext, Mapper, ParameterizedObject, ProvidedActor, RequiredActorOptions, UnifiedArg } from "../types.js";
|
2 | type ResolvableActorId<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TId extends string | undefined> = TId | ((args: UnifiedArg<TContext, TExpressionEvent, TEvent>) => TId);
|
3 | export interface SpawnAction<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TActor extends ProvidedActor> {
|
4 | (args: ActionArgs<TContext, TExpressionEvent, TEvent>, params: TParams): void;
|
5 | _out_TActor?: TActor;
|
6 | }
|
7 | interface SpawnActionOptions<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor> {
|
8 | id?: ResolvableActorId<TContext, TExpressionEvent, TEvent, TActor['id']>;
|
9 | systemId?: string;
|
10 | input?: Mapper<TContext, TEvent, InputFrom<TActor['logic']>, TEvent> | InputFrom<TActor['logic']>;
|
11 | syncSnapshot?: boolean;
|
12 | }
|
13 | type DistributeActors<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor> = (TActor extends any ? ConditionalRequired<[
|
14 | src: TActor['src'],
|
15 | options?: SpawnActionOptions<TContext, TExpressionEvent, TEvent, TActor> & {
|
16 | [K in RequiredActorOptions<TActor>]: unknown;
|
17 | }
|
18 | ], IsNotNever<RequiredActorOptions<TActor>>> : never) | [
|
19 | src: AnyActorLogic,
|
20 | options?: SpawnActionOptions<TContext, TExpressionEvent, TEvent, ProvidedActor> & {
|
21 | id?: never;
|
22 | }
|
23 | ];
|
24 | type SpawnArguments<TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TActor extends ProvidedActor> = IsLiteralString<TActor['src']> extends true ? DistributeActors<TContext, TExpressionEvent, TEvent, TActor> : [
|
25 | src: string | AnyActorLogic,
|
26 | options?: {
|
27 | id?: ResolvableActorId<TContext, TExpressionEvent, TEvent, string>;
|
28 | systemId?: string;
|
29 | input?: unknown;
|
30 | syncSnapshot?: boolean;
|
31 | }
|
32 | ];
|
33 | export declare function spawnChild<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TActor extends ProvidedActor>(...[src, { id, systemId, input, syncSnapshot }]: SpawnArguments<TContext, TExpressionEvent, TEvent, TActor>): ActionFunction<TContext, TExpressionEvent, TEvent, TParams, TActor, never, never, never, never>;
|
34 | export {};
|
35 |
|
\ | No newline at end of file |