rivetkit 0.0.0-main.41efcce → 0.0.0-main.49693dc
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 +939 -104
- package/dist/browser/client.js +1867 -900
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2079 -233
- 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 +2408 -2029
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +932 -114
- package/dist/tsup/agent-os/index.d.ts +932 -114
- package/dist/tsup/agent-os/index.js +2412 -2033
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-J27CEW6F.js → chunk-2OBVQZX6.js} +6 -6
- package/dist/tsup/chunk-2OBVQZX6.js.map +1 -0
- package/dist/tsup/chunk-3ZWHWMFJ.js +14 -0
- package/dist/tsup/chunk-3ZWHWMFJ.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-4KGXFC6M.cjs} +238 -22
- package/dist/tsup/chunk-4KGXFC6M.cjs.map +1 -0
- package/dist/tsup/{chunk-CVHUXINE.js → chunk-5IU3MI7X.js} +594 -72
- package/dist/tsup/chunk-5IU3MI7X.js.map +1 -0
- package/dist/tsup/{chunk-VD7AZIBR.js → chunk-6CXQMHZR.js} +1161 -361
- package/dist/tsup/chunk-6CXQMHZR.js.map +1 -0
- package/dist/tsup/{chunk-SBEFJ4IQ.js → chunk-6W2UIH3X.js} +70 -8
- package/dist/tsup/chunk-6W2UIH3X.js.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-6W5VGLFT.js} +237 -21
- package/dist/tsup/chunk-6W5VGLFT.js.map +1 -0
- package/dist/tsup/{chunk-RF3MEJV6.cjs → chunk-B73TBMMG.cjs} +18 -11
- package/dist/tsup/chunk-B73TBMMG.cjs.map +1 -0
- package/dist/tsup/chunk-D6TORRA4.js +243 -0
- package/dist/tsup/chunk-D6TORRA4.js.map +1 -0
- package/dist/tsup/{chunk-PXLJOMJD.js → chunk-FXT3HN32.js} +2 -2
- package/dist/tsup/{chunk-ZGWSH7YV.js → chunk-IXBD7BXC.js} +48 -72
- package/dist/tsup/chunk-IXBD7BXC.js.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-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-SPMMF6TR.cjs → chunk-LGOWPZJ5.cjs} +3 -3
- package/dist/tsup/chunk-LGOWPZJ5.cjs.map +1 -0
- package/dist/tsup/chunk-LYNWTX6R.cjs +14 -0
- package/dist/tsup/chunk-LYNWTX6R.cjs.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-XSC2WWXD.js → chunk-NYDZLWHZ.js} +16 -9
- package/dist/tsup/chunk-NYDZLWHZ.js.map +1 -0
- package/dist/tsup/{chunk-AV54CVAG.cjs → chunk-RB7WUDX6.cjs} +1290 -490
- package/dist/tsup/chunk-RB7WUDX6.cjs.map +1 -0
- package/dist/tsup/{chunk-JTL6Y2UN.cjs → chunk-SPJORZMM.cjs} +49 -73
- package/dist/tsup/chunk-SPJORZMM.cjs.map +1 -0
- package/dist/tsup/chunk-SSMKIYEX.cjs +243 -0
- package/dist/tsup/chunk-SSMKIYEX.cjs.map +1 -0
- package/dist/tsup/{chunk-TQSL4NJ3.cjs → chunk-TQ4HSX2U.cjs} +72 -10
- package/dist/tsup/chunk-TQ4HSX2U.cjs.map +1 -0
- package/dist/tsup/{chunk-EVADNK6Z.cjs → chunk-U6ZQELGJ.cjs} +10 -10
- package/dist/tsup/chunk-U6ZQELGJ.cjs.map +1 -0
- package/dist/tsup/chunk-XLBMKZD3.cjs +1257 -0
- package/dist/tsup/chunk-XLBMKZD3.cjs.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 +18 -7
- package/dist/tsup/client/mod.d.ts +18 -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.cjs.map +1 -1
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-B3RIidaJ.d.ts → config-BXSV17G7.d.cts} +987 -72
- package/dist/tsup/{config-D6WxBYjV.d.cts → config-Bi1r6gI7.d.ts} +987 -72
- package/dist/tsup/{config-B9qUIHX4.d.ts → config-ey2I2zz5.d.cts} +82 -15
- package/dist/tsup/{config-B9qUIHX4.d.cts → config-ey2I2zz5.d.ts} +82 -15
- package/dist/tsup/context-4fJemY0D.d.cts +129 -0
- package/dist/tsup/context-D4sNYboo.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +168 -103
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -4
- package/dist/tsup/db/drizzle.d.ts +8 -4
- package/dist/tsup/db/drizzle.js +170 -105
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +6 -163
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +12 -4
- package/dist/tsup/db/mod.d.ts +12 -4
- package/dist/tsup/db/mod.js +5 -162
- 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 +38 -0
- package/dist/tsup/dynamic/mod.d.ts +38 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +26 -136
- package/dist/tsup/inspector/mod.d.ts +26 -136
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +241 -0
- package/dist/tsup/inspector-tab/mod.d.ts +241 -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 +4268 -944
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -8
- package/dist/tsup/mod.d.ts +9 -8
- package/dist/tsup/mod.js +4229 -905
- 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 +7 -6
- package/dist/tsup/test/mod.d.ts +7 -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-Bbz-3411.d.cts +162 -0
- package/dist/tsup/utils-BqdWVlzm.d.ts +162 -0
- package/dist/tsup/utils-vvJQyygr.d.cts +109 -0
- package/dist/tsup/utils-vvJQyygr.d.ts +109 -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 +517 -412
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +11 -10
- package/dist/tsup/workflow/mod.d.ts +11 -10
- package/dist/tsup/workflow/mod.js +511 -406
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +62 -14
- package/src/actor/actions.ts +119 -0
- package/src/actor/config.test.ts +78 -0
- package/src/actor/config.ts +518 -96
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +38 -26
- package/src/actor/errors.ts +101 -89
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +32 -21
- 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 +106 -53
- package/src/client/actor-conn.ts +94 -45
- package/src/client/actor-handle.ts +198 -79
- package/src/client/actor-query.ts +13 -6
- package/src/client/client.ts +43 -15
- package/src/client/config.ts +8 -0
- package/src/client/errors.ts +4 -2
- package/src/client/lifecycle-errors.ts +28 -4
- package/src/client/mod.ts +9 -4
- package/src/client/query.ts +3 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +24 -16
- package/src/client/resolve-gateway-target.ts +3 -1
- package/src/client/utils.ts +36 -10
- package/src/common/actor-router-consts.ts +7 -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 +103 -10
- package/src/common/database/mod.test.ts +364 -0
- package/src/common/database/mod.ts +278 -149
- package/src/common/database/native-database.test.ts +220 -0
- package/src/common/database/native-database.ts +394 -58
- package/src/common/database/shared.ts +25 -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/inspector-transport.ts +12 -2
- package/src/common/log.ts +117 -14
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +23 -203
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.test.ts +164 -0
- package/src/db/drizzle.ts +207 -121
- package/src/db/mod.ts +6 -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 +23 -4
- 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 +21 -17
- package/src/engine-client/mod.ts +116 -64
- 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/workflow.ts +61 -0
- 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 +659 -96
- package/src/registry/napi-runtime.ts +1154 -0
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +2005 -955
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/run-handler-coordinator.test.ts +252 -0
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.test.ts +50 -0
- package/src/registry/runtime.ts +839 -0
- package/src/registry/wasm-runtime.ts +1283 -0
- package/src/registry/write-through-proxy.ts +141 -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/node.ts +44 -28
- 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 +246 -119
- package/src/workflow/inspector.ts +24 -24
- package/src/workflow/mod.ts +76 -84
- 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-SPMMF6TR.cjs.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-FXT3HN32.js.map} +0 -0
|
@@ -2,8 +2,9 @@ import { createVersionedDataHandler } from "vbare";
|
|
|
2
2
|
import * as v1 from "./bare/generated/client-protocol/v1";
|
|
3
3
|
import * as v2 from "./bare/generated/client-protocol/v2";
|
|
4
4
|
import * as v3 from "./bare/generated/client-protocol/v3";
|
|
5
|
+
import * as v4 from "./bare/generated/client-protocol/v4";
|
|
5
6
|
|
|
6
|
-
export const CURRENT_VERSION =
|
|
7
|
+
export const CURRENT_VERSION = 4;
|
|
7
8
|
|
|
8
9
|
// Converter from v1 to v2: Remove connectionToken from Init message
|
|
9
10
|
const v1ToV2 = (v1Data: v1.ToClient): v2.ToClient => {
|
|
@@ -44,17 +45,45 @@ const v2ToV1 = (v2Data: v2.ToClient): v1.ToClient => {
|
|
|
44
45
|
return v2Data as unknown as v1.ToClient;
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
// Converter from v2 to v3: No changes needed for ToClient
|
|
48
|
+
// Converter from v2 to v3: No changes needed for ToClient.
|
|
48
49
|
const v2ToV3 = (v2Data: v2.ToClient): v3.ToClient => {
|
|
49
50
|
return v2Data as unknown as v3.ToClient;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
|
|
53
|
+
const v3ToV4 = (v3Data: v3.ToClient): v4.ToClient => {
|
|
54
|
+
if (v3Data.body.tag === "Error") {
|
|
55
|
+
return {
|
|
56
|
+
body: {
|
|
57
|
+
tag: "Error",
|
|
58
|
+
val: {
|
|
59
|
+
...v3Data.body.val,
|
|
60
|
+
actor: null,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
return v3Data as unknown as v4.ToClient;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const v4ToV3 = (v4Data: v4.ToClient): v3.ToClient => {
|
|
69
|
+
if (v4Data.body.tag === "Error") {
|
|
70
|
+
const { actor: _, ...val } = v4Data.body.val;
|
|
71
|
+
return {
|
|
72
|
+
body: {
|
|
73
|
+
tag: "Error",
|
|
74
|
+
val,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
return v4Data as unknown as v3.ToClient;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// Converter from v3 to v2: No changes needed for ToClient.
|
|
53
82
|
const v3ToV2 = (v3Data: v3.ToClient): v2.ToClient => {
|
|
54
83
|
return v3Data as unknown as v2.ToClient;
|
|
55
84
|
};
|
|
56
85
|
|
|
57
|
-
// ToServer identity converters
|
|
86
|
+
// ToServer identity converters.
|
|
58
87
|
const v1ToServerV2 = (v1Data: v1.ToServer): v2.ToServer => {
|
|
59
88
|
return v1Data as unknown as v2.ToServer;
|
|
60
89
|
};
|
|
@@ -63,6 +92,14 @@ const v2ToServerV3 = (v2Data: v2.ToServer): v3.ToServer => {
|
|
|
63
92
|
return v2Data as unknown as v3.ToServer;
|
|
64
93
|
};
|
|
65
94
|
|
|
95
|
+
const v3ToServerV4 = (v3Data: v3.ToServer): v4.ToServer => {
|
|
96
|
+
return v3Data as unknown as v4.ToServer;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const v4ToServerV3 = (v4Data: v4.ToServer): v3.ToServer => {
|
|
100
|
+
return v4Data as unknown as v3.ToServer;
|
|
101
|
+
};
|
|
102
|
+
|
|
66
103
|
const v3ToServerV2 = (v3Data: v3.ToServer): v2.ToServer => {
|
|
67
104
|
return v3Data as unknown as v2.ToServer;
|
|
68
105
|
};
|
|
@@ -71,66 +108,90 @@ const v2ToServerV1 = (v2Data: v2.ToServer): v1.ToServer => {
|
|
|
71
108
|
return v2Data as unknown as v1.ToServer;
|
|
72
109
|
};
|
|
73
110
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
case 2:
|
|
80
|
-
return v2.decodeToServer(bytes);
|
|
81
|
-
case 3:
|
|
82
|
-
return v3.decodeToServer(bytes);
|
|
83
|
-
default:
|
|
84
|
-
throw new Error(`Unknown version ${version}`);
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
serializeVersion: (data, version) => {
|
|
88
|
-
switch (version) {
|
|
89
|
-
case 1:
|
|
90
|
-
return v1.encodeToServer(data as v1.ToServer);
|
|
91
|
-
case 2:
|
|
92
|
-
return v2.encodeToServer(data as v2.ToServer);
|
|
93
|
-
case 3:
|
|
94
|
-
return v3.encodeToServer(data as v3.ToServer);
|
|
95
|
-
default:
|
|
96
|
-
throw new Error(`Unknown version ${version}`);
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
deserializeConverters: () => [v1ToServerV2, v2ToServerV3],
|
|
100
|
-
serializeConverters: () => [v3ToServerV2, v2ToServerV1],
|
|
111
|
+
const v3HttpResponseErrorToV4 = (
|
|
112
|
+
v3Data: v3.HttpResponseError,
|
|
113
|
+
): v4.HttpResponseError => ({
|
|
114
|
+
...v3Data,
|
|
115
|
+
actor: null,
|
|
101
116
|
});
|
|
102
117
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
const v4HttpResponseErrorToV3 = (
|
|
119
|
+
v4Data: v4.HttpResponseError,
|
|
120
|
+
): v3.HttpResponseError => {
|
|
121
|
+
const { actor: _, ...rest } = v4Data;
|
|
122
|
+
return rest;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const CLIENT_PROTOCOL_TO_SERVER =
|
|
126
|
+
createVersionedDataHandler<v4.ToServer>({
|
|
127
|
+
deserializeVersion: (bytes, version) => {
|
|
128
|
+
switch (version) {
|
|
129
|
+
case 1:
|
|
130
|
+
return v1.decodeToServer(bytes);
|
|
131
|
+
case 2:
|
|
132
|
+
return v2.decodeToServer(bytes);
|
|
133
|
+
case 3:
|
|
134
|
+
return v3.decodeToServer(bytes);
|
|
135
|
+
case 4:
|
|
136
|
+
return v4.decodeToServer(bytes);
|
|
137
|
+
default:
|
|
138
|
+
throw new Error(`Unknown version ${version}`);
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
serializeVersion: (data, version) => {
|
|
142
|
+
switch (version) {
|
|
143
|
+
case 1:
|
|
144
|
+
return v1.encodeToServer(data as v1.ToServer);
|
|
145
|
+
case 2:
|
|
146
|
+
return v2.encodeToServer(data as v2.ToServer);
|
|
147
|
+
case 3:
|
|
148
|
+
return v3.encodeToServer(data as v3.ToServer);
|
|
149
|
+
case 4:
|
|
150
|
+
return v4.encodeToServer(data as v4.ToServer);
|
|
151
|
+
default:
|
|
152
|
+
throw new Error(`Unknown version ${version}`);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
deserializeConverters: () => [v1ToServerV2, v2ToServerV3, v3ToServerV4],
|
|
156
|
+
serializeConverters: () => [v4ToServerV3, v3ToServerV2, v2ToServerV1],
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
export const CLIENT_PROTOCOL_TO_CLIENT =
|
|
160
|
+
createVersionedDataHandler<v4.ToClient>({
|
|
161
|
+
deserializeVersion: (bytes, version) => {
|
|
162
|
+
switch (version) {
|
|
163
|
+
case 1:
|
|
164
|
+
return v1.decodeToClient(bytes);
|
|
165
|
+
case 2:
|
|
166
|
+
return v2.decodeToClient(bytes);
|
|
167
|
+
case 3:
|
|
168
|
+
return v3.decodeToClient(bytes);
|
|
169
|
+
case 4:
|
|
170
|
+
return v4.decodeToClient(bytes);
|
|
171
|
+
default:
|
|
172
|
+
throw new Error(`Unknown version ${version}`);
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
serializeVersion: (data, version) => {
|
|
176
|
+
switch (version) {
|
|
177
|
+
case 1:
|
|
178
|
+
return v1.encodeToClient(data as v1.ToClient);
|
|
179
|
+
case 2:
|
|
180
|
+
return v2.encodeToClient(data as v2.ToClient);
|
|
181
|
+
case 3:
|
|
182
|
+
return v3.encodeToClient(data as v3.ToClient);
|
|
183
|
+
case 4:
|
|
184
|
+
return v4.encodeToClient(data as v4.ToClient);
|
|
185
|
+
default:
|
|
186
|
+
throw new Error(`Unknown version ${version}`);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
deserializeConverters: () => [v1ToV2, v2ToV3, v3ToV4],
|
|
190
|
+
serializeConverters: () => [v4ToV3, v3ToV2, v2ToV1],
|
|
191
|
+
});
|
|
131
192
|
|
|
132
193
|
export const HTTP_ACTION_REQUEST_VERSIONED =
|
|
133
|
-
createVersionedDataHandler<
|
|
194
|
+
createVersionedDataHandler<v4.HttpActionRequest>({
|
|
134
195
|
deserializeVersion: (bytes, version) => {
|
|
135
196
|
switch (version) {
|
|
136
197
|
case 1:
|
|
@@ -139,6 +200,8 @@ export const HTTP_ACTION_REQUEST_VERSIONED =
|
|
|
139
200
|
return v2.decodeHttpActionRequest(bytes);
|
|
140
201
|
case 3:
|
|
141
202
|
return v3.decodeHttpActionRequest(bytes);
|
|
203
|
+
case 4:
|
|
204
|
+
return v4.decodeHttpActionRequest(bytes);
|
|
142
205
|
default:
|
|
143
206
|
throw new Error(`Unknown version ${version}`);
|
|
144
207
|
}
|
|
@@ -157,6 +220,10 @@ export const HTTP_ACTION_REQUEST_VERSIONED =
|
|
|
157
220
|
return v3.encodeHttpActionRequest(
|
|
158
221
|
data as v3.HttpActionRequest,
|
|
159
222
|
);
|
|
223
|
+
case 4:
|
|
224
|
+
return v4.encodeHttpActionRequest(
|
|
225
|
+
data as v4.HttpActionRequest,
|
|
226
|
+
);
|
|
160
227
|
default:
|
|
161
228
|
throw new Error(`Unknown version ${version}`);
|
|
162
229
|
}
|
|
@@ -166,7 +233,7 @@ export const HTTP_ACTION_REQUEST_VERSIONED =
|
|
|
166
233
|
});
|
|
167
234
|
|
|
168
235
|
export const HTTP_ACTION_RESPONSE_VERSIONED =
|
|
169
|
-
createVersionedDataHandler<
|
|
236
|
+
createVersionedDataHandler<v4.HttpActionResponse>({
|
|
170
237
|
deserializeVersion: (bytes, version) => {
|
|
171
238
|
switch (version) {
|
|
172
239
|
case 1:
|
|
@@ -175,6 +242,8 @@ export const HTTP_ACTION_RESPONSE_VERSIONED =
|
|
|
175
242
|
return v2.decodeHttpActionResponse(bytes);
|
|
176
243
|
case 3:
|
|
177
244
|
return v3.decodeHttpActionResponse(bytes);
|
|
245
|
+
case 4:
|
|
246
|
+
return v4.decodeHttpActionResponse(bytes);
|
|
178
247
|
default:
|
|
179
248
|
throw new Error(`Unknown version ${version}`);
|
|
180
249
|
}
|
|
@@ -193,6 +262,10 @@ export const HTTP_ACTION_RESPONSE_VERSIONED =
|
|
|
193
262
|
return v3.encodeHttpActionResponse(
|
|
194
263
|
data as v3.HttpActionResponse,
|
|
195
264
|
);
|
|
265
|
+
case 4:
|
|
266
|
+
return v4.encodeHttpActionResponse(
|
|
267
|
+
data as v4.HttpActionResponse,
|
|
268
|
+
);
|
|
196
269
|
default:
|
|
197
270
|
throw new Error(`Unknown version ${version}`);
|
|
198
271
|
}
|
|
@@ -202,11 +275,13 @@ export const HTTP_ACTION_RESPONSE_VERSIONED =
|
|
|
202
275
|
});
|
|
203
276
|
|
|
204
277
|
export const HTTP_QUEUE_SEND_REQUEST_VERSIONED =
|
|
205
|
-
createVersionedDataHandler<
|
|
278
|
+
createVersionedDataHandler<v4.HttpQueueSendRequest>({
|
|
206
279
|
deserializeVersion: (bytes, version) => {
|
|
207
280
|
switch (version) {
|
|
208
281
|
case 3:
|
|
209
282
|
return v3.decodeHttpQueueSendRequest(bytes);
|
|
283
|
+
case 4:
|
|
284
|
+
return v4.decodeHttpQueueSendRequest(bytes);
|
|
210
285
|
default:
|
|
211
286
|
throw new Error(
|
|
212
287
|
`HttpQueueSendRequest only exists in version 3+, got version ${version}`,
|
|
@@ -219,6 +294,10 @@ export const HTTP_QUEUE_SEND_REQUEST_VERSIONED =
|
|
|
219
294
|
return v3.encodeHttpQueueSendRequest(
|
|
220
295
|
data as v3.HttpQueueSendRequest,
|
|
221
296
|
);
|
|
297
|
+
case 4:
|
|
298
|
+
return v4.encodeHttpQueueSendRequest(
|
|
299
|
+
data as v4.HttpQueueSendRequest,
|
|
300
|
+
);
|
|
222
301
|
default:
|
|
223
302
|
throw new Error(
|
|
224
303
|
`HttpQueueSendRequest only exists in version 3+, got version ${version}`,
|
|
@@ -230,11 +309,13 @@ export const HTTP_QUEUE_SEND_REQUEST_VERSIONED =
|
|
|
230
309
|
});
|
|
231
310
|
|
|
232
311
|
export const HTTP_QUEUE_SEND_RESPONSE_VERSIONED =
|
|
233
|
-
createVersionedDataHandler<
|
|
312
|
+
createVersionedDataHandler<v4.HttpQueueSendResponse>({
|
|
234
313
|
deserializeVersion: (bytes, version) => {
|
|
235
314
|
switch (version) {
|
|
236
315
|
case 3:
|
|
237
316
|
return v3.decodeHttpQueueSendResponse(bytes);
|
|
317
|
+
case 4:
|
|
318
|
+
return v4.decodeHttpQueueSendResponse(bytes);
|
|
238
319
|
default:
|
|
239
320
|
throw new Error(
|
|
240
321
|
`HttpQueueSendResponse only exists in version 3+, got version ${version}`,
|
|
@@ -247,6 +328,10 @@ export const HTTP_QUEUE_SEND_RESPONSE_VERSIONED =
|
|
|
247
328
|
return v3.encodeHttpQueueSendResponse(
|
|
248
329
|
data as v3.HttpQueueSendResponse,
|
|
249
330
|
);
|
|
331
|
+
case 4:
|
|
332
|
+
return v4.encodeHttpQueueSendResponse(
|
|
333
|
+
data as v4.HttpQueueSendResponse,
|
|
334
|
+
);
|
|
250
335
|
default:
|
|
251
336
|
throw new Error(
|
|
252
337
|
`HttpQueueSendResponse only exists in version 3+, got version ${version}`,
|
|
@@ -258,7 +343,7 @@ export const HTTP_QUEUE_SEND_RESPONSE_VERSIONED =
|
|
|
258
343
|
});
|
|
259
344
|
|
|
260
345
|
export const HTTP_RESPONSE_ERROR_VERSIONED =
|
|
261
|
-
createVersionedDataHandler<
|
|
346
|
+
createVersionedDataHandler<v4.HttpResponseError>({
|
|
262
347
|
deserializeVersion: (bytes, version) => {
|
|
263
348
|
switch (version) {
|
|
264
349
|
case 1:
|
|
@@ -267,6 +352,8 @@ export const HTTP_RESPONSE_ERROR_VERSIONED =
|
|
|
267
352
|
return v2.decodeHttpResponseError(bytes);
|
|
268
353
|
case 3:
|
|
269
354
|
return v3.decodeHttpResponseError(bytes);
|
|
355
|
+
case 4:
|
|
356
|
+
return v4.decodeHttpResponseError(bytes);
|
|
270
357
|
default:
|
|
271
358
|
throw new Error(`Unknown version ${version}`);
|
|
272
359
|
}
|
|
@@ -285,16 +372,32 @@ export const HTTP_RESPONSE_ERROR_VERSIONED =
|
|
|
285
372
|
return v3.encodeHttpResponseError(
|
|
286
373
|
data as v3.HttpResponseError,
|
|
287
374
|
);
|
|
375
|
+
case 4:
|
|
376
|
+
return v4.encodeHttpResponseError(
|
|
377
|
+
data as v4.HttpResponseError,
|
|
378
|
+
);
|
|
288
379
|
default:
|
|
289
380
|
throw new Error(`Unknown version ${version}`);
|
|
290
381
|
}
|
|
291
382
|
},
|
|
292
|
-
deserializeConverters: () => [
|
|
293
|
-
|
|
383
|
+
deserializeConverters: () => [
|
|
384
|
+
(data: v1.HttpResponseError) =>
|
|
385
|
+
data as unknown as v2.HttpResponseError,
|
|
386
|
+
(data: v2.HttpResponseError) =>
|
|
387
|
+
data as unknown as v3.HttpResponseError,
|
|
388
|
+
v3HttpResponseErrorToV4,
|
|
389
|
+
],
|
|
390
|
+
serializeConverters: () => [
|
|
391
|
+
v4HttpResponseErrorToV3,
|
|
392
|
+
(data: v3.HttpResponseError) =>
|
|
393
|
+
data as unknown as v2.HttpResponseError,
|
|
394
|
+
(data: v2.HttpResponseError) =>
|
|
395
|
+
data as unknown as v1.HttpResponseError,
|
|
396
|
+
],
|
|
294
397
|
});
|
|
295
398
|
|
|
296
399
|
export const HTTP_RESOLVE_RESPONSE_VERSIONED =
|
|
297
|
-
createVersionedDataHandler<
|
|
400
|
+
createVersionedDataHandler<v4.HttpResolveResponse>({
|
|
298
401
|
deserializeVersion: (bytes, version) => {
|
|
299
402
|
switch (version) {
|
|
300
403
|
case 1:
|
|
@@ -303,6 +406,8 @@ export const HTTP_RESOLVE_RESPONSE_VERSIONED =
|
|
|
303
406
|
return v2.decodeHttpResolveResponse(bytes);
|
|
304
407
|
case 3:
|
|
305
408
|
return v3.decodeHttpResolveResponse(bytes);
|
|
409
|
+
case 4:
|
|
410
|
+
return v4.decodeHttpResolveResponse(bytes);
|
|
306
411
|
default:
|
|
307
412
|
throw new Error(`Unknown version ${version}`);
|
|
308
413
|
}
|
|
@@ -321,6 +426,10 @@ export const HTTP_RESOLVE_RESPONSE_VERSIONED =
|
|
|
321
426
|
return v3.encodeHttpResolveResponse(
|
|
322
427
|
data as v3.HttpResolveResponse,
|
|
323
428
|
);
|
|
429
|
+
case 4:
|
|
430
|
+
return v4.encodeHttpResolveResponse(
|
|
431
|
+
data as v4.HttpResolveResponse,
|
|
432
|
+
);
|
|
324
433
|
default:
|
|
325
434
|
throw new Error(`Unknown version ${version}`);
|
|
326
435
|
}
|
|
@@ -3,6 +3,11 @@ import { z } from "zod/v4";
|
|
|
3
3
|
// Helper schemas
|
|
4
4
|
const UintSchema = z.bigint();
|
|
5
5
|
const OptionalUintSchema = UintSchema.nullable();
|
|
6
|
+
const ActorSpecifierSchema = z.object({
|
|
7
|
+
actorId: z.string(),
|
|
8
|
+
generation: z.union([z.number(), z.bigint()]),
|
|
9
|
+
key: z.string().optional(),
|
|
10
|
+
});
|
|
6
11
|
|
|
7
12
|
// MARK: Message To Client
|
|
8
13
|
export const InitSchema = z.object({
|
|
@@ -17,6 +22,7 @@ export const ErrorSchema = z.object({
|
|
|
17
22
|
message: z.string(),
|
|
18
23
|
metadata: z.unknown().optional(),
|
|
19
24
|
actionId: OptionalUintSchema,
|
|
25
|
+
actor: ActorSpecifierSchema.optional(),
|
|
20
26
|
});
|
|
21
27
|
export type Error = z.infer<typeof ErrorSchema>;
|
|
22
28
|
|
|
@@ -105,6 +111,7 @@ export const HttpResponseErrorSchema = z.object({
|
|
|
105
111
|
code: z.string(),
|
|
106
112
|
message: z.string(),
|
|
107
113
|
metadata: z.unknown().optional(),
|
|
114
|
+
actor: ActorSpecifierSchema.optional(),
|
|
108
115
|
});
|
|
109
116
|
export type HttpResponseError = z.infer<typeof HttpResponseErrorSchema>;
|
|
110
117
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./bare/generated/client-protocol/
|
|
1
|
+
export * from "./bare/generated/client-protocol/v4";
|
|
@@ -4,15 +4,12 @@ export interface ActorMetricsLike {
|
|
|
4
4
|
totalKvReads: number;
|
|
5
5
|
totalKvWrites: number;
|
|
6
6
|
trackSql(query: string, durationMs: number): void;
|
|
7
|
-
setSqliteVfsMetricsSource(
|
|
8
|
-
source?: () => import("./native-database").SqliteVfsMetrics | null,
|
|
9
|
-
): void;
|
|
10
7
|
}
|
|
11
8
|
|
|
12
9
|
export type InferDatabaseClient<DBProvider extends AnyDatabaseProvider> =
|
|
13
10
|
DBProvider extends DatabaseProvider<any>
|
|
14
11
|
? Awaited<ReturnType<DBProvider["createClient"]>>
|
|
15
|
-
:
|
|
12
|
+
: RawAccess;
|
|
16
13
|
|
|
17
14
|
export type SqliteBindings = unknown[] | Record<string, unknown>;
|
|
18
15
|
|
|
@@ -21,19 +18,99 @@ export interface SqliteQueryResult {
|
|
|
21
18
|
rows: unknown[][];
|
|
22
19
|
}
|
|
23
20
|
|
|
21
|
+
export interface SqliteExecuteResult extends SqliteQueryResult {
|
|
22
|
+
changes: number;
|
|
23
|
+
lastInsertRowId?: number | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface SqliteBatchStatement {
|
|
27
|
+
sql: string;
|
|
28
|
+
params?: SqliteBindings;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SqliteTransactionOptions {
|
|
32
|
+
/** Static operation name used to aggregate transaction performance. */
|
|
33
|
+
name?: string;
|
|
34
|
+
/** Deadlock-safety timeout in milliseconds. */
|
|
35
|
+
timeout?: number;
|
|
36
|
+
/** @experimental */
|
|
37
|
+
experimental?: {
|
|
38
|
+
/**
|
|
39
|
+
* Atomically includes actor and hibernatable connection state.
|
|
40
|
+
* Only single-statement `execute` calls are supported in the transaction.
|
|
41
|
+
* Concurrent actions that try to mutate state while the transaction is
|
|
42
|
+
* active fail with `actor.state_transaction_conflict`.
|
|
43
|
+
*/
|
|
44
|
+
includeState?: boolean;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* SQLite profiling configuration.
|
|
50
|
+
*
|
|
51
|
+
* @experimental This entire configuration surface is experimental and subject
|
|
52
|
+
* to change without notice.
|
|
53
|
+
*/
|
|
54
|
+
export interface SqliteProfilingOptions {
|
|
55
|
+
enabled?: boolean;
|
|
56
|
+
maxTrackedStatementFingerprints?: number;
|
|
57
|
+
maxTrackedTransactionFingerprints?: number;
|
|
58
|
+
maxPrometheusSeries?: number;
|
|
59
|
+
maxStatementsPerTransactionTrace?: number;
|
|
60
|
+
maxGetPagesRequestsPerTrace?: number;
|
|
61
|
+
maxTransactionNameBytes?: number;
|
|
62
|
+
slowOperationThresholdMs?: number;
|
|
63
|
+
baselineSampleRate?: number;
|
|
64
|
+
maxDiagnosticEventsPerMinute?: number;
|
|
65
|
+
diagnosticEventQueueCapacity?: number;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface SqliteNativeMetrics {
|
|
69
|
+
requestBuildNs: number;
|
|
70
|
+
serializeNs: number;
|
|
71
|
+
transportNs: number;
|
|
72
|
+
stateUpdateNs: number;
|
|
73
|
+
totalNs: number;
|
|
74
|
+
commitCount: number;
|
|
75
|
+
pageCacheEntries: number;
|
|
76
|
+
pageCacheWeightedSize: number;
|
|
77
|
+
pageCacheCapacityPages: number;
|
|
78
|
+
writeBufferDirtyPages: number;
|
|
79
|
+
dbSizePages: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
24
82
|
export interface SqliteDatabase {
|
|
25
83
|
exec(
|
|
26
84
|
sql: string,
|
|
27
85
|
callback?: (row: unknown[], columns: string[]) => void,
|
|
28
86
|
): Promise<void>;
|
|
87
|
+
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
88
|
+
executeBatch(
|
|
89
|
+
statements: SqliteBatchStatement[],
|
|
90
|
+
): Promise<SqliteExecuteResult[]>;
|
|
91
|
+
beginTransaction(
|
|
92
|
+
timeoutMs?: number,
|
|
93
|
+
name?: string,
|
|
94
|
+
): Promise<SqliteTransactionDatabase>;
|
|
29
95
|
run(sql: string, params?: SqliteBindings): Promise<void>;
|
|
30
96
|
query(sql: string, params?: SqliteBindings): Promise<SqliteQueryResult>;
|
|
31
|
-
|
|
32
|
-
|
|
|
97
|
+
nativeMetrics?():
|
|
98
|
+
| SqliteNativeMetrics
|
|
99
|
+
| Promise<SqliteNativeMetrics | null>
|
|
33
100
|
| null;
|
|
34
101
|
close(): Promise<void>;
|
|
35
102
|
}
|
|
36
103
|
|
|
104
|
+
export interface SqliteTransactionDatabase {
|
|
105
|
+
exec(
|
|
106
|
+
sql: string,
|
|
107
|
+
callback?: (row: unknown[], columns: string[]) => void,
|
|
108
|
+
): Promise<void>;
|
|
109
|
+
execute(sql: string, params?: SqliteBindings): Promise<SqliteExecuteResult>;
|
|
110
|
+
commit(): Promise<void>;
|
|
111
|
+
rollback(): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
|
|
37
114
|
/**
|
|
38
115
|
* Provider for opening native databases from the active runtime.
|
|
39
116
|
*/
|
|
@@ -84,6 +161,13 @@ export interface DatabaseProviderContext {
|
|
|
84
161
|
}
|
|
85
162
|
|
|
86
163
|
export type DatabaseProvider<DB extends RawAccess> = {
|
|
164
|
+
/**
|
|
165
|
+
* Local SQLite profiling controls consumed by the actor runtime.
|
|
166
|
+
*
|
|
167
|
+
* @experimental This entire configuration surface is experimental and
|
|
168
|
+
* subject to change without notice.
|
|
169
|
+
*/
|
|
170
|
+
sqliteProfiling?: SqliteProfilingOptions;
|
|
87
171
|
/**
|
|
88
172
|
* Creates a new database client for the actor.
|
|
89
173
|
* The result is passed to the actor context as `c.db`.
|
|
@@ -111,10 +195,7 @@ export interface RawDatabaseClient {
|
|
|
111
195
|
/**
|
|
112
196
|
* Drizzle database client interface (will be extended by drizzle-orm types)
|
|
113
197
|
*/
|
|
114
|
-
export
|
|
115
|
-
// This will be extended by BaseSQLiteDatabase from drizzle-orm
|
|
116
|
-
// For now, just a marker interface
|
|
117
|
-
}
|
|
198
|
+
export type DrizzleDatabaseClient = {};
|
|
118
199
|
|
|
119
200
|
type ExecuteFunction = <
|
|
120
201
|
TRow extends Record<string, unknown> = Record<string, unknown>,
|
|
@@ -128,6 +209,18 @@ export type RawAccess = {
|
|
|
128
209
|
* Executes a raw SQL query.
|
|
129
210
|
*/
|
|
130
211
|
execute: ExecuteFunction;
|
|
212
|
+
/** Runs a callback in an isolated SQLite transaction. */
|
|
213
|
+
transaction: <T>(
|
|
214
|
+
callback: (tx: RawAccess) => Promise<T> | T,
|
|
215
|
+
options?: SqliteTransactionOptions,
|
|
216
|
+
) => Promise<T>;
|
|
217
|
+
/**
|
|
218
|
+
* Returns native SQLite metrics when the active runtime supports them.
|
|
219
|
+
*/
|
|
220
|
+
nativeMetrics?: () =>
|
|
221
|
+
| SqliteNativeMetrics
|
|
222
|
+
| Promise<SqliteNativeMetrics | null>
|
|
223
|
+
| null;
|
|
131
224
|
/**
|
|
132
225
|
* Closes the database connection and releases resources.
|
|
133
226
|
*/
|