@agentshouse/mdmodel 0.1.0-c8ef006e419a0 → 0.1.0-c94519eaa994d
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 +85 -106
- package/README.md +2 -1
- package/dist/built-in.d.ts.map +1 -1
- package/dist/built-in.js +10 -1
- package/dist/definition.d.ts +9 -1
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +92 -14
- package/dist/document.d.ts +3 -1
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +73 -21
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js +2 -1
- package/dist/facts.d.ts.map +1 -1
- package/dist/facts.js +7 -4
- package/dist/folders.d.ts +5 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/folders.js +19 -0
- package/dist/house-model.d.ts +145 -24
- package/dist/house-model.d.ts.map +1 -1
- package/dist/house-model.js +74 -14
- package/dist/house-references/patterns.d.ts +5 -1
- package/dist/house-references/patterns.d.ts.map +1 -1
- package/dist/house-references/patterns.js +8 -1
- package/dist/index.d.ts +16 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -9
- package/dist/indexed.d.ts +10 -0
- package/dist/indexed.d.ts.map +1 -0
- package/dist/indexed.js +63 -0
- package/dist/kinds.d.ts +9 -1
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +68 -0
- package/dist/markdown.d.ts +0 -4
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +1 -34
- package/dist/moment.d.ts +9 -0
- package/dist/moment.d.ts.map +1 -0
- package/dist/moment.js +40 -0
- package/dist/not-ready.d.ts +2 -0
- package/dist/not-ready.d.ts.map +1 -0
- package/dist/not-ready.js +5 -0
- package/dist/paths.d.ts +6 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +33 -3
- package/dist/query/language.d.ts +4 -1
- package/dist/query/language.d.ts.map +1 -1
- package/dist/query/language.js +4 -3
- package/dist/query/match.d.ts.map +1 -1
- package/dist/query/match.js +3 -24
- package/dist/query/rows.d.ts +5 -0
- package/dist/query/rows.d.ts.map +1 -1
- package/dist/query/rows.js +36 -7
- package/dist/query/sql.d.ts +10 -1
- package/dist/query/sql.d.ts.map +1 -1
- package/dist/query/sql.js +22 -3
- package/dist/query/walk.d.ts +73 -0
- package/dist/query/walk.d.ts.map +1 -0
- package/dist/query/walk.js +277 -0
- package/dist/reserved.d.ts +1 -0
- package/dist/reserved.d.ts.map +1 -1
- package/dist/reserved.js +15 -4
- package/dist/room-types.d.ts +2 -1
- package/dist/room-types.d.ts.map +1 -1
- package/dist/room-types.js +8 -1
- package/dist/types.d.ts +10 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +4 -0
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +90 -31
- package/dist/view.d.ts +5 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +27 -0
- package/dist/yaml.d.ts +3 -1
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +153 -32
- package/fixtures/README.md +64 -57
- package/fixtures/cases/absent-link-dangles/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/absent-optional-field/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/absolute-link/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/attachment-reference-any-file/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/attachment-reference-dangles/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/attachment-reference-outside/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-any-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-document-collision/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-image-dangles/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-link-dangles/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-link-outside-collection/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-prototype-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-typed-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/block-scalar-frontmatter/expected.json +1 -0
- package/fixtures/cases/block-scalar-frontmatter/library/notes/literal.md +17 -0
- package/fixtures/cases/block-scalar-frontmatter/library/skills/notes/SKILL.md +10 -0
- package/fixtures/cases/boolean-field/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/{duplicate-link-definition/schema.yaml → bracketed-link-definition/schema.md} +2 -0
- package/fixtures/cases/closed-nested-object/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/composed-root-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/conditional-long-text/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/cross-room-link/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/cross-room-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/date-time-format/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/declared-binary-links/schema.md +3 -0
- package/fixtures/cases/default-unfilled/schema.md +57 -0
- package/fixtures/cases/defs-pattern/schema.md +57 -0
- package/fixtures/cases/dependent-rule/schema.md +57 -0
- package/fixtures/cases/{bracketed-link-definition/schema.yaml → duplicate-link-definition/schema.md} +2 -0
- package/fixtures/cases/email-format/schema.md +57 -0
- package/fixtures/cases/equal-labels/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/fenced-link-definition/schema.md +7 -0
- package/fixtures/cases/field-enum/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/context.json +1 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/expected.json +1 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/door.md +3 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/host.md +13 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/map.md +24 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/open.md +13 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/schema.md +9 -0
- package/fixtures/cases/folder-names-no-type-of-the-schema/context.json +1 -0
- package/fixtures/cases/folder-names-no-type-of-the-schema/expected.json +5 -0
- package/fixtures/cases/folder-names-no-type-of-the-schema/schema.md +7 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/context.json +1 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/expected.json +6 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/library/tickets/archive/2025/old.md +1 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/schema.md +15 -0
- package/fixtures/cases/folder-refuses-a-declared-any/context.json +1 -0
- package/fixtures/cases/folder-refuses-a-declared-any/expected.json +6 -0
- package/fixtures/cases/folder-refuses-a-declared-any/library/tickets/door.md +5 -0
- package/fixtures/cases/folder-refuses-a-declared-any/schema.md +9 -0
- package/fixtures/cases/folder-refuses-another-declared-type/context.json +1 -0
- package/fixtures/cases/folder-refuses-another-declared-type/expected.json +6 -0
- package/fixtures/cases/folder-refuses-another-declared-type/library/tickets/door.md +5 -0
- package/fixtures/cases/folder-refuses-another-declared-type/schema.md +12 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/context.json +1 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/expected.json +1 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/notes/plan.md +7 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/tickets/door.md +3 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/tickets/gate.md +7 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/schema.md +13 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/context.json +1 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/expected.json +6 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/library/tickets/2026/gate.md +1 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/schema.md +9 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/context.json +1 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/expected.json +7 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/library/tickets/door.md +3 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/schema.md +9 -0
- package/fixtures/cases/folder-under-a-reserved-name/context.json +1 -0
- package/fixtures/cases/folder-under-a-reserved-name/expected.json +5 -0
- package/fixtures/cases/folder-under-a-reserved-name/schema.md +7 -0
- package/fixtures/cases/folder-without-a-trailing-slash/context.json +1 -0
- package/fixtures/cases/folder-without-a-trailing-slash/expected.json +5 -0
- package/fixtures/cases/folder-without-a-trailing-slash/schema.md +7 -0
- package/fixtures/cases/frontmatter-construct/context.json +1 -0
- package/fixtures/cases/frontmatter-construct/expected.json +7 -0
- package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
- package/fixtures/cases/integer-field/schema.md +57 -0
- package/fixtures/cases/interrupted-link-definition/schema.md +3 -0
- package/fixtures/cases/json-schema-constructs/schema.md +57 -0
- package/fixtures/cases/labels-in-the-rooms-language/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/lazy-list-item/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/link-into-a-reserved-name/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-item-enum/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-item-kind/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-items/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-of-objects-closed/schema.md +57 -0
- package/fixtures/cases/list-of-objects-item/schema.md +57 -0
- package/fixtures/cases/list-of-objects-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-reference-path/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-reference-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/list-size/schema.md +57 -0
- package/fixtures/cases/long-fence-link-definition/schema.md +3 -0
- package/fixtures/cases/long-value-past-six-levels/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/malformed-definition/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/malformed-list/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/member-document/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/member-on-another-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/missing-required-field/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/misspelled-key/schema.md +57 -0
- package/fixtures/cases/name-not-a-string/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/nested-defs/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/nested-object-reference/schema.md +34 -0
- package/fixtures/cases/nested-reference/schema.md +34 -0
- package/fixtures/cases/nested-required-field/schema.md +57 -0
- package/fixtures/cases/numeric-range/schema.md +57 -0
- package/fixtures/cases/one-key-two-labels/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/one-key-two-types/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/one-of-variant/schema.md +57 -0
- package/fixtures/cases/other-room-reference/schema.md +34 -0
- package/fixtures/cases/paragraph-link-definition/schema.md +3 -0
- package/fixtures/cases/prototype-field/schema.md +7 -0
- package/fixtures/cases/quoted-link-definition/schema.md +3 -0
- package/fixtures/cases/reference-into-a-reserved-name/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/reference-to-any-file-name/context.json +1 -0
- package/fixtures/cases/reference-to-any-file-name/expected.json +1 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/100%.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/C#.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/My notes.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/[draft].md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/c (d).md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/caf/303/251.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people//320/236/321/202/321/207/321/221/321/202.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/bracket.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/cyrillic.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/decomposed.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/hash.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/parenthesis.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/percent.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/spaced.md +9 -0
- package/fixtures/cases/{referenced-missing-file/schema.yaml → reference-to-any-file-name/schema.md} +2 -0
- package/fixtures/cases/referenced-missing-file/schema.md +12 -0
- package/fixtures/cases/referenced-missing-non-latin-file/context.json +1 -0
- package/fixtures/cases/referenced-missing-non-latin-file/expected.json +6 -0
- package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/a.md +9 -0
- package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/b.md +9 -0
- package/fixtures/cases/referenced-missing-non-latin-file/schema.md +12 -0
- package/fixtures/cases/remote-ref/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/schema-body-ignored/context.json +1 -0
- package/fixtures/cases/schema-body-ignored/expected.json +1 -0
- package/fixtures/cases/schema-body-ignored/schema.md +9 -0
- package/fixtures/cases/schema-type-named-folders/context.json +1 -0
- package/fixtures/cases/schema-type-named-folders/expected.json +5 -0
- package/fixtures/cases/schema-type-named-folders/schema.md +5 -0
- package/fixtures/cases/schema-type-named-type/context.json +1 -0
- package/fixtures/cases/schema-type-named-type/expected.json +5 -0
- package/fixtures/cases/{unknown-type/schema.yaml → schema-type-named-type/schema.md} +3 -1
- package/fixtures/cases/second-member-document/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/sections-keyword-refused/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/shortcut-reference-link/schema.md +7 -0
- package/fixtures/cases/string-length/schema.md +57 -0
- package/fixtures/cases/submission-keys/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/text-field-kind/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/thematic-break-ends-the-values/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/truncated-link-definition/schema.md +3 -0
- package/fixtures/cases/typed-path-names-another-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/typed-path-names-its-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/typed-path-names-no-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/types-folder-content/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/undeclared-field/schema.md +7 -0
- package/fixtures/cases/unevaluated-items-closed/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unique-in-app-schema/context.json +1 -0
- package/fixtures/cases/unique-in-app-schema/expected.json +5 -0
- package/fixtures/cases/unique-in-app-schema/schema.yaml +7 -0
- package/fixtures/cases/unique-indexed-field/context.json +1 -0
- package/fixtures/cases/unique-indexed-field/expected.json +1 -0
- package/fixtures/cases/unique-indexed-field/library/tickets/first.md +8 -0
- package/fixtures/cases/unique-indexed-field/library/tickets/second.md +8 -0
- package/fixtures/cases/unique-indexed-field/schema.md +9 -0
- package/fixtures/cases/unique-off-indexed-field/context.json +1 -0
- package/fixtures/cases/unique-off-indexed-field/expected.json +5 -0
- package/fixtures/cases/unique-off-indexed-field/schema.md +9 -0
- package/fixtures/cases/unlisted-reference-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unresolved-link/schema.md +7 -0
- package/fixtures/cases/valid-typed-document/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/wide-item-fence-link/schema.md +3 -0
- package/fixtures/forms.json +24 -0
- package/fixtures/preamble.json +4 -4
- package/fixtures/queries.json +827 -2
- package/fixtures/references.json +15 -0
- package/package.json +2 -2
- package/dist/divide.d.ts +0 -3
- package/dist/divide.d.ts.map +0 -1
- package/dist/divide.js +0 -321
- package/dist/project.d.ts +0 -22
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js +0 -101
- package/fixtures/cases/declared-binary-links/schema.yaml +0 -1
- package/fixtures/cases/default-unfilled/schema.yaml +0 -55
- package/fixtures/cases/defs-pattern/schema.yaml +0 -55
- package/fixtures/cases/dependent-rule/schema.yaml +0 -55
- package/fixtures/cases/email-format/schema.yaml +0 -55
- package/fixtures/cases/fenced-link-definition/schema.yaml +0 -5
- package/fixtures/cases/frontmatter-schema/expected.json +0 -5
- package/fixtures/cases/integer-field/schema.yaml +0 -55
- package/fixtures/cases/interrupted-link-definition/schema.yaml +0 -1
- package/fixtures/cases/json-schema-constructs/schema.yaml +0 -55
- package/fixtures/cases/list-of-objects-closed/schema.yaml +0 -55
- package/fixtures/cases/list-of-objects-item/schema.yaml +0 -55
- package/fixtures/cases/list-size/schema.yaml +0 -55
- package/fixtures/cases/long-fence-link-definition/schema.yaml +0 -1
- package/fixtures/cases/misspelled-key/schema.yaml +0 -55
- package/fixtures/cases/nested-object-reference/schema.yaml +0 -32
- package/fixtures/cases/nested-reference/schema.yaml +0 -32
- package/fixtures/cases/nested-required-field/schema.yaml +0 -55
- package/fixtures/cases/numeric-range/schema.yaml +0 -55
- package/fixtures/cases/one-of-variant/schema.yaml +0 -55
- package/fixtures/cases/other-room-reference/schema.yaml +0 -32
- package/fixtures/cases/paragraph-link-definition/schema.yaml +0 -1
- package/fixtures/cases/prototype-field/schema.yaml +0 -5
- package/fixtures/cases/quoted-link-definition/schema.yaml +0 -1
- package/fixtures/cases/shortcut-reference-link/schema.yaml +0 -5
- package/fixtures/cases/string-length/schema.yaml +0 -55
- package/fixtures/cases/truncated-link-definition/schema.yaml +0 -1
- package/fixtures/cases/undeclared-field/schema.yaml +0 -5
- package/fixtures/cases/unresolved-link/schema.yaml +0 -5
- package/fixtures/cases/wide-item-fence-link/schema.yaml +0 -1
- package/fixtures/division.json +0 -454
- package/fixtures/projection.json +0 -358
- /package/fixtures/cases/{frontmatter-schema → block-scalar-frontmatter}/context.json +0 -0
- /package/fixtures/cases/{frontmatter-schema/schema.yaml → unknown-type/schema.md} +0 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { escapePointer, pointerSegments } from '../definition.js';
|
|
2
|
+
import { byCodePoint, indexKey, instantOf, sortedKey } from '../kinds.js';
|
|
3
|
+
import { definitionAt } from '../validate.js';
|
|
4
|
+
import { plain } from '../yaml.js';
|
|
5
|
+
import { invalid, textless, } from './language.js';
|
|
6
|
+
import { indexed, placedIn } from './rows.js';
|
|
7
|
+
function keyOrder(left, right) {
|
|
8
|
+
for (let at = 0; at < Math.min(left.length, right.length); at += 1) {
|
|
9
|
+
if (left[at] !== right[at])
|
|
10
|
+
return left[at] - right[at];
|
|
11
|
+
}
|
|
12
|
+
return left.length - right.length;
|
|
13
|
+
}
|
|
14
|
+
function tighter(held, bound, sign) {
|
|
15
|
+
if (held === null)
|
|
16
|
+
return bound;
|
|
17
|
+
const order = sign * keyOrder(bound.key, held.key);
|
|
18
|
+
return order > 0 || (order === 0 && !bound.inclusive) ? bound : held;
|
|
19
|
+
}
|
|
20
|
+
function everyValue(facts) {
|
|
21
|
+
return { lower: { key: indexKey(facts, null), inclusive: false }, upper: null };
|
|
22
|
+
}
|
|
23
|
+
function rangeOf(facts, bounds) {
|
|
24
|
+
let { lower } = everyValue(facts);
|
|
25
|
+
let upper = null;
|
|
26
|
+
for (const [operator, value] of bounds) {
|
|
27
|
+
const bound = { key: indexKey(facts, value), inclusive: operator.endsWith('e') };
|
|
28
|
+
if (operator.startsWith('g'))
|
|
29
|
+
lower = tighter(lower, bound, 1);
|
|
30
|
+
else
|
|
31
|
+
upper = tighter(upper, bound, -1);
|
|
32
|
+
}
|
|
33
|
+
return { lower, upper };
|
|
34
|
+
}
|
|
35
|
+
function distinct(keys) {
|
|
36
|
+
return [...new Map(keys.map((key) => [key.join(','), key])).values()];
|
|
37
|
+
}
|
|
38
|
+
function testedKeys(facts, test) {
|
|
39
|
+
if (test.op === 'eq')
|
|
40
|
+
return { keys: [indexKey(facts, test.value)] };
|
|
41
|
+
if (test.op === 'in')
|
|
42
|
+
return { keys: distinct(test.values.map((value) => indexKey(facts, value))) };
|
|
43
|
+
if (test.op === 'range')
|
|
44
|
+
return { range: rangeOf(facts, test.bounds) };
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
function conjuncts(where) {
|
|
48
|
+
if (where === null || 'some' in where)
|
|
49
|
+
return [];
|
|
50
|
+
return 'every' in where ? where.every.flatMap(conjuncts) : [where];
|
|
51
|
+
}
|
|
52
|
+
function named(pointer) {
|
|
53
|
+
const segments = pointerSegments(pointer);
|
|
54
|
+
return segments.length === 1 ? segments[0] : null;
|
|
55
|
+
}
|
|
56
|
+
function indexing(model, types, field) {
|
|
57
|
+
const definitions = types.map((type) => Object.hasOwn(model.types, type) ? model.types[type] : null);
|
|
58
|
+
return definitions.every((definition) => definition?.indexed?.includes(field) === true)
|
|
59
|
+
? definitions
|
|
60
|
+
: null;
|
|
61
|
+
}
|
|
62
|
+
function afterOf(plan) {
|
|
63
|
+
const values = plan.after?.values ?? null;
|
|
64
|
+
if (values === null)
|
|
65
|
+
return null;
|
|
66
|
+
const key = sortedKey(values[0]);
|
|
67
|
+
if (key === null)
|
|
68
|
+
invalid('after', 'expects the next an earlier result of this query returned');
|
|
69
|
+
return { key, tie: values[1] };
|
|
70
|
+
}
|
|
71
|
+
export function pageOrder(plan) {
|
|
72
|
+
if (plan.shape.kind !== 'documents')
|
|
73
|
+
return invalid('groupBy', 'a page answers Documents');
|
|
74
|
+
const [term, second] = plan.shape.orderBy;
|
|
75
|
+
if (second !== undefined)
|
|
76
|
+
invalid(['orderBy', 1], 'a page orders by one term');
|
|
77
|
+
if (term === undefined)
|
|
78
|
+
return { by: 'path', direction: 'asc' };
|
|
79
|
+
const { key, options } = term;
|
|
80
|
+
if (key.of === 'path') {
|
|
81
|
+
if (options.stringSort !== 'lexical')
|
|
82
|
+
invalid(['orderBy', 0, 'stringSort'], 'a page orders Paths by code point, as lexical');
|
|
83
|
+
return { by: 'path', direction: options.direction };
|
|
84
|
+
}
|
|
85
|
+
const field = key.of === 'field' ? named(key.field) : null;
|
|
86
|
+
if (field === null)
|
|
87
|
+
return invalid(['orderBy', 0, 'by'], 'a page orders by Path or by a field its types index');
|
|
88
|
+
if (plan.root.types === null)
|
|
89
|
+
invalid('types', 'an order by a field names the types whose index it walks');
|
|
90
|
+
return {
|
|
91
|
+
by: 'field',
|
|
92
|
+
field,
|
|
93
|
+
direction: options.direction,
|
|
94
|
+
nulls: options.nulls ?? 'first',
|
|
95
|
+
lexical: options.stringSort === 'lexical',
|
|
96
|
+
after: afterOf(plan),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
function keysWalk(plan, model, direction) {
|
|
100
|
+
const types = plan.root.types;
|
|
101
|
+
for (const { field: pointer, test } of conjuncts(plan.root.where)) {
|
|
102
|
+
const field = named(pointer);
|
|
103
|
+
if (types === null || field === null || (test.op !== 'eq' && test.op !== 'in'))
|
|
104
|
+
continue;
|
|
105
|
+
const definitions = indexing(model, types, field);
|
|
106
|
+
if (definitions === null)
|
|
107
|
+
continue;
|
|
108
|
+
return {
|
|
109
|
+
by: 'keys',
|
|
110
|
+
field,
|
|
111
|
+
direction,
|
|
112
|
+
types: definitions.map((definition) => ({
|
|
113
|
+
type: definition.name,
|
|
114
|
+
keys: testedKeys(definition.fields[field], test).keys,
|
|
115
|
+
})),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return { by: 'path', direction };
|
|
119
|
+
}
|
|
120
|
+
function common(types) {
|
|
121
|
+
const [first, ...rest] = types;
|
|
122
|
+
return (first?.indexed ?? [])
|
|
123
|
+
.filter((field) => rest.every((definition) => definition.indexed?.includes(field)))
|
|
124
|
+
.map((field) => `/${escapePointer(field)}`);
|
|
125
|
+
}
|
|
126
|
+
function ranged(facts, tests) {
|
|
127
|
+
if (tests.length === 0)
|
|
128
|
+
return null;
|
|
129
|
+
return tests
|
|
130
|
+
.map(({ test }) => testedKeys(facts, test).range)
|
|
131
|
+
.reduce((held, range) => ({
|
|
132
|
+
lower: tighter(held.lower, range.lower, 1),
|
|
133
|
+
upper: range.upper === null ? held.upper : tighter(held.upper, range.upper, -1),
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
function past(range, key, direction) {
|
|
137
|
+
const beyond = { key, inclusive: false };
|
|
138
|
+
return direction === 'asc'
|
|
139
|
+
? { ...range, lower: tighter(range.lower, beyond, 1) }
|
|
140
|
+
: { ...range, upper: tighter(range.upper, beyond, -1) };
|
|
141
|
+
}
|
|
142
|
+
function runsOf(facts, order, range) {
|
|
143
|
+
const missing = indexKey(facts, null);
|
|
144
|
+
const cursor = order.after?.key ?? null;
|
|
145
|
+
const amongNulls = cursor !== null && keyOrder(cursor, missing) === 0;
|
|
146
|
+
const nulls = range === null ? [{ by: 'key', key: missing, after: amongNulls }] : [];
|
|
147
|
+
const span = range ?? everyValue(facts);
|
|
148
|
+
if (cursor === null || amongNulls) {
|
|
149
|
+
if (order.nulls === 'first')
|
|
150
|
+
return [...nulls, { by: 'range', range: span }];
|
|
151
|
+
return amongNulls ? nulls : [{ by: 'range', range: span }, ...nulls];
|
|
152
|
+
}
|
|
153
|
+
const values = [
|
|
154
|
+
{ by: 'key', key: cursor, after: true },
|
|
155
|
+
{ by: 'range', range: past(span, cursor, order.direction) },
|
|
156
|
+
];
|
|
157
|
+
return order.nulls === 'first' ? values : [...values, ...nulls];
|
|
158
|
+
}
|
|
159
|
+
function unindexed(model, types, at, problem) {
|
|
160
|
+
const declared = types.flatMap((type) => Object.hasOwn(model.types, type) ? [model.types[type]] : []);
|
|
161
|
+
return invalid(at, problem, declared.length === types.length ? common(declared) : []);
|
|
162
|
+
}
|
|
163
|
+
export function walkOf(plan, model) {
|
|
164
|
+
const order = pageOrder(plan);
|
|
165
|
+
if (order.by === 'path')
|
|
166
|
+
return keysWalk(plan, model, order.direction);
|
|
167
|
+
const types = plan.root.types;
|
|
168
|
+
const definitions = indexing(model, types, order.field);
|
|
169
|
+
if (definitions === null)
|
|
170
|
+
return unindexed(model, types, ['orderBy', 0, 'by'], 'orders by a field every type it names indexes');
|
|
171
|
+
if (!order.lexical &&
|
|
172
|
+
definitions.some((definition) => !textless(definition.fields[order.field])))
|
|
173
|
+
invalid(['orderBy', 0, 'stringSort'], 'a page orders text by code point, as lexical');
|
|
174
|
+
const bounding = conjuncts(plan.root.where).filter(({ field, test }) => test.op === 'range' && named(field) === order.field);
|
|
175
|
+
return {
|
|
176
|
+
by: 'order',
|
|
177
|
+
field: order.field,
|
|
178
|
+
direction: order.direction,
|
|
179
|
+
types: definitions.map((definition) => {
|
|
180
|
+
const facts = definition.fields[order.field];
|
|
181
|
+
return { type: definition.name, runs: runsOf(facts, order, ranged(facts, bounding)) };
|
|
182
|
+
}),
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export function countShape(plan) {
|
|
186
|
+
const { shape } = plan;
|
|
187
|
+
if (shape.kind === 'documents' && !plan.total)
|
|
188
|
+
return false;
|
|
189
|
+
if (plan.root.types === null)
|
|
190
|
+
invalid('types', 'a count names the types whose index it reads');
|
|
191
|
+
if (plan.text !== null)
|
|
192
|
+
invalid('text', 'a count tests no text');
|
|
193
|
+
if (plan.hop !== null)
|
|
194
|
+
invalid('hop', 'a count tests no hop');
|
|
195
|
+
if (shape.kind === 'documents')
|
|
196
|
+
return true;
|
|
197
|
+
if (plan.total)
|
|
198
|
+
invalid('total', 'a page of groups answers no total');
|
|
199
|
+
const key = shape.groupBy[0];
|
|
200
|
+
if (shape.groupBy.length > 1)
|
|
201
|
+
invalid(['groupBy', 1], 'a page groups by one field');
|
|
202
|
+
if (key.of !== 'field' || named(key.field) === null)
|
|
203
|
+
invalid(['groupBy', 0], 'a page groups by a field its types index');
|
|
204
|
+
for (const part of ['size', 'updated', 'greatest'])
|
|
205
|
+
if (shape[part] !== false && shape[part] !== null)
|
|
206
|
+
invalid(['select', part], 'a group selects only its count');
|
|
207
|
+
shape.orderBy.forEach(({ by }, index) => {
|
|
208
|
+
if (typeof by === 'string' && by !== 'count')
|
|
209
|
+
invalid(['orderBy', index, 'by'], 'a page of groups orders by its count or its key');
|
|
210
|
+
});
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
function testedPlaces(where, at) {
|
|
214
|
+
if (!plain(where))
|
|
215
|
+
return [];
|
|
216
|
+
return Object.keys(where)
|
|
217
|
+
.sort()
|
|
218
|
+
.flatMap((name) => name === '$and' || name === '$or'
|
|
219
|
+
? where[name].flatMap((part, index) => testedPlaces(part, [...at, name, index]))
|
|
220
|
+
: [{ pointer: name, place: [...at, name] }]);
|
|
221
|
+
}
|
|
222
|
+
function countWalk(plan, model) {
|
|
223
|
+
const keyed = keysWalk(plan, model, 'asc');
|
|
224
|
+
if (keyed.by !== 'path')
|
|
225
|
+
return keyed;
|
|
226
|
+
const tests = conjuncts(plan.root.where);
|
|
227
|
+
for (const { field: pointer, test } of tests) {
|
|
228
|
+
const field = named(pointer);
|
|
229
|
+
if (test.op !== 'range' || field === null)
|
|
230
|
+
continue;
|
|
231
|
+
const definitions = indexing(model, plan.root.types, field);
|
|
232
|
+
if (definitions === null)
|
|
233
|
+
continue;
|
|
234
|
+
const bounding = tests.filter((bounded) => bounded.test.op === 'range' && bounded.field === pointer);
|
|
235
|
+
return {
|
|
236
|
+
by: 'order',
|
|
237
|
+
field,
|
|
238
|
+
direction: 'asc',
|
|
239
|
+
types: definitions.map((definition) => ({
|
|
240
|
+
type: definition.name,
|
|
241
|
+
runs: [{ by: 'range', range: ranged(definition.fields[field], bounding) }],
|
|
242
|
+
})),
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return keyed;
|
|
246
|
+
}
|
|
247
|
+
export function countOf(plan, model, where) {
|
|
248
|
+
if (!countShape(plan))
|
|
249
|
+
return null;
|
|
250
|
+
const types = plan.root.types;
|
|
251
|
+
const grouped = plan.shape.kind === 'groups'
|
|
252
|
+
? [{ pointer: plan.shape.groupBy[0].field, place: ['groupBy', 0] }]
|
|
253
|
+
: [];
|
|
254
|
+
const fields = [...grouped, ...testedPlaces(where, ['where'])].map(({ pointer, place }) => {
|
|
255
|
+
const field = named(pointer);
|
|
256
|
+
if (field === null || indexing(model, types, field) === null)
|
|
257
|
+
return unindexed(model, types, place, place[0] === 'groupBy'
|
|
258
|
+
? 'groups by a field every type it names indexes'
|
|
259
|
+
: 'a count tests only fields every type it names indexes');
|
|
260
|
+
return field;
|
|
261
|
+
});
|
|
262
|
+
return { walk: countWalk(plan, model), fields: [...new Set(fields)].sort() };
|
|
263
|
+
}
|
|
264
|
+
export function walkedValue(definition, field, value) {
|
|
265
|
+
const instant = instantOf(definition.fields[field], value);
|
|
266
|
+
return instant === null ? (value ?? null) : { instant };
|
|
267
|
+
}
|
|
268
|
+
export function hopTargets(plan, model, row) {
|
|
269
|
+
if (plan.hop === null || row.type === null || row.fields === null)
|
|
270
|
+
return [];
|
|
271
|
+
const definition = definitionAt(model, row.path)(row.type);
|
|
272
|
+
const { links } = indexed(row.path, row.fields, definition);
|
|
273
|
+
const named = new Map();
|
|
274
|
+
for (const { handle, target } of placedIn(links, plan.hop.field, 'link'))
|
|
275
|
+
named.set(`${handle ?? ''}\u0000${target}`, { handle, path: target });
|
|
276
|
+
return [...named].sort(([left], [right]) => byCodePoint(left, right)).map(([, target]) => target);
|
|
277
|
+
}
|
package/dist/reserved.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const ROOM_DESCRIPTION = "ROOM.md";
|
|
2
2
|
export declare const CAPTURE_HOME = "capture";
|
|
3
3
|
export declare const RESERVED_NAMES: readonly string[];
|
|
4
|
+
export declare function foldedName(name: string): string;
|
|
4
5
|
export declare function isReservedName(name: string): boolean;
|
|
5
6
|
export declare function isDocumentPath(path: string): boolean;
|
|
6
7
|
//# sourceMappingURL=reserved.d.ts.map
|
package/dist/reserved.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;
|
|
1
|
+
{"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAYF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI/C;AAID,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
package/dist/reserved.js
CHANGED
|
@@ -8,12 +8,23 @@ export const RESERVED_NAMES = [
|
|
|
8
8
|
'agents',
|
|
9
9
|
'house',
|
|
10
10
|
];
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const DOTLESS_I = 'ı';
|
|
12
|
+
const CHEROKEE_SMALL = /[\u13F8-\u13FD\uAB70-\uABBF]/u;
|
|
13
|
+
function foldedPoint(point) {
|
|
14
|
+
if (point === DOTLESS_I)
|
|
15
|
+
return point;
|
|
16
|
+
const folded = point.toLowerCase().toUpperCase().toLowerCase();
|
|
17
|
+
return CHEROKEE_SMALL.test(folded) ? folded.toUpperCase() : folded;
|
|
13
18
|
}
|
|
14
|
-
|
|
19
|
+
export function foldedName(name) {
|
|
20
|
+
let folded = '';
|
|
21
|
+
for (const point of name.normalize('NFC'))
|
|
22
|
+
folded += foldedPoint(point);
|
|
23
|
+
return folded.normalize('NFC');
|
|
24
|
+
}
|
|
25
|
+
const FOLDED_RESERVED_NAMES = new Set(RESERVED_NAMES.map(foldedName));
|
|
15
26
|
export function isReservedName(name) {
|
|
16
|
-
return FOLDED_RESERVED_NAMES.has(
|
|
27
|
+
return FOLDED_RESERVED_NAMES.has(foldedName(name));
|
|
17
28
|
}
|
|
18
29
|
export function isDocumentPath(path) {
|
|
19
30
|
const first = path.split('/', 1)[0];
|
package/dist/room-types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const CHAT_TYPE = "chat";
|
|
2
2
|
export declare const CHAT_MESSAGE_TYPE = "chat-message";
|
|
3
3
|
export declare const INBOX_TYPES: readonly string[];
|
|
4
|
-
export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', '
|
|
4
|
+
export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', 'tiktok', 'viber'];
|
|
5
5
|
export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
|
|
6
|
+
export declare const VIEW_TYPE = "view";
|
|
6
7
|
export declare const ROOM_TYPES_TEXT: string;
|
|
7
8
|
//# sourceMappingURL=room-types.d.ts.map
|
package/dist/room-types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAAmC,CAAC;AAE7E,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAAmC,CAAC;AAE7E,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,OAAO,CACC,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAMpE,eAAO,MAAM,SAAS,SAAS,CAAC;AA8BhC,eAAO,MAAM,eAAe,QAuGhB,CAAC"}
|
package/dist/room-types.js
CHANGED
|
@@ -9,11 +9,12 @@ export const INBOX_CHANNEL_KINDS = [
|
|
|
9
9
|
'whatsapp',
|
|
10
10
|
'messenger',
|
|
11
11
|
'instagram',
|
|
12
|
-
'viber',
|
|
13
12
|
'tiktok',
|
|
13
|
+
'viber',
|
|
14
14
|
];
|
|
15
15
|
const WAYFINDING_MAP_TYPE = 'wayfinding-map';
|
|
16
16
|
const WAYFINDING_TICKET_TYPE = 'wayfinding-ticket';
|
|
17
|
+
export const VIEW_TYPE = 'view';
|
|
17
18
|
const WAYFINDING_MAP_TEXTS = [
|
|
18
19
|
['destination', 'Destination'],
|
|
19
20
|
['notes', 'Notes'],
|
|
@@ -133,5 +134,11 @@ export const ROOM_TYPES_TEXT = [
|
|
|
133
134
|
' else: { properties: { conversation: false } }',
|
|
134
135
|
' - if: { properties: { status: { enum: [done, out-of-scope] } }, required: [status] }',
|
|
135
136
|
' then: { required: [answer], properties: { answer: { minLength: 1, title: Answer } } }',
|
|
137
|
+
`${VIEW_TYPE}:`,
|
|
138
|
+
' properties:',
|
|
139
|
+
' name: { type: string, title: Name }',
|
|
140
|
+
' description: { type: string, title: Description }',
|
|
141
|
+
' query: { type: object, additionalProperties: true, title: Query }',
|
|
142
|
+
' required: [name, description, query]',
|
|
136
143
|
'',
|
|
137
144
|
].join('\n');
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { Definition } from './definition.js';
|
|
2
2
|
export type Library = Readonly<Record<string, string>>;
|
|
3
|
+
export type RoleNeed = 'read' | 'write';
|
|
3
4
|
export type VerifiedModel = {
|
|
4
5
|
readonly types: Readonly<Record<string, Definition>>;
|
|
5
6
|
readonly nameable?: readonly string[];
|
|
7
|
+
readonly roles?: Readonly<Record<string, RoleNeed>>;
|
|
6
8
|
};
|
|
7
9
|
export type ModelVerification = {
|
|
8
10
|
readonly verdict: 'accept';
|
|
@@ -23,13 +25,6 @@ export type ValidationContext = {
|
|
|
23
25
|
readonly anyRoom?: true;
|
|
24
26
|
readonly typedPaths?: readonly TypedPath[];
|
|
25
27
|
};
|
|
26
|
-
export type ProjectionContext = {
|
|
27
|
-
readonly documentTargets: readonly string[];
|
|
28
|
-
readonly definition?: Definition;
|
|
29
|
-
};
|
|
30
|
-
export type DivisionContext = ProjectionContext & {
|
|
31
|
-
readonly bound: number;
|
|
32
|
-
};
|
|
33
28
|
export type Extent = {
|
|
34
29
|
readonly start: number;
|
|
35
30
|
readonly end: number;
|
|
@@ -76,20 +71,6 @@ export type ValidationStep = {
|
|
|
76
71
|
readonly path: string;
|
|
77
72
|
readonly resolved: number;
|
|
78
73
|
};
|
|
79
|
-
export type Projection = {
|
|
80
|
-
readonly ok: true;
|
|
81
|
-
readonly text: string;
|
|
82
|
-
} | {
|
|
83
|
-
readonly ok: false;
|
|
84
|
-
readonly refusal: Refusal;
|
|
85
|
-
};
|
|
86
|
-
export type Division = {
|
|
87
|
-
readonly ok: true;
|
|
88
|
-
readonly spans: readonly Span[];
|
|
89
|
-
} | {
|
|
90
|
-
readonly ok: false;
|
|
91
|
-
readonly refusal: Refusal;
|
|
92
|
-
};
|
|
93
74
|
export type ParseResult = {
|
|
94
75
|
readonly ok: true;
|
|
95
76
|
readonly document: Document;
|
|
@@ -166,6 +147,14 @@ export type BodyResult = {
|
|
|
166
147
|
readonly outcome: 'refuse';
|
|
167
148
|
readonly refusal: Refusal;
|
|
168
149
|
};
|
|
150
|
+
export type LinkSpan = {
|
|
151
|
+
readonly start: number;
|
|
152
|
+
readonly end: number;
|
|
153
|
+
readonly label: Extent | null;
|
|
154
|
+
readonly href: string;
|
|
155
|
+
readonly destination: Extent;
|
|
156
|
+
readonly bracketed: boolean;
|
|
157
|
+
};
|
|
169
158
|
export type UnlinkedBody = {
|
|
170
159
|
readonly body: string;
|
|
171
160
|
readonly links: ReadonlyMap<string, string>;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACr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,CAAC,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAC5D;IACE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,GACD;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
+
import { type KeyedLink } from './paths.js';
|
|
2
3
|
import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
4
|
export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
|
|
4
5
|
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
5
6
|
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
6
7
|
export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
|
|
8
|
+
export declare function verifySchemaDocument(document: string, provided?: VerifiedModel): ModelVerification;
|
|
9
|
+
export declare function readSchemaDocument(document: string, provided?: VerifiedModel): VerifiedModel;
|
|
7
10
|
type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
|
|
8
11
|
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
|
|
9
12
|
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
13
|
+
export declare function bodyKeyedLinks(body: string): KeyedLink[];
|
|
10
14
|
export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
|
|
11
15
|
type Placed = {
|
|
12
16
|
readonly reference: Reached;
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAQjF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,aAAa,EACb,SAAS,EACT,UAA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