@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
package/dist/index.js CHANGED
@@ -3496,10 +3496,11 @@ class FilterParser {
3496
3496
  if (new Set(names).size !== names.length)
3497
3497
  throw new FilterV2Error("filter payload names must be unique");
3498
3498
  for (let i = 1;i < names.length; i++) {
3499
- if (!PAYLOAD_NAME.test(names[i]))
3500
- throw new FilterV2Error(`noncanonical payload name ${names[i]}`);
3501
- if (names[i].startsWith("type_") && this.valueAt(i) !== null) {
3502
- throw new FilterV2Error(`${names[i]} must contain NULL`);
3499
+ const name = names[i];
3500
+ if (!PAYLOAD_NAME.test(name))
3501
+ throw new FilterV2Error(`noncanonical payload name ${name}`);
3502
+ if (name.startsWith("type_") && this.valueAt(i) !== null) {
3503
+ throw new FilterV2Error(`${name} must contain NULL`);
3503
3504
  }
3504
3505
  }
3505
3506
  this.context = parseContext(batch.schema);
@@ -3512,9 +3513,10 @@ class FilterParser {
3512
3513
  }
3513
3514
  valueAt(index) {
3514
3515
  const column = this.batch.getChildAt(index);
3515
- if (!column)
3516
+ const field = this.batch.schema.fields[index];
3517
+ if (!column || !field)
3516
3518
  throw new FilterV2Error(`missing payload column ${index}`);
3517
- return readCanonicalValue(this.batch.schema.fields[index].type, column, 0);
3519
+ return readCanonicalValue(field.type, column, 0);
3518
3520
  }
3519
3521
  validateContextCapability() {
3520
3522
  if (this.context.profile === NO_EVALUATION_CONTEXT)
@@ -3635,9 +3637,10 @@ class FilterParser {
3635
3637
  const ref = expectUint(rawRef, `${prefix}_ref`);
3636
3638
  const name = `${prefix}_${ref}`;
3637
3639
  const indexes = this.batch.schema.fields.flatMap((field, index) => field.name === name ? [index] : []);
3638
- if (indexes.length !== 1)
3640
+ const index = indexes.length === 1 ? indexes[0] : undefined;
3641
+ if (index === undefined)
3639
3642
  throw new FilterV2Error(`missing or duplicate payload ${name}`);
3640
- return { ref, field: this.batch.schema.fields[indexes[0]], value: this.valueAt(indexes[0]) };
3643
+ return { ref, field: this.batch.schema.fields[index], value: this.valueAt(index) };
3641
3644
  }
3642
3645
  identity(raw, where) {
3643
3646
  const object = expectObject(raw, where);
@@ -3926,7 +3929,8 @@ function resolveColumn(batch, columnName) {
3926
3929
  throw new FilterV2Error(`filter column ${columnName} is unavailable in emitted batch`);
3927
3930
  }
3928
3931
  const column = batch.getChildAt(index);
3929
- resolved = column ? { type: batch.schema.fields[index].type, column } : null;
3932
+ const field = batch.schema.fields[index];
3933
+ resolved = column && field ? { type: field.type, column } : null;
3930
3934
  byName.set(columnName, resolved);
3931
3935
  }
3932
3936
  return resolved;
@@ -4526,9 +4530,10 @@ function decodeFilterDelta(bytes) {
4526
4530
  }
4527
4531
  function deltaRevisionKeys(batch) {
4528
4532
  const column = batch.getChildAt(0);
4529
- if (!column)
4533
+ const field = batch.schema.fields[0];
4534
+ if (!column || !field)
4530
4535
  throw new FilterV2Error("delta document has no filter_spec column");
4531
- const raw = readCanonicalValue(batch.schema.fields[0].type, column, 0);
4536
+ const raw = readCanonicalValue(field.type, column, 0);
4532
4537
  const document = JSON.parse(String(raw));
4533
4538
  return (document.updates ?? []).map((update) => revisionKey(update.id, update.revision));
4534
4539
  }
@@ -4928,7 +4933,7 @@ function defineTableFunction(config) {
4928
4933
  lookup_names: result.lookupNames
4929
4934
  };
4930
4935
  },
4931
- 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,
4936
+ ...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) } : {},
4932
4937
  async globalInit(request) {
4933
4938
  const executionId = new Uint8Array(16);
4934
4939
  crypto.getRandomValues(executionId);
@@ -5041,55 +5046,63 @@ function defineTableFunction(config) {
5041
5046
  }
5042
5047
  };
5043
5048
  },
5044
- cardinality: config.cardinality ? (request) => {
5045
- const args = extractArgs(request.bind_call);
5046
- const settings = batchToScalarDict(request.bind_call.settings);
5047
- const secrets = batchToSecretDict(request.bind_call.secrets);
5048
- return config.cardinality({
5049
- args,
5050
- bindCall: request.bind_call,
5051
- settings,
5052
- secrets,
5053
- resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
5054
- });
5055
- } : undefined,
5056
- plan: config.plan ? (request) => {
5057
- const args = extractArgs(request.bind_call);
5058
- const settings = batchToScalarDict(request.bind_call.settings);
5059
- const secrets = batchToSecretDict(request.bind_call.secrets);
5060
- return config.plan({
5061
- args,
5062
- bindCall: request.bind_call,
5063
- settings,
5064
- secrets,
5065
- resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
5066
- }, request);
5067
- } : undefined,
5068
- statistics: config.statistics ? (request) => {
5069
- const args = extractArgs(request.bind_call);
5070
- const settings = batchToScalarDict(request.bind_call.settings);
5071
- const secrets = batchToSecretDict(request.bind_call.secrets);
5072
- return config.statistics({
5073
- args,
5074
- bindCall: request.bind_call,
5075
- settings,
5076
- secrets,
5077
- resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
5078
- });
5079
- } : undefined,
5080
- dynamicToString: config.dynamicToString ? (request) => {
5081
- const args = extractArgs(request.bindCall);
5082
- const settings = batchToScalarDict(request.bindCall.settings);
5083
- const secrets = batchToSecretDict(request.bindCall.secrets);
5084
- const storage2 = new BoundStorage(storage, request.globalExecutionId);
5085
- return config.dynamicToString({
5086
- args,
5087
- bindCall: request.bindCall,
5088
- settings,
5089
- secrets,
5090
- resolvedSecretsProvided: request.bindCall.resolved_secrets_provided ?? false
5091
- }, request.globalExecutionId, storage2);
5092
- } : undefined
5049
+ ...config.cardinality ? {
5050
+ cardinality: (request) => {
5051
+ const args = extractArgs(request.bind_call);
5052
+ const settings = batchToScalarDict(request.bind_call.settings);
5053
+ const secrets = batchToSecretDict(request.bind_call.secrets);
5054
+ return config.cardinality({
5055
+ args,
5056
+ bindCall: request.bind_call,
5057
+ settings,
5058
+ secrets,
5059
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
5060
+ });
5061
+ }
5062
+ } : {},
5063
+ ...config.plan ? {
5064
+ plan: (request) => {
5065
+ const args = extractArgs(request.bind_call);
5066
+ const settings = batchToScalarDict(request.bind_call.settings);
5067
+ const secrets = batchToSecretDict(request.bind_call.secrets);
5068
+ return config.plan({
5069
+ args,
5070
+ bindCall: request.bind_call,
5071
+ settings,
5072
+ secrets,
5073
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
5074
+ }, request);
5075
+ }
5076
+ } : {},
5077
+ ...config.statistics ? {
5078
+ statistics: (request) => {
5079
+ const args = extractArgs(request.bind_call);
5080
+ const settings = batchToScalarDict(request.bind_call.settings);
5081
+ const secrets = batchToSecretDict(request.bind_call.secrets);
5082
+ return config.statistics({
5083
+ args,
5084
+ bindCall: request.bind_call,
5085
+ settings,
5086
+ secrets,
5087
+ resolvedSecretsProvided: request.bind_call.resolved_secrets_provided ?? false
5088
+ });
5089
+ }
5090
+ } : {},
5091
+ ...config.dynamicToString ? {
5092
+ dynamicToString: (request) => {
5093
+ const args = extractArgs(request.bindCall);
5094
+ const settings = batchToScalarDict(request.bindCall.settings);
5095
+ const secrets = batchToSecretDict(request.bindCall.secrets);
5096
+ const storage2 = new BoundStorage(storage, request.globalExecutionId);
5097
+ return config.dynamicToString({
5098
+ args,
5099
+ bindCall: request.bindCall,
5100
+ settings,
5101
+ secrets,
5102
+ resolvedSecretsProvided: request.bindCall.resolved_secrets_provided ?? false
5103
+ }, request.globalExecutionId, storage2);
5104
+ }
5105
+ } : {}
5093
5106
  };
5094
5107
  }
5095
5108
  // src/functions/aggregate.ts
@@ -6008,10 +6021,19 @@ function deserializeCardinalityRequest(params) {
6008
6021
  bind_opaque_data: params.bind_opaque_data ? toUint8Array2(params.bind_opaque_data) : null
6009
6022
  };
6010
6023
  }
6024
+ function cardinalityValue(name, v) {
6025
+ if (v === null || v === undefined)
6026
+ return null;
6027
+ if (typeof v === "bigint")
6028
+ return v;
6029
+ if (typeof v === "number" && Number.isInteger(v))
6030
+ return BigInt(v);
6031
+ throw new TypeError(`TableCardinality.${name} must be an integer number, a bigint, or null (got ${typeof v}: ${String(v)})`);
6032
+ }
6011
6033
  function serializeTableCardinality(card) {
6012
6034
  return {
6013
- estimate: card.estimate,
6014
- max: card.max
6035
+ estimate: cardinalityValue("estimate", card.estimate),
6036
+ max: cardinalityValue("max", card.max)
6015
6037
  };
6016
6038
  }
6017
6039
  // src/protocol/carried-init-request.ts
@@ -11478,12 +11500,13 @@ class ReadOnlyCatalogInterface extends CatalogInterface {
11478
11500
  if (typeof part !== "string" || !part || part.includes("\x00"))
11479
11501
  throw new Error("invalid requiredFilters component");
11480
11502
  const matches = fields.filter((f) => f.name === part);
11481
- if (matches.length !== 1)
11503
+ const match = matches.length === 1 ? matches[0] : undefined;
11504
+ if (!match)
11482
11505
  throw new Error(`unknown or ambiguous requiredFilters component: ${part}`);
11483
11506
  if (i + 1 < path.length) {
11484
- if (!isStruct(matches[0].type))
11507
+ if (!isStruct(match.type))
11485
11508
  throw new Error(`non-struct requiredFilters parent: ${part}`);
11486
- fields = matches[0].type.children;
11509
+ fields = match.type.children;
11487
11510
  }
11488
11511
  }
11489
11512
  }
@@ -12828,7 +12851,7 @@ class CompositeCatalogInterface extends CatalogInterface {
12828
12851
  }
12829
12852
  _route(attachOpaqueData) {
12830
12853
  const idx = attachOpaqueData[ROUTE_BYTE];
12831
- const route = this._backends[idx];
12854
+ const route = idx === undefined ? undefined : this._backends[idx];
12832
12855
  if (!route) {
12833
12856
  throw new OpaqueDataRejectedError("attach_opaque_data");
12834
12857
  }
@@ -14967,9 +14990,9 @@ function registerVgiService(protocol, service) {
14967
14990
  const common = {
14968
14991
  params: m.params,
14969
14992
  outputSchema: stream.outputSchema,
14970
- headerSchema: m.header ?? undefined,
14971
- headerInit: stream.headerInit,
14972
- onCancel: stream.onCancel,
14993
+ ...m.header ? { headerSchema: m.header } : {},
14994
+ ...stream.headerInit ? { headerInit: stream.headerInit } : {},
14995
+ ...stream.onCancel ? { onCancel: stream.onCancel } : {},
14973
14996
  doc: m.doc
14974
14997
  };
14975
14998
  if (stream.kind === "exchange") {
@@ -15933,6 +15956,7 @@ function extractArgMap(cfg, args) {
15933
15956
  }
15934
15957
  }
15935
15958
  for (let i = 0;i < constNames.length; i++) {
15959
+ const name = constNames[i];
15936
15960
  let v;
15937
15961
  try {
15938
15962
  v = args.get(i);
@@ -15947,16 +15971,16 @@ function extractArgMap(cfg, args) {
15947
15971
  v = Number(v);
15948
15972
  }
15949
15973
  } catch {
15950
- const def = cfg.argDefaults?.[constNames[i]];
15974
+ const def = cfg.argDefaults?.[name];
15951
15975
  if (def !== undefined)
15952
- out[constNames[i]] = def;
15976
+ out[name] = def;
15953
15977
  continue;
15954
15978
  }
15955
- const constraints = cfg.argConstraints?.[constNames[i]];
15979
+ const constraints = cfg.argConstraints?.[name];
15956
15980
  if (constraints !== undefined) {
15957
- validateConstConstraints(constNames[i], constraints, v);
15981
+ validateConstConstraints(name, constraints, v);
15958
15982
  }
15959
- out[constNames[i]] = v;
15983
+ out[name] = v;
15960
15984
  }
15961
15985
  if (cfg.argDefaults) {
15962
15986
  for (const [name, def] of Object.entries(cfg.argDefaults)) {
@@ -16501,15 +16525,16 @@ class CatalogSnapshotManager {
16501
16525
  validateCatalogPublicationEnvelope(bytes);
16502
16526
  }
16503
16527
  });
16504
- 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)
16528
+ const resultField = resolved.schema.fields.length === 1 ? resolved.schema.fields[0] : undefined;
16529
+ if (resolved.numRows !== 1 || !resultField || resultField.name !== "result" || typeSignature(resultField.type) !== typeSignature(binary2()) || resultField.nullable)
16505
16530
  throw new Error("invalid published RPC envelope");
16506
16531
  const bytes = resolved.getChild("result")?.get(0);
16507
16532
  if (!(bytes instanceof Uint8Array))
16508
16533
  throw new Error("published catalog has no result bytes");
16509
16534
  const decoded = decodeASDCollection(CatalogContentsResultSchema, bytes);
16510
- if (decoded.length !== 1)
16535
+ const response = decoded.length === 1 ? decoded[0] : undefined;
16536
+ if (!response)
16511
16537
  throw new Error("published catalog must contain exactly one response row");
16512
- const response = decoded[0];
16513
16538
  if (response.not_modified || Number(response.catalog_version) !== identity.catalogVersion || response.etag !== m.etag)
16514
16539
  throw new Error("published catalog version or ETag mismatch");
16515
16540
  decodeCatalogStreams(response);
@@ -17961,6 +17986,26 @@ function toAsyncIterator(input) {
17961
17986
  }
17962
17987
 
17963
17988
  // src/client/client.ts
17989
+ function int64ColumnNames(s) {
17990
+ if (!s)
17991
+ return [];
17992
+ return s.fields.filter((f) => isInt(f.type) && f.type.bitWidth === 64).map((f) => f.name);
17993
+ }
17994
+ var MIN_SAFE_BIGINT = BigInt(Number.MIN_SAFE_INTEGER);
17995
+ var MAX_SAFE_BIGINT = BigInt(Number.MAX_SAFE_INTEGER);
17996
+ function applyInt64Mode(rows, columns, mode) {
17997
+ for (const row of rows) {
17998
+ for (const name of columns) {
17999
+ const v = row[name];
18000
+ if (mode === "bigint") {
18001
+ if (typeof v === "number" && Number.isInteger(v))
18002
+ row[name] = BigInt(v);
18003
+ } else if (typeof v === "bigint" && v >= MIN_SAFE_BIGINT && v <= MAX_SAFE_BIGINT) {
18004
+ row[name] = Number(v);
18005
+ }
18006
+ }
18007
+ }
18008
+ }
17964
18009
  function onConflictName(onConflict) {
17965
18010
  return String(onConflict).toUpperCase();
17966
18011
  }
@@ -18252,10 +18297,14 @@ class VgiClient {
18252
18297
  tablesample: opts.tablesample,
18253
18298
  joinKeys: opts.joinKeys
18254
18299
  });
18300
+ const int64Columns = opts.int64 === undefined ? [] : int64ColumnNames(bindResp.output_schema);
18255
18301
  try {
18256
18302
  for await (const rows of session) {
18257
- if (rows.length > 0)
18258
- yield rows;
18303
+ if (rows.length === 0)
18304
+ continue;
18305
+ if (int64Columns.length > 0)
18306
+ applyInt64Mode(rows, int64Columns, opts.int64);
18307
+ yield rows;
18259
18308
  }
18260
18309
  } finally {
18261
18310
  session.close();
@@ -18497,7 +18546,7 @@ class VgiClient {
18497
18546
  return null;
18498
18547
  const inner = unwrapResult(result);
18499
18548
  const items = deserializeInfoList(inner.items, decodeSchemaInfo);
18500
- return items.length > 0 ? items[0] : null;
18549
+ return items[0] ?? null;
18501
18550
  }
18502
18551
  async schemaCreate(attachOpaqueData, path, opts) {
18503
18552
  const tagsMap = opts?.tags ? new Map(Object.entries(opts.tags)) : null;
@@ -18575,7 +18624,7 @@ class VgiClient {
18575
18624
  return null;
18576
18625
  const inner = unwrapResult(result);
18577
18626
  const items = deserializeInfoList(inner.items, decodeTableInfo);
18578
- return items.length > 0 ? items[0] : null;
18627
+ return items[0] ?? null;
18579
18628
  }
18580
18629
  async tableCreate(attachOpaqueData, schemaPath, name, columns, onConflict, constraintDefinitions = [], transactionOpaqueData) {
18581
18630
  await this.rpc.call("catalog_table_create", {
@@ -18743,7 +18792,7 @@ class VgiClient {
18743
18792
  return null;
18744
18793
  const inner = unwrapResult(result);
18745
18794
  const items = deserializeInfoList(inner.items, decodeViewInfo);
18746
- return items.length > 0 ? items[0] : null;
18795
+ return items[0] ?? null;
18747
18796
  }
18748
18797
  async viewCreate(attachOpaqueData, schemaPath, name, definition, onConflict, transactionOpaqueData, aliases, security = "regular", comment, tags, columnComments) {
18749
18798
  await this.rpc.call("catalog_view_create", {
@@ -18812,7 +18861,7 @@ class VgiClient {
18812
18861
  return null;
18813
18862
  const inner = unwrapResult(result);
18814
18863
  const items = deserializeInfoList(inner.items, decodeMacroInfo);
18815
- return items.length > 0 ? items[0] : null;
18864
+ return items[0] ?? null;
18816
18865
  }
18817
18866
  async schemaContentsMacros(attachOpaqueData, path, type, transactionOpaqueData) {
18818
18867
  const result = await this.rpc.call("catalog_schema_contents_macros", {
@@ -18862,6 +18911,18 @@ import {
18862
18911
  IdentityImpl,
18863
18912
  VgiRpcServer
18864
18913
  } from "@query-farm/vgi-rpc";
18914
+
18915
+ // src/util/defined.ts
18916
+ function omitUndefined(obj) {
18917
+ const out = {};
18918
+ for (const [k, v] of Object.entries(obj)) {
18919
+ if (v !== undefined)
18920
+ out[k] = v;
18921
+ }
18922
+ return out;
18923
+ }
18924
+
18925
+ // src/rpc-server.ts
18865
18926
  var TRANSPORTS = new Set(["pipe", "unix", "tcp", "iroh", "stream", "http"]);
18866
18927
  var IDENTITY_TRANSPORTS = new Set(["http"]);
18867
18928
  var RESERVED_PREFIX = "vgi_rpc.";
@@ -18880,12 +18941,12 @@ function buildRpcServer(primary, hosting, options) {
18880
18941
  if (tickets)
18881
18942
  protocols.push(tickets);
18882
18943
  }
18883
- return new VgiRpcServer(primary, {
18944
+ return new VgiRpcServer(primary, omitUndefined({
18884
18945
  serverId: options.serverId,
18885
18946
  protocols,
18886
18947
  identity,
18887
18948
  grantKeys: null
18888
- });
18949
+ }));
18889
18950
  }
18890
18951
  function validatedHostedProtocols(hosting, primary) {
18891
18952
  if (hosting.hostedProtocols === undefined)
@@ -18929,13 +18990,13 @@ function buildIdentity(hosting, grantKeys, env) {
18929
18990
  const { resolveToken, mintGrant } = hosting;
18930
18991
  if (!resolveToken && !mintGrant && !grantKeys)
18931
18992
  return;
18932
- return new IdentityImpl({
18993
+ return new IdentityImpl(omitUndefined({
18933
18994
  resolveToken,
18934
18995
  mintGrant,
18935
18996
  grantKeys: grantKeys ?? undefined,
18936
18997
  introspectPrincipals: resolveToken ? resolveIntrospectPrincipals(hosting.introspectPrincipals, env) : undefined,
18937
18998
  maxAuthAge: hosting.maxAuthAge
18938
- });
18999
+ }));
18939
19000
  }
18940
19001
  function buildAttachTickets(hosting, grantKeys, config, env) {
18941
19002
  if (!config || !config.signingKeyConfigured || !config.signingKey)
@@ -19117,10 +19178,10 @@ class Worker {
19117
19178
  const envOverride = process.env.VGI_WORKER_IDLE_TIMEOUT;
19118
19179
  const idleTimeout = envOverride !== undefined && envOverride !== "" ? Number(envOverride) : launcher.idleTimeout;
19119
19180
  debug(() => `[worker] AF_UNIX mode: ${launcher.unixPath} idle=${idleTimeout ?? 300}s${envOverride !== undefined && envOverride !== "" ? " (env override)" : ""}`);
19120
- serveUnix(this.buildServer(protocol, "unix"), {
19181
+ serveUnix(this.buildServer(protocol, "unix"), omitUndefined({
19121
19182
  unixPath: launcher.unixPath,
19122
19183
  idleTimeout
19123
- }).then((handle) => handle.done).then(() => {
19184
+ })).then((handle) => handle.done).then(() => {
19124
19185
  debug(() => `[worker] serveUnix done (idle shutdown)`);
19125
19186
  }).catch((err) => {
19126
19187
  process.stderr.write(`Worker error: ${err.message}
@@ -19134,7 +19195,7 @@ ${err.stack}
19134
19195
  const envOverride = process.env.VGI_WORKER_IDLE_TIMEOUT;
19135
19196
  const idleTimeout = envOverride !== undefined && envOverride !== "" ? Number(envOverride) : launcher.idleTimeout;
19136
19197
  debug(() => `[worker] TCP mode: ${launcher.tcpHost}:${launcher.tcpPort} idle=${idleTimeout ?? 300}s${envOverride !== undefined && envOverride !== "" ? " (env override)" : ""}`);
19137
- serveTcp(this.buildServer(protocol, launcher.irohRawUpstream ? "iroh" : "tcp"), {
19198
+ serveTcp(this.buildServer(protocol, launcher.irohRawUpstream ? "iroh" : "tcp"), omitUndefined({
19138
19199
  host: launcher.tcpHost,
19139
19200
  port: launcher.tcpPort,
19140
19201
  idleTimeout,
@@ -19144,7 +19205,7 @@ ${err.stack}
19144
19205
  irohProxyIssuer: launcher.irohIssuer,
19145
19206
  peerAuthenticationPolicy: launcher.irohAuthenticate ? peerIdentityPrimary("iroh") : observePeerIdentity
19146
19207
  } : {}
19147
- }).then((handle) => handle.done).then(() => {
19208
+ })).then((handle) => handle.done).then(() => {
19148
19209
  debug(() => `[worker] serveTcp done (idle shutdown)`);
19149
19210
  }).catch((err) => {
19150
19211
  process.stderr.write(`Worker error: ${err.message}
@@ -19182,7 +19243,7 @@ ${err.stack}
19182
19243
  });
19183
19244
  }
19184
19245
  async serveStream(readable, writable) {
19185
- await serveStreamRpc(this.buildServer(this.buildProtocol(), "stream"), { readable, writable });
19246
+ await serveStreamRpc(this.buildServer(this.buildProtocol(), "stream"), omitUndefined({ readable, writable }));
19186
19247
  }
19187
19248
  }
19188
19249
  // src/catalog/s3-publication.ts
@@ -19639,4 +19700,4 @@ export {
19639
19700
  validateTableConstraints
19640
19701
  };
19641
19702
 
19642
- //# debugId=67FF9BC53B3C318564756E2164756E21
19703
+ //# debugId=9CC3A9354AA50B4D64756E2164756E21