@rivetkit/supabase 2.3.11-rc.8 → 2.3.11-rc.9

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 (3) hide show
  1. package/dist/mod.js +140 -42
  2. package/dist/mod.mjs +140 -42
  3. package/package.json +3 -3
package/dist/mod.js CHANGED
@@ -508,7 +508,7 @@ function unsupportedFeature(feature) {
508
508
  );
509
509
  }
510
510
 
511
- // ../rivetkit/dist/tsup/chunk-AGNBLCNJ.js
511
+ // ../rivetkit/dist/tsup/chunk-LZ4TSBIP.js
512
512
  var import_pino = require("pino");
513
513
 
514
514
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/external.js
@@ -13181,7 +13181,7 @@ var classic_default = external_exports;
13181
13181
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
13182
13182
  var v4_default = classic_default;
13183
13183
 
13184
- // ../rivetkit/dist/tsup/chunk-AGNBLCNJ.js
13184
+ // ../rivetkit/dist/tsup/chunk-LZ4TSBIP.js
13185
13185
  var cbor = __toESM(require("cbor-x"), 1);
13186
13186
  var import_invariant = __toESM(require_invariant(), 1);
13187
13187
  var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
@@ -13346,7 +13346,7 @@ function noopNext() {
13346
13346
  }
13347
13347
  var package_default = {
13348
13348
  name: "rivetkit",
13349
- version: "2.3.11-rc.8",
13349
+ version: "2.3.11-rc.9",
13350
13350
  description: "Lightweight libraries for building stateful actors on edge platforms",
13351
13351
  license: "Apache-2.0",
13352
13352
  keywords: [
@@ -14639,7 +14639,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
14639
14639
  };
14640
14640
  }
14641
14641
 
14642
- // ../rivetkit/dist/tsup/chunk-4EDGOGCB.js
14642
+ // ../rivetkit/dist/tsup/chunk-C5TORAVP.js
14643
14643
  var config2 = /* @__PURE__ */ Config({});
14644
14644
  function readWorkflowCbor(bc) {
14645
14645
  return readData(bc);
@@ -15484,35 +15484,7 @@ function removePrefixFromKey(prefixedKey) {
15484
15484
  return prefixedKey.slice(KEYS.KV.length);
15485
15485
  }
15486
15486
 
15487
- // ../rivetkit/dist/tsup/chunk-7AFZMFPQ.js
15488
- var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
15489
- var AsyncMutex = class {
15490
- #locked = false;
15491
- #waiting = [];
15492
- async acquire() {
15493
- while (this.#locked) {
15494
- await new Promise((resolve) => this.#waiting.push(resolve));
15495
- }
15496
- this.#locked = true;
15497
- }
15498
- release() {
15499
- this.#locked = false;
15500
- const next = this.#waiting.shift();
15501
- if (next) {
15502
- next();
15503
- }
15504
- }
15505
- async run(fn) {
15506
- await this.acquire();
15507
- try {
15508
- return await fn();
15509
- } finally {
15510
- this.release();
15511
- }
15512
- }
15513
- };
15514
-
15515
- // ../rivetkit/dist/tsup/chunk-V6ANE6JM.js
15487
+ // ../rivetkit/dist/tsup/chunk-XOOESJY7.js
15516
15488
  function logger() {
15517
15489
  return getLogger("actor-client");
15518
15490
  }
@@ -15550,7 +15522,35 @@ async function importWebSocket() {
15550
15522
  return webSocketPromise;
15551
15523
  }
15552
15524
 
15553
- // ../rivetkit/dist/tsup/chunk-JBQ63WSM.js
15525
+ // ../rivetkit/dist/tsup/chunk-7AFZMFPQ.js
15526
+ var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
15527
+ var AsyncMutex = class {
15528
+ #locked = false;
15529
+ #waiting = [];
15530
+ async acquire() {
15531
+ while (this.#locked) {
15532
+ await new Promise((resolve) => this.#waiting.push(resolve));
15533
+ }
15534
+ this.#locked = true;
15535
+ }
15536
+ release() {
15537
+ this.#locked = false;
15538
+ const next = this.#waiting.shift();
15539
+ if (next) {
15540
+ next();
15541
+ }
15542
+ }
15543
+ async run(fn) {
15544
+ await this.acquire();
15545
+ try {
15546
+ return await fn();
15547
+ } finally {
15548
+ this.release();
15549
+ }
15550
+ }
15551
+ };
15552
+
15553
+ // ../rivetkit/dist/tsup/chunk-HOZ3ZLZ2.js
15554
15554
  var import_invariant2 = __toESM(require_invariant(), 1);
15555
15555
 
15556
15556
  // ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
@@ -15728,7 +15728,7 @@ function createVersionedDataHandler(config3) {
15728
15728
  return new VersionedDataHandler(config3);
15729
15729
  }
15730
15730
 
15731
- // ../rivetkit/dist/tsup/chunk-JBQ63WSM.js
15731
+ // ../rivetkit/dist/tsup/chunk-HOZ3ZLZ2.js
15732
15732
  var import_invariant3 = __toESM(require_invariant(), 1);
15733
15733
  var import_invariant4 = __toESM(require_invariant(), 1);
15734
15734
  var PATH_CONNECT = "/connect";
@@ -25352,6 +25352,83 @@ function createWriteThroughProxy(value, commit, beforeChange) {
25352
25352
  }
25353
25353
  );
25354
25354
  }
25355
+ function unwrapProxy(value) {
25356
+ let current = value;
25357
+ while (current !== null && typeof current === "object") {
25358
+ const target = source_default.target(current);
25359
+ if (target === current) {
25360
+ break;
25361
+ }
25362
+ current = target;
25363
+ }
25364
+ return current;
25365
+ }
25366
+ function isPlainObject3(value) {
25367
+ const proto = Object.getPrototypeOf(value);
25368
+ return proto === Object.prototype || proto === null;
25369
+ }
25370
+ function unwrapDeep(value, seen) {
25371
+ const unwrapped = unwrapProxy(value);
25372
+ if (!unwrapped || typeof unwrapped !== "object") {
25373
+ return unwrapped;
25374
+ }
25375
+ if (seen.has(unwrapped)) {
25376
+ return unwrapped;
25377
+ }
25378
+ seen.add(unwrapped);
25379
+ if (Array.isArray(unwrapped)) {
25380
+ for (let i = 0; i < unwrapped.length; i++) {
25381
+ const child = unwrapDeep(unwrapped[i], seen);
25382
+ if (child !== unwrapped[i]) {
25383
+ unwrapped[i] = child;
25384
+ }
25385
+ }
25386
+ return unwrapped;
25387
+ }
25388
+ if (unwrapped instanceof Map) {
25389
+ const replacements = [];
25390
+ for (const [key, child] of unwrapped.entries()) {
25391
+ const nextKey = unwrapDeep(key, seen);
25392
+ const nextChild = unwrapDeep(child, seen);
25393
+ if (nextKey !== key || nextChild !== child) {
25394
+ replacements.push([key, nextKey, nextChild]);
25395
+ }
25396
+ }
25397
+ for (const [key, nextKey, nextChild] of replacements) {
25398
+ if (nextKey !== key) {
25399
+ unwrapped.delete(key);
25400
+ }
25401
+ unwrapped.set(nextKey, nextChild);
25402
+ }
25403
+ return unwrapped;
25404
+ }
25405
+ if (unwrapped instanceof Set) {
25406
+ const replacements = [];
25407
+ for (const child of unwrapped.values()) {
25408
+ const next = unwrapDeep(child, seen);
25409
+ if (next !== child) {
25410
+ replacements.push([child, next]);
25411
+ }
25412
+ }
25413
+ for (const [child, next] of replacements) {
25414
+ unwrapped.delete(child);
25415
+ unwrapped.add(next);
25416
+ }
25417
+ return unwrapped;
25418
+ }
25419
+ if (isPlainObject3(unwrapped)) {
25420
+ for (const key of Object.keys(unwrapped)) {
25421
+ const child = unwrapDeep(unwrapped[key], seen);
25422
+ if (child !== unwrapped[key]) {
25423
+ unwrapped[key] = child;
25424
+ }
25425
+ }
25426
+ }
25427
+ return unwrapped;
25428
+ }
25429
+ function unwrapWriteThroughProxy(value) {
25430
+ return unwrapDeep(value, /* @__PURE__ */ new Set());
25431
+ }
25355
25432
  var textEncoder = new TextEncoder();
25356
25433
  var textDecoder = new TextDecoder();
25357
25434
  var defaultRuntimeLoaders = {
@@ -26038,8 +26115,23 @@ var NativeConnAdapter = class {
26038
26115
  }
26039
26116
  get state() {
26040
26117
  const nextState = this.#readState();
26118
+ if (!this.#ctx) {
26119
+ return this.#createStateProxy(nextState);
26120
+ }
26121
+ const connState = getNativeConnPersistState(
26122
+ this.#runtime,
26123
+ this.#ctx,
26124
+ this.#conn
26125
+ );
26126
+ if (connState.stateProxy === void 0 || connState.stateProxyTarget !== nextState) {
26127
+ connState.stateProxyTarget = nextState;
26128
+ connState.stateProxy = this.#createStateProxy(nextState);
26129
+ }
26130
+ return connState.stateProxy;
26131
+ }
26132
+ #createStateProxy(state) {
26041
26133
  return createWriteThroughProxy(
26042
- nextState,
26134
+ state,
26043
26135
  (nextValue) => {
26044
26136
  this.#writeState(nextValue, { writeNative: true });
26045
26137
  },
@@ -26049,11 +26141,14 @@ var NativeConnAdapter = class {
26049
26141
  );
26050
26142
  }
26051
26143
  set state(value) {
26052
- assertJsonCompatValue(value);
26053
- this.#writeState(value, { writeNative: true });
26144
+ const nextValue = unwrapWriteThroughProxy(value);
26145
+ assertJsonCompatValue(nextValue);
26146
+ this.#writeState(nextValue, { writeNative: true });
26054
26147
  }
26055
26148
  initializeState(value) {
26056
- this.#writeState(value, { writeNative: false });
26149
+ this.#writeState(unwrapWriteThroughProxy(value), {
26150
+ writeNative: false
26151
+ });
26057
26152
  }
26058
26153
  get isHibernatable() {
26059
26154
  return callNativeSync(
@@ -27106,14 +27201,17 @@ var ActorContextHandleAdapter = class {
27106
27201
  throw stateNotEnabledError();
27107
27202
  }
27108
27203
  this.#assertCanMutateState();
27109
- assertJsonCompatValue(value);
27110
- this.#writeState(value, { scheduleSave: true });
27204
+ const nextValue = unwrapWriteThroughProxy(value);
27205
+ assertJsonCompatValue(nextValue);
27206
+ this.#writeState(nextValue, { scheduleSave: true });
27111
27207
  }
27112
27208
  initializeState(value) {
27113
27209
  if (!this.#stateEnabled) {
27114
27210
  return;
27115
27211
  }
27116
- this.#writeState(value, { scheduleSave: false });
27212
+ this.#writeState(unwrapWriteThroughProxy(value), {
27213
+ scheduleSave: false
27214
+ });
27117
27215
  }
27118
27216
  get vars() {
27119
27217
  const runtimeState = getNativeRuntimeState(this.#runtime, this.#ctx);
package/dist/mod.mjs CHANGED
@@ -471,7 +471,7 @@ function unsupportedFeature(feature) {
471
471
  );
472
472
  }
473
473
 
474
- // ../rivetkit/dist/tsup/chunk-AGNBLCNJ.js
474
+ // ../rivetkit/dist/tsup/chunk-LZ4TSBIP.js
475
475
  import {
476
476
  pino,
477
477
  stdTimeFunctions
@@ -13147,7 +13147,7 @@ var classic_default = external_exports;
13147
13147
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
13148
13148
  var v4_default = classic_default;
13149
13149
 
13150
- // ../rivetkit/dist/tsup/chunk-AGNBLCNJ.js
13150
+ // ../rivetkit/dist/tsup/chunk-LZ4TSBIP.js
13151
13151
  var import_invariant = __toESM(require_invariant(), 1);
13152
13152
  import * as cbor from "cbor-x";
13153
13153
  var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
@@ -13312,7 +13312,7 @@ function noopNext() {
13312
13312
  }
13313
13313
  var package_default = {
13314
13314
  name: "rivetkit",
13315
- version: "2.3.11-rc.8",
13315
+ version: "2.3.11-rc.9",
13316
13316
  description: "Lightweight libraries for building stateful actors on edge platforms",
13317
13317
  license: "Apache-2.0",
13318
13318
  keywords: [
@@ -14605,7 +14605,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
14605
14605
  };
14606
14606
  }
14607
14607
 
14608
- // ../rivetkit/dist/tsup/chunk-4EDGOGCB.js
14608
+ // ../rivetkit/dist/tsup/chunk-C5TORAVP.js
14609
14609
  var config2 = /* @__PURE__ */ Config({});
14610
14610
  function readWorkflowCbor(bc) {
14611
14611
  return readData(bc);
@@ -15450,35 +15450,7 @@ function removePrefixFromKey(prefixedKey) {
15450
15450
  return prefixedKey.slice(KEYS.KV.length);
15451
15451
  }
15452
15452
 
15453
- // ../rivetkit/dist/tsup/chunk-7AFZMFPQ.js
15454
- var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
15455
- var AsyncMutex = class {
15456
- #locked = false;
15457
- #waiting = [];
15458
- async acquire() {
15459
- while (this.#locked) {
15460
- await new Promise((resolve) => this.#waiting.push(resolve));
15461
- }
15462
- this.#locked = true;
15463
- }
15464
- release() {
15465
- this.#locked = false;
15466
- const next = this.#waiting.shift();
15467
- if (next) {
15468
- next();
15469
- }
15470
- }
15471
- async run(fn) {
15472
- await this.acquire();
15473
- try {
15474
- return await fn();
15475
- } finally {
15476
- this.release();
15477
- }
15478
- }
15479
- };
15480
-
15481
- // ../rivetkit/dist/tsup/chunk-V6ANE6JM.js
15453
+ // ../rivetkit/dist/tsup/chunk-XOOESJY7.js
15482
15454
  function logger() {
15483
15455
  return getLogger("actor-client");
15484
15456
  }
@@ -15516,7 +15488,35 @@ async function importWebSocket() {
15516
15488
  return webSocketPromise;
15517
15489
  }
15518
15490
 
15519
- // ../rivetkit/dist/tsup/chunk-JBQ63WSM.js
15491
+ // ../rivetkit/dist/tsup/chunk-7AFZMFPQ.js
15492
+ var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
15493
+ var AsyncMutex = class {
15494
+ #locked = false;
15495
+ #waiting = [];
15496
+ async acquire() {
15497
+ while (this.#locked) {
15498
+ await new Promise((resolve) => this.#waiting.push(resolve));
15499
+ }
15500
+ this.#locked = true;
15501
+ }
15502
+ release() {
15503
+ this.#locked = false;
15504
+ const next = this.#waiting.shift();
15505
+ if (next) {
15506
+ next();
15507
+ }
15508
+ }
15509
+ async run(fn) {
15510
+ await this.acquire();
15511
+ try {
15512
+ return await fn();
15513
+ } finally {
15514
+ this.release();
15515
+ }
15516
+ }
15517
+ };
15518
+
15519
+ // ../rivetkit/dist/tsup/chunk-HOZ3ZLZ2.js
15520
15520
  var import_invariant2 = __toESM(require_invariant(), 1);
15521
15521
 
15522
15522
  // ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
@@ -15694,7 +15694,7 @@ function createVersionedDataHandler(config3) {
15694
15694
  return new VersionedDataHandler(config3);
15695
15695
  }
15696
15696
 
15697
- // ../rivetkit/dist/tsup/chunk-JBQ63WSM.js
15697
+ // ../rivetkit/dist/tsup/chunk-HOZ3ZLZ2.js
15698
15698
  var import_invariant3 = __toESM(require_invariant(), 1);
15699
15699
  var import_invariant4 = __toESM(require_invariant(), 1);
15700
15700
  var PATH_CONNECT = "/connect";
@@ -25317,6 +25317,83 @@ function createWriteThroughProxy(value, commit, beforeChange) {
25317
25317
  }
25318
25318
  );
25319
25319
  }
25320
+ function unwrapProxy(value) {
25321
+ let current = value;
25322
+ while (current !== null && typeof current === "object") {
25323
+ const target = source_default.target(current);
25324
+ if (target === current) {
25325
+ break;
25326
+ }
25327
+ current = target;
25328
+ }
25329
+ return current;
25330
+ }
25331
+ function isPlainObject3(value) {
25332
+ const proto = Object.getPrototypeOf(value);
25333
+ return proto === Object.prototype || proto === null;
25334
+ }
25335
+ function unwrapDeep(value, seen) {
25336
+ const unwrapped = unwrapProxy(value);
25337
+ if (!unwrapped || typeof unwrapped !== "object") {
25338
+ return unwrapped;
25339
+ }
25340
+ if (seen.has(unwrapped)) {
25341
+ return unwrapped;
25342
+ }
25343
+ seen.add(unwrapped);
25344
+ if (Array.isArray(unwrapped)) {
25345
+ for (let i = 0; i < unwrapped.length; i++) {
25346
+ const child = unwrapDeep(unwrapped[i], seen);
25347
+ if (child !== unwrapped[i]) {
25348
+ unwrapped[i] = child;
25349
+ }
25350
+ }
25351
+ return unwrapped;
25352
+ }
25353
+ if (unwrapped instanceof Map) {
25354
+ const replacements = [];
25355
+ for (const [key, child] of unwrapped.entries()) {
25356
+ const nextKey = unwrapDeep(key, seen);
25357
+ const nextChild = unwrapDeep(child, seen);
25358
+ if (nextKey !== key || nextChild !== child) {
25359
+ replacements.push([key, nextKey, nextChild]);
25360
+ }
25361
+ }
25362
+ for (const [key, nextKey, nextChild] of replacements) {
25363
+ if (nextKey !== key) {
25364
+ unwrapped.delete(key);
25365
+ }
25366
+ unwrapped.set(nextKey, nextChild);
25367
+ }
25368
+ return unwrapped;
25369
+ }
25370
+ if (unwrapped instanceof Set) {
25371
+ const replacements = [];
25372
+ for (const child of unwrapped.values()) {
25373
+ const next = unwrapDeep(child, seen);
25374
+ if (next !== child) {
25375
+ replacements.push([child, next]);
25376
+ }
25377
+ }
25378
+ for (const [child, next] of replacements) {
25379
+ unwrapped.delete(child);
25380
+ unwrapped.add(next);
25381
+ }
25382
+ return unwrapped;
25383
+ }
25384
+ if (isPlainObject3(unwrapped)) {
25385
+ for (const key of Object.keys(unwrapped)) {
25386
+ const child = unwrapDeep(unwrapped[key], seen);
25387
+ if (child !== unwrapped[key]) {
25388
+ unwrapped[key] = child;
25389
+ }
25390
+ }
25391
+ }
25392
+ return unwrapped;
25393
+ }
25394
+ function unwrapWriteThroughProxy(value) {
25395
+ return unwrapDeep(value, /* @__PURE__ */ new Set());
25396
+ }
25320
25397
  var textEncoder = new TextEncoder();
25321
25398
  var textDecoder = new TextDecoder();
25322
25399
  var defaultRuntimeLoaders = {
@@ -26003,8 +26080,23 @@ var NativeConnAdapter = class {
26003
26080
  }
26004
26081
  get state() {
26005
26082
  const nextState = this.#readState();
26083
+ if (!this.#ctx) {
26084
+ return this.#createStateProxy(nextState);
26085
+ }
26086
+ const connState = getNativeConnPersistState(
26087
+ this.#runtime,
26088
+ this.#ctx,
26089
+ this.#conn
26090
+ );
26091
+ if (connState.stateProxy === void 0 || connState.stateProxyTarget !== nextState) {
26092
+ connState.stateProxyTarget = nextState;
26093
+ connState.stateProxy = this.#createStateProxy(nextState);
26094
+ }
26095
+ return connState.stateProxy;
26096
+ }
26097
+ #createStateProxy(state) {
26006
26098
  return createWriteThroughProxy(
26007
- nextState,
26099
+ state,
26008
26100
  (nextValue) => {
26009
26101
  this.#writeState(nextValue, { writeNative: true });
26010
26102
  },
@@ -26014,11 +26106,14 @@ var NativeConnAdapter = class {
26014
26106
  );
26015
26107
  }
26016
26108
  set state(value) {
26017
- assertJsonCompatValue(value);
26018
- this.#writeState(value, { writeNative: true });
26109
+ const nextValue = unwrapWriteThroughProxy(value);
26110
+ assertJsonCompatValue(nextValue);
26111
+ this.#writeState(nextValue, { writeNative: true });
26019
26112
  }
26020
26113
  initializeState(value) {
26021
- this.#writeState(value, { writeNative: false });
26114
+ this.#writeState(unwrapWriteThroughProxy(value), {
26115
+ writeNative: false
26116
+ });
26022
26117
  }
26023
26118
  get isHibernatable() {
26024
26119
  return callNativeSync(
@@ -27071,14 +27166,17 @@ var ActorContextHandleAdapter = class {
27071
27166
  throw stateNotEnabledError();
27072
27167
  }
27073
27168
  this.#assertCanMutateState();
27074
- assertJsonCompatValue(value);
27075
- this.#writeState(value, { scheduleSave: true });
27169
+ const nextValue = unwrapWriteThroughProxy(value);
27170
+ assertJsonCompatValue(nextValue);
27171
+ this.#writeState(nextValue, { scheduleSave: true });
27076
27172
  }
27077
27173
  initializeState(value) {
27078
27174
  if (!this.#stateEnabled) {
27079
27175
  return;
27080
27176
  }
27081
- this.#writeState(value, { scheduleSave: false });
27177
+ this.#writeState(unwrapWriteThroughProxy(value), {
27178
+ scheduleSave: false
27179
+ });
27082
27180
  }
27083
27181
  get vars() {
27084
27182
  const runtimeState = getNativeRuntimeState(this.#runtime, this.#ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/supabase",
3
- "version": "2.3.11-rc.8",
3
+ "version": "2.3.11-rc.9",
4
4
  "description": "Supabase Edge Functions integration for RivetKit actors",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -39,14 +39,14 @@
39
39
  "check-edge-closure": "node ../../../scripts/ci/check-edge-native-closure.mjs"
40
40
  },
41
41
  "dependencies": {
42
- "@rivetkit/rivetkit-wasm": "2.3.11-rc.8",
42
+ "@rivetkit/rivetkit-wasm": "2.3.11-rc.9",
43
43
  "cbor-x": "^1.6.0",
44
44
  "pino": "^9.5.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@size-limit/file": "^11.1.6",
48
48
  "@types/node": "^22.0.0",
49
- "rivetkit": "2.3.11-rc.8",
49
+ "rivetkit": "2.3.11-rc.9",
50
50
  "size-limit": "^11.1.6",
51
51
  "tsup": "^8.4.0",
52
52
  "typescript": "^5.5.2"