@query-farm/vgi 0.19.1 → 0.21.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/arrow/impl-arrowjs/index.d.ts +7 -0
- package/dist/arrow/impl-flechette/arrowjs-shape.d.ts +16 -0
- package/dist/arrow/impl-flechette/compat.d.ts +22 -0
- package/dist/arrow/impl-flechette/index.d.ts +2 -0
- package/dist/arrow/impl-flechette/ipc.d.ts +1 -1
- package/dist/arrow/index.d.ts +2 -2
- package/dist/arrow/predicates.d.ts +16 -0
- package/dist/cache-control.d.ts +7 -0
- package/dist/client-entry.js +5 -1
- package/dist/client-entry.js.map +4 -4
- package/dist/index.core.d.ts +2 -2
- package/dist/index.js +56 -4
- package/dist/index.js.map +10 -10
- package/dist/serve-entry.js +6 -1
- package/dist/serve-entry.js.map +5 -5
- package/dist/util/arrow/index.d.ts +1 -1
- package/dist/worker-cf-entry.js +53 -4
- package/dist/worker-cf-entry.js.map +9 -9
- package/package.json +5 -5
- package/src/arrow/impl-arrowjs/index.ts +10 -0
- package/src/arrow/impl-flechette/arrowjs-shape.ts +78 -0
- package/src/arrow/impl-flechette/canonical.ts +19 -0
- package/src/arrow/impl-flechette/compat.ts +254 -0
- package/src/arrow/impl-flechette/empty.ts +5 -1
- package/src/arrow/impl-flechette/index.ts +8 -0
- package/src/arrow/impl-flechette/ipc.ts +72 -6
- package/src/arrow/impl-flechette/normalize-type.ts +10 -2
- package/src/arrow/impl-flechette/schema.ts +13 -9
- package/src/arrow/index.ts +3 -0
- package/src/arrow/predicates.ts +59 -0
- package/src/cache-control.ts +8 -0
- package/src/functions/registry.ts +21 -4
- package/src/index.core.ts +3 -0
- package/src/protocol/handlers/function.ts +9 -1
- package/src/util/arrow/index.ts +1 -0
|
@@ -10,3 +10,10 @@ export { readCanonicalValue } from "./canonical.js";
|
|
|
10
10
|
export { withBatchMetadata } from "./metadata.js";
|
|
11
11
|
export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./ipc.js";
|
|
12
12
|
export { buildStatisticsBatch, type ColumnStatistics } from "./statistics.js";
|
|
13
|
+
/**
|
|
14
|
+
* No-op on this backend: arrow-js `RecordBatch`/`Vector` already expose the
|
|
15
|
+
* full API worker code uses, and arrow-js is a peer dependency, so there is
|
|
16
|
+
* only ever one copy. Present so both backends satisfy one facade interface —
|
|
17
|
+
* see impl-flechette/compat.ts for what this does there.
|
|
18
|
+
*/
|
|
19
|
+
export declare function adoptArrowJsShape<T>(batch: T): T;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attach `isSigned` to a flechette Int type, recursing through children /
|
|
3
|
+
* dictionary / index types.
|
|
4
|
+
*
|
|
5
|
+
* The alias is a non-enumerable getter so it never shows up in structural
|
|
6
|
+
* comparisons, IPC encoding or `Object.keys` — flechette keeps writing
|
|
7
|
+
* `signed`, and this is purely a read-side view of it. Mutating in place is
|
|
8
|
+
* safe: these objects are freshly built per decode.
|
|
9
|
+
*/
|
|
10
|
+
export declare function aliasIntSigned<T>(type: T): T;
|
|
11
|
+
/**
|
|
12
|
+
* Bring a freshly decoded flechette schema up to the arrow-js shape shared
|
|
13
|
+
* code expects: every field (and nested child field) has a metadata `Map`,
|
|
14
|
+
* and every Int type answers to `isSigned`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function normalizeDecodedSchema<T>(schema: T): T;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Give a batch the arrow-js shape even when it was not built by our copy of
|
|
3
|
+
* flechette.
|
|
4
|
+
*
|
|
5
|
+
* The prototype patches above are scoped to one module instance. npm/bun will
|
|
6
|
+
* happily install a *second* copy of `@query-farm/flechette` — nested under
|
|
7
|
+
* `@query-farm/vgi-rpc`, say, whenever the two version ranges disagree even
|
|
8
|
+
* transiently — and then batches decoded off the wire by vgi-rpc are instances
|
|
9
|
+
* of classes our patches never touched. Worker code that has been calling
|
|
10
|
+
* `col.isValid(i)` happily for the whole bind phase suddenly gets
|
|
11
|
+
* `TypeError: col.isValid is not a function` on the first exchange round, with
|
|
12
|
+
* nothing in the stack to suggest the cause. That is not hypothetical: it took
|
|
13
|
+
* out four integration tests, and a duplicate copy is invisible to
|
|
14
|
+
* `bun install` output and to the lockfile, which lists flechette once.
|
|
15
|
+
*
|
|
16
|
+
* So rather than trusting module identity, patch whatever prototypes we are
|
|
17
|
+
* actually handed, once each. `adopted` keeps it to a WeakSet probe per call.
|
|
18
|
+
*
|
|
19
|
+
* Returns its argument (mutating prototypes, not the batch) so call sites can
|
|
20
|
+
* wrap inline.
|
|
21
|
+
*/
|
|
22
|
+
export declare function adoptArrowJsShape<T>(batch: T): T;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { VgiBackendInfo } from "../types.js";
|
|
2
|
+
import "./compat.js";
|
|
2
3
|
export declare const backend: VgiBackendInfo;
|
|
3
4
|
export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, binary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, } from "./schema.js";
|
|
4
5
|
export { emptyBatch } from "./empty.js";
|
|
@@ -10,3 +11,4 @@ export { readCanonicalValue } from "./canonical.js";
|
|
|
10
11
|
export { withBatchMetadata } from "./metadata.js";
|
|
11
12
|
export { serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, } from "./ipc.js";
|
|
12
13
|
export { buildStatisticsBatch, type ColumnStatistics } from "./statistics.js";
|
|
14
|
+
export { adoptArrowJsShape } from "./compat.js";
|
|
@@ -30,4 +30,4 @@ export declare function serializeBatch(batch: VgiBatch): Uint8Array;
|
|
|
30
30
|
* multi-batch streams this collapses to a single logical batch, matching
|
|
31
31
|
* the subprocess transport's one-batch-per-call convention.
|
|
32
32
|
*/
|
|
33
|
-
export declare function deserializeBatch(
|
|
33
|
+
export declare function deserializeBatch(input: Uint8Array): VgiBatch;
|
package/dist/arrow/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { VgiTypeId, VgiDataType, VgiField, VgiSchema, VgiColumn, VgiColumnData, VgiBatch, VgiBackendInfo, TaggedUnion, } from "./types.js";
|
|
2
|
-
export { TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, } from "./predicates.js";
|
|
3
|
-
export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, withBatchMetadata, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, buildStatisticsBatch, } from "#arrow-impl";
|
|
2
|
+
export { TypeId, isNull, isInt, isFloat, isBinary, isUtf8, isBool, isDecimal, isDate, isTime, isTimestamp, isInterval, isList, isStruct, isUnion, isFixedSizeBinary, isFixedSizeList, isMap, isDuration, isDictionary, isBatch, typeSignature, } from "./predicates.js";
|
|
3
|
+
export { backend, emptyBatch, batchFromRows, batchFromColumns, columnFromArray, iterRows, batchToScalarDict, batchToSecretDict, safeNumber, decodeDictValue, filterBatch, projectSchema, projectBatch, withBatchMetadata, adoptArrowJsShape, readCanonicalValue, serializeSchema, deserializeSchema, serializeBatch, deserializeBatch, buildStatisticsBatch, } from "#arrow-impl";
|
|
4
4
|
export type { ColumnStatistics } from "#arrow-impl";
|
|
5
5
|
export { schema, field, nullType, bool, int, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, utf8, binary, fixedSizeBinary, decimal, decimal128, decimal256, date, dateDay, dateMillisecond, time, timeSecond, timeMillisecond, timeMicrosecond, timeNanosecond, timestamp, duration, interval, timestampSeconds, timestampMillis, timestampMicros, timestampNanos, durationSeconds, durationMillis, durationMicros, durationNanos, list, fixedSizeList, struct, map, dictionary, union, sparseUnion, denseUnion, TimeUnit, DateUnit, IntervalUnit, UnionMode, } from "./schema-types.js";
|
|
6
6
|
export type { NullDescriptor, BoolType, IntType, Int8Type, Int16Type, Int32Type, Int64Type, Uint8Type, Uint16Type, Uint32Type, Uint64Type, FloatType, Utf8Type, LargeUtf8Type, BinaryType, LargeBinaryType, FixedSizeBinaryType, DecimalType, Date32Type, Date64Type, Time32Type, Time64Type, TimestampType, DurationType, IntervalType, ListType, FixedSizeListType, StructType, MapType, DictionaryType, UnionType, TypedField, TUnit, } from "./codec/type-descriptors.js";
|
|
@@ -41,6 +41,22 @@ export declare function isFixedSizeList(t: VgiDataType): boolean;
|
|
|
41
41
|
export declare function isMap(t: VgiDataType): boolean;
|
|
42
42
|
export declare function isDuration(t: VgiDataType): boolean;
|
|
43
43
|
export declare function isDictionary(t: VgiDataType): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Stable structural identity for an Arrow type, usable for equality.
|
|
46
|
+
*
|
|
47
|
+
* `String(type)` is NOT usable for this: arrow-js DataTypes are class
|
|
48
|
+
* instances with a meaningful `toString()` ("Int64", "Utf8", …), while
|
|
49
|
+
* flechette types are plain object literals that stringify to
|
|
50
|
+
* "[object Object]". Comparing with `toString()` therefore reports *every*
|
|
51
|
+
* flechette type as equal to every other, and never equal to a declared
|
|
52
|
+
* arrow-js type — which collapsed overload resolution to a first-match tie
|
|
53
|
+
* (`type_info(42::BIGINT)` picked the INTEGER overload).
|
|
54
|
+
*
|
|
55
|
+
* Both libraries agree on `typeId` and on the parameter *values*; they differ
|
|
56
|
+
* only on a few property names, so those are read under both spellings. The
|
|
57
|
+
* output is an opaque key — compare it, don't display it.
|
|
58
|
+
*/
|
|
59
|
+
export declare function typeSignature(t: VgiDataType | null | undefined): string;
|
|
44
60
|
/** Runtime check: does `x` quack like a VgiBatch? Used at API boundaries
|
|
45
61
|
* where callers may pass either a batch or a plain column dict. Duck-typed
|
|
46
62
|
* because arrow-js and flechette use unrelated classes. */
|
package/dist/cache-control.d.ts
CHANGED
|
@@ -35,6 +35,7 @@ export declare const CACHE_REVALIDATABLE_KEY = "vgi.cache.revalidatable";
|
|
|
35
35
|
export declare const CACHE_STALE_WHILE_REVALIDATE_KEY = "vgi.cache.stale_while_revalidate";
|
|
36
36
|
export declare const CACHE_STALE_IF_ERROR_KEY = "vgi.cache.stale_if_error";
|
|
37
37
|
export declare const CACHE_NOT_MODIFIED_KEY = "vgi.cache.not_modified";
|
|
38
|
+
export declare const CACHE_PARTITION_SCOPE_KEY = "vgi.cache.partition_scope";
|
|
38
39
|
export declare const CACHE_IF_NONE_MATCH_KEY = "vgi.cache.if_none_match";
|
|
39
40
|
export declare const CACHE_IF_MODIFIED_SINCE_KEY = "vgi.cache.if_modified_since";
|
|
40
41
|
export declare const CACHE_SCOPE_CATALOG = "catalog";
|
|
@@ -75,6 +76,12 @@ export interface CacheControl {
|
|
|
75
76
|
* assert the client's stored payload is still fresh (the client reuses it
|
|
76
77
|
* instead of re-streaming). */
|
|
77
78
|
notModified?: boolean;
|
|
79
|
+
/** Opt in to per-PARTITION caching: in addition to the whole-scan entry, the
|
|
80
|
+
* client stores the result split by distinct partition tuple, so a later
|
|
81
|
+
* `=`/`IN`-filtered scan on the partition column(s) can serve the requested
|
|
82
|
+
* partitions without calling the worker. Only meaningful for a
|
|
83
|
+
* `SINGLE_VALUE_PARTITIONS` table function; purely additive. */
|
|
84
|
+
partitionScope?: boolean;
|
|
78
85
|
}
|
|
79
86
|
/**
|
|
80
87
|
* Render a {@link CacheControl} to the `vgi.cache.*` batch-metadata map.
|
package/dist/client-entry.js
CHANGED
|
@@ -122,6 +122,7 @@ __export(exports_impl_arrowjs, {
|
|
|
122
122
|
batchFromRows: () => batchFromRows,
|
|
123
123
|
batchFromColumns: () => batchFromColumns,
|
|
124
124
|
backend: () => backend,
|
|
125
|
+
adoptArrowJsShape: () => adoptArrowJsShape,
|
|
125
126
|
UnionMode: () => UnionMode,
|
|
126
127
|
TimeUnit: () => TimeUnit,
|
|
127
128
|
IntervalUnit: () => IntervalUnit,
|
|
@@ -1758,6 +1759,9 @@ function assemble(columnNames, minData, maxData, hasNull, hasNotNull, distinctCo
|
|
|
1758
1759
|
|
|
1759
1760
|
// src/arrow/impl-arrowjs/index.ts
|
|
1760
1761
|
var backend = { name: "arrow-js" };
|
|
1762
|
+
function adoptArrowJsShape(batch) {
|
|
1763
|
+
return batch;
|
|
1764
|
+
}
|
|
1761
1765
|
// src/arrow/schema-types.ts
|
|
1762
1766
|
var { TimeUnit: TimeUnit2, DateUnit: DateUnit3, IntervalUnit: IntervalUnit2, UnionMode: UnionMode2, schema: schema2 } = exports_impl_arrowjs;
|
|
1763
1767
|
function field2(name, type, nullable, metadata) {
|
|
@@ -3917,4 +3921,4 @@ export {
|
|
|
3917
3921
|
ArgumentValidationError
|
|
3918
3922
|
};
|
|
3919
3923
|
|
|
3920
|
-
//# debugId=
|
|
3924
|
+
//# debugId=D04A9CC224B063B264756E2164756E21
|