@intellectual-frontiers/ergonex 0.3.1 → 0.3.3

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 (54) hide show
  1. package/dist/desired.d.ts +1 -1
  2. package/dist/mod.js +853 -955
  3. package/dist/modules/external.d.ts +1 -1
  4. package/dist/modules/registry.d.ts +1 -1
  5. package/dist/modules/types.d.ts +2 -2
  6. package/dist/plan.d.ts +1 -1
  7. package/dist/render.d.ts +2 -2
  8. package/dist/state-record.d.ts +2 -2
  9. package/dist/tools/catalog.d.ts +1 -1
  10. package/dist/vendor/ts/runtime/http-client.d.ts +1 -1
  11. package/ergonex.mjs +3641 -3638
  12. package/package.json +5 -4
  13. package/dist/vendor/ts/kernel/archive.d.ts +0 -147
  14. package/dist/vendor/ts/kernel/assess.d.ts +0 -247
  15. package/dist/vendor/ts/kernel/attest.d.ts +0 -164
  16. package/dist/vendor/ts/kernel/base64.d.ts +0 -24
  17. package/dist/vendor/ts/kernel/cbor.d.ts +0 -39
  18. package/dist/vendor/ts/kernel/cms.d.ts +0 -106
  19. package/dist/vendor/ts/kernel/cose.d.ts +0 -34
  20. package/dist/vendor/ts/kernel/crypt.d.ts +0 -30
  21. package/dist/vendor/ts/kernel/csv.d.ts +0 -38
  22. package/dist/vendor/ts/kernel/der.d.ts +0 -67
  23. package/dist/vendor/ts/kernel/documentation.d.ts +0 -118
  24. package/dist/vendor/ts/kernel/dsse.d.ts +0 -137
  25. package/dist/vendor/ts/kernel/evidence.d.ts +0 -212
  26. package/dist/vendor/ts/kernel/glob.d.ts +0 -64
  27. package/dist/vendor/ts/kernel/grc.d.ts +0 -356
  28. package/dist/vendor/ts/kernel/http.d.ts +0 -46
  29. package/dist/vendor/ts/kernel/json5.d.ts +0 -46
  30. package/dist/vendor/ts/kernel/layers.d.ts +0 -35
  31. package/dist/vendor/ts/kernel/md5.d.ts +0 -19
  32. package/dist/vendor/ts/kernel/media-types.d.ts +0 -28
  33. package/dist/vendor/ts/kernel/mod.d.ts +0 -89
  34. package/dist/vendor/ts/kernel/ocsf-types.auto.d.ts +0 -4374
  35. package/dist/vendor/ts/kernel/ocsf.d.ts +0 -160
  36. package/dist/vendor/ts/kernel/oscal.d.ts +0 -356
  37. package/dist/vendor/ts/kernel/otel.d.ts +0 -365
  38. package/dist/vendor/ts/kernel/otlp.d.ts +0 -83
  39. package/dist/vendor/ts/kernel/png.d.ts +0 -124
  40. package/dist/vendor/ts/kernel/render.d.ts +0 -111
  41. package/dist/vendor/ts/kernel/schedule.d.ts +0 -207
  42. package/dist/vendor/ts/kernel/semver.d.ts +0 -94
  43. package/dist/vendor/ts/kernel/sha256.d.ts +0 -29
  44. package/dist/vendor/ts/kernel/signals.d.ts +0 -371
  45. package/dist/vendor/ts/kernel/sigv4.d.ts +0 -67
  46. package/dist/vendor/ts/kernel/test-record.d.ts +0 -222
  47. package/dist/vendor/ts/kernel/test-report.d.ts +0 -294
  48. package/dist/vendor/ts/kernel/toml.d.ts +0 -51
  49. package/dist/vendor/ts/kernel/trace.d.ts +0 -169
  50. package/dist/vendor/ts/kernel/ts-literal.d.ts +0 -62
  51. package/dist/vendor/ts/kernel/uuid.d.ts +0 -53
  52. package/dist/vendor/ts/kernel/webauthn.d.ts +0 -212
  53. package/dist/vendor/ts/kernel/xml.d.ts +0 -73
  54. package/dist/vendor/ts/kernel/yaml.d.ts +0 -44
@@ -1,46 +0,0 @@
1
- /**
2
- * Pure HTTP helpers that API clients and servers keep rewriting (commons 0005-typescript-runtime FR-012): the `Link` header (RFC 8288) read into its
3
- * links so a client follows `rel="next"` pages, `Retry-After` (RFC 9110 §10.2.3) read as a wait whether it is seconds or a date, and which
4
- * methods are safe (RFC 9110 §9.2.1) so a read-only client can refuse the rest, and the entity-tag conditions of `If-Match` and
5
- * `If-None-Match` (RFC 9110 §13.1) a server answers with 412 or 304. Taken from Stolos's connector SDK (`src/archon/connect/sdk.ts`,
6
- * `connector.ts`), which matched `rel="next"` with a regular expression in two places, and erga's `lib/ts/http` (on `@std/http/etag`).
7
- *
8
- * @example
9
- * ```ts
10
- * import { nextLink, retryAfterMs } from "./http.js";
11
- * nextLink('<https://api.example.com/items?page=2>; rel="next", <https://api.example.com/items?page=9>; rel="last"');
12
- * // "https://api.example.com/items?page=2"
13
- * retryAfterMs("120", Date.now()); // 120000
14
- * ```
15
- *
16
- * @module
17
- */
18
- /** One link of a `Link` header: its target and its parameters (`rel`, `type`, ...), names in lower case. */
19
- export type WebLink = {
20
- readonly target: string;
21
- readonly params: Readonly<Record<string, string>>;
22
- };
23
- /** The links of a `Link` header, in order; a part that is not `<target>; params` is skipped. Relative targets are resolved against `base`. */
24
- export declare function parseLinkHeader(header: string, base?: string): readonly WebLink[];
25
- /** The target of the first link whose `rel` names `rel` (`next` by default); a `rel` may name several, separated by spaces. */
26
- export declare function nextLink(header: string | null | undefined, rel?: string, base?: string): string | undefined;
27
- /** How long a `Retry-After` value asks to wait, in milliseconds from `now`: whole seconds, or an HTTP date (never negative); undefined where it is neither. */
28
- export declare function retryAfterMs(value: string | null | undefined, now: number): number | undefined;
29
- /** The methods that only read (RFC 9110 §9.2.1). */
30
- export declare const SAFE_METHODS: ReadonlySet<string>;
31
- /** Whether a method only reads; case does not matter. */
32
- export declare function isSafeMethod(method: string): boolean;
33
- /** The entity tags of an `If-Match` or `If-None-Match` header, as written (`"abc"`, `W/"abc"`), or `*`. */
34
- export declare function entityTags(header: string): readonly string[] | "*";
35
- /** An entity tag for content by its checksum or another stable token: strong (`"token"`), or weak (`W/"token"`). */
36
- export declare function entityTag(token: string, weak?: boolean): string;
37
- /**
38
- * Whether a request with this `If-Match` header may go on for content with this entity tag (RFC 9110 §13.1.1): yes where the header is
39
- * absent, is `*`, or names the tag by strong comparison (a weak tag never matches).
40
- */
41
- export declare function ifMatch(header: string | null | undefined, etag: string): boolean;
42
- /**
43
- * Whether a request with this `If-None-Match` header should get the content again (RFC 9110 §13.1.2), rather than 304 or 412: yes where
44
- * the header is absent or names no tag equal to this one by weak comparison; no where it is `*`.
45
- */
46
- export declare function ifNoneMatch(header: string | null | undefined, etag: string): boolean;
@@ -1,46 +0,0 @@
1
- /**
2
- * JSON5 (https://spec.json5.org/, 1.0.0), read and written with no outside package (commons 0005-typescript-runtime FR-031): the reader
3
- * takes the whole grammar (comments, trailing commas, unquoted ECMAScript keys, single-quoted and continued strings, hexadecimal,
4
- * `Infinity`, `NaN`, a leading `+`, a leading or trailing decimal point) and gives a typed `Json` value or the line and column where the
5
- * text stops being JSON5; the writer gives the form a person edits: a `//` comment at the head, keys bare where they can be, two spaces of
6
- * indent, a comma after every member, and a short list of plain values on one line. Taken from erga's `lib/ts/json5`, whose reader was
7
- * the `json5` package.
8
- *
9
- * @example
10
- * ```ts
11
- * import { parseJson5, toJson5 } from "./json5.js";
12
- * parseJson5("{ unquoted: 'and you can quote me on that', trailing: [1, 2,], }");
13
- * // { kind: "ok", value: { unquoted: "and you can quote me on that", trailing: [1, 2] } }
14
- * toJson5({ name: "a", tags: ["x", "y"] }, "What this file is");
15
- * // "// What this file is\n{\n name: \"a\",\n tags: [\"x\", \"y\"],\n}\n"
16
- * ```
17
- *
18
- * @module
19
- */
20
- import { type Result } from "@intellectual-frontiers/core";
21
- /** A JSON value: what a JSON5 file holds once read. An object keeps its members in the order they were written; a number may be `NaN` or infinite. */
22
- export type Json = null | boolean | number | string | readonly Json[] | JsonObject;
23
- /** A JSON object. */
24
- export type JsonObject = {
25
- readonly [key: string]: Json;
26
- };
27
- /** Where a text stops being JSON5, and why. Lines and columns count from 1. */
28
- export type Json5Error = {
29
- readonly kind: "json5";
30
- readonly line: number;
31
- readonly column: number;
32
- readonly message: string;
33
- };
34
- /** A JSON5 error as one line: `3:14: expected a value`. */
35
- export declare function formatJson5Error(e: Json5Error): string;
36
- /** Whether a value is a JSON object. */
37
- export declare function isJsonObject(v: Json): v is JsonObject;
38
- /** JSON5 (or JSON) text read as a JSON value, or where and why it is not JSON5. */
39
- export declare function parseJson5(text: string): Result<Json, Json5Error>;
40
- /** Whether a key may stand without quotes: an ECMAScript identifier of ASCII letters, digits, `_` and `$`, not starting with a digit. */
41
- export declare function isBareKey(key: string): boolean;
42
- /**
43
- * A value as JSON5 text: `comment` first, one `//` line for each of its lines (none where it is empty), then the value, ending in a line
44
- * break. A list of plain values stays on one line while it fits in `width` bytes (100 by default).
45
- */
46
- export declare function toJson5(value: Json, comment?: string, width?: number): string;
@@ -1,35 +0,0 @@
1
- import { type Finding, type SourceFile } from "./trace.js";
2
- /** A rung of a ladder: its number, its name, its homes (globs; a trailing `/` is everything under a folder) and the rungs it may rely on. */
3
- export type Rung = {
4
- readonly number: number;
5
- readonly name: string;
6
- readonly homes: readonly string[];
7
- readonly mayRelyOn: readonly number[];
8
- };
9
- /** A ladder: its rungs. */
10
- export type Ladder = readonly Rung[];
11
- /** Where a path is on a ladder: one rung, none, or a tie between rungs whose homes match it equally. */
12
- export type Placement = {
13
- readonly kind: "one";
14
- readonly rung: Rung;
15
- readonly home: string;
16
- } | {
17
- readonly kind: "none";
18
- } | {
19
- readonly kind: "tie";
20
- readonly rungs: readonly Rung[];
21
- readonly homes: readonly string[];
22
- };
23
- /** The rung a path is on (FR-009). */
24
- export declare function placeOf(ladder: Ladder, path: string): Placement;
25
- /** A relative import of a file: the specifier as written and its line. */
26
- export type Import = {
27
- readonly line: number;
28
- readonly specifier: string;
29
- };
30
- /** Every relative import of a file's text (FR-010): static, side-effect, re-export and dynamic `import()`, `import type` included. */
31
- export declare function importsOf(text: string): readonly Import[];
32
- /** A relative specifier resolved against the file that imports it, as a path from the repository with `/`. */
33
- export declare function resolveImport(from: string, specifier: string): string;
34
- /** Every finding of the layers check (FR-009, FR-010): each file's placement, then each import that climbs the ladder wrongly. */
35
- export declare function layerFindings(ladder: Ladder, files: readonly SourceFile[]): readonly Finding[];
@@ -1,19 +0,0 @@
1
- /**
2
- * An MD5 digest computed a piece at a time: `update` with each piece of the bytes in order (text is taken as UTF-8), then `digest` or
3
- * `hex`. After the digest is taken, the object takes no more bytes. Not for security (see the module's documentation).
4
- */
5
- export declare class Md5 {
6
- #private;
7
- /** Takes the next piece of the bytes; throws where the digest was already taken. */
8
- update(data: Uint8Array | string): this;
9
- /** The 16 bytes of the digest of every piece taken; the same each time it is asked. */
10
- digest(): Uint8Array;
11
- /** The digest as 32 lower-case hexadecimal digits. */
12
- hex(): string;
13
- }
14
- /** The 16 bytes of the MD5 of bytes, or of text as UTF-8. Not for security. */
15
- export declare function md5(data: Uint8Array | string): Uint8Array;
16
- /** The MD5 of bytes, or of text as UTF-8, as 32 lower-case hexadecimal digits (`md5("")` is `d41d8cd98f00b204e9800998ecf8427e`). */
17
- export declare function md5Hex(data: Uint8Array | string): string;
18
- /** The 16 bytes of the MD5 of every byte of a stream, read a chunk at a time, so the whole is never held. Not for security. */
19
- export declare function md5Stream(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
@@ -1,28 +0,0 @@
1
- /**
2
- * Media types by file extension (commons 0005-typescript-runtime FR-037): what a server says a file is, with `charset=UTF-8` on text, so a
3
- * page, a stylesheet, a feed or a book is served as what it is. The table holds the types the harnesses serve and publish (web, documents,
4
- * images, fonts, audio and video, archives, data); an extension it does not hold is `application/octet-stream` to `contentType`. Replaces
5
- * `@std/media-types` in erga.
6
- *
7
- * @example
8
- * ```ts
9
- * import { contentType, mediaType } from "./media-types.js";
10
- * contentType("site/index.html"); // "text/html; charset=UTF-8"
11
- * mediaType(".epub"); // "application/epub+zip"
12
- * ```
13
- *
14
- * @module
15
- */
16
- /** The media type of each extension (lower case, without its dot). */
17
- export declare const MEDIA_TYPES: Readonly<Record<string, string>>;
18
- /** Whether text of a media type is read as characters, and so served with a charset. */
19
- export declare function isTextual(type: string): boolean;
20
- /**
21
- * The extension of a path (`site/index.html` gives `html`), or an extension given on its own (`.html` or `html`), in lower case without its
22
- * dot; `""` where a path has none. A name that starts with a dot and has no other (`.epub`) is taken as an extension.
23
- */
24
- export declare function extensionOf(pathOrExtension: string): string;
25
- /** The media type of a path or an extension, or undefined where the table does not hold it. */
26
- export declare function mediaType(pathOrExtension: string): string | undefined;
27
- /** What a `Content-Type` header says for a path or an extension: its media type, with `; charset=UTF-8` for text; `application/octet-stream` where it is not known. */
28
- export declare function contentType(pathOrExtension: string): string;
@@ -1,89 +0,0 @@
1
- /**
2
- * The kernel of IFC TypeScript (commons 0005-typescript-runtime): pure code that imports nothing outside this folder, has no effect on the
3
- * host and runs wherever ECMAScript and the web standards do (Bun, Node, a browser, a Cloudflare Worker). Errors as values,
4
- * exhaustive matching, branded identifiers, decoders at the boundary; versions, SHA-256, SHA-512 crypt, base64, ASN.1 DER (as `der`), CMS
5
- * encryption (as `cms`), signed in-toto statements (as `dsse`) and AWS Signature Version 4 (as `sigv4`); CBOR (as `cbor`), COSE keys (as `cose`)
6
- * and WebAuthn verification for a relying party (as `webauthn`); PNG and ICO pictures (as `png`);
7
- * archives, JSON5, TOML, YAML, CSV, XML and TypeScript literals; HTTP headers and media types; graphs; command-line arguments (as `args`) and command trees (as `commands`);
8
- * OS scheduled jobs planned (as `jobs`); the trace of requirements and the layers of a ladder (as `trace` and `layers`, commons 0015-trace);
9
- * and type-level tests.
10
- *
11
- * @example
12
- * ```ts
13
- * import { absurd, err, ok, type Result } from "@intellectual-frontiers/core";
14
- * type Stage = { readonly kind: "intake" } | { readonly kind: "review" };
15
- * function next(s: Stage): Result<Stage, string> {
16
- * switch (s.kind) {
17
- * case "intake": return ok({ kind: "review" });
18
- * case "review": return err("review is the last stage");
19
- * default: return absurd(s);
20
- * }
21
- * }
22
- * ```
23
- *
24
- * @remarks
25
- * A library of this repository (`commons/data`, commons 0027-commons-libraries) reaches the kernel by package name, not by a relative path, through a
26
- * path link in its `devDependencies`: `"@intellectual-frontiers/commons": "link:../ts"` (commons 0005-typescript-runtime FR-074 to FR-077). The findings,
27
- * run by `tests/node/linked-library.test.ts` so that no one repeats them:
28
- *
29
- * - `link:` makes a symbolic link to `commons/ts`; `file:` makes a copy under `node_modules`, which Node 26 refuses
30
- * (`ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING`) and which does not follow the source. Use `link:`.
31
- * - Node resolves a link to its real path, so a linked `.ts` runs on Node 26 with no `--import` of the hook, on Bun and under the TypeScript 7 compiler
32
- * (`nodenext`). The hook (`node/register.mjs`) is for a consumer that installs a copy.
33
- * - A library imports its own modules by its own package name through its `exports` (one entry for each public surface); a file `exports` does not name
34
- * cannot be imported, by the runtimes or by the compiler, so `exports` is the library's boundary.
35
- * - `layers.ts` reads relative imports only, so an import by package name is never one of its findings: a library checks its own layers, by resolving
36
- * each specifier through its `exports`.
37
- *
38
- * @module
39
- */
40
- export { ArchiveFailure, concat, crc32, deflateRaw, dosDate, filesOf, formatArchiveError, gunzip, gzip, isSafePath, readTarStream, sortedPaths, splitName, tar, tarHeader, untar, untarStream, unzip, zip, ZIP_EPOCH, zipDeflated, zipEntries, zipRead, } from "./archive.js";
41
- export type { ArchiveError, Files, TarEntry, TarHeader, TarStreamEntry, ZipEntry } from "./archive.js";
42
- export { fromBase64, fromBase64Url, toBase64, toBase64Url } from "./base64.js";
43
- export * as assess from "./assess.js";
44
- export * as attest from "./attest.js";
45
- export * as cms from "./cms.js";
46
- export * as cbor from "./cbor.js";
47
- export * as cose from "./cose.js";
48
- export { csvField, formatCsvError, parseCsv, parseCsvRecords, toCsv } from "./csv.js";
49
- export type { CsvError, CsvOptions } from "./csv.js";
50
- export { CRYPT_ROUNDS, cryptSalt, sha512Crypt, verifySha512Crypt } from "./crypt.js";
51
- export * as der from "./der.js";
52
- export * as dsse from "./dsse.js";
53
- export * as evidence from "./evidence.js";
54
- export * as glob from "./glob.js";
55
- export * as grc from "./grc.js";
56
- export { entityTag, entityTags, ifMatch, ifNoneMatch, isSafeMethod, nextLink, parseLinkHeader, retryAfterMs, SAFE_METHODS, } from "./http.js";
57
- export type { WebLink } from "./http.js";
58
- export { formatJson5Error, isBareKey, isJsonObject, parseJson5, toJson5 } from "./json5.js";
59
- export type { Json, Json5Error, JsonObject } from "./json5.js";
60
- export * as md5 from "./md5.js";
61
- export { contentType, extensionOf, isTextual, MEDIA_TYPES, mediaType } from "./media-types.js";
62
- export { atLeast, bump, bumpSuffices, compareDotted, compareSemVer, dottedParts, formatRange, formatSemVer, maxSatisfying, parseRange, parseSemVer, satisfies, versionIn, } from "./semver.js";
63
- export type { Change, Comparator, Level, Operator, Range, SatisfiesOptions, SemVer } from "./semver.js";
64
- export { fromHex, parseSha256Sums, sameSha256, sha256, sha256Of, toHex } from "./sha256.js";
65
- export type { Sha256 } from "./sha256.js";
66
- export * as ocsf from "./ocsf.js";
67
- export * as oscal from "./oscal.js";
68
- export * as otel from "./otel.js";
69
- export * as otlp from "./otlp.js";
70
- export * as png from "./png.js";
71
- export * as render from "./render.js";
72
- export * as jobs from "./schedule.js";
73
- export * as layers from "./layers.js";
74
- export * as signals from "./signals.js";
75
- export * as sigv4 from "./sigv4.js";
76
- export * as testRecord from "./test-record.js";
77
- export * as testReport from "./test-report.js";
78
- export * as trace from "./trace.js";
79
- export { formatTomlError, isTomlDateTime, isTomlTable, parseToml, tomlKey, tomlString, toToml } from "./toml.js";
80
- export type { TomlDateTime, TomlError, TomlTable, TomlValue } from "./toml.js";
81
- export { BARE_KEY, exportedLiteral, parseTsLiteral, tsKey, tsLiteral } from "./ts-literal.js";
82
- export type { Literal, LiteralError, LiteralShape } from "./ts-literal.js";
83
- export * as uuid from "./uuid.js";
84
- export * as webauthn from "./webauthn.js";
85
- export { attribute, child, children, descendants, el, escapeXml, formatXmlError, leaf, localName, readXml, textOf, writeNode, writeXml, } from "./xml.js";
86
- export { formatYamlError, isPlainSafe, parseYaml, resolveCore, toYaml } from "./yaml.js";
87
- export type { YamlError, YamlOptions } from "./yaml.js";
88
- export type { ReadXmlOptions, XmlChild, XmlElement, XmlError, XmlNode, XmlText } from "./xml.js";
89
- export type { About, AboutArea, AboutCommand, AboutEnforcer, AboutExample, AboutFolder, AboutPhase, AboutPhaseState, AboutRule, AboutSpec, } from "./documentation.js";