@zocomputer/system-api 0.0.0-stage → 0.1.1

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 (57) hide show
  1. package/README.md +51 -2
  2. package/dist/catalog/index.d.ts +106 -0
  3. package/dist/catalog/index.js +237 -0
  4. package/dist/core/catalog.d.ts +155 -0
  5. package/dist/core/catalog.js +24 -0
  6. package/dist/core/client.d.ts +156 -0
  7. package/dist/core/client.js +87 -0
  8. package/dist/core/database.d.ts +124 -0
  9. package/dist/core/database.js +314 -0
  10. package/dist/core/envelope.d.ts +45 -0
  11. package/dist/core/envelope.js +112 -0
  12. package/dist/core/errors.d.ts +52 -0
  13. package/dist/core/errors.js +33 -0
  14. package/dist/core/index.d.ts +14 -0
  15. package/dist/core/index.js +13 -0
  16. package/dist/core/json-call.d.ts +4 -0
  17. package/dist/core/json-call.js +109 -0
  18. package/dist/core/json.d.ts +17 -0
  19. package/dist/core/json.js +4 -0
  20. package/dist/core/transport.d.ts +47 -0
  21. package/dist/core/transport.js +367 -0
  22. package/dist/core/validator.d.ts +52 -0
  23. package/dist/core/validator.js +1 -0
  24. package/dist/generate/cli.d.ts +44 -0
  25. package/dist/generate/cli.js +358 -0
  26. package/dist/generate/generate.d.ts +46 -0
  27. package/dist/generate/generate.js +215 -0
  28. package/dist/generate/identifiers.d.ts +27 -0
  29. package/dist/generate/identifiers.js +67 -0
  30. package/dist/generate/index.d.ts +15 -0
  31. package/dist/generate/index.js +15 -0
  32. package/dist/generate/manifest.d.ts +1 -0
  33. package/dist/generate/manifest.js +1 -0
  34. package/dist/generate/types.d.ts +57 -0
  35. package/dist/generate/types.js +357 -0
  36. package/dist/generated/catalog.d.ts +2 -0
  37. package/dist/generated/catalog.js +854 -0
  38. package/dist/generated/index.d.ts +2 -0
  39. package/dist/generated/index.js +4 -0
  40. package/dist/generated/manifest.json +799 -0
  41. package/dist/generated/operations.d.ts +8450 -0
  42. package/dist/generated/operations.js +3 -0
  43. package/dist/generated/schema.json +39451 -0
  44. package/dist/index.d.ts +11 -0
  45. package/dist/index.js +11 -0
  46. package/dist/json/index.d.ts +81 -0
  47. package/dist/json/index.js +404 -0
  48. package/dist/validation/index.d.ts +19 -0
  49. package/dist/validation/index.js +149 -0
  50. package/dist/validation/json.d.ts +1 -0
  51. package/dist/validation/json.js +1 -0
  52. package/dist/validation/pattern.d.ts +56 -0
  53. package/dist/validation/pattern.js +382 -0
  54. package/dist/validation/schema.d.ts +103 -0
  55. package/dist/validation/schema.js +1300 -0
  56. package/openapi.json +40754 -0
  57. package/package.json +93 -4
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Portable, linear-time regular expressions for System API `pattern` keywords —
3
+ * a faithful port of `hostagent.system_api.pattern`, so a workspace-published
4
+ * pattern means the same thing to the Python validator and to this SDK.
5
+ *
6
+ * A deliberately small subset is parsed to an AST, then re-emitted in explicit
7
+ * Rust `regex` syntax (brace hex escapes, `\z` for end-of-text, an explicit
8
+ * line-terminator class for `.`) and executed with re2js — a finite-automaton
9
+ * matcher with no backtracking, so `(a+)+b` on a long input finishes at once.
10
+ * The emitted string is byte-identical to the Python emitter's, and the same
11
+ * three complexity rules (per-count cap, nested product, expansion cap) run
12
+ * over the AST before any engine sees it, so a server-accepted pattern is
13
+ * engine-compilable on both sides.
14
+ *
15
+ * Supported: literals; escapes `\n \t \r \f \v`, `\xHH`, `\uHHHH`, and a
16
+ * backslash before any punctuation; `.` (all but `\n \r
17
+
18
+ `);
19
+ * classes `[...]`/`[^...]` with ranges (no nesting); groups `(...)`/`(?:...)`;
20
+ * alternation `|`; quantifiers `* + ?` and `{n} {n,} {n,m}` (optionally lazy);
21
+ * anchors `^` and `$`. Rejected: `\d \w \s \b`, lookaround, named groups,
22
+ * backreferences, inline flags, possessive quantifiers, class set operations.
23
+ */
24
+ import { RE2JS } from "re2js";
25
+ export declare const MAX_PATTERN_LENGTH = 256;
26
+ /** Largest count in `{n}`/`{n,}`/`{n,m}` — the fixed RE2-family limit. */
27
+ export declare const MAX_PATTERN_REPETITION = 1000;
28
+ /** Largest product of counted repetitions along any nesting path (RE2's rule). */
29
+ export declare const MAX_NESTED_REPETITION = 1000;
30
+ /** Work cap on the expanded program size, in re2js `calcSize` units. */
31
+ export declare const MAX_PATTERN_EXPANSION = 250000;
32
+ /** The pattern is outside the portable subset or too complex. */
33
+ export declare class PatternError extends Error {
34
+ constructor(message: string);
35
+ }
36
+ /** A compiled portable pattern executed by the re2js (RE2) engine. */
37
+ export declare class PortablePattern {
38
+ readonly source: string;
39
+ readonly rust: string;
40
+ private readonly compiled;
41
+ constructor(source: string, rust: string, compiled: RE2JS);
42
+ /**
43
+ * True when the pattern matches anywhere in `text` (unanchored, like Python
44
+ * `re.search` / rust-regex `is_match` and JavaScript `RegExp.prototype.test`).
45
+ */
46
+ search(text: string): boolean;
47
+ }
48
+ /**
49
+ * Parse `pattern` against the portable subset and compile it for the
50
+ * linear-time engine; throws `PatternError` (never echoing input strings).
51
+ */
52
+ export declare function compilePattern(pattern: string): PortablePattern;
53
+ /** The explicit Rust-syntax form of a portable pattern (tests and export). */
54
+ export declare function toRustSyntax(pattern: string): string;
55
+ /** The shared work metric of a portable pattern (tests and parity checks). */
56
+ export declare function expansionSize(pattern: string): number;
@@ -0,0 +1,382 @@
1
+ /**
2
+ * Portable, linear-time regular expressions for System API `pattern` keywords —
3
+ * a faithful port of `hostagent.system_api.pattern`, so a workspace-published
4
+ * pattern means the same thing to the Python validator and to this SDK.
5
+ *
6
+ * A deliberately small subset is parsed to an AST, then re-emitted in explicit
7
+ * Rust `regex` syntax (brace hex escapes, `\z` for end-of-text, an explicit
8
+ * line-terminator class for `.`) and executed with re2js — a finite-automaton
9
+ * matcher with no backtracking, so `(a+)+b` on a long input finishes at once.
10
+ * The emitted string is byte-identical to the Python emitter's, and the same
11
+ * three complexity rules (per-count cap, nested product, expansion cap) run
12
+ * over the AST before any engine sees it, so a server-accepted pattern is
13
+ * engine-compilable on both sides.
14
+ *
15
+ * Supported: literals; escapes `\n \t \r \f \v`, `\xHH`, `\uHHHH`, and a
16
+ * backslash before any punctuation; `.` (all but `\n \r
17
+
18
+ `);
19
+ * classes `[...]`/`[^...]` with ranges (no nesting); groups `(...)`/`(?:...)`;
20
+ * alternation `|`; quantifiers `* + ?` and `{n} {n,} {n,m}` (optionally lazy);
21
+ * anchors `^` and `$`. Rejected: `\d \w \s \b`, lookaround, named groups,
22
+ * backreferences, inline flags, possessive quantifiers, class set operations.
23
+ */
24
+ import { RE2JS } from "re2js";
25
+ export const MAX_PATTERN_LENGTH = 256;
26
+ /** Largest count in `{n}`/`{n,}`/`{n,m}` — the fixed RE2-family limit. */
27
+ export const MAX_PATTERN_REPETITION = 1000;
28
+ /** Largest product of counted repetitions along any nesting path (RE2's rule). */
29
+ export const MAX_NESTED_REPETITION = 1000;
30
+ /** Work cap on the expanded program size, in re2js `calcSize` units. */
31
+ export const MAX_PATTERN_EXPANSION = 250_000;
32
+ const PUNCT_ESCAPES = new Set("\\/.*+?()[]{}|^$-");
33
+ const SIMPLE_ESCAPES = {
34
+ n: "\n",
35
+ t: "\t",
36
+ r: "\r",
37
+ f: "\f",
38
+ v: "\v",
39
+ };
40
+ const HEX = new Set("0123456789abcdefABCDEF");
41
+ const CLASS_SET_OPS = ["--", "&&", "~~", "||"];
42
+ const LINE_TERMINATORS = [
43
+ [0x0a, 0x0a],
44
+ [0x0d, 0x0d],
45
+ [0x2028, 0x2029],
46
+ ];
47
+ /** The pattern is outside the portable subset or too complex. */
48
+ export class PatternError extends Error {
49
+ constructor(message) {
50
+ super(message);
51
+ this.name = "PatternError";
52
+ }
53
+ }
54
+ // --- parser ------------------------------------------------------------------
55
+ class Parser {
56
+ /** Code points, so `pos` advances one code point at a time (Python parity). */
57
+ chars;
58
+ pos = 0;
59
+ constructor(pattern) {
60
+ this.chars = Array.from(pattern);
61
+ }
62
+ fail(message) {
63
+ throw new PatternError(`unsupported pattern: ${message}`);
64
+ }
65
+ peek(offset = 0) {
66
+ const index = this.pos + offset;
67
+ return index < this.chars.length ? this.chars[index] : "";
68
+ }
69
+ startsWith(prefix) {
70
+ return (this.chars.slice(this.pos, this.pos + prefix.length).join("") === prefix);
71
+ }
72
+ parse() {
73
+ const node = this.parseAlt();
74
+ if (this.pos !== this.chars.length)
75
+ this.fail("unbalanced ')'");
76
+ return node;
77
+ }
78
+ parseAlt() {
79
+ const branches = [this.parseSeq()];
80
+ while (this.peek() === "|") {
81
+ this.pos += 1;
82
+ branches.push(this.parseSeq());
83
+ }
84
+ return branches.length === 1 ? branches[0] : { kind: "alt", branches };
85
+ }
86
+ parseSeq() {
87
+ const items = [];
88
+ while (this.pos < this.chars.length && !"|)".includes(this.peek())) {
89
+ items.push(this.parseQuantifier(this.parseAtom()));
90
+ }
91
+ return items.length === 1 ? items[0] : { kind: "seq", items };
92
+ }
93
+ parseAtom() {
94
+ const c = this.peek();
95
+ if (c === "(") {
96
+ if (this.startsWith("(?:"))
97
+ this.pos += 3;
98
+ else if (this.startsWith("(?"))
99
+ this.fail("unsupported group syntax");
100
+ else
101
+ this.pos += 1;
102
+ const inner = this.parseAlt();
103
+ if (this.peek() !== ")")
104
+ this.fail("unterminated group");
105
+ this.pos += 1;
106
+ return inner;
107
+ }
108
+ if (c === "[")
109
+ return this.parseClass();
110
+ if (c === ".") {
111
+ this.pos += 1;
112
+ return { kind: "charset", ranges: LINE_TERMINATORS, negated: true };
113
+ }
114
+ if (c === "^") {
115
+ this.pos += 1;
116
+ return { kind: "assert", end: false };
117
+ }
118
+ if (c === "$") {
119
+ this.pos += 1;
120
+ return { kind: "assert", end: true };
121
+ }
122
+ if (c === "\\") {
123
+ const code = this.parseEscape();
124
+ return { kind: "charset", ranges: [[code, code]], negated: false };
125
+ }
126
+ if ("*+?{".includes(c))
127
+ this.fail("quantifier without a preceding atom");
128
+ if ("]}".includes(c))
129
+ this.fail(`unbalanced '${c}'`);
130
+ this.pos += 1;
131
+ const code = c.codePointAt(0);
132
+ return { kind: "charset", ranges: [[code, code]], negated: false };
133
+ }
134
+ /** Consume a backslash escape and return its code point. */
135
+ parseEscape() {
136
+ const e = this.peek(1);
137
+ if (e === "")
138
+ this.fail("pattern ends with a backslash");
139
+ if (PUNCT_ESCAPES.has(e)) {
140
+ this.pos += 2;
141
+ return e.codePointAt(0);
142
+ }
143
+ if (e in SIMPLE_ESCAPES) {
144
+ this.pos += 2;
145
+ return SIMPLE_ESCAPES[e].codePointAt(0);
146
+ }
147
+ if (e === "x" || e === "u") {
148
+ const width = e === "x" ? 2 : 4;
149
+ const digits = this.chars
150
+ .slice(this.pos + 2, this.pos + 2 + width)
151
+ .join("");
152
+ if (digits.length !== width || [...digits].some((ch) => !HEX.has(ch)))
153
+ this.fail(`\\${e} escape needs ${width} hex digits`);
154
+ this.pos += 2 + width;
155
+ return parseInt(digits, 16);
156
+ }
157
+ this.fail(/^[a-z0-9]$/i.test(e)
158
+ ? `unsupported escape '\\${e}'`
159
+ : "unsupported escape");
160
+ }
161
+ parseClass() {
162
+ const start = this.pos;
163
+ this.pos += 1;
164
+ let negated = false;
165
+ if (this.peek() === "^") {
166
+ negated = true;
167
+ this.pos += 1;
168
+ }
169
+ const ranges = [];
170
+ for (;;) {
171
+ const c = this.peek();
172
+ if (c === "")
173
+ this.fail("unterminated character class");
174
+ if (c === "]")
175
+ break;
176
+ if (c === "[")
177
+ this.fail("nested character class");
178
+ const low = this.parseClassChar();
179
+ if (this.peek() === "-" && this.peek(1) !== "]" && this.peek(1) !== "") {
180
+ this.pos += 1;
181
+ const high = this.parseClassChar();
182
+ if (high < low)
183
+ this.fail("inverted character range");
184
+ ranges.push([low, high]);
185
+ }
186
+ else {
187
+ ranges.push([low, low]);
188
+ }
189
+ }
190
+ const body = this.chars.slice(start + 1, this.pos).join("");
191
+ if (CLASS_SET_OPS.some((op) => body.includes(op)))
192
+ this.fail("ambiguous character class operator");
193
+ this.pos += 1;
194
+ if (ranges.length === 0)
195
+ this.fail("empty character class");
196
+ return { kind: "charset", ranges, negated };
197
+ }
198
+ parseClassChar() {
199
+ if (this.peek() === "\\")
200
+ return this.parseEscape();
201
+ const code = this.peek().codePointAt(0);
202
+ this.pos += 1;
203
+ return code;
204
+ }
205
+ parseQuantifier(atom) {
206
+ const c = this.peek();
207
+ let low;
208
+ let high;
209
+ if (c === "*") {
210
+ [low, high] = [0, null];
211
+ this.pos += 1;
212
+ }
213
+ else if (c === "+") {
214
+ [low, high] = [1, null];
215
+ this.pos += 1;
216
+ }
217
+ else if (c === "?") {
218
+ [low, high] = [0, 1];
219
+ this.pos += 1;
220
+ }
221
+ else if (c === "{") {
222
+ [low, high] = this.parseBraces();
223
+ }
224
+ else {
225
+ return atom;
226
+ }
227
+ if (atom.kind === "assert")
228
+ this.fail("anchors cannot be quantified");
229
+ if (this.peek() === "?")
230
+ this.pos += 1; // lazy: same language for match/no-match
231
+ if (this.peek() !== "" && "*+?{".includes(this.peek()))
232
+ this.fail("stacked or possessive quantifier");
233
+ return { kind: "repeat", node: atom, low, high };
234
+ }
235
+ parseBraces() {
236
+ const end = this.chars.indexOf("}", this.pos);
237
+ if (end === -1)
238
+ this.fail("unsupported '{' outside a bounded quantifier");
239
+ const parts = this.chars
240
+ .slice(this.pos + 1, end)
241
+ .join("")
242
+ .split(",");
243
+ const isDigits = (s) => /^[0-9]+$/.test(s);
244
+ if (parts.length > 2 ||
245
+ !isDigits(parts[0]) ||
246
+ (parts.length === 2 && parts[1] !== "" && !isDigits(parts[1])))
247
+ this.fail("unsupported '{' outside a bounded quantifier");
248
+ const low = parseInt(parts[0], 10);
249
+ let high;
250
+ if (parts.length === 1)
251
+ high = low;
252
+ else
253
+ high = parts[1] ? parseInt(parts[1], 10) : null;
254
+ if (low > MAX_PATTERN_REPETITION ||
255
+ (high !== null && high > MAX_PATTERN_REPETITION))
256
+ this.fail("repetition count is too large");
257
+ if (high !== null && high < low)
258
+ this.fail("repetition range is inverted");
259
+ this.pos = end + 1;
260
+ return [low, high];
261
+ }
262
+ }
263
+ // --- shared bounded-compile guard --------------------------------------------
264
+ /**
265
+ * Enforce the nested-repetition product and the expansion work cap on the AST,
266
+ * returning the node's expansion size. Identical arithmetic to the Python
267
+ * `_check_budget`, so both sides accept and reject the same patterns.
268
+ */
269
+ function checkBudget(node, product = 1) {
270
+ let size;
271
+ if (node.kind === "charset" || node.kind === "assert") {
272
+ return 1;
273
+ }
274
+ else if (node.kind === "seq") {
275
+ size = node.items.reduce((sum, item) => sum + checkBudget(item, product), 0);
276
+ }
277
+ else if (node.kind === "alt") {
278
+ size =
279
+ node.branches.reduce((sum, branch) => sum + checkBudget(branch, product), 0) +
280
+ node.branches.length -
281
+ 1;
282
+ }
283
+ else {
284
+ const factor = Math.max(node.high !== null ? node.high : node.low, 1);
285
+ const nested = product * factor;
286
+ if (nested > MAX_NESTED_REPETITION)
287
+ throw new PatternError("unsupported pattern: repetition too large");
288
+ const body = checkBudget(node.node, nested);
289
+ if (node.high === null)
290
+ size = node.low === 0 ? 2 + body : 1 + node.low * body;
291
+ else
292
+ size = node.high * body + (node.high - node.low);
293
+ }
294
+ size = Math.max(1, size);
295
+ if (size > MAX_PATTERN_EXPANSION)
296
+ throw new PatternError("unsupported pattern: too complex");
297
+ return size;
298
+ }
299
+ function parse(pattern) {
300
+ if (Array.from(pattern).length > MAX_PATTERN_LENGTH)
301
+ throw new PatternError("unsupported pattern: pattern is too long");
302
+ const ast = new Parser(pattern).parse();
303
+ checkBudget(ast);
304
+ return ast;
305
+ }
306
+ // --- Rust emitter ------------------------------------------------------------
307
+ function hex(code) {
308
+ return `\\x{${code.toString(16).toUpperCase()}}`;
309
+ }
310
+ function emit(node) {
311
+ if (node.kind === "charset") {
312
+ if (!node.negated &&
313
+ node.ranges.length === 1 &&
314
+ node.ranges[0][0] === node.ranges[0][1])
315
+ return hex(node.ranges[0][0]);
316
+ const body = node.ranges
317
+ .map(([low, high]) => low === high ? hex(low) : `${hex(low)}-${hex(high)}`)
318
+ .join("");
319
+ return `[${node.negated ? "^" : ""}${body}]`;
320
+ }
321
+ if (node.kind === "assert")
322
+ return node.end ? "\\z" : "^";
323
+ if (node.kind === "seq")
324
+ return node.items.map(emitInSeq).join("") || "(?:)";
325
+ if (node.kind === "alt")
326
+ return "(?:" + node.branches.map(emit).join("|") + ")";
327
+ let body = emit(node.node);
328
+ if (node.node.kind !== "charset")
329
+ body = `(?:${body})`;
330
+ if (node.high === null)
331
+ return (body + (node.low === 0 ? "*" : node.low === 1 ? "+" : `{${node.low},}`));
332
+ if (node.low === 0 && node.high === 1)
333
+ return body + "?";
334
+ return (body +
335
+ (node.low === node.high ? `{${node.low}}` : `{${node.low},${node.high}}`));
336
+ }
337
+ function emitInSeq(node) {
338
+ const text = emit(node);
339
+ return node.kind === "seq" ? `(?:${text})` : text;
340
+ }
341
+ // --- compiled pattern --------------------------------------------------------
342
+ /** A compiled portable pattern executed by the re2js (RE2) engine. */
343
+ export class PortablePattern {
344
+ source;
345
+ rust;
346
+ compiled;
347
+ constructor(source, rust, compiled) {
348
+ this.source = source;
349
+ this.rust = rust;
350
+ this.compiled = compiled;
351
+ }
352
+ /**
353
+ * True when the pattern matches anywhere in `text` (unanchored, like Python
354
+ * `re.search` / rust-regex `is_match` and JavaScript `RegExp.prototype.test`).
355
+ */
356
+ search(text) {
357
+ return this.compiled.matcher(text).find();
358
+ }
359
+ }
360
+ /**
361
+ * Parse `pattern` against the portable subset and compile it for the
362
+ * linear-time engine; throws `PatternError` (never echoing input strings).
363
+ */
364
+ export function compilePattern(pattern) {
365
+ const rust = emit(parse(pattern));
366
+ let compiled;
367
+ try {
368
+ compiled = RE2JS.compile(rust);
369
+ }
370
+ catch {
371
+ throw new PatternError("unsupported pattern: too complex");
372
+ }
373
+ return new PortablePattern(pattern, rust, compiled);
374
+ }
375
+ /** The explicit Rust-syntax form of a portable pattern (tests and export). */
376
+ export function toRustSyntax(pattern) {
377
+ return emit(parse(pattern));
378
+ }
379
+ /** The shared work metric of a portable pattern (tests and parity checks). */
380
+ export function expansionSize(pattern) {
381
+ return checkBudget(parse(pattern));
382
+ }
@@ -0,0 +1,103 @@
1
+ import { type JsonObject, type JsonPath, type JsonValue } from "./json.ts";
2
+ export declare const SUPPORTED_DIALECT = "https://json-schema.org/draft/2020-12/schema";
3
+ export declare const MAX_SCHEMA_NODES = 10000;
4
+ export declare const MAX_SCHEMA_DEPTH = 32;
5
+ /** Longest permitted chain of definitions reachable through `$ref` hops. */
6
+ export declare const MAX_REF_CHAIN_DEPTH = 32;
7
+ export declare const MAX_VALIDATION_ERRORS = 20;
8
+ export declare const MAX_SAFE_INTEGER_EXACT: number;
9
+ export declare const MAX_ENUM_VALUES = 256;
10
+ export declare const MAX_UNION_BRANCHES = 64;
11
+ export declare const MAX_TEXT_LENGTH = 4096;
12
+ export declare const MAX_PROPERTY_NAME_LENGTH = 256;
13
+ /** Base for schema definition and validation failures. */
14
+ export declare class SchemaError extends Error {
15
+ readonly code: string;
16
+ readonly path: JsonPath;
17
+ readonly schemaPath: SchemaPath;
18
+ readonly keyword: string | undefined;
19
+ constructor(code: string, message: string, options?: {
20
+ path?: JsonPath;
21
+ schemaPath?: SchemaPath;
22
+ keyword?: string;
23
+ });
24
+ }
25
+ /** The schema document is outside the supported dialect or inconsistent. */
26
+ export declare class SchemaDefinitionError extends SchemaError {
27
+ constructor(code: string, message: string, options?: {
28
+ schemaPath?: SchemaPath;
29
+ keyword?: string;
30
+ });
31
+ }
32
+ /** A value does not conform to the compiled schema. */
33
+ export declare class SchemaValidationError extends SchemaError {
34
+ constructor(code: string, message: string, options?: {
35
+ path?: JsonPath;
36
+ keyword?: string;
37
+ });
38
+ }
39
+ export type SchemaPath = ReadonlyArray<string | number>;
40
+ declare class Compiler {
41
+ private readonly schema;
42
+ readonly defs: Map<string, JsonObject>;
43
+ private readonly refEdges;
44
+ readonly unions: Map<string, {
45
+ node: JsonObject;
46
+ path: SchemaPath;
47
+ }>;
48
+ readonly defaults: Map<string, {
49
+ path: SchemaPath;
50
+ value: JsonValue;
51
+ }>;
52
+ constructor(schema: JsonObject);
53
+ private fail;
54
+ private expectDict;
55
+ private checkAnnotations;
56
+ private rejectUnknown;
57
+ compile(): void;
58
+ private normalize;
59
+ private rewriteTypeList;
60
+ private normalizeNullable;
61
+ private normalizeUnion;
62
+ private normalizeTyped;
63
+ private normalizeObject;
64
+ private checkLengthPair;
65
+ private checkNumericKeywords;
66
+ private checkAcyclic;
67
+ }
68
+ /** An immutable compiled schema. Construct through {@link compileSchema}. */
69
+ export declare class CompiledSchema {
70
+ private readonly schema;
71
+ private readonly defs;
72
+ private readonly unions;
73
+ private readonly defaults;
74
+ private readonly hasDefaults;
75
+ private readonly validator;
76
+ private constructor();
77
+ static build(compiler: Compiler, schema: JsonObject): CompiledSchema;
78
+ /** A fresh detached copy of the canonical schema. */
79
+ get canonicalSchema(): JsonObject;
80
+ get isObject(): boolean;
81
+ private resolve;
82
+ /**
83
+ * Return a detached canonical copy of `value` if it conforms. With
84
+ * `applyDefaults` the copy first receives defaults for absent object
85
+ * properties (choosing a union branch only by its discriminator).
86
+ */
87
+ validate(value: JsonValue, options?: {
88
+ applyDefaults?: boolean;
89
+ }): JsonValue;
90
+ private fill;
91
+ private resolveFrom;
92
+ private measuredCache;
93
+ private measuredDefault;
94
+ /** Publication check: every default conforms to its property schema. */
95
+ private validateDefaults;
96
+ /** A node reparented under the root's `$defs` so its `$ref`s still resolve. */
97
+ private subSchema;
98
+ /** Follow a normalized schema path from the root, resolving `$ref` hops. */
99
+ private locate;
100
+ }
101
+ /** Compile a schema document into an immutable {@link CompiledSchema}. */
102
+ export declare function compileSchema(schema: unknown): CompiledSchema;
103
+ export {};