@query-farm/vgi 0.48.0 → 0.48.1

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 (95) hide show
  1. package/dist/arguments/argument-spec.d.ts +17 -11
  2. package/dist/catalog/descriptors.d.ts +2 -2
  3. package/dist/catalog/publication.d.ts +7 -7
  4. package/dist/client/client.d.ts +9 -3
  5. package/dist/client/errors.d.ts +2 -2
  6. package/dist/client/types.d.ts +21 -0
  7. package/dist/client-entry.d.ts +1 -1
  8. package/dist/client-entry.js +31 -7
  9. package/dist/client-entry.js.map +20 -20
  10. package/dist/filter-pushdown/deserialize.d.ts +1 -1
  11. package/dist/filter-pushdown/types.d.ts +10 -10
  12. package/dist/functions/scalar.d.ts +1 -1
  13. package/dist/functions/table-buffering.d.ts +20 -20
  14. package/dist/functions/table-in-out.d.ts +4 -4
  15. package/dist/functions/table.d.ts +7 -7
  16. package/dist/functions/types.d.ts +47 -47
  17. package/dist/http/fetch.d.ts +10 -10
  18. package/dist/index.core.d.ts +1 -1
  19. package/dist/index.js +155 -94
  20. package/dist/index.js.map +53 -52
  21. package/dist/protocol/dispatch.d.ts +3 -3
  22. package/dist/protocol/handlers/function.d.ts +2 -2
  23. package/dist/protocol/serializers/cardinality.d.ts +4 -1
  24. package/dist/protocol/types.d.ts +5 -5
  25. package/dist/rpc-server.d.ts +6 -6
  26. package/dist/serve-entry.d.ts +16 -16
  27. package/dist/serve-entry.js +42 -21
  28. package/dist/serve-entry.js.map +38 -37
  29. package/dist/split-token.d.ts +6 -6
  30. package/dist/types.d.ts +9 -2
  31. package/dist/util/defined.d.ts +21 -0
  32. package/dist/worker-cf-entry.js +120 -85
  33. package/dist/worker-cf-entry.js.map +51 -50
  34. package/dist/worker.d.ts +2 -2
  35. package/package.json +6 -4
  36. package/src/arguments/argument-spec.ts +17 -11
  37. package/src/arrow/codec/registry.ts +2 -2
  38. package/src/arrow/impl-arrowjs/build.ts +1 -1
  39. package/src/arrow/impl-arrowjs/canonical.ts +23 -23
  40. package/src/arrow/impl-arrowjs/empty.ts +2 -2
  41. package/src/arrow/impl-arrowjs/ipc.ts +2 -2
  42. package/src/arrow/impl-arrowjs/iterate.ts +2 -2
  43. package/src/arrow/impl-arrowjs/project.ts +2 -2
  44. package/src/arrow/impl-flechette/build.ts +2 -1
  45. package/src/arrow/impl-flechette/canonical.ts +10 -9
  46. package/src/arrow/impl-flechette/compat.ts +3 -3
  47. package/src/arrow/impl-flechette/message-meta.ts +5 -4
  48. package/src/arrow/impl-flechette/statistics.ts +2 -2
  49. package/src/attach-ticket.ts +2 -2
  50. package/src/catalog/column-metadata.ts +1 -1
  51. package/src/catalog/composite.ts +2 -2
  52. package/src/catalog/constraints.ts +9 -9
  53. package/src/catalog/descriptors.ts +1 -1
  54. package/src/catalog/interface.ts +12 -12
  55. package/src/catalog/publication.ts +9 -8
  56. package/src/catalog/read-only.ts +9 -8
  57. package/src/catalog/sql-grammar.ts +6 -6
  58. package/src/client/client.ts +52 -15
  59. package/src/client/errors.ts +1 -1
  60. package/src/client/types.ts +23 -0
  61. package/src/client-entry.ts +2 -0
  62. package/src/codec/asd.ts +3 -3
  63. package/src/codec/conform.ts +3 -3
  64. package/src/filter-pushdown/collector.ts +1 -1
  65. package/src/filter-pushdown/deserialize.ts +13 -10
  66. package/src/filter-pushdown/evaluate.ts +3 -2
  67. package/src/filter-pushdown/history.ts +3 -2
  68. package/src/filter-pushdown/types.ts +10 -10
  69. package/src/functions/continuation.ts +1 -1
  70. package/src/functions/projection.ts +1 -1
  71. package/src/functions/registry.ts +14 -14
  72. package/src/functions/scalar.ts +3 -3
  73. package/src/functions/storage-cf-do.ts +2 -2
  74. package/src/functions/table-buffering.ts +25 -21
  75. package/src/functions/table-in-out.ts +8 -8
  76. package/src/functions/table.ts +27 -25
  77. package/src/functions/types.ts +47 -47
  78. package/src/generated/vgi-service.ts +5 -3
  79. package/src/http/fetch.ts +17 -12
  80. package/src/index.core.ts +2 -0
  81. package/src/protocol/carried-init-request.ts +1 -1
  82. package/src/protocol/dispatch.ts +3 -3
  83. package/src/protocol/handlers/aggregate.ts +8 -7
  84. package/src/protocol/handlers/catalog/shared.ts +1 -1
  85. package/src/protocol/handlers/function.ts +2 -2
  86. package/src/protocol/serializers/cardinality.ts +16 -3
  87. package/src/protocol/state-serializer.ts +1 -1
  88. package/src/protocol/types.ts +5 -5
  89. package/src/rpc-server.ts +13 -12
  90. package/src/serve-entry.ts +18 -18
  91. package/src/split-token.ts +10 -9
  92. package/src/types.ts +9 -2
  93. package/src/util/defined.ts +30 -0
  94. package/src/util/parent-rows.ts +2 -2
  95. package/src/worker.ts +15 -14
@@ -71,8 +71,8 @@ export declare function buildSplitToken(opts: {
71
71
  payload: Uint8Array;
72
72
  fingerprint: Uint8Array;
73
73
  anchor: Uint8Array;
74
- signingKey?: Uint8Array;
75
- auth?: AuthContext;
74
+ signingKey?: Uint8Array | undefined;
75
+ auth?: AuthContext | undefined;
76
76
  }): Promise<Uint8Array>;
77
77
  /**
78
78
  * Verify a split token and return the worker's payload.
@@ -81,8 +81,8 @@ export declare function buildSplitToken(opts: {
81
81
  * check.
82
82
  */
83
83
  export declare function openSplitToken(token: Uint8Array, opts?: {
84
- signingKey?: Uint8Array;
85
- auth?: AuthContext;
86
- expectedFingerprint?: Uint8Array;
87
- currentAnchor?: Uint8Array;
84
+ signingKey?: Uint8Array | undefined;
85
+ auth?: AuthContext | undefined;
86
+ expectedFingerprint?: Uint8Array | undefined;
87
+ currentAnchor?: Uint8Array | undefined;
88
88
  }): Promise<Uint8Array>;
package/dist/types.d.ts CHANGED
@@ -58,8 +58,15 @@ export declare const VGI_DEFAULT_KEY = "vgi_default";
58
58
  export declare const VGI_CHOICES_KEY = "vgi_choices";
59
59
  export declare const VGI_RANGE_KEY = "vgi_range";
60
60
  export declare const VGI_PATTERN_KEY = "vgi_pattern";
61
+ /**
62
+ * Row-count estimate/upper bound returned by a table function's `cardinality`
63
+ * hook. Both travel as int64 on the wire, so either a `number` (must be an
64
+ * integer) or a `bigint` is accepted — int64 arguments arrive as `bigint`, so
65
+ * `{ estimate: args.count, max: args.count }` works without a `Number(...)`
66
+ * conversion. `null` means unknown.
67
+ */
61
68
  export interface TableCardinality {
62
- estimate: number | null;
63
- max: number | null;
69
+ estimate: number | bigint | null;
70
+ max: number | bigint | null;
64
71
  }
65
72
  export declare const DEFAULT_MAX_WORKERS = 99999;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The type of `T` with every property whose value may be `undefined` made
3
+ * optional and stripped of `undefined` — the shape `omitUndefined` returns.
4
+ * It is assignable to option bags declared `{ k?: V }` under
5
+ * `exactOptionalPropertyTypes`.
6
+ */
7
+ export type OmitUndefined<T> = {
8
+ [K in keyof T as undefined extends T[K] ? never : K]: T[K];
9
+ } & {
10
+ [K in keyof T as undefined extends T[K] ? K : never]?: Exclude<T[K], undefined>;
11
+ };
12
+ /**
13
+ * Copy `obj` without the keys whose value is `undefined`.
14
+ *
15
+ * Used when forwarding optional settings to an options bag owned by another
16
+ * package (vgi-rpc, Bun) whose optional properties do not admit an explicit
17
+ * `undefined`. Readers of such bags treat an absent key and an `undefined`
18
+ * one identically (`??`, destructuring defaults), so this only changes the
19
+ * static type.
20
+ */
21
+ export declare function omitUndefined<T extends object>(obj: T): OmitUndefined<T>;
@@ -2522,6 +2522,16 @@ var init_storage = __esm(() => {
2522
2522
  });
2523
2523
  });
2524
2524
 
2525
+ // src/util/defined.ts
2526
+ function omitUndefined(obj) {
2527
+ const out = {};
2528
+ for (const [k, v] of Object.entries(obj)) {
2529
+ if (v !== undefined)
2530
+ out[k] = v;
2531
+ }
2532
+ return out;
2533
+ }
2534
+
2525
2535
  // src/http/fetch.ts
2526
2536
  import {
2527
2537
  AuthContext,
@@ -2600,7 +2610,8 @@ function resolveColumn(batch, columnName) {
2600
2610
  throw new FilterV2Error(`filter column ${columnName} is unavailable in emitted batch`);
2601
2611
  }
2602
2612
  const column = batch.getChildAt(index);
2603
- resolved = column ? { type: batch.schema.fields[index].type, column } : null;
2613
+ const field = batch.schema.fields[index];
2614
+ resolved = column && field ? { type: field.type, column } : null;
2604
2615
  byName.set(columnName, resolved);
2605
2616
  }
2606
2617
  return resolved;
@@ -3448,10 +3459,11 @@ class FilterParser {
3448
3459
  if (new Set(names).size !== names.length)
3449
3460
  throw new FilterV2Error("filter payload names must be unique");
3450
3461
  for (let i = 1;i < names.length; i++) {
3451
- if (!PAYLOAD_NAME.test(names[i]))
3452
- throw new FilterV2Error(`noncanonical payload name ${names[i]}`);
3453
- if (names[i].startsWith("type_") && this.valueAt(i) !== null) {
3454
- throw new FilterV2Error(`${names[i]} must contain NULL`);
3462
+ const name = names[i];
3463
+ if (!PAYLOAD_NAME.test(name))
3464
+ throw new FilterV2Error(`noncanonical payload name ${name}`);
3465
+ if (name.startsWith("type_") && this.valueAt(i) !== null) {
3466
+ throw new FilterV2Error(`${name} must contain NULL`);
3455
3467
  }
3456
3468
  }
3457
3469
  this.context = parseContext(batch.schema);
@@ -3464,9 +3476,10 @@ class FilterParser {
3464
3476
  }
3465
3477
  valueAt(index) {
3466
3478
  const column = this.batch.getChildAt(index);
3467
- if (!column)
3479
+ const field = this.batch.schema.fields[index];
3480
+ if (!column || !field)
3468
3481
  throw new FilterV2Error(`missing payload column ${index}`);
3469
- return readCanonicalValue(this.batch.schema.fields[index].type, column, 0);
3482
+ return readCanonicalValue(field.type, column, 0);
3470
3483
  }
3471
3484
  validateContextCapability() {
3472
3485
  if (this.context.profile === NO_EVALUATION_CONTEXT)
@@ -3587,9 +3600,10 @@ class FilterParser {
3587
3600
  const ref = expectUint(rawRef, `${prefix}_ref`);
3588
3601
  const name = `${prefix}_${ref}`;
3589
3602
  const indexes = this.batch.schema.fields.flatMap((field, index) => field.name === name ? [index] : []);
3590
- if (indexes.length !== 1)
3603
+ const index = indexes.length === 1 ? indexes[0] : undefined;
3604
+ if (index === undefined)
3591
3605
  throw new FilterV2Error(`missing or duplicate payload ${name}`);
3592
- return { ref, field: this.batch.schema.fields[indexes[0]], value: this.valueAt(indexes[0]) };
3606
+ return { ref, field: this.batch.schema.fields[index], value: this.valueAt(index) };
3593
3607
  }
3594
3608
  identity(raw, where) {
3595
3609
  const object = expectObject(raw, where);
@@ -3887,9 +3901,10 @@ function decodeFilterDelta(bytes) {
3887
3901
  }
3888
3902
  function deltaRevisionKeys(batch) {
3889
3903
  const column = batch.getChildAt(0);
3890
- if (!column)
3904
+ const field = batch.schema.fields[0];
3905
+ if (!column || !field)
3891
3906
  throw new FilterV2Error("delta document has no filter_spec column");
3892
- const raw = readCanonicalValue(batch.schema.fields[0].type, column, 0);
3907
+ const raw = readCanonicalValue(field.type, column, 0);
3893
3908
  const document = JSON.parse(String(raw));
3894
3909
  return (document.updates ?? []).map((update) => revisionKey(update.id, update.revision));
3895
3910
  }
@@ -4639,10 +4654,19 @@ function deserializeCardinalityRequest(params) {
4639
4654
  bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null
4640
4655
  };
4641
4656
  }
4657
+ function cardinalityValue(name, v) {
4658
+ if (v === null || v === undefined)
4659
+ return null;
4660
+ if (typeof v === "bigint")
4661
+ return v;
4662
+ if (typeof v === "number" && Number.isInteger(v))
4663
+ return BigInt(v);
4664
+ throw new TypeError(`TableCardinality.${name} must be an integer number, a bigint, or null (got ${typeof v}: ${String(v)})`);
4665
+ }
4642
4666
  function serializeTableCardinality(card) {
4643
4667
  return {
4644
- estimate: card.estimate,
4645
- max: card.max
4668
+ estimate: cardinalityValue("estimate", card.estimate),
4669
+ max: cardinalityValue("max", card.max)
4646
4670
  };
4647
4671
  }
4648
4672
  // src/protocol/carried-init-request.ts
@@ -6364,9 +6388,9 @@ function registerVgiService(protocol, service) {
6364
6388
  const common = {
6365
6389
  params: m.params,
6366
6390
  outputSchema: stream.outputSchema,
6367
- headerSchema: m.header ?? undefined,
6368
- headerInit: stream.headerInit,
6369
- onCancel: stream.onCancel,
6391
+ ...m.header ? { headerSchema: m.header } : {},
6392
+ ...stream.headerInit ? { headerInit: stream.headerInit } : {},
6393
+ ...stream.onCancel ? { onCancel: stream.onCancel } : {},
6370
6394
  doc: m.doc
6371
6395
  };
6372
6396
  if (stream.kind === "exchange") {
@@ -11082,6 +11106,7 @@ function extractArgMap(cfg, args) {
11082
11106
  }
11083
11107
  }
11084
11108
  for (let i = 0;i < constNames.length; i++) {
11109
+ const name = constNames[i];
11085
11110
  let v;
11086
11111
  try {
11087
11112
  v = args.get(i);
@@ -11096,16 +11121,16 @@ function extractArgMap(cfg, args) {
11096
11121
  v = Number(v);
11097
11122
  }
11098
11123
  } catch {
11099
- const def = cfg.argDefaults?.[constNames[i]];
11124
+ const def = cfg.argDefaults?.[name];
11100
11125
  if (def !== undefined)
11101
- out[constNames[i]] = def;
11126
+ out[name] = def;
11102
11127
  continue;
11103
11128
  }
11104
- const constraints = cfg.argConstraints?.[constNames[i]];
11129
+ const constraints = cfg.argConstraints?.[name];
11105
11130
  if (constraints !== undefined) {
11106
- validateConstConstraints(constNames[i], constraints, v);
11131
+ validateConstConstraints(name, constraints, v);
11107
11132
  }
11108
- out[constNames[i]] = v;
11133
+ out[name] = v;
11109
11134
  }
11110
11135
  if (cfg.argDefaults) {
11111
11136
  for (const [name, def] of Object.entries(cfg.argDefaults)) {
@@ -12306,15 +12331,16 @@ class CatalogSnapshotManager {
12306
12331
  validateCatalogPublicationEnvelope(bytes);
12307
12332
  }
12308
12333
  });
12309
- if (resolved.numRows !== 1 || resolved.schema.fields.length !== 1 || resolved.schema.fields[0].name !== "result" || typeSignature(resolved.schema.fields[0].type) !== typeSignature(binary2()) || resolved.schema.fields[0].nullable)
12334
+ const resultField = resolved.schema.fields.length === 1 ? resolved.schema.fields[0] : undefined;
12335
+ if (resolved.numRows !== 1 || !resultField || resultField.name !== "result" || typeSignature(resultField.type) !== typeSignature(binary2()) || resultField.nullable)
12310
12336
  throw new Error("invalid published RPC envelope");
12311
12337
  const bytes = resolved.getChild("result")?.get(0);
12312
12338
  if (!(bytes instanceof Uint8Array))
12313
12339
  throw new Error("published catalog has no result bytes");
12314
12340
  const decoded = decodeASDCollection(CatalogContentsResultSchema, bytes);
12315
- if (decoded.length !== 1)
12341
+ const response = decoded.length === 1 ? decoded[0] : undefined;
12342
+ if (!response)
12316
12343
  throw new Error("published catalog must contain exactly one response row");
12317
- const response = decoded[0];
12318
12344
  if (response.not_modified || Number(response.catalog_version) !== identity.catalogVersion || response.etag !== m.etag)
12319
12345
  throw new Error("published catalog version or ETag mismatch");
12320
12346
  decodeCatalogStreams(response);
@@ -14029,12 +14055,12 @@ function buildRpcServer(primary, hosting, options) {
14029
14055
  if (tickets)
14030
14056
  protocols.push(tickets);
14031
14057
  }
14032
- return new VgiRpcServer(primary, {
14058
+ return new VgiRpcServer(primary, omitUndefined({
14033
14059
  serverId: options.serverId,
14034
14060
  protocols,
14035
14061
  identity,
14036
14062
  grantKeys: null
14037
- });
14063
+ }));
14038
14064
  }
14039
14065
  function validatedHostedProtocols(hosting, primary) {
14040
14066
  if (hosting.hostedProtocols === undefined)
@@ -14078,13 +14104,13 @@ function buildIdentity(hosting, grantKeys, env) {
14078
14104
  const { resolveToken, mintGrant } = hosting;
14079
14105
  if (!resolveToken && !mintGrant && !grantKeys)
14080
14106
  return;
14081
- return new IdentityImpl({
14107
+ return new IdentityImpl(omitUndefined({
14082
14108
  resolveToken,
14083
14109
  mintGrant,
14084
14110
  grantKeys: grantKeys ?? undefined,
14085
14111
  introspectPrincipals: resolveToken ? resolveIntrospectPrincipals(hosting.introspectPrincipals, env) : undefined,
14086
14112
  maxAuthAge: hosting.maxAuthAge
14087
- });
14113
+ }));
14088
14114
  }
14089
14115
  function buildAttachTickets(hosting, grantKeys, config, env) {
14090
14116
  if (!config || !config.signingKeyConfigured || !config.signingKey)
@@ -14166,7 +14192,7 @@ function createVgiFetch(opts) {
14166
14192
  });
14167
14193
  const reservedCheck = checkReservedAttachOptions(opts.protocol.catalogInterface);
14168
14194
  reservedCheck.catch((e) => console.error(`VGI worker refused to serve: ${e.message}`));
14169
- const handler = createHttpHandler(server, {
14195
+ const handler = createHttpHandler(server, omitUndefined({
14170
14196
  prefix,
14171
14197
  serverId,
14172
14198
  tokenKey: opts.signingKey,
@@ -14181,7 +14207,7 @@ function createVgiFetch(opts) {
14181
14207
  repositoryUrl: opts.repositoryUrl,
14182
14208
  extraRoutes: createLandingRoutes(opts.landingInfo),
14183
14209
  enableLandingPage: false
14184
- });
14210
+ }));
14185
14211
  return async (req) => {
14186
14212
  await reservedCheck;
14187
14213
  const storage = await ensureRequestAuthStorage();
@@ -14574,7 +14600,7 @@ function defineTableFunction(config) {
14574
14600
  lookup_names: result.lookupNames
14575
14601
  };
14576
14602
  },
14577
- projection: config.projection ? (proposal) => config.projection({ args: extractArgs(proposal.bindCall), bindCall: proposal.bindCall, settings: batchToScalarDict(proposal.bindCall.settings), secrets: batchToSecretDict(proposal.bindCall.secrets), resolvedSecretsProvided: proposal.bindCall.resolved_secrets_provided }, proposal) : undefined,
14603
+ ...config.projection ? { projection: (proposal) => config.projection({ args: extractArgs(proposal.bindCall), bindCall: proposal.bindCall, settings: batchToScalarDict(proposal.bindCall.settings), secrets: batchToSecretDict(proposal.bindCall.secrets), resolvedSecretsProvided: proposal.bindCall.resolved_secrets_provided }, proposal) } : {},
14578
14604
  async globalInit(request) {
14579
14605
  const executionId = new Uint8Array(16);
14580
14606
  crypto.getRandomValues(executionId);
@@ -14687,55 +14713,63 @@ function defineTableFunction(config) {
14687
14713
  }
14688
14714
  };
14689
14715
  },
14690
- cardinality: config.cardinality ? (request) => {
14691
- const args = extractArgs(request.bind_call);
14692
- const settings = batchToScalarDict(request.bind_call.settings);
14693
- const secrets = batchToSecretDict(request.bind_call.secrets);
14694
- return config.cardinality({
14695
- args,
14696
- bindCall: request.bind_call,
14697
- settings,
14698
- secrets,
14699
- resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
14700
- });
14701
- } : undefined,
14702
- plan: config.plan ? (request) => {
14703
- const args = extractArgs(request.bind_call);
14704
- const settings = batchToScalarDict(request.bind_call.settings);
14705
- const secrets = batchToSecretDict(request.bind_call.secrets);
14706
- return config.plan({
14707
- args,
14708
- bindCall: request.bind_call,
14709
- settings,
14710
- secrets,
14711
- resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
14712
- }, request);
14713
- } : undefined,
14714
- statistics: config.statistics ? (request) => {
14715
- const args = extractArgs(request.bind_call);
14716
- const settings = batchToScalarDict(request.bind_call.settings);
14717
- const secrets = batchToSecretDict(request.bind_call.secrets);
14718
- return config.statistics({
14719
- args,
14720
- bindCall: request.bind_call,
14721
- settings,
14722
- secrets,
14723
- resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
14724
- });
14725
- } : undefined,
14726
- dynamicToString: config.dynamicToString ? (request) => {
14727
- const args = extractArgs(request.bindCall);
14728
- const settings = batchToScalarDict(request.bindCall.settings);
14729
- const secrets = batchToSecretDict(request.bindCall.secrets);
14730
- const storage2 = new BoundStorage(storage, request.globalExecutionId);
14731
- return config.dynamicToString({
14732
- args,
14733
- bindCall: request.bindCall,
14734
- settings,
14735
- secrets,
14736
- resolvedSecretsProvided: request.bindCall.resolved_secrets_provided ?? false
14737
- }, request.globalExecutionId, storage2);
14738
- } : undefined
14716
+ ...config.cardinality ? {
14717
+ cardinality: (request) => {
14718
+ const args = extractArgs(request.bind_call);
14719
+ const settings = batchToScalarDict(request.bind_call.settings);
14720
+ const secrets = batchToSecretDict(request.bind_call.secrets);
14721
+ return config.cardinality({
14722
+ args,
14723
+ bindCall: request.bind_call,
14724
+ settings,
14725
+ secrets,
14726
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
14727
+ });
14728
+ }
14729
+ } : {},
14730
+ ...config.plan ? {
14731
+ plan: (request) => {
14732
+ const args = extractArgs(request.bind_call);
14733
+ const settings = batchToScalarDict(request.bind_call.settings);
14734
+ const secrets = batchToSecretDict(request.bind_call.secrets);
14735
+ return config.plan({
14736
+ args,
14737
+ bindCall: request.bind_call,
14738
+ settings,
14739
+ secrets,
14740
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
14741
+ }, request);
14742
+ }
14743
+ } : {},
14744
+ ...config.statistics ? {
14745
+ statistics: (request) => {
14746
+ const args = extractArgs(request.bind_call);
14747
+ const settings = batchToScalarDict(request.bind_call.settings);
14748
+ const secrets = batchToSecretDict(request.bind_call.secrets);
14749
+ return config.statistics({
14750
+ args,
14751
+ bindCall: request.bind_call,
14752
+ settings,
14753
+ secrets,
14754
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
14755
+ });
14756
+ }
14757
+ } : {},
14758
+ ...config.dynamicToString ? {
14759
+ dynamicToString: (request) => {
14760
+ const args = extractArgs(request.bindCall);
14761
+ const settings = batchToScalarDict(request.bindCall.settings);
14762
+ const secrets = batchToSecretDict(request.bindCall.secrets);
14763
+ const storage2 = new BoundStorage(storage, request.globalExecutionId);
14764
+ return config.dynamicToString({
14765
+ args,
14766
+ bindCall: request.bindCall,
14767
+ settings,
14768
+ secrets,
14769
+ resolvedSecretsProvided: request.bindCall.resolved_secrets_provided ?? false
14770
+ }, request.globalExecutionId, storage2);
14771
+ }
14772
+ } : {}
14739
14773
  };
14740
14774
  }
14741
14775
  // src/functions/table-in-out.ts
@@ -15640,12 +15674,13 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
15640
15674
  if (typeof part !== "string" || !part || part.includes("\x00"))
15641
15675
  throw new Error("invalid requiredFilters component");
15642
15676
  const matches = fields.filter((f) => f.name === part);
15643
- if (matches.length !== 1)
15677
+ const match = matches.length === 1 ? matches[0] : undefined;
15678
+ if (!match)
15644
15679
  throw new Error(`unknown or ambiguous requiredFilters component: ${part}`);
15645
15680
  if (i + 1 < path.length) {
15646
- if (!isStruct(matches[0].type))
15681
+ if (!isStruct(match.type))
15647
15682
  throw new Error(`non-struct requiredFilters parent: ${part}`);
15648
- fields = matches[0].type.children;
15683
+ fields = match.type.children;
15649
15684
  }
15650
15685
  }
15651
15686
  }
@@ -16203,7 +16238,7 @@ class CompositeCatalogInterface extends CatalogInterface {
16203
16238
  }
16204
16239
  _route(attachOpaqueData) {
16205
16240
  const idx = attachOpaqueData[ROUTE_BYTE];
16206
- const route = this._backends[idx];
16241
+ const route = idx === undefined ? undefined : this._backends[idx];
16207
16242
  if (!route) {
16208
16243
  throw new OpaqueDataRejectedError("attach_opaque_data");
16209
16244
  }
@@ -16856,4 +16891,4 @@ export {
16856
16891
  validateTableConstraints
16857
16892
  };
16858
16893
 
16859
- //# debugId=BAA5461FE644FC2564756E2164756E21
16894
+ //# debugId=F3074584951B62A064756E2164756E21