@query-farm/vgi-rpc 0.2.4 → 0.3.2
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/README.md +3 -3
- package/dist/client/connect.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/introspect.d.ts +1 -1
- package/dist/client/introspect.d.ts.map +1 -1
- package/dist/client/ipc.d.ts +1 -1
- package/dist/client/ipc.d.ts.map +1 -1
- package/dist/client/pipe.d.ts +2 -2
- package/dist/client/pipe.d.ts.map +1 -1
- package/dist/client/stream.d.ts +1 -1
- package/dist/client/stream.d.ts.map +1 -1
- package/dist/dispatch/describe.d.ts +1 -1
- package/dist/dispatch/describe.d.ts.map +1 -1
- package/dist/dispatch/stream.d.ts +1 -1
- package/dist/dispatch/stream.d.ts.map +1 -1
- package/dist/dispatch/unary.d.ts.map +1 -1
- package/dist/http/common.d.ts +1 -1
- package/dist/http/common.d.ts.map +1 -1
- package/dist/http/dispatch.d.ts.map +1 -1
- package/dist/http/handler.d.ts.map +1 -1
- package/dist/http/index.d.ts +3 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/token.d.ts.map +1 -1
- package/dist/http/types.d.ts.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2162 -2119
- package/dist/index.js.map +26 -26
- package/dist/protocol.d.ts +1 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/util/schema.d.ts +1 -1
- package/dist/util/schema.d.ts.map +1 -1
- package/dist/util/zstd.d.ts.map +1 -1
- package/dist/wire/reader.d.ts +1 -1
- package/dist/wire/reader.d.ts.map +1 -1
- package/dist/wire/request.d.ts +1 -1
- package/dist/wire/request.d.ts.map +1 -1
- package/dist/wire/response.d.ts +1 -1
- package/dist/wire/response.d.ts.map +1 -1
- package/dist/wire/writer.d.ts +1 -1
- package/dist/wire/writer.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/client/connect.ts +12 -20
- package/src/client/index.ts +8 -8
- package/src/client/introspect.ts +11 -15
- package/src/client/ipc.ts +18 -32
- package/src/client/pipe.ts +17 -37
- package/src/client/stream.ts +20 -46
- package/src/dispatch/describe.ts +15 -27
- package/src/dispatch/stream.ts +7 -21
- package/src/dispatch/unary.ts +1 -2
- package/src/http/common.ts +9 -19
- package/src/http/dispatch.ts +115 -110
- package/src/http/handler.ts +20 -55
- package/src/http/index.ts +3 -1
- package/src/http/token.ts +2 -7
- package/src/http/types.ts +2 -6
- package/src/index.ts +44 -41
- package/src/protocol.ts +8 -8
- package/src/schema.ts +12 -16
- package/src/server.ts +16 -36
- package/src/types.ts +9 -36
- package/src/util/schema.ts +1 -1
- package/src/util/zstd.ts +2 -8
- package/src/wire/reader.ts +2 -4
- package/src/wire/request.ts +4 -15
- package/src/wire/response.ts +9 -25
- package/src/wire/writer.ts +1 -5
package/src/wire/response.ts
CHANGED
|
@@ -2,22 +2,16 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
RecordBatch,
|
|
6
|
-
Schema,
|
|
7
|
-
Field,
|
|
8
5
|
Data,
|
|
9
6
|
DataType,
|
|
7
|
+
type Field,
|
|
10
8
|
makeData,
|
|
9
|
+
RecordBatch,
|
|
10
|
+
type Schema,
|
|
11
11
|
Struct,
|
|
12
12
|
vectorFromArray,
|
|
13
|
-
} from "apache-arrow";
|
|
14
|
-
import {
|
|
15
|
-
LOG_LEVEL_KEY,
|
|
16
|
-
LOG_MESSAGE_KEY,
|
|
17
|
-
LOG_EXTRA_KEY,
|
|
18
|
-
SERVER_ID_KEY,
|
|
19
|
-
REQUEST_ID_KEY,
|
|
20
|
-
} from "../constants.js";
|
|
13
|
+
} from "@query-farm/apache-arrow";
|
|
14
|
+
import { LOG_EXTRA_KEY, LOG_LEVEL_KEY, LOG_MESSAGE_KEY, REQUEST_ID_KEY, SERVER_ID_KEY } from "../constants.js";
|
|
21
15
|
|
|
22
16
|
/**
|
|
23
17
|
* Coerce values for Int64 schema fields from Number to BigInt.
|
|
@@ -63,16 +57,14 @@ export function buildResultBatch(
|
|
|
63
57
|
for (const field of schema.fields) {
|
|
64
58
|
if (values[field.name] === undefined && !field.nullable) {
|
|
65
59
|
const got = Object.keys(values);
|
|
66
|
-
throw new TypeError(
|
|
67
|
-
`Handler result missing required field '${field.name}'. Got keys: [${got.join(", ")}]`,
|
|
68
|
-
);
|
|
60
|
+
throw new TypeError(`Handler result missing required field '${field.name}'. Got keys: [${got.join(", ")}]`);
|
|
69
61
|
}
|
|
70
62
|
}
|
|
71
63
|
|
|
72
64
|
const coerced = coerceInt64(schema, values);
|
|
73
65
|
|
|
74
66
|
const children = schema.fields.map((f: Field) => {
|
|
75
|
-
|
|
67
|
+
const val = coerced[f.name];
|
|
76
68
|
// Raw Data passthrough for Map_ types (whose .get() is broken in arrow-js)
|
|
77
69
|
if (val instanceof Data) {
|
|
78
70
|
return val;
|
|
@@ -95,12 +87,7 @@ export function buildResultBatch(
|
|
|
95
87
|
/**
|
|
96
88
|
* Build a 0-row error batch with EXCEPTION metadata matching Python's Message.from_exception().
|
|
97
89
|
*/
|
|
98
|
-
export function buildErrorBatch(
|
|
99
|
-
schema: Schema,
|
|
100
|
-
error: Error,
|
|
101
|
-
serverId: string,
|
|
102
|
-
requestId: string | null,
|
|
103
|
-
): RecordBatch {
|
|
90
|
+
export function buildErrorBatch(schema: Schema, error: Error, serverId: string, requestId: string | null): RecordBatch {
|
|
104
91
|
const metadata = new Map<string, string>();
|
|
105
92
|
metadata.set(LOG_LEVEL_KEY, "EXCEPTION");
|
|
106
93
|
metadata.set(LOG_MESSAGE_KEY, `${error.constructor.name}: ${error.message}`);
|
|
@@ -150,10 +137,7 @@ export function buildLogBatch(
|
|
|
150
137
|
* Build a 0-row batch from a schema with metadata.
|
|
151
138
|
* Used for error/log batches.
|
|
152
139
|
*/
|
|
153
|
-
export function buildEmptyBatch(
|
|
154
|
-
schema: Schema,
|
|
155
|
-
metadata?: Map<string, string>,
|
|
156
|
-
): RecordBatch {
|
|
140
|
+
export function buildEmptyBatch(schema: Schema, metadata?: Map<string, string>): RecordBatch {
|
|
157
141
|
const children = schema.fields.map((f: Field) => {
|
|
158
142
|
return makeData({ type: f.type, length: 0, nullCount: 0 });
|
|
159
143
|
});
|
package/src/wire/writer.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
// © Copyright 2025-2026, Query.Farm LLC - https://query.farm
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
RecordBatchStreamWriter,
|
|
6
|
-
type RecordBatch,
|
|
7
|
-
type Schema,
|
|
8
|
-
} from "apache-arrow";
|
|
9
4
|
import { writeSync } from "node:fs";
|
|
5
|
+
import { type RecordBatch, RecordBatchStreamWriter, type Schema } from "@query-farm/apache-arrow";
|
|
10
6
|
|
|
11
7
|
const STDOUT_FD = 1;
|
|
12
8
|
|