@agentshouse/mdmodel 0.1.0-c896b3d9398b1 → 0.1.0-cad192ab63d5f

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 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
- JSON Schema document (draft 2020-12) in the YAML subset. Every top-level key but
46
- `$defs` names an MD Type holding the JSON Schema of its frontmatter; `$defs`
47
- holds shapes the types reuse, reached by a `$ref` under `#/$defs/` alone. `type`
48
- and the built-in `any` are never declared. The model adds three keywords:
49
- `reference` on a string names one MD Type, several, `any` or `attachment`;
50
- `sections` declares a type's H2 sections, each `{ kind: text }` or `{ kind:
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,64 +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
- `shape` (the type as written with every `$defs` shape it reaches), the facts of
69
- its `frontmatter` and `fields`, its top-level ones: JSON `type`, `format`,
70
- `values`, `reference` targets, `items`, `properties`, an open map's `patterns`
71
- and `additional`, and `prose`, a string with no `enum`, `const`, `format`,
72
- `pattern` or `reference`. Facts join `$ref` and `allOf` to their siblings and
73
- the variants of `anyOf`, `oneOf`, `then`, `else` and `dependentSchemas`, a
74
- variant's own keys `conditional`; a path without one `type`, `null` aside, has
75
- none. A malformed schema is refused whole, naming its `rule`, the keyword or the
76
- model's own, and the JSON Pointer `location` it concerns, such as
77
- `/plan/properties/status/enum`, or `line <n>` outside the YAML subset.
78
- `pointerFacts(definition, pointer)` reads the facts a frontmatter pointer reaches,
79
- `itemFacts` and `memberFacts` take one step and `crossedFacts` reads a list's item
80
- facts; `pointerSegments` and `escapePointer` split and write a pointer, `ARRAY_INDEX`
81
- matches an index segment, and `ATTACHMENT` is the `reference` that admits any path.
82
-
83
- `validate(library, context?, model?)` takes the resulting text Library and one
84
- `ValidationContext` of `binaryTargets: readonly string[]`, none when omitted.
85
- Library keys and binary targets share one canonical collection-relative path
86
- namespace; a path declared text and binary is refused. House declares every
87
- binary file of the Room as a binary target, and the model reads no bytes. Ordinary links and images
88
- in typed Documents may resolve to either membership, relative to the source
89
- Document, and one to a path neither holds is not refused: it dangles, as a
90
- deleted file's links do. A destination that is an absolute path or leaves the
91
- collection is `unresolved-link`. A binary target supplies no Document or MD Type. `model` is the
92
- verified schema that types the Library, and every Library member is content,
93
- whatever its Path. Without `model` the Library declares no type.
94
-
95
- A typed Document's frontmatter satisfies its type's schema, every keyword with
96
- its JSON Schema meaning, formats asserted and defaults never filled, except that
97
- an object schema declaring neither `additionalProperties` nor
98
- `unevaluatedProperties` is closed: an undeclared key is refused as `undeclared-
99
- field`. `type`, `SITE_FIELD` and `RECEIVED_FIELD` count as declared on every
100
- type, and the string `MEMBER_FIELD` on the `member_document` type. A refusal
101
- names the keyword, such as `required`, and the value's JSON Pointer, such as
102
- `/shipping/city`. Every occurrence of a declared list section is a list of
103
- values of its item schema, else `structured-section`; a reference item is one
104
- ordinary link alone, such as `- [Ada](ada.md)`. A reference, at any depth or a
105
- section item, reaching a URL, a binary target, or a Document of a type it does
106
- not name is `unresolved-reference`, and a frontmatter one reaching no member is
107
- `referenced-missing-file` naming its `referrers`; `attachment` admits any path,
108
- and no body link is a referrer.
109
-
110
- Validation returns acceptance or one refusal naming the file, the field or
111
- section, and the violated rule. `parse`, `apply`, and `serialize` operate on a single text
112
- Document; they do not validate collection membership or consume binary bytes.
113
- `apply` sets one typed field, including a list field as a whole, replaces
114
- one existing section body or the preamble against that value's prior content,
115
- or rewrites one Markdown link destination. A section need not be declared by
116
- the Document's MD Type to be replaced. A field change does not reformat the rest of the file.
117
-
118
- `Document.preamble` is a readonly string containing the exact source after
119
- frontmatter and before the first section heading recognized by the existing
120
- section parser. Without a section it is the entire post-frontmatter body;
121
- without frontmatter it starts at the beginning of the Document. An empty span
122
- is `''`. It includes whitespace, newlines, a leading H1, and any fenced text
123
- before the first section. The closing frontmatter delimiter and its line ending
124
- 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 containing the exact source after frontmatter and before
118
+ the first section heading recognized by the existing section parser. Without a section it is the
119
+ entire post-frontmatter body; without frontmatter it starts at the beginning of the Document. An
120
+ empty span is `''`. It includes whitespace, newlines, a leading H1, and any fenced text before the
121
+ first section. The closing frontmatter delimiter and its line ending belong to frontmatter.
122
+ `headingLines(content, from, to)` reads each ATX heading outside a fence, by `level` and `name`.
125
123
 
126
124
  ```ts
127
125
  const parsed = parse(content);
@@ -136,15 +134,14 @@ if (parsed.ok) {
136
134
  }
137
135
  ```
138
136
 
139
- `apply(document, { kind: 'preamble', prior, value })` compares `prior` to the
140
- current preamble exactly. A mismatch returns `{ outcome: 'stale', document }`
141
- with the unchanged current Document. A match replaces only that source span,
142
- then parses a new immutable Document; the original is unchanged. Frontmatter
143
- and section source outside the span retain their exact bytes, including newline
144
- and heading syntax. As with section replacement, `value` is literal source:
145
- no newline or separator is inserted, and the resulting source is parsed again.
146
- An invalid frontmatter result receives the existing parse refusal. Independent
147
- 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.
148
145
 
149
146
  For a moved link, use `links` and the `link` change below to obtain the rewritten Document, then
150
147
  compare its public `preamble` and `sections` to the original. Submit the changed values with their
@@ -156,18 +153,27 @@ that resolve to a collection Path, each with the destination `href` exactly as w
156
153
  `target` Path it resolves to relative to `file`. A `?query` or `#fragment` the destination carries
157
154
  is part of `href` and not part of `target`. Entries are ordered by the position of the destination
158
155
  text a rewrite would change, and one destination written the same way appears once however many
159
- times it occurs. A destination that the syntax profile does not read as a link, one that is empty,
160
- a bare fragment, or carries a URL scheme, and one that leaves the collection are not in the
161
- inventory. Frontmatter field values, including typed references, are not link destinations and
162
- are never enumerated.
163
-
164
- `target(file, href)` is the collection Path one written destination resolves to relative to
165
- `file`, by the rule `links` and `validate` read: surrounding spaces and the `?query` or `#fragment`
166
- it carries are not part of that Path. A destination that is empty, a bare fragment, carries a URL
167
- scheme, starts at `/`, or leaves the collection resolves to `null`. It reads a destination written
168
- anywhere, such as a typed reference field value, which `links` never enumerates.
169
- `retarget(href, to)` is that destination rewritten to `to`, keeping the `?query` or `#fragment` it
170
- carried, which is the destination the `link` change below writes.
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`, `pl&#97;n.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`.
171
177
 
172
178
  `references(document, definition)` lists each frontmatter `reference` string at any depth as
173
179
  `pointer`, `value` and `to`; `apply(document, { kind: 'reference', pointer, value, prior })`
@@ -275,23 +281,19 @@ caller's number alone: the model holds no tokenizer, counts nothing else, and
275
281
  refuses no input for being too long. A Document the caller supplies no
276
282
  definition for carries the same `unknown-type` refusal `project` returns.
277
283
 
278
- The division descends one level at a time, and only into the piece that does not
279
- fit: the whole input, a heading node, adjacent sibling nodes packed under one
280
- parent, adjacent blocks inside a node, sentences inside a block, and a bound cut
281
- inside a single sentence. A Span covers whole heading nodes or one contiguous
282
- piece inside a single node, never a partial node beside another. A Span that
283
- continues a node repeats that node's own heading line, projected like any other
284
- text and so carrying an internal link's label rather than its destination, and
285
- never an ancestor's heading, so renaming a heading costs what editing that
286
- heading's own body costs. A heading the budget cannot hold beside any text is
287
- not repeated, a continuation piece that begins with an astral character the
288
- room beside its heading cannot hold is carried without the heading, and a
289
- heading with no body of its own leads its first child node rather than standing
290
- as a Span of nothing but itself. Overlap exists at the
291
- sentence level alone, where each Span after the first repeats its predecessor's
292
- last sentence whenever the budget holds both; when it cannot hold both, the
293
- Span carries its own sentence alone. An untyped input arrives without a
294
- 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.
295
297
 
296
298
  Division is total: every authored character of the input belongs to at least one
297
299
  Span, and an input carrying no authored text divides into no Span at all. A
@@ -353,3 +355,5 @@ over `/delivery`, `/source`, `/provider`, `/container`, `/author`, `/has_attachm
353
355
  the prose and section paths whose text builds `changed`; `pointed(value, pointer)` reads a JSON
354
356
  Pointer, `undefined` where nothing is; `dated(value)` checks a `YYYY-MM-DD` date, and
355
357
  `instant(value)` reads an RFC 3339 time with its offset as epoch nanoseconds, a `bigint`.
358
+ `datePointers(fields)` lists, sorted, the `/fields/<name>` pointers of a type's date fields, the
359
+ only values a `DateCondition`'s `date` takes.
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAmCF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CAiBrF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAe/E"}
1
+ {"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAqCF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CA+BrF;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAe/E"}
package/dist/blocks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { fenceSpans } from './links.js';
2
- const HEADING = /^(#{1,6})(?!#)[ \t]+(.+?)[ \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;
@@ -23,24 +23,38 @@ function scan(content, from, to, visit) {
23
23
  i = next;
24
24
  }
25
25
  }
26
+ const HASH = 0x23;
26
27
  export function headingLines(content, from, to) {
27
28
  const found = [];
28
- scan(content, from, to, (line) => {
29
- if (line.fenced)
30
- return;
31
- const match = HEADING.exec(line.text);
32
- const hashes = match?.[1];
33
- const name = match?.[2];
34
- if (hashes === undefined || name === undefined)
35
- return;
36
- found.push({
37
- level: hashes.length,
38
- name: name.trim(),
39
- start: line.start,
40
- textEnd: line.start + line.text.length,
41
- next: line.next,
42
- });
43
- });
29
+ let fences = null;
30
+ let i = from;
31
+ while (i < to) {
32
+ const nl = content.indexOf('\n', i);
33
+ const end = nl === -1 || nl >= to ? to : nl;
34
+ const next = end === to ? to : end + 1;
35
+ if (content.charCodeAt(i) === HASH) {
36
+ fences ??= fenceSpans(content.slice(from, to));
37
+ const at = i - from;
38
+ if (!fences.some(([start, stop]) => at >= start && at < stop)) {
39
+ const { text } = lineAt(content, i, to);
40
+ const match = HEADING.exec(text);
41
+ const hashes = match?.[1];
42
+ const name = match?.[2];
43
+ if (hashes !== undefined && name !== undefined) {
44
+ found.push({
45
+ level: hashes.length,
46
+ name: name.trim(),
47
+ start: i,
48
+ textEnd: i + text.length,
49
+ next,
50
+ });
51
+ }
52
+ }
53
+ }
54
+ if (next === i)
55
+ break;
56
+ i = next;
57
+ }
44
58
  return found;
45
59
  }
46
60
  export function blockRanges(content, from, to) {
@@ -139,6 +139,7 @@ export declare function facts(document: Document, at: {
139
139
  readonly path: string;
140
140
  }, model: VerifiedModel, resolve: (target: string) => Resolved | undefined): DocumentFacts;
141
141
  export declare function prosePaths(facts: DocumentFacts): string[];
142
+ export declare function datePointers(fields: Readonly<Record<string, ValueFacts>>): string[];
142
143
  export declare function dated(value: unknown): value is string;
143
144
  export declare function instant(value: unknown): bigint | undefined;
144
145
  export declare function pointed(value: unknown, pointer: string): unknown;
@@ -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,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G,KAAK,IAAI,MAAM,CAIrD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgC1D;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAehE;AAmJD,wBAAgB,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,KAAK,CAExF;AAyFD,wBAAgB,KAAK,CAAC,SAAS,EAAE,iBAAiB,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAehG;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAO3F"}
package/dist/condition.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ARRAY_INDEX, escapePointer, fieldFacts, itemFacts, memberFacts, pointerSegments, } from './definition.js';
2
2
  import { target } from './paths.js';
3
- import { isRecord } from './yaml.js';
3
+ import { isRecord, plain } from './yaml.js';
4
4
  export const WRITE_DOORS = ['browser', 'agent', 'client'];
5
5
  const PROSE = { kind: 'prose' };
6
6
  const NULL = { kind: 'null' };
@@ -205,11 +205,11 @@ function readActor(actor, path) {
205
205
  : undefined;
206
206
  return value === undefined ? undefined : single({ kind: 'actor', value });
207
207
  }
208
- function plain(value) {
209
- if (!isRecord(value))
210
- return false;
211
- const prototype = Object.getPrototypeOf(value);
212
- return prototype === Object.prototype || prototype === null;
208
+ export function datePointers(fields) {
209
+ return Object.entries(fields)
210
+ .filter(([, facts]) => facts.type === 'string' && facts.format === 'date')
211
+ .map(([name]) => `/fields/${name}`)
212
+ .sort();
213
213
  }
214
214
  export function dated(value) {
215
215
  return (typeof value === 'string' && DATE.test(value) && instant(`${value}T00:00:00Z`) !== undefined);
@@ -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) {
@@ -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,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAC3D,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,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B,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACtC;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAiC/D;AA6ZD,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,UAAU,CAE7F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAElF;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAKlF;AAED,MAAM,MAAM,YAAY,GAAG;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"}
@@ -1,4 +1,4 @@
1
- import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD } from './fields.js';
1
+ import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
2
2
  import { equalValue, isRecord, jsValue, parseYamlMapping, YamlError } from './yaml.js';
3
3
  export const JSON_TYPES = [
4
4
  'string',
@@ -16,7 +16,7 @@ const DEFS_REFERENCE = '#/$defs/';
16
16
  const UNRESOLVED = /[\u0000-\u001f\u007f%[\]\\^{|}]|\s$/u;
17
17
  export const ARRAY_INDEX = /^(?:0|[1-9][0-9]*)$/u;
18
18
  const HOUSE_KEYS = {
19
- type: { prose: false },
19
+ [TYPE_FIELD]: { prose: false },
20
20
  [SITE_FIELD]: { prose: false },
21
21
  [RECEIVED_FIELD]: { prose: false },
22
22
  };
@@ -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 !== undefined && right.items !== undefined
279
- ? joined(left.items, right.items)
280
- : undefined;
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 variants = Object.create(null);
302
- for (const branch of held.flatMap(variantsOf)) {
303
- for (const [name, facts] of Object.entries(factsOf([branch], defs, ancestry).properties ?? {})) {
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
- variants[name] = Object.hasOwn(variants, name) ? joined(variants[name], facts) : facts;
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(variants))
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 listed = held.flatMap((node) => Array.isArray(node.enum) ? [node.enum] : node.const !== undefined ? [[node.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 === 'array' && listedItems.length > 0 ? factsOf(listedItems, defs, reached) : undefined;
334
- const prefix = type === 'array'
335
- ? firstOf(held, (node) => Array.isArray(node.prefixItems)
336
- ? node.prefixItems.map((schema) => factsOf([schema], defs, reached))
337
- : undefined)
338
- : undefined;
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
  : [];