rivetkit 2.3.11-rc.9 → 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-HOZ3ZLZ2.js → chunk-3ZR542SK.js} +6 -6
- 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-XOOESJY7.js → chunk-FWROC5LA.js} +2 -2
- package/dist/tsup/{chunk-V5CVATRU.cjs → chunk-GLIPKKEC.cjs} +7 -7
- package/dist/tsup/{chunk-V5CVATRU.cjs.map → chunk-GLIPKKEC.cjs.map} +1 -1
- package/dist/tsup/{chunk-T5XVTVQY.cjs → chunk-GN2EUMEW.cjs} +3 -3
- package/dist/tsup/{chunk-T5XVTVQY.cjs.map → chunk-GN2EUMEW.cjs.map} +1 -1
- package/dist/tsup/{chunk-T56IZ42M.cjs → chunk-GU7ML3KE.cjs} +13 -3
- package/dist/tsup/chunk-GU7ML3KE.cjs.map +1 -0
- package/dist/tsup/{chunk-IOLZ3ONU.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-QVCO6DTZ.js → chunk-MO2SSUOR.js} +8 -7
- package/dist/tsup/chunk-MO2SSUOR.js.map +1 -0
- package/dist/tsup/{chunk-LZ4TSBIP.js → chunk-OUENKQHB.js} +13 -3
- package/dist/tsup/chunk-OUENKQHB.js.map +1 -0
- package/dist/tsup/{chunk-6SBPWTXJ.cjs → chunk-PUZY2XCD.cjs} +10 -9
- package/dist/tsup/chunk-PUZY2XCD.cjs.map +1 -0
- package/dist/tsup/{chunk-C5TORAVP.js → chunk-QFJ24MBU.js} +27 -2
- package/dist/tsup/{chunk-C5TORAVP.js.map → chunk-QFJ24MBU.js.map} +1 -1
- package/dist/tsup/{chunk-BZWKY6WO.cjs → chunk-RXXDNJXB.cjs} +140 -140
- package/dist/tsup/{chunk-BZWKY6WO.cjs.map → chunk-RXXDNJXB.cjs.map} +1 -1
- package/dist/tsup/{chunk-IMRDHZM2.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 +743 -247
- 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 +670 -174
- 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 +474 -161
- 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/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-6SBPWTXJ.cjs.map +0 -1
- package/dist/tsup/chunk-7AFZMFPQ.js.map +0 -1
- package/dist/tsup/chunk-HNHLBM3Y.cjs.map +0 -1
- package/dist/tsup/chunk-HOZ3ZLZ2.js.map +0 -1
- package/dist/tsup/chunk-IMRDHZM2.cjs.map +0 -1
- package/dist/tsup/chunk-LZ4TSBIP.js.map +0 -1
- package/dist/tsup/chunk-QVCO6DTZ.js.map +0 -1
- package/dist/tsup/chunk-QWLJCP3X.js.map +0 -1
- package/dist/tsup/chunk-T56IZ42M.cjs.map +0 -1
- package/dist/tsup/chunk-UEULFXUI.cjs.map +0 -1
- /package/dist/tsup/{chunk-XOOESJY7.js.map → chunk-FWROC5LA.js.map} +0 -0
- /package/dist/tsup/{chunk-IOLZ3ONU.js.map → chunk-JQ2AZ5FN.js.map} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import { A as AnyDatabaseProvider,
|
|
2
|
+
import { A as AnyDatabaseProvider, a as SqliteProfilingOptions, f as SqliteNativeMetrics, I as InferDatabaseClient } from './config-ey2I2zz5.cjs';
|
|
3
3
|
import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
|
|
4
4
|
import { z as z$1 } from 'zod';
|
|
5
5
|
import { Logger } from 'pino';
|
|
6
6
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
7
|
+
import { WorkflowState } from './inspector/workflow.cjs';
|
|
7
8
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
8
9
|
import { E as Encoding, G as GetUpgradeWebSocket } from './utils-DQDCphrl.cjs';
|
|
9
10
|
import { Context, Hono } from 'hono';
|
|
@@ -567,6 +568,7 @@ type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
|
567
568
|
type ConnHandle = OpaqueHandle<"conn">;
|
|
568
569
|
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
569
570
|
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
571
|
+
type ActorStateTransactionHandle = OpaqueHandle<"actorStateTransaction">;
|
|
570
572
|
type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
571
573
|
type RuntimeBytes = Uint8Array;
|
|
572
574
|
interface RuntimeActorKeySegment {
|
|
@@ -733,6 +735,7 @@ interface RuntimeActorConfig {
|
|
|
733
735
|
icon?: string;
|
|
734
736
|
hasDatabase?: boolean;
|
|
735
737
|
remoteSqlite?: boolean;
|
|
738
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
736
739
|
enableActorRuntimeSocket?: boolean;
|
|
737
740
|
hasState?: boolean;
|
|
738
741
|
canHibernateWebsocket?: boolean;
|
|
@@ -874,6 +877,7 @@ interface CoreRuntime {
|
|
|
874
877
|
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
875
878
|
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
876
879
|
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
880
|
+
actorSetRunWakeAt(ctx: ActorContextHandle, timestampMs?: number | undefined | null): Promise<void>;
|
|
877
881
|
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
878
882
|
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
879
883
|
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
@@ -919,11 +923,15 @@ interface CoreRuntime {
|
|
|
919
923
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
920
924
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
921
925
|
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
922
|
-
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<SqliteTransactionHandle>;
|
|
926
|
+
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number, name?: string): Promise<SqliteTransactionHandle>;
|
|
923
927
|
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
924
928
|
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
925
929
|
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
926
930
|
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
931
|
+
actorBeginStateTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<ActorStateTransactionHandle>;
|
|
932
|
+
actorStateTransactionExecute(transaction: ActorStateTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
933
|
+
actorStateTransactionCommit(transaction: ActorStateTransactionHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
934
|
+
actorStateTransactionRollback(transaction: ActorStateTransactionHandle): Promise<void>;
|
|
927
935
|
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
928
936
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
929
937
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
@@ -934,6 +942,7 @@ interface CoreRuntime {
|
|
|
934
942
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
935
943
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
936
944
|
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
945
|
+
actorQueueCompletePersisted(ctx: ActorContextHandle, messageId: bigint, expectedName: string, response?: RuntimeBytes | undefined | null): Promise<boolean>;
|
|
937
946
|
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
938
947
|
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
939
948
|
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
@@ -1118,7 +1127,9 @@ type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => voi
|
|
|
1118
1127
|
type ActorActionMap<R> = {
|
|
1119
1128
|
[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;
|
|
1120
1129
|
};
|
|
1121
|
-
type ActionsOf<AD extends AnyActorDefinition> = AD extends
|
|
1130
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD["config"] extends {
|
|
1131
|
+
actions?: infer R;
|
|
1132
|
+
} ? R : never;
|
|
1122
1133
|
interface ActorGatewayOptions {
|
|
1123
1134
|
skipReadyWait?: boolean;
|
|
1124
1135
|
}
|
|
@@ -1670,7 +1681,7 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1670
1681
|
};
|
|
1671
1682
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1672
1683
|
/**
|
|
1673
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`
|
|
1684
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1674
1685
|
* or actor state instead.
|
|
1675
1686
|
*/
|
|
1676
1687
|
interface ActorKv {
|
|
@@ -1822,6 +1833,13 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1822
1833
|
next<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
|
|
1823
1834
|
nextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
1824
1835
|
waitForNames<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(names: readonly TName[], opts?: QueueWaitOptions<TCompletable>): Promise<any>;
|
|
1836
|
+
/** @experimental */
|
|
1837
|
+
waitForAvailable<const TName extends QueueFilterName<TQueues>>(names?: readonly TName[], opts?: Omit<QueueWaitOptions<false>, "completable">): Promise<void>;
|
|
1838
|
+
/** @experimental */
|
|
1839
|
+
complete<const TName extends QueueFilterName<TQueues>>(message: {
|
|
1840
|
+
id: number | bigint;
|
|
1841
|
+
name: TName;
|
|
1842
|
+
}, ...args: QueueCompleteArgsForName<TQueues, TName>): Promise<void>;
|
|
1825
1843
|
enqueueAndWait<const TName extends QueueFilterName<TQueues>>(name: TName, body: QueueMessageForName<TQueues, TName>["body"], opts?: QueueEnqueueAndWaitOptions): Promise<QueueCompletionResultForName<TQueues, TName>>;
|
|
1826
1844
|
tryNext<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextOptions<TName, TCompletable>): Promise<any>;
|
|
1827
1845
|
tryNextBatch<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueTryNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
@@ -1845,7 +1863,7 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1845
1863
|
state: TState;
|
|
1846
1864
|
vars: TVars;
|
|
1847
1865
|
/**
|
|
1848
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db`
|
|
1866
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
1849
1867
|
* or actor state instead.
|
|
1850
1868
|
*/
|
|
1851
1869
|
readonly kv: ActorKv;
|
|
@@ -1853,6 +1871,8 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1853
1871
|
readonly schedule: ActorSchedule;
|
|
1854
1872
|
readonly cron: ActorCron;
|
|
1855
1873
|
readonly queue: ActorQueue<TQueues>;
|
|
1874
|
+
/** @experimental */
|
|
1875
|
+
readonly run: ActorRun;
|
|
1856
1876
|
readonly actorId: string;
|
|
1857
1877
|
readonly name: string;
|
|
1858
1878
|
readonly key: string[];
|
|
@@ -1882,6 +1902,14 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1882
1902
|
client<T = any>(): ActorClientFor<T>;
|
|
1883
1903
|
[key: string]: any;
|
|
1884
1904
|
}
|
|
1905
|
+
/** @experimental */
|
|
1906
|
+
interface ActorRun {
|
|
1907
|
+
/**
|
|
1908
|
+
* @experimental Sets or clears the durable Unix-millisecond deadline that
|
|
1909
|
+
* ensures this actor's run handler is active, starting it if inactive.
|
|
1910
|
+
*/
|
|
1911
|
+
setWakeAt(timestamp: number | null): Promise<void>;
|
|
1912
|
+
}
|
|
1885
1913
|
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> & {
|
|
1886
1914
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
1887
1915
|
};
|
|
@@ -1910,11 +1938,14 @@ interface ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase e
|
|
|
1910
1938
|
database?: TDatabase;
|
|
1911
1939
|
}
|
|
1912
1940
|
type InspectorUnsubscribe = () => void;
|
|
1941
|
+
/** @experimental */
|
|
1913
1942
|
interface WorkflowInspectorConfig<THistory = unknown> {
|
|
1914
1943
|
getHistory: () => THistory | null;
|
|
1944
|
+
getState?: () => Promise<WorkflowState | null>;
|
|
1915
1945
|
onHistoryUpdated?: (listener: (history: THistory) => void) => InspectorUnsubscribe;
|
|
1916
1946
|
replayFromStep?: (entryId?: string) => Promise<THistory | null>;
|
|
1917
1947
|
}
|
|
1948
|
+
/** @experimental */
|
|
1918
1949
|
interface RunInspectorConfig<THistory = unknown> {
|
|
1919
1950
|
workflow?: WorkflowInspectorConfig<THistory>;
|
|
1920
1951
|
}
|
|
@@ -1998,6 +2029,7 @@ declare const RunConfigSchema: z.ZodObject<{
|
|
|
1998
2029
|
inspector: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
1999
2030
|
workflow: z.ZodOptional<z.ZodObject<{
|
|
2000
2031
|
getHistory: z.ZodCustom<() => unknown, () => unknown>;
|
|
2032
|
+
getState: z.ZodOptional<z.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
|
|
2001
2033
|
onHistoryUpdated: z.ZodOptional<z.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
|
|
2002
2034
|
replayFromStep: z.ZodOptional<z.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
|
|
2003
2035
|
}, z.core.$strip>>;
|
|
@@ -2008,7 +2040,59 @@ type RunConfig<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
|
|
|
2008
2040
|
run: (c: RunContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>) => void | Promise<void>;
|
|
2009
2041
|
};
|
|
2010
2042
|
type AnyRunConfig = RunConfig<any, any, any, any, any, AnyDatabaseProvider, any, any>;
|
|
2011
|
-
|
|
2043
|
+
/** @experimental */
|
|
2044
|
+
type RunInspectorKind = "workflow";
|
|
2045
|
+
/** @experimental */
|
|
2046
|
+
interface RunWithInactiveOptions {
|
|
2047
|
+
/** Restart the run handler before releasing the exclusive gate on success. */
|
|
2048
|
+
restartOnSuccess?: boolean;
|
|
2049
|
+
}
|
|
2050
|
+
/** @experimental */
|
|
2051
|
+
interface RunControl {
|
|
2052
|
+
run: {
|
|
2053
|
+
/**
|
|
2054
|
+
* Executes only while no run handler is active or waiting to start.
|
|
2055
|
+
*
|
|
2056
|
+
* This is a non-blocking acquisition: concurrent replay/control requests
|
|
2057
|
+
* fail instead of waiting behind an active run.
|
|
2058
|
+
*/
|
|
2059
|
+
withInactive<T>(options: RunWithInactiveOptions, callback: () => T | Promise<T>): Promise<T>;
|
|
2060
|
+
};
|
|
2061
|
+
}
|
|
2062
|
+
/** @experimental */
|
|
2063
|
+
interface RunInspectorFactoryContext {
|
|
2064
|
+
actorId: string;
|
|
2065
|
+
control: RunControl;
|
|
2066
|
+
}
|
|
2067
|
+
/** @experimental */
|
|
2068
|
+
interface RunInspectorFactoryResult<THistory = unknown> {
|
|
2069
|
+
inspector: {
|
|
2070
|
+
workflow: Required<WorkflowInspectorConfig<THistory>> & {
|
|
2071
|
+
getState: () => Promise<WorkflowState | null>;
|
|
2072
|
+
};
|
|
2073
|
+
};
|
|
2074
|
+
/** Releases actor-specific listeners and encoded history. */
|
|
2075
|
+
dispose?: () => void;
|
|
2076
|
+
}
|
|
2077
|
+
interface RunHandlerDisplayOptions {
|
|
2078
|
+
name?: string;
|
|
2079
|
+
icon?: string;
|
|
2080
|
+
}
|
|
2081
|
+
/** @experimental */
|
|
2082
|
+
type DefineRunHandlerOptions<THistory = unknown> = RunHandlerDisplayOptions & ({
|
|
2083
|
+
inspectorKind?: never;
|
|
2084
|
+
createInspector?: never;
|
|
2085
|
+
} | {
|
|
2086
|
+
/** Static metadata used to install Inspector callbacks at registry build time. */
|
|
2087
|
+
inspectorKind: RunInspectorKind;
|
|
2088
|
+
/** Creates one Inspector adapter for each live actor. */
|
|
2089
|
+
createInspector: (context: RunInspectorFactoryContext) => RunInspectorFactoryResult<THistory>;
|
|
2090
|
+
});
|
|
2091
|
+
/**
|
|
2092
|
+
* @experimental Adds supported RivetKit run metadata while preserving the function's exact
|
|
2093
|
+
* callable type.
|
|
2094
|
+
*/
|
|
2095
|
+
declare function defineRunHandler<TRun extends (...args: any[]) => any, THistory = unknown>(run: TRun, options: DefineRunHandlerOptions<THistory>): TRun;
|
|
2012
2096
|
/** Extract the run function from either a function or RunConfig object. */
|
|
2013
2097
|
declare function getRunFunction(run: ((...args: any[]) => any) | AnyRunConfig | undefined): ((...args: any[]) => any) | undefined;
|
|
2014
2098
|
/** Extract run metadata (name/icon) from RunConfig if provided. */
|
|
@@ -2091,6 +2175,7 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
2091
2175
|
inspector: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
2092
2176
|
workflow: z.ZodOptional<z.ZodObject<{
|
|
2093
2177
|
getHistory: z.ZodCustom<() => unknown, () => unknown>;
|
|
2178
|
+
getState: z.ZodOptional<z.ZodCustom<() => Promise<WorkflowState | null>, () => Promise<WorkflowState | null>>>;
|
|
2094
2179
|
onHistoryUpdated: z.ZodOptional<z.ZodCustom<(listener: (history: unknown) => void) => InspectorUnsubscribe, (listener: (history: unknown) => void) => InspectorUnsubscribe>>;
|
|
2095
2180
|
replayFromStep: z.ZodOptional<z.ZodCustom<(entryId?: string) => Promise<unknown>, (entryId?: string) => Promise<unknown>>>;
|
|
2096
2181
|
}, z.core.$strip>>;
|
|
@@ -2447,4 +2532,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
|
|
|
2447
2532
|
}, z.core.$strip>>;
|
|
2448
2533
|
}, z.core.$strip>;
|
|
2449
2534
|
|
|
2450
|
-
export {
|
|
2535
|
+
export { type BaseActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorLogger as F, type ActorOptions as G, type ActorOptionsInput as H, ActorOptionsSchema as I, type ActorQuery as J, type ActorQueue as K, type ActorRun as L, type MigrateContext as M, type ActorSchedule as N, type ActorTypes as O, ActorsSchema as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AnyActorInstance as T, type AnyClient as U, type AnyConn as V, type WakeContext as W, type AnyStaticActorDefinition as X, type AnyStaticActorInstance as Y, type AuthIntent as Z, BUILTIN_INSPECTOR_TAB_IDS as _, type ActionContext as a, type SqliteBackend as a$, BuiltinInspectorTabIdSchema as a0, CONN_DRIVER_SYMBOL as a1, CONN_STATE_MANAGER_SYMBOL as a2, type Client as a3, type Conn as a4, type CronFire as a5, type CronJobInfo as a6, CustomInspectorTabEntrySchema as a7, DEFAULT_SLEEP_GRACE_PERIOD as a8, type DefineRunHandlerOptions as a9, type QueueResultMessageForName as aA, type QueueTryNextBatchOptions as aB, type QueueTryNextOptions as aC, type QueueWaitOptions as aD, RAW_STATE_SYMBOL as aE, Registry as aF, type RegistryActors as aG, type RegistryApplication as aH, type RegistryConfig as aI, type RegistryConfigInput as aJ, RegistryConfigSchema as aK, type RegistryDeps as aL, type RegistryListenOptions as aM, type RegistryRoutes as aN, type RunConfig as aO, RunConfigSchema as aP, type RunControl as aQ, type RunInspectorConfig as aR, type RunInspectorFactoryContext as aS, type RunInspectorFactoryResult as aT, type RunInspectorKind as aU, type RunWithInactiveOptions as aV, type RuntimeKind as aW, RuntimeKindSchema as aX, type ScheduledEventInfo as aY, type ScheduledFireInfo as aZ, type ServerlessHandler as a_, DocActorConfigSchema as aa, DocActorOptionsSchema as ab, DocConfigurePoolSchema as ac, DocEnvoyConfigSchema as ad, DocRegistryConfigSchema as ae, DocServerlessConfigSchema as af, DocSqliteConfigSchema as ag, type FetchHandler as ah, type GlobalActorOptions as ai, type GlobalActorOptionsInput as aj, GlobalActorOptionsSchema as ak, HideInspectorTabEntrySchema as al, type InferEventArgs as am, type InferSchemaMap as an, InspectorTabEntrySchema as ao, type InspectorUnsubscribe as ap, type InstanceActorOptions as aq, type InstanceActorOptionsInput as ar, InstanceActorOptionsSchema as as, type QueueEnqueueAndWaitOptions as at, type QueueFilterName as au, type QueueIterOptions as av, type QueueMessageOf as aw, type QueueName as ax, type QueueNextBatchOptions as ay, type QueueNextOptions as az, type BeforeActionResponseContext as b, SqliteBackendSchema as b0, type SqliteConfig as b1, SqliteConfigSchema as b2, type TestConfig as b3, TestConfigSchema as b4, type Type as b5, type WasmRuntimeBindings as b6, type WasmRuntimeConfig as b7, WasmRuntimeConfigSchema as b8, type WasmRuntimeInitInput as b9, ClientRaw as bA, type ConnectionStateCallback as bB, type CreateOptions as bC, type CreateRequest as bD, type EventUnsubscribe as bE, type ExtractActorsFromRegistry as bF, type ExtractRegistryFromClient as bG, type GetOptions as bH, type GetWithIdOptions as bI, type QueryOptions as bJ, type Region as bK, type StatusChangeCallback as bL, type WorkflowInspectorConfig as ba, actor as bb, buildActorNames as bc, createClientWithDriver as bd, defineRunHandler as be, disposeRunInspector as bf, event as bg, getRunFunction as bh, getRunInspectorConfig as bi, getRunMetadata as bj, isStaticActorDefinition as bk, isStaticActorInstance as bl, lookupInRegistry as bm, queue as bn, setup as bo, test as bp, type ActorAccessor as bq, type ActorActionFunction as br, type ActorActionOptions as bs, type ActorConn as bt, ActorConnRaw as bu, type ActorConnStatus as bv, type ActorConnectOptions as bw, type ActorGatewayOptions as bx, type ActorHandle as by, ActorHandleRaw as bz, type BeforeConnectContext as c, type CreateConnStateContext as d, type CreateContext as e, type CreateVarsContext as f, type DisconnectContext as g, type RunContext as h, type StateChangeContext as i, type WebSocketContext as j, ACTOR_CONTEXT_INTERNAL_SYMBOL as k, type ActionInputSchemas as l, type Actions as m, type ActorConfig as n, type ActorConfigInput as o, ActorConfigSchema as p, type ActorContext as q, type ActorContextOf as r, type ActorCron as s, type ActorCronEveryOptions as t, type ActorCronSetOptions as u, ActorDefinition as v, type ActorInspectorConfig as w, ActorInspectorConfigSchema as x, type ActorKey as y, type ActorKv as z };
|
|
@@ -4,7 +4,7 @@ interface ActorMetricsLike {
|
|
|
4
4
|
totalKvWrites: number;
|
|
5
5
|
trackSql(query: string, durationMs: number): void;
|
|
6
6
|
}
|
|
7
|
-
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> :
|
|
7
|
+
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> : RawAccess;
|
|
8
8
|
type SqliteBindings = unknown[] | Record<string, unknown>;
|
|
9
9
|
interface SqliteQueryResult {
|
|
10
10
|
columns: string[];
|
|
@@ -18,6 +18,41 @@ interface SqliteBatchStatement {
|
|
|
18
18
|
sql: string;
|
|
19
19
|
params?: SqliteBindings;
|
|
20
20
|
}
|
|
21
|
+
interface SqliteTransactionOptions {
|
|
22
|
+
/** Static operation name used to aggregate transaction performance. */
|
|
23
|
+
name?: string;
|
|
24
|
+
/** Deadlock-safety timeout in milliseconds. */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
/** @experimental */
|
|
27
|
+
experimental?: {
|
|
28
|
+
/**
|
|
29
|
+
* Atomically includes actor and hibernatable connection state.
|
|
30
|
+
* Only single-statement `execute` calls are supported in the transaction.
|
|
31
|
+
* Concurrent actions that try to mutate state while the transaction is
|
|
32
|
+
* active fail with `actor.state_transaction_conflict`.
|
|
33
|
+
*/
|
|
34
|
+
includeState?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* SQLite profiling configuration.
|
|
39
|
+
*
|
|
40
|
+
* @experimental This entire configuration surface is experimental and subject
|
|
41
|
+
* to change without notice.
|
|
42
|
+
*/
|
|
43
|
+
interface SqliteProfilingOptions {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
maxTrackedStatementFingerprints?: number;
|
|
46
|
+
maxTrackedTransactionFingerprints?: number;
|
|
47
|
+
maxPrometheusSeries?: number;
|
|
48
|
+
maxStatementsPerTransactionTrace?: number;
|
|
49
|
+
maxGetPagesRequestsPerTrace?: number;
|
|
50
|
+
maxTransactionNameBytes?: number;
|
|
51
|
+
slowOperationThresholdMs?: number;
|
|
52
|
+
baselineSampleRate?: number;
|
|
53
|
+
maxDiagnosticEventsPerMinute?: number;
|
|
54
|
+
diagnosticEventQueueCapacity?: number;
|
|
55
|
+
}
|
|
21
56
|
interface SqliteNativeMetrics {
|
|
22
57
|
requestBuildNs: number;
|
|
23
58
|
serializeNs: number;
|
|
@@ -35,7 +70,7 @@ interface SqliteDatabase {
|
|
|
35
70
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
36
71
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
37
72
|
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
38
|
-
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
73
|
+
beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
|
|
39
74
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
40
75
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
41
76
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
@@ -90,6 +125,13 @@ interface DatabaseProviderContext {
|
|
|
90
125
|
nativeDatabaseProvider?: NativeDatabaseProvider;
|
|
91
126
|
}
|
|
92
127
|
type DatabaseProvider<DB extends RawAccess> = {
|
|
128
|
+
/**
|
|
129
|
+
* Local SQLite profiling controls consumed by the actor runtime.
|
|
130
|
+
*
|
|
131
|
+
* @experimental This entire configuration surface is experimental and
|
|
132
|
+
* subject to change without notice.
|
|
133
|
+
*/
|
|
134
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
93
135
|
/**
|
|
94
136
|
* Creates a new database client for the actor.
|
|
95
137
|
* The result is passed to the actor context as `c.db`.
|
|
@@ -120,9 +162,7 @@ type RawAccess = {
|
|
|
120
162
|
*/
|
|
121
163
|
execute: ExecuteFunction;
|
|
122
164
|
/** Runs a callback in an isolated SQLite transaction. */
|
|
123
|
-
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?:
|
|
124
|
-
timeout?: number;
|
|
125
|
-
}) => Promise<T>;
|
|
165
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: SqliteTransactionOptions) => Promise<T>;
|
|
126
166
|
/**
|
|
127
167
|
* Returns native SQLite metrics when the active runtime supports them.
|
|
128
168
|
*/
|
|
@@ -133,4 +173,4 @@ type RawAccess = {
|
|
|
133
173
|
close: () => Promise<void>;
|
|
134
174
|
};
|
|
135
175
|
|
|
136
|
-
export type { AnyDatabaseProvider as A, DatabaseProvider as D, InferDatabaseClient as I, NativeDatabaseProvider as N, RawAccess as R,
|
|
176
|
+
export type { AnyDatabaseProvider as A, DatabaseProvider as D, InferDatabaseClient as I, NativeDatabaseProvider as N, RawAccess as R, SqliteTransactionOptions as S, SqliteProfilingOptions as a, DatabaseProviderContext as b, RawDatabaseClient as c, SqliteBindings as d, SqliteDatabase as e, SqliteNativeMetrics as f, SqliteQueryResult as g };
|
|
@@ -4,7 +4,7 @@ interface ActorMetricsLike {
|
|
|
4
4
|
totalKvWrites: number;
|
|
5
5
|
trackSql(query: string, durationMs: number): void;
|
|
6
6
|
}
|
|
7
|
-
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> :
|
|
7
|
+
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> : RawAccess;
|
|
8
8
|
type SqliteBindings = unknown[] | Record<string, unknown>;
|
|
9
9
|
interface SqliteQueryResult {
|
|
10
10
|
columns: string[];
|
|
@@ -18,6 +18,41 @@ interface SqliteBatchStatement {
|
|
|
18
18
|
sql: string;
|
|
19
19
|
params?: SqliteBindings;
|
|
20
20
|
}
|
|
21
|
+
interface SqliteTransactionOptions {
|
|
22
|
+
/** Static operation name used to aggregate transaction performance. */
|
|
23
|
+
name?: string;
|
|
24
|
+
/** Deadlock-safety timeout in milliseconds. */
|
|
25
|
+
timeout?: number;
|
|
26
|
+
/** @experimental */
|
|
27
|
+
experimental?: {
|
|
28
|
+
/**
|
|
29
|
+
* Atomically includes actor and hibernatable connection state.
|
|
30
|
+
* Only single-statement `execute` calls are supported in the transaction.
|
|
31
|
+
* Concurrent actions that try to mutate state while the transaction is
|
|
32
|
+
* active fail with `actor.state_transaction_conflict`.
|
|
33
|
+
*/
|
|
34
|
+
includeState?: boolean;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* SQLite profiling configuration.
|
|
39
|
+
*
|
|
40
|
+
* @experimental This entire configuration surface is experimental and subject
|
|
41
|
+
* to change without notice.
|
|
42
|
+
*/
|
|
43
|
+
interface SqliteProfilingOptions {
|
|
44
|
+
enabled?: boolean;
|
|
45
|
+
maxTrackedStatementFingerprints?: number;
|
|
46
|
+
maxTrackedTransactionFingerprints?: number;
|
|
47
|
+
maxPrometheusSeries?: number;
|
|
48
|
+
maxStatementsPerTransactionTrace?: number;
|
|
49
|
+
maxGetPagesRequestsPerTrace?: number;
|
|
50
|
+
maxTransactionNameBytes?: number;
|
|
51
|
+
slowOperationThresholdMs?: number;
|
|
52
|
+
baselineSampleRate?: number;
|
|
53
|
+
maxDiagnosticEventsPerMinute?: number;
|
|
54
|
+
diagnosticEventQueueCapacity?: number;
|
|
55
|
+
}
|
|
21
56
|
interface SqliteNativeMetrics {
|
|
22
57
|
requestBuildNs: number;
|
|
23
58
|
serializeNs: number;
|
|
@@ -35,7 +70,7 @@ interface SqliteDatabase {
|
|
|
35
70
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
36
71
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
37
72
|
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
38
|
-
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
73
|
+
beginTransaction(timeoutMs?: number, name?: string): Promise<SqliteTransactionDatabase>;
|
|
39
74
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
40
75
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
41
76
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
@@ -90,6 +125,13 @@ interface DatabaseProviderContext {
|
|
|
90
125
|
nativeDatabaseProvider?: NativeDatabaseProvider;
|
|
91
126
|
}
|
|
92
127
|
type DatabaseProvider<DB extends RawAccess> = {
|
|
128
|
+
/**
|
|
129
|
+
* Local SQLite profiling controls consumed by the actor runtime.
|
|
130
|
+
*
|
|
131
|
+
* @experimental This entire configuration surface is experimental and
|
|
132
|
+
* subject to change without notice.
|
|
133
|
+
*/
|
|
134
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
93
135
|
/**
|
|
94
136
|
* Creates a new database client for the actor.
|
|
95
137
|
* The result is passed to the actor context as `c.db`.
|
|
@@ -120,9 +162,7 @@ type RawAccess = {
|
|
|
120
162
|
*/
|
|
121
163
|
execute: ExecuteFunction;
|
|
122
164
|
/** Runs a callback in an isolated SQLite transaction. */
|
|
123
|
-
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?:
|
|
124
|
-
timeout?: number;
|
|
125
|
-
}) => Promise<T>;
|
|
165
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: SqliteTransactionOptions) => Promise<T>;
|
|
126
166
|
/**
|
|
127
167
|
* Returns native SQLite metrics when the active runtime supports them.
|
|
128
168
|
*/
|
|
@@ -133,4 +173,4 @@ type RawAccess = {
|
|
|
133
173
|
close: () => Promise<void>;
|
|
134
174
|
};
|
|
135
175
|
|
|
136
|
-
export type { AnyDatabaseProvider as A, DatabaseProvider as D, InferDatabaseClient as I, NativeDatabaseProvider as N, RawAccess as R,
|
|
176
|
+
export type { AnyDatabaseProvider as A, DatabaseProvider as D, InferDatabaseClient as I, NativeDatabaseProvider as N, RawAccess as R, SqliteTransactionOptions as S, SqliteProfilingOptions as a, DatabaseProviderContext as b, RawDatabaseClient as c, SqliteBindings as d, SqliteDatabase as e, SqliteNativeMetrics as f, SqliteQueryResult as g };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger,
|
|
1
|
+
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger, au as QueueFilterName, az as QueueNextOptions, aA as QueueResultMessageForName, ay as QueueNextBatchOptions, aF as Registry, a3 as Client, am as InferEventArgs, an as InferSchemaMap } from './config-DTGoWdkG.cjs';
|
|
2
2
|
import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine';
|
|
3
|
-
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-
|
|
3
|
+
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-ey2I2zz5.cjs';
|
|
4
4
|
|
|
5
5
|
type WorkflowActorQueueNextOptions<TName extends string, TCompletable extends boolean> = Omit<QueueNextOptions<TName, TCompletable>, "signal">;
|
|
6
6
|
type WorkflowActorQueueNextOptionsFallback<TCompletable extends boolean> = Omit<QueueNextOptions<string, TCompletable>, "signal">;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger,
|
|
1
|
+
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger, au as QueueFilterName, az as QueueNextOptions, aA as QueueResultMessageForName, ay as QueueNextBatchOptions, aF as Registry, a3 as Client, am as InferEventArgs, an as InferSchemaMap } from './config-C4OSv0QP.js';
|
|
2
2
|
import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine';
|
|
3
|
-
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-
|
|
3
|
+
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-ey2I2zz5.js';
|
|
4
4
|
|
|
5
5
|
type WorkflowActorQueueNextOptions<TName extends string, TCompletable extends boolean> = Omit<QueueNextOptions<TName, TCompletable>, "signal">;
|
|
6
6
|
type WorkflowActorQueueNextOptionsFallback<TCompletable extends boolean> = Omit<QueueNextOptions<string, TCompletable>, "signal">;
|
package/dist/tsup/db/drizzle.cjs
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunkUEULFXUIcjs = require('../chunk-UEULFXUI.cjs');
|
|
7
6
|
|
|
7
|
+
var _chunkKVFIONKQcjs = require('../chunk-KVFIONKQ.cjs');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunkGU7ML3KEcjs = require('../chunk-GU7ML3KE.cjs');
|
|
10
11
|
require('../chunk-4FC7TVS6.cjs');
|
|
11
12
|
|
|
12
13
|
// src/db/drizzle.ts
|
|
@@ -54,9 +55,11 @@ function db({
|
|
|
54
55
|
schema,
|
|
55
56
|
migrations,
|
|
56
57
|
onMigrate,
|
|
57
|
-
warnOnManualTransactions = true
|
|
58
|
+
warnOnManualTransactions = true,
|
|
59
|
+
profiling
|
|
58
60
|
} = {}) {
|
|
59
61
|
return {
|
|
62
|
+
sqliteProfiling: profiling,
|
|
60
63
|
createClient: async (ctx) => {
|
|
61
64
|
const override = ctx.overrideDrizzleDatabaseClient ? await ctx.overrideDrizzleDatabaseClient() : void 0;
|
|
62
65
|
if (override) {
|
|
@@ -89,7 +92,7 @@ function db({
|
|
|
89
92
|
try {
|
|
90
93
|
const { rows } = await target.execute(
|
|
91
94
|
query,
|
|
92
|
-
|
|
95
|
+
_chunkKVFIONKQcjs.toSqliteBindings.call(void 0, params)
|
|
93
96
|
);
|
|
94
97
|
if (method === "run") {
|
|
95
98
|
return { rows: [] };
|
|
@@ -129,9 +132,11 @@ function db({
|
|
|
129
132
|
);
|
|
130
133
|
};
|
|
131
134
|
drizzleDb.transaction = async (transactionCallback, options) => {
|
|
132
|
-
|
|
135
|
+
_chunkKVFIONKQcjs.validateTransactionTimeout.call(void 0, options == null ? void 0 : options.timeout);
|
|
136
|
+
_chunkKVFIONKQcjs.validateTransactionName.call(void 0, options == null ? void 0 : options.name);
|
|
133
137
|
const transaction = await nativeDb.beginTransaction(
|
|
134
|
-
options == null ? void 0 : options.timeout
|
|
138
|
+
options == null ? void 0 : options.timeout,
|
|
139
|
+
options == null ? void 0 : options.name
|
|
135
140
|
);
|
|
136
141
|
const tx = createDrizzleClient(transaction, true);
|
|
137
142
|
try {
|
|
@@ -155,11 +160,11 @@ function db({
|
|
|
155
160
|
return drizzleDb;
|
|
156
161
|
};
|
|
157
162
|
const warnForManualTransaction = (query, transactionScoped) => {
|
|
158
|
-
if (transactionScoped || !warnOnManualTransactions || manualTransactionWarned || hasMultipleStatements(query) || !
|
|
163
|
+
if (transactionScoped || !warnOnManualTransactions || manualTransactionWarned || hasMultipleStatements(query) || !_chunkKVFIONKQcjs.isManualTransactionControl.call(void 0, query)) {
|
|
159
164
|
return;
|
|
160
165
|
}
|
|
161
166
|
manualTransactionWarned = true;
|
|
162
|
-
|
|
167
|
+
_chunkGU7ML3KEcjs.getLogger.call(void 0, "database").warn(
|
|
163
168
|
{ actorId: ctx.actorId },
|
|
164
169
|
"Manual cross-call SQLite transactions can interleave with other actor work. Use db.transaction() for coordinated transactions. Set warnOnManualTransactions: false in your db(...) configuration to disable this warning."
|
|
165
170
|
);
|
|
@@ -202,7 +207,10 @@ async function withMigrationSavepoint(client, callback) {
|
|
|
202
207
|
throw error;
|
|
203
208
|
}
|
|
204
209
|
},
|
|
205
|
-
{
|
|
210
|
+
{
|
|
211
|
+
name: "rivetkit-drizzle-migration",
|
|
212
|
+
timeout: _chunkKVFIONKQcjs.MIGRATION_TRANSACTION_TIMEOUT_MS
|
|
213
|
+
}
|
|
206
214
|
);
|
|
207
215
|
}
|
|
208
216
|
async function runMigrations(db2, migrations) {
|
|
@@ -269,7 +277,7 @@ async function executeRaw(db2, ctx, ensureOpen, query, args, warnForManualTransa
|
|
|
269
277
|
if (args.length > 0) {
|
|
270
278
|
const { rows, columns } = await db2.execute(
|
|
271
279
|
query,
|
|
272
|
-
|
|
280
|
+
_chunkKVFIONKQcjs.toSqliteBindings.call(void 0, args)
|
|
273
281
|
);
|
|
274
282
|
return rows.map((row) => rowToObject(row, columns));
|
|
275
283
|
}
|