@methodacting/actor-kit 0.47.0
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/LICENSE.md +7 -0
- package/README.md +2042 -0
- package/dist/browser.d.ts +384 -0
- package/dist/browser.js +2 -0
- package/dist/browser.js.map +1 -0
- package/dist/index.d.ts +644 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/react.d.ts +416 -0
- package/dist/react.js +2 -0
- package/dist/react.js.map +1 -0
- package/dist/src/alarms.d.ts +47 -0
- package/dist/src/alarms.d.ts.map +1 -0
- package/dist/src/browser.d.ts +2 -0
- package/dist/src/browser.d.ts.map +1 -0
- package/dist/src/constants.d.ts +12 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/createAccessToken.d.ts +9 -0
- package/dist/src/createAccessToken.d.ts.map +1 -0
- package/dist/src/createActorFetch.d.ts +18 -0
- package/dist/src/createActorFetch.d.ts.map +1 -0
- package/dist/src/createActorKitClient.d.ts +13 -0
- package/dist/src/createActorKitClient.d.ts.map +1 -0
- package/dist/src/createActorKitContext.d.ts +29 -0
- package/dist/src/createActorKitContext.d.ts.map +1 -0
- package/dist/src/createActorKitMockClient.d.ts +11 -0
- package/dist/src/createActorKitMockClient.d.ts.map +1 -0
- package/dist/src/createActorKitRouter.d.ts +4 -0
- package/dist/src/createActorKitRouter.d.ts.map +1 -0
- package/dist/src/createMachineServer.d.ts +20 -0
- package/dist/src/createMachineServer.d.ts.map +1 -0
- package/dist/src/durable-object-system.d.ts +36 -0
- package/dist/src/durable-object-system.d.ts.map +1 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/react.d.ts +2 -0
- package/dist/src/react.d.ts.map +1 -0
- package/dist/src/schemas.d.ts +312 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/server.d.ts +3 -0
- package/dist/src/server.d.ts.map +1 -0
- package/dist/src/storage.d.ts +64 -0
- package/dist/src/storage.d.ts.map +1 -0
- package/dist/src/storybook.d.ts +13 -0
- package/dist/src/storybook.d.ts.map +1 -0
- package/dist/src/test.d.ts +2 -0
- package/dist/src/test.d.ts.map +1 -0
- package/dist/src/types.d.ts +181 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils.d.ts +30 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/withActorKit.d.ts +9 -0
- package/dist/src/withActorKit.d.ts.map +1 -0
- package/dist/src/worker.d.ts +3 -0
- package/dist/src/worker.d.ts.map +1 -0
- package/package.json +87 -0
- package/src/alarms.ts +237 -0
- package/src/browser.ts +1 -0
- package/src/constants.ts +31 -0
- package/src/createAccessToken.ts +29 -0
- package/src/createActorFetch.ts +111 -0
- package/src/createActorKitClient.ts +224 -0
- package/src/createActorKitContext.tsx +228 -0
- package/src/createActorKitMockClient.ts +138 -0
- package/src/createActorKitRouter.ts +149 -0
- package/src/createMachineServer.ts +844 -0
- package/src/durable-object-system.ts +212 -0
- package/src/global.d.ts +7 -0
- package/src/index.ts +6 -0
- package/src/react.ts +1 -0
- package/src/schemas.ts +95 -0
- package/src/server.ts +3 -0
- package/src/storage.ts +404 -0
- package/src/storybook.ts +42 -0
- package/src/test.ts +1 -0
- package/src/types.ts +334 -0
- package/src/utils.ts +171 -0
- package/src/withActorKit.tsx +103 -0
- package/src/worker.ts +2 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CallerType } from "./types";
|
|
2
|
+
export declare const createAccessToken: ({ signingKey, actorId, actorType, callerId, callerType, }: {
|
|
3
|
+
signingKey: string;
|
|
4
|
+
actorId: string;
|
|
5
|
+
actorType: string;
|
|
6
|
+
callerId: string;
|
|
7
|
+
callerType: CallerType;
|
|
8
|
+
}) => Promise<string>;
|
|
9
|
+
//# sourceMappingURL=createAccessToken.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createAccessToken.d.ts","sourceRoot":"","sources":["../../src/createAccessToken.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGrC,eAAO,MAAM,iBAAiB,GAAU,2DAMrC;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB,oBAWA,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { StateValueFrom } from "xstate";
|
|
2
|
+
import { AnyActorKitStateMachine, CallerSnapshotFrom, ClientEventFrom } from "./types";
|
|
3
|
+
export declare function createActorFetch<TMachine extends AnyActorKitStateMachine>({ actorType, host, }: {
|
|
4
|
+
actorType: string;
|
|
5
|
+
host: string;
|
|
6
|
+
}): (props: {
|
|
7
|
+
actorId: string;
|
|
8
|
+
accessToken: string;
|
|
9
|
+
input?: Record<string, unknown>;
|
|
10
|
+
waitForEvent?: ClientEventFrom<TMachine>;
|
|
11
|
+
waitForState?: StateValueFrom<TMachine>;
|
|
12
|
+
timeout?: number;
|
|
13
|
+
errorOnWaitTimeout?: boolean;
|
|
14
|
+
}, options?: RequestInit) => Promise<{
|
|
15
|
+
snapshot: CallerSnapshotFrom<TMachine>;
|
|
16
|
+
checksum: string;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=createActorFetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createActorFetch.d.ts","sourceRoot":"","sources":["../../src/createActorFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAOvF,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,uBAAuB,EAAE,EACzE,SAAS,EACT,IAAI,GACL,EAAE;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd,IAEG,OAAO;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzC,YAAY,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,EACD,UAAU,WAAW,KACpB,OAAO,CAAC;IACT,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC,CAgEH"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActorKitClient, AnyActorKitStateMachine, CallerSnapshotFrom } from "./types";
|
|
2
|
+
export type ActorKitClientProps<TMachine extends AnyActorKitStateMachine> = {
|
|
3
|
+
host: string;
|
|
4
|
+
actorType: string;
|
|
5
|
+
actorId: string;
|
|
6
|
+
checksum: string;
|
|
7
|
+
accessToken: string;
|
|
8
|
+
initialSnapshot: CallerSnapshotFrom<TMachine>;
|
|
9
|
+
onStateChange?: (newState: CallerSnapshotFrom<TMachine>) => void;
|
|
10
|
+
onError?: (error: Error) => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function createActorKitClient<TMachine extends AnyActorKitStateMachine>(props: ActorKitClientProps<TMachine>): ActorKitClient<TMachine>;
|
|
13
|
+
//# sourceMappingURL=createActorKitClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createActorKitClient.d.ts","sourceRoot":"","sources":["../../src/createActorKitClient.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EAEd,uBAAuB,EACvB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,mBAAmB,CAAC,QAAQ,SAAS,uBAAuB,IAAI;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC9C,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACjE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,CAAC;AAWF,wBAAgB,oBAAoB,CAAC,QAAQ,SAAS,uBAAuB,EAC3E,KAAK,EAAE,mBAAmB,CAAC,QAAQ,CAAC,GACnC,cAAc,CAAC,QAAQ,CAAC,CAuK1B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { StateValueFrom } from "xstate";
|
|
3
|
+
import type { ActorKitClientProps } from "./createActorKitClient";
|
|
4
|
+
import type { ActorKitClient, AnyActorKitStateMachine, CallerSnapshotFrom, ClientEventFrom, MatchesProps } from "./types";
|
|
5
|
+
export declare function createActorKitContext<TMachine extends AnyActorKitStateMachine>(actorType: string): {
|
|
6
|
+
Provider: React.FC<{
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
} & Omit<ActorKitClientProps<TMachine>, "actorType">>;
|
|
9
|
+
ProviderFromClient: React.FC<{
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
client: ActorKitClient<TMachine>;
|
|
12
|
+
}>;
|
|
13
|
+
useClient: () => ActorKitClient<TMachine>;
|
|
14
|
+
useSelector: <T>(selector: (snapshot: CallerSnapshotFrom<TMachine>) => T) => T;
|
|
15
|
+
useSend: () => (event: ClientEventFrom<TMachine>) => void;
|
|
16
|
+
useMatches: (stateValue: StateValueFrom<TMachine>) => boolean;
|
|
17
|
+
Matches: React.FC<MatchesProps<TMachine> & {
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
}> & {
|
|
20
|
+
create: (state: StateValueFrom<TMachine>, options?: {
|
|
21
|
+
and?: StateValueFrom<TMachine>;
|
|
22
|
+
or?: StateValueFrom<TMachine>;
|
|
23
|
+
not?: boolean;
|
|
24
|
+
}) => React.FC<Omit<MatchesProps<TMachine>, "state" | "and" | "or" | "not"> & {
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=createActorKitContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createActorKitContext.d.ts","sourceRoot":"","sources":["../../src/createActorKitContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAGZ,SAAS,EAOV,MAAM,OAAO,CAAC;AACf,OAAO,EAAgB,cAAc,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAElE,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,uBAAuB,EAC5E,SAAS,EAAE,MAAM;;kBAiBH,SAAS;;;kBAZX,SAAS;gBACX,cAAc,CAAC,QAAQ,CAAC;;qBAwCZ,cAAc,CAAC,QAAQ,CAAC;kBAUzB,CAAC,YACV,CAAC,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC;mBAarC,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,IAAI;6BAK9B,cAAc,CAAC,QAAQ,CAAC,KAAG,OAAO;;kBAIL,SAAS;;gBAC5D,CACN,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,EAC/B,OAAO,CAAC,EAAE;YACR,GAAG,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC/B,EAAE,CAAC,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;YAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;SACf,KACE,KAAK,CAAC,EAAE,CACX,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG;YAC7D,QAAQ,EAAE,SAAS,CAAC;SACrB,CACF;;EA0CJ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Draft } from "immer";
|
|
2
|
+
import { ActorKitClient, AnyActorKitStateMachine, CallerSnapshotFrom, ClientEventFrom } from "./types";
|
|
3
|
+
export type ActorKitMockClientProps<TMachine extends AnyActorKitStateMachine> = {
|
|
4
|
+
initialSnapshot: CallerSnapshotFrom<TMachine>;
|
|
5
|
+
onSend?: (event: ClientEventFrom<TMachine>) => void;
|
|
6
|
+
};
|
|
7
|
+
export type ActorKitMockClient<TMachine extends AnyActorKitStateMachine> = ActorKitClient<TMachine> & {
|
|
8
|
+
produce: (recipe: (draft: Draft<CallerSnapshotFrom<TMachine>>) => void) => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function createActorKitMockClient<TMachine extends AnyActorKitStateMachine>(props: ActorKitMockClientProps<TMachine>): ActorKitMockClient<TMachine>;
|
|
11
|
+
//# sourceMappingURL=createActorKitMockClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createActorKitMockClient.d.ts","sourceRoot":"","sources":["../../src/createActorKitMockClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAW,MAAM,OAAO,CAAC;AACvC,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,uBAAuB,CAAC,QAAQ,SAAS,uBAAuB,IAAI;IAC9E,eAAe,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,kBAAkB,CAAC,QAAQ,SAAS,uBAAuB,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG;IACpG,OAAO,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,KAAK,IAAI,CAAC;CACjF,CAAC;AASF,wBAAgB,wBAAwB,CAAC,QAAQ,SAAS,uBAAuB,EAC/E,KAAK,EAAE,uBAAuB,CAAC,QAAQ,CAAC,GACvC,kBAAkB,CAAC,QAAQ,CAAC,CA+G9B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ExecutionContext } from "@cloudflare/workers-types";
|
|
2
|
+
import { EnvWithDurableObjects, ScreamingSnakeToKebab } from "./types";
|
|
3
|
+
export declare const createActorKitRouter: <Env extends EnvWithDurableObjects>(routes: Array<ScreamingSnakeToKebab<Extract<keyof Env, string>>>) => (request: Request, env: Env, ctx: ExecutionContext) => Promise<Response>;
|
|
4
|
+
//# sourceMappingURL=createActorKitRouter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createActorKitRouter.d.ts","sourceRoot":"","sources":["../../src/createActorKitRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAKL,qBAAqB,EAErB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAGjB,eAAO,MAAM,oBAAoB,GAAI,GAAG,SAAS,qBAAqB,EACpE,QAAQ,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,MA+B9D,SAAS,OAAO,EAChB,KAAK,GAAG,EACR,KAAK,gBAAgB,KACpB,OAAO,CAAC,QAAQ,CAiGpB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AnyEventObject } from "xstate";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { ActorKitStateMachine, ActorKitSystemEvent, ActorServer, Caller, EnvFromMachine, MachineServerOptions, WithActorKitContext, WithActorKitEvent } from "./types";
|
|
4
|
+
export declare const createMachineServer: <TClientEvent extends AnyEventObject, TServiceEvent extends AnyEventObject, TInputSchema extends z.ZodObject<z.ZodRawShape>, TMachine extends ActorKitStateMachine<(WithActorKitEvent<TClientEvent, "client"> | WithActorKitEvent<TServiceEvent, "service"> | ActorKitSystemEvent) & {
|
|
5
|
+
storage: DurableObjectStorage;
|
|
6
|
+
env: EnvFromMachine<TMachine>;
|
|
7
|
+
}, z.infer<TInputSchema> & {
|
|
8
|
+
id: string;
|
|
9
|
+
caller: Caller;
|
|
10
|
+
storage: DurableObjectStorage;
|
|
11
|
+
}, WithActorKitContext<any, any, any>>>({ machine, schemas, options, }: {
|
|
12
|
+
machine: TMachine;
|
|
13
|
+
schemas: {
|
|
14
|
+
clientEvent: z.ZodSchema<TClientEvent>;
|
|
15
|
+
serviceEvent: z.ZodSchema<TServiceEvent>;
|
|
16
|
+
inputProps: TInputSchema;
|
|
17
|
+
};
|
|
18
|
+
options?: MachineServerOptions;
|
|
19
|
+
}) => new (state: DurableObjectState, env: EnvFromMachine<TMachine>, ctx: ExecutionContext) => ActorServer<TMachine>;
|
|
20
|
+
//# sourceMappingURL=createMachineServer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMachineServer.d.ts","sourceRoot":"","sources":["../../src/createMachineServer.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,cAAc,EAOf,MAAM,QAAQ,CAAC;AAEhB,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACX,MAAM,EAGN,cAAc,EACd,oBAAoB,EAEpB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AA4BjB,eAAO,MAAM,mBAAmB,GAC9B,YAAY,SAAS,cAAc,EACnC,aAAa,SAAS,cAAc,EACpC,YAAY,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EAC/C,QAAQ,SAAS,oBAAoB,CACnC,CACI,iBAAiB,CAAC,YAAY,EAAE,QAAQ,CAAC,GACzC,iBAAiB,CAAC,aAAa,EAAE,SAAS,CAAC,GAC3C,mBAAmB,CACtB,GAAG;IACF,OAAO,EAAE,oBAAoB,CAAC;IAC9B,GAAG,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CAC/B,EACD,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,oBAAoB,CAAC;CAC/B,EACD,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CACnC,EACD,gCAIC;IACD,OAAO,EAAE,QAAQ,CAAC;IAClB,OAAO,EAAE;QACP,WAAW,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACvC,YAAY,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QACzC,UAAU,EAAE,YAAY,CAAC;KAC1B,CAAC;IACF,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,KAAG,KACF,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,cAAc,CAAC,QAAQ,CAAC,EAC7B,GAAG,EAAE,gBAAgB,KAClB,WAAW,CAAC,QAAQ,CA6uBtB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AnyActorRef, AnyEventObject } from "xstate";
|
|
2
|
+
import type { AlarmManager } from "./alarms";
|
|
3
|
+
export interface XStateAlarmData {
|
|
4
|
+
type: "xstate-delay";
|
|
5
|
+
sourceSessionId: string;
|
|
6
|
+
targetSessionId: string;
|
|
7
|
+
event: AnyEventObject;
|
|
8
|
+
scheduledEventId: string;
|
|
9
|
+
alarmId: string;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface ScheduledEventSnapshot {
|
|
13
|
+
sourceSessionId: string;
|
|
14
|
+
targetSessionId: string;
|
|
15
|
+
event: AnyEventObject;
|
|
16
|
+
delay: number;
|
|
17
|
+
id: string;
|
|
18
|
+
startedAt: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Clock {
|
|
21
|
+
setTimeout: (fn: () => void, delay: number) => unknown;
|
|
22
|
+
clearTimeout: (id: unknown) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const NOOP_CLOCK: Clock;
|
|
25
|
+
export declare function createAlarmScheduler(alarmManager: AlarmManager, system: any): {
|
|
26
|
+
schedule: (source: AnyActorRef, target: AnyActorRef, event: AnyEventObject, delay: number, id?: string) => void;
|
|
27
|
+
cancel: (source: AnyActorRef, id: string) => void;
|
|
28
|
+
cancelAll: (actorRef: AnyActorRef) => void;
|
|
29
|
+
};
|
|
30
|
+
export declare function handleXStateAlarm(alarmData: XStateAlarmData, actor: any): Promise<void>;
|
|
31
|
+
export declare function getScheduledEvents(): Map<string, ScheduledEventSnapshot>;
|
|
32
|
+
export declare function restoreScheduledEvents(alarms: Array<{
|
|
33
|
+
payload: XStateAlarmData;
|
|
34
|
+
scheduledAt: number;
|
|
35
|
+
}>): void;
|
|
36
|
+
//# sourceMappingURL=durable-object-system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durable-object-system.d.ts","sourceRoot":"","sources":["../../src/durable-object-system.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAK7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AAC,MAAM,EAAE,sBAAsB,CAAC,CAExE;AAKD,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,KAAK,CAAC;IAAE,OAAO,EAAE,eAAe,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,GAC/D,IAAI,CAmBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/react.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const BotManagementSchema: z.ZodObject<{
|
|
3
|
+
corporateProxy: z.ZodBoolean;
|
|
4
|
+
verifiedBot: z.ZodBoolean;
|
|
5
|
+
jsDetection: z.ZodObject<{
|
|
6
|
+
passed: z.ZodBoolean;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
passed: boolean;
|
|
9
|
+
}, {
|
|
10
|
+
passed: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
staticResource: z.ZodBoolean;
|
|
13
|
+
detectionIds: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
14
|
+
score: z.ZodNumber;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
corporateProxy: boolean;
|
|
17
|
+
verifiedBot: boolean;
|
|
18
|
+
jsDetection: {
|
|
19
|
+
passed: boolean;
|
|
20
|
+
};
|
|
21
|
+
staticResource: boolean;
|
|
22
|
+
detectionIds: Record<string, any>;
|
|
23
|
+
score: number;
|
|
24
|
+
}, {
|
|
25
|
+
corporateProxy: boolean;
|
|
26
|
+
verifiedBot: boolean;
|
|
27
|
+
jsDetection: {
|
|
28
|
+
passed: boolean;
|
|
29
|
+
};
|
|
30
|
+
staticResource: boolean;
|
|
31
|
+
detectionIds: Record<string, any>;
|
|
32
|
+
score: number;
|
|
33
|
+
}>;
|
|
34
|
+
export declare const EnvironmentSchema: z.ZodObject<{
|
|
35
|
+
ACTOR_KIT_SECRET: z.ZodString;
|
|
36
|
+
ACTOR_KIT_HOST: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
ACTOR_KIT_SECRET: string;
|
|
39
|
+
ACTOR_KIT_HOST: string;
|
|
40
|
+
}, {
|
|
41
|
+
ACTOR_KIT_SECRET: string;
|
|
42
|
+
ACTOR_KIT_HOST: string;
|
|
43
|
+
}>;
|
|
44
|
+
export declare const RequestInfoSchema: z.ZodObject<{
|
|
45
|
+
longitude: z.ZodString;
|
|
46
|
+
latitude: z.ZodString;
|
|
47
|
+
continent: z.ZodString;
|
|
48
|
+
country: z.ZodString;
|
|
49
|
+
city: z.ZodString;
|
|
50
|
+
timezone: z.ZodString;
|
|
51
|
+
postalCode: z.ZodString;
|
|
52
|
+
region: z.ZodString;
|
|
53
|
+
regionCode: z.ZodString;
|
|
54
|
+
metroCode: z.ZodString;
|
|
55
|
+
botManagement: z.ZodObject<{
|
|
56
|
+
corporateProxy: z.ZodBoolean;
|
|
57
|
+
verifiedBot: z.ZodBoolean;
|
|
58
|
+
jsDetection: z.ZodObject<{
|
|
59
|
+
passed: z.ZodBoolean;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
passed: boolean;
|
|
62
|
+
}, {
|
|
63
|
+
passed: boolean;
|
|
64
|
+
}>;
|
|
65
|
+
staticResource: z.ZodBoolean;
|
|
66
|
+
detectionIds: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
67
|
+
score: z.ZodNumber;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
corporateProxy: boolean;
|
|
70
|
+
verifiedBot: boolean;
|
|
71
|
+
jsDetection: {
|
|
72
|
+
passed: boolean;
|
|
73
|
+
};
|
|
74
|
+
staticResource: boolean;
|
|
75
|
+
detectionIds: Record<string, any>;
|
|
76
|
+
score: number;
|
|
77
|
+
}, {
|
|
78
|
+
corporateProxy: boolean;
|
|
79
|
+
verifiedBot: boolean;
|
|
80
|
+
jsDetection: {
|
|
81
|
+
passed: boolean;
|
|
82
|
+
};
|
|
83
|
+
staticResource: boolean;
|
|
84
|
+
detectionIds: Record<string, any>;
|
|
85
|
+
score: number;
|
|
86
|
+
}>;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
longitude: string;
|
|
89
|
+
latitude: string;
|
|
90
|
+
continent: string;
|
|
91
|
+
country: string;
|
|
92
|
+
city: string;
|
|
93
|
+
timezone: string;
|
|
94
|
+
postalCode: string;
|
|
95
|
+
region: string;
|
|
96
|
+
regionCode: string;
|
|
97
|
+
metroCode: string;
|
|
98
|
+
botManagement: {
|
|
99
|
+
corporateProxy: boolean;
|
|
100
|
+
verifiedBot: boolean;
|
|
101
|
+
jsDetection: {
|
|
102
|
+
passed: boolean;
|
|
103
|
+
};
|
|
104
|
+
staticResource: boolean;
|
|
105
|
+
detectionIds: Record<string, any>;
|
|
106
|
+
score: number;
|
|
107
|
+
};
|
|
108
|
+
}, {
|
|
109
|
+
longitude: string;
|
|
110
|
+
latitude: string;
|
|
111
|
+
continent: string;
|
|
112
|
+
country: string;
|
|
113
|
+
city: string;
|
|
114
|
+
timezone: string;
|
|
115
|
+
postalCode: string;
|
|
116
|
+
region: string;
|
|
117
|
+
regionCode: string;
|
|
118
|
+
metroCode: string;
|
|
119
|
+
botManagement: {
|
|
120
|
+
corporateProxy: boolean;
|
|
121
|
+
verifiedBot: boolean;
|
|
122
|
+
jsDetection: {
|
|
123
|
+
passed: boolean;
|
|
124
|
+
};
|
|
125
|
+
staticResource: boolean;
|
|
126
|
+
detectionIds: Record<string, any>;
|
|
127
|
+
score: number;
|
|
128
|
+
};
|
|
129
|
+
}>;
|
|
130
|
+
export declare const CallerSchema: z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
type: z.ZodEnum<["client", "system", "service"]>;
|
|
133
|
+
}, "strip", z.ZodTypeAny, {
|
|
134
|
+
type: "client" | "system" | "service";
|
|
135
|
+
id: string;
|
|
136
|
+
}, {
|
|
137
|
+
type: "client" | "system" | "service";
|
|
138
|
+
id: string;
|
|
139
|
+
}>;
|
|
140
|
+
export declare const AnyEventSchema: z.ZodObject<{
|
|
141
|
+
type: z.ZodString;
|
|
142
|
+
}, "strip", z.ZodTypeAny, {
|
|
143
|
+
type: string;
|
|
144
|
+
}, {
|
|
145
|
+
type: string;
|
|
146
|
+
}>;
|
|
147
|
+
export declare const SystemEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"INITIALIZE">;
|
|
149
|
+
caller: z.ZodObject<{
|
|
150
|
+
type: z.ZodLiteral<"system">;
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
type: "system";
|
|
154
|
+
id: string;
|
|
155
|
+
}, {
|
|
156
|
+
type: "system";
|
|
157
|
+
id: string;
|
|
158
|
+
}>;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "INITIALIZE";
|
|
161
|
+
caller: {
|
|
162
|
+
type: "system";
|
|
163
|
+
id: string;
|
|
164
|
+
};
|
|
165
|
+
}, {
|
|
166
|
+
type: "INITIALIZE";
|
|
167
|
+
caller: {
|
|
168
|
+
type: "system";
|
|
169
|
+
id: string;
|
|
170
|
+
};
|
|
171
|
+
}>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"CONNECT">;
|
|
173
|
+
caller: z.ZodObject<{
|
|
174
|
+
type: z.ZodLiteral<"system">;
|
|
175
|
+
id: z.ZodString;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
type: "system";
|
|
178
|
+
id: string;
|
|
179
|
+
}, {
|
|
180
|
+
type: "system";
|
|
181
|
+
id: string;
|
|
182
|
+
}>;
|
|
183
|
+
connectingCaller: z.ZodObject<{
|
|
184
|
+
id: z.ZodString;
|
|
185
|
+
type: z.ZodEnum<["client", "system", "service"]>;
|
|
186
|
+
}, "strip", z.ZodTypeAny, {
|
|
187
|
+
type: "client" | "system" | "service";
|
|
188
|
+
id: string;
|
|
189
|
+
}, {
|
|
190
|
+
type: "client" | "system" | "service";
|
|
191
|
+
id: string;
|
|
192
|
+
}>;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
type: "CONNECT";
|
|
195
|
+
caller: {
|
|
196
|
+
type: "system";
|
|
197
|
+
id: string;
|
|
198
|
+
};
|
|
199
|
+
connectingCaller: {
|
|
200
|
+
type: "client" | "system" | "service";
|
|
201
|
+
id: string;
|
|
202
|
+
};
|
|
203
|
+
}, {
|
|
204
|
+
type: "CONNECT";
|
|
205
|
+
caller: {
|
|
206
|
+
type: "system";
|
|
207
|
+
id: string;
|
|
208
|
+
};
|
|
209
|
+
connectingCaller: {
|
|
210
|
+
type: "client" | "system" | "service";
|
|
211
|
+
id: string;
|
|
212
|
+
};
|
|
213
|
+
}>, z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"DISCONNECT">;
|
|
215
|
+
caller: z.ZodObject<{
|
|
216
|
+
type: z.ZodLiteral<"system">;
|
|
217
|
+
id: z.ZodString;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
type: "system";
|
|
220
|
+
id: string;
|
|
221
|
+
}, {
|
|
222
|
+
type: "system";
|
|
223
|
+
id: string;
|
|
224
|
+
}>;
|
|
225
|
+
disconnectingCaller: z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
type: z.ZodEnum<["client", "system", "service"]>;
|
|
228
|
+
}, "strip", z.ZodTypeAny, {
|
|
229
|
+
type: "client" | "system" | "service";
|
|
230
|
+
id: string;
|
|
231
|
+
}, {
|
|
232
|
+
type: "client" | "system" | "service";
|
|
233
|
+
id: string;
|
|
234
|
+
}>;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
type: "DISCONNECT";
|
|
237
|
+
caller: {
|
|
238
|
+
type: "system";
|
|
239
|
+
id: string;
|
|
240
|
+
};
|
|
241
|
+
disconnectingCaller: {
|
|
242
|
+
type: "client" | "system" | "service";
|
|
243
|
+
id: string;
|
|
244
|
+
};
|
|
245
|
+
}, {
|
|
246
|
+
type: "DISCONNECT";
|
|
247
|
+
caller: {
|
|
248
|
+
type: "system";
|
|
249
|
+
id: string;
|
|
250
|
+
};
|
|
251
|
+
disconnectingCaller: {
|
|
252
|
+
type: "client" | "system" | "service";
|
|
253
|
+
id: string;
|
|
254
|
+
};
|
|
255
|
+
}>, z.ZodObject<{
|
|
256
|
+
type: z.ZodLiteral<"RESUME">;
|
|
257
|
+
caller: z.ZodObject<{
|
|
258
|
+
type: z.ZodLiteral<"system">;
|
|
259
|
+
id: z.ZodString;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
type: "system";
|
|
262
|
+
id: string;
|
|
263
|
+
}, {
|
|
264
|
+
type: "system";
|
|
265
|
+
id: string;
|
|
266
|
+
}>;
|
|
267
|
+
}, "strip", z.ZodTypeAny, {
|
|
268
|
+
type: "RESUME";
|
|
269
|
+
caller: {
|
|
270
|
+
type: "system";
|
|
271
|
+
id: string;
|
|
272
|
+
};
|
|
273
|
+
}, {
|
|
274
|
+
type: "RESUME";
|
|
275
|
+
caller: {
|
|
276
|
+
type: "system";
|
|
277
|
+
id: string;
|
|
278
|
+
};
|
|
279
|
+
}>, z.ZodObject<{
|
|
280
|
+
type: z.ZodLiteral<"MIGRATE">;
|
|
281
|
+
caller: z.ZodObject<{
|
|
282
|
+
type: z.ZodLiteral<"system">;
|
|
283
|
+
id: z.ZodString;
|
|
284
|
+
}, "strip", z.ZodTypeAny, {
|
|
285
|
+
type: "system";
|
|
286
|
+
id: string;
|
|
287
|
+
}, {
|
|
288
|
+
type: "system";
|
|
289
|
+
id: string;
|
|
290
|
+
}>;
|
|
291
|
+
operations: z.ZodArray<z.ZodAny, "many">;
|
|
292
|
+
}, "strip", z.ZodTypeAny, {
|
|
293
|
+
type: "MIGRATE";
|
|
294
|
+
caller: {
|
|
295
|
+
type: "system";
|
|
296
|
+
id: string;
|
|
297
|
+
};
|
|
298
|
+
operations: any[];
|
|
299
|
+
}, {
|
|
300
|
+
type: "MIGRATE";
|
|
301
|
+
caller: {
|
|
302
|
+
type: "system";
|
|
303
|
+
id: string;
|
|
304
|
+
};
|
|
305
|
+
operations: any[];
|
|
306
|
+
}>]>;
|
|
307
|
+
export declare const CallerIdTypeSchema: z.ZodEnum<["client", "service", "system"]>;
|
|
308
|
+
export declare const CallerStringSchema: z.ZodEffects<z.ZodString, {
|
|
309
|
+
type: "client" | "system" | "service";
|
|
310
|
+
id: string;
|
|
311
|
+
}, string>;
|
|
312
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS9B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;EAG5B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY5B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;EAGvB,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwB5B,CAAC;AAEH,eAAO,MAAM,kBAAkB,4CAA0C,CAAC;AAE1E,eAAO,MAAM,kBAAkB;;;UAyB7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/server.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Caller } from "./types";
|
|
2
|
+
export interface AlarmRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
type: string;
|
|
5
|
+
scheduled_at: number;
|
|
6
|
+
repeat_interval: number | null;
|
|
7
|
+
payload: string | null;
|
|
8
|
+
created_at: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AlarmScheduleOptions {
|
|
11
|
+
id: string;
|
|
12
|
+
type: string;
|
|
13
|
+
scheduledAt: number;
|
|
14
|
+
repeatInterval?: number;
|
|
15
|
+
payload: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface ActorMetaRecord {
|
|
18
|
+
actor_id: string;
|
|
19
|
+
actor_type: string;
|
|
20
|
+
initial_caller: string;
|
|
21
|
+
input: string;
|
|
22
|
+
created_at: number;
|
|
23
|
+
updated_at: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ActorMeta {
|
|
26
|
+
actorId: string;
|
|
27
|
+
actorType: string;
|
|
28
|
+
initialCaller: Caller;
|
|
29
|
+
input: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
export interface SnapshotRecord {
|
|
32
|
+
actor_id: string;
|
|
33
|
+
snapshot: string;
|
|
34
|
+
checksum: string | null;
|
|
35
|
+
updated_at: number;
|
|
36
|
+
}
|
|
37
|
+
export interface Snapshot {
|
|
38
|
+
actorId: string;
|
|
39
|
+
snapshot: unknown;
|
|
40
|
+
checksum?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare class ActorKitStorage {
|
|
43
|
+
private storage;
|
|
44
|
+
private initialized;
|
|
45
|
+
private sql;
|
|
46
|
+
constructor(storage: DurableObjectStorage);
|
|
47
|
+
ensureInitialized(): Promise<void>;
|
|
48
|
+
getAlarms(): Promise<AlarmRecord[]>;
|
|
49
|
+
getDueAlarms(before: number): Promise<AlarmRecord[]>;
|
|
50
|
+
getEarliestAlarm(): Promise<AlarmRecord | null>;
|
|
51
|
+
insertAlarm(options: AlarmScheduleOptions): Promise<void>;
|
|
52
|
+
updateAlarm(options: AlarmScheduleOptions): Promise<void>;
|
|
53
|
+
deleteAlarm(id: string): Promise<void>;
|
|
54
|
+
deleteAlarmsByType(type: string): Promise<void>;
|
|
55
|
+
getActorMeta(actorId?: string): Promise<ActorMeta | null>;
|
|
56
|
+
setActorMeta(meta: ActorMeta): Promise<void>;
|
|
57
|
+
deleteActorMeta(actorId: string): Promise<void>;
|
|
58
|
+
getSnapshot(actorId: string): Promise<Snapshot | null>;
|
|
59
|
+
setSnapshot(actorId: string, snapshot: unknown, checksum?: string): Promise<void>;
|
|
60
|
+
deleteSnapshot(actorId: string): Promise<void>;
|
|
61
|
+
migrateFromKV(storage: DurableObjectStorage): Promise<void>;
|
|
62
|
+
private parseRows;
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAyCtC,MAAM,WAAW,WAAW;IA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
|
+
export interface ActorKitParameters<TMachine extends AnyActorKitStateMachine> {
|
|
4
|
+
actorKit: {
|
|
5
|
+
[K: string]: {
|
|
6
|
+
[actorId: string]: CallerSnapshotFrom<TMachine>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export type StoryWithActorKit<TMachine extends AnyActorKitStateMachine> = {
|
|
11
|
+
parameters: ActorKitParameters<TMachine>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=storybook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storybook.d.ts","sourceRoot":"","sources":["../../src/storybook.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAuB9C,MAAM,WAAW,kBAAkB,CAAC,QAAQ,SAAS,uBAAuB;IAC1E,QAAQ,EAAE;QACR,CAAC,CAAC,EAAE,MAAM,GAAG;YACX,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;SACjD,CAAC;KACH,CAAC;CACH;AAQD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,uBAAuB,IAAI;IACxE,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;CAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
|