rivetkit 3.1.2-rc.5 → 3.1.2-rc.6
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 +16 -2
- package/dist/browser/client.js +18 -48
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/{chunk-3T3EMLZW.js → chunk-2OEJM5K3.js} +2 -2
- package/dist/tsup/{chunk-3T3EMLZW.js.map → chunk-2OEJM5K3.js.map} +1 -1
- package/dist/tsup/{chunk-URACKJQW.js → chunk-4GCDILHQ.js} +2 -2
- package/dist/tsup/{chunk-W7R5OF2Y.cjs → chunk-7EDYE6RS.cjs} +164 -194
- package/dist/tsup/chunk-7EDYE6RS.cjs.map +1 -0
- package/dist/tsup/{chunk-2BOGDAXY.cjs → chunk-AKADRXK5.cjs} +3 -3
- package/dist/tsup/{chunk-2BOGDAXY.cjs.map → chunk-AKADRXK5.cjs.map} +1 -1
- package/dist/tsup/{chunk-2PPPGFWJ.js → chunk-AUC22H3Q.js} +4 -4
- package/dist/tsup/{chunk-J7FZTBPN.js → chunk-GPNKYTKX.js} +2 -2
- package/dist/tsup/{chunk-4M2YYW5C.js → chunk-HEWH252Y.js} +2 -2
- package/dist/tsup/{chunk-CKNOZ3G3.cjs → chunk-JHBRUK2G.cjs} +2 -2
- package/dist/tsup/{chunk-CKNOZ3G3.cjs.map → chunk-JHBRUK2G.cjs.map} +1 -1
- package/dist/tsup/{chunk-6JRISJJK.cjs → chunk-KCL4AISR.cjs} +4 -4
- package/dist/tsup/{chunk-6JRISJJK.cjs.map → chunk-KCL4AISR.cjs.map} +1 -1
- package/dist/tsup/{chunk-KRUDOIRE.js → chunk-LFGYDRKK.js} +2 -2
- package/dist/tsup/{chunk-GSS3YRUD.cjs → chunk-NHTD4LYE.cjs} +3 -3
- package/dist/tsup/{chunk-GSS3YRUD.cjs.map → chunk-NHTD4LYE.cjs.map} +1 -1
- package/dist/tsup/{chunk-6KETXN6K.js → chunk-O6BVKXY4.js} +23 -53
- package/dist/tsup/chunk-O6BVKXY4.js.map +1 -0
- package/dist/tsup/{chunk-62HCCSWY.cjs → chunk-V32FXQ3Y.cjs} +3 -3
- package/dist/tsup/{chunk-62HCCSWY.cjs.map → chunk-V32FXQ3Y.cjs.map} +1 -1
- package/dist/tsup/{chunk-ITW5YHD2.cjs → chunk-X3EPJHTD.cjs} +7 -7
- package/dist/tsup/{chunk-ITW5YHD2.cjs.map → chunk-X3EPJHTD.cjs.map} +1 -1
- package/dist/tsup/{chunk-MFJDJ2X6.cjs → chunk-X7HD5E4N.cjs} +10 -10
- package/dist/tsup/{chunk-MFJDJ2X6.cjs.map → chunk-X7HD5E4N.cjs.map} +1 -1
- package/dist/tsup/{chunk-OLOQ3NAM.js → chunk-Y5RH2IT6.js} +3 -3
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-BbRMYCV8.d.cts → config-BMGUEKMZ.d.cts} +16 -2
- package/dist/tsup/{config-CW3AWqHa.d.ts → config-iBpXyITj.d.ts} +16 -2
- package/dist/tsup/{context-Cp64yaMW.d.ts → context-hyVakgnU.d.ts} +1 -1
- package/dist/tsup/{context-NuwP8HjQ.d.cts → context-qfvLuF0P.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +391 -127
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +310 -46
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +7 -7
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +9 -9
- package/src/client/actor-handle.ts +0 -1
- package/src/client/client.ts +1 -4
- package/src/client/lifecycle-errors.ts +0 -37
- package/src/client/resolve-gateway-target.ts +15 -34
- package/src/common/database/config.ts +52 -0
- package/src/common/database/native-database.ts +229 -18
- package/src/registry/config/index.ts +1 -3
- package/src/registry/index.ts +14 -15
- package/src/registry/napi-runtime.ts +81 -2
- package/src/registry/native.ts +66 -17
- package/src/registry/runtime.ts +53 -2
- package/src/registry/wasm-runtime.ts +88 -0
- package/dist/tsup/chunk-6KETXN6K.js.map +0 -1
- package/dist/tsup/chunk-W7R5OF2Y.cjs.map +0 -1
- /package/dist/tsup/{chunk-URACKJQW.js.map → chunk-4GCDILHQ.js.map} +0 -0
- /package/dist/tsup/{chunk-2PPPGFWJ.js.map → chunk-AUC22H3Q.js.map} +0 -0
- /package/dist/tsup/{chunk-J7FZTBPN.js.map → chunk-GPNKYTKX.js.map} +0 -0
- /package/dist/tsup/{chunk-4M2YYW5C.js.map → chunk-HEWH252Y.js.map} +0 -0
- /package/dist/tsup/{chunk-KRUDOIRE.js.map → chunk-LFGYDRKK.js.map} +0 -0
- /package/dist/tsup/{chunk-OLOQ3NAM.js.map → chunk-Y5RH2IT6.js.map} +0 -0
package/dist/tsup/test/mod.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkX3EPJHTDcjs = require('../chunk-X3EPJHTD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk7EDYE6RScjs = require('../chunk-7EDYE6RS.cjs');
|
|
7
7
|
require('../chunk-RTWH3AX3.cjs');
|
|
8
|
+
require('../chunk-NHTD4LYE.cjs');
|
|
8
9
|
require('../chunk-KVFIONKQ.cjs');
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-CKNOZ3G3.cjs');
|
|
10
|
+
require('../chunk-JHBRUK2G.cjs');
|
|
11
11
|
require('../chunk-MGI2VVF6.cjs');
|
|
12
12
|
|
|
13
13
|
// src/test/ready.ts
|
|
@@ -36,8 +36,8 @@ async function setupTest(c, registry) {
|
|
|
36
36
|
registry.config.noWelcome = true;
|
|
37
37
|
registry.start();
|
|
38
38
|
await waitForRegistryReady(registry);
|
|
39
|
-
const client =
|
|
40
|
-
...
|
|
39
|
+
const client = _chunkX3EPJHTDcjs.createClient.call(void 0, {
|
|
40
|
+
..._chunk7EDYE6RScjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
|
|
41
41
|
disableMetadataLookup: false
|
|
42
42
|
});
|
|
43
43
|
c.onTestFinished(async () => {
|
package/dist/tsup/test/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'vitest';
|
|
2
|
-
import { aK as Registry, a8 as Client } from '../config-
|
|
2
|
+
import { aK as Registry, a8 as Client } from '../config-BMGUEKMZ.cjs';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '../config-CBTr4IhE.cjs';
|
|
5
5
|
import '@rivetkit/rivetkit-wasm';
|
package/dist/tsup/test/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'vitest';
|
|
2
|
-
import { aK as Registry, a8 as Client } from '../config-
|
|
2
|
+
import { aK as Registry, a8 as Client } from '../config-iBpXyITj.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '../config-CBTr4IhE.js';
|
|
5
5
|
import '@rivetkit/rivetkit-wasm';
|
package/dist/tsup/test/mod.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-Y5RH2IT6.js";
|
|
4
4
|
import {
|
|
5
5
|
convertRegistryConfigToClientConfig
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-O6BVKXY4.js";
|
|
7
7
|
import "../chunk-A2CF6PFH.js";
|
|
8
|
+
import "../chunk-GPNKYTKX.js";
|
|
8
9
|
import "../chunk-JTHHCZCZ.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-3T3EMLZW.js";
|
|
10
|
+
import "../chunk-2OEJM5K3.js";
|
|
11
11
|
import "../chunk-ZOVJDAOW.js";
|
|
12
12
|
|
|
13
13
|
// src/test/ready.ts
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunkJHBRUK2Gcjs = require('./chunk-JHBRUK2G.cjs');
|
|
23
23
|
require('./chunk-MGI2VVF6.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
@@ -42,5 +42,5 @@ require('./chunk-MGI2VVF6.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
exports.EXTRA_ERROR_LOG =
|
|
45
|
+
exports.EXTRA_ERROR_LOG = _chunkJHBRUK2Gcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkJHBRUK2Gcjs.SinglePromiseQueue; exports.VERSION = _chunkJHBRUK2Gcjs.VERSION; exports.arrayBuffersEqual = _chunkJHBRUK2Gcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkJHBRUK2Gcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkJHBRUK2Gcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkJHBRUK2Gcjs.combineUrlPath; exports.dbg = _chunkJHBRUK2Gcjs.dbg; exports.detectRuntime = _chunkJHBRUK2Gcjs.detectRuntime; exports.getEnvUniversal = _chunkJHBRUK2Gcjs.getEnvUniversal; exports.httpUserAgent = _chunkJHBRUK2Gcjs.httpUserAgent; exports.interval = _chunkJHBRUK2Gcjs.interval; exports.joinSignals = _chunkJHBRUK2Gcjs.joinSignals; exports.jsonParseCompat = _chunkJHBRUK2Gcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkJHBRUK2Gcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkJHBRUK2Gcjs.promiseWithResolvers; exports.setLongTimeout = _chunkJHBRUK2Gcjs.setLongTimeout; exports.sleep = _chunkJHBRUK2Gcjs.sleep; exports.stringifyError = _chunkJHBRUK2Gcjs.stringifyError; exports.toUint8Array = _chunkJHBRUK2Gcjs.toUint8Array;
|
|
46
46
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2;
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var _chunkX7HD5E4Ncjs = require('../chunk-X7HD5E4N.cjs');
|
|
4
|
+
require('../chunk-AKADRXK5.cjs');
|
|
5
|
+
require('../chunk-KCL4AISR.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -13,7 +13,7 @@ var _chunkAQJFKHBKcjs = require('../chunk-AQJFKHBK.cjs');
|
|
|
13
13
|
var _chunkRTWH3AX3cjs = require('../chunk-RTWH3AX3.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkJHBRUK2Gcjs = require('../chunk-JHBRUK2G.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -769,7 +769,7 @@ function workflow(fn, options = {}) {
|
|
|
769
769
|
function getWorkflowInspector(actorId) {
|
|
770
770
|
let workflowInspector = workflowInspectors.get(actorId);
|
|
771
771
|
if (!workflowInspector) {
|
|
772
|
-
workflowInspector =
|
|
772
|
+
workflowInspector = _chunkX7HD5E4Ncjs.createWorkflowInspectorAdapter.call(void 0, );
|
|
773
773
|
workflowInspectors.set(actorId, workflowInspector);
|
|
774
774
|
}
|
|
775
775
|
return workflowInspector;
|
|
@@ -842,13 +842,13 @@ function workflow(fn, options = {}) {
|
|
|
842
842
|
if (shouldRethrowWorkflowError(error)) {
|
|
843
843
|
runCtx.log.error({
|
|
844
844
|
msg: "workflow run failed",
|
|
845
|
-
error:
|
|
845
|
+
error: _chunkJHBRUK2Gcjs.stringifyError.call(void 0, error)
|
|
846
846
|
});
|
|
847
847
|
throw error;
|
|
848
848
|
}
|
|
849
849
|
runCtx.log.warn({
|
|
850
850
|
msg: "workflow failed and will sleep until woken",
|
|
851
|
-
error:
|
|
851
|
+
error: _chunkJHBRUK2Gcjs.stringifyError.call(void 0, error)
|
|
852
852
|
});
|
|
853
853
|
} finally {
|
|
854
854
|
runCtx.abortSignal.removeEventListener("abort", onAbort);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WorkflowErrorEvent } from '@rivetkit/workflow-engine';
|
|
2
2
|
export { Loop, TryBlockCatchKind, TryBlockConfig, TryBlockFailure, TryBlockResult, TryStepCatchKind, TryStepConfig, TryStepFailure, TryStepResult, WorkflowError, WorkflowErrorEvent } from '@rivetkit/workflow-engine';
|
|
3
|
-
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-
|
|
3
|
+
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-BMGUEKMZ.cjs';
|
|
4
4
|
import { A as AnyDatabaseProvider } from '../config-CBTr4IhE.cjs';
|
|
5
|
-
import { d as WorkflowContext } from '../context-
|
|
6
|
-
export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-
|
|
5
|
+
import { d as WorkflowContext } from '../context-qfvLuF0P.cjs';
|
|
6
|
+
export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-qfvLuF0P.cjs';
|
|
7
7
|
import 'zod/v4';
|
|
8
8
|
import '@rivetkit/rivetkit-wasm';
|
|
9
9
|
import 'zod';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WorkflowErrorEvent } from '@rivetkit/workflow-engine';
|
|
2
2
|
export { Loop, TryBlockCatchKind, TryBlockConfig, TryBlockFailure, TryBlockResult, TryStepCatchKind, TryStepConfig, TryStepFailure, TryStepResult, WorkflowError, WorkflowErrorEvent } from '@rivetkit/workflow-engine';
|
|
3
|
-
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-
|
|
3
|
+
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-iBpXyITj.js';
|
|
4
4
|
import { A as AnyDatabaseProvider } from '../config-CBTr4IhE.js';
|
|
5
|
-
import { d as WorkflowContext } from '../context-
|
|
6
|
-
export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-
|
|
5
|
+
import { d as WorkflowContext } from '../context-hyVakgnU.js';
|
|
6
|
+
export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-hyVakgnU.js';
|
|
7
7
|
import 'zod/v4';
|
|
8
8
|
import '@rivetkit/rivetkit-wasm';
|
|
9
9
|
import 'zod';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWorkflowInspectorAdapter
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-AUC22H3Q.js";
|
|
4
|
+
import "../chunk-4GCDILHQ.js";
|
|
5
|
+
import "../chunk-LFGYDRKK.js";
|
|
6
6
|
import {
|
|
7
7
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
8
8
|
defineRunHandler
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "../chunk-A2CF6PFH.js";
|
|
14
14
|
import {
|
|
15
15
|
stringifyError
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-2OEJM5K3.js";
|
|
17
17
|
import {
|
|
18
18
|
RivetError,
|
|
19
19
|
isActorAbortedError
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rivetkit",
|
|
3
|
-
"version": "3.1.2-rc.
|
|
3
|
+
"version": "3.1.2-rc.6",
|
|
4
4
|
"description": "Lightweight libraries for building stateful actors on edge platforms",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -211,15 +211,15 @@
|
|
|
211
211
|
"@hono/zod-openapi": "^1.1.5",
|
|
212
212
|
"@opentelemetry/api": "^1.1.0",
|
|
213
213
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
214
|
-
"@rivetkit/engine-api-full": "3.1.2-rc.
|
|
215
|
-
"@rivetkit/engine-cli": "3.1.2-rc.
|
|
216
|
-
"@rivetkit/engine-envoy-protocol": "3.1.2-rc.
|
|
214
|
+
"@rivetkit/engine-api-full": "3.1.2-rc.6",
|
|
215
|
+
"@rivetkit/engine-cli": "3.1.2-rc.6",
|
|
216
|
+
"@rivetkit/engine-envoy-protocol": "3.1.2-rc.6",
|
|
217
217
|
"@rivetkit/on-change": "6.0.1",
|
|
218
|
-
"@rivetkit/rivetkit-napi": "3.1.2-rc.
|
|
219
|
-
"@rivetkit/rivetkit-wasm": "3.1.2-rc.
|
|
220
|
-
"@rivetkit/traces": "3.1.2-rc.
|
|
221
|
-
"@rivetkit/virtual-websocket": "3.1.2-rc.
|
|
222
|
-
"@rivetkit/workflow-engine": "3.1.2-rc.
|
|
218
|
+
"@rivetkit/rivetkit-napi": "3.1.2-rc.6",
|
|
219
|
+
"@rivetkit/rivetkit-wasm": "3.1.2-rc.6",
|
|
220
|
+
"@rivetkit/traces": "3.1.2-rc.6",
|
|
221
|
+
"@rivetkit/virtual-websocket": "3.1.2-rc.6",
|
|
222
|
+
"@rivetkit/workflow-engine": "3.1.2-rc.6",
|
|
223
223
|
"cbor-x": "^1.6.0",
|
|
224
224
|
"drizzle-orm": "0.45.2",
|
|
225
225
|
"hono": "^4.7.0",
|
|
@@ -681,7 +681,6 @@ export class ActorHandleRaw {
|
|
|
681
681
|
this.#resolvingActorId = resolveGatewayTarget(
|
|
682
682
|
this.#driver,
|
|
683
683
|
this.#actorResolutionState,
|
|
684
|
-
{ budget: this.#retryBudget, signal: this.#signal },
|
|
685
684
|
).then((actorId) => {
|
|
686
685
|
this.#resolvedActorId = actorId;
|
|
687
686
|
return actorId;
|
package/src/client/client.ts
CHANGED
|
@@ -421,10 +421,7 @@ export class ClientRaw {
|
|
|
421
421
|
});
|
|
422
422
|
|
|
423
423
|
// Create the actor
|
|
424
|
-
const actorId = await resolveGatewayTarget(this.#driver, createQuery
|
|
425
|
-
budget: this.#retryBudget,
|
|
426
|
-
signal: opts?.signal,
|
|
427
|
-
});
|
|
424
|
+
const actorId = await resolveGatewayTarget(this.#driver, createQuery);
|
|
428
425
|
logger().debug({
|
|
429
426
|
msg: "created actor with ID",
|
|
430
427
|
name,
|
|
@@ -82,21 +82,6 @@ function classifyActorError(
|
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
// Storage refused the actor's write before running it, as when a new actor's startup commit
|
|
86
|
-
// is shed under load. The connection may open again after the hint the close carried, but
|
|
87
|
-
// an action that failed this way already ran its handler, so it is not sent again.
|
|
88
|
-
if (
|
|
89
|
-
(error.group === "sqlite" && error.code === "storage_overloaded") ||
|
|
90
|
-
(error.group === "depot" && error.code === "overloaded")
|
|
91
|
-
) {
|
|
92
|
-
return buildLifecycleBoundaryInfo(
|
|
93
|
-
"reconnect_only",
|
|
94
|
-
"actor_error",
|
|
95
|
-
error.message,
|
|
96
|
-
{ group: error.group, code: error.code },
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
85
|
if (
|
|
101
86
|
(error.group === "ups" && error.code === "consumer_closed") ||
|
|
102
87
|
(error.group === "depot" && error.code === "request_deadline_exceeded")
|
|
@@ -329,28 +314,6 @@ export function isRetryableForkRefusal(error: unknown): boolean {
|
|
|
329
314
|
return false;
|
|
330
315
|
}
|
|
331
316
|
|
|
332
|
-
/**
|
|
333
|
-
* Whether the engine refused an actor create before submitting it, so sending it again cannot
|
|
334
|
-
* make a second actor: a storage, gateway or namespace refusal that carries a `retry_after_ms`
|
|
335
|
-
* hint, which the actor API answers only for a refusal left before the create was sent, or a
|
|
336
|
-
* retryable lifecycle error. A create that may already have been sent answers
|
|
337
|
-
* `actor.create_pending` instead and goes to the caller, as does every other error.
|
|
338
|
-
*/
|
|
339
|
-
export function isRetryableCreateRefusal(error: unknown): boolean {
|
|
340
|
-
if (isRetryableLifecycleRequestError(error)) {
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
if (!(error instanceof ActorError) || retryAfterMs(error) === undefined) {
|
|
344
|
-
return false;
|
|
345
|
-
}
|
|
346
|
-
return (
|
|
347
|
-
(error.group === "depot" &&
|
|
348
|
-
(error.code === "overloaded" || error.code === "read_interrupted")) ||
|
|
349
|
-
(error.group === "guard" && error.code === "service_unavailable") ||
|
|
350
|
-
(error.group === "namespace" && error.code === "creating")
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
317
|
/**
|
|
355
318
|
* Runs `run`, retrying retryable lifecycle and refusal errors with jittered exponential backoff
|
|
356
319
|
* that honors the service's `retry_after_ms` hint. With a `budget`, the call credits it once and
|
|
@@ -3,32 +3,17 @@ import type {
|
|
|
3
3
|
EngineControlClient,
|
|
4
4
|
GatewayTarget,
|
|
5
5
|
} from "@/engine-client/driver";
|
|
6
|
-
import {
|
|
7
|
-
isRetryableCreateRefusal,
|
|
8
|
-
retryOnLifecycleBoundary,
|
|
9
|
-
} from "./lifecycle-errors";
|
|
10
|
-
import type { RetryBudget } from "./retry-budget";
|
|
11
6
|
|
|
12
7
|
/**
|
|
13
8
|
* Resolves a GatewayTarget to a concrete actor ID string.
|
|
14
9
|
*
|
|
15
10
|
* Shared across all EngineControlClient implementations to avoid duplicating the
|
|
16
|
-
* same query-to-actorId dispatch logic.
|
|
17
|
-
* engine refused before submitting it is sent again after the service's hint, within
|
|
18
|
-
* `opts.budget`.
|
|
11
|
+
* same query-to-actorId dispatch logic.
|
|
19
12
|
*/
|
|
20
13
|
export async function resolveGatewayTarget(
|
|
21
14
|
driver: EngineControlClient,
|
|
22
15
|
target: GatewayTarget,
|
|
23
|
-
opts?: { budget?: RetryBudget; signal?: AbortSignal },
|
|
24
16
|
): Promise<string> {
|
|
25
|
-
const retryCreate = <T>(run: () => Promise<T>) =>
|
|
26
|
-
retryOnLifecycleBoundary(run, {
|
|
27
|
-
signal: opts?.signal,
|
|
28
|
-
budget: opts?.budget,
|
|
29
|
-
isRetryable: isRetryableCreateRefusal,
|
|
30
|
-
});
|
|
31
|
-
|
|
32
17
|
if ("directId" in target) {
|
|
33
18
|
return target.directId;
|
|
34
19
|
}
|
|
@@ -51,28 +36,24 @@ export async function resolveGatewayTarget(
|
|
|
51
36
|
}
|
|
52
37
|
|
|
53
38
|
if ("getOrCreateForKey" in target) {
|
|
54
|
-
const output = await
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
39
|
+
const output = await driver.getOrCreateWithKey({
|
|
40
|
+
name: target.getOrCreateForKey.name,
|
|
41
|
+
key: target.getOrCreateForKey.key,
|
|
42
|
+
input: target.getOrCreateForKey.input,
|
|
43
|
+
region: target.getOrCreateForKey.region,
|
|
44
|
+
poolName: target.getOrCreateForKey.poolName,
|
|
45
|
+
});
|
|
63
46
|
return output.actorId;
|
|
64
47
|
}
|
|
65
48
|
|
|
66
49
|
if ("create" in target) {
|
|
67
|
-
const output = await
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
50
|
+
const output = await driver.createActor({
|
|
51
|
+
name: target.create.name,
|
|
52
|
+
key: target.create.key,
|
|
53
|
+
input: target.create.input,
|
|
54
|
+
region: target.create.region,
|
|
55
|
+
poolName: target.create.poolName,
|
|
56
|
+
});
|
|
76
57
|
return output.actorId;
|
|
77
58
|
}
|
|
78
59
|
|
|
@@ -160,6 +160,58 @@ export interface SqliteTransactionDatabase {
|
|
|
160
160
|
rollback(): Promise<void>;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* A native database as `NativeDatabaseProvider.open` returns it. The synchronous calls and commit
|
|
165
|
+
* tickets work only when the database provider opts into deferred commits, which only embedders
|
|
166
|
+
* that hold output until writes are durable do. Internal: not exported from `rivetkit/db`.
|
|
167
|
+
*/
|
|
168
|
+
export interface DeferredSqliteDatabase extends SqliteDatabase {
|
|
169
|
+
/**
|
|
170
|
+
* Never waits behind other work. Fails with `sqlite.sync_unsupported` unless the actor uses
|
|
171
|
+
* deferred commits. Fails with the retryable `sqlite.writer_busy` while a transaction is open,
|
|
172
|
+
* including a state save, or while another call on this database is running, and with the
|
|
173
|
+
* retryable `sqlite.storage_overloaded` while too many earlier writes wait for storage.
|
|
174
|
+
*/
|
|
175
|
+
execSync(
|
|
176
|
+
sql: string,
|
|
177
|
+
callback?: (row: unknown[], columns: string[]) => void,
|
|
178
|
+
): void;
|
|
179
|
+
/** Fails like `execSync`. */
|
|
180
|
+
executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
181
|
+
/**
|
|
182
|
+
* Fails like `execSync`, also while a transaction is beginning or a manual `BEGIN` is open.
|
|
183
|
+
*/
|
|
184
|
+
beginTransactionSync(
|
|
185
|
+
timeoutMs?: number,
|
|
186
|
+
name?: string,
|
|
187
|
+
): SynchronousSqliteTransactionDatabase;
|
|
188
|
+
/**
|
|
189
|
+
* Returns the ticket of the latest local commit. Synchronous writes return before they are
|
|
190
|
+
* durable; pass the ticket to `whenDurable` before releasing output that depends on them.
|
|
191
|
+
*/
|
|
192
|
+
commitTicket(): number;
|
|
193
|
+
/**
|
|
194
|
+
* Resolves once the commit `ticket` names and every earlier commit are durable. Rejects with
|
|
195
|
+
* `sqlite.durability_failed` once the database broke and the actor is restarting.
|
|
196
|
+
*/
|
|
197
|
+
whenDurable(ticket: number): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Restarts the owning actor from durable state. Every later write fails, including the final
|
|
200
|
+
* state save. For native database providers whose in-memory state can no longer be trusted.
|
|
201
|
+
*/
|
|
202
|
+
abortGeneration(reason: string): void;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export type SynchronousSqliteTransactionDatabase = SqliteTransactionDatabase & {
|
|
206
|
+
execSync(
|
|
207
|
+
sql: string,
|
|
208
|
+
callback?: (row: unknown[], columns: string[]) => void,
|
|
209
|
+
): void;
|
|
210
|
+
executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
|
|
211
|
+
commitSync(): void;
|
|
212
|
+
rollbackSync(): void;
|
|
213
|
+
};
|
|
214
|
+
|
|
163
215
|
/**
|
|
164
216
|
* Provider for opening native databases from the active runtime.
|
|
165
217
|
*/
|