@agentshouse/mdmodel 0.1.0-caefdbe3e3d42 → 0.1.0-caf400e6c33ef
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 +185 -165
- 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 +20 -11
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +178 -127
- package/dist/divide.d.ts.map +1 -1
- package/dist/divide.js +5 -4
- package/dist/document.d.ts +14 -8
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +726 -132
- package/dist/event.d.ts +77 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +200 -0
- package/dist/facts.d.ts +15 -0
- package/dist/facts.d.ts.map +1 -0
- package/dist/facts.js +41 -0
- 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 +866 -0
- package/dist/house-model.d.ts.map +1 -0
- package/dist/house-model.js +470 -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 +33 -20
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -13
- package/dist/kinds.d.ts +2 -2
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +20 -11
- package/dist/markdown.d.ts +75 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +265 -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/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 +10 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +74 -19
- package/dist/pattern.d.ts.map +1 -1
- package/dist/pattern.js +4 -3
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +33 -60
- package/dist/query/language.d.ts +43 -7
- package/dist/query/language.d.ts.map +1 -1
- package/dist/query/language.js +151 -57
- package/dist/query/match.d.ts +3 -1
- package/dist/query/match.d.ts.map +1 -1
- package/dist/query/match.js +40 -8
- package/dist/query/rows.d.ts +1 -1
- package/dist/query/rows.d.ts.map +1 -1
- package/dist/query/rows.js +1 -1
- package/dist/query/sql.d.ts.map +1 -1
- package/dist/query/sql.js +7 -1
- 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 +1 -0
- package/dist/reserved.d.ts.map +1 -1
- package/dist/reserved.js +2 -1
- package/dist/room-types.d.ts +7 -0
- package/dist/room-types.d.ts.map +1 -0
- package/dist/room-types.js +136 -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 -17
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +8 -5
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +142 -180
- package/dist/yaml.d.ts +4 -4
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +5 -12
- package/fixtures/README.md +40 -23
- 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/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/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/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/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/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/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/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/division.json +86 -41
- package/fixtures/forms.json +347 -0
- package/fixtures/preamble.json +26 -5
- package/fixtures/projection.json +121 -18
- package/fixtures/queries.json +51 -0
- 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/condition.d.ts +0 -179
- package/dist/condition.d.ts.map +0 -1
- package/dist/condition.js +0 -598
- 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/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/cases/{conditional-section → conditional-long-text}/context.json +0 -0
- /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
- /package/fixtures/cases/{null-refused → labels-in-the-rooms-language}/context.json +0 -0
- /package/fixtures/cases/{section-items → labels-in-the-rooms-language}/expected.json +0 -0
- /package/fixtures/cases/{open-map-value → lazy-list-item}/context.json +0 -0
- /package/fixtures/cases/{section-item-enum → list-item-enum}/context.json +0 -0
- /package/fixtures/cases/{section-item-kind → list-item-kind}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
- /package/fixtures/cases/{section-reference-path → 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}/context.json +0 -0
- /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
- /package/fixtures/cases/{structured-section → long-value-past-six-levels}/context.json +0 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export const MEDIA_TYPES = {
|
|
2
|
+
html: 'text/html',
|
|
3
|
+
css: 'text/css',
|
|
4
|
+
javascript: 'text/javascript',
|
|
5
|
+
plainText: 'text/plain',
|
|
6
|
+
markdown: 'text/markdown',
|
|
7
|
+
csv: 'text/csv',
|
|
8
|
+
json: 'application/json',
|
|
9
|
+
xml: 'application/xml',
|
|
10
|
+
yaml: 'application/yaml',
|
|
11
|
+
ndjson: 'application/x-ndjson',
|
|
12
|
+
webManifest: 'application/manifest+json',
|
|
13
|
+
reports: 'application/reports+json',
|
|
14
|
+
githubJson: 'application/vnd.github+json',
|
|
15
|
+
form: 'application/x-www-form-urlencoded',
|
|
16
|
+
octetStream: 'application/octet-stream',
|
|
17
|
+
gzip: 'application/gzip',
|
|
18
|
+
tar: 'application/x-tar',
|
|
19
|
+
zip: 'application/zip',
|
|
20
|
+
gitBundle: 'application/x-git-bundle',
|
|
21
|
+
wasm: 'application/wasm',
|
|
22
|
+
pdf: 'application/pdf',
|
|
23
|
+
docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
24
|
+
pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
|
|
25
|
+
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
26
|
+
avif: 'image/avif',
|
|
27
|
+
gif: 'image/gif',
|
|
28
|
+
heic: 'image/heic',
|
|
29
|
+
icon: 'image/vnd.microsoft.icon',
|
|
30
|
+
jpeg: 'image/jpeg',
|
|
31
|
+
png: 'image/png',
|
|
32
|
+
svg: 'image/svg+xml',
|
|
33
|
+
webp: 'image/webp',
|
|
34
|
+
aac: 'audio/aac',
|
|
35
|
+
amr: 'audio/amr',
|
|
36
|
+
m4a: 'audio/mp4',
|
|
37
|
+
mp3: 'audio/mpeg',
|
|
38
|
+
ogg: 'audio/ogg',
|
|
39
|
+
wav: 'audio/wav',
|
|
40
|
+
threeGpp: 'video/3gpp',
|
|
41
|
+
mp4: 'video/mp4',
|
|
42
|
+
quickTime: 'video/quicktime',
|
|
43
|
+
webm: 'video/webm',
|
|
44
|
+
otf: 'font/otf',
|
|
45
|
+
ttf: 'font/ttf',
|
|
46
|
+
woff: 'font/woff',
|
|
47
|
+
woff2: 'font/woff2',
|
|
48
|
+
};
|
|
49
|
+
const UTF8 = 'utf-8';
|
|
50
|
+
export function withCharset(type, charset) {
|
|
51
|
+
return `${type}; charset=${charset}`;
|
|
52
|
+
}
|
|
53
|
+
function utf8(type) {
|
|
54
|
+
return withCharset(type, UTF8);
|
|
55
|
+
}
|
|
56
|
+
export const UTF8_TEXT = {
|
|
57
|
+
html: utf8(MEDIA_TYPES.html),
|
|
58
|
+
css: utf8(MEDIA_TYPES.css),
|
|
59
|
+
javascript: utf8(MEDIA_TYPES.javascript),
|
|
60
|
+
plainText: utf8(MEDIA_TYPES.plainText),
|
|
61
|
+
markdown: utf8(MEDIA_TYPES.markdown),
|
|
62
|
+
xml: utf8(MEDIA_TYPES.xml),
|
|
63
|
+
};
|
|
64
|
+
export const SCRIPT_MEDIA_TYPES = [
|
|
65
|
+
MEDIA_TYPES.javascript,
|
|
66
|
+
'application/javascript',
|
|
67
|
+
'text/ecmascript',
|
|
68
|
+
'application/ecmascript',
|
|
69
|
+
];
|
|
70
|
+
const FILE_TYPES = [
|
|
71
|
+
[MEDIA_TYPES.aac, 'aac'],
|
|
72
|
+
[MEDIA_TYPES.amr, 'amr'],
|
|
73
|
+
[MEDIA_TYPES.avif, 'avif'],
|
|
74
|
+
[MEDIA_TYPES.css, 'css'],
|
|
75
|
+
[MEDIA_TYPES.csv, 'csv'],
|
|
76
|
+
[MEDIA_TYPES.docx, 'docx'],
|
|
77
|
+
[MEDIA_TYPES.gif, 'gif'],
|
|
78
|
+
[MEDIA_TYPES.heic, 'heic'],
|
|
79
|
+
[MEDIA_TYPES.html, 'html'],
|
|
80
|
+
[MEDIA_TYPES.icon, 'ico'],
|
|
81
|
+
[MEDIA_TYPES.javascript, 'js', 'mjs'],
|
|
82
|
+
[MEDIA_TYPES.jpeg, 'jpg', 'jpeg'],
|
|
83
|
+
[MEDIA_TYPES.json, 'json', 'map'],
|
|
84
|
+
[MEDIA_TYPES.m4a, 'm4a'],
|
|
85
|
+
[MEDIA_TYPES.markdown, 'md'],
|
|
86
|
+
[MEDIA_TYPES.mp3, 'mp3'],
|
|
87
|
+
[MEDIA_TYPES.mp4, 'mp4'],
|
|
88
|
+
[MEDIA_TYPES.ogg, 'ogg'],
|
|
89
|
+
[MEDIA_TYPES.otf, 'otf'],
|
|
90
|
+
[MEDIA_TYPES.pdf, 'pdf'],
|
|
91
|
+
[MEDIA_TYPES.plainText, 'txt'],
|
|
92
|
+
[MEDIA_TYPES.png, 'png'],
|
|
93
|
+
[MEDIA_TYPES.pptx, 'pptx'],
|
|
94
|
+
[MEDIA_TYPES.quickTime, 'mov'],
|
|
95
|
+
[MEDIA_TYPES.svg, 'svg'],
|
|
96
|
+
[MEDIA_TYPES.threeGpp, '3gp'],
|
|
97
|
+
[MEDIA_TYPES.ttf, 'ttf'],
|
|
98
|
+
[MEDIA_TYPES.wasm, 'wasm'],
|
|
99
|
+
[MEDIA_TYPES.wav, 'wav'],
|
|
100
|
+
[MEDIA_TYPES.webm, 'webm'],
|
|
101
|
+
[MEDIA_TYPES.webManifest, 'webmanifest'],
|
|
102
|
+
[MEDIA_TYPES.webp, 'webp'],
|
|
103
|
+
[MEDIA_TYPES.woff, 'woff'],
|
|
104
|
+
[MEDIA_TYPES.woff2, 'woff2'],
|
|
105
|
+
[MEDIA_TYPES.xlsx, 'xlsx'],
|
|
106
|
+
[MEDIA_TYPES.zip, 'zip'],
|
|
107
|
+
];
|
|
108
|
+
export const FILE_MEDIA_TYPES = FILE_TYPES.reduce((table, [type, ...extensions]) => extensions.reduce((named, extension) => ({ ...named, [extension]: type }), table), {});
|
|
109
|
+
export function servedMediaType(path) {
|
|
110
|
+
const dot = path.lastIndexOf('.');
|
|
111
|
+
const extension = dot === -1 ? '' : path.slice(dot + 1).toLowerCase();
|
|
112
|
+
const type = FILE_TYPES.find(([, ...extensions]) => extensions.includes(extension))?.[0] ??
|
|
113
|
+
MEDIA_TYPES.octetStream;
|
|
114
|
+
return type.startsWith('text/') ? utf8(type) : type;
|
|
115
|
+
}
|
|
116
|
+
export function fileExtension(type) {
|
|
117
|
+
const essence = mediaTypeEssence(type);
|
|
118
|
+
return FILE_TYPES.find(([named]) => named === essence)?.[1] ?? null;
|
|
119
|
+
}
|
|
120
|
+
export function dataUrl(type, base64) {
|
|
121
|
+
return `data:${type};base64,${base64}`;
|
|
122
|
+
}
|
|
123
|
+
function caseless(text) {
|
|
124
|
+
return text.replace(/[a-z]/gu, (letter) => `[${letter}${letter.toUpperCase()}]`);
|
|
125
|
+
}
|
|
126
|
+
export function dataUrlPattern(types) {
|
|
127
|
+
const named = types.map((type) => caseless(type).replace(/[+.]/gu, '\\$&')).join('|');
|
|
128
|
+
return new RegExp(`^${caseless('data:')}(${named});${caseless('base64')},([A-Za-z0-9+/]+={0,2})$`, 'u');
|
|
129
|
+
}
|
|
130
|
+
export function formDataType(boundary) {
|
|
131
|
+
return `multipart/form-data; boundary=${boundary}`;
|
|
132
|
+
}
|
|
133
|
+
export function gitMediaType(service, part) {
|
|
134
|
+
return `application/x-${service}-${part}`;
|
|
135
|
+
}
|
|
136
|
+
export function mediaTypeEssence(value) {
|
|
137
|
+
return value.split(';', 1)[0].trim().toLowerCase();
|
|
138
|
+
}
|
|
139
|
+
export function declaresUtf8(value) {
|
|
140
|
+
const match = /;\s*charset\s*=\s*(?:"([^"]*)"|([^;\s]*))/iu.exec(value);
|
|
141
|
+
return match === null || (match[1] ?? match[2]).toLowerCase() === UTF8;
|
|
142
|
+
}
|
|
143
|
+
export function acceptsType(accept, type) {
|
|
144
|
+
return (accept ?? '').split(',').some((range) => mediaTypeEssence(range) === type);
|
|
145
|
+
}
|
|
146
|
+
function ofTopLevel(value, top) {
|
|
147
|
+
return mediaTypeEssence(value).startsWith(`${top}/`);
|
|
148
|
+
}
|
|
149
|
+
export function isImageType(value) {
|
|
150
|
+
return ofTopLevel(value, 'image');
|
|
151
|
+
}
|
|
152
|
+
export function isVideoType(value) {
|
|
153
|
+
return ofTopLevel(value, 'video');
|
|
154
|
+
}
|
|
155
|
+
export function isAudioType(value) {
|
|
156
|
+
return ofTopLevel(value, 'audio');
|
|
157
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"not-ready.d.ts","sourceRoot":"","sources":["../src/not-ready.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// A Room answered not ready is asked again after these waits, the last repeating, so a chunk build that catches up within seconds installs at once and a long one is asked every 15 seconds.
|
|
2
|
+
const NOT_READY_WAITS_MS = [1_000, 2_000, 3_000, 5_000, 8_000, 11_000, 15_000];
|
|
3
|
+
export function notReadyWaitMs(asked) {
|
|
4
|
+
return NOT_READY_WAITS_MS[Math.min(asked, NOT_READY_WAITS_MS.length - 1)];
|
|
5
|
+
}
|
package/dist/paths.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type RoomTarget = {
|
|
|
6
6
|
readonly handle: string;
|
|
7
7
|
readonly path: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
type Classified = {
|
|
10
10
|
kind: 'skip';
|
|
11
11
|
} | {
|
|
12
12
|
kind: 'path';
|
|
@@ -16,11 +16,20 @@ export declare function classifyHref(from: string, href: string): {
|
|
|
16
16
|
} & RoomTarget) | {
|
|
17
17
|
kind: 'invalid';
|
|
18
18
|
};
|
|
19
|
+
export declare function classifyHref(from: string, href: string): Classified;
|
|
19
20
|
export declare function roomTarget(href: string): RoomTarget | null;
|
|
20
21
|
export declare function roomPath(href: string): string | null;
|
|
21
22
|
export declare function target(from: string, href: string): string | null;
|
|
23
|
+
export interface LinkedPath {
|
|
24
|
+
readonly handle: string | null;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
readonly fragment: string | null;
|
|
27
|
+
}
|
|
28
|
+
export declare function linkedPath(from: string, href: string): LinkedPath | null;
|
|
22
29
|
export declare function retarget(href: string, to: string): string;
|
|
23
30
|
export declare function relative(from: string, target: string): string;
|
|
24
31
|
export declare const SHELL_ROOMS = "/rooms/";
|
|
25
32
|
export declare function shellTarget(href: string, handle: string): string | null;
|
|
33
|
+
export declare function destinationText(to: string, bracketed: boolean): string | null;
|
|
34
|
+
export {};
|
|
26
35
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAUA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AA6DD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW3D;AAgBD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAiB5E,KAAK,UAAU,GACX;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAAC,GAC/B;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAgBxB,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAGnE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAG1D;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGpD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAaxE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvE;AAoBD,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI7E"}
|
package/dist/paths.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { decodeNamedCharacterReference } from 'decode-named-character-reference';
|
|
2
2
|
import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';
|
|
3
|
-
|
|
3
|
+
const BACKSLASH = 0x5c;
|
|
4
|
+
const PUNCTUATION = /^[!-/:-@[-`{-~]$/;
|
|
5
|
+
function escapes(text, index) {
|
|
6
|
+
return text.charCodeAt(index) === BACKSLASH && PUNCTUATION.test(text[index + 1] ?? '');
|
|
7
|
+
}
|
|
4
8
|
export function dirname(path) {
|
|
5
9
|
const index = path.lastIndexOf('/');
|
|
6
10
|
return index === -1 ? '' : path.slice(0, index);
|
|
@@ -43,19 +47,23 @@ function referenceAt(text, at) {
|
|
|
43
47
|
end,
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
|
-
function
|
|
47
|
-
let
|
|
48
|
-
let i =
|
|
50
|
+
function spelled(written, from, stops) {
|
|
51
|
+
let text = '';
|
|
52
|
+
let i = from;
|
|
49
53
|
while (i < written.length) {
|
|
50
54
|
const escaped = escapes(written, i);
|
|
51
55
|
const reference = escaped || written[i] !== '&' ? null : referenceAt(written, i);
|
|
52
|
-
const
|
|
53
|
-
if (
|
|
54
|
-
return {
|
|
55
|
-
|
|
56
|
+
const one = escaped ? written[i + 1] : (reference?.text ?? written[i]);
|
|
57
|
+
if (stops && (one.startsWith('?') || one.startsWith('#')))
|
|
58
|
+
return { text, end: i };
|
|
59
|
+
text += one;
|
|
56
60
|
i = escaped ? i + 2 : (reference?.end ?? i + 1);
|
|
57
61
|
}
|
|
58
|
-
return {
|
|
62
|
+
return { text, end: written.length };
|
|
63
|
+
}
|
|
64
|
+
function unescaped(written) {
|
|
65
|
+
const { text, end } = spelled(written, 0, true);
|
|
66
|
+
return { base: text, suffix: end };
|
|
59
67
|
}
|
|
60
68
|
function located(href) {
|
|
61
69
|
const written = href.trim();
|
|
@@ -107,18 +115,22 @@ function written(path) {
|
|
|
107
115
|
}
|
|
108
116
|
return text;
|
|
109
117
|
}
|
|
110
|
-
function
|
|
118
|
+
function roomAt(path) {
|
|
111
119
|
if (!path.startsWith(SHELL_ROOMS))
|
|
112
120
|
return null;
|
|
113
121
|
const rest = path.slice(SHELL_ROOMS.length);
|
|
114
122
|
const slash = rest.indexOf('/');
|
|
115
|
-
const handle = rest.slice(0, slash);
|
|
116
|
-
if (
|
|
123
|
+
const handle = slash === -1 ? rest : rest.slice(0, slash);
|
|
124
|
+
if (handle === '' || handle === '.' || handle === '..')
|
|
117
125
|
return null;
|
|
118
|
-
const within = normalize(rest.slice(slash + 1));
|
|
119
|
-
return within === null
|
|
126
|
+
const within = normalize(slash === -1 ? '' : rest.slice(slash + 1));
|
|
127
|
+
return within === null ? null : { handle, path: within };
|
|
120
128
|
}
|
|
121
|
-
|
|
129
|
+
function roomTargetOf(path) {
|
|
130
|
+
const room = roomAt(path);
|
|
131
|
+
return room === null || room.path === '' ? null : room;
|
|
132
|
+
}
|
|
133
|
+
function resolvedOf(from, href) {
|
|
122
134
|
const base = located(href).base;
|
|
123
135
|
if (base === '')
|
|
124
136
|
return { kind: 'skip' };
|
|
@@ -128,13 +140,15 @@ export function classifyHref(from, href) {
|
|
|
128
140
|
if (path === null)
|
|
129
141
|
return { kind: 'invalid' };
|
|
130
142
|
if (path.startsWith('/')) {
|
|
131
|
-
const room =
|
|
143
|
+
const room = roomAt(path);
|
|
132
144
|
return room === null ? { kind: 'invalid' } : { kind: 'room', ...room };
|
|
133
145
|
}
|
|
134
146
|
const resolved = normalize(join(dirname(from), path));
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
147
|
+
return resolved === null ? { kind: 'invalid' } : { kind: 'path', path: resolved };
|
|
148
|
+
}
|
|
149
|
+
export function classifyHref(from, href) {
|
|
150
|
+
const resolved = resolvedOf(from, href);
|
|
151
|
+
return 'path' in resolved && resolved.path === '' ? { kind: 'invalid' } : resolved;
|
|
138
152
|
}
|
|
139
153
|
export function roomTarget(href) {
|
|
140
154
|
const path = destinationPath(href);
|
|
@@ -148,6 +162,20 @@ export function target(from, href) {
|
|
|
148
162
|
const resolved = classifyHref(from, href);
|
|
149
163
|
return resolved.kind === 'path' ? resolved.path : null;
|
|
150
164
|
}
|
|
165
|
+
export function linkedPath(from, href) {
|
|
166
|
+
const resolved = located(href).base === '' ? { kind: 'path', path: from } : resolvedOf(from, href);
|
|
167
|
+
if (!('path' in resolved))
|
|
168
|
+
return null;
|
|
169
|
+
const written = href.trim();
|
|
170
|
+
const suffix = spelled(written, unescaped(written).suffix, false).text;
|
|
171
|
+
const hash = suffix.indexOf('#');
|
|
172
|
+
const fragment = hash === -1 ? '' : suffix.slice(hash + 1);
|
|
173
|
+
return {
|
|
174
|
+
handle: resolved.kind === 'room' ? resolved.handle : null,
|
|
175
|
+
path: resolved.path,
|
|
176
|
+
fragment: fragment === '' ? null : (decodedRun(fragment) ?? fragment),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
151
179
|
export function retarget(href, to) {
|
|
152
180
|
const trimmed = href.trim();
|
|
153
181
|
return written(to) + trimmed.slice(unescaped(trimmed).suffix);
|
|
@@ -173,3 +201,30 @@ export function shellTarget(href, handle) {
|
|
|
173
201
|
const path = normalize(decoded.slice(prefix.length));
|
|
174
202
|
return path === null || path === '' ? null : path;
|
|
175
203
|
}
|
|
204
|
+
function fitsBare(to) {
|
|
205
|
+
if (to === '' || to.startsWith('<'))
|
|
206
|
+
return false;
|
|
207
|
+
let depth = 0;
|
|
208
|
+
for (const character of to) {
|
|
209
|
+
if (/[\s\u0000-\u001f\u007f]/.test(character))
|
|
210
|
+
return false;
|
|
211
|
+
if (character === '(')
|
|
212
|
+
depth += 1;
|
|
213
|
+
else if (character === ')') {
|
|
214
|
+
if (depth === 0)
|
|
215
|
+
return false;
|
|
216
|
+
depth -= 1;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return depth === 0;
|
|
220
|
+
}
|
|
221
|
+
function fitsBrackets(to) {
|
|
222
|
+
return to !== '' && !/[<>\n\r]/.test(to);
|
|
223
|
+
}
|
|
224
|
+
export function destinationText(to, bracketed) {
|
|
225
|
+
if (fitsBare(to))
|
|
226
|
+
return bracketed && fitsBrackets(to) ? `<${to}>` : to;
|
|
227
|
+
if (fitsBrackets(to))
|
|
228
|
+
return `<${to}>`;
|
|
229
|
+
return null;
|
|
230
|
+
}
|
package/dist/pattern.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../src/pattern.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,OAAQ,CAAC;AAMpC,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAQ9C,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../src/pattern.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,OAAQ,CAAC;AAMpC,qBAAa,gBAAiB,SAAQ,KAAK;CAAG;AAQ9C,MAAM,MAAM,OAAO,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CAAE,CAAC;AAkUnE,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,IAAI,CAM5D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,CAkBnD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,IAAI,CAM9C"}
|
package/dist/pattern.js
CHANGED
|
@@ -262,10 +262,11 @@ class Linear {
|
|
|
262
262
|
const marks = this.marks;
|
|
263
263
|
const budget = scope ?? { left: VISIT_BUDGET };
|
|
264
264
|
let seeds = [];
|
|
265
|
-
let
|
|
265
|
+
let wordBefore = false;
|
|
266
266
|
for (let at = 0;;) {
|
|
267
267
|
const point = at < text.length ? text.codePointAt(at) : -1;
|
|
268
|
-
const
|
|
268
|
+
const wordAt = word(point);
|
|
269
|
+
const across = wordBefore !== wordAt;
|
|
269
270
|
const generation = (this.generation += 1);
|
|
270
271
|
const active = [];
|
|
271
272
|
seeds.push(this.start);
|
|
@@ -291,7 +292,7 @@ class Linear {
|
|
|
291
292
|
for (const state of active)
|
|
292
293
|
if (atoms[alternates[state]].holds(point))
|
|
293
294
|
seeds.push(outs[state]);
|
|
294
|
-
|
|
295
|
+
wordBefore = wordAt;
|
|
295
296
|
at += point > 0xffff ? 2 : 1;
|
|
296
297
|
}
|
|
297
298
|
}
|
package/dist/project.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3F,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC;AAEzB,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAqCtD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS3E;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAWxF;AAOD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACzB,WAAW,CA4Bb;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAA2C,GACnD,UAAU,CAMZ"}
|
package/dist/project.js
CHANGED
|
@@ -1,42 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { roomTarget, target } from './paths.js';
|
|
1
|
+
import { bodyWith, readingOf } from './document.js';
|
|
2
|
+
import { classifyHref } from './paths.js';
|
|
4
3
|
import { refusal } from './refuse.js';
|
|
5
|
-
import { headingSpans } from './sections.js';
|
|
6
4
|
import { bodyStartOf } from './yaml.js';
|
|
7
|
-
function internalEdits(content,
|
|
5
|
+
function internalEdits(content, reading, file, documentTargets) {
|
|
8
6
|
const internal = new Set();
|
|
9
|
-
const uses =
|
|
7
|
+
const uses = reading.uses
|
|
10
8
|
.filter((use) => {
|
|
11
|
-
const resolved =
|
|
12
|
-
return resolved ===
|
|
13
|
-
? roomTarget(use.destination.href) !== null
|
|
14
|
-
: documentTargets.has(resolved);
|
|
9
|
+
const resolved = classifyHref(file, use.destination.href);
|
|
10
|
+
return (resolved.kind === 'room' || (resolved.kind === 'path' && documentTargets.has(resolved.path)));
|
|
15
11
|
})
|
|
16
12
|
.sort((left, right) => left.start - right.start);
|
|
17
13
|
const edits = [];
|
|
18
14
|
for (let index = uses.length - 1; index >= 0; index -= 1) {
|
|
19
15
|
const use = uses[index];
|
|
20
16
|
internal.add(use.destination.start);
|
|
21
|
-
const label = { start:
|
|
17
|
+
const label = { start: use.labelStart, end: use.labelEnd };
|
|
22
18
|
const inner = [];
|
|
23
19
|
for (let nested = index + 1; nested < uses.length; nested += 1) {
|
|
24
20
|
const edit = edits[uses.length - 1 - nested];
|
|
25
21
|
if (edit.start >= label.end)
|
|
26
22
|
break;
|
|
27
|
-
if (edit.
|
|
23
|
+
if (edit.end <= label.end)
|
|
28
24
|
inner.push(edit);
|
|
29
25
|
}
|
|
30
|
-
edits.push({
|
|
31
|
-
start: bodyStart + use.start,
|
|
32
|
-
end: bodyStart + use.end,
|
|
33
|
-
text: rangeText(content, label, inner),
|
|
34
|
-
});
|
|
26
|
+
edits.push({ start: use.start, end: use.end, text: rangeText(content, label, inner) });
|
|
35
27
|
}
|
|
36
|
-
for (const block of
|
|
28
|
+
for (const block of reading.definitions) {
|
|
37
29
|
if (!internal.has(block.destination.start))
|
|
38
30
|
continue;
|
|
39
|
-
edits.push({ start:
|
|
31
|
+
edits.push({ start: block.start, end: block.end, text: '' });
|
|
40
32
|
}
|
|
41
33
|
return edits.sort((left, right) => left.start - right.start);
|
|
42
34
|
}
|
|
@@ -66,57 +58,38 @@ export function rangeText(content, range, edits) {
|
|
|
66
58
|
}
|
|
67
59
|
return text + content.slice(cursor, range.end);
|
|
68
60
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
function proseValues(node, facts, values) {
|
|
73
|
-
if (facts === undefined)
|
|
74
|
-
return;
|
|
75
|
-
if (node.kind === 'scalar') {
|
|
76
|
-
if (facts.prose && typeof node.value === 'string')
|
|
77
|
-
values.push({ start: node.start, end: node.end, text: `${node.value}\n\n` });
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
if (node.kind === 'seq') {
|
|
81
|
-
for (const item of node.items)
|
|
82
|
-
proseValues(item, facts.items, values);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
for (const entry of node.entries)
|
|
86
|
-
proseValues(entry.value, memberFacts(facts, entry.key), values);
|
|
87
|
-
}
|
|
88
|
-
function freeTextValues(definition, document) {
|
|
89
|
-
const root = frontmatter(document);
|
|
90
|
-
if (root === null)
|
|
91
|
-
return [];
|
|
92
|
-
const values = [];
|
|
93
|
-
proseValues(root, definition.frontmatter, values);
|
|
94
|
-
return values;
|
|
61
|
+
function linked(edits, range) {
|
|
62
|
+
const at = firstEditFrom(edits, range.start);
|
|
63
|
+
return at < edits.length && edits[at].start < range.end;
|
|
95
64
|
}
|
|
96
65
|
export function projectionInput(document, file, context) {
|
|
97
66
|
const content = document.content;
|
|
98
67
|
const bodyStart = bodyStartOf(content);
|
|
99
|
-
const
|
|
68
|
+
const reading = readingOf(document);
|
|
69
|
+
const edits = internalEdits(content, reading, file, new Set(context.documentTargets));
|
|
100
70
|
const declared = document.type;
|
|
101
|
-
|
|
71
|
+
const definition = context.definition;
|
|
72
|
+
if (definition === undefined && declared !== undefined && declared !== 'any')
|
|
73
|
+
return { ok: false, refusal: refusal(file, 'unknown-type') };
|
|
74
|
+
const body = definition === undefined ? null : bodyWith(document, definition);
|
|
75
|
+
if (body === null || !('top' in body)) {
|
|
102
76
|
return {
|
|
103
77
|
ok: true,
|
|
104
78
|
input: { values: [], ranges: [{ start: bodyStart, end: content.length }], edits },
|
|
105
79
|
};
|
|
106
80
|
}
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
119
|
-
return { ok: true, input: { values: freeTextValues(definition, document), ranges, edits } };
|
|
81
|
+
const values = body.prose
|
|
82
|
+
.filter((one) => !one.markdown)
|
|
83
|
+
.map((one) => ({
|
|
84
|
+
start: one.start,
|
|
85
|
+
end: one.end,
|
|
86
|
+
text: `${linked(edits, one) ? rangeText(content, one, edits) : one.text}\n\n`,
|
|
87
|
+
}));
|
|
88
|
+
const ranges = [
|
|
89
|
+
...body.prose.filter((one) => one.markdown).map(({ start, end }) => ({ start, end })),
|
|
90
|
+
...body.free,
|
|
91
|
+
].sort((left, right) => left.start - right.start);
|
|
92
|
+
return { ok: true, input: { values, ranges, edits } };
|
|
120
93
|
}
|
|
121
94
|
export function project(document, file, context = { documentTargets: [] }) {
|
|
122
95
|
const result = projectionInput(document, file, context);
|
package/dist/query/language.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type Filter = {
|
|
|
37
37
|
types?: readonly string[];
|
|
38
38
|
where?: Where;
|
|
39
39
|
pathPrefix?: string;
|
|
40
|
+
outside?: readonly string[];
|
|
40
41
|
folder?: string;
|
|
41
42
|
paths?: readonly string[];
|
|
42
43
|
fileIds?: readonly string[];
|
|
@@ -48,7 +49,10 @@ export type Filter = {
|
|
|
48
49
|
};
|
|
49
50
|
text?: string;
|
|
50
51
|
};
|
|
51
|
-
export type Key = 'room' | 'path' | 'type' | 'folder' | {
|
|
52
|
+
export type Key = 'room' | 'path' | 'type' | 'folder' | 'size' | 'created' | 'updated' | {
|
|
53
|
+
field: string;
|
|
54
|
+
};
|
|
55
|
+
export type GroupKey = 'room' | 'type' | 'folder' | 'subfolder' | {
|
|
52
56
|
field: string;
|
|
53
57
|
};
|
|
54
58
|
export type Select = 'all' | {
|
|
@@ -60,7 +64,17 @@ export type Select = 'all' | {
|
|
|
60
64
|
change?: true;
|
|
61
65
|
fileId?: true;
|
|
62
66
|
revision?: true;
|
|
67
|
+
size?: true;
|
|
68
|
+
created?: true;
|
|
69
|
+
};
|
|
70
|
+
export type GroupSelect = {
|
|
71
|
+
size?: true;
|
|
72
|
+
updated?: true;
|
|
73
|
+
greatest?: {
|
|
74
|
+
field: string;
|
|
75
|
+
};
|
|
63
76
|
};
|
|
77
|
+
export type GroupOrder = 'count' | 'size' | 'updated' | 'greatest';
|
|
64
78
|
export type OrderOptions = {
|
|
65
79
|
nulls?: 'first' | 'last';
|
|
66
80
|
stringSort?: 'lexical' | 'locale';
|
|
@@ -79,10 +93,12 @@ export type DocumentQuery = Filter & {
|
|
|
79
93
|
total?: true;
|
|
80
94
|
};
|
|
81
95
|
export type GroupQuery = Filter & {
|
|
82
|
-
groupBy: readonly
|
|
96
|
+
groupBy: readonly GroupKey[];
|
|
97
|
+
select?: GroupSelect;
|
|
83
98
|
orderBy?: readonly {
|
|
84
|
-
by:
|
|
99
|
+
by: GroupOrder | GroupKey;
|
|
85
100
|
direction?: Direction;
|
|
101
|
+
nulls?: 'first' | 'last';
|
|
86
102
|
}[];
|
|
87
103
|
limit?: number;
|
|
88
104
|
after?: string;
|
|
@@ -148,6 +164,14 @@ export type KeyPlan = {
|
|
|
148
164
|
of: 'type';
|
|
149
165
|
} | {
|
|
150
166
|
of: 'folder';
|
|
167
|
+
} | {
|
|
168
|
+
of: 'subfolder';
|
|
169
|
+
} | {
|
|
170
|
+
of: 'size';
|
|
171
|
+
} | {
|
|
172
|
+
of: 'created';
|
|
173
|
+
} | {
|
|
174
|
+
of: 'updated';
|
|
151
175
|
} | {
|
|
152
176
|
of: 'field';
|
|
153
177
|
field: string;
|
|
@@ -162,6 +186,8 @@ export type DocumentShape = {
|
|
|
162
186
|
change: boolean;
|
|
163
187
|
fileId: boolean;
|
|
164
188
|
revision: boolean;
|
|
189
|
+
size: boolean;
|
|
190
|
+
created: boolean;
|
|
165
191
|
orderBy: readonly {
|
|
166
192
|
key: KeyPlan;
|
|
167
193
|
options: OrderOptions & {
|
|
@@ -172,9 +198,13 @@ export type DocumentShape = {
|
|
|
172
198
|
export type GroupShape = {
|
|
173
199
|
kind: 'groups';
|
|
174
200
|
groupBy: readonly KeyPlan[];
|
|
201
|
+
size: boolean;
|
|
202
|
+
updated: boolean;
|
|
203
|
+
greatest: string | null;
|
|
175
204
|
orderBy: readonly {
|
|
176
|
-
by:
|
|
205
|
+
by: GroupOrder | number;
|
|
177
206
|
direction: Direction;
|
|
207
|
+
nulls: 'first' | 'last' | null;
|
|
178
208
|
}[];
|
|
179
209
|
};
|
|
180
210
|
export type Continuation = {
|
|
@@ -185,6 +215,7 @@ export type QueryPlan = {
|
|
|
185
215
|
key: string;
|
|
186
216
|
rooms: readonly string[] | null;
|
|
187
217
|
root: Scope;
|
|
218
|
+
outside: readonly string[] | null;
|
|
188
219
|
folder: string | null;
|
|
189
220
|
paths: readonly string[] | null;
|
|
190
221
|
fileIds: readonly string[] | null;
|
|
@@ -200,15 +231,20 @@ export type QueryPlan = {
|
|
|
200
231
|
after: Continuation | null;
|
|
201
232
|
total: boolean;
|
|
202
233
|
};
|
|
234
|
+
export type Place = readonly (string | number)[];
|
|
235
|
+
type At = Place | string;
|
|
203
236
|
export declare class QueryError extends Error {
|
|
204
237
|
readonly code: QueryErrorCode;
|
|
238
|
+
readonly place: Place;
|
|
239
|
+
readonly accepts: readonly string[];
|
|
205
240
|
readonly retryable = false;
|
|
206
|
-
constructor(code: QueryErrorCode, at:
|
|
241
|
+
constructor(code: QueryErrorCode, at: At, problem: string, accepts?: readonly string[]);
|
|
207
242
|
}
|
|
208
243
|
type Entries = Readonly<Record<string, unknown>>;
|
|
209
244
|
export declare function bodied(shape: DocumentShape): boolean;
|
|
210
|
-
export declare function invalid(at:
|
|
211
|
-
export declare function
|
|
245
|
+
export declare function invalid(at: At, problem: string, accepts?: readonly string[]): never;
|
|
246
|
+
export declare function placeText(at: Place): string;
|
|
247
|
+
export declare function known(value: Entries, allowed: readonly string[], at: At): void;
|
|
212
248
|
export declare function planOf(input: unknown, facts: HeldRooms): QueryPlan;
|
|
213
249
|
export declare function cursorOf(values: readonly unknown[]): string;
|
|
214
250
|
export declare function decodedCursor(text: string): readonly unknown[] | null;
|