@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
package/dist/errors.js DELETED
@@ -1,321 +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 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 const ABI_REVISION = 6;
50
- /** Base class for everything this package throws. */
51
- export class ChtypesError extends Error {
52
- constructor(message, options) {
53
- super(message, options);
54
- this.name = new.target.name;
55
- }
56
- }
57
- /** A registry could not be loaded, or a version could not be resolved. */
58
- export class RegistryError extends ChtypesError {
59
- }
60
- /**
61
- * This artifact IMAGE is already initialized under a different timezone.
62
- *
63
- * `dlopen` maps one image per file, and `chs_init` runs at most once per
64
- * image, so a second load asking for another zone can be neither honored nor
65
- * silently ignored: re-running `chs_init` would move the zone under the first
66
- * load's live libraries. A hardlink or symlink to a loaded artifact is that
67
- * same image and is refused the same way.
68
- *
69
- * A `RegistryError`, because it is a reason the loader cannot serve this
70
- * request — so a `catch` written against `for()`'s documented `RegistryError`
71
- * keeps working — and matched with `instanceof InitConflictError`, like every
72
- * other class here. Not an `ArtifactError`: the artifact is fine, and none of
73
- * the shared fetch codes describes it.
74
- */
75
- export class InitConflictError extends RegistryError {
76
- /** The artifact path this load asked for, as given. */
77
- path;
78
- /** The timezone the image is live under. */
79
- have;
80
- /** The timezone this load asked for, refused. */
81
- want;
82
- constructor(path, have, want) {
83
- super(`chtypes: ${path} is already initialized with timezone ${JSON.stringify(have)}; ` +
84
- `cannot re-initialize with ${JSON.stringify(want)} (one image per file — a hardlink ` +
85
- 'or symlink to a loaded artifact is the same image, and chs_init runs at most once)');
86
- this.path = path;
87
- this.have = have;
88
- this.want = want;
89
- }
90
- }
91
- /**
92
- * A REFUSAL: ClickHouse itself refused a type, a column list, an engine or a
93
- * TTL.
94
- *
95
- * `code` is ALWAYS a real ClickHouse error code. "This build declines to
96
- * answer" is a DIFFERENT CLASS — `UnsupportedError` — never this one carrying
97
- * a sentinel, so no `SchemaError` ever holds `CODE_UNSUPPORTED`
98
- * (docs/reference/bindings.md rule 12).
99
- */
100
- export class SchemaError extends ChtypesError {
101
- code;
102
- detail;
103
- column;
104
- constructor(code, detail, column) {
105
- super(column
106
- ? `chtypes: column ${JSON.stringify(column)}: [${code}] ${detail}`
107
- : `chtypes: [${code}] ${detail}`);
108
- this.code = code;
109
- this.detail = detail;
110
- this.column = column;
111
- }
112
- }
113
- /**
114
- * A DECLINE: "a real server might well have accepted this; I will not guess."
115
- * Never ClickHouse rejecting anything, so it carries no `code` property at all
116
- * — there is no code to carry.
117
- *
118
- * It is a PEER of `SchemaError`, deliberately NOT a subclass and deliberately
119
- * NOT matched by `err instanceof SchemaError`. A decline that still satisfied
120
- * "is a SchemaError" would be the sentinel problem wearing a class hierarchy:
121
- * every `catch` that forgot the predicate would keep silently turning declines
122
- * into rejections, which is a manufactured over-reject — data loss the product
123
- * never made, budgeted at zero. As a peer, forgetting throws on past the
124
- * handler, which is loud.
125
- *
126
- * ```ts
127
- * try {
128
- * schema.setEngine(engine, orderBy);
129
- * } catch (err) {
130
- * // validate cautiously; do NOT blame the tenant
131
- * if (err instanceof UnsupportedError) return degradeToCarefulPath(err);
132
- * // ClickHouse refused: err.code is its own code
133
- * if (err instanceof SchemaError) return rejectWith(err.code, err.detail);
134
- * throw err;
135
- * }
136
- * ```
137
- *
138
- * The MESSAGE still renders the ABI's `CODE_UNSUPPORTED` sentinel in the shape
139
- * `SchemaError` renders its code. The sentinel is not a property of this class
140
- * — it is the wire value the C ABI returned — but the rendering is frozen: the
141
- * conformance driver puts this exact string on the protocol wire as an
142
- * `unsupported` scope, and Python's `UnsupportedError` already spells it this
143
- * way. Changing the text would move rig records without changing a verdict.
144
- */
145
- export class UnsupportedError extends ChtypesError {
146
- detail;
147
- column;
148
- constructor(detail, column) {
149
- super(column
150
- ? `chtypes: column ${JSON.stringify(column)}: [${CODE_UNSUPPORTED}] ${detail}`
151
- : `chtypes: [${CODE_UNSUPPORTED}] ${detail}`);
152
- this.detail = detail;
153
- this.column = column;
154
- }
155
- }
156
- /**
157
- * The ONE place an ABI error code becomes an error object, so the
158
- * refusal/decline split cannot be decided differently in two files.
159
- *
160
- * The SIGN decides (docs/reference/bindings.md rule 12, the C ABI contract §Error model): a
161
- * positive code is the server's own refusal and rides through verbatim; any
162
- * negative code is this library declining (`-2` "I will not guess", `-1` a
163
- * guarded exception, and a binding's own missing-symbol sentinel) and becomes
164
- * an `UnsupportedError`. Keying on the sign rather than on `=== CODE_UNSUPPORTED`
165
- * means a negative sentinel a later era adds can never become "a SchemaError
166
- * with a negative code", which the class's own contract forbids.
167
- *
168
- * Internal: not re-exported from the package index.
169
- */
170
- export function schemaErrorFor(code, detail, column) {
171
- return code < 0 ? new UnsupportedError(detail, column) : new SchemaError(code, detail, column);
172
- }
173
- // ---------------------------------------------------------------- artifacts
174
- //
175
- // The fetch/verify contract (docs/guides/fetch.md §7) shares six codes across the
176
- // four SDKs. Five of them are verdicts of the verification chain or of the
177
- // source and are raised by `ensure` / the CLI; the sixth,
178
- // `CHTYPES_ARTIFACT_MISSING`, is the loader's — raised when a registry is
179
- // asked for a line no directory on the search path holds.
180
- /**
181
- * The codes docs/guides/fetch.md §6 shares across every SDK, as named constants.
182
- *
183
- * Each error below carries its own `code`, and a caller matches on it. Naming
184
- * them here is what lets that caller write `err.code === CODE_ARTIFACT_PINNED`
185
- * instead of retyping the string — which is exactly why the Go, Python and Rust
186
- * bindings all export them, and why this one already exported
187
- * `CODE_UNSUPPORTED`. A typo in a hand-written literal is a comparison that is
188
- * silently always false.
189
- */
190
- export const CODE_ARTIFACT_MISSING = 'CHTYPES_ARTIFACT_MISSING';
191
- /** docs/guides/fetch.md §6: the signature did not verify against the trust list. */
192
- export const CODE_ARTIFACT_UNTRUSTED = 'CHTYPES_ARTIFACT_UNTRUSTED';
193
- /** docs/guides/fetch.md §6: a hash mismatch, or a release that disagrees with itself. */
194
- export const CODE_ARTIFACT_CORRUPT = 'CHTYPES_ARTIFACT_CORRUPT';
195
- /** docs/guides/fetch.md §6: `--frozen` refused an asset the lock file does not pin. */
196
- export const CODE_ARTIFACT_PINNED = 'CHTYPES_ARTIFACT_PINNED';
197
- /** docs/guides/fetch.md §6: the release offers nothing for this platform or line. */
198
- export const CODE_ARTIFACT_UNPUBLISHED = 'CHTYPES_ARTIFACT_UNPUBLISHED';
199
- /** docs/guides/fetch.md §6: the source could not be reached or does not serve the release. */
200
- export const CODE_SOURCE_UNREACHABLE = 'CHTYPES_SOURCE_UNREACHABLE';
201
- /**
202
- * The single catchable type for every artifact-loading condition: a missing
203
- * artifact (`ArtifactMissingError`) or one of the five fetch/verify verdicts
204
- * (`FetchError`'s subclasses) — the six conditions docs/guides/fetch.md §3, §5
205
- * and §7 name. A caller that wants "the loader could not produce a usable
206
- * artifact" now catches exactly this one class, matching Python's
207
- * `ArtifactError`, Go's `*ArtifactError` (`.Code`), and Rust's
208
- * `Error::artifact_code()` (chtypes-sdk#13 A3, aligned 2026-09-15) — before
209
- * this, `ArtifactMissingError` was a `RegistryError` while the other five
210
- * were unrelated `FetchError`s, and a caller had to catch both types to
211
- * cover all six conditions.
212
- *
213
- * A `RegistryError`, because every one of these is a reason the loader could
214
- * not serve a version — `catch`es written against the pre-existing
215
- * `RegistryError` contract keep working unchanged.
216
- */
217
- export class ArtifactError extends RegistryError {
218
- }
219
- /** The command this SDK's §7 message tells a user to run. */
220
- export const FETCH_COMMAND = 'npx @wavehouse/chtypes fetch';
221
- /**
222
- * The §7 message, verbatim apart from the bracketed parts:
223
- *
224
- * chtypes: no artifact for ClickHouse <line> (<os>-<arch>). Looked in: <dir1>, <dir2>, ….
225
- * Install it: npx @wavehouse/chtypes fetch <line>
226
- * or set CHTYPES_AUTOFETCH=1 to fetch on first use.
227
- */
228
- export function artifactMissingMessage(line, platform, lookedIn) {
229
- return (`chtypes: no artifact for ClickHouse ${line} (${platform}). Looked in: ${lookedIn.join(', ')}.\n` +
230
- `Install it: ${FETCH_COMMAND} ${line}\n` +
231
- 'or set CHTYPES_AUTOFETCH=1 to fetch on first use.');
232
- }
233
- /**
234
- * The one identifiable error for a missing artifact (docs/guides/fetch.md §7):
235
- * a `Registry` was asked for a line that no directory on its search path
236
- * holds. `code` is `'CHTYPES_ARTIFACT_MISSING'`; the message is the
237
- * contract's, and names every directory that was looked in and the command
238
- * that installs the line.
239
- *
240
- * A subclass of `ArtifactError` (itself a `RegistryError`), so a `catch`
241
- * written against `for()`'s documented `RegistryError`, or against the
242
- * single catchable `ArtifactError`, both keep working; the `code` is what a
243
- * caller matches on.
244
- */
245
- export class ArtifactMissingError extends ArtifactError {
246
- code = 'CHTYPES_ARTIFACT_MISSING';
247
- /** The minor line that was asked for, e.g. `25.8`. */
248
- line;
249
- /** The platform key the registry serves, e.g. `darwin-arm64`. */
250
- platform;
251
- /** Every directory of the search path, in order. */
252
- lookedIn;
253
- constructor(line, platform, lookedIn) {
254
- super(artifactMissingMessage(line, platform, lookedIn));
255
- this.line = line;
256
- this.platform = platform;
257
- this.lookedIn = [...lookedIn];
258
- }
259
- }
260
- /**
261
- * Base of the fetch-time verdicts (docs/guides/fetch.md §3–§7). `code` is one of the
262
- * shared codes; the subclasses exist so `instanceof` reads as well as `code`.
263
- *
264
- * An `ArtifactError`, alongside `ArtifactMissingError` — so `catch (err) { if
265
- * (err instanceof ArtifactError) … }` handles all six artifact conditions in
266
- * one arm, while `instanceof FetchError` still isolates these five verdicts
267
- * from a missing artifact when that distinction matters.
268
- */
269
- export class FetchError extends ArtifactError {
270
- code;
271
- constructor(code, message, options) {
272
- super(message, options);
273
- this.code = code;
274
- }
275
- }
276
- /**
277
- * `CHTYPES_ARTIFACT_UNTRUSTED`: the release's `SHA256SUMS.sig` is absent,
278
- * malformed, or does not verify with any trusted key. Nothing is downloaded
279
- * around it (§3 step 0).
280
- */
281
- export class ArtifactUntrustedError extends FetchError {
282
- constructor(message, options) {
283
- super('CHTYPES_ARTIFACT_UNTRUSTED', message, options);
284
- }
285
- }
286
- /**
287
- * `CHTYPES_ARTIFACT_CORRUPT`: any hash mismatch along the chain, a release
288
- * that disagrees with itself (`index.json` vs `SHA256SUMS`, manifest vs
289
- * index), or an archive that cannot be read safely.
290
- */
291
- export class ArtifactCorruptError extends FetchError {
292
- constructor(message, options) {
293
- super('CHTYPES_ARTIFACT_CORRUPT', message, options);
294
- }
295
- }
296
- /**
297
- * `CHTYPES_ARTIFACT_PINNED`: a `--frozen` lock file names a different asset
298
- * or sha256 for this line — or none at all — and the fetch refused it (§5).
299
- */
300
- export class ArtifactPinnedError extends FetchError {
301
- constructor(message, options) {
302
- super('CHTYPES_ARTIFACT_PINNED', message, options);
303
- }
304
- }
305
- /** `CHTYPES_ARTIFACT_UNPUBLISHED`: the release has nothing for this platform, line or exact patch. */
306
- export class ArtifactUnpublishedError extends FetchError {
307
- constructor(message, options) {
308
- super('CHTYPES_ARTIFACT_UNPUBLISHED', message, options);
309
- }
310
- }
311
- /**
312
- * `CHTYPES_SOURCE_UNREACHABLE`: the source could not be reached or does not
313
- * serve the release files — or `offline` forbade reaching it and the line is
314
- * not installed and verified.
315
- */
316
- export class SourceUnreachableError extends FetchError {
317
- constructor(message, options) {
318
- super('CHTYPES_SOURCE_UNREACHABLE', message, options);
319
- }
320
- }
321
- //# sourceMappingURL=errors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC;AAE9B,qDAAqD;AACrD,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC;IAC9B,CAAC;CACF;AAED,0EAA0E;AAC1E,MAAM,OAAO,aAAc,SAAQ,YAAY;CAAG;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;IAClD,uDAAuD;IAC9C,IAAI,CAAS;IACtB,4CAA4C;IACnC,IAAI,CAAS;IACtB,iDAAiD;IACxC,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,IAAY,EAAE,IAAY;QAClD,KAAK,CACH,YAAY,IAAI,yCAAyC,IAAI,CAAC,SAAS,CAAC,IAAI,C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