@agentshouse/mdmodel 0.1.0-caefdbe3e3d42 → 0.1.0-caf6545f57b5d
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 +160 -158
- package/README.md +14 -15
- package/dist/body.d.ts +85 -0
- package/dist/body.d.ts.map +1 -0
- package/dist/body.js +1083 -0
- package/dist/definition.d.ts +20 -10
- package/dist/definition.d.ts.map +1 -1
- package/dist/definition.js +174 -123
- package/dist/divide.d.ts.map +1 -1
- package/dist/divide.js +5 -4
- package/dist/document.d.ts +14 -7
- package/dist/document.d.ts.map +1 -1
- package/dist/document.js +720 -110
- package/dist/event.d.ts +77 -0
- package/dist/event.d.ts.map +1 -0
- package/dist/event.js +200 -0
- package/dist/facts.d.ts +15 -0
- package/dist/facts.d.ts.map +1 -0
- package/dist/facts.js +41 -0
- package/dist/fields.d.ts +1 -1
- package/dist/fields.d.ts.map +1 -1
- package/dist/fields.js +1 -1
- package/dist/form.d.ts +4 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +152 -0
- package/dist/index.d.ts +21 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/kinds.d.ts +2 -2
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +20 -11
- package/dist/markdown.d.ts +75 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +265 -0
- package/dist/paths.d.ts +10 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +74 -19
- package/dist/pattern.d.ts.map +1 -1
- package/dist/pattern.js +4 -3
- package/dist/project.d.ts.map +1 -1
- package/dist/project.js +33 -60
- package/dist/query/language.d.ts +43 -7
- package/dist/query/language.d.ts.map +1 -1
- package/dist/query/language.js +151 -57
- package/dist/query/match.d.ts +3 -1
- package/dist/query/match.d.ts.map +1 -1
- package/dist/query/match.js +40 -8
- package/dist/query/rows.d.ts +1 -1
- package/dist/query/rows.d.ts.map +1 -1
- package/dist/query/sql.d.ts.map +1 -1
- package/dist/query/sql.js +7 -1
- package/dist/refuse.d.ts +1 -0
- package/dist/refuse.d.ts.map +1 -1
- package/dist/refuse.js +1 -0
- package/dist/reserved.d.ts +1 -0
- package/dist/reserved.d.ts.map +1 -1
- package/dist/reserved.js +2 -1
- package/dist/schema.d.ts +0 -2
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +5 -68
- package/dist/types.d.ts +14 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/validate.d.ts +8 -5
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +141 -179
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +4 -11
- package/fixtures/README.md +40 -23
- package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
- package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
- package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
- package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
- package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
- package/fixtures/cases/absolute-link/library/item.md +1 -1
- package/fixtures/cases/absolute-link/schema.yaml +2 -3
- package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
- package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
- package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
- package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
- package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
- package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
- package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
- package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
- package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
- package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
- package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
- package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
- package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
- package/fixtures/cases/binary-any-reference/expected.json +2 -1
- package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
- package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
- package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
- package/fixtures/cases/binary-typed-reference/expected.json +2 -1
- package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
- package/fixtures/cases/boolean-field/expected.json +2 -1
- package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
- package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
- package/fixtures/cases/boolean-field/schema.yaml +10 -11
- package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
- package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
- package/fixtures/cases/closed-nested-object/expected.json +2 -1
- package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
- package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
- package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
- package/fixtures/cases/composed-root-reference/library/a.md +2 -2
- package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
- package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
- package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
- package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
- package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
- package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
- package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
- package/fixtures/cases/date-time-format/expected.json +2 -1
- package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
- package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
- package/fixtures/cases/date-time-format/schema.yaml +10 -11
- package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
- package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
- package/fixtures/cases/default-unfilled/schema.yaml +10 -11
- package/fixtures/cases/defs-pattern/expected.json +2 -1
- package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
- package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
- package/fixtures/cases/defs-pattern/schema.yaml +10 -11
- package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
- package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
- package/fixtures/cases/dependent-rule/schema.yaml +10 -11
- package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
- package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
- package/fixtures/cases/email-format/expected.json +2 -1
- package/fixtures/cases/email-format/library/companies/acme.md +1 -1
- package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
- package/fixtures/cases/email-format/schema.yaml +10 -11
- package/fixtures/cases/equal-labels/expected.json +5 -0
- package/fixtures/cases/equal-labels/schema.yaml +4 -0
- package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
- package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
- package/fixtures/cases/field-enum/expected.json +2 -1
- package/fixtures/cases/field-enum/library/item.md +2 -2
- package/fixtures/cases/field-enum/schema.yaml +3 -4
- package/fixtures/cases/integer-field/expected.json +2 -1
- package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
- package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
- package/fixtures/cases/integer-field/schema.yaml +10 -11
- package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
- package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
- package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
- package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
- package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
- package/fixtures/cases/lazy-list-item/expected.json +3 -0
- package/fixtures/cases/lazy-list-item/library/item.md +10 -0
- package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
- package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
- package/fixtures/cases/list-item-enum/expected.json +7 -0
- package/fixtures/cases/list-item-enum/library/task.md +7 -0
- package/fixtures/cases/list-item-enum/schema.yaml +3 -0
- package/fixtures/cases/list-item-kind/expected.json +7 -0
- package/fixtures/cases/list-item-kind/library/task.md +6 -0
- package/fixtures/cases/list-item-kind/schema.yaml +3 -0
- package/fixtures/cases/list-items/expected.json +1 -0
- package/fixtures/cases/list-items/library/page.md +26 -0
- package/fixtures/cases/list-items/schema.yaml +10 -0
- package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
- package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
- package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
- package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
- package/fixtures/cases/list-of-objects-item/expected.json +2 -1
- package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
- package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
- package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
- package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
- package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
- package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
- package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
- package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
- package/fixtures/cases/list-reference-path/expected.json +7 -0
- package/fixtures/cases/list-reference-path/library/page.md +5 -0
- package/fixtures/cases/list-reference-path/schema.yaml +3 -0
- package/fixtures/cases/list-reference-type/expected.json +7 -0
- package/fixtures/cases/list-reference-type/library/page.md +6 -0
- package/fixtures/cases/list-reference-type/schema.yaml +3 -0
- package/fixtures/cases/list-size/expected.json +2 -1
- package/fixtures/cases/list-size/library/companies/acme.md +1 -1
- package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
- package/fixtures/cases/list-size/schema.yaml +10 -11
- package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
- package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
- package/fixtures/cases/malformed-list/context.json +1 -0
- package/fixtures/cases/malformed-list/expected.json +7 -0
- package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
- package/fixtures/cases/malformed-list/schema.yaml +6 -0
- package/fixtures/cases/member-document/library/people/ana.md +2 -2
- package/fixtures/cases/member-on-another-type/library/note.md +1 -1
- package/fixtures/cases/missing-required-field/library/item.md +1 -1
- package/fixtures/cases/missing-required-field/schema.yaml +3 -4
- package/fixtures/cases/misspelled-key/expected.json +2 -1
- package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
- package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
- package/fixtures/cases/misspelled-key/schema.yaml +10 -11
- package/fixtures/cases/name-not-a-string/context.json +1 -0
- package/fixtures/cases/name-not-a-string/expected.json +5 -0
- package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
- package/fixtures/cases/nested-defs/expected.json +2 -1
- package/fixtures/cases/nested-defs/library/deal.md +3 -3
- package/fixtures/cases/nested-object-reference/expected.json +2 -1
- package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
- package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
- package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
- package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
- package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
- package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
- package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
- package/fixtures/cases/nested-reference/library/products/support.md +1 -1
- package/fixtures/cases/nested-required-field/expected.json +2 -1
- package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
- package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
- package/fixtures/cases/nested-required-field/schema.yaml +10 -11
- package/fixtures/cases/numeric-range/expected.json +2 -1
- package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
- package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
- package/fixtures/cases/numeric-range/schema.yaml +10 -11
- package/fixtures/cases/one-key-two-labels/context.json +1 -0
- package/fixtures/cases/one-key-two-labels/expected.json +5 -0
- package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
- package/fixtures/cases/one-key-two-types/context.json +1 -0
- package/fixtures/cases/one-key-two-types/expected.json +5 -0
- package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
- package/fixtures/cases/one-of-variant/expected.json +2 -1
- package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
- package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
- package/fixtures/cases/one-of-variant/schema.yaml +10 -11
- package/fixtures/cases/other-room-reference/expected.json +2 -1
- package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
- package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
- package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
- package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
- package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
- package/fixtures/cases/prototype-field/expected.json +2 -1
- package/fixtures/cases/prototype-field/library/item.md +2 -2
- package/fixtures/cases/prototype-field/schema.yaml +2 -3
- package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
- package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
- package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
- package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
- package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
- package/fixtures/cases/sections-keyword-refused/context.json +1 -0
- package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
- package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
- package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
- package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
- package/fixtures/cases/string-length/expected.json +2 -1
- package/fixtures/cases/string-length/library/companies/acme.md +1 -1
- package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
- package/fixtures/cases/string-length/schema.yaml +10 -11
- package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
- package/fixtures/cases/text-field-kind/expected.json +1 -4
- package/fixtures/cases/text-field-kind/library/page.md +1 -1
- package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
- package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
- package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
- package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
- package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
- package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
- package/fixtures/cases/undeclared-field/expected.json +2 -1
- package/fixtures/cases/undeclared-field/library/item.md +2 -2
- package/fixtures/cases/undeclared-field/schema.yaml +2 -3
- package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
- package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
- package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
- package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
- package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
- package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
- package/fixtures/cases/unresolved-link/library/item.md +1 -1
- package/fixtures/cases/unresolved-link/schema.yaml +2 -3
- package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
- package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
- package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
- package/fixtures/division.json +86 -41
- package/fixtures/forms.json +347 -0
- package/fixtures/preamble.json +26 -5
- package/fixtures/projection.json +121 -18
- package/fixtures/queries.json +51 -0
- package/package.json +10 -1
- package/dist/blocks.d.ts +0 -11
- package/dist/blocks.d.ts.map +0 -1
- package/dist/blocks.js +0 -91
- package/dist/condition.d.ts +0 -179
- package/dist/condition.d.ts.map +0 -1
- package/dist/condition.js +0 -598
- package/dist/links.d.ts +0 -29
- package/dist/links.d.ts.map +0 -1
- package/dist/links.js +0 -831
- package/dist/profile.d.ts +0 -6
- package/dist/profile.d.ts.map +0 -1
- package/dist/profile.js +0 -5
- package/dist/sections.d.ts +0 -11
- package/dist/sections.d.ts.map +0 -1
- package/dist/sections.js +0 -57
- package/fixtures/cases/conditional-section/schema.yaml +0 -14
- package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
- package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
- package/fixtures/cases/null-refused/expected.json +0 -6
- package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
- package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
- package/fixtures/cases/null-refused/schema.yaml +0 -56
- package/fixtures/cases/open-map-value/expected.json +0 -6
- package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
- package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
- package/fixtures/cases/open-map-value/schema.yaml +0 -56
- package/fixtures/cases/section-item-enum/expected.json +0 -6
- package/fixtures/cases/section-item-enum/library/task.md +0 -8
- package/fixtures/cases/section-item-enum/schema.yaml +0 -3
- package/fixtures/cases/section-item-kind/expected.json +0 -6
- package/fixtures/cases/section-item-kind/library/task.md +0 -8
- package/fixtures/cases/section-item-kind/schema.yaml +0 -3
- package/fixtures/cases/section-items/library/page.md +0 -42
- package/fixtures/cases/section-items/schema.yaml +0 -10
- package/fixtures/cases/section-reference-path/expected.json +0 -6
- package/fixtures/cases/section-reference-path/library/page.md +0 -7
- package/fixtures/cases/section-reference-path/schema.yaml +0 -3
- package/fixtures/cases/section-reference-type/expected.json +0 -6
- package/fixtures/cases/section-reference-type/library/page.md +0 -7
- package/fixtures/cases/section-reference-type/schema.yaml +0 -3
- package/fixtures/cases/structured-section/expected.json +0 -6
- /package/fixtures/cases/{conditional-section → conditional-long-text}/context.json +0 -0
- /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
- /package/fixtures/cases/{null-refused → labels-in-the-rooms-language}/context.json +0 -0
- /package/fixtures/cases/{section-items → labels-in-the-rooms-language}/expected.json +0 -0
- /package/fixtures/cases/{open-map-value → lazy-list-item}/context.json +0 -0
- /package/fixtures/cases/{section-item-enum → list-item-enum}/context.json +0 -0
- /package/fixtures/cases/{section-item-kind → list-item-kind}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/context.json +0 -0
- /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
- /package/fixtures/cases/{section-reference-path → list-reference-path}/context.json +0 -0
- /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
- /package/fixtures/cases/{section-reference-type → list-reference-type}/context.json +0 -0
- /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
- /package/fixtures/cases/{structured-section → long-value-past-six-levels}/context.json +0 -0
package/dist/schema.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Validator } from '@cfworker/json-schema';
|
|
|
2
2
|
import { escapePointer, refTarget } from './definition.js';
|
|
3
3
|
import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
|
|
4
4
|
import { withLinearRegExp } from './pattern.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isRecord } from './yaml.js';
|
|
6
6
|
const STANDING_MAPS = ['properties', 'patternProperties'];
|
|
7
7
|
const STANDING = [
|
|
8
8
|
'additionalProperties',
|
|
@@ -96,50 +96,11 @@ function closed(node, inPlace, defs, always = false) {
|
|
|
96
96
|
function copied(value) {
|
|
97
97
|
return JSON.parse(JSON.stringify(value));
|
|
98
98
|
}
|
|
99
|
-
function asks(asked) {
|
|
100
|
-
return asked.sections.length > 0 || asked.conditions.length > 0;
|
|
101
|
-
}
|
|
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
99
|
function compile(definition) {
|
|
137
100
|
const defs = copied(definition.shape.defs);
|
|
138
|
-
const {
|
|
101
|
+
const { member_document: _mark, ...written } = copied(definition.shape.schema);
|
|
139
102
|
const closedDefs = mapped(defs, (held) => closed(held, true, defs));
|
|
140
|
-
const
|
|
141
|
-
const root = read.schema;
|
|
142
|
-
const declared = isRecord(root.properties) ? root.properties : {};
|
|
103
|
+
const declared = isRecord(written.properties) ? written.properties : {};
|
|
143
104
|
const properties = {
|
|
144
105
|
[TYPE_FIELD]: true,
|
|
145
106
|
[SITE_FIELD]: true,
|
|
@@ -147,14 +108,8 @@ function compile(definition) {
|
|
|
147
108
|
...(definition.memberDocument ? { [MEMBER_FIELD]: { type: 'string' } } : {}),
|
|
148
109
|
...declared,
|
|
149
110
|
};
|
|
150
|
-
const frontmatter = new Validator({ ...closed({ ...
|
|
151
|
-
|
|
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));
|
|
156
|
-
}
|
|
157
|
-
return { frontmatter, sections: lists, conditions: read.conditions };
|
|
111
|
+
const frontmatter = new Validator({ ...closed({ ...written, properties }, false, defs, true), $defs: closedDefs }, '2020-12', false);
|
|
112
|
+
return { frontmatter };
|
|
158
113
|
}
|
|
159
114
|
function compiledOf(definition) {
|
|
160
115
|
const held = compiled.get(definition);
|
|
@@ -194,21 +149,3 @@ export function frontmatterRefusal(definition, fields) {
|
|
|
194
149
|
const result = withLinearRegExp(() => frontmatter.validate(fields));
|
|
195
150
|
return result.valid ? undefined : refusalOf(result.errors);
|
|
196
151
|
}
|
|
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);
|
|
214
|
-
}
|
package/dist/types.d.ts
CHANGED
|
@@ -45,11 +45,16 @@ export type Frontmatter = {
|
|
|
45
45
|
export type Document = Frontmatter & {
|
|
46
46
|
readonly preamble: string;
|
|
47
47
|
readonly sections: Readonly<Record<string, string>>;
|
|
48
|
+
readonly text: string;
|
|
49
|
+
readonly ranges: Readonly<Record<string, Extent>>;
|
|
50
|
+
readonly listEnd: number;
|
|
48
51
|
};
|
|
52
|
+
export type DefinitionOf = (type: string | undefined) => Definition | undefined;
|
|
49
53
|
export type Refusal = {
|
|
50
54
|
readonly file: string;
|
|
51
55
|
readonly rule: string;
|
|
52
56
|
readonly location?: string;
|
|
57
|
+
readonly line?: number;
|
|
53
58
|
readonly referrers?: readonly string[];
|
|
54
59
|
};
|
|
55
60
|
export type Reached = {
|
|
@@ -123,12 +128,6 @@ export type RoomReference = {
|
|
|
123
128
|
readonly value: string;
|
|
124
129
|
readonly to: readonly string[];
|
|
125
130
|
readonly crossRoom?: true;
|
|
126
|
-
} | {
|
|
127
|
-
readonly kind: 'item';
|
|
128
|
-
readonly section: string;
|
|
129
|
-
readonly href: string;
|
|
130
|
-
readonly to: readonly string[];
|
|
131
|
-
readonly crossRoom?: true;
|
|
132
131
|
});
|
|
133
132
|
export type Change = {
|
|
134
133
|
readonly kind: 'field';
|
|
@@ -139,11 +138,15 @@ export type Change = {
|
|
|
139
138
|
readonly kind: 'section';
|
|
140
139
|
readonly name: string;
|
|
141
140
|
readonly value: string;
|
|
142
|
-
readonly prior: string;
|
|
141
|
+
readonly prior: string | undefined;
|
|
143
142
|
} | {
|
|
144
143
|
readonly kind: 'preamble';
|
|
145
144
|
readonly value: string;
|
|
146
145
|
readonly prior: string;
|
|
146
|
+
} | {
|
|
147
|
+
readonly kind: 'text';
|
|
148
|
+
readonly value: string;
|
|
149
|
+
readonly prior: string;
|
|
147
150
|
} | {
|
|
148
151
|
readonly kind: 'link';
|
|
149
152
|
readonly href: string;
|
|
@@ -172,4 +175,8 @@ export type BodyResult = {
|
|
|
172
175
|
readonly outcome: 'refuse';
|
|
173
176
|
readonly refusal: Refusal;
|
|
174
177
|
};
|
|
178
|
+
export type UnlinkedBody = {
|
|
179
|
+
readonly body: string;
|
|
180
|
+
readonly links: ReadonlyMap<string, string>;
|
|
181
|
+
};
|
|
175
182
|
//# 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,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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ACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEN,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,GAC5D;IACE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,GACD;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,UAAU,GAClB;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACtD;IAAE,QAAQ,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/validate.d.ts
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { type Definition } from './definition.js';
|
|
2
|
-
import type { DocumentCheck, Library, ModelVerification, Reached, RoomReference, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.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;
|
|
3
4
|
export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
|
|
4
5
|
export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
|
|
6
|
+
export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
|
|
5
7
|
type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
|
|
6
8
|
export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
|
|
7
|
-
export declare function sectionReferences(file: string, content: string, definition: Definition): readonly Reached[];
|
|
8
9
|
export declare function bodyRoomLinks(body: string): RoomReference[];
|
|
9
|
-
export declare function roomReferences(
|
|
10
|
+
export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
|
|
10
11
|
type Placed = {
|
|
11
12
|
readonly reference: Reached;
|
|
12
13
|
readonly location: string;
|
|
14
|
+
readonly line?: number;
|
|
13
15
|
};
|
|
14
16
|
export type Assessment = {
|
|
15
17
|
readonly file: string;
|
|
@@ -19,9 +21,9 @@ export type Assessment = {
|
|
|
19
21
|
readonly structured: Validation | null;
|
|
20
22
|
readonly fields: readonly Placed[];
|
|
21
23
|
readonly linked: boolean;
|
|
22
|
-
readonly sections: readonly Placed[];
|
|
23
24
|
};
|
|
24
|
-
export declare function assess(file: string,
|
|
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;
|
|
25
27
|
export type Verdicts = {
|
|
26
28
|
add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
|
|
27
29
|
verdict(): Validation;
|
|
@@ -29,5 +31,6 @@ export type Verdicts = {
|
|
|
29
31
|
export declare function verdicts(): Verdicts;
|
|
30
32
|
export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
|
|
31
33
|
export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
34
|
+
export declare function validateParsed(library: ReadonlyMap<string, ParseResult>, context?: ValidationContext, model?: VerifiedModel): Validation;
|
|
32
35
|
export {};
|
|
33
36
|
//# 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":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AA6FpB,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,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,OAAO,CAET;AAUD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,iBAAiB,CAKlF;AAED,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