@agentshouse/mdmodel 0.1.0-c3208a08ee314 → 0.1.0-c42f1957e050b
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/API.md +107 -111
- package/dist/blocks.js +1 -1
- package/dist/condition.d.ts.map +1 -1
- package/dist/condition.js +5 -0
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +81 -21
- package/dist/document.d.ts +4 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +68 -35
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/links.d.ts +1 -0
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +1 -1
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +92 -12
- package/dist/references.d.ts +2 -2
- package/dist/references.d.ts.map +1 -1
- package/dist/types.d.ts +25 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +5 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +146 -92
- package/package.json +4 -2
package/API.md
CHANGED
|
@@ -41,15 +41,13 @@ if (parsed.ok) {
|
|
|
41
41
|
`MARKDOWN_SYNTAX_PROFILE` is the Markdown every reader here applies, GitHub Flavored Markdown
|
|
42
42
|
0.29, and `VERSION` is the MD model version.
|
|
43
43
|
|
|
44
|
-
`verify(schema)` reads one schema text, the MD Types of one Room or App: one
|
|
45
|
-
|
|
46
|
-
`$defs`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
`
|
|
50
|
-
|
|
51
|
-
list, items }` over one string, number, integer or boolean, optionally
|
|
52
|
-
`required: true`; `member_document: true` marks at most one type.
|
|
44
|
+
`verify(schema)` reads one schema text, the MD Types of one Room or App: one JSON Schema document
|
|
45
|
+
(draft 2020-12) in the YAML subset. Every top-level key but `$defs` names an MD Type holding the
|
|
46
|
+
JSON Schema of its frontmatter; `$defs` holds shapes the types reuse, reached by a `$ref` under
|
|
47
|
+
`#/$defs/` alone. `type` and the built-in `any` are never declared. The model adds three keywords:
|
|
48
|
+
`reference` on a string names one MD Type, several, `any` or `attachment`; `sections` declares a
|
|
49
|
+
type's H2 sections, each `{ kind: text }` or `{ kind: list, items }` over one string, number,
|
|
50
|
+
integer or boolean, optionally `required: true`; `member_document: true` marks at most one type.
|
|
53
51
|
|
|
54
52
|
```yaml
|
|
55
53
|
$defs:
|
|
@@ -64,70 +62,64 @@ plan:
|
|
|
64
62
|
contact: { member_document: true }
|
|
65
63
|
```
|
|
66
64
|
|
|
67
|
-
The model's `types` expose each MD Type's `name`, `memberDocument`, `sections`,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
`
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
`
|
|
99
|
-
|
|
100
|
-
type
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
one
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
section
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
`
|
|
125
|
-
frontmatter and before the first section heading recognized by the existing
|
|
126
|
-
section parser. Without a section it is the entire post-frontmatter body;
|
|
127
|
-
without frontmatter it starts at the beginning of the Document. An empty span
|
|
128
|
-
is `''`. It includes whitespace, newlines, a leading H1, and any fenced text
|
|
129
|
-
before the first section. The closing frontmatter delimiter and its line ending
|
|
130
|
-
belong to frontmatter. Section recognition and the syntax profile are unchanged.
|
|
65
|
+
The model's `types` expose each MD Type's `name`, `memberDocument`, `sections`, `shape` (the type as
|
|
66
|
+
written with every `$defs` shape it reaches), the facts of its `frontmatter` and `fields`, its
|
|
67
|
+
top-level ones: JSON `type`, `format`, `values`, `reference` targets, `items`, `properties`, an open
|
|
68
|
+
map's `patterns` and `additional`, and `prose`, a string with no `enum`, `const`, `format`,
|
|
69
|
+
`pattern` or `reference`. Facts join `$ref` and `allOf` to their siblings and the variants of
|
|
70
|
+
`anyOf`, `oneOf`, `then`, `else` and `dependentSchemas`, a variant's own keys `conditional`; a path
|
|
71
|
+
without one `type`, `null` aside, has none. A malformed schema is refused whole, naming its `rule`,
|
|
72
|
+
the keyword or the model's own, and the JSON Pointer `location` it concerns, such as
|
|
73
|
+
`/plan/properties/status/enum`, or `line <n>` outside the YAML subset. `pointerFacts(definition,
|
|
74
|
+
pointer)` reads the facts a frontmatter pointer reaches, `itemFacts` and `memberFacts` take one step
|
|
75
|
+
and `crossedFacts` reads a list's item facts; `pointerSegments` and `escapePointer` split and write
|
|
76
|
+
a pointer, `ARRAY_INDEX` matches an index segment, and `ATTACHMENT` is the `reference` that admits
|
|
77
|
+
any path.
|
|
78
|
+
|
|
79
|
+
`validate(library, context?, model?)` takes the resulting text Library and one `ValidationContext`
|
|
80
|
+
of `binaryTargets: readonly string[]`, none when omitted. Library keys and binary targets share one
|
|
81
|
+
canonical collection-relative path namespace; a path declared text and binary is refused. House
|
|
82
|
+
declares every binary file of the Room as a binary target, and the model reads no bytes. Ordinary
|
|
83
|
+
links and images in typed Documents may resolve to either membership, relative to the source
|
|
84
|
+
Document, and one to a path neither holds is not refused: it dangles, as a deleted file's links do.
|
|
85
|
+
A destination that is an absolute path or leaves the collection is `unresolved-link`. A binary
|
|
86
|
+
target supplies no Document or MD Type. `model` is the verified schema that types the Library, and
|
|
87
|
+
every Library member is content, whatever its Path. Without `model` the Library declares no type.
|
|
88
|
+
|
|
89
|
+
A typed Document's frontmatter satisfies its type's schema, every keyword with its JSON Schema
|
|
90
|
+
meaning, formats asserted and defaults never filled, except that an object schema declaring neither
|
|
91
|
+
`additionalProperties` nor `unevaluatedProperties` is closed: an undeclared key is refused as
|
|
92
|
+
`undeclared- field`. `TYPE_FIELD`, `SITE_FIELD` and `RECEIVED_FIELD` count as declared on every
|
|
93
|
+
type, and the string `MEMBER_FIELD` on the `member_document` type; `HOUSE_FIELDS` lists the four. A
|
|
94
|
+
refusal names the keyword, such as `required`, and the value's JSON Pointer, such as
|
|
95
|
+
`/shipping/city`. Every occurrence of a declared list section is a list of values of its item
|
|
96
|
+
schema, else `structured-section`; a reference item is one ordinary link alone, such as
|
|
97
|
+
`- [Ada](ada.md)`. A reference, at any depth or a section item, reaching a URL, a binary target, or a
|
|
98
|
+
Document of a type it does not name is `unresolved-reference`, and a frontmatter one reaching no
|
|
99
|
+
member is `referenced-missing-file` naming its `referrers`; `attachment` admits any path, and no
|
|
100
|
+
body link is a referrer.
|
|
101
|
+
|
|
102
|
+
Validation returns acceptance or one refusal naming the file, the field or section, and the violated
|
|
103
|
+
rule. `parse`, `apply`, and `serialize` operate on a single text Document; they do not validate
|
|
104
|
+
collection membership or consume binary bytes. `apply` sets one typed field, including a list or an
|
|
105
|
+
object as a whole, replaces one existing section body or the preamble against that value's prior
|
|
106
|
+
content, or rewrites one Markdown link destination. A section need not be declared by the Document's
|
|
107
|
+
MD Type to be replaced. A section or preamble replacement that would hide a section the Document
|
|
108
|
+
carried behind a repeated, merged or fenced heading is refused as `overlapping-section` naming that
|
|
109
|
+
section. A field change does not reformat the rest of the file: an inline value is replaced where it
|
|
110
|
+
stands, and a value written after the key's line, an empty one or a block mapping or list, is
|
|
111
|
+
written after the key's colon in its place. A field holds a `FrontmatterValue`: null, a string, a
|
|
112
|
+
boolean, a finite number, a list without holes or a plain object of them, holding no cycle.
|
|
113
|
+
`frontmatterValue(value)` is that test, and `apply` refuses any other value as `frontmatter-fence`;
|
|
114
|
+
`equalValue(left, right)` compares two by value, whatever their key order, as `apply` compares a
|
|
115
|
+
field with its prior.
|
|
116
|
+
|
|
117
|
+
`Document.preamble` is a readonly string holding the exact source after frontmatter and before the
|
|
118
|
+
first section heading the section parser recognizes, `''` when empty, whitespace, newlines, a
|
|
119
|
+
leading H1 and any fenced text before the first section included. The closing frontmatter
|
|
120
|
+
delimiter and its line ending belong to frontmatter: `bodyAfterFrontmatter(content)` is the exact
|
|
121
|
+
source after them, the whole text when it opens no closed fence, and the preamble begins it.
|
|
122
|
+
`headingLines(content, from, to)` reads each ATX heading outside a fence, by `level` and `name`.
|
|
131
123
|
|
|
132
124
|
```ts
|
|
133
125
|
const parsed = parse(content);
|
|
@@ -142,15 +134,14 @@ if (parsed.ok) {
|
|
|
142
134
|
}
|
|
143
135
|
```
|
|
144
136
|
|
|
145
|
-
`apply(document, { kind: 'preamble', prior, value })` compares `prior` to the
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
and
|
|
150
|
-
and
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
field, section, and preamble edits keep their own prior values valid.
|
|
137
|
+
`apply(document, { kind: 'preamble', prior, value })` compares `prior` to the current preamble
|
|
138
|
+
exactly. A mismatch returns `{ outcome: 'stale', document }` with the unchanged current Document. A
|
|
139
|
+
match replaces only that source span, then parses a new immutable Document; the original is
|
|
140
|
+
unchanged. Frontmatter and section source outside the span retain their exact bytes, including
|
|
141
|
+
newline and heading syntax. As with section replacement, `value` is literal source: no newline or
|
|
142
|
+
separator is inserted, and the resulting source is parsed again. An invalid frontmatter result
|
|
143
|
+
receives the existing parse refusal. Independent field, section, and preamble edits keep their own
|
|
144
|
+
prior values valid.
|
|
154
145
|
|
|
155
146
|
For a moved link, use `links` and the `link` change below to obtain the rewritten Document, then
|
|
156
147
|
compare its public `preamble` and `sections` to the original. Submit the changed values with their
|
|
@@ -162,18 +153,27 @@ that resolve to a collection Path, each with the destination `href` exactly as w
|
|
|
162
153
|
`target` Path it resolves to relative to `file`. A `?query` or `#fragment` the destination carries
|
|
163
154
|
is part of `href` and not part of `target`. Entries are ordered by the position of the destination
|
|
164
155
|
text a rewrite would change, and one destination written the same way appears once however many
|
|
165
|
-
times it occurs. A destination that the syntax profile does not read as a link, one that is empty,
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
`target(file, href)` is the collection Path one written destination resolves to relative to
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
156
|
+
times it occurs. A destination that the syntax profile does not read as a link, one that is empty, a
|
|
157
|
+
bare fragment, or carries a URL scheme, and one that leaves the collection are not in the inventory.
|
|
158
|
+
Frontmatter values are never link destinations. `linkOccurrences(document, file)` places each
|
|
159
|
+
occurrence by its `start` in `content`, and `fieldStart(document, pointer)` a frontmatter value.
|
|
160
|
+
|
|
161
|
+
`target(file, href)` is the collection Path one written destination resolves to relative to `file`,
|
|
162
|
+
by the rule `links` and `validate` read: surrounding spaces and the `?query` or `#fragment` it
|
|
163
|
+
carries are not part of that Path. It reads backslash escapes and character references, strips as a
|
|
164
|
+
URL does, then percent-encodings, so `plan\.md`, `plan.md` and `pl%61n.md` all name `plan.md`;
|
|
165
|
+
an escaped or referenced `?` or `#` starts the suffix. A destination that is empty, a bare fragment,
|
|
166
|
+
carries a URL scheme, starts at `/` once read, encodes no UTF-8 text, or leaves the collection
|
|
167
|
+
resolves to `null`. It reads a destination written anywhere, such as a typed reference field value,
|
|
168
|
+
which `links` never enumerates. `retarget(href, to)` is that destination rewritten to `to`, keeping
|
|
169
|
+
the `?query` or `#fragment` it carried, which is the destination the `link` change below writes. It
|
|
170
|
+
percent-encodes in `to` what `target` would decode, so it resolves to `to` again.
|
|
171
|
+
|
|
172
|
+
`checkDocument(file, content, model)` reads one Document alone by the same rules: `ok: false` where
|
|
173
|
+
`validate` refuses it, else its `type`, whether it is `typed`, and each reference's `target` and
|
|
174
|
+
`to`, which `resolves(reference, typeOf, binary)` says reaches a member `validate` accepts.
|
|
175
|
+
`sectionReferences(file, content, definition)` reads only the references of its `list` sections.
|
|
176
|
+
`parseFrontmatter(content, file?)` is `parse` without the body: `content`, `type` and `fields`.
|
|
177
177
|
|
|
178
178
|
`references(document, definition)` lists each frontmatter `reference` string at any depth as
|
|
179
179
|
`pointer`, `value` and `to`; `apply(document, { kind: 'reference', pointer, value, prior })`
|
|
@@ -281,23 +281,19 @@ caller's number alone: the model holds no tokenizer, counts nothing else, and
|
|
|
281
281
|
refuses no input for being too long. A Document the caller supplies no
|
|
282
282
|
definition for carries the same `unknown-type` refusal `project` returns.
|
|
283
283
|
|
|
284
|
-
The division descends one level at a time, and only into the piece that does not
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
inside a single
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
heading
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
sentence level alone, where each Span after the first repeats its predecessor's
|
|
298
|
-
last sentence whenever the budget holds both; when it cannot hold both, the
|
|
299
|
-
Span carries its own sentence alone. An untyped input arrives without a
|
|
300
|
-
definition and descends the same ladder.
|
|
284
|
+
The division descends one level at a time, and only into the piece that does not fit: the whole
|
|
285
|
+
input, a heading node, adjacent sibling nodes packed under one parent, adjacent blocks inside a
|
|
286
|
+
node, sentences inside a block, and a bound cut inside a single sentence. A Span covers whole
|
|
287
|
+
heading nodes or one contiguous piece inside a single node, never a partial node beside another. A
|
|
288
|
+
Span that continues a node repeats that node's own heading line, projected like any other text and
|
|
289
|
+
so carrying an internal link's label rather than its destination, and never an ancestor's heading,
|
|
290
|
+
so renaming a heading costs what editing that heading's own body costs. A heading the budget cannot
|
|
291
|
+
hold beside any text is not repeated, a continuation piece that begins with an astral character the
|
|
292
|
+
room beside its heading cannot hold is carried without the heading, and a heading with no body of
|
|
293
|
+
its own leads its first child node rather than standing as a Span of nothing but itself. Overlap
|
|
294
|
+
exists at the sentence level alone, where each Span after the first repeats its predecessor's last
|
|
295
|
+
sentence whenever the budget holds both; when it cannot hold both, the Span carries its own sentence
|
|
296
|
+
alone. An untyped input arrives without a definition and descends the same ladder.
|
|
301
297
|
|
|
302
298
|
Division is total: every authored character of the input belongs to at least one
|
|
303
299
|
Span, and an input carrying no authored text divides into no Span at all. A
|
package/dist/blocks.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fenceSpans } from './links.js';
|
|
2
|
-
const HEADING = /^(#{1,6})(?!#)[ \t]+(.+?)[ \t]
|
|
2
|
+
const HEADING = /^(#{1,6})(?!#)[ \t]+(.+?)(?:[ \t]+#+)?[ \t]*$/;
|
|
3
3
|
function lineAt(content, from, to) {
|
|
4
4
|
const nl = content.indexOf('\n', from);
|
|
5
5
|
const end = nl === -1 || nl >= to ? to : nl;
|
package/dist/condition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.d.ts","sourceRoot":"","sources":["../src/condition.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAC;AAElF,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GAC1C;IAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,aAAa,EAAE,CAAA;CAAE,GAC1C;IAAE,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;CAAE,GAC/B,CAAC;IAAE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;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAO3F"}
|
package/dist/condition.js
CHANGED
|
@@ -444,6 +444,11 @@ function valueOf(fact) {
|
|
|
444
444
|
.sort()
|
|
445
445
|
.map((key) => [key, valueOf(fact.fields[key])]),
|
|
446
446
|
};
|
|
447
|
+
if (fact.kind === 'time') {
|
|
448
|
+
const at = instant(fact.value);
|
|
449
|
+
if (at !== undefined)
|
|
450
|
+
return { kind: fact.kind, at: String(at) };
|
|
451
|
+
}
|
|
447
452
|
return 'value' in fact ? { kind: fact.kind, value: fact.value } : fact;
|
|
448
453
|
}
|
|
449
454
|
function signature(reached) {
|
package/dist/definition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjG,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5B,QAAQ,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AG;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,CAK5D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAItF;AAqBD,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAc9F;AAmGD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,CAiChE"}
|
package/dist/definition.js
CHANGED
|
@@ -270,24 +270,43 @@ function united(left, right) {
|
|
|
270
270
|
return undefined;
|
|
271
271
|
return [...left, ...right.filter((value) => !left.some((held) => equalValue(held, value)))];
|
|
272
272
|
}
|
|
273
|
+
function both(left, right) {
|
|
274
|
+
return left !== undefined && right !== undefined ? joined(left, right) : undefined;
|
|
275
|
+
}
|
|
273
276
|
function joined(left, right) {
|
|
274
277
|
const type = left.type === right.type ? left.type : undefined;
|
|
275
278
|
const format = left.format === right.format ? left.format : undefined;
|
|
276
279
|
const values = united(left.values, right.values);
|
|
277
280
|
const reference = united(left.reference, right.reference);
|
|
278
|
-
const items = left.items
|
|
279
|
-
|
|
280
|
-
|
|
281
|
+
const items = both(left.items, right.items);
|
|
282
|
+
const prefix = left.prefix === undefined && right.prefix === undefined
|
|
283
|
+
? undefined
|
|
284
|
+
: Array.from({ length: Math.max(left.prefix?.length ?? 0, right.prefix?.length ?? 0) }, (_, index) => both(itemFacts(left, index), itemFacts(right, index)) ?? { prose: false });
|
|
285
|
+
const properties = Object.create(null);
|
|
286
|
+
for (const [name, facts] of Object.entries(left.properties ?? {})) {
|
|
287
|
+
const shared = both(facts, right.properties?.[name]);
|
|
288
|
+
if (shared !== undefined)
|
|
289
|
+
properties[name] = shared;
|
|
290
|
+
}
|
|
291
|
+
const patterns = (left.patterns ?? []).flatMap(({ pattern, facts }) => {
|
|
292
|
+
const shared = both(facts, right.patterns?.find((one) => one.pattern === pattern)?.facts);
|
|
293
|
+
return shared === undefined ? [] : [{ pattern, facts: shared }];
|
|
294
|
+
});
|
|
295
|
+
const additional = both(left.additional, right.additional);
|
|
281
296
|
return {
|
|
282
297
|
...(type === undefined ? {} : { type }),
|
|
283
298
|
...(format === undefined ? {} : { format }),
|
|
284
299
|
...(values === undefined ? {} : { values }),
|
|
285
300
|
...(reference === undefined ? {} : { reference }),
|
|
286
301
|
prose: left.prose && right.prose,
|
|
302
|
+
...(prefix === undefined ? {} : { prefix }),
|
|
287
303
|
...(items === undefined ? {} : { items }),
|
|
304
|
+
...(Object.keys(properties).length === 0 ? {} : { properties }),
|
|
305
|
+
...(patterns.length === 0 ? {} : { patterns }),
|
|
306
|
+
...(additional === undefined ? {} : { additional }),
|
|
288
307
|
};
|
|
289
308
|
}
|
|
290
|
-
function propertiesOf(held, defs, ancestry) {
|
|
309
|
+
function propertiesOf(held, variants, defs, ancestry) {
|
|
291
310
|
const declared = new Map();
|
|
292
311
|
for (const node of held) {
|
|
293
312
|
if (!isRecord(node.properties))
|
|
@@ -298,46 +317,87 @@ function propertiesOf(held, defs, ancestry) {
|
|
|
298
317
|
const properties = Object.create(null);
|
|
299
318
|
for (const [name, schemas] of declared)
|
|
300
319
|
properties[name] = factsOf(schemas, defs, ancestry);
|
|
301
|
-
const
|
|
302
|
-
for (const branch of
|
|
303
|
-
for (const [name, facts] of Object.entries(
|
|
320
|
+
const conditional = Object.create(null);
|
|
321
|
+
for (const branch of variants.values()) {
|
|
322
|
+
for (const [name, facts] of Object.entries(branch.properties ?? {})) {
|
|
304
323
|
if (Object.hasOwn(properties, name))
|
|
305
324
|
continue;
|
|
306
|
-
|
|
325
|
+
conditional[name] = Object.hasOwn(conditional, name)
|
|
326
|
+
? joined(conditional[name], facts)
|
|
327
|
+
: facts;
|
|
307
328
|
}
|
|
308
329
|
}
|
|
309
|
-
for (const [name, facts] of Object.entries(
|
|
330
|
+
for (const [name, facts] of Object.entries(conditional))
|
|
310
331
|
properties[name] = { ...facts, conditional: true };
|
|
311
332
|
return Object.keys(properties).length === 0 ? undefined : properties;
|
|
312
333
|
}
|
|
334
|
+
function nullOnly(facts) {
|
|
335
|
+
return facts.type === 'null' || (facts.values?.every((value) => value === null) ?? false);
|
|
336
|
+
}
|
|
337
|
+
function alternativesOf(held, variants) {
|
|
338
|
+
return held.flatMap((node) => [node.anyOf, node.oneOf].flatMap((branches) => {
|
|
339
|
+
if (!Array.isArray(branches))
|
|
340
|
+
return [];
|
|
341
|
+
const kept = branches
|
|
342
|
+
.flatMap((branch) => {
|
|
343
|
+
const facts = isRecord(branch) ? variants.get(branch) : undefined;
|
|
344
|
+
return facts === undefined ? [] : [facts];
|
|
345
|
+
})
|
|
346
|
+
.filter((facts) => !nullOnly(facts));
|
|
347
|
+
return kept.length === 0 ? [] : [kept];
|
|
348
|
+
}));
|
|
349
|
+
}
|
|
350
|
+
function inheritedOf(held) {
|
|
351
|
+
return held.flatMap((node) => {
|
|
352
|
+
const kept = Object.fromEntries(['type', 'items', 'prefixItems'].flatMap((key) => node[key] === undefined ? [] : [[key, node[key]]]));
|
|
353
|
+
return Object.keys(kept).length === 0 ? [] : [kept];
|
|
354
|
+
});
|
|
355
|
+
}
|
|
313
356
|
function factsOf(nodes, defs, ancestry) {
|
|
314
357
|
const { held, ancestry: reached } = conjoined(nodes, defs, ancestry);
|
|
315
|
-
const
|
|
358
|
+
const inherited = inheritedOf(held);
|
|
359
|
+
const variants = new Map(held
|
|
360
|
+
.flatMap(variantsOf)
|
|
361
|
+
.map((branch) => [branch, factsOf([branch, ...inherited], defs, reached)]));
|
|
362
|
+
const unions = alternativesOf(held, variants);
|
|
363
|
+
const alternatives = unions.map((kept) => kept.reduce(joined));
|
|
364
|
+
const listed = [
|
|
365
|
+
...held.flatMap((node) => Array.isArray(node.enum) ? [node.enum] : node.const !== undefined ? [[node.const]] : []),
|
|
366
|
+
...alternatives.flatMap((facts) => (facts.values === undefined ? [] : [facts.values])),
|
|
367
|
+
];
|
|
316
368
|
const values = listed.length === 0
|
|
317
369
|
? undefined
|
|
318
370
|
: listed.reduce((kept, list) => kept.filter((value) => list.some((other) => equalValue(other, value))));
|
|
319
371
|
const type = firstOf(held, (node) => singleType(node.type)) ??
|
|
320
|
-
(values === undefined ? undefined : sharedType(values))
|
|
372
|
+
(values === undefined ? undefined : sharedType(values)) ??
|
|
373
|
+
alternatives.find((facts) => facts.type !== undefined)?.type;
|
|
321
374
|
const reference = firstOf(held, (node) => typeof node.reference === 'string'
|
|
322
375
|
? [node.reference]
|
|
323
376
|
: Array.isArray(node.reference)
|
|
324
377
|
? node.reference
|
|
325
|
-
: undefined);
|
|
326
|
-
const format = firstOf(held, (node) => typeof node.format === 'string' ? node.format : undefined)
|
|
378
|
+
: undefined) ?? alternatives.find((facts) => facts.reference !== undefined)?.reference;
|
|
379
|
+
const format = firstOf(held, (node) => (typeof node.format === 'string' ? node.format : undefined)) ??
|
|
380
|
+
alternatives.find((facts) => facts.format !== undefined)?.format;
|
|
327
381
|
const prose = type === 'string' &&
|
|
328
382
|
values === undefined &&
|
|
329
383
|
format === undefined &&
|
|
330
384
|
reference === undefined &&
|
|
331
|
-
held.every((node) => node.pattern === undefined)
|
|
385
|
+
held.every((node) => node.pattern === undefined) &&
|
|
386
|
+
unions.every((kept) => kept.every((facts) => facts.type !== 'string' || facts.prose));
|
|
332
387
|
const listedItems = held.flatMap((node) => (node.items === undefined ? [] : [node.items]));
|
|
333
|
-
const items = type
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
388
|
+
const items = type !== 'array'
|
|
389
|
+
? undefined
|
|
390
|
+
: (alternatives.find((facts) => facts.items !== undefined)?.items ??
|
|
391
|
+
(listedItems.length > 0 ? factsOf(listedItems, defs, reached) : undefined));
|
|
392
|
+
const tuples = held.flatMap((node) => Array.isArray(node.prefixItems) ? [node.prefixItems] : []);
|
|
393
|
+
const prefix = type !== 'array'
|
|
394
|
+
? undefined
|
|
395
|
+
: (alternatives.find((facts) => facts.prefix !== undefined)?.prefix ??
|
|
396
|
+
(tuples.length === 0
|
|
397
|
+
? undefined
|
|
398
|
+
: Array.from({ length: Math.max(...tuples.map((tuple) => tuple.length)) }, (_, index) => factsOf(tuples.flatMap((tuple) => (index < tuple.length ? [tuple[index]] : [])), defs, reached))));
|
|
339
399
|
const mapped = type === 'object' || type === undefined;
|
|
340
|
-
const properties = mapped ? propertiesOf(held, defs, reached) : undefined;
|
|
400
|
+
const properties = mapped ? propertiesOf(held, variants, defs, reached) : undefined;
|
|
341
401
|
const patterns = mapped
|
|
342
402
|
? held.flatMap((node) => Object.entries(isRecord(node.patternProperties) ? node.patternProperties : {}).map(([pattern, schema]) => ({ pattern, facts: factsOf([schema], defs, reached) })))
|
|
343
403
|
: [];
|
package/dist/document.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { ApplyResult, BodyResult, Change, Document, Link, ParseResult } from './types.js';
|
|
2
|
+
import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, LinkOccurrence, ParseResult } from './types.js';
|
|
3
3
|
import { type YamlMap } from './yaml.js';
|
|
4
|
+
export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
|
|
4
5
|
export declare function parse(content: string, file?: string): ParseResult;
|
|
5
6
|
export declare function relativize(document: Document, file: string, handle: string, definition?: Definition): ApplyResult;
|
|
6
7
|
export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
|
|
7
8
|
export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
|
|
8
9
|
export declare function links(document: Document, file: string): readonly Link[];
|
|
10
|
+
export declare function linkOccurrences(document: Document, file: string): readonly LinkOccurrence[];
|
|
9
11
|
export declare function bodyLinks(body: string, file: string): readonly Link[];
|
|
10
12
|
export declare function apply(document: Document, change: Change): ApplyResult;
|
|
11
13
|
export declare function serialize(document: Document): string;
|
|
14
|
+
export declare function fieldStart(document: Document, pointer: string): number | undefined;
|
|
12
15
|
export declare function frontmatter(document: Document): YamlMap | null;
|
|
13
16
|
//# sourceMappingURL=document.d.ts.map
|
package/dist/document.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMhF,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EAEZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAaL,KAAK,OAAO,EAEb,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAMhF,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,cAAc,EACd,WAAW,EAEZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAaL,KAAK,OAAO,EAEb,MAAM,WAAW,CAAC;AAmEnB,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,iBAAiB,CAW9E;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,WAAW,CAgB7D;AAqMD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,GACtB,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