rivetkit 2.3.11-rc.8 → 2.3.11
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/browser/client.d.ts +96 -14
- package/dist/browser/client.js +12 -2
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +139 -139
- package/dist/browser/inspector/client.js +12 -2
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +146 -76
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +83 -9
- package/dist/tsup/agent-os/index.d.ts +83 -9
- package/dist/tsup/agent-os/index.js +146 -76
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-JBQ63WSM.js → chunk-3ZR542SK.js} +4 -4
- package/dist/tsup/chunk-3ZR542SK.js.map +1 -0
- package/dist/tsup/{chunk-HNHLBM3Y.cjs → chunk-4KGXFC6M.cjs} +42 -5
- package/dist/tsup/chunk-4KGXFC6M.cjs.map +1 -0
- package/dist/tsup/chunk-5UYWLCRO.js +14 -0
- package/dist/tsup/chunk-5UYWLCRO.js.map +1 -0
- package/dist/tsup/{chunk-QWLJCP3X.js → chunk-6W5VGLFT.js} +42 -5
- package/dist/tsup/chunk-6W5VGLFT.js.map +1 -0
- package/dist/tsup/chunk-6WYATRS4.js +243 -0
- package/dist/tsup/chunk-6WYATRS4.js.map +1 -0
- package/dist/tsup/chunk-B3W74FBB.cjs +14 -0
- package/dist/tsup/chunk-B3W74FBB.cjs.map +1 -0
- package/dist/tsup/{chunk-V6ANE6JM.js → chunk-FWROC5LA.js} +2 -2
- package/dist/tsup/{chunk-ZVM35ICH.cjs → chunk-GLIPKKEC.cjs} +7 -7
- package/dist/tsup/{chunk-ZVM35ICH.cjs.map → chunk-GLIPKKEC.cjs.map} +1 -1
- package/dist/tsup/{chunk-CCUO5OKD.cjs → chunk-GN2EUMEW.cjs} +3 -3
- package/dist/tsup/{chunk-CCUO5OKD.cjs.map → chunk-GN2EUMEW.cjs.map} +1 -1
- package/dist/tsup/{chunk-2ROUKH7W.cjs → chunk-GU7ML3KE.cjs} +13 -3
- package/dist/tsup/chunk-GU7ML3KE.cjs.map +1 -0
- package/dist/tsup/{chunk-WRRB24UY.js → chunk-JQ2AZ5FN.js} +3 -3
- package/dist/tsup/{chunk-7AFZMFPQ.js → chunk-JTHHCZCZ.js} +10 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-UEULFXUI.cjs → chunk-KVFIONKQ.cjs} +11 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/chunk-LWQFXGKS.cjs +243 -0
- package/dist/tsup/chunk-LWQFXGKS.cjs.map +1 -0
- package/dist/tsup/{chunk-KVD6ZWNM.js → chunk-MO2SSUOR.js} +8 -7
- package/dist/tsup/chunk-MO2SSUOR.js.map +1 -0
- package/dist/tsup/{chunk-AGNBLCNJ.js → chunk-OUENKQHB.js} +13 -3
- package/dist/tsup/chunk-OUENKQHB.js.map +1 -0
- package/dist/tsup/{chunk-E6WB2BLO.cjs → chunk-PUZY2XCD.cjs} +10 -9
- package/dist/tsup/chunk-PUZY2XCD.cjs.map +1 -0
- package/dist/tsup/{chunk-4EDGOGCB.js → chunk-QFJ24MBU.js} +27 -2
- package/dist/tsup/{chunk-4EDGOGCB.js.map → chunk-QFJ24MBU.js.map} +1 -1
- package/dist/tsup/{chunk-A55CGZIV.cjs → chunk-RXXDNJXB.cjs} +140 -140
- package/dist/tsup/{chunk-A55CGZIV.cjs.map → chunk-RXXDNJXB.cjs.map} +1 -1
- package/dist/tsup/{chunk-N6MBTYGX.cjs → chunk-VBJQIBXI.cjs} +30 -5
- package/dist/tsup/chunk-VBJQIBXI.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +4 -3
- package/dist/tsup/client/mod.d.ts +4 -3
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-CZcjyT5B.d.ts → config-C4OSv0QP.d.ts} +92 -7
- package/dist/tsup/{config-rGWrumlO.d.cts → config-DTGoWdkG.d.cts} +92 -7
- package/dist/tsup/{config-BxOimoGX.d.cts → config-ey2I2zz5.d.cts} +46 -6
- package/dist/tsup/{config-BxOimoGX.d.ts → config-ey2I2zz5.d.ts} +46 -6
- package/dist/tsup/{context-B8W8E8nW.d.cts → context-C6cvDNyk.d.cts} +2 -2
- package/dist/tsup/{context-_UrDZhEh.d.ts → context-CMygeBxS.d.ts} +2 -2
- package/dist/tsup/db/drizzle.cjs +18 -10
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +5 -6
- package/dist/tsup/db/drizzle.d.ts +5 -6
- package/dist/tsup/db/drizzle.js +13 -5
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +5 -175
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +11 -4
- package/dist/tsup/db/mod.d.ts +11 -4
- package/dist/tsup/db/mod.js +4 -174
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +3 -2
- package/dist/tsup/dynamic/mod.d.ts +3 -2
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -4
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +12 -146
- package/dist/tsup/inspector/mod.d.ts +12 -146
- package/dist/tsup/inspector/mod.js +4 -3
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +4 -3
- package/dist/tsup/inspector-tab/mod.d.ts +4 -3
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +837 -243
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +6 -5
- package/dist/tsup/mod.d.ts +6 -5
- package/dist/tsup/mod.js +766 -172
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +3 -2
- package/dist/tsup/test/mod.d.ts +3 -2
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/unstable/migrations.d.cts +1 -1
- package/dist/tsup/unstable/migrations.d.ts +1 -1
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +89 -95
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +5 -4
- package/dist/tsup/workflow/mod.d.ts +5 -4
- package/dist/tsup/workflow/mod.js +86 -92
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +19 -9
- package/src/actor/config.test.ts +65 -1
- package/src/actor/config.ts +169 -5
- package/src/actor/mod.ts +10 -1
- package/src/client/actor-common.ts +5 -14
- package/src/common/database/config.ts +50 -3
- package/src/common/database/mod.test.ts +142 -4
- package/src/common/database/mod.ts +210 -98
- package/src/common/database/native-database.ts +42 -3
- package/src/common/database/shared.ts +9 -0
- package/src/db/drizzle.test.ts +8 -1
- package/src/db/drizzle.ts +15 -4
- package/src/db/mod.ts +3 -0
- package/src/inspector/workflow.ts +61 -0
- package/src/registry/napi-runtime.ts +69 -1
- package/src/registry/native.ts +505 -155
- package/src/registry/run-handler-coordinator.test.ts +252 -0
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.ts +34 -1
- package/src/registry/wasm-runtime.ts +122 -17
- package/src/registry/write-through-proxy.ts +101 -0
- package/src/utils/node.ts +44 -28
- package/src/workflow/driver.ts +56 -58
- package/src/workflow/inspector.ts +10 -15
- package/src/workflow/mod.ts +48 -70
- package/dist/tsup/chunk-2ROUKH7W.cjs.map +0 -1
- package/dist/tsup/chunk-7AFZMFPQ.js.map +0 -1
- package/dist/tsup/chunk-AGNBLCNJ.js.map +0 -1
- package/dist/tsup/chunk-E6WB2BLO.cjs.map +0 -1
- package/dist/tsup/chunk-HNHLBM3Y.cjs.map +0 -1
- package/dist/tsup/chunk-JBQ63WSM.js.map +0 -1
- package/dist/tsup/chunk-KVD6ZWNM.js.map +0 -1
- package/dist/tsup/chunk-N6MBTYGX.cjs.map +0 -1
- package/dist/tsup/chunk-QWLJCP3X.js.map +0 -1
- package/dist/tsup/chunk-UEULFXUI.cjs.map +0 -1
- /package/dist/tsup/{chunk-V6ANE6JM.js.map → chunk-FWROC5LA.js.map} +0 -0
- /package/dist/tsup/{chunk-WRRB24UY.js.map → chunk-JQ2AZ5FN.js.map} +0 -0
|
@@ -15,7 +15,7 @@ interface ActorMetricsLike {
|
|
|
15
15
|
totalKvWrites: number;
|
|
16
16
|
trackSql(query: string, durationMs: number): void;
|
|
17
17
|
}
|
|
18
|
-
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> :
|
|
18
|
+
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> : RawAccess;
|
|
19
19
|
type SqliteBindings = unknown[] | Record<string, unknown>;
|
|
20
20
|
interface SqliteQueryResult {
|
|
21
21
|
columns: string[];
|
|
@@ -29,6 +29,41 @@ interface SqliteBatchStatement {
|
|
|
29
29
|
sql: string;
|
|
30
30
|
params?: SqliteBindings;
|
|
31
31
|
}
|
|
32
|
+
interface SqliteTransactionOptions {
|
|
33
|
+
/** Static operation name used to aggregate transaction performance. */
|
|
34
|
+
name?: string;
|
|
35
|
+
/** Deadlock-safety timeout in milliseconds. */
|
|
36
|
+
timeout?: number;
|
|
37
|
+
/** @experimental */
|
|
38
|
+
experimental?: {
|
|
39
|
+
/**
|
|
40
|
+
* Atomically includes actor and hibernatable connection state.
|
|
41
|
+
* Only single-statement `execute` calls are supported in the transaction.
|
|
42
|
+
* Concurrent actions that try to mutate state while the transaction is
|
|
43
|
+
* active fail with `actor.state_transaction_conflict`.
|
|
44
|
+
*/
|
|
45
|
+
includeState?: boolean;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* SQLite profiling configuration.
|
|
50
|
+
*
|
|
51
|
+
* @experimental This entire configuration surface is experimental and subject
|
|
52
|
+
* to change without notice.
|
|
53
|
+
*/
|
|
54
|
+
interface SqliteProfilingOptions {
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
maxTrackedStatementFingerprints?: number;
|
|
57
|
+
maxTrackedTransactionFingerprints?: number;
|
|
58
|
+
maxPrometheusSeries?: number;
|
|
59
|
+
maxStatementsPerTransactionTrace?: number;
|
|
60
|
+
maxGetPagesRequestsPerTrace?: number;
|
|
61
|
+
maxTransactionNameBytes?: number;
|
|
62
|
+
slowOperationThresholdMs?: number;
|
|
63
|
+
baselineSampleRate?: number;
|
|
64
|
+
maxDiagnosticEventsPerMinute?: number;
|
|
65
|
+
diagnosticEventQueueCapacity?: number;
|
|
66
|
+
}
|
|
32
67
|
interface SqliteNativeMetrics {
|
|
33
68
|
requestBuildNs: number;
|
|
34
69
|
serializeNs: number;
|
|
@@ -46,7 +81,7 @@ interface SqliteDatabase {
|
|
|
46
81
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
47
82
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
48
83
|
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
49
|
-
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
84
|
+
beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
|
|
50
85
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
51
86
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
52
87
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
@@ -101,6 +136,13 @@ interface DatabaseProviderContext {
|
|
|
101
136
|
nativeDatabaseProvider?: NativeDatabaseProvider;
|
|
102
137
|
}
|
|
103
138
|
type DatabaseProvider<DB extends RawAccess> = {
|
|
139
|
+
/**
|
|
140
|
+
* Local SQLite profiling controls consumed by the actor runtime.
|
|
141
|
+
*
|
|
142
|
+
* @experimental This entire configuration surface is experimental and
|
|
143
|
+
* subject to change without notice.
|
|
144
|
+
*/
|
|
145
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
104
146
|
/**
|
|
105
147
|
* Creates a new database client for the actor.
|
|
106
148
|
* The result is passed to the actor context as `c.db`.
|
|
@@ -125,9 +167,7 @@ type RawAccess = {
|
|
|
125
167
|
*/
|
|
126
168
|
execute: ExecuteFunction;
|
|
127
169
|
/** Runs a callback in an isolated SQLite transaction. */
|
|
128
|
-
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?:
|
|
129
|
-
timeout?: number;
|
|
130
|
-
}) => Promise<T>;
|
|
170
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: SqliteTransactionOptions) => Promise<T>;
|
|
131
171
|
/**
|
|
132
172
|
* Returns native SQLite metrics when the active runtime supports them.
|
|
133
173
|
*/
|
|
@@ -587,6 +627,7 @@ type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
|
587
627
|
type ConnHandle = OpaqueHandle<"conn">;
|
|
588
628
|
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
589
629
|
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
630
|
+
type ActorStateTransactionHandle = OpaqueHandle<"actorStateTransaction">;
|
|
590
631
|
type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
591
632
|
type RuntimeBytes = Uint8Array;
|
|
592
633
|
interface RuntimeActorKeySegment {
|
|
@@ -753,6 +794,7 @@ interface RuntimeActorConfig {
|
|
|
753
794
|
icon?: string;
|
|
754
795
|
hasDatabase?: boolean;
|
|
755
796
|
remoteSqlite?: boolean;
|
|
797
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
756
798
|
enableActorRuntimeSocket?: boolean;
|
|
757
799
|
hasState?: boolean;
|
|
758
800
|
canHibernateWebsocket?: boolean;
|
|
@@ -894,6 +936,7 @@ interface CoreRuntime {
|
|
|
894
936
|
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
895
937
|
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
896
938
|
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
939
|
+
actorSetRunWakeAt(ctx: ActorContextHandle, timestampMs?: number | undefined | null): Promise<void>;
|
|
897
940
|
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
898
941
|
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
899
942
|
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
@@ -939,11 +982,15 @@ interface CoreRuntime {
|
|
|
939
982
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
940
983
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
941
984
|
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
942
|
-
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<SqliteTransactionHandle>;
|
|
985
|
+
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
|
|
943
986
|
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
944
987
|
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
945
988
|
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
946
989
|
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
990
|
+
actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
|
|
991
|
+
actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
992
|
+
actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
993
|
+
actorStateTransactionRollback(transaction: ActorStateTransactionHandle): Promise<void>;
|
|
947
994
|
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
948
995
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
949
996
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
@@ -954,6 +1001,7 @@ interface CoreRuntime {
|
|
|
954
1001
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
955
1002
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
956
1003
|
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
1004
|
+
actorQueueCompletePersisted(ctx: ActorContextHandle, messageId: bigint, expectedName: string, response?: RuntimeBytes | undefined | null): Promise<boolean>;
|
|
957
1005
|
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
958
1006
|
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
959
1007
|
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
@@ -1137,7 +1185,9 @@ type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => voi
|
|
|
1137
1185
|
type ActorActionMap<R> = {
|
|
1138
1186
|
[K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : NonNullable<R>[K] extends Record<string, unknown> ? ActorActionMap<NonNullable<R>[K]> : never;
|
|
1139
1187
|
};
|
|
1140
|
-
type ActionsOf<AD extends AnyActorDefinition> = AD extends
|
|
1188
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD["config"] extends {
|
|
1189
|
+
actions?: infer R;
|
|
1190
|
+
} ? R : never;
|
|
1141
1191
|
interface ActorGatewayOptions {
|
|
1142
1192
|
skipReadyWait?: boolean;
|
|
1143
1193
|
}
|
|
@@ -1620,6 +1670,9 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
1620
1670
|
[K in keyof ExtractActorsFromRegistry<A>]: ActorAccessor<ExtractActorsFromRegistry<A>[K]>;
|
|
1621
1671
|
};
|
|
1622
1672
|
|
|
1673
|
+
/** @experimental State exposed by a durable workflow run handler to the Inspector. */
|
|
1674
|
+
type WorkflowState = "pending" | "running" | "sleeping" | "failed" | "completed" | "cancelled" | "rolling_back";
|
|
1675
|
+
|
|
1623
1676
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
1624
1677
|
declare const RAW_STATE_SYMBOL: unique symbol;
|
|
1625
1678
|
interface ActorLogger {
|
|
@@ -1655,7 +1708,7 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1655
1708
|
};
|
|
1656
1709
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1657
1710
|
/**
|
|
1658
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`
|
|
1711
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1659
1712
|
* or actor state instead.
|
|
1660
1713
|
*/
|
|
1661
1714
|
interface ActorKv {
|
|
@@ -1752,6 +1805,8 @@ type QueueMessageOf<Name extends string, Body> = {
|
|
|
1752
1805
|
type QueueName<TQueues extends QueueSchemaConfig> = keyof TQueues & string;
|
|
1753
1806
|
type QueueFilterName<TQueues extends QueueSchemaConfig> = keyof TQueues extends never ? string : QueueName<TQueues>;
|
|
1754
1807
|
type QueueMessageForName<TQueues extends QueueSchemaConfig, TName extends QueueFilterName<TQueues>> = keyof TQueues extends never ? QueueMessageOf<string, unknown> : TName extends QueueName<TQueues> ? QueueMessageOf<TName, InferSchemaMap<TQueues>[TName]> : never;
|
|
1808
|
+
type QueueCompleteArgs<T> = undefined extends T ? [response?: T] : [response: T];
|
|
1809
|
+
type QueueCompleteArgsForName<TQueues extends QueueSchemaConfig, TName extends QueueFilterName<TQueues>> = keyof TQueues extends never ? [response?: unknown] : TName extends QueueName<TQueues> ? [InferQueueCompleteMap<TQueues>[TName]] extends [never] ? [response?: unknown] : QueueCompleteArgs<InferQueueCompleteMap<TQueues>[TName]> : [response?: unknown];
|
|
1755
1810
|
type QueueCompletionResultForName<TQueues extends QueueSchemaConfig, TName extends QueueFilterName<TQueues>> = keyof TQueues extends never ? unknown | undefined : TName extends QueueName<TQueues> ? InferQueueCompleteMap<TQueues>[TName] | undefined : unknown | undefined;
|
|
1756
1811
|
interface QueueNextOptions<TName extends string = string, TCompletable extends boolean = boolean> {
|
|
1757
1812
|
names?: readonly TName[];
|
|
@@ -1794,6 +1849,13 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1794
1849
|
next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
|
|
1795
1850
|
nextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
1796
1851
|
waitForNames<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(names: readonly TName[], opts?: QueueWaitOptions<TCompletable>): Promise<any>;
|
|
1852
|
+
/** @experimental */
|
|
1853
|
+
waitForAvailable<const TName extends QueueFilterName<TQueues>>(names?: readonly TName[], opts?: Omit<QueueWaitOptions<false>, "completable">): Promise<void>;
|
|
1854
|
+
/** @experimental */
|
|
1855
|
+
complete<const TName extends QueueFilterName<TQueues>>(message: {
|
|
1856
|
+
id: number | bigint;
|
|
1857
|
+
name: TName;
|
|
1858
|
+
}, ...args: QueueCompleteArgsForName<TQueues, TName>): Promise<void>;
|
|
1797
1859
|
enqueueAndWait<const TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"], opts?: QueueEnqueueAndWaitOptions): Promise<QueueCompletionResultForName<TQueues, TName>>;
|
|
1798
1860
|
tryNext<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextOptions<TName, TCompletable>): Promise<any>;
|
|
1799
1861
|
tryNextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
@@ -1816,7 +1878,7 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1816
1878
|
state: TState;
|
|
1817
1879
|
vars: TVars;
|
|
1818
1880
|
/**
|
|
1819
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db`
|
|
1881
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1820
1882
|
* or actor state instead.
|
|
1821
1883
|
*/
|
|
1822
1884
|
readonly kv: ActorKv;
|
|
@@ -1824,6 +1886,8 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1824
1886
|
readonly schedule: ActorSchedule;
|
|
1825
1887
|
readonly cron: ActorCron;
|
|
1826
1888
|
readonly queue: ActorQueue<TQueues>;
|
|
1889
|
+
/** @experimental */
|
|
1890
|
+
readonly run: ActorRun;
|
|
1827
1891
|
readonly actorId: string;
|
|
1828
1892
|
readonly name: string;
|
|
1829
1893
|
readonly key: string[];
|
|
@@ -1853,6 +1917,14 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1853
1917
|
client<T = any>(): ActorClientFor<T>;
|
|
1854
1918
|
[key: string]: any;
|
|
1855
1919
|
}
|
|
1920
|
+
/** @experimental */
|
|
1921
|
+
interface ActorRun {
|
|
1922
|
+
/**
|
|
1923
|
+
* @experimental Sets or clears the durable Unix-millisecond deadline that
|
|
1924
|
+
* ensures this actor's run handler is active, starting it if inactive.
|
|
1925
|
+
*/
|
|
1926
|
+
setWakeAt(timestamp: number | null): Promise<void>;
|
|
1927
|
+
}
|
|
1856
1928
|
type ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & {
|
|
1857
1929
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
1858
1930
|
};
|
|
@@ -1879,6 +1951,7 @@ declare const RunConfigSchema: z$1.ZodObject<{
|
|
|
1879
1951
|
inspector: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodObject<{
|
|
1880
1952
|
workflow: z$1.ZodOptional<z$1.ZodObject<{
|
|
1881
1953
|
getHistory: z$1.ZodCustom<() => unknown, () => unknown>;
|
|
1954
|
+
getState: z$1.ZodOptional<z$1.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
|
|
1882
1955
|
onHistoryUpdated: z$1.ZodOptional<z$1.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
|
|
1883
1956
|
replayFromStep: z$1.ZodOptional<z$1.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
|
|
1884
1957
|
}, z$1.core.$strip>>;
|
|
@@ -1901,6 +1974,7 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1901
1974
|
inspector: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodObject<{
|
|
1902
1975
|
workflow: z$1.ZodOptional<z$1.ZodObject<{
|
|
1903
1976
|
getHistory: z$1.ZodCustom<() => unknown, () => unknown>;
|
|
1977
|
+
getState: z$1.ZodOptional<z$1.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
|
|
1904
1978
|
onHistoryUpdated: z$1.ZodOptional<z$1.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
|
|
1905
1979
|
replayFromStep: z$1.ZodOptional<z$1.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
|
|
1906
1980
|
}, z$1.core.$strip>>;
|
|
@@ -15,7 +15,7 @@ interface ActorMetricsLike {
|
|
|
15
15
|
totalKvWrites: number;
|
|
16
16
|
trackSql(query: string, durationMs: number): void;
|
|
17
17
|
}
|
|
18
|
-
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> :
|
|
18
|
+
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> : RawAccess;
|
|
19
19
|
type SqliteBindings = unknown[] | Record<string, unknown>;
|
|
20
20
|
interface SqliteQueryResult {
|
|
21
21
|
columns: string[];
|
|
@@ -29,6 +29,41 @@ interface SqliteBatchStatement {
|
|
|
29
29
|
sql: string;
|
|
30
30
|
params?: SqliteBindings;
|
|
31
31
|
}
|
|
32
|
+
interface SqliteTransactionOptions {
|
|
33
|
+
/** Static operation name used to aggregate transaction performance. */
|
|
34
|
+
name?: string;
|
|
35
|
+
/** Deadlock-safety timeout in milliseconds. */
|
|
36
|
+
timeout?: number;
|
|
37
|
+
/** @experimental */
|
|
38
|
+
experimental?: {
|
|
39
|
+
/**
|
|
40
|
+
* Atomically includes actor and hibernatable connection state.
|
|
41
|
+
* Only single-statement `execute` calls are supported in the transaction.
|
|
42
|
+
* Concurrent actions that try to mutate state while the transaction is
|
|
43
|
+
* active fail with `actor.state_transaction_conflict`.
|
|
44
|
+
*/
|
|
45
|
+
includeState?: boolean;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* SQLite profiling configuration.
|
|
50
|
+
*
|
|
51
|
+
* @experimental This entire configuration surface is experimental and subject
|
|
52
|
+
* to change without notice.
|
|
53
|
+
*/
|
|
54
|
+
interface SqliteProfilingOptions {
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
maxTrackedStatementFingerprints?: number;
|
|
57
|
+
maxTrackedTransactionFingerprints?: number;
|
|
58
|
+
maxPrometheusSeries?: number;
|
|
59
|
+
maxStatementsPerTransactionTrace?: number;
|
|
60
|
+
maxGetPagesRequestsPerTrace?: number;
|
|
61
|
+
maxTransactionNameBytes?: number;
|
|
62
|
+
slowOperationThresholdMs?: number;
|
|
63
|
+
baselineSampleRate?: number;
|
|
64
|
+
maxDiagnosticEventsPerMinute?: number;
|
|
65
|
+
diagnosticEventQueueCapacity?: number;
|
|
66
|
+
}
|
|
32
67
|
interface SqliteNativeMetrics {
|
|
33
68
|
requestBuildNs: number;
|
|
34
69
|
serializeNs: number;
|
|
@@ -46,7 +81,7 @@ interface SqliteDatabase {
|
|
|
46
81
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
47
82
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
48
83
|
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
49
|
-
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
84
|
+
beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
|
|
50
85
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
51
86
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
52
87
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
@@ -101,6 +136,13 @@ interface DatabaseProviderContext {
|
|
|
101
136
|
nativeDatabaseProvider?: NativeDatabaseProvider;
|
|
102
137
|
}
|
|
103
138
|
type DatabaseProvider<DB extends RawAccess> = {
|
|
139
|
+
/**
|
|
140
|
+
* Local SQLite profiling controls consumed by the actor runtime.
|
|
141
|
+
*
|
|
142
|
+
* @experimental This entire configuration surface is experimental and
|
|
143
|
+
* subject to change without notice.
|
|
144
|
+
*/
|
|
145
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
104
146
|
/**
|
|
105
147
|
* Creates a new database client for the actor.
|
|
106
148
|
* The result is passed to the actor context as `c.db`.
|
|
@@ -125,9 +167,7 @@ type RawAccess = {
|
|
|
125
167
|
*/
|
|
126
168
|
execute: ExecuteFunction;
|
|
127
169
|
/** Runs a callback in an isolated SQLite transaction. */
|
|
128
|
-
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?:
|
|
129
|
-
timeout?: number;
|
|
130
|
-
}) => Promise<T>;
|
|
170
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: SqliteTransactionOptions) => Promise<T>;
|
|
131
171
|
/**
|
|
132
172
|
* Returns native SQLite metrics when the active runtime supports them.
|
|
133
173
|
*/
|
|
@@ -587,6 +627,7 @@ type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
|
587
627
|
type ConnHandle = OpaqueHandle<"conn">;
|
|
588
628
|
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
589
629
|
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
630
|
+
type ActorStateTransactionHandle = OpaqueHandle<"actorStateTransaction">;
|
|
590
631
|
type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
591
632
|
type RuntimeBytes = Uint8Array;
|
|
592
633
|
interface RuntimeActorKeySegment {
|
|
@@ -753,6 +794,7 @@ interface RuntimeActorConfig {
|
|
|
753
794
|
icon?: string;
|
|
754
795
|
hasDatabase?: boolean;
|
|
755
796
|
remoteSqlite?: boolean;
|
|
797
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
756
798
|
enableActorRuntimeSocket?: boolean;
|
|
757
799
|
hasState?: boolean;
|
|
758
800
|
canHibernateWebsocket?: boolean;
|
|
@@ -894,6 +936,7 @@ interface CoreRuntime {
|
|
|
894
936
|
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
895
937
|
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
896
938
|
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
939
|
+
actorSetRunWakeAt(ctx: ActorContextHandle, timestampMs?: number | undefined | null): Promise<void>;
|
|
897
940
|
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
898
941
|
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
899
942
|
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
@@ -939,11 +982,15 @@ interface CoreRuntime {
|
|
|
939
982
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
940
983
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
941
984
|
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
942
|
-
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<SqliteTransactionHandle>;
|
|
985
|
+
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
|
|
943
986
|
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
944
987
|
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
945
988
|
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
946
989
|
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
990
|
+
actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
|
|
991
|
+
actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
992
|
+
actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
993
|
+
actorStateTransactionRollback(transaction: ActorStateTransactionHandle): Promise<void>;
|
|
947
994
|
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
948
995
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
949
996
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
@@ -954,6 +1001,7 @@ interface CoreRuntime {
|
|
|
954
1001
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
955
1002
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
956
1003
|
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
1004
|
+
actorQueueCompletePersisted(ctx: ActorContextHandle, messageId: bigint, expectedName: string, response?: RuntimeBytes | undefined | null): Promise<boolean>;
|
|
957
1005
|
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
958
1006
|
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
959
1007
|
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
@@ -1137,7 +1185,9 @@ type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => voi
|
|
|
1137
1185
|
type ActorActionMap<R> = {
|
|
1138
1186
|
[K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : NonNullable<R>[K] extends Record<string, unknown> ? ActorActionMap<NonNullable<R>[K]> : never;
|
|
1139
1187
|
};
|
|
1140
|
-
type ActionsOf<AD extends AnyActorDefinition> = AD extends
|
|
1188
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD["config"] extends {
|
|
1189
|
+
actions?: infer R;
|
|
1190
|
+
} ? R : never;
|
|
1141
1191
|
interface ActorGatewayOptions {
|
|
1142
1192
|
skipReadyWait?: boolean;
|
|
1143
1193
|
}
|
|
@@ -1620,6 +1670,9 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
1620
1670
|
[K in keyof ExtractActorsFromRegistry<A>]: ActorAccessor<ExtractActorsFromRegistry<A>[K]>;
|
|
1621
1671
|
};
|
|
1622
1672
|
|
|
1673
|
+
/** @experimental State exposed by a durable workflow run handler to the Inspector. */
|
|
1674
|
+
type WorkflowState = "pending" | "running" | "sleeping" | "failed" | "completed" | "cancelled" | "rolling_back";
|
|
1675
|
+
|
|
1623
1676
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
1624
1677
|
declare const RAW_STATE_SYMBOL: unique symbol;
|
|
1625
1678
|
interface ActorLogger {
|
|
@@ -1655,7 +1708,7 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1655
1708
|
};
|
|
1656
1709
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1657
1710
|
/**
|
|
1658
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`
|
|
1711
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1659
1712
|
* or actor state instead.
|
|
1660
1713
|
*/
|
|
1661
1714
|
interface ActorKv {
|
|
@@ -1752,6 +1805,8 @@ type QueueMessageOf<Name extends string, Body> = {
|
|
|
1752
1805
|
type QueueName<TQueues extends QueueSchemaConfig> = keyof TQueues & string;
|
|
1753
1806
|
type QueueFilterName<TQueues extends QueueSchemaConfig> = keyof TQueues extends never ? string : QueueName<TQueues>;
|
|
1754
1807
|
type QueueMessageForName<TQueues extends QueueSchemaConfig, TName extends QueueFilterName<TQueues>> = keyof TQueues extends never ? QueueMessageOf<string, unknown> : TName extends QueueName<TQueues> ? QueueMessageOf<TName, InferSchemaMap<TQueues>[TName]> : never;
|
|
1808
|
+
type QueueCompleteArgs<T> = undefined extends T ? [response?: T] : [response: T];
|
|
1809
|
+
type QueueCompleteArgsForName<TQueues extends QueueSchemaConfig, TName extends QueueFilterName<TQueues>> = keyof TQueues extends never ? [response?: unknown] : TName extends QueueName<TQueues> ? [InferQueueCompleteMap<TQueues>[TName]] extends [never] ? [response?: unknown] : QueueCompleteArgs<InferQueueCompleteMap<TQueues>[TName]> : [response?: unknown];
|
|
1755
1810
|
type QueueCompletionResultForName<TQueues extends QueueSchemaConfig, TName extends QueueFilterName<TQueues>> = keyof TQueues extends never ? unknown | undefined : TName extends QueueName<TQueues> ? InferQueueCompleteMap<TQueues>[TName] | undefined : unknown | undefined;
|
|
1756
1811
|
interface QueueNextOptions<TName extends string = string, TCompletable extends boolean = boolean> {
|
|
1757
1812
|
names?: readonly TName[];
|
|
@@ -1794,6 +1849,13 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1794
1849
|
next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
|
|
1795
1850
|
nextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
1796
1851
|
waitForNames<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(names: readonly TName[], opts?: QueueWaitOptions<TCompletable>): Promise<any>;
|
|
1852
|
+
/** @experimental */
|
|
1853
|
+
waitForAvailable<const TName extends QueueFilterName<TQueues>>(names?: readonly TName[], opts?: Omit<QueueWaitOptions<false>, "completable">): Promise<void>;
|
|
1854
|
+
/** @experimental */
|
|
1855
|
+
complete<const TName extends QueueFilterName<TQueues>>(message: {
|
|
1856
|
+
id: number | bigint;
|
|
1857
|
+
name: TName;
|
|
1858
|
+
}, ...args: QueueCompleteArgsForName<TQueues, TName>): Promise<void>;
|
|
1797
1859
|
enqueueAndWait<const TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"], opts?: QueueEnqueueAndWaitOptions): Promise<QueueCompletionResultForName<TQueues, TName>>;
|
|
1798
1860
|
tryNext<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextOptions<TName, TCompletable>): Promise<any>;
|
|
1799
1861
|
tryNextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
@@ -1816,7 +1878,7 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1816
1878
|
state: TState;
|
|
1817
1879
|
vars: TVars;
|
|
1818
1880
|
/**
|
|
1819
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db`
|
|
1881
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1820
1882
|
* or actor state instead.
|
|
1821
1883
|
*/
|
|
1822
1884
|
readonly kv: ActorKv;
|
|
@@ -1824,6 +1886,8 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1824
1886
|
readonly schedule: ActorSchedule;
|
|
1825
1887
|
readonly cron: ActorCron;
|
|
1826
1888
|
readonly queue: ActorQueue<TQueues>;
|
|
1889
|
+
/** @experimental */
|
|
1890
|
+
readonly run: ActorRun;
|
|
1827
1891
|
readonly actorId: string;
|
|
1828
1892
|
readonly name: string;
|
|
1829
1893
|
readonly key: string[];
|
|
@@ -1853,6 +1917,14 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1853
1917
|
client<T = any>(): ActorClientFor<T>;
|
|
1854
1918
|
[key: string]: any;
|
|
1855
1919
|
}
|
|
1920
|
+
/** @experimental */
|
|
1921
|
+
interface ActorRun {
|
|
1922
|
+
/**
|
|
1923
|
+
* @experimental Sets or clears the durable Unix-millisecond deadline that
|
|
1924
|
+
* ensures this actor's run handler is active, starting it if inactive.
|
|
1925
|
+
*/
|
|
1926
|
+
setWakeAt(timestamp: number | null): Promise<void>;
|
|
1927
|
+
}
|
|
1856
1928
|
type ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & {
|
|
1857
1929
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
1858
1930
|
};
|
|
@@ -1879,6 +1951,7 @@ declare const RunConfigSchema: z$1.ZodObject<{
|
|
|
1879
1951
|
inspector: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodObject<{
|
|
1880
1952
|
workflow: z$1.ZodOptional<z$1.ZodObject<{
|
|
1881
1953
|
getHistory: z$1.ZodCustom<() => unknown, () => unknown>;
|
|
1954
|
+
getState: z$1.ZodOptional<z$1.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
|
|
1882
1955
|
onHistoryUpdated: z$1.ZodOptional<z$1.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
|
|
1883
1956
|
replayFromStep: z$1.ZodOptional<z$1.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
|
|
1884
1957
|
}, z$1.core.$strip>>;
|
|
@@ -1901,6 +1974,7 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1901
1974
|
inspector: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodObject<{
|
|
1902
1975
|
workflow: z$1.ZodOptional<z$1.ZodObject<{
|
|
1903
1976
|
getHistory: z$1.ZodCustom<() => unknown, () => unknown>;
|
|
1977
|
+
getState: z$1.ZodOptional<z$1.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
|
|
1904
1978
|
onHistoryUpdated: z$1.ZodOptional<z$1.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
|
|
1905
1979
|
replayFromStep: z$1.ZodOptional<z$1.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
|
|
1906
1980
|
}, z$1.core.$strip>>;
|