cesr-ts 0.5.0 → 0.7.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 (52) hide show
  1. package/README.md +17 -6
  2. package/esm/mod.js +1 -0
  3. package/esm/src/annotate/render.js +4 -1
  4. package/esm/src/{annotate/cli.js → cli/commands/annotate.js} +11 -40
  5. package/esm/src/cli/commands/bench.js +137 -0
  6. package/esm/src/cli/commands/validate.js +154 -0
  7. package/esm/src/cli/io-node.js +45 -0
  8. package/esm/src/cli/main.js +42 -0
  9. package/esm/src/cli/node.js +14 -0
  10. package/esm/src/cli/types.js +1 -0
  11. package/esm/src/core/parser-frame-parser.js +6 -2
  12. package/esm/src/primitives/matter.js +7 -0
  13. package/esm/src/tables/counter.tables.generated.js +1 -5
  14. package/esm/src/tables/hard-code-tables.js +39 -0
  15. package/esm/src/tables/indexer.tables.generated.js +1 -9
  16. package/esm/src/tables/matter.tables.generated.js +1 -14
  17. package/esm/src/version.js +7 -4
  18. package/package.json +3 -9
  19. package/types/mod.d.ts +1 -0
  20. package/types/mod.d.ts.map +1 -1
  21. package/types/src/annotate/render.d.ts.map +1 -1
  22. package/types/src/cli/commands/annotate.d.ts +9 -0
  23. package/types/src/cli/commands/annotate.d.ts.map +1 -0
  24. package/types/src/cli/commands/bench.d.ts +4 -0
  25. package/types/src/cli/commands/bench.d.ts.map +1 -0
  26. package/types/src/cli/commands/validate.d.ts +4 -0
  27. package/types/src/cli/commands/validate.d.ts.map +1 -0
  28. package/types/src/cli/io-node.d.ts +4 -0
  29. package/types/src/cli/io-node.d.ts.map +1 -0
  30. package/types/src/cli/main.d.ts +10 -0
  31. package/types/src/cli/main.d.ts.map +1 -0
  32. package/types/src/cli/node.d.ts +9 -0
  33. package/types/src/cli/node.d.ts.map +1 -0
  34. package/types/src/cli/types.d.ts +22 -0
  35. package/types/src/cli/types.d.ts.map +1 -0
  36. package/types/src/core/parser-frame-parser.d.ts.map +1 -1
  37. package/types/src/primitives/matter.d.ts.map +1 -1
  38. package/types/src/tables/counter.tables.generated.d.ts +1 -1
  39. package/types/src/tables/counter.tables.generated.d.ts.map +1 -1
  40. package/types/src/tables/hard-code-tables.d.ts +15 -0
  41. package/types/src/tables/hard-code-tables.d.ts.map +1 -0
  42. package/types/src/tables/indexer.tables.generated.d.ts +1 -1
  43. package/types/src/tables/indexer.tables.generated.d.ts.map +1 -1
  44. package/types/src/tables/matter.tables.generated.d.ts +1 -1
  45. package/types/src/tables/matter.tables.generated.d.ts.map +1 -1
  46. package/types/src/version.d.ts +7 -4
  47. package/types/src/version.d.ts.map +1 -1
  48. package/esm/src/annotate/cli-node.js +0 -53
  49. package/types/src/annotate/cli-node.d.ts +0 -2
  50. package/types/src/annotate/cli-node.d.ts.map +0 -1
  51. package/types/src/annotate/cli.d.ts +0 -23
  52. package/types/src/annotate/cli.d.ts.map +0 -1
package/README.md CHANGED
@@ -25,16 +25,27 @@ const annotated = annotate(text, { domainHint: "txt", pretty: true });
25
25
  ## CLI usage
26
26
 
27
27
  ```bash
28
- npx cesr-annotate --in mystream.cesr --pretty
28
+ npm exec --package cesr-ts -- tephra annotate --in mystream.cesr --pretty
29
+ npm exec --package cesr-ts -- tephra validate --in mystream.cesr
30
+ npm exec --package cesr-ts -- tephra bench --in mystream.cesr --iterations 20 --warmup 3
29
31
  ```
30
32
 
31
- ## Deno CLI usage (from source)
33
+ After global install:
32
34
 
33
35
  ```bash
34
- deno task cesr:annotate --in mystream.cesr --pretty
36
+ tephra annotate --in mystream.cesr --pretty
37
+ tephra validate --in mystream.cesr
38
+ tephra bench --in mystream.cesr --iterations 20 --warmup 3
35
39
  ```
36
40
 
37
- ## Benchmarking (from source)
41
+ ## Deno CLI usage (from repository root)
42
+
43
+ ```bash
44
+ deno task tephra:annotate --in mystream.cesr --pretty
45
+ deno task tephra:validate --in mystream.cesr
46
+ ```
47
+
48
+ ## Benchmarking (from repository root)
38
49
 
39
50
  Run standard parser benchmark baselines:
40
51
 
@@ -45,8 +56,8 @@ deno task bench:cesr
45
56
  Run a benchmark on an arbitrary stream:
46
57
 
47
58
  ```bash
48
- deno task bench:cesr:parser --in ../../samples/cesr-streams/CESR_1_0-oor-auth-vc.cesr
49
- cat ../../samples/cesr-streams/CESR_1_0-oor-auth-vc.cesr | deno task bench:cesr:parser --iterations 20 --warmup 3
59
+ deno task tephra:bench --in ../../samples/cesr-streams/CESR_1_0-oor-auth-vc.cesr
60
+ cat ../../samples/cesr-streams/CESR_1_0-oor-auth-vc.cesr | deno task tephra:bench --iterations 20 --warmup 3
50
61
  ```
51
62
 
52
63
  ## Using cesr-ts through tufa
package/esm/mod.js CHANGED
@@ -1,3 +1,4 @@
1
+ /** cesr-ts npm package root entrypoint. */
1
2
  import "./_dnt.polyfills.js";
2
3
  export * from "./src/index.js";
3
4
  export * from "./src/version.js";
@@ -251,7 +251,10 @@ function renderFrame(frame, index, options) {
251
251
  const lines = [];
252
252
  const version = frame.body.gvrsn ?? frame.body.pvrsn;
253
253
  const domain = asDomain(frame.body.raw);
254
- if (domain === "txt" || domain === "bny") {
254
+ if (frame.body.kind === "CESR" && frame.body.ked === null) {
255
+ renderMessageBody(lines, frame, options);
256
+ }
257
+ else if (domain === "txt" || domain === "bny") {
255
258
  renderNativeBody(lines, frame, options, version);
256
259
  }
257
260
  else {
@@ -1,5 +1,7 @@
1
- import { annotate } from "./annotator.js";
1
+ import { annotate } from "../../annotate/annotator.js";
2
2
  const TEXT_DECODER = new TextDecoder();
3
+ const ANNOTATE_USAGE = "Usage: tephra annotate [--in <path>] [--out <path>] [--qb2] [--pretty]";
4
+ /** Parse `tephra annotate` command-line flags without performing IO. */
3
5
  function parseArgs(args) {
4
6
  const out = { qb2: false, pretty: false };
5
7
  for (let i = 0; i < args.length; i++) {
@@ -28,52 +30,21 @@ function parseArgs(args) {
28
30
  i++;
29
31
  continue;
30
32
  }
31
- if (arg === "--help" || arg === "-h") {
32
- throw new Error("Usage: cesr-annotate [--in <path>] [--out <path>] [--qb2] [--pretty]");
33
- }
34
33
  throw new Error(`Unknown argument: ${arg}`);
35
34
  }
36
35
  return out;
37
36
  }
38
37
  /**
39
- * Read a full `ReadableStream` into one contiguous byte buffer.
38
+ * Execute `tephra annotate`.
40
39
  *
41
- * This is the shared browser/runtime-neutral helper used by annotate CLI
42
- * shims that expose stdin as a web stream instead of synchronous file APIs.
40
+ * The command preserves the old standalone annotation behavior while moving it
41
+ * under the package-level dispatcher.
43
42
  */
44
- export async function readAllReadable(stream) {
45
- const reader = stream.getReader();
46
- const chunks = [];
47
- let total = 0;
48
- try {
49
- while (true) {
50
- const { value, done } = await reader.read();
51
- if (done)
52
- break;
53
- if (value) {
54
- chunks.push(value);
55
- total += value.length;
56
- }
57
- }
58
- }
59
- finally {
60
- reader.releaseLock();
61
- }
62
- const out = new Uint8Array(total);
63
- let offset = 0;
64
- for (const chunk of chunks) {
65
- out.set(chunk, offset);
66
- offset += chunk.length;
43
+ export async function annotateCommand(args, io) {
44
+ if (args.includes("--help") || args.includes("-h")) {
45
+ await io.writeStdout(`${ANNOTATE_USAGE}\n`);
46
+ return 0;
67
47
  }
68
- return out;
69
- }
70
- /**
71
- * Execute the standalone annotate CLI against the provided IO boundary.
72
- *
73
- * Error reporting is intentionally normalized here so runtime-specific entry
74
- * points can stay as thin bootstraps.
75
- */
76
- export async function annotateCli(args, io) {
77
48
  try {
78
49
  const options = parseArgs(args);
79
50
  const inputBytes = options.inPath
@@ -95,7 +66,7 @@ export async function annotateCli(args, io) {
95
66
  }
96
67
  catch (error) {
97
68
  const message = error instanceof Error ? error.message : String(error);
98
- await io.writeStderr(`cesr annotate error: ${message}\n`);
69
+ await io.writeStderr(`tephra annotate error: ${message}\n`);
99
70
  return 1;
100
71
  }
101
72
  }
@@ -0,0 +1,137 @@
1
+ import { benchmarkCesrParser } from "../../bench/parser-benchmark.js";
2
+ const BENCH_USAGE = "Usage: tephra bench [--in <path>] [--iterations <n>] [--warmup <n>] [--chunk-size <bytes>] [--framed] [--compat] [--allow-errors] [--json]";
3
+ /** Parse non-negative integer flags used for sizing and warmup controls. */
4
+ function parseNonNegativeInt(argName, value) {
5
+ const parsed = Number(value);
6
+ if (!Number.isFinite(parsed) || !Number.isInteger(parsed) || parsed < 0) {
7
+ throw new Error(`${argName} must be a non-negative integer`);
8
+ }
9
+ return parsed;
10
+ }
11
+ /** Parse strictly positive integer flags used for measured iteration count. */
12
+ function parsePositiveInt(argName, value) {
13
+ const parsed = parseNonNegativeInt(argName, value);
14
+ if (parsed <= 0) {
15
+ throw new Error(`${argName} must be greater than 0`);
16
+ }
17
+ return parsed;
18
+ }
19
+ /** Parse `tephra bench` command-line flags without performing IO. */
20
+ function parseArgs(args) {
21
+ const out = {
22
+ iterations: 50,
23
+ warmupIterations: 5,
24
+ chunkSize: 0,
25
+ framed: false,
26
+ attachmentDispatchMode: "strict",
27
+ allowErrors: false,
28
+ json: false,
29
+ };
30
+ for (let i = 0; i < args.length; i++) {
31
+ const arg = args[i];
32
+ if (arg === "--in") {
33
+ const next = args[i + 1];
34
+ if (!next)
35
+ throw new Error("Missing value for --in");
36
+ out.inPath = next;
37
+ i++;
38
+ continue;
39
+ }
40
+ if (arg === "--iterations") {
41
+ const next = args[i + 1];
42
+ if (!next)
43
+ throw new Error("Missing value for --iterations");
44
+ out.iterations = parsePositiveInt("--iterations", next);
45
+ i++;
46
+ continue;
47
+ }
48
+ if (arg === "--warmup") {
49
+ const next = args[i + 1];
50
+ if (!next)
51
+ throw new Error("Missing value for --warmup");
52
+ out.warmupIterations = parseNonNegativeInt("--warmup", next);
53
+ i++;
54
+ continue;
55
+ }
56
+ if (arg === "--chunk-size") {
57
+ const next = args[i + 1];
58
+ if (!next)
59
+ throw new Error("Missing value for --chunk-size");
60
+ out.chunkSize = parseNonNegativeInt("--chunk-size", next);
61
+ i++;
62
+ continue;
63
+ }
64
+ if (arg === "--framed") {
65
+ out.framed = true;
66
+ continue;
67
+ }
68
+ if (arg === "--compat") {
69
+ out.attachmentDispatchMode = "compat";
70
+ continue;
71
+ }
72
+ if (arg === "--allow-errors") {
73
+ out.allowErrors = true;
74
+ continue;
75
+ }
76
+ if (arg === "--json") {
77
+ out.json = true;
78
+ continue;
79
+ }
80
+ throw new Error(`Unknown argument: ${arg}`);
81
+ }
82
+ return out;
83
+ }
84
+ /** Render human-readable benchmark output for terminal workflows. */
85
+ function formatHumanReadable(sourceLabel, result) {
86
+ const chunkLabel = result.chunkSize === result.bytesPerIteration
87
+ ? "full stream"
88
+ : `${result.chunkSize} bytes`;
89
+ return [
90
+ "CESR parser benchmark",
91
+ `source: ${sourceLabel}`,
92
+ `iterations: ${result.iterations} (warmup: ${result.warmupIterations})`,
93
+ `input bytes/iteration: ${result.bytesPerIteration}`,
94
+ `chunk size: ${chunkLabel}`,
95
+ `frames/iteration: ${(result.totalFrames / result.iterations).toFixed(2)}`,
96
+ `errors/iteration: ${(result.totalErrors / result.iterations).toFixed(2)}`,
97
+ `avg iteration: ${result.avgIterationMs.toFixed(3)} ms`,
98
+ `throughput: ${result.throughputMiBPerSec.toFixed(3)} MiB/s`,
99
+ `frame rate: ${result.framesPerSec.toFixed(2)} frames/s`,
100
+ ].join("\n");
101
+ }
102
+ /** Execute `tephra bench` using the existing parser benchmark engine. */
103
+ export async function benchCommand(args, io) {
104
+ if (args.includes("--help") || args.includes("-h")) {
105
+ await io.writeStdout(`${BENCH_USAGE}\n`);
106
+ return 0;
107
+ }
108
+ try {
109
+ const options = parseArgs(args);
110
+ const sourceLabel = options.inPath ? options.inPath : "stdin";
111
+ const inputBytes = options.inPath
112
+ ? await io.readFile(options.inPath)
113
+ : await io.readStdin();
114
+ const result = benchmarkCesrParser(inputBytes, {
115
+ iterations: options.iterations,
116
+ warmupIterations: options.warmupIterations,
117
+ chunkSize: options.chunkSize,
118
+ parserOptions: {
119
+ framed: options.framed,
120
+ attachmentDispatchMode: options.attachmentDispatchMode,
121
+ },
122
+ failOnParseError: !options.allowErrors,
123
+ });
124
+ if (options.json) {
125
+ await io.writeStdout(`${JSON.stringify({ source: sourceLabel, ...result })}\n`);
126
+ return 0;
127
+ }
128
+ const rendered = formatHumanReadable(sourceLabel, result);
129
+ await io.writeStdout(`${rendered}\n`);
130
+ return 0;
131
+ }
132
+ catch (error) {
133
+ const message = error instanceof Error ? error.message : String(error);
134
+ await io.writeStderr(`tephra bench error: ${message}\n`);
135
+ return 1;
136
+ }
137
+ }
@@ -0,0 +1,154 @@
1
+ import { parseBytes } from "../../core/parser-engine.js";
2
+ const VALIDATE_USAGE = "Usage: tephra validate [--in <path>] [--framed] [--compat] [--json]";
3
+ /** Parse `tephra validate` command-line flags without performing IO. */
4
+ function parseArgs(args) {
5
+ const out = {
6
+ framed: false,
7
+ attachmentDispatchMode: "strict",
8
+ json: false,
9
+ };
10
+ for (let i = 0; i < args.length; i++) {
11
+ const arg = args[i];
12
+ if (arg === "--in") {
13
+ const next = args[i + 1];
14
+ if (!next)
15
+ throw new Error("Missing value for --in");
16
+ out.inPath = next;
17
+ i++;
18
+ continue;
19
+ }
20
+ if (arg === "--framed") {
21
+ out.framed = true;
22
+ continue;
23
+ }
24
+ if (arg === "--compat") {
25
+ out.attachmentDispatchMode = "compat";
26
+ continue;
27
+ }
28
+ if (arg === "--json") {
29
+ out.json = true;
30
+ continue;
31
+ }
32
+ throw new Error(`Unknown argument: ${arg}`);
33
+ }
34
+ return out;
35
+ }
36
+ /**
37
+ * Convert parser errors into stable validation report entries.
38
+ *
39
+ * Parser error classes may carry useful location fields, but the CLI should not
40
+ * expose entire internal error objects as JSON. This function keeps the stable
41
+ * public fields and includes offset/context only when the parser supplied them.
42
+ */
43
+ function describeError(error) {
44
+ const detail = {
45
+ name: error.name || "Error",
46
+ message: error.message,
47
+ };
48
+ const maybeParserError = error;
49
+ if (typeof maybeParserError.offset === "number") {
50
+ detail.offset = maybeParserError.offset;
51
+ }
52
+ if (typeof maybeParserError.context === "string") {
53
+ detail.context = maybeParserError.context;
54
+ }
55
+ return detail;
56
+ }
57
+ /**
58
+ * Count frames, attachment groups, and parser errors for one input stream.
59
+ *
60
+ * `tephra validate` is strict by default because a validation command should fail
61
+ * on ambiguous attachment dispatch. `--compat` intentionally relaxes that mode
62
+ * for streams that still rely on legacy mixed-major attachment behavior.
63
+ *
64
+ * Empty input is reported as a validation failure even though the parser has no
65
+ * malformed bytes to diagnose. A zero-frame stream is not useful evidence that a
66
+ * CESR payload is valid.
67
+ */
68
+ function validateBytes(bytes, source, options) {
69
+ const events = parseBytes(bytes, {
70
+ framed: options.framed,
71
+ attachmentDispatchMode: options.attachmentDispatchMode,
72
+ });
73
+ const frames = events.filter((event) => event.type === "frame");
74
+ const errors = events
75
+ .filter((event) => event.type === "error")
76
+ .map((event) => describeError(event.error));
77
+ const attachmentGroupCount = frames.reduce((count, event) => count + event.frame.attachments.length, 0);
78
+ if (frames.length === 0 && errors.length === 0) {
79
+ errors.push({
80
+ name: "NoFramesError",
81
+ message: "No CESR frames parsed",
82
+ });
83
+ }
84
+ return {
85
+ ok: errors.length === 0,
86
+ source,
87
+ bytes: bytes.length,
88
+ frameCount: frames.length,
89
+ attachmentGroupCount,
90
+ errorCount: errors.length,
91
+ errors,
92
+ };
93
+ }
94
+ /** Render successful human-readable validation output. */
95
+ function formatSuccess(report) {
96
+ return [
97
+ "CESR validation passed",
98
+ `source: ${report.source}`,
99
+ `bytes: ${report.bytes}`,
100
+ `frames: ${report.frameCount}`,
101
+ `attachment groups: ${report.attachmentGroupCount}`,
102
+ ].join("\n");
103
+ }
104
+ /** Render human-readable validation failure output with per-error details. */
105
+ function formatFailure(report) {
106
+ const lines = [
107
+ "CESR validation failed",
108
+ `source: ${report.source}`,
109
+ `bytes: ${report.bytes}`,
110
+ `frames: ${report.frameCount}`,
111
+ `attachment groups: ${report.attachmentGroupCount}`,
112
+ `errors: ${report.errorCount}`,
113
+ ];
114
+ for (const error of report.errors) {
115
+ lines.push(`- ${error.name}: ${error.message}`);
116
+ if (error.offset !== undefined) {
117
+ lines.push(` offset: ${error.offset}`);
118
+ }
119
+ if (error.context) {
120
+ lines.push(` context: ${error.context}`);
121
+ }
122
+ }
123
+ return lines.join("\n");
124
+ }
125
+ /** Execute `tephra validate` against file input or stdin. */
126
+ export async function validateCommand(args, io) {
127
+ if (args.includes("--help") || args.includes("-h")) {
128
+ await io.writeStdout(`${VALIDATE_USAGE}\n`);
129
+ return 0;
130
+ }
131
+ try {
132
+ const options = parseArgs(args);
133
+ const source = options.inPath ? options.inPath : "stdin";
134
+ const inputBytes = options.inPath
135
+ ? await io.readFile(options.inPath)
136
+ : await io.readStdin();
137
+ const report = validateBytes(inputBytes, source, options);
138
+ if (options.json) {
139
+ await io.writeStdout(`${JSON.stringify(report)}\n`);
140
+ }
141
+ else if (report.ok) {
142
+ await io.writeStdout(`${formatSuccess(report)}\n`);
143
+ }
144
+ else {
145
+ await io.writeStderr(`${formatFailure(report)}\n`);
146
+ }
147
+ return report.ok ? 0 : 1;
148
+ }
149
+ catch (error) {
150
+ const message = error instanceof Error ? error.message : String(error);
151
+ await io.writeStderr(`tephra validate error: ${message}\n`);
152
+ return 1;
153
+ }
154
+ }
@@ -0,0 +1,45 @@
1
+ import { readFile, writeFile } from "node:fs/promises";
2
+ import { stderr, stdin, stdout } from "node:process";
3
+ /** Read Node stdin into one contiguous byte buffer for command execution. */
4
+ async function readNodeStdin() {
5
+ const chunks = [];
6
+ let total = 0;
7
+ for await (const chunk of stdin) {
8
+ const bytes = chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
9
+ chunks.push(bytes);
10
+ total += bytes.length;
11
+ }
12
+ const out = new Uint8Array(total);
13
+ let offset = 0;
14
+ for (const chunk of chunks) {
15
+ out.set(chunk, offset);
16
+ offset += chunk.length;
17
+ }
18
+ return out;
19
+ }
20
+ /** Write text to a Node stream and wait for completion or backpressure error. */
21
+ async function writeNodeStream(stream, text) {
22
+ await new Promise((resolve, reject) => {
23
+ stream.write(text, (error) => {
24
+ if (error)
25
+ reject(error);
26
+ else
27
+ resolve();
28
+ });
29
+ });
30
+ }
31
+ /** Create the Node runtime IO adapter for the package-level `tephra` CLI. */
32
+ export function createNodeCliIo() {
33
+ return {
34
+ readFile: async (path) => {
35
+ const data = await readFile(path);
36
+ return new Uint8Array(data);
37
+ },
38
+ writeTextFile: async (path, text) => {
39
+ await writeFile(path, text, "utf8");
40
+ },
41
+ readStdin: readNodeStdin,
42
+ writeStdout: (text) => writeNodeStream(stdout, text),
43
+ writeStderr: (text) => writeNodeStream(stderr, text),
44
+ };
45
+ }
@@ -0,0 +1,42 @@
1
+ import { annotateCommand } from "./commands/annotate.js";
2
+ import { benchCommand } from "./commands/bench.js";
3
+ import { validateCommand } from "./commands/validate.js";
4
+ const COMMANDS = {
5
+ annotate: annotateCommand,
6
+ validate: validateCommand,
7
+ bench: benchCommand,
8
+ };
9
+ const TEPHRA_USAGE = [
10
+ "Usage: tephra <command> [options]",
11
+ "",
12
+ "Commands:",
13
+ " annotate Annotate a CESR stream",
14
+ " validate Validate a CESR stream",
15
+ " bench Benchmark CESR parser throughput",
16
+ "",
17
+ "Run `tephra <command> --help` for command-specific options.",
18
+ ].join("\n");
19
+ /**
20
+ * Execute the package-level `tephra` CLI dispatcher.
21
+ *
22
+ * This function owns only command selection and top-level usage behavior. Each
23
+ * subcommand receives the already-selected argument tail plus a runtime-neutral
24
+ * IO adapter, so command behavior remains identical under Deno and Node.
25
+ */
26
+ export async function tephraCli(args, io) {
27
+ const [command, ...commandArgs] = args;
28
+ if (command === "--help" || command === "-h") {
29
+ await io.writeStdout(`${TEPHRA_USAGE}\n`);
30
+ return 0;
31
+ }
32
+ if (!command) {
33
+ await io.writeStderr(`${TEPHRA_USAGE}\n`);
34
+ return 1;
35
+ }
36
+ const handler = COMMANDS[command];
37
+ if (!handler) {
38
+ await io.writeStderr(`Unknown tephra command: ${command}\n${TEPHRA_USAGE}\n`);
39
+ return 1;
40
+ }
41
+ return await handler(commandArgs, io);
42
+ }
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * npm executable entrypoint for the package-level `tephra` CLI.
4
+ *
5
+ * The CESR npm build discovers this file by the marker text in this comment and
6
+ * prepends a Node shebang after DNT emits JavaScript. Keep this launcher thin so
7
+ * Deno-only APIs do not leak into the Node executable path.
8
+ */
9
+ import "../../_dnt.polyfills.js";
10
+ import { argv, exit } from "node:process";
11
+ import { createNodeCliIo } from "./io-node.js";
12
+ import { tephraCli } from "./main.js";
13
+ const code = await tephraCli(argv.slice(2), createNodeCliIo());
14
+ exit(code);
@@ -0,0 +1 @@
1
+ export {};
@@ -242,14 +242,18 @@ export class FrameParser {
242
242
  };
243
243
  }
244
244
  catch (_error) {
245
+ // Non-native body groups wrap one Matter primitive. If Serder hydration
246
+ // fails, expose the primitive body bytes only; callers that inspect the
247
+ // fallback should not see the surrounding group counter envelope.
248
+ const raw = matter.raw;
245
249
  return {
246
250
  frame: {
247
251
  body: {
248
- raw: matter.raw,
252
+ raw,
249
253
  ked: null,
250
254
  proto: Protocols.keri,
251
255
  kind: Kinds.cesr,
252
- size: matter.raw.length,
256
+ size: raw.length,
253
257
  pvrsn: version,
254
258
  gvrsn: version,
255
259
  ilk: null,
@@ -41,6 +41,13 @@ function matterNameForCode(code) {
41
41
  }
42
42
  return name;
43
43
  }
44
+ /**
45
+ * Select the concrete variable-length Matter code for the raw payload size.
46
+ *
47
+ * Variable families encode lead bytes and soft-size width in the selector
48
+ * itself. Normalizing once during construction keeps generated qb64/qb2 forms
49
+ * deterministic without leaking that sizing policy to primitive callers.
50
+ */
44
51
  function normalizeVariableMatterCode(code, raw) {
45
52
  const sizage = MATTER_SIZES.get(code);
46
53
  if (!sizage || sizage.fs !== null) {
@@ -1,3 +1,4 @@
1
+ export { COUNTER_HARDS } from "./hard-code-tables.js";
1
2
  export const COUNTER_SIZES_V1 = new Map([
2
3
  ["-_AAA", { hs: 5, ss: 3, fs: 8 }],
3
4
  ["--L", { hs: 3, ss: 5, fs: 8 }],
@@ -84,11 +85,6 @@ export const COUNTER_SIZES_V2 = new Map([
84
85
  ["-Y", { hs: 2, ss: 2, fs: 4 }],
85
86
  ["-Z", { hs: 2, ss: 2, fs: 4 }],
86
87
  ]);
87
- export const COUNTER_HARDS = new Map([
88
- ..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("").map((c) => [`-${c}`, 2]),
89
- ["--", 3],
90
- ["-_", 5],
91
- ]);
92
88
  export const COUNTER_CODE_NAMES_V1 = {
93
89
  "-_AAA": "KERIACDCGenusVersion",
94
90
  "--L": "BigPathedMaterialCouples",
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Source-owned hard-code size tables used by generated CESR lookup modules.
3
+ *
4
+ * KERIpy derives these ranges procedurally rather than listing them alongside
5
+ * the generated size/name dictionaries. Keeping them here avoids embedding
6
+ * static table literals inside the generator while preserving the public
7
+ * generated-module exports.
8
+ */
9
+ /** Hard-code byte counts for Matter derivation code prefixes. */
10
+ export const MATTER_HARDS = new Map([
11
+ ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((c) => [c, 1]),
12
+ ..."abcdefghijklmnopqrstuvwxyz".split("").map((c) => [c, 1]),
13
+ ["0", 2],
14
+ ["1", 4],
15
+ ["2", 4],
16
+ ["3", 4],
17
+ ["4", 2],
18
+ ["5", 2],
19
+ ["6", 2],
20
+ ["7", 4],
21
+ ["8", 4],
22
+ ["9", 4],
23
+ ]);
24
+ /** Hard-code byte counts for Indexer derivation code prefixes. */
25
+ export const INDEXER_HARDS = new Map([
26
+ ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((c) => [c, 1]),
27
+ ..."abcdefghijklmnopqrstuvwxyz".split("").map((c) => [c, 1]),
28
+ ["0", 2],
29
+ ["1", 2],
30
+ ["2", 2],
31
+ ["3", 2],
32
+ ["4", 2],
33
+ ]);
34
+ /** Hard-code byte counts for Counter code prefixes. */
35
+ export const COUNTER_HARDS = new Map([
36
+ ..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("").map((c) => [`-${c}`, 2]),
37
+ ["--", 3],
38
+ ["-_", 5],
39
+ ]);
@@ -1,3 +1,4 @@
1
+ export { INDEXER_HARDS } from "./hard-code-tables.js";
1
2
  export const INDEXER_SIZES = new Map([
2
3
  ["0A", { hs: 2, ss: 2, os: 1, fs: 156, ls: 0 }],
3
4
  ["0B", { hs: 2, ss: 2, os: 1, fs: 156, ls: 0 }],
@@ -61,12 +62,3 @@ export const INDEXER_CODES_BY_NAME = {
61
62
  "TBD1": "1z",
62
63
  "TBD4": "4z",
63
64
  };
64
- export const INDEXER_HARDS = new Map([
65
- ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((c) => [c, 1]),
66
- ..."abcdefghijklmnopqrstuvwxyz".split("").map((c) => [c, 1]),
67
- ["0", 2],
68
- ["1", 2],
69
- ["2", 2],
70
- ["3", 2],
71
- ["4", 2],
72
- ]);
@@ -1,3 +1,4 @@
1
+ export { MATTER_HARDS } from "./hard-code-tables.js";
1
2
  export const MATTER_SIZES = new Map([
2
3
  ["0A", { hs: 2, ss: 0, xs: 0, fs: 24, ls: 0 }],
3
4
  ["0B", { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 }],
@@ -334,17 +335,3 @@ export const MATTER_CODES_BY_NAME = {
334
335
  "X448": "L",
335
336
  "Yes": "1AAM",
336
337
  };
337
- export const MATTER_HARDS = new Map([
338
- ..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split("").map((c) => [c, 1]),
339
- ..."abcdefghijklmnopqrstuvwxyz".split("").map((c) => [c, 1]),
340
- ["0", 2],
341
- ["1", 4],
342
- ["2", 4],
343
- ["3", 4],
344
- ["4", 2],
345
- ["5", 2],
346
- ["6", 2],
347
- ["7", 4],
348
- ["8", 4],
349
- ["9", 4],
350
- ]);
@@ -1,11 +1,14 @@
1
1
  /**
2
- * Generated by scripts/generate_versions.ts.
3
- * Do not edit by hand.
2
+ * Template used by scripts/generate_versions.ts for package version modules.
3
+ *
4
+ * The generator token-replaces the string placeholders below, then formats and
5
+ * compares the rendered output during version checks. Do not edit generated
6
+ * `src/version.ts` files by hand; edit this template instead.
4
7
  */
5
8
  /** Package semantic version copied from the owning package manifest. */
6
- export const PACKAGE_VERSION = "0.5.0";
9
+ export const PACKAGE_VERSION = "0.7.0";
7
10
  /** Optional build metadata stamp injected by release/CI workflows. */
8
- export const BUILD_METADATA = "build.5.d6fc2b59e3bc691c9cf61654afbc3417593163ee";
11
+ export const BUILD_METADATA = "build.7.6ebe132d252df25f649be23d4c6c62de41e23dec";
9
12
  /** User-facing version string with build metadata appended when present. */
10
13
  export const DISPLAY_VERSION = BUILD_METADATA
11
14
  ? `${PACKAGE_VERSION}+${BUILD_METADATA}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cesr-ts",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "CESR parser, primitives, and annotation tooling for TypeScript/JavaScript",
5
5
  "homepage": "https://github.com/kentbull/keri-ts/tree/main/packages/cesr",
6
6
  "repository": {
@@ -19,12 +19,6 @@
19
19
  ".": {
20
20
  "import": "./esm/mod.js",
21
21
  "types": "./types/mod.d.ts"
22
- },
23
- "./src/annotate/cli-node.js": {
24
- "import": {
25
- "types": "./types/src/annotate/cli-node.d.ts",
26
- "default": "./esm/src/annotate/cli-node.js"
27
- }
28
22
  }
29
23
  },
30
24
  "scripts": {
@@ -34,7 +28,7 @@
34
28
  "type": "module",
35
29
  "sideEffects": false,
36
30
  "bin": {
37
- "cesr-annotate": "./esm/src/annotate/cli-node.js"
31
+ "tephra": "esm/src/cli/node.js"
38
32
  },
39
33
  "files": [
40
34
  "esm",
@@ -54,4 +48,4 @@
54
48
  "libsodium-wrappers": "^0.8.2"
55
49
  },
56
50
  "_generatedBy": "dnt@dev"
57
- }
51
+ }
package/types/mod.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /** cesr-ts npm package root entrypoint. */
1
2
  import "./_dnt.polyfills.js";
2
3
  export * from "./src/index.js";
3
4
  export * from "./src/version.js";
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,OAAO,qBAAqB,CAAC;AAE7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/src/annotate/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAUpD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAqelE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,GACjC,MAAM,GAAG,IAAI,CAaf;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,EAAE,EACrB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,GACjC,cAAc,EAAE,CAElB"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/src/annotate/render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAUpD,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAuelE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,GACjC,MAAM,GAAG,IAAI,CAaf;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,EAAE,EACrB,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC,GACjC,cAAc,EAAE,CAElB"}
@@ -0,0 +1,9 @@
1
+ import type { CliIo } from "../types.js";
2
+ /**
3
+ * Execute `tephra annotate`.
4
+ *
5
+ * The command preserves the old standalone annotation behavior while moving it
6
+ * under the package-level dispatcher.
7
+ */
8
+ export declare function annotateCommand(args: string[], io: CliIo): Promise<number>;
9
+ //# sourceMappingURL=annotate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotate.d.ts","sourceRoot":"","sources":["../../../../src/src/cli/commands/annotate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA4CzC;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CA+BhF"}
@@ -0,0 +1,4 @@
1
+ import type { CliIo } from "../types.js";
2
+ /** Execute `tephra bench` using the existing parser benchmark engine. */
3
+ export declare function benchCommand(args: string[], io: CliIo): Promise<number>;
4
+ //# sourceMappingURL=bench.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bench.d.ts","sourceRoot":"","sources":["../../../../src/src/cli/commands/bench.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AA+HzC,yEAAyE;AACzE,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC7E"}
@@ -0,0 +1,4 @@
1
+ import type { CliIo } from "../types.js";
2
+ /** Execute `tephra validate` against file input or stdin. */
3
+ export declare function validateCommand(args: string[], io: CliIo): Promise<number>;
4
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/src/cli/commands/validate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAwKzC,6DAA6D;AAC7D,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BhF"}
@@ -0,0 +1,4 @@
1
+ import type { CliIo } from "./types.js";
2
+ /** Create the Node runtime IO adapter for the package-level `tephra` CLI. */
3
+ export declare function createNodeCliIo(): CliIo;
4
+ //# sourceMappingURL=io-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io-node.d.ts","sourceRoot":"","sources":["../../../src/src/cli/io-node.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAkCxC,6EAA6E;AAC7E,wBAAgB,eAAe,IAAI,KAAK,CAavC"}
@@ -0,0 +1,10 @@
1
+ import type { CliIo } from "./types.js";
2
+ /**
3
+ * Execute the package-level `tephra` CLI dispatcher.
4
+ *
5
+ * This function owns only command selection and top-level usage behavior. Each
6
+ * subcommand receives the already-selected argument tail plus a runtime-neutral
7
+ * IO adapter, so command behavior remains identical under Deno and Node.
8
+ */
9
+ export declare function tephraCli(args: string[], io: CliIo): Promise<number>;
10
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/src/cli/main.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAmBpD;;;;;;GAMG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB1E"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * npm executable entrypoint for the package-level `tephra` CLI.
3
+ *
4
+ * The CESR npm build discovers this file by the marker text in this comment and
5
+ * prepends a Node shebang after DNT emits JavaScript. Keep this launcher thin so
6
+ * Deno-only APIs do not leak into the Node executable path.
7
+ */
8
+ import "../../_dnt.polyfills.js";
9
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/src/cli/node.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,yBAAyB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Runtime-neutral IO boundary for CESR CLI commands.
3
+ *
4
+ * Command modules should depend on this interface instead of importing Deno or
5
+ * Node APIs directly. That keeps `tephra annotate`, `tephra validate`, and
6
+ * `tephra bench` executable from both the Deno launcher and the npm/Node launcher.
7
+ */
8
+ export interface CliIo {
9
+ /** Read one complete input file as raw CESR bytes. */
10
+ readFile(path: string): Promise<Uint8Array>;
11
+ /** Write command output to a text file, used by `tephra annotate --out`. */
12
+ writeTextFile(path: string, text: string): Promise<void>;
13
+ /** Read stdin as raw CESR bytes when `--in` is omitted. */
14
+ readStdin(): Promise<Uint8Array>;
15
+ /** Write terminal output intended for successful command output. */
16
+ writeStdout(text: string): Promise<void>;
17
+ /** Write terminal output intended for usage errors or validation failures. */
18
+ writeStderr(text: string): Promise<void>;
19
+ }
20
+ /** Shared command contract for package-level CESR CLI subcommands. */
21
+ export type CliCommand = (args: string[], io: CliIo) => Promise<number>;
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/src/cli/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,KAAK;IACpB,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,4EAA4E;IAC5E,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;I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AAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAI3C,+DAA+D;IAC/D,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAQ5C,yDAAyD;IACzD,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAG7C;AAED,gDAAgD;AAChD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE7D;AAED,kDAAkD;AAClD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAE/D;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CACzB,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,GAAG,KAAK,CAAC,GACrC,MAAM,CAIR"}
@@ -1,7 +1,7 @@
1
1
  import type { Cizage } from "./table-types.js";
2
+ export { COUNTER_HARDS } from "./hard-code-tables.js";
2
3
  export declare const COUNTER_SIZES_V1: Map<string, Cizage>;
3
4
  export declare const COUNTER_SIZES_V2: Map<string, Cizage>;
4
- export declare const COUNTER_HARDS: Map<string, number>;
5
5
  export declare const COUNTER_CODE_NAMES_V1: {
6
6
  readonly "-_AAA": "KERIACDCGenusVersion";
7
7
  readonly "--L": "BigPathedMaterialCouples";
@@ -1 +1 @@
1
- {"version":3,"file":"counter.tables.generated.d.ts","sourceRoot":"","sources":["../../../src/src/tables/counter.tables.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,qBAyB3B,CAAC;AAEH,eAAO,MAAM,gBAAgB,qBA2D3B,CAAC;AAEH,eAAO,MAAM,aAAa,qBAIxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBxB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DxB,CAAC"}
1
+ {"version":3,"file":"counter.tables.generated.d.ts","sourceRoot":"","sources":["../../../src/src/tables/counter.tables.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,eAAO,MAAM,gBAAgB,qBAyB3B,CAAC;AAEH,eAAO,MAAM,gBAAgB,qBA2D3B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;CAyBxB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DxB,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Source-owned hard-code size tables used by generated CESR lookup modules.
3
+ *
4
+ * KERIpy derives these ranges procedurally rather than listing them alongside
5
+ * the generated size/name dictionaries. Keeping them here avoids embedding
6
+ * static table literals inside the generator while preserving the public
7
+ * generated-module exports.
8
+ */
9
+ /** Hard-code byte counts for Matter derivation code prefixes. */
10
+ export declare const MATTER_HARDS: Map<string, number>;
11
+ /** Hard-code byte counts for Indexer derivation code prefixes. */
12
+ export declare const INDEXER_HARDS: Map<string, number>;
13
+ /** Hard-code byte counts for Counter code prefixes. */
14
+ export declare const COUNTER_HARDS: Map<string, number>;
15
+ //# sourceMappingURL=hard-code-tables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hard-code-tables.d.ts","sourceRoot":"","sources":["../../../src/src/tables/hard-code-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iEAAiE;AACjE,eAAO,MAAM,YAAY,qBAavB,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,aAAa,qBAQxB,CAAC;AAEH,uDAAuD;AACvD,eAAO,MAAM,aAAa,qBAIxB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Xizage } from "./table-types.js";
2
+ export { INDEXER_HARDS } from "./hard-code-tables.js";
2
3
  export declare const INDEXER_SIZES: Map<string, Xizage>;
3
4
  export declare const INDEXER_CODE_NAMES: {
4
5
  readonly "0A": "Ed448_Sig";
@@ -42,5 +43,4 @@ export declare const INDEXER_CODES_BY_NAME: {
42
43
  readonly TBD1: "1z";
43
44
  readonly TBD4: "4z";
44
45
  };
45
- export declare const INDEXER_HARDS: Map<string, number>;
46
46
  //# sourceMappingURL=indexer.tables.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.tables.generated.d.ts","sourceRoot":"","sources":["../../../src/src/tables/indexer.tables.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,eAAO,MAAM,aAAa,qBAoBxB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;CAoBrB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC;AAEX,eAAO,MAAM,aAAa,qBAQxB,CAAC"}
1
+ {"version":3,"file":"indexer.tables.generated.d.ts","sourceRoot":"","sources":["../../../src/src/tables/indexer.tables.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,eAAO,MAAM,aAAa,qBAoBxB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;CAoBrB,CAAC;AAEX,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;CAoBxB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Sizage } from "./table-types.js";
2
+ export { MATTER_HARDS } from "./hard-code-tables.js";
2
3
  export declare const MATTER_SIZES: Map<string, Sizage>;
3
4
  export declare const MATTER_CODE_NAMES: {
4
5
  readonly "0A": "Salt_128";
@@ -224,5 +225,4 @@ export declare const MATTER_CODES_BY_NAME: {
224
225
  readonly X448: "L";
225
226
  readonly Yes: "1AAM";
226
227
  };
227
- export declare const MATTER_HARDS: Map<string, number>;
228
228
  //# sourceMappingURL=matter.tables.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"matter.tables.generated.d.ts","sourceRoot":"","sources":["../../../src/src/tables/matter.tables.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C,eAAO,MAAM,YAAY,qBA+GvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GpB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GvB,CAAC;AAEX,eAAO,MAAM,YAAY,qBAavB,CAAC"}
1
+ {"version":3,"file":"matter.tables.generated.d.ts","sourceRoot":"","sources":["../../../src/src/tables/matter.tables.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,YAAY,qBA+GvB,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GpB,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GvB,CAAC"}
@@ -1,11 +1,14 @@
1
1
  /**
2
- * Generated by scripts/generate_versions.ts.
3
- * Do not edit by hand.
2
+ * Template used by scripts/generate_versions.ts for package version modules.
3
+ *
4
+ * The generator token-replaces the string placeholders below, then formats and
5
+ * compares the rendered output during version checks. Do not edit generated
6
+ * `src/version.ts` files by hand; edit this template instead.
4
7
  */
5
8
  /** Package semantic version copied from the owning package manifest. */
6
- export declare const PACKAGE_VERSION = "0.5.0";
9
+ export declare const PACKAGE_VERSION = "0.7.0";
7
10
  /** Optional build metadata stamp injected by release/CI workflows. */
8
- export declare const BUILD_METADATA = "build.5.d6fc2b59e3bc691c9cf61654afbc3417593163ee";
11
+ export declare const BUILD_METADATA = "build.7.6ebe132d252df25f649be23d4c6c62de41e23dec";
9
12
  /** User-facing version string with build metadata appended when present. */
10
13
  export declare const DISPLAY_VERSION: string;
11
14
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wEAAwE;AACxE,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,sEAAsE;AACtE,eAAO,MAAM,cAAc,qDAAqD,CAAC;AACjF,4EAA4E;AAC5E,eAAO,MAAM,eAAe,QAET,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/src/version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wEAAwE;AACxE,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,sEAAsE;AACtE,eAAO,MAAM,cAAc,qDAAqD,CAAC;AACjF,4EAA4E;AAC5E,eAAO,MAAM,eAAe,QAET,CAAC"}
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- import "../../_dnt.polyfills.js";
3
- import { readFile, writeFile } from "node:fs/promises";
4
- import { argv, exit, stderr, stdin, stdout } from "node:process";
5
- import { annotateCli } from "./cli.js";
6
- async function readNodeStdin() {
7
- const chunks = [];
8
- let total = 0;
9
- for await (const chunk of stdin) {
10
- const bytes = chunk instanceof Uint8Array ? chunk : new Uint8Array(chunk);
11
- chunks.push(bytes);
12
- total += bytes.length;
13
- }
14
- const out = new Uint8Array(total);
15
- let offset = 0;
16
- for (const chunk of chunks) {
17
- out.set(chunk, offset);
18
- offset += chunk.length;
19
- }
20
- return out;
21
- }
22
- const NODE_IO = {
23
- readFile: async (path) => {
24
- const data = await readFile(path);
25
- return new Uint8Array(data);
26
- },
27
- writeTextFile: async (path, text) => {
28
- await writeFile(path, text, "utf8");
29
- },
30
- readStdin: readNodeStdin,
31
- writeStdout: async (text) => {
32
- await new Promise((resolve, reject) => {
33
- stdout.write(text, (error) => {
34
- if (error)
35
- reject(error);
36
- else
37
- resolve();
38
- });
39
- });
40
- },
41
- writeStderr: async (text) => {
42
- await new Promise((resolve, reject) => {
43
- stderr.write(text, (error) => {
44
- if (error)
45
- reject(error);
46
- else
47
- resolve();
48
- });
49
- });
50
- },
51
- };
52
- const code = await annotateCli(argv.slice(2), NODE_IO);
53
- exit(code);
@@ -1,2 +0,0 @@
1
- import "../../_dnt.polyfills.js";
2
- //# sourceMappingURL=cli-node.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli-node.d.ts","sourceRoot":"","sources":["../../../src/src/annotate/cli-node.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC"}
@@ -1,23 +0,0 @@
1
- /** Runtime IO boundary for the standalone annotate CLI. */
2
- export interface CliIo {
3
- readFile(path: string): Promise<Uint8Array>;
4
- writeTextFile(path: string, text: string): Promise<void>;
5
- readStdin(): Promise<Uint8Array>;
6
- writeStdout(text: string): Promise<void>;
7
- writeStderr(text: string): Promise<void>;
8
- }
9
- /**
10
- * Read a full `ReadableStream` into one contiguous byte buffer.
11
- *
12
- * This is the shared browser/runtime-neutral helper used by annotate CLI
13
- * shims that expose stdin as a web stream instead of synchronous file APIs.
14
- */
15
- export declare function readAllReadable(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
16
- /**
17
- * Execute the standalone annotate CLI against the provided IO boundary.
18
- *
19
- * Error reporting is intentionally normalized here so runtime-specific entry
20
- * points can stay as thin bootstraps.
21
- */
22
- export declare function annotateCli(args: string[], io: CliIo): Promise<number>;
23
- //# sourceMappingURL=cli.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/src/annotate/cli.ts"],"names":[],"mappings":"AASA,2DAA2D;AAC3D,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C;AAwCD;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GACjC,OAAO,CAAC,UAAU,CAAC,CAwBrB;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B5E"}