@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/query/language.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { pointerFacts, } from '../definition.js';
|
|
2
|
-
import { fitsKind, kindOf } from '../kinds.js';
|
|
1
|
+
import { crossedFacts, escapePointer, pointerFacts, pointerSegments, } from '../definition.js';
|
|
2
|
+
import { fitsKind, kindOf, kindWords } from '../kinds.js';
|
|
3
3
|
import { normalize } from '../paths.js';
|
|
4
4
|
import { plain } from '../yaml.js';
|
|
5
5
|
export class QueryError extends Error {
|
|
6
6
|
code;
|
|
7
|
+
place;
|
|
8
|
+
accepts;
|
|
7
9
|
retryable = false;
|
|
8
|
-
constructor(code, at, problem) {
|
|
9
|
-
super(`${code} at ${at}: ${problem}`);
|
|
10
|
+
constructor(code, at, problem, accepts = []) {
|
|
11
|
+
super(`${code} at ${placeText(placed(at))}: ${problem}`);
|
|
10
12
|
this.code = code;
|
|
13
|
+
this.place = placed(at);
|
|
14
|
+
this.accepts = accepts;
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
17
|
const RANGE = ['$gt', '$gte', '$lt', '$lte'];
|
|
@@ -17,6 +21,7 @@ const FILTER = [
|
|
|
17
21
|
'types',
|
|
18
22
|
'where',
|
|
19
23
|
'pathPrefix',
|
|
24
|
+
'outside',
|
|
20
25
|
'folder',
|
|
21
26
|
'paths',
|
|
22
27
|
'fileIds',
|
|
@@ -34,22 +39,42 @@ const PARTS = [
|
|
|
34
39
|
'change',
|
|
35
40
|
'fileId',
|
|
36
41
|
'revision',
|
|
42
|
+
'size',
|
|
43
|
+
'created',
|
|
37
44
|
];
|
|
45
|
+
const GROUP_PARTS = ['size', 'updated', 'greatest'];
|
|
46
|
+
const DOCUMENT_KEYS = ['room', 'path', 'type', 'folder', 'size', 'created', 'updated'];
|
|
47
|
+
const GROUP_KEYS = ['room', 'type', 'folder', 'subfolder'];
|
|
48
|
+
const GROUP_ORDERS = ['count', 'size', 'updated', 'greatest'];
|
|
38
49
|
const ORDER = ['by', 'direction', 'nulls', 'stringSort', 'locale', 'localeOptions'];
|
|
39
50
|
const STRAY_ESCAPE = /~(?![01])/u;
|
|
40
51
|
export function bodied(shape) {
|
|
41
52
|
return shape.sections !== null || shape.preamble || shape.markdown;
|
|
42
53
|
}
|
|
43
|
-
export function invalid(at, problem) {
|
|
44
|
-
throw new QueryError('invalid-query', at, problem);
|
|
54
|
+
export function invalid(at, problem, accepts = []) {
|
|
55
|
+
throw new QueryError('invalid-query', at, problem, accepts);
|
|
45
56
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
57
|
+
function placed(at) {
|
|
58
|
+
if (typeof at !== 'string')
|
|
59
|
+
return at;
|
|
60
|
+
return at === '' ? [] : [at];
|
|
61
|
+
}
|
|
62
|
+
export function placeText(at) {
|
|
63
|
+
return at.reduce((text, step) => {
|
|
64
|
+
if (typeof step === 'number')
|
|
65
|
+
return `${text}[${step}]`;
|
|
66
|
+
if (step.startsWith('/') || text === '')
|
|
67
|
+
return `${text}${step}`;
|
|
68
|
+
return `${text}.${step}`;
|
|
69
|
+
}, '');
|
|
70
|
+
}
|
|
71
|
+
function place(at, step) {
|
|
72
|
+
return [...placed(at), step];
|
|
48
73
|
}
|
|
49
74
|
export function known(value, allowed, at) {
|
|
50
75
|
for (const name of Object.keys(value)) {
|
|
51
76
|
if (!allowed.includes(name))
|
|
52
|
-
invalid(place(at, name), 'unknown part');
|
|
77
|
+
invalid(place(at, name), 'unknown part', allowed);
|
|
53
78
|
}
|
|
54
79
|
}
|
|
55
80
|
function list(input, at) {
|
|
@@ -69,7 +94,7 @@ function value(input, at) {
|
|
|
69
94
|
return input;
|
|
70
95
|
}
|
|
71
96
|
function values(input, at) {
|
|
72
|
-
return list(input, at).map((item, index) => value(item,
|
|
97
|
+
return list(input, at).map((item, index) => value(item, place(at, index)));
|
|
73
98
|
}
|
|
74
99
|
function names(input, at) {
|
|
75
100
|
const listed = list(input, at);
|
|
@@ -128,7 +153,7 @@ function typing(facts, rooms, types, at) {
|
|
|
128
153
|
for (const name of types ?? []) {
|
|
129
154
|
if (name === 'any' || !available || declared.some((type) => type.name === name))
|
|
130
155
|
continue;
|
|
131
|
-
throw new QueryError('unknown-type', place(at, 'types'), `no model it reads declares ${name}
|
|
156
|
+
throw new QueryError('unknown-type', place(at, 'types'), `no model it reads declares ${name}`, [...new Set(declared.map((type) => type.name))].sort());
|
|
132
157
|
}
|
|
133
158
|
return {
|
|
134
159
|
untyped: types === null || types.includes('any') || !available,
|
|
@@ -148,7 +173,7 @@ function specs(typed, input, at) {
|
|
|
148
173
|
return spec === undefined ? [] : [spec];
|
|
149
174
|
});
|
|
150
175
|
if (declared.length === 0 && !typed.untyped) {
|
|
151
|
-
throw new QueryError('unknown-field', at, `no MD Type it reads declares ${field}
|
|
176
|
+
throw new QueryError('unknown-field', at, `no MD Type it reads declares ${field}`, nearby(typed.types, field));
|
|
152
177
|
}
|
|
153
178
|
if (!declared.some((spec) => spec.conditional))
|
|
154
179
|
return declared;
|
|
@@ -158,6 +183,24 @@ function specs(typed, input, at) {
|
|
|
158
183
|
conditional: true,
|
|
159
184
|
}));
|
|
160
185
|
}
|
|
186
|
+
function nearby(types, field) {
|
|
187
|
+
const segments = pointerSegments(field);
|
|
188
|
+
for (let length = segments.length - 1; length > 0; length -= 1) {
|
|
189
|
+
const prefix = segments
|
|
190
|
+
.slice(0, length)
|
|
191
|
+
.map((segment) => `/${escapePointer(segment)}`)
|
|
192
|
+
.join('');
|
|
193
|
+
const children = types.flatMap((type) => {
|
|
194
|
+
const reached = pointerFacts(type, prefix);
|
|
195
|
+
return (reached === undefined ? [] : crossedFacts(reached.facts)).flatMap((crossed) => Object.keys(crossed.properties ?? {}).map((key) => `${prefix}/${escapePointer(key)}`));
|
|
196
|
+
});
|
|
197
|
+
if (children.length > 0)
|
|
198
|
+
return [...new Set(children)].sort();
|
|
199
|
+
}
|
|
200
|
+
return [
|
|
201
|
+
...new Set(types.flatMap((type) => Object.keys(type.fields).map((name) => `/${escapePointer(name)}`))),
|
|
202
|
+
].sort();
|
|
203
|
+
}
|
|
161
204
|
function several(spec) {
|
|
162
205
|
return spec.through || spec.facts.type === 'array';
|
|
163
206
|
}
|
|
@@ -173,7 +216,9 @@ function kind(declared, checked, at) {
|
|
|
173
216
|
declared.some((spec) => fits(spec.facts, checked))) {
|
|
174
217
|
return;
|
|
175
218
|
}
|
|
176
|
-
throw new QueryError('wrong-kind', at, `${JSON.stringify(checked)} is not of its field's kind
|
|
219
|
+
throw new QueryError('wrong-kind', at, `${JSON.stringify(checked)} is not of its field's kind`, [
|
|
220
|
+
...new Set(declared.flatMap((spec) => kindWords(itemOf(spec.facts)))),
|
|
221
|
+
]);
|
|
177
222
|
}
|
|
178
223
|
function test(declared, input, at) {
|
|
179
224
|
if (!plain(input)) {
|
|
@@ -208,8 +253,9 @@ function test(declared, input, at) {
|
|
|
208
253
|
invalid(place(at, operators[1]), 'names a second operator');
|
|
209
254
|
const [operator] = operators;
|
|
210
255
|
const where = place(at, operator);
|
|
211
|
-
if (!SINGLE.includes(operator))
|
|
212
|
-
invalid(where, 'unknown operator');
|
|
256
|
+
if (!SINGLE.includes(operator)) {
|
|
257
|
+
invalid(where, 'unknown operator', [...SINGLE, ...RANGE]);
|
|
258
|
+
}
|
|
213
259
|
const operand = input[operator];
|
|
214
260
|
if (operator === '$eq' || operator === '$ne') {
|
|
215
261
|
const compared = value(operand, where);
|
|
@@ -218,7 +264,7 @@ function test(declared, input, at) {
|
|
|
218
264
|
}
|
|
219
265
|
if (operator === '$in' || operator === '$nin' || operator === '$all') {
|
|
220
266
|
const compared = values(operand, where);
|
|
221
|
-
compared.forEach((item, index) => kind(declared, item,
|
|
267
|
+
compared.forEach((item, index) => kind(declared, item, place(where, index)));
|
|
222
268
|
if (operator === '$in')
|
|
223
269
|
return { op: 'in', values: compared };
|
|
224
270
|
if (operator === '$nin')
|
|
@@ -254,10 +300,10 @@ function condition(typed, input, at) {
|
|
|
254
300
|
invalid(at, 'expects an object of field predicates');
|
|
255
301
|
const conditions = [];
|
|
256
302
|
for (const name of Object.keys(input).sort()) {
|
|
257
|
-
const where =
|
|
303
|
+
const where = place(at, name);
|
|
258
304
|
const entry = input[name];
|
|
259
305
|
if (name === '$and' || name === '$or') {
|
|
260
|
-
const nested = list(entry, where).map((item, index) => condition(typed, item,
|
|
306
|
+
const nested = list(entry, where).map((item, index) => condition(typed, item, place(where, index)));
|
|
261
307
|
if (nested.length === 0)
|
|
262
308
|
invalid(where, 'expects a nonempty list');
|
|
263
309
|
conditions.push(name === '$and' ? { every: nested } : { some: nested });
|
|
@@ -297,7 +343,7 @@ function hopOf(facts, rooms, root, input) {
|
|
|
297
343
|
if (!plain(input))
|
|
298
344
|
invalid('hop', 'expects an object');
|
|
299
345
|
known(input, RELATED, 'hop');
|
|
300
|
-
const field = referenceName(root, input.field, 'hop
|
|
346
|
+
const field = referenceName(root, input.field, ['hop', 'field']);
|
|
301
347
|
const { types, where, pathPrefix } = scope(facts, rooms, input, 'hop');
|
|
302
348
|
return { types, where, pathPrefix, field };
|
|
303
349
|
}
|
|
@@ -306,20 +352,22 @@ function backlinksOf(facts, rooms, input) {
|
|
|
306
352
|
invalid('backlinks', 'expects an object');
|
|
307
353
|
known(input, RELATED, 'backlinks');
|
|
308
354
|
const { typed, types, where, pathPrefix } = scope(facts, rooms, input, 'backlinks');
|
|
309
|
-
const field = input.field === undefined ? null : referenceName(typed, input.field, 'backlinks
|
|
355
|
+
const field = input.field === undefined ? null : referenceName(typed, input.field, ['backlinks', 'field']);
|
|
310
356
|
return { types, where, pathPrefix, field };
|
|
311
357
|
}
|
|
312
|
-
function
|
|
313
|
-
if (
|
|
314
|
-
|
|
358
|
+
function oneField(typed, input, at) {
|
|
359
|
+
if (specs(typed, input.field, place(at, 'field')).some(several)) {
|
|
360
|
+
invalid(place(at, 'field'), 'a path that can hold several values');
|
|
315
361
|
}
|
|
362
|
+
return input.field;
|
|
363
|
+
}
|
|
364
|
+
function keyPlan(typed, input, at, keys) {
|
|
365
|
+
if (typeof input === 'string' && keys.includes(input))
|
|
366
|
+
return { of: input };
|
|
316
367
|
if (plain(input) && Object.hasOwn(input, 'field') && Object.keys(input).length === 1) {
|
|
317
|
-
|
|
318
|
-
invalid(place(at, 'field'), 'a path that can hold several values');
|
|
319
|
-
}
|
|
320
|
-
return { of: 'field', field: input.field };
|
|
368
|
+
return { of: 'field', field: oneField(typed, input, at) };
|
|
321
369
|
}
|
|
322
|
-
return invalid(at,
|
|
370
|
+
return invalid(at, `expects ${keys.join(', ')} or a field`);
|
|
323
371
|
}
|
|
324
372
|
function direction(input, at) {
|
|
325
373
|
if (input === undefined)
|
|
@@ -328,16 +376,20 @@ function direction(input, at) {
|
|
|
328
376
|
invalid(at, 'expects asc or desc');
|
|
329
377
|
return input;
|
|
330
378
|
}
|
|
379
|
+
function nulls(input, at) {
|
|
380
|
+
if (input === undefined)
|
|
381
|
+
return null;
|
|
382
|
+
if (input !== 'first' && input !== 'last')
|
|
383
|
+
invalid(at, 'expects first or last');
|
|
384
|
+
return input;
|
|
385
|
+
}
|
|
331
386
|
function orderOptions(input, at) {
|
|
332
387
|
const options = {
|
|
333
388
|
direction: direction(input.direction, place(at, 'direction')),
|
|
334
389
|
};
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
options.nulls = input.nulls;
|
|
340
|
-
}
|
|
390
|
+
const placed = nulls(input.nulls, place(at, 'nulls'));
|
|
391
|
+
if (placed !== null)
|
|
392
|
+
options.nulls = placed;
|
|
341
393
|
if (input.stringSort !== undefined) {
|
|
342
394
|
if (input.stringSort !== 'lexical' && input.stringSort !== 'locale') {
|
|
343
395
|
invalid(place(at, 'stringSort'), 'expects lexical or locale');
|
|
@@ -375,9 +427,9 @@ function parts(typed, input, at, fields) {
|
|
|
375
427
|
const named = list(input, at);
|
|
376
428
|
named.forEach((name, index) => {
|
|
377
429
|
if (fields)
|
|
378
|
-
specs(typed, name,
|
|
430
|
+
specs(typed, name, place(at, index));
|
|
379
431
|
else if (typeof name !== 'string')
|
|
380
|
-
invalid(
|
|
432
|
+
invalid(place(at, index), 'expects a name');
|
|
381
433
|
});
|
|
382
434
|
return named;
|
|
383
435
|
}
|
|
@@ -390,12 +442,12 @@ function flag(input, at) {
|
|
|
390
442
|
}
|
|
391
443
|
function documentShape(typed, input) {
|
|
392
444
|
const orderBy = (input.orderBy === undefined ? [] : list(input.orderBy, 'orderBy')).map((clause, index) => {
|
|
393
|
-
const at =
|
|
445
|
+
const at = place('orderBy', index);
|
|
394
446
|
if (!plain(clause))
|
|
395
447
|
invalid(at, 'expects an order clause');
|
|
396
448
|
known(clause, ORDER, at);
|
|
397
449
|
return {
|
|
398
|
-
key: keyPlan(typed, clause.by, place(at, 'by'),
|
|
450
|
+
key: keyPlan(typed, clause.by, place(at, 'by'), DOCUMENT_KEYS),
|
|
399
451
|
options: orderOptions(clause, at),
|
|
400
452
|
};
|
|
401
453
|
});
|
|
@@ -411,6 +463,8 @@ function documentShape(typed, input) {
|
|
|
411
463
|
change: true,
|
|
412
464
|
fileId: true,
|
|
413
465
|
revision: true,
|
|
466
|
+
size: true,
|
|
467
|
+
created: true,
|
|
414
468
|
orderBy,
|
|
415
469
|
};
|
|
416
470
|
}
|
|
@@ -419,45 +473,84 @@ function documentShape(typed, input) {
|
|
|
419
473
|
known(select, PARTS, 'select');
|
|
420
474
|
return {
|
|
421
475
|
kind: 'documents',
|
|
422
|
-
fields: parts(typed, select.fields, 'select
|
|
423
|
-
sections: parts(typed, select.sections, 'select
|
|
424
|
-
preamble: flag(select.preamble, 'select
|
|
425
|
-
markdown: flag(select.markdown, 'select
|
|
426
|
-
backlinks: flag(select.backlinks, 'select
|
|
427
|
-
change: flag(select.change, 'select
|
|
428
|
-
fileId: flag(select.fileId, 'select
|
|
429
|
-
revision: flag(select.revision, 'select
|
|
476
|
+
fields: parts(typed, select.fields, ['select', 'fields'], true),
|
|
477
|
+
sections: parts(typed, select.sections, ['select', 'sections'], false),
|
|
478
|
+
preamble: flag(select.preamble, ['select', 'preamble']),
|
|
479
|
+
markdown: flag(select.markdown, ['select', 'markdown']),
|
|
480
|
+
backlinks: flag(select.backlinks, ['select', 'backlinks']),
|
|
481
|
+
change: flag(select.change, ['select', 'change']),
|
|
482
|
+
fileId: flag(select.fileId, ['select', 'fileId']),
|
|
483
|
+
revision: flag(select.revision, ['select', 'revision']),
|
|
484
|
+
size: flag(select.size, ['select', 'size']),
|
|
485
|
+
created: flag(select.created, ['select', 'created']),
|
|
430
486
|
orderBy,
|
|
431
487
|
};
|
|
432
488
|
}
|
|
489
|
+
function greatestOf(typed, input) {
|
|
490
|
+
if (input === undefined)
|
|
491
|
+
return null;
|
|
492
|
+
const at = ['select', 'greatest'];
|
|
493
|
+
if (!plain(input))
|
|
494
|
+
invalid(at, 'expects the field whose greatest value each group answers');
|
|
495
|
+
known(input, ['field'], at);
|
|
496
|
+
if (!Object.hasOwn(input, 'field'))
|
|
497
|
+
invalid(at, 'names no field');
|
|
498
|
+
return oneField(typed, input, at);
|
|
499
|
+
}
|
|
433
500
|
function groupShape(typed, input) {
|
|
434
|
-
const groupBy = list(input.groupBy, 'groupBy').map((key, index) => keyPlan(typed, key,
|
|
501
|
+
const groupBy = list(input.groupBy, 'groupBy').map((key, index) => keyPlan(typed, key, place('groupBy', index), GROUP_KEYS));
|
|
435
502
|
if (groupBy.length === 0)
|
|
436
503
|
invalid('groupBy', 'names no key');
|
|
504
|
+
const select = input.select ?? {};
|
|
505
|
+
if (!plain(select))
|
|
506
|
+
invalid('select', 'expects the totals each group answers');
|
|
507
|
+
known(select, GROUP_PARTS, 'select');
|
|
508
|
+
const greatest = greatestOf(typed, select.greatest);
|
|
437
509
|
const grouped = groupBy.map((key) => JSON.stringify(key));
|
|
438
510
|
const orderBy = (input.orderBy === undefined ? [] : list(input.orderBy, 'orderBy')).map((clause, index) => {
|
|
439
|
-
const at =
|
|
511
|
+
const at = place('orderBy', index);
|
|
440
512
|
if (!plain(clause))
|
|
441
513
|
invalid(at, 'expects an order clause');
|
|
442
|
-
known(clause, ['by', 'direction'], at);
|
|
443
|
-
const by = clause.by === '
|
|
444
|
-
?
|
|
445
|
-
: grouped.indexOf(JSON.stringify(keyPlan(typed, clause.by, place(at, 'by'),
|
|
514
|
+
known(clause, ['by', 'direction', 'nulls'], at);
|
|
515
|
+
const by = typeof clause.by === 'string' && GROUP_ORDERS.includes(clause.by)
|
|
516
|
+
? clause.by
|
|
517
|
+
: grouped.indexOf(JSON.stringify(keyPlan(typed, clause.by, place(at, 'by'), [...GROUP_ORDERS, ...GROUP_KEYS])));
|
|
446
518
|
if (by === -1)
|
|
447
519
|
invalid(place(at, 'by'), 'orders by a key the query does not group by');
|
|
448
|
-
|
|
520
|
+
if (by === 'greatest' && greatest === null) {
|
|
521
|
+
invalid(place(at, 'by'), 'orders by a greatest value the query does not select');
|
|
522
|
+
}
|
|
523
|
+
return {
|
|
524
|
+
by,
|
|
525
|
+
direction: direction(clause.direction, place(at, 'direction')),
|
|
526
|
+
nulls: nulls(clause.nulls, place(at, 'nulls')),
|
|
527
|
+
};
|
|
449
528
|
});
|
|
450
|
-
return {
|
|
529
|
+
return {
|
|
530
|
+
kind: 'groups',
|
|
531
|
+
groupBy,
|
|
532
|
+
size: flag(select.size, ['select', 'size']),
|
|
533
|
+
updated: flag(select.updated, ['select', 'updated']),
|
|
534
|
+
greatest,
|
|
535
|
+
orderBy,
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
function outsideOf(input) {
|
|
539
|
+
const listed = list(input, 'outside');
|
|
540
|
+
listed.forEach((item, index) => {
|
|
541
|
+
if (directory(item, place('outside', index)) === '') {
|
|
542
|
+
invalid(place('outside', index), 'names no directory');
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
return [...new Set(listed)].sort();
|
|
451
546
|
}
|
|
452
547
|
export function planOf(input, facts) {
|
|
453
548
|
if (!plain(input))
|
|
454
549
|
invalid('query', 'expects a query object');
|
|
455
550
|
const grouped = input.groupBy !== undefined;
|
|
456
|
-
if (grouped && input.select !== undefined)
|
|
457
|
-
invalid('select', 'a grouped query selects nothing');
|
|
458
551
|
if (!grouped && input.select === undefined)
|
|
459
552
|
invalid('select', 'a Document query must select');
|
|
460
|
-
known(input, [...FILTER, 'orderBy', 'limit', 'after', 'total',
|
|
553
|
+
known(input, [...FILTER, 'orderBy', 'limit', 'after', 'total', 'select', 'groupBy'], '');
|
|
461
554
|
const limit = limitOf(input.limit);
|
|
462
555
|
const rooms = input.rooms === undefined ? null : names(input.rooms, 'rooms');
|
|
463
556
|
const { typed, ...root } = scope(facts, rooms, input, '');
|
|
@@ -466,6 +559,7 @@ export function planOf(input, facts) {
|
|
|
466
559
|
key: queryKey(input),
|
|
467
560
|
rooms,
|
|
468
561
|
root,
|
|
562
|
+
outside: input.outside === undefined ? null : outsideOf(input.outside),
|
|
469
563
|
folder: input.folder === undefined ? null : directory(input.folder, 'folder'),
|
|
470
564
|
paths: input.paths === undefined ? null : pathsOf(input.paths),
|
|
471
565
|
fileIds: input.fileIds === undefined ? null : fileIdsOf(input.fileIds),
|
package/dist/query/match.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Definition } from '../definition.js';
|
|
2
2
|
import { type QueryPlan } from './language.js';
|
|
3
|
+
import { type HeldValue } from './rows.js';
|
|
3
4
|
export type Candidate = {
|
|
4
5
|
readonly path: string;
|
|
5
6
|
readonly type: string | null;
|
|
6
7
|
readonly fileId: string | null;
|
|
7
8
|
readonly fields: Readonly<Record<string, unknown>>;
|
|
8
|
-
readonly definition?: Definition
|
|
9
|
+
readonly definition?: Pick<Definition, 'frontmatter'>;
|
|
9
10
|
readonly text: string | null;
|
|
10
11
|
};
|
|
12
|
+
export declare function heldAt(candidate: Candidate, field: string): readonly HeldValue[];
|
|
11
13
|
export declare function matches(plan: QueryPlan, candidate: Candidate): boolean;
|
|
12
14
|
//# sourceMappingURL=match.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/query/match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/query/match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AA4HF,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,SAAS,EAAE,CAEhF;AAiCD,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAYtE"}
|
package/dist/query/match.js
CHANGED
|
@@ -79,9 +79,12 @@ function tested(values, field, test) {
|
|
|
79
79
|
return rows.some((row) => row.kind === 'string' && row.value.startsWith(test.prefix));
|
|
80
80
|
}
|
|
81
81
|
if (test.op === 'all') {
|
|
82
|
-
return rows.some((row) =>
|
|
83
|
-
row.kind
|
|
84
|
-
|
|
82
|
+
return rows.some((row) => {
|
|
83
|
+
if (row.item !== -1 || row.kind !== 'array')
|
|
84
|
+
return false;
|
|
85
|
+
const items = itemsOf(values, row);
|
|
86
|
+
return test.values.every((value) => items.some((item) => same(item, value)));
|
|
87
|
+
});
|
|
85
88
|
}
|
|
86
89
|
return rows.some((row) => row.item === -1 && row.kind === 'array' && row.size === test.size);
|
|
87
90
|
}
|
|
@@ -92,14 +95,19 @@ function conditioned(values, condition) {
|
|
|
92
95
|
return condition.some.some((one) => conditioned(values, one));
|
|
93
96
|
return tested(values, condition.field, condition.test);
|
|
94
97
|
}
|
|
95
|
-
function scoped(candidate,
|
|
98
|
+
function scoped(candidate, scope) {
|
|
96
99
|
return ((scope.types === null || (candidate.type !== null && scope.types.includes(candidate.type))) &&
|
|
97
100
|
(scope.pathPrefix === null ||
|
|
98
101
|
scope.pathPrefix === '' ||
|
|
99
102
|
candidate.path.startsWith(`${scope.pathPrefix}/`)) &&
|
|
100
|
-
(scope.where === null ||
|
|
103
|
+
(scope.where === null ||
|
|
104
|
+
conditioned(indexed(candidate.path, candidate.fields, candidate.definition).values, scope.where)));
|
|
101
105
|
}
|
|
102
|
-
export function
|
|
106
|
+
export function heldAt(candidate, field) {
|
|
107
|
+
return reached(indexed(candidate.path, candidate.fields, candidate.definition).values, field);
|
|
108
|
+
}
|
|
109
|
+
const UNHELD = ['size', 'created', 'updated', 'greatest'];
|
|
110
|
+
function answerable(plan) {
|
|
103
111
|
if (plan.rooms !== null)
|
|
104
112
|
invalid('rooms', 'names Rooms, which one Document does not choose');
|
|
105
113
|
if (plan.hop !== null)
|
|
@@ -107,12 +115,36 @@ export function matches(plan, candidate) {
|
|
|
107
115
|
if (plan.backlinks !== null) {
|
|
108
116
|
invalid('backlinks', 'tests other Documents, which one Document cannot answer');
|
|
109
117
|
}
|
|
110
|
-
const
|
|
118
|
+
const shape = plan.shape;
|
|
119
|
+
const ordered = shape.kind === 'documents'
|
|
120
|
+
? shape.orderBy.map(({ key }) => key.of)
|
|
121
|
+
: shape.orderBy.map(({ by }) => by);
|
|
122
|
+
ordered.forEach((by, index) => {
|
|
123
|
+
if (typeof by === 'string' && UNHELD.includes(by)) {
|
|
124
|
+
invalid(['orderBy', index, 'by'], `orders by ${by}, which one Document does not hold`);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
if (shape.kind === 'documents')
|
|
128
|
+
return;
|
|
129
|
+
for (const part of ['size', 'updated']) {
|
|
130
|
+
if (shape[part])
|
|
131
|
+
invalid(['select', part], 'totals other Documents, which one Document cannot');
|
|
132
|
+
}
|
|
133
|
+
if (shape.greatest !== null) {
|
|
134
|
+
invalid(['select', 'greatest'], 'compares other Documents, which one Document cannot');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function outside(plan, path) {
|
|
138
|
+
return (plan.outside ?? []).some((folder) => path === folder || path.startsWith(`${folder}/`));
|
|
139
|
+
}
|
|
140
|
+
export function matches(plan, candidate) {
|
|
141
|
+
answerable(plan);
|
|
111
142
|
return ((plan.paths === null || plan.paths.includes(candidate.path)) &&
|
|
112
143
|
(plan.fileIds === null ||
|
|
113
144
|
(candidate.fileId !== null && plan.fileIds.includes(candidate.fileId))) &&
|
|
114
145
|
(plan.folder === null || dirname(candidate.path) === plan.folder) &&
|
|
115
|
-
|
|
146
|
+
!outside(plan, candidate.path) &&
|
|
147
|
+
scoped(candidate, plan.root) &&
|
|
116
148
|
(plan.text === null ||
|
|
117
149
|
(candidate.text !== null && candidate.text.toLowerCase().includes(plan.text.toLowerCase()))));
|
|
118
150
|
}
|
package/dist/query/rows.d.ts
CHANGED
|
@@ -28,5 +28,5 @@ export type Placed = {
|
|
|
28
28
|
};
|
|
29
29
|
export declare function placedOf(pointer: string, reach: Reach): Placed;
|
|
30
30
|
export declare function heldKind(value: unknown): HeldKind;
|
|
31
|
-
export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Definition | undefined): Indexed;
|
|
31
|
+
export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'frontmatter'> | undefined): Indexed;
|
|
32
32
|
//# sourceMappingURL=rows.d.ts.map
|
package/dist/query/rows.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/query/rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEnG,MAAM,MAAM,SAAS,GA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GAAG,QAAQ,CAgB7E;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,QAAQ,CAqB9D;AAUD,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,GAAG,SAAS,EAC1B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,QAAQ,GAAG,SAAS,WAG9B;AAsDD,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,QAAQ,CAc7D;AAED,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAG,SAAS,CAgC9E;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,SAAS,EAAE,EAAE,GAAG,EAAE,QAAQ,GAAG,QAAQ,CAM9E"}
|
package/dist/query/sql.js
CHANGED
|
@@ -171,6 +171,11 @@ export function tests(alias, plan) {
|
|
|
171
171
|
? []
|
|
172
172
|
: [fragment(`${alias}.file_id IN ${listed(plan.fileIds).sql}`, plan.fileIds)]),
|
|
173
173
|
...(plan.folder === null ? [] : [fragment(`${alias}.folder = ?`, [plan.folder])]),
|
|
174
|
+
...(plan.outside ?? []).map((folder) => fragment(`NOT (${alias}.path = ? OR (${alias}.path >= ? AND ${alias}.path < ?))`, [
|
|
175
|
+
folder,
|
|
176
|
+
`${folder}/`,
|
|
177
|
+
`${folder}0`,
|
|
178
|
+
])),
|
|
174
179
|
scoped(alias, plan.root, plan.paths !== null),
|
|
175
180
|
...(plan.text === null
|
|
176
181
|
? []
|
|
@@ -228,9 +233,10 @@ function collated(collate, term, which) {
|
|
|
228
233
|
}
|
|
229
234
|
export function sorted(collate, term) {
|
|
230
235
|
const direction = term.ordering.direction === 'desc' ? 'DESC' : 'ASC';
|
|
236
|
+
const group = klass(term);
|
|
231
237
|
return joined([
|
|
232
238
|
placement(term),
|
|
233
|
-
fragment(`${
|
|
239
|
+
fragment(`${group.sql} ${direction}`, group.bind),
|
|
234
240
|
...[NUMBERS, INSTANTS, TEXTS, LISTS].map((which) => {
|
|
235
241
|
const value = classed(term, which);
|
|
236
242
|
return fragment(`${value.sql}${collated(collate, term, which)} ${direction}`, value.bind);
|
package/dist/refuse.d.ts
CHANGED
package/dist/refuse.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1E,OAAO,CAQT"}
|
package/dist/refuse.js
CHANGED
|
@@ -3,6 +3,7 @@ export function refusal(file, rule, extra) {
|
|
|
3
3
|
file,
|
|
4
4
|
rule,
|
|
5
5
|
...(extra?.location === undefined ? {} : { location: extra.location }),
|
|
6
|
+
...(extra?.line === undefined ? {} : { line: extra.line }),
|
|
6
7
|
...(extra?.referrers === undefined ? {} : { referrers: extra.referrers }),
|
|
7
8
|
};
|
|
8
9
|
}
|
package/dist/reserved.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const ROOM_DESCRIPTION = "ROOM.md";
|
|
2
|
+
export declare const CAPTURE_HOME = "capture";
|
|
2
3
|
export declare const RESERVED_NAMES: readonly string[];
|
|
3
4
|
export declare function isReservedName(name: string): boolean;
|
|
4
5
|
export declare function isDocumentPath(path: string): boolean;
|
package/dist/reserved.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
|
1
|
+
{"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
|
package/dist/reserved.js
CHANGED
package/dist/schema.d.ts
CHANGED
|
@@ -4,6 +4,4 @@ export type SchemaRefusal = {
|
|
|
4
4
|
readonly location: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function frontmatterRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
|
|
7
|
-
export declare function conditionedSections(definition: Definition, fields: Readonly<Record<string, unknown>>): readonly string[];
|
|
8
|
-
export declare function fitsItem(definition: Definition, section: string, text: string): boolean;
|
|
9
7
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAO5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA+JjF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAI3B"}
|