@query-farm/vgi 0.28.0 → 0.29.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.
- package/README.md +52 -8
- package/dist/arguments/argument-spec.d.ts +57 -2
- package/dist/arrow/impl-arrowjs/index.d.ts +1 -1
- package/dist/arrow/impl-arrowjs/iterate.d.ts +10 -1
- package/dist/arrow/impl-arrowjs/schema.d.ts +2 -0
- package/dist/arrow/impl-flechette/index.d.ts +1 -1
- package/dist/arrow/impl-flechette/iterate.d.ts +10 -1
- package/dist/arrow/impl-flechette/schema.d.ts +2 -0
- package/dist/arrow/index.d.ts +1 -1
- package/dist/arrow/schema-types.d.ts +3 -1
- package/dist/arrow/types.d.ts +39 -3
- package/dist/catalog/composite.d.ts +13 -13
- package/dist/catalog/descriptors.d.ts +7 -3
- package/dist/catalog/interface.d.ts +108 -38
- package/dist/catalog/read-only.d.ts +32 -15
- package/dist/client/client.d.ts +37 -30
- package/dist/client/types.d.ts +2 -0
- package/dist/client-entry.d.ts +1 -1
- package/dist/client-entry.js +791 -447
- package/dist/client-entry.js.map +18 -17
- package/dist/filter-pushdown/capabilities.d.ts +3 -0
- package/dist/filter-pushdown/deserialize.d.ts +14 -15
- package/dist/filter-pushdown/evaluate.d.ts +14 -44
- package/dist/filter-pushdown/index.d.ts +2 -2
- package/dist/filter-pushdown/types.d.ts +120 -68
- package/dist/functions/aggregate.d.ts +4 -0
- package/dist/functions/registry.d.ts +5 -5
- package/dist/functions/scalar.d.ts +6 -1
- package/dist/functions/table-buffering.d.ts +9 -0
- package/dist/functions/table-in-out.d.ts +13 -0
- package/dist/functions/table.d.ts +72 -2
- package/dist/functions/types.d.ts +60 -2
- package/dist/generated/vgi-client.d.ts +114 -26
- package/dist/generated/vgi-protocol-schemas.d.ts +34 -0
- package/dist/http/fetch.d.ts +16 -0
- package/dist/index.core.d.ts +4 -3
- package/dist/index.js +3396 -2064
- package/dist/index.js.map +55 -49
- package/dist/metadata/types.d.ts +15 -2
- package/dist/protocol/handlers/catalog/shared.d.ts +0 -8
- package/dist/protocol/handlers/function.d.ts +11 -0
- package/dist/protocol/handlers/shared.d.ts +3 -1
- package/dist/protocol/serializers/bind.d.ts +1 -2
- package/dist/protocol/serializers/cardinality.d.ts +1 -2
- package/dist/protocol/serializers/splits.d.ts +126 -0
- package/dist/protocol/types.d.ts +36 -3
- package/dist/request-auth.d.ts +28 -0
- package/dist/schema-path.d.ts +7 -0
- package/dist/serve-entry.d.ts +25 -0
- package/dist/serve-entry.js +1129 -569
- package/dist/serve-entry.js.map +36 -32
- package/dist/split-token.d.ts +88 -0
- package/dist/types.d.ts +8 -0
- package/dist/worker-cf-entry.js +2928 -1689
- package/dist/worker-cf-entry.js.map +51 -44
- package/dist/worker.d.ts +1 -1
- package/package.json +3 -3
- package/src/arguments/argument-spec.ts +93 -4
- package/src/arguments/arguments.ts +0 -1
- package/src/arrow/impl-arrowjs/index.ts +1 -1
- package/src/arrow/impl-arrowjs/iterate.ts +21 -0
- package/src/arrow/impl-arrowjs/schema.ts +4 -0
- package/src/arrow/impl-flechette/index.ts +1 -1
- package/src/arrow/impl-flechette/iterate.ts +24 -1
- package/src/arrow/impl-flechette/schema.ts +4 -0
- package/src/arrow/index.ts +1 -1
- package/src/arrow/schema-types.ts +4 -0
- package/src/arrow/types.ts +39 -3
- package/src/catalog/composite.ts +26 -26
- package/src/catalog/descriptors.ts +12 -3
- package/src/catalog/interface.ts +217 -72
- package/src/catalog/read-only.ts +141 -84
- package/src/client/client.ts +97 -73
- package/src/client/types.ts +2 -0
- package/src/client-entry.ts +2 -1
- package/src/filter-pushdown/capabilities.ts +13 -0
- package/src/filter-pushdown/collector.ts +22 -35
- package/src/filter-pushdown/deserialize.ts +657 -221
- package/src/filter-pushdown/evaluate.ts +410 -499
- package/src/filter-pushdown/index.ts +16 -2
- package/src/filter-pushdown/types.ts +88 -71
- package/src/functions/aggregate.ts +12 -1
- package/src/functions/copy-from.ts +2 -1
- package/src/functions/copy-to.ts +2 -1
- package/src/functions/registry.ts +24 -22
- package/src/functions/scalar.ts +37 -0
- package/src/functions/table-buffering.ts +48 -6
- package/src/functions/table-in-out.ts +194 -33
- package/src/functions/table.ts +187 -22
- package/src/functions/types.ts +64 -1
- package/src/generated/vgi-client.ts +122 -28
- package/src/generated/vgi-protocol-schemas.ts +455 -58
- package/src/http/fetch.ts +129 -2
- package/src/index.core.ts +4 -2
- package/src/metadata/resolve.ts +43 -1
- package/src/metadata/serialize.ts +43 -5
- package/src/metadata/types.ts +17 -1
- package/src/protocol/dispatch.ts +1 -1
- package/src/protocol/handlers/aggregate.ts +23 -12
- package/src/protocol/handlers/catalog/admin.ts +47 -54
- package/src/protocol/handlers/catalog/index_methods.ts +6 -13
- package/src/protocol/handlers/catalog/macro.ts +12 -20
- package/src/protocol/handlers/catalog/shared.ts +12 -57
- package/src/protocol/handlers/catalog/table.ts +49 -112
- package/src/protocol/handlers/catalog/view.ts +18 -22
- package/src/protocol/handlers/function.ts +311 -18
- package/src/protocol/handlers/shared.ts +12 -3
- package/src/protocol/handlers/table-buffering.ts +11 -8
- package/src/protocol/serializers/bind.ts +69 -67
- package/src/protocol/serializers/cardinality.ts +7 -7
- package/src/protocol/serializers/init.ts +52 -10
- package/src/protocol/serializers/splits.ts +221 -0
- package/src/protocol/state-serializer.ts +55 -1
- package/src/protocol/types.ts +36 -3
- package/src/request-auth.ts +73 -0
- package/src/schema-path.ts +25 -0
- package/src/serve-entry.ts +69 -2
- package/src/split-token.ts +297 -0
- package/src/types.ts +9 -0
- package/src/worker-cf-entry.ts +2 -1
- package/src/worker.ts +79 -14
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split-token envelope: the framework's wrapper around a worker's split payload.
|
|
3
|
+
*
|
|
4
|
+
* A split token *names* a unit of scan work so a distributed engine can
|
|
5
|
+
* re-request exactly the work it was handed. The worker supplies only the
|
|
6
|
+
* payload; everything around it is stamped here, so an author cannot forget the
|
|
7
|
+
* consistency anchor or mis-bind the fingerprint, and never writes crypto.
|
|
8
|
+
*
|
|
9
|
+
* Layout (little-endian, fixed prefix) — byte-identical across every SDK:
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
* offset size field
|
|
13
|
+
* 0 1 format_version currently 1
|
|
14
|
+
* 1 1 flags bit0 = payload_sealed; bits 1-7 reserved, MUST be 0
|
|
15
|
+
* 2 2 anchor_len u16 LE
|
|
16
|
+
* 4 16 bind_fingerprint truncated SHA-256 of the bind identity
|
|
17
|
+
* 20 var consistency_anchor anchor_len bytes
|
|
18
|
+
* 20+n var payload the worker's own bytes
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* **The header is plaintext on every transport; only the payload is sealed.**
|
|
22
|
+
* That is not a preference: a worker has no signing key on subprocess and unix,
|
|
23
|
+
* which is DuckDB's primary path, so a header readable only through AEAD would be
|
|
24
|
+
* unreadable exactly where DuckDB runs. It also matters for streaming — a
|
|
25
|
+
* checkpointed position must survive key rotation.
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import type { AuthContext } from "@query-farm/vgi-rpc";
|
|
30
|
+
/** Envelope format version. Checked unconditionally, before anything else. */
|
|
31
|
+
export declare const SPLIT_TOKEN_FORMAT_VERSION = 1;
|
|
32
|
+
/** Stable error-kind strings, identical across SDKs. */
|
|
33
|
+
export declare const SPLIT_TOKEN_INVALID = "SPLIT_TOKEN_INVALID";
|
|
34
|
+
export declare const SPLIT_SNAPSHOT_EXPIRED = "SPLIT_SNAPSHOT_EXPIRED";
|
|
35
|
+
export declare const SPLIT_TRANSACTION_ENDED = "SPLIT_TRANSACTION_ENDED";
|
|
36
|
+
/**
|
|
37
|
+
* Why a split token was refused.
|
|
38
|
+
*
|
|
39
|
+
* The kind matters to a connector: only `SPLIT_SNAPSHOT_EXPIRED` means "re-run
|
|
40
|
+
* the query", and neither kind is retriable in place. Keeping the anchor in the
|
|
41
|
+
* PLAINTEXT header rather than in the AAD is what makes that distinction
|
|
42
|
+
* expressible — inside the AAD both collapse into one tag-check failure.
|
|
43
|
+
*/
|
|
44
|
+
export declare class SplitTokenError extends Error {
|
|
45
|
+
readonly kind: string;
|
|
46
|
+
constructor(kind: string, message: string);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Derive the 16-byte binding check for a bind call.
|
|
50
|
+
*
|
|
51
|
+
* Minted **and** verified by the same worker, so it needs self-consistency only
|
|
52
|
+
* — it does not have to agree with any client, which is why the cross-SDK byte
|
|
53
|
+
* fixtures do not cover it. 16 bytes is a binding check, not a MAC: forgery
|
|
54
|
+
* resistance comes from the seal where a key exists, and from the uid trust
|
|
55
|
+
* boundary where one does not.
|
|
56
|
+
*
|
|
57
|
+
* Uses Web Crypto rather than a hash dependency so this works unchanged in the
|
|
58
|
+
* browser and Cloudflare Workers builds.
|
|
59
|
+
*/
|
|
60
|
+
export declare function bindFingerprint(schemaPath: string[], functionName: string, args: Uint8Array, settings: Uint8Array, projection: Uint8Array): Promise<Uint8Array>;
|
|
61
|
+
/**
|
|
62
|
+
* Encode the consistency anchor.
|
|
63
|
+
*
|
|
64
|
+
* `catalog_version` is the counter that MOVES within an attach, so it is what a
|
|
65
|
+
* plan is pinned to; `resolved_data_version` is fixed at attach and would say
|
|
66
|
+
* nothing about staleness.
|
|
67
|
+
*/
|
|
68
|
+
export declare function splitAnchor(catalogVersion: bigint | number): Uint8Array;
|
|
69
|
+
/** Stamp (and, when a key exists, seal) a worker payload into a split token. */
|
|
70
|
+
export declare function buildSplitToken(opts: {
|
|
71
|
+
payload: Uint8Array;
|
|
72
|
+
fingerprint: Uint8Array;
|
|
73
|
+
anchor: Uint8Array;
|
|
74
|
+
signingKey?: Uint8Array;
|
|
75
|
+
auth?: AuthContext;
|
|
76
|
+
}): Promise<Uint8Array>;
|
|
77
|
+
/**
|
|
78
|
+
* Verify a split token and return the worker's payload.
|
|
79
|
+
*
|
|
80
|
+
* `expectedFingerprint` and `currentAnchor` are optional; omitting one skips that
|
|
81
|
+
* check.
|
|
82
|
+
*/
|
|
83
|
+
export declare function openSplitToken(token: Uint8Array, opts?: {
|
|
84
|
+
signingKey?: Uint8Array;
|
|
85
|
+
auth?: AuthContext;
|
|
86
|
+
expectedFingerprint?: Uint8Array;
|
|
87
|
+
currentAnchor?: Uint8Array;
|
|
88
|
+
}): Promise<Uint8Array>;
|
package/dist/types.d.ts
CHANGED
|
@@ -13,6 +13,14 @@ export declare enum NullHandling {
|
|
|
13
13
|
DEFAULT = "DEFAULT",
|
|
14
14
|
SPECIAL = "SPECIAL"
|
|
15
15
|
}
|
|
16
|
+
export declare enum ArgumentMonotonicity {
|
|
17
|
+
UNKNOWN = "UNKNOWN",
|
|
18
|
+
CONSTANT = "CONSTANT",
|
|
19
|
+
NON_DECREASING = "NON_DECREASING",
|
|
20
|
+
STRICTLY_INCREASING = "STRICTLY_INCREASING",
|
|
21
|
+
NON_INCREASING = "NON_INCREASING",
|
|
22
|
+
STRICTLY_DECREASING = "STRICTLY_DECREASING"
|
|
23
|
+
}
|
|
16
24
|
export declare enum OrderPreservation {
|
|
17
25
|
/** Output rows are in same order as input rows (DuckDB INSERTION_ORDER). */
|
|
18
26
|
PRESERVES_ORDER = "PRESERVES_ORDER",
|