@schema-engine/registry 0.5.2 → 0.6.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.
- package/README.md +93 -7
- package/dist/bind-registry.d.ts +6 -3
- package/dist/bind-registry.js +1 -1
- package/dist/bind-registry.js.map +4 -4
- package/dist/chunk-24SNVXNP.js +2 -0
- package/dist/chunk-24SNVXNP.js.map +7 -0
- package/dist/chunk-55J6XMHW.js +0 -0
- package/dist/chunk-55J6XMHW.js.map +7 -0
- package/dist/chunk-DE7GQKZP.js +3 -0
- package/dist/chunk-DE7GQKZP.js.map +7 -0
- package/dist/chunk-FMWSZRDV.js +1 -0
- package/dist/chunk-FMWSZRDV.js.map +7 -0
- package/dist/chunk-GX6PAJLU.js +1 -0
- package/dist/chunk-GX6PAJLU.js.map +7 -0
- package/dist/chunk-IYIWS4LW.js +1 -0
- package/dist/chunk-IYIWS4LW.js.map +7 -0
- package/dist/chunk-LG33VSKX.js +1 -0
- package/dist/chunk-LG33VSKX.js.map +7 -0
- package/dist/chunk-NSLF54GM.js +1 -0
- package/dist/chunk-NSLF54GM.js.map +7 -0
- package/dist/chunk-O5CRFISG.js +1 -0
- package/dist/chunk-O5CRFISG.js.map +7 -0
- package/dist/chunk-P3DDHPDA.js +1 -0
- package/dist/chunk-P3DDHPDA.js.map +7 -0
- package/dist/chunk-QHVQ4S4D.js +1 -0
- package/dist/chunk-QHVQ4S4D.js.map +7 -0
- package/dist/chunk-RVS7JY2Y.js +1 -0
- package/dist/chunk-RVS7JY2Y.js.map +7 -0
- package/dist/chunk-UH3CEF45.js +1 -0
- package/dist/chunk-UH3CEF45.js.map +7 -0
- package/dist/chunk-XG4EZ5VP.js +1 -0
- package/dist/chunk-XG4EZ5VP.js.map +7 -0
- package/dist/create-registry.d.ts +70 -10
- package/dist/create-registry.js +1 -1
- package/dist/create-registry.js.map +4 -4
- package/dist/export-tree-schema.d.ts +100 -0
- package/dist/export-tree-schema.js +1 -0
- package/dist/export-tree-schema.js.map +7 -0
- package/dist/format-issue-path.js +1 -1
- package/dist/format-issue-path.js.map +4 -4
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +4 -4
- package/dist/json-schema/embedder.d.ts +119 -0
- package/dist/json-schema/embedder.js +1 -0
- package/dist/json-schema/embedder.js.map +7 -0
- package/dist/json-schema/index.d.ts +5 -0
- package/dist/json-schema/index.js +1 -0
- package/dist/json-schema/index.js.map +7 -0
- package/dist/json-schema/slot.d.ts +46 -0
- package/dist/json-schema/slot.js +1 -0
- package/dist/json-schema/slot.js.map +7 -0
- package/dist/json-schema/standard.d.ts +44 -0
- package/dist/json-schema/standard.js +1 -0
- package/dist/json-schema/standard.js.map +7 -0
- package/dist/parse-node.d.ts +69 -10
- package/dist/parse-node.js +1 -1
- package/dist/parse-node.js.map +4 -4
- package/dist/parse-tree.d.ts +105 -35
- package/dist/parse-tree.js +1 -1
- package/dist/parse-tree.js.map +4 -4
- package/dist/registry-error.d.ts +80 -0
- package/dist/registry-error.js +1 -0
- package/dist/registry-error.js.map +7 -0
- package/dist/standard-schema.d.ts +9 -0
- package/dist/standard-schema.js +1 -1
- package/dist/standard-schema.js.map +4 -4
- package/dist/tree-types.d.ts +152 -0
- package/dist/tree-types.js +0 -0
- package/dist/tree-types.js.map +7 -0
- package/dist/types.d.ts +37 -7
- package/dist/types.js +1 -0
- package/dist/yaml/index.js +1 -4
- package/dist/yaml/index.js.map +4 -4
- package/dist/yaml/parse.js +1 -2
- package/dist/yaml/parse.js.map +4 -4
- package/dist/yaml/stringify.js +1 -3
- package/dist/yaml/stringify.js.map +4 -4
- package/package.json +13 -9
- package/skill/SKILL.md +9 -9
- package/skill/reference/registry.md +57 -18
- package/dist/base-registry.d.ts +0 -73
- package/dist/base-registry.js +0 -1
- package/dist/base-registry.js.map +0 -7
package/dist/yaml/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": ["import { LineCounter, isNode, parseDocument } from 'yaml';\nimport type { Document, Node, YAMLError, YAMLWarning } from 'yaml';\n\n/** One segment of a Standard Schema issue path: a key, or `{ key }` as Standard Schema allows. */\ntype PathSegment = PropertyKey | { readonly key: PropertyKey };\n\n/**\n * A validator for the parsed value, in the shape of Standard Schema issues. It must be synchronous.\n *\n * @remarks\n * `engine.safeValidateForm` from `@schema-engine/forms` fits as it is. For a Standard Schema\n * (`zod`, `valibot`, ...), wrap its `~standard.validate` and return `{ success: true, data }` or\n * `{ success: false, issues }`.\n */\nexport type YamlValidate<T> = (\n\tvalue: unknown,\n) =>\n\t| { success: true; data: T }\n\t| { success: false; issues: ReadonlyArray<{ message: string; path?: ReadonlyArray<PathSegment> }> };\n\n/**\n * A problem found in a YAML document, placed in its source text.\n *\n * @remarks\n * `line` and `column` count from 1. For a validation issue they point at the start of the value the\n * `path` names; when the path names a key the document does not have, they point at the nearest\n * ancestor that exists. A syntax error has an empty `path` and the position the parser reports.\n */\nexport type YamlIssue = {\n\tmessage: string;\n\tpath: PropertyKey[];\n\tline: number;\n\tcolumn: number;\n\tfilename?: string;\n};\n\n/** What {@link safeParseYaml} returns: the validated data, or every issue found. */\nexport type YamlParseResult<T> = { success: true; data: T } | { success: false; issues: YamlIssue[] };\n\nexport type YamlParseOptions = {\n\t/** Name of the file the text came from; it prefixes error messages and is set on each issue. */\n\tfilename?: string;\n};\n\n/**\n * Thrown by {@link parseYaml} when the text is not valid YAML or its value does not validate.\n *\n * @remarks\n * `message` lists the issues one per line as `<file>:<line>:<column> <path>: <message>`, so a log\n * reads without parsing `issues`.\n */\nexport class YamlDocumentError extends Error {\n\treadonly issues: YamlIssue[];\n\n\tconstructor(issues: YamlIssue[]) {\n\t\tsuper(issues.length > 0 ? issues.map(formatIssue).join('\\n') : 'Invalid YAML document');\n\t\tthis.name = 'YamlDocumentError';\n\t\tthis.issues = issues;\n\t}\n}\n\n/** A path as it reads in an error message: `steps[0].elements[2].grid.width`. */\nfunction formatPath(path: PropertyKey[]): string {\n\tlet text = '';\n\tfor (const key of path) {\n\t\tif (typeof key === 'number') {\n\t\t\ttext += `[${key}]`;\n\t\t} else {\n\t\t\ttext += text ? `.${String(key)}` : String(key);\n\t\t}\n\t}\n\treturn text;\n}\n\nfunction formatIssue(issue: YamlIssue): string {\n\tconst location = issue.filename\n\t\t? `${issue.filename}:${issue.line}:${issue.column}`\n\t\t: `line ${issue.line}, column ${issue.column}`;\n\tconst path = formatPath(issue.path);\n\treturn path ? `${location} ${path}: ${issue.message}` : `${location} ${issue.message}`;\n}\n\nfunction toKey(segment: PathSegment): PropertyKey {\n\treturn typeof segment === 'object' ? segment.key : segment;\n}\n\n/**\n * The source node a path names, or the nearest ancestor that exists when the document lacks the\n * last keys of the path.\n */\nfunction nodeForPath(doc: Document.Parsed, path: PropertyKey[]): Node | null {\n\tfor (let length = path.length; length > 0; length--) {\n\t\tconst node = doc.getIn(path.slice(0, length), true);\n\t\tif (isNode(node) && node.range) {\n\t\t\treturn node;\n\t\t}\n\t}\n\treturn doc.contents?.range ? doc.contents : null;\n}\n\n/** The most alias expansions `toJS` allows before it gives up, which guards against alias bombs. */\nconst MAX_ALIAS_COUNT = 100;\n\n/** The parser's message without the ` at line N, column N:` suffix and the code frame it appends. */\nfunction syntaxMessage(message: string): string {\n\treturn message.replace(/ at line \\d+, column \\d+:?[\\s\\S]*$/, '');\n}\n\ntype Position = { line: number; col: number };\n\nfunction samePosition(a: Position | undefined, b: Position | undefined): boolean {\n\treturn a !== undefined && b !== undefined && a.line === b.line && a.col === b.col;\n}\n\n/** `tag:yaml.org,2002:float` as it is written in a document, `!!float`. */\nfunction shortTag(tag: string): string {\n\tconst prefix = 'tag:yaml.org,2002:';\n\treturn tag.startsWith(prefix) ? `!!${tag.slice(prefix.length)}` : tag;\n}\n\n/**\n * The message an author can act on. The parser's own text often advises changing a `yaml` API call,\n * which the author of a document cannot do.\n */\nfunction friendlyMessage(problem: YAMLError | YAMLWarning): string {\n\tswitch (problem.code) {\n\t\tcase 'MULTIPLE_DOCS':\n\t\t\treturn 'A file holds one document; remove the extra `---`.';\n\t\tcase 'MULTILINE_IMPLICIT_KEY':\n\t\t\treturn 'Bad indentation or a missing colon: line this up with the keys above it, or put the whole key on one line.';\n\t\tcase 'TAG_RESOLVE_FAILED': {\n\t\t\tconst tag = /Unresolved tag: (\\S+)/.exec(problem.message)?.[1];\n\t\t\tconst name = tag ? `${shortTag(tag)} ` : '';\n\t\t\treturn `Tags are not supported: remove ${name}and write the value plainly. Quote a string that looks like another type.`;\n\t\t}\n\t\tdefault:\n\t\t\treturn syntaxMessage(problem.message);\n\t}\n}\n\n/**\n * Where a parser problem is reported. A `MULTILINE_IMPLICIT_KEY` starts on the line above the\n * over-indented line that ends it, so it is reported at its end.\n */\nfunction positionOf(problem: YAMLError | YAMLWarning): Position {\n\tconst [start, end] = problem.linePos ?? [];\n\treturn (problem.code === 'MULTILINE_IMPLICIT_KEY' ? end : start) ?? start ?? { line: 1, col: 1 };\n}\n\n/**\n * Every parser error and warning. An over-indented line makes the parser report two errors from the\n * same place; the `BLOCK_AS_IMPLICIT_KEY` one is dropped.\n */\nfunction parserProblems(doc: Document.Parsed): Array<{ message: string; position: Position }> {\n\tconst multiline = doc.errors.filter((error) => error.code === 'MULTILINE_IMPLICIT_KEY');\n\treturn [...doc.errors, ...doc.warnings]\n\t\t.filter(\n\t\t\t(problem) =>\n\t\t\t\tproblem.code !== 'BLOCK_AS_IMPLICIT_KEY' ||\n\t\t\t\t!multiline.some((other) => samePosition(other.linePos?.[0], problem.linePos?.[0])),\n\t\t)\n\t\t.map((problem) => ({ message: friendlyMessage(problem), position: positionOf(problem) }));\n}\n\n/** The text of an error `toJS` throws, with the alias limit said in terms an author can use. */\nfunction conversionMessage(error: unknown): string {\n\tif (error instanceof Error && /alias count/i.test(error.message)) {\n\t\treturn `The document has more than ${MAX_ALIAS_COUNT} alias expansions (*name) in all. Write the repeated value out, or use fewer or smaller anchors.`;\n\t}\n\treturn error instanceof Error ? error.message : 'The document could not be read';\n}\n\n/**\n * Parse YAML text and validate the value, returning the issues instead of throwing.\n *\n * @param text A single YAML document, read as YAML 1.2 with the core schema: only `true`, `false`,\n * `null` and numbers are special, so `no`, `on` and `yes` stay strings. A leading byte order mark is\n * ignored.\n * @param validate Called with the parsed value, only when the text is valid YAML.\n * @returns `{ success: true, data }` with what `validate` returned, or `{ success: false, issues }`\n * with each syntax error or validation issue and its line and column.\n *\n * @remarks\n * An unquoted `1.10` is the number `1.1` in every YAML version; quote it (`\"1.10\"`) to keep a string.\n * Multiple documents in one text are a syntax error. Tags (`!!binary`, `!!set`, `!custom`) are\n * reported as issues, so what `validate` receives is always JSON-shaped. Mapping keys are read as\n * strings: `1: a` is `{ '1': 'a' }`.\n *\n * Anchors, aliases and merge keys (`<<: *defaults`) work within the text. A text with more than 100\n * alias expansions is reported as an issue at line 1, not thrown. An issue inside a merged value\n * points at the map that merges it, because the merged keys have no place of their own. A merge\n * source that is not a map (`<<: 5`) is reported at line 1, column 1.\n */\nexport function safeParseYaml<T>(\n\ttext: string,\n\tvalidate: YamlValidate<T>,\n\toptions?: YamlParseOptions,\n): YamlParseResult<T> {\n\tconst lineCounter = new LineCounter();\n\tconst source = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n\tconst doc = parseDocument(source, {\n\t\tlineCounter,\n\t\tversion: '1.2',\n\t\tschema: 'core',\n\t\tresolveKnownTags: false,\n\t\tmerge: true,\n\t\tstringKeys: true,\n\t});\n\n\tconst issue = (message: string, path: PropertyKey[], line: number, column: number): YamlIssue => {\n\t\tconst found: YamlIssue = { message, path, line, column };\n\t\tif (options?.filename !== undefined) {\n\t\t\tfound.filename = options.filename;\n\t\t}\n\t\treturn found;\n\t};\n\n\tconst problems = parserProblems(doc);\n\tif (problems.length > 0) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tissues: problems.map(({ message, position }) => issue(message, [], position.line, position.col)),\n\t\t};\n\t}\n\n\tlet value: unknown;\n\ttry {\n\t\tvalue = doc.toJS({ maxAliasCount: MAX_ALIAS_COUNT });\n\t} catch (error) {\n\t\treturn { success: false, issues: [issue(conversionMessage(error), [], 1, 1)] };\n\t}\n\n\tconst result = validate(value);\n\tif (result.success) {\n\t\treturn { success: true, data: result.data };\n\t}\n\treturn {\n\t\tsuccess: false,\n\t\tissues: result.issues.map((found) => {\n\t\t\tconst path = (found.path ?? []).map(toKey);\n\t\t\tconst node = nodeForPath(doc, path);\n\t\t\tconst start = node?.range ? lineCounter.linePos(node.range[0]) : { line: 1, col: 1 };\n\t\t\treturn issue(found.message, path, start.line, start.col);\n\t\t}),\n\t};\n}\n\n/**\n * Parse YAML text and validate the value, throwing when either fails.\n *\n * @throws {YamlDocumentError} With each syntax error or validation issue and its line and column.\n * {@link safeParseYaml} returns them instead.\n */\nexport function parseYaml<T>(text: string, validate: YamlValidate<T>, options?: YamlParseOptions): T {\n\tconst result = safeParseYaml(text, validate, options);\n\tif (!result.success) {\n\t\tthrow new YamlDocumentError(result.issues);\n\t}\n\treturn result.data;\n}\n", "import { Document, isPair, isScalar, visit } from 'yaml';\nimport type { YAMLMap } from 'yaml';\n\n/**\n * Limits for a map written in flow style: scalar entries only, at most this many, and about this\n * many characters.\n *\n * @remarks\n * `grid: { width: half }` reads better inline; an element with many keys does not.\n */\nconst MAX_FLOW_ENTRIES = 3;\nconst MAX_FLOW_LENGTH = 48;\n\nexport type StringifyYamlOptions = {\n\t/** Adds a `# yaml-language-server: $schema=<url>` header, which editors read to offer completion. */\n\tschemaUrl?: string;\n};\n\nfunction isShortLeafMap(map: YAMLMap): boolean {\n\tif (map.items.length === 0 || map.items.length > MAX_FLOW_ENTRIES) {\n\t\treturn false;\n\t}\n\tlet length = 0;\n\tfor (const pair of map.items) {\n\t\tif (!isScalar(pair.key) || !isScalar(pair.value)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst value = String(pair.value.value);\n\t\tif (value.includes('\\n')) {\n\t\t\treturn false;\n\t\t}\n\t\tlength += String(pair.key.value).length + value.length + 4;\n\t}\n\treturn length <= MAX_FLOW_LENGTH;\n}\n\n/**\n * Write a value as YAML text.\n *\n * @remarks\n * An object that appears twice is written out twice, not as an anchor and an alias. A short map of\n * scalars under a key is written in flow style (`grid: { width: half }`); every other collection,\n * including a sequence item, is written in block style. Lines are not folded.\n * Strings that would read as another type are quoted, so `\"1.10\"` stays a string when parsed back,\n * and so is a key named `<<`, which `parseYaml` would otherwise read as a merge key.\n * `no` and `on` are not quoted, because YAML 1.2 reads them as strings; a YAML 1.1 reader would not.\n */\nexport function stringifyYaml(value: unknown, options?: StringifyYamlOptions): string {\n\tconst schemaUrl = options?.schemaUrl;\n\tif (schemaUrl !== undefined && /[\\r\\n]/.test(schemaUrl)) {\n\t\tthrow new TypeError('schemaUrl must be a single line');\n\t}\n\tconst doc = new Document(value, { version: '1.2', aliasDuplicateObjects: false });\n\tvisit(doc, {\n\t\tPair(_key, pair) {\n\t\t\tif (isScalar(pair.key) && pair.key.value === '<<') {\n\t\t\t\tpair.key.type = 'QUOTE_DOUBLE';\n\t\t\t}\n\t\t},\n\t\tMap(_key, map, path) {\n\t\t\tif (isPair(path.at(-1)) && isShortLeafMap(map)) {\n\t\t\t\tmap.flow = true;\n\t\t\t}\n\t\t},\n\t});\n\tconst text = doc.toString({ lineWidth: 0 });\n\treturn schemaUrl === undefined ? text : `# yaml-language-server: $schema=${schemaUrl}\\n${text}`;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/yaml/parse.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`):"Invalid YAML document"),this.name="YamlDocumentError",this.issues=n}};function Y(e){let n="";for(let t of e)typeof t=="number"?n+=`[${t}]`:n+=n?`.${String(t)}`:String(t);return n}function T(e){let n=e.filename?`${e.filename}:${e.line}:${e.column}`:`line ${e.line}, column ${e.column}`,t=Y(e.path);return t?`${n} ${t}: ${e.message}`:`${n} ${e.message}`}function L(e){return typeof e=="object"?e.key:e}function A(e,n){for(let t=n.length;t>0;t--){let s=e.getIn(n.slice(0,t),!0);if(P(s)&&s.range)return s}return e.contents?.range?e.contents:null}var p=100;function M(e){return e.replace(/ at line \d+, column \d+:?[\s\S]*$/,"")}function E(e,n){return e!==void 0&&n!==void 0&&e.line===n.line&&e.col===n.col}function $(e){let n="tag:yaml.org,2002:";return e.startsWith(n)?`!!${e.slice(n.length)}`:e}function K(e){switch(e.code){case"MULTIPLE_DOCS":return"A file holds one document; remove the extra `---`.";case"MULTILINE_IMPLICIT_KEY":return"Bad indentation or a missing colon: line this up with the keys above it, or put the whole key on one line.";case"TAG_RESOLVE_FAILED":{let n=/Unresolved tag: (\S+)/.exec(e.message)?.[1];return`Tags are not supported: remove ${n?`${$(n)} `:""}and write the value plainly. Quote a string that looks like another type.`}default:return M(e.message)}}function x(e){let[n,t]=e.linePos??[];return(e.code==="MULTILINE_IMPLICIT_KEY"?t:n)??n??{line:1,col:1}}function _(e){let n=e.errors.filter(t=>t.code==="MULTILINE_IMPLICIT_KEY");return[...e.errors,...e.warnings].filter(t=>t.code!=="BLOCK_AS_IMPLICIT_KEY"||!n.some(s=>E(s.linePos?.[0],t.linePos?.[0]))).map(t=>({message:K(t),position:x(t)}))}function w(e){return e instanceof Error&&/alias count/i.test(e.message)?`The document has more than ${p} alias expansions (*name) in all. Write the repeated value out, or use fewer or smaller anchors.`:e instanceof Error?e.message:"The document could not be read"}function v(e,n,t){let s=new h,y=e.charCodeAt(0)===65279?e.slice(1):e,l=I(y,{lineCounter:s,version:"1.2",schema:"core",resolveKnownTags:!1,merge:!0,stringKeys:!0}),u=(r,o,a,i)=>{let d={message:r,path:o,line:a,column:i};return t?.filename!==void 0&&(d.filename=t.filename),d},f=_(l);if(f.length>0)return{success:!1,issues:f.map(({message:r,position:o})=>u(r,[],o.line,o.col))};let g;try{g=l.toJS({maxAliasCount:p})}catch(r){return{success:!1,issues:[u(w(r),[],1,1)]}}let c=n(g);return c.success?{success:!0,data:c.data}:{success:!1,issues:c.issues.map(r=>{let o=(r.path??[]).map(L),a=A(l,o),i=a?.range?s.linePos(a.range[0]):{line:1,col:1};return u(r.message,o,i.line,i.col)})}}function C(e,n,t){let s=v(e,n,t);if(!s.success)throw new m(s.issues);return s.data}export{m as YamlDocumentError,C as parseYaml,v as safeParseYaml};
|
|
1
|
+
import{a,b,c}from"../chunk-24SNVXNP.js";export{a as YamlDocumentError,c as parseYaml,b as safeParseYaml};
|
package/dist/yaml/parse.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": ["import { LineCounter, isNode, parseDocument } from 'yaml';\nimport type { Document, Node, YAMLError, YAMLWarning } from 'yaml';\n\n/** One segment of a Standard Schema issue path: a key, or `{ key }` as Standard Schema allows. */\ntype PathSegment = PropertyKey | { readonly key: PropertyKey };\n\n/**\n * A validator for the parsed value, in the shape of Standard Schema issues. It must be synchronous.\n *\n * @remarks\n * `engine.safeValidateForm` from `@schema-engine/forms` fits as it is. For a Standard Schema\n * (`zod`, `valibot`, ...), wrap its `~standard.validate` and return `{ success: true, data }` or\n * `{ success: false, issues }`.\n */\nexport type YamlValidate<T> = (\n\tvalue: unknown,\n) =>\n\t| { success: true; data: T }\n\t| { success: false; issues: ReadonlyArray<{ message: string; path?: ReadonlyArray<PathSegment> }> };\n\n/**\n * A problem found in a YAML document, placed in its source text.\n *\n * @remarks\n * `line` and `column` count from 1. For a validation issue they point at the start of the value the\n * `path` names; when the path names a key the document does not have, they point at the nearest\n * ancestor that exists. A syntax error has an empty `path` and the position the parser reports.\n */\nexport type YamlIssue = {\n\tmessage: string;\n\tpath: PropertyKey[];\n\tline: number;\n\tcolumn: number;\n\tfilename?: string;\n};\n\n/** What {@link safeParseYaml} returns: the validated data, or every issue found. */\nexport type YamlParseResult<T> = { success: true; data: T } | { success: false; issues: YamlIssue[] };\n\nexport type YamlParseOptions = {\n\t/** Name of the file the text came from; it prefixes error messages and is set on each issue. */\n\tfilename?: string;\n};\n\n/**\n * Thrown by {@link parseYaml} when the text is not valid YAML or its value does not validate.\n *\n * @remarks\n * `message` lists the issues one per line as `<file>:<line>:<column> <path>: <message>`, so a log\n * reads without parsing `issues`.\n */\nexport class YamlDocumentError extends Error {\n\treadonly issues: YamlIssue[];\n\n\tconstructor(issues: YamlIssue[]) {\n\t\tsuper(issues.length > 0 ? issues.map(formatIssue).join('\\n') : 'Invalid YAML document');\n\t\tthis.name = 'YamlDocumentError';\n\t\tthis.issues = issues;\n\t}\n}\n\n/** A path as it reads in an error message: `steps[0].elements[2].grid.width`. */\nfunction formatPath(path: PropertyKey[]): string {\n\tlet text = '';\n\tfor (const key of path) {\n\t\tif (typeof key === 'number') {\n\t\t\ttext += `[${key}]`;\n\t\t} else {\n\t\t\ttext += text ? `.${String(key)}` : String(key);\n\t\t}\n\t}\n\treturn text;\n}\n\nfunction formatIssue(issue: YamlIssue): string {\n\tconst location = issue.filename\n\t\t? `${issue.filename}:${issue.line}:${issue.column}`\n\t\t: `line ${issue.line}, column ${issue.column}`;\n\tconst path = formatPath(issue.path);\n\treturn path ? `${location} ${path}: ${issue.message}` : `${location} ${issue.message}`;\n}\n\nfunction toKey(segment: PathSegment): PropertyKey {\n\treturn typeof segment === 'object' ? segment.key : segment;\n}\n\n/**\n * The source node a path names, or the nearest ancestor that exists when the document lacks the\n * last keys of the path.\n */\nfunction nodeForPath(doc: Document.Parsed, path: PropertyKey[]): Node | null {\n\tfor (let length = path.length; length > 0; length--) {\n\t\tconst node = doc.getIn(path.slice(0, length), true);\n\t\tif (isNode(node) && node.range) {\n\t\t\treturn node;\n\t\t}\n\t}\n\treturn doc.contents?.range ? doc.contents : null;\n}\n\n/** The most alias expansions `toJS` allows before it gives up, which guards against alias bombs. */\nconst MAX_ALIAS_COUNT = 100;\n\n/** The parser's message without the ` at line N, column N:` suffix and the code frame it appends. */\nfunction syntaxMessage(message: string): string {\n\treturn message.replace(/ at line \\d+, column \\d+:?[\\s\\S]*$/, '');\n}\n\ntype Position = { line: number; col: number };\n\nfunction samePosition(a: Position | undefined, b: Position | undefined): boolean {\n\treturn a !== undefined && b !== undefined && a.line === b.line && a.col === b.col;\n}\n\n/** `tag:yaml.org,2002:float` as it is written in a document, `!!float`. */\nfunction shortTag(tag: string): string {\n\tconst prefix = 'tag:yaml.org,2002:';\n\treturn tag.startsWith(prefix) ? `!!${tag.slice(prefix.length)}` : tag;\n}\n\n/**\n * The message an author can act on. The parser's own text often advises changing a `yaml` API call,\n * which the author of a document cannot do.\n */\nfunction friendlyMessage(problem: YAMLError | YAMLWarning): string {\n\tswitch (problem.code) {\n\t\tcase 'MULTIPLE_DOCS':\n\t\t\treturn 'A file holds one document; remove the extra `---`.';\n\t\tcase 'MULTILINE_IMPLICIT_KEY':\n\t\t\treturn 'Bad indentation or a missing colon: line this up with the keys above it, or put the whole key on one line.';\n\t\tcase 'TAG_RESOLVE_FAILED': {\n\t\t\tconst tag = /Unresolved tag: (\\S+)/.exec(problem.message)?.[1];\n\t\t\tconst name = tag ? `${shortTag(tag)} ` : '';\n\t\t\treturn `Tags are not supported: remove ${name}and write the value plainly. Quote a string that looks like another type.`;\n\t\t}\n\t\tdefault:\n\t\t\treturn syntaxMessage(problem.message);\n\t}\n}\n\n/**\n * Where a parser problem is reported. A `MULTILINE_IMPLICIT_KEY` starts on the line above the\n * over-indented line that ends it, so it is reported at its end.\n */\nfunction positionOf(problem: YAMLError | YAMLWarning): Position {\n\tconst [start, end] = problem.linePos ?? [];\n\treturn (problem.code === 'MULTILINE_IMPLICIT_KEY' ? end : start) ?? start ?? { line: 1, col: 1 };\n}\n\n/**\n * Every parser error and warning. An over-indented line makes the parser report two errors from the\n * same place; the `BLOCK_AS_IMPLICIT_KEY` one is dropped.\n */\nfunction parserProblems(doc: Document.Parsed): Array<{ message: string; position: Position }> {\n\tconst multiline = doc.errors.filter((error) => error.code === 'MULTILINE_IMPLICIT_KEY');\n\treturn [...doc.errors, ...doc.warnings]\n\t\t.filter(\n\t\t\t(problem) =>\n\t\t\t\tproblem.code !== 'BLOCK_AS_IMPLICIT_KEY' ||\n\t\t\t\t!multiline.some((other) => samePosition(other.linePos?.[0], problem.linePos?.[0])),\n\t\t)\n\t\t.map((problem) => ({ message: friendlyMessage(problem), position: positionOf(problem) }));\n}\n\n/** The text of an error `toJS` throws, with the alias limit said in terms an author can use. */\nfunction conversionMessage(error: unknown): string {\n\tif (error instanceof Error && /alias count/i.test(error.message)) {\n\t\treturn `The document has more than ${MAX_ALIAS_COUNT} alias expansions (*name) in all. Write the repeated value out, or use fewer or smaller anchors.`;\n\t}\n\treturn error instanceof Error ? error.message : 'The document could not be read';\n}\n\n/**\n * Parse YAML text and validate the value, returning the issues instead of throwing.\n *\n * @param text A single YAML document, read as YAML 1.2 with the core schema: only `true`, `false`,\n * `null` and numbers are special, so `no`, `on` and `yes` stay strings. A leading byte order mark is\n * ignored.\n * @param validate Called with the parsed value, only when the text is valid YAML.\n * @returns `{ success: true, data }` with what `validate` returned, or `{ success: false, issues }`\n * with each syntax error or validation issue and its line and column.\n *\n * @remarks\n * An unquoted `1.10` is the number `1.1` in every YAML version; quote it (`\"1.10\"`) to keep a string.\n * Multiple documents in one text are a syntax error. Tags (`!!binary`, `!!set`, `!custom`) are\n * reported as issues, so what `validate` receives is always JSON-shaped. Mapping keys are read as\n * strings: `1: a` is `{ '1': 'a' }`.\n *\n * Anchors, aliases and merge keys (`<<: *defaults`) work within the text. A text with more than 100\n * alias expansions is reported as an issue at line 1, not thrown. An issue inside a merged value\n * points at the map that merges it, because the merged keys have no place of their own. A merge\n * source that is not a map (`<<: 5`) is reported at line 1, column 1.\n */\nexport function safeParseYaml<T>(\n\ttext: string,\n\tvalidate: YamlValidate<T>,\n\toptions?: YamlParseOptions,\n): YamlParseResult<T> {\n\tconst lineCounter = new LineCounter();\n\tconst source = text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;\n\tconst doc = parseDocument(source, {\n\t\tlineCounter,\n\t\tversion: '1.2',\n\t\tschema: 'core',\n\t\tresolveKnownTags: false,\n\t\tmerge: true,\n\t\tstringKeys: true,\n\t});\n\n\tconst issue = (message: string, path: PropertyKey[], line: number, column: number): YamlIssue => {\n\t\tconst found: YamlIssue = { message, path, line, column };\n\t\tif (options?.filename !== undefined) {\n\t\t\tfound.filename = options.filename;\n\t\t}\n\t\treturn found;\n\t};\n\n\tconst problems = parserProblems(doc);\n\tif (problems.length > 0) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tissues: problems.map(({ message, position }) => issue(message, [], position.line, position.col)),\n\t\t};\n\t}\n\n\tlet value: unknown;\n\ttry {\n\t\tvalue = doc.toJS({ maxAliasCount: MAX_ALIAS_COUNT });\n\t} catch (error) {\n\t\treturn { success: false, issues: [issue(conversionMessage(error), [], 1, 1)] };\n\t}\n\n\tconst result = validate(value);\n\tif (result.success) {\n\t\treturn { success: true, data: result.data };\n\t}\n\treturn {\n\t\tsuccess: false,\n\t\tissues: result.issues.map((found) => {\n\t\t\tconst path = (found.path ?? []).map(toKey);\n\t\t\tconst node = nodeForPath(doc, path);\n\t\t\tconst start = node?.range ? lineCounter.linePos(node.range[0]) : { line: 1, col: 1 };\n\t\t\treturn issue(found.message, path, start.line, start.col);\n\t\t}),\n\t};\n}\n\n/**\n * Parse YAML text and validate the value, throwing when either fails.\n *\n * @throws {YamlDocumentError} With each syntax error or validation issue and its line and column.\n * {@link safeParseYaml} returns them instead.\n */\nexport function parseYaml<T>(text: string, validate: YamlValidate<T>, options?: YamlParseOptions): T {\n\tconst result = safeParseYaml(text, validate, options);\n\tif (!result.success) {\n\t\tthrow new YamlDocumentError(result.issues);\n\t}\n\treturn result.data;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/dist/yaml/stringify.js
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`))return!1;r+=String(e.key.value).length+i.length+4}return r<=m}function p(n,r){let e=r?.schemaUrl;if(e!==void 0&&/[\r\n]/.test(e))throw new TypeError("schemaUrl must be a single line");let i=new f(n,{version:"1.2",aliasDuplicateObjects:!1});c(i,{Pair(a,t){s(t.key)&&t.key.value==="<<"&&(t.key.type="QUOTE_DOUBLE")},Map(a,t,o){u(o.at(-1))&&y(t)&&(t.flow=!0)}});let l=i.toString({lineWidth:0});return e===void 0?l:`# yaml-language-server: $schema=${e}
|
|
3
|
-
${l}`}export{p as stringifyYaml};
|
|
1
|
+
import{a}from"../chunk-DE7GQKZP.js";export{a as stringifyYaml};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": [
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
3
|
+
"sources": [],
|
|
4
|
+
"sourcesContent": [],
|
|
5
|
+
"mappings": "",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schema-engine/registry",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"description": "The registration contract and registries of Schema Engine: documents name registrations by $type, and each registration validates its own configuration",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"schema-engine",
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
"url": "git+https://github.com/schema-engine/schema-engine.git",
|
|
18
18
|
"directory": "packages/registry"
|
|
19
19
|
},
|
|
20
|
-
"engines": {
|
|
21
|
-
"node": "^24.22.0 || >=26.0.0"
|
|
22
|
-
},
|
|
23
20
|
"homepage": "https://schema-engine.com/docs/registry/overview",
|
|
24
21
|
"publishConfig": {
|
|
25
22
|
"access": "public"
|
|
@@ -33,9 +30,16 @@
|
|
|
33
30
|
"types": "./dist/index.d.ts",
|
|
34
31
|
"import": "./dist/index.js"
|
|
35
32
|
},
|
|
33
|
+
"./json-schema": {
|
|
34
|
+
"types": "./dist/json-schema/index.d.ts",
|
|
35
|
+
"import": "./dist/json-schema/index.js"
|
|
36
|
+
},
|
|
36
37
|
"./yaml": {
|
|
37
38
|
"types": "./dist/yaml/index.d.ts",
|
|
38
39
|
"import": "./dist/yaml/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./package.json": {
|
|
42
|
+
"import": "./package.json"
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
45
|
"files": [
|
|
@@ -43,16 +47,16 @@
|
|
|
43
47
|
"/skill"
|
|
44
48
|
],
|
|
45
49
|
"dependencies": {
|
|
46
|
-
"@ecopages/logger": "^0.2.3",
|
|
47
50
|
"@standard-schema/spec": "^1.1.0"
|
|
48
51
|
},
|
|
49
52
|
"devDependencies": {
|
|
53
|
+
"ajv": "^8.20.0",
|
|
54
|
+
"ajv-draft-04": "^1.0.0",
|
|
50
55
|
"esbuild": "^0.27.0",
|
|
51
|
-
"tsc-alias": "^1.8.16",
|
|
52
56
|
"typescript": "^5.9.3",
|
|
53
57
|
"vitest": "^5.1.1",
|
|
54
58
|
"yaml": "2.9.1",
|
|
55
|
-
"zod": "^4.0
|
|
59
|
+
"zod": "^4.5.0",
|
|
56
60
|
"@schema-engine/scripts": "0.0.0"
|
|
57
61
|
},
|
|
58
62
|
"peerDependencies": {
|
|
@@ -66,10 +70,10 @@
|
|
|
66
70
|
"scripts": {
|
|
67
71
|
"build:lib": "pnpm clean && pnpm build:files && pnpm build:types",
|
|
68
72
|
"build:files": "node ./build.ts",
|
|
69
|
-
"build:types": "tsc -p tsconfig.build.json
|
|
73
|
+
"build:types": "tsc -p tsconfig.build.json",
|
|
70
74
|
"watch:lib": "node ./build.ts --watch",
|
|
71
75
|
"clean": "rm -rf ./dist",
|
|
72
76
|
"test:all": "vitest run",
|
|
73
|
-
"check-types": "tsc --noEmit"
|
|
77
|
+
"check-types": "tsc --noEmit && node test/type-cost/check.ts"
|
|
74
78
|
}
|
|
75
79
|
}
|
package/skill/SKILL.md
CHANGED
|
@@ -19,7 +19,7 @@ This file is the router. It defines the concepts once; the references assume the
|
|
|
19
19
|
## Core concepts
|
|
20
20
|
|
|
21
21
|
- **registration**: `{ $type, schema, metadata, ... }`, where `$type` is the stable key, `schema` is any Standard Schema that describes its config, and `metadata` names it. Elements, recipes, actions, validation rules and appearance axes are all registrations.
|
|
22
|
-
- **registry**: a read-only registry, `createRegistry(kind, registrations)` from `@schema-engine/registry`, built once from a list. The last registration of a `$type` wins without a warning, which is how you replace a built-in; pass `{ duplicates: 'error' }` to make a repeat a build error instead.
|
|
22
|
+
- **registry**: a read-only registry, `createRegistry(kind, registrations)` from `@schema-engine/registry`, built once from a list, or `createMutableRegistry(kind)` for registrations that arrive at runtime; both are read the same way. The last registration of a `$type` wins without a warning, which is how you replace a built-in; pass `{ duplicates: 'error' }` to make a repeat a build error instead.
|
|
23
23
|
- **document**: serializable data whose every node names a registration by `$type`. It is checked against the registrations at the boundary, so what is rendered or run has passed its schema.
|
|
24
24
|
- **action**: a registration with `execute` that runs on a trigger. Actions run as a sequence, an inner array is a parallel group, and a failure that sets `shouldContinue: false` stops what follows and cancels the group's siblings through their `signal`.
|
|
25
25
|
|
|
@@ -34,14 +34,14 @@ Outcomes use one vocabulary: a check or a submission ends `passed`, `invalid` or
|
|
|
34
34
|
|
|
35
35
|
## Packages
|
|
36
36
|
|
|
37
|
-
| Package | Role
|
|
38
|
-
| ------------------------------ |
|
|
39
|
-
| `@schema-engine/registry` | The registration contract and
|
|
40
|
-
| `@schema-engine/actions` | Actions: `parseActions`, and a dispatcher that runs a sequence with parallel groups, cancellation and results
|
|
41
|
-
| `@schema-engine/layout` | Domain-neutral grid, appearance axes, layout themes and the recipe protocol
|
|
42
|
-
| `@schema-engine/forms` | The forms engine: config, validation, constraints, the container, the runtime
|
|
43
|
-
| `@schema-engine/forms-react` | React renderer: `FormRenderer` and the hooks. You write the widgets; ready-made ones come from the optional shadcn registry
|
|
44
|
-
| `@schema-engine/forms-radiant` | Radiant renderer: `se-form-instance`, `FormController`, widgets and recipes in the package
|
|
37
|
+
| Package | Role |
|
|
38
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
39
|
+
| `@schema-engine/registry` | The registration contract and the registries every package builds on, `safeParseTree` and `exportTreeSchema` for a whole document, and `/yaml` for documents authored as YAML. Ships this router |
|
|
40
|
+
| `@schema-engine/actions` | Actions: `parseActions`, and a dispatcher that runs a sequence with parallel groups, cancellation and results |
|
|
41
|
+
| `@schema-engine/layout` | Domain-neutral grid, appearance axes, layout themes and the recipe protocol |
|
|
42
|
+
| `@schema-engine/forms` | The forms engine: config, validation, constraints, the container, the runtime |
|
|
43
|
+
| `@schema-engine/forms-react` | React renderer: `FormRenderer` and the hooks. You write the widgets; ready-made ones come from the optional shadcn registry |
|
|
44
|
+
| `@schema-engine/forms-radiant` | Radiant renderer: `se-form-instance`, `FormController`, widgets and recipes in the package |
|
|
45
45
|
|
|
46
46
|
A symbol has one import path. `@schema-engine/forms` has these entries: `.` (the engine, the runtime and the types), `/state-container` (the container and its selectors), `/csrf`, `/server-errors`, `/recipes`, `/recipes/built-in`, `/browser` (browser-side actions such as auto-save), `/testing` (conformance suites; they need vitest) and `/agent-tool` (experimental).
|
|
47
47
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @schema-engine/registry
|
|
2
2
|
|
|
3
|
-
The registration contract and the read-only
|
|
3
|
+
The registration contract and the registries (read-only, or mutable for runtime registrations) every other package builds on, and the YAML subpath for documents authored as text. The terms are defined in the router (`SKILL.md`). How the forms engine registers elements, recipes, actions and rules is in `forms.md`.
|
|
4
4
|
|
|
5
5
|
## A registration
|
|
6
6
|
|
|
7
|
-
Every registration is `{ $type, schema, metadata }`: `$type` is the stable key, `schema` is any Standard Schema (Zod, Zod Mini, Valibot, Effect Schema or a hand-written one) that describes the config, and `metadata` has a `name` and optionally a `description`. A package adds what it needs to the type (`BaseRegistration`): a renderable one is a `ComponentRegistration` with `render`, an action adds `execute`, a validation rule adds `category` and `handler`. The registry has no schema-library dependency: install the provider you prefer.
|
|
7
|
+
Every registration is `{ $type, schema, metadata }`: `$type` is the stable key, `schema` is any Standard Schema (Zod, Zod Mini, Valibot, Effect Schema or a hand-written one) that describes the config, and `metadata` has a `name` and optionally a `description`. A package adds what it needs to the type (`BaseRegistration`; a component's metadata, `ComponentMetadata`, adds optional `icon`, `tags` and `version`): a renderable one is a `ComponentRegistration` with `render`, an action adds `execute`, a validation rule adds `category` and `handler`. The registry has no schema-library dependency: install the provider you prefer.
|
|
8
8
|
|
|
9
9
|
## createRegistry
|
|
10
10
|
|
|
@@ -30,7 +30,7 @@ export const widgets = createRegistry('Widget', [...defaults, custom]);
|
|
|
30
30
|
|
|
31
31
|
- A later registration with the same `$type` replaces the earlier one with no warning, so `[...defaults, custom]` is how you override. The key keeps its first position.
|
|
32
32
|
- `createRegistry(kind, registrations, { duplicates: 'error' })` makes a repeated `$type` a build error instead (`Widget 'card' is registered twice.`, thrown before any schema is checked). Use it for a catalog where a repeat is always a mistake, such as component keys; the default is `'override'`.
|
|
33
|
-
- Each winning `schema` is checked at build: a value without `~standard.validate` throws
|
|
33
|
+
- Each winning `schema` is checked at build: a value without `~standard.validate` throws a `RegistryError` with code `'invalid-schema'`, naming the `kind` and the `$type`.
|
|
34
34
|
- The result has `get`, `has`, `all`, `keys` and `size`, and no `register` or `clear`. It holds a frozen shallow copy of each winner taken at build, so patch a registration before building, or build a new registry from a new list.
|
|
35
35
|
- Type it with `ReadOnlyRegistry<TRegistration>`.
|
|
36
36
|
|
|
@@ -56,24 +56,37 @@ export const radiantWidgets = bindRegistry(contracts, {
|
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
- The result is a frozen registry built with `createRegistry`: the contracts' order, every schema checked again. For contracts typed by literal `$type` (an inline list), `get('card')` returns that registration without `undefined`, and a missing binding, an extra one (`crad`) and a binding that sets a contract key (`schema`, `metadata`) are compile errors. `RegistryBindings<typeof contracts, ReactBinding>` with `satisfies` fixes the shape every binding of a renderer takes.
|
|
60
|
-
- Whatever the typing, the build throws naming the `kind`: `Widget 'badge' has no binding.`, `Widget binding 'crad' names no registration.` and `Widget 'card' binding sets 'schema', which the contract defines.`
|
|
59
|
+
- The result is a `BoundRegistry`, a frozen registry built with `createRegistry`: the contracts' order, every schema checked again. For contracts typed by literal `$type` (an inline list), `get('card')` returns that registration (a `BoundRegistration`, the contract with its binding) without `undefined`, and a missing binding, an extra one (`crad`) and a binding that sets a contract key (`schema`, `metadata`) are compile errors. `RegistryBindings<typeof contracts, ReactBinding>` with `satisfies` fixes the shape every binding of a renderer takes.
|
|
60
|
+
- Whatever the typing, the build throws a `RegistryError` (codes `'missing-binding'`, `'unknown-binding'` and `'binding-overrides-contract'`) naming the `kind`: `Widget 'badge' has no binding.`, `Widget binding 'crad' names no registration.` and `Widget 'card' binding sets 'schema', which the contract defines.`
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Errors while building or binding, and a tree parse whose schema contradicts its registration, are a `RegistryError` (`error.code` of type `RegistryErrorCode`, always with `$type`, and `kind` unless a parse went through a lookup that is no registry). Branch on the code, not on the message, which may be reworded:
|
|
63
63
|
|
|
64
|
-
|
|
64
|
+
- `'invalid-schema'`: a `schema` without `~standard.validate`.
|
|
65
|
+
- `'invalid-child-paths'`: `childPaths` is not a list, or an entry is not `{ keys, accepts?, list? }` (another property such as `accept`, empty or non-string `keys`, an empty `accepts`, a name that is empty or listed twice, a `list` that is not `true`).
|
|
66
|
+
- `'duplicate-child-path'`: the same child path (`childPath`, the same keys) twice. `'nested-child-path'`: a child path (`childPath`) that runs through another (`outerChildPath`).
|
|
67
|
+
- `'invalid-declaration'`: a domain package refuses a declaration of a registration other than its child paths.
|
|
68
|
+
- `'duplicate-type'`: a repeated `$type` with `duplicates: 'error'`.
|
|
69
|
+
- `'unknown-binding'`: a binding key no contract answers (`$type` is that key). `'missing-binding'`: a contract with no binding. `'binding-overrides-contract'`: a binding that sets a key (`key`) its contract defines.
|
|
70
|
+
- `'unreachable-child-path'` (`childPath`): `exportTreeSchema` found no slot for a child path in a registration's JSON Schema. `'unknown-accepted-type'` (`childPath`, `key`): a child path accepts a `$type` the lookup lacks. `'definition-name-clash'` (`key`): a definition a schema brought along takes the name of a `$type`.
|
|
71
|
+
- `'schema-changes-type'` and `'schema-breaks-child-path'` (`childPath`): `safeParseTree` parsed a node whose schema returned an output without the node's own `$type`, or that does not keep a child path as the document has it. They are bugs of the registration, never issues of the document.
|
|
72
|
+
|
|
73
|
+
`assertStandardSchema` on its own and errors while parsing (`safeParseStandardSchema` and `safeParseNode` with an asynchronous schema) are plain `Error`s, and `parseYaml` throws `YamlDocumentError`.
|
|
74
|
+
|
|
75
|
+
`safeParseStandardSchema(schema, value)` runs a registration's schema without throwing and returns `{ success: true, data }` or `{ success: false, error: { issues } }` (it throws for a schema that validates asynchronously). Form validation and `parseActions` both go through it; `isStandardSchema(value)` is the type guard for a Standard Schema's shape (it never runs the schema), and `assertStandardSchema` is the build-time check on its own. `standardSchema(validate)` builds a Standard Schema from a function that returns `{ value }` or `{ issues }`, for a registration whose check is not a schema library's.
|
|
76
|
+
|
|
77
|
+
`safeParseNode(registry, node, options?)` checks one node of a document: it looks `node.$type` up in the registry (anything with `get(key)`, and optionally `hint`, a sentence added to the message of an unregistered `$type`, such as where to register it), validates the node with the registration's schema and returns `{ success: true, $type, registration, data }` or `{ success: false, issues }`. For a registry typed by its registrations (`createRegistry` keeps the literal `$type` of an inline list), checking `parsed.$type` narrows `registration` and `data` to that registration's schema output with no cast; `data` is `unknown` for a registry typed as `BaseRegistration`. A node that is not an object with a string `$type`, and a `$type` no registration answers, are issues, not throws; the second reads `No registration for $type '<type>'.` and then the hint, and `unregisteredTypeMessage(type, hint?)` writes the same text for a caller that throws instead. Every issue's `path` starts with `options.path`, the position of the node in its document, so a walk over a tree passes each child its own. `options.accepts` is a non-empty list of the `$type`s the node may have: another `$type` is the issue `registry/not-accepted` (with `expected` and `received`), checked before the lookup. The issues the engine creates carry a namespaced `code`: `registry/not-an-object`, `registry/missing-type`, `registry/unregistered-type`, `registry/not-accepted`, `registry/not-a-node` and `registry/contains-itself`; an issue from a schema is its library's own.
|
|
65
78
|
|
|
66
79
|
```ts title="registry/draw-node.ts"
|
|
67
80
|
import { formatIssuePath, safeParseNode } from '@schema-engine/registry';
|
|
68
81
|
import { widgets } from './widgets';
|
|
69
82
|
|
|
70
83
|
export function nodeIssues(node: unknown, index: number): string[] {
|
|
71
|
-
const parsed = safeParseNode(widgets, node, ['children', index]);
|
|
84
|
+
const parsed = safeParseNode(widgets, node, { path: ['children', index] });
|
|
72
85
|
return parsed.success ? [] : parsed.issues.map((issue) => `${formatIssuePath(issue.path)}: ${issue.message}`);
|
|
73
86
|
}
|
|
74
87
|
```
|
|
75
88
|
|
|
76
|
-
`safeParseTree(registry, root,
|
|
89
|
+
`safeParseTree(registry, root, options?)` checks a whole document in one call. A registration says where its children are with `childPaths`, a list of `{ keys, accepts?, list? }`: `keys` is the list of keys from the node to the slot (`['sections']`, or `['engine', 'controls']`), relative and without indexes, and `accepts` is a closed, non-empty list of the `$type`s allowed there (leave it out and the slot puts no limit on the `$type`). The slot holds one node or an array of nodes, or only an array when `list: true`: anything else there is `registry/not-a-list` at the path, an open slot is exported as an array, and `data` types the slot as an array. Keep the slot opaque in the parent's schema (`z.array(z.unknown())`) and declare every child key there: `accepts` is the only way to restrict a slot, and `createRegistry` fails to compile a child path whose key the schema output does not declare. `options.accepts` restricts the root and `options.path` is where it sits in a larger document. Every node goes through `safeParseNode` at its full path and the `accepts` of its position, a node whose schema fails is not walked further but its siblings still are, a value at a child path that is no node (`null`, a primitive) is `registry/not-a-node` at that path (`registry/not-a-list` on a path that sets `list`), and a node that contains itself is `registry/contains-itself`, not an overflow. It returns `{ success: true, tree }` or `{ success: false, issues, tree? }` with every issue and the nodes that parsed. `tree.data` is the parsed document, typed per child path, with defaults and transforms of every level applied; a `tree` node is a `ParsedNode`, `{ $type, registration, data, path, children }`, whose `data` is that node's composed data and whose `children` is a list of `{ keys, nodes }`, one per declared path in declaration order (find one with `children.find(({ keys }) => ...)`, never by index). On failure, `tree` is a `PartialNode` when the root's own schema passed (absent when the root failed): every node whose own schema passed and whose parent was kept, `{ $type, registration, output, path, children }`, with `output` the node's own schema output and no `data` (reading `tree.data` there is a type error). A failed node is left out and not walked, as are a rejected `accepts` and a cycle edge; `children` keeps one `{ keys, nodes }` per path with the kept children in document order, each with its own `path`. Read children from `children`, never from a slot of `output`, which holds what the document had there. The parent schema must keep `$type` and the slot the way the document has it, or `safeParseTree` throws a `RegistryError`. The root narrows from a literal `accepts`. Two registries in one parse go through one lookup: `{ get: (type) => a.get(type) ?? b.get(type) }`, and the first that answers wins.
|
|
77
90
|
|
|
78
91
|
```ts title="registry/check-tree.ts"
|
|
79
92
|
import * as z from 'zod/mini';
|
|
@@ -82,36 +95,62 @@ import { createRegistry, formatIssuePath, safeParseTree } from '@schema-engine/r
|
|
|
82
95
|
const nodes = createRegistry('Node', [
|
|
83
96
|
{
|
|
84
97
|
$type: 'page',
|
|
85
|
-
schema: z.
|
|
98
|
+
schema: z.object({ $type: z.literal('page'), sections: z.array(z.unknown()) }),
|
|
86
99
|
metadata: { name: 'Page' },
|
|
87
|
-
childPaths: [['sections']],
|
|
100
|
+
childPaths: [{ keys: ['sections'], accepts: ['section'] }],
|
|
88
101
|
},
|
|
89
102
|
{
|
|
90
103
|
$type: 'section',
|
|
91
|
-
schema: z.
|
|
104
|
+
schema: z.object({ $type: z.literal('section'), title: z.string() }),
|
|
92
105
|
metadata: { name: 'Section' },
|
|
93
106
|
},
|
|
94
107
|
]);
|
|
95
108
|
|
|
96
109
|
export function documentIssues(document: unknown): string[] {
|
|
97
|
-
const parsed = safeParseTree(nodes, document);
|
|
110
|
+
const parsed = safeParseTree(nodes, document, { accepts: ['page'] });
|
|
98
111
|
return parsed.success
|
|
99
112
|
? []
|
|
100
113
|
: parsed.issues.map((issue) => `${formatIssuePath(issue.path, document)}: ${issue.message}`);
|
|
101
114
|
}
|
|
102
115
|
|
|
103
116
|
export function sectionTitles(document: unknown): string[] {
|
|
104
|
-
const parsed = safeParseTree(nodes, document);
|
|
105
|
-
|
|
106
|
-
return sections.flatMap((section) => (section.$type === 'section' ? [section.data.title] : []));
|
|
117
|
+
const parsed = safeParseTree(nodes, document, { accepts: ['page'] });
|
|
118
|
+
return parsed.success ? parsed.tree.data.sections.map((section) => section.title) : [];
|
|
107
119
|
}
|
|
108
120
|
```
|
|
109
121
|
|
|
110
122
|
`formatIssuePath(path, source?)` writes the `path` of an issue as text: keys joined by dots and indexes in brackets (`children[1].label`), the empty string for a missing or empty path. A segment may be a key or a Standard Schema `{ key }` object. Given the document as `source`, an array item with a string `id` is followed by it, `children[1] (hero).label`.
|
|
111
123
|
|
|
112
|
-
|
|
124
|
+
`exportTreeSchema(lookup, options?)` writes the JSON Schema of the whole tree, composed at the JSON Schema level so it does not depend on the validator. `lookup` is a registry (anything with `all()`) or a list of registries, the first winning a `$type` both list. It returns `{ $schema, $defs, anyOf }`: one definition per `$type` under `$defs` (`definitions` for target `'draft-07'`), referred to by `#/$defs/<$type>` with `~` and `/` escaped as `~0` and `~1`, and the root as the union of `options.accepts`, or of every `$type`. Each schema is read by `options.resolve(schema, { io, target })`, by default its `~standard.jsonSchema`, and a schema it returns `undefined` for is listed by an open object that holds its `$type` and its child paths. `options.io` is `'input'` (the authored shape, the default) or `'output'`, and `options.target` the dialect: `'draft-2020-12'` (the default) or `'draft-07'`, and any other target (`'openapi-3.0'`, a misspelling, Zod's older spelling of draft-07) throws an `Error` before a schema is read. `JSONSchemaTarget`, the closed set of the Standard JSON Schema names `'draft-2020-12'`, `'draft-07'`, `'draft-04'` and `'openapi-3.0'`, is exported from the root. Each child path is then replaced, and only its slot, so `required`, `minItems`, `maxItems` and sibling keys stay: an array slot gets `items: U`, an object slot becomes `U`, an open slot (`{}`) becomes `{ anyOf: [U, { type: 'array', items: U }] }`, where `U` is `{ anyOf: [{ $ref }, ...] }` of the path's `accepts`, or of every `$type` without it. A slot behind `allOf`, a `$ref` or a union, inside a schema with an `$id` (`id` for draft-04) of its own, or one a schema does not declare, throws `RegistryError` `'unreachable-child-path'`. Definitions a schema wrote into its own `$defs` are lifted to the top as `<$type>.<name>` and their pointers follow, with each `.` and `_` of the `$type` written as `_2e_` and `_5f_` (so `a.b` with `c` is `a_2e_b.c`, apart from `a` with `b.c`), and its anchors (`$anchor`, `$dynamicAnchor`, a draft-07 `$id: '#name'`, a draft-04 `id: '#name'`) become `<owner part>.<name>` where the owner part is `o` and the `$type` with every character outside `[A-Za-z0-9-]` written as `_<hex>_` (`ui/button` and `x` give `oui_2f_button.x`, `my-card` gives `omy-card.x`); a name already in the document (a `$type` with that name, say) throws `'definition-name-clash'`. `@schema-engine/registry/json-schema` holds the pieces for code that writes JSON Schema itself: `readStandardJSONSchema(schema)` returns a schema's `~standard.jsonSchema` converter or `undefined` (what the default `resolve` reads, so a custom `resolve` can fall back to it: `readStandardJSONSchema(schema)?.[io]({ target })`), `createJSONSchemaEmbedder(target, placement)` embeds schemas written as documents of their own into one being written, as the forms export does (it takes a `JSONSchemaTarget` and throws for any other string), `assertJSONSchemaTarget(target)` throws unless a string is a `JSONSchemaTarget` and narrows it to one (for the open `target` of a Standard JSON Schema converter's options), `idKeyword(target)` is the keyword a target writes a schema's identifier under (`'id'` for `'draft-04'`, `'$id'` otherwise), `startsResource(schema, target)` is whether a schema sets it to something other than a fragment (`#node`), which makes it a resource that resolves its own references and anchors, `replaceChildSlot(definition, { $type, keys }, union, { target })` replaces, in place, the slot a child path names in a registration's JSON Schema, which is the step `exportTreeSchema` takes per child path (an unreachable slot, or an `$id` (`id` for draft-04) between the definition and the slot, throws `RegistryError` `'unreachable-child-path'`; the `$id` of the definition's own root is the caller's to check; a path with `list: true` writes an open slot as an array instead of a child or a list, and an object slot of it is unreachable), `definitionRef(target, name)` writes the `$ref` to a definition (`#/$defs/<name>` for `'draft-2020-12'`, `#/definitions/<name>` otherwise, the name as a JSON Pointer token percent-encoded only where a URI fragment needs it, so `element:tab` stays as written), and `definitionsKeyword(target)` is the keyword it writes. A schema that is itself a definition or an entry is written in place by the embedder's `embedDefinition(own, name)` (one with an `$id` (`id` for draft-04) of its own is a collection entry that refers to it, so the entry keeps the collection's URI). A registry user needs only `exportTreeSchema`.
|
|
125
|
+
|
|
126
|
+
```ts title="registry/export-tree.ts"
|
|
127
|
+
import * as z from 'zod/mini';
|
|
128
|
+
import { createRegistry, exportTreeSchema } from '@schema-engine/registry';
|
|
129
|
+
|
|
130
|
+
const nodes = createRegistry('Node', [
|
|
131
|
+
{
|
|
132
|
+
$type: 'page',
|
|
133
|
+
schema: z.object({ $type: z.literal('page'), sections: z.array(z.unknown()) }),
|
|
134
|
+
metadata: { name: 'Page' },
|
|
135
|
+
childPaths: [{ keys: ['sections'], accepts: ['section'] }],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
$type: 'section',
|
|
139
|
+
schema: z.object({ $type: z.literal('section'), title: z.string() }),
|
|
140
|
+
metadata: { name: 'Section' },
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
|
|
144
|
+
export const documentSchema = exportTreeSchema(nodes, {
|
|
145
|
+
accepts: ['page'],
|
|
146
|
+
resolve: (schema, { io, target }) =>
|
|
147
|
+
schema instanceof z.core.$ZodType ? z.toJSONSchema(schema, { io, target }) : undefined,
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## createMutableRegistry
|
|
113
152
|
|
|
114
|
-
`
|
|
153
|
+
`createRegistry` and `createMutableRegistry` take `{ hint }`: the sentence that ends the message of an unregistered `$type`, exposed as the registry's optional `hint`, so a registry is a `NodeLookup` with its hint (`parseActions` and `safeParseNode` report it). `createMutableRegistry<MyRegistration>('Plugin')` is the mutable opt-in for registrations that arrive at runtime, such as a plugin system. It returns a `MutableRegistry`: the read side of a `createRegistry` result (`get`, `has`, `all`, `keys`, `size`, `kind`) plus `register` and `clear`, so either kind goes wherever a registry is read. `register` checks a registration as `createRegistry` does (`RegistryError` `'invalid-schema'`, `'invalid-child-paths'`, `'duplicate-child-path'`, `'nested-child-path'`, and the registry is unchanged when it throws), a repeated `$type` replaces the earlier one and keeps its position (or throws `'duplicate-type'` with `{ duplicates: 'error' }`), and nothing is logged. `all()` and `keys()` return the same frozen array until the next change. A function that finds a registration takes a `NodeLookup`, one that lists them takes an `ExportLookup`, and a registry of either kind is both. Use `createRegistry` unless the list is not known when the registry is built.
|
|
115
154
|
|
|
116
155
|
## YAML documents
|
|
117
156
|
|
package/dist/base-registry.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { BaseRegistration } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Base Registry - Abstract class for all registries
|
|
4
|
-
*
|
|
5
|
-
* Provides common registration, retrieval, and management functionality.
|
|
6
|
-
* Each registry extends this to add type-specific behavior.
|
|
7
|
-
*
|
|
8
|
-
* All registrations must extend BaseRegistration which provides the unified `$type` field.
|
|
9
|
-
*
|
|
10
|
-
* @template TKey - The key type (typically string)
|
|
11
|
-
* @template TValue - The value type (registration object extending BaseRegistration)
|
|
12
|
-
*/
|
|
13
|
-
export declare abstract class BaseRegistry<TKey extends string, TValue extends BaseRegistration> {
|
|
14
|
-
protected items: Map<TKey, TValue>;
|
|
15
|
-
/**
|
|
16
|
-
* Get the registry name for logging purposes.
|
|
17
|
-
*/
|
|
18
|
-
abstract get registryName(): string;
|
|
19
|
-
/**
|
|
20
|
-
* Extract the key from an item.
|
|
21
|
-
* Uses the unified `$type` field from BaseRegistration.
|
|
22
|
-
* @param item - The item to extract the key from
|
|
23
|
-
*/
|
|
24
|
-
protected getItemKey(item: TValue): TKey;
|
|
25
|
-
/**
|
|
26
|
-
* Extract the name from an item for logging.
|
|
27
|
-
* Uses the `name` field from metadata.
|
|
28
|
-
* @param item - The item to extract the name from
|
|
29
|
-
*/
|
|
30
|
-
protected getItemName(item: TValue): string;
|
|
31
|
-
/**
|
|
32
|
-
* Register an item.
|
|
33
|
-
*
|
|
34
|
-
* @param item - The item to register
|
|
35
|
-
*/
|
|
36
|
-
register(item: TValue): void;
|
|
37
|
-
/**
|
|
38
|
-
* Check if an item is registered.
|
|
39
|
-
*
|
|
40
|
-
* @param key - The key to check
|
|
41
|
-
* @returns True if the item is registered
|
|
42
|
-
*/
|
|
43
|
-
has(key: TKey): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Get a registered item.
|
|
46
|
-
*
|
|
47
|
-
* @param key - The key to retrieve
|
|
48
|
-
* @returns The item or undefined if not found
|
|
49
|
-
*/
|
|
50
|
-
get(key: TKey): TValue | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Get all registered items.
|
|
53
|
-
*
|
|
54
|
-
* @returns Array of all registered items
|
|
55
|
-
*/
|
|
56
|
-
getAll(): TValue[];
|
|
57
|
-
/**
|
|
58
|
-
* Get all registered keys.
|
|
59
|
-
*
|
|
60
|
-
* @returns Array of all registered keys
|
|
61
|
-
*/
|
|
62
|
-
getAllKeys(): TKey[];
|
|
63
|
-
/**
|
|
64
|
-
* Get the number of registered items.
|
|
65
|
-
*
|
|
66
|
-
* @returns The number of items in the registry
|
|
67
|
-
*/
|
|
68
|
-
get size(): number;
|
|
69
|
-
/**
|
|
70
|
-
* Clear all registered items. Primarily for testing.
|
|
71
|
-
*/
|
|
72
|
-
clear(): void;
|
|
73
|
-
}
|
package/dist/base-registry.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Logger as m}from"@ecopages/logger";var s=new m("[@schema-engine/registry]"),a=class{items=new Map;getItemKey(e){return e.$type}getItemName(e){return e.metadata.name}register(e){let t=this.getItemKey(e),r=this.getItemName(e);if(this.items.has(t)){let i=this.items.get(t),n=i?this.getItemName(i):"unknown";s.warn(`Overriding ${this.registryName}: ${t}`,{previousName:n,newName:r})}this.items.set(t,e),s.debug(`Registered ${this.registryName}: ${t}`,{name:r})}has(e){return this.items.has(e)}get(e){return this.items.get(e)}getAll(){return Array.from(this.items.values())}getAllKeys(){return Array.from(this.items.keys())}get size(){return this.items.size}clear(){this.items.clear(),s.debug(`${this.registryName} cleared`)}};export{a as BaseRegistry};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/base-registry.ts"],
|
|
4
|
-
"sourcesContent": ["import { Logger } from '@ecopages/logger';\nimport type { BaseRegistration } from './types.js';\n\nconst logger = new Logger('[@schema-engine/registry]');\n\n/**\n * Base Registry - Abstract class for all registries\n *\n * Provides common registration, retrieval, and management functionality.\n * Each registry extends this to add type-specific behavior.\n *\n * All registrations must extend BaseRegistration which provides the unified `$type` field.\n *\n * @template TKey - The key type (typically string)\n * @template TValue - The value type (registration object extending BaseRegistration)\n */\nexport abstract class BaseRegistry<TKey extends string, TValue extends BaseRegistration> {\n\tprotected items = new Map<TKey, TValue>();\n\n\t/**\n\t * Get the registry name for logging purposes.\n\t */\n\tabstract get registryName(): string;\n\n\t/**\n\t * Extract the key from an item.\n\t * Uses the unified `$type` field from BaseRegistration.\n\t * @param item - The item to extract the key from\n\t */\n\tprotected getItemKey(item: TValue): TKey {\n\t\treturn item.$type as TKey;\n\t}\n\n\t/**\n\t * Extract the name from an item for logging.\n\t * Uses the `name` field from metadata.\n\t * @param item - The item to extract the name from\n\t */\n\tprotected getItemName(item: TValue): string {\n\t\treturn item.metadata.name;\n\t}\n\n\t/**\n\t * Register an item.\n\t *\n\t * @param item - The item to register\n\t */\n\tregister(item: TValue): void {\n\t\tconst key = this.getItemKey(item);\n\t\tconst name = this.getItemName(item);\n\n\t\tif (this.items.has(key)) {\n\t\t\tconst existing = this.items.get(key);\n\t\t\tconst existingName = existing ? this.getItemName(existing) : 'unknown';\n\t\t\tlogger.warn(`Overriding ${this.registryName}: ${key}`, {\n\t\t\t\tpreviousName: existingName,\n\t\t\t\tnewName: name,\n\t\t\t});\n\t\t}\n\n\t\tthis.items.set(key, item);\n\t\tlogger.debug(`Registered ${this.registryName}: ${key}`, {\n\t\t\tname,\n\t\t});\n\t}\n\n\t/**\n\t * Check if an item is registered.\n\t *\n\t * @param key - The key to check\n\t * @returns True if the item is registered\n\t */\n\thas(key: TKey): boolean {\n\t\treturn this.items.has(key);\n\t}\n\n\t/**\n\t * Get a registered item.\n\t *\n\t * @param key - The key to retrieve\n\t * @returns The item or undefined if not found\n\t */\n\tget(key: TKey): TValue | undefined {\n\t\treturn this.items.get(key);\n\t}\n\n\t/**\n\t * Get all registered items.\n\t *\n\t * @returns Array of all registered items\n\t */\n\tgetAll(): TValue[] {\n\t\treturn Array.from(this.items.values());\n\t}\n\n\t/**\n\t * Get all registered keys.\n\t *\n\t * @returns Array of all registered keys\n\t */\n\tgetAllKeys(): TKey[] {\n\t\treturn Array.from(this.items.keys());\n\t}\n\n\t/**\n\t * Get the number of registered items.\n\t *\n\t * @returns The number of items in the registry\n\t */\n\tget size(): number {\n\t\treturn this.items.size;\n\t}\n\n\t/**\n\t * Clear all registered items. Primarily for testing.\n\t */\n\tclear(): void {\n\t\tthis.items.clear();\n\t\tlogger.debug(`${this.registryName} cleared`);\n\t}\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,UAAAA,MAAc,mBAGvB,IAAMC,EAAS,IAAID,EAAO,2BAA2B,EAa/BE,EAAf,KAAkF,CAC9E,MAAQ,IAAI,IAYZ,WAAWC,EAAoB,CACxC,OAAOA,EAAK,KACb,CAOU,YAAYA,EAAsB,CAC3C,OAAOA,EAAK,SAAS,IACtB,CAOA,SAASA,EAAoB,CAC5B,IAAMC,EAAM,KAAK,WAAWD,CAAI,EAC1BE,EAAO,KAAK,YAAYF,CAAI,EAElC,GAAI,KAAK,MAAM,IAAIC,CAAG,EAAG,CACxB,IAAME,EAAW,KAAK,MAAM,IAAIF,CAAG,EAC7BG,EAAeD,EAAW,KAAK,YAAYA,CAAQ,EAAI,UAC7DL,EAAO,KAAK,cAAc,KAAK,YAAY,KAAKG,CAAG,GAAI,CACtD,aAAcG,EACd,QAASF,CACV,CAAC,CACF,CAEA,KAAK,MAAM,IAAID,EAAKD,CAAI,EACxBF,EAAO,MAAM,cAAc,KAAK,YAAY,KAAKG,CAAG,GAAI,CACvD,KAAAC,CACD,CAAC,CACF,CAQA,IAAID,EAAoB,CACvB,OAAO,KAAK,MAAM,IAAIA,CAAG,CAC1B,CAQA,IAAIA,EAA+B,CAClC,OAAO,KAAK,MAAM,IAAIA,CAAG,CAC1B,CAOA,QAAmB,CAClB,OAAO,MAAM,KAAK,KAAK,MAAM,OAAO,CAAC,CACtC,CAOA,YAAqB,CACpB,OAAO,MAAM,KAAK,KAAK,MAAM,KAAK,CAAC,CACpC,CAOA,IAAI,MAAe,CAClB,OAAO,KAAK,MAAM,IACnB,CAKA,OAAc,CACb,KAAK,MAAM,MAAM,EACjBH,EAAO,MAAM,GAAG,KAAK,YAAY,UAAU,CAC5C,CACD",
|
|
6
|
-
"names": ["Logger", "logger", "BaseRegistry", "item", "key", "name", "existing", "existingName"]
|
|
7
|
-
}
|