@agentshouse/mdmodel 0.1.0-cdbd463e01dc2 → 0.1.0-ce47d8f9de14a
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 +182 -194
- package/README.md +25 -25
- package/dist/body.d.ts +85 -0
- package/dist/body.d.ts.map +1 -0
- package/dist/body.js +1083 -0
- package/dist/built-in.d.ts +4 -0
- package/dist/built-in.d.ts.map +1 -0
- package/dist/built-in.js +19 -0
- package/dist/definition.d.ts +23 -10
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +175 -119
- package/dist/document.d.ts +15 -8
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +769 -140
- package/dist/event.d.ts +3 -4
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js +17 -47
- package/dist/facts.d.ts +2 -2
- package/dist/facts.d.ts.map +1 -1
- package/dist/facts.js +4 -2
- package/dist/fields.d.ts +1 -1
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +2 -2
- package/dist/form.d.ts +4 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +153 -0
- package/dist/house-model.d.ts +934 -0
- package/dist/house-model.d.ts.map +1 -0
- package/dist/house-model.js +513 -0
- package/dist/house-references/crockford.d.ts +4 -0
- package/dist/house-references/crockford.d.ts.map +1 -0
- package/dist/house-references/crockford.js +3 -0
- package/dist/house-references/patterns.d.ts +9 -0
- package/dist/house-references/patterns.d.ts.map +1 -0
- package/dist/house-references/patterns.js +13 -0
- package/dist/index.d.ts +34 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -12
- package/dist/indexed.d.ts +9 -0
- package/dist/indexed.d.ts.map +1 -0
- package/dist/indexed.js +55 -0
- package/dist/kinds.d.ts +4 -2
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +60 -11
- package/dist/markdown.d.ts +71 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +232 -0
- package/dist/media-type.d.ts +72 -0
- package/dist/media-type.d.ts.map +1 -0
- package/dist/media-type.js +157 -0
- package/dist/moment.d.ts +7 -0
- package/dist/moment.d.ts.map +1 -0
- package/dist/moment.js +18 -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 +16 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +107 -22
- package/dist/pattern.d.ts.map +1 -1
- package/dist/pattern.js +4 -3
- package/dist/query/language.d.ts +39 -5
- package/dist/query/language.d.ts.map +1 -1
- package/dist/query/language.js +84 -28
- package/dist/query/match.d.ts +1 -1
- package/dist/query/match.d.ts.map +1 -1
- package/dist/query/match.js +37 -8
- package/dist/query/rows.d.ts +1 -1
- package/dist/query/rows.d.ts.map +1 -1
- package/dist/query/rows.js +2 -5
- package/dist/query/sql.d.ts +7 -1
- package/dist/query/sql.d.ts.map +1 -1
- package/dist/query/sql.js +21 -4
- package/dist/query/walk.d.ts +63 -0
- package/dist/query/walk.d.ts.map +1 -0
- package/dist/query/walk.js +263 -0
- package/dist/references.d.ts +2 -2
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +1 -1
- package/dist/refuse.d.ts +1 -0
- package/dist/refuse.d.ts.map +1 -1
- package/dist/refuse.js +1 -0
- package/dist/reserved.d.ts +2 -0
- package/dist/reserved.d.ts.map +1 -1
- package/dist/reserved.js +17 -5
- package/dist/room-types.d.ts +7 -0
- package/dist/room-types.d.ts.map +1 -0
- package/dist/room-types.js +137 -0
- package/dist/schema.d.ts +1 -3
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +9 -73
- package/dist/types.d.ts +15 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +9 -4
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +145 -164
- package/dist/yaml.d.ts +7 -5
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +158 -44
- package/fixtures/README.md +77 -69
- package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
- package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
- package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
- package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
- package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
- package/fixtures/cases/absolute-link/library/item.md +1 -1
- package/fixtures/cases/absolute-link/schema.yaml +2 -3
- package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
- package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
- package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
- package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
- package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
- package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
- package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
- package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
- package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
- package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
- package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
- package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
- package/fixtures/cases/binary-any-reference/expected.json +2 -1
- package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
- package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
- package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
- package/fixtures/cases/binary-typed-reference/expected.json +2 -1
- package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
- 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/expected.json +2 -1
- package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
- package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
- package/fixtures/cases/boolean-field/schema.yaml +10 -11
- package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
- package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
- package/fixtures/cases/closed-nested-object/expected.json +2 -1
- package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
- package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
- package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
- package/fixtures/cases/composed-root-reference/library/a.md +2 -2
- package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
- package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
- package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
- package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
- package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
- package/fixtures/cases/date-time-format/expected.json +2 -1
- package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
- package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
- package/fixtures/cases/date-time-format/schema.yaml +10 -11
- package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
- package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
- package/fixtures/cases/default-unfilled/schema.yaml +10 -11
- package/fixtures/cases/defs-pattern/expected.json +2 -1
- package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
- package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
- package/fixtures/cases/defs-pattern/schema.yaml +10 -11
- package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
- package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
- package/fixtures/cases/dependent-rule/schema.yaml +10 -11
- package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
- package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
- package/fixtures/cases/email-format/expected.json +2 -1
- package/fixtures/cases/email-format/library/companies/acme.md +1 -1
- package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
- package/fixtures/cases/email-format/schema.yaml +10 -11
- package/fixtures/cases/equal-labels/expected.json +5 -0
- package/fixtures/cases/equal-labels/schema.yaml +4 -0
- package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
- package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
- package/fixtures/cases/field-enum/expected.json +2 -1
- package/fixtures/cases/field-enum/library/item.md +2 -2
- package/fixtures/cases/field-enum/schema.yaml +3 -4
- package/fixtures/cases/frontmatter-construct/expected.json +7 -0
- package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
- package/fixtures/cases/integer-field/expected.json +2 -1
- package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
- package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
- package/fixtures/cases/integer-field/schema.yaml +10 -11
- package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
- package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
- package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
- package/fixtures/cases/labels-in-the-rooms-language/expected.json +1 -0
- package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
- package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
- package/fixtures/cases/lazy-list-item/expected.json +3 -0
- package/fixtures/cases/lazy-list-item/library/item.md +10 -0
- package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
- package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
- package/fixtures/cases/list-item-enum/expected.json +7 -0
- package/fixtures/cases/list-item-enum/library/task.md +7 -0
- package/fixtures/cases/list-item-enum/schema.yaml +3 -0
- package/fixtures/cases/list-item-kind/expected.json +7 -0
- package/fixtures/cases/list-item-kind/library/task.md +6 -0
- package/fixtures/cases/list-item-kind/schema.yaml +3 -0
- package/fixtures/cases/list-items/expected.json +1 -0
- package/fixtures/cases/list-items/library/page.md +26 -0
- package/fixtures/cases/list-items/schema.yaml +10 -0
- package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
- package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
- package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
- package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
- package/fixtures/cases/list-of-objects-item/expected.json +2 -1
- package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
- package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
- package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
- package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
- package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
- package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
- package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
- package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
- package/fixtures/cases/list-reference-path/expected.json +7 -0
- package/fixtures/cases/list-reference-path/library/page.md +5 -0
- package/fixtures/cases/list-reference-path/schema.yaml +3 -0
- package/fixtures/cases/list-reference-type/context.json +1 -0
- package/fixtures/cases/list-reference-type/expected.json +7 -0
- package/fixtures/cases/list-reference-type/library/page.md +6 -0
- package/fixtures/cases/list-reference-type/schema.yaml +3 -0
- package/fixtures/cases/list-size/expected.json +2 -1
- package/fixtures/cases/list-size/library/companies/acme.md +1 -1
- package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
- package/fixtures/cases/list-size/schema.yaml +10 -11
- package/fixtures/cases/long-value-past-six-levels/context.json +1 -0
- package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
- package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
- package/fixtures/cases/malformed-list/context.json +1 -0
- package/fixtures/cases/malformed-list/expected.json +7 -0
- package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
- package/fixtures/cases/malformed-list/schema.yaml +6 -0
- package/fixtures/cases/member-document/library/people/ana.md +2 -2
- package/fixtures/cases/member-on-another-type/library/note.md +1 -1
- package/fixtures/cases/missing-required-field/library/item.md +1 -1
- package/fixtures/cases/missing-required-field/schema.yaml +3 -4
- package/fixtures/cases/misspelled-key/expected.json +2 -1
- package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
- package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
- package/fixtures/cases/misspelled-key/schema.yaml +10 -11
- package/fixtures/cases/name-not-a-string/context.json +1 -0
- package/fixtures/cases/name-not-a-string/expected.json +5 -0
- package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
- package/fixtures/cases/nested-defs/expected.json +2 -1
- package/fixtures/cases/nested-defs/library/deal.md +3 -3
- package/fixtures/cases/nested-object-reference/expected.json +2 -1
- package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
- package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
- package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
- package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
- package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
- package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
- package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
- package/fixtures/cases/nested-reference/library/products/support.md +1 -1
- package/fixtures/cases/nested-required-field/expected.json +2 -1
- package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
- package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
- package/fixtures/cases/nested-required-field/schema.yaml +10 -11
- package/fixtures/cases/numeric-range/expected.json +2 -1
- package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
- package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
- package/fixtures/cases/numeric-range/schema.yaml +10 -11
- package/fixtures/cases/one-key-two-labels/context.json +1 -0
- package/fixtures/cases/one-key-two-labels/expected.json +5 -0
- package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
- package/fixtures/cases/one-key-two-types/context.json +1 -0
- package/fixtures/cases/one-key-two-types/expected.json +5 -0
- package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
- package/fixtures/cases/one-of-variant/expected.json +2 -1
- package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
- package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
- package/fixtures/cases/one-of-variant/schema.yaml +10 -11
- package/fixtures/cases/other-room-reference/expected.json +2 -1
- package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
- package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
- package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
- package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
- package/fixtures/cases/prototype-field/expected.json +2 -1
- package/fixtures/cases/prototype-field/library/item.md +2 -2
- package/fixtures/cases/prototype-field/schema.yaml +2 -3
- package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
- package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
- 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/reference-to-any-file-name/schema.yaml +10 -0
- package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
- package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
- package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
- 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.yaml +10 -0
- package/fixtures/cases/sections-keyword-refused/context.json +1 -0
- package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
- package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
- package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
- package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
- package/fixtures/cases/string-length/expected.json +2 -1
- package/fixtures/cases/string-length/library/companies/acme.md +1 -1
- package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
- package/fixtures/cases/string-length/schema.yaml +10 -11
- package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
- package/fixtures/cases/text-field-kind/expected.json +1 -4
- package/fixtures/cases/text-field-kind/library/page.md +1 -1
- package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
- package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
- package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
- package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
- package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
- package/fixtures/cases/undeclared-field/expected.json +2 -1
- package/fixtures/cases/undeclared-field/library/item.md +2 -2
- package/fixtures/cases/undeclared-field/schema.yaml +2 -3
- package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
- package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
- package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
- package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
- package/fixtures/cases/unresolved-link/library/item.md +1 -1
- package/fixtures/cases/unresolved-link/schema.yaml +2 -3
- package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
- package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
- package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
- package/fixtures/forms.json +371 -0
- package/fixtures/preamble.json +29 -8
- package/fixtures/queries.json +651 -2
- package/package.json +10 -1
- package/dist/blocks.d.ts +0 -11
- package/dist/blocks.d.ts.map +0 -1
- package/dist/blocks.js +0 -91
- package/dist/divide.d.ts +0 -3
- package/dist/divide.d.ts.map +0 -1
- package/dist/divide.js +0 -320
- package/dist/links.d.ts +0 -29
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -831
- package/dist/profile.d.ts +0 -6
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js +0 -5
- package/dist/project.d.ts +0 -22
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js +0 -128
- package/dist/sections.d.ts +0 -11
- package/dist/sections.d.ts.map +0 -1
- package/dist/sections.js +0 -57
- package/fixtures/cases/conditional-section/schema.yaml +0 -14
- package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
- package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
- package/fixtures/cases/null-refused/expected.json +0 -6
- package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
- package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
- package/fixtures/cases/null-refused/schema.yaml +0 -56
- package/fixtures/cases/open-map-value/expected.json +0 -6
- package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
- package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
- package/fixtures/cases/open-map-value/schema.yaml +0 -56
- package/fixtures/cases/section-item-enum/expected.json +0 -6
- package/fixtures/cases/section-item-enum/library/task.md +0 -8
- package/fixtures/cases/section-item-enum/schema.yaml +0 -3
- package/fixtures/cases/section-item-kind/expected.json +0 -6
- package/fixtures/cases/section-item-kind/library/task.md +0 -8
- package/fixtures/cases/section-item-kind/schema.yaml +0 -3
- package/fixtures/cases/section-items/library/page.md +0 -42
- package/fixtures/cases/section-items/schema.yaml +0 -10
- package/fixtures/cases/section-reference-path/expected.json +0 -6
- package/fixtures/cases/section-reference-path/library/page.md +0 -7
- package/fixtures/cases/section-reference-path/schema.yaml +0 -3
- package/fixtures/cases/section-reference-type/expected.json +0 -6
- package/fixtures/cases/section-reference-type/library/page.md +0 -7
- package/fixtures/cases/section-reference-type/schema.yaml +0 -3
- package/fixtures/cases/structured-section/expected.json +0 -6
- package/fixtures/division.json +0 -409
- package/fixtures/projection.json +0 -255
- /package/fixtures/cases/{conditional-section → block-scalar-frontmatter}/context.json +0 -0
- /package/fixtures/cases/{section-items → block-scalar-frontmatter}/expected.json +0 -0
- /package/fixtures/cases/{missing-section-item-kind → conditional-long-text}/context.json +0 -0
- /package/fixtures/cases/{null-refused → equal-labels}/context.json +0 -0
- /package/fixtures/cases/{open-map-value → frontmatter-construct}/context.json +0 -0
- /package/fixtures/cases/{section-item-enum → labels-in-the-rooms-language}/context.json +0 -0
- /package/fixtures/cases/{section-item-kind → lazy-list-item}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-item-enum}/context.json +0 -0
- /package/fixtures/cases/{section-reference-path → list-item-kind}/context.json +0 -0
- /package/fixtures/cases/{section-reference-type → list-items}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
- /package/fixtures/cases/{structured-section → list-reference-path}/context.json +0 -0
- /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
- /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,33 +1,48 @@
|
|
|
1
1
|
export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
|
|
2
|
-
export type { Actor, DocumentEvent, DocumentFacts, Fact,
|
|
3
|
-
export { byCodePoint, compared, dated, fitsKind, instant, instantKey,
|
|
2
|
+
export type { Actor, DocumentEvent, DocumentFacts, Fact, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
|
|
3
|
+
export { byCodePoint, compared, dated, fitsKind, indexKey, instant, instantKey, kindOf, kindWords, } from './kinds.js';
|
|
4
4
|
export type { Kind, Ordering } from './kinds.js';
|
|
5
5
|
export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
|
|
6
|
-
export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupQuery, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
|
|
6
|
+
export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
|
|
7
|
+
export { countOf, countShape, pageOrder, walkedValue, walkOf } from './query/walk.js';
|
|
8
|
+
export type { Count, KeyBound, KeyRange, PageOrder, Walk, WalkRun } from './query/walk.js';
|
|
9
|
+
export { verifyIndexBounds } from './indexed.js';
|
|
10
|
+
export type { IndexBounds } from './indexed.js';
|
|
7
11
|
export { heldAt, matches } from './query/match.js';
|
|
8
12
|
export type { Candidate } from './query/match.js';
|
|
9
13
|
export { heldKind, indexed } from './query/rows.js';
|
|
10
14
|
export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows.js';
|
|
11
15
|
export * as sql from './query/sql.js';
|
|
12
|
-
export { headingLines } from './
|
|
13
|
-
export type { HeadingLine } from './
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
+
export { headingLines } from './markdown.js';
|
|
17
|
+
export type { HeadingLine } from './markdown.js';
|
|
18
|
+
export { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
|
|
19
|
+
export { shownDay, shownMoment } from './moment.js';
|
|
20
|
+
export type { MomentReader } from './moment.js';
|
|
21
|
+
export { labelAt, NAME_FIELD } from './body.js';
|
|
22
|
+
export type { Naming } from './body.js';
|
|
23
|
+
export { apply, bodyLinks, create, links, parse, partText, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
|
|
16
24
|
export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
|
|
25
|
+
export { notReadyWaitMs } from './not-ready.js';
|
|
17
26
|
export type { ReferenceTarget, SavedFacts } from './facts.js';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
27
|
+
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './house-references/crockford.js';
|
|
28
|
+
export { HOUSE_FIELDS, MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
|
|
29
|
+
export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
|
|
30
|
+
export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
|
|
31
|
+
export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, REVISION_REFERENCE_PATTERN, REVISION_REFERENCE_PREFIX, ROOM_REFERENCE_PREFIX, SPACE_REFERENCE_PATTERN, SPACE_REFERENCE_PREFIX, } from './house-references/patterns.js';
|
|
32
|
+
export type { HouseDocumentFields, HouseModelType } from './house-model.js';
|
|
33
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
|
|
34
|
+
export type { InboxChannelKind } from './room-types.js';
|
|
35
|
+
export { keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, urlDestination, } from './paths.js';
|
|
36
|
+
export { openPatternBudget } from './pattern.js';
|
|
37
|
+
export type { LinkedPath, RoomTarget } from './paths.js';
|
|
23
38
|
export { references } from './references.js';
|
|
24
|
-
export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
|
|
25
|
-
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
26
|
-
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue,
|
|
27
|
-
export type { ApplyResult, BodyResult, Change,
|
|
28
|
-
export { assess, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
39
|
+
export { CAPTURE_HOME, foldedName, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
|
|
40
|
+
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
|
|
41
|
+
export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
|
|
42
|
+
export type { ApplyResult, BodyResult, Change, DefinitionOf, Document, DocumentCheck, Extent, Library, ModelVerification, Link, ParseResult, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
|
|
43
|
+
export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
|
|
29
44
|
export type { Assessment, Verdicts } from './validate.js';
|
|
30
45
|
export { VERSION } from './version.js';
|
|
31
|
-
export { bodyAfterFrontmatter,
|
|
32
|
-
export type {
|
|
46
|
+
export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
|
|
47
|
+
export type { DocumentValue } from './yaml.js';
|
|
33
48
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,IAAI,EACJ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,KAAK,EACL,aAAa,EACb,aAAa,EACb,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,UAAU,EACV,MAAM,EACN,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,MAAM,EACN,QAAQ,EACR,aAAa,EACb,UAAU,EACV,OAAO,EACP,KAAK,EACL,SAAS,EACT,MAAM,EACN,UAAU,EACV,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,MAAM,EACN,YAAY,EACZ,SAAS,EACT,aAAa,EACb,aAAa,EACb,MAAM,EACN,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,GAAG,EACH,OAAO,EACP,UAAU,EACV,YAAY,EACZ,KAAK,EACL,SAAS,EACT,cAAc,EACd,SAAS,EACT,OAAO,EACP,SAAS,EACT,KAAK,EACL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtF,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,O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,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,UAAU,EACV,YAAY,EACZ,aAAa,EACb,SAAS,EACT,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,eAAe,EACf,QAAQ,GACT,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,WAAW,EACX,UAAU,EACV,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,MAAM,EACN,OAAO,EACP,iBAAiB,EACjB,IAAI,EACJ,WAAW,EACX,OAAO,EACP,SAAS,EACT,OAAO,EACP,aAAa,EACb,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACnF,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
|
|
2
|
-
export { byCodePoint, compared, dated, fitsKind, instant, instantKey,
|
|
2
|
+
export { byCodePoint, compared, dated, fitsKind, indexKey, instant, instantKey, kindOf, kindWords, } from './kinds.js';
|
|
3
3
|
export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
|
|
4
|
+
export { countOf, countShape, pageOrder, walkedValue, walkOf } from './query/walk.js';
|
|
5
|
+
export { verifyIndexBounds } from './indexed.js';
|
|
4
6
|
export { heldAt, matches } from './query/match.js';
|
|
5
7
|
export { heldKind, indexed } from './query/rows.js';
|
|
6
8
|
export * as sql from './query/sql.js';
|
|
7
|
-
export { headingLines } from './
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
9
|
+
export { headingLines } from './markdown.js';
|
|
10
|
+
export { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
|
|
11
|
+
export { shownDay, shownMoment } from './moment.js';
|
|
12
|
+
export { labelAt, NAME_FIELD } from './body.js';
|
|
13
|
+
export { apply, bodyLinks, create, links, parse, partText, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
|
|
10
14
|
export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
+
export { notReadyWaitMs } from './not-ready.js';
|
|
16
|
+
export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './house-references/crockford.js';
|
|
17
|
+
export { HOUSE_FIELDS, MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
|
|
18
|
+
export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
|
|
19
|
+
export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
|
|
20
|
+
export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, REVISION_REFERENCE_PATTERN, REVISION_REFERENCE_PREFIX, ROOM_REFERENCE_PREFIX, SPACE_REFERENCE_PATTERN, SPACE_REFERENCE_PREFIX, } from './house-references/patterns.js';
|
|
21
|
+
export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES } from './room-types.js';
|
|
22
|
+
export { keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, urlDestination, } from './paths.js';
|
|
23
|
+
export { openPatternBudget } from './pattern.js';
|
|
15
24
|
export { references } from './references.js';
|
|
16
|
-
export { isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION } from './reserved.js';
|
|
17
|
-
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
|
|
18
|
-
export { assess, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
|
|
25
|
+
export { CAPTURE_HOME, foldedName, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
|
|
26
|
+
export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
|
|
27
|
+
export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, } from './validate.js';
|
|
19
28
|
export { VERSION } from './version.js';
|
|
20
|
-
export { bodyAfterFrontmatter,
|
|
29
|
+
export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Failure } from './definition.js';
|
|
2
|
+
import type { ModelVerification, VerifiedModel } from './types.js';
|
|
3
|
+
export type IndexBounds = {
|
|
4
|
+
readonly perType: number;
|
|
5
|
+
readonly longestText: number;
|
|
6
|
+
};
|
|
7
|
+
export declare function indexedFailure(model: VerifiedModel): Failure | undefined;
|
|
8
|
+
export declare function verifyIndexBounds(model: VerifiedModel, bounds: IndexBounds): ModelVerification;
|
|
9
|
+
//# sourceMappingURL=indexed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexed.d.ts","sourceRoot":"","sources":["../src/indexed.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGnE,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AA+CrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,CAQxE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,iBAAiB,CAW9F"}
|
package/dist/indexed.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { admitted, conjoined, escapePointer, refuse, UNIONS, } from './definition.js';
|
|
2
|
+
import { HOUSE_FIELDS } from './fields.js';
|
|
3
|
+
import { kindOf } from './kinds.js';
|
|
4
|
+
import { isRecord } from './yaml.js';
|
|
5
|
+
const PLAIN = ['string', 'number', 'boolean'];
|
|
6
|
+
const UNBOUNDED_KINDS = ['enum', 'date', 'date-time', 'time'];
|
|
7
|
+
function declarations(definition, field) {
|
|
8
|
+
const { schema, defs } = definition.shape;
|
|
9
|
+
return conjoined([{ node: schema, at: '' }], defs, new Set()).held.flatMap(({ node }) => isRecord(node.properties) && Object.hasOwn(node.properties, field)
|
|
10
|
+
? [node.properties[field]]
|
|
11
|
+
: []);
|
|
12
|
+
}
|
|
13
|
+
function indexable(definition, field) {
|
|
14
|
+
if (HOUSE_FIELDS.includes(field) || !Object.hasOwn(definition.fields, field))
|
|
15
|
+
return null;
|
|
16
|
+
const facts = definition.fields[field];
|
|
17
|
+
if (facts.markdown === true || facts.reference !== undefined)
|
|
18
|
+
return null;
|
|
19
|
+
const declared = declarations(definition, field);
|
|
20
|
+
const { defs } = definition.shape;
|
|
21
|
+
const held = conjoined(declared.map((node) => ({ node, at: '' })), defs, new Set()).held.map(({ node }) => node);
|
|
22
|
+
if (held.length === 0 ||
|
|
23
|
+
held.some((node) => UNIONS.some((keyword) => node[keyword] !== undefined)))
|
|
24
|
+
return null;
|
|
25
|
+
const types = admitted(declared, defs, new Set());
|
|
26
|
+
const plain = types === null ? [] : [...types].filter((type) => type !== 'null');
|
|
27
|
+
if (plain.length !== 1 || !PLAIN.includes(plain[0]))
|
|
28
|
+
return null;
|
|
29
|
+
if (plain[0] !== 'string' || UNBOUNDED_KINDS.includes(kindOf(facts) ?? ''))
|
|
30
|
+
return { text: null };
|
|
31
|
+
const lengths = held.flatMap((node) => typeof node.maxLength === 'number' ? [node.maxLength] : []);
|
|
32
|
+
return lengths.length === 0 ? null : { text: Math.min(...lengths) };
|
|
33
|
+
}
|
|
34
|
+
function at(name, index) {
|
|
35
|
+
return `/${escapePointer(name)}/indexed/${index}`;
|
|
36
|
+
}
|
|
37
|
+
export function indexedFailure(model) {
|
|
38
|
+
for (const [name, definition] of Object.entries(model.types)) {
|
|
39
|
+
const index = (definition.indexed ?? []).findIndex((field) => indexable(definition, field) === null);
|
|
40
|
+
if (index !== -1)
|
|
41
|
+
return refuse('indexed', at(name, index));
|
|
42
|
+
}
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
export function verifyIndexBounds(model, bounds) {
|
|
46
|
+
for (const [name, definition] of Object.entries(model.types)) {
|
|
47
|
+
const indexed = definition.indexed ?? [];
|
|
48
|
+
if (indexed.length > bounds.perType)
|
|
49
|
+
return { verdict: 'refuse', rule: 'indexed', location: at(name, bounds.perType) };
|
|
50
|
+
const index = indexed.findIndex((field) => (indexable(definition, field)?.text ?? 0) > bounds.longestText);
|
|
51
|
+
if (index !== -1)
|
|
52
|
+
return { verdict: 'refuse', rule: 'indexed', location: at(name, index) };
|
|
53
|
+
}
|
|
54
|
+
return { verdict: 'accept', model };
|
|
55
|
+
}
|
package/dist/kinds.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ValueFacts } from './definition.js';
|
|
2
|
-
export
|
|
3
|
-
export type Kind = (typeof KINDS)[number];
|
|
2
|
+
export type Kind = 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'date-time' | 'time' | 'enum' | 'reference';
|
|
4
3
|
export type Ordering = {
|
|
5
4
|
readonly direction: 'asc' | 'desc';
|
|
6
5
|
readonly nulls: 'first' | 'last';
|
|
@@ -14,6 +13,9 @@ export declare function kindWords(facts: ValueFacts | undefined): readonly strin
|
|
|
14
13
|
export declare function dated(value: unknown): value is string;
|
|
15
14
|
export declare function instant(value: unknown): bigint | undefined;
|
|
16
15
|
export declare function instantKey(value: unknown): string | null;
|
|
16
|
+
export declare function instantOf(facts: ValueFacts | undefined, value: unknown): string | null;
|
|
17
|
+
export declare function indexKey(facts: ValueFacts, value: unknown): Uint8Array;
|
|
18
|
+
export declare function sortedKey(value: unknown): Uint8Array | null;
|
|
17
19
|
export declare function byCodePoint(left: string, right: string): number;
|
|
18
20
|
export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
|
|
19
21
|
//# sourceMappingURL=kinds.d.ts.map
|
package/dist/kinds.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../src/kinds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;A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B,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAUtE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,GAAG,IAAI,CAU3D;AAaD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAO/D;AA4BD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAMlF"}
|
package/dist/kinds.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
import { format } from '@cfworker/json-schema';
|
|
2
2
|
import { normalize } from './paths.js';
|
|
3
|
-
export const KINDS = [
|
|
4
|
-
'string',
|
|
5
|
-
'number',
|
|
6
|
-
'integer',
|
|
7
|
-
'boolean',
|
|
8
|
-
'date',
|
|
9
|
-
'date-time',
|
|
10
|
-
'time',
|
|
11
|
-
'enum',
|
|
12
|
-
'reference',
|
|
13
|
-
];
|
|
14
3
|
const DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt\s](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:[Zz]|([+-])(\d{2})(?::?(\d{2}))?)$/u;
|
|
15
4
|
const BEFORE_YEAR_ZERO = 62200000000000000000n;
|
|
16
5
|
const INSTANT_DIGITS = 21;
|
|
6
|
+
const MISSING_KEY = 0;
|
|
7
|
+
const NUMBER_KEYS = 1;
|
|
8
|
+
const INSTANT_KEYS = 2;
|
|
9
|
+
const TEXT_KEYS = 3;
|
|
17
10
|
export function kindOf(facts) {
|
|
18
11
|
if (facts.reference !== undefined)
|
|
19
12
|
return 'reference';
|
|
@@ -97,6 +90,62 @@ export function instantKey(value) {
|
|
|
97
90
|
const at = instant(value);
|
|
98
91
|
return at === undefined ? null : (at + BEFORE_YEAR_ZERO).toString().padStart(INSTANT_DIGITS, '0');
|
|
99
92
|
}
|
|
93
|
+
export function instantOf(facts, value) {
|
|
94
|
+
return facts !== undefined && kindOf(facts) === 'date-time' ? instantKey(value) : null;
|
|
95
|
+
}
|
|
96
|
+
function utf8(text) {
|
|
97
|
+
const bytes = [];
|
|
98
|
+
for (const char of text) {
|
|
99
|
+
const code = char.codePointAt(0);
|
|
100
|
+
if (code < 0x80)
|
|
101
|
+
bytes.push(code);
|
|
102
|
+
else if (code < 0x800)
|
|
103
|
+
bytes.push(0xc0 | (code >> 6), 0x80 | (code & 0x3f));
|
|
104
|
+
else if (code < 0x10000)
|
|
105
|
+
bytes.push(0xe0 | (code >> 12), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f));
|
|
106
|
+
else
|
|
107
|
+
bytes.push(0xf0 | (code >> 18), 0x80 | ((code >> 12) & 0x3f), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f));
|
|
108
|
+
}
|
|
109
|
+
return bytes;
|
|
110
|
+
}
|
|
111
|
+
function numberKey(value) {
|
|
112
|
+
const key = new Uint8Array(9);
|
|
113
|
+
const view = new DataView(key.buffer);
|
|
114
|
+
view.setUint8(0, NUMBER_KEYS);
|
|
115
|
+
view.setFloat64(1, value === 0 ? 0 : value);
|
|
116
|
+
const sign = view.getUint8(1);
|
|
117
|
+
if (sign < 0x80)
|
|
118
|
+
view.setUint8(1, sign | 0x80);
|
|
119
|
+
else
|
|
120
|
+
for (let at = 1; at < key.length; at += 1)
|
|
121
|
+
view.setUint8(at, ~view.getUint8(at) & 0xff);
|
|
122
|
+
return key;
|
|
123
|
+
}
|
|
124
|
+
export function indexKey(facts, value) {
|
|
125
|
+
if (value === undefined || value === null)
|
|
126
|
+
return Uint8Array.of(MISSING_KEY);
|
|
127
|
+
if (typeof value === 'boolean')
|
|
128
|
+
return numberKey(value ? 1 : 0);
|
|
129
|
+
if (typeof value === 'number')
|
|
130
|
+
return numberKey(value);
|
|
131
|
+
if (typeof value !== 'string')
|
|
132
|
+
throw new Error('an indexed value is a number, a boolean or a string');
|
|
133
|
+
const at = instantOf(facts, value);
|
|
134
|
+
return at === null
|
|
135
|
+
? Uint8Array.of(TEXT_KEYS, ...utf8(value))
|
|
136
|
+
: Uint8Array.of(INSTANT_KEYS, ...utf8(at));
|
|
137
|
+
}
|
|
138
|
+
export function sortedKey(value) {
|
|
139
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
140
|
+
const { instant, ...rest } = value;
|
|
141
|
+
return typeof instant === 'string' && Object.keys(rest).length === 0
|
|
142
|
+
? Uint8Array.of(INSTANT_KEYS, ...utf8(instant))
|
|
143
|
+
: null;
|
|
144
|
+
}
|
|
145
|
+
return value === null || ['boolean', 'number', 'string'].includes(typeof value)
|
|
146
|
+
? indexKey({ prose: false }, value)
|
|
147
|
+
: null;
|
|
148
|
+
}
|
|
100
149
|
function rank(value) {
|
|
101
150
|
if (typeof value === 'boolean' || typeof value === 'number')
|
|
102
151
|
return 1;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type HeadingLine = {
|
|
2
|
+
readonly level: number;
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly start: number;
|
|
5
|
+
readonly textEnd: number;
|
|
6
|
+
readonly next: number;
|
|
7
|
+
};
|
|
8
|
+
export type HrefOccurrence = {
|
|
9
|
+
readonly href: string;
|
|
10
|
+
readonly start: number;
|
|
11
|
+
readonly end: number;
|
|
12
|
+
readonly bracketed: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type LinkUse = {
|
|
15
|
+
readonly start: number;
|
|
16
|
+
readonly end: number;
|
|
17
|
+
readonly labelStart: number;
|
|
18
|
+
readonly labelEnd: number;
|
|
19
|
+
readonly destination: HrefOccurrence;
|
|
20
|
+
};
|
|
21
|
+
export type DefinitionBlock = {
|
|
22
|
+
readonly start: number;
|
|
23
|
+
readonly end: number;
|
|
24
|
+
readonly destination: HrefOccurrence;
|
|
25
|
+
};
|
|
26
|
+
export type Node = {
|
|
27
|
+
readonly type: string;
|
|
28
|
+
readonly position?: {
|
|
29
|
+
readonly start: {
|
|
30
|
+
readonly offset?: number;
|
|
31
|
+
};
|
|
32
|
+
readonly end: {
|
|
33
|
+
readonly offset?: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly children?: readonly Node[];
|
|
37
|
+
readonly depth?: number;
|
|
38
|
+
readonly identifier?: string;
|
|
39
|
+
readonly checked?: boolean | null;
|
|
40
|
+
readonly ordered?: boolean | null;
|
|
41
|
+
readonly lang?: string | null;
|
|
42
|
+
readonly value?: string;
|
|
43
|
+
};
|
|
44
|
+
export type Reading = {
|
|
45
|
+
readonly headings: readonly HeadingLine[];
|
|
46
|
+
readonly uses: readonly LinkUse[];
|
|
47
|
+
readonly definitions: readonly DefinitionBlock[];
|
|
48
|
+
readonly tree: readonly Node[];
|
|
49
|
+
readonly base: number;
|
|
50
|
+
};
|
|
51
|
+
export declare function lineBreaks(text: string): readonly number[];
|
|
52
|
+
export declare function lineNumber(breaks: readonly number[], offset: number): number;
|
|
53
|
+
export declare function lineStart(text: string, index: number): number;
|
|
54
|
+
export declare function lineEnd(text: string, index: number): {
|
|
55
|
+
readonly end: number;
|
|
56
|
+
readonly next: number;
|
|
57
|
+
};
|
|
58
|
+
export declare function read(text: string, at?: number): Reading;
|
|
59
|
+
export declare function destinations(reading: Reading): readonly HrefOccurrence[];
|
|
60
|
+
export declare function linkable(text: string, from?: number): boolean;
|
|
61
|
+
export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
|
|
62
|
+
export declare function headingLines(content: string, from: number, to: number): HeadingLine[];
|
|
63
|
+
export type SectionSpan = {
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly headingStart: number;
|
|
66
|
+
readonly bodyStart: number;
|
|
67
|
+
readonly bodyEnd: number;
|
|
68
|
+
};
|
|
69
|
+
export declare function sectionSpans(reading: Reading, end: number): SectionSpan[];
|
|
70
|
+
export declare function sectionsRecord(spans: readonly SectionSpan[], content: string): Record<string, string>;
|
|
71
|
+
//# sour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IAAI,EAAE,MAAM,CAAA;CAAE,CAKjD;AAgBD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAI,GAAG,OAAO,CAwElD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,cAAc,EAAE,CAIxE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,OAAO,CAExD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAEvE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CAErF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,EAAE,CAczE;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB"}
|
package/dist/markdown.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { fromMarkdown, } from 'mdast-util-from-markdown';
|
|
2
|
+
import { gfmFootnoteFromMarkdown } from 'mdast-util-gfm-footnote';
|
|
3
|
+
import { gfmStrikethroughFromMarkdown } from 'mdast-util-gfm-strikethrough';
|
|
4
|
+
import { gfmTableFromMarkdown } from 'mdast-util-gfm-table';
|
|
5
|
+
import { gfmTaskListItemFromMarkdown } from 'mdast-util-gfm-task-list-item';
|
|
6
|
+
import { gfmFootnote } from 'micromark-extension-gfm-footnote';
|
|
7
|
+
import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough';
|
|
8
|
+
import { gfmTable } from 'micromark-extension-gfm-table';
|
|
9
|
+
import { gfmTaskListItem } from 'micromark-extension-gfm-task-list-item';
|
|
10
|
+
const BYTE_ORDER_MARK = 0xfeff;
|
|
11
|
+
const LINKED = new Set(['link', 'image', 'linkReference', 'imageReference']);
|
|
12
|
+
const REFERENCED = new Set(['linkReference', 'imageReference']);
|
|
13
|
+
const SYNTAX = [gfmFootnote(), gfmStrikethrough(), gfmTable(), gfmTaskListItem()];
|
|
14
|
+
function startOf(node) {
|
|
15
|
+
return node.position.start.offset;
|
|
16
|
+
}
|
|
17
|
+
function endOf(node) {
|
|
18
|
+
return node.position.end.offset;
|
|
19
|
+
}
|
|
20
|
+
function marked(marks, node) {
|
|
21
|
+
let mark = marks.get(node);
|
|
22
|
+
if (mark === undefined) {
|
|
23
|
+
mark = {};
|
|
24
|
+
marks.set(node, mark);
|
|
25
|
+
}
|
|
26
|
+
return mark;
|
|
27
|
+
}
|
|
28
|
+
function marking(text, shift, marks, labelled) {
|
|
29
|
+
const at = (point) => point.offset + shift;
|
|
30
|
+
return {
|
|
31
|
+
afterExit(token) {
|
|
32
|
+
const top = this.stack[this.stack.length - 1];
|
|
33
|
+
const start = at(token.start);
|
|
34
|
+
const end = at(token.end);
|
|
35
|
+
switch (token.type) {
|
|
36
|
+
case 'labelText': {
|
|
37
|
+
const node = this.stack[this.stack.length - 2];
|
|
38
|
+
marked(marks, node).label = { start, end };
|
|
39
|
+
labelled.push(node);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
case 'resourceDestinationLiteral':
|
|
43
|
+
case 'definitionDestinationLiteral':
|
|
44
|
+
marked(marks, top).destination = {
|
|
45
|
+
href: text.slice(start + 1, end - 1),
|
|
46
|
+
start,
|
|
47
|
+
end,
|
|
48
|
+
bracketed: true,
|
|
49
|
+
};
|
|
50
|
+
return;
|
|
51
|
+
case 'resourceDestinationRaw':
|
|
52
|
+
case 'definitionDestinationRaw':
|
|
53
|
+
marked(marks, top).destination = {
|
|
54
|
+
href: text.slice(start, end),
|
|
55
|
+
start,
|
|
56
|
+
end,
|
|
57
|
+
bracketed: false,
|
|
58
|
+
};
|
|
59
|
+
return;
|
|
60
|
+
case 'resource':
|
|
61
|
+
marked(marks, top).resourceEnd = end;
|
|
62
|
+
return;
|
|
63
|
+
case 'atxHeadingText':
|
|
64
|
+
case 'setextHeadingText':
|
|
65
|
+
marked(marks, top).text = { start, end };
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export function lineBreaks(text) {
|
|
72
|
+
const breaks = [];
|
|
73
|
+
for (let at = text.indexOf('\n'); at !== -1; at = text.indexOf('\n', at + 1))
|
|
74
|
+
breaks.push(at);
|
|
75
|
+
return breaks;
|
|
76
|
+
}
|
|
77
|
+
export function lineNumber(breaks, offset) {
|
|
78
|
+
let low = 0;
|
|
79
|
+
let high = breaks.length;
|
|
80
|
+
while (low < high) {
|
|
81
|
+
const middle = (low + high) >>> 1;
|
|
82
|
+
if (breaks[middle] < offset)
|
|
83
|
+
low = middle + 1;
|
|
84
|
+
else
|
|
85
|
+
high = middle;
|
|
86
|
+
}
|
|
87
|
+
return low + 1;
|
|
88
|
+
}
|
|
89
|
+
export function lineStart(text, index) {
|
|
90
|
+
let at = index;
|
|
91
|
+
while (at > 0 && text[at - 1] !== '\n' && text[at - 1] !== '\r')
|
|
92
|
+
at -= 1;
|
|
93
|
+
return at;
|
|
94
|
+
}
|
|
95
|
+
export function lineEnd(text, index) {
|
|
96
|
+
let at = index;
|
|
97
|
+
while (at < text.length && text[at] !== '\n' && text[at] !== '\r')
|
|
98
|
+
at += 1;
|
|
99
|
+
if (at === text.length)
|
|
100
|
+
return { end: at, next: at };
|
|
101
|
+
return { end: at, next: text[at] === '\r' && text[at + 1] === '\n' ? at + 2 : at + 1 };
|
|
102
|
+
}
|
|
103
|
+
function shifted(value, by) {
|
|
104
|
+
return { ...value, start: value.start + by, end: value.end + by };
|
|
105
|
+
}
|
|
106
|
+
function walked(root, visit) {
|
|
107
|
+
const pending = [root];
|
|
108
|
+
while (pending.length > 0) {
|
|
109
|
+
const node = pending.pop();
|
|
110
|
+
visit(node);
|
|
111
|
+
const children = node.children ?? [];
|
|
112
|
+
for (let index = children.length - 1; index >= 0; index -= 1)
|
|
113
|
+
pending.push(children[index]);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export function read(text, at = 0) {
|
|
117
|
+
const marks = new WeakMap();
|
|
118
|
+
const labelled = [];
|
|
119
|
+
const shift = text.charCodeAt(0) === BYTE_ORDER_MARK ? 1 : 0;
|
|
120
|
+
const root = fromMarkdown(text, {
|
|
121
|
+
extensions: SYNTAX,
|
|
122
|
+
mdastExtensions: [
|
|
123
|
+
gfmFootnoteFromMarkdown(),
|
|
124
|
+
gfmStrikethroughFromMarkdown(),
|
|
125
|
+
gfmTableFromMarkdown(),
|
|
126
|
+
gfmTaskListItemFromMarkdown(),
|
|
127
|
+
marking(text, shift, marks, labelled),
|
|
128
|
+
],
|
|
129
|
+
});
|
|
130
|
+
const local = (offset) => offset + shift;
|
|
131
|
+
const headings = [];
|
|
132
|
+
for (const node of root.children ?? []) {
|
|
133
|
+
let start = local(startOf(node));
|
|
134
|
+
while (start > 0 && (text[start - 1] === ' ' || text[start - 1] === '\t'))
|
|
135
|
+
start -= 1;
|
|
136
|
+
const end = local(endOf(node));
|
|
137
|
+
if (node.type === 'heading') {
|
|
138
|
+
const name = marks.get(node)?.text;
|
|
139
|
+
const line = lineEnd(text, end);
|
|
140
|
+
headings.push({
|
|
141
|
+
level: node.depth,
|
|
142
|
+
name: name === undefined ? '' : text.slice(name.start, name.end),
|
|
143
|
+
start: at + start,
|
|
144
|
+
textEnd: at + line.end,
|
|
145
|
+
next: at + line.next,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const destinations = new Map();
|
|
150
|
+
const definitions = [];
|
|
151
|
+
walked(root, (node) => {
|
|
152
|
+
const mark = marks.get(node);
|
|
153
|
+
if (node.type !== 'definition' || mark?.destination === undefined)
|
|
154
|
+
return;
|
|
155
|
+
const destination = shifted(mark.destination, at);
|
|
156
|
+
if (!destinations.has(node.identifier))
|
|
157
|
+
destinations.set(node.identifier, destination);
|
|
158
|
+
definitions.push({
|
|
159
|
+
start: at + lineStart(text, local(startOf(node))),
|
|
160
|
+
end: at + lineEnd(text, local(endOf(node))).next,
|
|
161
|
+
destination,
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
const uses = [];
|
|
165
|
+
for (const node of labelled) {
|
|
166
|
+
if (!LINKED.has(node.type))
|
|
167
|
+
continue;
|
|
168
|
+
const mark = marks.get(node);
|
|
169
|
+
const destination = REFERENCED.has(node.type)
|
|
170
|
+
? destinations.get(node.identifier)
|
|
171
|
+
: mark.destination !== undefined
|
|
172
|
+
? shifted(mark.destination, at)
|
|
173
|
+
: mark.resourceEnd === undefined
|
|
174
|
+
? undefined
|
|
175
|
+
: {
|
|
176
|
+
href: '',
|
|
177
|
+
start: at + mark.resourceEnd - 1,
|
|
178
|
+
end: at + mark.resourceEnd - 1,
|
|
179
|
+
bracketed: false,
|
|
180
|
+
};
|
|
181
|
+
if (destination === undefined)
|
|
182
|
+
continue;
|
|
183
|
+
uses.push({
|
|
184
|
+
start: at + local(startOf(node)),
|
|
185
|
+
end: at + local(endOf(node)),
|
|
186
|
+
labelStart: at + mark.label.start,
|
|
187
|
+
labelEnd: at + mark.label.end,
|
|
188
|
+
destination,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
uses.sort((left, right) => left.start - right.start);
|
|
192
|
+
return { headings, uses, definitions, tree: root.children ?? [], base: at + shift };
|
|
193
|
+
}
|
|
194
|
+
export function destinations(reading) {
|
|
195
|
+
const byStart = new Map();
|
|
196
|
+
for (const use of reading.uses)
|
|
197
|
+
byStart.set(use.destination.start, use.destination);
|
|
198
|
+
return [...byStart.values()].sort((left, right) => left.start - right.start);
|
|
199
|
+
}
|
|
200
|
+
export function linkable(text, from = 0) {
|
|
201
|
+
return text.includes('](', from) || text.includes(']:', from);
|
|
202
|
+
}
|
|
203
|
+
export function hrefOccurrences(body) {
|
|
204
|
+
return linkable(body) ? destinations(read(body)) : [];
|
|
205
|
+
}
|
|
206
|
+
export function headingLines(content, from, to) {
|
|
207
|
+
return [...read(content.slice(from, to), from).headings];
|
|
208
|
+
}
|
|
209
|
+
export function sectionSpans(reading, end) {
|
|
210
|
+
const found = [];
|
|
211
|
+
for (const heading of reading.headings) {
|
|
212
|
+
if (heading.level !== 2)
|
|
213
|
+
continue;
|
|
214
|
+
if (found.length > 0)
|
|
215
|
+
found[found.length - 1] = { ...found[found.length - 1], bodyEnd: heading.start };
|
|
216
|
+
found.push({
|
|
217
|
+
name: heading.name,
|
|
218
|
+
headingStart: heading.start,
|
|
219
|
+
bodyStart: heading.next,
|
|
220
|
+
bodyEnd: end,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return found;
|
|
224
|
+
}
|
|
225
|
+
export function sectionsRecord(spans, content) {
|
|
226
|
+
const record = Object.create(null);
|
|
227
|
+
for (const span of spans) {
|
|
228
|
+
if (record[span.name] === undefined)
|
|
229
|
+
record[span.name] = content.slice(span.bodyStart, span.bodyEnd);
|
|
230
|
+
}
|
|
231
|
+
return record;
|
|
232
|
+
}
|