rivetkit 2.3.0-rc.8 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +481 -74
- package/dist/browser/client.js +174 -148
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +47 -18
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/agent-os/index.cjs +2160 -2086
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +479 -73
- package/dist/tsup/agent-os/index.d.ts +479 -73
- package/dist/tsup/agent-os/index.js +2160 -2086
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-KY3CERZR.js → chunk-2OTRTA3J.js} +7 -21
- package/dist/tsup/chunk-2OTRTA3J.js.map +1 -0
- package/dist/tsup/{chunk-HGW6PBWR.cjs → chunk-3677IIOV.cjs} +11 -25
- package/dist/tsup/chunk-3677IIOV.cjs.map +1 -0
- package/dist/tsup/{chunk-OT7FF6GB.cjs → chunk-47HHIEXH.cjs} +24 -9
- package/dist/tsup/chunk-47HHIEXH.cjs.map +1 -0
- package/dist/tsup/{chunk-EMFKMVJR.js → chunk-4JDSFJS5.js} +69 -58
- package/dist/tsup/chunk-4JDSFJS5.js.map +1 -0
- package/dist/tsup/{chunk-7HLFSAJP.cjs → chunk-7QKCIVAY.cjs} +225 -214
- package/dist/tsup/chunk-7QKCIVAY.cjs.map +1 -0
- package/dist/tsup/{chunk-AWTPTUQ7.cjs → chunk-B6VUNZUD.cjs} +10 -10
- package/dist/tsup/{chunk-AWTPTUQ7.cjs.map → chunk-B6VUNZUD.cjs.map} +1 -1
- package/dist/tsup/{chunk-D3T3ZBSY.js → chunk-BEI24WTI.js} +2 -2
- package/dist/tsup/{chunk-TMLOKTRB.js → chunk-BRP62GZC.js} +1 -1
- package/dist/tsup/chunk-BRP62GZC.js.map +1 -0
- package/dist/tsup/{chunk-D5G75T7J.js → chunk-DPIMKYNB.js} +61 -2
- package/dist/tsup/chunk-DPIMKYNB.js.map +1 -0
- package/dist/tsup/{chunk-BATTOVHF.cjs → chunk-DXXJPH55.cjs} +40 -13
- package/dist/tsup/chunk-DXXJPH55.cjs.map +1 -0
- package/dist/tsup/{chunk-3YY5S6TV.js → chunk-HXUEHHJF.js} +2 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-4BPKKZJO.cjs → chunk-I4LN3FNT.cjs} +10 -10
- package/dist/tsup/chunk-I4LN3FNT.cjs.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
- package/dist/tsup/{chunk-63WNTDRC.cjs → chunk-KORQB2IR.cjs} +1 -1
- package/dist/tsup/{chunk-63WNTDRC.cjs.map → chunk-KORQB2IR.cjs.map} +1 -1
- package/dist/tsup/{chunk-6TQSSJ4F.cjs → chunk-LVTBW2RE.cjs} +3 -3
- package/dist/tsup/{chunk-6TQSSJ4F.cjs.map → chunk-LVTBW2RE.cjs.map} +1 -1
- package/dist/tsup/{chunk-4JU3IPG2.js → chunk-MEHBWPLJ.js} +6 -6
- package/dist/tsup/chunk-MEHBWPLJ.js.map +1 -0
- package/dist/tsup/{chunk-SRNOPUC6.cjs → chunk-NIY3RSPX.cjs} +62 -3
- package/dist/tsup/chunk-NIY3RSPX.cjs.map +1 -0
- package/dist/tsup/{chunk-UZXQEGVJ.js → chunk-P2GNQ4RN.js} +4 -4
- package/dist/tsup/{chunk-UZXQEGVJ.js.map → chunk-P2GNQ4RN.js.map} +1 -1
- package/dist/tsup/{chunk-VUGENVIK.js → chunk-UMZVD6DQ.js} +22 -7
- package/dist/tsup/chunk-UMZVD6DQ.js.map +1 -0
- package/dist/tsup/{chunk-LD5YASJU.cjs → chunk-VE2X4KMG.cjs} +2 -2
- package/dist/tsup/{chunk-LD5YASJU.cjs.map → chunk-VE2X4KMG.cjs.map} +1 -1
- package/dist/tsup/{chunk-GBG63SUG.js → chunk-VTTFNQQI.js} +32 -5
- package/dist/tsup/chunk-VTTFNQQI.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.d.cts +5 -5
- package/dist/tsup/client/mod.d.ts +5 -5
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Ak1lv4gF.d.ts → config-BxWAw3iH.d.ts} +512 -27
- package/dist/tsup/{config-DU_xj4qZ.d.cts → config-CZQQ-mso.d.cts} +512 -27
- package/dist/tsup/{config-CxjGYf4K.d.ts → config-D49x8NpL.d.cts} +1 -2
- package/dist/tsup/{config-CxjGYf4K.d.cts → config-D49x8NpL.d.ts} +1 -2
- package/dist/tsup/{context-DAAp4Lpg.d.ts → context-Bw7xq8w3.d.cts} +8 -8
- package/dist/tsup/{context-Dt_L55q8.d.cts → context-D8QA76sV.d.ts} +8 -8
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.d.cts +1 -1
- package/dist/tsup/db/drizzle.d.ts +1 -1
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +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 +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector-tab/mod.cjs +173 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +250 -0
- package/dist/tsup/inspector-tab/mod.d.ts +250 -0
- package/dist/tsup/inspector-tab/mod.js +173 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +615 -348
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +511 -244
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +21 -18
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -4
- package/dist/tsup/test/mod.d.ts +4 -4
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/{utils-DVekpm4I.d.cts → utils-DQosb24I.d.cts} +1 -1
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-DQosb24I.d.ts} +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +279 -279
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +6 -6
- package/dist/tsup/workflow/mod.d.ts +6 -6
- package/dist/tsup/workflow/mod.js +380 -380
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +29 -9
- package/src/actor/config.ts +156 -51
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +17 -19
- package/src/actor/driver.ts +3 -3
- package/src/actor/errors.ts +8 -2
- package/src/actor/instance/mod.ts +26 -34
- package/src/actor/keys.ts +1 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/index.ts +38 -18
- package/src/agent-os/actor/preview.ts +1 -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/client/actor-common.ts +87 -54
- package/src/client/actor-conn.ts +11 -11
- package/src/client/actor-handle.ts +69 -52
- package/src/client/actor-query.ts +5 -5
- package/src/client/errors.ts +1 -1
- package/src/client/lifecycle-errors.ts +2 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -4
- package/src/client/raw-utils.ts +8 -6
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +2 -6
- 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/transport/v1.ts +659 -543
- package/src/common/client-protocol-versioned.ts +66 -64
- package/src/common/database/config.ts +2 -8
- package/src/common/database/native-database.ts +1 -1
- package/src/common/database/shared.ts +1 -0
- package/src/common/encoding.ts +13 -17
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +3 -2
- package/src/common/router.ts +13 -17
- package/src/common/utils.ts +1 -2
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/mod.ts +1 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/drivers/engine/actor-driver.ts +48 -46
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +66 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +3 -3
- package/src/engine-client/actor-websocket-client.ts +5 -5
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +1 -1
- package/src/engine-client/mod.ts +5 -3
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +5 -11
- package/src/inspector/mod.ts +1 -3
- package/src/inspector-tab/mod.ts +315 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +40 -16
- package/src/registry/index.ts +226 -83
- package/src/registry/napi-runtime.ts +46 -12
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +307 -164
- package/src/registry/process-metrics.ts +90 -23
- package/src/registry/runtime.ts +53 -6
- package/src/registry/wasm-runtime.ts +30 -3
- package/src/serde.ts +1 -1
- package/src/serverless/configure.ts +18 -7
- package/src/test/mod.ts +11 -8
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +6 -0
- package/src/utils/router.ts +1 -1
- package/src/utils/serve.ts +4 -5
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +30 -29
- package/src/workflow/driver.ts +4 -6
- package/src/workflow/inspector.ts +2 -2
- package/src/workflow/mod.ts +15 -17
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
- package/dist/tsup/chunk-4BPKKZJO.cjs.map +0 -1
- package/dist/tsup/chunk-4JU3IPG2.js.map +0 -1
- package/dist/tsup/chunk-7HLFSAJP.cjs.map +0 -1
- package/dist/tsup/chunk-BATTOVHF.cjs.map +0 -1
- package/dist/tsup/chunk-D5G75T7J.js.map +0 -1
- package/dist/tsup/chunk-EMFKMVJR.js.map +0 -1
- package/dist/tsup/chunk-GBG63SUG.js.map +0 -1
- package/dist/tsup/chunk-HGW6PBWR.cjs.map +0 -1
- package/dist/tsup/chunk-KY3CERZR.js.map +0 -1
- package/dist/tsup/chunk-OT7FF6GB.cjs.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-SRNOPUC6.cjs.map +0 -1
- package/dist/tsup/chunk-TMLOKTRB.js.map +0 -1
- package/dist/tsup/chunk-VUGENVIK.js.map +0 -1
- package/dist/tsup/process-metrics-NW754INA.js +0 -118
- package/dist/tsup/process-metrics-NW754INA.js.map +0 -1
- package/dist/tsup/process-metrics-TYAGKCEJ.cjs +0 -118
- package/dist/tsup/process-metrics-TYAGKCEJ.cjs.map +0 -1
- /package/dist/tsup/{chunk-D3T3ZBSY.js.map → chunk-BEI24WTI.js.map} +0 -0
package/src/actor/config.ts
CHANGED
|
@@ -1,24 +1,18 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Client } from "@/client/client";
|
|
3
3
|
import type {
|
|
4
4
|
AnyDatabaseProvider,
|
|
5
5
|
InferDatabaseClient,
|
|
6
|
-
RawDatabaseClient,
|
|
7
|
-
DrizzleDatabaseClient,
|
|
8
|
-
NativeDatabaseProvider,
|
|
9
6
|
} from "@/common/database/config";
|
|
10
|
-
import type {
|
|
7
|
+
import type { UniversalWebSocket } from "@/common/websocket-interface";
|
|
11
8
|
import type { Registry } from "@/registry";
|
|
12
9
|
import type { BaseActorDefinition } from "./definition";
|
|
13
10
|
import type {
|
|
14
11
|
EventSchemaConfig,
|
|
15
|
-
PrimitiveSchema,
|
|
16
|
-
QueueSchemaConfig,
|
|
17
|
-
} from "./schema";
|
|
18
|
-
import type {
|
|
19
|
-
InferEventArgs,
|
|
20
12
|
InferQueueCompleteMap,
|
|
21
13
|
InferSchemaMap,
|
|
14
|
+
PrimitiveSchema,
|
|
15
|
+
QueueSchemaConfig,
|
|
22
16
|
} from "./schema";
|
|
23
17
|
|
|
24
18
|
export const DEFAULT_SLEEP_GRACE_PERIOD = 15_000;
|
|
@@ -68,6 +62,10 @@ type ActorKvListOptions<
|
|
|
68
62
|
|
|
69
63
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
70
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db` / `c.sql`)
|
|
67
|
+
* or actor state instead.
|
|
68
|
+
*/
|
|
71
69
|
export interface ActorKv {
|
|
72
70
|
get<T extends ActorKvValueType = "text">(
|
|
73
71
|
key: Uint8Array | string,
|
|
@@ -98,7 +96,10 @@ export interface ActorKv {
|
|
|
98
96
|
end: Uint8Array | string,
|
|
99
97
|
options?: ActorKvListOptions<T, K>,
|
|
100
98
|
): Promise<Array<[ActorKvKeyTypeMap[K], ActorKvValueTypeMap[T]]>>;
|
|
101
|
-
list<
|
|
99
|
+
list<
|
|
100
|
+
T extends ActorKvValueType = "text",
|
|
101
|
+
K extends ActorKvKeyType = "text",
|
|
102
|
+
>(
|
|
102
103
|
prefix: Uint8Array | string,
|
|
103
104
|
options?: ActorKvListOptions<T, K>,
|
|
104
105
|
): Promise<Array<[ActorKvKeyTypeMap[K], ActorKvValueTypeMap[T]]>>;
|
|
@@ -119,7 +120,8 @@ export type QueueMessageOf<Name extends string, Body> = {
|
|
|
119
120
|
[key: string]: unknown;
|
|
120
121
|
};
|
|
121
122
|
|
|
122
|
-
export type QueueName<TQueues extends QueueSchemaConfig> = keyof TQueues &
|
|
123
|
+
export type QueueName<TQueues extends QueueSchemaConfig> = keyof TQueues &
|
|
124
|
+
string;
|
|
123
125
|
export type QueueFilterName<TQueues extends QueueSchemaConfig> =
|
|
124
126
|
keyof TQueues extends never ? string : QueueName<TQueues>;
|
|
125
127
|
|
|
@@ -229,7 +231,9 @@ export interface QueueIterOptions<
|
|
|
229
231
|
completable?: TCompletable;
|
|
230
232
|
}
|
|
231
233
|
|
|
232
|
-
export interface ActorQueue<
|
|
234
|
+
export interface ActorQueue<
|
|
235
|
+
TQueues extends QueueSchemaConfig = Record<never, never>,
|
|
236
|
+
> {
|
|
233
237
|
send<TName extends QueueFilterName<TQueues>>(
|
|
234
238
|
name: TName,
|
|
235
239
|
body: QueueMessageForName<TQueues, TName>["body"],
|
|
@@ -237,15 +241,11 @@ export interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, ne
|
|
|
237
241
|
next<
|
|
238
242
|
const TName extends QueueFilterName<TQueues>,
|
|
239
243
|
const TCompletable extends boolean = false,
|
|
240
|
-
>(
|
|
241
|
-
opts?: QueueNextOptions<TName, TCompletable>,
|
|
242
|
-
): Promise<any>;
|
|
244
|
+
>(opts?: QueueNextOptions<TName, TCompletable>): Promise<any>;
|
|
243
245
|
nextBatch<
|
|
244
246
|
const TName extends QueueFilterName<TQueues>,
|
|
245
247
|
const TCompletable extends boolean = false,
|
|
246
|
-
>(
|
|
247
|
-
opts?: QueueNextBatchOptions<TName, TCompletable>,
|
|
248
|
-
): Promise<any[]>;
|
|
248
|
+
>(opts?: QueueNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
249
249
|
waitForNames<
|
|
250
250
|
const TName extends QueueFilterName<TQueues>,
|
|
251
251
|
const TCompletable extends boolean = false,
|
|
@@ -261,33 +261,27 @@ export interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, ne
|
|
|
261
261
|
tryNext<
|
|
262
262
|
const TName extends QueueFilterName<TQueues>,
|
|
263
263
|
const TCompletable extends boolean = false,
|
|
264
|
-
>(
|
|
265
|
-
opts?: QueueTryNextOptions<TName, TCompletable>,
|
|
266
|
-
): Promise<any>;
|
|
264
|
+
>(opts?: QueueTryNextOptions<TName, TCompletable>): Promise<any>;
|
|
267
265
|
tryNextBatch<
|
|
268
266
|
const TName extends QueueFilterName<TQueues>,
|
|
269
267
|
const TCompletable extends boolean = false,
|
|
270
|
-
>(
|
|
271
|
-
opts?: QueueTryNextBatchOptions<TName, TCompletable>,
|
|
272
|
-
): Promise<any[]>;
|
|
268
|
+
>(opts?: QueueTryNextBatchOptions<TName, TCompletable>): Promise<any[]>;
|
|
273
269
|
iter<
|
|
274
270
|
const TName extends QueueFilterName<TQueues>,
|
|
275
271
|
const TCompletable extends boolean = false,
|
|
276
|
-
>(
|
|
277
|
-
opts?: QueueIterOptions<TName, TCompletable>,
|
|
278
|
-
): AsyncIterable<any>;
|
|
272
|
+
>(opts?: QueueIterOptions<TName, TCompletable>): AsyncIterable<any>;
|
|
279
273
|
[key: string]: any;
|
|
280
274
|
}
|
|
281
275
|
|
|
282
276
|
export interface Conn<
|
|
283
|
-
|
|
277
|
+
_TState = unknown,
|
|
284
278
|
TConnParams = unknown,
|
|
285
279
|
TConnState = unknown,
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
280
|
+
_TVars = unknown,
|
|
281
|
+
_TInput = unknown,
|
|
282
|
+
_TDatabase extends AnyDatabaseProvider = AnyDatabaseProvider,
|
|
283
|
+
_TEvents extends EventSchemaConfig = Record<never, never>,
|
|
284
|
+
_TQueues extends QueueSchemaConfig = Record<never, never>,
|
|
291
285
|
> {
|
|
292
286
|
id: string;
|
|
293
287
|
params: TConnParams;
|
|
@@ -315,6 +309,10 @@ export interface ActorContext<
|
|
|
315
309
|
[RAW_STATE_SYMBOL](): TState;
|
|
316
310
|
state: TState;
|
|
317
311
|
vars: TVars;
|
|
312
|
+
/**
|
|
313
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db` / `sql`)
|
|
314
|
+
* or actor state instead.
|
|
315
|
+
*/
|
|
318
316
|
readonly kv: ActorKv;
|
|
319
317
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
320
318
|
readonly schedule: ActorSchedule;
|
|
@@ -323,7 +321,19 @@ export interface ActorContext<
|
|
|
323
321
|
readonly name: string;
|
|
324
322
|
readonly key: string[];
|
|
325
323
|
readonly region: string;
|
|
326
|
-
readonly conns: Map<
|
|
324
|
+
readonly conns: Map<
|
|
325
|
+
string,
|
|
326
|
+
Conn<
|
|
327
|
+
TState,
|
|
328
|
+
TConnParams,
|
|
329
|
+
TConnState,
|
|
330
|
+
TVars,
|
|
331
|
+
TInput,
|
|
332
|
+
TDatabase,
|
|
333
|
+
TEvents,
|
|
334
|
+
TQueues
|
|
335
|
+
>
|
|
336
|
+
>;
|
|
327
337
|
readonly log: ActorLogger;
|
|
328
338
|
readonly abortSignal: AbortSignal;
|
|
329
339
|
readonly aborted: boolean;
|
|
@@ -654,7 +664,9 @@ export type WebSocketContext<
|
|
|
654
664
|
TQueues
|
|
655
665
|
>;
|
|
656
666
|
|
|
657
|
-
export type ActorContextOf<
|
|
667
|
+
export type ActorContextOf<
|
|
668
|
+
AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, any>,
|
|
669
|
+
> =
|
|
658
670
|
AD extends BaseActorDefinition<
|
|
659
671
|
infer TState,
|
|
660
672
|
infer TConnParams,
|
|
@@ -731,6 +743,88 @@ const RunInspectorConfigSchema = z
|
|
|
731
743
|
})
|
|
732
744
|
.optional();
|
|
733
745
|
|
|
746
|
+
/**
|
|
747
|
+
* Built-in inspector tabs the dashboard ships. Used to validate
|
|
748
|
+
* `hidden: true` entries and reject custom-tab ids that collide with
|
|
749
|
+
* a built-in.
|
|
750
|
+
*/
|
|
751
|
+
export const BUILTIN_INSPECTOR_TAB_IDS = [
|
|
752
|
+
"workflow",
|
|
753
|
+
"database",
|
|
754
|
+
"state",
|
|
755
|
+
"queue",
|
|
756
|
+
"connections",
|
|
757
|
+
"console",
|
|
758
|
+
] as const;
|
|
759
|
+
|
|
760
|
+
export const BuiltinInspectorTabIdSchema = z.enum(BUILTIN_INSPECTOR_TAB_IDS);
|
|
761
|
+
|
|
762
|
+
// Custom tab id grammar — mirrored in Rust at
|
|
763
|
+
// `rivetkit-rust/packages/rivetkit-core/src/inspector/tabs.rs`. Slashes are
|
|
764
|
+
// forbidden because the runtime splits `/inspector/custom-tabs/<id>/<rest>`
|
|
765
|
+
// on the first `/`.
|
|
766
|
+
const CUSTOM_INSPECTOR_TAB_ID_RE = /^[A-Za-z0-9_-]+$/;
|
|
767
|
+
|
|
768
|
+
export const CustomInspectorTabEntrySchema = z
|
|
769
|
+
.object({
|
|
770
|
+
id: z
|
|
771
|
+
.string()
|
|
772
|
+
.regex(
|
|
773
|
+
CUSTOM_INSPECTOR_TAB_ID_RE,
|
|
774
|
+
"inspector.tabs[].id must contain only letters, digits, underscore, or dash",
|
|
775
|
+
),
|
|
776
|
+
label: z.string().min(1),
|
|
777
|
+
source: z.string().min(1),
|
|
778
|
+
/**
|
|
779
|
+
* Optional icon id. The dashboard maps strings to glyphs (see its
|
|
780
|
+
* icon registry); unknown ids fall back to a generic icon.
|
|
781
|
+
*/
|
|
782
|
+
icon: z.string().min(1).optional(),
|
|
783
|
+
hidden: z.literal(false).optional(),
|
|
784
|
+
})
|
|
785
|
+
.strict();
|
|
786
|
+
|
|
787
|
+
export const HideInspectorTabEntrySchema = z
|
|
788
|
+
.object({
|
|
789
|
+
id: BuiltinInspectorTabIdSchema,
|
|
790
|
+
hidden: z.literal(true),
|
|
791
|
+
})
|
|
792
|
+
.strict();
|
|
793
|
+
|
|
794
|
+
export const InspectorTabEntrySchema = z.union([
|
|
795
|
+
CustomInspectorTabEntrySchema,
|
|
796
|
+
HideInspectorTabEntrySchema,
|
|
797
|
+
]);
|
|
798
|
+
|
|
799
|
+
export const ActorInspectorConfigSchema = z
|
|
800
|
+
.object({
|
|
801
|
+
tabs: z.array(InspectorTabEntrySchema).default(() => []),
|
|
802
|
+
})
|
|
803
|
+
.strict()
|
|
804
|
+
.refine(
|
|
805
|
+
(data) => {
|
|
806
|
+
const ids = data.tabs.map((t) => t.id);
|
|
807
|
+
return new Set(ids).size === ids.length;
|
|
808
|
+
},
|
|
809
|
+
{ message: "Duplicate id in inspector.tabs", path: ["tabs"] },
|
|
810
|
+
)
|
|
811
|
+
.refine(
|
|
812
|
+
(data) => {
|
|
813
|
+
// A custom entry's id must not collide with a built-in id.
|
|
814
|
+
const builtinSet = new Set(BUILTIN_INSPECTOR_TAB_IDS);
|
|
815
|
+
return data.tabs.every(
|
|
816
|
+
(t) => t.hidden === true || !builtinSet.has(t.id as any),
|
|
817
|
+
);
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
message:
|
|
821
|
+
"Custom inspector tab id collides with a built-in (use hidden: true to hide a built-in)",
|
|
822
|
+
path: ["tabs"],
|
|
823
|
+
},
|
|
824
|
+
);
|
|
825
|
+
|
|
826
|
+
export type ActorInspectorConfig = z.input<typeof ActorInspectorConfigSchema>;
|
|
827
|
+
|
|
734
828
|
// Schema for run handler with metadata
|
|
735
829
|
export const RunConfigSchema = z.object({
|
|
736
830
|
/** Display name for the actor in the Inspector UI. */
|
|
@@ -947,6 +1041,7 @@ export const ActorConfigSchema = z
|
|
|
947
1041
|
db: z.any().optional(),
|
|
948
1042
|
createVars: zFunction().optional(),
|
|
949
1043
|
options: ActorOptionsSchema,
|
|
1044
|
+
inspector: ActorInspectorConfigSchema.optional(),
|
|
950
1045
|
})
|
|
951
1046
|
.strict()
|
|
952
1047
|
.refine(
|
|
@@ -982,9 +1077,9 @@ export const ActorConfigSchema = z
|
|
|
982
1077
|
// Data returned from this handler will be available on `c.state`.
|
|
983
1078
|
type CreateState<
|
|
984
1079
|
TState,
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
1080
|
+
_TConnParams,
|
|
1081
|
+
_TConnState,
|
|
1082
|
+
_TVars,
|
|
988
1083
|
TInput,
|
|
989
1084
|
TDatabase extends AnyDatabaseProvider,
|
|
990
1085
|
TEvents extends EventSchemaConfig,
|
|
@@ -1039,8 +1134,8 @@ type CreateConnState<
|
|
|
1039
1134
|
*/
|
|
1040
1135
|
type CreateVars<
|
|
1041
1136
|
TState,
|
|
1042
|
-
|
|
1043
|
-
|
|
1137
|
+
_TConnParams,
|
|
1138
|
+
_TConnState,
|
|
1044
1139
|
TVars,
|
|
1045
1140
|
TInput,
|
|
1046
1141
|
TDatabase extends AnyDatabaseProvider,
|
|
@@ -1501,6 +1596,25 @@ export type ActorConfig<
|
|
|
1501
1596
|
TDatabase extends AnyDatabaseProvider,
|
|
1502
1597
|
TEvents extends EventSchemaConfig = Record<never, never>,
|
|
1503
1598
|
TQueues extends QueueSchemaConfig = Record<never, never>,
|
|
1599
|
+
TActions extends Actions<
|
|
1600
|
+
TState,
|
|
1601
|
+
TConnParams,
|
|
1602
|
+
TConnState,
|
|
1603
|
+
TVars,
|
|
1604
|
+
TInput,
|
|
1605
|
+
TDatabase,
|
|
1606
|
+
TEvents,
|
|
1607
|
+
TQueues
|
|
1608
|
+
> = Actions<
|
|
1609
|
+
TState,
|
|
1610
|
+
TConnParams,
|
|
1611
|
+
TConnState,
|
|
1612
|
+
TVars,
|
|
1613
|
+
TInput,
|
|
1614
|
+
TDatabase,
|
|
1615
|
+
TEvents,
|
|
1616
|
+
TQueues
|
|
1617
|
+
>,
|
|
1504
1618
|
> = Omit<
|
|
1505
1619
|
z.infer<typeof ActorConfigSchema>,
|
|
1506
1620
|
| "actions"
|
|
@@ -1536,16 +1650,7 @@ export type ActorConfig<
|
|
|
1536
1650
|
TDatabase,
|
|
1537
1651
|
TEvents,
|
|
1538
1652
|
TQueues,
|
|
1539
|
-
|
|
1540
|
-
TState,
|
|
1541
|
-
TConnParams,
|
|
1542
|
-
TConnState,
|
|
1543
|
-
TVars,
|
|
1544
|
-
TInput,
|
|
1545
|
-
TDatabase,
|
|
1546
|
-
TEvents,
|
|
1547
|
-
TQueues
|
|
1548
|
-
>
|
|
1653
|
+
TActions
|
|
1549
1654
|
> &
|
|
1550
1655
|
CreateState<
|
|
1551
1656
|
TState,
|
|
@@ -16,10 +16,15 @@ import type {
|
|
|
16
16
|
WakeContext,
|
|
17
17
|
WebSocketContext,
|
|
18
18
|
} from "@/actor/config";
|
|
19
|
+
|
|
19
20
|
export type { ActorContextOf } from "@/actor/config";
|
|
20
|
-
|
|
21
|
-
import type {
|
|
21
|
+
|
|
22
|
+
import type {
|
|
23
|
+
AnyActorDefinition,
|
|
24
|
+
BaseActorDefinition,
|
|
25
|
+
} from "@/actor/definition";
|
|
22
26
|
import type { EventSchemaConfig, QueueSchemaConfig } from "@/actor/schema";
|
|
27
|
+
import type { AnyDatabaseProvider } from "@/common/database/config";
|
|
23
28
|
|
|
24
29
|
export type ActionContextOf<AD extends AnyActorDefinition> =
|
|
25
30
|
AD extends BaseActorDefinition<
|
package/src/actor/definition.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import type { AnyDatabaseProvider } from "@/common/database/config";
|
|
1
2
|
import type { RegistryConfig } from "@/registry/config";
|
|
2
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type Actions,
|
|
5
|
+
type ActorConfig,
|
|
6
|
+
type ActorConfigInput,
|
|
7
|
+
ActorConfigSchema,
|
|
8
|
+
} from "./config";
|
|
3
9
|
import { loggerWithoutContext } from "./log";
|
|
4
|
-
import type { AnyDatabaseProvider } from "@/common/database/config";
|
|
5
10
|
import type { EventSchemaConfig, QueueSchemaConfig } from "./schema";
|
|
6
11
|
|
|
7
12
|
const warnedDeprecatedTimeoutKeys = new Set<string>();
|
|
@@ -28,7 +33,7 @@ export interface BaseActorDefinition<
|
|
|
28
33
|
DB extends AnyDatabaseProvider,
|
|
29
34
|
E extends EventSchemaConfig = Record<never, never>,
|
|
30
35
|
Q extends QueueSchemaConfig = Record<never, never>,
|
|
31
|
-
|
|
36
|
+
_R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<
|
|
32
37
|
S,
|
|
33
38
|
CP,
|
|
34
39
|
CS,
|
|
@@ -39,20 +44,12 @@ export interface BaseActorDefinition<
|
|
|
39
44
|
Q
|
|
40
45
|
>,
|
|
41
46
|
> {
|
|
42
|
-
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
47
|
+
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
|
-
export
|
|
46
|
-
any
|
|
47
|
-
|
|
48
|
-
any,
|
|
49
|
-
any,
|
|
50
|
-
any,
|
|
51
|
-
any,
|
|
52
|
-
any,
|
|
53
|
-
any,
|
|
54
|
-
any
|
|
55
|
-
>;
|
|
50
|
+
export interface AnyActorDefinition {
|
|
51
|
+
readonly config: any;
|
|
52
|
+
}
|
|
56
53
|
|
|
57
54
|
export type AnyStaticActorDefinition = ActorDefinition<
|
|
58
55
|
any,
|
|
@@ -87,13 +84,13 @@ export class ActorDefinition<
|
|
|
87
84
|
>,
|
|
88
85
|
> implements BaseActorDefinition<S, CP, CS, V, I, DB, E, Q, R>
|
|
89
86
|
{
|
|
90
|
-
#config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
87
|
+
#config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
|
|
91
88
|
|
|
92
|
-
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>) {
|
|
89
|
+
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>) {
|
|
93
90
|
this.#config = config;
|
|
94
91
|
}
|
|
95
92
|
|
|
96
|
-
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q> {
|
|
93
|
+
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R> {
|
|
97
94
|
return this.#config;
|
|
98
95
|
}
|
|
99
96
|
}
|
|
@@ -195,7 +192,8 @@ export function actor<
|
|
|
195
192
|
TInput,
|
|
196
193
|
TDatabase,
|
|
197
194
|
TEvents,
|
|
198
|
-
TQueues
|
|
195
|
+
TQueues,
|
|
196
|
+
TActions
|
|
199
197
|
>;
|
|
200
198
|
return new ActorDefinition(config);
|
|
201
199
|
}
|
package/src/actor/driver.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Context as HonoContext } from "hono";
|
|
2
2
|
import type { AnyClient } from "@/client/client";
|
|
3
|
-
import type { EngineControlClient } from "@/engine-client/driver";
|
|
4
|
-
import type { AnyActorInstance, AnyStaticActorInstance } from "./definition";
|
|
5
|
-
import type { RegistryConfig } from "@/registry/config";
|
|
6
3
|
import type {
|
|
7
4
|
DrizzleDatabaseClient,
|
|
8
5
|
NativeDatabaseProvider,
|
|
9
6
|
} from "@/common/database/config";
|
|
7
|
+
import type { EngineControlClient } from "@/engine-client/driver";
|
|
8
|
+
import type { RegistryConfig } from "@/registry/config";
|
|
9
|
+
import type { AnyActorInstance, AnyStaticActorInstance } from "./definition";
|
|
10
10
|
|
|
11
11
|
export type ActorDriverBuilder = (
|
|
12
12
|
config: RegistryConfig,
|
package/src/actor/errors.ts
CHANGED
|
@@ -106,7 +106,9 @@ function isActorSpecifier(value: unknown): value is ActorSpecifier {
|
|
|
106
106
|
typeof value.actorId === "string" &&
|
|
107
107
|
"generation" in value &&
|
|
108
108
|
typeof value.generation === "number" &&
|
|
109
|
-
(!("key" in value) ||
|
|
109
|
+
(!("key" in value) ||
|
|
110
|
+
value.key === undefined ||
|
|
111
|
+
typeof value.key === "string")
|
|
110
112
|
);
|
|
111
113
|
}
|
|
112
114
|
|
|
@@ -237,7 +239,11 @@ export function decodeBridgeRivetErrorPayload(
|
|
|
237
239
|
if (!isRivetErrorLike(payload)) {
|
|
238
240
|
return undefined;
|
|
239
241
|
}
|
|
240
|
-
if (
|
|
242
|
+
if (
|
|
243
|
+
payload.actor !== undefined &&
|
|
244
|
+
payload.actor !== null &&
|
|
245
|
+
!isActorSpecifier(payload.actor)
|
|
246
|
+
) {
|
|
241
247
|
return undefined;
|
|
242
248
|
}
|
|
243
249
|
|
|
@@ -9,22 +9,21 @@ import {
|
|
|
9
9
|
type SpanStatusInput,
|
|
10
10
|
type Traces,
|
|
11
11
|
} from "@rivetkit/traces";
|
|
12
|
-
import { ActorMetrics, type StartupTimingKey } from "@/actor/metrics";
|
|
13
12
|
import invariant from "invariant";
|
|
13
|
+
import { ActorMetrics, type StartupTimingKey } from "@/actor/metrics";
|
|
14
14
|
import type { Client } from "@/client/client";
|
|
15
|
+
import type { ActorKey } from "@/client/query";
|
|
15
16
|
import { getBaseLogger, getIncludeTarget, type Logger } from "@/common/log";
|
|
16
17
|
import { stringifyError } from "@/common/utils";
|
|
17
18
|
import type { UniversalWebSocket } from "@/common/websocket-interface";
|
|
18
19
|
import { ActorInspector } from "@/inspector/actor-inspector";
|
|
19
|
-
import type { ActorKey } from "@/client/query";
|
|
20
20
|
import type { Registry } from "@/mod";
|
|
21
21
|
import {
|
|
22
22
|
ACTOR_VERSIONED,
|
|
23
23
|
CONN_VERSIONED,
|
|
24
24
|
} from "@/schemas/actor-persist/versioned";
|
|
25
|
-
import { EXTRA_ERROR_LOG } from "@/utils";
|
|
25
|
+
import { EXTRA_ERROR_LOG, promiseWithResolvers } from "@/utils";
|
|
26
26
|
import { getRivetExperimentalOtel } from "@/utils/env-vars";
|
|
27
|
-
import { promiseWithResolvers } from "@/utils";
|
|
28
27
|
import {
|
|
29
28
|
type Actions,
|
|
30
29
|
type ActorConfig,
|
|
@@ -32,16 +31,13 @@ import {
|
|
|
32
31
|
ActorConfigSchema,
|
|
33
32
|
getRunFunction,
|
|
34
33
|
} from "../config";
|
|
35
|
-
import type { ConnDriver } from "../conn/driver";
|
|
36
|
-
import { createHttpDriver } from "../conn/drivers/http";
|
|
37
34
|
import {
|
|
38
|
-
HibernatableWebSocketAckState,
|
|
39
35
|
handleInboundHibernatableWebSocketMessage as applyInboundHibernatableWebSocketMessage,
|
|
36
|
+
HibernatableWebSocketAckState,
|
|
40
37
|
} from "../conn/hibernatable-websocket-ack-state";
|
|
41
38
|
import {
|
|
42
|
-
CONN_DRIVER_SYMBOL,
|
|
43
|
-
CONN_STATE_MANAGER_SYMBOL,
|
|
44
39
|
type AnyConn,
|
|
40
|
+
CONN_STATE_MANAGER_SYMBOL,
|
|
45
41
|
type Conn,
|
|
46
42
|
type ConnId,
|
|
47
43
|
} from "../conn/mod";
|
|
@@ -50,7 +46,7 @@ import {
|
|
|
50
46
|
type PersistedConn,
|
|
51
47
|
} from "../conn/persisted";
|
|
52
48
|
import {
|
|
53
|
-
ActionContext,
|
|
49
|
+
type ActionContext,
|
|
54
50
|
ActorContext,
|
|
55
51
|
RequestContext,
|
|
56
52
|
WebSocketContext,
|
|
@@ -79,20 +75,16 @@ import {
|
|
|
79
75
|
import { ConnectionManager } from "./connection-manager";
|
|
80
76
|
import { EventManager } from "./event-manager";
|
|
81
77
|
import { KEYS, workflowStoragePrefix } from "./keys";
|
|
82
|
-
import {
|
|
83
|
-
type PreloadedEntries,
|
|
84
|
-
type PreloadHit,
|
|
85
|
-
type PreloadMap,
|
|
86
|
-
} from "./preload-map";
|
|
87
78
|
import {
|
|
88
79
|
convertActorFromBarePersisted,
|
|
89
80
|
type PersistedActor,
|
|
90
81
|
} from "./persisted";
|
|
82
|
+
import type { PreloadedEntries, PreloadMap } from "./preload-map";
|
|
91
83
|
import { QueueManager } from "./queue-manager";
|
|
92
84
|
import { ScheduleManager } from "./schedule-manager";
|
|
93
85
|
import { type SaveStateOptions, StateManager } from "./state-manager";
|
|
94
|
-
import { TrackedWebSocket } from "./tracked-websocket";
|
|
95
86
|
import { ActorTracesDriver } from "./traces-driver";
|
|
87
|
+
import { TrackedWebSocket } from "./tracked-websocket";
|
|
96
88
|
import { WriteCollector } from "./write-collector";
|
|
97
89
|
|
|
98
90
|
export type { SaveStateOptions };
|
|
@@ -215,14 +207,14 @@ const ACTIVE_ASYNC_REGION_ERROR_MESSAGES: Record<
|
|
|
215
207
|
* only on `ActorInstance`.
|
|
216
208
|
*/
|
|
217
209
|
export interface BaseActorInstance<
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
210
|
+
_S = any,
|
|
211
|
+
_CP = any,
|
|
212
|
+
_CS = any,
|
|
213
|
+
_V = any,
|
|
214
|
+
_I = any,
|
|
215
|
+
_DB extends AnyDatabaseProvider = AnyDatabaseProvider,
|
|
216
|
+
_E extends EventSchemaConfig = Record<never, never>,
|
|
217
|
+
_Q extends QueueSchemaConfig = Record<never, never>,
|
|
226
218
|
> {
|
|
227
219
|
readonly id: string;
|
|
228
220
|
readonly isStopping: boolean;
|
|
@@ -1274,7 +1266,7 @@ export class ActorInstance<
|
|
|
1274
1266
|
"actor.onBeforeActionResponse",
|
|
1275
1267
|
{ "rivet.action.name": actionName },
|
|
1276
1268
|
() =>
|
|
1277
|
-
this.#config.onBeforeActionResponse
|
|
1269
|
+
this.#config.onBeforeActionResponse?.(
|
|
1278
1270
|
this.actorContext,
|
|
1279
1271
|
actionName,
|
|
1280
1272
|
args,
|
|
@@ -1406,7 +1398,7 @@ export class ActorInstance<
|
|
|
1406
1398
|
|
|
1407
1399
|
// NOTE: This is async and will run in the background
|
|
1408
1400
|
const voidOrPromise = this.#traces.withSpan(span, () =>
|
|
1409
|
-
this.#config.onWebSocket
|
|
1401
|
+
this.#config.onWebSocket?.(ctx, trackedWebSocket),
|
|
1410
1402
|
);
|
|
1411
1403
|
|
|
1412
1404
|
// Save changes from the WebSocket open
|
|
@@ -1645,10 +1637,10 @@ export class ActorInstance<
|
|
|
1645
1637
|
attributes?: Record<string, unknown>,
|
|
1646
1638
|
): Record<string, unknown> {
|
|
1647
1639
|
return {
|
|
1648
|
-
"rivet.actor.id": this.#actorId,
|
|
1649
|
-
"rivet.actor.name": this.#name,
|
|
1650
|
-
"rivet.actor.key": this.#actorKeyString,
|
|
1651
|
-
"rivet.actor.region": this.#region,
|
|
1640
|
+
"rivet.actors.actor.id": this.#actorId,
|
|
1641
|
+
"rivet.actors.actor.name": this.#name,
|
|
1642
|
+
"rivet.actors.actor.key": this.#actorKeyString,
|
|
1643
|
+
"rivet.actors.actor.region": this.#region,
|
|
1652
1644
|
...(attributes ?? {}),
|
|
1653
1645
|
};
|
|
1654
1646
|
}
|
|
@@ -1882,7 +1874,7 @@ export class ActorInstance<
|
|
|
1882
1874
|
"actor.createVars",
|
|
1883
1875
|
undefined,
|
|
1884
1876
|
() => {
|
|
1885
|
-
const dataOrPromise = createVars
|
|
1877
|
+
const dataOrPromise = createVars?.(
|
|
1886
1878
|
this.actorContext as any,
|
|
1887
1879
|
this.driver.getContext(this.#actorId),
|
|
1888
1880
|
);
|
|
@@ -2084,7 +2076,7 @@ export class ActorInstance<
|
|
|
2084
2076
|
}
|
|
2085
2077
|
}
|
|
2086
2078
|
|
|
2087
|
-
async #setupDatabase(
|
|
2079
|
+
async #setupDatabase(_preload?: PreloadMap) {
|
|
2088
2080
|
if (!("db" in this.#config) || !this.#config.db) {
|
|
2089
2081
|
return;
|
|
2090
2082
|
}
|
|
@@ -2099,14 +2091,14 @@ export class ActorInstance<
|
|
|
2099
2091
|
overrideRawDatabaseClient: this.driver
|
|
2100
2092
|
.overrideRawDatabaseClient
|
|
2101
2093
|
? () =>
|
|
2102
|
-
this.driver.overrideRawDatabaseClient
|
|
2094
|
+
this.driver.overrideRawDatabaseClient?.(
|
|
2103
2095
|
this.#actorId,
|
|
2104
2096
|
)
|
|
2105
2097
|
: undefined,
|
|
2106
2098
|
overrideDrizzleDatabaseClient: this.driver
|
|
2107
2099
|
.overrideDrizzleDatabaseClient
|
|
2108
2100
|
? () =>
|
|
2109
|
-
this.driver.overrideDrizzleDatabaseClient
|
|
2101
|
+
this.driver.overrideDrizzleDatabaseClient?.(
|
|
2110
2102
|
this.#actorId,
|
|
2111
2103
|
)
|
|
2112
2104
|
: undefined,
|
package/src/actor/keys.ts
CHANGED
|
@@ -135,7 +135,7 @@ export function deserializeActorKey(keyString: string | undefined): ActorKey {
|
|
|
135
135
|
// Add the last part
|
|
136
136
|
if (escaping) {
|
|
137
137
|
// Incomplete escape at the end - treat as literal backslash
|
|
138
|
-
parts.push(currentPart
|
|
138
|
+
parts.push(`${currentPart}\\`);
|
|
139
139
|
} else if (isEmptyStringMarker) {
|
|
140
140
|
parts.push("");
|
|
141
141
|
} else if (currentPart !== "" || parts.length > 0) {
|