rivetkit 0.0.0-main.41efcce → 0.0.0-main.4994268
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 +845 -103
- package/dist/browser/client.js +1806 -889
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +121 -2
- package/dist/browser/inspector/client.js +2066 -232
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2331 -2022
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +847 -113
- package/dist/tsup/agent-os/index.d.ts +847 -113
- package/dist/tsup/agent-os/index.js +2334 -2025
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-XSC2WWXD.js → chunk-2PVIX6B3.js} +13 -7
- package/dist/tsup/chunk-2PVIX6B3.js.map +1 -0
- package/dist/tsup/{chunk-JTL6Y2UN.cjs → chunk-4FC7TVS6.cjs} +37 -72
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-J27CEW6F.js → chunk-54VWHRG7.js} +6 -6
- package/dist/tsup/chunk-54VWHRG7.js.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-7AFZMFPQ.js} +15 -1
- package/dist/tsup/chunk-7AFZMFPQ.js.map +1 -0
- package/dist/tsup/{chunk-CVHUXINE.js → chunk-ALCCSOCU.js} +579 -72
- package/dist/tsup/chunk-ALCCSOCU.js.map +1 -0
- package/dist/tsup/{chunk-EVADNK6Z.cjs → chunk-CFA5ZRWA.cjs} +10 -10
- package/dist/tsup/chunk-CFA5ZRWA.cjs.map +1 -0
- package/dist/tsup/{chunk-RF3MEJV6.cjs → chunk-DFRCAEKM.cjs} +17 -11
- package/dist/tsup/chunk-DFRCAEKM.cjs.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-HNHLBM3Y.cjs} +198 -19
- package/dist/tsup/chunk-HNHLBM3Y.cjs.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-JI6GZ2C2.js} +4 -12
- package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
- package/dist/tsup/{chunk-SBEFJ4IQ.js → chunk-L3KD2YPI.js} +42 -7
- package/dist/tsup/chunk-L3KD2YPI.js.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-MYWZCDML.cjs} +4 -12
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
- package/dist/tsup/chunk-OE3QIP5X.cjs +1242 -0
- package/dist/tsup/chunk-OE3QIP5X.cjs.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-QWLJCP3X.js} +196 -17
- package/dist/tsup/chunk-QWLJCP3X.js.map +1 -0
- package/dist/tsup/{chunk-VD7AZIBR.js → chunk-R3SZNBUQ.js} +1110 -342
- package/dist/tsup/chunk-R3SZNBUQ.js.map +1 -0
- package/dist/tsup/{chunk-TQSL4NJ3.cjs → chunk-SUV5DP6T.cjs} +44 -9
- package/dist/tsup/chunk-SUV5DP6T.cjs.map +1 -0
- package/dist/tsup/{chunk-AV54CVAG.cjs → chunk-TJ3B4I5P.cjs} +1239 -471
- package/dist/tsup/chunk-TJ3B4I5P.cjs.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-UEULFXUI.cjs} +16 -2
- package/dist/tsup/chunk-UEULFXUI.cjs.map +1 -0
- package/dist/tsup/{chunk-SPMMF6TR.cjs → chunk-YBTLEVA2.cjs} +3 -3
- package/dist/tsup/{chunk-SPMMF6TR.cjs.map → chunk-YBTLEVA2.cjs.map} +1 -1
- package/dist/tsup/{chunk-PXLJOMJD.js → chunk-YNNR7QDA.js} +2 -2
- package/dist/tsup/{chunk-ZGWSH7YV.js → chunk-ZZ3WBRPD.js} +36 -71
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +8 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +17 -7
- package/dist/tsup/client/mod.d.ts +17 -7
- package/dist/tsup/client/mod.js +7 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-B9qUIHX4.d.ts → config-BxOimoGX.d.cts} +41 -14
- package/dist/tsup/{config-B9qUIHX4.d.cts → config-BxOimoGX.d.ts} +41 -14
- package/dist/tsup/{config-D6WxBYjV.d.cts → config-CUymbyM6.d.ts} +894 -71
- package/dist/tsup/{config-B3RIidaJ.d.ts → config-CpB-e4I9.d.cts} +894 -71
- package/dist/tsup/context-YBUBTwTS.d.ts +129 -0
- package/dist/tsup/context-c-6G4mjk.d.cts +129 -0
- package/dist/tsup/db/drizzle.cjs +160 -103
- 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 +162 -105
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +116 -103
- 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 +117 -104
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +37 -0
- package/dist/tsup/dynamic/mod.d.ts +37 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +46 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +37 -15
- package/dist/tsup/inspector/mod.d.ts +37 -15
- package/dist/tsup/inspector/mod.js +45 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +240 -0
- package/dist/tsup/inspector-tab/mod.d.ts +240 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +3831 -892
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +7 -7
- package/dist/tsup/mod.d.ts +7 -7
- package/dist/tsup/mod.js +3793 -854
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +26 -21
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +6 -6
- package/dist/tsup/test/mod.d.ts +6 -6
- package/dist/tsup/test/mod.js +25 -20
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/unstable/migrations.cjs +101 -0
- package/dist/tsup/unstable/migrations.cjs.map +1 -0
- package/dist/tsup/unstable/migrations.d.cts +29 -0
- package/dist/tsup/unstable/migrations.d.ts +29 -0
- package/dist/tsup/unstable/migrations.js +101 -0
- package/dist/tsup/unstable/migrations.js.map +1 -0
- package/dist/tsup/utils-CV0akuDD.d.ts +162 -0
- package/dist/tsup/utils-CqDnC_PS.d.cts +104 -0
- package/dist/tsup/utils-CqDnC_PS.d.ts +104 -0
- package/dist/tsup/utils-DQDCphrl.d.cts +162 -0
- package/dist/tsup/utils.cjs +7 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +4 -147
- package/dist/tsup/utils.d.ts +4 -147
- package/dist/tsup/utils.js +6 -2
- package/dist/tsup/workflow/mod.cjs +486 -375
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +10 -10
- package/dist/tsup/workflow/mod.d.ts +10 -10
- package/dist/tsup/workflow/mod.js +478 -367
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +46 -13
- package/src/actor/actions.ts +119 -0
- package/src/actor/config.test.ts +14 -0
- package/src/actor/config.ts +351 -93
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +38 -26
- package/src/actor/errors.ts +74 -89
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/cron.ts +37 -2
- package/src/agent-os/actor/index.ts +39 -19
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/agent-os/types.ts +11 -0
- package/src/client/actor-common.ts +108 -46
- package/src/client/actor-conn.ts +88 -40
- package/src/client/actor-handle.ts +175 -77
- package/src/client/actor-query.ts +5 -5
- package/src/client/client.ts +32 -15
- package/src/client/config.ts +8 -0
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +28 -4
- package/src/client/mod.ts +9 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +31 -13
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +34 -10
- package/src/common/actor-router-consts.ts +8 -0
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +55 -9
- package/src/common/database/mod.test.ts +226 -0
- package/src/common/database/mod.ts +142 -125
- package/src/common/database/native-database.test.ts +220 -0
- package/src/common/database/native-database.ts +356 -59
- package/src/common/database/shared.ts +16 -0
- package/src/common/encoding.ts +302 -38
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/log.ts +117 -14
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +17 -203
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.test.ts +157 -0
- package/src/db/drizzle.ts +195 -120
- package/src/db/mod.ts +3 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +64 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +28 -25
- package/src/engine-client/actor-websocket-client.ts +32 -5
- package/src/engine-client/api-endpoints.ts +52 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +17 -17
- package/src/engine-client/mod.ts +103 -60
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/globals.d.ts +4 -0
- package/src/inspector/client.browser.ts +127 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector-tab/mod.ts +301 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +160 -53
- package/src/registry/config/serverless.ts +7 -1
- package/src/registry/index.ts +699 -96
- package/src/registry/napi-runtime.ts +1113 -0
- package/src/registry/native-http.ts +208 -0
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +1610 -876
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.test.ts +50 -0
- package/src/registry/runtime.ts +820 -0
- package/src/registry/wasm-runtime.ts +1178 -0
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +8 -2
- package/src/serverless/configure.ts +102 -49
- package/src/test/mod.ts +2 -17
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.test.ts +170 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +39 -0
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +4 -2
- package/src/workflow/context.ts +683 -242
- package/src/workflow/driver.test.ts +62 -0
- package/src/workflow/driver.ts +248 -119
- package/src/workflow/inspector.ts +12 -3
- package/src/workflow/mod.ts +39 -25
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-6AVUJ52Q.cjs +0 -253
- package/dist/tsup/chunk-6AVUJ52Q.cjs.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-7X7RVTFF.cjs +0 -735
- package/dist/tsup/chunk-7X7RVTFF.cjs.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-AV54CVAG.cjs.map +0 -1
- package/dist/tsup/chunk-CVHUXINE.js.map +0 -1
- package/dist/tsup/chunk-EVADNK6Z.cjs.map +0 -1
- package/dist/tsup/chunk-J27CEW6F.js.map +0 -1
- package/dist/tsup/chunk-JTL6Y2UN.cjs.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RF3MEJV6.cjs.map +0 -1
- package/dist/tsup/chunk-SB4MXRN2.js +0 -253
- package/dist/tsup/chunk-SB4MXRN2.js.map +0 -1
- package/dist/tsup/chunk-SBEFJ4IQ.js.map +0 -1
- package/dist/tsup/chunk-TQSL4NJ3.cjs.map +0 -1
- package/dist/tsup/chunk-VD7AZIBR.js.map +0 -1
- package/dist/tsup/chunk-XSC2WWXD.js.map +0 -1
- package/dist/tsup/chunk-ZGWSH7YV.js.map +0 -1
- package/dist/tsup/context-BxvHh9wi.d.cts +0 -92
- package/dist/tsup/context-CNIZBIKl.d.ts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2501
- package/src/drivers/engine/actor-driver.ts +0 -2470
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-PXLJOMJD.js.map → chunk-YNNR7QDA.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
|
+
import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
|
|
1
2
|
import { z as z$2 } from 'zod';
|
|
2
3
|
import z$1, { z } from 'zod/v4';
|
|
3
|
-
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
4
4
|
import { Context, Handler, Hono } from 'hono';
|
|
5
|
+
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
6
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
6
7
|
import { ContentfulStatusCode } from 'hono/utils/http-status';
|
|
7
8
|
import { Logger } from 'pino';
|
|
8
9
|
|
|
9
|
-
interface SqliteVfsMetrics {
|
|
10
|
-
requestBuildNs: number;
|
|
11
|
-
serializeNs: number;
|
|
12
|
-
transportNs: number;
|
|
13
|
-
stateUpdateNs: number;
|
|
14
|
-
totalNs: number;
|
|
15
|
-
commitCount: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
10
|
type AnyDatabaseProvider = DatabaseProvider<any> | undefined;
|
|
19
11
|
interface ActorMetricsLike {
|
|
20
12
|
totalKvReads: number;
|
|
21
13
|
totalKvWrites: number;
|
|
22
14
|
trackSql(query: string, durationMs: number): void;
|
|
23
|
-
setSqliteVfsMetricsSource(source?: () => SqliteVfsMetrics | null): void;
|
|
24
15
|
}
|
|
25
16
|
type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> = DBProvider extends DatabaseProvider<any> ? Awaited<ReturnType<DBProvider["createClient"]>> : never;
|
|
26
17
|
type SqliteBindings = unknown[] | Record<string, unknown>;
|
|
@@ -28,13 +19,43 @@ interface SqliteQueryResult {
|
|
|
28
19
|
columns: string[];
|
|
29
20
|
rows: unknown[][];
|
|
30
21
|
}
|
|
22
|
+
interface SqliteExecuteResult extends SqliteQueryResult {
|
|
23
|
+
changes: number;
|
|
24
|
+
lastInsertRowId?: number | null;
|
|
25
|
+
}
|
|
26
|
+
interface SqliteBatchStatement {
|
|
27
|
+
sql: string;
|
|
28
|
+
params?: SqliteBindings;
|
|
29
|
+
}
|
|
30
|
+
interface SqliteNativeMetrics {
|
|
31
|
+
requestBuildNs: number;
|
|
32
|
+
serializeNs: number;
|
|
33
|
+
transportNs: number;
|
|
34
|
+
stateUpdateNs: number;
|
|
35
|
+
totalNs: number;
|
|
36
|
+
commitCount: number;
|
|
37
|
+
pageCacheEntries: number;
|
|
38
|
+
pageCacheWeightedSize: number;
|
|
39
|
+
pageCacheCapacityPages: number;
|
|
40
|
+
writeBufferDirtyPages: number;
|
|
41
|
+
dbSizePages: number;
|
|
42
|
+
}
|
|
31
43
|
interface SqliteDatabase {
|
|
32
44
|
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
45
|
+
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
46
|
+
executeBatch(statements: SqliteBatchStatement[]): Promise<SqliteExecuteResult[]>;
|
|
47
|
+
beginTransaction(timeoutMs?: number): Promise<SqliteTransactionDatabase>;
|
|
33
48
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
34
49
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
35
|
-
|
|
50
|
+
nativeMetrics?(): SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
36
51
|
close(): Promise<void>;
|
|
37
52
|
}
|
|
53
|
+
interface SqliteTransactionDatabase {
|
|
54
|
+
exec(sql: string, callback?: (row: unknown[], columns: string[]) => void): Promise<void>;
|
|
55
|
+
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
56
|
+
commit(): Promise<void>;
|
|
57
|
+
rollback(): Promise<void>;
|
|
58
|
+
}
|
|
38
59
|
/**
|
|
39
60
|
* Provider for opening native databases from the active runtime.
|
|
40
61
|
*/
|
|
@@ -94,14 +115,21 @@ type DatabaseProvider<DB extends RawAccess> = {
|
|
|
94
115
|
/**
|
|
95
116
|
* Drizzle database client interface (will be extended by drizzle-orm types)
|
|
96
117
|
*/
|
|
97
|
-
|
|
98
|
-
}
|
|
118
|
+
type DrizzleDatabaseClient = {};
|
|
99
119
|
type ExecuteFunction = <TRow extends Record<string, unknown> = Record<string, unknown>>(query: string, ...args: unknown[]) => Promise<TRow[]>;
|
|
100
120
|
type RawAccess = {
|
|
101
121
|
/**
|
|
102
122
|
* Executes a raw SQL query.
|
|
103
123
|
*/
|
|
104
124
|
execute: ExecuteFunction;
|
|
125
|
+
/** Runs a callback in an isolated SQLite transaction. */
|
|
126
|
+
transaction: <T>(callback: (tx: RawAccess) => Promise<T> | T, options?: {
|
|
127
|
+
timeout?: number;
|
|
128
|
+
}) => Promise<T>;
|
|
129
|
+
/**
|
|
130
|
+
* Returns native SQLite metrics when the active runtime supports them.
|
|
131
|
+
*/
|
|
132
|
+
nativeMetrics?: () => SqliteNativeMetrics | Promise<SqliteNativeMetrics | null> | null;
|
|
105
133
|
/**
|
|
106
134
|
* Closes the database connection and releases resources.
|
|
107
135
|
*/
|
|
@@ -169,6 +197,44 @@ type ActorQuery = z.infer<typeof ActorQuerySchema>;
|
|
|
169
197
|
*/
|
|
170
198
|
type CreateRequest = z.infer<typeof CreateRequestSchema>;
|
|
171
199
|
|
|
200
|
+
type SchemaHookResult = boolean | Promise<boolean>;
|
|
201
|
+
type SchemaHook<TContext = any> = (ctx: TContext) => SchemaHookResult;
|
|
202
|
+
interface EventTypeToken<T, TContext = any> {
|
|
203
|
+
readonly _eventType?: T;
|
|
204
|
+
readonly canSubscribe?: SchemaHook<TContext>;
|
|
205
|
+
readonly schema?: PrimitiveSchema;
|
|
206
|
+
}
|
|
207
|
+
interface QueueTypeToken<TMessage, TComplete = never, TContext = any> {
|
|
208
|
+
readonly _queueMessage?: TMessage;
|
|
209
|
+
readonly _queueComplete?: TComplete;
|
|
210
|
+
readonly canPublish?: SchemaHook<TContext>;
|
|
211
|
+
readonly message?: PrimitiveSchema;
|
|
212
|
+
readonly complete?: PrimitiveSchema;
|
|
213
|
+
}
|
|
214
|
+
type PrimitiveSchema = StandardSchemaV1 | EventTypeToken<unknown, any>;
|
|
215
|
+
interface EventSchemaDefinition<TContext = any> {
|
|
216
|
+
schema: PrimitiveSchema;
|
|
217
|
+
canSubscribe?: SchemaHook<TContext>;
|
|
218
|
+
}
|
|
219
|
+
interface QueueSchemaDefinition<TContext = any> {
|
|
220
|
+
message: PrimitiveSchema;
|
|
221
|
+
complete?: PrimitiveSchema;
|
|
222
|
+
canPublish?: SchemaHook<TContext>;
|
|
223
|
+
}
|
|
224
|
+
type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
|
|
225
|
+
type QueueSchema = PrimitiveSchema | QueueSchemaDefinition<any> | QueueTypeToken<unknown, unknown, any>;
|
|
226
|
+
type EventSchemaConfig<TContext = any> = Record<string, EventSchema<TContext>>;
|
|
227
|
+
type QueueSchemaConfig<_TContext = any> = Record<string, QueueSchema>;
|
|
228
|
+
type InferSchema<T> = T extends QueueSchemaDefinition<any> ? InferSchema<T["message"]> : T extends QueueTypeToken<infer M, unknown, any> ? M : T extends EventSchemaDefinition<any> ? InferSchema<T["schema"]> : T extends StandardSchemaV1<any, infer O> ? O : T extends EventTypeToken<infer R, any> ? R : never;
|
|
229
|
+
type InferSchemaMap<T extends Record<string, unknown>> = {
|
|
230
|
+
[K in keyof T]: InferSchema<T[K]>;
|
|
231
|
+
};
|
|
232
|
+
type InferQueueComplete<T> = T extends QueueTypeToken<unknown, infer C, any> ? [C] extends [never] ? never : C : T extends QueueSchemaDefinition<any> ? T["complete"] extends PrimitiveSchema ? InferSchema<T["complete"]> : never : never;
|
|
233
|
+
type InferQueueCompleteMap<T extends QueueSchemaConfig> = {
|
|
234
|
+
[K in keyof T]: InferQueueComplete<T[K]>;
|
|
235
|
+
};
|
|
236
|
+
type InferEventArgs<T> = T extends readonly unknown[] ? number extends T["length"] ? [T] : T : [T];
|
|
237
|
+
|
|
172
238
|
interface DeconstructedError {
|
|
173
239
|
__type: "ActorError";
|
|
174
240
|
statusCode: ContentfulStatusCode;
|
|
@@ -177,6 +243,7 @@ interface DeconstructedError {
|
|
|
177
243
|
code: string;
|
|
178
244
|
message: string;
|
|
179
245
|
metadata?: unknown;
|
|
246
|
+
actor?: ActorSpecifier;
|
|
180
247
|
}
|
|
181
248
|
|
|
182
249
|
interface RivetErrorOptions extends ErrorOptions {
|
|
@@ -186,6 +253,14 @@ interface RivetErrorOptions extends ErrorOptions {
|
|
|
186
253
|
metadata?: unknown;
|
|
187
254
|
/** Explicit HTTP status override for router responses. */
|
|
188
255
|
statusCode?: number;
|
|
256
|
+
/** Actor context associated with this error. */
|
|
257
|
+
actor?: ActorSpecifier;
|
|
258
|
+
}
|
|
259
|
+
/** Identifies the actor that was handling work when an error was produced. */
|
|
260
|
+
interface ActorSpecifier {
|
|
261
|
+
actorId: string;
|
|
262
|
+
generation: number;
|
|
263
|
+
key?: string;
|
|
189
264
|
}
|
|
190
265
|
interface UserErrorOptions extends ErrorOptions {
|
|
191
266
|
/**
|
|
@@ -204,6 +279,7 @@ declare class RivetError extends Error {
|
|
|
204
279
|
public: boolean;
|
|
205
280
|
metadata?: unknown;
|
|
206
281
|
statusCode: number;
|
|
282
|
+
actor?: ActorSpecifier;
|
|
207
283
|
readonly group: string;
|
|
208
284
|
readonly code: string;
|
|
209
285
|
static isRivetError(error: unknown): error is RivetError | DeconstructedError;
|
|
@@ -216,61 +292,26 @@ declare class UserError extends RivetError {
|
|
|
216
292
|
constructor(message: string, options?: UserErrorOptions);
|
|
217
293
|
}
|
|
218
294
|
|
|
219
|
-
type SchemaHookResult = boolean | Promise<boolean>;
|
|
220
|
-
type SchemaHook<TContext = any> = (ctx: TContext) => SchemaHookResult;
|
|
221
|
-
interface EventTypeToken<T, TContext = any> {
|
|
222
|
-
readonly _eventType?: T;
|
|
223
|
-
readonly canSubscribe?: SchemaHook<TContext>;
|
|
224
|
-
readonly schema?: PrimitiveSchema;
|
|
225
|
-
}
|
|
226
|
-
interface QueueTypeToken<TMessage, TComplete = never, TContext = any> {
|
|
227
|
-
readonly _queueMessage?: TMessage;
|
|
228
|
-
readonly _queueComplete?: TComplete;
|
|
229
|
-
readonly canPublish?: SchemaHook<TContext>;
|
|
230
|
-
readonly message?: PrimitiveSchema;
|
|
231
|
-
readonly complete?: PrimitiveSchema;
|
|
232
|
-
}
|
|
233
|
-
type PrimitiveSchema = StandardSchemaV1 | EventTypeToken<unknown, any>;
|
|
234
|
-
interface EventSchemaDefinition<TContext = any> {
|
|
235
|
-
schema: PrimitiveSchema;
|
|
236
|
-
canSubscribe?: SchemaHook<TContext>;
|
|
237
|
-
}
|
|
238
|
-
interface QueueSchemaDefinition<TContext = any> {
|
|
239
|
-
message: PrimitiveSchema;
|
|
240
|
-
complete?: PrimitiveSchema;
|
|
241
|
-
canPublish?: SchemaHook<TContext>;
|
|
242
|
-
}
|
|
243
|
-
type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
|
|
244
|
-
type QueueSchema = PrimitiveSchema | QueueSchemaDefinition<any> | QueueTypeToken<unknown, unknown, any>;
|
|
245
|
-
type EventSchemaConfig<TContext = any> = Record<string, EventSchema<TContext>>;
|
|
246
|
-
type QueueSchemaConfig<TContext = any> = Record<string, QueueSchema>;
|
|
247
|
-
type InferSchema<T> = T extends QueueSchemaDefinition<any> ? InferSchema<T["message"]> : T extends QueueTypeToken<infer M, unknown, any> ? M : T extends EventSchemaDefinition<any> ? InferSchema<T["schema"]> : T extends StandardSchemaV1<any, infer O> ? O : T extends EventTypeToken<infer R, any> ? R : never;
|
|
248
|
-
type InferSchemaMap<T extends Record<string, unknown>> = {
|
|
249
|
-
[K in keyof T]: InferSchema<T[K]>;
|
|
250
|
-
};
|
|
251
|
-
type InferQueueComplete<T> = T extends QueueTypeToken<unknown, infer C, any> ? [C] extends [never] ? never : C : T extends QueueSchemaDefinition<any> ? T["complete"] extends PrimitiveSchema ? InferSchema<T["complete"]> : never : never;
|
|
252
|
-
type InferQueueCompleteMap<T extends QueueSchemaConfig> = {
|
|
253
|
-
[K in keyof T]: InferQueueComplete<T[K]>;
|
|
254
|
-
};
|
|
255
|
-
type InferEventArgs<T> = T extends readonly unknown[] ? number extends T["length"] ? [T] : T : [T];
|
|
256
|
-
|
|
257
295
|
type UpgradeWebSocket = (createEvents: (c: Context) => any) => Handler;
|
|
258
296
|
type GetUpgradeWebSocket = () => UpgradeWebSocket;
|
|
259
297
|
|
|
260
298
|
type GatewayTarget = {
|
|
261
299
|
directId: string;
|
|
262
300
|
} | ActorQuery;
|
|
301
|
+
interface GatewayRequestOptions {
|
|
302
|
+
skipReadyWait?: boolean;
|
|
303
|
+
}
|
|
263
304
|
interface EngineControlClient {
|
|
264
305
|
getForId(input: GetForIdInput): Promise<ActorOutput | undefined>;
|
|
265
306
|
getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
|
|
266
307
|
getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
|
|
267
308
|
createActor(input: CreateInput): Promise<ActorOutput>;
|
|
268
309
|
listActors(input: ListActorsInput): Promise<ActorOutput[]>;
|
|
269
|
-
sendRequest(target: GatewayTarget, actorRequest: Request): Promise<Response>;
|
|
270
|
-
openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown): Promise<UniversalWebSocket>;
|
|
310
|
+
sendRequest(target: GatewayTarget, actorRequest: Request, options?: GatewayRequestOptions): Promise<Response>;
|
|
311
|
+
openWebSocket(path: string, target: GatewayTarget, encoding: Encoding, params: unknown, options?: GatewayRequestOptions): Promise<UniversalWebSocket>;
|
|
271
312
|
proxyRequest(c: Context, actorRequest: Request, actorId: string): Promise<Response>;
|
|
272
313
|
proxyWebSocket(c: Context, path: string, actorId: string, encoding: Encoding, params: unknown): Promise<Response>;
|
|
273
|
-
buildGatewayUrl(target: GatewayTarget): Promise<string>;
|
|
314
|
+
buildGatewayUrl(target: GatewayTarget, options?: GatewayRequestOptions): Promise<string>;
|
|
274
315
|
displayInformation(): RuntimeDisplayInformation;
|
|
275
316
|
extraStartupLog?: () => Record<string, unknown>;
|
|
276
317
|
modifyRuntimeRouter?: (config: RegistryConfig, router: Hono) => void;
|
|
@@ -280,11 +321,6 @@ interface EngineControlClient {
|
|
|
280
321
|
* Test-only helper that simulates an abrupt actor crash.
|
|
281
322
|
*/
|
|
282
323
|
hardCrashActor?(actorId: string): Promise<void>;
|
|
283
|
-
kvGet(actorId: string, key: Uint8Array): Promise<string | null>;
|
|
284
|
-
kvBatchGet(actorId: string, keys: Uint8Array[]): Promise<(Uint8Array | null)[]>;
|
|
285
|
-
kvBatchPut(actorId: string, entries: [Uint8Array, Uint8Array][]): Promise<void>;
|
|
286
|
-
kvBatchDelete(actorId: string, keys: Uint8Array[]): Promise<void>;
|
|
287
|
-
kvDeleteRange(actorId: string, start: Uint8Array, end: Uint8Array): Promise<void>;
|
|
288
324
|
}
|
|
289
325
|
interface RuntimeDisplayInformation {
|
|
290
326
|
properties: Record<string, string>;
|
|
@@ -358,12 +394,25 @@ interface QueueSendResult<TResponse = unknown> {
|
|
|
358
394
|
* @returns {Promise<Response>}
|
|
359
395
|
*/
|
|
360
396
|
type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unknown> = (...args: Args extends [unknown, ...infer Rest] ? Rest : Args) => Promise<Response>;
|
|
397
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
398
|
+
type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => void) => () => void;
|
|
399
|
+
type ActorActionMap<R> = {
|
|
400
|
+
[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;
|
|
401
|
+
};
|
|
402
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? R : never;
|
|
403
|
+
interface ActorGatewayOptions {
|
|
404
|
+
skipReadyWait?: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface ActorActionOptions extends ActorGatewayOptions {
|
|
407
|
+
signal?: AbortSignal;
|
|
408
|
+
}
|
|
409
|
+
type ActorConnectOptions = ActorGatewayOptions;
|
|
410
|
+
type ActorFetchInit = RequestInit & ActorGatewayOptions;
|
|
411
|
+
type ActorWebSocketOptions = ActorGatewayOptions;
|
|
361
412
|
/**
|
|
362
413
|
* Maps action methods from actor definition to typed function signatures.
|
|
363
414
|
*/
|
|
364
|
-
type ActorDefinitionActions<AD extends AnyActorDefinition> = AD extends
|
|
365
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
366
|
-
} : never;
|
|
415
|
+
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
367
416
|
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
368
417
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
369
418
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
@@ -374,13 +423,31 @@ type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
|
|
|
374
423
|
<K extends keyof TEvents & string>(eventName: K, callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void): () => void;
|
|
375
424
|
(eventName: keyof TEvents extends never ? string : never, callback: (...args: any[]) => void): () => void;
|
|
376
425
|
};
|
|
377
|
-
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = AD
|
|
426
|
+
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
|
|
427
|
+
send: ActorQueueSend<Record<string, any>>;
|
|
428
|
+
} : AD extends {
|
|
429
|
+
config: {
|
|
430
|
+
queues?: infer Q;
|
|
431
|
+
};
|
|
432
|
+
} ? Q extends QueueSchemaConfig ? {
|
|
378
433
|
send: ActorQueueSend<Q>;
|
|
379
|
-
} :
|
|
380
|
-
|
|
434
|
+
} : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
|
|
435
|
+
send: ActorQueueSend<Q>;
|
|
436
|
+
} : {} : {};
|
|
437
|
+
type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
|
|
438
|
+
on: LooseEventSubscribe;
|
|
439
|
+
once: LooseEventSubscribe;
|
|
440
|
+
} : AD extends {
|
|
441
|
+
config: {
|
|
442
|
+
events?: infer E;
|
|
443
|
+
};
|
|
444
|
+
} ? E extends EventSchemaConfig ? {
|
|
445
|
+
on: ActorEventSubscribe<E>;
|
|
446
|
+
once: ActorEventSubscribe<E>;
|
|
447
|
+
} : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
|
|
381
448
|
on: ActorEventSubscribe<E>;
|
|
382
449
|
once: ActorEventSubscribe<E>;
|
|
383
|
-
} :
|
|
450
|
+
} : {} : {};
|
|
384
451
|
|
|
385
452
|
declare class ActorClientError extends Error {
|
|
386
453
|
}
|
|
@@ -445,7 +512,7 @@ declare class ActorConnRaw {
|
|
|
445
512
|
*
|
|
446
513
|
* @protected
|
|
447
514
|
*/
|
|
448
|
-
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState);
|
|
515
|
+
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
|
|
449
516
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
450
517
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
451
518
|
/**
|
|
@@ -510,6 +577,10 @@ declare class ActorConnRaw {
|
|
|
510
577
|
* @returns {boolean} - True if the connection is open, false otherwise.
|
|
511
578
|
*/
|
|
512
579
|
get isConnected(): boolean;
|
|
580
|
+
/**
|
|
581
|
+
* Resolves when this connection first reaches the connected state.
|
|
582
|
+
*/
|
|
583
|
+
get ready(): Promise<void>;
|
|
513
584
|
/**
|
|
514
585
|
* Subscribes to connection open events.
|
|
515
586
|
*
|
|
@@ -577,7 +648,7 @@ declare class ActorHandleRaw {
|
|
|
577
648
|
*
|
|
578
649
|
* @protected
|
|
579
650
|
*/
|
|
580
|
-
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState);
|
|
651
|
+
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
|
|
581
652
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
582
653
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
583
654
|
/**
|
|
@@ -590,24 +661,23 @@ declare class ActorHandleRaw {
|
|
|
590
661
|
action<Args extends Array<unknown> = unknown[], Response = unknown>(opts: {
|
|
591
662
|
name: string;
|
|
592
663
|
args: Args;
|
|
593
|
-
|
|
594
|
-
}): Promise<Response>;
|
|
664
|
+
} & ActorActionOptions): Promise<Response>;
|
|
595
665
|
/**
|
|
596
666
|
* Establishes a persistent connection to the actor.
|
|
597
667
|
*
|
|
598
668
|
* @template AD The actor class that this connection is for.
|
|
599
669
|
* @returns {ActorConn<AD>} A connection to the actor.
|
|
600
670
|
*/
|
|
601
|
-
connect(params?: unknown): ActorConn<AnyActorDefinition>;
|
|
671
|
+
connect(params?: unknown, options?: ActorConnectOptions): ActorConn<AnyActorDefinition>;
|
|
602
672
|
/**
|
|
603
673
|
* Fetches a resource from this actor via the /request endpoint. This is a
|
|
604
674
|
* convenience wrapper around the raw HTTP API.
|
|
605
675
|
*/
|
|
606
|
-
fetch(input: string | URL | Request, init?:
|
|
676
|
+
fetch(input: string | URL | Request, init?: ActorFetchInit): Promise<Response>;
|
|
607
677
|
/**
|
|
608
678
|
* Opens a raw WebSocket connection to this actor.
|
|
609
679
|
*/
|
|
610
|
-
webSocket(path?: string, protocols?: string | string[]): Promise<any>;
|
|
680
|
+
webSocket(path?: string, protocols?: string | string[], options?: ActorWebSocketOptions): Promise<any>;
|
|
611
681
|
/**
|
|
612
682
|
* Resolves the actor to get its unique actor ID.
|
|
613
683
|
*/
|
|
@@ -635,7 +705,7 @@ declare class ActorHandleRaw {
|
|
|
635
705
|
* @see {@link ActorHandleRaw}
|
|
636
706
|
*/
|
|
637
707
|
type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect" | "send"> & {
|
|
638
|
-
connect(params?: unknown): ActorConn<AD>;
|
|
708
|
+
connect(params?: unknown, options?: ActorConnectOptions): ActorConn<AD>;
|
|
639
709
|
resolve(): Promise<string>;
|
|
640
710
|
} & ActorDefinitionQueueSend<AD> & ActorDefinitionActions<AD>;
|
|
641
711
|
|
|
@@ -650,6 +720,9 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
650
720
|
bare: "bare";
|
|
651
721
|
}>>;
|
|
652
722
|
headers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>>;
|
|
723
|
+
gateway: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
|
|
724
|
+
skipReadyWait: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
725
|
+
}, z$1.core.$strip>>>;
|
|
653
726
|
getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodCustom<GetUpgradeWebSocket, GetUpgradeWebSocket>>;
|
|
654
727
|
disableMetadataLookup: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
655
728
|
maxInputSize: z$1.ZodDefault<z$1.ZodNumber>;
|
|
@@ -661,6 +734,9 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
661
734
|
poolName: string;
|
|
662
735
|
encoding: "json" | "cbor" | "bare";
|
|
663
736
|
headers: Record<string, string>;
|
|
737
|
+
gateway: {
|
|
738
|
+
skipReadyWait: boolean;
|
|
739
|
+
};
|
|
664
740
|
disableMetadataLookup: boolean;
|
|
665
741
|
maxInputSize: number;
|
|
666
742
|
devtools: boolean;
|
|
@@ -672,6 +748,9 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
672
748
|
poolName: string;
|
|
673
749
|
encoding: "json" | "cbor" | "bare";
|
|
674
750
|
headers: Record<string, string>;
|
|
751
|
+
gateway: {
|
|
752
|
+
skipReadyWait: boolean;
|
|
753
|
+
};
|
|
675
754
|
disableMetadataLookup: boolean;
|
|
676
755
|
maxInputSize: number;
|
|
677
756
|
devtools: boolean;
|
|
@@ -821,7 +900,7 @@ declare class ClientRaw {
|
|
|
821
900
|
/**
|
|
822
901
|
* Creates an instance of Client.
|
|
823
902
|
*/
|
|
824
|
-
constructor(driver: EngineControlClient, encoding: Encoding | undefined);
|
|
903
|
+
constructor(driver: EngineControlClient, encoding: Encoding | undefined, gatewayOptions?: ActorGatewayOptions);
|
|
825
904
|
/**
|
|
826
905
|
* Gets a stateless handle to a actor by its ID.
|
|
827
906
|
*
|
|
@@ -882,6 +961,7 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
882
961
|
};
|
|
883
962
|
|
|
884
963
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
964
|
+
declare const RAW_STATE_SYMBOL: unique symbol;
|
|
885
965
|
interface ActorLogger {
|
|
886
966
|
level: any;
|
|
887
967
|
fatal: any;
|
|
@@ -914,6 +994,10 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
914
994
|
limit?: number;
|
|
915
995
|
};
|
|
916
996
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
997
|
+
/**
|
|
998
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db` / `c.sql`)
|
|
999
|
+
* or actor state instead.
|
|
1000
|
+
*/
|
|
917
1001
|
interface ActorKv {
|
|
918
1002
|
get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
|
|
919
1003
|
put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
|
|
@@ -928,10 +1012,76 @@ interface ActorKv {
|
|
|
928
1012
|
[key: string]: any;
|
|
929
1013
|
}
|
|
930
1014
|
interface ActorSchedule {
|
|
931
|
-
after(duration: number, action: string, ...args: unknown[]): Promise<
|
|
932
|
-
at(timestamp: number, action: string, ...args: unknown[]): Promise<
|
|
1015
|
+
after(duration: number, action: string, ...args: unknown[]): Promise<string>;
|
|
1016
|
+
at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
|
|
1017
|
+
cancel(id: string): Promise<boolean>;
|
|
1018
|
+
get(id: string): Promise<ScheduledEventInfo | undefined>;
|
|
1019
|
+
list(): Promise<ScheduledEventInfo[]>;
|
|
1020
|
+
[key: string]: any;
|
|
1021
|
+
}
|
|
1022
|
+
interface ActorCronSetOptions {
|
|
1023
|
+
name: string;
|
|
1024
|
+
expression: string;
|
|
1025
|
+
action: string;
|
|
1026
|
+
args?: unknown[];
|
|
1027
|
+
timezone?: string;
|
|
1028
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
1029
|
+
maxHistory?: number;
|
|
1030
|
+
}
|
|
1031
|
+
interface ActorCronEveryOptions {
|
|
1032
|
+
name: string;
|
|
1033
|
+
/** Fixed interval in milliseconds. Minimum 5,000. */
|
|
1034
|
+
interval: number;
|
|
1035
|
+
action: string;
|
|
1036
|
+
args?: unknown[];
|
|
1037
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
1038
|
+
maxHistory?: number;
|
|
1039
|
+
}
|
|
1040
|
+
interface ActorCron {
|
|
1041
|
+
set(options: ActorCronSetOptions): Promise<void>;
|
|
1042
|
+
every(options: ActorCronEveryOptions): Promise<void>;
|
|
1043
|
+
get(name: string): Promise<CronJobInfo | undefined>;
|
|
1044
|
+
list(): Promise<CronJobInfo[]>;
|
|
1045
|
+
delete(name: string): Promise<boolean>;
|
|
1046
|
+
history(name: string, options?: {
|
|
1047
|
+
limit?: number;
|
|
1048
|
+
}): Promise<CronFire[]>;
|
|
933
1049
|
[key: string]: any;
|
|
934
1050
|
}
|
|
1051
|
+
interface ScheduledEventInfo {
|
|
1052
|
+
id: string;
|
|
1053
|
+
action: string;
|
|
1054
|
+
args: unknown[];
|
|
1055
|
+
runAt: number;
|
|
1056
|
+
}
|
|
1057
|
+
type CronJobInfo = {
|
|
1058
|
+
name: string;
|
|
1059
|
+
action: string;
|
|
1060
|
+
args: unknown[];
|
|
1061
|
+
nextRunAt: number;
|
|
1062
|
+
lastRunAt?: number;
|
|
1063
|
+
maxHistory: number;
|
|
1064
|
+
} & ({
|
|
1065
|
+
kind: "cron";
|
|
1066
|
+
expression: string;
|
|
1067
|
+
timezone: string;
|
|
1068
|
+
} | {
|
|
1069
|
+
kind: "every";
|
|
1070
|
+
interval: number;
|
|
1071
|
+
});
|
|
1072
|
+
interface CronFire {
|
|
1073
|
+
action: string;
|
|
1074
|
+
scheduledAt: number;
|
|
1075
|
+
firedAt: number;
|
|
1076
|
+
finishedAt?: number;
|
|
1077
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
1078
|
+
error?: {
|
|
1079
|
+
group: string;
|
|
1080
|
+
code: string;
|
|
1081
|
+
message: string;
|
|
1082
|
+
metadata?: unknown;
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
935
1085
|
type QueueMessageOf<Name extends string, Body> = {
|
|
936
1086
|
id: number | bigint;
|
|
937
1087
|
name: Name;
|
|
@@ -990,7 +1140,7 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
990
1140
|
iter<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueIterOptions<TName, TCompletable>): AsyncIterable<any>;
|
|
991
1141
|
[key: string]: any;
|
|
992
1142
|
}
|
|
993
|
-
interface Conn<
|
|
1143
|
+
interface Conn<_TState = unknown, TConnParams = unknown, TConnState = unknown, _TVars = unknown, _TInput = unknown, _TDatabase extends AnyDatabaseProvider = AnyDatabaseProvider, _TEvents extends EventSchemaConfig = Record<never, never>, _TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
994
1144
|
id: string;
|
|
995
1145
|
params: TConnParams;
|
|
996
1146
|
state: TConnState;
|
|
@@ -1001,16 +1151,27 @@ interface Conn<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
|
|
|
1001
1151
|
}
|
|
1002
1152
|
interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1003
1153
|
[ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
|
|
1154
|
+
/** Returns the raw unwrapped state without the write-through proxy. */
|
|
1155
|
+
[RAW_STATE_SYMBOL](): TState;
|
|
1004
1156
|
state: TState;
|
|
1005
1157
|
vars: TVars;
|
|
1158
|
+
/**
|
|
1159
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db` / `sql`)
|
|
1160
|
+
* or actor state instead.
|
|
1161
|
+
*/
|
|
1006
1162
|
readonly kv: ActorKv;
|
|
1007
1163
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1008
1164
|
readonly schedule: ActorSchedule;
|
|
1165
|
+
readonly cron: ActorCron;
|
|
1009
1166
|
readonly queue: ActorQueue<TQueues>;
|
|
1010
1167
|
readonly actorId: string;
|
|
1011
1168
|
readonly name: string;
|
|
1012
1169
|
readonly key: string[];
|
|
1013
1170
|
readonly region: string;
|
|
1171
|
+
/** Provisions the experimental Actor Runtime Socket for this actor generation. */
|
|
1172
|
+
actorRuntimeSocket(): Promise<{
|
|
1173
|
+
path: string;
|
|
1174
|
+
}>;
|
|
1014
1175
|
readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
|
|
1015
1176
|
readonly log: ActorLogger;
|
|
1016
1177
|
readonly abortSignal: AbortSignal;
|
|
@@ -1092,7 +1253,7 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
1092
1253
|
onBeforeActionResponse: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
|
|
1093
1254
|
onRequest: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
|
|
1094
1255
|
onWebSocket: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
|
|
1095
|
-
actions: z.ZodDefault<z.
|
|
1256
|
+
actions: z.ZodDefault<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
1096
1257
|
actionInputSchemas: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
1097
1258
|
connParamsSchema: z.ZodOptional<z.ZodAny>;
|
|
1098
1259
|
events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -1107,6 +1268,7 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
1107
1268
|
options: z.ZodPrefault<z.ZodObject<{
|
|
1108
1269
|
name: z.ZodOptional<z.ZodString>;
|
|
1109
1270
|
icon: z.ZodOptional<z.ZodString>;
|
|
1271
|
+
enableActorRuntimeSocket: z.ZodDefault<z.ZodBoolean>;
|
|
1110
1272
|
canHibernateWebSocket: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodCustom<(request: Request) => boolean, (request: Request) => boolean>]>>;
|
|
1111
1273
|
createVarsTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1112
1274
|
createConnStateTimeout: z.ZodDefault<z.ZodNumber>;
|
|
@@ -1123,12 +1285,33 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
1123
1285
|
noSleep: z.ZodDefault<z.ZodBoolean>;
|
|
1124
1286
|
sleepTimeout: z.ZodDefault<z.ZodNumber>;
|
|
1125
1287
|
maxQueueSize: z.ZodDefault<z.ZodNumber>;
|
|
1288
|
+
maxSchedules: z.ZodDefault<z.ZodNumber>;
|
|
1126
1289
|
maxQueueMessageSize: z.ZodDefault<z.ZodNumber>;
|
|
1127
1290
|
preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
|
|
1128
1291
|
preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
|
|
1129
1292
|
}, z.core.$strict>>;
|
|
1293
|
+
inspector: z.ZodOptional<z.ZodObject<{
|
|
1294
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1295
|
+
id: z.ZodString;
|
|
1296
|
+
label: z.ZodString;
|
|
1297
|
+
source: z.ZodString;
|
|
1298
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1299
|
+
hidden: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1300
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1301
|
+
id: z.ZodEnum<{
|
|
1302
|
+
state: "state";
|
|
1303
|
+
workflow: "workflow";
|
|
1304
|
+
database: "database";
|
|
1305
|
+
queue: "queue";
|
|
1306
|
+
schedules: "schedules";
|
|
1307
|
+
connections: "connections";
|
|
1308
|
+
console: "console";
|
|
1309
|
+
}>;
|
|
1310
|
+
hidden: z.ZodLiteral<true>;
|
|
1311
|
+
}, z.core.$strict>]>>>;
|
|
1312
|
+
}, z.core.$strict>>;
|
|
1130
1313
|
}, z.core.$strict>;
|
|
1131
|
-
type CreateState<TState,
|
|
1314
|
+
type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1132
1315
|
state: TState;
|
|
1133
1316
|
} | {
|
|
1134
1317
|
createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
|
|
@@ -1141,7 +1324,7 @@ type CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase e
|
|
|
1141
1324
|
/**
|
|
1142
1325
|
* @experimental
|
|
1143
1326
|
*/
|
|
1144
|
-
type CreateVars<TState,
|
|
1327
|
+
type CreateVars<TState, _TConnParams, _TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1145
1328
|
/**
|
|
1146
1329
|
* @experimental
|
|
1147
1330
|
*/
|
|
@@ -1153,7 +1336,10 @@ type CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase extend
|
|
|
1153
1336
|
createVars: (c: CreateVarsContext<TState, TInput, TDatabase, TEvents, TQueues>, driverCtx: any) => TVars | Promise<TVars>;
|
|
1154
1337
|
} | Record<never, never>;
|
|
1155
1338
|
interface Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1156
|
-
[Action: string]: (c: ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, ...args: any[]) => any
|
|
1339
|
+
[Action: string]: ((c: ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, ...args: any[]) => any) | Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
1340
|
+
}
|
|
1341
|
+
interface ActionInputSchemas {
|
|
1342
|
+
[Action: string]: PrimitiveSchema | ActionInputSchemas;
|
|
1157
1343
|
}
|
|
1158
1344
|
interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> {
|
|
1159
1345
|
/**
|
|
@@ -1209,7 +1395,7 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1209
1395
|
* shutdown window (`sleepGracePeriod`) cover deferred work.
|
|
1210
1396
|
*
|
|
1211
1397
|
* The handler receives an abort signal via `c.abortSignal` and a
|
|
1212
|
-
* `c.aborted` alias
|
|
1398
|
+
* `c.aborted` alias. Use these to gracefully exit when shutdown starts.
|
|
1213
1399
|
*
|
|
1214
1400
|
* If this handler exits, the actor will follow the normal idle sleep timeout
|
|
1215
1401
|
* once it becomes idle.
|
|
@@ -1238,10 +1424,11 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1238
1424
|
* Called before a client connects to the actor.
|
|
1239
1425
|
*
|
|
1240
1426
|
* Use this hook to determine if a connection should be accepted
|
|
1241
|
-
* and to
|
|
1427
|
+
* and to validate client-provided parameters. The pending connection
|
|
1428
|
+
* is not visible in `c.conns` while this hook runs.
|
|
1242
1429
|
*
|
|
1243
1430
|
* @param opts Connection parameters including client-provided data
|
|
1244
|
-
* @returns
|
|
1431
|
+
* @returns Void or a Promise.
|
|
1245
1432
|
* @throws Throw an error to reject the connection
|
|
1246
1433
|
*/
|
|
1247
1434
|
onBeforeConnect?: (c: BeforeConnectContext<TState, TVars, TInput, TDatabase, TEvents, TQueues>, params: TConnParams) => void | Promise<void>;
|
|
@@ -1249,7 +1436,8 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1249
1436
|
* Called when a client successfully connects to the actor.
|
|
1250
1437
|
*
|
|
1251
1438
|
* Use this hook to perform actions when a connection is established,
|
|
1252
|
-
* such as sending initial data or updating the actor's state.
|
|
1439
|
+
* such as sending initial data or updating the actor's state. The
|
|
1440
|
+
* connection is visible in `c.conns` before this hook runs.
|
|
1253
1441
|
*
|
|
1254
1442
|
* @param conn The connection object
|
|
1255
1443
|
* @returns Void or a Promise that resolves when connection handling is complete
|
|
@@ -1303,9 +1491,10 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1303
1491
|
onWebSocket?: (c: WebSocketContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>, websocket: UniversalWebSocket) => void | Promise<void>;
|
|
1304
1492
|
actions?: TActions;
|
|
1305
1493
|
/**
|
|
1306
|
-
* Optional
|
|
1494
|
+
* Optional schemas for validating action argument tuples in native runtimes.
|
|
1495
|
+
* May mirror nested action groups or use dot-separated low-level action names.
|
|
1307
1496
|
*/
|
|
1308
|
-
actionInputSchemas?:
|
|
1497
|
+
actionInputSchemas?: ActionInputSchemas;
|
|
1309
1498
|
/**
|
|
1310
1499
|
* Optional schema for validating connection params in native runtimes.
|
|
1311
1500
|
*/
|
|
@@ -1325,27 +1514,55 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
|
|
|
1325
1514
|
*/
|
|
1326
1515
|
db: TDatabase;
|
|
1327
1516
|
} | Record<never, never>;
|
|
1328
|
-
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues,
|
|
1517
|
+
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
1329
1518
|
|
|
1330
|
-
interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>,
|
|
1331
|
-
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
1519
|
+
interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, _R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> {
|
|
1520
|
+
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
|
|
1521
|
+
}
|
|
1522
|
+
interface AnyActorDefinition {
|
|
1523
|
+
readonly config: any;
|
|
1332
1524
|
}
|
|
1333
|
-
type AnyActorDefinition = BaseActorDefinition<any, any, any, any, any, any, any, any, any>;
|
|
1334
1525
|
declare class ActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> implements BaseActorDefinition<S, CP, CS, V, I, DB, E, Q, R> {
|
|
1335
1526
|
#private;
|
|
1336
|
-
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>);
|
|
1337
|
-
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
1527
|
+
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>);
|
|
1528
|
+
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
|
|
1338
1529
|
}
|
|
1339
1530
|
|
|
1340
|
-
declare const ActorsSchema: z$2.ZodRecord<z$2.ZodString, z$2.ZodCustom<
|
|
1531
|
+
declare const ActorsSchema: z$2.ZodRecord<z$2.ZodString, z$2.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
|
|
1341
1532
|
type RegistryActors = z$2.infer<typeof ActorsSchema>;
|
|
1342
1533
|
declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
1343
1534
|
use: z$2.ZodRecord<z$2.ZodString, z$2.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
|
|
1344
1535
|
test: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
1345
|
-
enabled: z$2.ZodBoolean
|
|
1536
|
+
enabled: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodBoolean>>;
|
|
1537
|
+
sqliteBackend: z$2.ZodOptional<z$2.ZodEnum<{
|
|
1538
|
+
local: "local";
|
|
1539
|
+
remote: "remote";
|
|
1540
|
+
}>>;
|
|
1346
1541
|
}, z$2.core.$strip>>>;
|
|
1347
1542
|
maxIncomingMessageSize: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1348
1543
|
maxOutgoingMessageSize: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1544
|
+
runtime: z$2.ZodPipe<z$2.ZodOptional<z$2.ZodEnum<{
|
|
1545
|
+
auto: "auto";
|
|
1546
|
+
native: "native";
|
|
1547
|
+
wasm: "wasm";
|
|
1548
|
+
}>>, z$2.ZodTransform<"auto" | "native" | "wasm", "auto" | "native" | "wasm" | undefined>>;
|
|
1549
|
+
wasm: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
1550
|
+
bindings: z$2.ZodOptional<z$2.ZodCustom<typeof _rivetkit_rivetkit_wasm, typeof _rivetkit_rivetkit_wasm>>;
|
|
1551
|
+
initInput: z$2.ZodOptional<z$2.ZodCustom<_rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined, _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined>>;
|
|
1552
|
+
}, z$2.core.$strip>>>;
|
|
1553
|
+
sqlite: z$2.ZodPipe<z$2.ZodOptional<z$2.ZodUnion<readonly [z$2.ZodEnum<{
|
|
1554
|
+
local: "local";
|
|
1555
|
+
remote: "remote";
|
|
1556
|
+
}>, z$2.ZodObject<{
|
|
1557
|
+
backend: z$2.ZodEnum<{
|
|
1558
|
+
local: "local";
|
|
1559
|
+
remote: "remote";
|
|
1560
|
+
}>;
|
|
1561
|
+
}, z$2.core.$strip>]>>, z$2.ZodTransform<{
|
|
1562
|
+
backend: "local" | "remote";
|
|
1563
|
+
} | undefined, "local" | "remote" | {
|
|
1564
|
+
backend: "local" | "remote";
|
|
1565
|
+
} | undefined>>;
|
|
1349
1566
|
noWelcome: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodBoolean>>;
|
|
1350
1567
|
logging: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
1351
1568
|
baseLogger: z$2.ZodOptional<z$2.ZodCustom<Logger, Logger>>;
|
|
@@ -1368,12 +1585,15 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1368
1585
|
httpPort: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1369
1586
|
httpHost: z$2.ZodOptional<z$2.ZodString>;
|
|
1370
1587
|
startEngine: z$2.ZodDefault<z$2.ZodBoolean>;
|
|
1588
|
+
engineHost: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodString>>;
|
|
1589
|
+
enginePort: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1371
1590
|
engineVersion: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodString>>;
|
|
1372
1591
|
configurePool: z$2.ZodOptional<z$2.ZodOptional<z$2.ZodObject<{
|
|
1373
1592
|
name: z$2.ZodOptional<z$2.ZodString>;
|
|
1374
1593
|
url: z$2.ZodString;
|
|
1375
1594
|
headers: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodString>>;
|
|
1376
1595
|
requestLifespan: z$2.ZodOptional<z$2.ZodNumber>;
|
|
1596
|
+
drainGracePeriod: z$2.ZodOptional<z$2.ZodNumber>;
|
|
1377
1597
|
metadata: z$2.ZodOptional<z$2.ZodRecord<z$2.ZodString, z$2.ZodUnknown>>;
|
|
1378
1598
|
metadataPollInterval: z$2.ZodOptional<z$2.ZodNumber>;
|
|
1379
1599
|
drainOnVersionUpgrade: z$2.ZodOptional<z$2.ZodBoolean>;
|
|
@@ -1391,10 +1611,13 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1391
1611
|
envoyKey: z$2.ZodOptional<z$2.ZodString>;
|
|
1392
1612
|
}, z$2.core.$strip>>>;
|
|
1393
1613
|
shutdown: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
1394
|
-
gracePeriodMs: z$2.
|
|
1614
|
+
gracePeriodMs: z$2.ZodOptional<z$2.ZodNumber>;
|
|
1395
1615
|
disableSignalHandlers: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodBoolean>>;
|
|
1396
1616
|
}, z$2.core.$strip>>>;
|
|
1397
1617
|
}, z$2.core.$strip>, z$2.ZodTransform<{
|
|
1618
|
+
sqlite: {
|
|
1619
|
+
backend: "local" | "remote";
|
|
1620
|
+
} | undefined;
|
|
1398
1621
|
endpoint: string | undefined;
|
|
1399
1622
|
namespace: string;
|
|
1400
1623
|
token: string | undefined;
|
|
@@ -1411,9 +1634,15 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1411
1634
|
use: Record<string, AnyActorDefinition>;
|
|
1412
1635
|
test: {
|
|
1413
1636
|
enabled: boolean;
|
|
1637
|
+
sqliteBackend?: "local" | "remote" | undefined;
|
|
1414
1638
|
};
|
|
1415
1639
|
maxIncomingMessageSize: number;
|
|
1416
1640
|
maxOutgoingMessageSize: number;
|
|
1641
|
+
runtime: "auto" | "native" | "wasm";
|
|
1642
|
+
wasm: {
|
|
1643
|
+
bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
|
|
1644
|
+
initInput?: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined;
|
|
1645
|
+
};
|
|
1417
1646
|
noWelcome: boolean;
|
|
1418
1647
|
logging: {
|
|
1419
1648
|
baseLogger?: Logger | undefined;
|
|
@@ -1423,6 +1652,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1423
1652
|
httpBasePath: string;
|
|
1424
1653
|
httpPort: number;
|
|
1425
1654
|
startEngine: boolean;
|
|
1655
|
+
engineHost: string;
|
|
1656
|
+
enginePort: number;
|
|
1426
1657
|
engineVersion: string;
|
|
1427
1658
|
envoy: {
|
|
1428
1659
|
poolName: string;
|
|
@@ -1431,8 +1662,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1431
1662
|
envoyKey?: string | undefined;
|
|
1432
1663
|
};
|
|
1433
1664
|
shutdown: {
|
|
1434
|
-
gracePeriodMs: number;
|
|
1435
1665
|
disableSignalHandlers: boolean;
|
|
1666
|
+
gracePeriodMs?: number | undefined;
|
|
1436
1667
|
};
|
|
1437
1668
|
staticDir?: string | undefined;
|
|
1438
1669
|
httpHost?: string | undefined;
|
|
@@ -1441,6 +1672,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1441
1672
|
name?: string | undefined;
|
|
1442
1673
|
headers?: Record<string, string> | undefined;
|
|
1443
1674
|
requestLifespan?: number | undefined;
|
|
1675
|
+
drainGracePeriod?: number | undefined;
|
|
1444
1676
|
metadata?: Record<string, unknown> | undefined;
|
|
1445
1677
|
metadataPollInterval?: number | undefined;
|
|
1446
1678
|
drainOnVersionUpgrade?: boolean | undefined;
|
|
@@ -1449,9 +1681,18 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1449
1681
|
use: Record<string, AnyActorDefinition>;
|
|
1450
1682
|
test: {
|
|
1451
1683
|
enabled: boolean;
|
|
1684
|
+
sqliteBackend?: "local" | "remote" | undefined;
|
|
1452
1685
|
};
|
|
1453
1686
|
maxIncomingMessageSize: number;
|
|
1454
1687
|
maxOutgoingMessageSize: number;
|
|
1688
|
+
runtime: "auto" | "native" | "wasm";
|
|
1689
|
+
wasm: {
|
|
1690
|
+
bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
|
|
1691
|
+
initInput?: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined;
|
|
1692
|
+
};
|
|
1693
|
+
sqlite: {
|
|
1694
|
+
backend: "local" | "remote";
|
|
1695
|
+
} | undefined;
|
|
1455
1696
|
noWelcome: boolean;
|
|
1456
1697
|
logging: {
|
|
1457
1698
|
baseLogger?: Logger | undefined;
|
|
@@ -1464,6 +1705,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1464
1705
|
httpBasePath: string;
|
|
1465
1706
|
httpPort: number;
|
|
1466
1707
|
startEngine: boolean;
|
|
1708
|
+
engineHost: string;
|
|
1709
|
+
enginePort: number;
|
|
1467
1710
|
engineVersion: string;
|
|
1468
1711
|
serverless: {
|
|
1469
1712
|
basePath: string;
|
|
@@ -1478,8 +1721,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1478
1721
|
envoyKey?: string | undefined;
|
|
1479
1722
|
};
|
|
1480
1723
|
shutdown: {
|
|
1481
|
-
gracePeriodMs: number;
|
|
1482
1724
|
disableSignalHandlers: boolean;
|
|
1725
|
+
gracePeriodMs?: number | undefined;
|
|
1483
1726
|
};
|
|
1484
1727
|
staticDir?: string | undefined;
|
|
1485
1728
|
httpHost?: string | undefined;
|
|
@@ -1488,6 +1731,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1488
1731
|
name?: string | undefined;
|
|
1489
1732
|
headers?: Record<string, string> | undefined;
|
|
1490
1733
|
requestLifespan?: number | undefined;
|
|
1734
|
+
drainGracePeriod?: number | undefined;
|
|
1491
1735
|
metadata?: Record<string, unknown> | undefined;
|
|
1492
1736
|
metadataPollInterval?: number | undefined;
|
|
1493
1737
|
drainOnVersionUpgrade?: boolean | undefined;
|
|
@@ -1498,15 +1742,459 @@ type RegistryConfigInput<A extends RegistryActors> = Omit<z$2.input<typeof Regis
|
|
|
1498
1742
|
use: A;
|
|
1499
1743
|
};
|
|
1500
1744
|
|
|
1745
|
+
declare const handleBrand: unique symbol;
|
|
1746
|
+
type OpaqueHandle<Name extends string> = {
|
|
1747
|
+
readonly [handleBrand]: Name;
|
|
1748
|
+
};
|
|
1749
|
+
type RegistryHandle = OpaqueHandle<"registry">;
|
|
1750
|
+
type ActorFactoryHandle = OpaqueHandle<"actorFactory">;
|
|
1751
|
+
type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
1752
|
+
type ConnHandle = OpaqueHandle<"conn">;
|
|
1753
|
+
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
1754
|
+
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
1755
|
+
type SqliteTransactionHandle = OpaqueHandle<"sqliteTransaction">;
|
|
1756
|
+
type RuntimeBytes = Uint8Array;
|
|
1757
|
+
interface RuntimeActorKeySegment {
|
|
1758
|
+
kind: string;
|
|
1759
|
+
stringValue?: string;
|
|
1760
|
+
numberValue?: number;
|
|
1761
|
+
}
|
|
1762
|
+
interface RuntimeHttpRequest {
|
|
1763
|
+
method: string;
|
|
1764
|
+
uri: string;
|
|
1765
|
+
headers?: Record<string, string>;
|
|
1766
|
+
body?: RuntimeBytes;
|
|
1767
|
+
}
|
|
1768
|
+
interface RuntimeHttpResponseBodyStream {
|
|
1769
|
+
cancelled(): Promise<void>;
|
|
1770
|
+
write(chunk: Uint8Array): Promise<void>;
|
|
1771
|
+
end(): Promise<void>;
|
|
1772
|
+
error(message: string): Promise<void>;
|
|
1773
|
+
}
|
|
1774
|
+
interface RuntimeStateDeltaPayload {
|
|
1775
|
+
state?: RuntimeBytes;
|
|
1776
|
+
connHibernation: Array<{
|
|
1777
|
+
connId: string;
|
|
1778
|
+
bytes: RuntimeBytes;
|
|
1779
|
+
}>;
|
|
1780
|
+
connHibernationRemoved: string[];
|
|
1781
|
+
}
|
|
1782
|
+
interface RuntimeWorkflowKvWrite {
|
|
1783
|
+
key: RuntimeBytes;
|
|
1784
|
+
value: RuntimeBytes;
|
|
1785
|
+
}
|
|
1786
|
+
interface RuntimeRequestSaveOpts {
|
|
1787
|
+
immediate?: boolean;
|
|
1788
|
+
maxWaitMs?: number;
|
|
1789
|
+
}
|
|
1790
|
+
interface RuntimeInspectorSnapshot {
|
|
1791
|
+
stateRevision: number;
|
|
1792
|
+
connectionsRevision: number;
|
|
1793
|
+
queueRevision: number;
|
|
1794
|
+
activeConnections: number;
|
|
1795
|
+
queueSize: number;
|
|
1796
|
+
connectedClients: number;
|
|
1797
|
+
}
|
|
1798
|
+
interface RuntimeQueueMessage {
|
|
1799
|
+
id(): bigint;
|
|
1800
|
+
name(): string;
|
|
1801
|
+
body(): RuntimeBytes;
|
|
1802
|
+
createdAt(): number;
|
|
1803
|
+
isCompletable(): boolean;
|
|
1804
|
+
complete(response?: RuntimeBytes | undefined | null): Promise<void>;
|
|
1805
|
+
}
|
|
1806
|
+
interface RuntimeQueueInspectMessage {
|
|
1807
|
+
id: number;
|
|
1808
|
+
name: string;
|
|
1809
|
+
createdAtMs: number;
|
|
1810
|
+
}
|
|
1811
|
+
interface RuntimeScheduledEventInfo {
|
|
1812
|
+
id: string;
|
|
1813
|
+
action: string;
|
|
1814
|
+
args: RuntimeBytes;
|
|
1815
|
+
runAt: number;
|
|
1816
|
+
}
|
|
1817
|
+
interface RuntimeCronJobInfo {
|
|
1818
|
+
name: string;
|
|
1819
|
+
kind: "cron" | "every";
|
|
1820
|
+
action: string;
|
|
1821
|
+
args: RuntimeBytes;
|
|
1822
|
+
nextRunAt: number;
|
|
1823
|
+
lastRunAt?: number;
|
|
1824
|
+
expression?: string;
|
|
1825
|
+
timezone?: string;
|
|
1826
|
+
intervalMs?: number;
|
|
1827
|
+
maxHistory: number;
|
|
1828
|
+
}
|
|
1829
|
+
interface RuntimeScheduleErrorInfo {
|
|
1830
|
+
group: string;
|
|
1831
|
+
code: string;
|
|
1832
|
+
message: string;
|
|
1833
|
+
metadata?: unknown;
|
|
1834
|
+
}
|
|
1835
|
+
interface RuntimeCronFire {
|
|
1836
|
+
action: string;
|
|
1837
|
+
scheduledAt: number;
|
|
1838
|
+
firedAt: number;
|
|
1839
|
+
finishedAt?: number;
|
|
1840
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
1841
|
+
error?: RuntimeScheduleErrorInfo;
|
|
1842
|
+
}
|
|
1843
|
+
interface RuntimeQueueNextBatchOptions {
|
|
1844
|
+
names?: string[];
|
|
1845
|
+
count?: number;
|
|
1846
|
+
timeoutMs?: number;
|
|
1847
|
+
completable?: boolean;
|
|
1848
|
+
}
|
|
1849
|
+
interface RuntimeQueueWaitOptions {
|
|
1850
|
+
timeoutMs?: number;
|
|
1851
|
+
completable?: boolean;
|
|
1852
|
+
}
|
|
1853
|
+
interface RuntimeQueueEnqueueAndWaitOptions {
|
|
1854
|
+
timeoutMs?: number;
|
|
1855
|
+
}
|
|
1856
|
+
interface RuntimeQueueTryNextBatchOptions {
|
|
1857
|
+
names?: string[];
|
|
1858
|
+
count?: number;
|
|
1859
|
+
completable?: boolean;
|
|
1860
|
+
}
|
|
1861
|
+
interface RuntimeKvListOptions {
|
|
1862
|
+
reverse?: boolean;
|
|
1863
|
+
limit?: number;
|
|
1864
|
+
}
|
|
1865
|
+
interface RuntimeKvEntry {
|
|
1866
|
+
key: RuntimeBytes;
|
|
1867
|
+
value: RuntimeBytes;
|
|
1868
|
+
}
|
|
1869
|
+
type RuntimeSqlBindNoValues = {
|
|
1870
|
+
intValue?: never;
|
|
1871
|
+
floatValue?: never;
|
|
1872
|
+
textValue?: never;
|
|
1873
|
+
blobValue?: never;
|
|
1874
|
+
};
|
|
1875
|
+
type RuntimeSqlBindParam = ({
|
|
1876
|
+
kind: "null";
|
|
1877
|
+
} & RuntimeSqlBindNoValues) | {
|
|
1878
|
+
kind: "int";
|
|
1879
|
+
intValue: number;
|
|
1880
|
+
floatValue?: never;
|
|
1881
|
+
textValue?: never;
|
|
1882
|
+
blobValue?: never;
|
|
1883
|
+
} | {
|
|
1884
|
+
kind: "float";
|
|
1885
|
+
intValue?: never;
|
|
1886
|
+
floatValue: number;
|
|
1887
|
+
textValue?: never;
|
|
1888
|
+
blobValue?: never;
|
|
1889
|
+
} | {
|
|
1890
|
+
kind: "text";
|
|
1891
|
+
intValue?: never;
|
|
1892
|
+
floatValue?: never;
|
|
1893
|
+
textValue: string;
|
|
1894
|
+
blobValue?: never;
|
|
1895
|
+
} | {
|
|
1896
|
+
kind: "blob";
|
|
1897
|
+
intValue?: never;
|
|
1898
|
+
floatValue?: never;
|
|
1899
|
+
textValue?: never;
|
|
1900
|
+
blobValue: RuntimeBytes;
|
|
1901
|
+
};
|
|
1902
|
+
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
1903
|
+
interface RuntimeActorRuntimeSocketEndpointInfo {
|
|
1904
|
+
path: string;
|
|
1905
|
+
}
|
|
1906
|
+
interface RuntimeSqlQueryResult {
|
|
1907
|
+
columns: string[];
|
|
1908
|
+
rows: unknown[][];
|
|
1909
|
+
}
|
|
1910
|
+
type RuntimeSqlExecResult = RuntimeSqlQueryResult;
|
|
1911
|
+
interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
1912
|
+
changes: number;
|
|
1913
|
+
lastInsertRowId?: number | null;
|
|
1914
|
+
}
|
|
1915
|
+
interface RuntimeSqlBatchStatement {
|
|
1916
|
+
sql: string;
|
|
1917
|
+
params?: RuntimeSqlBindParams;
|
|
1918
|
+
}
|
|
1919
|
+
interface RuntimeSqlRunResult {
|
|
1920
|
+
changes: number;
|
|
1921
|
+
}
|
|
1922
|
+
interface RuntimeActorConfig {
|
|
1923
|
+
name?: string;
|
|
1924
|
+
icon?: string;
|
|
1925
|
+
hasDatabase?: boolean;
|
|
1926
|
+
remoteSqlite?: boolean;
|
|
1927
|
+
enableActorRuntimeSocket?: boolean;
|
|
1928
|
+
hasState?: boolean;
|
|
1929
|
+
canHibernateWebsocket?: boolean;
|
|
1930
|
+
stateSaveIntervalMs?: number;
|
|
1931
|
+
createStateTimeoutMs?: number;
|
|
1932
|
+
onCreateTimeoutMs?: number;
|
|
1933
|
+
createVarsTimeoutMs?: number;
|
|
1934
|
+
createConnStateTimeoutMs?: number;
|
|
1935
|
+
onBeforeConnectTimeoutMs?: number;
|
|
1936
|
+
onConnectTimeoutMs?: number;
|
|
1937
|
+
onMigrateTimeoutMs?: number;
|
|
1938
|
+
onWakeTimeoutMs?: number;
|
|
1939
|
+
onBeforeActorStartTimeoutMs?: number;
|
|
1940
|
+
actionTimeoutMs?: number;
|
|
1941
|
+
onRequestTimeoutMs?: number;
|
|
1942
|
+
sleepTimeoutMs?: number;
|
|
1943
|
+
noSleep?: boolean;
|
|
1944
|
+
sleepGracePeriodMs?: number;
|
|
1945
|
+
connectionLivenessTimeoutMs?: number;
|
|
1946
|
+
connectionLivenessIntervalMs?: number;
|
|
1947
|
+
maxQueueSize?: number;
|
|
1948
|
+
maxSchedules?: number;
|
|
1949
|
+
maxQueueMessageSize?: number;
|
|
1950
|
+
maxIncomingMessageSize?: number;
|
|
1951
|
+
maxOutgoingMessageSize?: number;
|
|
1952
|
+
preloadMaxWorkflowBytes?: number;
|
|
1953
|
+
preloadMaxConnectionsBytes?: number;
|
|
1954
|
+
actions?: Array<{
|
|
1955
|
+
name: string;
|
|
1956
|
+
}>;
|
|
1957
|
+
inspectorTabs?: Array<RuntimeInspectorTabEntry>;
|
|
1958
|
+
}
|
|
1959
|
+
interface RuntimeInspectorTabEntry {
|
|
1960
|
+
id: string;
|
|
1961
|
+
/** Required for custom entries; omitted for built-in hides. */
|
|
1962
|
+
label?: string;
|
|
1963
|
+
/**
|
|
1964
|
+
* Required for custom entries — absolute path to the source directory.
|
|
1965
|
+
* Resolved on the TS side before being handed to the runtime.
|
|
1966
|
+
*/
|
|
1967
|
+
source?: string;
|
|
1968
|
+
/** Optional icon id for custom entries. */
|
|
1969
|
+
icon?: string;
|
|
1970
|
+
/** Set to true for built-in hide entries. */
|
|
1971
|
+
hidden?: boolean;
|
|
1972
|
+
}
|
|
1973
|
+
interface RuntimeServeConfig {
|
|
1974
|
+
version: number;
|
|
1975
|
+
endpoint: string;
|
|
1976
|
+
token?: string;
|
|
1977
|
+
namespace: string;
|
|
1978
|
+
poolName: string;
|
|
1979
|
+
engineBinaryPath?: string;
|
|
1980
|
+
engineHost?: string;
|
|
1981
|
+
enginePort?: number;
|
|
1982
|
+
handleInspectorHttpInRuntime?: boolean;
|
|
1983
|
+
inspectorTestToken?: string;
|
|
1984
|
+
serverlessBasePath?: string;
|
|
1985
|
+
serverlessPackageVersion: string;
|
|
1986
|
+
serverlessClientEndpoint?: string;
|
|
1987
|
+
serverlessClientNamespace?: string;
|
|
1988
|
+
serverlessClientToken?: string;
|
|
1989
|
+
serverlessValidateEndpoint: boolean;
|
|
1990
|
+
serverlessMaxStartPayloadBytes: number;
|
|
1991
|
+
}
|
|
1992
|
+
interface RuntimeListenerConfig {
|
|
1993
|
+
port: number;
|
|
1994
|
+
host?: string;
|
|
1995
|
+
publicDir?: string;
|
|
1996
|
+
application?: RuntimeApplicationFetch;
|
|
1997
|
+
}
|
|
1998
|
+
interface RuntimeServerlessRequest {
|
|
1999
|
+
method: string;
|
|
2000
|
+
url: string;
|
|
2001
|
+
headers: Record<string, string>;
|
|
2002
|
+
body: RuntimeBytes;
|
|
2003
|
+
}
|
|
2004
|
+
interface RuntimeApplicationRequest extends RuntimeServerlessRequest {
|
|
2005
|
+
cancelToken?: CancellationTokenHandle;
|
|
2006
|
+
}
|
|
2007
|
+
interface RuntimeApplicationResponse {
|
|
2008
|
+
status: number;
|
|
2009
|
+
headers: Record<string, string>;
|
|
2010
|
+
body?: RuntimeBytes;
|
|
2011
|
+
stream?: boolean;
|
|
2012
|
+
}
|
|
2013
|
+
type RuntimeApplicationFetch = (request: RuntimeApplicationRequest, responseBodyStream?: RuntimeHttpResponseBodyStream) => Promise<RuntimeApplicationResponse>;
|
|
2014
|
+
interface RuntimeApplicationListenerConfig extends RuntimeListenerConfig {
|
|
2015
|
+
application: RuntimeApplicationFetch;
|
|
2016
|
+
}
|
|
2017
|
+
interface RuntimeServerlessResponseHead {
|
|
2018
|
+
status: number;
|
|
2019
|
+
headers: Record<string, string>;
|
|
2020
|
+
}
|
|
2021
|
+
interface RuntimeRegistryRouteResponse {
|
|
2022
|
+
status: number;
|
|
2023
|
+
headers: Record<string, string>;
|
|
2024
|
+
body: RuntimeBytes;
|
|
2025
|
+
}
|
|
2026
|
+
type RuntimeServerlessStreamEvent = {
|
|
2027
|
+
kind: "chunk";
|
|
2028
|
+
chunk?: RuntimeBytes;
|
|
2029
|
+
} | {
|
|
2030
|
+
kind: "end";
|
|
2031
|
+
error?: {
|
|
2032
|
+
group: string;
|
|
2033
|
+
code: string;
|
|
2034
|
+
message: string;
|
|
2035
|
+
};
|
|
2036
|
+
};
|
|
2037
|
+
type RuntimeServerlessStreamCallback = (error: unknown, event?: RuntimeServerlessStreamEvent) => unknown;
|
|
2038
|
+
type RuntimeWebSocketEvent = {
|
|
2039
|
+
kind: "message";
|
|
2040
|
+
data: string | RuntimeBytes;
|
|
2041
|
+
binary: boolean;
|
|
2042
|
+
messageIndex?: number;
|
|
2043
|
+
} | {
|
|
2044
|
+
kind: "close";
|
|
2045
|
+
code: number;
|
|
2046
|
+
reason: string;
|
|
2047
|
+
wasClean: boolean;
|
|
2048
|
+
};
|
|
2049
|
+
interface CoreRuntime {
|
|
2050
|
+
readonly kind: "napi" | "wasm";
|
|
2051
|
+
createRegistry(): RegistryHandle;
|
|
2052
|
+
registerActor(registry: RegistryHandle, name: string, factory: ActorFactoryHandle): void;
|
|
2053
|
+
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
2054
|
+
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
2055
|
+
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
2056
|
+
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
2057
|
+
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
2058
|
+
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
2059
|
+
serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
2060
|
+
registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
2061
|
+
registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
2062
|
+
registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
2063
|
+
createActorFactory(callbacks: object, config?: RuntimeActorConfig | undefined | null): ActorFactoryHandle;
|
|
2064
|
+
createCancellationToken(): CancellationTokenHandle;
|
|
2065
|
+
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
2066
|
+
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
2067
|
+
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
|
|
2068
|
+
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
2069
|
+
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
2070
|
+
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
2071
|
+
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
2072
|
+
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
2073
|
+
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
2074
|
+
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
2075
|
+
actorDecodeInspectorRequest(ctx: ActorContextHandle, bytes: RuntimeBytes, advertisedVersion: number): RuntimeBytes;
|
|
2076
|
+
actorEncodeInspectorResponse(ctx: ActorContextHandle, bytes: RuntimeBytes, targetVersion: number): RuntimeBytes;
|
|
2077
|
+
actorVerifyInspectorAuth(ctx: ActorContextHandle, bearerToken?: string | undefined | null): Promise<void>;
|
|
2078
|
+
actorQueueHibernationRemoval(ctx: ActorContextHandle, connId: string): void;
|
|
2079
|
+
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
2080
|
+
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
2081
|
+
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
2082
|
+
actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
|
|
2083
|
+
actorId(ctx: ActorContextHandle): string;
|
|
2084
|
+
actorName(ctx: ActorContextHandle): string;
|
|
2085
|
+
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
2086
|
+
actorRegion(ctx: ActorContextHandle): string;
|
|
2087
|
+
actorSleep(ctx: ActorContextHandle): void;
|
|
2088
|
+
actorDestroy(ctx: ActorContextHandle): void;
|
|
2089
|
+
actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
|
|
2090
|
+
actorConns(ctx: ActorContextHandle): ConnHandle[];
|
|
2091
|
+
actorConnectConn(ctx: ActorContextHandle, params: RuntimeBytes, request?: RuntimeHttpRequest | undefined | null): Promise<ConnHandle>;
|
|
2092
|
+
actorBroadcast(ctx: ActorContextHandle, name: string, args: RuntimeBytes): void;
|
|
2093
|
+
actorWaitUntil(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
2094
|
+
actorWaitForTrackedShutdownWork(ctx: ActorContextHandle): Promise<boolean>;
|
|
2095
|
+
actorWaitForTrackedShutdownWorkUnbounded(ctx: ActorContextHandle): Promise<void>;
|
|
2096
|
+
actorKeepAwake(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
2097
|
+
actorBeginKeepAwake(ctx: ActorContextHandle): number;
|
|
2098
|
+
actorEndKeepAwake(ctx: ActorContextHandle, regionId: number): void;
|
|
2099
|
+
actorRegisterTask(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
2100
|
+
actorRuntimeState(ctx: ActorContextHandle): object;
|
|
2101
|
+
actorClearRuntimeState(ctx: ActorContextHandle): void;
|
|
2102
|
+
actorRestartRunHandler(ctx: ActorContextHandle): void;
|
|
2103
|
+
actorBeginWebsocketCallback(ctx: ActorContextHandle): number;
|
|
2104
|
+
actorEndWebsocketCallback(ctx: ActorContextHandle, regionId: number): void;
|
|
2105
|
+
actorKvGet(ctx: ActorContextHandle, key: RuntimeBytes): Promise<RuntimeBytes | null>;
|
|
2106
|
+
actorKvPut(ctx: ActorContextHandle, key: RuntimeBytes, value: RuntimeBytes): Promise<void>;
|
|
2107
|
+
actorKvDelete(ctx: ActorContextHandle, key: RuntimeBytes): Promise<void>;
|
|
2108
|
+
actorKvDeleteRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes): Promise<void>;
|
|
2109
|
+
actorKvListPrefix(ctx: ActorContextHandle, prefix: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
2110
|
+
actorKvListRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
2111
|
+
actorKvBatchGet(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<Array<RuntimeBytes | undefined | null>>;
|
|
2112
|
+
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
2113
|
+
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
2114
|
+
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
2115
|
+
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
2116
|
+
actorSqlExecuteBatch(ctx: ActorContextHandle, statements: RuntimeSqlBatchStatement[]): Promise<RuntimeSqlExecuteResult[]>;
|
|
2117
|
+
actorSqlBeginTransaction(ctx: ActorContextHandle, timeoutMs?: number): Promise<SqliteTransactionHandle>;
|
|
2118
|
+
actorSqlTransactionExec(transaction: SqliteTransactionHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
2119
|
+
actorSqlTransactionExecute(transaction: SqliteTransactionHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
2120
|
+
actorSqlTransactionCommit(transaction: SqliteTransactionHandle): Promise<void>;
|
|
2121
|
+
actorSqlTransactionRollback(transaction: SqliteTransactionHandle): Promise<void>;
|
|
2122
|
+
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
2123
|
+
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
2124
|
+
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
2125
|
+
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
2126
|
+
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
2127
|
+
actorRuntimeSocketProvision(ctx: ActorContextHandle): Promise<RuntimeActorRuntimeSocketEndpointInfo>;
|
|
2128
|
+
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
2129
|
+
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
2130
|
+
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
2131
|
+
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
2132
|
+
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
2133
|
+
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
2134
|
+
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
2135
|
+
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
2136
|
+
actorQueueReset(ctx: ActorContextHandle): Promise<void>;
|
|
2137
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
|
|
2138
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): Promise<string>;
|
|
2139
|
+
actorScheduleCancel(ctx: ActorContextHandle, id: string): Promise<boolean>;
|
|
2140
|
+
actorScheduleGet(ctx: ActorContextHandle, id: string): Promise<RuntimeScheduledEventInfo | undefined>;
|
|
2141
|
+
actorScheduleList(ctx: ActorContextHandle): Promise<RuntimeScheduledEventInfo[]>;
|
|
2142
|
+
actorCronSet(ctx: ActorContextHandle, name: string, expression: string, timezone: string | undefined, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
|
|
2143
|
+
actorCronEvery(ctx: ActorContextHandle, name: string, intervalMs: number, actionName: string, args: RuntimeBytes, maxHistory: number | undefined): Promise<void>;
|
|
2144
|
+
actorCronGet(ctx: ActorContextHandle, name: string): Promise<RuntimeCronJobInfo | undefined>;
|
|
2145
|
+
actorCronList(ctx: ActorContextHandle): Promise<RuntimeCronJobInfo[]>;
|
|
2146
|
+
actorCronDelete(ctx: ActorContextHandle, name: string): Promise<boolean>;
|
|
2147
|
+
actorCronHistory(ctx: ActorContextHandle, name: string, limit: number | undefined): Promise<RuntimeCronFire[]>;
|
|
2148
|
+
connId(conn: ConnHandle): string;
|
|
2149
|
+
connParams(conn: ConnHandle): RuntimeBytes;
|
|
2150
|
+
connState(conn: ConnHandle): RuntimeBytes;
|
|
2151
|
+
connSetState(conn: ConnHandle, state: RuntimeBytes): void;
|
|
2152
|
+
connIsHibernatable(conn: ConnHandle): boolean;
|
|
2153
|
+
connSend(conn: ConnHandle, name: string, args: RuntimeBytes): void;
|
|
2154
|
+
connDisconnect(conn: ConnHandle, reason?: string | undefined | null): Promise<void>;
|
|
2155
|
+
webSocketSend(ws: WebSocketHandle, data: RuntimeBytes, binary: boolean): void;
|
|
2156
|
+
webSocketClose(ws: WebSocketHandle, code?: number | undefined | null, reason?: string | undefined | null): Promise<void>;
|
|
2157
|
+
webSocketSetEventCallback(ws: WebSocketHandle, callback: (event: RuntimeWebSocketEvent) => void): void;
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
declare function buildConfiguredRegistry(config: RegistryConfig): Promise<{
|
|
2161
|
+
runtime: CoreRuntime;
|
|
2162
|
+
registry: RegistryHandle;
|
|
2163
|
+
serveConfig: RuntimeServeConfig;
|
|
2164
|
+
}>;
|
|
2165
|
+
|
|
1501
2166
|
type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
1502
2167
|
interface ServerlessHandler {
|
|
1503
2168
|
fetch: FetchHandler;
|
|
1504
2169
|
}
|
|
2170
|
+
interface RegistryApplication {
|
|
2171
|
+
fetch: FetchHandler;
|
|
2172
|
+
}
|
|
2173
|
+
interface RegistryListenOptions {
|
|
2174
|
+
port?: number;
|
|
2175
|
+
host?: string;
|
|
2176
|
+
publicDir?: string;
|
|
2177
|
+
application?: RegistryApplication;
|
|
2178
|
+
}
|
|
2179
|
+
interface RegistryRoutes {
|
|
2180
|
+
health(): Promise<Response>;
|
|
2181
|
+
metadata(): Promise<Response>;
|
|
2182
|
+
prometheusMetrics(request?: Request): Promise<Response>;
|
|
2183
|
+
}
|
|
2184
|
+
/**
|
|
2185
|
+
* Injectable dependencies for {@link Registry}. Production code uses the
|
|
2186
|
+
* defaults. Tests override `buildConfiguredRegistry` to drive lifecycle
|
|
2187
|
+
* orchestration against a fake `CoreRuntime` without an engine.
|
|
2188
|
+
*/
|
|
2189
|
+
interface RegistryDeps {
|
|
2190
|
+
buildConfiguredRegistry: typeof buildConfiguredRegistry;
|
|
2191
|
+
}
|
|
1505
2192
|
declare class Registry<A extends RegistryActors> {
|
|
1506
2193
|
#private;
|
|
2194
|
+
readonly routes: RegistryRoutes;
|
|
1507
2195
|
get config(): RegistryConfigInput<A>;
|
|
1508
2196
|
parseConfig(): RegistryConfig;
|
|
1509
|
-
constructor(config: RegistryConfigInput<A>);
|
|
2197
|
+
constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>);
|
|
1510
2198
|
/**
|
|
1511
2199
|
* Handle an incoming HTTP request for serverless deployments.
|
|
1512
2200
|
*
|
|
@@ -1527,9 +2215,63 @@ declare class Registry<A extends RegistryActors> {
|
|
|
1527
2215
|
* ```
|
|
1528
2216
|
*/
|
|
1529
2217
|
serve(): ServerlessHandler;
|
|
2218
|
+
/**
|
|
2219
|
+
* Bind an HTTP listener provided by the native (Rust) runtime and serve
|
|
2220
|
+
* the registry's serverless endpoints over it. Resolves only after the
|
|
2221
|
+
* registry is shut down (SIGINT/SIGTERM or `nativeRegistry.shutdown()`).
|
|
2222
|
+
*
|
|
2223
|
+
* @param opts.port Port to listen on. Defaults to `process.env.RIVET_PORT`
|
|
2224
|
+
* if set, otherwise 3000.
|
|
2225
|
+
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
2226
|
+
* @param opts.publicDir If set, serves static files from this directory
|
|
2227
|
+
* as a fallback below the framework routes.
|
|
2228
|
+
* @param opts.application If set, handles requests that do not match a
|
|
2229
|
+
* framework route.
|
|
2230
|
+
*
|
|
2231
|
+
* @example
|
|
2232
|
+
* ```ts
|
|
2233
|
+
* await registry.listen();
|
|
2234
|
+
* await registry.listen({ application: app });
|
|
2235
|
+
* ```
|
|
2236
|
+
*/
|
|
2237
|
+
listen(opts?: RegistryListenOptions): Promise<void>;
|
|
2238
|
+
/**
|
|
2239
|
+
* Gracefully drains all live registries.
|
|
2240
|
+
*
|
|
2241
|
+
* Programmatic counterpart to the SIGINT/SIGTERM handlers: tears down
|
|
2242
|
+
* every live `CoreRegistry` (both `start()` and `handler()` modes) and
|
|
2243
|
+
* waits for the serve promise to resolve, all bounded by the shutdown
|
|
2244
|
+
* grace period. Unlike a signal-driven shutdown, this does not re-raise a
|
|
2245
|
+
* signal or exit the process. The caller owns process lifetime.
|
|
2246
|
+
*
|
|
2247
|
+
* Idempotent: concurrent or repeated calls share a single drain. Safe to
|
|
2248
|
+
* call even if nothing has been started.
|
|
2249
|
+
*
|
|
2250
|
+
* @example
|
|
2251
|
+
* ```ts
|
|
2252
|
+
* const registry = setup({ use: { counter } });
|
|
2253
|
+
* registry.start();
|
|
2254
|
+
* // ...later, on your own shutdown trigger:
|
|
2255
|
+
* await registry.shutdown();
|
|
2256
|
+
* ```
|
|
2257
|
+
*/
|
|
2258
|
+
shutdown(): Promise<void>;
|
|
1530
2259
|
startEnvoy(): void;
|
|
1531
2260
|
/**
|
|
1532
|
-
* Starts the
|
|
2261
|
+
* Starts the serverful registry if needed and waits until its envoy has
|
|
2262
|
+
* registered with the Engine. Repeated and concurrent calls share one
|
|
2263
|
+
* startup lifecycle and readiness promise.
|
|
2264
|
+
*
|
|
2265
|
+
* Unlike {@link start}, this reports startup failures and does not resolve
|
|
2266
|
+
* merely because an HTTP health endpoint is listening.
|
|
2267
|
+
*/
|
|
2268
|
+
startAndWait(): Promise<void>;
|
|
2269
|
+
/**
|
|
2270
|
+
* Starts the actor envoy for standalone server deployments.
|
|
2271
|
+
*
|
|
2272
|
+
* Set `RIVETKIT_RUNTIME_MODE=serverless` to instead bind an HTTP listener
|
|
2273
|
+
* via `listen()` (Mode B). Mode A (envoy) and Mode B (listener) are
|
|
2274
|
+
* mutually exclusive per registry instance.
|
|
1533
2275
|
*
|
|
1534
2276
|
* @example
|
|
1535
2277
|
* ```ts
|
|
@@ -1545,4 +2287,4 @@ declare class Registry<A extends RegistryActors> {
|
|
|
1545
2287
|
*/
|
|
1546
2288
|
declare function createClient<A extends Registry<any>>(endpointOrConfig?: string | ClientConfigInput): Client<A>;
|
|
1547
2289
|
|
|
1548
|
-
export { type ActorAccessor, type ActorActionFunction, ActorClientError, type ActorConn, ActorConnDisposed, ActorConnRaw, type ActorConnStatus, ActorDefinition, RivetError as ActorError, type ActorHandle, ActorHandleRaw, type AnyActorDefinition, type Client, type ClientConfigInput, ClientRaw, type ConnectionStateCallback, type CreateOptions, type CreateRequest, type Encoding, type EventUnsubscribe, type ExtractActorsFromRegistry, type ExtractRegistryFromClient, type GetOptions, type GetWithIdOptions, MalformedResponseMessage, ManagerError, type QueryOptions, type Region, RivetError, type StatusChangeCallback, UserError, createClient };
|
|
2290
|
+
export { type ActorAccessor, type ActorActionFunction, type ActorActionOptions, ActorClientError, type ActorConn, ActorConnDisposed, ActorConnRaw, type ActorConnStatus, type ActorConnectOptions, ActorDefinition, RivetError as ActorError, type ActorGatewayOptions, type ActorHandle, ActorHandleRaw, type AnyActorDefinition, type Client, type ClientConfigInput, ClientRaw, type ConnectionStateCallback, type CreateOptions, type CreateRequest, type Encoding, type EventUnsubscribe, type ExtractActorsFromRegistry, type ExtractRegistryFromClient, type GetOptions, type GetWithIdOptions, MalformedResponseMessage, ManagerError, type QueryOptions, type Region, RivetError, type StatusChangeCallback, UserError, createClient };
|