@agentshouse/mdmodel 0.1.0-c0d316445d94f → 0.1.0-c2224db91aaa3
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 +129 -68
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +31 -17
- package/dist/condition.d.ts +1 -0
- package/dist/condition.d.ts.map +1 -1
- package/dist/condition.js +11 -6
- package/dist/definition.js +2 -2
- package/dist/document.d.ts +3 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +53 -25
- package/dist/fields.d.ts +2 -0
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +7 -0
- 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/schema.js +2 -2
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +19 -25
- package/dist/yaml.d.ts +7 -3
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +72 -43
- package/fixtures/README.md +1 -1
- package/package.json +4 -2
package/API.md
CHANGED
|
@@ -38,6 +38,9 @@ if (parsed.ok) {
|
|
|
38
38
|
}
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
`MARKDOWN_SYNTAX_PROFILE` is the Markdown every reader here applies, GitHub Flavored Markdown
|
|
42
|
+
0.29, and `VERSION` is the MD model version.
|
|
43
|
+
|
|
41
44
|
`verify(schema)` reads one schema text, the MD Types of one Room or App: one
|
|
42
45
|
JSON Schema document (draft 2020-12) in the YAML subset. Every top-level key but
|
|
43
46
|
`$defs` names an MD Type holding the JSON Schema of its frontmatter; `$defs`
|
|
@@ -72,6 +75,10 @@ variant's own keys `conditional`; a path without one `type`, `null` aside, has
|
|
|
72
75
|
none. A malformed schema is refused whole, naming its `rule`, the keyword or the
|
|
73
76
|
model's own, and the JSON Pointer `location` it concerns, such as
|
|
74
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.
|
|
75
82
|
|
|
76
83
|
`validate(library, context?, model?)` takes the resulting text Library and one
|
|
77
84
|
`ValidationContext` of `binaryTargets: readonly string[]`, none when omitted.
|
|
@@ -85,36 +92,40 @@ collection is `unresolved-link`. A binary target supplies no Document or MD Type
|
|
|
85
92
|
verified schema that types the Library, and every Library member is content,
|
|
86
93
|
whatever its Path. Without `model` the Library declares no type.
|
|
87
94
|
|
|
88
|
-
A typed Document's frontmatter satisfies its type's schema, every keyword with
|
|
89
|
-
|
|
90
|
-
an
|
|
91
|
-
`
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
95
|
+
A typed Document's frontmatter satisfies its type's schema, every keyword with its JSON Schema
|
|
96
|
+
meaning, formats asserted and defaults never filled, except that an object schema declaring neither
|
|
97
|
+
`additionalProperties` nor `unevaluatedProperties` is closed: an undeclared key is refused as
|
|
98
|
+
`undeclared- field`. `TYPE_FIELD`, `SITE_FIELD` and `RECEIVED_FIELD` count as declared on every
|
|
99
|
+
type, and the string `MEMBER_FIELD` on the `member_document` type; `HOUSE_FIELDS` lists the four. A
|
|
100
|
+
refusal names the keyword, such as `required`, and the value's JSON Pointer, such as
|
|
101
|
+
`/shipping/city`. Every occurrence of a declared list section is a list of values of its item
|
|
102
|
+
schema, else `structured-section`; a reference item is one ordinary link alone, such as
|
|
103
|
+
`- [Ada](ada.md)`. A reference, at any depth or a section item, reaching a URL, a binary target, or a
|
|
104
|
+
Document of a type it does not name is `unresolved-reference`, and a frontmatter one reaching no
|
|
105
|
+
member is `referenced-missing-file` naming its `referrers`; `attachment` admits any path, and no
|
|
106
|
+
body link is a referrer.
|
|
107
|
+
|
|
108
|
+
Validation returns acceptance or one refusal naming the file, the field or section, and the violated
|
|
109
|
+
rule. `parse`, `apply`, and `serialize` operate on a single text Document; they do not validate
|
|
110
|
+
collection membership or consume binary bytes. `apply` sets one typed field, including a list or an
|
|
111
|
+
object as a whole, replaces one existing section body or the preamble against that value's prior
|
|
112
|
+
content, or rewrites one Markdown link destination. A section need not be declared by the Document's
|
|
113
|
+
MD Type to be replaced. A section or preamble replacement that would hide a section the Document
|
|
114
|
+
carried behind a repeated, merged or fenced heading is refused as `overlapping-section` naming that
|
|
115
|
+
section. A field change does not reformat the rest of the file: an inline value is replaced where it
|
|
116
|
+
stands, and a value written after the key's line, an empty one or a block mapping or list, is
|
|
117
|
+
written after the key's colon in its place. A field holds a `FrontmatterValue`: null, a string, a
|
|
118
|
+
boolean, a finite number, a list without holes or a plain object of them, holding no cycle.
|
|
119
|
+
`frontmatterValue(value)` is that test, and `apply` refuses any other value as `frontmatter-fence`;
|
|
120
|
+
`equalValue(left, right)` compares two by value, whatever their key order, as `apply` compares a
|
|
121
|
+
field with its prior.
|
|
122
|
+
|
|
123
|
+
`Document.preamble` is a readonly string containing the exact source after frontmatter and before
|
|
124
|
+
the first section heading recognized by the existing section parser. Without a section it is the
|
|
125
|
+
entire post-frontmatter body; without frontmatter it starts at the beginning of the Document. An
|
|
126
|
+
empty span is `''`. It includes whitespace, newlines, a leading H1, and any fenced text before the
|
|
127
|
+
first section. The closing frontmatter delimiter and its line ending belong to frontmatter. Section
|
|
128
|
+
recognition and the syntax profile are unchanged.
|
|
118
129
|
|
|
119
130
|
```ts
|
|
120
131
|
const parsed = parse(content);
|
|
@@ -129,15 +140,14 @@ if (parsed.ok) {
|
|
|
129
140
|
}
|
|
130
141
|
```
|
|
131
142
|
|
|
132
|
-
`apply(document, { kind: 'preamble', prior, value })` compares `prior` to the
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
and
|
|
137
|
-
and
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
field, section, and preamble edits keep their own prior values valid.
|
|
143
|
+
`apply(document, { kind: 'preamble', prior, value })` compares `prior` to the current preamble
|
|
144
|
+
exactly. A mismatch returns `{ outcome: 'stale', document }` with the unchanged current Document. A
|
|
145
|
+
match replaces only that source span, then parses a new immutable Document; the original is
|
|
146
|
+
unchanged. Frontmatter and section source outside the span retain their exact bytes, including
|
|
147
|
+
newline and heading syntax. As with section replacement, `value` is literal source: no newline or
|
|
148
|
+
separator is inserted, and the resulting source is parsed again. An invalid frontmatter result
|
|
149
|
+
receives the existing parse refusal. Independent field, section, and preamble edits keep their own
|
|
150
|
+
prior values valid.
|
|
141
151
|
|
|
142
152
|
For a moved link, use `links` and the `link` change below to obtain the rewritten Document, then
|
|
143
153
|
compare its public `preamble` and `sections` to the original. Submit the changed values with their
|
|
@@ -149,18 +159,21 @@ that resolve to a collection Path, each with the destination `href` exactly as w
|
|
|
149
159
|
`target` Path it resolves to relative to `file`. A `?query` or `#fragment` the destination carries
|
|
150
160
|
is part of `href` and not part of `target`. Entries are ordered by the position of the destination
|
|
151
161
|
text a rewrite would change, and one destination written the same way appears once however many
|
|
152
|
-
times it occurs. A destination that the syntax profile does not read as a link, one that is empty,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
`target(file, href)` is the collection Path one written destination resolves to relative to
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
times it occurs. A destination that the syntax profile does not read as a link, one that is empty, a
|
|
163
|
+
bare fragment, or carries a URL scheme, and one that leaves the collection are not in the inventory.
|
|
164
|
+
Frontmatter field values, including typed references, are not link destinations and are never
|
|
165
|
+
enumerated. `linkOccurrences(document, file)` lists each occurrence with its `start` in `content`.
|
|
166
|
+
|
|
167
|
+
`target(file, href)` is the collection Path one written destination resolves to relative to `file`,
|
|
168
|
+
by the rule `links` and `validate` read: surrounding spaces and the `?query` or `#fragment` it
|
|
169
|
+
carries are not part of that Path. It reads backslash escapes and character references, strips as a
|
|
170
|
+
URL does, then percent-encodings, so `plan\.md`, `plan.md` and `pl%61n.md` all name `plan.md`;
|
|
171
|
+
an escaped or referenced `?` or `#` starts the suffix. A destination that is empty, a bare fragment,
|
|
172
|
+
carries a URL scheme, starts at `/` once read, encodes no UTF-8 text, or leaves the collection
|
|
173
|
+
resolves to `null`. It reads a destination written anywhere, such as a typed reference field value,
|
|
174
|
+
which `links` never enumerates. `retarget(href, to)` is that destination rewritten to `to`, keeping
|
|
175
|
+
the `?query` or `#fragment` it carried, which is the destination the `link` change below writes. It
|
|
176
|
+
percent-encodes in `to` what `target` would decode, so it resolves to `to` again.
|
|
164
177
|
|
|
165
178
|
`references(document, definition)` lists each frontmatter `reference` string at any depth as
|
|
166
179
|
`pointer`, `value` and `to`; `apply(document, { kind: 'reference', pointer, value, prior })`
|
|
@@ -268,23 +281,19 @@ caller's number alone: the model holds no tokenizer, counts nothing else, and
|
|
|
268
281
|
refuses no input for being too long. A Document the caller supplies no
|
|
269
282
|
definition for carries the same `unknown-type` refusal `project` returns.
|
|
270
283
|
|
|
271
|
-
The division descends one level at a time, and only into the piece that does not
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
inside a single
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
heading
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
sentence level alone, where each Span after the first repeats its predecessor's
|
|
285
|
-
last sentence whenever the budget holds both; when it cannot hold both, the
|
|
286
|
-
Span carries its own sentence alone. An untyped input arrives without a
|
|
287
|
-
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.
|
|
288
297
|
|
|
289
298
|
Division is total: every authored character of the input belongs to at least one
|
|
290
299
|
Span, and an input carrying no authored text divides into no Span at all. A
|
|
@@ -296,3 +305,55 @@ author quoted. A Span divided out of one free-text field value addresses that
|
|
|
296
305
|
whole value, because a YAML scalar's own positions are the only ones its source
|
|
297
306
|
has, and a Span carrying part of one internal link's label addresses that whole
|
|
298
307
|
link, because a cut never falls inside link syntax.
|
|
308
|
+
|
|
309
|
+
## Conditions
|
|
310
|
+
|
|
311
|
+
`facts(document, { id, path }, model, resolve)` reads one Document as the `DocumentFacts` a
|
|
312
|
+
condition tests: its `id`, its `path` with a leading `/`, its `type` or `null`, its `sections`, and
|
|
313
|
+
a `Fact` for each frontmatter field it writes that its MD Type declares. `factKind(facts)` names
|
|
314
|
+
the kind a declared value compares as: `reference`, `enum`, `number`, `boolean`, `date`, `time`
|
|
315
|
+
(a `date-time`) or `string`, else `null`. A prose value, or one of no kind, is `prose`, a list or
|
|
316
|
+
an object holds the facts of its members, and a value written `null` is `null`. A value that does
|
|
317
|
+
not fit its kind, such as a string in a number field, a value outside its `enum` or a reference
|
|
318
|
+
`resolve` maps to no `{ id, member? }`, is `unreadable`; a readable reference compares as that `id`.
|
|
319
|
+
|
|
320
|
+
`holds(test, facts, owner)` is `true`, `false` or `undefined`, unknown; a Trigger fires on `true`
|
|
321
|
+
alone. A test's `path` is `/path`, `/type`, `/sections/<heading>`, `/fields/<pointer>`, or
|
|
322
|
+
`/members/<pointer>`, the member of the Document a reference field reaches. A pointer segment that
|
|
323
|
+
is not an index reads every item of a list, an item lacking it unknown, and a test over several
|
|
324
|
+
values holds as `any` does. The value `{ owner: true }` stands for `owner`, a User id.
|
|
325
|
+
|
|
326
|
+
| The path reaches | `exists` | `contains` | any other test |
|
|
327
|
+
| --------------------------------------- | ----------- | -------------- | -------------- |
|
|
328
|
+
| a value | present | `undefined` | compared |
|
|
329
|
+
| `null`, prose or a section | present | `undefined` | `undefined` |
|
|
330
|
+
| a list | present | `any` of items | `undefined` |
|
|
331
|
+
| no item, through an empty list | absent | `false` | `false` |
|
|
332
|
+
| nothing: no such field, section or type | absent | `undefined` | `undefined` |
|
|
333
|
+
| only unreadable values | `undefined` | `undefined` | `undefined` |
|
|
334
|
+
|
|
335
|
+
`exists: true` holds where present and fails where absent, `exists: false` the reverse. `all` is
|
|
336
|
+
`false` if a part is, else `undefined` if a part is; `any` is `true` if a part is, else `undefined`
|
|
337
|
+
if a part is; `not` keeps `undefined`, so absence is tested with `exists`, never with `not`. `eq`
|
|
338
|
+
and `in` are `undefined` against a value of another JSON type and compare a `time` as an instant;
|
|
339
|
+
`prefix` reads only a string, never a reference or a member; `gt`, `gte`, `lt` and `lte` order
|
|
340
|
+
numbers, dates and times alone.
|
|
341
|
+
|
|
342
|
+
`fires(condition, event, owner)` reads one change, `{ before, after, changed, by }`: the facts of
|
|
343
|
+
each side, `null` on the side a creation or a deletion lacks, the `changed` paths whose prose
|
|
344
|
+
changed, and the actor whose `/user`, `/site` and `/door`, one of `WRITE_DOORS`, a `by` test reads.
|
|
345
|
+
`starts_matching` fires when the Document is in `scope` and holds `match` after the change and did
|
|
346
|
+
not before; a creation fires only with `new_documents: true`, and a deletion never fires.
|
|
347
|
+
`field_changes` fires when the side the Document has, after or for a deletion before, is in `scope`
|
|
348
|
+
and holds `match`, and `field` changed: its facts differ, or with neither `from` nor `to` `changed`
|
|
349
|
+
names it. A field absent on both sides never fires; `from: 'new'` admits only a creation and
|
|
350
|
+
`to: 'deleted'` only a deletion, and listed values need that side to hold `field` `in` them.
|
|
351
|
+
|
|
352
|
+
`itemFires(condition, item, owner)` compares `source` and `address` where given and holds `match`
|
|
353
|
+
over `/delivery`, `/source`, `/provider`, `/container`, `/author`, `/has_attachment`,
|
|
354
|
+
`/headers/<name>` and `/json/<pointer>`, unknown for an item with no JSON. `prosePaths(facts)` lists
|
|
355
|
+
the prose and section paths whose text builds `changed`; `pointed(value, pointer)` reads a JSON
|
|
356
|
+
Pointer, `undefined` where nothing is; `dated(value)` checks a `YYYY-MM-DD` date, and
|
|
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.
|
package/dist/blocks.d.ts.map
CHANGED
|
@@ -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;
|
|
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]
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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) {
|
package/dist/condition.d.ts
CHANGED
|
@@ -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;
|
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,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,CACzB;IAAE,QAAQ,CAAC,EAAE,EAAE,cAAc,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GAC1C;IAAE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,GACrC;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA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O,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
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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) {
|
package/dist/definition.js
CHANGED
|
@@ -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
|
-
|
|
19
|
+
[TYPE_FIELD]: { prose: false },
|
|
20
20
|
[SITE_FIELD]: { prose: false },
|
|
21
21
|
[RECEIVED_FIELD]: { prose: false },
|
|
22
22
|
};
|
package/dist/document.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
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, Change, Document, Link, LinkOccurrence, ParseResult } from './types.js';
|
|
3
3
|
import { type YamlMap } from './yaml.js';
|
|
4
4
|
export declare function parse(content: string, file?: string): ParseResult;
|
|
5
5
|
export declare function relativize(document: Document, file: string, handle: string, definition?: Definition): ApplyResult;
|
|
6
6
|
export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
|
|
7
7
|
export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
|
|
8
8
|
export declare function links(document: Document, file: string): readonly Link[];
|
|
9
|
+
export declare function linkOccurrences(document: Document, file: string): readonly LinkOccurrence[];
|
|
9
10
|
export declare function bodyLinks(body: string, file: string): readonly Link[];
|
|
10
11
|
export declare function apply(document: Document, change: Change): ApplyResult;
|
|
11
12
|
export declare function serialize(document: Document): string;
|
|
13
|
+
export declare function fieldStart(document: Document, pointer: string): number | undefined;
|
|
12
14
|
export declare function frontmatter(document: Document): YamlMap | null;
|
|
13
15
|
//# 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,
|
|
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,cAAc,EACd,WAAW,EAEZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAaL,KAAK,OAAO,EAEb,MAAM,WAAW,CAAC;AAwCnB,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,WAAW,CAkD7D;AAqMD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,GACtB,WAAW,CAYb;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CASrF;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,UAAU,CAeZ;AAuBD,wBAAgB,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,IAAI,EAAE,CAEvE;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAG3F;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,IAAI,EAAE,CAErE;AAED,wBAAgB,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CAOrE;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAEpD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGlF;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAE9D"}
|
package/dist/document.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ARRAY_INDEX, pointerSegments } from './definition.js';
|
|
2
2
|
import { hrefOccurrences } from './links.js';
|
|
3
|
-
import { relative, retarget, SHELL_ROOMS, shellTarget, target } from './paths.js';
|
|
3
|
+
import { destinationPath, relative, retarget, SHELL_ROOMS, shellTarget, target } from './paths.js';
|
|
4
4
|
import { references } from './references.js';
|
|
5
5
|
import { headingSpans, sectionsRecord } from './sections.js';
|
|
6
6
|
import { refusal } from './refuse.js';
|
|
7
|
-
import { bodyStartAfterYaml, bodyStartOf, equalValue, extractFrontmatter, jsValue, lineEnding, mapEntry, parseYamlMapping, serializeJs, serializeKey, YamlError, } from './yaml.js';
|
|
7
|
+
import { bodyStartAfterYaml, bodyStartOf, equalValue, extractFrontmatter, frontmatterValue, jsValue, lineEnding, mapEntry, parseYamlMapping, serializeJs, serializeKey, YamlError, } from './yaml.js';
|
|
8
8
|
const internals = new WeakMap();
|
|
9
9
|
function refuse(file, rule, location) {
|
|
10
10
|
return location === undefined ? refusal(file, rule) : refusal(file, rule, { location });
|
|
@@ -78,10 +78,18 @@ function applyField(document, name, value, prior) {
|
|
|
78
78
|
if (!equalValue(document.fields[name], prior)) {
|
|
79
79
|
return { outcome: 'stale', document };
|
|
80
80
|
}
|
|
81
|
+
if (!frontmatterValue(value)) {
|
|
82
|
+
return { outcome: 'refuse', refusal: refuse('', 'frontmatter-fence', name) };
|
|
83
|
+
}
|
|
81
84
|
let nextContent;
|
|
82
85
|
const existing = mapEntry(internal.root, name);
|
|
83
86
|
if (existing !== undefined) {
|
|
84
|
-
|
|
87
|
+
const held = existing.value;
|
|
88
|
+
const inline = held.start > existing.after &&
|
|
89
|
+
!/[\r\n]/.test(document.content.slice(existing.after, held.start));
|
|
90
|
+
nextContent = inline
|
|
91
|
+
? splice(document.content, held.start, held.end, serializeJs(value))
|
|
92
|
+
: splice(document.content, existing.after, held.end, ` ${serializeJs(value)}`);
|
|
85
93
|
}
|
|
86
94
|
else if (document.content[internal.root.start] === '{') {
|
|
87
95
|
nextContent = splice(document.content, internal.root.end - 1, internal.root.end - 1, `${internal.root.entries.length === 0 ? '' : ', '}${serializeKey(name)}: ${serializeJs(value)}`);
|
|
@@ -111,16 +119,30 @@ function applySection(document, name, value, prior) {
|
|
|
111
119
|
const current = document.content.slice(span.bodyStart, span.bodyEnd);
|
|
112
120
|
if (current !== prior)
|
|
113
121
|
return { outcome: 'stale', document };
|
|
114
|
-
|
|
115
|
-
if (!parsed.ok)
|
|
116
|
-
return { outcome: 'refuse', refusal: parsed.refusal };
|
|
117
|
-
return { outcome: 'applied', document: parsed.document };
|
|
122
|
+
return replaced(document, internal.bodyStart, span.bodyStart, span.bodyEnd, value);
|
|
118
123
|
}
|
|
119
124
|
function applyPreamble(document, value, prior) {
|
|
120
125
|
if (document.preamble !== prior)
|
|
121
126
|
return { outcome: 'stale', document };
|
|
122
127
|
const start = bodyStartOf(document.content);
|
|
123
|
-
|
|
128
|
+
return replaced(document, start, start, start + document.preamble.length, value);
|
|
129
|
+
}
|
|
130
|
+
function firstHeadings(content, bodyStart) {
|
|
131
|
+
const first = new Map();
|
|
132
|
+
for (const span of headingSpans(content, bodyStart)) {
|
|
133
|
+
if (!first.has(span.name))
|
|
134
|
+
first.set(span.name, span.headingStart);
|
|
135
|
+
}
|
|
136
|
+
return first;
|
|
137
|
+
}
|
|
138
|
+
function replaced(document, bodyStart, start, end, value) {
|
|
139
|
+
const content = splice(document.content, start, end, value);
|
|
140
|
+
const after = firstHeadings(content, bodyStartOf(content));
|
|
141
|
+
for (const [name, at] of firstHeadings(document.content, bodyStart)) {
|
|
142
|
+
if (after.get(name) !== (at < start ? at : at + value.length - (end - start)))
|
|
143
|
+
return { outcome: 'refuse', refusal: refuse('', 'overlapping-section', name) };
|
|
144
|
+
}
|
|
145
|
+
const parsed = parse(content);
|
|
124
146
|
if (!parsed.ok)
|
|
125
147
|
return { outcome: 'refuse', refusal: parsed.refusal };
|
|
126
148
|
return { outcome: 'applied', document: parsed.document };
|
|
@@ -248,7 +270,7 @@ export function relativizeBody(body, file, handle) {
|
|
|
248
270
|
const relinkedBody = shellRelinked(body, 0, file, handle);
|
|
249
271
|
if (typeof relinkedBody !== 'string')
|
|
250
272
|
return { outcome: 'refuse', refusal: relinkedBody };
|
|
251
|
-
const elsewhere = hrefOccurrences(relinkedBody).find(({ href }) => href
|
|
273
|
+
const elsewhere = hrefOccurrences(relinkedBody).find(({ href }) => destinationPath(href)?.startsWith(SHELL_ROOMS) === true);
|
|
252
274
|
if (elsewhere !== undefined)
|
|
253
275
|
return { outcome: 'refuse', refusal: refuse(file, 'unresolved-link', elsewhere.href) };
|
|
254
276
|
return { outcome: 'applied', body: relinkedBody };
|
|
@@ -270,23 +292,33 @@ export function relinkBody(body, file, moves) {
|
|
|
270
292
|
}
|
|
271
293
|
return { outcome: 'applied', body: rewritten + body.slice(cursor) };
|
|
272
294
|
}
|
|
295
|
+
function occurrencesIn(text, file, offset) {
|
|
296
|
+
const found = [];
|
|
297
|
+
for (const occurrence of hrefOccurrences(text)) {
|
|
298
|
+
const resolved = target(file, occurrence.href);
|
|
299
|
+
if (resolved !== null)
|
|
300
|
+
found.push({ href: occurrence.href, target: resolved, start: offset + occurrence.start });
|
|
301
|
+
}
|
|
302
|
+
return found;
|
|
303
|
+
}
|
|
273
304
|
function linksIn(text, file) {
|
|
274
305
|
const found = [];
|
|
275
306
|
const seen = new Set();
|
|
276
|
-
for (const occurrence of
|
|
307
|
+
for (const occurrence of occurrencesIn(text, file, 0)) {
|
|
277
308
|
if (seen.has(occurrence.href))
|
|
278
309
|
continue;
|
|
279
|
-
const resolved = target(file, occurrence.href);
|
|
280
|
-
if (resolved === null)
|
|
281
|
-
continue;
|
|
282
310
|
seen.add(occurrence.href);
|
|
283
|
-
found.push({ href: occurrence.href, target:
|
|
311
|
+
found.push({ href: occurrence.href, target: occurrence.target });
|
|
284
312
|
}
|
|
285
313
|
return found;
|
|
286
314
|
}
|
|
287
315
|
export function links(document, file) {
|
|
288
316
|
return linksIn(document.content.slice(bodyStartOf(document.content)), file);
|
|
289
317
|
}
|
|
318
|
+
export function linkOccurrences(document, file) {
|
|
319
|
+
const bodyStart = bodyStartOf(document.content);
|
|
320
|
+
return occurrencesIn(document.content.slice(bodyStart), file, bodyStart);
|
|
321
|
+
}
|
|
290
322
|
export function bodyLinks(body, file) {
|
|
291
323
|
return linksIn(body, file);
|
|
292
324
|
}
|
|
@@ -297,21 +329,17 @@ export function apply(document, change) {
|
|
|
297
329
|
return applyReference(document, change.pointer, change.value, change.prior);
|
|
298
330
|
if (change.kind === 'preamble')
|
|
299
331
|
return applyPreamble(document, change.value, change.prior);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return applySection(document, change.name, change.value, change.prior);
|
|
304
|
-
}
|
|
305
|
-
catch (error) {
|
|
306
|
-
if (error instanceof YamlError) {
|
|
307
|
-
return { outcome: 'refuse', refusal: refuse('', 'frontmatter-fence', change.name) };
|
|
308
|
-
}
|
|
309
|
-
throw error;
|
|
310
|
-
}
|
|
332
|
+
if (change.kind === 'field')
|
|
333
|
+
return applyField(document, change.name, change.value, change.prior);
|
|
334
|
+
return applySection(document, change.name, change.value, change.prior);
|
|
311
335
|
}
|
|
312
336
|
export function serialize(document) {
|
|
313
337
|
return document.content;
|
|
314
338
|
}
|
|
339
|
+
export function fieldStart(document, pointer) {
|
|
340
|
+
const root = internals.get(document)?.root;
|
|
341
|
+
return root === null || root === undefined ? undefined : nodeAt(root, pointer)?.start;
|
|
342
|
+
}
|
|
315
343
|
export function frontmatter(document) {
|
|
316
344
|
return internals.get(document)?.root ?? null;
|
|
317
345
|
}
|
package/dist/fields.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
export declare const TYPE_FIELD = "type";
|
|
1
2
|
export declare const MEMBER_FIELD = "member";
|
|
2
3
|
export declare const SITE_FIELD = "site";
|
|
3
4
|
export declare const RECEIVED_FIELD = "received";
|
|
5
|
+
export declare const HOUSE_FIELDS: readonly string[];
|
|
4
6
|
//# sourceMappingURL=fields.d.ts.map
|
package/dist/fields.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,eAAO,MAAM,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,eAAO,MAAM,UAAU,SAAS,CAAC;AAEjC,eAAO,MAAM,cAAc,aAAa,CAAC;AAEzC,eAAO,MAAM,YAAY,EAAE,SAAS,MAAM,EAKzC,CAAC"}
|
package/dist/fields.js
CHANGED