@agentshouse/mdmodel 0.1.0-alpha.9 → 0.1.0-c08b2adadd2fe
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 +408 -0
- package/README.md +38 -194
- package/dist/definition.d.ts +72 -27
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +839 -145
- package/dist/divide.d.ts +3 -0
- package/dist/divide.d.ts.map +1 -0
- package/dist/divide.js +321 -0
- package/dist/document.d.ts +17 -3
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +514 -189
- package/dist/event.d.ts +78 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +201 -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 +6 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/fields.js +10 -0
- package/dist/index.d.ts +30 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -5
- package/dist/kinds.d.ts +18 -0
- package/dist/kinds.d.ts.map +1 -0
- package/dist/kinds.js +150 -0
- package/dist/markdown.d.ts +51 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +271 -0
- package/dist/paths.d.ts +15 -4
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +156 -36
- package/dist/pattern.d.ts +10 -0
- package/dist/pattern.d.ts.map +1 -0
- package/dist/pattern.js +356 -0
- package/dist/project.d.ts +20 -1
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +98 -97
- package/dist/query/language.d.ts +254 -0
- package/dist/query/language.d.ts.map +1 -0
- package/dist/query/language.js +620 -0
- package/dist/query/match.d.ts +14 -0
- package/dist/query/match.d.ts.map +1 -0
- package/dist/query/match.js +150 -0
- package/dist/query/rows.d.ts +32 -0
- package/dist/query/rows.d.ts.map +1 -0
- package/dist/query/rows.js +161 -0
- package/dist/query/sql.d.ts +39 -0
- package/dist/query/sql.d.ts.map +1 -0
- package/dist/query/sql.js +285 -0
- package/dist/references.d.ts +4 -0
- package/dist/references.d.ts.map +1 -0
- package/dist/references.js +30 -0
- package/dist/refuse.d.ts.map +1 -1
- package/dist/refuse.js +2 -10
- package/dist/reserved.d.ts +6 -0
- package/dist/reserved.d.ts.map +1 -0
- package/dist/reserved.js +21 -0
- package/dist/schema.d.ts +8 -5
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +207 -41
- package/dist/types.d.ts +114 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -3
- package/dist/validate.d.ts +34 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +449 -159
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -3
- package/dist/yaml.d.ts +9 -3
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +326 -201
- package/fixtures/README.md +113 -56
- package/fixtures/cases/absent-link-dangles/library/item.md +8 -0
- package/fixtures/cases/absent-link-dangles/schema.yaml +6 -0
- package/fixtures/cases/absent-optional-field/context.json +1 -0
- package/fixtures/cases/absent-optional-field/expected.json +1 -0
- package/fixtures/cases/absent-optional-field/library/companies/acme.md +4 -0
- package/fixtures/cases/absent-optional-field/library/deals/lead.md +6 -0
- package/fixtures/cases/absent-optional-field/schema.yaml +56 -0
- package/fixtures/cases/absolute-link/context.json +1 -0
- package/fixtures/cases/absolute-link/expected.json +5 -0
- package/fixtures/cases/absolute-link/library/item.md +8 -0
- package/fixtures/cases/absolute-link/schema.yaml +6 -0
- package/fixtures/cases/attachment-reference-any-file/context.json +1 -0
- package/fixtures/cases/attachment-reference-any-file/expected.json +1 -0
- package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +15 -0
- package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/library/products/support.md +4 -0
- package/fixtures/cases/attachment-reference-any-file/schema.yaml +32 -0
- package/fixtures/cases/attachment-reference-dangles/context.json +1 -0
- package/fixtures/cases/attachment-reference-dangles/expected.json +1 -0
- package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +15 -0
- package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/library/products/support.md +4 -0
- package/fixtures/cases/attachment-reference-dangles/schema.yaml +32 -0
- package/fixtures/cases/attachment-reference-outside/context.json +1 -0
- package/fixtures/cases/attachment-reference-outside/expected.json +6 -0
- package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +4 -0
- package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +15 -0
- package/fixtures/cases/attachment-reference-outside/library/places/depot.md +4 -0
- package/fixtures/cases/attachment-reference-outside/library/products/seats.md +4 -0
- package/fixtures/cases/attachment-reference-outside/library/products/support.md +4 -0
- package/fixtures/cases/attachment-reference-outside/schema.yaml +32 -0
- package/fixtures/cases/binary-any-reference/expected.json +1 -2
- package/fixtures/cases/binary-any-reference/schema.yaml +4 -0
- package/fixtures/cases/binary-document-collision/expected.json +1 -2
- package/fixtures/cases/binary-document-collision/schema.yaml +1 -0
- package/fixtures/cases/binary-image-dangles/expected.json +1 -0
- package/fixtures/cases/binary-image-dangles/schema.yaml +1 -0
- package/fixtures/cases/binary-link-dangles/expected.json +1 -0
- package/fixtures/cases/binary-link-dangles/schema.yaml +1 -0
- package/fixtures/cases/binary-link-outside-collection/expected.json +1 -2
- package/fixtures/cases/binary-link-outside-collection/schema.yaml +1 -0
- package/fixtures/cases/binary-prototype-reference/expected.json +1 -2
- package/fixtures/cases/binary-prototype-reference/schema.yaml +4 -0
- package/fixtures/cases/binary-typed-reference/expected.json +1 -2
- package/fixtures/cases/binary-typed-reference/schema.yaml +5 -0
- package/fixtures/cases/boolean-field/context.json +1 -0
- package/fixtures/cases/boolean-field/expected.json +6 -0
- package/fixtures/cases/boolean-field/library/companies/acme.md +4 -0
- package/fixtures/cases/boolean-field/library/deals/renewal.md +31 -0
- package/fixtures/cases/boolean-field/schema.yaml +56 -0
- package/fixtures/cases/bracketed-link-definition/schema.yaml +6 -0
- package/fixtures/cases/closed-nested-object/context.json +1 -0
- package/fixtures/cases/closed-nested-object/expected.json +6 -0
- package/fixtures/cases/closed-nested-object/library/companies/acme.md +4 -0
- package/fixtures/cases/closed-nested-object/library/deals/renewal.md +32 -0
- package/fixtures/cases/closed-nested-object/schema.yaml +56 -0
- package/fixtures/cases/composed-root-reference/context.json +1 -0
- package/fixtures/cases/composed-root-reference/expected.json +6 -0
- package/fixtures/cases/composed-root-reference/library/a.md +5 -0
- package/fixtures/cases/composed-root-reference/schema.yaml +13 -0
- package/fixtures/cases/conditional-section/context.json +1 -0
- package/fixtures/cases/conditional-section/expected.json +6 -0
- package/fixtures/cases/conditional-section/library/questions/hosting.md +9 -0
- package/fixtures/cases/conditional-section/library/questions/payments.md +12 -0
- package/fixtures/cases/conditional-section/schema.yaml +14 -0
- package/fixtures/cases/cross-room-link/context.json +1 -0
- package/fixtures/cases/cross-room-link/expected.json +1 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +6 -0
- package/fixtures/cases/cross-room-link/schema.yaml +3 -0
- package/fixtures/cases/cross-room-reference/context.json +1 -0
- package/fixtures/cases/cross-room-reference/expected.json +1 -0
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +9 -0
- package/fixtures/cases/cross-room-reference/schema.yaml +9 -0
- package/fixtures/cases/date-time-format/context.json +1 -0
- package/fixtures/cases/date-time-format/expected.json +6 -0
- package/fixtures/cases/date-time-format/library/companies/acme.md +4 -0
- package/fixtures/cases/date-time-format/library/deals/renewal.md +31 -0
- package/fixtures/cases/date-time-format/schema.yaml +56 -0
- package/fixtures/cases/declared-binary-links/schema.yaml +1 -0
- package/fixtures/cases/default-unfilled/context.json +1 -0
- package/fixtures/cases/default-unfilled/expected.json +6 -0
- package/fixtures/cases/default-unfilled/library/companies/acme.md +4 -0
- package/fixtures/cases/default-unfilled/library/deals/renewal.md +29 -0
- package/fixtures/cases/default-unfilled/schema.yaml +56 -0
- package/fixtures/cases/defs-pattern/context.json +1 -0
- package/fixtures/cases/defs-pattern/expected.json +6 -0
- package/fixtures/cases/defs-pattern/library/companies/acme.md +4 -0
- package/fixtures/cases/defs-pattern/library/deals/renewal.md +31 -0
- package/fixtures/cases/defs-pattern/schema.yaml +56 -0
- package/fixtures/cases/dependent-rule/context.json +1 -0
- package/fixtures/cases/dependent-rule/expected.json +6 -0
- package/fixtures/cases/dependent-rule/library/companies/acme.md +4 -0
- package/fixtures/cases/dependent-rule/library/deals/renewal.md +30 -0
- package/fixtures/cases/dependent-rule/schema.yaml +56 -0
- package/fixtures/cases/duplicate-link-definition/schema.yaml +6 -0
- package/fixtures/cases/email-format/context.json +1 -0
- package/fixtures/cases/email-format/expected.json +6 -0
- package/fixtures/cases/email-format/library/companies/acme.md +4 -0
- package/fixtures/cases/email-format/library/deals/renewal.md +31 -0
- package/fixtures/cases/email-format/schema.yaml +56 -0
- package/fixtures/cases/fenced-link-definition/schema.yaml +6 -0
- package/fixtures/cases/field-enum/expected.json +2 -3
- package/fixtures/cases/field-enum/schema.yaml +7 -0
- package/fixtures/cases/frontmatter-schema/context.json +1 -0
- package/fixtures/cases/frontmatter-schema/expected.json +5 -0
- package/fixtures/cases/frontmatter-schema/schema.yaml +5 -0
- package/fixtures/cases/integer-field/context.json +1 -0
- package/fixtures/cases/integer-field/expected.json +6 -0
- package/fixtures/cases/integer-field/library/companies/acme.md +4 -0
- package/fixtures/cases/integer-field/library/deals/renewal.md +31 -0
- package/fixtures/cases/integer-field/schema.yaml +56 -0
- package/fixtures/cases/interrupted-link-definition/schema.yaml +1 -0
- package/fixtures/cases/json-schema-constructs/context.json +1 -0
- package/fixtures/cases/json-schema-constructs/expected.json +1 -0
- package/fixtures/cases/json-schema-constructs/library/companies/acme.md +4 -0
- package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +31 -0
- package/fixtures/cases/json-schema-constructs/schema.yaml +56 -0
- package/fixtures/cases/lazy-list-item/context.json +1 -0
- package/fixtures/cases/lazy-list-item/expected.json +3 -0
- package/fixtures/cases/lazy-list-item/library/item.md +8 -0
- package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
- package/fixtures/cases/link-into-a-reserved-name/context.json +1 -0
- package/fixtures/cases/link-into-a-reserved-name/expected.json +5 -0
- package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +6 -0
- package/fixtures/cases/link-into-a-reserved-name/schema.yaml +3 -0
- package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/context.json +1 -0
- package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/expected.json +5 -0
- package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/library/notes/b.md +5 -0
- package/fixtures/cases/list-of-objects-closed/context.json +1 -0
- package/fixtures/cases/list-of-objects-closed/expected.json +6 -0
- package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +4 -0
- package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +32 -0
- package/fixtures/cases/list-of-objects-closed/schema.yaml +56 -0
- package/fixtures/cases/list-of-objects-item/context.json +1 -0
- package/fixtures/cases/list-of-objects-item/expected.json +6 -0
- package/fixtures/cases/list-of-objects-item/library/companies/acme.md +4 -0
- package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +31 -0
- package/fixtures/cases/list-of-objects-item/schema.yaml +56 -0
- package/fixtures/cases/list-of-objects-reference/context.json +1 -0
- package/fixtures/cases/list-of-objects-reference/expected.json +6 -0
- package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +14 -0
- package/fixtures/cases/list-of-objects-reference/library/places/depot.md +4 -0
- package/fixtures/cases/list-of-objects-reference/library/products/seats.md +4 -0
- package/fixtures/cases/list-of-objects-reference/library/products/support.md +4 -0
- package/fixtures/cases/list-of-objects-reference/schema.yaml +32 -0
- package/fixtures/cases/list-size/context.json +1 -0
- package/fixtures/cases/list-size/expected.json +6 -0
- package/fixtures/cases/list-size/library/companies/acme.md +4 -0
- package/fixtures/cases/list-size/library/deals/renewal.md +31 -0
- package/fixtures/cases/list-size/schema.yaml +56 -0
- package/fixtures/cases/long-fence-link-definition/schema.yaml +1 -0
- package/fixtures/cases/malformed-definition/expected.json +2 -4
- package/fixtures/cases/malformed-definition/schema.yaml +3 -0
- package/fixtures/cases/member-document/context.json +1 -0
- package/fixtures/cases/member-document/expected.json +1 -0
- package/fixtures/cases/member-document/library/people/ana.md +5 -0
- package/fixtures/cases/member-document/schema.yaml +5 -0
- package/fixtures/cases/member-on-an-untyped-document/context.json +1 -0
- package/fixtures/cases/member-on-an-untyped-document/expected.json +6 -0
- package/fixtures/cases/member-on-an-untyped-document/library/note.md +4 -0
- package/fixtures/cases/member-on-another-type/context.json +1 -0
- package/fixtures/cases/member-on-another-type/expected.json +6 -0
- package/fixtures/cases/member-on-another-type/library/note.md +4 -0
- package/fixtures/cases/member-on-another-type/schema.yaml +7 -0
- package/fixtures/cases/missing-required-field/expected.json +2 -3
- package/fixtures/cases/missing-required-field/schema.yaml +7 -0
- package/fixtures/cases/missing-section-item-kind/expected.json +2 -4
- package/fixtures/cases/missing-section-item-kind/schema.yaml +6 -0
- package/fixtures/cases/misspelled-key/context.json +1 -0
- package/fixtures/cases/misspelled-key/expected.json +6 -0
- package/fixtures/cases/misspelled-key/library/companies/acme.md +4 -0
- package/fixtures/cases/misspelled-key/library/deals/renewal.md +32 -0
- package/fixtures/cases/misspelled-key/schema.yaml +56 -0
- package/fixtures/cases/nested-defs/context.json +1 -0
- package/fixtures/cases/nested-defs/expected.json +6 -0
- package/fixtures/cases/nested-defs/library/deal.md +6 -0
- package/fixtures/cases/nested-defs/schema.yaml +11 -0
- package/fixtures/cases/nested-object-reference/context.json +1 -0
- package/fixtures/cases/nested-object-reference/expected.json +6 -0
- package/fixtures/cases/nested-object-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/nested-object-reference/library/deals/renewal.md +14 -0
- package/fixtures/cases/nested-object-reference/library/places/depot.md +4 -0
- package/fixtures/cases/nested-object-reference/library/products/seats.md +4 -0
- package/fixtures/cases/nested-object-reference/library/products/support.md +4 -0
- package/fixtures/cases/nested-object-reference/schema.yaml +32 -0
- package/fixtures/cases/nested-reference/context.json +1 -0
- package/fixtures/cases/nested-reference/expected.json +1 -0
- package/fixtures/cases/nested-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/nested-reference/library/deals/renewal.md +15 -0
- package/fixtures/cases/nested-reference/library/places/depot.md +4 -0
- package/fixtures/cases/nested-reference/library/products/seats.md +4 -0
- package/fixtures/cases/nested-reference/library/products/support.md +4 -0
- package/fixtures/cases/nested-reference/schema.yaml +32 -0
- package/fixtures/cases/nested-required-field/context.json +1 -0
- package/fixtures/cases/nested-required-field/expected.json +6 -0
- package/fixtures/cases/nested-required-field/library/companies/acme.md +4 -0
- package/fixtures/cases/nested-required-field/library/deals/renewal.md +30 -0
- package/fixtures/cases/nested-required-field/schema.yaml +56 -0
- package/fixtures/cases/null-refused/context.json +1 -0
- package/fixtures/cases/null-refused/expected.json +6 -0
- package/fixtures/cases/null-refused/library/companies/acme.md +4 -0
- package/fixtures/cases/null-refused/library/deals/renewal.md +31 -0
- package/fixtures/cases/null-refused/schema.yaml +56 -0
- package/fixtures/cases/numeric-range/context.json +1 -0
- package/fixtures/cases/numeric-range/expected.json +6 -0
- package/fixtures/cases/numeric-range/library/companies/acme.md +4 -0
- package/fixtures/cases/numeric-range/library/deals/renewal.md +31 -0
- package/fixtures/cases/numeric-range/schema.yaml +56 -0
- package/fixtures/cases/one-of-variant/context.json +1 -0
- package/fixtures/cases/one-of-variant/expected.json +6 -0
- package/fixtures/cases/one-of-variant/library/companies/acme.md +4 -0
- package/fixtures/cases/one-of-variant/library/deals/renewal.md +31 -0
- package/fixtures/cases/one-of-variant/schema.yaml +56 -0
- package/fixtures/cases/open-map-value/context.json +1 -0
- package/fixtures/cases/open-map-value/expected.json +6 -0
- package/fixtures/cases/open-map-value/library/companies/acme.md +4 -0
- package/fixtures/cases/open-map-value/library/deals/renewal.md +31 -0
- package/fixtures/cases/open-map-value/schema.yaml +56 -0
- package/fixtures/cases/other-room-reference/context.json +1 -0
- package/fixtures/cases/other-room-reference/expected.json +6 -0
- package/fixtures/cases/other-room-reference/library/companies/acme.md +4 -0
- package/fixtures/cases/other-room-reference/library/deals/renewal.md +14 -0
- package/fixtures/cases/other-room-reference/library/places/depot.md +4 -0
- package/fixtures/cases/other-room-reference/library/products/seats.md +4 -0
- package/fixtures/cases/other-room-reference/library/products/support.md +4 -0
- package/fixtures/cases/other-room-reference/schema.yaml +32 -0
- package/fixtures/cases/paragraph-link-definition/schema.yaml +1 -0
- package/fixtures/cases/prototype-field/expected.json +2 -3
- package/fixtures/cases/prototype-field/schema.yaml +6 -0
- package/fixtures/cases/quoted-link-definition/expected.json +1 -2
- package/fixtures/cases/quoted-link-definition/library/notes/draft.md +1 -1
- package/fixtures/cases/quoted-link-definition/schema.yaml +1 -0
- package/fixtures/cases/reference-into-a-reserved-name/context.json +1 -0
- package/fixtures/cases/reference-into-a-reserved-name/expected.json +6 -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.yaml +3 -0
- package/fixtures/cases/referenced-missing-file/expected.json +0 -1
- package/fixtures/cases/referenced-missing-file/schema.yaml +11 -0
- package/fixtures/cases/remote-ref/context.json +1 -0
- package/fixtures/cases/remote-ref/expected.json +5 -0
- package/fixtures/cases/remote-ref/schema.yaml +3 -0
- package/fixtures/cases/room-md-declares-a-type/context.json +1 -0
- package/fixtures/cases/room-md-declares-a-type/expected.json +6 -0
- package/fixtures/cases/room-md-declares-a-type/library/ROOM.md +5 -0
- package/fixtures/cases/second-member-document/context.json +1 -0
- package/fixtures/cases/second-member-document/expected.json +5 -0
- package/fixtures/cases/second-member-document/schema.yaml +4 -0
- package/fixtures/cases/section-item-enum/context.json +1 -0
- package/fixtures/cases/section-item-enum/expected.json +6 -0
- package/fixtures/cases/section-item-enum/library/task.md +8 -0
- package/fixtures/cases/section-item-enum/schema.yaml +3 -0
- package/fixtures/cases/section-item-kind/context.json +1 -0
- package/fixtures/cases/section-item-kind/expected.json +6 -0
- package/fixtures/cases/section-item-kind/library/task.md +8 -0
- package/fixtures/cases/section-item-kind/schema.yaml +3 -0
- package/fixtures/cases/section-items/context.json +1 -0
- package/fixtures/cases/section-items/expected.json +1 -0
- package/fixtures/cases/section-items/library/other.md +3 -0
- package/fixtures/cases/section-items/library/page.md +42 -0
- package/fixtures/cases/section-items/schema.yaml +10 -0
- package/fixtures/cases/section-reference-path/context.json +1 -0
- package/fixtures/cases/section-reference-path/expected.json +6 -0
- package/fixtures/cases/section-reference-path/library/other.md +3 -0
- package/fixtures/cases/section-reference-path/library/page.md +7 -0
- package/fixtures/cases/section-reference-path/schema.yaml +3 -0
- package/fixtures/cases/section-reference-type/context.json +1 -0
- package/fixtures/cases/section-reference-type/expected.json +6 -0
- package/fixtures/cases/section-reference-type/library/note.md +1 -0
- package/fixtures/cases/section-reference-type/library/page.md +7 -0
- package/fixtures/cases/section-reference-type/schema.yaml +3 -0
- package/fixtures/cases/shortcut-reference-link/context.json +1 -0
- package/fixtures/cases/shortcut-reference-link/expected.json +5 -0
- package/fixtures/cases/shortcut-reference-link/library/item.md +10 -0
- package/fixtures/cases/shortcut-reference-link/schema.yaml +6 -0
- package/fixtures/cases/string-length/context.json +1 -0
- package/fixtures/cases/string-length/expected.json +6 -0
- package/fixtures/cases/string-length/library/companies/acme.md +4 -0
- package/fixtures/cases/string-length/library/deals/renewal.md +31 -0
- package/fixtures/cases/string-length/schema.yaml +56 -0
- package/fixtures/cases/structured-section/expected.json +1 -2
- package/fixtures/cases/structured-section/schema.yaml +7 -0
- package/fixtures/cases/submission-keys/context.json +1 -0
- package/fixtures/cases/submission-keys/expected.json +1 -0
- package/fixtures/cases/submission-keys/library/notes/visitor.md +8 -0
- package/fixtures/cases/submission-keys/schema.yaml +4 -0
- package/fixtures/cases/text-field-kind/context.json +1 -0
- package/fixtures/cases/text-field-kind/expected.json +6 -0
- package/fixtures/cases/text-field-kind/library/page.md +4 -0
- package/fixtures/cases/text-field-kind/schema.yaml +4 -0
- package/fixtures/cases/thematic-break-in-a-list-section/context.json +1 -0
- package/fixtures/cases/thematic-break-in-a-list-section/expected.json +6 -0
- package/fixtures/cases/thematic-break-in-a-list-section/library/item.md +7 -0
- package/fixtures/cases/thematic-break-in-a-list-section/schema.yaml +3 -0
- package/fixtures/cases/truncated-link-definition/expected.json +1 -2
- package/fixtures/cases/truncated-link-definition/library/notes/draft.md +1 -1
- package/fixtures/cases/truncated-link-definition/schema.yaml +1 -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.yaml +6 -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.yaml +6 -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.yaml +6 -0
- package/fixtures/cases/types-folder-content/context.json +1 -0
- package/fixtures/cases/types-folder-content/expected.json +1 -0
- package/fixtures/cases/types-folder-content/library/types/task.md +4 -0
- package/fixtures/cases/types-folder-content/schema.yaml +4 -0
- package/fixtures/cases/unclosed-frontmatter/expected.json +1 -2
- package/fixtures/cases/undeclared-field/expected.json +2 -3
- package/fixtures/cases/undeclared-field/schema.yaml +6 -0
- package/fixtures/cases/unevaluated-items-closed/context.json +1 -0
- package/fixtures/cases/unevaluated-items-closed/expected.json +6 -0
- package/fixtures/cases/unevaluated-items-closed/library/trip.md +6 -0
- package/fixtures/cases/unevaluated-items-closed/schema.yaml +10 -0
- package/fixtures/cases/unknown-type/context.json +1 -0
- package/fixtures/cases/unknown-type/expected.json +6 -0
- package/fixtures/cases/unknown-type/library/item.md +3 -0
- package/fixtures/cases/unknown-type/schema.yaml +3 -0
- package/fixtures/cases/unlisted-reference-type/context.json +1 -0
- package/fixtures/cases/unlisted-reference-type/expected.json +5 -0
- package/fixtures/cases/unlisted-reference-type/schema.yaml +3 -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 +4 -0
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/schema.yaml +5 -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 +6 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/schema.yaml +5 -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 +5 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/schema.yaml +5 -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.yaml +5 -0
- package/fixtures/cases/unresolved-link/expected.json +1 -2
- package/fixtures/cases/unresolved-link/library/item.md +1 -1
- package/fixtures/cases/unresolved-link/schema.yaml +6 -0
- package/fixtures/cases/valid-typed-document/schema.yaml +16 -0
- package/fixtures/cases/wide-item-fence-link/schema.yaml +1 -0
- package/fixtures/division.json +454 -0
- package/fixtures/preamble.json +24 -3
- package/fixtures/projection.json +194 -22
- package/fixtures/queries.json +964 -0
- package/package.json +20 -13
- package/dist/definition.js.map +0 -1
- package/dist/document.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/links.d.ts +0 -25
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -380
- package/dist/links.js.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/profile.d.ts +0 -6
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js +0 -7
- package/dist/profile.js.map +0 -1
- package/dist/project.js.map +0 -1
- package/dist/refuse.js.map +0 -1
- package/dist/schema.js.map +0 -1
- package/dist/sections.d.ts +0 -10
- package/dist/sections.d.ts.map +0 -1
- package/dist/sections.js +0 -79
- package/dist/sections.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validate.js.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/yaml.js.map +0 -1
- package/fixtures/cases/binary-any-reference/library/types/note.md +0 -5
- package/fixtures/cases/binary-document-collision/library/types/note.md +0 -3
- package/fixtures/cases/binary-link-outside-collection/library/types/note.md +0 -3
- package/fixtures/cases/binary-prototype-reference/library/types/note.md +0 -5
- package/fixtures/cases/binary-typed-reference/library/types/note.md +0 -5
- package/fixtures/cases/binary-typed-reference/library/types/person.md +0 -3
- package/fixtures/cases/bracketed-link-definition/library/types/task.md +0 -7
- package/fixtures/cases/declared-binary-links/library/types/note.md +0 -3
- package/fixtures/cases/duplicate-link-definition/library/types/task.md +0 -7
- package/fixtures/cases/fenced-link-definition/library/types/task.md +0 -7
- package/fixtures/cases/field-enum/library/types/task.md +0 -8
- package/fixtures/cases/interrupted-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/long-fence-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/malformed-definition/library/types/task.md +0 -5
- package/fixtures/cases/missing-binary-image/expected.json +0 -6
- package/fixtures/cases/missing-binary-image/library/types/note.md +0 -3
- package/fixtures/cases/missing-binary-link/expected.json +0 -6
- package/fixtures/cases/missing-binary-link/library/types/note.md +0 -3
- package/fixtures/cases/missing-required-field/library/types/task.md +0 -8
- package/fixtures/cases/missing-section-item-kind/library/types/task.md +0 -7
- package/fixtures/cases/paragraph-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/prd-definition/library/types/task.md +0 -16
- package/fixtures/cases/prototype-field/library/types/task.md +0 -7
- package/fixtures/cases/quoted-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/referenced-missing-file/library/types/person.md +0 -5
- package/fixtures/cases/referenced-missing-file/library/types/task.md +0 -8
- package/fixtures/cases/structured-section/library/types/task.md +0 -8
- package/fixtures/cases/truncated-link-definition/library/types/note.md +0 -3
- package/fixtures/cases/undeclared-field/library/types/task.md +0 -7
- package/fixtures/cases/unresolved-link/library/types/task.md +0 -7
- package/fixtures/cases/valid-typed-document/library/types/person.md +0 -5
- package/fixtures/cases/valid-typed-document/library/types/task.md +0 -13
- package/fixtures/cases/wide-item-fence-link/library/types/note.md +0 -3
- package/markdown-syntax-profile.md +0 -9
- /package/fixtures/cases/{prd-definition → absent-link-dangles}/context.json +0 -0
- /package/fixtures/cases/{prd-definition → absent-link-dangles}/expected.json +0 -0
- /package/fixtures/cases/{missing-binary-image → binary-image-dangles}/context.json +0 -0
- /package/fixtures/cases/{missing-binary-image → binary-image-dangles}/library/notes/draft.md +0 -0
- /package/fixtures/cases/{missing-binary-link → binary-link-dangles}/context.json +0 -0
- /package/fixtures/cases/{missing-binary-link → binary-link-dangles}/library/notes/draft.md +0 -0
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
import type { Frontmatter, Reference } from './types.js';
|
|
3
|
+
export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
|
|
4
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA8BzD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EACrC,UAAU,EAAE,UAAU,GACrB,SAAS,SAAS,EAAE,CAItB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { escapePointer, itemFacts, memberFacts, } from './definition.js';
|
|
2
|
+
import { isRecord } from './yaml.js';
|
|
3
|
+
function collect(value, facts, pointer, found) {
|
|
4
|
+
if (facts === undefined)
|
|
5
|
+
return;
|
|
6
|
+
if (typeof value === 'string') {
|
|
7
|
+
if (facts.reference !== undefined)
|
|
8
|
+
found.push({
|
|
9
|
+
pointer,
|
|
10
|
+
value,
|
|
11
|
+
to: facts.reference,
|
|
12
|
+
...(facts.crossRoom === true ? { crossRoom: true } : {}),
|
|
13
|
+
});
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(value)) {
|
|
17
|
+
for (const [index, item] of value.entries())
|
|
18
|
+
collect(item, itemFacts(facts, index), `${pointer}/${index}`, found);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (!isRecord(value))
|
|
22
|
+
return;
|
|
23
|
+
for (const [key, held] of Object.entries(value))
|
|
24
|
+
collect(held, memberFacts(facts, key), `${pointer}/${escapePointer(key)}`, found);
|
|
25
|
+
}
|
|
26
|
+
export function references(document, definition) {
|
|
27
|
+
const found = [];
|
|
28
|
+
collect(document.fields, definition.frontmatter, '', found);
|
|
29
|
+
return found;
|
|
30
|
+
}
|
package/dist/refuse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3D,OAAO,CAOT"}
|
package/dist/refuse.js
CHANGED
|
@@ -1,16 +1,8 @@
|
|
|
1
|
-
import { VERSION } from './version.js';
|
|
2
1
|
export function refusal(file, rule, extra) {
|
|
3
2
|
return {
|
|
4
3
|
file,
|
|
5
4
|
rule,
|
|
6
|
-
|
|
7
|
-
...extra?.
|
|
8
|
-
location: extra.location
|
|
9
|
-
},
|
|
10
|
-
...extra?.referrers === undefined ? {} : {
|
|
11
|
-
referrers: extra.referrers
|
|
12
|
-
}
|
|
5
|
+
...(extra?.location === undefined ? {} : { location: extra.location }),
|
|
6
|
+
...(extra?.referrers === undefined ? {} : { referrers: extra.referrers }),
|
|
13
7
|
};
|
|
14
8
|
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=refuse.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ROOM_DESCRIPTION = "ROOM.md";
|
|
2
|
+
export declare const CAPTURE_HOME = "capture";
|
|
3
|
+
export declare const RESERVED_NAMES: readonly string[];
|
|
4
|
+
export declare function isReservedName(name: string): boolean;
|
|
5
|
+
export declare function isDocumentPath(path: string): boolean;
|
|
6
|
+
//# sourceMappingURL=reserved.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
package/dist/reserved.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const ROOM_DESCRIPTION = 'ROOM.md';
|
|
2
|
+
export const CAPTURE_HOME = 'capture';
|
|
3
|
+
export const RESERVED_NAMES = [
|
|
4
|
+
ROOM_DESCRIPTION,
|
|
5
|
+
CAPTURE_HOME,
|
|
6
|
+
'settings',
|
|
7
|
+
'rooms',
|
|
8
|
+
'agents',
|
|
9
|
+
'house',
|
|
10
|
+
];
|
|
11
|
+
function folded(name) {
|
|
12
|
+
return name.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
|
|
13
|
+
}
|
|
14
|
+
const FOLDED_RESERVED_NAMES = new Set(RESERVED_NAMES.map(folded));
|
|
15
|
+
export function isReservedName(name) {
|
|
16
|
+
return FOLDED_RESERVED_NAMES.has(folded(name));
|
|
17
|
+
}
|
|
18
|
+
export function isDocumentPath(path) {
|
|
19
|
+
const first = path.split('/', 1)[0];
|
|
20
|
+
return first !== '' && !isReservedName(first);
|
|
21
|
+
}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
export type SchemaRefusal = {
|
|
3
|
+
readonly rule: string;
|
|
4
|
+
readonly location: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function frontmatterRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
|
|
7
|
+
export declare function conditionedSections(definition: Definition, fields: Readonly<Record<string, unknown>>): readonly string[];
|
|
8
|
+
export declare function fitsItem(definition: Definition, section: string, text: string): boolean;
|
|
6
9
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0B5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA6NjF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAI3B;AAYD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,SAAS,MAAM,EAAE,CAGnB;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMvF"}
|
package/dist/schema.js
CHANGED
|
@@ -1,48 +1,214 @@
|
|
|
1
1
|
import { Validator } from '@cfworker/json-schema';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
import { escapePointer, refTarget } from './definition.js';
|
|
3
|
+
import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
4
|
+
import { withLinearRegExp } from './pattern.js';
|
|
5
|
+
import { interpretPlain, isRecord } from './yaml.js';
|
|
6
|
+
const STANDING_MAPS = ['properties', 'patternProperties'];
|
|
7
|
+
const STANDING = [
|
|
8
|
+
'additionalProperties',
|
|
9
|
+
'unevaluatedProperties',
|
|
10
|
+
'items',
|
|
11
|
+
'unevaluatedItems',
|
|
12
|
+
'contains',
|
|
13
|
+
];
|
|
14
|
+
const STANDING_LISTS = ['prefixItems'];
|
|
15
|
+
const IN_PLACE = ['if', 'then', 'else'];
|
|
16
|
+
const IN_PLACE_LISTS = ['allOf', 'anyOf', 'oneOf'];
|
|
17
|
+
const IN_PLACE_MAPS = ['dependentSchemas'];
|
|
18
|
+
const PASSING = new Set([
|
|
19
|
+
'properties',
|
|
20
|
+
'patternProperties',
|
|
21
|
+
'$ref',
|
|
22
|
+
'items',
|
|
23
|
+
'prefixItems',
|
|
24
|
+
'unevaluatedItems',
|
|
25
|
+
'allOf',
|
|
26
|
+
'if',
|
|
27
|
+
'dependentSchemas',
|
|
28
|
+
]);
|
|
29
|
+
const OPENING = new Set(['additionalProperties', 'unevaluatedProperties']);
|
|
30
|
+
const REQUIRED = /required property "([\s\S]*)"\.$/u;
|
|
31
|
+
const compiled = new WeakMap();
|
|
32
|
+
function mapped(value, map) {
|
|
33
|
+
return Object.fromEntries(Object.entries(value).map(([key, held]) => [key, map(held)]));
|
|
19
34
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
35
|
+
function objectSchema(node) {
|
|
36
|
+
const type = node.type;
|
|
37
|
+
return (type === 'object' ||
|
|
38
|
+
(Array.isArray(type) && type.includes('object')) ||
|
|
39
|
+
node.properties !== undefined ||
|
|
40
|
+
node.patternProperties !== undefined);
|
|
41
|
+
}
|
|
42
|
+
function inPlaceChildren(node) {
|
|
43
|
+
return [
|
|
44
|
+
...IN_PLACE.map((key) => node[key]),
|
|
45
|
+
...IN_PLACE_LISTS.flatMap((key) => (Array.isArray(node[key]) ? node[key] : [])),
|
|
46
|
+
...IN_PLACE_MAPS.flatMap((key) => (isRecord(node[key]) ? Object.values(node[key]) : [])),
|
|
47
|
+
];
|
|
48
|
+
}
|
|
49
|
+
function objecty(node, defs, seen) {
|
|
50
|
+
if (!isRecord(node))
|
|
51
|
+
return false;
|
|
52
|
+
if (objectSchema(node))
|
|
53
|
+
return true;
|
|
54
|
+
if (typeof node.$ref === 'string') {
|
|
55
|
+
const target = refTarget(node.$ref, defs)?.node;
|
|
56
|
+
if (target !== undefined &&
|
|
57
|
+
!seen.has(target) &&
|
|
58
|
+
objecty(target, defs, new Set([...seen, target])))
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return inPlaceChildren(node).some((child) => objecty(child, defs, seen));
|
|
62
|
+
}
|
|
63
|
+
function closed(node, inPlace, defs, always = false) {
|
|
64
|
+
if (!isRecord(node))
|
|
65
|
+
return node;
|
|
66
|
+
const out = { ...node };
|
|
67
|
+
const standing = (held) => closed(held, false, defs);
|
|
68
|
+
const nested = (held) => closed(held, true, defs);
|
|
69
|
+
for (const key of STANDING_MAPS)
|
|
70
|
+
if (isRecord(node[key]))
|
|
71
|
+
out[key] = mapped(node[key], standing);
|
|
72
|
+
for (const key of STANDING)
|
|
73
|
+
if (node[key] !== undefined)
|
|
74
|
+
out[key] = standing(node[key]);
|
|
75
|
+
for (const key of STANDING_LISTS)
|
|
76
|
+
if (Array.isArray(node[key]))
|
|
77
|
+
out[key] = node[key].map(standing);
|
|
78
|
+
for (const key of IN_PLACE)
|
|
79
|
+
if (node[key] !== undefined)
|
|
80
|
+
out[key] = nested(node[key]);
|
|
81
|
+
for (const key of IN_PLACE_LISTS)
|
|
82
|
+
if (Array.isArray(node[key]))
|
|
83
|
+
out[key] = node[key].map(nested);
|
|
84
|
+
for (const key of IN_PLACE_MAPS)
|
|
85
|
+
if (isRecord(node[key]))
|
|
86
|
+
out[key] = mapped(node[key], nested);
|
|
87
|
+
if (isRecord(node.$defs))
|
|
88
|
+
out.$defs = mapped(node.$defs, nested);
|
|
89
|
+
if (!inPlace &&
|
|
90
|
+
node.additionalProperties === undefined &&
|
|
91
|
+
node.unevaluatedProperties === undefined &&
|
|
92
|
+
(always || objecty(node, defs, new Set())))
|
|
93
|
+
out.unevaluatedProperties = false;
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
function copied(value) {
|
|
97
|
+
return JSON.parse(JSON.stringify(value));
|
|
26
98
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
99
|
+
function asks(asked) {
|
|
100
|
+
return asked.sections.length > 0 || asked.conditions.length > 0;
|
|
29
101
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
102
|
+
function branchOf(node, defs, closedDefs) {
|
|
103
|
+
if (!isRecord(node))
|
|
104
|
+
return { schema: node, asked: { sections: [], conditions: [] } };
|
|
105
|
+
const { sections, ...rest } = node;
|
|
106
|
+
const read = unconditioned(rest, defs, closedDefs);
|
|
107
|
+
const required = Object.entries(isRecord(sections) ? sections : {}).flatMap(([name, spec]) => isRecord(spec) && spec.required === true ? [name] : []);
|
|
108
|
+
return { schema: read.schema, asked: { sections: required, conditions: read.conditions } };
|
|
109
|
+
}
|
|
110
|
+
function unconditioned(node, defs, closedDefs) {
|
|
111
|
+
if (!isRecord(node))
|
|
112
|
+
return { schema: node, conditions: [] };
|
|
113
|
+
const schema = { ...node };
|
|
114
|
+
const conditions = [];
|
|
115
|
+
if (Array.isArray(node.allOf))
|
|
116
|
+
schema.allOf = node.allOf.map((entry) => {
|
|
117
|
+
const read = unconditioned(entry, defs, closedDefs);
|
|
118
|
+
conditions.push(...read.conditions);
|
|
119
|
+
return read.schema;
|
|
120
|
+
});
|
|
121
|
+
if (node.if === undefined)
|
|
122
|
+
return { schema, conditions };
|
|
123
|
+
const met = branchOf(node.then, defs, closedDefs);
|
|
124
|
+
const unmet = branchOf(node.else, defs, closedDefs);
|
|
125
|
+
if (node.then !== undefined)
|
|
126
|
+
schema.then = met.schema;
|
|
127
|
+
if (node.else !== undefined)
|
|
128
|
+
schema.else = unmet.schema;
|
|
129
|
+
if (!asks(met.asked) && !asks(unmet.asked))
|
|
130
|
+
return { schema, conditions };
|
|
131
|
+
const test = new Validator(isRecord(node.if)
|
|
132
|
+
? { ...closed(node.if, true, defs), $defs: closedDefs }
|
|
133
|
+
: node.if === true, '2020-12', false);
|
|
134
|
+
return { schema, conditions: [...conditions, { test, met: met.asked, unmet: unmet.asked }] };
|
|
135
|
+
}
|
|
136
|
+
function compile(definition) {
|
|
137
|
+
const defs = copied(definition.shape.defs);
|
|
138
|
+
const { sections, member_document: _mark, ...written } = copied(definition.shape.schema);
|
|
139
|
+
const closedDefs = mapped(defs, (held) => closed(held, true, defs));
|
|
140
|
+
const read = unconditioned(written, defs, closedDefs);
|
|
141
|
+
const root = read.schema;
|
|
142
|
+
const declared = isRecord(root.properties) ? root.properties : {};
|
|
143
|
+
const properties = {
|
|
144
|
+
[TYPE_FIELD]: true,
|
|
145
|
+
[SITE_FIELD]: true,
|
|
146
|
+
[RECEIVED_FIELD]: true,
|
|
147
|
+
...(definition.memberDocument ? { [MEMBER_FIELD]: { type: 'string' } } : {}),
|
|
148
|
+
...declared,
|
|
149
|
+
};
|
|
150
|
+
const frontmatter = new Validator({ ...closed({ ...root, properties }, false, defs, true), $defs: closedDefs }, '2020-12', false);
|
|
151
|
+
const lists = new Map();
|
|
152
|
+
for (const [name, spec] of Object.entries(isRecord(sections) ? sections : {})) {
|
|
153
|
+
if (!isRecord(spec) || spec.kind !== 'list')
|
|
154
|
+
continue;
|
|
155
|
+
lists.set(name, new Validator({ ...closed(spec.items, false, defs), $defs: closedDefs }, '2020-12', false));
|
|
36
156
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
157
|
+
return { frontmatter, sections: lists, conditions: read.conditions };
|
|
158
|
+
}
|
|
159
|
+
function compiledOf(definition) {
|
|
160
|
+
const held = compiled.get(definition);
|
|
161
|
+
if (held !== undefined)
|
|
162
|
+
return held;
|
|
163
|
+
const made = compile(definition);
|
|
164
|
+
compiled.set(definition, made);
|
|
165
|
+
return made;
|
|
166
|
+
}
|
|
167
|
+
function pointer(location) {
|
|
168
|
+
return decodeURI(location.slice(1));
|
|
169
|
+
}
|
|
170
|
+
function refusalOf(errors) {
|
|
171
|
+
for (const [index, error] of errors.entries()) {
|
|
172
|
+
const next = errors[index + 1];
|
|
173
|
+
if (OPENING.has(error.keyword)) {
|
|
174
|
+
if (next?.keyword === 'false')
|
|
175
|
+
return { rule: 'undeclared-field', location: pointer(next.instanceLocation) };
|
|
176
|
+
if (next !== undefined)
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (PASSING.has(error.keyword) && next !== undefined)
|
|
180
|
+
continue;
|
|
181
|
+
if (error.keyword === 'required') {
|
|
182
|
+
const missing = REQUIRED.exec(error.error)?.[1] ?? '';
|
|
183
|
+
return {
|
|
184
|
+
rule: 'required',
|
|
185
|
+
location: `${pointer(error.instanceLocation)}/${escapePointer(missing)}`,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
return { rule: error.keyword, location: pointer(error.instanceLocation) };
|
|
44
189
|
}
|
|
45
|
-
return
|
|
190
|
+
return { rule: 'schema', location: '' };
|
|
191
|
+
}
|
|
192
|
+
export function frontmatterRefusal(definition, fields) {
|
|
193
|
+
const { frontmatter } = compiledOf(definition);
|
|
194
|
+
const result = withLinearRegExp(() => frontmatter.validate(fields));
|
|
195
|
+
return result.valid ? undefined : refusalOf(result.errors);
|
|
196
|
+
}
|
|
197
|
+
function askedOf(conditions, fields) {
|
|
198
|
+
return conditions.flatMap((condition) => {
|
|
199
|
+
const asked = condition.test.validate(fields).valid ? condition.met : condition.unmet;
|
|
200
|
+
return [...asked.sections, ...askedOf(asked.conditions, fields)];
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
export function conditionedSections(definition, fields) {
|
|
204
|
+
const { conditions } = compiledOf(definition);
|
|
205
|
+
return withLinearRegExp(() => askedOf(conditions, fields));
|
|
206
|
+
}
|
|
207
|
+
export function fitsItem(definition, section, text) {
|
|
208
|
+
const spec = definition.sections[section];
|
|
209
|
+
const validator = compiledOf(definition).sections.get(section);
|
|
210
|
+
if (spec?.kind !== 'list' || validator === undefined)
|
|
211
|
+
return false;
|
|
212
|
+
const typed = spec.items.type === 'string' ? text : interpretPlain(text);
|
|
213
|
+
return withLinearRegExp(() => validator.validate(typed).valid);
|
|
46
214
|
}
|
|
47
|
-
|
|
48
|
-
//# sourceMappingURL=schema.js.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,30 +1,80 @@
|
|
|
1
|
+
import type { Definition } from './definition.js';
|
|
1
2
|
export type Library = Readonly<Record<string, string>>;
|
|
3
|
+
export type VerifiedModel = {
|
|
4
|
+
readonly types: Readonly<Record<string, Definition>>;
|
|
5
|
+
readonly nameable?: readonly string[];
|
|
6
|
+
};
|
|
7
|
+
export type ModelVerification = {
|
|
8
|
+
readonly verdict: 'accept';
|
|
9
|
+
readonly model: VerifiedModel;
|
|
10
|
+
} | {
|
|
11
|
+
readonly verdict: 'refuse';
|
|
12
|
+
readonly rule: string;
|
|
13
|
+
readonly location?: string;
|
|
14
|
+
};
|
|
15
|
+
export type TypedPath = {
|
|
16
|
+
readonly path: string;
|
|
17
|
+
readonly type: string;
|
|
18
|
+
readonly named: boolean;
|
|
19
|
+
readonly body: boolean;
|
|
20
|
+
};
|
|
2
21
|
export type ValidationContext = {
|
|
3
22
|
readonly binaryTargets: readonly string[];
|
|
23
|
+
readonly anyRoom?: true;
|
|
24
|
+
readonly typedPaths?: readonly TypedPath[];
|
|
4
25
|
};
|
|
5
26
|
export type ProjectionContext = {
|
|
6
27
|
readonly documentTargets: readonly string[];
|
|
7
|
-
readonly definition?:
|
|
28
|
+
readonly definition?: Definition;
|
|
29
|
+
};
|
|
30
|
+
export type DivisionContext = ProjectionContext & {
|
|
31
|
+
readonly bound: number;
|
|
32
|
+
};
|
|
33
|
+
export type Extent = {
|
|
34
|
+
readonly start: number;
|
|
35
|
+
readonly end: number;
|
|
8
36
|
};
|
|
9
|
-
export type
|
|
37
|
+
export type Span = Extent & {
|
|
38
|
+
readonly text: string;
|
|
39
|
+
};
|
|
40
|
+
export type Frontmatter = {
|
|
10
41
|
readonly content: string;
|
|
11
42
|
readonly type: string | undefined;
|
|
12
43
|
readonly fields: Readonly<Record<string, unknown>>;
|
|
44
|
+
};
|
|
45
|
+
export type Document = Frontmatter & {
|
|
13
46
|
readonly preamble: string;
|
|
14
47
|
readonly sections: Readonly<Record<string, string>>;
|
|
48
|
+
readonly text: string;
|
|
15
49
|
};
|
|
50
|
+
export type DefinitionOf = (type: string | undefined) => Definition | undefined;
|
|
16
51
|
export type Refusal = {
|
|
17
52
|
readonly file: string;
|
|
18
53
|
readonly rule: string;
|
|
19
|
-
readonly version: string;
|
|
20
54
|
readonly location?: string;
|
|
21
55
|
readonly referrers?: readonly string[];
|
|
22
56
|
};
|
|
57
|
+
export type Reached = {
|
|
58
|
+
readonly target: string | null;
|
|
59
|
+
readonly to: readonly string[];
|
|
60
|
+
};
|
|
61
|
+
export type DocumentCheck = {
|
|
62
|
+
readonly ok: false;
|
|
63
|
+
} | {
|
|
64
|
+
readonly ok: true;
|
|
65
|
+
readonly type: string;
|
|
66
|
+
readonly typed: boolean;
|
|
67
|
+
readonly references: readonly Reached[];
|
|
68
|
+
};
|
|
23
69
|
export type Validation = {
|
|
24
70
|
readonly verdict: 'accept';
|
|
25
71
|
} | ({
|
|
26
72
|
readonly verdict: 'refuse';
|
|
27
73
|
} & Refusal);
|
|
74
|
+
export type ValidationStep = {
|
|
75
|
+
readonly path: string;
|
|
76
|
+
readonly resolved: number;
|
|
77
|
+
};
|
|
28
78
|
export type Projection = {
|
|
29
79
|
readonly ok: true;
|
|
30
80
|
readonly text: string;
|
|
@@ -32,6 +82,20 @@ export type Projection = {
|
|
|
32
82
|
readonly ok: false;
|
|
33
83
|
readonly refusal: Refusal;
|
|
34
84
|
};
|
|
85
|
+
export type Division = {
|
|
86
|
+
readonly ok: true;
|
|
87
|
+
readonly spans: readonly Span[];
|
|
88
|
+
} | {
|
|
89
|
+
readonly ok: false;
|
|
90
|
+
readonly refusal: Refusal;
|
|
91
|
+
};
|
|
92
|
+
export type FrontmatterResult = {
|
|
93
|
+
readonly ok: true;
|
|
94
|
+
readonly frontmatter: Frontmatter;
|
|
95
|
+
} | {
|
|
96
|
+
readonly ok: false;
|
|
97
|
+
readonly refusal: Refusal;
|
|
98
|
+
};
|
|
35
99
|
export type ParseResult = {
|
|
36
100
|
readonly ok: true;
|
|
37
101
|
readonly document: Document;
|
|
@@ -43,6 +107,31 @@ export type Link = {
|
|
|
43
107
|
readonly href: string;
|
|
44
108
|
readonly target: string;
|
|
45
109
|
};
|
|
110
|
+
export type Reference = {
|
|
111
|
+
readonly pointer: string;
|
|
112
|
+
readonly value: string;
|
|
113
|
+
readonly to: readonly string[];
|
|
114
|
+
readonly crossRoom?: true;
|
|
115
|
+
};
|
|
116
|
+
export type RoomReference = {
|
|
117
|
+
readonly handle: string;
|
|
118
|
+
readonly path: string;
|
|
119
|
+
} & ({
|
|
120
|
+
readonly kind: 'link';
|
|
121
|
+
readonly href: string;
|
|
122
|
+
} | {
|
|
123
|
+
readonly kind: 'field';
|
|
124
|
+
readonly pointer: string;
|
|
125
|
+
readonly value: string;
|
|
126
|
+
readonly to: readonly string[];
|
|
127
|
+
readonly crossRoom?: true;
|
|
128
|
+
} | {
|
|
129
|
+
readonly kind: 'item';
|
|
130
|
+
readonly section: string;
|
|
131
|
+
readonly href: string;
|
|
132
|
+
readonly to: readonly string[];
|
|
133
|
+
readonly crossRoom?: true;
|
|
134
|
+
});
|
|
46
135
|
export type Change = {
|
|
47
136
|
readonly kind: 'field';
|
|
48
137
|
readonly name: string;
|
|
@@ -52,15 +141,24 @@ export type Change = {
|
|
|
52
141
|
readonly kind: 'section';
|
|
53
142
|
readonly name: string;
|
|
54
143
|
readonly value: string;
|
|
55
|
-
readonly prior: string;
|
|
144
|
+
readonly prior: string | undefined;
|
|
56
145
|
} | {
|
|
57
146
|
readonly kind: 'preamble';
|
|
58
147
|
readonly value: string;
|
|
59
148
|
readonly prior: string;
|
|
149
|
+
} | {
|
|
150
|
+
readonly kind: 'text';
|
|
151
|
+
readonly value: string;
|
|
152
|
+
readonly prior: string;
|
|
60
153
|
} | {
|
|
61
154
|
readonly kind: 'link';
|
|
62
155
|
readonly href: string;
|
|
63
156
|
readonly to: string;
|
|
157
|
+
} | {
|
|
158
|
+
readonly kind: 'reference';
|
|
159
|
+
readonly pointer: string;
|
|
160
|
+
readonly value: string;
|
|
161
|
+
readonly prior: string;
|
|
64
162
|
};
|
|
65
163
|
export type ApplyResult = {
|
|
66
164
|
readonly outcome: 'applied';
|
|
@@ -68,8 +166,20 @@ export type ApplyResult = {
|
|
|
68
166
|
} | {
|
|
69
167
|
readonly outcome: 'stale';
|
|
70
168
|
readonly document: Document;
|
|
169
|
+
readonly stale: readonly number[];
|
|
71
170
|
} | {
|
|
72
171
|
readonly outcome: 'refuse';
|
|
73
172
|
readonly refusal: Refusal;
|
|
74
173
|
};
|
|
174
|
+
export type BodyResult = {
|
|
175
|
+
readonly outcome: 'applied';
|
|
176
|
+
readonly body: string;
|
|
177
|
+
} | {
|
|
178
|
+
readonly outcome: 'refuse';
|
|
179
|
+
readonly refusal: Refusal;
|
|
180
|
+
};
|
|
181
|
+
export type UnlinkedBody = {
|
|
182
|
+
readonly body: string;
|
|
183
|
+
readonly links: ReadonlyMap<string, string>;
|
|
184
|
+
};
|
|
75
185
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IACrD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAC7D;IACE,QAAQ,CAAC,OAAO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CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC"}
|
package/dist/types.js
CHANGED
package/dist/validate.d.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { type Definition } from './definition.js';
|
|
2
|
+
import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
|
|
3
|
+
export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
|
|
4
|
+
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
5
|
+
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
6
|
+
export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
|
|
7
|
+
type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
|
|
8
|
+
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
|
|
9
|
+
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
10
|
+
export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
|
|
11
|
+
type Placed = {
|
|
12
|
+
readonly reference: Reached;
|
|
13
|
+
readonly location: string;
|
|
14
|
+
};
|
|
15
|
+
export type Assessment = {
|
|
16
|
+
readonly file: string;
|
|
17
|
+
readonly type: string | undefined;
|
|
18
|
+
readonly targets: readonly string[];
|
|
19
|
+
readonly read: Validation | null;
|
|
20
|
+
readonly structured: Validation | null;
|
|
21
|
+
readonly fields: readonly Placed[];
|
|
22
|
+
readonly linked: boolean;
|
|
23
|
+
readonly sections: readonly Placed[];
|
|
24
|
+
};
|
|
25
|
+
export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
|
|
26
|
+
export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
|
|
27
|
+
export type Verdicts = {
|
|
28
|
+
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
29
|
+
verdict(): Validation;
|
|
30
|
+
};
|
|
31
|
+
export declare function verdicts(): Verdicts;
|
|
32
|
+
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
33
|
+
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
34
|
+
export {};
|
|
3
35
|
//# sourceMappingURL=validate.d.ts.map
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AAgBzB,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EAEb,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AA+EpB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,GAChC,YAAY,CAOd;AA8BD,wBAAgB,QAAQ,CACtB,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,CAA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