@query-farm/vgi 0.28.0 → 0.29.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 (121) hide show
  1. package/README.md +52 -8
  2. package/dist/arguments/argument-spec.d.ts +57 -2
  3. package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
  4. package/dist/arrow/impl-arrowjs/iterate.d.ts +10 -1
  5. package/dist/arrow/impl-arrowjs/schema.d.ts +2 -0
  6. package/dist/arrow/impl-flechette/index.d.ts +1 -1
  7. package/dist/arrow/impl-flechette/iterate.d.ts +10 -1
  8. package/dist/arrow/impl-flechette/schema.d.ts +2 -0
  9. package/dist/arrow/index.d.ts +1 -1
  10. package/dist/arrow/schema-types.d.ts +3 -1
  11. package/dist/arrow/types.d.ts +39 -3
  12. package/dist/catalog/composite.d.ts +13 -13
  13. package/dist/catalog/descriptors.d.ts +7 -3
  14. package/dist/catalog/interface.d.ts +108 -38
  15. package/dist/catalog/read-only.d.ts +32 -15
  16. package/dist/client/client.d.ts +37 -30
  17. package/dist/client/types.d.ts +2 -0
  18. package/dist/client-entry.d.ts +1 -1
  19. package/dist/client-entry.js +791 -447
  20. package/dist/client-entry.js.map +18 -17
  21. package/dist/filter-pushdown/capabilities.d.ts +3 -0
  22. package/dist/filter-pushdown/deserialize.d.ts +14 -15
  23. package/dist/filter-pushdown/evaluate.d.ts +14 -44
  24. package/dist/filter-pushdown/index.d.ts +2 -2
  25. package/dist/filter-pushdown/types.d.ts +120 -68
  26. package/dist/functions/aggregate.d.ts +4 -0
  27. package/dist/functions/registry.d.ts +5 -5
  28. package/dist/functions/scalar.d.ts +6 -1
  29. package/dist/functions/table-buffering.d.ts +9 -0
  30. package/dist/functions/table-in-out.d.ts +13 -0
  31. package/dist/functions/table.d.ts +72 -2
  32. package/dist/functions/types.d.ts +60 -2
  33. package/dist/generated/vgi-client.d.ts +114 -26
  34. package/dist/generated/vgi-protocol-schemas.d.ts +34 -0
  35. package/dist/http/fetch.d.ts +16 -0
  36. package/dist/index.core.d.ts +4 -3
  37. package/dist/index.js +3396 -2064
  38. package/dist/index.js.map +55 -49
  39. package/dist/metadata/types.d.ts +15 -2
  40. package/dist/protocol/handlers/catalog/shared.d.ts +0 -8
  41. package/dist/protocol/handlers/function.d.ts +11 -0
  42. package/dist/protocol/handlers/shared.d.ts +3 -1
  43. package/dist/protocol/serializers/bind.d.ts +1 -2
  44. package/dist/protocol/serializers/cardinality.d.ts +1 -2
  45. package/dist/protocol/serializers/splits.d.ts +126 -0
  46. package/dist/protocol/types.d.ts +36 -3
  47. package/dist/request-auth.d.ts +28 -0
  48. package/dist/schema-path.d.ts +7 -0
  49. package/dist/serve-entry.d.ts +25 -0
  50. package/dist/serve-entry.js +1129 -569
  51. package/dist/serve-entry.js.map +36 -32
  52. package/dist/split-token.d.ts +88 -0
  53. package/dist/types.d.ts +8 -0
  54. package/dist/worker-cf-entry.js +2928 -1689
  55. package/dist/worker-cf-entry.js.map +51 -44
  56. package/dist/worker.d.ts +1 -1
  57. package/package.json +3 -3
  58. package/src/arguments/argument-spec.ts +93 -4
  59. package/src/arguments/arguments.ts +0 -1
  60. package/src/arrow/impl-arrowjs/index.ts +1 -1
  61. package/src/arrow/impl-arrowjs/iterate.ts +21 -0
  62. package/src/arrow/impl-arrowjs/schema.ts +4 -0
  63. package/src/arrow/impl-flechette/index.ts +1 -1
  64. package/src/arrow/impl-flechette/iterate.ts +24 -1
  65. package/src/arrow/impl-flechette/schema.ts +4 -0
  66. package/src/arrow/index.ts +1 -1
  67. package/src/arrow/schema-types.ts +4 -0
  68. package/src/arrow/types.ts +39 -3
  69. package/src/catalog/composite.ts +26 -26
  70. package/src/catalog/descriptors.ts +12 -3
  71. package/src/catalog/interface.ts +217 -72
  72. package/src/catalog/read-only.ts +141 -84
  73. package/src/client/client.ts +97 -73
  74. package/src/client/types.ts +2 -0
  75. package/src/client-entry.ts +2 -1
  76. package/src/filter-pushdown/capabilities.ts +13 -0
  77. package/src/filter-pushdown/collector.ts +22 -35
  78. package/src/filter-pushdown/deserialize.ts +657 -221
  79. package/src/filter-pushdown/evaluate.ts +410 -499
  80. package/src/filter-pushdown/index.ts +16 -2
  81. package/src/filter-pushdown/types.ts +88 -71
  82. package/src/functions/aggregate.ts +12 -1
  83. package/src/functions/copy-from.ts +2 -1
  84. package/src/functions/copy-to.ts +2 -1
  85. package/src/functions/registry.ts +24 -22
  86. package/src/functions/scalar.ts +37 -0
  87. package/src/functions/table-buffering.ts +48 -6
  88. package/src/functions/table-in-out.ts +194 -33
  89. package/src/functions/table.ts +187 -22
  90. package/src/functions/types.ts +64 -1
  91. package/src/generated/vgi-client.ts +122 -28
  92. package/src/generated/vgi-protocol-schemas.ts +455 -58
  93. package/src/http/fetch.ts +129 -2
  94. package/src/index.core.ts +4 -2
  95. package/src/metadata/resolve.ts +43 -1
  96. package/src/metadata/serialize.ts +43 -5
  97. package/src/metadata/types.ts +17 -1
  98. package/src/protocol/dispatch.ts +1 -1
  99. package/src/protocol/handlers/aggregate.ts +23 -12
  100. package/src/protocol/handlers/catalog/admin.ts +47 -54
  101. package/src/protocol/handlers/catalog/index_methods.ts +6 -13
  102. package/src/protocol/handlers/catalog/macro.ts +12 -20
  103. package/src/protocol/handlers/catalog/shared.ts +12 -57
  104. package/src/protocol/handlers/catalog/table.ts +49 -112
  105. package/src/protocol/handlers/catalog/view.ts +18 -22
  106. package/src/protocol/handlers/function.ts +311 -18
  107. package/src/protocol/handlers/shared.ts +12 -3
  108. package/src/protocol/handlers/table-buffering.ts +11 -8
  109. package/src/protocol/serializers/bind.ts +69 -67
  110. package/src/protocol/serializers/cardinality.ts +7 -7
  111. package/src/protocol/serializers/init.ts +52 -10
  112. package/src/protocol/serializers/splits.ts +221 -0
  113. package/src/protocol/state-serializer.ts +55 -1
  114. package/src/protocol/types.ts +36 -3
  115. package/src/request-auth.ts +73 -0
  116. package/src/schema-path.ts +25 -0
  117. package/src/serve-entry.ts +69 -2
  118. package/src/split-token.ts +297 -0
  119. package/src/types.ts +9 -0
  120. package/src/worker-cf-entry.ts +2 -1
  121. package/src/worker.ts +79 -14
@@ -1,6 +1,6 @@
1
1
  import type { VgiSchema, VgiBatch } from "../arrow/index.js";
2
2
  import type { OutputCollector } from "@query-farm/vgi-rpc";
3
- import type { FunctionStability, NullHandling, OrderPreservation, OrderDependence, DistinctDependence, TableCardinality } from "../types.js";
3
+ import type { FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableCardinality } from "../types.js";
4
4
  import type { BindRequest, BindResponse, InitRequest, GlobalInitResponse, TableFunctionCardinalityRequest } from "../protocol/types.js";
5
5
  import type { ArgumentSpec } from "../arguments/argument-spec.js";
6
6
  /** Convention for handler state: mutable user state lives in `.state`. */
@@ -14,14 +14,31 @@ export interface FunctionExample {
14
14
  description: string;
15
15
  expectedOutput?: string;
16
16
  }
17
+ export interface FilterFunctionCapability {
18
+ namespace: string;
19
+ name: string;
20
+ version: number;
21
+ }
22
+ export interface EvaluationContextCapability {
23
+ profile: string;
24
+ providerFingerprint?: string | null;
25
+ }
17
26
  export interface FunctionMeta {
18
27
  name: string;
19
28
  description?: string;
20
29
  stability?: FunctionStability;
21
30
  nullHandling?: NullHandling;
31
+ /** Scalar-only claims in argument declaration order. A vararg is one slot. */
32
+ argumentMonotonicity?: ArgumentMonotonicity[] | null;
22
33
  examples?: FunctionExample[];
23
34
  categories?: string[];
24
35
  tags?: Record<string, string>;
36
+ /**
37
+ * Authoritative typed parameter defaults. The batch must contain one row
38
+ * and only defaulted parameters, in signature order; a present null is an
39
+ * explicit null default. `vgi_default` field metadata remains discovery-only.
40
+ */
41
+ parameterDefaultValues?: VgiBatch | null;
25
42
  projectionPushdown?: boolean;
26
43
  filterPushdown?: boolean;
27
44
  samplingPushdown?: boolean;
@@ -34,7 +51,10 @@ export interface FunctionMeta {
34
51
  * for tables whose worker also guarantees a UNIQUE, snapshot-stable rowid.
35
52
  */
36
53
  lateMaterialization?: boolean;
37
- supportedExpressionFilters?: string[];
54
+ filterSemanticProfiles?: string[];
55
+ additionalFilterFunctions?: FilterFunctionCapability[];
56
+ runtimeFilterAlgorithms?: FilterFunctionCapability[];
57
+ filterEvaluationContexts?: EvaluationContextCapability[];
38
58
  autoApplyFilters?: boolean;
39
59
  preservesOrder?: OrderPreservation;
40
60
  maxWorkers?: number;
@@ -82,6 +102,38 @@ export interface FunctionMeta {
82
102
  * `supports_batch_index`.
83
103
  */
84
104
  supportsBatchIndex?: boolean;
105
+ /**
106
+ * table (generator): the scan divides into named, independently redeemable
107
+ * splits (see the `plan` / `onSplit` hooks). Surfaces as FunctionInfo
108
+ * `supports_splits`.
109
+ *
110
+ * The declaration is what a distributed engine reads to decide whether it can
111
+ * retry a task: a split NAMES its work, so re-running one reads exactly the
112
+ * same rows. Without it, the division lives behind an opaque worker-side queue
113
+ * and a retry reads neither what it read before nor what it missed.
114
+ */
115
+ supportsSplits?: boolean;
116
+ /**
117
+ * table (generator): the worker applies every pushed filter EXACTLY, so the
118
+ * engine may drop its own copy rather than re-filtering. Wrong answers if
119
+ * declared falsely — leave unset unless certain.
120
+ */
121
+ filtersExactlyApplied?: boolean;
122
+ /**
123
+ * table (generator): addressable positions in the data, for incremental and
124
+ * streaming reads. The engine owns the checkpoint; this declares only that
125
+ * positions are meaningful to externalize.
126
+ */
127
+ supportsPositions?: boolean;
128
+ /**
129
+ * table (generator): how long a split token stays redeemable.
130
+ *
131
+ * UNSET MEANS UNBOUNDED, not "expires immediately" — a client must not assume
132
+ * a TTL exists, or long-running streams are foreclosed. A client rejects a
133
+ * plan whose TTL is below its own planning-to-task-start horizon, which on a
134
+ * busy cluster is hours rather than seconds.
135
+ */
136
+ splitTokenTtlSeconds?: number;
85
137
  /**
86
138
  * table (generator): Hive-style partition-columns mode. Functions declare
87
139
  * a PartitionKind and annotate bind-schema fields; emitted batches carry
@@ -146,6 +198,12 @@ export interface VgiFunction {
146
198
  globalInit(request: InitRequest): GlobalInitResponse | Promise<GlobalInitResponse>;
147
199
  createStreamHandlers(request: InitRequest, response: GlobalInitResponse, accumulatedState?: any): StreamHandlers;
148
200
  cardinality?(request: TableFunctionCardinalityRequest): TableCardinality | Promise<TableCardinality>;
201
+ /**
202
+ * Divide a scan into named, independently redeemable splits. Absent means the
203
+ * function is not split-capable: the whole scan is one unit of work, and the
204
+ * framework answers with a single empty-payload split.
205
+ */
206
+ plan?(request: import("../protocol/serializers/splits.js").TableFunctionPlanRequest): import("../protocol/serializers/splits.js").PlanResult | Promise<import("../protocol/serializers/splits.js").PlanResult>;
149
207
  /**
150
208
  * Per-column statistics for this table function's output given the user's
151
209
  * bind-time arguments. Returns null/[] when stats are unknown. Wired to the
@@ -1,3 +1,4 @@
1
+ export type ArgumentMonotonicity = "UNKNOWN" | "CONSTANT" | "NON_DECREASING" | "STRICTLY_INCREASING" | "NON_INCREASING" | "STRICTLY_DECREASING";
1
2
  export type DistinctDependence = "DISTINCT_DEPENDENT" | "NOT_DISTINCT_DEPENDENT";
2
3
  export type FunctionStability = "CONSISTENT" | "VOLATILE" | "CONSISTENT_WITHIN_QUERY";
3
4
  export type FunctionType = "SCALAR" | "TABLE" | "TABLE_BUFFERING" | "AGGREGATE";
@@ -31,14 +32,14 @@ export interface SchemaInfo {
31
32
  comment?: string | null;
32
33
  tags: Record<string, string>;
33
34
  attach_opaque_data: Uint8Array;
34
- name: string;
35
+ path: string[];
35
36
  estimated_object_count?: Record<string, number> | null;
36
37
  }
37
38
  export interface TableInfo {
38
39
  comment?: string | null;
39
40
  tags: Record<string, string>;
40
41
  name: string;
41
- schema_name: string;
42
+ schema_path: string[];
42
43
  columns: Uint8Array;
43
44
  not_null_constraints: number[];
44
45
  unique_constraints: number[][];
@@ -64,7 +65,7 @@ export interface ViewInfo {
64
65
  comment?: string | null;
65
66
  tags: Record<string, string>;
66
67
  name: string;
67
- schema_name: string;
68
+ schema_path: string[];
68
69
  definition: string;
69
70
  column_comments: Record<string, string>;
70
71
  }
@@ -73,6 +74,20 @@ export interface CatalogExample {
73
74
  description: string;
74
75
  expected_output?: string | null;
75
76
  }
77
+ export interface FilterFunctionCapability {
78
+ namespace: string;
79
+ name: string;
80
+ version: number;
81
+ }
82
+ export interface RuntimeFilterAlgorithmCapability {
83
+ namespace: string;
84
+ name: string;
85
+ version: number;
86
+ }
87
+ export interface EvaluationContextCapability {
88
+ profile: string;
89
+ provider_fingerprint?: string | null;
90
+ }
76
91
  export interface SecretLookupEntry {
77
92
  secret_type: string;
78
93
  scope?: string | null;
@@ -82,12 +97,14 @@ export interface FunctionInfo {
82
97
  comment?: string | null;
83
98
  tags: Record<string, string>;
84
99
  name: string;
85
- schema_name: string;
100
+ schema_path: string[];
86
101
  function_type: FunctionType;
87
102
  arguments: Uint8Array;
88
103
  output_schema: Uint8Array;
104
+ parameter_default_values?: /** @record-batch */ Uint8Array | null;
89
105
  stability?: FunctionStability | null;
90
106
  null_handling?: NullHandling | null;
107
+ argument_monotonicity?: ArgumentMonotonicity[] | null;
91
108
  description: string;
92
109
  examples: CatalogExample[];
93
110
  categories: string[];
@@ -95,10 +112,17 @@ export interface FunctionInfo {
95
112
  filter_pushdown?: boolean | null;
96
113
  sampling_pushdown?: boolean | null;
97
114
  late_materialization?: boolean | null;
98
- supported_expression_filters: string[];
115
+ filter_semantic_profiles: string[];
116
+ additional_filter_functions: FilterFunctionCapability[];
117
+ runtime_filter_algorithms: RuntimeFilterAlgorithmCapability[];
118
+ filter_evaluation_contexts: EvaluationContextCapability[];
99
119
  order_preservation?: OrderPreservation | null;
100
120
  max_workers?: number | null;
101
121
  supports_batch_index: boolean;
122
+ supports_splits: boolean;
123
+ filters_exactly_applied: boolean;
124
+ supports_positions: boolean;
125
+ split_token_ttl_seconds?: number | null;
102
126
  partition_kind: PartitionKind;
103
127
  order_dependent: OrderDependence;
104
128
  distinct_dependent: DistinctDependence;
@@ -116,7 +140,7 @@ export interface MacroInfo {
116
140
  comment?: string | null;
117
141
  tags: Record<string, string>;
118
142
  name: string;
119
- schema_name: string;
143
+ schema_path: string[];
120
144
  macro_type: MacroType;
121
145
  parameters: string[];
122
146
  parameter_default_values?: /** @record-batch */ Uint8Array | null;
@@ -127,7 +151,7 @@ export interface IndexInfo {
127
151
  comment?: string | null;
128
152
  tags: Record<string, string>;
129
153
  name: string;
130
- schema_name: string;
154
+ schema_path: string[];
131
155
  table_name: string;
132
156
  index_type: string;
133
157
  constraint_type: IndexConstraintType;
@@ -141,7 +165,8 @@ export interface AggregateBindRequest {
141
165
  settings?: /** @record-batch */ Uint8Array | null;
142
166
  secrets?: /** @record-batch */ Uint8Array | null;
143
167
  attach_opaque_data?: Uint8Array | null;
144
- schema_name?: string | null;
168
+ schema_path?: string[] | null;
169
+ argument_names?: (string | null)[] | null;
145
170
  }
146
171
  export interface AggregateBindResponse {
147
172
  output_schema: Uint8Array;
@@ -152,7 +177,7 @@ export interface AggregateCombineRequest {
152
177
  execution_id: Uint8Array;
153
178
  merge_batch: Uint8Array;
154
179
  attach_opaque_data?: Uint8Array | null;
155
- schema_name?: string | null;
180
+ schema_path?: string[] | null;
156
181
  }
157
182
  export interface AggregateCombineResponse {
158
183
  }
@@ -161,7 +186,7 @@ export interface AggregateDestructorRequest {
161
186
  execution_id: Uint8Array;
162
187
  group_ids_batch: Uint8Array;
163
188
  attach_opaque_data?: Uint8Array | null;
164
- schema_name?: string | null;
189
+ schema_path?: string[] | null;
165
190
  }
166
191
  export interface AggregateDestructorResponse {
167
192
  }
@@ -171,7 +196,7 @@ export interface AggregateFinalizeRequest {
171
196
  group_ids_batch: Uint8Array;
172
197
  output_schema: Uint8Array;
173
198
  attach_opaque_data?: Uint8Array | null;
174
- schema_name?: string | null;
199
+ schema_path?: string[] | null;
175
200
  }
176
201
  export interface AggregateFinalizeResponse {
177
202
  result_batch: Uint8Array;
@@ -181,7 +206,7 @@ export interface AggregateStreamingChunkRequest {
181
206
  execution_id: Uint8Array;
182
207
  input_batch: Uint8Array;
183
208
  attach_opaque_data?: Uint8Array | null;
184
- schema_name?: string | null;
209
+ schema_path?: string[] | null;
185
210
  }
186
211
  export interface AggregateStreamingChunkResponse {
187
212
  result_batch: Uint8Array;
@@ -190,7 +215,7 @@ export interface AggregateStreamingCloseRequest {
190
215
  function_name: string;
191
216
  execution_id: Uint8Array;
192
217
  attach_opaque_data?: Uint8Array | null;
193
- schema_name?: string | null;
218
+ schema_path?: string[] | null;
194
219
  }
195
220
  export interface AggregateStreamingCloseResponse {
196
221
  }
@@ -204,7 +229,7 @@ export interface AggregateStreamingOpenRequest {
204
229
  settings?: /** @record-batch */ Uint8Array | null;
205
230
  secrets?: /** @record-batch */ Uint8Array | null;
206
231
  attach_opaque_data?: Uint8Array | null;
207
- schema_name?: string | null;
232
+ schema_path?: string[] | null;
208
233
  }
209
234
  export interface AggregateStreamingOpenResponse {
210
235
  execution_id: Uint8Array;
@@ -214,7 +239,7 @@ export interface AggregateUpdateRequest {
214
239
  execution_id: Uint8Array;
215
240
  input_batch: Uint8Array;
216
241
  attach_opaque_data?: Uint8Array | null;
217
- schema_name?: string | null;
242
+ schema_path?: string[] | null;
218
243
  }
219
244
  export interface AggregateUpdateResponse {
220
245
  }
@@ -226,7 +251,7 @@ export interface AggregateWindowRequest {
226
251
  frame_starts: number[];
227
252
  frame_ends: number[];
228
253
  attach_opaque_data?: Uint8Array | null;
229
- schema_name?: string | null;
254
+ schema_path?: string[] | null;
230
255
  }
231
256
  export interface AggregateWindowResponse {
232
257
  result_batch: Uint8Array;
@@ -241,7 +266,7 @@ export interface AggregateWindowBatchRequest {
241
266
  frame_starts: number[];
242
267
  frame_ends: number[];
243
268
  attach_opaque_data?: Uint8Array | null;
244
- schema_name?: string | null;
269
+ schema_path?: string[] | null;
245
270
  }
246
271
  export interface AggregateWindowBatchResponse {
247
272
  result_batch: Uint8Array;
@@ -251,7 +276,7 @@ export interface AggregateWindowDestructorRequest {
251
276
  execution_id: Uint8Array;
252
277
  partition_id: number;
253
278
  attach_opaque_data?: Uint8Array | null;
254
- schema_name?: string | null;
279
+ schema_path?: string[] | null;
255
280
  }
256
281
  export interface AggregateWindowDestructorResponse {
257
282
  }
@@ -266,7 +291,7 @@ export interface AggregateWindowInitRequest {
266
291
  frame_stats: Uint8Array;
267
292
  all_valid: Uint8Array;
268
293
  attach_opaque_data?: Uint8Array | null;
269
- schema_name?: string | null;
294
+ schema_path?: string[] | null;
270
295
  }
271
296
  export interface AggregateWindowInitResponse {
272
297
  }
@@ -293,7 +318,8 @@ export interface BindRequest {
293
318
  at_value?: string | null;
294
319
  copy_from?: CopyFromContext | null;
295
320
  copy_to?: CopyToContext | null;
296
- schema_name?: string | null;
321
+ schema_path?: string[] | null;
322
+ argument_names?: (string | null)[] | null;
297
323
  }
298
324
  export interface BindResponse {
299
325
  output_schema: Uint8Array;
@@ -302,11 +328,19 @@ export interface BindResponse {
302
328
  lookup_scopes: string[];
303
329
  lookup_names: string[];
304
330
  }
331
+ export interface ClientCapabilities {
332
+ engine: string;
333
+ native_formats: string[];
334
+ catalogs: string[];
335
+ can_stream: boolean;
336
+ filter_encodings: string[];
337
+ }
305
338
  export interface CatalogAttachRequest {
306
339
  name: string;
307
340
  options?: /** @record-batch */ Uint8Array | null;
308
341
  data_version_spec?: string | null;
309
342
  implementation_version?: string | null;
343
+ client_capabilities?: ClientCapabilities | null;
310
344
  }
311
345
  export interface CatalogAttachResult {
312
346
  attach_opaque_data: Uint8Array;
@@ -340,7 +374,7 @@ export interface CatalogCreateRequest {
340
374
  }
341
375
  export interface IndexCreateRequest {
342
376
  attach_opaque_data: Uint8Array;
343
- schema_name: string;
377
+ schema_path: string[];
344
378
  name: string;
345
379
  table_name: string;
346
380
  index_type: string;
@@ -355,7 +389,7 @@ export interface IndexesResponse {
355
389
  }
356
390
  export interface MacroCreateRequest {
357
391
  attach_opaque_data: Uint8Array;
358
- schema_name: string;
392
+ schema_path: string[];
359
393
  name: string;
360
394
  macro_type: MacroType;
361
395
  parameters: string[];
@@ -382,7 +416,7 @@ export interface SchemasResponse {
382
416
  }
383
417
  export interface TableCreateRequest {
384
418
  attach_opaque_data: Uint8Array;
385
- schema_name: string;
419
+ schema_path: string[];
386
420
  name: string;
387
421
  columns: Uint8Array;
388
422
  on_conflict: OnConflict;
@@ -406,6 +440,8 @@ export interface InitRequest {
406
440
  projection_ids?: number[] | null;
407
441
  pushdown_filters?: /** @record-batch */ Uint8Array | null;
408
442
  join_keys?: /** @record-batch */ Uint8Array[] | null;
443
+ split_tokens?: Uint8Array[] | null;
444
+ row_limit?: number | null;
409
445
  phase?: TableInOutFunctionInitPhase | null;
410
446
  finalize_state_id?: Uint8Array | null;
411
447
  execution_id?: Uint8Array | null;
@@ -424,7 +460,7 @@ export interface TableBufferingCombineRequest {
424
460
  state_ids: Uint8Array[];
425
461
  attach_opaque_data?: Uint8Array | null;
426
462
  transaction_id?: Uint8Array | null;
427
- schema_name?: string | null;
463
+ schema_path?: string[] | null;
428
464
  }
429
465
  export interface TableBufferingCombineResponse {
430
466
  finalize_state_ids: Uint8Array[];
@@ -434,7 +470,7 @@ export interface TableBufferingDestructorRequest {
434
470
  execution_id: Uint8Array;
435
471
  attach_opaque_data?: Uint8Array | null;
436
472
  transaction_id?: Uint8Array | null;
437
- schema_name?: string | null;
473
+ schema_path?: string[] | null;
438
474
  }
439
475
  export interface TableBufferingDestructorResponse {
440
476
  }
@@ -445,7 +481,7 @@ export interface TableBufferingProcessRequest {
445
481
  attach_opaque_data?: Uint8Array | null;
446
482
  transaction_id?: Uint8Array | null;
447
483
  batch_index?: number | null;
448
- schema_name?: string | null;
484
+ schema_path?: string[] | null;
449
485
  }
450
486
  export interface TableBufferingProcessResponse {
451
487
  state_id: Uint8Array;
@@ -467,6 +503,58 @@ export interface TableFunctionDynamicToStringResponse {
467
503
  keys: string[];
468
504
  values: string[];
469
505
  }
506
+ export interface TableFunctionPlanRequest {
507
+ bind_call: BindRequest;
508
+ bind_opaque_data?: Uint8Array | null;
509
+ projection_ids?: number[] | null;
510
+ pushdown_filters?: /** @record-batch */ Uint8Array | null;
511
+ join_keys?: /** @record-batch */ Uint8Array[] | null;
512
+ row_limit?: number | null;
513
+ target_split_bytes?: number | null;
514
+ min_splits?: number | null;
515
+ max_splits_per_response?: number | null;
516
+ cursor?: Uint8Array | null;
517
+ refined_filters?: /** @record-batch */ Uint8Array | null;
518
+ filters_complete: boolean;
519
+ start_position?: Uint8Array | null;
520
+ end_position?: Uint8Array | null;
521
+ order_by_column_name?: string | null;
522
+ order_by_direction?: OrderByDirection | null;
523
+ order_by_null_order?: OrderByNullOrder | null;
524
+ order_by_limit?: number | null;
525
+ tablesample_percentage?: number | null;
526
+ tablesample_seed?: number | null;
527
+ }
528
+ export interface ScanSplit {
529
+ payload: Uint8Array;
530
+ token: Uint8Array;
531
+ estimated_rows?: number | null;
532
+ rows_exact: boolean;
533
+ estimated_bytes?: number | null;
534
+ partition_bounds?: /** @record-batch */ Uint8Array | null;
535
+ column_statistics?: Uint8Array | null;
536
+ location_ids?: number[] | null;
537
+ start_position?: Uint8Array | null;
538
+ end_position?: Uint8Array | null;
539
+ }
540
+ export interface PlanResponse {
541
+ splits: ScanSplit[] | Uint8Array[];
542
+ next_cursors?: Uint8Array[] | null;
543
+ execution_id?: Uint8Array | null;
544
+ init_opaque_data?: Uint8Array | null;
545
+ max_workers?: number | null;
546
+ estimated_total_splits?: number | null;
547
+ estimated_total_rows?: number | null;
548
+ estimated_total_bytes?: number | null;
549
+ catalog_version?: number | null;
550
+ scope: string;
551
+ locations?: string[] | null;
552
+ partitioning?: Uint8Array[] | null;
553
+ sort_order?: Uint8Array[] | null;
554
+ cache_max_age_seconds?: number | null;
555
+ start_position?: Uint8Array | null;
556
+ end_position?: Uint8Array | null;
557
+ }
470
558
  export interface TableFunctionStatisticsRequest {
471
559
  bind_call: BindRequest;
472
560
  bind_opaque_data?: Uint8Array | null;
@@ -9,7 +9,39 @@ export declare const CopyFromFormatInfoSchema: import("../index.core.js").VgiSch
9
9
  export declare const ScanFunctionResultSchema: import("../index.core.js").VgiSchema;
10
10
  export declare const ScanBranchesResultSchema: import("../index.core.js").VgiSchema;
11
11
  export declare const ScanBranchSchema: import("../index.core.js").VgiSchema;
12
+ export declare const ScanSplitSchema: import("../index.core.js").VgiSchema;
12
13
  export declare const AttachCatalogInfoSchema: import("../index.core.js").VgiSchema;
14
+ export declare const ForeignKeyInfoSchema: import("../index.core.js").VgiSchema;
15
+ export declare const AggregateBindRequestSchema: import("../index.core.js").VgiSchema;
16
+ export declare const AggregateCombineRequestSchema: import("../index.core.js").VgiSchema;
17
+ export declare const AggregateDestructorRequestSchema: import("../index.core.js").VgiSchema;
18
+ export declare const AggregateFinalizeRequestSchema: import("../index.core.js").VgiSchema;
19
+ export declare const AggregateStreamingChunkRequestSchema: import("../index.core.js").VgiSchema;
20
+ export declare const AggregateStreamingCloseRequestSchema: import("../index.core.js").VgiSchema;
21
+ export declare const AggregateStreamingOpenRequestSchema: import("../index.core.js").VgiSchema;
22
+ export declare const AggregateUpdateRequestSchema: import("../index.core.js").VgiSchema;
23
+ export declare const AggregateWindowBatchRequestSchema: import("../index.core.js").VgiSchema;
24
+ export declare const AggregateWindowDestructorRequestSchema: import("../index.core.js").VgiSchema;
25
+ export declare const AggregateWindowInitRequestSchema: import("../index.core.js").VgiSchema;
26
+ export declare const AggregateWindowRequestSchema: import("../index.core.js").VgiSchema;
27
+ export declare const BindRequestSchema: import("../index.core.js").VgiSchema;
28
+ export declare const CatalogAttachRequestSchema: import("../index.core.js").VgiSchema;
29
+ export declare const CatalogCreateRequestSchema: import("../index.core.js").VgiSchema;
30
+ export declare const ClientCapabilitiesSchema: import("../index.core.js").VgiSchema;
31
+ export declare const CopyFromContextSchema: import("../index.core.js").VgiSchema;
32
+ export declare const CopyToContextSchema: import("../index.core.js").VgiSchema;
33
+ export declare const GlobalInitResponseSchema: import("../index.core.js").VgiSchema;
34
+ export declare const IndexCreateRequestSchema: import("../index.core.js").VgiSchema;
35
+ export declare const InitRequestSchema: import("../index.core.js").VgiSchema;
36
+ export declare const MacroCreateRequestSchema: import("../index.core.js").VgiSchema;
37
+ export declare const TableCreateRequestSchema: import("../index.core.js").VgiSchema;
38
+ export declare const TableBufferingCombineRequestSchema: import("../index.core.js").VgiSchema;
39
+ export declare const TableBufferingDestructorRequestSchema: import("../index.core.js").VgiSchema;
40
+ export declare const TableBufferingProcessRequestSchema: import("../index.core.js").VgiSchema;
41
+ export declare const TableFunctionCardinalityRequestSchema: import("../index.core.js").VgiSchema;
42
+ export declare const TableFunctionDynamicToStringRequestSchema: import("../index.core.js").VgiSchema;
43
+ export declare const TableFunctionPlanRequestSchema: import("../index.core.js").VgiSchema;
44
+ export declare const TableFunctionStatisticsRequestSchema: import("../index.core.js").VgiSchema;
13
45
  export declare const AggregateBindResultSchema: import("../index.core.js").VgiSchema;
14
46
  export declare const AggregateCombineResultSchema: import("../index.core.js").VgiSchema;
15
47
  export declare const AggregateDestructorResultSchema: import("../index.core.js").VgiSchema;
@@ -44,6 +76,7 @@ export declare const TableBufferingDestructorResultSchema: import("../index.core
44
76
  export declare const TableBufferingProcessResultSchema: import("../index.core.js").VgiSchema;
45
77
  export declare const TableFunctionCardinalityResultSchema: import("../index.core.js").VgiSchema;
46
78
  export declare const TableFunctionDynamicToStringResultSchema: import("../index.core.js").VgiSchema;
79
+ export declare const TableFunctionPlanResultSchema: import("../index.core.js").VgiSchema;
47
80
  export declare const AggregateBindParamsSchema: import("../index.core.js").VgiSchema;
48
81
  export declare const AggregateCombineParamsSchema: import("../index.core.js").VgiSchema;
49
82
  export declare const AggregateDestructorParamsSchema: import("../index.core.js").VgiSchema;
@@ -113,4 +146,5 @@ export declare const TableBufferingDestructorParamsSchema: import("../index.core
113
146
  export declare const TableBufferingProcessParamsSchema: import("../index.core.js").VgiSchema;
114
147
  export declare const TableFunctionCardinalityParamsSchema: import("../index.core.js").VgiSchema;
115
148
  export declare const TableFunctionDynamicToStringParamsSchema: import("../index.core.js").VgiSchema;
149
+ export declare const TableFunctionPlanParamsSchema: import("../index.core.js").VgiSchema;
116
150
  export declare const TableFunctionStatisticsParamsSchema: import("../index.core.js").VgiSchema;
@@ -1,3 +1,4 @@
1
+ import { type AuthenticateFn, type PeerAuthenticationPolicy, type PeerIdentityProvider, type PeerResolutionOptions } from "@query-farm/vgi-rpc";
1
2
  import { type ProtocolConfig } from "../protocol/dispatch.js";
2
3
  import { type LandingInfo } from "./landing.js";
3
4
  export interface VgiFetchOptions {
@@ -42,6 +43,21 @@ export interface VgiFetchOptions {
42
43
  * its required name/doc/version; the CF entry had to remember, and
43
44
  * vgi-open-meteo shipped for weeks without it. */
44
45
  landingInfo: LandingInfo;
46
+ /** Authenticates each incoming request, returning the caller's
47
+ * {@link AuthContext}. Forwarded verbatim to `createHttpHandler`; omit it
48
+ * and every caller is anonymous, which is what this package did before the
49
+ * option existed.
50
+ *
51
+ * Supplying it is what makes a worker able to serve more than one principal,
52
+ * and the identity it returns is the one the worker seals `attach_opaque_data`
53
+ * and split tokens under. */
54
+ authenticate?: AuthenticateFn;
55
+ /** Off-wire transport identities, including a trusted Iroh HTTP bridge. */
56
+ peerIdentityProviders?: readonly PeerIdentityProvider[];
57
+ /** Policy composing peer evidence with application authentication. */
58
+ peerAuthenticationPolicy?: PeerAuthenticationPolicy;
59
+ /** Host adapter supplying the physical peer and multiplicity-preserving headers. */
60
+ peerResolutionContext?: (request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions>;
45
61
  }
46
62
  /**
47
63
  * Build a fetch handler suitable for `export default { fetch }` in a CF
@@ -7,12 +7,12 @@ export { defineTableBufferingFunction, type TableBufferingConfig, type TableBuff
7
7
  export { defineCopyFromFunction, type CopyFromFunctionConfig, type CopyFromOption, type CopyFromReadParams, } from "./functions/copy-from.js";
8
8
  export { defineCopyToFunction, type CopyToFunctionConfig, type CopyToOption, type CopyToWriteParams, type CopyToCloseParams, } from "./functions/copy-to.js";
9
9
  export type { VgiFunction, FunctionMeta, StreamHandlers, FunctionExample, HandlerState } from "./functions/types.js";
10
- export { CatalogInterface, type CatalogAttachResult, type SchemaInfo, encodeSchemaInfo, decodeSchemaInfo, type TableInfo, encodeTableInfo, decodeTableInfo, type ViewInfo, encodeViewInfo, decodeViewInfo, type CatalogInfo, encodeCatalogInfo, decodeCatalogInfo, type FunctionInfo, encodeFunctionInfo, decodeFunctionInfo, type FunctionInfoOptions, type MacroInfo, encodeMacroInfo, decodeMacroInfo, type MacroType, type CopyFromFormatInfo, encodeCopyFromFormatInfo, type AttachOpaqueData, type TransactionOpaqueData, buildScanBranchesResult, type ScanBranchInput } from "./catalog/interface.js";
10
+ export { CatalogInterface, type CatalogAttachResult, type SchemaInfo, encodeSchemaInfo, decodeSchemaInfo, type TableInfo, encodeTableInfo, decodeTableInfo, type ViewInfo, encodeViewInfo, decodeViewInfo, type CatalogInfo, encodeCatalogInfo, decodeCatalogInfo, type FunctionInfo, encodeFunctionInfo, decodeFunctionInfo, type FunctionInfoOptions, type MacroInfo, encodeMacroInfo, decodeMacroInfo, type MacroType, type CopyFromFormatInfo, encodeCopyFromFormatInfo, type AttachOpaqueData, type TransactionOpaqueData, buildScanBranchesResult, encodeFormatOptions, type ScanBranchInput } from "./catalog/interface.js";
11
11
  export type { CatalogDescriptor, SchemaDescriptor, TableDescriptor, ViewDescriptor, MacroDescriptor, SettingDescriptor, SecretTypeDescriptor, ForeignKeyDef, DefaultValue } from "./catalog/descriptors.js";
12
12
  export { ReadOnlyCatalogInterface } from "./catalog/read-only.js";
13
13
  export { CompositeCatalogInterface } from "./catalog/composite.js";
14
14
  export { FunctionRegistry } from "./functions/registry.js";
15
- export { FunctionType, FunctionStability, NullHandling, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, DEFAULT_MAX_WORKERS, } from "./types.js";
15
+ export { FunctionType, FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, DEFAULT_MAX_WORKERS, } from "./types.js";
16
16
  export type { BindRequest, BindResponse, CopyFromContext, CopyToContext, InitRequest, GlobalInitResponse, TableCardinality, } from "./protocol/types.js";
17
17
  export { Arguments } from "./arguments/arguments.js";
18
18
  export { type ArgumentSpec, type ArgumentConstraints, argumentSpecsToSchema, schemaToArgumentSpecs, macroArgumentsSchema, macroParameterDocsFromSchema, formatRange, constraintSpecFields } from "./arguments/argument-spec.js";
@@ -33,7 +33,7 @@ export { toUint8Array } from "./util/bytes.js";
33
33
  export { iterRows, batchFromRows, batchFromColumns, emptyBatch, filterBatch, projectSchema, projectBatch, batchToScalarDict, batchToSecretDict, safeNumber, } from "./util/arrow/index.js";
34
34
  export { type SecretFields, type SecretsDict, secretType, secretsOfType, secretForScope, secretForScopeOfType, } from "./secrets/helpers.js";
35
35
  export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./util/arrow/index.js";
36
- export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, binary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, readCanonicalValue, columnFromArray, decodeDictValue, backend, adoptArrowJsShape, } from "./arrow/index.js";
36
+ export { schema, field, nullType, int8, int16, int64, uint8, uint16, uint32, uint64, float16, float64, utf8, largeUtf8, binary, largeBinary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, codecFor, asDate32, asDate64Ms, asTime32S, asTime32Ms, asTime64Us, asTime64Ns, asTimestampSeconds, asTimestampMillis, asTimestampMicros, asTimestampNanos, asDurationSeconds, asDurationMillis, asDurationMicros, asDurationNanos, asUnscaledDecimal, asInt64, asUint64, fromBranded, fromBrandedNumber, fromBrandedBigInt, TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, readCanonicalValue, columnFromArray, decodeDictValue, backend, adoptArrowJsShape, } from "./arrow/index.js";
37
37
  export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, RichValue, RawValue, ValueFor, Repr, Codec, Branded, Date32, Date64Ms, Time32S, Time32Ms, Time64Us, Time64Ns, TimestampSeconds, TimestampMillis, TimestampMicros, TimestampNanos, DurationSeconds, DurationMillis, DurationMicros, DurationNanos, UnscaledDecimal, Int64Raw, Uint64Raw, } from "./arrow/index.js";
38
38
  export type { ScalarComputeRow, ScalarOutputValue, ScalarComputeResult } from "./functions/scalar.js";
39
39
  export { type FunctionStorage, FunctionStorageSqlite, BoundStorage, UnknownInvocationError, resolveStorageFromEnv, setStorage, storage as functionStorage, } from "./functions/storage.js";
@@ -43,3 +43,4 @@ export type { VgiClientOptions, TableFunctionOptions, ScalarFunctionOptions, Tab
43
43
  export { str, bytes, int, int32, float, float32, bool, toSchema, OutputCollector, AuthContext } from "@query-farm/vgi-rpc";
44
44
  export { subprocessConnect, httpConnect, tcpConnect } from "@query-farm/vgi-rpc";
45
45
  export type { RpcClient, StreamSession, LogMessage } from "@query-farm/vgi-rpc";
46
+ export { normalizeSchemaPath, schemaPathDisplay, schemaPathKey, schemaPathsEqual, type SchemaPath } from "./schema-path.js";