rivetkit 2.3.4 → 2.3.5-rc.1
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 +157 -9
- package/dist/browser/client.js +518 -542
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +101 -2
- package/dist/browser/inspector/client.js +1245 -227
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/agent-os/index.cjs +103 -36
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +159 -11
- package/dist/tsup/agent-os/index.d.ts +159 -11
- package/dist/tsup/agent-os/index.js +103 -36
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-7X4M7ZRA.cjs → chunk-4XKED5P5.cjs} +146 -177
- package/dist/tsup/chunk-4XKED5P5.cjs.map +1 -0
- package/dist/tsup/{chunk-Q7NBMTF3.cjs → chunk-6HQCLWAW.cjs} +384 -4
- package/dist/tsup/chunk-6HQCLWAW.cjs.map +1 -0
- package/dist/tsup/{chunk-JZ7TWV65.js → chunk-7AFZMFPQ.js} +15 -1
- package/dist/tsup/chunk-7AFZMFPQ.js.map +1 -0
- package/dist/tsup/{chunk-M7DCRMOZ.js → chunk-B4IZU537.js} +382 -2
- package/dist/tsup/chunk-B4IZU537.js.map +1 -0
- package/dist/tsup/{chunk-3MHDOUD7.cjs → chunk-G3CCRCTK.cjs} +14 -9
- package/dist/tsup/chunk-G3CCRCTK.cjs.map +1 -0
- package/dist/tsup/{chunk-CMPFZ724.js → chunk-GAV4PKFT.js} +16 -47
- package/dist/tsup/{chunk-CMPFZ724.js.map → chunk-GAV4PKFT.js.map} +1 -1
- package/dist/tsup/{chunk-HXUEHHJF.js → chunk-JI6GZ2C2.js} +2 -11
- package/dist/tsup/{chunk-HXUEHHJF.js.map → chunk-JI6GZ2C2.js.map} +1 -1
- package/dist/tsup/{chunk-3SNFA373.cjs → chunk-M3FCXL3Q.cjs} +3 -3
- package/dist/tsup/{chunk-3SNFA373.cjs.map → chunk-M3FCXL3Q.cjs.map} +1 -1
- package/dist/tsup/{chunk-GXW3VFJQ.js → chunk-MGTSVSUC.js} +2 -2
- package/dist/tsup/{chunk-VE2X4KMG.cjs → chunk-MYWZCDML.cjs} +2 -11
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
- package/dist/tsup/{chunk-M5TAM4JV.js → chunk-NIC3QLKL.js} +3 -3
- package/dist/tsup/{chunk-H4XOUVGP.js → chunk-P4OGQ4JL.js} +5 -7
- package/dist/tsup/{chunk-H4XOUVGP.js.map → chunk-P4OGQ4JL.js.map} +1 -1
- package/dist/tsup/{chunk-EOSGY3DC.js → chunk-PAG6G46L.js} +2 -2
- package/dist/tsup/{chunk-XIX5DOZN.js → chunk-SHBE77IT.js} +14 -9
- package/dist/tsup/chunk-SHBE77IT.js.map +1 -0
- package/dist/tsup/{chunk-SRT2DPN3.cjs → chunk-TNIWIUNV.cjs} +9 -11
- package/dist/tsup/chunk-TNIWIUNV.cjs.map +1 -0
- package/dist/tsup/{chunk-UPOCJPEQ.cjs → chunk-TR5NLR5V.cjs} +4 -4
- package/dist/tsup/{chunk-UPOCJPEQ.cjs.map → chunk-TR5NLR5V.cjs.map} +1 -1
- package/dist/tsup/{chunk-ZA7FLHKH.cjs → chunk-UEULFXUI.cjs} +16 -2
- package/dist/tsup/chunk-UEULFXUI.cjs.map +1 -0
- package/dist/tsup/{chunk-T4MURX4P.cjs → chunk-UJ2FQY63.cjs} +7 -7
- package/dist/tsup/{chunk-T4MURX4P.cjs.map → chunk-UJ2FQY63.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +7 -8
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +5 -4
- package/dist/tsup/client/mod.d.ts +5 -4
- package/dist/tsup/client/mod.js +6 -7
- 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-D49x8NpL.d.cts → config-BxOimoGX.d.cts} +16 -0
- package/dist/tsup/{config-D49x8NpL.d.ts → config-BxOimoGX.d.ts} +16 -0
- package/dist/tsup/{config-ZkIsRFsN.d.ts → config-BzdqbLAP.d.ts} +164 -27
- package/dist/tsup/{config-BfBhjEbk.d.cts → config-CPPEwn_e.d.cts} +164 -27
- package/dist/tsup/{context-sZ9GlaBK.d.cts → context-DSA9gFXB.d.cts} +2 -2
- package/dist/tsup/{context-B7-84u9K.d.ts → context-wWv-K2K_.d.ts} +2 -2
- package/dist/tsup/db/drizzle.cjs +120 -68
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -3
- package/dist/tsup/db/drizzle.d.ts +8 -3
- package/dist/tsup/db/drizzle.js +120 -68
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +74 -22
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +4 -3
- package/dist/tsup/db/mod.d.ts +4 -3
- package/dist/tsup/db/mod.js +74 -22
- 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 -3
- package/dist/tsup/dynamic/mod.d.ts +3 -3
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +4 -5
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.js +3 -4
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
- package/dist/tsup/inspector-tab/mod.d.cts +5 -5
- package/dist/tsup/inspector-tab/mod.d.ts +5 -5
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/inspector-tab/mod.js.map +1 -1
- package/dist/tsup/mod.cjs +605 -158
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +528 -81
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -11
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +3 -3
- package/dist/tsup/test/mod.d.ts +3 -3
- package/dist/tsup/test/mod.js +6 -7
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils-CV0akuDD.d.ts +162 -0
- package/dist/tsup/utils-DQDCphrl.d.cts +162 -0
- package/dist/tsup/utils.cjs +6 -2
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +3 -146
- package/dist/tsup/utils.d.ts +3 -146
- package/dist/tsup/utils.js +5 -1
- package/dist/tsup/workflow/mod.cjs +198 -151
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +5 -5
- package/dist/tsup/workflow/mod.d.ts +5 -5
- package/dist/tsup/workflow/mod.js +187 -140
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +8 -8
- package/src/actor/config.test.ts +14 -0
- package/src/actor/config.ts +104 -16
- package/src/actor/definition.ts +18 -7
- package/src/agent-os/actor/index.ts +2 -2
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/database/config.ts +24 -0
- package/src/common/database/mod.test.ts +148 -59
- package/src/common/database/mod.ts +93 -23
- package/src/common/database/native-database.test.ts +9 -0
- package/src/common/database/native-database.ts +151 -0
- package/src/common/database/shared.ts +15 -0
- package/src/common/encoding.ts +28 -21
- package/src/db/drizzle.test.ts +157 -0
- package/src/db/drizzle.ts +170 -79
- package/src/dynamic/isolate-runtime.ts +0 -2
- package/src/engine-client/driver.ts +0 -15
- package/src/engine-client/mod.ts +0 -41
- package/src/inspector/client.browser.ts +69 -8
- package/src/inspector-tab/mod.ts +1 -0
- package/src/registry/config/index.ts +1 -35
- package/src/registry/napi-runtime.ts +204 -16
- package/src/registry/native.ts +200 -30
- package/src/registry/runtime.ts +146 -3
- package/src/registry/wasm-runtime.ts +217 -6
- package/src/utils.ts +3 -0
- package/src/workflow/context.ts +5 -27
- package/src/workflow/driver.test.ts +62 -0
- package/src/workflow/driver.ts +231 -113
- package/src/workflow/mod.ts +3 -3
- package/dist/tsup/chunk-3MHDOUD7.cjs.map +0 -1
- package/dist/tsup/chunk-7X4M7ZRA.cjs.map +0 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +0 -1
- package/dist/tsup/chunk-M7DCRMOZ.js.map +0 -1
- package/dist/tsup/chunk-Q7NBMTF3.cjs.map +0 -1
- package/dist/tsup/chunk-SRT2DPN3.cjs.map +0 -1
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +0 -1
- package/dist/tsup/chunk-W6WPKZ6I.js +0 -382
- package/dist/tsup/chunk-W6WPKZ6I.js.map +0 -1
- package/dist/tsup/chunk-XIX5DOZN.js.map +0 -1
- package/dist/tsup/chunk-Z7PSQWMC.cjs +0 -382
- package/dist/tsup/chunk-Z7PSQWMC.cjs.map +0 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +0 -1
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2484
- package/src/drivers/engine/actor-driver.ts +0 -2473
- /package/dist/tsup/{chunk-GXW3VFJQ.js.map → chunk-MGTSVSUC.js.map} +0 -0
- /package/dist/tsup/{chunk-M5TAM4JV.js.map → chunk-NIC3QLKL.js.map} +0 -0
- /package/dist/tsup/{chunk-EOSGY3DC.js.map → chunk-PAG6G46L.js.map} +0 -0
|
@@ -25,6 +25,10 @@ interface SqliteExecuteResult extends SqliteQueryResult {
|
|
|
25
25
|
changes: number;
|
|
26
26
|
lastInsertRowId?: number | null;
|
|
27
27
|
}
|
|
28
|
+
interface SqliteBatchStatement {
|
|
29
|
+
sql: string;
|
|
30
|
+
params?: SqliteBindings;
|
|
31
|
+
}
|
|
28
32
|
interface SqliteNativeMetrics {
|
|
29
33
|
requestBuildNs: number;
|
|
30
34
|
serializeNs: number;
|
|
@@ -41,11 +45,19 @@ interface SqliteNativeMetrics {
|
|
|
41
45
|
interface SqliteDatabase {
|
|
42
46
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
43
47
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
48
|
+
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
49
|
+
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
44
50
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
45
51
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
46
52
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
47
53
|
close(): Promise<void>;
|
|
48
54
|
}
|
|
55
|
+
interface SqliteTransactionDatabase {
|
|
56
|
+
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
57
|
+
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
58
|
+
commit(): Promise<void>;
|
|
59
|
+
rollback(): Promise<void>;
|
|
60
|
+
}
|
|
49
61
|
/**
|
|
50
62
|
* Provider for opening native databases from the active runtime.
|
|
51
63
|
*/
|
|
@@ -112,6 +124,10 @@ type RawAccess = {
|
|
|
112
124
|
* Executes a raw SQL query.
|
|
113
125
|
*/
|
|
114
126
|
execute: ExecuteFunction;
|
|
127
|
+
/** Runs a callback in an isolated SQLite transaction. */
|
|
128
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: {
|
|
129
|
+
timeout?: number;
|
|
130
|
+
}) => Promise<T>;
|
|
115
131
|
/**
|
|
116
132
|
* Returns native SQLite metrics when the active runtime supports them.
|
|
117
133
|
*/
|
|
@@ -507,11 +523,6 @@ interface EngineControlClient {
|
|
|
507
523
|
* Test-only helper that simulates an abrupt actor crash.
|
|
508
524
|
*/
|
|
509
525
|
hardCrashActor?(actorId: string): Promise<void>;
|
|
510
|
-
kvGet(actorId: string, key: Uint8Array): Promise<string | null>;
|
|
511
|
-
kvBatchGet(actorId: string, keys: Uint8Array[]): Promise<(Uint8Array | null)[]>;
|
|
512
|
-
kvBatchPut(actorId: string, entries: [Uint8Array, Uint8Array][]): Promise<void>;
|
|
513
|
-
kvBatchDelete(actorId: string, keys: Uint8Array[]): Promise<void>;
|
|
514
|
-
kvDeleteRange(actorId: string, start: Uint8Array, end: Uint8Array): Promise<void>;
|
|
515
526
|
}
|
|
516
527
|
interface RuntimeDisplayInformation {
|
|
517
528
|
properties: Record<string, string>;
|
|
@@ -570,6 +581,7 @@ type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
|
570
581
|
type ConnHandle = OpaqueHandle<"conn">;
|
|
571
582
|
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
572
583
|
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
584
|
+
type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
573
585
|
type RuntimeBytes = Uint8Array;
|
|
574
586
|
interface RuntimeActorKeySegment {
|
|
575
587
|
kind: string;
|
|
@@ -590,6 +602,10 @@ interface RuntimeStateDeltaPayload {
|
|
|
590
602
|
}>;
|
|
591
603
|
connHibernationRemoved: string[];
|
|
592
604
|
}
|
|
605
|
+
interface RuntimeWorkflowKvWrite {
|
|
606
|
+
key: RuntimeBytes;
|
|
607
|
+
value: RuntimeBytes;
|
|
608
|
+
}
|
|
593
609
|
interface RuntimeRequestSaveOpts {
|
|
594
610
|
immediate?: boolean;
|
|
595
611
|
maxWaitMs?: number;
|
|
@@ -615,6 +631,38 @@ interface RuntimeQueueInspectMessage {
|
|
|
615
631
|
name: string;
|
|
616
632
|
createdAtMs: number;
|
|
617
633
|
}
|
|
634
|
+
interface RuntimeScheduledEventInfo {
|
|
635
|
+
id: string;
|
|
636
|
+
action: string;
|
|
637
|
+
args: RuntimeBytes;
|
|
638
|
+
runAt: number;
|
|
639
|
+
}
|
|
640
|
+
interface RuntimeCronJobInfo {
|
|
641
|
+
name: string;
|
|
642
|
+
kind: "cron" | "every";
|
|
643
|
+
action: string;
|
|
644
|
+
args: RuntimeBytes;
|
|
645
|
+
nextRunAt: number;
|
|
646
|
+
lastRunAt?: number;
|
|
647
|
+
expression?: string;
|
|
648
|
+
timezone?: string;
|
|
649
|
+
intervalMs?: number;
|
|
650
|
+
maxHistory: number;
|
|
651
|
+
}
|
|
652
|
+
interface RuntimeScheduleErrorInfo {
|
|
653
|
+
group: string;
|
|
654
|
+
code: string;
|
|
655
|
+
message: string;
|
|
656
|
+
metadata?: unknown;
|
|
657
|
+
}
|
|
658
|
+
interface RuntimeCronFire {
|
|
659
|
+
action: string;
|
|
660
|
+
scheduledAt: number;
|
|
661
|
+
firedAt: number;
|
|
662
|
+
finishedAt?: number;
|
|
663
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
664
|
+
error?: RuntimeScheduleErrorInfo;
|
|
665
|
+
}
|
|
618
666
|
interface RuntimeQueueNextBatchOptions {
|
|
619
667
|
names?: string[];
|
|
620
668
|
count?: number;
|
|
@@ -675,6 +723,9 @@ type RuntimeSqlBindParam = ({
|
|
|
675
723
|
blobValue: RuntimeBytes;
|
|
676
724
|
};
|
|
677
725
|
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
726
|
+
interface RuntimeActorRuntimeSocketEndpointInfo {
|
|
727
|
+
path: string;
|
|
728
|
+
}
|
|
678
729
|
interface RuntimeSqlQueryResult {
|
|
679
730
|
columns: string[];
|
|
680
731
|
rows: unknown[][];
|
|
@@ -684,6 +735,10 @@ interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
|
684
735
|
changes: number;
|
|
685
736
|
lastInsertRowId?: number | null;
|
|
686
737
|
}
|
|
738
|
+
interface RuntimeSqlBatchStatement {
|
|
739
|
+
sql: string;
|
|
740
|
+
params?: RuntimeSqlBindParams;
|
|
741
|
+
}
|
|
687
742
|
interface RuntimeSqlRunResult {
|
|
688
743
|
changes: number;
|
|
689
744
|
}
|
|
@@ -692,6 +747,7 @@ interface RuntimeActorConfig {
|
|
|
692
747
|
icon?: string;
|
|
693
748
|
hasDatabase?: boolean;
|
|
694
749
|
remoteSqlite?: boolean;
|
|
750
|
+
enableActorRuntimeSocket?: boolean;
|
|
695
751
|
hasState?: boolean;
|
|
696
752
|
canHibernateWebsocket?: boolean;
|
|
697
753
|
stateSaveIntervalMs?: number;
|
|
@@ -712,6 +768,7 @@ interface RuntimeActorConfig {
|
|
|
712
768
|
connectionLivenessTimeoutMs?: number;
|
|
713
769
|
connectionLivenessIntervalMs?: number;
|
|
714
770
|
maxQueueSize?: number;
|
|
771
|
+
maxSchedules?: number;
|
|
715
772
|
maxQueueMessageSize?: number;
|
|
716
773
|
maxIncomingMessageSize?: number;
|
|
717
774
|
maxOutgoingMessageSize?: number;
|
|
@@ -829,6 +886,7 @@ interface CoreRuntime {
|
|
|
829
886
|
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
830
887
|
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
831
888
|
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
889
|
+
actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
|
|
832
890
|
actorId(ctx: ActorContextHandle): string;
|
|
833
891
|
actorName(ctx: ActorContextHandle): string;
|
|
834
892
|
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
@@ -862,11 +920,18 @@ interface CoreRuntime {
|
|
|
862
920
|
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
863
921
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
864
922
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
923
|
+
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
924
|
+
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<SqliteTransactionHandle>;
|
|
925
|
+
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
926
|
+
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
927
|
+
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
928
|
+
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
865
929
|
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
866
930
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
867
931
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
868
932
|
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
869
933
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
934
|
+
actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
|
|
870
935
|
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
871
936
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
872
937
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
@@ -876,8 +941,17 @@ interface CoreRuntime {
|
|
|
876
941
|
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
877
942
|
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
878
943
|
actorQueueReset(ctx: ActorContextHandle): Promise<void>;
|
|
879
|
-
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes):
|
|
880
|
-
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes):
|
|
944
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
|
|
945
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
|
|
946
|
+
actorScheduleCancel(ctx: ActorContextHandle, id: string): Promise<boolean>;
|
|
947
|
+
actorScheduleGet(ctx: ActorContextHandle, id: string): Promise<RuntimeScheduledEventInfo | undefined>;
|
|
948
|
+
actorScheduleList(ctx: ActorContextHandle): Promise<RuntimeScheduledEventInfo[]>;
|
|
949
|
+
actorCronSet(ctx: ActorContextHandle, name: string, expression: string, timezone: string | undefined, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
|
|
950
|
+
actorCronEvery(ctx: ActorContextHandle, name: string, intervalMs: number, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
|
|
951
|
+
actorCronGet(ctx: ActorContextHandle, name: string): Promise<RuntimeCronJobInfo | undefined>;
|
|
952
|
+
actorCronList(ctx: ActorContextHandle): Promise<RuntimeCronJobInfo[]>;
|
|
953
|
+
actorCronDelete(ctx: ActorContextHandle, name: string): Promise<boolean>;
|
|
954
|
+
actorCronHistory(ctx: ActorContextHandle, name: string, limit: number | undefined): Promise<RuntimeCronFire[]>;
|
|
881
955
|
connId(conn: ConnHandle): string;
|
|
882
956
|
connParams(conn: ConnHandle): RuntimeBytes;
|
|
883
957
|
connState(conn: ConnHandle): RuntimeBytes;
|
|
@@ -1554,10 +1628,76 @@ interface ActorKv {
|
|
|
1554
1628
|
[key: string]: any;
|
|
1555
1629
|
}
|
|
1556
1630
|
interface ActorSchedule {
|
|
1557
|
-
after(duration: number, action: string, ...args: unknown[]): Promise<
|
|
1558
|
-
at(timestamp: number, action: string, ...args: unknown[]): Promise<
|
|
1631
|
+
after(duration: number, action: string, ...args: unknown[]): Promise<string>;
|
|
1632
|
+
at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
|
|
1633
|
+
cancel(id: string): Promise<boolean>;
|
|
1634
|
+
get(id: string): Promise<ScheduledEventInfo | undefined>;
|
|
1635
|
+
list(): Promise<ScheduledEventInfo[]>;
|
|
1636
|
+
[key: string]: any;
|
|
1637
|
+
}
|
|
1638
|
+
interface ActorCronSetOptions {
|
|
1639
|
+
name: string;
|
|
1640
|
+
expression: string;
|
|
1641
|
+
action: string;
|
|
1642
|
+
args?: unknown[];
|
|
1643
|
+
timezone?: string;
|
|
1644
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
1645
|
+
maxHistory?: number;
|
|
1646
|
+
}
|
|
1647
|
+
interface ActorCronEveryOptions {
|
|
1648
|
+
name: string;
|
|
1649
|
+
/** Fixed interval in milliseconds. Minimum 5,000. */
|
|
1650
|
+
interval: number;
|
|
1651
|
+
action: string;
|
|
1652
|
+
args?: unknown[];
|
|
1653
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
1654
|
+
maxHistory?: number;
|
|
1655
|
+
}
|
|
1656
|
+
interface ActorCron {
|
|
1657
|
+
set(options: ActorCronSetOptions): Promise<void>;
|
|
1658
|
+
every(options: ActorCronEveryOptions): Promise<void>;
|
|
1659
|
+
get(name: string): Promise<CronJobInfo | undefined>;
|
|
1660
|
+
list(): Promise<CronJobInfo[]>;
|
|
1661
|
+
delete(name: string): Promise<boolean>;
|
|
1662
|
+
history(name: string, options?: {
|
|
1663
|
+
limit?: number;
|
|
1664
|
+
}): Promise<CronFire[]>;
|
|
1559
1665
|
[key: string]: any;
|
|
1560
1666
|
}
|
|
1667
|
+
interface ScheduledEventInfo {
|
|
1668
|
+
id: string;
|
|
1669
|
+
action: string;
|
|
1670
|
+
args: unknown[];
|
|
1671
|
+
runAt: number;
|
|
1672
|
+
}
|
|
1673
|
+
type CronJobInfo = {
|
|
1674
|
+
name: string;
|
|
1675
|
+
action: string;
|
|
1676
|
+
args: unknown[];
|
|
1677
|
+
nextRunAt: number;
|
|
1678
|
+
lastRunAt?: number;
|
|
1679
|
+
maxHistory: number;
|
|
1680
|
+
} & ({
|
|
1681
|
+
kind: "cron";
|
|
1682
|
+
expression: string;
|
|
1683
|
+
timezone: string;
|
|
1684
|
+
} | {
|
|
1685
|
+
kind: "every";
|
|
1686
|
+
interval: number;
|
|
1687
|
+
});
|
|
1688
|
+
interface CronFire {
|
|
1689
|
+
action: string;
|
|
1690
|
+
scheduledAt: number;
|
|
1691
|
+
firedAt: number;
|
|
1692
|
+
finishedAt?: number;
|
|
1693
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
1694
|
+
error?: {
|
|
1695
|
+
group: string;
|
|
1696
|
+
code: string;
|
|
1697
|
+
message: string;
|
|
1698
|
+
metadata?: unknown;
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1561
1701
|
type QueueMessageOf<Name extends string, Body> = {
|
|
1562
1702
|
id: number | bigint;
|
|
1563
1703
|
name: Name;
|
|
@@ -1638,11 +1778,16 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1638
1778
|
readonly kv: ActorKv;
|
|
1639
1779
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1640
1780
|
readonly schedule: ActorSchedule;
|
|
1781
|
+
readonly cron: ActorCron;
|
|
1641
1782
|
readonly queue: ActorQueue<TQueues>;
|
|
1642
1783
|
readonly actorId: string;
|
|
1643
1784
|
readonly name: string;
|
|
1644
1785
|
readonly key: string[];
|
|
1645
1786
|
readonly region: string;
|
|
1787
|
+
/** Provisions the experimental Actor Runtime Socket for this actor generation. */
|
|
1788
|
+
actorRuntimeSocket(): Promise<{
|
|
1789
|
+
path: string;
|
|
1790
|
+
}>;
|
|
1646
1791
|
readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
|
|
1647
1792
|
readonly log: ActorLogger;
|
|
1648
1793
|
readonly abortSignal: AbortSignal;
|
|
@@ -1739,6 +1884,7 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1739
1884
|
options: z$1.ZodPrefault<z$1.ZodObject<{
|
|
1740
1885
|
name: z$1.ZodOptional<z$1.ZodString>;
|
|
1741
1886
|
icon: z$1.ZodOptional<z$1.ZodString>;
|
|
1887
|
+
enableActorRuntimeSocket: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
1742
1888
|
canHibernateWebSocket: z$1.ZodDefault<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
|
|
1743
1889
|
createVarsTimeout: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1744
1890
|
createConnStateTimeout: z$1.ZodDefault<z$1.ZodNumber>;
|
|
@@ -1755,6 +1901,7 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1755
1901
|
noSleep: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
1756
1902
|
sleepTimeout: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1757
1903
|
maxQueueSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1904
|
+
maxSchedules: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1758
1905
|
maxQueueMessageSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1759
1906
|
preloadMaxWorkflowBytes: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1760
1907
|
preloadMaxConnectionsBytes: z$1.ZodOptional<z$1.ZodNumber>;
|
|
@@ -1768,10 +1915,11 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1768
1915
|
hidden: z$1.ZodOptional<z$1.ZodLiteral<false>>;
|
|
1769
1916
|
}, z$1.core.$strict>, z$1.ZodObject<{
|
|
1770
1917
|
id: z$1.ZodEnum<{
|
|
1771
|
-
state: "state";
|
|
1772
|
-
queue: "queue";
|
|
1773
1918
|
workflow: "workflow";
|
|
1919
|
+
state: "state";
|
|
1774
1920
|
database: "database";
|
|
1921
|
+
queue: "queue";
|
|
1922
|
+
schedules: "schedules";
|
|
1775
1923
|
connections: "connections";
|
|
1776
1924
|
console: "console";
|
|
1777
1925
|
}>;
|
|
@@ -25,6 +25,10 @@ interface SqliteExecuteResult extends SqliteQueryResult {
|
|
|
25
25
|
changes: number;
|
|
26
26
|
lastInsertRowId?: number | null;
|
|
27
27
|
}
|
|
28
|
+
interface SqliteBatchStatement {
|
|
29
|
+
sql: string;
|
|
30
|
+
params?: SqliteBindings;
|
|
31
|
+
}
|
|
28
32
|
interface SqliteNativeMetrics {
|
|
29
33
|
requestBuildNs: number;
|
|
30
34
|
serializeNs: number;
|
|
@@ -41,11 +45,19 @@ interface SqliteNativeMetrics {
|
|
|
41
45
|
interface SqliteDatabase {
|
|
42
46
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
43
47
|
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
48
|
+
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
49
|
+
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
44
50
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
45
51
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
46
52
|
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
47
53
|
close(): Promise<void>;
|
|
48
54
|
}
|
|
55
|
+
interface SqliteTransactionDatabase {
|
|
56
|
+
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
57
|
+
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
58
|
+
commit(): Promise<void>;
|
|
59
|
+
rollback(): Promise<void>;
|
|
60
|
+
}
|
|
49
61
|
/**
|
|
50
62
|
* Provider for opening native databases from the active runtime.
|
|
51
63
|
*/
|
|
@@ -112,6 +124,10 @@ type RawAccess = {
|
|
|
112
124
|
* Executes a raw SQL query.
|
|
113
125
|
*/
|
|
114
126
|
execute: ExecuteFunction;
|
|
127
|
+
/** Runs a callback in an isolated SQLite transaction. */
|
|
128
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: {
|
|
129
|
+
timeout?: number;
|
|
130
|
+
}) => Promise<T>;
|
|
115
131
|
/**
|
|
116
132
|
* Returns native SQLite metrics when the active runtime supports them.
|
|
117
133
|
*/
|
|
@@ -507,11 +523,6 @@ interface EngineControlClient {
|
|
|
507
523
|
* Test-only helper that simulates an abrupt actor crash.
|
|
508
524
|
*/
|
|
509
525
|
hardCrashActor?(actorId: string): Promise<void>;
|
|
510
|
-
kvGet(actorId: string, key: Uint8Array): Promise<string | null>;
|
|
511
|
-
kvBatchGet(actorId: string, keys: Uint8Array[]): Promise<(Uint8Array | null)[]>;
|
|
512
|
-
kvBatchPut(actorId: string, entries: [Uint8Array, Uint8Array][]): Promise<void>;
|
|
513
|
-
kvBatchDelete(actorId: string, keys: Uint8Array[]): Promise<void>;
|
|
514
|
-
kvDeleteRange(actorId: string, start: Uint8Array, end: Uint8Array): Promise<void>;
|
|
515
526
|
}
|
|
516
527
|
interface RuntimeDisplayInformation {
|
|
517
528
|
properties: Record<string, string>;
|
|
@@ -570,6 +581,7 @@ type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
|
570
581
|
type ConnHandle = OpaqueHandle<"conn">;
|
|
571
582
|
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
572
583
|
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
584
|
+
type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
573
585
|
type RuntimeBytes = Uint8Array;
|
|
574
586
|
interface RuntimeActorKeySegment {
|
|
575
587
|
kind: string;
|
|
@@ -590,6 +602,10 @@ interface RuntimeStateDeltaPayload {
|
|
|
590
602
|
}>;
|
|
591
603
|
connHibernationRemoved: string[];
|
|
592
604
|
}
|
|
605
|
+
interface RuntimeWorkflowKvWrite {
|
|
606
|
+
key: RuntimeBytes;
|
|
607
|
+
value: RuntimeBytes;
|
|
608
|
+
}
|
|
593
609
|
interface RuntimeRequestSaveOpts {
|
|
594
610
|
immediate?: boolean;
|
|
595
611
|
maxWaitMs?: number;
|
|
@@ -615,6 +631,38 @@ interface RuntimeQueueInspectMessage {
|
|
|
615
631
|
name: string;
|
|
616
632
|
createdAtMs: number;
|
|
617
633
|
}
|
|
634
|
+
interface RuntimeScheduledEventInfo {
|
|
635
|
+
id: string;
|
|
636
|
+
action: string;
|
|
637
|
+
args: RuntimeBytes;
|
|
638
|
+
runAt: number;
|
|
639
|
+
}
|
|
640
|
+
interface RuntimeCronJobInfo {
|
|
641
|
+
name: string;
|
|
642
|
+
kind: "cron" | "every";
|
|
643
|
+
action: string;
|
|
644
|
+
args: RuntimeBytes;
|
|
645
|
+
nextRunAt: number;
|
|
646
|
+
lastRunAt?: number;
|
|
647
|
+
expression?: string;
|
|
648
|
+
timezone?: string;
|
|
649
|
+
intervalMs?: number;
|
|
650
|
+
maxHistory: number;
|
|
651
|
+
}
|
|
652
|
+
interface RuntimeScheduleErrorInfo {
|
|
653
|
+
group: string;
|
|
654
|
+
code: string;
|
|
655
|
+
message: string;
|
|
656
|
+
metadata?: unknown;
|
|
657
|
+
}
|
|
658
|
+
interface RuntimeCronFire {
|
|
659
|
+
action: string;
|
|
660
|
+
scheduledAt: number;
|
|
661
|
+
firedAt: number;
|
|
662
|
+
finishedAt?: number;
|
|
663
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
664
|
+
error?: RuntimeScheduleErrorInfo;
|
|
665
|
+
}
|
|
618
666
|
interface RuntimeQueueNextBatchOptions {
|
|
619
667
|
names?: string[];
|
|
620
668
|
count?: number;
|
|
@@ -675,6 +723,9 @@ type RuntimeSqlBindParam = ({
|
|
|
675
723
|
blobValue: RuntimeBytes;
|
|
676
724
|
};
|
|
677
725
|
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
726
|
+
interface RuntimeActorRuntimeSocketEndpointInfo {
|
|
727
|
+
path: string;
|
|
728
|
+
}
|
|
678
729
|
interface RuntimeSqlQueryResult {
|
|
679
730
|
columns: string[];
|
|
680
731
|
rows: unknown[][];
|
|
@@ -684,6 +735,10 @@ interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
|
684
735
|
changes: number;
|
|
685
736
|
lastInsertRowId?: number | null;
|
|
686
737
|
}
|
|
738
|
+
interface RuntimeSqlBatchStatement {
|
|
739
|
+
sql: string;
|
|
740
|
+
params?: RuntimeSqlBindParams;
|
|
741
|
+
}
|
|
687
742
|
interface RuntimeSqlRunResult {
|
|
688
743
|
changes: number;
|
|
689
744
|
}
|
|
@@ -692,6 +747,7 @@ interface RuntimeActorConfig {
|
|
|
692
747
|
icon?: string;
|
|
693
748
|
hasDatabase?: boolean;
|
|
694
749
|
remoteSqlite?: boolean;
|
|
750
|
+
enableActorRuntimeSocket?: boolean;
|
|
695
751
|
hasState?: boolean;
|
|
696
752
|
canHibernateWebsocket?: boolean;
|
|
697
753
|
stateSaveIntervalMs?: number;
|
|
@@ -712,6 +768,7 @@ interface RuntimeActorConfig {
|
|
|
712
768
|
connectionLivenessTimeoutMs?: number;
|
|
713
769
|
connectionLivenessIntervalMs?: number;
|
|
714
770
|
maxQueueSize?: number;
|
|
771
|
+
maxSchedules?: number;
|
|
715
772
|
maxQueueMessageSize?: number;
|
|
716
773
|
maxIncomingMessageSize?: number;
|
|
717
774
|
maxOutgoingMessageSize?: number;
|
|
@@ -829,6 +886,7 @@ interface CoreRuntime {
|
|
|
829
886
|
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
830
887
|
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
831
888
|
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
889
|
+
actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
|
|
832
890
|
actorId(ctx: ActorContextHandle): string;
|
|
833
891
|
actorName(ctx: ActorContextHandle): string;
|
|
834
892
|
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
@@ -862,11 +920,18 @@ interface CoreRuntime {
|
|
|
862
920
|
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
863
921
|
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
864
922
|
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
923
|
+
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
924
|
+
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<SqliteTransactionHandle>;
|
|
925
|
+
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
926
|
+
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
927
|
+
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
928
|
+
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
865
929
|
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
866
930
|
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
867
931
|
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
868
932
|
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
869
933
|
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
934
|
+
actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
|
|
870
935
|
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
871
936
|
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
872
937
|
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
@@ -876,8 +941,17 @@ interface CoreRuntime {
|
|
|
876
941
|
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
877
942
|
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
878
943
|
actorQueueReset(ctx: ActorContextHandle): Promise<void>;
|
|
879
|
-
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes):
|
|
880
|
-
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes):
|
|
944
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
|
|
945
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
|
|
946
|
+
actorScheduleCancel(ctx: ActorContextHandle, id: string): Promise<boolean>;
|
|
947
|
+
actorScheduleGet(ctx: ActorContextHandle, id: string): Promise<RuntimeScheduledEventInfo | undefined>;
|
|
948
|
+
actorScheduleList(ctx: ActorContextHandle): Promise<RuntimeScheduledEventInfo[]>;
|
|
949
|
+
actorCronSet(ctx: ActorContextHandle, name: string, expression: string, timezone: string | undefined, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
|
|
950
|
+
actorCronEvery(ctx: ActorContextHandle, name: string, intervalMs: number, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
|
|
951
|
+
actorCronGet(ctx: ActorContextHandle, name: string): Promise<RuntimeCronJobInfo | undefined>;
|
|
952
|
+
actorCronList(ctx: ActorContextHandle): Promise<RuntimeCronJobInfo[]>;
|
|
953
|
+
actorCronDelete(ctx: ActorContextHandle, name: string): Promise<boolean>;
|
|
954
|
+
actorCronHistory(ctx: ActorContextHandle, name: string, limit: number | undefined): Promise<RuntimeCronFire[]>;
|
|
881
955
|
connId(conn: ConnHandle): string;
|
|
882
956
|
connParams(conn: ConnHandle): RuntimeBytes;
|
|
883
957
|
connState(conn: ConnHandle): RuntimeBytes;
|
|
@@ -1554,10 +1628,76 @@ interface ActorKv {
|
|
|
1554
1628
|
[key: string]: any;
|
|
1555
1629
|
}
|
|
1556
1630
|
interface ActorSchedule {
|
|
1557
|
-
after(duration: number, action: string, ...args: unknown[]): Promise<
|
|
1558
|
-
at(timestamp: number, action: string, ...args: unknown[]): Promise<
|
|
1631
|
+
after(duration: number, action: string, ...args: unknown[]): Promise<string>;
|
|
1632
|
+
at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
|
|
1633
|
+
cancel(id: string): Promise<boolean>;
|
|
1634
|
+
get(id: string): Promise<ScheduledEventInfo | undefined>;
|
|
1635
|
+
list(): Promise<ScheduledEventInfo[]>;
|
|
1636
|
+
[key: string]: any;
|
|
1637
|
+
}
|
|
1638
|
+
interface ActorCronSetOptions {
|
|
1639
|
+
name: string;
|
|
1640
|
+
expression: string;
|
|
1641
|
+
action: string;
|
|
1642
|
+
args?: unknown[];
|
|
1643
|
+
timezone?: string;
|
|
1644
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
1645
|
+
maxHistory?: number;
|
|
1646
|
+
}
|
|
1647
|
+
interface ActorCronEveryOptions {
|
|
1648
|
+
name: string;
|
|
1649
|
+
/** Fixed interval in milliseconds. Minimum 5,000. */
|
|
1650
|
+
interval: number;
|
|
1651
|
+
action: string;
|
|
1652
|
+
args?: unknown[];
|
|
1653
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
1654
|
+
maxHistory?: number;
|
|
1655
|
+
}
|
|
1656
|
+
interface ActorCron {
|
|
1657
|
+
set(options: ActorCronSetOptions): Promise<void>;
|
|
1658
|
+
every(options: ActorCronEveryOptions): Promise<void>;
|
|
1659
|
+
get(name: string): Promise<CronJobInfo | undefined>;
|
|
1660
|
+
list(): Promise<CronJobInfo[]>;
|
|
1661
|
+
delete(name: string): Promise<boolean>;
|
|
1662
|
+
history(name: string, options?: {
|
|
1663
|
+
limit?: number;
|
|
1664
|
+
}): Promise<CronFire[]>;
|
|
1559
1665
|
[key: string]: any;
|
|
1560
1666
|
}
|
|
1667
|
+
interface ScheduledEventInfo {
|
|
1668
|
+
id: string;
|
|
1669
|
+
action: string;
|
|
1670
|
+
args: unknown[];
|
|
1671
|
+
runAt: number;
|
|
1672
|
+
}
|
|
1673
|
+
type CronJobInfo = {
|
|
1674
|
+
name: string;
|
|
1675
|
+
action: string;
|
|
1676
|
+
args: unknown[];
|
|
1677
|
+
nextRunAt: number;
|
|
1678
|
+
lastRunAt?: number;
|
|
1679
|
+
maxHistory: number;
|
|
1680
|
+
} & ({
|
|
1681
|
+
kind: "cron";
|
|
1682
|
+
expression: string;
|
|
1683
|
+
timezone: string;
|
|
1684
|
+
} | {
|
|
1685
|
+
kind: "every";
|
|
1686
|
+
interval: number;
|
|
1687
|
+
});
|
|
1688
|
+
interface CronFire {
|
|
1689
|
+
action: string;
|
|
1690
|
+
scheduledAt: number;
|
|
1691
|
+
firedAt: number;
|
|
1692
|
+
finishedAt?: number;
|
|
1693
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
1694
|
+
error?: {
|
|
1695
|
+
group: string;
|
|
1696
|
+
code: string;
|
|
1697
|
+
message: string;
|
|
1698
|
+
metadata?: unknown;
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1561
1701
|
type QueueMessageOf<Name extends string, Body> = {
|
|
1562
1702
|
id: number | bigint;
|
|
1563
1703
|
name: Name;
|
|
@@ -1638,11 +1778,16 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1638
1778
|
readonly kv: ActorKv;
|
|
1639
1779
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1640
1780
|
readonly schedule: ActorSchedule;
|
|
1781
|
+
readonly cron: ActorCron;
|
|
1641
1782
|
readonly queue: ActorQueue<TQueues>;
|
|
1642
1783
|
readonly actorId: string;
|
|
1643
1784
|
readonly name: string;
|
|
1644
1785
|
readonly key: string[];
|
|
1645
1786
|
readonly region: string;
|
|
1787
|
+
/** Provisions the experimental Actor Runtime Socket for this actor generation. */
|
|
1788
|
+
actorRuntimeSocket(): Promise<{
|
|
1789
|
+
path: string;
|
|
1790
|
+
}>;
|
|
1646
1791
|
readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
|
|
1647
1792
|
readonly log: ActorLogger;
|
|
1648
1793
|
readonly abortSignal: AbortSignal;
|
|
@@ -1739,6 +1884,7 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1739
1884
|
options: z$1.ZodPrefault<z$1.ZodObject<{
|
|
1740
1885
|
name: z$1.ZodOptional<z$1.ZodString>;
|
|
1741
1886
|
icon: z$1.ZodOptional<z$1.ZodString>;
|
|
1887
|
+
enableActorRuntimeSocket: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
1742
1888
|
canHibernateWebSocket: z$1.ZodDefault<z$1.ZodUnion<readonly [z$1.ZodBoolean, z$1.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
|
|
1743
1889
|
createVarsTimeout: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1744
1890
|
createConnStateTimeout: z$1.ZodDefault<z$1.ZodNumber>;
|
|
@@ -1755,6 +1901,7 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1755
1901
|
noSleep: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
1756
1902
|
sleepTimeout: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1757
1903
|
maxQueueSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1904
|
+
maxSchedules: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1758
1905
|
maxQueueMessageSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
1759
1906
|
preloadMaxWorkflowBytes: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1760
1907
|
preloadMaxConnectionsBytes: z$1.ZodOptional<z$1.ZodNumber>;
|
|
@@ -1768,10 +1915,11 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1768
1915
|
hidden: z$1.ZodOptional<z$1.ZodLiteral<false>>;
|
|
1769
1916
|
}, z$1.core.$strict>, z$1.ZodObject<{
|
|
1770
1917
|
id: z$1.ZodEnum<{
|
|
1771
|
-
state: "state";
|
|
1772
|
-
queue: "queue";
|
|
1773
1918
|
workflow: "workflow";
|
|
1919
|
+
state: "state";
|
|
1774
1920
|
database: "database";
|
|
1921
|
+
queue: "queue";
|
|
1922
|
+
schedules: "schedules";
|
|
1775
1923
|
connections: "connections";
|
|
1776
1924
|
console: "console";
|
|
1777
1925
|
}>;
|