@wavehouse/chtypes 0.1.1 → 0.1.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/CHANGELOG.md +24 -38
- package/README.md +45 -414
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/discover.d.ts +2 -2
- package/dist/discover.js +2 -2
- package/dist/errors.d.ts +30 -9
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +35 -7
- package/dist/errors.js.map +1 -1
- package/dist/fetch.d.ts +8 -8
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +8 -8
- package/dist/fetch.js.map +1 -1
- package/dist/ffi.d.ts +15 -15
- package/dist/ffi.js +26 -26
- package/dist/ffi.js.map +1 -1
- package/dist/format.d.ts +5 -5
- package/dist/format.js +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts +3 -3
- package/dist/json.js +5 -5
- package/dist/json.js.map +1 -1
- package/dist/library.d.ts +11 -11
- package/dist/library.js +9 -9
- package/dist/numeric.js +1 -1
- package/dist/paths.d.ts +1 -1
- package/dist/paths.js +1 -1
- package/dist/registry.d.ts +6 -6
- package/dist/registry.js +6 -6
- package/dist/registry.js.map +1 -1
- package/dist/results.d.ts +46 -13
- package/dist/results.d.ts.map +1 -1
- package/dist/results.js +85 -4
- package/dist/results.js.map +1 -1
- package/dist/schema.d.ts +18 -18
- package/dist/schema.js +11 -11
- package/dist/settings.d.ts +4 -4
- package/dist/settings.js +2 -2
- package/dist/settings.js.map +1 -1
- package/dist/transform.d.ts +2 -2
- package/dist/transform.js +5 -5
- package/package.json +1 -1
package/dist/results.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqB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
* as the reference implementation's `RowResult` / `BatchResult`
|
|
4
|
-
* (
|
|
4
|
+
* (docs/reference/bindings.md §Result types), in TypeScript spelling.
|
|
5
5
|
*
|
|
6
6
|
* ---------------------------------------------------------------- text vs bytes
|
|
7
7
|
* Every rendered value here comes in both spellings, and which one is
|
|
@@ -22,10 +22,40 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { asBool, asBytes, asInt, asString, asStringArray, field, hasField, items, rawBytes, rawText, } from './json.js';
|
|
24
24
|
import { classify, isLossyReason } from './transform.js';
|
|
25
|
+
/**
|
|
26
|
+
* The verdict on a row or a batch — the error taxonomy in one string, and
|
|
27
|
+
* conflating any two arms is a scoring error (the C ABI contract §Error model):
|
|
28
|
+
*
|
|
29
|
+
* - `'accepted'` — the server would take this, possibly with silent coercions
|
|
30
|
+
* (read `transformed`), defaults filled and volatile DEFAULTs substituted
|
|
31
|
+
* (read `substituted` — the caller MUST send those columns explicitly).
|
|
32
|
+
* - `'rejected'` — the server itself would refuse; `errCode` is ClickHouse's
|
|
33
|
+
* own code (27, 117, 455, …) and `errMsg` its own message. Tell the tenant.
|
|
34
|
+
* - `'accepted_poisoned'` — the insert is ACCEPTED (rc = 0) but the stored
|
|
35
|
+
* value can never be read back (`errCode` 691). Never report it as a
|
|
36
|
+
* rejection.
|
|
37
|
+
* - `'unsupported'` — chtypes declines to answer ("a real server might well
|
|
38
|
+
* have accepted this; I will not guess"). NOT a rejection: fall back to the
|
|
39
|
+
* server. Mapping it onto either other arm manufactures an over-reject or an
|
|
40
|
+
* over-accept, both budgeted at zero.
|
|
41
|
+
* - `'skipped'` (2026-08-27) — the row was dropped under
|
|
42
|
+
* `input_format_allow_errors_*` and the batch continued: the server's own
|
|
43
|
+
* skip, itemized. `errCode`/`errMsg` carry the error the vendored reader
|
|
44
|
+
* caught before resyncing, verbatim; `values` is empty — the row is NOT
|
|
45
|
+
* stored. Only ever seen on rows inside a `BatchResult`, never as a batch
|
|
46
|
+
* verdict and never from `Schema#row`.
|
|
47
|
+
*/
|
|
48
|
+
export const Outcome = {
|
|
49
|
+
Accepted: 'accepted',
|
|
50
|
+
Rejected: 'rejected',
|
|
51
|
+
AcceptedPoisoned: 'accepted_poisoned',
|
|
52
|
+
Unsupported: 'unsupported',
|
|
53
|
+
Skipped: 'skipped',
|
|
54
|
+
};
|
|
25
55
|
const EMPTY = Buffer.alloc(0);
|
|
26
56
|
/**
|
|
27
|
-
* Map a document's outcome string. An outcome this binding does not
|
|
28
|
-
* degrades to `unsupported`, never to `rejected` (
|
|
57
|
+
* Map a document's outcome string. An outcome this binding does not recognize
|
|
58
|
+
* degrades to `unsupported`, never to `rejected` (docs/reference/bindings.md
|
|
29
59
|
* §RowResult, rule added 2026-08-26): a future artifact's new verdict is an
|
|
30
60
|
* answer this binding cannot interpret, and `unsupported` is the arm that is
|
|
31
61
|
* never scored as agreement, while a default of `rejected` would manufacture
|
|
@@ -164,7 +194,7 @@ export function batchResultOf(doc, payload = null) {
|
|
|
164
194
|
const engineRowsBytes = enginePresent ? engineNode.items.map((r) => rawBytes(r)) : null;
|
|
165
195
|
// row_spans is present exactly when export bytes were emitted;
|
|
166
196
|
// export_declined exactly when an export was requested and withheld
|
|
167
|
-
// (
|
|
197
|
+
// (the C ABI contract §Rows). Both absent = no export requested, or a call-level
|
|
168
198
|
// verdict preempted the machinery.
|
|
169
199
|
const spansNode = field(doc, 'row_spans');
|
|
170
200
|
const spans = spansNode === undefined
|
|
@@ -187,11 +217,62 @@ export function batchResultOf(doc, payload = null) {
|
|
|
187
217
|
exportDeclined,
|
|
188
218
|
};
|
|
189
219
|
}
|
|
220
|
+
// ------------------------------------------------------------------ filters
|
|
221
|
+
/**
|
|
222
|
+
* One row's answer from `Filter#rows`. Two of the four states are ANSWERS and
|
|
223
|
+
* two are NOT, and the split is load-bearing: a caller enforcing visibility
|
|
224
|
+
* MUST fail closed (hide the row / fail the request) on `'error'` AND
|
|
225
|
+
* `'decline'` — collapsing either into `'false'`-the-answer inverts
|
|
226
|
+
* fail-closed into fail-open under NOT, the measured leak class
|
|
227
|
+
* (docs/reference/bindings.md §Revision 3).
|
|
228
|
+
*
|
|
229
|
+
* - `'true'` the predicate is non-NULL and non-zero for this row.
|
|
230
|
+
* - `'false'` false OR NULL — SQL's three-valued logic collapsed at the
|
|
231
|
+
* WHERE boundary, computed by the vendored functions.
|
|
232
|
+
* - `'error'` the predicate THREW on this row's values (e.g. NO_COMMON_TYPE
|
|
233
|
+
* 386 from `s = 257` over String). On a real server a WHERE
|
|
234
|
+
* that throws fails the WHOLE query. NOT an answer.
|
|
235
|
+
* - `'decline'` this library declines to answer for this row — unparseable
|
|
236
|
+
* under the schema, poisoned, or the admission envelope
|
|
237
|
+
* tripped. NOT an answer, and the state an unknown verdict
|
|
238
|
+
* character degrades to.
|
|
239
|
+
*/
|
|
240
|
+
export const Verdict = {
|
|
241
|
+
True: 'true',
|
|
242
|
+
False: 'false',
|
|
243
|
+
Error: 'error',
|
|
244
|
+
Decline: 'decline',
|
|
245
|
+
};
|
|
190
246
|
/** Whether a verdict is an ANSWER (`'true'`/`'false'`) rather than an error
|
|
191
247
|
* or a decline. A security-enforcing caller hides the row when this is false. */
|
|
192
248
|
export function isAnswer(v) {
|
|
193
249
|
return v === 'true' || v === 'false';
|
|
194
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* The CALL-level verdict of `Filter#rows` — whether evaluation completed at
|
|
253
|
+
* all; per-row failures live in the verdicts, not here. An outcome spelling
|
|
254
|
+
* this binding does not recognize degrades to `'unsupported'`, never to
|
|
255
|
+
* `'rejected'` (the unknown-outcome rule, docs/reference/bindings.md §RowResult).
|
|
256
|
+
*/
|
|
257
|
+
export const FilterOutcome = {
|
|
258
|
+
Ok: 'ok',
|
|
259
|
+
Rejected: 'rejected',
|
|
260
|
+
Unsupported: 'unsupported',
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* `chs_schema_column_default_kind`'s five answers, as `ColumnInfo#defaultKind`
|
|
264
|
+
* carries them. Named here because the Go, Python and Rust bindings all name
|
|
265
|
+
* them and a TypeScript caller was otherwise typing the strings by hand — and
|
|
266
|
+
* one of them is load-bearing: `EPHEMERAL` is the column a gateway must DECLINE
|
|
267
|
+
* to preview rather than mispreview (docs/reference/bindings.md §EPHEMERAL columns).
|
|
268
|
+
*/
|
|
269
|
+
export const DefaultKind = {
|
|
270
|
+
None: '',
|
|
271
|
+
Default: 'DEFAULT',
|
|
272
|
+
Materialized: 'MATERIALIZED',
|
|
273
|
+
Alias: 'ALIAS',
|
|
274
|
+
Ephemeral: 'EPHEMERAL',
|
|
275
|
+
};
|
|
195
276
|
/** Turn one filter document into a `FilterResult`. */
|
|
196
277
|
export function filterResultOf(doc) {
|
|
197
278
|
const rawOutcome = asString(field(doc, 'outcome'));
|
package/dist/results.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,aAAa,EACb,KAAK,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,GAER,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"results.js","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EACL,MAAM,EACN,OAAO,EACP,KAAK,EACL,QAAQ,EACR,aAAa,EACb,KAAK,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,GAER,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG;I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,CAAC;AACvC,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ import type { BlockHandle, FilterHandle, NativeLibrary, SchemaHandle } from './f
|
|
|
7
7
|
import { type Format } from './format.js';
|
|
8
8
|
import { type BatchResult, type FilterResult, type RowResult } from './results.js';
|
|
9
9
|
import { type Settings } from './settings.js';
|
|
10
|
-
/** One declared column, as ClickHouse
|
|
10
|
+
/** One declared column, as ClickHouse canonicalized it. */
|
|
11
11
|
export interface ColumnInfo {
|
|
12
12
|
readonly name: string;
|
|
13
|
-
/** Canonical type — pass it through verbatim, never re-
|
|
13
|
+
/** Canonical type — pass it through verbatim, never re-normalize whitespace. */
|
|
14
14
|
readonly type: string;
|
|
15
15
|
/** "" | "DEFAULT" | "MATERIALIZED" | "ALIAS" | "EPHEMERAL" */
|
|
16
16
|
readonly defaultKind: string;
|
|
@@ -22,12 +22,12 @@ export interface ColumnInfo {
|
|
|
22
22
|
export interface EngineOptions {
|
|
23
23
|
/**
|
|
24
24
|
* The `SETTINGS` clause after the engine — `allow_nullable_key` and friends,
|
|
25
|
-
* a namespace `DB::Settings` cannot carry (
|
|
25
|
+
* a namespace `DB::Settings` cannot carry (the C ABI contract §`chs_schema_engine`).
|
|
26
26
|
* Absent or empty is structurally identical to the plain engine declaration:
|
|
27
27
|
* `chs_schema_engine` takes "{}" either way. Names are validated by the
|
|
28
28
|
* server's own `MergeTreeSettings` object: an unknown name throws the
|
|
29
29
|
* server's own 115; a known name declared at a NON-default value is refused
|
|
30
|
-
* (`unsupported`, naming it) — no MergeTree setting's
|
|
30
|
+
* (`unsupported`, naming it) — no MergeTree setting's behavior is modeled
|
|
31
31
|
* yet, and silently ignoring a declared value would mean the declared
|
|
32
32
|
* profile is not in force; a name declared AT its default is inert and
|
|
33
33
|
* accepted.
|
|
@@ -36,7 +36,7 @@ export interface EngineOptions {
|
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* Options for `Schema#rows` — the revision-3 export and document-flag
|
|
39
|
-
* channels (
|
|
39
|
+
* channels (the C ABI contract §Rows; docs/proposals/rows-export.md). Whatever the
|
|
40
40
|
* options, `rows()` is always ONE `chs_rows` call — never a second call,
|
|
41
41
|
* never re-parsing.
|
|
42
42
|
*/
|
|
@@ -52,7 +52,7 @@ export interface RowsOptions {
|
|
|
52
52
|
* A bitmask of `DOC_VALUES | DOC_TRANSFORMS | DOC_DEFAULTS` selecting the
|
|
53
53
|
* document groups; the verdict channel is always present and not a flag.
|
|
54
54
|
* Defaults: `DOC_ALL` when no `exportFormat` is given (the full document —
|
|
55
|
-
* plain `rows()`
|
|
55
|
+
* plain `rows()` behavior), `0` (LEAN — verdicts only: `values`,
|
|
56
56
|
* `transformed`, `substituted`, `computed` and `unknownFields` all come
|
|
57
57
|
* back empty) when one is. An explicit value always wins; a bit outside
|
|
58
58
|
* `DOC_ALL` is refused loudly by the library, never pre-validated here.
|
|
@@ -70,7 +70,7 @@ export interface CompileFilterOptions {
|
|
|
70
70
|
* deserialized by the DECLARED type's own reader and injected as a typed
|
|
71
71
|
* literal AFTER SQL parsing, so a value is never SQL text and NEVER needs
|
|
72
72
|
* hand-escaping — injection safety is by construction, not by escaping
|
|
73
|
-
* (
|
|
73
|
+
* (the C ABI contract §Filters, Query parameters). Do not render values into
|
|
74
74
|
* the expression yourself.
|
|
75
75
|
*
|
|
76
76
|
* CHOOSE THE BRACE TYPE FOR THE VALUE'S DOMAIN: the declared type's own
|
|
@@ -109,7 +109,7 @@ export declare class Schema {
|
|
|
109
109
|
/** The column-declaration list this schema was compiled from, verbatim. */
|
|
110
110
|
readonly ddl: string;
|
|
111
111
|
/**
|
|
112
|
-
* The declared columns as ClickHouse
|
|
112
|
+
* The declared columns as ClickHouse canonicalized them, in declaration
|
|
113
113
|
* order — flattened under `flatten_nested=1`, DEFAULT-rewritten types
|
|
114
114
|
* (`x Int64 DEFAULT NULL` compiles as `Nullable(Int64)`), ALIAS types
|
|
115
115
|
* inferred. A gateway detects EPHEMERAL columns here, at compile time
|
|
@@ -120,12 +120,12 @@ export declare class Schema {
|
|
|
120
120
|
/**
|
|
121
121
|
* Every open `Filter` compiled from this handle, so `close()` can free them
|
|
122
122
|
* FIRST — the C layer does not refcount, and freeing the schema under a
|
|
123
|
-
* live filter is use-after-free (
|
|
123
|
+
* live filter is use-after-free (the C ABI contract §Filters, handle lifetime).
|
|
124
124
|
*/
|
|
125
125
|
private readonly filters;
|
|
126
126
|
/**
|
|
127
127
|
* Every open `Block` parsed from this handle — the same non-owning rule,
|
|
128
|
-
* the same free-before-schema order (
|
|
128
|
+
* the same free-before-schema order (the C ABI contract §Blocks).
|
|
129
129
|
*/
|
|
130
130
|
private readonly blocks;
|
|
131
131
|
/** @internal — obtained from `Library#compileDdl`. */
|
|
@@ -147,7 +147,7 @@ export declare class Schema {
|
|
|
147
147
|
*
|
|
148
148
|
* The two error classes here are the refusal/decline split and MUST be
|
|
149
149
|
* handled as peers — `UnsupportedError` is deliberately NOT
|
|
150
|
-
* `instanceof SchemaError` (
|
|
150
|
+
* `instanceof SchemaError` (docs/reference/bindings.md rule 12):
|
|
151
151
|
*
|
|
152
152
|
* @param engine - the engine expression, e.g. `"SummingMergeTree"`,
|
|
153
153
|
* `"CollapsingMergeTree(sign)"`.
|
|
@@ -243,7 +243,7 @@ export declare class Schema {
|
|
|
243
243
|
* the same TreeRewriter + ExpressionAnalyzer pipeline the CONSTRAINT CHECK
|
|
244
244
|
* path runs, so comparison semantics are WHERE-side by construction:
|
|
245
245
|
* `x = 256` over UInt8 promotes (false for every row), it never wraps
|
|
246
|
-
* (
|
|
246
|
+
* (the C ABI contract §Filters).
|
|
247
247
|
*
|
|
248
248
|
* The expression may contain `{name:Type}` query parameters, bound with
|
|
249
249
|
* `options.params` (revision 4) — substitution is the server's own
|
|
@@ -280,7 +280,7 @@ export declare class Schema {
|
|
|
280
280
|
/**
|
|
281
281
|
* Parse a body ONCE into a `Block` (`chs_block_parse`) — the parse half of
|
|
282
282
|
* `Filter#rows`, exported so K filters can evaluate one event with no
|
|
283
|
-
* re-parse (`Filter#eval`;
|
|
283
|
+
* re-parse (`Filter#eval`; the C ABI contract §Blocks). Same formats and
|
|
284
284
|
* settings contract as `rows` (`settings` is the PARSE-side map: format
|
|
285
285
|
* settings, clock keys; evaluation takes none). Volatile DEFAULTs resolve
|
|
286
286
|
* against THIS call's clock instant, so
|
|
@@ -324,7 +324,7 @@ export declare class Schema {
|
|
|
324
324
|
* constructed directly.
|
|
325
325
|
*
|
|
326
326
|
* LIFETIME: a filter REFERENCES its schema handle — the C layer does not copy
|
|
327
|
-
* and does not refcount (
|
|
327
|
+
* and does not refcount (the C ABI contract §Filters). This binding enforces the
|
|
328
328
|
* free order structurally, both ways: the `Filter` holds its `Schema` (so the
|
|
329
329
|
* schema stays reachable), and `Schema#close` closes every open filter before
|
|
330
330
|
* freeing the schema. `close()` is idempotent, and `using` / `Symbol.dispose`
|
|
@@ -336,13 +336,13 @@ export declare class Schema {
|
|
|
336
336
|
* from two threads at once, and a chs_filter call is ALSO a use of its schema
|
|
337
337
|
* handle" (two filters over ONE schema must not run concurrently either). On
|
|
338
338
|
* a single JS thread every call here is synchronous, so ordinary Node code
|
|
339
|
-
* satisfies both by construction (
|
|
339
|
+
* satisfies both by construction (docs/reference/bindings.md §Concurrency); do not
|
|
340
340
|
* share a `Filter` — or its `Schema` — across `worker_threads`.
|
|
341
341
|
*
|
|
342
342
|
* ENFORCEMENT GATE: `'error'` and `'decline'` verdicts are NOT answers — a
|
|
343
343
|
* caller enforcing visibility MUST fail closed on both — and NO caller may
|
|
344
344
|
* enforce read-side security on this surface until the WHERE-truth rig gates
|
|
345
|
-
* green; until then it is a shadow/replay surface (
|
|
345
|
+
* green; until then it is a shadow/replay surface (the C ABI contract §Filters).
|
|
346
346
|
*/
|
|
347
347
|
export declare class Filter {
|
|
348
348
|
private readonly native;
|
|
@@ -382,7 +382,7 @@ export declare class Filter {
|
|
|
382
382
|
*
|
|
383
383
|
* Filter and block MUST come from the SAME schema: a mismatched pair
|
|
384
384
|
* answers a REJECTED result (code 1002) — the C layer's loud refusal,
|
|
385
|
-
* never undefined
|
|
385
|
+
* never undefined behavior. A pair from two different libraries throws
|
|
386
386
|
* `ChtypesError`: no handle ever crosses a dlopen'd image boundary.
|
|
387
387
|
*
|
|
388
388
|
* @param block - a `Block` from `Schema#parseBlock`.
|
|
@@ -404,7 +404,7 @@ export declare class Filter {
|
|
|
404
404
|
* One body, parsed ONCE under one schema handle and one clock instant
|
|
405
405
|
* (`chs_block_parse`). Obtained from `Schema#parseBlock`; evaluated by
|
|
406
406
|
* `Filter#eval`. The parse-once/eval-many twin of `Filter#rows`
|
|
407
|
-
* (
|
|
407
|
+
* (the C ABI contract §Blocks): the live-SSE hot path is K filters × 1 event, and
|
|
408
408
|
* the block sheds the re-parse.
|
|
409
409
|
*
|
|
410
410
|
* LIFETIME: a block REFERENCES its schema handle exactly as a filter does —
|
package/dist/schema.js
CHANGED
|
@@ -22,7 +22,7 @@ export class Schema {
|
|
|
22
22
|
native;
|
|
23
23
|
ddl;
|
|
24
24
|
/**
|
|
25
|
-
* The declared columns as ClickHouse
|
|
25
|
+
* The declared columns as ClickHouse canonicalized them, in declaration
|
|
26
26
|
* order — flattened under `flatten_nested=1`, DEFAULT-rewritten types
|
|
27
27
|
* (`x Int64 DEFAULT NULL` compiles as `Nullable(Int64)`), ALIAS types
|
|
28
28
|
* inferred. A gateway detects EPHEMERAL columns here, at compile time
|
|
@@ -33,12 +33,12 @@ export class Schema {
|
|
|
33
33
|
/**
|
|
34
34
|
* Every open `Filter` compiled from this handle, so `close()` can free them
|
|
35
35
|
* FIRST — the C layer does not refcount, and freeing the schema under a
|
|
36
|
-
* live filter is use-after-free (
|
|
36
|
+
* live filter is use-after-free (the C ABI contract §Filters, handle lifetime).
|
|
37
37
|
*/
|
|
38
38
|
filters = new Set();
|
|
39
39
|
/**
|
|
40
40
|
* Every open `Block` parsed from this handle — the same non-owning rule,
|
|
41
|
-
* the same free-before-schema order (
|
|
41
|
+
* the same free-before-schema order (the C ABI contract §Blocks).
|
|
42
42
|
*/
|
|
43
43
|
blocks = new Set();
|
|
44
44
|
/** @internal — obtained from `Library#compileDdl`. */
|
|
@@ -69,7 +69,7 @@ export class Schema {
|
|
|
69
69
|
*
|
|
70
70
|
* The two error classes here are the refusal/decline split and MUST be
|
|
71
71
|
* handled as peers — `UnsupportedError` is deliberately NOT
|
|
72
|
-
* `instanceof SchemaError` (
|
|
72
|
+
* `instanceof SchemaError` (docs/reference/bindings.md rule 12):
|
|
73
73
|
*
|
|
74
74
|
* @param engine - the engine expression, e.g. `"SummingMergeTree"`,
|
|
75
75
|
* `"CollapsingMergeTree(sign)"`.
|
|
@@ -177,7 +177,7 @@ export class Schema {
|
|
|
177
177
|
* the same TreeRewriter + ExpressionAnalyzer pipeline the CONSTRAINT CHECK
|
|
178
178
|
* path runs, so comparison semantics are WHERE-side by construction:
|
|
179
179
|
* `x = 256` over UInt8 promotes (false for every row), it never wraps
|
|
180
|
-
* (
|
|
180
|
+
* (the C ABI contract §Filters).
|
|
181
181
|
*
|
|
182
182
|
* The expression may contain `{name:Type}` query parameters, bound with
|
|
183
183
|
* `options.params` (revision 4) — substitution is the server's own
|
|
@@ -221,7 +221,7 @@ export class Schema {
|
|
|
221
221
|
/**
|
|
222
222
|
* Parse a body ONCE into a `Block` (`chs_block_parse`) — the parse half of
|
|
223
223
|
* `Filter#rows`, exported so K filters can evaluate one event with no
|
|
224
|
-
* re-parse (`Filter#eval`;
|
|
224
|
+
* re-parse (`Filter#eval`; the C ABI contract §Blocks). Same formats and
|
|
225
225
|
* settings contract as `rows` (`settings` is the PARSE-side map: format
|
|
226
226
|
* settings, clock keys; evaluation takes none). Volatile DEFAULTs resolve
|
|
227
227
|
* against THIS call's clock instant, so
|
|
@@ -285,7 +285,7 @@ export class Schema {
|
|
|
285
285
|
* constructed directly.
|
|
286
286
|
*
|
|
287
287
|
* LIFETIME: a filter REFERENCES its schema handle — the C layer does not copy
|
|
288
|
-
* and does not refcount (
|
|
288
|
+
* and does not refcount (the C ABI contract §Filters). This binding enforces the
|
|
289
289
|
* free order structurally, both ways: the `Filter` holds its `Schema` (so the
|
|
290
290
|
* schema stays reachable), and `Schema#close` closes every open filter before
|
|
291
291
|
* freeing the schema. `close()` is idempotent, and `using` / `Symbol.dispose`
|
|
@@ -297,13 +297,13 @@ export class Schema {
|
|
|
297
297
|
* from two threads at once, and a chs_filter call is ALSO a use of its schema
|
|
298
298
|
* handle" (two filters over ONE schema must not run concurrently either). On
|
|
299
299
|
* a single JS thread every call here is synchronous, so ordinary Node code
|
|
300
|
-
* satisfies both by construction (
|
|
300
|
+
* satisfies both by construction (docs/reference/bindings.md §Concurrency); do not
|
|
301
301
|
* share a `Filter` — or its `Schema` — across `worker_threads`.
|
|
302
302
|
*
|
|
303
303
|
* ENFORCEMENT GATE: `'error'` and `'decline'` verdicts are NOT answers — a
|
|
304
304
|
* caller enforcing visibility MUST fail closed on both — and NO caller may
|
|
305
305
|
* enforce read-side security on this surface until the WHERE-truth rig gates
|
|
306
|
-
* green; until then it is a shadow/replay surface (
|
|
306
|
+
* green; until then it is a shadow/replay surface (the C ABI contract §Filters).
|
|
307
307
|
*/
|
|
308
308
|
export class Filter {
|
|
309
309
|
native;
|
|
@@ -352,7 +352,7 @@ export class Filter {
|
|
|
352
352
|
*
|
|
353
353
|
* Filter and block MUST come from the SAME schema: a mismatched pair
|
|
354
354
|
* answers a REJECTED result (code 1002) — the C layer's loud refusal,
|
|
355
|
-
* never undefined
|
|
355
|
+
* never undefined behavior. A pair from two different libraries throws
|
|
356
356
|
* `ChtypesError`: no handle ever crosses a dlopen'd image boundary.
|
|
357
357
|
*
|
|
358
358
|
* @param block - a `Block` from `Schema#parseBlock`.
|
|
@@ -390,7 +390,7 @@ export class Filter {
|
|
|
390
390
|
* One body, parsed ONCE under one schema handle and one clock instant
|
|
391
391
|
* (`chs_block_parse`). Obtained from `Schema#parseBlock`; evaluated by
|
|
392
392
|
* `Filter#eval`. The parse-once/eval-many twin of `Filter#rows`
|
|
393
|
-
* (
|
|
393
|
+
* (the C ABI contract §Blocks): the live-SSE hot path is K filters × 1 event, and
|
|
394
394
|
* the block sheds the re-parse.
|
|
395
395
|
*
|
|
396
396
|
* LIFETIME: a block REFERENCES its schema handle exactly as a filter does —
|
package/dist/settings.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A setting value crosses the boundary as a JSON **string**, always.
|
|
3
3
|
*
|
|
4
|
-
* This is not cosmetic (
|
|
5
|
-
* 19-digit nanosecond epoch, which does not survive an IEEE double.
|
|
4
|
+
* This is not cosmetic (the C ABI contract §Settings): `chtypes_now_epoch_nanos` is a
|
|
5
|
+
* 19-digit nanosecond epoch, which does not survive an IEEE double. Serialized
|
|
6
6
|
* as a JSON *number* through a JS `number` it arrives as 1.7e+18 and the setting
|
|
7
7
|
* is **silently ignored** — the batch keeps stamping the real wall clock and
|
|
8
8
|
* nothing anywhere says so.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
export type SettingValue = string | bigint;
|
|
15
15
|
/**
|
|
16
16
|
* A map of ClickHouse query/format settings plus the six `chtypes_*` keys
|
|
17
|
-
* (clock control and admission budgets —
|
|
17
|
+
* (clock control and admission budgets — the C ABI contract §Settings), by name.
|
|
18
18
|
*
|
|
19
19
|
* Accepted everywhere settings travel: the compile profile
|
|
20
20
|
* (`Library#compileDdl`), the per-call map (`Schema#row` / `Schema#rows`), the
|
|
@@ -29,7 +29,7 @@ export type SettingValue = string | bigint;
|
|
|
29
29
|
*/
|
|
30
30
|
export type Settings = Readonly<Record<string, SettingValue>>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Serialize settings to the `settings_json` object the C ABI expects — every
|
|
33
33
|
* value crossing as a JSON string.
|
|
34
34
|
*
|
|
35
35
|
* @param settings - the settings map; `undefined` encodes as `"{}"`, the
|
package/dist/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChtypesError } from './errors.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Serialize settings to the `settings_json` object the C ABI expects — every
|
|
4
4
|
* value crossing as a JSON string.
|
|
5
5
|
*
|
|
6
6
|
* @param settings - the settings map; `undefined` encodes as `"{}"`, the
|
|
@@ -25,7 +25,7 @@ export function encodeSettings(settings) {
|
|
|
25
25
|
throw new ChtypesError(`chtypes: setting ${JSON.stringify(key)} must be a string or a bigint, got ` +
|
|
26
26
|
`${typeof value}. A JS number cannot carry a 19-digit nanosecond epoch: ` +
|
|
27
27
|
`1700000000123456789 becomes 1.7e+18 and the setting is silently ignored ` +
|
|
28
|
-
`(
|
|
28
|
+
`(the C ABI contract §Settings).`);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
return JSON.stringify(out);
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAkC3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,QAAmB;IAChD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,YAAY,CACpB,oBAAoB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,qCAAqC;gBAC1E,GAAG,OAAO,KAAK,0DAA0D;gBACzE,0EAA0E;gBAC1E,
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAkC3C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,QAAmB;IAChD,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,YAAY,CACpB,oBAAoB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,qCAAqC;gBAC1E,GAAG,OAAO,KAAK,0DAA0D;gBACzE,0EAA0E;gBAC1E,iCAAiC,CACpC,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/transform.d.ts
CHANGED
|
@@ -53,7 +53,7 @@ export declare const Reason: {
|
|
|
53
53
|
readonly Reformat: 'reformat';
|
|
54
54
|
readonly DefaultFilled: 'default_filled';
|
|
55
55
|
readonly ZeroFilled: 'zero_filled';
|
|
56
|
-
readonly
|
|
56
|
+
readonly DefaultMaterialized: 'default_materialized';
|
|
57
57
|
readonly TtlExpired: 'ttl_expired';
|
|
58
58
|
readonly TtlColumnExpired: 'ttl_column_expired';
|
|
59
59
|
};
|
|
@@ -63,7 +63,7 @@ export type Reason = (typeof Reason)[keyof typeof Reason];
|
|
|
63
63
|
* Whether a transform reason means information was LOST (a warning to raise to
|
|
64
64
|
* the tenant) rather than merely re-spelled or filled in. False for exactly
|
|
65
65
|
* four reasons — `reformat`, `default_filled`, `zero_filled`,
|
|
66
|
-
* `
|
|
66
|
+
* `default_materialized` — true for everything else, unknown strings included:
|
|
67
67
|
* a reason nobody has audited must degrade to a warning, never to silence.
|
|
68
68
|
* Mirrors `Transform#lossy`. Never throws.
|
|
69
69
|
*/
|
package/dist/transform.js
CHANGED
|
@@ -54,7 +54,7 @@ export const Reason = {
|
|
|
54
54
|
Reformat: 'reformat',
|
|
55
55
|
DefaultFilled: 'default_filled',
|
|
56
56
|
ZeroFilled: 'zero_filled',
|
|
57
|
-
|
|
57
|
+
DefaultMaterialized: 'default_materialized',
|
|
58
58
|
TtlExpired: 'ttl_expired',
|
|
59
59
|
TtlColumnExpired: 'ttl_column_expired',
|
|
60
60
|
};
|
|
@@ -68,13 +68,13 @@ const NON_LOSSY = new Set([
|
|
|
68
68
|
Reason.Reformat,
|
|
69
69
|
Reason.DefaultFilled,
|
|
70
70
|
Reason.ZeroFilled,
|
|
71
|
-
Reason.
|
|
71
|
+
Reason.DefaultMaterialized,
|
|
72
72
|
]);
|
|
73
73
|
/**
|
|
74
74
|
* Whether a transform reason means information was LOST (a warning to raise to
|
|
75
75
|
* the tenant) rather than merely re-spelled or filled in. False for exactly
|
|
76
76
|
* four reasons — `reformat`, `default_filled`, `zero_filled`,
|
|
77
|
-
* `
|
|
77
|
+
* `default_materialized` — true for everything else, unknown strings included:
|
|
78
78
|
* a reason nobody has audited must degrade to a warning, never to silence.
|
|
79
79
|
* Mirrors `Transform#lossy`. Never throws.
|
|
80
80
|
*/
|
|
@@ -127,7 +127,7 @@ export function classify(c) {
|
|
|
127
127
|
case 'default':
|
|
128
128
|
return [transform(c.name, EMPTY, stored, Reason.DefaultFilled)];
|
|
129
129
|
case 'default_substituted':
|
|
130
|
-
return [transform(c.name, EMPTY, stored, Reason.
|
|
130
|
+
return [transform(c.name, EMPTY, stored, Reason.DefaultMaterialized)];
|
|
131
131
|
case 'absent':
|
|
132
132
|
return [transform(c.name, EMPTY, stored, Reason.ZeroFilled)];
|
|
133
133
|
default:
|
|
@@ -215,7 +215,7 @@ function membersOf(v) {
|
|
|
215
215
|
return out;
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
|
-
* Equal after
|
|
218
|
+
* Equal after canonicalization, where a number and its decimal string spelling
|
|
219
219
|
* are the same value (5 vs "5") but a float that has thrown away 60 digits of an
|
|
220
220
|
* Int256 is not. Mirrors the arbiter's `_same_value`.
|
|
221
221
|
*/
|