@wavehouse/chtypes 0.1.1 → 0.2.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 (51) hide show
  1. package/CHANGELOG.md +43 -38
  2. package/README.md +45 -414
  3. package/dist/cli.d.ts +1 -1
  4. package/dist/cli.js +1 -1
  5. package/dist/discover.d.ts +2 -2
  6. package/dist/discover.js +2 -2
  7. package/dist/errors.d.ts +60 -13
  8. package/dist/errors.d.ts.map +1 -1
  9. package/dist/errors.js +64 -11
  10. package/dist/errors.js.map +1 -1
  11. package/dist/fetch.d.ts +15 -8
  12. package/dist/fetch.d.ts.map +1 -1
  13. package/dist/fetch.js +15 -8
  14. package/dist/fetch.js.map +1 -1
  15. package/dist/ffi.d.ts +15 -15
  16. package/dist/ffi.js +26 -26
  17. package/dist/ffi.js.map +1 -1
  18. package/dist/format.d.ts +5 -5
  19. package/dist/format.js +5 -5
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/index.js.map +1 -1
  24. package/dist/json.d.ts +3 -3
  25. package/dist/json.js +5 -5
  26. package/dist/json.js.map +1 -1
  27. package/dist/library.d.ts +11 -11
  28. package/dist/library.js +9 -9
  29. package/dist/numeric.js +1 -1
  30. package/dist/paths.d.ts +5 -1
  31. package/dist/paths.d.ts.map +1 -1
  32. package/dist/paths.js +7 -3
  33. package/dist/paths.js.map +1 -1
  34. package/dist/registry.d.ts +6 -6
  35. package/dist/registry.d.ts.map +1 -1
  36. package/dist/registry.js +14 -11
  37. package/dist/registry.js.map +1 -1
  38. package/dist/results.d.ts +65 -28
  39. package/dist/results.d.ts.map +1 -1
  40. package/dist/results.js +95 -10
  41. package/dist/results.js.map +1 -1
  42. package/dist/schema.d.ts +23 -22
  43. package/dist/schema.d.ts.map +1 -1
  44. package/dist/schema.js +15 -15
  45. package/dist/schema.js.map +1 -1
  46. package/dist/settings.d.ts +4 -4
  47. package/dist/settings.js +2 -2
  48. package/dist/settings.js.map +1 -1
  49. package/dist/transform.d.ts +2 -2
  50. package/dist/transform.js +5 -5
  51. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * `chtypes` — the one CLI surface every SDK carries (docs/fetch.md §6),
3
+ * `chtypes` — the one CLI surface every SDK carries (docs/guides/fetch.md §6),
4
4
  * spelled identically in all four:
5
5
  *
6
6
  * chtypes fetch <line>... [--all] [--platform <os-arch>] [--dest <dir>]
@@ -10,7 +10,7 @@
10
10
  * profile.settings -> compileDdl({ settings }) (compile-time) and per-call settings
11
11
  * columns -> reconstructDdl -> compileDdl
12
12
  *
13
- * The pattern, in full (spec/bindings.md §Discovery):
13
+ * The pattern, in full (docs/reference/bindings.md §Discovery):
14
14
  *
15
15
  * 1. run QUERY_SERVER_VERSION, QUERY_CHANGED_SETTINGS once per connection
16
16
  * 2. cache the ServerProfile per deployment/tenant
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * Never ask the customer for their settings — ask their server. The queries
22
22
  * return exactly what the server believes, spelled the way the server spells
23
- * it, which is what the settings gate (spec/c-abi.md, Settings rule 2)
23
+ * it, which is what the settings gate (the C ABI contract, Settings rule 2)
24
24
  * validates against.
25
25
  *
26
26
  * The parsers read JSONEachRow bytes through this package's own byte-exact
package/dist/discover.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * profile.settings -> compileDdl({ settings }) (compile-time) and per-call settings
11
11
  * columns -> reconstructDdl -> compileDdl
12
12
  *
13
- * The pattern, in full (spec/bindings.md §Discovery):
13
+ * The pattern, in full (docs/reference/bindings.md §Discovery):
14
14
  *
15
15
  * 1. run QUERY_SERVER_VERSION, QUERY_CHANGED_SETTINGS once per connection
16
16
  * 2. cache the ServerProfile per deployment/tenant
@@ -20,7 +20,7 @@
20
20
  *
21
21
  * Never ask the customer for their settings — ask their server. The queries
22
22
  * return exactly what the server believes, spelled the way the server spells
23
- * it, which is what the settings gate (spec/c-abi.md, Settings rule 2)
23
+ * it, which is what the settings gate (the C ABI contract, Settings rule 2)
24
24
  * validates against.
25
25
  *
26
26
  * The parsers read JSONEachRow bytes through this package's own byte-exact
package/dist/errors.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The error model, which is three outcomes that must never be conflated
3
- * (spec/c-abi.md §Error model):
3
+ * (the C ABI contract §Error model):
4
4
  *
5
5
  * - ClickHouse rejects -> a real ClickHouse error code
6
6
  * - this build refuses -> CODE_UNSUPPORTED (-2), never a ClickHouse code
@@ -24,7 +24,7 @@ export declare const CODE_UNSUPPORTED = -2;
24
24
  * this is a hand-kept mirror and MUST be bumped in the same cycle the header
25
25
  * is. A `Registry` refuses an artifact reporting a different nonzero revision;
26
26
  * 0 means the artifact predates the probe, which is ignorance rather than
27
- * incompatibility (spec/artifact.md §Loading).
27
+ * incompatibility (docs/reference/artifact.md §Loading).
28
28
  *
29
29
  * Revision 3 (2026-08-31): `chs_rows` gained `export_format` / `doc_flags` /
30
30
  * `out_bytes`, and the `chs_filter_compile` / `chs_filter_free` /
@@ -35,7 +35,7 @@ export declare const CODE_UNSUPPORTED = -2;
35
35
  * joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`. This
36
36
  * binding therefore speaks 4 and refuses revision-3 artifacts — calling the
37
37
  * 5-argument `chs_filter_compile` through the 4-argument revision-3 artifact
38
- * is undefined behaviour, which is exactly what the gate exists to prevent.
38
+ * is undefined behavior, which is exactly what the gate exists to prevent.
39
39
  */
40
40
  export declare const ABI_REVISION = 4;
41
41
  /** Base class for everything this package throws. */
@@ -54,7 +54,7 @@ export declare class RegistryError extends ChtypesError {
54
54
  * `code` is ALWAYS a real ClickHouse error code. "This build declines to
55
55
  * answer" is a DIFFERENT CLASS — `UnsupportedError` — never this one carrying
56
56
  * a sentinel, so no `SchemaError` ever holds `CODE_UNSUPPORTED`
57
- * (spec/bindings.md rule 12).
57
+ * (docs/reference/bindings.md rule 12).
58
58
  */
59
59
  export declare class SchemaError extends ChtypesError {
60
60
  readonly code: number;
@@ -103,7 +103,7 @@ export declare class UnsupportedError extends ChtypesError {
103
103
  * The ONE place an ABI error code becomes an error object, so the
104
104
  * refusal/decline split cannot be decided differently in two files.
105
105
  *
106
- * The SIGN decides (spec/bindings.md rule 12, spec/c-abi.md §Error model): a
106
+ * The SIGN decides (docs/reference/bindings.md rule 12, the C ABI contract §Error model): a
107
107
  * positive code is the server's own refusal and rides through verbatim; any
108
108
  * negative code is this library declining (`-2` "I will not guess", `-1` a
109
109
  * guarded exception, and a binding's own missing-symbol sentinel) and becomes
@@ -114,8 +114,48 @@ export declare class UnsupportedError extends ChtypesError {
114
114
  * Internal: not re-exported from the package index.
115
115
  */
116
116
  export declare function schemaErrorFor(code: number, detail: string, column?: string): SchemaError | UnsupportedError;
117
- /** The codes docs/fetch.md §7 shares across every SDK. */
118
- export type ArtifactErrorCode = 'CHTYPES_ARTIFACT_MISSING' | 'CHTYPES_ARTIFACT_UNTRUSTED' | 'CHTYPES_ARTIFACT_CORRUPT' | 'CHTYPES_ARTIFACT_PINNED' | 'CHTYPES_ARTIFACT_UNPUBLISHED' | 'CHTYPES_SOURCE_UNREACHABLE';
117
+ /**
118
+ * The codes docs/guides/fetch.md §6 shares across every SDK, as named constants.
119
+ *
120
+ * Each error below carries its own `code`, and a caller matches on it. Naming
121
+ * them here is what lets that caller write `err.code === CODE_ARTIFACT_PINNED`
122
+ * instead of retyping the string — which is exactly why the Go, Python and Rust
123
+ * bindings all export them, and why this one already exported
124
+ * `CODE_UNSUPPORTED`. A typo in a hand-written literal is a comparison that is
125
+ * silently always false.
126
+ */
127
+ export declare const CODE_ARTIFACT_MISSING = "CHTYPES_ARTIFACT_MISSING";
128
+ /** docs/guides/fetch.md §6: the signature did not verify against the trust list. */
129
+ export declare const CODE_ARTIFACT_UNTRUSTED = "CHTYPES_ARTIFACT_UNTRUSTED";
130
+ /** docs/guides/fetch.md §6: a hash mismatch, or a release that disagrees with itself. */
131
+ export declare const CODE_ARTIFACT_CORRUPT = "CHTYPES_ARTIFACT_CORRUPT";
132
+ /** docs/guides/fetch.md §6: `--frozen` refused an asset the lock file does not pin. */
133
+ export declare const CODE_ARTIFACT_PINNED = "CHTYPES_ARTIFACT_PINNED";
134
+ /** docs/guides/fetch.md §6: the release offers nothing for this platform or line. */
135
+ export declare const CODE_ARTIFACT_UNPUBLISHED = "CHTYPES_ARTIFACT_UNPUBLISHED";
136
+ /** docs/guides/fetch.md §6: the source could not be reached or does not serve the release. */
137
+ export declare const CODE_SOURCE_UNREACHABLE = "CHTYPES_SOURCE_UNREACHABLE";
138
+ /** The codes docs/guides/fetch.md §7 shares across every SDK. */
139
+ 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;
140
+ /**
141
+ * The single catchable type for every artifact-loading condition: a missing
142
+ * artifact (`ArtifactMissingError`) or one of the five fetch/verify verdicts
143
+ * (`FetchError`'s subclasses) — the six conditions docs/guides/fetch.md §3, §5
144
+ * and §7 name. A caller that wants "the loader could not produce a usable
145
+ * artifact" now catches exactly this one class, matching Python's
146
+ * `ArtifactError`, Go's `*ArtifactError` (`.Code`), and Rust's
147
+ * `Error::artifact_code()` (chtypes-sdk#13 A3, aligned 2026-09-15) — before
148
+ * this, `ArtifactMissingError` was a `RegistryError` while the other five
149
+ * were unrelated `FetchError`s, and a caller had to catch both types to
150
+ * cover all six conditions.
151
+ *
152
+ * A `RegistryError`, because every one of these is a reason the loader could
153
+ * not serve a version — `catch`es written against the pre-existing
154
+ * `RegistryError` contract keep working unchanged.
155
+ */
156
+ export declare abstract class ArtifactError extends RegistryError {
157
+ abstract readonly code: ArtifactErrorCode;
158
+ }
119
159
  /** The command this SDK's §7 message tells a user to run. */
120
160
  export declare const FETCH_COMMAND = "npx @wavehouse/chtypes fetch";
121
161
  /**
@@ -127,16 +167,18 @@ export declare const FETCH_COMMAND = "npx @wavehouse/chtypes fetch";
127
167
  */
128
168
  export declare function artifactMissingMessage(line: string, platform: string, lookedIn: readonly string[]): string;
129
169
  /**
130
- * The one identifiable error for a missing artifact (docs/fetch.md §7):
170
+ * The one identifiable error for a missing artifact (docs/guides/fetch.md §7):
131
171
  * a `Registry` was asked for a line that no directory on its search path
132
172
  * holds. `code` is `'CHTYPES_ARTIFACT_MISSING'`; the message is the
133
173
  * contract's, and names every directory that was looked in and the command
134
174
  * that installs the line.
135
175
  *
136
- * A subclass of `RegistryError`, so a `catch` written against `for()`'s
137
- * documented error keeps working; the `code` is what a caller matches on.
176
+ * A subclass of `ArtifactError` (itself a `RegistryError`), so a `catch`
177
+ * written against `for()`'s documented `RegistryError`, or against the
178
+ * single catchable `ArtifactError`, both keep working; the `code` is what a
179
+ * caller matches on.
138
180
  */
139
- export declare class ArtifactMissingError extends RegistryError {
181
+ export declare class ArtifactMissingError extends ArtifactError {
140
182
  readonly code: 'CHTYPES_ARTIFACT_MISSING';
141
183
  /** The minor line that was asked for, e.g. `25.8`. */
142
184
  readonly line: string;
@@ -147,10 +189,15 @@ export declare class ArtifactMissingError extends RegistryError {
147
189
  constructor(line: string, platform: string, lookedIn: readonly string[]);
148
190
  }
149
191
  /**
150
- * Base of the fetch-time verdicts (docs/fetch.md §3–§7). `code` is one of the
192
+ * Base of the fetch-time verdicts (docs/guides/fetch.md §3–§7). `code` is one of the
151
193
  * shared codes; the subclasses exist so `instanceof` reads as well as `code`.
194
+ *
195
+ * An `ArtifactError`, alongside `ArtifactMissingError` — so `catch (err) { if
196
+ * (err instanceof ArtifactError) … }` handles all six artifact conditions in
197
+ * one arm, while `instanceof FetchError` still isolates these five verdicts
198
+ * from a missing artifact when that distinction matters.
152
199
  */
153
- export declare class FetchError extends ChtypesError {
200
+ export declare class FetchError extends ArtifactError {
154
201
  readonly code: Exclude<ArtifactErrorCode, 'CHTYPES_ARTIFACT_MISSING'>;
155
202
  constructor(code: Exclude<ArtifactErrorCode, 'CHTYPES_ARTIFACT_MISSING'>, message: string, options?: {
156
203
  cause?: unknown;
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;GAoBG;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;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,YAAY,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EASxD;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,YAAY,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAQ1C;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE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AE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAEzD;CACF;AAED,sGAAsG;AACtG,qBAAa,wBAAyB,SAAQ,UAAU;IACtD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAEzD;CACF;AAED;;;;GAIG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;IACpD,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAEzD;CACF"}
package/dist/errors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The error model, which is three outcomes that must never be conflated
3
- * (spec/c-abi.md §Error model):
3
+ * (the C ABI contract §Error model):
4
4
  *
5
5
  * - ClickHouse rejects -> a real ClickHouse error code
6
6
  * - this build refuses -> CODE_UNSUPPORTED (-2), never a ClickHouse code
@@ -24,7 +24,7 @@ export const CODE_UNSUPPORTED = -2;
24
24
  * this is a hand-kept mirror and MUST be bumped in the same cycle the header
25
25
  * is. A `Registry` refuses an artifact reporting a different nonzero revision;
26
26
  * 0 means the artifact predates the probe, which is ignorance rather than
27
- * incompatibility (spec/artifact.md §Loading).
27
+ * incompatibility (docs/reference/artifact.md §Loading).
28
28
  *
29
29
  * Revision 3 (2026-08-31): `chs_rows` gained `export_format` / `doc_flags` /
30
30
  * `out_bytes`, and the `chs_filter_compile` / `chs_filter_free` /
@@ -35,7 +35,7 @@ export const CODE_UNSUPPORTED = -2;
35
35
  * joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`. This
36
36
  * binding therefore speaks 4 and refuses revision-3 artifacts — calling the
37
37
  * 5-argument `chs_filter_compile` through the 4-argument revision-3 artifact
38
- * is undefined behaviour, which is exactly what the gate exists to prevent.
38
+ * is undefined behavior, which is exactly what the gate exists to prevent.
39
39
  */
40
40
  export const ABI_REVISION = 4;
41
41
  /** Base class for everything this package throws. */
@@ -55,7 +55,7 @@ export class RegistryError extends ChtypesError {
55
55
  * `code` is ALWAYS a real ClickHouse error code. "This build declines to
56
56
  * answer" is a DIFFERENT CLASS — `UnsupportedError` — never this one carrying
57
57
  * a sentinel, so no `SchemaError` ever holds `CODE_UNSUPPORTED`
58
- * (spec/bindings.md rule 12).
58
+ * (docs/reference/bindings.md rule 12).
59
59
  */
60
60
  export class SchemaError extends ChtypesError {
61
61
  code;
@@ -117,7 +117,7 @@ export class UnsupportedError extends ChtypesError {
117
117
  * The ONE place an ABI error code becomes an error object, so the
118
118
  * refusal/decline split cannot be decided differently in two files.
119
119
  *
120
- * The SIGN decides (spec/bindings.md rule 12, spec/c-abi.md §Error model): a
120
+ * The SIGN decides (docs/reference/bindings.md rule 12, the C ABI contract §Error model): a
121
121
  * positive code is the server's own refusal and rides through verbatim; any
122
122
  * negative code is this library declining (`-2` "I will not guess", `-1` a
123
123
  * guarded exception, and a binding's own missing-symbol sentinel) and becomes
@@ -130,6 +130,52 @@ export class UnsupportedError extends ChtypesError {
130
130
  export function schemaErrorFor(code, detail, column) {
131
131
  return code < 0 ? new UnsupportedError(detail, column) : new SchemaError(code, detail, column);
132
132
  }
133
+ // ---------------------------------------------------------------- artifacts
134
+ //
135
+ // The fetch/verify contract (docs/guides/fetch.md §7) shares six codes across the
136
+ // four SDKs. Five of them are verdicts of the verification chain or of the
137
+ // source and are raised by `ensure` / the CLI; the sixth,
138
+ // `CHTYPES_ARTIFACT_MISSING`, is the loader's — raised when a registry is
139
+ // asked for a line no directory on the search path holds.
140
+ /**
141
+ * The codes docs/guides/fetch.md §6 shares across every SDK, as named constants.
142
+ *
143
+ * Each error below carries its own `code`, and a caller matches on it. Naming
144
+ * them here is what lets that caller write `err.code === CODE_ARTIFACT_PINNED`
145
+ * instead of retyping the string — which is exactly why the Go, Python and Rust
146
+ * bindings all export them, and why this one already exported
147
+ * `CODE_UNSUPPORTED`. A typo in a hand-written literal is a comparison that is
148
+ * silently always false.
149
+ */
150
+ export const CODE_ARTIFACT_MISSING = 'CHTYPES_ARTIFACT_MISSING';
151
+ /** docs/guides/fetch.md §6: the signature did not verify against the trust list. */
152
+ export const CODE_ARTIFACT_UNTRUSTED = 'CHTYPES_ARTIFACT_UNTRUSTED';
153
+ /** docs/guides/fetch.md §6: a hash mismatch, or a release that disagrees with itself. */
154
+ export const CODE_ARTIFACT_CORRUPT = 'CHTYPES_ARTIFACT_CORRUPT';
155
+ /** docs/guides/fetch.md §6: `--frozen` refused an asset the lock file does not pin. */
156
+ export const CODE_ARTIFACT_PINNED = 'CHTYPES_ARTIFACT_PINNED';
157
+ /** docs/guides/fetch.md §6: the release offers nothing for this platform or line. */
158
+ export const CODE_ARTIFACT_UNPUBLISHED = 'CHTYPES_ARTIFACT_UNPUBLISHED';
159
+ /** docs/guides/fetch.md §6: the source could not be reached or does not serve the release. */
160
+ export const CODE_SOURCE_UNREACHABLE = 'CHTYPES_SOURCE_UNREACHABLE';
161
+ /**
162
+ * The single catchable type for every artifact-loading condition: a missing
163
+ * artifact (`ArtifactMissingError`) or one of the five fetch/verify verdicts
164
+ * (`FetchError`'s subclasses) — the six conditions docs/guides/fetch.md §3, §5
165
+ * and §7 name. A caller that wants "the loader could not produce a usable
166
+ * artifact" now catches exactly this one class, matching Python's
167
+ * `ArtifactError`, Go's `*ArtifactError` (`.Code`), and Rust's
168
+ * `Error::artifact_code()` (chtypes-sdk#13 A3, aligned 2026-09-15) — before
169
+ * this, `ArtifactMissingError` was a `RegistryError` while the other five
170
+ * were unrelated `FetchError`s, and a caller had to catch both types to
171
+ * cover all six conditions.
172
+ *
173
+ * A `RegistryError`, because every one of these is a reason the loader could
174
+ * not serve a version — `catch`es written against the pre-existing
175
+ * `RegistryError` contract keep working unchanged.
176
+ */
177
+ export class ArtifactError extends RegistryError {
178
+ }
133
179
  /** The command this SDK's §7 message tells a user to run. */
134
180
  export const FETCH_COMMAND = 'npx @wavehouse/chtypes fetch';
135
181
  /**
@@ -145,16 +191,18 @@ export function artifactMissingMessage(line, platform, lookedIn) {
145
191
  'or set CHTYPES_AUTOFETCH=1 to fetch on first use.');
146
192
  }
147
193
  /**
148
- * The one identifiable error for a missing artifact (docs/fetch.md §7):
194
+ * The one identifiable error for a missing artifact (docs/guides/fetch.md §7):
149
195
  * a `Registry` was asked for a line that no directory on its search path
150
196
  * holds. `code` is `'CHTYPES_ARTIFACT_MISSING'`; the message is the
151
197
  * contract's, and names every directory that was looked in and the command
152
198
  * that installs the line.
153
199
  *
154
- * A subclass of `RegistryError`, so a `catch` written against `for()`'s
155
- * documented error keeps working; the `code` is what a caller matches on.
200
+ * A subclass of `ArtifactError` (itself a `RegistryError`), so a `catch`
201
+ * written against `for()`'s documented `RegistryError`, or against the
202
+ * single catchable `ArtifactError`, both keep working; the `code` is what a
203
+ * caller matches on.
156
204
  */
157
- export class ArtifactMissingError extends RegistryError {
205
+ export class ArtifactMissingError extends ArtifactError {
158
206
  code = 'CHTYPES_ARTIFACT_MISSING';
159
207
  /** The minor line that was asked for, e.g. `25.8`. */
160
208
  line;
@@ -170,10 +218,15 @@ export class ArtifactMissingError extends RegistryError {
170
218
  }
171
219
  }
172
220
  /**
173
- * Base of the fetch-time verdicts (docs/fetch.md §3–§7). `code` is one of the
221
+ * Base of the fetch-time verdicts (docs/guides/fetch.md §3–§7). `code` is one of the
174
222
  * shared codes; the subclasses exist so `instanceof` reads as well as `code`.
223
+ *
224
+ * An `ArtifactError`, alongside `ArtifactMissingError` — so `catch (err) { if
225
+ * (err instanceof ArtifactError) … }` handles all six artifact conditions in
226
+ * one arm, while `instanceof FetchError` still isolates these five verdicts
227
+ * from a missing artifact when that distinction matters.
175
228
  */
176
- export class FetchError extends ChtypesError {
229
+ export class FetchError extends ArtifactError {
177
230
  code;
178
231
  constructor(code, message, options) {
179
232
  super(message, options);
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0EAA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C,CAAC;IAC1D,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,UAAU;IACpD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,4BAA4B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF"}
package/dist/fetch.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Fetching, verifying and installing artifacts — docs/fetch.md, the contract
2
+ * Fetching, verifying and installing artifacts — docs/guides/fetch.md, the contract
3
3
  * every SDK implements identically: the same source (§2), the same
4
4
  * verification chain (§3), the same signature policy (§4), the same lock
5
5
  * file (§5), the same function (§6) and the same codes (§7).
@@ -25,21 +25,21 @@
25
25
  * trusts the directory, exactly as a runtime trusts `node_modules`.
26
26
  * Verification is a fetch-time policy, not a load-time gate.
27
27
  */
28
- /** The public artifacts host (docs/fetch.md §2); `CHTYPES_ARTIFACTS_URL` overrides it. */
28
+ /** The public artifacts host (docs/guides/fetch.md §2); `CHTYPES_ARTIFACTS_URL` overrides it. */
29
29
  export declare const DEFAULT_ARTIFACTS_URL = "https://artifacts.wavehouse.dev";
30
30
  /** The rolling release every fetch reads by default; `tag` picks a frozen one. */
31
31
  export declare const DEFAULT_RELEASE_TAG = "artifacts";
32
32
  /**
33
33
  * The release signing key(s) — raw 32-byte ed25519 public keys, hex
34
- * (docs/fetch.md §4). `CHTYPES_TRUSTED_KEYS` or the `trustedKeys` option
34
+ * (docs/guides/fetch.md §4). `CHTYPES_TRUSTED_KEYS` or the `trustedKeys` option
35
35
  * REPLACES this list; it is never extended silently.
36
36
  */
37
37
  export declare const RELEASE_PUBLIC_KEYS: readonly string[];
38
- /** The lock-file schema this SDK writes and reads (docs/fetch.md §5). */
38
+ /** The lock-file schema this SDK writes and reads (docs/guides/fetch.md §5). */
39
39
  export declare const LOCK_SCHEMA = 1;
40
- /** The lock file `frozen` reads when no `lock` names one (docs/fetch.md, Decisions); relative, so the working directory's. */
40
+ /** The lock file `frozen` reads when no `lock` names one (docs/guides/fetch.md, Decisions); relative, so the working directory's. */
41
41
  export declare const DEFAULT_LOCK_FILE = "chtypes.lock";
42
- /** One row of a release's `index.json` (docs/artifacts.md §2). */
42
+ /** One row of a release's `index.json` (docs/guides/artifacts.md §2). */
43
43
  export interface IndexArtifact {
44
44
  readonly os: string;
45
45
  readonly arch: string;
@@ -76,7 +76,7 @@ export interface LockEntry {
76
76
  readonly file: string;
77
77
  readonly sha256: string;
78
78
  }
79
- /** `chtypes.lock` (docs/fetch.md §5): `{"schema": 1, "artifacts": {"<os>-<arch>/<minor>": {file, sha256}}}`. */
79
+ /** `chtypes.lock` (docs/guides/fetch.md §5): `{"schema": 1, "artifacts": {"<os>-<arch>/<minor>": {file, sha256}}}`. */
80
80
  export interface LockFile {
81
81
  readonly schema: number;
82
82
  readonly artifacts: Record<string, LockEntry>;
@@ -181,8 +181,15 @@ export interface VersionRequest {
181
181
  export declare function parseVersionSpelling(spelling: string): VersionRequest;
182
182
  /** Numeric order over dotted versions, channel suffix ignored: 25.10 > 25.8, 25.8.30.16 > 25.8.28.1. */
183
183
  export declare function compareVersions(a: string, b: string): number;
184
- /** The key id docs/fetch.md §4 defines: the first 16 hex characters of sha256 over the raw 32-byte public key. */
184
+ /** The key id docs/guides/fetch.md §4 defines: the first 16 hex characters of sha256 over the raw 32-byte public key. */
185
185
  export declare function keyId(rawKeyHex: string): string;
186
+ /**
187
+ * `keyId(RELEASE_PUBLIC_KEYS[0])`, precomputed — the id the signature file's
188
+ * comment line names for the primary release key. `RELEASE_PUBLIC_KEYS` stays
189
+ * the list to verify against (rotation adds a second entry); this is the one
190
+ * short id go/python/rust each export as a scalar constant.
191
+ */
192
+ export declare const RELEASE_KEY_ID: string;
186
193
  /**
187
194
  * Verify an ed25519 signature over `message` with a raw public key, through
188
195
  * `node:crypto` — the key wrapped as SPKI DER, the 64-byte signature as is.
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/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AsB,eAAe,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAQpG;AAED,iHAAiH;AACjH,wBAAsB,aAAa,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,UAAU,CAAC,CA8BpF;AAID,qDAAqD;AACrD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CA2BtD;AAWD,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzD;AA2DD,gFAAgF;AAChF,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM9D"}
package/dist/fetch.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Fetching, verifying and installing artifacts — docs/fetch.md, the contract
2
+ * Fetching, verifying and installing artifacts — docs/guides/fetch.md, the contract
3
3
  * every SDK implements identically: the same source (§2), the same
4
4
  * verification chain (§3), the same signature policy (§4), the same lock
5
5
  * file (§5), the same function (§6) and the same codes (§7).
@@ -37,21 +37,21 @@ import { ArtifactCorruptError, ArtifactPinnedError, ArtifactUnpublishedError, Ar
37
37
  import { fetchDestination, hostPlatform, isPlatformKey } from './paths.js';
38
38
  import { extractTarGz } from './tar.js';
39
39
  // ------------------------------------------------------------- constants
40
- /** The public artifacts host (docs/fetch.md §2); `CHTYPES_ARTIFACTS_URL` overrides it. */
40
+ /** The public artifacts host (docs/guides/fetch.md §2); `CHTYPES_ARTIFACTS_URL` overrides it. */
41
41
  export const DEFAULT_ARTIFACTS_URL = 'https://artifacts.wavehouse.dev';
42
42
  /** The rolling release every fetch reads by default; `tag` picks a frozen one. */
43
43
  export const DEFAULT_RELEASE_TAG = 'artifacts';
44
44
  /**
45
45
  * The release signing key(s) — raw 32-byte ed25519 public keys, hex
46
- * (docs/fetch.md §4). `CHTYPES_TRUSTED_KEYS` or the `trustedKeys` option
46
+ * (docs/guides/fetch.md §4). `CHTYPES_TRUSTED_KEYS` or the `trustedKeys` option
47
47
  * REPLACES this list; it is never extended silently.
48
48
  */
49
49
  export const RELEASE_PUBLIC_KEYS = [
50
50
  'fdb5f06a8d4c9918d049a5f1748fa2e3b3238c3f2000986d5bb9e31beff778fc',
51
51
  ];
52
- /** The lock-file schema this SDK writes and reads (docs/fetch.md §5). */
52
+ /** The lock-file schema this SDK writes and reads (docs/guides/fetch.md §5). */
53
53
  export const LOCK_SCHEMA = 1;
54
- /** The lock file `frozen` reads when no `lock` names one (docs/fetch.md, Decisions); relative, so the working directory's. */
54
+ /** The lock file `frozen` reads when no `lock` names one (docs/guides/fetch.md, Decisions); relative, so the working directory's. */
55
55
  export const DEFAULT_LOCK_FILE = 'chtypes.lock';
56
56
  const INDEX_SCHEMA = 1;
57
57
  const CHANNEL = /-(lts|stable|prestable|testing)$/;
@@ -90,10 +90,17 @@ export function compareVersions(a, b) {
90
90
  /** The 12-byte SubjectPublicKeyInfo header for an Ed25519 key (RFC 8410): SEQUENCE { AlgorithmIdentifier(1.3.101.112), BIT STRING }. */
91
91
  const ED25519_SPKI_PREFIX = Buffer.from('302a300506032b6570032100', 'hex');
92
92
  const RAW_KEY = /^[0-9a-fA-F]{64}$/;
93
- /** The key id docs/fetch.md §4 defines: the first 16 hex characters of sha256 over the raw 32-byte public key. */
93
+ /** The key id docs/guides/fetch.md §4 defines: the first 16 hex characters of sha256 over the raw 32-byte public key. */
94
94
  export function keyId(rawKeyHex) {
95
95
  return createHash('sha256').update(Buffer.from(rawKeyHex, 'hex')).digest('hex').slice(0, 16);
96
96
  }
97
+ /**
98
+ * `keyId(RELEASE_PUBLIC_KEYS[0])`, precomputed — the id the signature file's
99
+ * comment line names for the primary release key. `RELEASE_PUBLIC_KEYS` stays
100
+ * the list to verify against (rotation adds a second entry); this is the one
101
+ * short id go/python/rust each export as a scalar constant.
102
+ */
103
+ export const RELEASE_KEY_ID = keyId(RELEASE_PUBLIC_KEYS[0]);
97
104
  /**
98
105
  * Verify an ed25519 signature over `message` with a raw public key, through
99
106
  * `node:crypto` — the key wrapped as SPKI DER, the 64-byte signature as is.
@@ -506,7 +513,7 @@ function forPlatform(index, platform) {
506
513
  return rows;
507
514
  }
508
515
  // -------------------------------------------------------------- ensure
509
- /** Concurrent `ensure`s of one line in one process share one fetch (docs/fetch.md §6). */
516
+ /** Concurrent `ensure`s of one line in one process share one fetch (docs/guides/fetch.md §6). */
510
517
  const inFlight = new Map();
511
518
  /**
512
519
  * Make one ClickHouse line available in a registry directory, through the
@@ -599,7 +606,7 @@ async function installGoldens(release, ctx) {
599
606
  }
600
607
  function installContext(platform, dest, options) {
601
608
  const frozen = options.frozen ?? false;
602
- // frozen without a lock path reads ./chtypes.lock (docs/fetch.md, Decisions).
609
+ // frozen without a lock path reads ./chtypes.lock (docs/guides/fetch.md, Decisions).
603
610
  const lockPath = options.lock !== undefined && options.lock !== '' ? path.resolve(options.lock) : frozen ? path.resolve(DEFAULT_LOCK_FILE) : undefined;
604
611
  const lock = lockPath !== undefined ? readLock(lockPath) : null;
605
612
  if (frozen && lock === null) {