@wavehouse/chtypes 2.0.0-dev.6 → 2.0.0-dev.7

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 (72) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/abi2/buildinfo.d.ts +1 -1
  3. package/dist/abi2/buildinfo.js +3 -3
  4. package/dist/abi2/buildinfo.js.map +1 -1
  5. package/dist/abi2/errors.d.ts +16 -38
  6. package/dist/abi2/errors.d.ts.map +1 -1
  7. package/dist/abi2/errors.js +16 -42
  8. package/dist/abi2/errors.js.map +1 -1
  9. package/dist/abi2/index.d.ts +1 -1
  10. package/dist/abi2/index.d.ts.map +1 -1
  11. package/dist/abi2/index.js +1 -1
  12. package/dist/abi2/index.js.map +1 -1
  13. package/dist/abi2/libc.gen.d.ts +2 -0
  14. package/dist/abi2/libc.gen.d.ts.map +1 -1
  15. package/dist/abi2/libc.gen.js +10 -0
  16. package/dist/abi2/libc.gen.js.map +1 -1
  17. package/dist/abi2/loader.js +2 -2
  18. package/dist/abi2/loader.js.map +1 -1
  19. package/dist/cli.d.ts +8 -3
  20. package/dist/cli.d.ts.map +1 -1
  21. package/dist/cli.js +94 -11
  22. package/dist/cli.js.map +1 -1
  23. package/dist/env.d.ts +8 -1
  24. package/dist/env.d.ts.map +1 -1
  25. package/dist/env.js +17 -8
  26. package/dist/env.js.map +1 -1
  27. package/dist/index.d.ts +5 -4
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +5 -4
  30. package/dist/index.js.map +1 -1
  31. package/dist/ocifetch/constants.gen.d.ts +14 -0
  32. package/dist/ocifetch/constants.gen.d.ts.map +1 -1
  33. package/dist/ocifetch/constants.gen.js +13 -0
  34. package/dist/ocifetch/constants.gen.js.map +1 -1
  35. package/dist/ocifetch/ensure.d.ts +42 -8
  36. package/dist/ocifetch/ensure.d.ts.map +1 -1
  37. package/dist/ocifetch/ensure.js +111 -41
  38. package/dist/ocifetch/ensure.js.map +1 -1
  39. package/dist/ocifetch/errors.d.ts +51 -27
  40. package/dist/ocifetch/errors.d.ts.map +1 -1
  41. package/dist/ocifetch/errors.js +49 -38
  42. package/dist/ocifetch/errors.js.map +1 -1
  43. package/dist/ocifetch/hold.d.ts +66 -0
  44. package/dist/ocifetch/hold.d.ts.map +1 -0
  45. package/dist/ocifetch/hold.js +150 -0
  46. package/dist/ocifetch/hold.js.map +1 -0
  47. package/dist/ocifetch/http.d.ts.map +1 -1
  48. package/dist/ocifetch/http.js +1 -1
  49. package/dist/ocifetch/http.js.map +1 -1
  50. package/dist/ocifetch/index.d.ts +6 -2
  51. package/dist/ocifetch/index.d.ts.map +1 -1
  52. package/dist/ocifetch/index.js +5 -1
  53. package/dist/ocifetch/index.js.map +1 -1
  54. package/dist/ocifetch/oci.d.ts +38 -6
  55. package/dist/ocifetch/oci.d.ts.map +1 -1
  56. package/dist/ocifetch/oci.js +48 -12
  57. package/dist/ocifetch/oci.js.map +1 -1
  58. package/dist/ocifetch/prune.d.ts +48 -0
  59. package/dist/ocifetch/prune.d.ts.map +1 -0
  60. package/dist/ocifetch/prune.js +383 -0
  61. package/dist/ocifetch/prune.js.map +1 -0
  62. package/dist/ocifetch/resolve.d.ts +37 -0
  63. package/dist/ocifetch/resolve.d.ts.map +1 -0
  64. package/dist/ocifetch/resolve.js +90 -0
  65. package/dist/ocifetch/resolve.js.map +1 -0
  66. package/dist/ocifetch/types.d.ts +1 -1
  67. package/dist/ocifetch/types.d.ts.map +1 -1
  68. package/dist/registry.d.ts +64 -3
  69. package/dist/registry.d.ts.map +1 -1
  70. package/dist/registry.js +141 -10
  71. package/dist/registry.js.map +1 -1
  72. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,10 @@ The four bindings in this repository are released together and give one answer,
8
8
 
9
9
  ### Added
10
10
 
11
+ - `registry.fetch(request): Promise<Resolved>`, the fetch-only call (#492): it resolves, fetches, verifies and installs the build a request names into the cache, as `chtypes fetch` does, and opens nothing (no library is loaded, the process setup is untouched, nothing appears in `libraries()`). It honors the registry's fetch options, its errors are the fetch codes (a refused spelling is a `UsageError`, as for `for`), and it shares one fetch with a concurrent open or `fetch` of the same request: an open that misses the cache now waits on the same fetch.
12
+ - `chtypes resolve <spelling> [--json] [--offline]` (#493): the version, build and platform manifest digest the spelling resolves to on every platform the registry offers, one `resolved <version> <platform> <build> <manifest>` line each in platform order (`--json`: one compact JSON array of `{platform, version, build, manifest}`), each verified exactly as a fetch verifies it, with no layer downloaded and nothing written. `--offline` answers from the cache. A refused spelling (a `v` prefix, a channel suffix) exits with the usage status.
13
+ - `chtypes prune [--line <line>] [--keep <n>] [--dry-run]`, and the in-use hold (#494): prune removes from the cache the installed builds of each line that newer installed builds of the same line and platform supersede, keeping the newest `n` (default 1), with their `index.json` entries and every blob no remaining build names. It never touches a system directory or another fingerprint's build, and never removes a build a live process holds: every build a registry opens or fetches is held by that process until it exits, by a shared `flock` on the entry's `verified.json` (prune takes the exclusive lock without waiting, and reports a held build `in-use`).
14
+ - The `CHTYPES_*` codes as constants (`CODE_ARTIFACT_MISSING` …) and their union type, `ErrorCode`, the type of `ArtifactError.code`, generated from `spec/fetch-v1/constants.json` (#500; `docs/reference/bindings-v1.md` §4, the codes).
11
15
  - Every settings layer's filter-declined settings, in one list (ABI v2; moves the dev fingerprint; #588): `SchemaDescription.filterDeclinedSettings`, a list of `DeclinedSetting`, decoded from `schema_description`'s new required top-level `filter_declined_settings`, over every layer known at schema compile (`setup`'s defaults as the compile captured them, the server profile, and the schema's own settings). `DeclinedSetting` gains `layer`, the highest layer that sets the name, from the new `DeclinedLayer` vocabulary (`Defaults`, `Server`, `Schema`, and its unknown(n), with `declinedLayerKnown`). One entry per name, ordered by layer and then by name bytes, as the library writes it; the binding sorts nothing.
12
16
  - `Schema.describe` raises the library's `CHS_REJECTED` with ch_code 306 (TOO_DEEP_RECURSION), a `SchemaError`, for a deep input the server's stack check refuses (ABI v2: `chs_schema_describe` now lists `CHS_REJECTED`).
13
17
  - The server's filter-declined settings (ABI v2; moves the dev fingerprint): `SchemaServer.filterDeclinedSettings`, a list of `DeclinedSetting` (`name`, `tier`), decoded from `schema_description`'s new required `server.filter_declined_settings`, with the new `DeclinedTier` vocabulary (`Predicate`, `PredicateUnflipped`, `ResultContent`, its unknown(n), and `declinedTierKnown`). `compileFilter` on a schema whose server lists any is the library's `CHS_DECLINED`, an `UnsupportedError` carrying its message; a filter's own settings other than `session_timezone` are no longer declined at compile, and a declined one is named at evaluation instead.
@@ -16,12 +20,23 @@ The four bindings in this repository are released together and give one answer,
16
20
  - The v2 spec publishes the filter decline-reasons catalog (`spec/abi-v2/declines/`).
17
21
  - The v2 spec's decline catalog has 49 entries, and it publishes the settings values a server refuses outright (`spec/abi-v2/where-settings/documented-pathological.tsv`).
18
22
  - The v2 spec's decline catalog follows the producer's batch 11: its `server-profile-setting` entry now covers every settings layer the schema compiles under (the id is unchanged), the evaluation-time setting entries name only the filter's own settings, and its `stack-depth` entry lists `chs_schema_describe`.
23
+ - The v2 spec publishes the documented platform differences (`spec/abi-v2/documented-platform/`), and its decline catalog adds `setting-format-pair`, `string-reading` and `equals-fold` (52 reasons).
19
24
  - A `410 Gone` is a retired repository, and permanent (#571). Any request the fetch layer makes (a tag, an alias, a digest, a blob, `tags/list`, the referrers API or its fallback tag, after a redirect too) that answers `410` is now the new code `CHTYPES_SOURCE_RETIRED` (exit status 10), never retried and never sent to the next base, nor from the dev channel's alias to its tag. It was `CHTYPES_SOURCE_UNREACHABLE` (exit 3) with the registry's message dropped, and Go, Python and Rust moved on to the next base, so a mirror's 404 could hide the retirement. The error names the URL that answered and carries the registry's own message, with control and bidirectional-formatting characters removed and cut to 256 code points: Go `CodeSourceRetired` (`errors.Is(err, ErrSourceRetired)`), Python and TypeScript `SourceRetiredError`, Rust `Error::SourceRetired`. The rule is `docs/guides/fetch-v1.md` section 2, "A retired repository", and the `retired-410-*` and `list-tags-retired-410` conformance cases and one shared message table (`tests/fixtures/retired-message/cases.json`) hold all four bindings to it.
20
25
  - The public server handle (ABI v2): `lib.newServer(profile)` describes one ClickHouse server (`ServerProfile`: `timezone`, `settings`, `macros`), `compileTable(createTable, { server })` compiles a table on it, and `Server` has `close()` and `[Symbol.dispose]()`. A schema description carries `server` (`SchemaServer`) and `replicated` (`SchemaReplicated`: `zookeeperPath`, `replicaName`), each `undefined` when absent. Absent `macros` is not `{}`: absent means the server's macros are unknown, present (even `{}`) is its complete set. The binding validates nothing in the profile. Follows the Go binding.
21
26
  - A 2.0.0-dev SDK prefers the newest build of its own fingerprint (#511). A version request resolves `<tag>--fp-<fingerprint>` first, the alias the staging dev registry serves beside every dev tag, with the binding's own generated ABI fingerprint, and the tag itself only when every base answers the alias 404; any other failure of the alias request is that failure, with no fallback, and an alias whose index lacks the platform is `CHTYPES_ARTIFACT_UNPUBLISHED`. The dev channel's cache lookups (the installed-build lookup a registry open makes first, the offline answer, and the monotonic rule of a fetch) now see only records whose signed `abi_fingerprint` is the SDK's own, so a newer build of another fingerprint, installed by another dev SDK in the shared cache, is never returned or kept over this one's own, and is never removed or rewritten. So a dev build of a newer fingerprint no longer strands an older dev SDK until its consumers upgrade. Trust is unchanged (the signed predicate and the load checks decide), a listing never shows an alias, nothing records one, `list` and `where` are unchanged, and there is no option: both steps are the dev channel's alone, and the v1 contract and every production channel never take them. The rule is `docs/guides/fetch-v1.md` section 3, and the `dev-alias-*`, `resolve-installed-dev-alias-*` and `list-tags-dev-alias` conformance cases hold all four bindings to it.
22
27
 
23
28
  ### Changed
24
29
 
30
+ - `chtypes list` and the tag listing name the published lines only (two-part, numeric order), as Go's always did; `chtypes resolve <line>` prints the exact version a line resolves to (#613).
31
+ - `chtypes fetch` of a refused spelling (a `v` prefix, a `-lts`/`-stable` suffix) exits with the usage status, 2, as Go's does, and prints the refusal alone; it exited 1 and printed a stack trace.
32
+ - **Breaking: the public surface the parity gate carried as exceptions is resolved, before the v2 lock (#500).** A convenience exists in every binding or in none (`docs/reference/bindings-v1.md` §1, principle 2). Migration, old → new:
33
+ - `isChtypesError(e)` → `e instanceof ChtypesError`: `ArtifactError` extends `ChtypesError` (#487), so the guard was the same test.
34
+ - `LoaderCorruptError` → `ArtifactCorruptError`: the loader's corrupt refusal is an `ArtifactCorruptError` carrying the refusal's fields, and its `name` is `ArtifactCorruptError`. `ArtifactError` itself now carries `reason`, `path`, `want` and `got`, as Go's and Python's do (`undefined` on a fetch error), so `ArtifactIncompatibleError` inherits them. `LoaderErrorFields` is no longer exported.
35
+ - `ArtifactError.exitStatus` → removed: a code's exit status is the `chtypes` command's, never the library's.
36
+ - `SourceUnreachableError.retryAfterRefused` → removed: the fetch layer has spent its retry table before it raises, and the message names the refused `Retry-After`.
37
+ - `FetchOptions` is an interface of its own (it was the fetch layer's options less its test hooks). `trustedKeys: [{ keyid, ed25519Hex }, …]` → `trustedKeys: ['<64 hex characters>', …]`, the `CHTYPES_TRUSTED_KEYS` spelling and Go's and Rust's, with each key id derived; a malformed key is a `UsageError` where the channel honors the option. `platform` → removed: a registry opens libraries for this host only, and `CHTYPES_TARGET` no longer reaches one (it names `chtypes fetch`'s platform). `lockAllPlatforms` → removed: a lock write pins every platform the index offers, as in the other bindings.
38
+ - `BatchOutcome` and `batchOutcomeKnown` → `Outcome` and `outcomeKnown`: `BatchResult.outcome` is an `Outcome`, as in the other bindings.
39
+ - **Breaking: `ArtifactError` extends `ChtypesError`** (#487). `new ArtifactMissingError('x') instanceof ChtypesError` was `false`, so a caller catching `ChtypesError` to handle every SDK error missed the fetch and loader errors; in Python they are `ChtypesError`s. `ChtypesError` (still abstract, still exported under the same names) is now the base of `ArtifactError` as well as of `CallError`. Error codes, names and messages are unchanged. A handler written as `catch (e) { if (e instanceof ChtypesError) treatAsCallError(e) }` now also receives artifact errors: narrow on `CallError` for the call errors only.
25
40
  - `compileFilter` is the library's `CHS_DECLINED`, `UnsupportedError`, on a schema whose `filter_declined_settings` is not empty from any layer, and its message names each setting and its layer (ABI v2, #588). A declined setting from the defaults or the schema's own settings now fails the compile, where it was named at evaluation before; a filter's own settings and an evaluation's are still named at evaluation.
26
41
  - **Enforcement gate lifted** for `26.3` on `linux-amd64`.
27
42
  - **Enforcement gate lifted** for `26.7` on `linux-amd64`.
@@ -52,6 +67,8 @@ The four bindings in this repository are released together and give one answer,
52
67
 
53
68
  ### Fixed
54
69
 
70
+ - `fetch --lock` pins every platform the index offers, as Go, Python and Rust do (#487): the CLI and the `lockWrite` option pinned only the host's platform, because the all-platforms write was an opt-in (`lockAllPlatforms`) that only the conformance runner set, so a lock written on a Mac could not drive a `--frozen` fetch in a Linux image (`CHTYPES_ARTIFACT_PINNED`). The all-platforms write is now the default, with no public opt-out (#500), and the runner no longer sets it, so `lock-write-all-platforms` exercises the default path.
71
+ - `--frozen` with a warm cache no longer GETs the manifest (#487; it made one request, a manifest of a few hundred bytes, on 1.0.2). `--frozen` with a warm, verified cache makes zero requests, and `--frozen --offline` verifies the installed build against the lock with zero network (#414). An installed build whose `verified.json` is for the platform and records exactly the lock's pinned manifest, layer and bundle digests is used as it is. `--frozen --offline` is `CHTYPES_ARTIFACT_MISSING` when the pinned build is not installed, and `CHTYPES_ARTIFACT_PINNED` when there is no lock entry or the installed record does not match the pin; `--offline` without `--frozen` is unchanged. The `frozen-warm-cache-zero-requests`, `frozen-offline-lock-match`, `frozen-offline-lock-mismatch` and `frozen-offline-lock-not-installed` conformance cases hold all four bindings to it, under both corpora.
55
72
  - A 2.0.0-dev SDK whose own-fingerprint alias has expired, with a cached build of that fingerprint for the request, now says so in the `CHTYPES_ARTIFACT_UNPUBLISHED` message of `fetch` (#581): `; a cached build for this fingerprint (build <id>) is still usable by open; upgrade the SDK to get newer builds` is appended. The code, the exit status (4) and the cache are unchanged, and all four bindings give the same message (`fp-ahead-cached-own-fp`).
56
73
  - A 2.0.0-dev SDK whose fingerprint no published build carries yet now fails closed with a precise message (#578). When every base answers its own alias 404 and the tag names a build signed for another fingerprint, `fetch` is `CHTYPES_ARTIFACT_UNPUBLISHED` (exit status 4): `no published build for this SDK's fingerprint <own fp>; newest published on this channel is <fp> (build <id>)`. It used to install that build, or report it already installed, and the lookup at open then answered `CHTYPES_ARTIFACT_MISSING` with advice to run `fetch`: a loop with no pointer to the cause. Nothing is downloaded or installed and the cache is unchanged. An alias that answers, a tag at the SDK's own fingerprint and the v1 contract are unchanged. All four bindings run the same fetch conformance cases, `fp-ahead-*`, and the rule is `docs/guides/fetch-v1.md` section 3.
57
74
  - Opening a line never waits for another line's fetch, and concurrent opens of one request share one fetch (#491). The TypeScript registry already behaved this way (one promise per request in its memo, and no lock), so nothing changes here; the same tests as in the other three bindings now hold it to the rule.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `BuildInfo`: the decoded form of the library's static build-info JSON
3
3
  * (`docs/reference/bindings-v1.md` §5, `BuildInfo`). Decoded once, at loader
4
- * step 4, where a malformed document is a `LoaderCorruptError`
4
+ * step 4, where a malformed document is an `ArtifactCorruptError`
5
5
  * (`build_info_malformed`): ASCII only, no duplicate key at any depth,
6
6
  * `schema` equal to 1, every required field of its type.
7
7
  */
@@ -1,14 +1,14 @@
1
1
  /**
2
2
  * `BuildInfo`: the decoded form of the library's static build-info JSON
3
3
  * (`docs/reference/bindings-v1.md` §5, `BuildInfo`). Decoded once, at loader
4
- * step 4, where a malformed document is a `LoaderCorruptError`
4
+ * step 4, where a malformed document is an `ArtifactCorruptError`
5
5
  * (`build_info_malformed`): ASCII only, no duplicate key at any depth,
6
6
  * `schema` equal to 1, every required field of its type.
7
7
  */
8
- import { LoaderCorruptError } from './errors.js';
8
+ import { corruptRefusal } from './errors.js';
9
9
  import { DuplicateKeyError, isAsciiOnly, parseStrictJson } from './strictjson.js';
10
10
  function malformed(path, want, got) {
11
- throw new LoaderCorruptError({ reason: 'build_info_malformed', path, want, got });
11
+ throw corruptRefusal({ reason: 'build_info_malformed', path, want, got });
12
12
  }
13
13
  function kindOf(v) {
14
14
  return v === null ? 'null' : Array.isArray(v) ? 'array' : typeof v;
@@ -1 +1 @@
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AE,GAAG,EAAE,SAAS,CAAC;QAClC,eAAe,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,kBAAkB,CAAC;QACnD,gBAAgB,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,mBAAmB,CAAC;QACrD,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,CAAC;QACzC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC;QAC9B,YAAY,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,eAAe,CAAC;QAC7C,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC;QACxB,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC;QAC5B,SAAS,EAAE,SAAoC;QAC/C,YAAY,EAAE;YACZ,YAAY,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,eAAe,CAAC;YACrD,aAAa,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC;YACvD,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC;YAC7C,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC;SAC7C;QACD,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;KACjC,CAAC;AACJ,CAAC"}
@@ -11,29 +11,24 @@
11
11
  * that forgot the distinction turn every decline into a rejection. They
12
12
  * share one abstract base, `CallError`, under `ChtypesError`, which is the
13
13
  * explicit way to catch all four.
14
- * - a LOADER error: a refusal reason, the path, and the want/got pair where
15
- * the reason has one (sdk.json `loader.refusals`). These extend the fetch
16
- * layer's own classes, so a caller catching `ArtifactCorruptError` catches
17
- * the fetch layer's corruption and the loader's step 5 alike, and every
18
- * artifact error (fetch or loader) is an `ArtifactError`.
14
+ * - a LOADER error: a refusal reason, the path, and want and got where the
15
+ * refusal names them (sdk.json `loader.refusals`), carried on the
16
+ * `ArtifactError` base as in Go and Python. A refusal is the fetch layer's
17
+ * own class for its code, so a caller catching `ArtifactCorruptError`
18
+ * catches the fetch layer's corruption and the loader's step 5 alike, and
19
+ * every artifact error (fetch or loader) is an `ArtifactError`.
19
20
  *
20
21
  * `messageBytes` and `column` are raw bytes, never assumed UTF-8. `chName` is
21
22
  * a plain string: its content is ASCII by the ABI's own promise. `message`
22
23
  * (the string every `Error` has) is the one lossy display form.
23
24
  */
24
- import { ArtifactCorruptError, FetchV1Error } from '../ocifetch/index.js';
25
- /** The base of every call error. The fetch and loader errors live under `ArtifactError` instead; `isChtypesError` is true for all of them. */
26
- export declare abstract class ChtypesError extends Error {
27
- constructor(message: string, options?: {
28
- cause?: unknown;
29
- });
30
- }
25
+ import { ArtifactCorruptError, ChtypesError, FetchV1Error, type RefusalFields } from '../ocifetch/index.js';
26
+ /** The base of every error this package throws on purpose: the call errors (under `CallError`) and the fetch and loader errors (under `ArtifactError`), so one `catch` on it takes them all. */
27
+ export { ChtypesError };
31
28
  /** The base of every fetch error and every loader refusal: the fetch layer's own base class, re-exported under the name the rest of the family uses. */
32
29
  export { FetchV1Error as ArtifactError };
33
- /** Re-exported unchanged: the fetch layer's corruption error, which the loader's step-5 refusal extends. */
30
+ /** Re-exported unchanged: the fetch layer's corruption error, which the loader's step-4 and step-5 refusals are too. */
34
31
  export { ArtifactCorruptError };
35
- /** True for any error this package throws on purpose: a call error, a fetch error or a loader refusal. */
36
- export declare function isChtypesError(err: unknown): err is ChtypesError | FetchV1Error;
37
32
  /** The five fields of a library error object, read verbatim. */
38
33
  export interface CallErrorFields {
39
34
  /** The raw status value; compare with `Status`. */
@@ -76,13 +71,6 @@ export declare class InternalError extends CallError {
76
71
  export declare function usageError(message: string): UsageError;
77
72
  /** A document or a value that breaks the library's own contract. */
78
73
  export declare function internalError(message: string): InternalError;
79
- /** A loader refusal's fields: the reason, the artifact path, and want/got where the reason has one. */
80
- export interface LoaderErrorFields {
81
- readonly reason: string;
82
- readonly path: string;
83
- readonly want?: string | undefined;
84
- readonly got?: string | undefined;
85
- }
86
74
  /**
87
75
  * Rule r6's exact refusal of a library whose fingerprint is not this dev SDK's
88
76
  * (`spec/abi-v2/docs.md`): `sdk` is this binding's own `ABI_FINGERPRINT`,
@@ -90,24 +78,14 @@ export interface LoaderErrorFields {
90
78
  */
91
79
  export declare function devFingerprintMessage(sdk: string, library: string): string;
92
80
  /** A loader step 1-4 or 6 refusal: the artifact is not one this binding can speak to (wrong ABI generation, a different fingerprint, a missing symbol, an unresolvable link). A fingerprint refusal by a 2.0.0-dev SDK carries rule r6's exact message. */
93
- export declare class ArtifactIncompatibleError extends FetchV1Error implements LoaderErrorFields {
94
- readonly reason: string;
95
- readonly path: string;
96
- readonly want: string | undefined;
97
- readonly got: string | undefined;
98
- constructor(f: LoaderErrorFields);
81
+ export declare class ArtifactIncompatibleError extends FetchV1Error {
82
+ constructor(f: RefusalFields);
99
83
  }
100
84
  /**
101
85
  * A loader step 4 (malformed build info) or step 5 (a cross-check mismatch)
102
- * refusal: the artifact's own signed statement and its bytes disagree. It
103
- * extends the fetch layer's `ArtifactCorruptError`, so the two are one class
104
- * to a caller who catches it.
86
+ * refusal, or the load-time assertion's: the artifact's own signed statement
87
+ * and its bytes disagree. It is the fetch layer's `ArtifactCorruptError`, with
88
+ * the refusal's fields, so the two are one class to a caller who catches it.
105
89
  */
106
- export declare class LoaderCorruptError extends ArtifactCorruptError implements LoaderErrorFields {
107
- readonly reason: string;
108
- readonly path: string;
109
- readonly want: string | undefined;
110
- readonly got: string | undefined;
111
- constructor(f: LoaderErrorFields);
112
- }
90
+ export declare function corruptRefusal(f: RefusalFields): ArtifactCorruptError;
113
91
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/abi2/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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AE,eAAe,EAOtD;CACF;AAED,iIAAiI;AACjI,qBAAa,WAAY,SAAQ,SAAS;IACxC,YAAY,CAAC,EAAE,eAAe,EAE7B;CACF;AAED,2GAA2G;AAC3G,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,YAAY,CAAC,EAAE,eAAe,EAE7B;CACF;AAED,qHAAqH;AACrH,qBAAa,UAAW,SAAQ,SAAS;IACvC,YAAY,CAAC,EAAE,eAAe,EAE7B;CACF;AAED,mIAAmI;AACnI,qBAAa,aAAc,SAAQ,SAAS;IAC1C,YAAY,CAAC,EAAE,eAAe,EAE7B;CACF;AAMD,iLAAiL;AACjL,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAE5D;AAOD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1E;AAUD,2PAA2P;AAC3P,qBAAa,yBAA0B,SAAQ,YAAY;IACzD,YAAY,CAAC,EAAE,aAAa,EAE3B;CACF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,aAAa,GAAG,oBAAoB,CAErE"}
@@ -11,34 +11,26 @@
11
11
  * that forgot the distinction turn every decline into a rejection. They
12
12
  * share one abstract base, `CallError`, under `ChtypesError`, which is the
13
13
  * explicit way to catch all four.
14
- * - a LOADER error: a refusal reason, the path, and the want/got pair where
15
- * the reason has one (sdk.json `loader.refusals`). These extend the fetch
16
- * layer's own classes, so a caller catching `ArtifactCorruptError` catches
17
- * the fetch layer's corruption and the loader's step 5 alike, and every
18
- * artifact error (fetch or loader) is an `ArtifactError`.
14
+ * - a LOADER error: a refusal reason, the path, and want and got where the
15
+ * refusal names them (sdk.json `loader.refusals`), carried on the
16
+ * `ArtifactError` base as in Go and Python. A refusal is the fetch layer's
17
+ * own class for its code, so a caller catching `ArtifactCorruptError`
18
+ * catches the fetch layer's corruption and the loader's step 5 alike, and
19
+ * every artifact error (fetch or loader) is an `ArtifactError`.
19
20
  *
20
21
  * `messageBytes` and `column` are raw bytes, never assumed UTF-8. `chName` is
21
22
  * a plain string: its content is ASCII by the ABI's own promise. `message`
22
23
  * (the string every `Error` has) is the one lossy display form.
23
24
  */
24
- import { ArtifactCorruptError, FetchV1Error } from '../ocifetch/index.js';
25
+ import { ArtifactCorruptError, ChtypesError, CODE_ARTIFACT_INCOMPATIBLE, FetchV1Error } from '../ocifetch/index.js';
25
26
  import { ABI_STABILITY } from './decls.gen.js';
26
27
  import { Status } from './vocab.gen.js';
27
- /** The base of every call error. The fetch and loader errors live under `ArtifactError` instead; `isChtypesError` is true for all of them. */
28
- export class ChtypesError extends Error {
29
- constructor(message, options) {
30
- super(message, options);
31
- this.name = new.target.name;
32
- }
33
- }
28
+ /** The base of every error this package throws on purpose: the call errors (under `CallError`) and the fetch and loader errors (under `ArtifactError`), so one `catch` on it takes them all. */
29
+ export { ChtypesError };
34
30
  /** The base of every fetch error and every loader refusal: the fetch layer's own base class, re-exported under the name the rest of the family uses. */
35
31
  export { FetchV1Error as ArtifactError };
36
- /** Re-exported unchanged: the fetch layer's corruption error, which the loader's step-5 refusal extends. */
32
+ /** Re-exported unchanged: the fetch layer's corruption error, which the loader's step-4 and step-5 refusals are too. */
37
33
  export { ArtifactCorruptError };
38
- /** True for any error this package throws on purpose: a call error, a fetch error or a loader refusal. */
39
- export function isChtypesError(err) {
40
- return err instanceof ChtypesError || err instanceof FetchV1Error;
41
- }
42
34
  function renderCallMessage(label, f) {
43
35
  const msg = f.messageBytes.toString('utf8');
44
36
  const col = f.column.length > 0 ? ` (column ${JSON.stringify(f.column.toString('utf8'))})` : '';
@@ -116,35 +108,17 @@ function incompatibleMessage(f) {
116
108
  }
117
109
  /** A loader step 1-4 or 6 refusal: the artifact is not one this binding can speak to (wrong ABI generation, a different fingerprint, a missing symbol, an unresolvable link). A fingerprint refusal by a 2.0.0-dev SDK carries rule r6's exact message. */
118
110
  export class ArtifactIncompatibleError extends FetchV1Error {
119
- reason;
120
- path;
121
- want;
122
- got;
123
111
  constructor(f) {
124
- super('CHTYPES_ARTIFACT_INCOMPATIBLE', incompatibleMessage(f));
125
- this.reason = f.reason;
126
- this.path = f.path;
127
- this.want = f.want;
128
- this.got = f.got;
112
+ super(CODE_ARTIFACT_INCOMPATIBLE, incompatibleMessage(f), { refusal: f });
129
113
  }
130
114
  }
131
115
  /**
132
116
  * A loader step 4 (malformed build info) or step 5 (a cross-check mismatch)
133
- * refusal: the artifact's own signed statement and its bytes disagree. It
134
- * extends the fetch layer's `ArtifactCorruptError`, so the two are one class
135
- * to a caller who catches it.
117
+ * refusal, or the load-time assertion's: the artifact's own signed statement
118
+ * and its bytes disagree. It is the fetch layer's `ArtifactCorruptError`, with
119
+ * the refusal's fields, so the two are one class to a caller who catches it.
136
120
  */
137
- export class LoaderCorruptError extends ArtifactCorruptError {
138
- reason;
139
- path;
140
- want;
141
- got;
142
- constructor(f) {
143
- super(renderLoaderMessage('corrupt artifact', f));
144
- this.reason = f.reason;
145
- this.path = f.path;
146
- this.want = f.want;
147
- this.got = f.got;
148
- }
121
+ export function corruptRefusal(f) {
122
+ return new ArtifactCorruptError(renderLoaderMessage('corrupt artifact', f), { refusal: f });
149
123
  }
150
124
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/abi2/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,8IAA8I;AAC9I,MAAM,OAAgB,YAAa,SAAQ,KAAK;IAC9C,YAAY,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AC,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAW,EAAE,OAAe;IAChE,OAAO,mCAAmC,GAAG,qBAAqB,OAAO,wBAAwB,CAAC;AACpG,CAAC;AAED,kLAAkL;AAClL,SAAS,mBAAmB,CAAC,CAAgB;IAC3C,IAAI,CAAC,CAAC,MAAM,KAAK,aAAa,IAAI,aAAa,KAAK,UAAU,IAAI,CAAC,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QAC9G,OAAO,qBAAqB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,mBAAmB,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,2PAA2P;AAC3P,MAAM,OAAO,yBAA0B,SAAQ,YAAY;IACzD,YAAY,CAAgB;QAC1B,KAAK,CAAC,0BAA0B,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAC5E,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,CAAgB;IAC7C,OAAO,IAAI,oBAAoB,CAAC,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;AAC9F,CAAC"}
@@ -8,7 +8,7 @@ export { type BuildInfo, type Capabilities, decodeBuildInfo } from './buildinfo.
8
8
  export { type BlockHandle, Calls, type FilterHandle, type SchemaHandle, type ServerHandle } from './calls.gen.js';
9
9
  export { ABI_FINGERPRINT, ABI_STABILITY, ABI_VERSION, BUF_HANDLE, type FunctionSpec, type ParamSpec, type ReturnSpec } from './decls.gen.js';
10
10
  export { errorForStatus, type LoaderErrorClass, loaderErrorClassFor } from './errmap.gen.js';
11
- export { ArtifactCorruptError, ArtifactError, ArtifactIncompatibleError, CallError, type CallErrorFields, ChtypesError, devFingerprintMessage, InternalError, internalError, isChtypesError, LoaderCorruptError, type LoaderErrorFields, SchemaError, UnsupportedError, UsageError, usageError, } from './errors.js';
11
+ export { ArtifactCorruptError, ArtifactError, ArtifactIncompatibleError, CallError, type CallErrorFields, ChtypesError, corruptRefusal, devFingerprintMessage, InternalError, internalError, SchemaError, UnsupportedError, UsageError, usageError, } from './errors.js';
12
12
  export { Abi2Handle, HANDLE_CLASSES, wrapHandle } from './handles.js';
13
13
  export { checkUnverifiedAllowed, type ImageSetup, LoadedImage, type LoadInput, openAbi2, openUnverified, type Predicate } from './loader.js';
14
14
  export { asBuffer, checkStatus, defineRawFunctions, type HandleRef, NULL_EXTERNAL, type RawApi, type RawCallResult, rawCall, readOwnedBuf, } from './raw.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abi2/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,yBAAyB,EACzB,SAAS,EACT,KAAK,eAAe,EACpB,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,KAA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,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7I,OAAO,EACL,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,KAAK,SAAS,EACd,aAAa,EACb,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,OAAO,EACP,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrG,cAAc,gBAAgB,CAAC"}
@@ -8,7 +8,7 @@ export { decodeBuildInfo } from './buildinfo.js';
8
8
  export { Calls } from './calls.gen.js';
9
9
  export { ABI_FINGERPRINT, ABI_STABILITY, ABI_VERSION, BUF_HANDLE } from './decls.gen.js';
10
10
  export { errorForStatus, loaderErrorClassFor } from './errmap.gen.js';
11
- export { ArtifactCorruptError, ArtifactError, ArtifactIncompatibleError, CallError, ChtypesError, devFingerprintMessage, InternalError, internalError, isChtypesError, LoaderCorruptError, SchemaError, UnsupportedError, UsageError, usageError, } from './errors.js';
11
+ export { ArtifactCorruptError, ArtifactError, ArtifactIncompatibleError, CallError, ChtypesError, corruptRefusal, devFingerprintMessage, InternalError, internalError, SchemaError, UnsupportedError, UsageError, usageError, } from './errors.js';
12
12
  export { Abi2Handle, HANDLE_CLASSES, wrapHandle } from './handles.js';
13
13
  export { checkUnverifiedAllowed, LoadedImage, openAbi2, openUnverified } from './loader.js';
14
14
  export { asBuffer, checkStatus, defineRawFunctions, NULL_EXTERNAL, rawCall, readOwnedBuf, } from './raw.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/abi2/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqC,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAoB,KAAK,EAA2D,MAAM,gBAAgB,CAAC;AAClH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAsD,MAAM,gBAAgB,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAyB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,yBAAyB,EACzB,SAAS,EAET,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,cAAc,EACd,kBAAkB,EAElB,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAmB,WAAW,EAAkB,QAAQ,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAC7I,OAAO,EACL,QAAQ,EACR,WAAW,EACX,kBAAkB,EAElB,aAAa,EAGb,OAAO,EACP,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrG,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/abi2/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAqC,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,EAAoB,KAAK,EAA2D,MAAM,gBAAgB,CAAC;AAClH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAsD,MAAM,gBAAgB,CAAC;AAC7I,OAAO,EAAE,cAAc,EAAyB,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,yBAAyB,EACzB,SAAS,EAET,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAmB,WAAW,EAAkB,QAAQ,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAC7I,OAAO,EACL,QAAQ,EACR,WAAW,EACX,kBAAkB,EAElB,aAAa,EAGb,OAAO,EACP,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrG,cAAc,gBAAgB,CAAC"}
@@ -9,4 +9,6 @@ export declare function dlerror(): JsExternal | null;
9
9
  export declare function gnuGetLibcVersion(): JsExternal | null;
10
10
  /** strlen(ptr): the length of a NUL-terminated C string, for a byte-safe read via createExternalBuffer. */
11
11
  export declare function cStringLength(ptr: JsExternal): number;
12
+ /** flock(fd, operation) against the process's own libc: 0 when it succeeded, else the errno it failed with (-1 when none was captured), never 0 for a failure. */
13
+ export declare function flock(fd: number, operation: number): number;
12
14
  //# sourceMappingURL=libc.gen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"libc.gen.d.ts","sourceRoot":"","sources":["../../src/abi2/libc.gen.ts"],"names":[],"mappings":"AAeA,OAAO,EAAmC,KAAK,UAAU,EAAQ,MAAM,QAAQ,CAAC;AA0ChF,2EAA2E;AAC3E,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAGrE;AAED,6GAA6G;AAC7G,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAGjF;AAED,wHAAwH;AACxH,wBAAgB,OAAO,IAAI,UAAU,GAAG,IAAI,CAG3C;AAED,iHAAiH;AACjH,wBAAgB,iBAAiB,IAAI,UAAU,GAAG,IAAI,CAOrD;AAED,2GAA2G;AAC3G,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAErD"}
1
+ {"version":3,"file":"libc.gen.d.ts","sourceRoot":"","sources":["../../src/abi2/libc.gen.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAmC,KAAK,UAAU,EAAQ,MAAM,QAAQ,CAAC;AA4ChF,2EAA2E;AAC3E,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAGrE;AAED,6GAA6G;AAC7G,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAGjF;AAED,wHAAwH;AACxH,wBAAgB,OAAO,IAAI,UAAU,GAAG,IAAI,CAG3C;AAED,iHAAiH;AACjH,wBAAgB,iBAAiB,IAAI,UAAU,GAAG,IAAI,CAOrD;AAED,2GAA2G;AAC3G,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAErD;AAED,kKAAkK;AAClK,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAI3D"}
@@ -11,6 +11,8 @@
11
11
  * `resolveSymbol` is THE ONE symbol-lookup helper hand code uses (dlsym plus the null
12
12
  * check); the other four exports are the raw primitives dlopen/dlerror/gnu_get_libc_version/
13
13
  * strlen need, each with its own null handling where the C function can return NULL.
14
+ * `flock` is the fetch layer's in-use hold (docs/guides/fetch-v1.md §1, "In use"): Node has
15
+ * no file lock of its own, and every binding takes the same flock(2) on the same file.
14
16
  */
15
17
  import { DataType, define, isNullPointer, open } from 'ffi-rs';
16
18
  const { External, I32, U64, String: Str } = DataType;
@@ -39,6 +41,7 @@ function libc() {
39
41
  dlerror: { library: LIBC_KEY, retType: External, paramsType: [] },
40
42
  gnu_get_libc_version: { library: LIBC_KEY, retType: External, paramsType: [] },
41
43
  strlen: { library: LIBC_KEY, retType: U64, paramsType: [External] },
44
+ flock: { library: LIBC_KEY, retType: I32, paramsType: [I32, I32], errno: true },
42
45
  });
43
46
  }
44
47
  return fns;
@@ -72,4 +75,11 @@ export function gnuGetLibcVersion() {
72
75
  export function cStringLength(ptr) {
73
76
  return Number(libc().strlen([ptr]));
74
77
  }
78
+ /** flock(fd, operation) against the process's own libc: 0 when it succeeded, else the errno it failed with (-1 when none was captured), never 0 for a failure. */
79
+ export function flock(fd, operation) {
80
+ const r = libc().flock([fd, operation]);
81
+ if (r.value === 0)
82
+ return 0;
83
+ return r.errnoCode !== 0 ? r.errnoCode : -1;
84
+ }
75
85
  //# sourceMappingURL=libc.gen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"libc.gen.js","sourceRoot":"","sources":["../../src/abi2/libc.gen.ts"],"names":[],"mappings":"AAAA,wLAAwL;AACxL;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAmB,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEhF,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,QAAQ,CAAC;AAErD,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAErC,SAAS,QAAQ;IACf,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,4BAA4B,CAAC;IACvE,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO;QAAE,OAAO,WAAW,CAAC;IACrD,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,CAAC,QAAQ,8CAA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AM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,2GAA2G;AAC3G,MAAM,UAAU,aAAa,CAAC,GAAe;IAC3C,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,kKAAkK;AAClK,MAAM,UAAU,KAAK,CAAC,EAAU,EAAE,SAAiB;IACjD,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;IACxC,IAAI,CAAC,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC5B,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC"}
@@ -43,7 +43,7 @@ import { realpathSync, statSync } from 'node:fs';
43
43
  import { decodeBuildInfo } from './buildinfo.js';
44
44
  import { Calls } from './calls.gen.js';
45
45
  import { ABI_FINGERPRINT, ABI_VERSION, CROSS_CHECK, DESCRIBED_SYMBOLS, SYMBOL } from './decls.gen.js';
46
- import { ArtifactIncompatibleError, LoaderCorruptError, UsageError, usageError } from './errors.js';
46
+ import { ArtifactIncompatibleError, corruptRefusal, UsageError, usageError } from './errors.js';
47
47
  import { compareDottedVersions, ffiOpen, glibcVersionString, lastDlError, rawDlopen, rawDlsym } from './libc.js';
48
48
  import { defineRawFunctions, rawCall } from './raw.js';
49
49
  /** One opened, verified ABI v2 image: the resolved raw table, its typed call wrappers, and the decoded build info. */
@@ -66,7 +66,7 @@ function refuseIncompatible(path, reason, want, got) {
66
66
  throw new ArtifactIncompatibleError({ reason, path, want, got });
67
67
  }
68
68
  function refuseCorrupt(path, reason, want, got) {
69
- throw new LoaderCorruptError({ reason, path, want, got });
69
+ throw corruptRefusal({ reason, path, want, got });
70
70
  }
71
71
  // --------------------------------------------------------------- image cache
72
72
  const loadedByKey = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/abi2/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEjD,OAAO,EAAkB,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACtG,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAe,OAAO,EAAE,MAAM,UAAU,CAAC;AA+BpE,sHAAsH;AACtH,MAAM,OAAO,WAAW;IACb,IAAI,CAAS;IACb,GAAG,CAAS;IACZ,KAAK,CAAQ;IACb,SAAS,CAAY;IAE9B,YAAY,IAAY,EAAE,GAAW,EAAE,SAAoB;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC;IAC1C,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,IAAY,EAAE,MAAc,EAAE,IAAa,EAAE,GAAY;IACnF,M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IAC5B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,WAAW,GAAG,IAAI,GAAG,EAAU,CAAC;AACtC,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO;IAClC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACtB,OAAO,CAAC,IAAI,CACV,YAAY,IAAI,2BAA2B,cAAc,iCAAiC;QACxF,yFAAyF,CAC5F,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -10,13 +10,18 @@
10
10
  *
11
11
  * chtypes fetch <version>... | --all [--frozen] [--offline] [--lock <file>] [--update] [--strict]
12
12
  * chtypes verify re-hash every installed library against its verified record
13
- * chtypes list what is installed, and the versions the registry publishes
13
+ * chtypes list what is installed, and the lines the registry publishes
14
14
  * chtypes where [--all] the v1 cache root; --all: every directory searched
15
+ * chtypes resolve <version> [--json] the build and manifest each platform resolves to, verified; installs nothing
16
+ * chtypes prune [--line <line>] [--keep <n>] [--dry-run]
17
+ * remove the builds of each line newer ones supersede, keeping the newest n
15
18
  *
16
19
  * Options per cli-common: `fetch` takes `--platform`, `--cache`, `--lock`, `--frozen`,
17
20
  * `--offline`, `--update`; `verify`, `list` and `where` take `--cache` (`list` also
18
- * `--offline`); every command takes `--strict`; `-h/--help` anywhere, `--version` at
19
- * top level. The registry base comes only from `CHTYPES_ARTIFACTS_URL`.
21
+ * `--offline`); `resolve` takes `--cache`, `--offline` and `--json`; `prune` takes
22
+ * `--cache`, `--line`, `--keep` and `--dry-run`; every command takes `--strict`;
23
+ * `-h/--help` anywhere, `--version` at top level. The registry base comes only from
24
+ * `CHTYPES_ARTIFACTS_URL`.
20
25
  *
21
26
  * Exit statuses: 0 ok, 2 usage, and for every fetch error the status the
22
27
  * `errors` table of `spec/fetch-v1/constants.json` gives its code (generated
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAqCH,qFAAqF;AACrF,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAe;AACf,eAAO,MAAM,OAAO,IAAI,CAAC;AAKzB,yDAAyD;AACzD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AA0DD;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,GAAE,KAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAgD5F"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AA0CH,qFAAqF;AACrF,eAAO,MAAM,UAAU,IAAI,CAAC;AAC5B,eAAe;AACf,eAAO,MAAM,OAAO,IAAI,CAAC;AAKzB,yDAAyD;AACzD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAyED;;;;GAIG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,EAAE,GAAE,KAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAwD5F"}