rivetkit 3.1.2-rc.3 → 3.1.2-rc.5
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.js +40 -18
- 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-MJCM3IZN.cjs → chunk-2BOGDAXY.cjs} +3 -3
- package/dist/tsup/{chunk-MJCM3IZN.cjs.map → chunk-2BOGDAXY.cjs.map} +1 -1
- package/dist/tsup/{chunk-WJSHEWTP.js → chunk-2PPPGFWJ.js} +4 -4
- package/dist/tsup/{chunk-POKN6RC5.js → chunk-3T3EMLZW.js} +2 -2
- package/dist/tsup/{chunk-POKN6RC5.js.map → chunk-3T3EMLZW.js.map} +1 -1
- package/dist/tsup/{chunk-YXBMGSYD.js → chunk-4M2YYW5C.js} +2 -2
- package/dist/tsup/{chunk-P57K5DTD.cjs → chunk-62HCCSWY.cjs} +3 -3
- package/dist/tsup/{chunk-P57K5DTD.cjs.map → chunk-62HCCSWY.cjs.map} +1 -1
- package/dist/tsup/{chunk-JK62DI4K.cjs → chunk-6JRISJJK.cjs} +4 -4
- package/dist/tsup/{chunk-JK62DI4K.cjs.map → chunk-6JRISJJK.cjs.map} +1 -1
- package/dist/tsup/{chunk-WCVT6UXF.js → chunk-6KETXN6K.js} +42 -20
- package/dist/tsup/chunk-6KETXN6K.js.map +1 -0
- package/dist/tsup/{chunk-MJWDZ4CU.cjs → chunk-CKNOZ3G3.cjs} +2 -2
- package/dist/tsup/{chunk-MJWDZ4CU.cjs.map → chunk-CKNOZ3G3.cjs.map} +1 -1
- package/dist/tsup/{chunk-6ANYUVLS.cjs → chunk-GSS3YRUD.cjs} +3 -3
- package/dist/tsup/{chunk-6ANYUVLS.cjs.map → chunk-GSS3YRUD.cjs.map} +1 -1
- package/dist/tsup/{chunk-C2I4CPLD.cjs → chunk-ITW5YHD2.cjs} +7 -7
- package/dist/tsup/{chunk-C2I4CPLD.cjs.map → chunk-ITW5YHD2.cjs.map} +1 -1
- package/dist/tsup/{chunk-2BXN54R4.js → chunk-J7FZTBPN.js} +2 -2
- package/dist/tsup/{chunk-6S73EWWS.js → chunk-KRUDOIRE.js} +2 -2
- package/dist/tsup/{chunk-X4HPTBGP.cjs → chunk-MFJDJ2X6.cjs} +10 -10
- package/dist/tsup/{chunk-X4HPTBGP.cjs.map → chunk-MFJDJ2X6.cjs.map} +1 -1
- package/dist/tsup/{chunk-3ALVCHXR.js → chunk-OLOQ3NAM.js} +3 -3
- package/dist/tsup/{chunk-ZWLSBELO.js → chunk-URACKJQW.js} +2 -2
- package/dist/tsup/{chunk-6YDPLY6F.cjs → chunk-W7R5OF2Y.cjs} +185 -163
- package/dist/tsup/chunk-W7R5OF2Y.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +5 -5
- 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/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/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/mod.cjs +86 -86
- package/dist/tsup/mod.js +5 -5
- package/dist/tsup/test/mod.cjs +6 -6
- 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.js +4 -4
- package/package.json +9 -9
- package/src/client/actor-handle.ts +1 -0
- package/src/client/client.ts +4 -1
- package/src/client/lifecycle-errors.ts +22 -0
- package/src/client/resolve-gateway-target.ts +34 -15
- package/dist/tsup/chunk-6YDPLY6F.cjs.map +0 -1
- package/dist/tsup/chunk-WCVT6UXF.js.map +0 -1
- /package/dist/tsup/{chunk-WJSHEWTP.js.map → chunk-2PPPGFWJ.js.map} +0 -0
- /package/dist/tsup/{chunk-YXBMGSYD.js.map → chunk-4M2YYW5C.js.map} +0 -0
- /package/dist/tsup/{chunk-2BXN54R4.js.map → chunk-J7FZTBPN.js.map} +0 -0
- /package/dist/tsup/{chunk-6S73EWWS.js.map → chunk-KRUDOIRE.js.map} +0 -0
- /package/dist/tsup/{chunk-3ALVCHXR.js.map → chunk-OLOQ3NAM.js.map} +0 -0
- /package/dist/tsup/{chunk-ZWLSBELO.js.map → chunk-URACKJQW.js.map} +0 -0
package/dist/browser/client.js
CHANGED
|
@@ -230,7 +230,7 @@ function noopNext() {
|
|
|
230
230
|
// package.json
|
|
231
231
|
var package_default = {
|
|
232
232
|
name: "rivetkit",
|
|
233
|
-
version: "3.1.2-rc.
|
|
233
|
+
version: "3.1.2-rc.5",
|
|
234
234
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
235
235
|
license: "Apache-2.0",
|
|
236
236
|
keywords: [
|
|
@@ -5161,6 +5161,15 @@ function isRetryableForkRefusal(error) {
|
|
|
5161
5161
|
}
|
|
5162
5162
|
return false;
|
|
5163
5163
|
}
|
|
5164
|
+
function isRetryableCreateRefusal(error) {
|
|
5165
|
+
if (isRetryableLifecycleRequestError(error)) {
|
|
5166
|
+
return true;
|
|
5167
|
+
}
|
|
5168
|
+
if (!(error instanceof RivetError) || retryAfterMs(error) === void 0) {
|
|
5169
|
+
return false;
|
|
5170
|
+
}
|
|
5171
|
+
return error.group === "depot" && (error.code === "overloaded" || error.code === "read_interrupted") || error.group === "guard" && error.code === "service_unavailable" || error.group === "namespace" && error.code === "creating";
|
|
5172
|
+
}
|
|
5164
5173
|
async function retryOnLifecycleBoundary(run, opts) {
|
|
5165
5174
|
const maxAttempts = opts?.maxAttempts ?? 5;
|
|
5166
5175
|
const initialDelayMs = opts?.initialDelayMs ?? 25;
|
|
@@ -6694,7 +6703,12 @@ async function rawWebSocket(driver, target, params, path, _protocols, options =
|
|
|
6694
6703
|
}
|
|
6695
6704
|
|
|
6696
6705
|
// src/client/resolve-gateway-target.ts
|
|
6697
|
-
async function resolveGatewayTarget(driver, target) {
|
|
6706
|
+
async function resolveGatewayTarget(driver, target, opts) {
|
|
6707
|
+
const retryCreate = (run) => retryOnLifecycleBoundary(run, {
|
|
6708
|
+
signal: opts?.signal,
|
|
6709
|
+
budget: opts?.budget,
|
|
6710
|
+
isRetryable: isRetryableCreateRefusal
|
|
6711
|
+
});
|
|
6698
6712
|
if ("directId" in target) {
|
|
6699
6713
|
return target.directId;
|
|
6700
6714
|
}
|
|
@@ -6714,23 +6728,27 @@ async function resolveGatewayTarget(driver, target) {
|
|
|
6714
6728
|
return output.actorId;
|
|
6715
6729
|
}
|
|
6716
6730
|
if ("getOrCreateForKey" in target) {
|
|
6717
|
-
const output = await
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6723
|
-
|
|
6731
|
+
const output = await retryCreate(
|
|
6732
|
+
() => driver.getOrCreateWithKey({
|
|
6733
|
+
name: target.getOrCreateForKey.name,
|
|
6734
|
+
key: target.getOrCreateForKey.key,
|
|
6735
|
+
input: target.getOrCreateForKey.input,
|
|
6736
|
+
region: target.getOrCreateForKey.region,
|
|
6737
|
+
poolName: target.getOrCreateForKey.poolName
|
|
6738
|
+
})
|
|
6739
|
+
);
|
|
6724
6740
|
return output.actorId;
|
|
6725
6741
|
}
|
|
6726
6742
|
if ("create" in target) {
|
|
6727
|
-
const output = await
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6743
|
+
const output = await retryCreate(
|
|
6744
|
+
() => driver.createActor({
|
|
6745
|
+
name: target.create.name,
|
|
6746
|
+
key: target.create.key,
|
|
6747
|
+
input: target.create.input,
|
|
6748
|
+
region: target.create.region,
|
|
6749
|
+
poolName: target.create.poolName
|
|
6750
|
+
})
|
|
6751
|
+
);
|
|
6734
6752
|
return output.actorId;
|
|
6735
6753
|
}
|
|
6736
6754
|
throw invalidRequest("Invalid query format");
|
|
@@ -7152,7 +7170,8 @@ var ActorHandleRaw = class {
|
|
|
7152
7170
|
if (!this.#resolvingActorId) {
|
|
7153
7171
|
this.#resolvingActorId = resolveGatewayTarget(
|
|
7154
7172
|
this.#driver,
|
|
7155
|
-
this.#actorResolutionState
|
|
7173
|
+
this.#actorResolutionState,
|
|
7174
|
+
{ budget: this.#retryBudget, signal: this.#signal }
|
|
7156
7175
|
).then((actorId) => {
|
|
7157
7176
|
this.#resolvedActorId = actorId;
|
|
7158
7177
|
return actorId;
|
|
@@ -7626,7 +7645,10 @@ var ClientRaw = class {
|
|
|
7626
7645
|
parameters: opts?.params,
|
|
7627
7646
|
create: createQuery.create
|
|
7628
7647
|
});
|
|
7629
|
-
const actorId = await resolveGatewayTarget(this.#driver, createQuery
|
|
7648
|
+
const actorId = await resolveGatewayTarget(this.#driver, createQuery, {
|
|
7649
|
+
budget: this.#retryBudget,
|
|
7650
|
+
signal: opts?.signal
|
|
7651
|
+
});
|
|
7630
7652
|
logger2().debug({
|
|
7631
7653
|
msg: "created actor with ID",
|
|
7632
7654
|
name,
|