@query-farm/vgi 0.51.0 → 0.52.0

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 (70) hide show
  1. package/README.md +45 -3
  2. package/dist/client-entry.js +833 -775
  3. package/dist/client-entry.js.map +10 -10
  4. package/dist/functions/storage-blobs.d.ts +173 -0
  5. package/dist/functions/storage-cf-do.d.ts +12 -0
  6. package/dist/functions/storage.d.ts +22 -0
  7. package/dist/functions/table.d.ts +6 -1
  8. package/dist/generated/vgi-client.d.ts +7 -1
  9. package/dist/generated/vgi-protocol-schemas.d.ts +10 -9
  10. package/dist/generated/vgi-protocol-types.d.ts +244 -2
  11. package/dist/generated/vgi-service.d.ts +1 -1
  12. package/dist/hosted.d.ts +117 -0
  13. package/dist/http/blob-vendor.d.ts +33 -0
  14. package/dist/http/fetch.d.ts +53 -2
  15. package/dist/http/hosted-auth.d.ts +45 -0
  16. package/dist/index.core.d.ts +9 -2
  17. package/dist/index.js +5238 -3619
  18. package/dist/index.js.map +44 -28
  19. package/dist/protocol/arguments-ref.d.ts +107 -0
  20. package/dist/protocol/dispatch.d.ts +3 -2
  21. package/dist/protocol/handlers/function.d.ts +21 -0
  22. package/dist/protocol/serialize.d.ts +1 -1
  23. package/dist/protocol/serializers/bind.d.ts +27 -1
  24. package/dist/protocol/serializers/cardinality.d.ts +1 -1
  25. package/dist/protocol/serializers/splits.d.ts +7 -0
  26. package/dist/protocol/state-serializer.d.ts +8 -7
  27. package/dist/protocol/stream-init.d.ts +17 -0
  28. package/dist/protocol/types.d.ts +24 -0
  29. package/dist/secrets/lookups.d.ts +31 -0
  30. package/dist/serve-entry.d.ts +25 -4
  31. package/dist/serve-entry.js +2940 -1219
  32. package/dist/serve-entry.js.map +44 -29
  33. package/dist/worker-cf-entry.d.ts +5 -0
  34. package/dist/worker-cf-entry.js +2928 -1223
  35. package/dist/worker-cf-entry.js.map +47 -31
  36. package/package.json +5 -4
  37. package/src/functions/storage-blobs.ts +654 -0
  38. package/src/functions/storage-cf-do.ts +24 -0
  39. package/src/functions/storage.ts +54 -5
  40. package/src/functions/table-buffering.ts +14 -4
  41. package/src/functions/table.ts +8 -4
  42. package/src/generated/vgi-client.ts +9 -2
  43. package/src/generated/vgi-protocol-schemas.ts +115 -107
  44. package/src/generated/vgi-protocol-types.ts +640 -3
  45. package/src/generated/vgi-service.ts +2 -2
  46. package/src/hosted.ts +254 -0
  47. package/src/http/blob-vendor.ts +80 -0
  48. package/src/http/fetch.ts +170 -8
  49. package/src/http/hosted-auth.ts +326 -0
  50. package/src/index.core.ts +64 -1
  51. package/src/protocol/arguments-ref.ts +260 -0
  52. package/src/protocol/dispatch.ts +3 -2
  53. package/src/protocol/handlers/function.ts +109 -60
  54. package/src/protocol/handlers/table-buffering.ts +5 -0
  55. package/src/protocol/serialize.ts +3 -0
  56. package/src/protocol/serializers/bind.ts +96 -69
  57. package/src/protocol/serializers/cardinality.ts +4 -7
  58. package/src/protocol/serializers/init.ts +5 -11
  59. package/src/protocol/serializers/splits.ts +31 -4
  60. package/src/protocol/state-serializer.ts +27 -39
  61. package/src/protocol/stream-init.ts +87 -0
  62. package/src/protocol/types.ts +25 -0
  63. package/src/secrets/lookups.ts +53 -0
  64. package/src/serve-entry.ts +105 -8
  65. package/src/worker-cf-entry.ts +33 -0
  66. package/src/worker.ts +25 -0
  67. package/dist/protocol/carried-init-request.d.ts +0 -28
  68. package/dist/util/zstd-sync.d.ts +0 -7
  69. package/src/protocol/carried-init-request.ts +0 -139
  70. package/src/util/zstd-sync.ts +0 -50
@@ -22,6 +22,14 @@ export type FetchLike = (
22
22
  init?: { method?: string; headers?: Record<string, string>; body?: string; signal?: AbortSignal },
23
23
  ) => Promise<Response>;
24
24
 
25
+ /**
26
+ * The storage service's per-value cap (`MAX_VALUE_BYTES` in its src/index.ts).
27
+ * `resolveStorageFromEnv` / `setStorage` wrap this backend in
28
+ * `ExternalizingStorage` with this cap, which envelopes every value and moves
29
+ * large ones to the blob vendor.
30
+ */
31
+ export const MAX_VALUE_BYTES = 1024 * 1024;
32
+
25
33
  /** The DO server's shard_key rule (vgi-cloudflare-durable-object-storage). */
26
34
  export const SHARD_KEY_RE = /^[A-Za-z0-9._-]{1,128}$/;
27
35
 
@@ -56,6 +64,10 @@ class RetryableError extends Error {
56
64
  const NS_WORKER = new TextEncoder().encode("worker");
57
65
 
58
66
  export class FunctionStorageCfDo implements FunctionStorage {
67
+ /** Marks this backend for `setStorage`, which always envelopes it. */
68
+ readonly storageKind = "cloudflare-do";
69
+ /** The service's per-value cap ({@link MAX_VALUE_BYTES}). */
70
+ readonly maxValueBytes = MAX_VALUE_BYTES;
59
71
  private readonly _baseUrl: string;
60
72
  private readonly _token: string | null;
61
73
  /** Per-attach routing key (att-<hex uuid>); "" until pinned via forShard. */
@@ -203,6 +215,18 @@ export class FunctionStorageCfDo implements FunctionStorage {
203
215
  await this._statePutMany(scopeId, ns, items);
204
216
  }
205
217
 
218
+ async stateDelete(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number> {
219
+ if (keys.length === 0) return 0;
220
+ // Naturally idempotent; the attempt_id is for audit only.
221
+ const data = await this._post<{ deleted: number }>("state_delete", {
222
+ scope_id: bytesToB64(scopeId),
223
+ ns: bytesToB64(ns),
224
+ keys: keys.map(bytesToB64),
225
+ attempt_id: newAttemptId(),
226
+ });
227
+ return Number(data.deleted ?? 0);
228
+ }
229
+
206
230
  // --- Append-only log ---
207
231
 
208
232
  async stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number> {
@@ -14,6 +14,7 @@
14
14
  // variables that esbuild can't trace statically, so workerd bundles cleanly
15
15
  // without nodejs_compat polyfills for paths we never run.
16
16
  import { sealPayload, openPayload, type StorageSlot } from "./storage-seal.js";
17
+ import { wrapStorageFromEnv } from "./storage-blobs.js";
17
18
 
18
19
  type Database = any;
19
20
  const _BUN_SQLITE_MOD = "bun:sqlite";
@@ -115,6 +116,10 @@ export interface FunctionStorage {
115
116
  /** Batched atomic upsert of `(key, value)` pairs. One round trip on a remote
116
117
  * backend; a no-op for an empty list. */
117
118
  statePutMany(scopeId: Uint8Array, ns: Uint8Array, items: Array<[Uint8Array, Uint8Array]>): Promise<void>;
119
+ /** Optional: delete the given keys of one namespace, returning how many rows
120
+ * went. Missing keys are ignored. Every built-in backend implements it;
121
+ * {@link BoundStorage.stateDelete} refuses on a backend that does not. */
122
+ stateDelete?(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number>;
118
123
  // --- Append-only log (scoped by execution_id) ---
119
124
  stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number>;
120
125
  stateLogScan(
@@ -377,6 +382,23 @@ export class FunctionStorageSqlite implements FunctionStorage {
377
382
  }
378
383
  }
379
384
 
385
+ async stateDelete(scopeId: Uint8Array, ns: Uint8Array, keys: Uint8Array[]): Promise<number> {
386
+ if (keys.length === 0) return 0;
387
+ const stmt = this._db.prepare("DELETE FROM function_state WHERE scope_id = ? AND ns = ? AND key = ?");
388
+ const sid = bufferArg(scopeId);
389
+ const nsb = bufferArg(ns);
390
+ let deleted = 0;
391
+ this._db.exec("BEGIN IMMEDIATE");
392
+ try {
393
+ for (const k of keys) deleted += stmt.run(sid, nsb, bufferArg(k)).changes as number;
394
+ this._db.exec("COMMIT");
395
+ } catch (e) {
396
+ this._db.exec("ROLLBACK");
397
+ throw e;
398
+ }
399
+ return deleted;
400
+ }
401
+
380
402
  async stateAppend(scopeId: Uint8Array, ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number> {
381
403
  const res = this._db
382
404
  .prepare("INSERT INTO function_state_log (scope_id, ns, key, value) VALUES (?, ?, ?, ?)")
@@ -585,6 +607,16 @@ export class BoundStorage {
585
607
  return this._base.statePutMany(this._executionId, ns, items);
586
608
  }
587
609
 
610
+ /** Delete keys of one namespace; their values' blobs (when externalized)
611
+ * stay until the execution is cleared.
612
+ * @throws Error if the backend does not implement `stateDelete`. */
613
+ stateDelete(ns: Uint8Array, keys: Uint8Array[]): Promise<number> {
614
+ if (typeof this._base.stateDelete !== "function") {
615
+ return Promise.reject(new Error("this FunctionStorage backend does not implement stateDelete"));
616
+ }
617
+ return this._base.stateDelete(this._executionId, ns, keys);
618
+ }
619
+
588
620
  stateAppend(ns: Uint8Array, key: Uint8Array, item: Uint8Array): Promise<number> {
589
621
  return this._base.stateAppend(this._executionId, ns, key, item);
590
622
  }
@@ -659,19 +691,25 @@ export function shardKeyOf(bindCall: { storage_shard_key?: string | null | undef
659
691
  * (including `:memory:`).
660
692
  * - `cloudflare-do` — `FunctionStorageCfDo`. Requires `VGI_CF_DO_URL`;
661
693
  * optional `VGI_CF_DO_TOKEN` for bearer auth.
694
+ *
695
+ * The backend is wrapped in {@link ExternalizingStorage} (value envelope plus
696
+ * blob-vendor externalization, `./storage-blobs.ts`) always for
697
+ * `cloudflare-do`, and for any other backend with `VGI_STORAGE_EXTERNALIZE=1`;
698
+ * see `wrapStorageFromEnv`.
662
699
  */
663
700
  export function resolveStorageFromEnv(): FunctionStorage {
664
701
  const backend = (process.env.VGI_WORKER_SHARED_STORAGE ?? "sqlite").toLowerCase();
665
702
  if (backend === "memory") {
666
- return new FunctionStorageSqlite(":memory:");
703
+ return wrapStorageFromEnv(new FunctionStorageSqlite(":memory:"));
667
704
  }
668
705
  if (backend === "sqlite") {
669
- return new FunctionStorageSqlite();
706
+ return wrapStorageFromEnv(new FunctionStorageSqlite());
670
707
  }
671
708
  if (backend === "cloudflare-do") {
672
709
  // Lazy require to avoid loading the CF client when sqlite is in use.
673
- const { FunctionStorageCfDo } = require("./storage-cf-do.js") as typeof import("./storage-cf-do.js");
674
- return FunctionStorageCfDo.fromEnv();
710
+ const { FunctionStorageCfDo, MAX_VALUE_BYTES } = require("./storage-cf-do.js") as typeof import("./storage-cf-do.js");
711
+ // Always enveloped (vendor or not) so every process writes one format.
712
+ return wrapStorageFromEnv(FunctionStorageCfDo.fromEnv(), { maxValueBytes: MAX_VALUE_BYTES });
675
713
  }
676
714
  throw new Error(
677
715
  `Unknown VGI_WORKER_SHARED_STORAGE backend: '${backend}'. Supported: 'memory', 'sqlite', 'cloudflare-do'.`,
@@ -695,9 +733,20 @@ function getDefaultStorage(): FunctionStorage {
695
733
  * service-binding Fetcher (the binding lives on `env`, not `process.env`, and a
696
734
  * same-zone public-URL fetch is rejected with CF error 1042). Takes precedence
697
735
  * over `VGI_WORKER_SHARED_STORAGE`.
736
+ *
737
+ * A bare `FunctionStorageCfDo` is wrapped in {@link ExternalizingStorage}, as
738
+ * the env-selected one is, so every process writes the same enveloped format;
739
+ * the blob vendor comes from `VGI_BLOB_VENDOR_URL` in `process.env` when there
740
+ * is one. On Cloudflare Workers, where the vendor's URL and token are `env`
741
+ * bindings, wrap it yourself first --
742
+ * `setStorage(wrapStorageFromEnv(cfDo, { maxValueBytes: MAX_VALUE_BYTES, env }))`
743
+ * -- and it is used as given. Any other backend is used as given.
698
744
  */
699
745
  export function setStorage(impl: FunctionStorage): void {
700
- _resolved = impl;
746
+ _resolved =
747
+ (impl as { storageKind?: string }).storageKind === "cloudflare-do"
748
+ ? wrapStorageFromEnv(impl, { maxValueBytes: (impl as { maxValueBytes?: number }).maxValueBytes })
749
+ : impl;
701
750
  }
702
751
 
703
752
  /** Default FunctionStorage instance. Backend is selected via env on first access. */
@@ -16,7 +16,9 @@
16
16
  // The Source phase may route a finalize_state_id to a worker process that
17
17
  // did NOT run the corresponding process() calls.
18
18
 
19
+ import { unresolvedArguments } from "../protocol/arguments-ref.js";
19
20
  import { normalizeRequiredSecrets, type RequiredSecret } from "../secrets/requirements.js";
21
+ import { secretLookupWire } from "../secrets/lookups.js";
20
22
  import {
21
23
  type VgiSchema,
22
24
  schema,
@@ -309,9 +311,7 @@ export function defineTableBufferingFunction<
309
311
  return {
310
312
  output_schema: result.outputSchema,
311
313
  opaque_data: result.opaqueData ?? null,
312
- lookup_secret_types: result.lookupSecretTypes,
313
- lookup_scopes: result.lookupScopes,
314
- lookup_names: result.lookupNames,
314
+ ...secretLookupWire(config.name, result),
315
315
  };
316
316
  }
317
317
  return {
@@ -559,9 +559,19 @@ export async function persistBufferingInit(
559
559
  signingKey: Uint8Array | undefined,
560
560
  ): Promise<void> {
561
561
  const shardKey = shardKeyOf(request.bind_call);
562
+ // A bind call that arrived by reference is stored -- and cached -- as that
563
+ // reference, never the resolved value (vgi docs/large-values-3.4.md §6):
564
+ // serializeBindRequest emits `arguments_location`, and the cached copy holds
565
+ // the unresolved placeholder, so neither storage nor this process's cache
566
+ // pins a large argument. The loader resolves it per request.
562
567
  const stored: InitRequest = {
563
568
  ...request,
564
- bind_call: { ...request.bind_call, attach_opaque_data: null, transaction_opaque_data: null },
569
+ bind_call: {
570
+ ...request.bind_call,
571
+ arguments: request.bind_call.arguments_location ? unresolvedArguments() : request.bind_call.arguments,
572
+ attach_opaque_data: null,
573
+ transaction_opaque_data: null,
574
+ },
565
575
  };
566
576
  const bound = new BoundStorage(defaultStorage, response.execution_id, null, shardKey);
567
577
  await bound.sealedPut(FrameworkNS.BUFFERING_INIT, BUFFERING_INIT_KEY, encodeBufferingInit(stored, response), signingKey);
@@ -3,6 +3,7 @@
3
3
  // Table functions produce output batches from arguments (no streaming input).
4
4
 
5
5
  import { normalizeRequiredSecrets, type RequiredSecret } from "../secrets/requirements.js";
6
+ import { secretLookupWire } from "../secrets/lookups.js";
6
7
  import {
7
8
  type VgiSchema,
8
9
  type VgiBatch,
@@ -214,7 +215,12 @@ export interface TableFunctionConfig<
214
215
  argConstraints?: Record<string, ArgumentConstraints>;
215
216
  /** Names of args that accept variable number of arguments */
216
217
  varargs?: string[];
217
- /** Bind: return output schema. May be async — handlers `await` the result. */
218
+ /**
219
+ * Bind: return output schema. May be async — handlers `await` the result.
220
+ * To ask DuckDB for secrets, return `lookupSecretTypes` with optional
221
+ * `lookupScopes` / `lookupNames` at the same indexes (see `SecretLookupFields`);
222
+ * a scope or name with no type at its index is a bind error.
223
+ */
218
224
  onBind: (params: TableBindParams<TArgs>) =>
219
225
  | {
220
226
  outputSchema: VgiSchema;
@@ -472,9 +478,7 @@ export function defineTableFunction<
472
478
  opaque_data: result.opaqueData ?? null,
473
479
  projection_expression_profiles: result.projectionExpressionProfiles ?? [],
474
480
  repeatability: result.repeatability === undefined ? "UNKNOWN" : result.repeatability,
475
- lookup_secret_types: result.lookupSecretTypes,
476
- lookup_scopes: result.lookupScopes,
477
- lookup_names: result.lookupNames,
481
+ ...secretLookupWire(config.name, result),
478
482
  };
479
483
  },
480
484
 
@@ -2,7 +2,7 @@
2
2
  // GENERATED by vgi.codegen.ts_client. DO NOT EDIT BY HAND.
3
3
  //
4
4
  // Generator: vgi-gen-ts-client v1
5
- // Content hash: da655aba43cc
5
+ // Content hash: 054aee3477d1
6
6
  //
7
7
  // To regenerate:
8
8
  // uv run --project ~/Development/vgi-python vgi-gen-ts-client \
@@ -426,9 +426,15 @@ export interface CopyToContext {
426
426
  file_path: string;
427
427
  }
428
428
 
429
+ export interface ArgumentsLocation {
430
+ ref: Uint8Array;
431
+ size: number;
432
+ sha256: string;
433
+ }
434
+
429
435
  export interface BindRequest {
430
436
  function_name: string;
431
- arguments: /** @vgi-arguments */ Uint8Array;
437
+ arguments?: /** @vgi-arguments */ Uint8Array | null;
432
438
  function_type: InvocationFunctionType;
433
439
  input_schema?: /** @arrow-schema */ Uint8Array | null;
434
440
  settings?: /** @record-batch */ Uint8Array | null;
@@ -442,6 +448,7 @@ export interface BindRequest {
442
448
  copy_to?: CopyToContext | null;
443
449
  schema_path?: string[] | null;
444
450
  argument_names?: (string | null)[] | null;
451
+ arguments_location?: ArgumentsLocation | null;
445
452
  }
446
453
 
447
454
  export interface BindResponse {
@@ -2,7 +2,7 @@
2
2
  // GENERATED by vgi.codegen.ts_schemas. DO NOT EDIT BY HAND.
3
3
  //
4
4
  // Generator: vgi-gen-ts-schemas v2
5
- // Content hash: f5e8b0f6823e
5
+ // Content hash: 928fcc1dcce0
6
6
  //
7
7
  // To regenerate:
8
8
  // uv run --project ~/Development/vgi-python vgi-gen-ts-schemas \
@@ -458,6 +458,120 @@ export const RequiredFilterPathsSchema = schema([
458
458
  field("groups", list(field("item", list(field("item", list(field("item", utf8(), true)), true)), true)), false),
459
459
  ]);
460
460
 
461
+ // Origin: CopyFromContext
462
+ export const CopyFromContextSchema = schema([
463
+ field("format", utf8(), false),
464
+ field("file_path", utf8(), false),
465
+ field("expected_schema", binary(), false),
466
+ ]);
467
+
468
+ // Origin: CopyToContext
469
+ export const CopyToContextSchema = schema([
470
+ field("format", utf8(), false),
471
+ field("file_path", utf8(), false),
472
+ ]);
473
+
474
+ // Origin: ArgumentsLocation
475
+ export const ArgumentsLocationSchema = schema([
476
+ field("ref", binary(), false),
477
+ field("size", int64(), false),
478
+ field("sha256", utf8(), false),
479
+ ]);
480
+
481
+ // Origin: BindRequest
482
+ export const BindRequestSchema = schema([
483
+ field("function_name", utf8(), false),
484
+ field("arguments", binary(), true),
485
+ field("function_type", dictionary(utf8(), int16()), false),
486
+ field("input_schema", binary(), true),
487
+ field("settings", binary(), true),
488
+ field("secrets", binary(), true),
489
+ field("attach_opaque_data", binary(), true),
490
+ field("transaction_opaque_data", binary(), true),
491
+ field("resolved_secrets_provided", bool(), false),
492
+ field("at_unit", utf8(), true),
493
+ field("at_value", utf8(), true),
494
+ field("copy_from", struct([field("format", utf8(), false), field("file_path", utf8(), false), field("expected_schema", binary(), false)]), true),
495
+ field("copy_to", struct([field("format", utf8(), false), field("file_path", utf8(), false)]), true),
496
+ field("schema_path", list(field("item", utf8(), true)), true),
497
+ field("argument_names", list(field("item", utf8(), true)), true),
498
+ field("arguments_location", struct([field("ref", binary(), false), field("size", int64(), false), field("sha256", utf8(), false)]), true),
499
+ ]);
500
+
501
+ // Origin: InitRequest
502
+ export const InitRequestSchema = schema([
503
+ field("bind_call", binary(), false),
504
+ field("output_schema", binary(), false),
505
+ field("bind_opaque_data", binary(), true),
506
+ field("projection_ids", list(field("item", int64(), true)), true),
507
+ field("pushdown_filters", largeBinary(), true),
508
+ field("join_keys", list(field("item", largeBinary(), true)), true),
509
+ field("split_tokens", list(field("item", largeBinary(), true)), true),
510
+ field("row_limit", int64(), true),
511
+ field("phase", dictionary(utf8(), int16()), true),
512
+ field("finalize_state_id", binary(), true),
513
+ field("execution_id", binary(), true),
514
+ field("init_opaque_data", binary(), true),
515
+ field("substream_id", binary(), true),
516
+ field("order_by_column_name", utf8(), true),
517
+ field("order_by_direction", dictionary(utf8(), int16()), true),
518
+ field("order_by_null_order", dictionary(utf8(), int16()), true),
519
+ field("order_by_limit", int64(), true),
520
+ field("tablesample_percentage", float64(), true),
521
+ field("tablesample_seed", int64(), true),
522
+ ]);
523
+
524
+ // Origin: TableFunctionCardinalityRequest
525
+ export const TableFunctionCardinalityRequestSchema = schema([
526
+ field("bind_call", binary(), false),
527
+ field("bind_opaque_data", binary(), true),
528
+ ]);
529
+
530
+ // Origin: TableFunctionStatisticsRequest
531
+ export const TableFunctionStatisticsRequestSchema = schema([
532
+ field("bind_call", binary(), false),
533
+ field("bind_opaque_data", binary(), true),
534
+ ]);
535
+
536
+ // Origin: TableFunctionDynamicToStringRequest
537
+ export const TableFunctionDynamicToStringRequestSchema = schema([
538
+ field("bind_call", binary(), false),
539
+ field("bind_opaque_data", binary(), true),
540
+ field("global_execution_id", binary(), false),
541
+ ]);
542
+
543
+ // Origin: TableFunctionPlanRequest
544
+ export const TableFunctionPlanRequestSchema = schema([
545
+ field("bind_call", binary(), false),
546
+ field("bind_opaque_data", binary(), true),
547
+ field("projection_ids", list(field("item", int64(), true)), true),
548
+ field("pushdown_filters", largeBinary(), true),
549
+ field("join_keys", list(field("item", largeBinary(), true)), true),
550
+ field("row_limit", int64(), true),
551
+ field("target_split_bytes", int64(), true),
552
+ field("min_splits", int64(), true),
553
+ field("max_splits_per_response", int64(), true),
554
+ field("cursor", binary(), true),
555
+ field("refined_filters", largeBinary(), true),
556
+ field("filters_complete", bool(), false),
557
+ field("start_position", binary(), true),
558
+ field("end_position", binary(), true),
559
+ field("order_by_column_name", utf8(), true),
560
+ field("order_by_direction", dictionary(utf8(), int16()), true),
561
+ field("order_by_null_order", dictionary(utf8(), int16()), true),
562
+ field("order_by_limit", int64(), true),
563
+ field("tablesample_percentage", float64(), true),
564
+ field("tablesample_seed", int64(), true),
565
+ ]);
566
+
567
+ // Origin: TableFunctionProjectionRequest
568
+ export const TableFunctionProjectionRequestSchema = schema([
569
+ field("bind_call", binary(), false),
570
+ field("bind_result", binary(), false),
571
+ field("expressions", list(field("item", largeBinary(), true)), false),
572
+ field("result_schema", binary(), false),
573
+ ]);
574
+
461
575
  // Origin: ScanFunctionResult
462
576
  export const ScanFunctionResultSchema = schema([
463
577
  field("function_name", utf8(), false),
@@ -669,25 +783,6 @@ export const AggregateWindowRequestSchema = schema([
669
783
  field("schema_path", list(field("item", utf8(), true)), true),
670
784
  ]);
671
785
 
672
- // Origin: BindRequest
673
- export const BindRequestSchema = schema([
674
- field("function_name", utf8(), false),
675
- field("arguments", binary(), false),
676
- field("function_type", dictionary(utf8(), int16()), false),
677
- field("input_schema", binary(), true),
678
- field("settings", binary(), true),
679
- field("secrets", binary(), true),
680
- field("attach_opaque_data", binary(), true),
681
- field("transaction_opaque_data", binary(), true),
682
- field("resolved_secrets_provided", bool(), false),
683
- field("at_unit", utf8(), true),
684
- field("at_value", utf8(), true),
685
- field("copy_from", struct([field("format", utf8(), false), field("file_path", utf8(), false), field("expected_schema", binary(), false)]), true),
686
- field("copy_to", struct([field("format", utf8(), false), field("file_path", utf8(), false)]), true),
687
- field("schema_path", list(field("item", utf8(), true)), true),
688
- field("argument_names", list(field("item", utf8(), true)), true),
689
- ]);
690
-
691
786
  // Origin: CatalogAttachRequest
692
787
  export const CatalogAttachRequestSchema = schema([
693
788
  field("name", utf8(), false),
@@ -715,19 +810,6 @@ export const ClientCapabilitiesSchema = schema([
715
810
  field("query_pushdown", struct([field("encodings", list(field("item", utf8(), true)), false), field("semantic_profiles", list(field("item", utf8(), true)), false), field("engine_version", utf8(), false), field("max_query_bytes", int64(), false)]), true),
716
811
  ]);
717
812
 
718
- // Origin: CopyFromContext
719
- export const CopyFromContextSchema = schema([
720
- field("format", utf8(), false),
721
- field("file_path", utf8(), false),
722
- field("expected_schema", binary(), false),
723
- ]);
724
-
725
- // Origin: CopyToContext
726
- export const CopyToContextSchema = schema([
727
- field("format", utf8(), false),
728
- field("file_path", utf8(), false),
729
- ]);
730
-
731
813
  // Origin: GlobalInitResponse
732
814
  export const GlobalInitResponseSchema = schema([
733
815
  field("execution_id", binary(), false),
@@ -745,29 +827,6 @@ export const IndexCreateRequestSchema = schema([
745
827
  field("transaction_opaque_data", binary(), true),
746
828
  ]);
747
829
 
748
- // Origin: InitRequest
749
- export const InitRequestSchema = schema([
750
- field("bind_call", binary(), false),
751
- field("output_schema", binary(), false),
752
- field("bind_opaque_data", binary(), true),
753
- field("projection_ids", list(field("item", int64(), true)), true),
754
- field("pushdown_filters", largeBinary(), true),
755
- field("join_keys", list(field("item", largeBinary(), true)), true),
756
- field("split_tokens", list(field("item", largeBinary(), true)), true),
757
- field("row_limit", int64(), true),
758
- field("phase", dictionary(utf8(), int16()), true),
759
- field("finalize_state_id", binary(), true),
760
- field("execution_id", binary(), true),
761
- field("init_opaque_data", binary(), true),
762
- field("substream_id", binary(), true),
763
- field("order_by_column_name", utf8(), true),
764
- field("order_by_direction", dictionary(utf8(), int16()), true),
765
- field("order_by_null_order", dictionary(utf8(), int16()), true),
766
- field("order_by_limit", int64(), true),
767
- field("tablesample_percentage", float64(), true),
768
- field("tablesample_seed", int64(), true),
769
- ]);
770
-
771
830
  // Origin: MacroCreateRequest
772
831
  export const MacroCreateRequestSchema = schema([
773
832
  field("attach_opaque_data", binary(), false),
@@ -824,57 +883,6 @@ export const TableBufferingProcessRequestSchema = schema([
824
883
  field("schema_path", list(field("item", utf8(), true)), true),
825
884
  ]);
826
885
 
827
- // Origin: TableFunctionCardinalityRequest
828
- export const TableFunctionCardinalityRequestSchema = schema([
829
- field("bind_call", binary(), false),
830
- field("bind_opaque_data", binary(), true),
831
- ]);
832
-
833
- // Origin: TableFunctionDynamicToStringRequest
834
- export const TableFunctionDynamicToStringRequestSchema = schema([
835
- field("bind_call", binary(), false),
836
- field("bind_opaque_data", binary(), true),
837
- field("global_execution_id", binary(), false),
838
- ]);
839
-
840
- // Origin: TableFunctionPlanRequest
841
- export const TableFunctionPlanRequestSchema = schema([
842
- field("bind_call", binary(), false),
843
- field("bind_opaque_data", binary(), true),
844
- field("projection_ids", list(field("item", int64(), true)), true),
845
- field("pushdown_filters", largeBinary(), true),
846
- field("join_keys", list(field("item", largeBinary(), true)), true),
847
- field("row_limit", int64(), true),
848
- field("target_split_bytes", int64(), true),
849
- field("min_splits", int64(), true),
850
- field("max_splits_per_response", int64(), true),
851
- field("cursor", binary(), true),
852
- field("refined_filters", largeBinary(), true),
853
- field("filters_complete", bool(), false),
854
- field("start_position", binary(), true),
855
- field("end_position", binary(), true),
856
- field("order_by_column_name", utf8(), true),
857
- field("order_by_direction", dictionary(utf8(), int16()), true),
858
- field("order_by_null_order", dictionary(utf8(), int16()), true),
859
- field("order_by_limit", int64(), true),
860
- field("tablesample_percentage", float64(), true),
861
- field("tablesample_seed", int64(), true),
862
- ]);
863
-
864
- // Origin: TableFunctionProjectionRequest
865
- export const TableFunctionProjectionRequestSchema = schema([
866
- field("bind_call", binary(), false),
867
- field("bind_result", binary(), false),
868
- field("expressions", list(field("item", largeBinary(), true)), false),
869
- field("result_schema", binary(), false),
870
- ]);
871
-
872
- // Origin: TableFunctionStatisticsRequest
873
- export const TableFunctionStatisticsRequestSchema = schema([
874
- field("bind_call", binary(), false),
875
- field("bind_opaque_data", binary(), true),
876
- ]);
877
-
878
886
  // Origin: method 'aggregate_bind' result
879
887
  export const AggregateBindResultSchema = schema([
880
888
  field("output_schema", binary(), false),