@agentshouse/mdmodel 0.1.0-cc9fa0498a7f7 → 0.1.0-ccf1367190878

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,17 @@ 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 its 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. A
51
+ type alone takes `create_roles` and `delete_roles`, each a list of role names. On a field of a
52
+ type's own `properties` alone, `change_roles` and `initial_roles` each list role names, and
53
+ `transitions` lists `{ from, to, roles? }`, each end a scalar or `null`, on a field whose `type`,
54
+ `enum`, `const`, `$ref`, `allOf`, `anyOf`, `oneOf`, `if` and `not` admit no list or object.
53
55
 
54
56
  ```yaml
55
57
  $defs:
@@ -64,70 +66,65 @@ plan:
64
66
  contact: { member_document: true }
65
67
  ```
66
68
 
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_FIELD`, `SITE_FIELD` and `RECEIVED_FIELD` count as declared on every
100
- type, and the string `MEMBER_FIELD` on the `member_document` type; `HOUSE_FIELDS`
101
- lists the four. A refusal names the keyword, such as `required`, and the
102
- value's JSON Pointer, such as `/shipping/city`. Every occurrence of a declared
103
- list section is a list of values of its item schema, else `structured-section`;
104
- a reference item is one ordinary link alone, such as `- [Ada](ada.md)`. A
105
- reference, at any depth or a section item, reaching a URL, a binary target, or a
106
- Document of a type it does not name is `unresolved-reference`, and a frontmatter
107
- one reaching no member is `referenced-missing-file` naming its `referrers`;
108
- `attachment` admits any path, 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 or an object 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
- an inline value is replaced where it stands, and a value written after the key's line, an empty
118
- one or a block mapping or list, is written after the key's colon in its place.
119
- A field holds a `FrontmatterValue`: null, a string, a boolean, a finite number, a list
120
- without holes or a plain object of them, holding no cycle. `frontmatterValue(value)` is that test, and
121
- `apply` refuses any other value as `frontmatter-fence`; `equalValue(left, right)` compares
122
- two by value, whatever their key order, as `apply` compares a field with its prior.
123
-
124
- `Document.preamble` is a readonly string containing the exact source after
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.
69
+ The model's `types` expose each MD Type's `name`, `memberDocument`, `sections`, `shape` (the type as
70
+ written, its rule keywords left out, with every `$defs` shape it reaches), `createRoles` and
71
+ `deleteRoles` when written, its `rules` by field as `changeRoles`, `initialRoles` and `transitions`,
72
+ the facts of its `frontmatter` and `fields`, its top-level ones: JSON `type`, `format`, `values`,
73
+ `reference` targets, `items`, `properties`, an open map's `patterns` and `additional`, and `prose`,
74
+ a string with no `enum`, `const`, `format`, `pattern` or `reference`. Facts join `$ref` and `allOf`
75
+ to their siblings and the variants of `anyOf`, `oneOf`, `then`, `else` and `dependentSchemas`, a
76
+ variant's own keys `conditional`; a path without one `type`, `null` aside, has none. A malformed
77
+ schema is refused whole, naming its `rule`, the keyword or the model's own, and the JSON Pointer
78
+ `location` it concerns, such as `/plan/properties/status/enum`, or `line <n>` outside the YAML
79
+ subset. `pointerFacts(definition, pointer)` reads the facts a frontmatter pointer reaches,
80
+ `itemFacts` and `memberFacts` take one step and `crossedFacts` reads a list's item facts;
81
+ `pointerSegments` and `escapePointer` split and write a pointer, `ARRAY_INDEX` matches an index
82
+ segment, and `ATTACHMENT` is the `reference` that admits any path.
83
+
84
+ `validate(library, context?, model?)` takes the resulting text Library and one `ValidationContext`
85
+ of `binaryTargets: readonly string[]`, none when omitted. Library keys and binary targets share one
86
+ canonical collection-relative path namespace; a path declared text and binary is refused. House
87
+ declares every binary file of the Room as a binary target, and the model reads no bytes. Ordinary
88
+ links and images 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 deleted file's links do.
90
+ A destination that is an absolute path or leaves the collection is `unresolved-link`. A binary
91
+ target supplies no Document or MD Type. `model` is the verified schema that types the Library, and
92
+ every Library member is content, whatever its Path. Without `model` the Library declares no type.
93
+
94
+ A typed Document's frontmatter satisfies its type's schema, every keyword with its JSON Schema
95
+ meaning, formats asserted and defaults never filled, except that an object schema declaring neither
96
+ `additionalProperties` nor `unevaluatedProperties` is closed: an undeclared key is refused as
97
+ `undeclared- field`. `TYPE_FIELD`, `SITE_FIELD` and `RECEIVED_FIELD` count as declared on every
98
+ type, and the string `MEMBER_FIELD` on the `member_document` type; `HOUSE_FIELDS` lists the four. A
99
+ refusal names the keyword, such as `required`, and the value's JSON Pointer, such as
100
+ `/shipping/city`. Every occurrence of a declared list section is a list of values of its item
101
+ schema, else `structured-section`; a reference item is one ordinary link alone, such as
102
+ `- [Ada](ada.md)`. A reference, at any depth or a section item, reaching a URL, a binary target, or a
103
+ Document of a type it does not name is `unresolved-reference`, and a frontmatter one reaching no
104
+ member is `referenced-missing-file` naming its `referrers`; `attachment` admits any path, and no
105
+ body link is a referrer.
106
+
107
+ Validation returns acceptance or one refusal naming the file, the field or section, and the violated
108
+ rule. `parse`, `apply`, and `serialize` operate on a single text Document; they do not validate
109
+ collection membership or consume binary bytes. `apply` sets one typed field, including a list or an
110
+ object as a whole, replaces one existing section body or the preamble against that value's prior
111
+ content, or rewrites one Markdown link destination. A section need not be declared by the Document's
112
+ MD Type to be replaced. A section or preamble replacement that would hide a section the Document
113
+ carried behind a repeated, merged or fenced heading is refused as `overlapping-section` naming that
114
+ section. A field change does not reformat the rest of the file: an inline value is replaced where it
115
+ stands, and a value written after the key's line, an empty one or a block mapping or list, is
116
+ written after the key's colon in its place. A field holds a `FrontmatterValue`: null, a string, a
117
+ boolean, a finite number, a list without holes or a plain object of them, holding no cycle.
118
+ `frontmatterValue(value)` is that test, and `apply` refuses any other value as `frontmatter-fence`;
119
+ `equalValue(left, right)` compares two by value, whatever their key order, as `apply` compares a
120
+ field with its prior.
121
+
122
+ `Document.preamble` is a readonly string holding the exact source after frontmatter and before the
123
+ first section heading the section parser recognizes, `''` when empty, whitespace, newlines, a
124
+ leading H1 and any fenced text before the first section included. The closing frontmatter
125
+ delimiter and its line ending belong to frontmatter: `bodyAfterFrontmatter(content)` is the exact
126
+ source after them, the whole text when it opens no closed fence, and the preamble begins it.
127
+ `headingLines(content, from, to)` reads each ATX heading outside a fence, by `level` and `name`.
131
128
 
132
129
  ```ts
133
130
  const parsed = parse(content);
@@ -142,15 +139,14 @@ if (parsed.ok) {
142
139
  }
143
140
  ```
144
141
 
145
- `apply(document, { kind: 'preamble', prior, value })` compares `prior` to the
146
- current preamble exactly. A mismatch returns `{ outcome: 'stale', document }`
147
- with the unchanged current Document. A match replaces only that source span,
148
- then parses a new immutable Document; the original is unchanged. Frontmatter
149
- and section source outside the span retain their exact bytes, including newline
150
- and heading syntax. As with section replacement, `value` is literal source:
151
- no newline or separator is inserted, and the resulting source is parsed again.
152
- An invalid frontmatter result receives the existing parse refusal. Independent
153
- field, section, and preamble edits keep their own prior values valid.
142
+ `apply(document, { kind: 'preamble', prior, value })` compares `prior` to the current preamble
143
+ exactly. A mismatch returns `{ outcome: 'stale', document }` with the unchanged current Document. A
144
+ match replaces only that source span, then parses a new immutable Document; the original is
145
+ unchanged. Frontmatter and section source outside the span retain their exact bytes, including
146
+ newline and heading syntax. As with section replacement, `value` is literal source: no newline or
147
+ separator is inserted, and the resulting source is parsed again. An invalid frontmatter result
148
+ receives the existing parse refusal. Independent field, section, and preamble edits keep their own
149
+ prior values valid.
154
150
 
155
151
  For a moved link, use `links` and the `link` change below to obtain the rewritten Document, then
156
152
  compare its public `preamble` and `sections` to the original. Submit the changed values with their
@@ -162,18 +158,27 @@ that resolve to a collection Path, each with the destination `href` exactly as w
162
158
  `target` Path it resolves to relative to `file`. A `?query` or `#fragment` the destination carries
163
159
  is part of `href` and not part of `target`. Entries are ordered by the position of the destination
164
160
  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
- a bare fragment, or carries a URL scheme, and one that leaves the collection are not in the
167
- inventory. Frontmatter field values, including typed references, are not link destinations and
168
- are never enumerated.
169
-
170
- `target(file, href)` is the collection Path one written destination resolves to relative to
171
- `file`, by the rule `links` and `validate` read: surrounding spaces and the `?query` or `#fragment`
172
- it carries are not part of that Path. A destination that is empty, a bare fragment, carries a URL
173
- scheme, starts at `/`, or leaves the collection resolves to `null`. It reads a destination written
174
- anywhere, such as a typed reference field value, which `links` never enumerates.
175
- `retarget(href, to)` is that destination rewritten to `to`, keeping the `?query` or `#fragment` it
176
- carried, which is the destination the `link` change below writes.
161
+ times it occurs. A destination that the syntax profile does not read as a link, one that is empty, a
162
+ bare fragment, or carries a URL scheme, and one that leaves the collection are not in the inventory.
163
+ Frontmatter values are never link destinations. `linkOccurrences(document, file)` places each
164
+ occurrence by its `start` in `content`, and `fieldStart(document, pointer)` a frontmatter value.
165
+
166
+ `target(file, href)` is the collection Path one written destination resolves to relative to `file`,
167
+ by the rule `links` and `validate` read: surrounding spaces and the `?query` or `#fragment` it
168
+ carries are not part of that Path. It reads backslash escapes and character references, strips as a
169
+ URL does, then percent-encodings, so `plan\.md`, `pl&#97;n.md` and `pl%61n.md` all name `plan.md`;
170
+ an escaped or referenced `?` or `#` starts the suffix. A destination that is empty, a bare fragment,
171
+ carries a URL scheme, starts at `/` once read, encodes no UTF-8 text, or leaves the collection
172
+ resolves to `null`. It reads a destination written anywhere, such as a typed reference field value,
173
+ which `links` never enumerates. `retarget(href, to)` is that destination rewritten to `to`, keeping
174
+ the `?query` or `#fragment` it carried, which is the destination the `link` change below writes. It
175
+ percent-encodes in `to` what `target` would decode, so it resolves to `to` again.
176
+
177
+ `checkDocument(file, content, model)` reads one Document alone by the same rules: `ok: false` where
178
+ `validate` refuses it, else its `type`, whether it is `typed`, and each reference's `target` and
179
+ `to`, which `resolves(reference, typeOf, binary)` says reaches a member `validate` accepts.
180
+ `sectionReferences(file, content, definition)` reads only the references of its `list` sections.
181
+ `parseFrontmatter(content, file?)` is `parse` without the body: `content`, `type` and `fields`.
177
182
 
178
183
  `references(document, definition)` lists each frontmatter `reference` string at any depth as
179
184
  `pointer`, `value` and `to`; `apply(document, { kind: 'reference', pointer, value, prior })`
@@ -200,18 +205,16 @@ profile reads back: bare when it carries no whitespace, does not open with `<`,
200
205
  parentheses, otherwise inside angle brackets, which the original form is kept in when it still
201
206
  fits. A destination that neither form can carry is refused as `unwritable-link`.
202
207
 
203
- `project(document, file, context?)` is the Embedding projection input of one
204
- Document: the prose a consumer embeds, with every internal Markdown-document
205
- link reduced to the label a reader sees. A Document that declares no MD type
206
- contributes its body after the frontmatter fence. A typed one contributes its
207
- prose values, its preamble, and every H2 section its MD type does not declare as
208
- structure, each with its own heading line and every occurrence of a repeated
209
- name, in Document order: a declared text section, a list section of prose items
210
- and an undeclared section are in; a list section of any other item schema is
211
- not. A prose value is a frontmatter string at any depth whose schema is prose,
212
- projected bare and followed by a blank line, in the order the Document writes
213
- them, exactly as written. The Path and every other value stay outside, so
214
- changing them alone leaves the projection unchanged.
208
+ `project(document, file, context?)` is the Embedding projection input of one Document: the prose a
209
+ consumer embeds, with every internal Markdown-document link reduced to the label a reader sees. A
210
+ Document that declares no MD type contributes its body after the frontmatter fence. A typed one
211
+ contributes its prose values, its preamble, and every H2 section its MD type does not declare as
212
+ structure, each with its own heading line and every occurrence of a repeated name, in Document
213
+ order: a declared text section, a list section of prose items and an undeclared section are in; a
214
+ list section of any other item schema is not. A prose value is a frontmatter string at any depth
215
+ whose schema is prose, projected bare and followed by a blank line, in the order the Document writes
216
+ them, exactly as written. The Path and every other value stay outside, so changing them alone leaves
217
+ the projection unchanged.
215
218
 
216
219
  ```ts
217
220
  const parsed = parse(content);
@@ -224,16 +227,14 @@ if (parsed.ok) {
224
227
  }
225
228
  ```
226
229
 
227
- `ProjectionContext` carries `documentTargets`, the collection-relative Paths the
228
- caller holds as Markdown documents, and `definition`, the verified MD Type the
229
- Document's `type` names, taken from the model `verify` returned. A Document that
230
- declares a type the caller supplies no definition for is refused as
231
- `unknown-type`. `documentTargets` is what makes a destination internal: a
232
- destination resolving to a supplied Path is internal, and every other
233
- destination stays authored text, a binary target and a Path nobody
234
- supplied alike. The caller supplies that membership, as it does for `validate`;
235
- the model reads no bytes, resolves no authority, and classifies nothing it was
236
- not given.
230
+ `ProjectionContext` carries `documentTargets`, the collection-relative Paths the caller holds as
231
+ Markdown documents, and `definition`, the verified MD Type the Document's `type` names, taken from
232
+ the model `verify` returned. A Document that declares a type the caller supplies no definition for
233
+ is refused as `unknown-type`. `documentTargets` is what makes a destination internal: a destination
234
+ resolving to a supplied Path is internal, and every other destination stays authored text, a binary
235
+ target and a Path nobody supplied alike. The caller supplies that membership, as it does for
236
+ `validate`; the model reads no bytes, resolves no authority, and classifies nothing it was not
237
+ given.
237
238
 
238
239
  An internal link contributes its visible label and no destination, fragment, or
239
240
  title, in the inline `[label](path)`, full `[label][id]`, collapsed
@@ -248,11 +249,10 @@ and `validate` read. `project` returns text and never rewrites the Document.
248
249
  A `link` change leaves the projection of every Document it rewrites
249
250
  byte-identical, while a changed visible label changes it.
250
251
 
251
- `divide(document, file, context)` divides that same Embedding projection input
252
- into ordered Spans under the budget the caller supplies. Each Span carries the
253
- `text` to embed and the `start` and `end` of the extent it addresses in the
254
- Document's own source, as UTF-8 byte offsets into that source and never string
255
- positions, so a caller stores the extent and hydrates the text it shows from
252
+ `divide(document, file, context)` divides that same Embedding projection input into ordered Spans
253
+ under the budget the caller supplies. Each Span carries the `text` to embed and the `start` and
254
+ `end` of the extent it addresses in the Document's own source, as UTF-8 byte offsets into that
255
+ source and never string positions, so a caller stores the extent and hydrates the text it shows from
256
256
  the Document itself.
257
257
 
258
258
  ```ts
@@ -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
- fit: the whole input, a heading node, adjacent sibling nodes packed under one
286
- parent, adjacent blocks inside a node, sentences inside a block, and a bound cut
287
- inside a single sentence. A Span covers whole heading nodes or one contiguous
288
- piece inside a single node, never a partial node beside another. A Span that
289
- continues a node repeats that node's own heading line, projected like any other
290
- text and so carrying an internal link's label rather than its destination, and
291
- never an ancestor's heading, so renaming a heading costs what editing that
292
- heading's own body costs. A heading the budget cannot hold beside any text is
293
- not repeated, a continuation piece that begins with an astral character the
294
- room beside its heading cannot hold is carried without the heading, and a
295
- heading with no body of its own leads its first child node rather than standing
296
- as a Span of nothing but itself. Overlap exists at the
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
@@ -354,7 +350,7 @@ names it. A field absent on both sides never fires; `from: 'new'` admits only a
354
350
  `to: 'deleted'` only a deletion, and listed values need that side to hold `field` `in` them.
355
351
 
356
352
  `itemFires(condition, item, owner)` compares `source` and `address` where given and holds `match`
357
- over `/delivery`, `/source`, `/provider`, `/container`, `/author`, `/has_attachment`,
353
+ over `/delivery`, `/source`, `/container`, `/author`, `/has_attachment`,
358
354
  `/headers/<name>` and `/json/<pointer>`, unknown for an item with no JSON. `prosePaths(facts)` lists
359
355
  the prose and section paths whose text builds `changed`; `pointed(value, pointer)` reads a JSON
360
356
  Pointer, `undefined` where nothing is; `dated(value)` checks a `YYYY-MM-DD` date, and
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;
@@ -120,7 +120,6 @@ export type ItemFacts = {
120
120
  readonly source: string | null;
121
121
  readonly address: string | null;
122
122
  readonly has_attachment: boolean;
123
- readonly provider: string | null;
124
123
  readonly container: string | null;
125
124
  readonly author: string | null;
126
125
  readonly headers: Readonly<Record<string, string>>;
@@ -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;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path === '/source'
302
302
  ? item.source
303
- : path === '/provider'
304
- ? item.provider
305
- : path === '/container'
306
- ? item.container
307
- : path === '/author'
308
- ? item.author
309
- : null;
303
+ : path === '/container'
304
+ ? item.container
305
+ : path === '/author'
306
+ ? item.author
307
+ : null;
310
308
  return value === null ? undefined : single({ kind: 'string', value });
311
309
  }
312
310
  function wanted(value, owner) {
@@ -444,6 +442,11 @@ function valueOf(fact) {
444
442
  .sort()
445
443
  .map((key) => [key, valueOf(fact.fields[key])]),
446
444
  };
445
+ if (fact.kind === 'time') {
446
+ const at = instant(fact.value);
447
+ if (at !== undefined)
448
+ return { kind: fact.kind, at: String(at) };
449
+ }
447
450
  return 'value' in fact ? { kind: fact.kind, value: fact.value } : fact;
448
451
  }
449
452
  function signature(reached) {
@@ -29,12 +29,26 @@ export type Shape = {
29
29
  readonly schema: Readonly<Record<string, unknown>>;
30
30
  readonly defs: Readonly<Record<string, unknown>>;
31
31
  };
32
+ export type RuleValue = string | number | boolean | null;
33
+ export type Transition = {
34
+ readonly from: RuleValue;
35
+ readonly to: RuleValue;
36
+ readonly roles?: readonly string[];
37
+ };
38
+ export type FieldRules = {
39
+ readonly changeRoles?: readonly string[];
40
+ readonly initialRoles?: readonly string[];
41
+ readonly transitions?: readonly Transition[];
42
+ };
32
43
  export type Definition = {
33
44
  readonly name: string;
34
45
  readonly memberDocument: boolean;
35
46
  readonly frontmatter: ValueFacts;
36
47
  readonly fields: Readonly<Record<string, ValueFacts>>;
37
48
  readonly sections: Readonly<Record<string, SectionSpec>>;
49
+ readonly rules: Readonly<Record<string, FieldRules>>;
50
+ readonly createRoles?: readonly string[];
51
+ readonly deleteRoles?: readonly string[];
38
52
  readonly shape: Shape;
39
53
  };
40
54
  export type Failure = {
@@ -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,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