@rivetkit/supabase 2.3.24-rc.1 → 2.3.24
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/mod.js +154 -363
- package/dist/mod.mjs +154 -363
- package/package.json +3 -3
package/dist/mod.js
CHANGED
|
@@ -538,7 +538,7 @@ function unsupportedFeature(feature) {
|
|
|
538
538
|
);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
541
|
+
// ../rivetkit/dist/tsup/chunk-YH2CAWLD.js
|
|
542
542
|
var import_pino = require("pino");
|
|
543
543
|
|
|
544
544
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/external.js
|
|
@@ -13211,7 +13211,7 @@ var classic_default = external_exports;
|
|
|
13211
13211
|
// ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
|
|
13212
13212
|
var v4_default = classic_default;
|
|
13213
13213
|
|
|
13214
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
13214
|
+
// ../rivetkit/dist/tsup/chunk-YH2CAWLD.js
|
|
13215
13215
|
var cbor = __toESM(require("cbor-x"), 1);
|
|
13216
13216
|
var import_invariant = __toESM(require_invariant(), 1);
|
|
13217
13217
|
var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
|
|
@@ -13382,7 +13382,7 @@ function noopNext() {
|
|
|
13382
13382
|
}
|
|
13383
13383
|
var package_default = {
|
|
13384
13384
|
name: "rivetkit",
|
|
13385
|
-
version: "2.3.24
|
|
13385
|
+
version: "2.3.24",
|
|
13386
13386
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
13387
13387
|
license: "Apache-2.0",
|
|
13388
13388
|
keywords: [
|
|
@@ -14689,7 +14689,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
|
|
|
14689
14689
|
};
|
|
14690
14690
|
}
|
|
14691
14691
|
|
|
14692
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
14692
|
+
// ../rivetkit/dist/tsup/chunk-QMR2J7PT.js
|
|
14693
14693
|
var config2 = /* @__PURE__ */ Config({});
|
|
14694
14694
|
function readWorkflowCbor(bc) {
|
|
14695
14695
|
return readData(bc);
|
|
@@ -14987,7 +14987,7 @@ function decodeWorkflowHistoryTransport(data) {
|
|
|
14987
14987
|
return decodeWorkflowHistory(toUint8Array(data));
|
|
14988
14988
|
}
|
|
14989
14989
|
|
|
14990
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
14990
|
+
// ../rivetkit/dist/tsup/chunk-CSOHAAZK.js
|
|
14991
14991
|
function flattenActionHandlers(actions) {
|
|
14992
14992
|
const flattened = /* @__PURE__ */ Object.create(null);
|
|
14993
14993
|
for (const { name, handler } of collectActionEntries(actions)) {
|
|
@@ -15599,6 +15599,44 @@ function removePrefixFromKey(prefixedKey) {
|
|
|
15599
15599
|
return prefixedKey.slice(KEYS.KV.length);
|
|
15600
15600
|
}
|
|
15601
15601
|
|
|
15602
|
+
// ../rivetkit/dist/tsup/chunk-NSNBWLCG.js
|
|
15603
|
+
function logger() {
|
|
15604
|
+
return getLogger("actor-client");
|
|
15605
|
+
}
|
|
15606
|
+
var webSocketPromise = null;
|
|
15607
|
+
async function importWebSocket() {
|
|
15608
|
+
if (webSocketPromise !== null) {
|
|
15609
|
+
return webSocketPromise;
|
|
15610
|
+
}
|
|
15611
|
+
webSocketPromise = (async () => {
|
|
15612
|
+
let _WebSocket;
|
|
15613
|
+
if (typeof WebSocket !== "undefined") {
|
|
15614
|
+
_WebSocket = WebSocket;
|
|
15615
|
+
} else {
|
|
15616
|
+
try {
|
|
15617
|
+
const moduleName = "ws";
|
|
15618
|
+
const ws = await import(
|
|
15619
|
+
/* webpackIgnore: true */
|
|
15620
|
+
moduleName
|
|
15621
|
+
);
|
|
15622
|
+
_WebSocket = ws.default;
|
|
15623
|
+
logger().debug("using websocket from npm");
|
|
15624
|
+
} catch {
|
|
15625
|
+
_WebSocket = class MockWebSocket {
|
|
15626
|
+
constructor() {
|
|
15627
|
+
throw new Error(
|
|
15628
|
+
'WebSocket support requires installing the "ws" peer dependency.'
|
|
15629
|
+
);
|
|
15630
|
+
}
|
|
15631
|
+
};
|
|
15632
|
+
logger().debug("using mock websocket");
|
|
15633
|
+
}
|
|
15634
|
+
}
|
|
15635
|
+
return _WebSocket;
|
|
15636
|
+
})();
|
|
15637
|
+
return webSocketPromise;
|
|
15638
|
+
}
|
|
15639
|
+
|
|
15602
15640
|
// ../rivetkit/dist/tsup/chunk-JTHHCZCZ.js
|
|
15603
15641
|
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
15604
15642
|
function isManualTransactionControl(query) {
|
|
@@ -15682,45 +15720,7 @@ var AsyncMutex = class {
|
|
|
15682
15720
|
}
|
|
15683
15721
|
};
|
|
15684
15722
|
|
|
15685
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
15686
|
-
function logger() {
|
|
15687
|
-
return getLogger("actor-client");
|
|
15688
|
-
}
|
|
15689
|
-
var webSocketPromise = null;
|
|
15690
|
-
async function importWebSocket() {
|
|
15691
|
-
if (webSocketPromise !== null) {
|
|
15692
|
-
return webSocketPromise;
|
|
15693
|
-
}
|
|
15694
|
-
webSocketPromise = (async () => {
|
|
15695
|
-
let _WebSocket;
|
|
15696
|
-
if (typeof WebSocket !== "undefined") {
|
|
15697
|
-
_WebSocket = WebSocket;
|
|
15698
|
-
} else {
|
|
15699
|
-
try {
|
|
15700
|
-
const moduleName = "ws";
|
|
15701
|
-
const ws = await import(
|
|
15702
|
-
/* webpackIgnore: true */
|
|
15703
|
-
moduleName
|
|
15704
|
-
);
|
|
15705
|
-
_WebSocket = ws.default;
|
|
15706
|
-
logger().debug("using websocket from npm");
|
|
15707
|
-
} catch {
|
|
15708
|
-
_WebSocket = class MockWebSocket {
|
|
15709
|
-
constructor() {
|
|
15710
|
-
throw new Error(
|
|
15711
|
-
'WebSocket support requires installing the "ws" peer dependency.'
|
|
15712
|
-
);
|
|
15713
|
-
}
|
|
15714
|
-
};
|
|
15715
|
-
logger().debug("using mock websocket");
|
|
15716
|
-
}
|
|
15717
|
-
}
|
|
15718
|
-
return _WebSocket;
|
|
15719
|
-
})();
|
|
15720
|
-
return webSocketPromise;
|
|
15721
|
-
}
|
|
15722
|
-
|
|
15723
|
-
// ../rivetkit/dist/tsup/chunk-B6WTPGOR.js
|
|
15723
|
+
// ../rivetkit/dist/tsup/chunk-SW22GCYF.js
|
|
15724
15724
|
var import_invariant2 = __toESM(require_invariant(), 1);
|
|
15725
15725
|
|
|
15726
15726
|
// ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
|
|
@@ -16935,7 +16935,7 @@ var TraceAPI = (
|
|
|
16935
16935
|
// ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
16936
16936
|
var trace = TraceAPI.getInstance();
|
|
16937
16937
|
|
|
16938
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
16938
|
+
// ../rivetkit/dist/tsup/chunk-SW22GCYF.js
|
|
16939
16939
|
var import_invariant3 = __toESM(require_invariant(), 1);
|
|
16940
16940
|
var import_invariant4 = __toESM(require_invariant(), 1);
|
|
16941
16941
|
var PATH_CONNECT = "/connect";
|
|
@@ -19018,6 +19018,14 @@ function isResponseLike(value) {
|
|
|
19018
19018
|
function isHeadersLike(value) {
|
|
19019
19019
|
return typeof value === "object" && value !== null && typeof value.entries === "function";
|
|
19020
19020
|
}
|
|
19021
|
+
function readRequestBody(request) {
|
|
19022
|
+
if (!request.body) return request.arrayBuffer();
|
|
19023
|
+
return new Response(
|
|
19024
|
+
request.body.pipeThrough(new TransformStream(), {
|
|
19025
|
+
signal: request.signal
|
|
19026
|
+
})
|
|
19027
|
+
).arrayBuffer();
|
|
19028
|
+
}
|
|
19021
19029
|
function* walkErrorChain(error46, maxDepth = 8) {
|
|
19022
19030
|
let current = error46;
|
|
19023
19031
|
let depth = 0;
|
|
@@ -19546,9 +19554,10 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}, t
|
|
|
19546
19554
|
initHeaders.forEach((value, key) => {
|
|
19547
19555
|
mergedHeaders.set(key, value);
|
|
19548
19556
|
});
|
|
19557
|
+
const readsInputBody = (init == null ? void 0 : init.body) === void 0 && input.method !== "GET" && input.method !== "HEAD";
|
|
19549
19558
|
mergedInit = {
|
|
19550
19559
|
method: input.method,
|
|
19551
|
-
body: input
|
|
19560
|
+
body: readsInputBody ? await readRequestBody(input) : void 0,
|
|
19552
19561
|
mode: input.mode,
|
|
19553
19562
|
credentials: input.credentials,
|
|
19554
19563
|
redirect: input.redirect,
|
|
@@ -21967,6 +21976,8 @@ var ClientConfigSchemaBase = v4_default.object({
|
|
|
21967
21976
|
// This is required in the client config in order to support
|
|
21968
21977
|
// `proxyWebSocket`
|
|
21969
21978
|
getUpgradeWebSocket: v4_default.custom().optional(),
|
|
21979
|
+
/** Replaces global fetch for actor HTTP gateway requests. */
|
|
21980
|
+
fetch: v4_default.custom().optional(),
|
|
21970
21981
|
/** Whether to automatically perform health checks when the client is created. */
|
|
21971
21982
|
disableMetadataLookup: v4_default.boolean().optional().default(false),
|
|
21972
21983
|
/**
|
|
@@ -22028,18 +22039,26 @@ async function sendHttpRequestToGateway(runConfig, gatewayUrl, actorRequest, opt
|
|
|
22028
22039
|
if (actorRequest.bodyUsed) {
|
|
22029
22040
|
throw new Error("Request body has already been consumed");
|
|
22030
22041
|
}
|
|
22031
|
-
|
|
22032
|
-
|
|
22042
|
+
const bytes = await readRequestBody(actorRequest);
|
|
22043
|
+
if (bytes.byteLength > 0) {
|
|
22044
|
+
bodyToSend = bytes;
|
|
22033
22045
|
guardHeaders.delete("transfer-encoding");
|
|
22034
22046
|
guardHeaders.delete("content-length");
|
|
22035
22047
|
}
|
|
22036
22048
|
}
|
|
22037
|
-
|
|
22049
|
+
const fetchImpl = runConfig.fetch ?? fetch;
|
|
22050
|
+
return fetchImpl(gatewayUrl, {
|
|
22038
22051
|
method: actorRequest.method,
|
|
22039
22052
|
headers: guardHeaders,
|
|
22040
22053
|
body: bodyToSend,
|
|
22041
22054
|
signal: actorRequest.signal,
|
|
22042
|
-
|
|
22055
|
+
mode: actorRequest.mode,
|
|
22056
|
+
credentials: actorRequest.credentials,
|
|
22057
|
+
redirect: actorRequest.redirect,
|
|
22058
|
+
referrer: actorRequest.referrer,
|
|
22059
|
+
referrerPolicy: actorRequest.referrerPolicy,
|
|
22060
|
+
integrity: actorRequest.integrity,
|
|
22061
|
+
keepalive: actorRequest.keepalive
|
|
22043
22062
|
});
|
|
22044
22063
|
}
|
|
22045
22064
|
function buildGuardHeaders(runConfig, actorRequest, options) {
|
|
@@ -23112,7 +23131,7 @@ function apiActorToOutput(actor2) {
|
|
|
23112
23131
|
};
|
|
23113
23132
|
}
|
|
23114
23133
|
|
|
23115
|
-
// ../rivetkit/dist/tsup/chunk-
|
|
23134
|
+
// ../rivetkit/dist/tsup/chunk-QZQE75U2.js
|
|
23116
23135
|
var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
|
|
23117
23136
|
var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
|
|
23118
23137
|
function registerNativeStateTransactionOpener(provider, opener) {
|
|
@@ -26171,12 +26190,6 @@ var NapiCoreRuntime = class {
|
|
|
26171
26190
|
actorId(ctx) {
|
|
26172
26191
|
return asNativeActorContext(ctx).actorId();
|
|
26173
26192
|
}
|
|
26174
|
-
actorGeneration(ctx) {
|
|
26175
|
-
return asNativeActorContext(ctx).generation() ?? void 0;
|
|
26176
|
-
}
|
|
26177
|
-
actorIsLost(ctx) {
|
|
26178
|
-
return asNativeActorContext(ctx).isLost();
|
|
26179
|
-
}
|
|
26180
26193
|
runWithActorInvocationContext(ctx, run) {
|
|
26181
26194
|
return this.#runAs(asNativeActorContext(ctx), run);
|
|
26182
26195
|
}
|
|
@@ -26790,27 +26803,6 @@ function notifyStateChanged(state) {
|
|
|
26790
26803
|
waiter();
|
|
26791
26804
|
}
|
|
26792
26805
|
}
|
|
26793
|
-
function createRunState(actorGeneration) {
|
|
26794
|
-
return {
|
|
26795
|
-
actorGeneration,
|
|
26796
|
-
active: false,
|
|
26797
|
-
closed: false,
|
|
26798
|
-
exclusive: false,
|
|
26799
|
-
exclusiveGeneration: 0,
|
|
26800
|
-
inspectorInitialized: false,
|
|
26801
|
-
queued: 0,
|
|
26802
|
-
waiters: /* @__PURE__ */ new Set()
|
|
26803
|
-
};
|
|
26804
|
-
}
|
|
26805
|
-
function closeRunState(state, disposeInspector = true) {
|
|
26806
|
-
var _a2, _b;
|
|
26807
|
-
state.closed = true;
|
|
26808
|
-
if (disposeInspector) {
|
|
26809
|
-
(_b = (_a2 = state.inspector) == null ? void 0 : _a2.dispose) == null ? void 0 : _b.call(_a2);
|
|
26810
|
-
}
|
|
26811
|
-
state.inspector = void 0;
|
|
26812
|
-
notifyStateChanged(state);
|
|
26813
|
-
}
|
|
26814
26806
|
function waitForStateChange(state) {
|
|
26815
26807
|
return new Promise((resolve) => {
|
|
26816
26808
|
state.waiters.add(resolve);
|
|
@@ -26825,11 +26817,8 @@ var RunHandlerCoordinator = class {
|
|
|
26825
26817
|
get inspectorKind() {
|
|
26826
26818
|
return getRunInspectorKind(this.#run);
|
|
26827
26819
|
}
|
|
26828
|
-
async run(actorId, restart, callback
|
|
26829
|
-
const state = this.#getOrCreate(actorId
|
|
26830
|
-
if (state.closed) {
|
|
26831
|
-
return "closed";
|
|
26832
|
-
}
|
|
26820
|
+
async run(actorId, restart, callback) {
|
|
26821
|
+
const state = this.#getOrCreate(actorId);
|
|
26833
26822
|
state.restart = restart;
|
|
26834
26823
|
this.#initializeInspector(actorId, state);
|
|
26835
26824
|
state.queued += 1;
|
|
@@ -26856,27 +26845,21 @@ var RunHandlerCoordinator = class {
|
|
|
26856
26845
|
notifyStateChanged(state);
|
|
26857
26846
|
}
|
|
26858
26847
|
}
|
|
26859
|
-
getInspector(actorId, restart
|
|
26848
|
+
getInspector(actorId, restart) {
|
|
26860
26849
|
var _a2;
|
|
26861
|
-
const state = this.#getOrCreate(actorId
|
|
26862
|
-
if (state.closed) {
|
|
26863
|
-
return void 0;
|
|
26864
|
-
}
|
|
26850
|
+
const state = this.#getOrCreate(actorId);
|
|
26865
26851
|
state.restart = restart;
|
|
26866
26852
|
this.#initializeInspector(actorId, state);
|
|
26867
26853
|
return (_a2 = state.inspector) == null ? void 0 : _a2.inspector;
|
|
26868
26854
|
}
|
|
26869
|
-
|
|
26870
|
-
|
|
26871
|
-
* generation is closed, so an older generation's late cleanup cannot close a newer one.
|
|
26872
|
-
*/
|
|
26873
|
-
destroy(actorId, actorGeneration, options = {}) {
|
|
26855
|
+
destroy(actorId) {
|
|
26856
|
+
var _a2, _b;
|
|
26874
26857
|
const state = this.#states.get(actorId);
|
|
26875
26858
|
if (!state) return;
|
|
26876
|
-
|
|
26877
|
-
|
|
26878
|
-
|
|
26879
|
-
|
|
26859
|
+
state.closed = true;
|
|
26860
|
+
(_b = (_a2 = state.inspector) == null ? void 0 : _a2.dispose) == null ? void 0 : _b.call(_a2);
|
|
26861
|
+
state.inspector = void 0;
|
|
26862
|
+
notifyStateChanged(state);
|
|
26880
26863
|
this.#states.delete(actorId);
|
|
26881
26864
|
}
|
|
26882
26865
|
#control(actorId, state) {
|
|
@@ -26922,20 +26905,18 @@ var RunHandlerCoordinator = class {
|
|
|
26922
26905
|
}
|
|
26923
26906
|
};
|
|
26924
26907
|
}
|
|
26925
|
-
#getOrCreate(actorId
|
|
26908
|
+
#getOrCreate(actorId) {
|
|
26926
26909
|
let state = this.#states.get(actorId);
|
|
26927
|
-
if (state && actorGeneration !== void 0 && state.actorGeneration !== void 0 && state.actorGeneration !== actorGeneration) {
|
|
26928
|
-
if (actorGeneration < state.actorGeneration) {
|
|
26929
|
-
const detached = createRunState(actorGeneration);
|
|
26930
|
-
detached.closed = true;
|
|
26931
|
-
return detached;
|
|
26932
|
-
}
|
|
26933
|
-
closeRunState(state, false);
|
|
26934
|
-
this.#states.delete(actorId);
|
|
26935
|
-
state = void 0;
|
|
26936
|
-
}
|
|
26937
26910
|
if (!state) {
|
|
26938
|
-
state =
|
|
26911
|
+
state = {
|
|
26912
|
+
active: false,
|
|
26913
|
+
closed: false,
|
|
26914
|
+
exclusive: false,
|
|
26915
|
+
exclusiveGeneration: 0,
|
|
26916
|
+
inspectorInitialized: false,
|
|
26917
|
+
queued: 0,
|
|
26918
|
+
waiters: /* @__PURE__ */ new Set()
|
|
26919
|
+
};
|
|
26939
26920
|
this.#states.set(actorId, state);
|
|
26940
26921
|
}
|
|
26941
26922
|
return state;
|
|
@@ -26944,7 +26925,6 @@ var RunHandlerCoordinator = class {
|
|
|
26944
26925
|
if (state.inspectorInitialized) return;
|
|
26945
26926
|
const inspector = createRunInspector(this.#run, {
|
|
26946
26927
|
actorId,
|
|
26947
|
-
actorGeneration: state.actorGeneration,
|
|
26948
26928
|
control: this.#control(actorId, state)
|
|
26949
26929
|
});
|
|
26950
26930
|
if (this.inspectorKind === "workflow") {
|
|
@@ -27270,12 +27250,6 @@ var WasmCoreRuntime = class {
|
|
|
27270
27250
|
actorId(ctx) {
|
|
27271
27251
|
return callHandle(asWasmActorContext(ctx), "actorId");
|
|
27272
27252
|
}
|
|
27273
|
-
actorGeneration(ctx) {
|
|
27274
|
-
return callHandle(asWasmActorContext(ctx), "generation") ?? void 0;
|
|
27275
|
-
}
|
|
27276
|
-
actorIsLost(ctx) {
|
|
27277
|
-
return callHandle(asWasmActorContext(ctx), "isLost");
|
|
27278
|
-
}
|
|
27279
27253
|
runWithActorInvocationContext(_ctx, run) {
|
|
27280
27254
|
return run();
|
|
27281
27255
|
}
|
|
@@ -28102,11 +28076,8 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
28102
28076
|
await closeNativeDatabaseClient(runtime, ctx);
|
|
28103
28077
|
await closeNativeSqlDatabase(runtime, ctx);
|
|
28104
28078
|
void runtime.actorWaitForTrackedShutdownWorkUnbounded(ctx).then(async () => {
|
|
28105
|
-
|
|
28106
|
-
|
|
28107
|
-
} finally {
|
|
28108
|
-
clearNativeRuntimeState(runtime, ctx);
|
|
28109
|
-
}
|
|
28079
|
+
await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
|
|
28080
|
+
clearNativeRuntimeState(runtime, ctx);
|
|
28110
28081
|
}).catch((error46) => {
|
|
28111
28082
|
logger22().warn({
|
|
28112
28083
|
msg: "deferred native sleep cleanup failed",
|
|
@@ -28115,24 +28086,10 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
|
|
|
28115
28086
|
});
|
|
28116
28087
|
return;
|
|
28117
28088
|
}
|
|
28118
|
-
|
|
28119
|
-
await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
|
|
28120
|
-
} finally {
|
|
28121
|
-
try {
|
|
28122
|
-
await closeNativeDatabaseClient(runtime, ctx);
|
|
28123
|
-
await closeNativeSqlDatabase(runtime, ctx);
|
|
28124
|
-
} finally {
|
|
28125
|
-
clearNativeRuntimeState(runtime, ctx);
|
|
28126
|
-
}
|
|
28127
|
-
}
|
|
28128
|
-
}
|
|
28129
|
-
async function cleanupNativeLostRuntimeState(runtime, ctx) {
|
|
28089
|
+
await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
|
|
28130
28090
|
await closeNativeDatabaseClient(runtime, ctx);
|
|
28131
|
-
|
|
28132
|
-
|
|
28133
|
-
} finally {
|
|
28134
|
-
clearNativeRuntimeState(runtime, ctx);
|
|
28135
|
-
}
|
|
28091
|
+
await closeNativeSqlDatabase(runtime, ctx);
|
|
28092
|
+
clearNativeRuntimeState(runtime, ctx);
|
|
28136
28093
|
}
|
|
28137
28094
|
function closeNativeSqlDatabase(runtime, ctx) {
|
|
28138
28095
|
const runtimeState = getNativeRuntimeState(runtime, ctx);
|
|
@@ -28150,9 +28107,6 @@ async function closeNativeDatabaseClient(runtime, ctx) {
|
|
|
28150
28107
|
return;
|
|
28151
28108
|
}
|
|
28152
28109
|
runtimeState.databaseClient = void 0;
|
|
28153
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
28154
|
-
return;
|
|
28155
|
-
}
|
|
28156
28110
|
if (entry.client && typeof entry.client === "object" && "close" in entry.client && typeof entry.client.close === "function") {
|
|
28157
28111
|
await entry.client.close();
|
|
28158
28112
|
}
|
|
@@ -28578,49 +28532,6 @@ function wrapNativeCallback(callback) {
|
|
|
28578
28532
|
}
|
|
28579
28533
|
};
|
|
28580
28534
|
}
|
|
28581
|
-
var LOST_GENERATION_CLEANUP_CALLBACKS = /* @__PURE__ */ new Set(["onSleep", "onDestroy"]);
|
|
28582
|
-
function throwIfActorLost(runtime, ctx) {
|
|
28583
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
28584
|
-
throw actorGenerationLostError();
|
|
28585
|
-
}
|
|
28586
|
-
}
|
|
28587
|
-
function actorGenerationLostError() {
|
|
28588
|
-
return new RivetError(
|
|
28589
|
-
"actor",
|
|
28590
|
-
"stopping",
|
|
28591
|
-
"Actor generation was declared lost; it starts no new user callbacks."
|
|
28592
|
-
);
|
|
28593
|
-
}
|
|
28594
|
-
function refuseCallbacksAfterLost(runtime, callbacks) {
|
|
28595
|
-
const guard = (callback) => {
|
|
28596
|
-
return async (...args) => {
|
|
28597
|
-
var _a2;
|
|
28598
|
-
const ctx = (_a2 = args[1]) == null ? void 0 : _a2.ctx;
|
|
28599
|
-
if (ctx !== void 0 && callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
28600
|
-
throw encodeNativeCallbackError(actorGenerationLostError());
|
|
28601
|
-
}
|
|
28602
|
-
return await callback(...args);
|
|
28603
|
-
};
|
|
28604
|
-
};
|
|
28605
|
-
const guarded = {};
|
|
28606
|
-
for (const [name, value] of Object.entries(callbacks)) {
|
|
28607
|
-
if (LOST_GENERATION_CLEANUP_CALLBACKS.has(name)) {
|
|
28608
|
-
guarded[name] = value;
|
|
28609
|
-
} else if (typeof value === "function") {
|
|
28610
|
-
guarded[name] = guard(value);
|
|
28611
|
-
} else if (name === "actions" && value !== null && typeof value === "object") {
|
|
28612
|
-
guarded[name] = Object.fromEntries(
|
|
28613
|
-
Object.entries(value).map(([actionName, handler]) => [
|
|
28614
|
-
actionName,
|
|
28615
|
-
guard(handler)
|
|
28616
|
-
])
|
|
28617
|
-
);
|
|
28618
|
-
} else {
|
|
28619
|
-
guarded[name] = value;
|
|
28620
|
-
}
|
|
28621
|
-
}
|
|
28622
|
-
return guarded;
|
|
28623
|
-
}
|
|
28624
28535
|
function decodeArgs(value) {
|
|
28625
28536
|
const decoded = decodeValue(value);
|
|
28626
28537
|
return normalizeArgs(decoded);
|
|
@@ -29058,30 +28969,17 @@ var NativeQueueAdapter = class {
|
|
|
29058
28969
|
this.#ctx = ctx;
|
|
29059
28970
|
this.#schemas = schemas;
|
|
29060
28971
|
}
|
|
29061
|
-
// Queue results arrive after awaits, and their schema validation is user code, so each
|
|
29062
|
-
// validation checks that the generation was not lost first.
|
|
29063
|
-
#validateBody(name, body) {
|
|
29064
|
-
throwIfActorLost(this.#runtime, this.#ctx);
|
|
29065
|
-
return validateQueueBody(this.#schemas, name, body);
|
|
29066
|
-
}
|
|
29067
|
-
#validateComplete(name, response) {
|
|
29068
|
-
throwIfActorLost(this.#runtime, this.#ctx);
|
|
29069
|
-
return validateQueueComplete(this.#schemas, name, response);
|
|
29070
|
-
}
|
|
29071
|
-
#wrap(message) {
|
|
29072
|
-
throwIfActorLost(this.#runtime, this.#ctx);
|
|
29073
|
-
return wrapQueueMessage(message, this.#schemas);
|
|
29074
|
-
}
|
|
29075
28972
|
async send(name, body) {
|
|
29076
|
-
const validatedBody = this.#
|
|
29077
|
-
return
|
|
28973
|
+
const validatedBody = validateQueueBody(this.#schemas, name, body);
|
|
28974
|
+
return wrapQueueMessage(
|
|
29078
28975
|
await callNative(
|
|
29079
28976
|
() => this.#runtime.actorQueueSend(
|
|
29080
28977
|
this.#ctx,
|
|
29081
28978
|
name,
|
|
29082
28979
|
encodeValue(validatedBody)
|
|
29083
28980
|
)
|
|
29084
|
-
)
|
|
28981
|
+
),
|
|
28982
|
+
this.#schemas
|
|
29085
28983
|
);
|
|
29086
28984
|
}
|
|
29087
28985
|
async next(options) {
|
|
@@ -29124,7 +29022,9 @@ var NativeQueueAdapter = class {
|
|
|
29124
29022
|
token
|
|
29125
29023
|
)
|
|
29126
29024
|
);
|
|
29127
|
-
const wrapped = messages.map(
|
|
29025
|
+
const wrapped = messages.map(
|
|
29026
|
+
(message) => wrapQueueMessage(message, this.#schemas)
|
|
29027
|
+
);
|
|
29128
29028
|
return completable ? wrapped.map(
|
|
29129
29029
|
(message) => this.#makeCompletableMessage(message)
|
|
29130
29030
|
) : wrapped;
|
|
@@ -29138,7 +29038,7 @@ var NativeQueueAdapter = class {
|
|
|
29138
29038
|
options == null ? void 0 : options.signal
|
|
29139
29039
|
);
|
|
29140
29040
|
try {
|
|
29141
|
-
return
|
|
29041
|
+
return wrapQueueMessage(
|
|
29142
29042
|
await callNative(
|
|
29143
29043
|
() => this.#runtime.actorQueueWaitForNames(
|
|
29144
29044
|
this.#ctx,
|
|
@@ -29149,7 +29049,8 @@ var NativeQueueAdapter = class {
|
|
|
29149
29049
|
},
|
|
29150
29050
|
token
|
|
29151
29051
|
)
|
|
29152
|
-
)
|
|
29052
|
+
),
|
|
29053
|
+
this.#schemas
|
|
29153
29054
|
);
|
|
29154
29055
|
} finally {
|
|
29155
29056
|
cleanup == null ? void 0 : cleanup();
|
|
@@ -29179,7 +29080,8 @@ var NativeQueueAdapter = class {
|
|
|
29179
29080
|
await this.waitForNamesAvailable(names ?? [], options);
|
|
29180
29081
|
}
|
|
29181
29082
|
async complete(message, response) {
|
|
29182
|
-
const validatedResponse =
|
|
29083
|
+
const validatedResponse = validateQueueComplete(
|
|
29084
|
+
this.#schemas,
|
|
29183
29085
|
message.name,
|
|
29184
29086
|
response
|
|
29185
29087
|
);
|
|
@@ -29194,7 +29096,7 @@ var NativeQueueAdapter = class {
|
|
|
29194
29096
|
this.#pendingCompletableMessageIds.delete(message.id.toString());
|
|
29195
29097
|
}
|
|
29196
29098
|
async enqueueAndWait(name, body, options) {
|
|
29197
|
-
const validatedBody = this.#
|
|
29099
|
+
const validatedBody = validateQueueBody(this.#schemas, name, body);
|
|
29198
29100
|
const { token, cleanup } = await createCancellationTokenHandle(
|
|
29199
29101
|
this.#runtime,
|
|
29200
29102
|
options == null ? void 0 : options.signal
|
|
@@ -29211,7 +29113,11 @@ var NativeQueueAdapter = class {
|
|
|
29211
29113
|
token
|
|
29212
29114
|
)
|
|
29213
29115
|
);
|
|
29214
|
-
return response === void 0 || response === null ? void 0 :
|
|
29116
|
+
return response === void 0 || response === null ? void 0 : validateQueueComplete(
|
|
29117
|
+
this.#schemas,
|
|
29118
|
+
name,
|
|
29119
|
+
decodeValue(response)
|
|
29120
|
+
);
|
|
29215
29121
|
} finally {
|
|
29216
29122
|
cleanup == null ? void 0 : cleanup();
|
|
29217
29123
|
}
|
|
@@ -29592,9 +29498,6 @@ var TrackedWebSocketHandleAdapter = class {
|
|
|
29592
29498
|
}
|
|
29593
29499
|
}
|
|
29594
29500
|
#callHandler(type, handler, event2) {
|
|
29595
|
-
if ((type === "message" || type === "open") && this.#ctx.isLost) {
|
|
29596
|
-
return;
|
|
29597
|
-
}
|
|
29598
29501
|
try {
|
|
29599
29502
|
const result = handler(event2);
|
|
29600
29503
|
if (!this.#isPromiseLike(result)) {
|
|
@@ -29877,13 +29780,6 @@ var ActorContextHandleAdapter = class {
|
|
|
29877
29780
|
get actorId() {
|
|
29878
29781
|
return callNativeSync(() => this.#runtime.actorId(this.#ctx));
|
|
29879
29782
|
}
|
|
29880
|
-
get actorGeneration() {
|
|
29881
|
-
return callNativeSync(() => this.#runtime.actorGeneration(this.#ctx));
|
|
29882
|
-
}
|
|
29883
|
-
/** Whether this generation was declared lost. A lost generation starts no new user code. */
|
|
29884
|
-
get isLost() {
|
|
29885
|
-
return callNativeSync(() => this.#runtime.actorIsLost(this.#ctx));
|
|
29886
|
-
}
|
|
29887
29783
|
get name() {
|
|
29888
29784
|
return callNativeSync(() => this.#runtime.actorName(this.#ctx));
|
|
29889
29785
|
}
|
|
@@ -29998,9 +29894,6 @@ var ActorContextHandleAdapter = class {
|
|
|
29998
29894
|
return this.#db;
|
|
29999
29895
|
}
|
|
30000
29896
|
const actorId = this.actorId;
|
|
30001
|
-
if (this.isLost) {
|
|
30002
|
-
throw actorGenerationLostError();
|
|
30003
|
-
}
|
|
30004
29897
|
const createdClient = await this.#databaseProvider.createClient({
|
|
30005
29898
|
actorId,
|
|
30006
29899
|
kv: {
|
|
@@ -30153,11 +30046,9 @@ var ActorContextHandleAdapter = class {
|
|
|
30153
30046
|
if (!this.#databaseProvider) {
|
|
30154
30047
|
return;
|
|
30155
30048
|
}
|
|
30156
|
-
|
|
30157
|
-
|
|
30158
|
-
|
|
30159
|
-
}
|
|
30160
|
-
await this.#databaseProvider.onMigrate(client);
|
|
30049
|
+
await this.#databaseProvider.onMigrate(
|
|
30050
|
+
await this.ensureDatabaseClient()
|
|
30051
|
+
);
|
|
30161
30052
|
}
|
|
30162
30053
|
async closeDatabase() {
|
|
30163
30054
|
this.#db = void 0;
|
|
@@ -30429,7 +30320,7 @@ var ActorContextHandleAdapter = class {
|
|
|
30429
30320
|
callNativeSync(
|
|
30430
30321
|
() => this.#runtime.actorRequestSave(this.#ctx, { immediate: false })
|
|
30431
30322
|
);
|
|
30432
|
-
if (!this.#onStateChange
|
|
30323
|
+
if (!this.#onStateChange) {
|
|
30433
30324
|
return;
|
|
30434
30325
|
}
|
|
30435
30326
|
actorState.isInOnStateChange = true;
|
|
@@ -30469,12 +30360,6 @@ var NativeWorkflowRuntimeAdapter = class {
|
|
|
30469
30360
|
#onMessagesReceived;
|
|
30470
30361
|
#completions = /* @__PURE__ */ new Map();
|
|
30471
30362
|
id;
|
|
30472
|
-
/** Actor generation, used to keep workflow registrations of different generations apart. */
|
|
30473
|
-
generation;
|
|
30474
|
-
/** Whether this generation was declared lost. Workflow code checks it before each user callback. */
|
|
30475
|
-
get isLost() {
|
|
30476
|
-
return this.#ctx.isLost;
|
|
30477
|
-
}
|
|
30478
30363
|
driver;
|
|
30479
30364
|
queueManager;
|
|
30480
30365
|
stateManager;
|
|
@@ -30482,7 +30367,6 @@ var NativeWorkflowRuntimeAdapter = class {
|
|
|
30482
30367
|
this.#ctx = ctx;
|
|
30483
30368
|
this.#onMessagesReceived = onMessagesReceived;
|
|
30484
30369
|
this.id = ctx.actorId;
|
|
30485
|
-
this.generation = ctx.actorGeneration;
|
|
30486
30370
|
this.driver = {
|
|
30487
30371
|
kvBatchGet: async (actorId, keys) => {
|
|
30488
30372
|
this.#assertActorId(actorId);
|
|
@@ -30765,23 +30649,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
30765
30649
|
const runHandlerCoordinator = getRunInspectorKind(config3.run) === "workflow" ? new RunHandlerCoordinator(config3.run) : void 0;
|
|
30766
30650
|
const getNativeWorkflowInspector = (ctx) => {
|
|
30767
30651
|
var _a22, _b;
|
|
30768
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
30769
|
-
return void 0;
|
|
30770
|
-
}
|
|
30771
30652
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
30772
30653
|
const restart = () => callNativeSync(() => runtime.actorRestartRunHandler(ctx));
|
|
30773
|
-
|
|
30774
|
-
() => runtime.actorGeneration(ctx)
|
|
30775
|
-
);
|
|
30776
|
-
const inspector = ((_a22 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(
|
|
30777
|
-
actorId,
|
|
30778
|
-
restart,
|
|
30779
|
-
actorGeneration
|
|
30780
|
-
)) == null ? void 0 : _a22.workflow) ?? ((_b = getRunInspectorConfig(config3.run, actorId)) == null ? void 0 : _b.workflow);
|
|
30781
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
30782
|
-
return void 0;
|
|
30783
|
-
}
|
|
30784
|
-
return inspector;
|
|
30654
|
+
return ((_a22 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(actorId, restart)) == null ? void 0 : _a22.workflow) ?? ((_b = getRunInspectorConfig(config3.run, actorId)) == null ? void 0 : _b.workflow);
|
|
30785
30655
|
};
|
|
30786
30656
|
const onStateChange = typeof config3.onStateChange === "function" ? (actorCtx, nextState) => {
|
|
30787
30657
|
config3.onStateChange(actorCtx, nextState);
|
|
@@ -30858,10 +30728,6 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
30858
30728
|
return errorResponse(error46, 401);
|
|
30859
30729
|
}
|
|
30860
30730
|
}
|
|
30861
|
-
const inspectorConnParams = (conn) => {
|
|
30862
|
-
throwIfActorLost(runtime, ctx);
|
|
30863
|
-
return conn.params;
|
|
30864
|
-
};
|
|
30865
30731
|
const workflowHistory = () => {
|
|
30866
30732
|
var _a3;
|
|
30867
30733
|
return serializeWorkflowHistoryForJson(
|
|
@@ -30895,7 +30761,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
30895
30761
|
id: conn.id,
|
|
30896
30762
|
details: {
|
|
30897
30763
|
type: null,
|
|
30898
|
-
params:
|
|
30764
|
+
params: conn.params,
|
|
30899
30765
|
stateEnabled: true,
|
|
30900
30766
|
state: conn.state,
|
|
30901
30767
|
subscriptions: 0,
|
|
@@ -31099,7 +30965,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31099
30965
|
id: conn.id,
|
|
31100
30966
|
details: {
|
|
31101
30967
|
type: null,
|
|
31102
|
-
params:
|
|
30968
|
+
params: conn.params,
|
|
31103
30969
|
stateEnabled: true,
|
|
31104
30970
|
state: conn.state,
|
|
31105
30971
|
subscriptions: 0,
|
|
@@ -31146,20 +31012,15 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31146
31012
|
);
|
|
31147
31013
|
}
|
|
31148
31014
|
const args = body.properties !== void 0 ? [body.properties] : normalizeArgs(body.args);
|
|
31149
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
31150
|
-
return jsonResponse(
|
|
31151
|
-
{ error: "actor generation was declared lost" },
|
|
31152
|
-
{ status: 503 }
|
|
31153
|
-
);
|
|
31154
|
-
}
|
|
31155
31015
|
try {
|
|
31156
|
-
const
|
|
31157
|
-
|
|
31158
|
-
|
|
31159
|
-
|
|
31016
|
+
const output = await action(
|
|
31017
|
+
actorCtx,
|
|
31018
|
+
...validateActionArgs(
|
|
31019
|
+
schemaConfig.actionInputSchemas,
|
|
31020
|
+
actionName,
|
|
31021
|
+
args
|
|
31022
|
+
)
|
|
31160
31023
|
);
|
|
31161
|
-
throwIfActorLost(runtime, ctx);
|
|
31162
|
-
const output = await action(actorCtx, ...validatedArgs);
|
|
31163
31024
|
return jsonResponse({ output });
|
|
31164
31025
|
} catch (error46) {
|
|
31165
31026
|
logger22().error({
|
|
@@ -31263,9 +31124,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31263
31124
|
await actorCtx.closeDatabase();
|
|
31264
31125
|
}
|
|
31265
31126
|
await actorCtx.runDatabaseMigrations();
|
|
31266
|
-
if (typeof config3.onMigrate === "function"
|
|
31267
|
-
() => runtime.actorIsLost(ctx)
|
|
31268
|
-
)) {
|
|
31127
|
+
if (typeof config3.onMigrate === "function") {
|
|
31269
31128
|
await config3.onMigrate(actorCtx, isNew);
|
|
31270
31129
|
}
|
|
31271
31130
|
} catch (error210) {
|
|
@@ -31308,29 +31167,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31308
31167
|
const { ctx } = unwrapTsfnPayload(error46, payload);
|
|
31309
31168
|
const actorCtx = makeActorCtx(ctx);
|
|
31310
31169
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
31311
|
-
const actorGeneration = callNativeSync(
|
|
31312
|
-
() => runtime.actorGeneration(ctx)
|
|
31313
|
-
);
|
|
31314
|
-
const isLost = () => callNativeSync(() => runtime.actorIsLost(ctx));
|
|
31315
|
-
if (isLost()) {
|
|
31316
|
-
try {
|
|
31317
|
-
await cleanupNativeLostRuntimeState(runtime, ctx);
|
|
31318
|
-
} finally {
|
|
31319
|
-
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(
|
|
31320
|
-
actorId,
|
|
31321
|
-
actorGeneration,
|
|
31322
|
-
{
|
|
31323
|
-
disposeInspector: false
|
|
31324
|
-
}
|
|
31325
|
-
);
|
|
31326
|
-
await actorCtx.dispose();
|
|
31327
|
-
}
|
|
31328
|
-
return;
|
|
31329
|
-
}
|
|
31330
31170
|
const saveActorState = async () => {
|
|
31331
|
-
if (isLost()) {
|
|
31332
|
-
return;
|
|
31333
|
-
}
|
|
31334
31171
|
if (runtime.kind === "wasm") {
|
|
31335
31172
|
await runtime.actorSaveState(
|
|
31336
31173
|
ctx,
|
|
@@ -31349,26 +31186,14 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31349
31186
|
await saveActorState();
|
|
31350
31187
|
} finally {
|
|
31351
31188
|
try {
|
|
31352
|
-
|
|
31353
|
-
|
|
31354
|
-
|
|
31355
|
-
|
|
31356
|
-
runtime,
|
|
31357
|
-
ctx,
|
|
31358
|
-
saveActorState
|
|
31359
|
-
);
|
|
31360
|
-
}
|
|
31361
|
-
} finally {
|
|
31362
|
-
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(
|
|
31363
|
-
actorId,
|
|
31364
|
-
actorGeneration,
|
|
31365
|
-
{
|
|
31366
|
-
disposeInspector: !isLost()
|
|
31367
|
-
}
|
|
31189
|
+
await cleanupNativeSleepRuntimeState(
|
|
31190
|
+
runtime,
|
|
31191
|
+
ctx,
|
|
31192
|
+
saveActorState
|
|
31368
31193
|
);
|
|
31369
|
-
|
|
31370
|
-
|
|
31371
|
-
|
|
31194
|
+
} finally {
|
|
31195
|
+
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
|
|
31196
|
+
disposeRunInspector(config3.run, actorId);
|
|
31372
31197
|
await actorCtx.dispose();
|
|
31373
31198
|
}
|
|
31374
31199
|
}
|
|
@@ -31379,17 +31204,10 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31379
31204
|
const { ctx } = unwrapTsfnPayload(error46, payload);
|
|
31380
31205
|
const actorCtx = makeActorCtx(ctx);
|
|
31381
31206
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
31382
|
-
|
|
31383
|
-
|
|
31384
|
-
actorId,
|
|
31385
|
-
callNativeSync(() => runtime.actorGeneration(ctx)),
|
|
31386
|
-
{ disposeInspector: !isLost() }
|
|
31387
|
-
);
|
|
31388
|
-
if (!isLost()) {
|
|
31389
|
-
disposeRunInspector(config3.run, actorId);
|
|
31390
|
-
}
|
|
31207
|
+
runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
|
|
31208
|
+
disposeRunInspector(config3.run, actorId);
|
|
31391
31209
|
try {
|
|
31392
|
-
if (typeof config3.onDestroy === "function"
|
|
31210
|
+
if (typeof config3.onDestroy === "function") {
|
|
31393
31211
|
await config3.onDestroy(actorCtx);
|
|
31394
31212
|
}
|
|
31395
31213
|
} finally {
|
|
@@ -31411,14 +31229,12 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31411
31229
|
request ? buildNativeHttpRequest(request) : void 0
|
|
31412
31230
|
);
|
|
31413
31231
|
try {
|
|
31414
|
-
const validatedParams = validateConnParams(
|
|
31415
|
-
schemaConfig.connParamsSchema,
|
|
31416
|
-
decodeValue(params)
|
|
31417
|
-
);
|
|
31418
|
-
throwIfActorLost(runtime, ctx);
|
|
31419
31232
|
await config3.onBeforeConnect(
|
|
31420
31233
|
actorCtx,
|
|
31421
|
-
|
|
31234
|
+
validateConnParams(
|
|
31235
|
+
schemaConfig.connParamsSchema,
|
|
31236
|
+
decodeValue(params)
|
|
31237
|
+
)
|
|
31422
31238
|
);
|
|
31423
31239
|
} finally {
|
|
31424
31240
|
await actorCtx.dispose();
|
|
@@ -31446,22 +31262,13 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31446
31262
|
() => actorCtx.assertCanMutateState()
|
|
31447
31263
|
);
|
|
31448
31264
|
try {
|
|
31449
|
-
|
|
31450
|
-
|
|
31451
|
-
|
|
31452
|
-
config3.connState
|
|
31453
|
-
);
|
|
31454
|
-
} else {
|
|
31455
|
-
const validatedParams = validateConnParams(
|
|
31265
|
+
const nextConnState = hasStaticConnState ? structuredClone(config3.connState) : await config3.createConnState(
|
|
31266
|
+
actorCtx,
|
|
31267
|
+
validateConnParams(
|
|
31456
31268
|
schemaConfig.connParamsSchema,
|
|
31457
31269
|
decodeValue(params)
|
|
31458
|
-
)
|
|
31459
|
-
|
|
31460
|
-
nextConnState = await config3.createConnState(
|
|
31461
|
-
actorCtx,
|
|
31462
|
-
validatedParams
|
|
31463
|
-
);
|
|
31464
|
-
}
|
|
31270
|
+
)
|
|
31271
|
+
);
|
|
31465
31272
|
connAdapter.initializeState(nextConnState);
|
|
31466
31273
|
return encodeValue(nextConnState);
|
|
31467
31274
|
} finally {
|
|
@@ -31566,9 +31373,6 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31566
31373
|
onBeforeActionResponse: typeof config3.onBeforeActionResponse === "function" ? wrapNativeCallback(
|
|
31567
31374
|
async (error46, payload) => {
|
|
31568
31375
|
const { ctx, name, args, output } = unwrapTsfnPayload(error46, payload);
|
|
31569
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
31570
|
-
return output;
|
|
31571
|
-
}
|
|
31572
31376
|
const actorCtx = makeActorCtx(ctx);
|
|
31573
31377
|
try {
|
|
31574
31378
|
return encodeValue(
|
|
@@ -31637,7 +31441,6 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31637
31441
|
}
|
|
31638
31442
|
};
|
|
31639
31443
|
try {
|
|
31640
|
-
throwIfActorLost(runtime, ctx);
|
|
31641
31444
|
const connParams = validateConnParams(
|
|
31642
31445
|
schemaConfig.connParamsSchema,
|
|
31643
31446
|
rawConnParams ? JSON.parse(rawConnParams) : void 0
|
|
@@ -31672,11 +31475,6 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31672
31475
|
abortRequest
|
|
31673
31476
|
);
|
|
31674
31477
|
}
|
|
31675
|
-
if (callNativeSync(
|
|
31676
|
-
() => runtime.actorIsLost(ctx)
|
|
31677
|
-
)) {
|
|
31678
|
-
throw actorGenerationLostError();
|
|
31679
|
-
}
|
|
31680
31478
|
const response = await config3.onRequest(
|
|
31681
31479
|
requestCtx,
|
|
31682
31480
|
handlerRequest
|
|
@@ -31749,9 +31547,6 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31749
31547
|
const { ctx } = unwrapTsfnPayload(error46, payload);
|
|
31750
31548
|
const actorId = callNativeSync(() => runtime.actorId(ctx));
|
|
31751
31549
|
const executeRun = async () => {
|
|
31752
|
-
if (callNativeSync(() => runtime.actorIsLost(ctx))) {
|
|
31753
|
-
return;
|
|
31754
|
-
}
|
|
31755
31550
|
const actorCtx = makeActorCtx(ctx);
|
|
31756
31551
|
try {
|
|
31757
31552
|
await run(actorCtx);
|
|
@@ -31765,8 +31560,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31765
31560
|
() => callNativeSync(
|
|
31766
31561
|
() => runtime.actorRestartRunHandler(ctx)
|
|
31767
31562
|
),
|
|
31768
|
-
executeRun
|
|
31769
|
-
callNativeSync(() => runtime.actorGeneration(ctx))
|
|
31563
|
+
executeRun
|
|
31770
31564
|
);
|
|
31771
31565
|
return outcome !== "suppressed";
|
|
31772
31566
|
}
|
|
@@ -31806,16 +31600,14 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31806
31600
|
const actorCtx = conn != null ? makeConnCtx(ctx, conn, void 0, cancelToken) : makeActorCtx(ctx, void 0, cancelToken);
|
|
31807
31601
|
const runAction = async () => {
|
|
31808
31602
|
try {
|
|
31809
|
-
const validatedArgs = validateActionArgs(
|
|
31810
|
-
schemaConfig.actionInputSchemas,
|
|
31811
|
-
name,
|
|
31812
|
-
decodeArgs(args)
|
|
31813
|
-
);
|
|
31814
|
-
throwIfActorLost(runtime, ctx);
|
|
31815
31603
|
return encodeValue(
|
|
31816
31604
|
await handler(
|
|
31817
31605
|
actorCtx,
|
|
31818
|
-
...
|
|
31606
|
+
...validateActionArgs(
|
|
31607
|
+
schemaConfig.actionInputSchemas,
|
|
31608
|
+
name,
|
|
31609
|
+
decodeArgs(args)
|
|
31610
|
+
),
|
|
31819
31611
|
...scheduledFire ? [scheduledFire] : []
|
|
31820
31612
|
)
|
|
31821
31613
|
);
|
|
@@ -31871,7 +31663,6 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31871
31663
|
if (canPublish && !await canPublish(actorCtx)) {
|
|
31872
31664
|
throw forbiddenError();
|
|
31873
31665
|
}
|
|
31874
|
-
throwIfActorLost(runtime, ctx);
|
|
31875
31666
|
const decodedBody = decodeValue(body);
|
|
31876
31667
|
if (wait) {
|
|
31877
31668
|
try {
|
|
@@ -31915,7 +31706,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
|
|
|
31915
31706
|
)
|
|
31916
31707
|
};
|
|
31917
31708
|
return runtime.createActorFactory(
|
|
31918
|
-
|
|
31709
|
+
callbacks,
|
|
31919
31710
|
buildActorConfig(definition, registryConfig, runtime.kind)
|
|
31920
31711
|
);
|
|
31921
31712
|
}
|