@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
@@ -9,6 +9,13 @@ interface PipeWritable {
9
9
  end(): void;
10
10
  }
11
11
  type WriteFn = (bytes: Uint8Array) => void;
12
+ /**
13
+ * {@link StreamSession} implementation for the pipe/subprocess transport.
14
+ * Drives lockstep streaming over a single bidirectional pipe: each
15
+ * {@link PipeStreamSession.exchange} or iteration step writes one input batch
16
+ * and reads one output batch. Holds the connection's single-threaded busy lock
17
+ * until closed.
18
+ */
12
19
  export declare class PipeStreamSession implements StreamSession {
13
20
  private _reader;
14
21
  private _writeFn;
@@ -32,6 +39,7 @@ export declare class PipeStreamSession implements StreamSession {
32
39
  setDrainPromise: (p: Promise<void>) => void;
33
40
  externalConfig?: ExternalLocationConfig;
34
41
  });
42
+ /** The stream's one-time header row, or `null` if the method declares no header. */
35
43
  get header(): Record<string, any> | null;
36
44
  /**
37
45
  * Read output batches from the server until a data batch is found.
@@ -58,9 +66,25 @@ export declare class PipeStreamSession implements StreamSession {
58
66
  * Iterate over producer stream batches (lockstep).
59
67
  */
60
68
  [Symbol.asyncIterator](): AsyncIterableIterator<Record<string, any>[]>;
69
+ /**
70
+ * End the stream: close the input side (or send an empty stream if nothing
71
+ * was sent yet) and drain the server's remaining output in the background,
72
+ * releasing the connection's busy lock once the drain completes.
73
+ */
61
74
  close(): void;
62
75
  }
76
+ /**
77
+ * Connect to a vgi-rpc server over a raw bidirectional pipe (a readable stream
78
+ * of server output plus a writable for client input). The connection is
79
+ * single-threaded: only one call or stream may be in flight at a time. The
80
+ * `__describe__` handshake is sent before the reader is opened to avoid deadlock.
81
+ */
63
82
  export declare function pipeConnect(readable: ReadableStream<Uint8Array>, writable: PipeWritable, options?: PipeConnectOptions): RpcClient;
83
+ /**
84
+ * Spawn a server process (via `Bun.spawn`) and connect to it over its
85
+ * stdin/stdout using {@link pipeConnect}. The returned client's
86
+ * {@link RpcClient.close} also kills the subprocess.
87
+ */
64
88
  export declare function subprocessConnect(cmd: string[], options?: SubprocessConnectOptions): RpcClient;
65
89
  export {};
66
90
  //# sourceMappingURL=pipe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../src/client/pipe.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,MAAM,EAGP,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,sBAAsB,EAAoD,MAAM,gBAAgB,CAAC;AAE/G,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAM1G,UAAU,YAAY;IACpB,KAAK,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,GAAG,IAAI,IAAI,CAAC;CACb;AAED,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;AA6C3C,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,OAAO,CAAkB;IACjC,OAAO,CAAC,QAAQ,CAAU;IAC1B,OAAO,CAAC,MAAM,CAAC,CAA4B;IAC3C,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,YAAY,CAAsC;IAC1D,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,YAAY,CAAa;IACjC,OAAO,CAAC,gBAAgB,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C;QACrB,WAAW,EAAE,MAAM,IAAI,CAAC;QACxB,eAAe,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC;QAC5C,cAAc,CAAC,EAAE,sBAAsB,CAAC;KACzC;IAWD,oFAAoF;IACpF,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAEvC;IAED;;;;OAIG;YACW,gBAAgB;IAqB9B;;;;;OAKG;YACW,mBAAmB;IASjC;;OAEG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAsG5E;;OAEG;YACW,QAAQ;IAiBtB;;OAEG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;IAqD7E;;;;OAIG;IACH,KAAK,IAAI,IAAI;CAoCd;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,EACpC,QAAQ,EAAE,YAAY,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,SAAS,CAqOX;AAMD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAwC9F"}
@@ -1,8 +1,20 @@
1
1
  import { RecordBatch, Schema } from "@query-farm/apache-arrow";
2
2
  import { type ExternalLocationConfig } from "../external.js";
3
3
  import type { LogMessage, StreamSession } from "./types.js";
4
- type CompressFn = (data: Uint8Array, level: number) => Uint8Array;
5
- type DecompressFn = (data: Uint8Array) => Uint8Array;
4
+ type CompressFn = (data: Uint8Array, level: number) => Promise<Uint8Array>;
5
+ type DecompressFn = (data: Uint8Array) => Promise<Uint8Array>;
6
+ /**
7
+ * Posts an Arrow IPC request body to *url*, transparently handling
8
+ * client-vended request externalization. Provided by the parent connection
9
+ * so a single capability cache can drive both unary and stream call paths.
10
+ */
11
+ export type PostFn = (url: string, body: Uint8Array) => Promise<Response>;
12
+ /**
13
+ * {@link StreamSession} implementation for the HTTP transport. Stream state is
14
+ * carried statelessly across requests via an HMAC state token: each
15
+ * {@link HttpStreamSession.exchange} or producer-continuation POST sends the
16
+ * current token and receives the next one in the response metadata.
17
+ */
6
18
  export declare class HttpStreamSession implements StreamSession {
7
19
  private _baseUrl;
8
20
  private _prefix;
@@ -19,6 +31,7 @@ export declare class HttpStreamSession implements StreamSession {
19
31
  private _decompressFn?;
20
32
  private _authorization?;
21
33
  private _externalConfig?;
34
+ private _postFn?;
22
35
  constructor(opts: {
23
36
  baseUrl: string;
24
37
  prefix: string;
@@ -35,7 +48,10 @@ export declare class HttpStreamSession implements StreamSession {
35
48
  decompressFn?: DecompressFn;
36
49
  authorization?: string;
37
50
  externalConfig?: ExternalLocationConfig;
51
+ postFn?: PostFn;
38
52
  });
53
+ private _post;
54
+ /** The stream's one-time header row, or `null` if the method declares no header. */
39
55
  get header(): Record<string, any> | null;
40
56
  private _buildHeaders;
41
57
  private _prepareBody;
@@ -51,6 +67,7 @@ export declare class HttpStreamSession implements StreamSession {
51
67
  */
52
68
  [Symbol.asyncIterator](): AsyncIterableIterator<Record<string, any>[]>;
53
69
  private _sendContinuation;
70
+ /** No-op: the HTTP transport is stateless, so there is nothing to tear down. */
54
71
  close(): void;
55
72
  }
56
73
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/client/stream.ts"],"names":[],"mappings":"AAGA,OAAO,EAAmB,WAAW,EAAE,MAAM,EAA2B,MAAM,0BAA0B,CAAC;AAGzG,OAAO,EAAE,KAAK,sBAAsB,EAAoD,MAAM,gBAAgB,CAAC;AAG/G,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MA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B,oFAAoF;IACpF,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAEvC;IAED,OAAO,CAAC,aAAa;YAgBP,YAAY;YAOZ,aAAa;IAQ3B;;OAEG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YA0D9D,WAAW;IAmCzB,OAAO,CAAC,gBAAgB;IAcxB;;OAEG;IACI,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;YAoD/D,iBAAiB;IAuB/B,gFAAgF;IAChF,KAAK,IAAI,IAAI;CAGd"}
@@ -1,31 +1,54 @@
1
+ /** Options for {@link httpConnect}, the HTTP-transport RPC client. */
1
2
  export interface HttpConnectOptions {
3
+ /** Route prefix the server mounts its methods under (e.g. `/api`). Trailing slashes are stripped. Defaults to no prefix. */
2
4
  prefix?: string;
5
+ /** Callback invoked for each log/error message the server emits during a request. */
3
6
  onLog?: (msg: LogMessage) => void;
7
+ /** When set, request bodies are zstd-compressed at this level and `Accept-Encoding: zstd` is sent. Omit to disable compression. */
4
8
  compressionLevel?: number;
5
9
  /** Authorization header value (e.g. "Bearer <token>"). Sent with every request. */
6
10
  authorization?: string;
7
11
  /** External storage config for resolving externalized batches. */
8
12
  externalLocation?: import("../external.js").ExternalLocationConfig;
9
13
  }
14
+ /** A log or error message delivered to an {@link HttpConnectOptions.onLog} callback. */
10
15
  export interface LogMessage {
16
+ /** Severity, mirroring the server's log level (e.g. `INFO`, `WARNING`, `EXCEPTION`). */
11
17
  level: string;
18
+ /** The human-readable log text. */
12
19
  message: string;
20
+ /** Optional structured fields attached to the log record. */
13
21
  extra?: Record<string, any>;
14
22
  }
23
+ /**
24
+ * A live streaming method call. Exchange methods drive the server with
25
+ * {@link StreamSession.exchange}; producer methods are consumed by async
26
+ * iteration. Always {@link StreamSession.close} when done.
27
+ */
15
28
  export interface StreamSession {
29
+ /** The method's header row (returned once at stream start), or `null` if the method declares no header. */
16
30
  readonly header: Record<string, any> | null;
31
+ /** Send one batch of input rows and receive the server's corresponding output rows (exchange streams). */
17
32
  exchange(input: Record<string, any>[]): Promise<Record<string, any>[]>;
33
+ /** Iterate the server-produced output batches one row-array at a time (producer streams). */
18
34
  [Symbol.asyncIterator](): AsyncIterableIterator<Record<string, any>[]>;
35
+ /** Tear down the stream, flushing/draining the underlying transport. */
19
36
  close(): void;
20
37
  }
38
+ /** Options for {@link pipeConnect}, the client over raw readable/writable streams. */
21
39
  export interface PipeConnectOptions {
40
+ /** Callback invoked for each log/error message the server emits during a request. */
22
41
  onLog?: (msg: LogMessage) => void;
23
42
  /** External storage config for resolving externalized batches. */
24
43
  externalLocation?: import("../external.js").ExternalLocationConfig;
25
44
  }
45
+ /** Options for {@link subprocessConnect}, which spawns a server process and pipes to it. */
26
46
  export interface SubprocessConnectOptions extends PipeConnectOptions {
47
+ /** Working directory for the spawned process. Defaults to the current directory. */
27
48
  cwd?: string;
49
+ /** Extra environment variables, merged over the current `process.env`. */
28
50
  env?: Record<string, string>;
51
+ /** How to handle the child's stderr. Defaults to `"ignore"`. */
29
52
  stderr?: "inherit" | "pipe" | "ignore";
30
53
  }
31
54
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mFAAmF;IACnF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,OAA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M,EAAE,MAAM,CAAC,CAAC;IAC7B,gEAAgE;IAChE,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;CACxC"}
@@ -0,0 +1,25 @@
1
+ export interface UploadUrlPair {
2
+ uploadUrl: string;
3
+ downloadUrl: string;
4
+ expiresAt: Date;
5
+ }
6
+ /**
7
+ * POST `__upload_url__/init` and return the requested number of pre-signed
8
+ * URL pairs. Server must have an `uploadUrlProvider` configured; otherwise
9
+ * the route returns 404 and we surface that as `RpcError("NotSupported")`.
10
+ */
11
+ export declare function requestUploadUrls(baseUrl: string, prefix: string, count: number, authorization?: string): Promise<UploadUrlPair[]>;
12
+ export interface ExternalizeOptions {
13
+ baseUrl: string;
14
+ prefix: string;
15
+ authorization?: string;
16
+ /** Optional per-URL validator; throw to reject. */
17
+ urlValidator?: ((url: string) => void) | null;
18
+ }
19
+ /**
20
+ * Upload *body* via a server-vended URL and return the pointer-batch body
21
+ * that should be sent in place of the original. Throws if the server does
22
+ * not advertise upload-URL support or the upload fails.
23
+ */
24
+ export declare function externalizeRequestBody(body: Uint8Array, opts: ExternalizeOptions): Promise<Uint8Array>;
25
+ //# sourceMappingURL=uploadUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadUrl.d.ts","sourceRoot":"","sources":["../../src/client/uploadUrl.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,aAAa,EAAE,CAAC,CAkD1B;AA4CD,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;CAC/C;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CAmB5G"}
@@ -1,17 +1,45 @@
1
- /** Well-known metadata keys matching Python's metadata.py */
1
+ /** Batch-metadata key carrying the invoked RPC method name. */
2
2
  export declare const RPC_METHOD_KEY = "vgi_rpc.method";
3
+ /** Batch-metadata key carrying a log batch's severity level. */
3
4
  export declare const LOG_LEVEL_KEY = "vgi_rpc.log_level";
5
+ /** Batch-metadata key carrying a log batch's message text. */
4
6
  export declare const LOG_MESSAGE_KEY = "vgi_rpc.log_message";
7
+ /** Batch-metadata key carrying a log batch's structured extra fields. */
5
8
  export declare const LOG_EXTRA_KEY = "vgi_rpc.log_extra";
9
+ /** Batch-metadata key carrying the wire request-framing version. */
6
10
  export declare const REQUEST_VERSION_KEY = "vgi_rpc.request_version";
11
+ /** Current wire request-framing version. Distinct from the application-level
12
+ * {@link PROTOCOL_VERSION_KEY protocol version}. */
7
13
  export declare const REQUEST_VERSION = "1";
14
+ /** Batch-metadata key identifying the server instance that produced a batch. */
8
15
  export declare const SERVER_ID_KEY = "vgi_rpc.server_id";
16
+ /** Batch-metadata key carrying the client-supplied request id. */
9
17
  export declare const REQUEST_ID_KEY = "vgi_rpc.request_id";
18
+ /** Batch-metadata key carrying the service / protocol name. */
10
19
  export declare const PROTOCOL_NAME_KEY = "vgi_rpc.protocol_name";
20
+ /** Batch-metadata key carrying the `__describe__` response schema version. */
11
21
  export declare const DESCRIBE_VERSION_KEY = "vgi_rpc.describe_version";
12
- export declare const DESCRIBE_VERSION = "3";
22
+ export declare const PROTOCOL_HASH_KEY = "vgi_rpc.protocol_hash";
23
+ /** Current `__describe__` response schema version (the slim 8-column schema). */
24
+ export declare const DESCRIBE_VERSION = "4";
25
+ /** Application protocol surface version. Carried on every request batch from
26
+ * a client bound to a Protocol that declares `protocolVersion`; also emitted
27
+ * in the __describe__ response metadata. Format: canonical semver
28
+ * MAJOR.MINOR.PATCH. Enforced at the dispatch boundary on the server: exact
29
+ * major+minor match required, patch ignored. Distinct from `REQUEST_VERSION`
30
+ * (wire framing). Mirrors Python's `PROTOCOL_VERSION_KEY`. */
31
+ export declare const PROTOCOL_VERSION_KEY = "vgi_rpc.protocol_version";
32
+ /** Reserved method name for the introspection (`__describe__`) call. */
13
33
  export declare const DESCRIBE_METHOD_NAME = "__describe__";
34
+ /** Batch-metadata key carrying the base64-encoded stream continuation/state token. */
14
35
  export declare const STATE_KEY = "vgi_rpc.stream_state#b64";
36
+ export declare const CANCEL_KEY = "vgi_rpc.cancel";
15
37
  export declare const LOCATION_KEY = "vgi_rpc.location";
16
38
  export declare const LOCATION_SHA256_KEY = "vgi_rpc.location.sha256";
39
+ /** HTTP response header set when an RPC error is returned over the HTTP transport. */
40
+ export declare const RPC_ERROR_HEADER = "X-VGI-RPC-Error";
41
+ /** Top-level metadata key on an EXCEPTION batch identifying the error category.
42
+ * Hoisted by `buildErrorBatch` when the thrown error has a static or instance
43
+ * `errorKind` property. Mirrors Python's `vgi_rpc.metadata.ERROR_KIND_KEY`. */
44
+ export declare const ERROR_KIND_KEY = "vgi_rpc.error_kind";
17
45
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,6DAA6D;AAE7D,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAC/C,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAC7D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AAsF;AACtF,eAAO,MAAM,SAAS,6BAA6B,CAAC;AACpD,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAE3C,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAElD;;gFAEgF;AAChF,eAAO,MAAM,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /** Thrown by {@link openBytes} for any envelope it cannot open — malformed,
2
+ * tampered, wrong key, wrong AAD, wrong version, truncated, all surface the
3
+ * same way so callers cannot distinguish failure modes via error content. */
4
+ export declare class SealError extends Error {
5
+ constructor(message: string);
6
+ }
7
+ /** Normalise a key to 32 bytes by SHA-256 hashing when it isn't already 32B.
8
+ * Mirrors Python's `normalize_key` so any callers can pass operator-provided
9
+ * keys of arbitrary length without a separate stretching step. */
10
+ export declare function normalizeKey(key: Uint8Array): Promise<Uint8Array>;
11
+ export interface SealOptions {
12
+ /** Associated data bound at the crypto layer — typically a principal or
13
+ * request-scoped identifier. Must match between seal and open. */
14
+ aad: Uint8Array;
15
+ /** Envelope version byte. Defaults to 1; carry through to {@link openBytes}. */
16
+ version?: number;
17
+ }
18
+ /** Seal `plaintext` under `key` with AEAD, returning the wire envelope. */
19
+ export declare function sealBytes(plaintext: Uint8Array, key: Uint8Array, opts: SealOptions): Uint8Array;
20
+ /** Open and verify an envelope produced by {@link sealBytes}. */
21
+ export declare function openBytes(envelope: Uint8Array, key: Uint8Array, opts: SealOptions): Uint8Array;
22
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AA8BA;;8EAE8E;AAC9E,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED;;mEAEmE;AACnE,wBAAsB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAIvE;AAED,MAAM,WAAW,WAAW;IAC1B;uEACmE;IACnE,GAAG,EAAE,UAAU,CAAC;IAChB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAe/F;AAED,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,CAkB9F"}
@@ -1,14 +1,18 @@
1
- import { RecordBatch, Schema } from "@query-farm/apache-arrow";
1
+ import { type VgiBatch } from "../arrow/index.js";
2
2
  import type { MethodDefinition } from "../types.js";
3
3
  /**
4
- * The schema for the __describe__ response, matching Python's _DESCRIBE_SCHEMA.
4
+ * Slim DESCRIBE_VERSION 4 schema. Python-flavoured fields (doc,
5
+ * param_types_json, param_defaults_json, param_docs_json) are not on the
6
+ * wire — Arrow IPC schema bytes are the authoritative type information;
7
+ * everything else is source-level metadata that callers should consult the
8
+ * Protocol class for.
5
9
  */
6
- export declare const DESCRIBE_SCHEMA: Schema<any>;
10
+ export declare const DESCRIBE_SCHEMA: import("../arrow/types.js").VgiSchema;
7
11
  /**
8
12
  * Build the __describe__ response batch and metadata.
9
13
  */
10
- export declare function buildDescribeBatch(protocolName: string, methods: Map<string, MethodDefinition>, serverId: string): {
11
- batch: RecordBatch;
14
+ export declare function buildDescribeBatch(protocolName: string, methods: Map<string, MethodDefinition>, serverId: string, protocolVersion?: string): Promise<{
15
+ batch: VgiBatch;
12
16
  metadata: Map<string, string>;
13
- };
17
+ }>;
14
18
  //# sourceMappingURL=describe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/dispatch/describe.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,WAAW,EACX,MAAM,EAIP,MAAM,0BAA0B,CAAC;AASlC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD;;GAEG;AACH,eAAO,MAAM,eAAe,aAa1B,CAAC;AAEH;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACtC,QAAQ,EAAE,MAAM,GACf;IAAE,KAAK,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAgHvD"}
1
+ {"version":3,"file":"describe.d.ts","sourceRoot":"","sources":["../../src/dispatch/describe.ts"],"names":[],"mappings":"AAGA,OAAO,EAOL,KAAK,QAAQ,EAEd,MAAM,mBAAmB,CAAC;AAW3B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAIpD;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,uCAS1B,CAAC;AAkEH;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACtC,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAoF7D"}
@@ -1,5 +1,5 @@
1
1
  import { type ExternalLocationConfig } from "../external.js";
2
- import type { MethodDefinition } from "../types.js";
2
+ import type { MethodDefinition, TransportKind } from "../types.js";
3
3
  import type { IpcStreamReader } from "../wire/reader.js";
4
4
  import type { IpcStreamWriter } from "../wire/writer.js";
5
5
  /**
@@ -17,5 +17,5 @@ import type { IpcStreamWriter } from "../wire/writer.js";
17
17
  * - Server writes output batch(es) for each input
18
18
  * - Stream ends when client closes input (EOS)
19
19
  */
20
- export declare function dispatchStream(method: MethodDefinition, params: Record<string, any>, writer: IpcStreamWriter, reader: IpcStreamReader, serverId: string, requestId: string | null, externalConfig?: ExternalLocationConfig): Promise<void>;
20
+ export declare function dispatchStream(method: MethodDefinition, params: Record<string, any>, writer: IpcStreamWriter, reader: IpcStreamReader, serverId: string, requestId: string | null, externalConfig?: ExternalLocationConfig, kind?: TransportKind): Promise<void>;
21
21
  //# sourceMappingURL=stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/dispatch/stream.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAyB,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,CAAC,EAAE,sBAAsB,GACtC,OAAO,CAAC,IAAI,CAAC,CA8Hf"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/dispatch/stream.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,sBAAsB,EAAyB,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,CAAC,EAAE,sBAAsB,EACvC,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,IAAI,CAAC,CA0Jf"}
@@ -1,10 +1,10 @@
1
1
  import { type ExternalLocationConfig } from "../external.js";
2
- import type { MethodDefinition } from "../types.js";
2
+ import type { MethodDefinition, TransportKind } from "../types.js";
3
3
  import type { IpcStreamWriter } from "../wire/writer.js";
4
4
  /**
5
5
  * Dispatch a unary RPC call.
6
6
  * Calls the handler with parsed params, writes result or error batch.
7
7
  * Supports client-directed logging via ctx.clientLog().
8
8
  */
9
- export declare function dispatchUnary(method: MethodDefinition, params: Record<string, any>, writer: IpcStreamWriter, serverId: string, requestId: string | null, externalConfig?: ExternalLocationConfig): Promise<void>;
9
+ export declare function dispatchUnary(method: MethodDefinition, params: Record<string, any>, writer: IpcStreamWriter, serverId: string, requestId: string | null, externalConfig?: ExternalLocationConfig, kind?: TransportKind): Promise<void>;
10
10
  //# sourceMappingURL=unary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unary.d.ts","sourceRoot":"","sources":["../../src/dispatch/unary.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,sBAAsB,EAAyB,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,CAAC,EAAE,sBAAsB,GACtC,OAAO,CAAC,IAAI,CAAC,CAiBf"}
1
+ {"version":3,"file":"unary.d.ts","sourceRoot":"","sources":["../../src/dispatch/unary.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,sBAAsB,EAAyB,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEzD;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,gBAAgB,EACxB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,cAAc,CAAC,EAAE,sBAAsB,EACvC,IAAI,CAAC,EAAE,aAAa,GACnB,OAAO,CAAC,IAAI,CAAC,CAiBf"}
package/dist/errors.d.ts CHANGED
@@ -1,12 +1,75 @@
1
1
  /** Error thrown when the server encounters an RPC protocol error. */
2
2
  export declare class RpcError extends Error {
3
+ /** Remote error class name (e.g. `"ValueError"`). */
3
4
  readonly errorType: string;
5
+ /** Human-readable message from the remote error. */
4
6
  readonly errorMessage: string;
7
+ /** Remote stack-trace text, or an empty string when unavailable. */
5
8
  readonly remoteTraceback: string;
6
- constructor(errorType: string, errorMessage: string, remoteTraceback: string);
9
+ constructor(
10
+ /** Remote error class name (e.g. `"ValueError"`). */
11
+ errorType: string,
12
+ /** Human-readable message from the remote error. */
13
+ errorMessage: string,
14
+ /** Remote stack-trace text, or an empty string when unavailable. */
15
+ remoteTraceback: string);
7
16
  }
8
17
  /** Error thrown when the client sends an unsupported request version. */
9
18
  export declare class VersionError extends Error {
10
19
  constructor(message: string);
11
20
  }
21
+ /** `vgi_rpc.error_kind` batch-metadata value for {@link MethodNotImplementedError}.
22
+ * Mirrors Python's `vgi_rpc.metadata.ERROR_KIND_*` constants. */
23
+ export declare const ERROR_KIND_METHOD_NOT_IMPLEMENTED = "method_not_implemented";
24
+ /** `vgi_rpc.error_kind` batch-metadata value for {@link SessionLostError}. */
25
+ export declare const ERROR_KIND_SESSION_LOST = "session_lost";
26
+ /** `vgi_rpc.error_kind` batch-metadata value for {@link ServerDrainingError}. */
27
+ export declare const ERROR_KIND_SERVER_DRAINING = "server_draining";
28
+ export declare const ERROR_KIND_PROTOCOL_VERSION_MISMATCH = "protocol_version_mismatch";
29
+ /** Raised when the client's declared `vgi_rpc.protocol_version` is
30
+ * incompatible with the server's. Subclass of `VersionError` so existing
31
+ * catch sites continue to write a typed error stream and keep serving.
32
+ * Carries a directional message that tells the reader which side to
33
+ * upgrade. Mirrors Python's `vgi_rpc.rpc.ProtocolVersionError`. */
34
+ export declare class ProtocolVersionError extends VersionError {
35
+ static readonly errorKind = "protocol_version_mismatch";
36
+ readonly errorKind = "protocol_version_mismatch";
37
+ constructor(message: string);
38
+ }
39
+ /** Parse a canonical semver string into `[major, minor, patch]`. Throws on
40
+ * any input that isn't `MAJOR.MINOR.PATCH` with non-negative integers and
41
+ * no leading zeros (except literal `0`). No prereleases, no build metadata.
42
+ * Mirrors Python's `vgi_rpc.metadata.parse_version`. */
43
+ export declare function parseProtocolVersion(value: string): [number, number, number];
44
+ /** Raised when a client invokes a method the server does not implement.
45
+ *
46
+ * Mirrors Python's `vgi_rpc.rpc.MethodNotImplementedError`. The static
47
+ * `errorKind` is hoisted onto the error batch metadata as
48
+ * `vgi_rpc.error_kind` so clients can branch on the typed marker without
49
+ * string-matching the message.
50
+ */
51
+ export declare class MethodNotImplementedError extends Error {
52
+ /** Typed `vgi_rpc.error_kind` marker for this error class. */
53
+ static readonly errorKind = "method_not_implemented";
54
+ /** Typed `vgi_rpc.error_kind` marker hoisted onto the error batch metadata. */
55
+ readonly errorKind = "method_not_implemented";
56
+ constructor(message: string);
57
+ }
58
+ /** Raised when a sticky session token is malformed, expired, evicted, or
59
+ * bound to a different worker / principal. HTTP-only. */
60
+ export declare class SessionLostError extends Error {
61
+ /** Typed `vgi_rpc.error_kind` marker for this error class. */
62
+ static readonly errorKind = "session_lost";
63
+ /** Typed `vgi_rpc.error_kind` marker hoisted onto the error batch metadata. */
64
+ readonly errorKind = "session_lost";
65
+ constructor(message: string);
66
+ }
67
+ /** Raised when `ctx.openSession` is called while the server is draining. */
68
+ export declare class ServerDrainingError extends Error {
69
+ /** Typed `vgi_rpc.error_kind` marker for this error class. */
70
+ static readonly errorKind = "server_draining";
71
+ /** Typed `vgi_rpc.error_kind` marker hoisted onto the error batch metadata. */
72
+ readonly errorKind = "server_draining";
73
+ constructor(message: string);
74
+ }
12
75
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,qBAAa,QAAS,SAAQ,KAAK;aAEf,SAAS,EAAE,MAAM;aACjB,YAAY,EAAE,MAAM;aACpB,eAAe,EAAE,MAAM;gBAFvB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM;CAK1C;AAED,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;CAI5B"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAGA,qEAAqE;AACrE,qBAAa,QAAS,SAAQ,KAAK;IAE/B,qDAAqD;aACrC,SAAS,EAAE,MAAM;IACjC,oDAAoD;aACpC,YAAY,EAAE,MAAM;IACpC,oEAAoE;aACpD,eAAe,EAAE,MAAM;;IALvC,qDAAqD;IAC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C,OAAO,EAAE,MAAM;CAI5B"}
@@ -6,12 +6,32 @@
6
6
  * The batch is replaced with a zero-row "pointer batch" containing the
7
7
  * download URL and SHA-256 checksum in metadata.
8
8
  */
9
- import { type RecordBatch, type Schema } from "@query-farm/apache-arrow";
9
+ import { type VgiBatch, type VgiSchema } from "./arrow/index.js";
10
10
  /** Pluggable storage backend for uploading large batches. */
11
11
  export interface ExternalStorage {
12
12
  /** Upload IPC data and return a URL for retrieval. */
13
13
  upload(data: Uint8Array, contentEncoding: string): Promise<string>;
14
14
  }
15
+ /** A pre-signed PUT/GET URL pair for client-side data upload. */
16
+ export interface UploadUrl {
17
+ /** Pre-signed PUT URL the client uploads to. */
18
+ uploadUrl: string;
19
+ /** Pre-signed GET URL the server fetches from. */
20
+ downloadUrl: string;
21
+ /** Expiration time (UTC) for the URL pair. */
22
+ expiresAt: Date;
23
+ }
24
+ /**
25
+ * Generates pre-signed upload URL pairs for client-vended externalization.
26
+ *
27
+ * Implementations must be safe to call from multiple concurrent requests.
28
+ * Object lifecycle is the operator's responsibility — uploaded objects are
29
+ * not automatically deleted by vgi-rpc.
30
+ */
31
+ export interface UploadUrlProvider {
32
+ /** Allocate one upload/download URL pair. */
33
+ generateUploadUrl(): Promise<UploadUrl> | UploadUrl;
34
+ }
15
35
  /** Configuration for external storage of large batches. */
16
36
  export interface ExternalLocationConfig {
17
37
  /** Storage backend for uploading. */
@@ -20,7 +40,9 @@ export interface ExternalLocationConfig {
20
40
  externalizeThresholdBytes?: number;
21
41
  /** Optional zstd compression for uploaded data. */
22
42
  compression?: {
43
+ /** Compression algorithm; only `"zstd"` is currently supported. */
23
44
  algorithm: "zstd";
45
+ /** zstd compression level. Default: 3. */
24
46
  level?: number;
25
47
  };
26
48
  /** URL validator called before fetching. Throw to reject. Default: HTTPS-only. */
@@ -29,17 +51,17 @@ export interface ExternalLocationConfig {
29
51
  /** Default validator that rejects non-HTTPS URLs. */
30
52
  export declare function httpsOnlyValidator(url: string): void;
31
53
  /** Returns true if the batch is a zero-row pointer to external data. */
32
- export declare function isExternalLocationBatch(batch: RecordBatch): boolean;
54
+ export declare function isExternalLocationBatch(batch: VgiBatch): boolean;
33
55
  /** Create a zero-row pointer batch with location URL and optional SHA-256. */
34
- export declare function makeExternalLocationBatch(schema: Schema, url: string, sha256?: string): RecordBatch;
56
+ export declare function makeExternalLocationBatch(schema: VgiSchema, url: string, sha256?: string): VgiBatch;
35
57
  /**
36
58
  * Maybe externalize a batch if it exceeds the threshold.
37
59
  * Returns the original batch unchanged if below threshold or no config.
38
60
  */
39
- export declare function maybeExternalizeBatch(batch: RecordBatch, config?: ExternalLocationConfig | null): Promise<RecordBatch>;
61
+ export declare function maybeExternalizeBatch(batch: VgiBatch, config?: ExternalLocationConfig | null): Promise<VgiBatch>;
40
62
  /**
41
63
  * Resolve an external pointer batch by fetching the data from the URL.
42
64
  * Returns the original batch unchanged if not a pointer or no config.
43
65
  */
44
- export declare function resolveExternalLocation(batch: RecordBatch, config?: ExternalLocationConfig | null): Promise<RecordBatch>;
66
+ export declare function resolveExternalLocation(batch: VgiBatch, config?: ExternalLocationConfig | null): Promise<VgiBatch>;
45
67
  //# sourceMappingURL=external.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../src/external.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,WAAW,EAA8C,KAAK,MAAM,EAAE,MAAM,0BAA0B,CAAC;AASrH,6DAA6D;AAC7D,MAAM,WAAW,eAAe;IAC9B,sDAAsD;IACtD,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpE;AAED,2DAA2D;AAC3D,MAAM,WAAW,sBAAsB;IACrC,qCAAqC;IACrC,OAAO,EAAE,eAAe,CAAC;IACzB,wEAAwE;IACxE,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,mDAAmD;IACnD,WA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ateFn = (request: Request) => AuthContext | Promise<AuthContext>;
4
4
  /** RFC 9728 OAuth Protected Resource Metadata. */
5
5
  export interface OAuthResourceMetadata {
6
+ /** The protected resource's canonical URL. Doubles as the base for the
7
+ * `/_oauth/callback` redirect URI. */
6
8
  resource: string;
9
+ /** Authorization-server issuer URLs. The PKCE flow uses
10
+ * `authorizationServers[0]` for OIDC discovery. */
7
11
  authorizationServers: string[];
12
+ /** Scopes the resource advertises. When non-empty these become the PKCE
13
+ * authorization request's space-joined `scope`, taking precedence over
14
+ * {@link HttpHandlerOptions.oauthPkceScope}. */
8
15
  scopesSupported?: string[];
16
+ /** Advertised bearer methods (e.g. `["header"]`). */
9
17
  bearerMethodsSupported?: string[];
18
+ /** JWS algorithms the resource accepts. */
10
19
  resourceSigningAlgValuesSupported?: string[];
20
+ /** Human-readable resource name. */
11
21
  resourceName?: string;
22
+ /** Documentation URL for the resource. */
12
23
  resourceDocumentation?: string;
24
+ /** Policy URL for the resource. */
13
25
  resourcePolicyUri?: string;
26
+ /** Terms-of-service URL for the resource. */
14
27
  resourceTosUri?: string;
15
28
  /** OAuth client_id that clients should use with the authorization server. */
16
29
  clientId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/http/auth.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEtF,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,iCAAiC,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7C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