rivetkit 3.1.2-rc.4 → 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.
Files changed (65) hide show
  1. package/dist/browser/client.js +40 -18
  2. package/dist/browser/client.js.map +1 -1
  3. package/dist/browser/inspector/client.js +1 -1
  4. package/dist/browser/inspector/client.js.map +1 -1
  5. package/dist/tsup/{chunk-J6FABVZY.cjs → chunk-2BOGDAXY.cjs} +3 -3
  6. package/dist/tsup/{chunk-J6FABVZY.cjs.map → chunk-2BOGDAXY.cjs.map} +1 -1
  7. package/dist/tsup/{chunk-YJWR3YQX.js → chunk-2PPPGFWJ.js} +4 -4
  8. package/dist/tsup/{chunk-UWN46MY2.js → chunk-3T3EMLZW.js} +2 -2
  9. package/dist/tsup/{chunk-UWN46MY2.js.map → chunk-3T3EMLZW.js.map} +1 -1
  10. package/dist/tsup/{chunk-6476KISG.js → chunk-4M2YYW5C.js} +2 -2
  11. package/dist/tsup/{chunk-2NDVJNGH.cjs → chunk-62HCCSWY.cjs} +3 -3
  12. package/dist/tsup/{chunk-2NDVJNGH.cjs.map → chunk-62HCCSWY.cjs.map} +1 -1
  13. package/dist/tsup/{chunk-6AD2HIBH.cjs → chunk-6JRISJJK.cjs} +4 -4
  14. package/dist/tsup/{chunk-6AD2HIBH.cjs.map → chunk-6JRISJJK.cjs.map} +1 -1
  15. package/dist/tsup/{chunk-OS3NPWVL.js → chunk-6KETXN6K.js} +42 -20
  16. package/dist/tsup/chunk-6KETXN6K.js.map +1 -0
  17. package/dist/tsup/{chunk-VWIV375X.cjs → chunk-CKNOZ3G3.cjs} +2 -2
  18. package/dist/tsup/{chunk-VWIV375X.cjs.map → chunk-CKNOZ3G3.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-QSO2JLX2.cjs → chunk-GSS3YRUD.cjs} +3 -3
  20. package/dist/tsup/{chunk-QSO2JLX2.cjs.map → chunk-GSS3YRUD.cjs.map} +1 -1
  21. package/dist/tsup/{chunk-P3P4I45V.cjs → chunk-ITW5YHD2.cjs} +7 -7
  22. package/dist/tsup/{chunk-P3P4I45V.cjs.map → chunk-ITW5YHD2.cjs.map} +1 -1
  23. package/dist/tsup/{chunk-OJ37CYEU.js → chunk-J7FZTBPN.js} +2 -2
  24. package/dist/tsup/{chunk-S26YAPYA.js → chunk-KRUDOIRE.js} +2 -2
  25. package/dist/tsup/{chunk-WJA6TRRE.cjs → chunk-MFJDJ2X6.cjs} +10 -10
  26. package/dist/tsup/{chunk-WJA6TRRE.cjs.map → chunk-MFJDJ2X6.cjs.map} +1 -1
  27. package/dist/tsup/{chunk-NSAMWM3A.js → chunk-OLOQ3NAM.js} +3 -3
  28. package/dist/tsup/{chunk-YCGI3WIV.js → chunk-URACKJQW.js} +2 -2
  29. package/dist/tsup/{chunk-Z367MDQC.cjs → chunk-W7R5OF2Y.cjs} +185 -163
  30. package/dist/tsup/chunk-W7R5OF2Y.cjs.map +1 -0
  31. package/dist/tsup/client/mod.cjs +5 -5
  32. package/dist/tsup/client/mod.js +4 -4
  33. package/dist/tsup/common/log.cjs +2 -2
  34. package/dist/tsup/common/log.js +1 -1
  35. package/dist/tsup/common/websocket.cjs +3 -3
  36. package/dist/tsup/common/websocket.js +2 -2
  37. package/dist/tsup/db/drizzle.cjs +2 -2
  38. package/dist/tsup/db/drizzle.js +1 -1
  39. package/dist/tsup/db/mod.cjs +3 -3
  40. package/dist/tsup/db/mod.js +2 -2
  41. package/dist/tsup/inspector/mod.cjs +5 -5
  42. package/dist/tsup/inspector/mod.js +4 -4
  43. package/dist/tsup/inspector/workflow.cjs +4 -4
  44. package/dist/tsup/inspector/workflow.js +3 -3
  45. package/dist/tsup/mod.cjs +86 -86
  46. package/dist/tsup/mod.js +5 -5
  47. package/dist/tsup/test/mod.cjs +6 -6
  48. package/dist/tsup/test/mod.js +4 -4
  49. package/dist/tsup/utils.cjs +2 -2
  50. package/dist/tsup/utils.js +1 -1
  51. package/dist/tsup/workflow/mod.cjs +7 -7
  52. package/dist/tsup/workflow/mod.js +4 -4
  53. package/package.json +9 -9
  54. package/src/client/actor-handle.ts +1 -0
  55. package/src/client/client.ts +4 -1
  56. package/src/client/lifecycle-errors.ts +22 -0
  57. package/src/client/resolve-gateway-target.ts +34 -15
  58. package/dist/tsup/chunk-OS3NPWVL.js.map +0 -1
  59. package/dist/tsup/chunk-Z367MDQC.cjs.map +0 -1
  60. /package/dist/tsup/{chunk-YJWR3YQX.js.map → chunk-2PPPGFWJ.js.map} +0 -0
  61. /package/dist/tsup/{chunk-6476KISG.js.map → chunk-4M2YYW5C.js.map} +0 -0
  62. /package/dist/tsup/{chunk-OJ37CYEU.js.map → chunk-J7FZTBPN.js.map} +0 -0
  63. /package/dist/tsup/{chunk-S26YAPYA.js.map → chunk-KRUDOIRE.js.map} +0 -0
  64. /package/dist/tsup/{chunk-NSAMWM3A.js.map → chunk-OLOQ3NAM.js.map} +0 -0
  65. /package/dist/tsup/{chunk-YCGI3WIV.js.map → chunk-URACKJQW.js.map} +0 -0
@@ -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.4",
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 driver.getOrCreateWithKey({
6718
- name: target.getOrCreateForKey.name,
6719
- key: target.getOrCreateForKey.key,
6720
- input: target.getOrCreateForKey.input,
6721
- region: target.getOrCreateForKey.region,
6722
- poolName: target.getOrCreateForKey.poolName
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 driver.createActor({
6728
- name: target.create.name,
6729
- key: target.create.key,
6730
- input: target.create.input,
6731
- region: target.create.region,
6732
- poolName: target.create.poolName
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,