@agentshouse/mdmodel 0.1.0-ca6c012c54fb0 → 0.1.0-caaa5bad9995d
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 +246 -229
- package/README.md +27 -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 +25 -11
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +235 -136
- package/dist/document.d.ts +16 -9
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +786 -149
- 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 +42 -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 +912 -0
- package/dist/house-model.d.ts.map +1 -0
- package/dist/house-model.js +502 -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 +13 -0
- package/dist/house-references/patterns.d.ts.map +1 -0
- package/dist/house-references/patterns.js +20 -0
- package/dist/index.d.ts +44 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -12
- package/dist/indexed.d.ts +10 -0
- package/dist/indexed.d.ts.map +1 -0
- package/dist/indexed.js +63 -0
- package/dist/kinds.d.ts +26 -0
- package/dist/kinds.d.ts.map +1 -0
- package/dist/kinds.js +218 -0
- 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 +257 -0
- package/dist/query/language.d.ts.map +1 -0
- package/dist/query/language.js +621 -0
- package/dist/query/match.d.ts +14 -0
- package/dist/query/match.d.ts.map +1 -0
- package/dist/query/match.js +129 -0
- package/dist/query/rows.d.ts +36 -0
- package/dist/query/rows.d.ts.map +1 -0
- package/dist/query/rows.js +179 -0
- package/dist/query/sql.d.ts +45 -0
- package/dist/query/sql.d.ts.map +1 -0
- package/dist/query/sql.js +296 -0
- package/dist/query/walk.d.ts +69 -0
- package/dist/query/walk.d.ts.map +1 -0
- package/dist/query/walk.js +274 -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 +8 -0
- package/dist/room-types.d.ts.map +1 -0
- package/dist/room-types.js +144 -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 +32 -43
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +14 -6
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +225 -187
- package/dist/view.d.ts +5 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +27 -0
- package/dist/yaml.d.ts +7 -5
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +158 -44
- package/fixtures/README.md +103 -70
- package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
- package/fixtures/cases/absent-link-dangles/schema.md +7 -0
- 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/{date-time-format/schema.yaml → absent-optional-field/schema.md} +12 -11
- package/fixtures/cases/absolute-link/library/item.md +1 -1
- package/fixtures/cases/absolute-link/schema.md +7 -0
- 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-any-file/{schema.yaml → schema.md} +2 -0
- 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-dangles/{schema.yaml → schema.md} +2 -0
- 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/attachment-reference-outside/{schema.yaml → schema.md} +2 -0
- 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-any-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-document-collision/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-image-dangles/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-link-dangles/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-link-outside-collection/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
- package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
- package/fixtures/cases/binary-prototype-reference/{schema.yaml → schema.md} +2 -0
- 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/binary-typed-reference/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/block-scalar-frontmatter/library/notes/literal.md +17 -0
- package/fixtures/cases/block-scalar-frontmatter/library/skills/notes/SKILL.md +10 -0
- package/fixtures/cases/boolean-field/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/{absent-optional-field/schema.yaml → boolean-field/schema.md} +12 -11
- package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
- package/fixtures/cases/bracketed-link-definition/schema.md +7 -0
- 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 → schema.md} +12 -11
- package/fixtures/cases/composed-root-reference/library/a.md +2 -2
- package/fixtures/cases/composed-root-reference/{schema.yaml → schema.md} +2 -0
- 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.md +15 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
- package/fixtures/cases/cross-room-link/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
- package/fixtures/cases/cross-room-reference/{schema.yaml → schema.md} +3 -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/{boolean-field/schema.yaml → date-time-format/schema.md} +12 -11
- package/fixtures/cases/declared-binary-links/schema.md +3 -0
- 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.md +57 -0
- 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.md +57 -0
- 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.md +57 -0
- package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
- package/fixtures/cases/duplicate-link-definition/schema.md +7 -0
- 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.md +57 -0
- package/fixtures/cases/equal-labels/expected.json +5 -0
- package/fixtures/cases/equal-labels/schema.md +6 -0
- package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
- package/fixtures/cases/fenced-link-definition/schema.md +7 -0
- 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.md +8 -0
- package/fixtures/cases/frontmatter-construct/expected.json +7 -0
- package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
- package/fixtures/cases/integer-field/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.md +57 -0
- package/fixtures/cases/interrupted-link-definition/schema.md +3 -0
- 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.md +57 -0
- 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.md +11 -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.md +5 -0
- package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
- package/fixtures/cases/link-into-a-reserved-name/{schema.yaml → schema.md} +2 -0
- 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.md +5 -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.md +5 -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.md +12 -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.md +57 -0
- 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.md +57 -0
- 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-of-objects-reference/{schema.yaml → schema.md} +2 -0
- 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.md +5 -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.md +5 -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.md +57 -0
- package/fixtures/cases/long-fence-link-definition/schema.md +3 -0
- 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.md +17 -0
- package/fixtures/cases/malformed-definition/{schema.yaml → schema.md} +2 -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.md +8 -0
- package/fixtures/cases/member-document/library/people/ana.md +2 -2
- package/fixtures/cases/member-document/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/member-on-another-type/library/note.md +1 -1
- package/fixtures/cases/member-on-another-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/missing-required-field/library/item.md +1 -1
- package/fixtures/cases/missing-required-field/schema.md +8 -0
- 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.md +57 -0
- 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.md +7 -0
- package/fixtures/cases/nested-defs/expected.json +2 -1
- package/fixtures/cases/nested-defs/library/deal.md +3 -3
- package/fixtures/cases/nested-defs/{schema.yaml → schema.md} +2 -0
- 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-object-reference/schema.md +34 -0
- 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-reference/schema.md +34 -0
- 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.md +57 -0
- 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.md +57 -0
- 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.md +7 -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.md +6 -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.md +57 -0
- 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/other-room-reference/schema.md +34 -0
- package/fixtures/cases/paragraph-link-definition/schema.md +3 -0
- 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.md +7 -0
- package/fixtures/cases/quoted-link-definition/schema.md +3 -0
- package/fixtures/cases/reference-into-a-reserved-name/context.json +1 -0
- package/fixtures/cases/reference-into-a-reserved-name/expected.json +7 -0
- package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +4 -0
- package/fixtures/cases/reference-into-a-reserved-name/library/settings/brief.md +1 -0
- package/fixtures/cases/reference-into-a-reserved-name/schema.md +5 -0
- package/fixtures/cases/reference-to-any-file-name/context.json +1 -0
- package/fixtures/cases/reference-to-any-file-name/expected.json +1 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/100%.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/C#.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/My notes.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/[draft].md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/c (d).md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/caf/303/251.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people//320/236/321/202/321/207/321/221/321/202.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/bracket.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/cyrillic.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/decomposed.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/hash.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/parenthesis.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/percent.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/spaced.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/schema.md +12 -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.md +12 -0
- package/fixtures/cases/referenced-missing-non-latin-file/context.json +1 -0
- package/fixtures/cases/referenced-missing-non-latin-file/expected.json +6 -0
- package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/a.md +9 -0
- package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/b.md +9 -0
- package/fixtures/cases/referenced-missing-non-latin-file/schema.md +12 -0
- package/fixtures/cases/remote-ref/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/schema-body-ignored/context.json +1 -0
- package/fixtures/cases/schema-body-ignored/expected.json +1 -0
- package/fixtures/cases/schema-body-ignored/schema.md +9 -0
- package/fixtures/cases/schema-type-named-folders/context.json +1 -0
- package/fixtures/cases/schema-type-named-folders/expected.json +5 -0
- package/fixtures/cases/schema-type-named-folders/schema.md +5 -0
- package/fixtures/cases/schema-type-named-type/context.json +1 -0
- package/fixtures/cases/schema-type-named-type/expected.json +5 -0
- package/fixtures/cases/{unknown-type/schema.yaml → schema-type-named-type/schema.md} +3 -1
- package/fixtures/cases/second-member-document/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/sections-keyword-refused/context.json +1 -0
- package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
- package/fixtures/cases/{structured-section/schema.yaml → sections-keyword-refused/schema.md} +3 -2
- package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
- package/fixtures/cases/shortcut-reference-link/schema.md +7 -0
- 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.md +57 -0
- package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
- package/fixtures/cases/submission-keys/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/text-field-kind/expected.json +1 -4
- package/fixtures/cases/text-field-kind/library/page.md +1 -1
- package/fixtures/cases/text-field-kind/{schema.yaml → schema.md} +2 -0
- 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.md +5 -0
- package/fixtures/cases/truncated-link-definition/schema.md +3 -0
- package/fixtures/cases/typed-path-names-another-type/context.json +11 -0
- package/fixtures/cases/typed-path-names-another-type/expected.json +6 -0
- package/fixtures/cases/typed-path-names-another-type/library/settings/prefs/one.md +3 -0
- package/fixtures/cases/typed-path-names-another-type/schema.md +8 -0
- package/fixtures/cases/typed-path-names-its-type/context.json +11 -0
- package/fixtures/cases/typed-path-names-its-type/expected.json +3 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/deeper/two.md +1 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +4 -0
- package/fixtures/cases/typed-path-names-its-type/schema.md +8 -0
- package/fixtures/cases/typed-path-names-no-type/context.json +11 -0
- package/fixtures/cases/typed-path-names-no-type/expected.json +6 -0
- package/fixtures/cases/typed-path-names-no-type/library/settings/prefs/one.md +1 -0
- package/fixtures/cases/typed-path-names-no-type/schema.md +8 -0
- package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
- package/fixtures/cases/types-folder-content/{schema.yaml → schema.md} +2 -0
- 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.md +7 -0
- package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
- package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
- package/fixtures/cases/unevaluated-items-closed/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unique-in-app-schema/context.json +1 -0
- package/fixtures/cases/unique-in-app-schema/expected.json +5 -0
- package/fixtures/cases/unique-in-app-schema/schema.yaml +7 -0
- package/fixtures/cases/unique-indexed-field/context.json +1 -0
- package/fixtures/cases/unique-indexed-field/expected.json +1 -0
- package/fixtures/cases/unique-indexed-field/library/tickets/first.md +8 -0
- package/fixtures/cases/unique-indexed-field/library/tickets/second.md +8 -0
- package/fixtures/cases/unique-indexed-field/schema.md +9 -0
- package/fixtures/cases/unique-off-indexed-field/context.json +1 -0
- package/fixtures/cases/unique-off-indexed-field/expected.json +5 -0
- package/fixtures/cases/unique-off-indexed-field/schema.md +9 -0
- package/fixtures/cases/unlisted-reference-type/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/expected.json +6 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +5 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/schema.md +7 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/expected.json +6 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +7 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/schema.md +7 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/expected.json +3 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/plan.md +1 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +6 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/schema.md +7 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/context.json +11 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/expected.json +5 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +5 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/schema.md +7 -0
- package/fixtures/cases/unresolved-link/library/item.md +1 -1
- package/fixtures/cases/unresolved-link/schema.md +7 -0
- 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.md +17 -0
- package/fixtures/cases/wide-item-fence-link/schema.md +3 -0
- package/fixtures/forms.json +371 -0
- package/fixtures/preamble.json +29 -8
- package/fixtures/queries.json +1562 -0
- package/fixtures/references.json +15 -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 -181
- package/dist/condition.d.ts.map +0 -1
- package/dist/condition.js +0 -633
- 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/absent-link-dangles/schema.yaml +0 -6
- package/fixtures/cases/absolute-link/schema.yaml +0 -6
- package/fixtures/cases/bracketed-link-definition/schema.yaml +0 -6
- package/fixtures/cases/conditional-section/schema.yaml +0 -14
- package/fixtures/cases/declared-binary-links/schema.yaml +0 -1
- package/fixtures/cases/default-unfilled/schema.yaml +0 -56
- package/fixtures/cases/defs-pattern/schema.yaml +0 -56
- package/fixtures/cases/dependent-rule/schema.yaml +0 -56
- package/fixtures/cases/duplicate-link-definition/schema.yaml +0 -6
- package/fixtures/cases/email-format/schema.yaml +0 -56
- package/fixtures/cases/fenced-link-definition/schema.yaml +0 -6
- package/fixtures/cases/field-enum/schema.yaml +0 -7
- package/fixtures/cases/frontmatter-schema/expected.json +0 -5
- package/fixtures/cases/integer-field/schema.yaml +0 -56
- package/fixtures/cases/interrupted-link-definition/schema.yaml +0 -1
- package/fixtures/cases/json-schema-constructs/schema.yaml +0 -56
- package/fixtures/cases/list-of-objects-closed/schema.yaml +0 -56
- package/fixtures/cases/list-of-objects-item/schema.yaml +0 -56
- package/fixtures/cases/list-size/schema.yaml +0 -56
- package/fixtures/cases/long-fence-link-definition/schema.yaml +0 -1
- package/fixtures/cases/missing-required-field/schema.yaml +0 -7
- 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/misspelled-key/schema.yaml +0 -56
- package/fixtures/cases/nested-object-reference/schema.yaml +0 -32
- package/fixtures/cases/nested-reference/schema.yaml +0 -32
- package/fixtures/cases/nested-required-field/schema.yaml +0 -56
- 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/numeric-range/schema.yaml +0 -56
- package/fixtures/cases/one-of-variant/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/other-room-reference/schema.yaml +0 -32
- package/fixtures/cases/paragraph-link-definition/schema.yaml +0 -1
- package/fixtures/cases/prototype-field/schema.yaml +0 -6
- package/fixtures/cases/quoted-link-definition/schema.yaml +0 -1
- package/fixtures/cases/referenced-missing-file/schema.yaml +0 -11
- 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/shortcut-reference-link/schema.yaml +0 -6
- package/fixtures/cases/string-length/schema.yaml +0 -56
- package/fixtures/cases/structured-section/expected.json +0 -6
- package/fixtures/cases/truncated-link-definition/schema.yaml +0 -1
- package/fixtures/cases/undeclared-field/schema.yaml +0 -6
- package/fixtures/cases/unresolved-link/schema.yaml +0 -6
- package/fixtures/cases/valid-typed-document/schema.yaml +0 -16
- package/fixtures/cases/wide-item-fence-link/schema.yaml +0 -1
- 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/{frontmatter-schema → 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 → frontmatter-construct}/context.json +0 -0
- /package/fixtures/cases/{open-map-value → labels-in-the-rooms-language}/context.json +0 -0
- /package/fixtures/cases/{section-item-enum → lazy-list-item}/context.json +0 -0
- /package/fixtures/cases/{section-item-kind → list-item-enum}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-item-kind}/context.json +0 -0
- /package/fixtures/cases/{section-reference-path → list-items}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
- /package/fixtures/cases/{section-reference-type → list-reference-path}/context.json +0 -0
- /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
- /package/fixtures/cases/{structured-section → list-reference-type}/context.json +0 -0
- /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
- /package/fixtures/cases/{frontmatter-schema/schema.yaml → unknown-type/schema.md} +0 -0
package/dist/yaml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"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"}
|
package/dist/yaml.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export class YamlError extends Error {
|
|
2
2
|
offset;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
construct;
|
|
4
|
+
constructor(offset, construct) {
|
|
5
|
+
super();
|
|
5
6
|
this.offset = offset;
|
|
7
|
+
this.construct = construct;
|
|
6
8
|
this.name = 'YamlError';
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
const YAML_DEPTH_MAX = 64;
|
|
10
12
|
function nested(c, parse) {
|
|
11
13
|
if (c.depth >= YAML_DEPTH_MAX)
|
|
12
|
-
throw new YamlError(c.i);
|
|
14
|
+
throw new YamlError(c.i, 'nesting');
|
|
13
15
|
c.depth += 1;
|
|
14
16
|
try {
|
|
15
17
|
return parse();
|
|
@@ -31,7 +33,7 @@ function skipSpaces(c) {
|
|
|
31
33
|
while (peek(c) === ' ')
|
|
32
34
|
c.i += 1;
|
|
33
35
|
if (peek(c) === '\t')
|
|
34
|
-
throw new YamlError(c.i);
|
|
36
|
+
throw new YamlError(c.i, 'tab');
|
|
35
37
|
}
|
|
36
38
|
function skipToEol(c) {
|
|
37
39
|
while (c.i < c.end && peek(c) !== '\n' && peek(c) !== '\r')
|
|
@@ -61,7 +63,7 @@ function skipFlowSpace(c) {
|
|
|
61
63
|
continue;
|
|
62
64
|
}
|
|
63
65
|
if (ch === '\t')
|
|
64
|
-
throw new YamlError(c.i);
|
|
66
|
+
throw new YamlError(c.i, 'tab');
|
|
65
67
|
break;
|
|
66
68
|
}
|
|
67
69
|
}
|
|
@@ -75,7 +77,7 @@ function indentAt(c) {
|
|
|
75
77
|
if (ch === ' ')
|
|
76
78
|
n += 1;
|
|
77
79
|
else if (ch === '\t')
|
|
78
|
-
throw new YamlError(j);
|
|
80
|
+
throw new YamlError(j, 'tab');
|
|
79
81
|
else
|
|
80
82
|
break;
|
|
81
83
|
j += 1;
|
|
@@ -85,7 +87,7 @@ function indentAt(c) {
|
|
|
85
87
|
const UNHELD_TEXT = /[\0\ud800-\udfff]/u;
|
|
86
88
|
function scalar(value, start, end) {
|
|
87
89
|
if (typeof value === 'string' && UNHELD_TEXT.test(value))
|
|
88
|
-
throw new YamlError(start);
|
|
90
|
+
throw new YamlError(start, 'unheld-character');
|
|
89
91
|
return { kind: 'scalar', value, start, end };
|
|
90
92
|
}
|
|
91
93
|
export function interpretPlain(text) {
|
|
@@ -119,7 +121,7 @@ function parseEscape(c) {
|
|
|
119
121
|
}
|
|
120
122
|
const hex = c.text.slice(c.i + 1, c.i + 5);
|
|
121
123
|
if (escaped !== 'u' || c.i + 5 > c.end || !/^[0-9A-Fa-f]{4}$/.test(hex))
|
|
122
|
-
throw new YamlError(c.i);
|
|
124
|
+
throw new YamlError(c.i, 'escape');
|
|
123
125
|
c.i += 5;
|
|
124
126
|
return String.fromCharCode(Number.parseInt(hex, 16));
|
|
125
127
|
}
|
|
@@ -140,7 +142,7 @@ function parseQuoted(c) {
|
|
|
140
142
|
return scalar(out, start, c.i);
|
|
141
143
|
}
|
|
142
144
|
if (ch === '\n' || ch === '\r')
|
|
143
|
-
throw new YamlError(c.i);
|
|
145
|
+
throw new YamlError(c.i, 'multi-line-scalar');
|
|
144
146
|
if (quote === '"' && ch === '\\') {
|
|
145
147
|
out += parseEscape(c);
|
|
146
148
|
continue;
|
|
@@ -148,7 +150,7 @@ function parseQuoted(c) {
|
|
|
148
150
|
out += ch;
|
|
149
151
|
c.i += 1;
|
|
150
152
|
}
|
|
151
|
-
throw new YamlError(c.i);
|
|
153
|
+
throw new YamlError(c.i, 'multi-line-scalar');
|
|
152
154
|
}
|
|
153
155
|
function parsePlain(c, flow) {
|
|
154
156
|
const start = c.i;
|
|
@@ -163,7 +165,7 @@ function parsePlain(c, flow) {
|
|
|
163
165
|
c.i += 1;
|
|
164
166
|
}
|
|
165
167
|
if (c.i === start)
|
|
166
|
-
throw new YamlError(c.i);
|
|
168
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
167
169
|
const raw = c.text.slice(start, c.i);
|
|
168
170
|
const trimmed = raw.trimEnd();
|
|
169
171
|
return scalar(interpretPlain(trimmed), start, start + trimmed.length);
|
|
@@ -174,12 +176,12 @@ function parseScalar(c, flow) {
|
|
|
174
176
|
return parseQuoted(c);
|
|
175
177
|
return parsePlain(c, flow);
|
|
176
178
|
}
|
|
177
|
-
function parseKey(c) {
|
|
179
|
+
function parseKey(c, refused) {
|
|
178
180
|
const start = c.i;
|
|
179
181
|
if (peek(c) === '"' || peek(c) === "'") {
|
|
180
182
|
const quoted = parseQuoted(c);
|
|
181
183
|
if (typeof quoted.value !== 'string')
|
|
182
|
-
throw new YamlError(start);
|
|
184
|
+
throw new YamlError(start, refused);
|
|
183
185
|
return { name: quoted.value, start, end: c.i };
|
|
184
186
|
}
|
|
185
187
|
let end = c.i;
|
|
@@ -201,7 +203,7 @@ function parseKey(c) {
|
|
|
201
203
|
end = c.i;
|
|
202
204
|
}
|
|
203
205
|
if (end === start)
|
|
204
|
-
throw new YamlError(c.i);
|
|
206
|
+
throw new YamlError(c.i, refused);
|
|
205
207
|
c.i = end;
|
|
206
208
|
return { name: c.text.slice(start, end), start, end };
|
|
207
209
|
}
|
|
@@ -213,16 +215,25 @@ function parseFlowValue(c) {
|
|
|
213
215
|
if (ch === '[')
|
|
214
216
|
return parseFlowSeq(c);
|
|
215
217
|
if (ch === '|' || ch === '>')
|
|
216
|
-
throw new YamlError(c.i);
|
|
218
|
+
throw new YamlError(c.i, 'block-scalar-in-flow');
|
|
217
219
|
return parseScalar(c, true);
|
|
218
220
|
}
|
|
221
|
+
function closed(c, parse) {
|
|
222
|
+
const start = c.i;
|
|
223
|
+
try {
|
|
224
|
+
return parse();
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
if (error instanceof YamlError && error.offset >= c.end)
|
|
228
|
+
throw new YamlError(start, 'flow-collection');
|
|
229
|
+
throw error;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
219
232
|
function parseFlowMap(c) {
|
|
220
|
-
return nested(c, () => flowMap(c));
|
|
233
|
+
return nested(c, () => closed(c, () => flowMap(c)));
|
|
221
234
|
}
|
|
222
235
|
function flowMap(c) {
|
|
223
236
|
const start = c.i;
|
|
224
|
-
if (peek(c) !== '{')
|
|
225
|
-
throw new YamlError(c.i);
|
|
226
237
|
c.i += 1;
|
|
227
238
|
skipFlowSpace(c);
|
|
228
239
|
const entries = [];
|
|
@@ -233,15 +244,15 @@ function flowMap(c) {
|
|
|
233
244
|
}
|
|
234
245
|
while (c.i < c.end) {
|
|
235
246
|
skipFlowSpace(c);
|
|
236
|
-
const key = parseKey(c);
|
|
247
|
+
const key = parseKey(c, 'flow-collection');
|
|
237
248
|
skipFlowSpace(c);
|
|
238
249
|
if (peek(c) !== ':')
|
|
239
|
-
throw new YamlError(c.i);
|
|
250
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
240
251
|
c.i += 1;
|
|
241
252
|
const after = c.i;
|
|
242
253
|
const value = parseFlowValue(c);
|
|
243
254
|
if (seen.has(key.name))
|
|
244
|
-
throw new YamlError(key.start);
|
|
255
|
+
throw new YamlError(key.start, 'duplicate-key');
|
|
245
256
|
seen.add(key.name);
|
|
246
257
|
entries.push({ key: key.name, after, value });
|
|
247
258
|
skipFlowSpace(c);
|
|
@@ -253,17 +264,15 @@ function flowMap(c) {
|
|
|
253
264
|
c.i += 1;
|
|
254
265
|
return { kind: 'map', entries, start, end: c.i };
|
|
255
266
|
}
|
|
256
|
-
throw new YamlError(c.i);
|
|
267
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
257
268
|
}
|
|
258
|
-
throw new YamlError(c.i);
|
|
269
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
259
270
|
}
|
|
260
271
|
function parseFlowSeq(c) {
|
|
261
|
-
return nested(c, () => flowSeq(c));
|
|
272
|
+
return nested(c, () => closed(c, () => flowSeq(c)));
|
|
262
273
|
}
|
|
263
274
|
function flowSeq(c) {
|
|
264
275
|
const start = c.i;
|
|
265
|
-
if (peek(c) !== '[')
|
|
266
|
-
throw new YamlError(c.i);
|
|
267
276
|
c.i += 1;
|
|
268
277
|
skipFlowSpace(c);
|
|
269
278
|
const items = [];
|
|
@@ -283,9 +292,9 @@ function flowSeq(c) {
|
|
|
283
292
|
c.i += 1;
|
|
284
293
|
return { kind: 'seq', items, start, end: c.i };
|
|
285
294
|
}
|
|
286
|
-
throw new YamlError(c.i);
|
|
295
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
287
296
|
}
|
|
288
|
-
throw new YamlError(c.i);
|
|
297
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
289
298
|
}
|
|
290
299
|
function parseValue(c, parentKeyIndent) {
|
|
291
300
|
const at = c.i;
|
|
@@ -309,6 +318,8 @@ function parseValue(c, parentKeyIndent) {
|
|
|
309
318
|
return parseFlowSeq(c);
|
|
310
319
|
if (peek(c) === '{')
|
|
311
320
|
return parseFlowMap(c);
|
|
321
|
+
if (peek(c) === '|' || peek(c) === '>')
|
|
322
|
+
return parseBlockScalar(c, parentKeyIndent);
|
|
312
323
|
return parseBlockMap(c, nextIndent);
|
|
313
324
|
}
|
|
314
325
|
if (ch === '{')
|
|
@@ -316,9 +327,106 @@ function parseValue(c, parentKeyIndent) {
|
|
|
316
327
|
if (ch === '[')
|
|
317
328
|
return parseFlowSeq(c);
|
|
318
329
|
if (ch === '|' || ch === '>')
|
|
319
|
-
|
|
330
|
+
return parseBlockScalar(c, parentKeyIndent);
|
|
320
331
|
return parseScalar(c, false);
|
|
321
332
|
}
|
|
333
|
+
function scalarLine(c, start) {
|
|
334
|
+
let at = start;
|
|
335
|
+
while (at < c.end && c.text[at] === ' ')
|
|
336
|
+
at += 1;
|
|
337
|
+
const indent = at - start;
|
|
338
|
+
while (at < c.end && c.text[at] !== '\n' && c.text[at] !== '\r')
|
|
339
|
+
at += 1;
|
|
340
|
+
let next = at;
|
|
341
|
+
if (next < c.end && c.text[next] === '\r')
|
|
342
|
+
next += 1;
|
|
343
|
+
if (next < c.end && c.text[next] === '\n')
|
|
344
|
+
next += 1;
|
|
345
|
+
return { start, indent, end: at, next };
|
|
346
|
+
}
|
|
347
|
+
function blank(line) {
|
|
348
|
+
return line.start + line.indent === line.end;
|
|
349
|
+
}
|
|
350
|
+
function folded(texts) {
|
|
351
|
+
let out = '';
|
|
352
|
+
let previous = null;
|
|
353
|
+
let empty = 0;
|
|
354
|
+
for (const text of texts) {
|
|
355
|
+
if (text === null) {
|
|
356
|
+
empty += 1;
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const spaced = text.startsWith(' ') || text.startsWith('\t');
|
|
360
|
+
if (previous === null)
|
|
361
|
+
out += '\n'.repeat(empty);
|
|
362
|
+
else if (previous === 'text' && !spaced)
|
|
363
|
+
out += empty === 0 ? ' ' : '\n'.repeat(empty);
|
|
364
|
+
else
|
|
365
|
+
out += '\n'.repeat(empty + 1);
|
|
366
|
+
out += text;
|
|
367
|
+
previous = spaced ? 'spaced' : 'text';
|
|
368
|
+
empty = 0;
|
|
369
|
+
}
|
|
370
|
+
return out;
|
|
371
|
+
}
|
|
372
|
+
function parseBlockScalar(c, parentIndent) {
|
|
373
|
+
const start = c.i;
|
|
374
|
+
const fold = peek(c) === '>';
|
|
375
|
+
c.i += 1;
|
|
376
|
+
let chomping = '';
|
|
377
|
+
let explicit = 0;
|
|
378
|
+
for (;;) {
|
|
379
|
+
const ch = peek(c);
|
|
380
|
+
if (chomping === '' && (ch === '-' || ch === '+'))
|
|
381
|
+
chomping = ch;
|
|
382
|
+
else if (explicit === 0 && ch >= '1' && ch <= '9')
|
|
383
|
+
explicit = Number(ch);
|
|
384
|
+
else
|
|
385
|
+
break;
|
|
386
|
+
c.i += 1;
|
|
387
|
+
}
|
|
388
|
+
const header = c.i;
|
|
389
|
+
if (peek(c) === ' ' || peek(c) === '\t') {
|
|
390
|
+
skipSpaces(c);
|
|
391
|
+
if (peek(c) === '#')
|
|
392
|
+
skipToEol(c);
|
|
393
|
+
}
|
|
394
|
+
if (c.i < c.end && peek(c) !== '\n' && peek(c) !== '\r')
|
|
395
|
+
throw new YamlError(c.i, 'block-scalar-header');
|
|
396
|
+
skipEol(c);
|
|
397
|
+
const lines = [];
|
|
398
|
+
let indent = explicit === 0 ? null : parentIndent + explicit;
|
|
399
|
+
let leading = 0;
|
|
400
|
+
while (c.i < c.end) {
|
|
401
|
+
const line = scalarLine(c, c.i);
|
|
402
|
+
if (indent === null && blank(line))
|
|
403
|
+
leading = Math.max(leading, line.indent);
|
|
404
|
+
else if (indent === null) {
|
|
405
|
+
if (line.indent <= parentIndent)
|
|
406
|
+
break;
|
|
407
|
+
if (leading > line.indent)
|
|
408
|
+
throw new YamlError(line.start + line.indent, 'indentation');
|
|
409
|
+
indent = line.indent;
|
|
410
|
+
}
|
|
411
|
+
if (indent !== null && !blank(line) && line.indent < indent)
|
|
412
|
+
break;
|
|
413
|
+
lines.push(line);
|
|
414
|
+
c.i = line.next;
|
|
415
|
+
}
|
|
416
|
+
const texts = lines.map((line) => indent === null || (blank(line) && line.indent <= indent)
|
|
417
|
+
? null
|
|
418
|
+
: c.text.slice(line.start + indent, line.end));
|
|
419
|
+
let last = texts.length - 1;
|
|
420
|
+
while (last >= 0 && texts[last] === null)
|
|
421
|
+
last -= 1;
|
|
422
|
+
const content = texts.slice(0, last + 1);
|
|
423
|
+
const body = fold ? folded(content) : content.map((text) => text ?? '').join('\n');
|
|
424
|
+
const broken = (line) => line.next > line.end;
|
|
425
|
+
const final = last >= 0 && broken(lines[last]) ? '\n' : '';
|
|
426
|
+
const kept = '\n'.repeat(lines.slice(last + 1).filter(broken).length);
|
|
427
|
+
const value = chomping === '-' ? body : chomping === '+' ? body + final + kept : body + final;
|
|
428
|
+
return scalar(value, start, last >= 0 ? lines[last].end : header);
|
|
429
|
+
}
|
|
322
430
|
function seqAhead(c) {
|
|
323
431
|
const next = c.text[c.i + 1];
|
|
324
432
|
return peek(c) === '-' && (next === ' ' || next === '\n' || next === '\r' || c.i + 1 >= c.end);
|
|
@@ -328,22 +436,27 @@ function mappingAhead(c) {
|
|
|
328
436
|
try {
|
|
329
437
|
if (peek(c) === '{' || peek(c) === '[')
|
|
330
438
|
return false;
|
|
331
|
-
parseKey(c);
|
|
439
|
+
parseKey(c, 'mapping-entry');
|
|
332
440
|
skipSpaces(c);
|
|
333
441
|
if (peek(c) !== ':')
|
|
334
442
|
return false;
|
|
335
443
|
const next = c.text[c.i + 1];
|
|
336
444
|
return next === ' ' || next === '\n' || next === '\r' || c.i + 1 >= c.end;
|
|
337
445
|
}
|
|
338
|
-
catch
|
|
339
|
-
|
|
340
|
-
return false;
|
|
341
|
-
throw error;
|
|
446
|
+
catch {
|
|
447
|
+
return false;
|
|
342
448
|
}
|
|
343
449
|
finally {
|
|
344
450
|
c.i = start;
|
|
345
451
|
}
|
|
346
452
|
}
|
|
453
|
+
function plainScalar(c, node) {
|
|
454
|
+
return node?.kind === 'scalar' && node.end > node.start && !`"'|>`.includes(c.text[node.start]);
|
|
455
|
+
}
|
|
456
|
+
function deeperLine(c, held) {
|
|
457
|
+
const continued = plainScalar(c, held) && !mappingAhead(c);
|
|
458
|
+
return new YamlError(c.i, continued ? 'multi-line-scalar' : 'indentation');
|
|
459
|
+
}
|
|
347
460
|
function lineStartOf(c) {
|
|
348
461
|
let j = c.i;
|
|
349
462
|
while (j > 0 && c.text[j - 1] !== '\n' && c.text[j - 1] !== '\r')
|
|
@@ -367,7 +480,9 @@ function blockSeq(c, indent) {
|
|
|
367
480
|
skipBlankAndComments(c);
|
|
368
481
|
if (c.i >= c.end)
|
|
369
482
|
break;
|
|
370
|
-
if (indentAt(c)
|
|
483
|
+
if (indentAt(c) > indent)
|
|
484
|
+
throw deeperLine(c, items[items.length - 1]);
|
|
485
|
+
if (indentAt(c) < indent)
|
|
371
486
|
break;
|
|
372
487
|
if (peek(c) !== '-')
|
|
373
488
|
break;
|
|
@@ -395,18 +510,18 @@ function blockMap(c, indent, inline) {
|
|
|
395
510
|
if (indentAt(c) < indent)
|
|
396
511
|
break;
|
|
397
512
|
if (indentAt(c) > indent)
|
|
398
|
-
throw
|
|
513
|
+
throw deeperLine(c, entries[entries.length - 1]?.value);
|
|
399
514
|
}
|
|
400
515
|
first = false;
|
|
401
|
-
const key = parseKey(c);
|
|
516
|
+
const key = parseKey(c, 'mapping-entry');
|
|
402
517
|
skipSpaces(c);
|
|
403
518
|
if (peek(c) !== ':')
|
|
404
|
-
throw new YamlError(c.i);
|
|
519
|
+
throw new YamlError(c.i, 'mapping-entry');
|
|
405
520
|
c.i += 1;
|
|
406
521
|
const after = c.i;
|
|
407
522
|
const value = parseValue(c, indent);
|
|
408
523
|
if (seen.has(key.name))
|
|
409
|
-
throw new YamlError(key.start);
|
|
524
|
+
throw new YamlError(key.start, 'duplicate-key');
|
|
410
525
|
seen.add(key.name);
|
|
411
526
|
entries.push({ key: key.name, after, value });
|
|
412
527
|
end = value.end;
|
|
@@ -422,13 +537,13 @@ export function parseYamlMapping(text, start, end) {
|
|
|
422
537
|
const mapped = parseFlowMap(c);
|
|
423
538
|
skipBlankAndComments(c);
|
|
424
539
|
if (c.i < end)
|
|
425
|
-
throw new YamlError(c.i);
|
|
540
|
+
throw new YamlError(c.i, 'flow-collection');
|
|
426
541
|
return mapped;
|
|
427
542
|
}
|
|
428
543
|
const mapped = parseBlockMap(c, indentAt(c));
|
|
429
544
|
skipBlankAndComments(c);
|
|
430
545
|
if (c.i < end)
|
|
431
|
-
throw new YamlError(c.i);
|
|
546
|
+
throw new YamlError(c.i, 'indentation');
|
|
432
547
|
return mapped;
|
|
433
548
|
}
|
|
434
549
|
export function jsValue(node) {
|
|
@@ -484,7 +599,7 @@ function heldWithin(value, within) {
|
|
|
484
599
|
Object.keys(value).every((key) => !UNHELD_TEXT.test(key)) &&
|
|
485
600
|
Object.values(value).every(held));
|
|
486
601
|
}
|
|
487
|
-
export function
|
|
602
|
+
export function documentValue(value) {
|
|
488
603
|
return heldWithin(value, []);
|
|
489
604
|
}
|
|
490
605
|
export function serializeJs(value) {
|
|
@@ -528,7 +643,7 @@ export function extractFrontmatter(content) {
|
|
|
528
643
|
return { kind: 'unclosed' };
|
|
529
644
|
const yamlStart = firstNl + 1;
|
|
530
645
|
let i = yamlStart;
|
|
531
|
-
|
|
646
|
+
for (;;) {
|
|
532
647
|
const nl = content.indexOf('\n', i);
|
|
533
648
|
const lineEnd = nl === -1 ? content.length : nl;
|
|
534
649
|
let line = content.slice(i, lineEnd);
|
|
@@ -540,7 +655,6 @@ export function extractFrontmatter(content) {
|
|
|
540
655
|
return { kind: 'unclosed' };
|
|
541
656
|
i = nl + 1;
|
|
542
657
|
}
|
|
543
|
-
return { kind: 'unclosed' };
|
|
544
658
|
}
|
|
545
659
|
export function equalValue(left, right) {
|
|
546
660
|
if (left === right)
|