@rivetkit/supabase 2.3.19 → 2.3.20

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 CHANGED
@@ -13005,7 +13005,7 @@ var classic_default = external_exports;
13005
13005
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
13006
13006
  var v4_default = classic_default;
13007
13007
 
13008
- // ../rivetkit/dist/tsup/chunk-EB77NZL4.js
13008
+ // ../rivetkit/dist/tsup/chunk-CSOHAAZK.js
13009
13009
  function flattenActionHandlers(actions) {
13010
13010
  const flattened = /* @__PURE__ */ Object.create(null);
13011
13011
  for (const { name, handler } of collectActionEntries(actions)) {
@@ -13034,6 +13034,26 @@ function flattenActionInputSchemas(actions, schemas) {
13034
13034
  }
13035
13035
  return flattened;
13036
13036
  }
13037
+ function flattenActionTraceSamplers(actions, rates = {}) {
13038
+ const handlers = flattenActionHandlers(actions);
13039
+ const flattened = Object.fromEntries(flattenSampleRates(rates, []));
13040
+ for (const name of Object.keys(flattened)) {
13041
+ if (!Object.hasOwn(handlers, name)) {
13042
+ throw new TypeError(
13043
+ `tracing.actions.${name} does not name an action`
13044
+ );
13045
+ }
13046
+ }
13047
+ return flattened;
13048
+ }
13049
+ function flattenSampleRates(rates, path2) {
13050
+ return Object.entries(rates).flatMap(
13051
+ ([segment, rate]) => {
13052
+ const childPath = [...path2, segment];
13053
+ return typeof rate === "number" ? [[childPath.join("."), rate]] : flattenSampleRates(rate, childPath);
13054
+ }
13055
+ );
13056
+ }
13037
13057
  function collectActionEntries(actions) {
13038
13058
  const entries = [];
13039
13059
  const names = /* @__PURE__ */ new Set();
@@ -13298,6 +13318,10 @@ var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => (
13298
13318
  var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
13299
13319
  InstanceActorOptionsBaseSchema.shape
13300
13320
  ).strict().prefault(() => ({}));
13321
+ var zSampleRate = external_exports.number().min(0).max(1);
13322
+ var zActionSampleRates = external_exports.lazy(
13323
+ () => external_exports.record(external_exports.string(), external_exports.union([zSampleRate, zActionSampleRates]))
13324
+ );
13301
13325
  var ActorConfigSchema = external_exports.object({
13302
13326
  onCreate: zFunction().optional(),
13303
13327
  onDestroy: zFunction().optional(),
@@ -13314,6 +13338,10 @@ var ActorConfigSchema = external_exports.object({
13314
13338
  onWebSocket: zFunction().optional(),
13315
13339
  actions: zActionTree.default(() => ({})),
13316
13340
  actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
13341
+ tracing: external_exports.object({
13342
+ sampler: zSampleRate.optional(),
13343
+ actions: zActionSampleRates.optional()
13344
+ }).strict().optional(),
13317
13345
  connParamsSchema: external_exports.any().optional(),
13318
13346
  events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
13319
13347
  queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
@@ -13461,6 +13489,9 @@ var DocActorConfigSchema = external_exports.object({
13461
13489
  actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
13462
13490
  "Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
13463
13491
  ),
13492
+ tracing: external_exports.unknown().optional().describe(
13493
+ "Trace sampling for this actor: `sampler` is the share of its invocations that are recorded, from 0 to 1, with optional per-action rates under `actions`. A rate lowers what is recorded and never raises it. Defaults to the process sampler from OTEL_TRACES_SAMPLER."
13494
+ ),
13464
13495
  connParamsSchema: external_exports.unknown().optional().describe(
13465
13496
  "Optional schema for validating connection params in native runtimes."
13466
13497
  ),
@@ -13662,7 +13693,7 @@ function unsupportedFeature(feature) {
13662
13693
  );
13663
13694
  }
13664
13695
 
13665
- // ../rivetkit/dist/tsup/chunk-DN6MD3KK.js
13696
+ // ../rivetkit/dist/tsup/chunk-DHWZTUKA.js
13666
13697
  var import_pino = require("pino");
13667
13698
  var cbor = __toESM(require("cbor-x"), 1);
13668
13699
  var import_invariant = __toESM(require_invariant(), 1);
@@ -13834,7 +13865,7 @@ function noopNext() {
13834
13865
  }
13835
13866
  var package_default = {
13836
13867
  name: "rivetkit",
13837
- version: "2.3.19",
13868
+ version: "2.3.20",
13838
13869
  description: "Lightweight libraries for building stateful actors on edge platforms",
13839
13870
  license: "Apache-2.0",
13840
13871
  keywords: [
@@ -15140,7 +15171,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
15140
15171
  };
15141
15172
  }
15142
15173
 
15143
- // ../rivetkit/dist/tsup/chunk-4SC2NSAV.js
15174
+ // ../rivetkit/dist/tsup/chunk-SNNVRHLX.js
15144
15175
  var config2 = /* @__PURE__ */ Config({});
15145
15176
  function readWorkflowCbor(bc) {
15146
15177
  return readData(bc);
@@ -15555,7 +15586,7 @@ function removePrefixFromKey(prefixedKey) {
15555
15586
  return prefixedKey.slice(KEYS.KV.length);
15556
15587
  }
15557
15588
 
15558
- // ../rivetkit/dist/tsup/chunk-X7RMJQGY.js
15589
+ // ../rivetkit/dist/tsup/chunk-553CIQJY.js
15559
15590
  function logger() {
15560
15591
  return getLogger("actor-client");
15561
15592
  }
@@ -15676,7 +15707,7 @@ var AsyncMutex = class {
15676
15707
  }
15677
15708
  };
15678
15709
 
15679
- // ../rivetkit/dist/tsup/chunk-BKX7UDTA.js
15710
+ // ../rivetkit/dist/tsup/chunk-5G2J26VM.js
15680
15711
  var import_invariant2 = __toESM(require_invariant(), 1);
15681
15712
 
15682
15713
  // ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
@@ -16891,7 +16922,7 @@ var TraceAPI = (
16891
16922
  // ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace-api.js
16892
16923
  var trace = TraceAPI.getInstance();
16893
16924
 
16894
- // ../rivetkit/dist/tsup/chunk-BKX7UDTA.js
16925
+ // ../rivetkit/dist/tsup/chunk-5G2J26VM.js
16895
16926
  var import_invariant3 = __toESM(require_invariant(), 1);
16896
16927
  var import_invariant4 = __toESM(require_invariant(), 1);
16897
16928
  var PATH_CONNECT = "/connect";
@@ -22827,7 +22858,7 @@ function apiActorToOutput(actor2) {
22827
22858
  };
22828
22859
  }
22829
22860
 
22830
- // ../rivetkit/dist/tsup/chunk-WME6KOXW.js
22861
+ // ../rivetkit/dist/tsup/chunk-W2PXGWMR.js
22831
22862
  var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
22832
22863
  var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
22833
22864
  function registerNativeStateTransactionOpener(provider, opener) {
@@ -24320,12 +24351,14 @@ function isStaticActorInstance(_actor) {
24320
24351
  return true;
24321
24352
  }
24322
24353
  function actor(input) {
24354
+ var _a2;
24323
24355
  warnDeprecatedOptionKeys(
24324
24356
  input == null ? void 0 : input.options
24325
24357
  );
24326
24358
  const config3 = ActorConfigSchema.parse(input);
24327
24359
  flattenActionHandlers(config3.actions);
24328
24360
  flattenActionInputSchemas(config3.actions, config3.actionInputSchemas);
24361
+ flattenActionTraceSamplers(config3.actions, (_a2 = config3.tracing) == null ? void 0 : _a2.actions);
24329
24362
  return new ActorDefinition(config3);
24330
24363
  }
24331
24364
  function isStaticActorDefinition(definition) {
@@ -30198,6 +30231,13 @@ function withConnContext(runtime, ctx, conn, clientFactory, schemas = {}, databa
30198
30231
  )
30199
30232
  });
30200
30233
  }
30234
+ function buildActorTracingConfig(actions, tracing) {
30235
+ if (tracing === void 0) return void 0;
30236
+ return {
30237
+ sampler: tracing.sampler,
30238
+ actions: flattenActionTraceSamplers(actions, tracing.actions)
30239
+ };
30240
+ }
30201
30241
  function buildActorConfig(definition, registryConfig, runtimeKind) {
30202
30242
  var _a2;
30203
30243
  const config3 = definition.config;
@@ -30211,6 +30251,10 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
30211
30251
  hasDatabase: true,
30212
30252
  remoteSqlite: usesRemoteSqlite,
30213
30253
  sqliteProfiling,
30254
+ tracing: buildActorTracingConfig(
30255
+ definition.config.actions,
30256
+ definition.config.tracing
30257
+ ),
30214
30258
  enableActorRuntimeSocket: options.enableActorRuntimeSocket === true,
30215
30259
  hasState: config3.state !== void 0 || typeof config3.createState === "function",
30216
30260
  canHibernateWebsocket: typeof canHibernate === "boolean" ? canHibernate : void 0,
package/dist/mod.mjs CHANGED
@@ -12967,7 +12967,7 @@ var classic_default = external_exports;
12967
12967
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
12968
12968
  var v4_default = classic_default;
12969
12969
 
12970
- // ../rivetkit/dist/tsup/chunk-EB77NZL4.js
12970
+ // ../rivetkit/dist/tsup/chunk-CSOHAAZK.js
12971
12971
  function flattenActionHandlers(actions) {
12972
12972
  const flattened = /* @__PURE__ */ Object.create(null);
12973
12973
  for (const { name, handler } of collectActionEntries(actions)) {
@@ -12996,6 +12996,26 @@ function flattenActionInputSchemas(actions, schemas) {
12996
12996
  }
12997
12997
  return flattened;
12998
12998
  }
12999
+ function flattenActionTraceSamplers(actions, rates = {}) {
13000
+ const handlers = flattenActionHandlers(actions);
13001
+ const flattened = Object.fromEntries(flattenSampleRates(rates, []));
13002
+ for (const name of Object.keys(flattened)) {
13003
+ if (!Object.hasOwn(handlers, name)) {
13004
+ throw new TypeError(
13005
+ `tracing.actions.${name} does not name an action`
13006
+ );
13007
+ }
13008
+ }
13009
+ return flattened;
13010
+ }
13011
+ function flattenSampleRates(rates, path2) {
13012
+ return Object.entries(rates).flatMap(
13013
+ ([segment, rate]) => {
13014
+ const childPath = [...path2, segment];
13015
+ return typeof rate === "number" ? [[childPath.join("."), rate]] : flattenSampleRates(rate, childPath);
13016
+ }
13017
+ );
13018
+ }
12999
13019
  function collectActionEntries(actions) {
13000
13020
  const entries = [];
13001
13021
  const names = /* @__PURE__ */ new Set();
@@ -13260,6 +13280,10 @@ var InstanceActorOptionsSchema = InstanceActorOptionsBaseSchema.prefault(() => (
13260
13280
  var ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
13261
13281
  InstanceActorOptionsBaseSchema.shape
13262
13282
  ).strict().prefault(() => ({}));
13283
+ var zSampleRate = external_exports.number().min(0).max(1);
13284
+ var zActionSampleRates = external_exports.lazy(
13285
+ () => external_exports.record(external_exports.string(), external_exports.union([zSampleRate, zActionSampleRates]))
13286
+ );
13263
13287
  var ActorConfigSchema = external_exports.object({
13264
13288
  onCreate: zFunction().optional(),
13265
13289
  onDestroy: zFunction().optional(),
@@ -13276,6 +13300,10 @@ var ActorConfigSchema = external_exports.object({
13276
13300
  onWebSocket: zFunction().optional(),
13277
13301
  actions: zActionTree.default(() => ({})),
13278
13302
  actionInputSchemas: external_exports.record(external_exports.string(), external_exports.any()).optional(),
13303
+ tracing: external_exports.object({
13304
+ sampler: zSampleRate.optional(),
13305
+ actions: zActionSampleRates.optional()
13306
+ }).strict().optional(),
13279
13307
  connParamsSchema: external_exports.any().optional(),
13280
13308
  events: external_exports.record(external_exports.string(), external_exports.any()).optional(),
13281
13309
  queues: external_exports.record(external_exports.string(), external_exports.any()).optional(),
@@ -13423,6 +13451,9 @@ var DocActorConfigSchema = external_exports.object({
13423
13451
  actionInputSchemas: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe(
13424
13452
  "Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names."
13425
13453
  ),
13454
+ tracing: external_exports.unknown().optional().describe(
13455
+ "Trace sampling for this actor: `sampler` is the share of its invocations that are recorded, from 0 to 1, with optional per-action rates under `actions`. A rate lowers what is recorded and never raises it. Defaults to the process sampler from OTEL_TRACES_SAMPLER."
13456
+ ),
13426
13457
  connParamsSchema: external_exports.unknown().optional().describe(
13427
13458
  "Optional schema for validating connection params in native runtimes."
13428
13459
  ),
@@ -13624,7 +13655,7 @@ function unsupportedFeature(feature) {
13624
13655
  );
13625
13656
  }
13626
13657
 
13627
- // ../rivetkit/dist/tsup/chunk-DN6MD3KK.js
13658
+ // ../rivetkit/dist/tsup/chunk-DHWZTUKA.js
13628
13659
  import {
13629
13660
  pino,
13630
13661
  stdTimeFunctions
@@ -13799,7 +13830,7 @@ function noopNext() {
13799
13830
  }
13800
13831
  var package_default = {
13801
13832
  name: "rivetkit",
13802
- version: "2.3.19",
13833
+ version: "2.3.20",
13803
13834
  description: "Lightweight libraries for building stateful actors on edge platforms",
13804
13835
  license: "Apache-2.0",
13805
13836
  keywords: [
@@ -15105,7 +15136,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
15105
15136
  };
15106
15137
  }
15107
15138
 
15108
- // ../rivetkit/dist/tsup/chunk-4SC2NSAV.js
15139
+ // ../rivetkit/dist/tsup/chunk-SNNVRHLX.js
15109
15140
  var config2 = /* @__PURE__ */ Config({});
15110
15141
  function readWorkflowCbor(bc) {
15111
15142
  return readData(bc);
@@ -15520,7 +15551,7 @@ function removePrefixFromKey(prefixedKey) {
15520
15551
  return prefixedKey.slice(KEYS.KV.length);
15521
15552
  }
15522
15553
 
15523
- // ../rivetkit/dist/tsup/chunk-X7RMJQGY.js
15554
+ // ../rivetkit/dist/tsup/chunk-553CIQJY.js
15524
15555
  function logger() {
15525
15556
  return getLogger("actor-client");
15526
15557
  }
@@ -15641,7 +15672,7 @@ var AsyncMutex = class {
15641
15672
  }
15642
15673
  };
15643
15674
 
15644
- // ../rivetkit/dist/tsup/chunk-BKX7UDTA.js
15675
+ // ../rivetkit/dist/tsup/chunk-5G2J26VM.js
15645
15676
  var import_invariant2 = __toESM(require_invariant(), 1);
15646
15677
 
15647
15678
  // ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
@@ -16856,7 +16887,7 @@ var TraceAPI = (
16856
16887
  // ../../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace-api.js
16857
16888
  var trace = TraceAPI.getInstance();
16858
16889
 
16859
- // ../rivetkit/dist/tsup/chunk-BKX7UDTA.js
16890
+ // ../rivetkit/dist/tsup/chunk-5G2J26VM.js
16860
16891
  var import_invariant3 = __toESM(require_invariant(), 1);
16861
16892
  var import_invariant4 = __toESM(require_invariant(), 1);
16862
16893
  var PATH_CONNECT = "/connect";
@@ -22792,7 +22823,7 @@ function apiActorToOutput(actor2) {
22792
22823
  };
22793
22824
  }
22794
22825
 
22795
- // ../rivetkit/dist/tsup/chunk-WME6KOXW.js
22826
+ // ../rivetkit/dist/tsup/chunk-W2PXGWMR.js
22796
22827
  var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
22797
22828
  var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
22798
22829
  function registerNativeStateTransactionOpener(provider, opener) {
@@ -24285,12 +24316,14 @@ function isStaticActorInstance(_actor) {
24285
24316
  return true;
24286
24317
  }
24287
24318
  function actor(input) {
24319
+ var _a2;
24288
24320
  warnDeprecatedOptionKeys(
24289
24321
  input == null ? void 0 : input.options
24290
24322
  );
24291
24323
  const config3 = ActorConfigSchema.parse(input);
24292
24324
  flattenActionHandlers(config3.actions);
24293
24325
  flattenActionInputSchemas(config3.actions, config3.actionInputSchemas);
24326
+ flattenActionTraceSamplers(config3.actions, (_a2 = config3.tracing) == null ? void 0 : _a2.actions);
24294
24327
  return new ActorDefinition(config3);
24295
24328
  }
24296
24329
  function isStaticActorDefinition(definition) {
@@ -30163,6 +30196,13 @@ function withConnContext(runtime, ctx, conn, clientFactory, schemas = {}, databa
30163
30196
  )
30164
30197
  });
30165
30198
  }
30199
+ function buildActorTracingConfig(actions, tracing) {
30200
+ if (tracing === void 0) return void 0;
30201
+ return {
30202
+ sampler: tracing.sampler,
30203
+ actions: flattenActionTraceSamplers(actions, tracing.actions)
30204
+ };
30205
+ }
30166
30206
  function buildActorConfig(definition, registryConfig, runtimeKind) {
30167
30207
  var _a2;
30168
30208
  const config3 = definition.config;
@@ -30176,6 +30216,10 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
30176
30216
  hasDatabase: true,
30177
30217
  remoteSqlite: usesRemoteSqlite,
30178
30218
  sqliteProfiling,
30219
+ tracing: buildActorTracingConfig(
30220
+ definition.config.actions,
30221
+ definition.config.tracing
30222
+ ),
30179
30223
  enableActorRuntimeSocket: options.enableActorRuntimeSocket === true,
30180
30224
  hasState: config3.state !== void 0 || typeof config3.createState === "function",
30181
30225
  canHibernateWebsocket: typeof canHibernate === "boolean" ? canHibernate : void 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/supabase",
3
- "version": "2.3.19",
3
+ "version": "2.3.20",
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.19",
42
+ "@rivetkit/rivetkit-wasm": "2.3.20",
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.19",
49
+ "rivetkit": "2.3.20",
50
50
  "size-limit": "^11.1.6",
51
51
  "tsup": "^8.4.0",
52
52
  "typescript": "^5.5.2"