@agentshouse/mdmodel 0.1.0-c3c0e116a89f8 → 0.1.0-c3ebba90039b4
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 +200 -196
- package/README.md +25 -25
- package/dist/body.d.ts +85 -0
- package/dist/body.d.ts.map +1 -0
- package/dist/body.js +1083 -0
- package/dist/built-in.d.ts +4 -0
- package/dist/built-in.d.ts.map +1 -0
- package/dist/built-in.js +28 -0
- package/dist/definition.d.ts +28 -11
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +250 -126
- package/dist/document.d.ts +12 -6
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +705 -105
- package/dist/event.d.ts +1 -2
- package/dist/event.d.ts.map +1 -1
- package/dist/event.js +4 -4
- package/dist/facts.d.ts.map +1 -1
- package/dist/facts.js +7 -4
- package/dist/fields.d.ts +1 -1
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +2 -2
- package/dist/folders.d.ts +5 -0
- package/dist/folders.d.ts.map +1 -0
- package/dist/folders.js +19 -0
- 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 +30 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -10
- package/dist/indexed.d.ts +10 -0
- package/dist/indexed.d.ts.map +1 -0
- package/dist/indexed.js +63 -0
- package/dist/kinds.d.ts +9 -1
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +68 -0
- package/dist/markdown.d.ts +27 -7
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +25 -64
- 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 +102 -21
- package/dist/query/language.d.ts +4 -1
- package/dist/query/language.d.ts.map +1 -1
- package/dist/query/language.js +4 -3
- package/dist/query/match.d.ts +1 -1
- package/dist/query/match.d.ts.map +1 -1
- package/dist/query/match.js +3 -24
- package/dist/query/rows.d.ts +6 -1
- package/dist/query/rows.d.ts.map +1 -1
- package/dist/query/rows.js +37 -8
- package/dist/query/sql.d.ts +10 -1
- package/dist/query/sql.d.ts.map +1 -1
- package/dist/query/sql.js +22 -3
- package/dist/query/walk.d.ts +73 -0
- package/dist/query/walk.d.ts.map +1 -0
- package/dist/query/walk.js +277 -0
- package/dist/references.d.ts +2 -2
- package/dist/references.d.ts.map +1 -1
- package/dist/references.js +1 -1
- package/dist/refuse.d.ts +1 -0
- package/dist/refuse.d.ts.map +1 -1
- package/dist/refuse.js +1 -0
- package/dist/reserved.d.ts +1 -0
- package/dist/reserved.d.ts.map +1 -1
- package/dist/reserved.js +15 -4
- 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 +21 -38
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +8 -2
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +174 -174
- 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 +154 -33
- package/fixtures/README.md +93 -71
- 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/absent-optional-field/{schema.yaml → 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/boolean-field/{schema.yaml → 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/date-time-format/{schema.yaml → 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/folder-keeps-a-built-in-type/expected.json +1 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/door.md +3 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/host.md +13 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/map.md +24 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/open.md +13 -0
- package/fixtures/cases/folder-keeps-a-built-in-type/schema.md +9 -0
- package/fixtures/cases/folder-names-no-type-of-the-schema/expected.json +5 -0
- package/fixtures/cases/folder-names-no-type-of-the-schema/schema.md +7 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/expected.json +6 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/library/tickets/archive/2025/old.md +1 -0
- package/fixtures/cases/folder-nearer-entry-types-a-document/schema.md +15 -0
- package/fixtures/cases/folder-refuses-a-declared-any/expected.json +6 -0
- package/fixtures/cases/folder-refuses-a-declared-any/library/tickets/door.md +5 -0
- package/fixtures/cases/folder-refuses-a-declared-any/schema.md +9 -0
- package/fixtures/cases/folder-refuses-another-declared-type/expected.json +6 -0
- package/fixtures/cases/folder-refuses-another-declared-type/library/tickets/door.md +5 -0
- package/fixtures/cases/folder-refuses-another-declared-type/schema.md +12 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/expected.json +1 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/notes/plan.md +7 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/tickets/door.md +3 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/tickets/gate.md +7 -0
- package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/schema.md +13 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/expected.json +6 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/library/tickets/2026/gate.md +1 -0
- package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/schema.md +9 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/expected.json +7 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/library/tickets/door.md +3 -0
- package/fixtures/cases/folder-types-a-document-that-names-no-type/schema.md +9 -0
- package/fixtures/cases/folder-under-a-reserved-name/expected.json +5 -0
- package/fixtures/cases/folder-under-a-reserved-name/schema.md +7 -0
- package/fixtures/cases/folder-without-a-trailing-slash/context.json +1 -0
- package/fixtures/cases/folder-without-a-trailing-slash/expected.json +5 -0
- package/fixtures/cases/folder-without-a-trailing-slash/schema.md +7 -0
- package/fixtures/cases/frontmatter-construct/context.json +1 -0
- package/fixtures/cases/frontmatter-construct/expected.json +7 -0
- package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
- package/fixtures/cases/integer-field/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/context.json +1 -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/library/item.md +3 -1
- 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/context.json +1 -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/context.json +1 -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/context.json +1 -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/context.json +1 -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/context.json +1 -0
- package/fixtures/cases/list-reference-type/expected.json +7 -0
- package/fixtures/cases/list-reference-type/library/page.md +6 -0
- package/fixtures/cases/list-reference-type/schema.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/expected.json +2 -1
- package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
- package/fixtures/cases/reference-into-a-reserved-name/{schema.yaml → schema.md} +2 -0
- package/fixtures/cases/reference-to-any-file-name/context.json +1 -0
- package/fixtures/cases/reference-to-any-file-name/expected.json +1 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/100%.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/C#.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/My notes.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/[draft].md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/c (d).md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people/caf/303/251.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/people//320/236/321/202/321/207/321/221/321/202.md +4 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/bracket.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/cyrillic.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/decomposed.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/hash.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/parenthesis.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/percent.md +9 -0
- package/fixtures/cases/reference-to-any-file-name/library/tasks/spaced.md +9 -0
- package/fixtures/cases/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-its-type/schema.yaml → typed-path-names-another-type/schema.md} +2 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
- package/fixtures/cases/{typed-path-names-no-type/schema.yaml → typed-path-names-its-type/schema.md} +2 -0
- package/fixtures/cases/{typed-path-names-another-type/schema.yaml → typed-path-names-no-type/schema.md} +2 -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/library/rooms/team/tasks/plan.md +2 -1
- package/fixtures/cases/{unnamed-typed-path-without-a-body/schema.yaml → unnamed-typed-path-checks-its-fields/schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
- package/fixtures/cases/{unnamed-typed-path-checks-its-fields/schema.yaml → unnamed-typed-path-names-a-type/schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
- package/fixtures/cases/{unnamed-typed-path-names-a-type/schema.yaml → unnamed-typed-path-reads-its-type/schema.md} +2 -0
- package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
- package/fixtures/cases/{unnamed-typed-path-reads-its-type/schema.yaml → unnamed-typed-path-without-a-body/schema.md} +2 -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 +6 -6
- package/fixtures/queries.json +827 -2
- package/fixtures/references.json +15 -0
- package/package.json +2 -2
- package/dist/divide.d.ts +0 -3
- package/dist/divide.d.ts.map +0 -1
- package/dist/divide.js +0 -321
- package/dist/project.d.ts +0 -22
- package/dist/project.d.ts.map +0 -1
- package/dist/project.js +0 -123
- 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/lazy-list-item/schema.yaml +0 -3
- 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/thematic-break-in-a-list-section/expected.json +0 -6
- package/fixtures/cases/thematic-break-in-a-list-section/library/item.md +0 -7
- package/fixtures/cases/thematic-break-in-a-list-section/schema.yaml +0 -3
- 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 -454
- package/fixtures/projection.json +0 -358
- /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 → folder-keeps-a-built-in-type}/context.json +0 -0
- /package/fixtures/cases/{open-map-value → folder-names-no-type-of-the-schema}/context.json +0 -0
- /package/fixtures/cases/{section-item-enum → folder-nearer-entry-types-a-document}/context.json +0 -0
- /package/fixtures/cases/{section-item-kind → folder-refuses-a-declared-any}/context.json +0 -0
- /package/fixtures/cases/{section-items → folder-refuses-another-declared-type}/context.json +0 -0
- /package/fixtures/cases/{section-reference-path → folder-type-is-the-type-a-reference-reaches}/context.json +0 -0
- /package/fixtures/cases/{section-reference-type → folder-types-a-document-in-a-folder-below-it}/context.json +0 -0
- /package/fixtures/cases/{structured-section → folder-types-a-document-that-names-no-type}/context.json +0 -0
- /package/fixtures/cases/{thematic-break-in-a-list-section → folder-under-a-reserved-name}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
- /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[
|
|
2
|
+
{ "name": "a Room", "reference": "r_3k9.q", "pattern": "room" },
|
|
3
|
+
{ "name": "an App", "reference": "a_3k9.q", "pattern": "app" },
|
|
4
|
+
{ "name": "a Space", "reference": "sp_3k9.q", "pattern": "space" },
|
|
5
|
+
{ "name": "a document", "reference": "d_3k9.q", "pattern": "document" },
|
|
6
|
+
{ "name": "an attachment", "reference": "at_3k9.q", "pattern": "attachment" },
|
|
7
|
+
{ "name": "a revision", "reference": "v_3k9.2.q", "pattern": "revision" },
|
|
8
|
+
{ "name": "a document's ordinal never starts with zero", "reference": "d_03k9.q", "pattern": null },
|
|
9
|
+
{ "name": "a revision's number never starts with zero", "reference": "v_3k9.02.q", "pattern": null },
|
|
10
|
+
{ "name": "a reference is lower case", "reference": "D_3K9.Q", "pattern": null },
|
|
11
|
+
{ "name": "an entry reference carries no revision", "reference": "at_3k9.2.q", "pattern": null },
|
|
12
|
+
{ "name": "a revision carries its entry's ordinal", "reference": "v_2.q", "pattern": null },
|
|
13
|
+
{ "name": "an authored file's old form", "reference": "af_3k9.q", "pattern": null },
|
|
14
|
+
{ "name": "a file revision's old form", "reference": "fr_3k9.2.q", "pattern": null }
|
|
15
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentshouse/mdmodel",
|
|
3
|
-
"version": "0.1.0-c3c0e116a89f8",
|
|
4
3
|
"description": "MD Type language, parser, validator, structured change application, Markdown syntax profile, and conformance fixtures",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"type": "module",
|
|
@@ -43,5 +42,6 @@
|
|
|
43
42
|
"type": "git",
|
|
44
43
|
"url": "git+https://github.com/agentshouse/core.git",
|
|
45
44
|
"directory": "mdmodel/packages/mdmodel"
|
|
46
|
-
}
|
|
45
|
+
},
|
|
46
|
+
"version": "0.1.0-c3ebba90039b4"
|
|
47
47
|
}
|
package/dist/divide.d.ts
DELETED
package/dist/divide.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"divide.d.ts","sourceRoot":"","sources":["../src/divide.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AAwXpF,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,QAAQ,CAe3F"}
|
package/dist/divide.js
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
import { readingOf } from './document.js';
|
|
2
|
-
import { blockRanges, headingsIn } from './markdown.js';
|
|
3
|
-
import { firstEditFrom, projectionInput, rangeText, } from './project.js';
|
|
4
|
-
import { refusal } from './refuse.js';
|
|
5
|
-
const SMALLEST_BOUND = 2;
|
|
6
|
-
function node(draft) {
|
|
7
|
-
return {
|
|
8
|
-
start: draft.start,
|
|
9
|
-
end: draft.end,
|
|
10
|
-
bodyStart: draft.bodyStart,
|
|
11
|
-
heading: draft.heading,
|
|
12
|
-
children: draft.children.map(node),
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function forest(state, range) {
|
|
16
|
-
const headings = headingsIn(state.reading, range.start, range.end);
|
|
17
|
-
const roots = [];
|
|
18
|
-
const open = [];
|
|
19
|
-
const first = headings[0]?.start ?? range.end;
|
|
20
|
-
if (first > range.start) {
|
|
21
|
-
roots.push({
|
|
22
|
-
level: 0,
|
|
23
|
-
start: range.start,
|
|
24
|
-
end: first,
|
|
25
|
-
bodyStart: range.start,
|
|
26
|
-
heading: '',
|
|
27
|
-
children: [],
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
for (const heading of headings) {
|
|
31
|
-
while ((open[open.length - 1]?.level ?? 0) >= heading.level) {
|
|
32
|
-
open.pop().end = heading.start;
|
|
33
|
-
}
|
|
34
|
-
const draft = {
|
|
35
|
-
level: heading.level,
|
|
36
|
-
start: heading.start,
|
|
37
|
-
end: range.end,
|
|
38
|
-
bodyStart: heading.next,
|
|
39
|
-
heading: `${textOf(state, { start: heading.start, end: heading.textEnd })}\n\n`,
|
|
40
|
-
children: [],
|
|
41
|
-
};
|
|
42
|
-
(open[open.length - 1]?.children ?? roots).push(draft);
|
|
43
|
-
open.push(draft);
|
|
44
|
-
}
|
|
45
|
-
return roots.map(node);
|
|
46
|
-
}
|
|
47
|
-
function isSpace(character) {
|
|
48
|
-
return character === ' ' || character === '\t' || character === '\n' || character === '\r';
|
|
49
|
-
}
|
|
50
|
-
const TERMINATORS = new Set(['.', '!', '?', '…', '。', '!', '?']);
|
|
51
|
-
function isTerminator(character) {
|
|
52
|
-
return TERMINATORS.has(character);
|
|
53
|
-
}
|
|
54
|
-
const CLOSERS = new Set(['"', "'", ')', ']', '»', '”']);
|
|
55
|
-
function isCloser(character) {
|
|
56
|
-
return CLOSERS.has(character);
|
|
57
|
-
}
|
|
58
|
-
function sentenceBounds(text) {
|
|
59
|
-
const bounds = [0];
|
|
60
|
-
let i = 0;
|
|
61
|
-
while (i < text.length) {
|
|
62
|
-
if (!isTerminator(text[i])) {
|
|
63
|
-
i += 1;
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
let after = i + 1;
|
|
67
|
-
while (after < text.length && isCloser(text[after]))
|
|
68
|
-
after += 1;
|
|
69
|
-
if (after >= text.length || !isSpace(text[after])) {
|
|
70
|
-
i = after + 1;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
while (after < text.length && isSpace(text[after]))
|
|
74
|
-
after += 1;
|
|
75
|
-
if (after < text.length)
|
|
76
|
-
bounds.push(after);
|
|
77
|
-
i = after;
|
|
78
|
-
}
|
|
79
|
-
bounds.push(text.length);
|
|
80
|
-
return bounds;
|
|
81
|
-
}
|
|
82
|
-
function isTrailingSurrogate(text, index) {
|
|
83
|
-
const code = text.charCodeAt(index);
|
|
84
|
-
return code >= 0xdc00 && code <= 0xdfff;
|
|
85
|
-
}
|
|
86
|
-
function characterLength(text, index) {
|
|
87
|
-
return isTrailingSurrogate(text, index + 1) ? 2 : 1;
|
|
88
|
-
}
|
|
89
|
-
function boundOf(cutting, from, to, bound) {
|
|
90
|
-
const limit = from + bound;
|
|
91
|
-
if (limit >= to)
|
|
92
|
-
return to;
|
|
93
|
-
for (let index = limit; index > from + 1; index -= 1) {
|
|
94
|
-
if (isSpace(cutting.text[index]))
|
|
95
|
-
return index;
|
|
96
|
-
}
|
|
97
|
-
const inside = cutting.masks.find((mask) => limit > mask.start && limit < mask.end);
|
|
98
|
-
if (inside !== undefined)
|
|
99
|
-
return inside.start > from ? inside.start : Math.min(inside.end, to);
|
|
100
|
-
return isTrailingSurrogate(cutting.text, limit) ? limit - 1 : limit;
|
|
101
|
-
}
|
|
102
|
-
function utf8Size(code) {
|
|
103
|
-
if (code < 0x80)
|
|
104
|
-
return 1;
|
|
105
|
-
if (code < 0x800)
|
|
106
|
-
return 2;
|
|
107
|
-
if (code < 0x10000)
|
|
108
|
-
return 3;
|
|
109
|
-
return 4;
|
|
110
|
-
}
|
|
111
|
-
function byteBounds(content, spans) {
|
|
112
|
-
const marks = [...new Set(spans.flatMap((span) => [span.start, span.end]))].sort((left, right) => left - right);
|
|
113
|
-
const bytes = new Map();
|
|
114
|
-
let index = 0;
|
|
115
|
-
let count = 0;
|
|
116
|
-
for (const mark of marks) {
|
|
117
|
-
while (index < mark) {
|
|
118
|
-
const code = content.codePointAt(index);
|
|
119
|
-
count += utf8Size(code);
|
|
120
|
-
index += code > 0xffff ? 2 : 1;
|
|
121
|
-
}
|
|
122
|
-
bytes.set(mark, count);
|
|
123
|
-
}
|
|
124
|
-
return spans.map((span) => ({
|
|
125
|
-
...span,
|
|
126
|
-
start: bytes.get(span.start),
|
|
127
|
-
end: bytes.get(span.end),
|
|
128
|
-
}));
|
|
129
|
-
}
|
|
130
|
-
function textOf(state, extent) {
|
|
131
|
-
return rangeText(state.content, extent, state.edits);
|
|
132
|
-
}
|
|
133
|
-
function sourceCutting(state, extent) {
|
|
134
|
-
const source = state.content.slice(extent.start, extent.end);
|
|
135
|
-
const masks = [];
|
|
136
|
-
for (let index = firstEditFrom(state.edits, extent.start); index < state.edits.length; index += 1) {
|
|
137
|
-
const edit = state.edits[index];
|
|
138
|
-
if (edit.start > extent.end)
|
|
139
|
-
break;
|
|
140
|
-
if (edit.end > extent.end)
|
|
141
|
-
continue;
|
|
142
|
-
masks.push({ start: edit.start - extent.start, end: edit.end - extent.start });
|
|
143
|
-
}
|
|
144
|
-
let text = '';
|
|
145
|
-
let cursor = 0;
|
|
146
|
-
for (const mask of masks) {
|
|
147
|
-
if (mask.end <= cursor)
|
|
148
|
-
continue;
|
|
149
|
-
const from = Math.max(mask.start, cursor);
|
|
150
|
-
text += `${source.slice(cursor, from)}${'x'.repeat(mask.end - from)}`;
|
|
151
|
-
cursor = mask.end;
|
|
152
|
-
}
|
|
153
|
-
text += source.slice(cursor);
|
|
154
|
-
return {
|
|
155
|
-
text,
|
|
156
|
-
masks,
|
|
157
|
-
piece: (from, to) => {
|
|
158
|
-
const cut = { start: extent.start + from, end: extent.start + to };
|
|
159
|
-
return { ...cut, text: textOf(state, cut) };
|
|
160
|
-
},
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
function valueCutting(value) {
|
|
164
|
-
return {
|
|
165
|
-
text: value.text,
|
|
166
|
-
masks: [],
|
|
167
|
-
piece: (from, to) => ({ start: value.start, end: value.end, text: value.text.slice(from, to) }),
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function prefixOf(state, body) {
|
|
171
|
-
if (body.emitted === 0 || body.heading.length >= state.bound)
|
|
172
|
-
return '';
|
|
173
|
-
return body.heading;
|
|
174
|
-
}
|
|
175
|
-
function available(state, body) {
|
|
176
|
-
return state.bound - prefixOf(state, body).length;
|
|
177
|
-
}
|
|
178
|
-
function emit(state, body, piece, bare = false) {
|
|
179
|
-
if (piece.text.trim() === '')
|
|
180
|
-
return;
|
|
181
|
-
const text = (bare ? '' : prefixOf(state, body)) + piece.text;
|
|
182
|
-
state.spans.push({ start: piece.start, end: piece.end, text });
|
|
183
|
-
body.emitted += 1;
|
|
184
|
-
}
|
|
185
|
-
function merge(run) {
|
|
186
|
-
return {
|
|
187
|
-
start: Math.min(...run.map((unit) => unit.start)),
|
|
188
|
-
end: Math.max(...run.map((unit) => unit.end)),
|
|
189
|
-
text: run.map((unit) => unit.text).join(''),
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
function divideUnits(state, body, units) {
|
|
193
|
-
let run = [];
|
|
194
|
-
let length = 0;
|
|
195
|
-
const flush = () => {
|
|
196
|
-
if (run.length === 0)
|
|
197
|
-
return;
|
|
198
|
-
emit(state, body, merge(run));
|
|
199
|
-
run = [];
|
|
200
|
-
length = 0;
|
|
201
|
-
};
|
|
202
|
-
for (const unit of units) {
|
|
203
|
-
if (run.length > 0 && length + unit.text.length > available(state, body))
|
|
204
|
-
flush();
|
|
205
|
-
if (unit.text.length > available(state, body)) {
|
|
206
|
-
flush();
|
|
207
|
-
unit.descend();
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
run.push(unit);
|
|
211
|
-
length += unit.text.length;
|
|
212
|
-
}
|
|
213
|
-
flush();
|
|
214
|
-
}
|
|
215
|
-
function divideBound(state, body, cutting, range) {
|
|
216
|
-
let start = range.start;
|
|
217
|
-
while (start < range.end) {
|
|
218
|
-
const bare = available(state, body) < characterLength(cutting.text, start);
|
|
219
|
-
const room = bare ? state.bound : available(state, body);
|
|
220
|
-
const stop = boundOf(cutting, start, range.end, room);
|
|
221
|
-
const piece = cutting.piece(start, stop);
|
|
222
|
-
if (cutting.masks.length === 0 || piece.text.length <= room) {
|
|
223
|
-
emit(state, body, piece, bare);
|
|
224
|
-
}
|
|
225
|
-
else {
|
|
226
|
-
divideBound(state, body, valueCutting(piece), { start: 0, end: piece.text.length });
|
|
227
|
-
}
|
|
228
|
-
start = stop;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
function divideSentences(state, body, cutting) {
|
|
232
|
-
const cut = cutting.piece;
|
|
233
|
-
const bounds = sentenceBounds(cutting.text);
|
|
234
|
-
let index = 0;
|
|
235
|
-
while (index + 1 < bounds.length) {
|
|
236
|
-
const alone = { start: bounds[index], end: bounds[index + 1] };
|
|
237
|
-
if (cut(alone.start, alone.end).text.length > available(state, body)) {
|
|
238
|
-
divideBound(state, body, cutting, alone);
|
|
239
|
-
index += 1;
|
|
240
|
-
continue;
|
|
241
|
-
}
|
|
242
|
-
const carried = bounds[Math.max(index - 1, 0)];
|
|
243
|
-
const from = cut(carried, alone.end).text.length <= available(state, body) ? carried : alone.start;
|
|
244
|
-
let last = index;
|
|
245
|
-
while (last + 2 < bounds.length &&
|
|
246
|
-
cut(from, bounds[last + 2]).text.length <= available(state, body)) {
|
|
247
|
-
last += 1;
|
|
248
|
-
}
|
|
249
|
-
emit(state, body, cut(from, bounds[last + 1]));
|
|
250
|
-
index = last + 1;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function blockUnit(state, body, block) {
|
|
254
|
-
return {
|
|
255
|
-
start: block.start,
|
|
256
|
-
end: block.end,
|
|
257
|
-
text: textOf(state, block),
|
|
258
|
-
descend: () => divideSentences(state, body, sourceCutting(state, block)),
|
|
259
|
-
};
|
|
260
|
-
}
|
|
261
|
-
function valueUnit(state, body, value) {
|
|
262
|
-
return {
|
|
263
|
-
start: value.start,
|
|
264
|
-
end: value.end,
|
|
265
|
-
text: value.text,
|
|
266
|
-
descend: () => divideSentences(state, body, valueCutting(value)),
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
function nodeUnit(state, subject) {
|
|
270
|
-
return {
|
|
271
|
-
start: subject.start,
|
|
272
|
-
end: subject.end,
|
|
273
|
-
text: textOf(state, subject),
|
|
274
|
-
descend: () => divideNode(state, subject),
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
function ownBlocks(subject, end, blocks) {
|
|
278
|
-
const first = blocks[0];
|
|
279
|
-
return first === undefined
|
|
280
|
-
? [{ start: subject.start, end }]
|
|
281
|
-
: [{ start: subject.start, end: first.end }, ...blocks.slice(1)];
|
|
282
|
-
}
|
|
283
|
-
function divideNode(state, subject) {
|
|
284
|
-
const end = subject.children[0]?.start ?? subject.end;
|
|
285
|
-
const blocks = blockRanges(state.reading, subject.bodyStart, end);
|
|
286
|
-
const children = { heading: '', emitted: 0 };
|
|
287
|
-
if (blocks.length === 0 && subject.children.length > 0) {
|
|
288
|
-
const [first, ...rest] = subject.children;
|
|
289
|
-
const led = [{ ...first, start: subject.start }, ...rest];
|
|
290
|
-
divideUnits(state, children, led.map((child) => nodeUnit(state, child)));
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
const body = { heading: subject.heading, emitted: 0 };
|
|
294
|
-
const own = ownBlocks(subject, end, blocks);
|
|
295
|
-
divideUnits(state, body, own.map((block) => blockUnit(state, body, block)));
|
|
296
|
-
divideUnits(state, children, subject.children.map((child) => nodeUnit(state, child)));
|
|
297
|
-
}
|
|
298
|
-
function divideInput(state, input) {
|
|
299
|
-
const body = { heading: '', emitted: 0 };
|
|
300
|
-
divideUnits(state, body, [
|
|
301
|
-
...input.values.map((value) => valueUnit(state, body, value)),
|
|
302
|
-
...input.ranges.flatMap((range) => forest(state, range).map((subject) => nodeUnit(state, subject))),
|
|
303
|
-
]);
|
|
304
|
-
}
|
|
305
|
-
export function divide(document, file, context) {
|
|
306
|
-
if (!Number.isInteger(context.bound) || context.bound < SMALLEST_BOUND) {
|
|
307
|
-
return { ok: false, refusal: refusal(file, 'division-bound') };
|
|
308
|
-
}
|
|
309
|
-
const result = projectionInput(document, file, context);
|
|
310
|
-
if (!result.ok)
|
|
311
|
-
return { ok: false, refusal: result.refusal };
|
|
312
|
-
const state = {
|
|
313
|
-
content: document.content,
|
|
314
|
-
reading: readingOf(document),
|
|
315
|
-
edits: result.input.edits,
|
|
316
|
-
bound: context.bound,
|
|
317
|
-
spans: [],
|
|
318
|
-
};
|
|
319
|
-
divideInput(state, result.input);
|
|
320
|
-
return { ok: true, spans: byteBounds(document.content, state.spans) };
|
|
321
|
-
}
|
package/dist/project.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Document, Extent, Projection, ProjectionContext, Refusal } from './types.js';
|
|
2
|
-
export type Piece = Extent & {
|
|
3
|
-
readonly text: string;
|
|
4
|
-
};
|
|
5
|
-
export type Edit = Piece;
|
|
6
|
-
export type Input = {
|
|
7
|
-
readonly values: readonly Piece[];
|
|
8
|
-
readonly ranges: readonly Extent[];
|
|
9
|
-
readonly edits: readonly Edit[];
|
|
10
|
-
};
|
|
11
|
-
export type InputResult = {
|
|
12
|
-
readonly ok: true;
|
|
13
|
-
readonly input: Input;
|
|
14
|
-
} | {
|
|
15
|
-
readonly ok: false;
|
|
16
|
-
readonly refusal: Refusal;
|
|
17
|
-
};
|
|
18
|
-
export declare function firstEditFrom(edits: readonly Edit[], start: number): number;
|
|
19
|
-
export declare function rangeText(content: string, range: Extent, edits: readonly Edit[]): string;
|
|
20
|
-
export declare function projectionInput(document: Document, file: string, context: ProjectionContext): InputResult;
|
|
21
|
-
export declare function project(document: Document, file: string, context?: ProjectionContext): Projection;
|
|
22
|
-
//# sourceMappingURL=project.d.ts.map
|
package/dist/project.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3F,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC;AAEzB,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAqCtD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS3E;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAWxF;AA4BD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,GACzB,WAAW,CA0Bb;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAA2C,GACnD,UAAU,CAMZ"}
|
package/dist/project.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { memberFacts } from './definition.js';
|
|
2
|
-
import { frontmatter, readingOf } from './document.js';
|
|
3
|
-
import { sectionSpans } from './markdown.js';
|
|
4
|
-
import { classifyHref } from './paths.js';
|
|
5
|
-
import { refusal } from './refuse.js';
|
|
6
|
-
import { bodyStartOf } from './yaml.js';
|
|
7
|
-
function internalEdits(content, reading, file, documentTargets) {
|
|
8
|
-
const internal = new Set();
|
|
9
|
-
const uses = reading.uses
|
|
10
|
-
.filter((use) => {
|
|
11
|
-
const resolved = classifyHref(file, use.destination.href);
|
|
12
|
-
return (resolved.kind === 'room' || (resolved.kind === 'path' && documentTargets.has(resolved.path)));
|
|
13
|
-
})
|
|
14
|
-
.sort((left, right) => left.start - right.start);
|
|
15
|
-
const edits = [];
|
|
16
|
-
for (let index = uses.length - 1; index >= 0; index -= 1) {
|
|
17
|
-
const use = uses[index];
|
|
18
|
-
internal.add(use.destination.start);
|
|
19
|
-
const label = { start: use.labelStart, end: use.labelEnd };
|
|
20
|
-
const inner = [];
|
|
21
|
-
for (let nested = index + 1; nested < uses.length; nested += 1) {
|
|
22
|
-
const edit = edits[uses.length - 1 - nested];
|
|
23
|
-
if (edit.start >= label.end)
|
|
24
|
-
break;
|
|
25
|
-
if (edit.end <= label.end)
|
|
26
|
-
inner.push(edit);
|
|
27
|
-
}
|
|
28
|
-
edits.push({ start: use.start, end: use.end, text: rangeText(content, label, inner) });
|
|
29
|
-
}
|
|
30
|
-
for (const block of reading.definitions) {
|
|
31
|
-
if (!internal.has(block.destination.start))
|
|
32
|
-
continue;
|
|
33
|
-
edits.push({ start: block.start, end: block.end, text: '' });
|
|
34
|
-
}
|
|
35
|
-
return edits.sort((left, right) => left.start - right.start);
|
|
36
|
-
}
|
|
37
|
-
export function firstEditFrom(edits, start) {
|
|
38
|
-
let low = 0;
|
|
39
|
-
let high = edits.length;
|
|
40
|
-
while (low < high) {
|
|
41
|
-
const middle = (low + high) >>> 1;
|
|
42
|
-
if (edits[middle].start < start)
|
|
43
|
-
low = middle + 1;
|
|
44
|
-
else
|
|
45
|
-
high = middle;
|
|
46
|
-
}
|
|
47
|
-
return low;
|
|
48
|
-
}
|
|
49
|
-
export function rangeText(content, range, edits) {
|
|
50
|
-
let text = '';
|
|
51
|
-
let cursor = range.start;
|
|
52
|
-
for (let index = firstEditFrom(edits, range.start); index < edits.length; index += 1) {
|
|
53
|
-
const edit = edits[index];
|
|
54
|
-
if (edit.start > range.end)
|
|
55
|
-
break;
|
|
56
|
-
if (edit.start < cursor || edit.end > range.end)
|
|
57
|
-
continue;
|
|
58
|
-
text += content.slice(cursor, edit.start) + edit.text;
|
|
59
|
-
cursor = edit.end;
|
|
60
|
-
}
|
|
61
|
-
return text + content.slice(cursor, range.end);
|
|
62
|
-
}
|
|
63
|
-
function structural(spec) {
|
|
64
|
-
return spec.kind === 'list' && !spec.items.prose;
|
|
65
|
-
}
|
|
66
|
-
function proseValues(node, facts, values) {
|
|
67
|
-
if (facts === undefined)
|
|
68
|
-
return;
|
|
69
|
-
if (node.kind === 'scalar') {
|
|
70
|
-
if (facts.prose && typeof node.value === 'string')
|
|
71
|
-
values.push({ start: node.start, end: node.end, text: `${node.value}\n\n` });
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
if (node.kind === 'seq') {
|
|
75
|
-
for (const item of node.items)
|
|
76
|
-
proseValues(item, facts.items, values);
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
for (const entry of node.entries)
|
|
80
|
-
proseValues(entry.value, memberFacts(facts, entry.key), values);
|
|
81
|
-
}
|
|
82
|
-
function freeTextValues(definition, document) {
|
|
83
|
-
const root = frontmatter(document);
|
|
84
|
-
if (root === null)
|
|
85
|
-
return [];
|
|
86
|
-
const values = [];
|
|
87
|
-
proseValues(root, definition.frontmatter, values);
|
|
88
|
-
return values;
|
|
89
|
-
}
|
|
90
|
-
export function projectionInput(document, file, context) {
|
|
91
|
-
const content = document.content;
|
|
92
|
-
const bodyStart = bodyStartOf(content);
|
|
93
|
-
const reading = readingOf(document);
|
|
94
|
-
const edits = internalEdits(content, reading, file, new Set(context.documentTargets));
|
|
95
|
-
const declared = document.type;
|
|
96
|
-
if (declared === undefined || declared === 'any') {
|
|
97
|
-
return {
|
|
98
|
-
ok: true,
|
|
99
|
-
input: { values: [], ranges: [{ start: bodyStart, end: content.length }], edits },
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
const definition = context.definition;
|
|
103
|
-
if (definition === undefined) {
|
|
104
|
-
return { ok: false, refusal: refusal(file, 'unknown-type') };
|
|
105
|
-
}
|
|
106
|
-
const structure = new Set(Object.entries(definition.sections).flatMap(([name, spec]) => (structural(spec) ? [name] : [])));
|
|
107
|
-
const headings = sectionSpans(reading, content.length);
|
|
108
|
-
const ranges = [{ start: bodyStart, end: headings[0]?.headingStart ?? content.length }];
|
|
109
|
-
for (const heading of headings) {
|
|
110
|
-
if (structure.has(heading.name))
|
|
111
|
-
continue;
|
|
112
|
-
ranges.push({ start: heading.headingStart, end: heading.bodyEnd });
|
|
113
|
-
}
|
|
114
|
-
return { ok: true, input: { values: freeTextValues(definition, document), ranges, edits } };
|
|
115
|
-
}
|
|
116
|
-
export function project(document, file, context = { documentTargets: [] }) {
|
|
117
|
-
const result = projectionInput(document, file, context);
|
|
118
|
-
if (!result.ok)
|
|
119
|
-
return { ok: false, refusal: result.refusal };
|
|
120
|
-
const { values, ranges, edits } = result.input;
|
|
121
|
-
const prose = ranges.map((range) => rangeText(document.content, range, edits)).join('');
|
|
122
|
-
return { ok: true, text: values.map((value) => value.text).join('') + prose };
|
|
123
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
question:
|
|
2
|
-
properties:
|
|
3
|
-
title: { type: string }
|
|
4
|
-
status: { enum: [open, answered, withdrawn] }
|
|
5
|
-
required: [title, status]
|
|
6
|
-
sections:
|
|
7
|
-
Question: { kind: text, required: true }
|
|
8
|
-
Answer: { kind: text }
|
|
9
|
-
if:
|
|
10
|
-
properties:
|
|
11
|
-
status: { enum: [answered, withdrawn] }
|
|
12
|
-
then:
|
|
13
|
-
sections:
|
|
14
|
-
Answer: { kind: text, required: true }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
note: {}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
$defs:
|
|
2
|
-
address:
|
|
3
|
-
type: object
|
|
4
|
-
properties:
|
|
5
|
-
city: { type: string }
|
|
6
|
-
country: { type: string, pattern: '^[A-Z]{2}$' }
|
|
7
|
-
required: [city]
|
|
8
|
-
company:
|
|
9
|
-
properties:
|
|
10
|
-
name: { type: string }
|
|
11
|
-
deal:
|
|
12
|
-
type: object
|
|
13
|
-
properties:
|
|
14
|
-
title: { type: string, minLength: 1, maxLength: 40 }
|
|
15
|
-
company: { type: string, reference: company }
|
|
16
|
-
stage: { enum: [lead, proposal, won, lost], default: lead }
|
|
17
|
-
amount: { type: integer, minimum: 0 }
|
|
18
|
-
probability: { type: number, minimum: 0, maximum: 1 }
|
|
19
|
-
open: { type: boolean }
|
|
20
|
-
closes_at: { type: string, format: date-time }
|
|
21
|
-
contact_email: { type: string, format: email }
|
|
22
|
-
note: { type: [string, 'null'] }
|
|
23
|
-
shipping: { $ref: '#/$defs/address' }
|
|
24
|
-
tags: { type: array, items: { type: string }, maxItems: 3 }
|
|
25
|
-
lines:
|
|
26
|
-
type: array
|
|
27
|
-
items:
|
|
28
|
-
type: object
|
|
29
|
-
properties:
|
|
30
|
-
product: { type: string }
|
|
31
|
-
quantity: { type: integer, minimum: 1 }
|
|
32
|
-
required: [product, quantity]
|
|
33
|
-
blocks:
|
|
34
|
-
type: array
|
|
35
|
-
items:
|
|
36
|
-
oneOf:
|
|
37
|
-
- properties:
|
|
38
|
-
kind: { const: paragraph }
|
|
39
|
-
text: { type: string }
|
|
40
|
-
required: [kind, text]
|
|
41
|
-
- properties:
|
|
42
|
-
kind: { const: quiz }
|
|
43
|
-
question: { type: string }
|
|
44
|
-
required: [kind, question]
|
|
45
|
-
attributes:
|
|
46
|
-
type: object
|
|
47
|
-
additionalProperties: { type: string }
|
|
48
|
-
required: [title, company, stage]
|
|
49
|
-
if:
|
|
50
|
-
properties:
|
|
51
|
-
stage: { const: won }
|
|
52
|
-
required: [stage]
|
|
53
|
-
then:
|
|
54
|
-
required: [amount]
|
|
55
|
-
sections:
|
|
56
|
-
Description: { kind: text }
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
$defs:
|
|
2
|
-
address:
|
|
3
|
-
type: object
|
|
4
|
-
properties:
|
|
5
|
-
city: { type: string }
|
|
6
|
-
country: { type: string, pattern: '^[A-Z]{2}$' }
|
|
7
|
-
required: [city]
|
|
8
|
-
company:
|
|
9
|
-
properties:
|
|
10
|
-
name: { type: string }
|
|
11
|
-
deal:
|
|
12
|
-
type: object
|
|
13
|
-
properties:
|
|
14
|
-
title: { type: string, minLength: 1, maxLength: 40 }
|
|
15
|
-
company: { type: string, reference: company }
|
|
16
|
-
stage: { enum: [lead, proposal, won, lost], default: lead }
|
|
17
|
-
amount: { type: integer, minimum: 0 }
|
|
18
|
-
probability: { type: number, minimum: 0, maximum: 1 }
|
|
19
|
-
open: { type: boolean }
|
|
20
|
-
closes_at: { type: string, format: date-time }
|
|
21
|
-
contact_email: { type: string, format: email }
|
|
22
|
-
note: { type: [string, 'null'] }
|
|
23
|
-
shipping: { $ref: '#/$defs/address' }
|
|
24
|
-
tags: { type: array, items: { type: string }, maxItems: 3 }
|
|
25
|
-
lines:
|
|
26
|
-
type: array
|
|
27
|
-
items:
|
|
28
|
-
type: object
|
|
29
|
-
properties:
|
|
30
|
-
product: { type: string }
|
|
31
|
-
quantity: { type: integer, minimum: 1 }
|
|
32
|
-
required: [product, quantity]
|
|
33
|
-
blocks:
|
|
34
|
-
type: array
|
|
35
|
-
items:
|
|
36
|
-
oneOf:
|
|
37
|
-
- properties:
|
|
38
|
-
kind: { const: paragraph }
|
|
39
|
-
text: { type: string }
|
|
40
|
-
required: [kind, text]
|
|
41
|
-
- properties:
|
|
42
|
-
kind: { const: quiz }
|
|
43
|
-
question: { type: string }
|
|
44
|
-
required: [kind, question]
|
|
45
|
-
attributes:
|
|
46
|
-
type: object
|
|
47
|
-
additionalProperties: { type: string }
|
|
48
|
-
required: [title, company, stage]
|
|
49
|
-
if:
|
|
50
|
-
properties:
|
|
51
|
-
stage: { const: won }
|
|
52
|
-
required: [stage]
|
|
53
|
-
then:
|
|
54
|
-
required: [amount]
|
|
55
|
-
sections:
|
|
56
|
-
Description: { kind: text }
|