@query-farm/vgi-rpc 0.6.4 → 0.7.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 (177) hide show
  1. package/dist/access-log.d.ts +55 -0
  2. package/dist/access-log.d.ts.map +1 -0
  3. package/dist/arrow/impl-arrowjs/index.d.ts +96 -0
  4. package/dist/arrow/impl-arrowjs/index.d.ts.map +1 -0
  5. package/dist/arrow/impl-flechette/index.d.ts +102 -0
  6. package/dist/arrow/impl-flechette/index.d.ts.map +1 -0
  7. package/dist/arrow/impl-flechette/message-meta.d.ts +11 -0
  8. package/dist/arrow/impl-flechette/message-meta.d.ts.map +1 -0
  9. package/dist/arrow/index.d.ts +4 -0
  10. package/dist/arrow/index.d.ts.map +1 -0
  11. package/dist/arrow/predicates.d.ts +44 -0
  12. package/dist/arrow/predicates.d.ts.map +1 -0
  13. package/dist/arrow/types.d.ts +62 -0
  14. package/dist/arrow/types.d.ts.map +1 -0
  15. package/dist/auth.d.ts +5 -0
  16. package/dist/auth.d.ts.map +1 -1
  17. package/dist/client/capabilities.d.ts +25 -0
  18. package/dist/client/capabilities.d.ts.map +1 -0
  19. package/dist/client/connect.d.ts +10 -0
  20. package/dist/client/connect.d.ts.map +1 -1
  21. package/dist/client/introspect.d.ts +21 -0
  22. package/dist/client/introspect.d.ts.map +1 -1
  23. package/dist/client/ipc.d.ts +8 -2
  24. package/dist/client/ipc.d.ts.map +1 -1
  25. package/dist/client/oauth.d.ts +9 -0
  26. package/dist/client/oauth.d.ts.map +1 -1
  27. package/dist/client/pipe.d.ts +24 -0
  28. package/dist/client/pipe.d.ts.map +1 -1
  29. package/dist/client/stream.d.ts +19 -2
  30. package/dist/client/stream.d.ts.map +1 -1
  31. package/dist/client/types.d.ts +23 -0
  32. package/dist/client/types.d.ts.map +1 -1
  33. package/dist/client/uploadUrl.d.ts +25 -0
  34. package/dist/client/uploadUrl.d.ts.map +1 -0
  35. package/dist/constants.d.ts +30 -2
  36. package/dist/constants.d.ts.map +1 -1
  37. package/dist/crypto.d.ts +22 -0
  38. package/dist/crypto.d.ts.map +1 -0
  39. package/dist/dispatch/describe.d.ts +10 -6
  40. package/dist/dispatch/describe.d.ts.map +1 -1
  41. package/dist/dispatch/stream.d.ts +2 -2
  42. package/dist/dispatch/stream.d.ts.map +1 -1
  43. package/dist/dispatch/unary.d.ts +2 -2
  44. package/dist/dispatch/unary.d.ts.map +1 -1
  45. package/dist/errors.d.ts +64 -1
  46. package/dist/errors.d.ts.map +1 -1
  47. package/dist/external.d.ts +27 -5
  48. package/dist/external.d.ts.map +1 -1
  49. package/dist/http/auth.d.ts +13 -0
  50. package/dist/http/auth.d.ts.map +1 -1
  51. package/dist/http/bearer.d.ts.map +1 -1
  52. package/dist/http/common.d.ts +43 -7
  53. package/dist/http/common.d.ts.map +1 -1
  54. package/dist/http/dispatch.d.ts +20 -2
  55. package/dist/http/dispatch.d.ts.map +1 -1
  56. package/dist/http/handler.d.ts.map +1 -1
  57. package/dist/http/index.d.ts +1 -0
  58. package/dist/http/index.d.ts.map +1 -1
  59. package/dist/http/jwt.d.ts +1 -0
  60. package/dist/http/jwt.d.ts.map +1 -1
  61. package/dist/http/mtls.d.ts +9 -1
  62. package/dist/http/mtls.d.ts.map +1 -1
  63. package/dist/http/oauth-pkce.d.ts +141 -0
  64. package/dist/http/oauth-pkce.d.ts.map +1 -0
  65. package/dist/http/pages.d.ts +3 -0
  66. package/dist/http/pages.d.ts.map +1 -1
  67. package/dist/http/sticky.d.ts +124 -0
  68. package/dist/http/sticky.d.ts.map +1 -0
  69. package/dist/http/token.d.ts +43 -12
  70. package/dist/http/token.d.ts.map +1 -1
  71. package/dist/http/types.d.ts +68 -5
  72. package/dist/http/types.d.ts.map +1 -1
  73. package/dist/index.d.ts +6 -4
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +1275 -3511
  76. package/dist/index.js.map +20 -38
  77. package/dist/launcher/hash.d.ts +22 -0
  78. package/dist/launcher/hash.d.ts.map +1 -0
  79. package/dist/launcher/index.d.ts +23 -0
  80. package/dist/launcher/index.d.ts.map +1 -0
  81. package/dist/launcher/launch.d.ts +27 -0
  82. package/dist/launcher/launch.d.ts.map +1 -0
  83. package/dist/launcher/lock.d.ts +19 -0
  84. package/dist/launcher/lock.d.ts.map +1 -0
  85. package/dist/launcher/serve-unix.d.ts +55 -0
  86. package/dist/launcher/serve-unix.d.ts.map +1 -0
  87. package/dist/launcher/state.d.ts +71 -0
  88. package/dist/launcher/state.d.ts.map +1 -0
  89. package/dist/otel.d.ts.map +1 -1
  90. package/dist/protocol.d.ts +19 -2
  91. package/dist/protocol.d.ts.map +1 -1
  92. package/dist/schema.d.ts +45 -18
  93. package/dist/schema.d.ts.map +1 -1
  94. package/dist/server.d.ts +23 -2
  95. package/dist/server.d.ts.map +1 -1
  96. package/dist/types.d.ts +270 -12
  97. package/dist/types.d.ts.map +1 -1
  98. package/dist/util/gzip.d.ts +10 -0
  99. package/dist/util/gzip.d.ts.map +1 -0
  100. package/dist/util/schema.d.ts +3 -15
  101. package/dist/util/schema.d.ts.map +1 -1
  102. package/dist/util/web-crypto.d.ts +22 -0
  103. package/dist/util/web-crypto.d.ts.map +1 -0
  104. package/dist/util/zstd.d.ts +26 -3
  105. package/dist/util/zstd.d.ts.map +1 -1
  106. package/dist/wire/opaque.d.ts +11 -0
  107. package/dist/wire/opaque.d.ts.map +1 -0
  108. package/dist/wire/reader.d.ts +5 -5
  109. package/dist/wire/reader.d.ts.map +1 -1
  110. package/dist/wire/request.d.ts +11 -3
  111. package/dist/wire/request.d.ts.map +1 -1
  112. package/dist/wire/response.d.ts +6 -6
  113. package/dist/wire/response.d.ts.map +1 -1
  114. package/dist/wire/writer.d.ts +49 -39
  115. package/dist/wire/writer.d.ts.map +1 -1
  116. package/package.json +35 -21
  117. package/src/access-log.ts +200 -0
  118. package/src/arrow/impl-arrowjs/index.ts +433 -0
  119. package/src/arrow/impl-flechette/index.ts +414 -0
  120. package/src/arrow/impl-flechette/message-meta.ts +174 -0
  121. package/src/arrow/index.ts +89 -0
  122. package/src/arrow/predicates.ts +56 -0
  123. package/src/arrow/types.ts +73 -0
  124. package/src/auth.ts +5 -0
  125. package/src/client/capabilities.ts +84 -0
  126. package/src/client/connect.ts +113 -26
  127. package/src/client/introspect.ts +74 -38
  128. package/src/client/ipc.ts +37 -27
  129. package/src/client/oauth.ts +9 -0
  130. package/src/client/pipe.ts +36 -9
  131. package/src/client/stream.ts +43 -20
  132. package/src/client/types.ts +23 -0
  133. package/src/client/uploadUrl.ts +169 -0
  134. package/src/constants.ts +34 -2
  135. package/src/crypto.ts +95 -0
  136. package/src/dispatch/describe.ts +146 -107
  137. package/src/dispatch/stream.ts +53 -24
  138. package/src/dispatch/unary.ts +5 -4
  139. package/src/errors.ts +87 -0
  140. package/src/external.ts +49 -30
  141. package/src/http/auth.ts +13 -0
  142. package/src/http/bearer.ts +2 -5
  143. package/src/http/common.ts +91 -23
  144. package/src/http/dispatch.ts +373 -46
  145. package/src/http/handler.ts +790 -68
  146. package/src/http/index.ts +1 -0
  147. package/src/http/jwt.ts +1 -0
  148. package/src/http/mtls.ts +25 -3
  149. package/src/http/oauth-pkce.ts +1035 -0
  150. package/src/http/pages.ts +30 -15
  151. package/src/http/sticky.ts +429 -0
  152. package/src/http/token.ts +170 -75
  153. package/src/http/types.ts +69 -5
  154. package/src/index.ts +40 -1
  155. package/src/launcher/hash.ts +104 -0
  156. package/src/launcher/index.ts +35 -0
  157. package/src/launcher/launch.ts +284 -0
  158. package/src/launcher/lock.ts +171 -0
  159. package/src/launcher/serve-unix.ts +386 -0
  160. package/src/launcher/state.ts +257 -0
  161. package/src/otel.ts +39 -33
  162. package/src/protocol.ts +30 -3
  163. package/src/schema.ts +107 -56
  164. package/src/server.ts +196 -20
  165. package/src/types.ts +376 -18
  166. package/src/util/gzip.ts +63 -0
  167. package/src/util/schema.ts +4 -22
  168. package/src/util/web-crypto.ts +98 -0
  169. package/src/util/zstd.ts +133 -14
  170. package/src/wire/opaque.ts +37 -0
  171. package/src/wire/reader.ts +5 -4
  172. package/src/wire/request.ts +67 -8
  173. package/src/wire/response.ts +51 -85
  174. package/src/wire/writer.ts +165 -69
  175. package/dist/util/conform.d.ts +0 -18
  176. package/dist/util/conform.d.ts.map +0 -1
  177. package/src/util/conform.ts +0 -94
package/dist/types.d.ts CHANGED
@@ -1,16 +1,156 @@
1
- import { RecordBatch, type Schema } from "@query-farm/apache-arrow";
1
+ import { type VgiBatch, type VgiSchema } from "./arrow/index.js";
2
2
  import { AuthContext } from "./auth.js";
3
+ /**
4
+ * Whether an RPC method is request/response or streaming. Mirrors Python's
5
+ * `MethodType` and is carried in the `__describe__` payload.
6
+ */
3
7
  export declare enum MethodType {
8
+ /** Single request batch in, single result batch out. */
4
9
  UNARY = "unary",
10
+ /** Streamed batches — either a producer or an exchange stream. */
5
11
  STREAM = "stream"
6
12
  }
13
+ /**
14
+ * Coarse identifier of the transport binding a {@link VgiRpcServer} or
15
+ * HTTP handler. Workers (RPC implementations) read this via
16
+ * {@link CallContext.kind} or the {@link ServeStartHook} lifecycle hook
17
+ * to tailor startup behaviour (skip HTTP-only caching, enable
18
+ * transport-specific metrics, etc.).
19
+ *
20
+ * Values are wire/log-friendly strings to match Python's `TransportKind`
21
+ * StrEnum byte-for-byte across language boundaries.
22
+ *
23
+ * - `PIPE` — Stdio worker (the standalone {@link VgiRpcServer} loop).
24
+ * - `HTTP` — Fetch-style HTTP handler (`createHttpHandler`).
25
+ * - `UNIX` — AF_UNIX socket handler (the launcher path).
26
+ */
27
+ export declare enum TransportKind {
28
+ /** Stdio worker — the standalone {@link VgiRpcServer} loop. */
29
+ PIPE = "pipe",
30
+ /** Fetch-style HTTP handler (`createHttpHandler`). */
31
+ HTTP = "http",
32
+ /** AF_UNIX socket handler (the launcher path). */
33
+ UNIX = "unix"
34
+ }
35
+ /**
36
+ * Optional lifecycle hook fired once per process before the first
37
+ * dispatched request.
38
+ *
39
+ * For the stdio server, fires inside `VgiRpcServer.run()` before the
40
+ * first read. For HTTP, fires lazily on the first request handled
41
+ * (fork-safe for pre-fork servers).
42
+ *
43
+ * If the hook raises, the server logs the exception and propagates it,
44
+ * leaving the bind state unset so the next attempt re-fires the hook
45
+ * rather than silently skipping it.
46
+ */
47
+ export type ServeStartHook = (kind: TransportKind) => void | Promise<void>;
7
48
  /** Logging interface available to handlers. */
8
49
  export interface LogContext {
50
+ /** Emit a client-directed log message (sent as a zero-row log batch on the
51
+ * wire). `level` is a severity label such as `"info"`, `"warning"`, or
52
+ * `"error"`; `extra` carries optional structured string key/value pairs. */
9
53
  clientLog(level: string, message: string, extra?: Record<string, string>): void;
10
54
  }
55
+ /**
56
+ * Attributes for a Set-Cookie directive queued via {@link CallContext.setCookie}.
57
+ * All fields are optional; omitted attributes are not serialized onto the header.
58
+ */
59
+ export interface CookieAttrs {
60
+ expires?: Date;
61
+ maxAge?: number;
62
+ domain?: string;
63
+ path?: string;
64
+ secure?: boolean;
65
+ httpOnly?: boolean;
66
+ sameSite?: "Strict" | "Lax" | "None";
67
+ partitioned?: boolean;
68
+ }
69
+ /**
70
+ * A queued cookie mutation for the HTTP response. Internal — callers
71
+ * interact through {@link CallContext.setCookie} / {@link CallContext.deleteCookie}.
72
+ */
73
+ export interface CookieSpec extends CookieAttrs {
74
+ name: string;
75
+ value: string;
76
+ delete: boolean;
77
+ }
78
+ /** Per-request sticky-session sink. Internal — populated by the HTTP handler
79
+ * when sticky sessions are enabled, read/mutated by {@link CallContext}'s
80
+ * `openSession` / `closeSession` / `session` getters. */
81
+ export interface StickyContext {
82
+ readonly acceptOpens: boolean;
83
+ state: unknown | null;
84
+ sessionId: string | null;
85
+ mintToken: string | null;
86
+ closed: boolean;
87
+ action: "none" | "resume" | "open" | "close";
88
+ _open(state: unknown, ttl: number | undefined): void;
89
+ _close(): void;
90
+ }
11
91
  /** Extended context with authentication info, available to handlers. */
12
92
  export interface CallContext extends LogContext {
93
+ /** Authenticated principal for this call; {@link AuthContext.anonymous} when
94
+ * the request was not authenticated. */
13
95
  readonly auth: AuthContext;
96
+ /** Coarse identifier of the bound transport, or `undefined` until the
97
+ * server begins serving (the value is committed by the lifecycle hook
98
+ * on the very first request). */
99
+ readonly kind?: TransportKind;
100
+ /**
101
+ * Wire body bytes the framework will accept this iteration before
102
+ * triggering a continuation token (producer streams) or strict-fail
103
+ * with an EXCEPTION batch (unary / stream-exchange). Snapshot at
104
+ * collector construction; not live. `undefined` when no cap is
105
+ * configured or the transport doesn't expose one (stdio).
106
+ */
107
+ readonly remainingResponseBytes?: number;
108
+ /**
109
+ * External-channel bytes left this iteration. Always a hard cap —
110
+ * externalised uploads have no escape valve like producer
111
+ * continuation tokens. Undefined when no cap is configured or
112
+ * externalisation is disabled.
113
+ */
114
+ readonly remainingExternalizedResponseBytes?: number;
115
+ /** True iff the server has an externalisation backend wired up. */
116
+ readonly externalizationEnabled?: boolean;
117
+ /**
118
+ * Incoming request cookies. Empty for non-HTTP transports.
119
+ */
120
+ readonly cookies: ReadonlyMap<string, string>;
121
+ /**
122
+ * Queue a Set-Cookie header on the HTTP response. Only valid inside a
123
+ * unary RPC method served over HTTP; throws otherwise.
124
+ */
125
+ setCookie(name: string, value: string, attrs?: CookieAttrs): void;
126
+ /**
127
+ * Queue an unset-cookie directive on the HTTP response. Only valid
128
+ * inside a unary RPC method served over HTTP; throws otherwise.
129
+ */
130
+ deleteCookie(name: string, opts?: {
131
+ path?: string;
132
+ domain?: string;
133
+ }): void;
134
+ /**
135
+ * Live sticky-session state object, or `null` when no session is bound to
136
+ * this request. HTTP-only — other transports always return `null`.
137
+ */
138
+ readonly session: unknown | null;
139
+ /**
140
+ * Opaque 24-char-hex session ID, or `null` when no session is bound.
141
+ * Survives {@link closeSession} so post-close access-log records still
142
+ * carry the id.
143
+ */
144
+ readonly sessionId: string | null;
145
+ /**
146
+ * Register a sticky session holding *state* for subsequent requests on
147
+ * this transport. HTTP-only — throws on other transports, on calls
148
+ * without the `VGI-Session-Accept: true` opt-in header, or when a
149
+ * session is already bound to this request.
150
+ */
151
+ openSession(state: unknown, ttl?: number): void;
152
+ /** Invalidate the sticky session bound to this request. Idempotent. */
153
+ closeSession(): void;
14
154
  }
15
155
  /** Handler for unary (request-response) RPC methods. */
16
156
  export type UnaryHandler = (params: Record<string, any>, ctx: LogContext) => Promise<Record<string, any>> | Record<string, any>;
@@ -21,25 +161,57 @@ export type ProducerFn<S = any> = (state: S, out: OutputCollector) => Promise<vo
21
161
  /** Initialization function for exchange streams. Returns the initial state object. */
22
162
  export type ExchangeInit<S = any> = (params: Record<string, any>) => Promise<S> | S;
23
163
  /** Called once per input batch. Must emit exactly one output batch per call. */
24
- export type ExchangeFn<S = any> = (state: S, input: RecordBatch, out: OutputCollector) => Promise<void> | void;
164
+ export type ExchangeFn<S = any> = (state: S, input: VgiBatch, out: OutputCollector) => Promise<void> | void;
25
165
  /** Produces a header batch sent before the first output batch in a stream. */
26
166
  export type HeaderInit = (params: Record<string, any>, state: any, ctx: LogContext) => Record<string, any>;
167
+ /**
168
+ * Optional handler invoked when the client signals cancellation by writing an
169
+ * input batch carrying the ``vgi_rpc.cancel`` metadata key. The server runs
170
+ * this hook once, before breaking out of the streaming loop, giving state
171
+ * objects a chance to release resources. Errors are logged and swallowed.
172
+ */
173
+ export type OnCancelFn<S = any> = (state: S) => Promise<void> | void;
174
+ /**
175
+ * In-memory definition of one registered RPC method, produced by the
176
+ * {@link Protocol} builder and consumed by the dispatch layer. Which optional
177
+ * fields are populated depends on the method {@link type}: `handler` for unary
178
+ * methods, `producerInit`/`producerFn` for producer streams, and
179
+ * `exchangeInit`/`exchangeFn` for exchange streams.
180
+ */
27
181
  export interface MethodDefinition {
182
+ /** Method name as registered on the protocol. */
28
183
  name: string;
184
+ /** Whether the method is unary or streaming. */
29
185
  type: MethodType;
30
- paramsSchema: Schema;
31
- resultSchema: Schema;
32
- outputSchema?: Schema;
33
- inputSchema?: Schema;
186
+ /** Schema of the request parameters batch. */
187
+ paramsSchema: VgiSchema;
188
+ /** Schema of the unary result batch (unused for streams). */
189
+ resultSchema: VgiSchema;
190
+ /** Schema of streamed output batches (producer and exchange streams). */
191
+ outputSchema?: VgiSchema;
192
+ /** Schema of streamed input batches (exchange streams only). */
193
+ inputSchema?: VgiSchema;
194
+ /** Implementation for unary methods. */
34
195
  handler?: UnaryHandler;
196
+ /** Builds the initial state object for a producer stream. */
35
197
  producerInit?: ProducerInit;
198
+ /** Produces output batches for a producer stream. */
36
199
  producerFn?: ProducerFn;
200
+ /** Builds the initial state object for an exchange stream. */
37
201
  exchangeInit?: ExchangeInit;
202
+ /** Handles each input batch of an exchange stream. */
38
203
  exchangeFn?: ExchangeFn;
39
- headerSchema?: Schema;
204
+ /** Schema of the optional per-stream header batch. */
205
+ headerSchema?: VgiSchema;
206
+ /** Builds the optional header batch emitted before the first output batch. */
40
207
  headerInit?: HeaderInit;
208
+ /** Optional hook run when the client cancels a stream. */
209
+ onCancel?: OnCancelFn;
210
+ /** Human-readable method documentation, surfaced via introspection. */
41
211
  doc?: string;
212
+ /** Default values applied to omitted request parameters. */
42
213
  defaults?: Record<string, any>;
214
+ /** Human-readable parameter type names, surfaced via introspection. */
43
215
  paramTypes?: Record<string, string>;
44
216
  }
45
217
  /** Metadata passed to dispatch hooks before and after RPC method execution. */
@@ -52,14 +224,50 @@ export interface DispatchInfo {
52
224
  serverId: string;
53
225
  /** Client-supplied request identifier, or null. */
54
226
  requestId: string | null;
227
+ /** Coarse transport identifier — `pipe` for stdio, `http` for fetch
228
+ * handlers, `unix` for AF_UNIX. */
229
+ kind?: TransportKind;
230
+ /** Logical service / protocol name. */
231
+ protocol?: string;
232
+ /** SHA-256 hex of the canonical __describe__ payload (always required in access log). */
233
+ protocolHash?: string;
234
+ /** Operator-supplied protocol-contract version label (optional). */
235
+ protocolVersion?: string;
236
+ /** Authenticated principal, empty string when anonymous. */
237
+ principal?: string;
238
+ /** Authentication domain, empty string when anonymous. */
239
+ authDomain?: string;
240
+ /** True when the call was authenticated. */
241
+ authenticated?: boolean;
242
+ /** HTTP transport: remote IP:port. */
243
+ remoteAddr?: string;
244
+ /** Self-contained Arrow IPC stream of the request batch (unary + stream init only). */
245
+ requestData?: Uint8Array;
246
+ /** Stream lifecycle identifier (32-char lowercase hex); empty on unary. */
247
+ streamId?: string;
248
+ /** True when a stream was cancelled by the client. */
249
+ cancelled?: boolean;
250
+ /** Sticky session ID (24-char hex). Present only when the request was bound
251
+ * to a sticky session or the method opened/closed one. */
252
+ sessionId?: string;
253
+ /** Sticky-session lifecycle action observed during dispatch — one of
254
+ * `"none"` / `"resume"` / `"open"` / `"close"`. Omitted when sticky is
255
+ * disabled or the request never touched the sticky middleware. */
256
+ sessionAction?: "none" | "resume" | "open" | "close";
55
257
  }
56
258
  /** Per-call I/O counters, matching Python's CallStatistics. */
57
259
  export interface CallStatistics {
260
+ /** Number of input batches read from the client. */
58
261
  inputBatches: number;
262
+ /** Number of output batches written to the client. */
59
263
  outputBatches: number;
264
+ /** Total rows across all input batches. */
60
265
  inputRows: number;
266
+ /** Total rows across all output batches. */
61
267
  outputRows: number;
268
+ /** Total serialized bytes of all input batches. */
62
269
  inputBytes: number;
270
+ /** Total serialized bytes of all output batches. */
63
271
  outputBytes: number;
64
272
  }
65
273
  /** Opaque token returned by onDispatchStart, passed back to onDispatchEnd. */
@@ -69,11 +277,15 @@ export type HookToken = unknown;
69
277
  * Implementations must be safe for concurrent use (HTTP transport is concurrent).
70
278
  */
71
279
  export interface DispatchHook {
280
+ /** Invoked before the method runs. The returned {@link HookToken} is opaque
281
+ * to the framework and passed back to {@link onDispatchEnd}. */
72
282
  onDispatchStart(info: DispatchInfo): HookToken;
283
+ /** Invoked after the method completes or throws. `stats` carries the per-call
284
+ * I/O counters; `error` is set only when the dispatch failed. */
73
285
  onDispatchEnd(token: HookToken, info: DispatchInfo, stats: CallStatistics, error?: Error): void;
74
286
  }
75
287
  export interface EmittedBatch {
76
- batch: RecordBatch;
288
+ batch: VgiBatch;
77
289
  metadata?: Map<string, string>;
78
290
  }
79
291
  /**
@@ -88,13 +300,59 @@ export declare class OutputCollector implements CallContext {
88
300
  private _outputSchema;
89
301
  private _serverId;
90
302
  private _requestId;
303
+ private _cookieSinkEnabled;
304
+ private _responseCookies;
305
+ private _stickyContext;
306
+ /** Authenticated principal for this call; {@link AuthContext.anonymous} when
307
+ * the request was not authenticated. */
91
308
  readonly auth: AuthContext;
92
- constructor(outputSchema: Schema, producerMode?: boolean, serverId?: string, requestId?: string | null, authContext?: AuthContext);
93
- get outputSchema(): Schema;
309
+ readonly cookies: ReadonlyMap<string, string>;
310
+ readonly kind?: TransportKind;
311
+ readonly remainingResponseBytes?: number;
312
+ readonly remainingExternalizedResponseBytes?: number;
313
+ readonly externalizationEnabled?: boolean;
314
+ constructor(outputSchema: VgiSchema, producerMode?: boolean, serverId?: string, requestId?: string | null, authContext?: AuthContext, cookies?: ReadonlyMap<string, string>, kind?: TransportKind,
315
+ /** Snapshot budget fields exposed to worker code via {@link CallContext}.
316
+ * Optional — non-HTTP transports omit them and existing call sites
317
+ * remain source-compatible. */
318
+ budgets?: {
319
+ remainingResponseBytes?: number;
320
+ remainingExternalizedResponseBytes?: number;
321
+ externalizationEnabled?: boolean;
322
+ });
323
+ /**
324
+ * Mark this collector as able to accept Set-Cookie directives. Called
325
+ * by the unary HTTP dispatcher only; streaming and non-HTTP paths leave
326
+ * the sink disabled so setCookie/deleteCookie throw.
327
+ * @internal
328
+ */
329
+ enableCookieSink(): void;
330
+ /**
331
+ * Return and clear all queued cookie mutations.
332
+ * @internal
333
+ */
334
+ drainResponseCookies(): CookieSpec[];
335
+ setCookie(name: string, value: string, attrs?: CookieAttrs): void;
336
+ deleteCookie(name: string, opts?: {
337
+ path?: string;
338
+ domain?: string;
339
+ }): void;
340
+ /** Attach the sticky-session sink the HTTP handler built for this request.
341
+ * @internal */
342
+ attachStickyContext(ctx: StickyContext): void;
343
+ get session(): unknown | null;
344
+ get sessionId(): string | null;
345
+ openSession(state: unknown, ttl?: number): void;
346
+ closeSession(): void;
347
+ /** Schema of the data batches this collector emits. */
348
+ get outputSchema(): VgiSchema;
349
+ /** True once {@link finish} has been called (producer streams only). */
94
350
  get finished(): boolean;
351
+ /** Batches emitted so far this call — the single data batch plus any log
352
+ * batches, in emission order. Consumed by the dispatch layer. */
95
353
  get batches(): EmittedBatch[];
96
- /** Emit a pre-built RecordBatch as the data batch for this call. */
97
- emit(batch: RecordBatch, metadata?: Map<string, string>): void;
354
+ /** Emit a pre-built batch as the data batch for this call. */
355
+ emit(batch: VgiBatch, metadata?: Map<string, string>): void;
98
356
  /** Emit a data batch from column arrays keyed by field name. Int64 Number values are coerced to BigInt. */
99
357
  emit(columns: Record<string, any[]>): void;
100
358
  /** Single-row convenience. Wraps each value in `[value]` then calls `emit()`. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAyB,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CACjF;AAED,wEAAwE;AACxE,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC7C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B;AAED,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,CACzB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,GAAG,EAAE,UAAU,KACZ,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,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F,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI;IAQ1C,2FAA2F;IAC3F,MAAM,IAAI,IAAI;IASd,iDAAiD;IACjD,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;CAIhF"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Decompress gzip-encoded data, optionally bounded by `maxOutputSize`.
3
+ *
4
+ * The gzip footer's ISIZE field is mod 2^32 so it can't be trusted for a
5
+ * pre-check — we bound output incrementally during streaming decode.
6
+ */
7
+ export declare function gzipDecompress(data: Uint8Array, maxOutputSize?: number): Promise<Uint8Array<ArrayBuffer>>;
8
+ /** Compress data with gzip. `level` is accepted for API parity with zstd but ignored — the Web API doesn't expose a level. */
9
+ export declare function gzipCompress(data: Uint8Array, _level?: number): Promise<Uint8Array<ArrayBuffer>>;
10
+ //# sourceMappingURL=gzip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gzip.d.ts","sourceRoot":"","sources":["../../src/util/gzip.ts"],"names":[],"mappings":"AAiDA;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAE/G;AAED,8HAA8H;AAC9H,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAEtG"}
@@ -1,20 +1,8 @@
1
- import { type Schema } from "@query-farm/apache-arrow";
1
+ import { type VgiSchema } from "../arrow/index.js";
2
2
  /**
3
3
  * Serialize a Schema to the Arrow IPC Schema message format.
4
4
  * This produces bytes compatible with Python's `pa.ipc.read_schema()`.
5
- *
6
- * We serialize by writing an empty-batch IPC stream and extracting
7
- * the bytes, which includes the schema message. Python's read_schema()
8
- * uses `pa.ipc.read_schema(pa.py_buffer(bytes))` which expects
9
- * the schema flatbuffer message bytes directly — but the Python side
10
- * actually uses `schema.serialize()` which produces Schema message bytes.
11
- *
12
- * In arrow-js, we can get the equivalent by using Message.from(schema)
13
- * and encoding it, or by serializing a zero-batch stream.
14
- *
15
- * The Python `schema.serialize()` produces the Schema flatbuffer message bytes,
16
- * and `pa.ipc.read_schema()` expects an IPC stream containing a schema message.
17
- * The actual format is: continuation marker (0xFFFFFFFF) + length + flatbuffer bytes.
5
+ * Equivalent to writing an empty-batch IPC stream — schema message + EOS marker.
18
6
  */
19
- export declare function serializeSchema(schema: Schema): Uint8Array;
7
+ export declare function serializeSchema(schema: VgiSchema): Uint8Array;
20
8
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/util/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAEhF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAQ1D"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/util/schema.ts"],"names":[],"mappings":"AAGA,OAAO,EAA4C,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE7F;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAE7D"}
@@ -0,0 +1,22 @@
1
+ /** Cryptographically-strong random bytes. */
2
+ export declare function randomBytes(length: number): Uint8Array;
3
+ /**
4
+ * Constant-time byte-array comparison. Returns false fast on length mismatch
5
+ * (the length itself is not a secret), and otherwise XOR-accumulates without
6
+ * an early return so the comparison takes the same wall time regardless of
7
+ * which byte differs.
8
+ */
9
+ export declare function constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean;
10
+ /** HMAC-SHA256 over `data` with `key`. Returns a 32-byte tag. */
11
+ export declare function hmacSha256(key: Uint8Array, data: Uint8Array): Promise<Uint8Array>;
12
+ /**
13
+ * Verify an HMAC-SHA256 tag in constant time. Equivalent to
14
+ * `constantTimeEqual(await hmacSha256(key, data), tag)`, but routes through
15
+ * `crypto.subtle.verify` which is also constant-time on conforming runtimes.
16
+ */
17
+ export declare function hmacSha256Verify(key: Uint8Array, data: Uint8Array, tag: Uint8Array): Promise<boolean>;
18
+ /** SHA-256 of `data` as raw bytes. */
19
+ export declare function sha256(data: Uint8Array): Promise<Uint8Array>;
20
+ /** SHA-256 of `data` as lower-case hex. */
21
+ export declare function sha256Hex(data: Uint8Array): Promise<string>;
22
+ //# sourceMappingURL=web-crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web-crypto.d.ts","sourceRoot":"","sources":["../../src/util/web-crypto.ts"],"names":[],"mappings":"AAWA,6CAA6C;AAC7C,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAItD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAKvE;AAuCD,iEAAiE;AACjE,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAIvF;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAG3G;AAED,sCAAsC;AACtC,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAGlE;AAED,2CAA2C;AAC3C,wBAAsB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjE"}
@@ -1,5 +1,28 @@
1
+ /** Return true when the current runtime can produce zstd-compressed output.
2
+ *
3
+ * Bun has `Bun.zstdCompressSync`; Node ≥22.15 / Deno ≥2.6.9 expose it via
4
+ * `node:zlib`. Other runtimes (workerd, older Node) have no encoder. The
5
+ * fzstd fallback is decompress-only so it doesn't count.
6
+ */
7
+ export declare function isZstdCompressAvailable(): boolean;
1
8
  /** Compress data with zstd at the given level (1-22). */
2
- export declare function zstdCompress(data: Uint8Array, level: number): Uint8Array<ArrayBuffer>;
3
- /** Decompress zstd-compressed data. */
4
- export declare function zstdDecompress(data: Uint8Array): Uint8Array<ArrayBuffer>;
9
+ export declare function zstdCompress(data: Uint8Array, level: number): Promise<Uint8Array<ArrayBuffer>>;
10
+ /**
11
+ * Decompress zstd-compressed data, optionally bounding the output size.
12
+ *
13
+ * Zstd frames carry the decompressed size in the header and decompressors
14
+ * trust it eagerly: a ~3 KB compressed body claiming 100 MB output would
15
+ * allocate 100 MB. When `maxOutputSize` is supplied, this helper:
16
+ *
17
+ * 1. Reads `Frame_Content_Size` from the frame header. If declared and
18
+ * above the cap, refuses *before* allocation with a clear error.
19
+ * 2. Decompresses, then asserts the actual output size is also under the
20
+ * cap (covers frames whose size is not in the header — a streaming
21
+ * cap would be tighter, but neither Bun.zstdDecompressSync nor
22
+ * node:zlib's sync API exposes one, so we use the post-check).
23
+ *
24
+ * Mirrors the Python server-side fix in `_decompress_body` and the
25
+ * client-side fix in `external_fetch.fetch_url`.
26
+ */
27
+ export declare function zstdDecompress(data: Uint8Array, maxOutputSize?: number): Promise<Uint8Array<ArrayBuffer>>;
5
28
  //# sourceMappingURL=zstd.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"zstd.d.ts","sourceRoot":"","sources":["../../src/util/zstd.ts"],"names":[],"mappings":"AAcA,yDAAyD;AACzD,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAerF;AAED,uCAAuC;AACvC,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,CASxE"}
1
+ {"version":3,"file":"zstd.d.ts","sourceRoot":"","sources":["../../src/util/zstd.ts"],"names":[],"mappings":"AA+BA;;;;;GAKG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAIjD;AAED,yDAAyD;AACzD,wBAAsB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAoBpG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAsC/G"}
@@ -0,0 +1,11 @@
1
+ import { type VgiDataType } from "../arrow/index.js";
2
+ /**
3
+ * Arrow types whose `.get(0)` / `vectorFromArray` round-trips are unreliable
4
+ * in arrow-js. For these we extract and re-emit the underlying `Data` object
5
+ * directly (passthrough), like we already do for Map_.
6
+ *
7
+ * Covers Date/Time/Timestamp/Duration/Decimal/LargeUtf8/LargeBinary/
8
+ * FixedSizeBinary/Dictionary.
9
+ */
10
+ export declare function isOpaquePassthroughType(type: VgiDataType): boolean;
11
+ //# sourceMappingURL=opaque.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opaque.d.ts","sourceRoot":"","sources":["../../src/wire/opaque.ts"],"names":[],"mappings":"AAGA,OAAO,EAUL,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAYlE"}
@@ -1,7 +1,7 @@
1
- import { type RecordBatch, type Schema } from "@query-farm/apache-arrow";
1
+ import type { VgiBatch, VgiSchema } from "../arrow/index.js";
2
2
  export interface StreamMessage {
3
- schema: Schema;
4
- batches: RecordBatch[];
3
+ schema: VgiSchema;
4
+ batches: VgiBatch[];
5
5
  }
6
6
  /**
7
7
  * Reads sequential IPC streams from a byte source (e.g., process.stdin).
@@ -25,7 +25,7 @@ export declare class IpcStreamReader {
25
25
  * Use readNextBatch() to read batches one at a time.
26
26
  * Returns null on EOF.
27
27
  */
28
- openNextStream(): Promise<Schema | null>;
28
+ openNextStream(): Promise<VgiSchema | null>;
29
29
  /**
30
30
  * Read the next batch from the currently open IPC stream.
31
31
  * Returns null when the stream ends (EOS).
@@ -34,7 +34,7 @@ export declare class IpcStreamReader {
34
34
  * reading from the underlying byte source. This prevents the Arrow-JS
35
35
  * reader from consuming bytes that belong to the next IPC stream.
36
36
  */
37
- readNextBatch(): Promise<RecordBatch | null>;
37
+ readNextBatch(): Promise<VgiBatch | null>;
38
38
  cancel(): Promise<void>;
39
39
  }
40
40
  //# sourceMappingURL=reader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/wire/reader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,WAAW,EAAqB,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAE5F,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,WAAW,CAAS;IAC5B,+EAA+E;IAC/E,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO;WAIM,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IASxG;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA2BjD;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAY9C;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAiB5C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
1
+ {"version":3,"file":"reader.d.ts","sourceRoot":"","sources":["../../src/wire/reader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,WAAW,CAAS;IAC5B,+EAA+E;IAC/E,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO;WAIM,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IASxG;;;OAGG;IACG,UAAU,IAAI,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IA2BjD;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAYjD;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAiBzC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
@@ -1,9 +1,9 @@
1
- import { type RecordBatch, type Schema } from "@query-farm/apache-arrow";
1
+ import { type VgiBatch, type VgiSchema } from "../arrow/index.js";
2
2
  export interface ParsedRequest {
3
3
  methodName: string;
4
4
  requestVersion: string;
5
5
  requestId: string | null;
6
- schema: Schema;
6
+ schema: VgiSchema;
7
7
  params: Record<string, any>;
8
8
  rawMetadata: Map<string, string>;
9
9
  }
@@ -11,5 +11,13 @@ export interface ParsedRequest {
11
11
  * Parse a request from a RecordBatch with metadata.
12
12
  * Extracts method name, version, and params from the batch.
13
13
  */
14
- export declare function parseRequest(schema: Schema, batch: RecordBatch): ParsedRequest;
14
+ export declare function parseRequest(schema: VgiSchema, batch: VgiBatch): ParsedRequest;
15
+ /**
16
+ * Fill in `defaults` for any params that arrived as null/undefined.
17
+ * The slim DESCRIBE_VERSION 4 wire format no longer carries defaults to the
18
+ * client, so default substitution must happen server-side: the client sends
19
+ * a null in any column it didn't supply, and dispatch swaps in the registered
20
+ * default before invoking the handler.
21
+ */
22
+ export declare function applyDefaults(params: Record<string, any>, defaults: Record<string, any> | undefined): Record<string, any>;
15
23
  //# sourceMappingURL=request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/wire/request.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAInF,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,aAAa,CAkE9E"}
1
+ {"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../src/wire/request.ts"],"names":[],"mappings":"AAGA,OAAO,EAAkB,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKlF,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,GAAG,aAAa,CAwG9E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GACxC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQrB"}
@@ -1,25 +1,25 @@
1
- import { RecordBatch, type Schema } from "@query-farm/apache-arrow";
1
+ import { type VgiBatch, type VgiSchema } from "../arrow/index.js";
2
2
  /**
3
3
  * Coerce values for Int64 schema fields from Number to BigInt.
4
4
  * Handles both single values and arrays. Returns a new record with coerced values.
5
5
  */
6
- export declare function coerceInt64(schema: Schema, values: Record<string, any>): Record<string, any>;
6
+ export declare function coerceInt64(schema: VgiSchema, values: Record<string, any>): Record<string, any>;
7
7
  /**
8
8
  * Build a 1-row result batch with optional metadata.
9
9
  * For unary methods, `values` maps field names to single values.
10
10
  */
11
- export declare function buildResultBatch(schema: Schema, values: Record<string, any>, serverId: string, requestId: string | null): RecordBatch;
11
+ export declare function buildResultBatch(schema: VgiSchema, values: Record<string, any>, serverId: string, requestId: string | null): VgiBatch;
12
12
  /**
13
13
  * Build a 0-row error batch with EXCEPTION metadata matching Python's Message.from_exception().
14
14
  */
15
- export declare function buildErrorBatch(schema: Schema, error: Error, serverId: string, requestId: string | null): RecordBatch;
15
+ export declare function buildErrorBatch(schema: VgiSchema, error: Error, serverId: string, requestId: string | null): VgiBatch;
16
16
  /**
17
17
  * Build a 0-row log batch.
18
18
  */
19
- export declare function buildLogBatch(schema: Schema, level: string, message: string, extra?: Record<string, any>, serverId?: string, requestId?: string | null): RecordBatch;
19
+ export declare function buildLogBatch(schema: VgiSchema, level: string, message: string, extra?: Record<string, any>, serverId?: string, requestId?: string | null): VgiBatch;
20
20
  /**
21
21
  * Build a 0-row batch from a schema with metadata.
22
22
  * Used for error/log batches.
23
23
  */
24
- export declare function buildEmptyBatch(schema: Schema, metadata?: Map<string, string>): RecordBatch;
24
+ export declare function buildEmptyBatch(schema: VgiSchema, metadata?: Map<string, string>): VgiBatch;
25
25
  //# sourceMappingURL=response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/wire/response.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,WAAW,EACX,KAAK,MAAM,EAGZ,MAAM,0BAA0B,CAAC;AAGlC;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAc5F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,WAAW,CAwCb;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,CAiBrH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,QAAQ,CAAC,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI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