@wavehouse/chtypes 0.5.2 → 1.0.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.
Files changed (195) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +34 -38
  3. package/dist/abi1/buildinfo.d.ts +40 -0
  4. package/dist/abi1/buildinfo.d.ts.map +1 -0
  5. package/dist/abi1/buildinfo.js +83 -0
  6. package/dist/abi1/buildinfo.js.map +1 -0
  7. package/dist/abi1/calls.gen.d.ts +55 -0
  8. package/dist/abi1/calls.gen.d.ts.map +1 -0
  9. package/dist/abi1/calls.gen.js +110 -0
  10. package/dist/abi1/calls.gen.js.map +1 -0
  11. package/dist/abi1/decls.gen.d.ts +115 -0
  12. package/dist/abi1/decls.gen.d.ts.map +1 -0
  13. package/dist/abi1/decls.gen.js +1613 -0
  14. package/dist/abi1/decls.gen.js.map +1 -0
  15. package/dist/abi1/errmap.gen.d.ts +18 -0
  16. package/dist/abi1/errmap.gen.d.ts.map +1 -0
  17. package/dist/abi1/errmap.gen.js +66 -0
  18. package/dist/abi1/errmap.gen.js.map +1 -0
  19. package/dist/abi1/errors.d.ts +107 -0
  20. package/dist/abi1/errors.d.ts.map +1 -0
  21. package/dist/abi1/errors.js +134 -0
  22. package/dist/abi1/errors.js.map +1 -0
  23. package/dist/abi1/handles.d.ts +31 -0
  24. package/dist/abi1/handles.d.ts.map +1 -0
  25. package/dist/abi1/handles.js +76 -0
  26. package/dist/abi1/handles.js.map +1 -0
  27. package/dist/abi1/index.d.ts +17 -0
  28. package/dist/abi1/index.d.ts.map +1 -0
  29. package/dist/abi1/index.js +17 -0
  30. package/dist/abi1/index.js.map +1 -0
  31. package/dist/abi1/libc.d.ts +54 -0
  32. package/dist/abi1/libc.d.ts.map +1 -0
  33. package/dist/abi1/libc.gen.d.ts +12 -0
  34. package/dist/abi1/libc.gen.d.ts.map +1 -0
  35. package/dist/abi1/libc.gen.js +75 -0
  36. package/dist/abi1/libc.gen.js.map +1 -0
  37. package/dist/abi1/libc.js +109 -0
  38. package/dist/abi1/libc.js.map +1 -0
  39. package/dist/abi1/loader.d.ts +99 -0
  40. package/dist/abi1/loader.d.ts.map +1 -0
  41. package/dist/abi1/loader.js +261 -0
  42. package/dist/abi1/loader.js.map +1 -0
  43. package/dist/abi1/raw.d.ts +104 -0
  44. package/dist/abi1/raw.d.ts.map +1 -0
  45. package/dist/abi1/raw.js +296 -0
  46. package/dist/abi1/raw.js.map +1 -0
  47. package/dist/abi1/strictjson.d.ts +19 -0
  48. package/dist/abi1/strictjson.d.ts.map +1 -0
  49. package/dist/abi1/strictjson.js +78 -0
  50. package/dist/abi1/strictjson.js.map +1 -0
  51. package/dist/abi1/vocab.gen.d.ts +169 -0
  52. package/dist/abi1/vocab.gen.d.ts.map +1 -0
  53. package/dist/abi1/vocab.gen.js +306 -0
  54. package/dist/abi1/vocab.gen.js.map +1 -0
  55. package/dist/cli.d.ts +25 -26
  56. package/dist/cli.d.ts.map +1 -1
  57. package/dist/cli.js +206 -218
  58. package/dist/cli.js.map +1 -1
  59. package/dist/documents.d.ts +195 -0
  60. package/dist/documents.d.ts.map +1 -0
  61. package/dist/documents.js +389 -0
  62. package/dist/documents.js.map +1 -0
  63. package/dist/env.d.ts +16 -0
  64. package/dist/env.d.ts.map +1 -0
  65. package/dist/env.js +57 -0
  66. package/dist/env.js.map +1 -0
  67. package/dist/index.d.ts +19 -24
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/index.js +17 -23
  70. package/dist/index.js.map +1 -1
  71. package/dist/json.d.ts +11 -89
  72. package/dist/json.d.ts.map +1 -1
  73. package/dist/json.js +16 -180
  74. package/dist/json.js.map +1 -1
  75. package/dist/library.d.ts +53 -309
  76. package/dist/library.d.ts.map +1 -1
  77. package/dist/library.js +77 -315
  78. package/dist/library.js.map +1 -1
  79. package/dist/ocifetch/constants.gen.d.ts +84 -0
  80. package/dist/ocifetch/constants.gen.d.ts.map +1 -0
  81. package/dist/ocifetch/constants.gen.js +92 -0
  82. package/dist/ocifetch/constants.gen.js.map +1 -0
  83. package/dist/ocifetch/dsse.d.ts +114 -0
  84. package/dist/ocifetch/dsse.d.ts.map +1 -0
  85. package/dist/ocifetch/dsse.js +331 -0
  86. package/dist/ocifetch/dsse.js.map +1 -0
  87. package/dist/ocifetch/ensure.d.ts +65 -0
  88. package/dist/ocifetch/ensure.d.ts.map +1 -0
  89. package/dist/ocifetch/ensure.js +775 -0
  90. package/dist/ocifetch/ensure.js.map +1 -0
  91. package/dist/ocifetch/errors.d.ts +92 -0
  92. package/dist/ocifetch/errors.d.ts.map +1 -0
  93. package/dist/ocifetch/errors.js +101 -0
  94. package/dist/ocifetch/errors.js.map +1 -0
  95. package/dist/ocifetch/goldens.d.ts +44 -0
  96. package/dist/ocifetch/goldens.d.ts.map +1 -0
  97. package/dist/ocifetch/goldens.js +62 -0
  98. package/dist/ocifetch/goldens.js.map +1 -0
  99. package/dist/ocifetch/http.d.ts +124 -0
  100. package/dist/ocifetch/http.d.ts.map +1 -0
  101. package/dist/ocifetch/http.js +549 -0
  102. package/dist/ocifetch/http.js.map +1 -0
  103. package/dist/ocifetch/index.d.ts +17 -0
  104. package/dist/ocifetch/index.d.ts.map +1 -0
  105. package/dist/ocifetch/index.js +14 -0
  106. package/dist/ocifetch/index.js.map +1 -0
  107. package/dist/ocifetch/layout.d.ts +126 -0
  108. package/dist/ocifetch/layout.d.ts.map +1 -0
  109. package/dist/ocifetch/layout.js +375 -0
  110. package/dist/ocifetch/layout.js.map +1 -0
  111. package/dist/ocifetch/localverify.d.ts +43 -0
  112. package/dist/ocifetch/localverify.d.ts.map +1 -0
  113. package/dist/ocifetch/localverify.js +164 -0
  114. package/dist/ocifetch/localverify.js.map +1 -0
  115. package/dist/ocifetch/lock.d.ts +39 -0
  116. package/dist/ocifetch/lock.d.ts.map +1 -0
  117. package/dist/ocifetch/lock.js +140 -0
  118. package/dist/ocifetch/lock.js.map +1 -0
  119. package/dist/ocifetch/oci.d.ts +100 -0
  120. package/dist/ocifetch/oci.d.ts.map +1 -0
  121. package/dist/ocifetch/oci.js +323 -0
  122. package/dist/ocifetch/oci.js.map +1 -0
  123. package/dist/ocifetch/referrers.d.ts +55 -0
  124. package/dist/ocifetch/referrers.d.ts.map +1 -0
  125. package/dist/ocifetch/referrers.js +132 -0
  126. package/dist/ocifetch/referrers.js.map +1 -0
  127. package/dist/ocifetch/types.d.ts +167 -0
  128. package/dist/ocifetch/types.d.ts.map +1 -0
  129. package/dist/ocifetch/types.js +88 -0
  130. package/dist/ocifetch/types.js.map +1 -0
  131. package/dist/ocifetch/unpack.d.ts +55 -0
  132. package/dist/ocifetch/unpack.d.ts.map +1 -0
  133. package/dist/ocifetch/unpack.js +205 -0
  134. package/dist/ocifetch/unpack.js.map +1 -0
  135. package/dist/registry.d.ts +38 -387
  136. package/dist/registry.d.ts.map +1 -1
  137. package/dist/registry.js +94 -819
  138. package/dist/registry.js.map +1 -1
  139. package/dist/schema.d.ts +77 -588
  140. package/dist/schema.d.ts.map +1 -1
  141. package/dist/schema.js +87 -549
  142. package/dist/schema.js.map +1 -1
  143. package/dist/settings.d.ts +27 -36
  144. package/dist/settings.d.ts.map +1 -1
  145. package/dist/settings.js +75 -25
  146. package/dist/settings.js.map +1 -1
  147. package/dist/setup.d.ts +37 -0
  148. package/dist/setup.d.ts.map +1 -0
  149. package/dist/setup.js +60 -0
  150. package/dist/setup.js.map +1 -0
  151. package/dist/tar.d.ts +27 -11
  152. package/dist/tar.d.ts.map +1 -1
  153. package/dist/tar.js +54 -32
  154. package/dist/tar.js.map +1 -1
  155. package/package.json +2 -2
  156. package/dist/discover.d.ts +0 -142
  157. package/dist/discover.d.ts.map +0 -1
  158. package/dist/discover.js +0 -288
  159. package/dist/discover.js.map +0 -1
  160. package/dist/error-codes.d.ts +0 -80
  161. package/dist/error-codes.d.ts.map +0 -1
  162. package/dist/error-codes.js +0 -139
  163. package/dist/error-codes.js.map +0 -1
  164. package/dist/errors.d.ts +0 -284
  165. package/dist/errors.d.ts.map +0 -1
  166. package/dist/errors.js +0 -321
  167. package/dist/errors.js.map +0 -1
  168. package/dist/fetch.d.ts +0 -382
  169. package/dist/fetch.d.ts.map +0 -1
  170. package/dist/fetch.js +0 -1498
  171. package/dist/fetch.js.map +0 -1
  172. package/dist/ffi.d.ts +0 -410
  173. package/dist/ffi.d.ts.map +0 -1
  174. package/dist/ffi.js +0 -1154
  175. package/dist/ffi.js.map +0 -1
  176. package/dist/format.d.ts +0 -128
  177. package/dist/format.d.ts.map +0 -1
  178. package/dist/format.js +0 -132
  179. package/dist/format.js.map +0 -1
  180. package/dist/numeric.d.ts +0 -20
  181. package/dist/numeric.d.ts.map +0 -1
  182. package/dist/numeric.js +0 -107
  183. package/dist/numeric.js.map +0 -1
  184. package/dist/paths.d.ts +0 -55
  185. package/dist/paths.d.ts.map +0 -1
  186. package/dist/paths.js +0 -87
  187. package/dist/paths.js.map +0 -1
  188. package/dist/results.d.ts +0 -495
  189. package/dist/results.d.ts.map +0 -1
  190. package/dist/results.js +0 -406
  191. package/dist/results.js.map +0 -1
  192. package/dist/transform.d.ts +0 -73
  193. package/dist/transform.d.ts.map +0 -1
  194. package/dist/transform.js +0 -533
  195. package/dist/transform.js.map +0 -1
@@ -1,139 +0,0 @@
1
- /**
2
- * The error-code table (revision 6): one loaded build's own code -> name map.
3
- *
4
- * There is no table in this package, and there must never be one. The table is
5
- * a property of the BUILD: codes join and leave between ClickHouse lines, and
6
- * one number can name two different errors on two lines (903 is
7
- * LICENSE_EXPIRED on 25.3 and 25.8, absent on 25.10, and
8
- * DISTRIBUTED_CACHE_REGISTRY_SHUTDOWN on 26.2 through 26.9). Every answer
9
- * therefore comes from `Library#errorCodes()`, i.e. from
10
- * `chs_error_codes` of the library being asked, and
11
- * `scripts/check-no-error-code-table.py` fails the build if a literal code ->
12
- * name table appears in any binding.
13
- */
14
- import { ChtypesError } from './errors.js';
15
- /**
16
- * One loaded library's own error-code table, from `chs_error_codes` — obtained
17
- * from `Library#errorCodes()` and valid for that library's ClickHouse line
18
- * only. Immutable once built.
19
- *
20
- * Lookups answer only what the build's own table holds: an unknown code, a
21
- * negative code (the ABI's -1 and -2 sentinels included — they are not
22
- * ClickHouse codes) or an unknown name is `undefined`, never a synthesized
23
- * spelling. Names match exactly and case-sensitively, as the server prints
24
- * them.
25
- */
26
- export class ErrorCodeTable {
27
- entries;
28
- byCode;
29
- byName;
30
- /** @internal — obtained from `Library#errorCodes()`. */
31
- constructor(entries) {
32
- const byCode = new Map();
33
- const byName = new Map();
34
- const kept = [];
35
- for (const e of entries) {
36
- // Not a name, not a ClickHouse code, or a repeat: the first entry for a
37
- // code or a name wins, and nothing else is invented.
38
- if (e.name === '' || e.code < 0 || byCode.has(e.code) || byName.has(e.name))
39
- continue;
40
- byCode.set(e.code, e.name);
41
- byName.set(e.name, e.code);
42
- kept.push(Object.freeze({ code: e.code, name: e.name }));
43
- }
44
- kept.sort((a, b) => a.code - b.code);
45
- this.entries = Object.freeze(kept);
46
- this.byCode = byCode;
47
- this.byName = byName;
48
- }
49
- /**
50
- * The name this build gives `code`.
51
- *
52
- * @returns the name, or `undefined` for an unknown or negative code.
53
- */
54
- name(code) {
55
- if (code < 0)
56
- return undefined;
57
- return this.byCode.get(code);
58
- }
59
- /**
60
- * The code this build gives `name` — an exact, case-sensitive match.
61
- *
62
- * @returns the code, or `undefined` for an unknown name.
63
- */
64
- code(name) {
65
- return this.byName.get(name);
66
- }
67
- /** Every entry, in ascending code order. */
68
- all() {
69
- return this.entries;
70
- }
71
- /** Iterates the entries in ascending code order, as `all()` returns them. */
72
- [Symbol.iterator]() {
73
- return this.entries[Symbol.iterator]();
74
- }
75
- }
76
- function bad(why) {
77
- return new ChtypesError(`chtypes: bad chs_error_codes document: ${why}`);
78
- }
79
- /**
80
- * Build a table from a `chs_error_codes` document,
81
- * `{"error_codes":[{"code":N,"name":"…"}, …]}`. Unknown keys are ignored and
82
- * an absent (or null) key is its default, like every document this ABI hands
83
- * back; a value of the wrong type is a bad document, never a guess.
84
- *
85
- * Not re-exported from the package: it is the parser `Library#errorCodes()`
86
- * runs, exported for this binding's own tests.
87
- */
88
- export function parseErrorCodes(doc) {
89
- let parsed;
90
- try {
91
- parsed = JSON.parse(typeof doc === 'string' ? doc : doc.toString('utf8'));
92
- }
93
- catch (err) {
94
- throw bad(err.message);
95
- }
96
- if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
97
- throw bad('not a JSON object');
98
- const rows = parsed['error_codes'] ?? [];
99
- if (!Array.isArray(rows))
100
- throw bad('error_codes is not an array');
101
- const entries = [];
102
- for (const row of rows) {
103
- if (row === null || typeof row !== 'object' || Array.isArray(row))
104
- throw bad('an entry is not an object');
105
- const code = row['code'] ?? 0;
106
- const name = row['name'] ?? '';
107
- if (typeof code !== 'number' || !Number.isInteger(code) || typeof name !== 'string') {
108
- throw bad(`entry ${JSON.stringify(row)}`);
109
- }
110
- entries.push({ code, name });
111
- }
112
- return new ErrorCodeTable(entries);
113
- }
114
- /**
115
- * One library's table once it has been built, and only then. A `null` answer
116
- * from `chs_error_codes` is a guarded exception inside the library — transient
117
- * by definition — so it throws `ChtypesError` and is NOT remembered: the next
118
- * call asks again. A missing symbol throws the decline type and is not
119
- * remembered either.
120
- *
121
- * Not re-exported from the package: `Library` holds one, and this binding's
122
- * own tests drive it directly.
123
- */
124
- export class ErrorCodeCache {
125
- table;
126
- get(fetch) {
127
- if (this.table !== undefined)
128
- return this.table;
129
- const doc = fetch();
130
- if (doc === null) {
131
- throw new ChtypesError('chtypes: chs_error_codes returned no document (a guarded exception inside the library); ' +
132
- 'nothing was cached, so the next call asks again');
133
- }
134
- const table = parseErrorCodes(doc);
135
- this.table = table;
136
- return table;
137
- }
138
- }
139
- //# sourceMappingURL=error-codes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE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ACF"}
package/dist/errors.d.ts DELETED
@@ -1,284 +0,0 @@
1
- /**
2
- * The error model, which is three outcomes that must never be conflated
3
- * (the C ABI contract §Error model):
4
- *
5
- * - ClickHouse rejects -> a real ClickHouse error code
6
- * - this build refuses -> CODE_UNSUPPORTED (-2), never a ClickHouse code
7
- * - ClickHouse accepts but the value cannot be read back -> usually code 691; it
8
- * is an ACCEPTED insert, surfaced through the row outcome rather than here.
9
- *
10
- * Mapping `unsupported` onto a rejection manufactures an over-reject the product
11
- * never made; mapping it onto an acceptance manufactures an over-accept, which
12
- * is the cardinal sin. So it gets its own sentinel on the wire and, since
13
- * 2026-08-26, its own ERROR CLASS here — `UnsupportedError`, a peer of
14
- * `SchemaError` rather than a subclass, so that a `catch` which handles only
15
- * `SchemaError` cannot silently swallow a decline as a rejection.
16
- */
17
- /** "This build refuses to answer." Never a real ClickHouse error code. */
18
- export declare const CODE_UNSUPPORTED = -2;
19
- /**
20
- * The chs_* ABI revision this binding was written against — `CHS_ABI_REVISION`
21
- * in `include/chtypes.h`.
22
- *
23
- * This package dlopens artifacts rather than compiling against the header, so
24
- * this is a hand-kept mirror and MUST be bumped in the same cycle the header
25
- * is. A `Registry` refuses an artifact reporting a different nonzero revision;
26
- * 0 means the artifact predates the probe, which is ignorance rather than
27
- * incompatibility (docs/reference/artifact.md §Loading).
28
- *
29
- * Revision 3 (2026-08-31): `chs_rows` gained `export_format` / `doc_flags` /
30
- * `out_bytes`, and the `chs_filter_compile` / `chs_filter_free` /
31
- * `chs_filter_rows` trio joined the surface.
32
- *
33
- * Revision 4 (2026-08-31, the filter phase-2 cycle): `chs_filter_compile`
34
- * gained `params_json` (`{name:Type}` query parameters), and the block twin
35
- * joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`.
36
- *
37
- * Revision 5 (2026-09-15, the explicit INSERT column list): `chs_row`,
38
- * `chs_rows` and `chs_block_parse` each gained a trailing `columns_json` —
39
- * `RowsOptions#columns`. This binding therefore speaks 5 and refuses
40
- * revision-4 artifacts — calling the 6-argument `chs_row` (or the
41
- * 9-argument `chs_rows`, or the 8-argument `chs_block_parse`) through a
42
- * revision-4 artifact's shorter declaration is undefined behavior, which is
43
- * exactly what the gate exists to prevent.
44
- *
45
- * Revision 6 (the error-code table and the partition key): `chs_error_codes`
46
- * and `chs_schema_partition_by` joined the surface. Purely additive, and still
47
- * a new number: this binding speaks 6 and refuses revision-5 artifacts.
48
- */
49
- export declare const ABI_REVISION = 6;
50
- /** Base class for everything this package throws. */
51
- export declare class ChtypesError extends Error {
52
- constructor(message: string, options?: {
53
- cause?: unknown;
54
- });
55
- }
56
- /** A registry could not be loaded, or a version could not be resolved. */
57
- export declare class RegistryError extends ChtypesError {
58
- }
59
- /**
60
- * This artifact IMAGE is already initialized under a different timezone.
61
- *
62
- * `dlopen` maps one image per file, and `chs_init` runs at most once per
63
- * image, so a second load asking for another zone can be neither honored nor
64
- * silently ignored: re-running `chs_init` would move the zone under the first
65
- * load's live libraries. A hardlink or symlink to a loaded artifact is that
66
- * same image and is refused the same way.
67
- *
68
- * A `RegistryError`, because it is a reason the loader cannot serve this
69
- * request — so a `catch` written against `for()`'s documented `RegistryError`
70
- * keeps working — and matched with `instanceof InitConflictError`, like every
71
- * other class here. Not an `ArtifactError`: the artifact is fine, and none of
72
- * the shared fetch codes describes it.
73
- */
74
- export declare class InitConflictError extends RegistryError {
75
- /** The artifact path this load asked for, as given. */
76
- readonly path: string;
77
- /** The timezone the image is live under. */
78
- readonly have: string;
79
- /** The timezone this load asked for, refused. */
80
- readonly want: string;
81
- constructor(path: string, have: string, want: string);
82
- }
83
- /**
84
- * A REFUSAL: ClickHouse itself refused a type, a column list, an engine or a
85
- * TTL.
86
- *
87
- * `code` is ALWAYS a real ClickHouse error code. "This build declines to
88
- * answer" is a DIFFERENT CLASS — `UnsupportedError` — never this one carrying
89
- * a sentinel, so no `SchemaError` ever holds `CODE_UNSUPPORTED`
90
- * (docs/reference/bindings.md rule 12).
91
- */
92
- export declare class SchemaError extends ChtypesError {
93
- readonly code: number;
94
- readonly detail: string;
95
- readonly column: string | undefined;
96
- constructor(code: number, detail: string, column?: string);
97
- }
98
- /**
99
- * A DECLINE: "a real server might well have accepted this; I will not guess."
100
- * Never ClickHouse rejecting anything, so it carries no `code` property at all
101
- * — there is no code to carry.
102
- *
103
- * It is a PEER of `SchemaError`, deliberately NOT a subclass and deliberately
104
- * NOT matched by `err instanceof SchemaError`. A decline that still satisfied
105
- * "is a SchemaError" would be the sentinel problem wearing a class hierarchy:
106
- * every `catch` that forgot the predicate would keep silently turning declines
107
- * into rejections, which is a manufactured over-reject — data loss the product
108
- * never made, budgeted at zero. As a peer, forgetting throws on past the
109
- * handler, which is loud.
110
- *
111
- * ```ts
112
- * try {
113
- * schema.setEngine(engine, orderBy);
114
- * } catch (err) {
115
- * // validate cautiously; do NOT blame the tenant
116
- * if (err instanceof UnsupportedError) return degradeToCarefulPath(err);
117
- * // ClickHouse refused: err.code is its own code
118
- * if (err instanceof SchemaError) return rejectWith(err.code, err.detail);
119
- * throw err;
120
- * }
121
- * ```
122
- *
123
- * The MESSAGE still renders the ABI's `CODE_UNSUPPORTED` sentinel in the shape
124
- * `SchemaError` renders its code. The sentinel is not a property of this class
125
- * — it is the wire value the C ABI returned — but the rendering is frozen: the
126
- * conformance driver puts this exact string on the protocol wire as an
127
- * `unsupported` scope, and Python's `UnsupportedError` already spells it this
128
- * way. Changing the text would move rig records without changing a verdict.
129
- */
130
- export declare class UnsupportedError extends ChtypesError {
131
- readonly detail: string;
132
- readonly column: string | undefined;
133
- constructor(detail: string, column?: string);
134
- }
135
- /**
136
- * The ONE place an ABI error code becomes an error object, so the
137
- * refusal/decline split cannot be decided differently in two files.
138
- *
139
- * The SIGN decides (docs/reference/bindings.md rule 12, the C ABI contract §Error model): a
140
- * positive code is the server's own refusal and rides through verbatim; any
141
- * negative code is this library declining (`-2` "I will not guess", `-1` a
142
- * guarded exception, and a binding's own missing-symbol sentinel) and becomes
143
- * an `UnsupportedError`. Keying on the sign rather than on `=== CODE_UNSUPPORTED`
144
- * means a negative sentinel a later era adds can never become "a SchemaError
145
- * with a negative code", which the class's own contract forbids.
146
- *
147
- * Internal: not re-exported from the package index.
148
- */
149
- export declare function schemaErrorFor(code: number, detail: string, column?: string): SchemaError | UnsupportedError;
150
- /**
151
- * The codes docs/guides/fetch.md §6 shares across every SDK, as named constants.
152
- *
153
- * Each error below carries its own `code`, and a caller matches on it. Naming
154
- * them here is what lets that caller write `err.code === CODE_ARTIFACT_PINNED`
155
- * instead of retyping the string — which is exactly why the Go, Python and Rust
156
- * bindings all export them, and why this one already exported
157
- * `CODE_UNSUPPORTED`. A typo in a hand-written literal is a comparison that is
158
- * silently always false.
159
- */
160
- export declare const CODE_ARTIFACT_MISSING = "CHTYPES_ARTIFACT_MISSING";
161
- /** docs/guides/fetch.md §6: the signature did not verify against the trust list. */
162
- export declare const CODE_ARTIFACT_UNTRUSTED = "CHTYPES_ARTIFACT_UNTRUSTED";
163
- /** docs/guides/fetch.md §6: a hash mismatch, or a release that disagrees with itself. */
164
- export declare const CODE_ARTIFACT_CORRUPT = "CHTYPES_ARTIFACT_CORRUPT";
165
- /** docs/guides/fetch.md §6: `--frozen` refused an asset the lock file does not pin. */
166
- export declare const CODE_ARTIFACT_PINNED = "CHTYPES_ARTIFACT_PINNED";
167
- /** docs/guides/fetch.md §6: the release offers nothing for this platform or line. */
168
- export declare const CODE_ARTIFACT_UNPUBLISHED = "CHTYPES_ARTIFACT_UNPUBLISHED";
169
- /** docs/guides/fetch.md §6: the source could not be reached or does not serve the release. */
170
- export declare const CODE_SOURCE_UNREACHABLE = "CHTYPES_SOURCE_UNREACHABLE";
171
- /** The codes docs/guides/fetch.md §7 shares across every SDK. */
172
- export type ArtifactErrorCode = typeof CODE_ARTIFACT_MISSING | typeof CODE_ARTIFACT_UNTRUSTED | typeof CODE_ARTIFACT_CORRUPT | typeof CODE_ARTIFACT_PINNED | typeof CODE_ARTIFACT_UNPUBLISHED | typeof CODE_SOURCE_UNREACHABLE;
173
- /**
174
- * The single catchable type for every artifact-loading condition: a missing
175
- * artifact (`ArtifactMissingError`) or one of the five fetch/verify verdicts
176
- * (`FetchError`'s subclasses) — the six conditions docs/guides/fetch.md §3, §5
177
- * and §7 name. A caller that wants "the loader could not produce a usable
178
- * artifact" now catches exactly this one class, matching Python's
179
- * `ArtifactError`, Go's `*ArtifactError` (`.Code`), and Rust's
180
- * `Error::artifact_code()` (chtypes-sdk#13 A3, aligned 2026-09-15) — before
181
- * this, `ArtifactMissingError` was a `RegistryError` while the other five
182
- * were unrelated `FetchError`s, and a caller had to catch both types to
183
- * cover all six conditions.
184
- *
185
- * A `RegistryError`, because every one of these is a reason the loader could
186
- * not serve a version — `catch`es written against the pre-existing
187
- * `RegistryError` contract keep working unchanged.
188
- */
189
- export declare abstract class ArtifactError extends RegistryError {
190
- abstract readonly code: ArtifactErrorCode;
191
- }
192
- /** The command this SDK's §7 message tells a user to run. */
193
- export declare const FETCH_COMMAND = "npx @wavehouse/chtypes fetch";
194
- /**
195
- * The §7 message, verbatim apart from the bracketed parts:
196
- *
197
- * chtypes: no artifact for ClickHouse <line> (<os>-<arch>). Looked in: <dir1>, <dir2>, ….
198
- * Install it: npx @wavehouse/chtypes fetch <line>
199
- * or set CHTYPES_AUTOFETCH=1 to fetch on first use.
200
- */
201
- export declare function artifactMissingMessage(line: string, platform: string, lookedIn: readonly string[]): string;
202
- /**
203
- * The one identifiable error for a missing artifact (docs/guides/fetch.md §7):
204
- * a `Registry` was asked for a line that no directory on its search path
205
- * holds. `code` is `'CHTYPES_ARTIFACT_MISSING'`; the message is the
206
- * contract's, and names every directory that was looked in and the command
207
- * that installs the line.
208
- *
209
- * A subclass of `ArtifactError` (itself a `RegistryError`), so a `catch`
210
- * written against `for()`'s documented `RegistryError`, or against the
211
- * single catchable `ArtifactError`, both keep working; the `code` is what a
212
- * caller matches on.
213
- */
214
- export declare class ArtifactMissingError extends ArtifactError {
215
- readonly code: 'CHTYPES_ARTIFACT_MISSING';
216
- /** The minor line that was asked for, e.g. `25.8`. */
217
- readonly line: string;
218
- /** The platform key the registry serves, e.g. `darwin-arm64`. */
219
- readonly platform: string;
220
- /** Every directory of the search path, in order. */
221
- readonly lookedIn: readonly string[];
222
- constructor(line: string, platform: string, lookedIn: readonly string[]);
223
- }
224
- /**
225
- * Base of the fetch-time verdicts (docs/guides/fetch.md §3–§7). `code` is one of the
226
- * shared codes; the subclasses exist so `instanceof` reads as well as `code`.
227
- *
228
- * An `ArtifactError`, alongside `ArtifactMissingError` — so `catch (err) { if
229
- * (err instanceof ArtifactError) … }` handles all six artifact conditions in
230
- * one arm, while `instanceof FetchError` still isolates these five verdicts
231
- * from a missing artifact when that distinction matters.
232
- */
233
- export declare class FetchError extends ArtifactError {
234
- readonly code: Exclude<ArtifactErrorCode, 'CHTYPES_ARTIFACT_MISSING'>;
235
- constructor(code: Exclude<ArtifactErrorCode, 'CHTYPES_ARTIFACT_MISSING'>, message: string, options?: {
236
- cause?: unknown;
237
- });
238
- }
239
- /**
240
- * `CHTYPES_ARTIFACT_UNTRUSTED`: the release's `SHA256SUMS.sig` is absent,
241
- * malformed, or does not verify with any trusted key. Nothing is downloaded
242
- * around it (§3 step 0).
243
- */
244
- export declare class ArtifactUntrustedError extends FetchError {
245
- constructor(message: string, options?: {
246
- cause?: unknown;
247
- });
248
- }
249
- /**
250
- * `CHTYPES_ARTIFACT_CORRUPT`: any hash mismatch along the chain, a release
251
- * that disagrees with itself (`index.json` vs `SHA256SUMS`, manifest vs
252
- * index), or an archive that cannot be read safely.
253
- */
254
- export declare class ArtifactCorruptError extends FetchError {
255
- constructor(message: string, options?: {
256
- cause?: unknown;
257
- });
258
- }
259
- /**
260
- * `CHTYPES_ARTIFACT_PINNED`: a `--frozen` lock file names a different asset
261
- * or sha256 for this line — or none at all — and the fetch refused it (§5).
262
- */
263
- export declare class ArtifactPinnedError extends FetchError {
264
- constructor(message: string, options?: {
265
- cause?: unknown;
266
- });
267
- }
268
- /** `CHTYPES_ARTIFACT_UNPUBLISHED`: the release has nothing for this platform, line or exact patch. */
269
- export declare class ArtifactUnpublishedError extends FetchError {
270
- constructor(message: string, options?: {
271
- cause?: unknown;
272
- });
273
- }
274
- /**
275
- * `CHTYPES_SOURCE_UNREACHABLE`: the source could not be reached or does not
276
- * serve the release files — or `offline` forbade reaching it and the line is
277
- * not installed and verified.
278
- */
279
- export declare class SourceUnreachableError extends FetchError {
280
- constructor(message: string, options?: {
281
- cause?: unknown;
282
- });
283
- }
284
- //# sourceMappingURL=errors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,qDAAqD;AACrD,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACF;AAED,0EAA0E;AAC1E,qBAAa,aAAc,SAAQ,YAAY;CAAG;AAElD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EASnD;CACF;AAED;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QA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