@query-farm/vgi-rpc 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/access-log.d.ts +50 -0
- package/dist/access-log.d.ts.map +1 -0
- package/dist/arrow/impl-arrowjs/index.d.ts +96 -0
- package/dist/arrow/impl-arrowjs/index.d.ts.map +1 -0
- package/dist/arrow/impl-flechette/index.d.ts +102 -0
- package/dist/arrow/impl-flechette/index.d.ts.map +1 -0
- package/dist/arrow/impl-flechette/message-meta.d.ts +11 -0
- package/dist/arrow/impl-flechette/message-meta.d.ts.map +1 -0
- package/dist/arrow/index.d.ts +4 -0
- package/dist/arrow/index.d.ts.map +1 -0
- package/dist/arrow/predicates.d.ts +44 -0
- package/dist/arrow/predicates.d.ts.map +1 -0
- package/dist/arrow/types.d.ts +62 -0
- package/dist/arrow/types.d.ts.map +1 -0
- package/dist/client/capabilities.d.ts +25 -0
- package/dist/client/capabilities.d.ts.map +1 -0
- package/dist/client/connect.d.ts.map +1 -1
- package/dist/client/introspect.d.ts +7 -0
- package/dist/client/introspect.d.ts.map +1 -1
- package/dist/client/ipc.d.ts +8 -2
- package/dist/client/ipc.d.ts.map +1 -1
- package/dist/client/pipe.d.ts.map +1 -1
- package/dist/client/stream.d.ts +11 -2
- package/dist/client/stream.d.ts.map +1 -1
- package/dist/client/uploadUrl.d.ts +25 -0
- package/dist/client/uploadUrl.d.ts.map +1 -0
- package/dist/constants.d.ts +15 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/crypto.d.ts +22 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/dispatch/describe.d.ts +10 -6
- package/dist/dispatch/describe.d.ts.map +1 -1
- package/dist/dispatch/stream.d.ts +2 -2
- package/dist/dispatch/stream.d.ts.map +1 -1
- package/dist/dispatch/unary.d.ts +2 -2
- package/dist/dispatch/unary.d.ts.map +1 -1
- package/dist/errors.d.ts +46 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/external.d.ts +25 -5
- package/dist/external.d.ts.map +1 -1
- package/dist/http/bearer.d.ts.map +1 -1
- package/dist/http/common.d.ts +42 -7
- package/dist/http/common.d.ts.map +1 -1
- package/dist/http/dispatch.d.ts +20 -2
- package/dist/http/dispatch.d.ts.map +1 -1
- package/dist/http/handler.d.ts.map +1 -1
- package/dist/http/index.d.ts +1 -0
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/mtls.d.ts +2 -1
- package/dist/http/mtls.d.ts.map +1 -1
- package/dist/http/oauth-pkce.d.ts +141 -0
- package/dist/http/oauth-pkce.d.ts.map +1 -0
- package/dist/http/pages.d.ts +3 -0
- package/dist/http/pages.d.ts.map +1 -1
- package/dist/http/sticky.d.ts +124 -0
- package/dist/http/sticky.d.ts.map +1 -0
- package/dist/http/token.d.ts +38 -12
- package/dist/http/token.d.ts.map +1 -1
- package/dist/http/types.d.ts +66 -5
- package/dist/http/types.d.ts.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1275 -3511
- package/dist/index.js.map +19 -37
- package/dist/launcher/hash.d.ts +22 -0
- package/dist/launcher/hash.d.ts.map +1 -0
- package/dist/launcher/index.d.ts +23 -0
- package/dist/launcher/index.d.ts.map +1 -0
- package/dist/launcher/launch.d.ts +27 -0
- package/dist/launcher/launch.d.ts.map +1 -0
- package/dist/launcher/lock.d.ts +19 -0
- package/dist/launcher/lock.d.ts.map +1 -0
- package/dist/launcher/serve-unix.d.ts +54 -0
- package/dist/launcher/serve-unix.d.ts.map +1 -0
- package/dist/launcher/state.d.ts +59 -0
- package/dist/launcher/state.d.ts.map +1 -0
- package/dist/otel.d.ts.map +1 -1
- package/dist/protocol.d.ts +16 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/schema.d.ts +45 -18
- package/dist/schema.d.ts.map +1 -1
- package/dist/server.d.ts +23 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/types.d.ts +216 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/util/gzip.d.ts +10 -0
- package/dist/util/gzip.d.ts.map +1 -0
- package/dist/util/schema.d.ts +3 -15
- package/dist/util/schema.d.ts.map +1 -1
- package/dist/util/web-crypto.d.ts +22 -0
- package/dist/util/web-crypto.d.ts.map +1 -0
- package/dist/util/zstd.d.ts +26 -3
- package/dist/util/zstd.d.ts.map +1 -1
- package/dist/wire/opaque.d.ts +11 -0
- package/dist/wire/opaque.d.ts.map +1 -0
- package/dist/wire/reader.d.ts +5 -5
- package/dist/wire/reader.d.ts.map +1 -1
- package/dist/wire/request.d.ts +11 -3
- package/dist/wire/request.d.ts.map +1 -1
- package/dist/wire/response.d.ts +6 -6
- package/dist/wire/response.d.ts.map +1 -1
- package/dist/wire/writer.d.ts +49 -39
- package/dist/wire/writer.d.ts.map +1 -1
- package/package.json +24 -10
- package/src/access-log.ts +195 -0
- package/src/arrow/impl-arrowjs/index.ts +433 -0
- package/src/arrow/impl-flechette/index.ts +414 -0
- package/src/arrow/impl-flechette/message-meta.ts +174 -0
- package/src/arrow/index.ts +89 -0
- package/src/arrow/predicates.ts +56 -0
- package/src/arrow/types.ts +73 -0
- package/src/client/capabilities.ts +84 -0
- package/src/client/connect.ts +103 -26
- package/src/client/introspect.ts +60 -38
- package/src/client/ipc.ts +37 -27
- package/src/client/pipe.ts +12 -9
- package/src/client/stream.ts +34 -19
- package/src/client/uploadUrl.ts +169 -0
- package/src/constants.ts +18 -1
- package/src/crypto.ts +95 -0
- package/src/dispatch/describe.ts +146 -107
- package/src/dispatch/stream.ts +53 -24
- package/src/dispatch/unary.ts +5 -4
- package/src/errors.ts +76 -0
- package/src/external.ts +43 -29
- package/src/http/bearer.ts +2 -5
- package/src/http/common.ts +90 -23
- package/src/http/dispatch.ts +373 -46
- package/src/http/handler.ts +790 -68
- package/src/http/index.ts +1 -0
- package/src/http/mtls.ts +18 -3
- package/src/http/oauth-pkce.ts +1035 -0
- package/src/http/pages.ts +30 -15
- package/src/http/sticky.ts +429 -0
- package/src/http/token.ts +165 -75
- package/src/http/types.ts +67 -5
- package/src/index.ts +40 -1
- package/src/launcher/hash.ts +104 -0
- package/src/launcher/index.ts +35 -0
- package/src/launcher/launch.ts +284 -0
- package/src/launcher/lock.ts +171 -0
- package/src/launcher/serve-unix.ts +385 -0
- package/src/launcher/state.ts +245 -0
- package/src/otel.ts +39 -33
- package/src/protocol.ts +27 -3
- package/src/schema.ts +107 -56
- package/src/server.ts +196 -20
- package/src/types.ts +322 -18
- package/src/util/gzip.ts +63 -0
- package/src/util/schema.ts +4 -22
- package/src/util/web-crypto.ts +98 -0
- package/src/util/zstd.ts +133 -14
- package/src/wire/opaque.ts +37 -0
- package/src/wire/reader.ts +5 -4
- package/src/wire/request.ts +67 -8
- package/src/wire/response.ts +51 -85
- package/src/wire/writer.ts +165 -69
- package/dist/util/conform.d.ts +0 -18
- package/dist/util/conform.d.ts.map +0 -1
- package/src/util/conform.ts +0 -94
package/dist/types.d.ts
CHANGED
|
@@ -1,16 +1,142 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type VgiBatch, type VgiSchema } from "./arrow/index.js";
|
|
2
2
|
import { AuthContext } from "./auth.js";
|
|
3
3
|
export declare enum MethodType {
|
|
4
4
|
UNARY = "unary",
|
|
5
5
|
STREAM = "stream"
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Coarse identifier of the transport binding a {@link VgiRpcServer} or
|
|
9
|
+
* HTTP handler. Workers (RPC implementations) read this via
|
|
10
|
+
* {@link CallContext.kind} or the {@link ServeStartHook} lifecycle hook
|
|
11
|
+
* to tailor startup behaviour (skip HTTP-only caching, enable
|
|
12
|
+
* transport-specific metrics, etc.).
|
|
13
|
+
*
|
|
14
|
+
* Values are wire/log-friendly strings to match Python's `TransportKind`
|
|
15
|
+
* StrEnum byte-for-byte across language boundaries.
|
|
16
|
+
*
|
|
17
|
+
* - `PIPE` — Stdio worker (the standalone {@link VgiRpcServer} loop).
|
|
18
|
+
* - `HTTP` — Fetch-style HTTP handler (`createHttpHandler`).
|
|
19
|
+
* - `UNIX` — AF_UNIX socket handler (the launcher path).
|
|
20
|
+
*/
|
|
21
|
+
export declare enum TransportKind {
|
|
22
|
+
PIPE = "pipe",
|
|
23
|
+
HTTP = "http",
|
|
24
|
+
UNIX = "unix"
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Optional lifecycle hook fired once per process before the first
|
|
28
|
+
* dispatched request.
|
|
29
|
+
*
|
|
30
|
+
* For the stdio server, fires inside `VgiRpcServer.run()` before the
|
|
31
|
+
* first read. For HTTP, fires lazily on the first request handled
|
|
32
|
+
* (fork-safe for pre-fork servers).
|
|
33
|
+
*
|
|
34
|
+
* If the hook raises, the server logs the exception and propagates it,
|
|
35
|
+
* leaving the bind state unset so the next attempt re-fires the hook
|
|
36
|
+
* rather than silently skipping it.
|
|
37
|
+
*/
|
|
38
|
+
export type ServeStartHook = (kind: TransportKind) => void | Promise<void>;
|
|
7
39
|
/** Logging interface available to handlers. */
|
|
8
40
|
export interface LogContext {
|
|
9
41
|
clientLog(level: string, message: string, extra?: Record<string, string>): void;
|
|
10
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Attributes for a Set-Cookie directive queued via {@link CallContext.setCookie}.
|
|
45
|
+
* All fields are optional; omitted attributes are not serialized onto the header.
|
|
46
|
+
*/
|
|
47
|
+
export interface CookieAttrs {
|
|
48
|
+
expires?: Date;
|
|
49
|
+
maxAge?: number;
|
|
50
|
+
domain?: string;
|
|
51
|
+
path?: string;
|
|
52
|
+
secure?: boolean;
|
|
53
|
+
httpOnly?: boolean;
|
|
54
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
55
|
+
partitioned?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A queued cookie mutation for the HTTP response. Internal — callers
|
|
59
|
+
* interact through {@link CallContext.setCookie} / {@link CallContext.deleteCookie}.
|
|
60
|
+
*/
|
|
61
|
+
export interface CookieSpec extends CookieAttrs {
|
|
62
|
+
name: string;
|
|
63
|
+
value: string;
|
|
64
|
+
delete: boolean;
|
|
65
|
+
}
|
|
66
|
+
/** Per-request sticky-session sink. Internal — populated by the HTTP handler
|
|
67
|
+
* when sticky sessions are enabled, read/mutated by {@link CallContext}'s
|
|
68
|
+
* `openSession` / `closeSession` / `session` getters. */
|
|
69
|
+
export interface StickyContext {
|
|
70
|
+
readonly acceptOpens: boolean;
|
|
71
|
+
state: unknown | null;
|
|
72
|
+
sessionId: string | null;
|
|
73
|
+
mintToken: string | null;
|
|
74
|
+
closed: boolean;
|
|
75
|
+
action: "none" | "resume" | "open" | "close";
|
|
76
|
+
_open(state: unknown, ttl: number | undefined): void;
|
|
77
|
+
_close(): void;
|
|
78
|
+
}
|
|
11
79
|
/** Extended context with authentication info, available to handlers. */
|
|
12
80
|
export interface CallContext extends LogContext {
|
|
13
81
|
readonly auth: AuthContext;
|
|
82
|
+
/** Coarse identifier of the bound transport, or `undefined` until the
|
|
83
|
+
* server begins serving (the value is committed by the lifecycle hook
|
|
84
|
+
* on the very first request). */
|
|
85
|
+
readonly kind?: TransportKind;
|
|
86
|
+
/**
|
|
87
|
+
* Wire body bytes the framework will accept this iteration before
|
|
88
|
+
* triggering a continuation token (producer streams) or strict-fail
|
|
89
|
+
* with an EXCEPTION batch (unary / stream-exchange). Snapshot at
|
|
90
|
+
* collector construction; not live. `undefined` when no cap is
|
|
91
|
+
* configured or the transport doesn't expose one (stdio).
|
|
92
|
+
*/
|
|
93
|
+
readonly remainingResponseBytes?: number;
|
|
94
|
+
/**
|
|
95
|
+
* External-channel bytes left this iteration. Always a hard cap —
|
|
96
|
+
* externalised uploads have no escape valve like producer
|
|
97
|
+
* continuation tokens. Undefined when no cap is configured or
|
|
98
|
+
* externalisation is disabled.
|
|
99
|
+
*/
|
|
100
|
+
readonly remainingExternalizedResponseBytes?: number;
|
|
101
|
+
/** True iff the server has an externalisation backend wired up. */
|
|
102
|
+
readonly externalizationEnabled?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Incoming request cookies. Empty for non-HTTP transports.
|
|
105
|
+
*/
|
|
106
|
+
readonly cookies: ReadonlyMap<string, string>;
|
|
107
|
+
/**
|
|
108
|
+
* Queue a Set-Cookie header on the HTTP response. Only valid inside a
|
|
109
|
+
* unary RPC method served over HTTP; throws otherwise.
|
|
110
|
+
*/
|
|
111
|
+
setCookie(name: string, value: string, attrs?: CookieAttrs): void;
|
|
112
|
+
/**
|
|
113
|
+
* Queue an unset-cookie directive on the HTTP response. Only valid
|
|
114
|
+
* inside a unary RPC method served over HTTP; throws otherwise.
|
|
115
|
+
*/
|
|
116
|
+
deleteCookie(name: string, opts?: {
|
|
117
|
+
path?: string;
|
|
118
|
+
domain?: string;
|
|
119
|
+
}): void;
|
|
120
|
+
/**
|
|
121
|
+
* Live sticky-session state object, or `null` when no session is bound to
|
|
122
|
+
* this request. HTTP-only — other transports always return `null`.
|
|
123
|
+
*/
|
|
124
|
+
readonly session: unknown | null;
|
|
125
|
+
/**
|
|
126
|
+
* Opaque 24-char-hex session ID, or `null` when no session is bound.
|
|
127
|
+
* Survives {@link closeSession} so post-close access-log records still
|
|
128
|
+
* carry the id.
|
|
129
|
+
*/
|
|
130
|
+
readonly sessionId: string | null;
|
|
131
|
+
/**
|
|
132
|
+
* Register a sticky session holding *state* for subsequent requests on
|
|
133
|
+
* this transport. HTTP-only — throws on other transports, on calls
|
|
134
|
+
* without the `VGI-Session-Accept: true` opt-in header, or when a
|
|
135
|
+
* session is already bound to this request.
|
|
136
|
+
*/
|
|
137
|
+
openSession(state: unknown, ttl?: number): void;
|
|
138
|
+
/** Invalidate the sticky session bound to this request. Idempotent. */
|
|
139
|
+
closeSession(): void;
|
|
14
140
|
}
|
|
15
141
|
/** Handler for unary (request-response) RPC methods. */
|
|
16
142
|
export type UnaryHandler = (params: Record<string, any>, ctx: LogContext) => Promise<Record<string, any>> | Record<string, any>;
|
|
@@ -21,23 +147,31 @@ export type ProducerFn<S = any> = (state: S, out: OutputCollector) => Promise<vo
|
|
|
21
147
|
/** Initialization function for exchange streams. Returns the initial state object. */
|
|
22
148
|
export type ExchangeInit<S = any> = (params: Record<string, any>) => Promise<S> | S;
|
|
23
149
|
/** Called once per input batch. Must emit exactly one output batch per call. */
|
|
24
|
-
export type ExchangeFn<S = any> = (state: S, input:
|
|
150
|
+
export type ExchangeFn<S = any> = (state: S, input: VgiBatch, out: OutputCollector) => Promise<void> | void;
|
|
25
151
|
/** Produces a header batch sent before the first output batch in a stream. */
|
|
26
152
|
export type HeaderInit = (params: Record<string, any>, state: any, ctx: LogContext) => Record<string, any>;
|
|
153
|
+
/**
|
|
154
|
+
* Optional handler invoked when the client signals cancellation by writing an
|
|
155
|
+
* input batch carrying the ``vgi_rpc.cancel`` metadata key. The server runs
|
|
156
|
+
* this hook once, before breaking out of the streaming loop, giving state
|
|
157
|
+
* objects a chance to release resources. Errors are logged and swallowed.
|
|
158
|
+
*/
|
|
159
|
+
export type OnCancelFn<S = any> = (state: S) => Promise<void> | void;
|
|
27
160
|
export interface MethodDefinition {
|
|
28
161
|
name: string;
|
|
29
162
|
type: MethodType;
|
|
30
|
-
paramsSchema:
|
|
31
|
-
resultSchema:
|
|
32
|
-
outputSchema?:
|
|
33
|
-
inputSchema?:
|
|
163
|
+
paramsSchema: VgiSchema;
|
|
164
|
+
resultSchema: VgiSchema;
|
|
165
|
+
outputSchema?: VgiSchema;
|
|
166
|
+
inputSchema?: VgiSchema;
|
|
34
167
|
handler?: UnaryHandler;
|
|
35
168
|
producerInit?: ProducerInit;
|
|
36
169
|
producerFn?: ProducerFn;
|
|
37
170
|
exchangeInit?: ExchangeInit;
|
|
38
171
|
exchangeFn?: ExchangeFn;
|
|
39
|
-
headerSchema?:
|
|
172
|
+
headerSchema?: VgiSchema;
|
|
40
173
|
headerInit?: HeaderInit;
|
|
174
|
+
onCancel?: OnCancelFn;
|
|
41
175
|
doc?: string;
|
|
42
176
|
defaults?: Record<string, any>;
|
|
43
177
|
paramTypes?: Record<string, string>;
|
|
@@ -52,6 +186,36 @@ export interface DispatchInfo {
|
|
|
52
186
|
serverId: string;
|
|
53
187
|
/** Client-supplied request identifier, or null. */
|
|
54
188
|
requestId: string | null;
|
|
189
|
+
/** Coarse transport identifier — `pipe` for stdio, `http` for fetch
|
|
190
|
+
* handlers, `unix` for AF_UNIX. */
|
|
191
|
+
kind?: TransportKind;
|
|
192
|
+
/** Logical service / protocol name. */
|
|
193
|
+
protocol?: string;
|
|
194
|
+
/** SHA-256 hex of the canonical __describe__ payload (always required in access log). */
|
|
195
|
+
protocolHash?: string;
|
|
196
|
+
/** Operator-supplied protocol-contract version label (optional). */
|
|
197
|
+
protocolVersion?: string;
|
|
198
|
+
/** Authenticated principal, empty string when anonymous. */
|
|
199
|
+
principal?: string;
|
|
200
|
+
/** Authentication domain, empty string when anonymous. */
|
|
201
|
+
authDomain?: string;
|
|
202
|
+
/** True when the call was authenticated. */
|
|
203
|
+
authenticated?: boolean;
|
|
204
|
+
/** HTTP transport: remote IP:port. */
|
|
205
|
+
remoteAddr?: string;
|
|
206
|
+
/** Self-contained Arrow IPC stream of the request batch (unary + stream init only). */
|
|
207
|
+
requestData?: Uint8Array;
|
|
208
|
+
/** Stream lifecycle identifier (32-char lowercase hex); empty on unary. */
|
|
209
|
+
streamId?: string;
|
|
210
|
+
/** True when a stream was cancelled by the client. */
|
|
211
|
+
cancelled?: boolean;
|
|
212
|
+
/** Sticky session ID (24-char hex). Present only when the request was bound
|
|
213
|
+
* to a sticky session or the method opened/closed one. */
|
|
214
|
+
sessionId?: string;
|
|
215
|
+
/** Sticky-session lifecycle action observed during dispatch — one of
|
|
216
|
+
* `"none"` / `"resume"` / `"open"` / `"close"`. Omitted when sticky is
|
|
217
|
+
* disabled or the request never touched the sticky middleware. */
|
|
218
|
+
sessionAction?: "none" | "resume" | "open" | "close";
|
|
55
219
|
}
|
|
56
220
|
/** Per-call I/O counters, matching Python's CallStatistics. */
|
|
57
221
|
export interface CallStatistics {
|
|
@@ -73,7 +237,7 @@ export interface DispatchHook {
|
|
|
73
237
|
onDispatchEnd(token: HookToken, info: DispatchInfo, stats: CallStatistics, error?: Error): void;
|
|
74
238
|
}
|
|
75
239
|
export interface EmittedBatch {
|
|
76
|
-
batch:
|
|
240
|
+
batch: VgiBatch;
|
|
77
241
|
metadata?: Map<string, string>;
|
|
78
242
|
}
|
|
79
243
|
/**
|
|
@@ -88,13 +252,53 @@ export declare class OutputCollector implements CallContext {
|
|
|
88
252
|
private _outputSchema;
|
|
89
253
|
private _serverId;
|
|
90
254
|
private _requestId;
|
|
255
|
+
private _cookieSinkEnabled;
|
|
256
|
+
private _responseCookies;
|
|
257
|
+
private _stickyContext;
|
|
91
258
|
readonly auth: AuthContext;
|
|
92
|
-
|
|
93
|
-
|
|
259
|
+
readonly cookies: ReadonlyMap<string, string>;
|
|
260
|
+
readonly kind?: TransportKind;
|
|
261
|
+
readonly remainingResponseBytes?: number;
|
|
262
|
+
readonly remainingExternalizedResponseBytes?: number;
|
|
263
|
+
readonly externalizationEnabled?: boolean;
|
|
264
|
+
constructor(outputSchema: VgiSchema, producerMode?: boolean, serverId?: string, requestId?: string | null, authContext?: AuthContext, cookies?: ReadonlyMap<string, string>, kind?: TransportKind,
|
|
265
|
+
/** Snapshot budget fields exposed to worker code via {@link CallContext}.
|
|
266
|
+
* Optional — non-HTTP transports omit them and existing call sites
|
|
267
|
+
* remain source-compatible. */
|
|
268
|
+
budgets?: {
|
|
269
|
+
remainingResponseBytes?: number;
|
|
270
|
+
remainingExternalizedResponseBytes?: number;
|
|
271
|
+
externalizationEnabled?: boolean;
|
|
272
|
+
});
|
|
273
|
+
/**
|
|
274
|
+
* Mark this collector as able to accept Set-Cookie directives. Called
|
|
275
|
+
* by the unary HTTP dispatcher only; streaming and non-HTTP paths leave
|
|
276
|
+
* the sink disabled so setCookie/deleteCookie throw.
|
|
277
|
+
* @internal
|
|
278
|
+
*/
|
|
279
|
+
enableCookieSink(): void;
|
|
280
|
+
/**
|
|
281
|
+
* Return and clear all queued cookie mutations.
|
|
282
|
+
* @internal
|
|
283
|
+
*/
|
|
284
|
+
drainResponseCookies(): CookieSpec[];
|
|
285
|
+
setCookie(name: string, value: string, attrs?: CookieAttrs): void;
|
|
286
|
+
deleteCookie(name: string, opts?: {
|
|
287
|
+
path?: string;
|
|
288
|
+
domain?: string;
|
|
289
|
+
}): void;
|
|
290
|
+
/** Attach the sticky-session sink the HTTP handler built for this request.
|
|
291
|
+
* @internal */
|
|
292
|
+
attachStickyContext(ctx: StickyContext): void;
|
|
293
|
+
get session(): unknown | null;
|
|
294
|
+
get sessionId(): string | null;
|
|
295
|
+
openSession(state: unknown, ttl?: number): void;
|
|
296
|
+
closeSession(): void;
|
|
297
|
+
get outputSchema(): VgiSchema;
|
|
94
298
|
get finished(): boolean;
|
|
95
299
|
get batches(): EmittedBatch[];
|
|
96
|
-
/** Emit a pre-built
|
|
97
|
-
emit(batch:
|
|
300
|
+
/** Emit a pre-built batch as the data batch for this call. */
|
|
301
|
+
emit(batch: VgiBatch, metadata?: Map<string, string>): void;
|
|
98
302
|
/** Emit a data batch from column arrays keyed by field name. Int64 Number values are coerced to BigInt. */
|
|
99
303
|
emit(columns: Record<string, any[]>): void;
|
|
100
304
|
/** Single-row convenience. Wraps each value in `[value]` then calls `emit()`. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6B,KAAK,QAAQ,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAGxC,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED;;;;;;;;;;;;;GAaG;AACH,oBAAY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AI,OAAO,GAAG,IAAI,CAE5B;IAED,IAAI,SAAS,IAAI,MAAM,GAAG,IAAI,CAE7B;IAED,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI;IAmB/C,YAAY,IAAI,IAAI;IASpB,IAAI,YAAY,IAAI,SAAS,CAE5B;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,OAAO,IAAI,YAAY,EAAE,CAE5B;IAED,8DAA8D;IAC9D,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI;IAC3D,2GAA2G;IAC3G,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI;IAsB1C,iFAAiF;IACjF,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"}
|
package/dist/util/schema.d.ts
CHANGED
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
import { type
|
|
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:
|
|
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,
|
|
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"}
|
package/dist/util/zstd.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
4
|
-
|
|
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
|
package/dist/util/zstd.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zstd.d.ts","sourceRoot":"","sources":["../../src/util/zstd.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/wire/reader.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { VgiBatch, VgiSchema } from "../arrow/index.js";
|
|
2
2
|
export interface StreamMessage {
|
|
3
|
-
schema:
|
|
4
|
-
batches:
|
|
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<
|
|
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<
|
|
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":"
|
|
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"}
|
package/dist/wire/request.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type
|
|
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:
|
|
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:
|
|
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,
|
|
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"}
|
package/dist/wire/response.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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,
|
|
1
|
+
{"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../src/wire/response.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,mBAAmB,CAAC;AAU3B;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAc/F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,GACvB,QAAQ,CAqBV;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,QAAQ,CAmCrH;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,SAAS,EACjB,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,GACxB,QAAQ,CAeV;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,QAAQ,CAE3F"}
|