@query-farm/vgi 0.47.2 → 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 (105) hide show
  1. package/README.md +1 -1
  2. package/dist/arguments/argument-spec.d.ts +17 -11
  3. package/dist/catalog/descriptors.d.ts +2 -2
  4. package/dist/catalog/publication.d.ts +7 -7
  5. package/dist/client/client.d.ts +9 -3
  6. package/dist/client/errors.d.ts +2 -2
  7. package/dist/client/types.d.ts +21 -0
  8. package/dist/client-entry.d.ts +1 -1
  9. package/dist/client-entry.js +56 -7
  10. package/dist/client-entry.js.map +23 -23
  11. package/dist/filter-pushdown/deserialize.d.ts +1 -1
  12. package/dist/filter-pushdown/types.d.ts +10 -10
  13. package/dist/functions/scalar.d.ts +1 -1
  14. package/dist/functions/table-buffering.d.ts +20 -20
  15. package/dist/functions/table-in-out.d.ts +4 -4
  16. package/dist/functions/table.d.ts +7 -7
  17. package/dist/functions/types.d.ts +47 -47
  18. package/dist/generated/vgi-client.d.ts +5 -0
  19. package/dist/generated/vgi-protocol-schemas.d.ts +5 -0
  20. package/dist/generated/vgi-protocol-types.d.ts +57 -0
  21. package/dist/generated/vgi-service.d.ts +1 -1
  22. package/dist/http/fetch.d.ts +10 -10
  23. package/dist/index.core.d.ts +3 -1
  24. package/dist/index.js +289 -103
  25. package/dist/index.js.map +57 -55
  26. package/dist/protocol/dispatch.d.ts +4 -4
  27. package/dist/protocol/handlers/function.d.ts +2 -2
  28. package/dist/protocol/serializers/cardinality.d.ts +4 -1
  29. package/dist/protocol/serializers/splits.d.ts +41 -1
  30. package/dist/protocol/types.d.ts +5 -5
  31. package/dist/rpc-server.d.ts +6 -6
  32. package/dist/serve-entry.d.ts +16 -16
  33. package/dist/serve-entry.js +119 -30
  34. package/dist/serve-entry.js.map +42 -40
  35. package/dist/split-token.d.ts +6 -6
  36. package/dist/types.d.ts +9 -2
  37. package/dist/util/defined.d.ts +21 -0
  38. package/dist/worker-cf-entry.js +199 -94
  39. package/dist/worker-cf-entry.js.map +55 -53
  40. package/dist/worker.d.ts +2 -2
  41. package/package.json +6 -4
  42. package/src/arguments/argument-spec.ts +17 -11
  43. package/src/arrow/codec/registry.ts +2 -2
  44. package/src/arrow/impl-arrowjs/build.ts +1 -1
  45. package/src/arrow/impl-arrowjs/canonical.ts +23 -23
  46. package/src/arrow/impl-arrowjs/empty.ts +2 -2
  47. package/src/arrow/impl-arrowjs/ipc.ts +2 -2
  48. package/src/arrow/impl-arrowjs/iterate.ts +2 -2
  49. package/src/arrow/impl-arrowjs/project.ts +2 -2
  50. package/src/arrow/impl-flechette/build.ts +2 -1
  51. package/src/arrow/impl-flechette/canonical.ts +10 -9
  52. package/src/arrow/impl-flechette/compat.ts +3 -3
  53. package/src/arrow/impl-flechette/message-meta.ts +5 -4
  54. package/src/arrow/impl-flechette/statistics.ts +2 -2
  55. package/src/attach-ticket.ts +2 -2
  56. package/src/catalog/column-metadata.ts +1 -1
  57. package/src/catalog/composite.ts +2 -2
  58. package/src/catalog/constraints.ts +9 -9
  59. package/src/catalog/descriptors.ts +1 -1
  60. package/src/catalog/interface.ts +12 -12
  61. package/src/catalog/publication.ts +9 -8
  62. package/src/catalog/read-only.ts +9 -8
  63. package/src/catalog/sql-grammar.ts +6 -6
  64. package/src/client/client.ts +52 -15
  65. package/src/client/errors.ts +1 -1
  66. package/src/client/types.ts +23 -0
  67. package/src/client-entry.ts +2 -0
  68. package/src/codec/asd.ts +3 -3
  69. package/src/codec/conform.ts +3 -3
  70. package/src/filter-pushdown/collector.ts +1 -1
  71. package/src/filter-pushdown/deserialize.ts +13 -10
  72. package/src/filter-pushdown/evaluate.ts +3 -2
  73. package/src/filter-pushdown/history.ts +3 -2
  74. package/src/filter-pushdown/types.ts +10 -10
  75. package/src/functions/continuation.ts +1 -1
  76. package/src/functions/projection.ts +1 -1
  77. package/src/functions/registry.ts +14 -14
  78. package/src/functions/scalar.ts +3 -3
  79. package/src/functions/storage-cf-do.ts +2 -2
  80. package/src/functions/table-buffering.ts +25 -21
  81. package/src/functions/table-in-out.ts +8 -8
  82. package/src/functions/table.ts +27 -25
  83. package/src/functions/types.ts +47 -47
  84. package/src/generated/vgi-client.ts +6 -1
  85. package/src/generated/vgi-protocol-schemas.ts +36 -1
  86. package/src/generated/vgi-protocol-types.ts +130 -1
  87. package/src/generated/vgi-service.ts +7 -5
  88. package/src/http/fetch.ts +17 -12
  89. package/src/index.core.ts +34 -0
  90. package/src/protocol/carried-init-request.ts +1 -1
  91. package/src/protocol/dispatch.ts +4 -4
  92. package/src/protocol/handlers/aggregate.ts +8 -7
  93. package/src/protocol/handlers/catalog/shared.ts +1 -1
  94. package/src/protocol/handlers/function.ts +2 -2
  95. package/src/protocol/serializers/cardinality.ts +16 -3
  96. package/src/protocol/serializers/splits.ts +82 -9
  97. package/src/protocol/state-serializer.ts +1 -1
  98. package/src/protocol/types.ts +5 -5
  99. package/src/rpc-server.ts +13 -12
  100. package/src/serve-entry.ts +18 -18
  101. package/src/split-token.ts +10 -9
  102. package/src/types.ts +9 -2
  103. package/src/util/defined.ts +30 -0
  104. package/src/util/parent-rows.ts +2 -2
  105. package/src/worker.ts +15 -14
@@ -7,7 +7,7 @@ export declare class FilterV2Error extends Error {
7
7
  export interface DeserializeFilterOptions extends FilterCapabilities {
8
8
  /** The authoritative, unprojected bind output schema. */
9
9
  outputSchema: VgiSchema;
10
- joinKeyBatches?: VgiBatch[];
10
+ joinKeyBatches?: VgiBatch[] | undefined;
11
11
  }
12
12
  export declare function deserializeFilters(batch: VgiBatch, options: DeserializeFilterOptions): PushdownFilters;
13
13
  export declare function applyFilterDelta(prior: PushdownFilters, batch: VgiBatch): PushdownFilters;
@@ -25,12 +25,12 @@ export interface FunctionIdentity {
25
25
  }
26
26
  export interface EvaluationContext {
27
27
  profile: string;
28
- timeZone?: string;
29
- calendar?: string;
30
- defaultCollation?: string;
31
- ieeeFloatingPointOps?: boolean;
32
- integerDivision?: boolean;
33
- providerFingerprint?: string;
28
+ timeZone?: string | undefined;
29
+ calendar?: string | undefined;
30
+ defaultCollation?: string | undefined;
31
+ ieeeFloatingPointOps?: boolean | undefined;
32
+ integerDivision?: boolean | undefined;
33
+ providerFingerprint?: string | undefined;
34
34
  }
35
35
  export type FilterExpression = {
36
36
  node: "column_ref";
@@ -85,7 +85,7 @@ export type FilterExpression = {
85
85
  node: "call";
86
86
  function: StandardFilterFunction | FunctionIdentity;
87
87
  arguments: FilterExpression[];
88
- options?: Record<string, unknown>;
88
+ options?: Record<string, unknown> | undefined;
89
89
  } | {
90
90
  node: "runtime_filter";
91
91
  algorithm: FunctionIdentity;
@@ -117,12 +117,12 @@ export interface FilterPredicate {
117
117
  expression: FilterExpression;
118
118
  }
119
119
  export interface FilterCapabilities {
120
- extensionFunctions?: ReadonlyArray<FunctionIdentity>;
121
- runtimeAlgorithms?: ReadonlyArray<FunctionIdentity>;
120
+ extensionFunctions?: ReadonlyArray<FunctionIdentity> | undefined;
121
+ runtimeAlgorithms?: ReadonlyArray<FunctionIdentity> | undefined;
122
122
  evaluationContexts?: ReadonlyArray<{
123
123
  profile: string;
124
124
  providerFingerprint?: string | null;
125
- }>;
125
+ }> | undefined;
126
126
  }
127
127
  export type Filter = FilterExpression;
128
128
  export type ExprNode = FilterExpression;
@@ -38,7 +38,7 @@ export interface ScalarParameterDef {
38
38
  gt?: number;
39
39
  /** Exclusive upper bound, `<` (folded into `vgi_range`). */
40
40
  lt?: number;
41
- /** Regex the value must match (surfaced as `vgi_pattern`). */
41
+ /** Regex the value must match (surfaced as `vgi_pattern`); an unanchored search — anchor with `^...$` for a full match. */
42
42
  pattern?: string;
43
43
  /** Default value (surfaced as `vgi_default`, JSON-encoded). */
44
44
  default?: unknown;
@@ -39,16 +39,16 @@ export interface TableBufferingParams<TArgs = Record<string, any>> {
39
39
  }
40
40
  export interface TableBufferingConfig<TArgs = Record<string, any>, TState = any> {
41
41
  name: string;
42
- description?: string;
43
- args?: Record<string, VgiDataType>;
44
- namedArgs?: Record<string, VgiDataType>;
45
- argDefaults?: Record<string, any>;
42
+ description?: string | undefined;
43
+ args?: Record<string, VgiDataType> | undefined;
44
+ namedArgs?: Record<string, VgiDataType> | undefined;
45
+ argDefaults?: Record<string, any> | undefined;
46
46
  /** Authoritative typed defaults: one row, defaulted parameters only. */
47
- parameterDefaultValues?: VgiBatch | null;
47
+ parameterDefaultValues?: VgiBatch | null | undefined;
48
48
  /** Argument descriptions keyed by argument name. */
49
- argDocs?: Record<string, string>;
49
+ argDocs?: Record<string, string> | undefined;
50
50
  /** Discovery constraints, also enforced for scalar arguments at bind. */
51
- argConstraints?: Record<string, ArgumentConstraints>;
51
+ argConstraints?: Record<string, ArgumentConstraints> | undefined;
52
52
  /** Bind: default passes through input schema. May be async. Return non-empty
53
53
  * `lookupSecret*` lists on the first pass to request DuckDB secrets; the
54
54
  * connector then re-binds with `resolvedSecretsProvided` and the resolved
@@ -75,22 +75,22 @@ export interface TableBufferingConfig<TArgs = Record<string, any>, TState = any>
75
75
  /** Source tick: emit one batch via out.emit / signal EOS via out.finish. */
76
76
  finalize: (params: TableBufferingParams<TArgs>, finalizeStateId: Uint8Array, state: TState, out: OutputCollector) => void | Promise<void>;
77
77
  cardinality?: (params: TableBufferingBindParams<TArgs>) => TableCardinality | Promise<TableCardinality>;
78
- projectionPushdown?: boolean;
79
- filterPushdown?: boolean;
80
- autoApplyFilters?: boolean;
78
+ projectionPushdown?: boolean | undefined;
79
+ filterPushdown?: boolean | undefined;
80
+ autoApplyFilters?: boolean | undefined;
81
81
  /** Force ParallelSink=false in the C++ operator (single-thread ingest). */
82
- sinkOrderDependent?: boolean;
82
+ sinkOrderDependent?: boolean | undefined;
83
83
  /** Force serial Source drain in finalize_queue order. */
84
- sourceOrderDependent?: boolean;
84
+ sourceOrderDependent?: boolean | undefined;
85
85
  /** Thread DuckDB's per-chunk batch_index into every process() call. */
86
- requiresInputBatchIndex?: boolean;
87
- stability?: FunctionStability;
88
- examples?: FunctionExample[];
89
- categories?: string[];
90
- tags?: Record<string, string>;
91
- maxWorkers?: number;
92
- requiredSettings?: string[];
93
- requiredSecrets?: string[];
86
+ requiresInputBatchIndex?: boolean | undefined;
87
+ stability?: FunctionStability | undefined;
88
+ examples?: FunctionExample[] | undefined;
89
+ categories?: string[] | undefined;
90
+ tags?: Record<string, string> | undefined;
91
+ maxWorkers?: number | undefined;
92
+ requiredSettings?: string[] | undefined;
93
+ requiredSecrets?: string[] | undefined;
94
94
  }
95
95
  /**
96
96
  * A table_buffering VgiFunction also carries its callback config so the
@@ -22,7 +22,7 @@ export interface TableInOutProcessParams<TArgs = Record<string, any>> {
22
22
  outputSchema: VgiSchema;
23
23
  settings: Record<string, any>;
24
24
  secrets: Record<string, Record<string, any>>;
25
- pushdownFilters?: PushdownFilters;
25
+ pushdownFilters?: PushdownFilters | undefined;
26
26
  /** Shared storage for cross-phase and cross-worker data (SQLite-backed). */
27
27
  storage: BoundStorage;
28
28
  /**
@@ -36,7 +36,7 @@ export interface TableInOutProcessParams<TArgs = Record<string, any>> {
36
36
  * `null`/`undefined` for a client that sent none. Mirrors vgi-python's
37
37
  * `ProcessParams.substream_id`.
38
38
  */
39
- substreamId?: Uint8Array | null;
39
+ substreamId?: Uint8Array | null | undefined;
40
40
  /**
41
41
  * Conditional-revalidation validator (exchange-mode result cache): the
42
42
  * client holds a stale cached result for THIS input unit and asks the
@@ -45,10 +45,10 @@ export interface TableInOutProcessParams<TArgs = Record<string, any>> {
45
45
  * of recomputing. Rides the input batch's custom metadata (attached by the
46
46
  * C++ WriteInputBatch). Undefined on a normal call.
47
47
  */
48
- ifNoneMatch?: string;
48
+ ifNoneMatch?: string | undefined;
49
49
  /** RFC 3339 Last-Modified validator for conditional revalidation.
50
50
  * Companion to {@link ifNoneMatch}. Undefined on a normal call. */
51
- ifModifiedSince?: string;
51
+ ifModifiedSince?: string | undefined;
52
52
  }
53
53
  export interface TableInOutConfig<TArgs = Record<string, any>, TState = null> {
54
54
  name: string;
@@ -24,7 +24,7 @@ export interface TableProcessParams<TArgs = Record<string, any>> {
24
24
  outputSchema: VgiSchema;
25
25
  settings: Record<string, any>;
26
26
  secrets: Record<string, Record<string, any>>;
27
- pushdownFilters?: PushdownFilters;
27
+ pushdownFilters?: PushdownFilters | undefined;
28
28
  /**
29
29
  * The verified payloads of the splits this init claimed, in the order given,
30
30
  * or undefined when this is not a split scan.
@@ -33,8 +33,8 @@ export interface TableProcessParams<TArgs = Record<string, any>> {
33
33
  * the client did not plan (a split-only function should fail loudly rather
34
34
  * than answer the same query differently), empty means a claim of no work.
35
35
  */
36
- splitPayloads?: Uint8Array[];
37
- storage?: BoundStorage;
36
+ splitPayloads?: Uint8Array[] | undefined;
37
+ storage?: BoundStorage | undefined;
38
38
  /**
39
39
  * AT (TIMESTAMP|VERSION) clause for this scan, or `undefined` when the scan
40
40
  * has no AT clause. Carried on the per-scan bind embedded in the init request
@@ -42,8 +42,8 @@ export interface TableProcessParams<TArgs = Record<string, any>> {
42
42
  * read time travel at init alongside their pushdown filters. Mirrors
43
43
  * vgi-python's `ProcessParams.at_unit` / `.at_value`. See `BindRequest.at_unit`.
44
44
  */
45
- atUnit?: string;
46
- atValue?: string;
45
+ atUnit?: string | undefined;
46
+ atValue?: string | undefined;
47
47
  /**
48
48
  * Conditional-revalidation validator (the client's stored ETag). Set when the
49
49
  * client holds a stale-but-revalidatable cached result and asks the worker to
@@ -52,10 +52,10 @@ export interface TableProcessParams<TArgs = Record<string, any>> {
52
52
  * `cacheControlMetadata({ notModified: true })` instead of re-streaming.
53
53
  * Undefined on a normal call.
54
54
  */
55
- ifNoneMatch?: string;
55
+ ifNoneMatch?: string | undefined;
56
56
  /** Conditional-revalidation validator (the client's stored Last-Modified).
57
57
  * Companion to {@link ifNoneMatch}. Undefined on a normal call. */
58
- ifModifiedSince?: string;
58
+ ifModifiedSince?: string | undefined;
59
59
  }
60
60
  export interface TableFunctionConfig<TArgs = Record<string, any>, TState = null> {
61
61
  name: string;
@@ -37,23 +37,23 @@ export interface EvaluationContextCapability {
37
37
  }
38
38
  export interface FunctionMeta {
39
39
  name: string;
40
- description?: string;
41
- stability?: FunctionStability;
42
- nullHandling?: NullHandling;
40
+ description?: string | undefined;
41
+ stability?: FunctionStability | undefined;
42
+ nullHandling?: NullHandling | undefined;
43
43
  /** Scalar-only claims in argument declaration order. A vararg is one slot. */
44
- argumentMonotonicity?: ArgumentMonotonicity[] | null;
45
- examples?: FunctionExample[];
46
- categories?: string[];
47
- tags?: Record<string, string>;
44
+ argumentMonotonicity?: ArgumentMonotonicity[] | null | undefined;
45
+ examples?: FunctionExample[] | undefined;
46
+ categories?: string[] | undefined;
47
+ tags?: Record<string, string> | undefined;
48
48
  /**
49
49
  * Authoritative typed parameter defaults. The batch must contain one row
50
50
  * and only defaulted parameters, in signature order; a present null is an
51
51
  * explicit null default. `vgi_default` field metadata remains discovery-only.
52
52
  */
53
- parameterDefaultValues?: VgiBatch | null;
54
- projectionPushdown?: boolean;
55
- filterPushdown?: boolean;
56
- samplingPushdown?: boolean;
53
+ parameterDefaultValues?: VgiBatch | null | undefined;
54
+ projectionPushdown?: boolean | undefined;
55
+ filterPushdown?: boolean | undefined;
56
+ samplingPushdown?: boolean | undefined;
57
57
  /**
58
58
  * table (generator): opt in to DuckDB's late-materialization rewrite. A
59
59
  * TOP_N/LIMIT/SAMPLE over a rowid-bearing table is rewritten into a SEMI
@@ -62,24 +62,24 @@ export interface FunctionMeta {
62
62
  * as FunctionInfo `late_materialization`. Only honoured by the C++ extension
63
63
  * for tables whose worker also guarantees a UNIQUE, snapshot-stable rowid.
64
64
  */
65
- lateMaterialization?: boolean;
66
- filterSemanticProfiles?: string[];
67
- additionalFilterFunctions?: FilterFunctionCapability[];
68
- runtimeFilterAlgorithms?: FilterFunctionCapability[];
69
- filterEvaluationContexts?: EvaluationContextCapability[];
70
- autoApplyFilters?: boolean;
71
- preservesOrder?: OrderPreservation;
72
- maxWorkers?: number;
73
- requiredSettings?: string[];
74
- requiredSecrets?: string[];
75
- orderDependent?: OrderDependence;
76
- distinctDependent?: DistinctDependence;
65
+ lateMaterialization?: boolean | undefined;
66
+ filterSemanticProfiles?: string[] | undefined;
67
+ additionalFilterFunctions?: FilterFunctionCapability[] | undefined;
68
+ runtimeFilterAlgorithms?: FilterFunctionCapability[] | undefined;
69
+ filterEvaluationContexts?: EvaluationContextCapability[] | undefined;
70
+ autoApplyFilters?: boolean | undefined;
71
+ preservesOrder?: OrderPreservation | undefined;
72
+ maxWorkers?: number | undefined;
73
+ requiredSettings?: string[] | undefined;
74
+ requiredSecrets?: string[] | undefined;
75
+ orderDependent?: OrderDependence | undefined;
76
+ distinctDependent?: DistinctDependence | undefined;
77
77
  /**
78
78
  * For table_in_out functions: whether the user defined a finalize callback.
79
79
  * DuckDB issues a separate FINALIZE init() phase only when this is true;
80
80
  * otherwise calling FinalExecute is unsupported and crashes the C++ side.
81
81
  */
82
- hasFinalize?: boolean;
82
+ hasFinalize?: boolean | undefined;
83
83
  /**
84
84
  * Blended ("UNNEST-style") table-in-out: the function's positional args ARE
85
85
  * its per-row input columns (real typed args, no synthetic TABLE
@@ -91,36 +91,36 @@ export interface FunctionMeta {
91
91
  * single-row scan-mode. Mirrors vgi-python's RowTransformFunction /
92
92
  * ResolvedMetadata.input_from_args.
93
93
  */
94
- inputFromArgs?: boolean;
94
+ inputFromArgs?: boolean | undefined;
95
95
  /**
96
96
  * Blended only: the most input rows one worker call receives; the client
97
97
  * splits each input chunk into calls of at most this many rows. Unset sends
98
98
  * a whole chunk per call. Set by {@link defineRowTransformFunction}'s
99
99
  * `inputRowsPerCall`; surfaces as FunctionInfo.input_rows_per_call.
100
100
  */
101
- inputRowsPerCall?: number;
101
+ inputRowsPerCall?: number | undefined;
102
102
  /**
103
103
  * table_buffering: force ParallelSink=false in the C++ operator
104
104
  * (single-thread, source-ordered ingest).
105
105
  */
106
- sinkOrderDependent?: boolean;
106
+ sinkOrderDependent?: boolean | undefined;
107
107
  /**
108
108
  * table_buffering: force serial Source drain in finalize_queue order
109
109
  * (ParallelSource=false, SourceOrder=FIXED_ORDER).
110
110
  */
111
- sourceOrderDependent?: boolean;
111
+ sourceOrderDependent?: boolean | undefined;
112
112
  /**
113
113
  * table_buffering: thread DuckDB's per-chunk batch_index into every
114
114
  * process() call (RequiredPartitionInfo=BatchIndex).
115
115
  */
116
- requiresInputBatchIndex?: boolean;
116
+ requiresInputBatchIndex?: boolean | undefined;
117
117
  /**
118
118
  * table (generator): the function tags every emitted Arrow batch with a
119
119
  * per-partition `vgi_batch_index` so DuckDB's ordered sinks reassemble
120
120
  * parallel output in partition order. Surfaces as FunctionInfo
121
121
  * `supports_batch_index`.
122
122
  */
123
- supportsBatchIndex?: boolean;
123
+ supportsBatchIndex?: boolean | undefined;
124
124
  /**
125
125
  * table (generator): the scan divides into named, independently redeemable
126
126
  * splits (see the `plan` / `onSplit` hooks). Surfaces as FunctionInfo
@@ -131,19 +131,19 @@ export interface FunctionMeta {
131
131
  * same rows. Without it, the division lives behind an opaque worker-side queue
132
132
  * and a retry reads neither what it read before nor what it missed.
133
133
  */
134
- supportsSplits?: boolean;
134
+ supportsSplits?: boolean | undefined;
135
135
  /**
136
136
  * table (generator): the worker applies every pushed filter EXACTLY, so the
137
137
  * engine may drop its own copy rather than re-filtering. Wrong answers if
138
138
  * declared falsely — leave unset unless certain.
139
139
  */
140
- filtersExactlyApplied?: boolean;
140
+ filtersExactlyApplied?: boolean | undefined;
141
141
  /**
142
142
  * table (generator): addressable positions in the data, for incremental and
143
143
  * streaming reads. The engine owns the checkpoint; this declares only that
144
144
  * positions are meaningful to externalize.
145
145
  */
146
- supportsPositions?: boolean;
146
+ supportsPositions?: boolean | undefined;
147
147
  /**
148
148
  * table (generator): how long a split token stays redeemable.
149
149
  *
@@ -152,14 +152,14 @@ export interface FunctionMeta {
152
152
  * plan whose TTL is below its own planning-to-task-start horizon, which on a
153
153
  * busy cluster is hours rather than seconds.
154
154
  */
155
- splitTokenTtlSeconds?: number;
155
+ splitTokenTtlSeconds?: number | undefined;
156
156
  /**
157
157
  * table (generator): Hive-style partition-columns mode. Functions declare
158
158
  * a PartitionKind and annotate bind-schema fields; emitted batches carry
159
159
  * `vgi_partition_values#b64` metadata. Surfaces as FunctionInfo
160
160
  * `partition_kind`.
161
161
  */
162
- partitionKind?: "NOT_PARTITIONED" | "SINGLE_VALUE_PARTITIONS" | "OVERLAPPING_PARTITIONS" | "DISJOINT_PARTITIONS";
162
+ partitionKind?: "NOT_PARTITIONED" | "SINGLE_VALUE_PARTITIONS" | "OVERLAPPING_PARTITIONS" | "DISJOINT_PARTITIONS" | undefined;
163
163
  /**
164
164
  * COPY ... FROM custom format reader: the SQL `FORMAT` identifier this
165
165
  * function backs (e.g. `example_lines`). Set by {@link defineCopyFromFunction}.
@@ -168,11 +168,11 @@ export interface FunctionMeta {
168
168
  * extension registers a DuckDB CopyFunction for it. Mirrors vgi-python's
169
169
  * `CopyFromFunction.COPY_FROM_FORMAT`.
170
170
  */
171
- copyFromFormat?: string;
171
+ copyFromFormat?: string | undefined;
172
172
  /** COPY direction; only `"from"` is supported today. Default `"from"`. */
173
- copyFromDirection?: string;
173
+ copyFromDirection?: string | undefined;
174
174
  /** Optional free-text comment surfaced by `vgi_copy_formats()`. */
175
- copyFromComment?: string | null;
175
+ copyFromComment?: string | null | undefined;
176
176
  /**
177
177
  * COPY ... TO custom format writer: the SQL `FORMAT` identifier this function
178
178
  * backs (e.g. `example_lines_out`). Set by {@link defineCopyToFunction}. When
@@ -183,19 +183,19 @@ export interface FunctionMeta {
183
183
  * `table_buffering_process` / `table_buffering_combine` RPCs. Mirrors
184
184
  * vgi-python's `CopyToFunction.COPY_TO_FORMAT`.
185
185
  */
186
- copyToFormat?: string;
186
+ copyToFormat?: string | undefined;
187
187
  /** COPY direction for a TO writer; always `"to"`. Default `"to"`. */
188
- copyToDirection?: string;
188
+ copyToDirection?: string | undefined;
189
189
  /** Optional free-text comment surfaced by `vgi_copy_formats()`. */
190
- copyToComment?: string | null;
190
+ copyToComment?: string | null | undefined;
191
191
  }
192
192
  export interface StreamHandlers {
193
- producerInit?: () => any;
194
- producerFn?: (state: any, out: OutputCollector) => void | Promise<void>;
195
- exchangeInit?: () => any;
193
+ producerInit?: (() => any) | undefined;
194
+ producerFn?: ((state: any, out: OutputCollector) => void | Promise<void>) | undefined;
195
+ exchangeInit?: (() => any) | undefined;
196
196
  exchangeFn?: (state: any, input: VgiBatch, out: OutputCollector) => void | Promise<void>;
197
197
  outputSchema: VgiSchema;
198
- inputSchema?: VgiSchema;
198
+ inputSchema?: VgiSchema | undefined;
199
199
  /**
200
200
  * Fires once per tick batch on the producer path, before `producerFn`.
201
201
  * Receives the tick's Arrow custom metadata so the handler can pick up
@@ -209,7 +209,7 @@ export interface StreamHandlers {
209
209
  * handler state, which the dispatcher carries in the HTTP state token. Every
210
210
  * other stream's reply is refused if it says HAVE_MORE_OUTPUT.
211
211
  */
212
- continuesOutput?: boolean;
212
+ continuesOutput?: boolean | undefined;
213
213
  }
214
214
  /**
215
215
  * A resolved, registered VGI function definition.
@@ -219,7 +219,7 @@ export interface VgiFunction {
219
219
  meta: FunctionMeta;
220
220
  argumentSpecs: ArgumentSpec[];
221
221
  /** Default output schema (for catalog registration). May be overridden at bind time. */
222
- defaultOutputSchema?: VgiSchema;
222
+ defaultOutputSchema?: VgiSchema | undefined;
223
223
  bind(request: BindRequest): BindResponse | Promise<BindResponse>;
224
224
  globalInit(request: InitRequest): GlobalInitResponse | Promise<GlobalInitResponse>;
225
225
  /**
@@ -671,6 +671,9 @@ export interface ScanSplit {
671
671
  estimated_rows?: number | null;
672
672
  rows_exact: boolean;
673
673
  estimated_bytes?: number | null;
674
+ key_value?: /** @record-batch */ Uint8Array | null;
675
+ range_index?: number | null;
676
+ column_bounds?: /** @record-batch */ Uint8Array | null;
674
677
  partition_bounds?: /** @record-batch */ Uint8Array | null;
675
678
  column_statistics?: Uint8Array | null;
676
679
  location_ids?: number[] | null;
@@ -689,6 +692,8 @@ export interface PlanResponse {
689
692
  catalog_version?: number | null;
690
693
  scope: string;
691
694
  locations?: string[] | null;
695
+ key_grouping?: Uint8Array | null;
696
+ range_partitioning?: Uint8Array | null;
692
697
  partitioning?: Uint8Array[] | null;
693
698
  sort_order?: Uint8Array[] | null;
694
699
  cache_max_age_seconds?: number | null;
@@ -8,6 +8,11 @@ export declare const FunctionInfoSchema: import("../index.core.js").VgiSchema;
8
8
  export declare const MacroInfoSchema: import("../index.core.js").VgiSchema;
9
9
  export declare const IndexInfoSchema: import("../index.core.js").VgiSchema;
10
10
  export declare const CopyFromFormatInfoSchema: import("../index.core.js").VgiSchema;
11
+ export declare const FieldPathSchema: import("../index.core.js").VgiSchema;
12
+ export declare const TransformSpecSchema: import("../index.core.js").VgiSchema;
13
+ export declare const KeyGroupingSchema: import("../index.core.js").VgiSchema;
14
+ export declare const RangeKeySchema: import("../index.core.js").VgiSchema;
15
+ export declare const RangePartitioningSchema: import("../index.core.js").VgiSchema;
11
16
  export declare const MacroParameterSchema: import("../index.core.js").VgiSchema;
12
17
  export declare const MacroOverloadSchema: import("../index.core.js").VgiSchema;
13
18
  export declare const ClientQueryCapabilitiesSchema: import("../index.core.js").VgiSchema;
@@ -1,5 +1,62 @@
1
1
  import type { CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout } from "./vgi-client.js";
2
2
  export type { CatalogAttachResult, CatalogCapabilities, CatalogContentsResponse, CatalogObjectRef, CatalogQueryPrepareRequest, CatalogQueryPrepareResult, ClientQueryCapabilities, ConstraintSnapshot, ConstraintsApplyRequest, DependencySnapshot, IndexDefinition, MacroOverload, MacroParameter, OptionDefinitions, OptionState, QueryCapabilities, QueryEvaluationContext, QueryObjectReference, SqlExpression, TableLayout };
3
+ /** One raw, component-preserving field reference used by a transform. */
4
+ export interface FieldPath {
5
+ components: string[];
6
+ }
7
+ /** `FieldPath` has no defaulted fields, so its init is the record itself. */
8
+ export type FieldPathInit = FieldPath;
9
+ /** Build a complete `FieldPath`, filling the protocol defaults, in wire order. */
10
+ export declare function buildFieldPath(init: FieldPathInit): FieldPath;
11
+ export declare const encodeFieldPath: (v: FieldPath) => Uint8Array;
12
+ export declare const decodeFieldPath: (b: Uint8Array) => FieldPath;
13
+ /** A versioned, registry-defined partition transform. `id` identifies normative semantics (for example `vgi.identity/1` or `iceberg.bucket/1`). `inputs` contains serialized :class:`FieldPath` records. `parameters` is either absent or a one-row Arrow batch, which permits any number of named, typed parameters without admitting arbitrary recursive expressions. */
14
+ export interface TransformSpec {
15
+ id: string;
16
+ inputs: Uint8Array[];
17
+ parameters?: Uint8Array | null;
18
+ }
19
+ /** Fields of `TransformSpec` that have a protocol default. */
20
+ export type TransformSpecDefaultedField = "inputs" | "parameters";
21
+ /** `TransformSpec` with every field that has a protocol default optional. */
22
+ export type TransformSpecInit = Omit<TransformSpec, TransformSpecDefaultedField> & Partial<Pick<TransformSpec, TransformSpecDefaultedField>>;
23
+ /** Build a complete `TransformSpec`, filling the protocol defaults, in wire order. */
24
+ export declare function buildTransformSpec(init: TransformSpecInit): TransformSpec;
25
+ export declare const encodeTransformSpec: (v: TransformSpec) => Uint8Array;
26
+ export declare const decodeTransformSpec: (b: Uint8Array) => TransformSpec;
27
+ /** Transforms whose exact result tuple is constant within every split. */
28
+ export interface KeyGrouping {
29
+ keys: Uint8Array[];
30
+ }
31
+ /** `KeyGrouping` has no defaulted fields, so its init is the record itself. */
32
+ export type KeyGroupingInit = KeyGrouping;
33
+ /** Build a complete `KeyGrouping`, filling the protocol defaults, in wire order. */
34
+ export declare function buildKeyGrouping(init: KeyGroupingInit): KeyGrouping;
35
+ export declare const encodeKeyGrouping: (v: KeyGrouping) => Uint8Array;
36
+ export declare const decodeKeyGrouping: (b: Uint8Array) => KeyGrouping;
37
+ /** One transform and comparator component of a range key. */
38
+ export interface RangeKey {
39
+ transform: Uint8Array;
40
+ direction: string;
41
+ null_order: string;
42
+ }
43
+ /** `RangeKey` has no defaulted fields, so its init is the record itself. */
44
+ export type RangeKeyInit = RangeKey;
45
+ /** Build a complete `RangeKey`, filling the protocol defaults, in wire order. */
46
+ export declare function buildRangeKey(init: RangeKeyInit): RangeKey;
47
+ export declare const encodeRangeKey: (v: RangeKey) => Uint8Array;
48
+ export declare const decodeRangeKey: (b: Uint8Array) => RangeKey;
49
+ /** Exact half-open range distribution shared by all splits in a plan. `N` split-point rows define `N + 1` ranges. Values equal to point `i` belong to range `i + 1`. Each split names its range with :attr:`ScanSplit.range_index`. */
50
+ export interface RangePartitioning {
51
+ keys: Uint8Array[];
52
+ split_points: Uint8Array;
53
+ }
54
+ /** `RangePartitioning` has no defaulted fields, so its init is the record itself. */
55
+ export type RangePartitioningInit = RangePartitioning;
56
+ /** Build a complete `RangePartitioning`, filling the protocol defaults, in wire order. */
57
+ export declare function buildRangePartitioning(init: RangePartitioningInit): RangePartitioning;
58
+ export declare const encodeRangePartitioning: (v: RangePartitioning) => Uint8Array;
59
+ export declare const decodeRangePartitioning: (b: Uint8Array) => RangePartitioning;
3
60
  /** Fields of `MacroParameter` that have a protocol default. */
4
61
  export type MacroParameterDefaultedField = "declared_type" | "default_value" | "default_expression" | "documentation";
5
62
  /** `MacroParameter` with every field that has a protocol default optional. */
@@ -3,7 +3,7 @@ import { type VgiSchema } from "../arrow/index.js";
3
3
  /** The protocol's wire name: the `vgi_rpc.protocol` routing key and the HTTP path segment. */
4
4
  export declare const VGI_PROTOCOL_NAME = "vgi.v3";
5
5
  /** The protocol's semver, stamped on every request by a client of this protocol. */
6
- export declare const VGI_PROTOCOL_VERSION = "3.0.0";
6
+ export declare const VGI_PROTOCOL_VERSION = "3.1.0";
7
7
  /** What a unary handler returns: the result row, now or later. */
8
8
  export type VgiReply<T> = T | ExternalRef | Promise<T | ExternalRef>;
9
9
  /** The result of a unary method with no `result` column. */
@@ -14,14 +14,14 @@ export interface VgiFetchOptions extends HostingOptions {
14
14
  * configured key hosts `vgi.attach_tickets.v1` (with the ability to issue
15
15
  * grants): tickets sealed under a generated key would die on restart.
16
16
  * Defaults to `true`, since this factory requires the key to be passed. */
17
- signingKeyConfigured?: boolean;
17
+ signingKeyConfigured?: boolean | undefined;
18
18
  /** State-token TTL in seconds (default 3600). */
19
- tokenTtl?: number;
19
+ tokenTtl?: number | undefined;
20
20
  /** URL path prefix for VGI requests (default "/vgi"). Pass "" to mount at
21
21
  * the root, which is what a dedicated single-worker HTTP server wants. */
22
- prefix?: string;
22
+ prefix?: string | undefined;
23
23
  /** Server ID for state-token attribution (default "vgi-cf"). */
24
- serverId?: string;
24
+ serverId?: string | undefined;
25
25
  /** CORS allowed origins, added to all responses so the preflight `OPTIONS`
26
26
  * that browser clients send before `__describe__` succeeds.
27
27
  *
@@ -33,9 +33,9 @@ export interface VgiFetchOptions extends HostingOptions {
33
33
  * always defaulted this way; this matches it so both entries agree.
34
34
  *
35
35
  * Pass `null` to disable CORS. */
36
- corsOrigins?: string | null;
36
+ corsOrigins?: string | null | undefined;
37
37
  /** Public source-repository URL, surfaced on the landing page. */
38
- repositoryUrl?: string;
38
+ repositoryUrl?: string | undefined;
39
39
  /** Worker identity for the standardized VGI landing surface: `GET /` serves
40
40
  * the shared landing.html plus a JSON status document carrying this
41
41
  * identity, and `GET /vgi-client.js` serves the browser client build the
@@ -58,13 +58,13 @@ export interface VgiFetchOptions extends HostingOptions {
58
58
  * Supplying it is what makes a worker able to serve more than one principal,
59
59
  * and the identity it returns is the one the worker seals `attach_opaque_data`
60
60
  * and split tokens under. */
61
- authenticate?: AuthenticateFn;
61
+ authenticate?: AuthenticateFn | undefined;
62
62
  /** Off-wire transport identities, including a trusted Iroh HTTP bridge. */
63
- peerIdentityProviders?: readonly PeerIdentityProvider[];
63
+ peerIdentityProviders?: readonly PeerIdentityProvider[] | undefined;
64
64
  /** Policy composing peer evidence with application authentication. */
65
- peerAuthenticationPolicy?: PeerAuthenticationPolicy;
65
+ peerAuthenticationPolicy?: PeerAuthenticationPolicy | undefined;
66
66
  /** Host adapter supplying the physical peer and multiplicity-preserving headers. */
67
- peerResolutionContext?: (request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions>;
67
+ peerResolutionContext?: ((request: Request) => PeerResolutionOptions | Promise<PeerResolutionOptions>) | undefined;
68
68
  }
69
69
  /**
70
70
  * Build a fetch handler suitable for `export default { fetch }` in a CF
@@ -16,6 +16,8 @@ export { CompositeCatalogInterface } from "./catalog/composite.js";
16
16
  export { FunctionRegistry } from "./functions/registry.js";
17
17
  export { FunctionType, FunctionStability, NullHandling, ArgumentMonotonicity, OrderPreservation, OrderDependence, DistinctDependence, TableInOutPhase, DEFAULT_MAX_WORKERS, } from "./types.js";
18
18
  export type { BindRequest, BindResponse, BindRepeatability, CopyFromContext, CopyToContext, InitRequest, GlobalInitResponse, TableCardinality, } from "./protocol/types.js";
19
+ export type { ScanSplit, PlanResult, TableFunctionPlanRequest, } from "./protocol/serializers/splits.js";
20
+ export { type FieldPath, type FieldPathInit, buildFieldPath, encodeFieldPath, decodeFieldPath, type TransformSpec, type TransformSpecInit, buildTransformSpec, encodeTransformSpec, decodeTransformSpec, type KeyGrouping, type KeyGroupingInit, buildKeyGrouping, encodeKeyGrouping, decodeKeyGrouping, type RangeKey, type RangeKeyInit, buildRangeKey, encodeRangeKey, decodeRangeKey, type RangePartitioning, type RangePartitioningInit, buildRangePartitioning, encodeRangePartitioning, decodeRangePartitioning, } from "./generated/vgi-protocol-types.js";
19
21
  export { Arguments } from "./arguments/arguments.js";
20
22
  export { type ArgumentSpec, type ArgumentConstraints, argumentSpecsToSchema, schemaToArgumentSpecs, macroArgumentsSchema, macroParameterDocsFromSchema, formatRange, constraintSpecFields } from "./arguments/argument-spec.js";
21
23
  export { VgiError, RowCountMismatchError, FunctionNotFoundError, CatalogReadOnlyError, CatalogNotFoundError, CatalogAlreadyExistsError, ArgumentValidationError, NoCatalogError, } from "./errors.js";
@@ -42,7 +44,7 @@ export type { ScalarComputeRow, ScalarOutputValue, ScalarComputeResult } from ".
42
44
  export { type FunctionStorage, type WorkerStateKey, FunctionStorageSqlite, BoundStorage, UnknownInvocationError, resolveStorageFromEnv, setStorage, storage as functionStorage, } from "./functions/storage.js";
43
45
  export { FunctionStorageCfDo, type FetchLike } from "./functions/storage-cf-do.js";
44
46
  export { VgiClient, VgiClientError } from "./client/client.js";
45
- export type { VgiClientOptions, TableFunctionOptions, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType as ClientCatalogFunctionType, CatalogAttachOptions, AttachOptionValue, CatalogSnapshot, LoadCatalogOptions, } from "./client/types.js";
47
+ export type { VgiClientOptions, TableFunctionOptions, TableFunctionRowsOptions, Int64Mode, ScalarFunctionOptions, TableInOutFunctionOptions, OnCreateConflict, CatalogFunctionType as ClientCatalogFunctionType, CatalogAttachOptions, AttachOptionValue, CatalogSnapshot, LoadCatalogOptions, } from "./client/types.js";
46
48
  export { str, bytes, int, int32, float, float32, bool, toSchema, OutputCollector, AuthContext } from "@query-farm/vgi-rpc";
47
49
  export { subprocessConnect, httpConnect, tcpConnect } from "@query-farm/vgi-rpc";
48
50
  export type { RpcClient, StreamSession, LogMessage } from "@query-farm/vgi-rpc";