@graview/core 0.1.28 → 0.1.29
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/README.md +17 -0
- package/dist/amount-input.d.ts +21 -0
- package/dist/amount-input.d.ts.map +1 -0
- package/dist/amount-input.js +96 -0
- package/dist/amount-input.js.map +1 -0
- package/dist/answer-seen.d.ts +38 -0
- package/dist/answer-seen.d.ts.map +1 -0
- package/dist/answer-seen.js +122 -0
- package/dist/answer-seen.js.map +1 -0
- package/dist/app-places.d.ts +56 -0
- package/dist/app-places.d.ts.map +1 -0
- package/dist/app-places.js +153 -0
- package/dist/app-places.js.map +1 -0
- package/dist/arrange.d.ts +2 -2
- package/dist/arrange.d.ts.map +1 -1
- package/dist/arrange.js +2 -2
- package/dist/arrange.js.map +1 -1
- package/dist/arrangement-words.d.ts +3 -0
- package/dist/arrangement-words.d.ts.map +1 -0
- package/dist/arrangement-words.js +50 -0
- package/dist/arrangement-words.js.map +1 -0
- package/dist/arrangement.d.ts +25 -3
- package/dist/arrangement.d.ts.map +1 -1
- package/dist/arrangement.js +36 -32
- package/dist/arrangement.js.map +1 -1
- package/dist/arranging.d.ts.map +1 -1
- package/dist/arranging.js +19 -8
- package/dist/arranging.js.map +1 -1
- package/dist/bind.d.ts +3 -0
- package/dist/bind.d.ts.map +1 -1
- package/dist/bind.js.map +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/check.d.ts +3 -0
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +3 -0
- package/dist/check.js.map +1 -1
- package/dist/city.d.ts +58 -50
- package/dist/city.d.ts.map +1 -1
- package/dist/city.js +160 -147
- package/dist/city.js.map +1 -1
- package/dist/cli/check/brand.js +1 -1
- package/dist/cli/check/brand.js.map +1 -1
- package/dist/cli/check/clock-rules.d.ts +4 -0
- package/dist/cli/check/clock-rules.d.ts.map +1 -0
- package/dist/cli/check/clock-rules.js +26 -0
- package/dist/cli/check/clock-rules.js.map +1 -0
- package/dist/cli/check/field-sight.d.ts +11 -0
- package/dist/cli/check/field-sight.d.ts.map +1 -0
- package/dist/cli/check/field-sight.js +113 -0
- package/dist/cli/check/field-sight.js.map +1 -0
- package/dist/cli/check/index.d.ts +2 -0
- package/dist/cli/check/index.d.ts.map +1 -1
- package/dist/cli/check/index.js +2 -0
- package/dist/cli/check/index.js.map +1 -1
- package/dist/cli/check/lenses.d.ts +1 -1
- package/dist/cli/check/lenses.d.ts.map +1 -1
- package/dist/cli/check/lenses.js +43 -2
- package/dist/cli/check/lenses.js.map +1 -1
- package/dist/cli/check/relations.d.ts.map +1 -1
- package/dist/cli/check/relations.js +2 -1
- package/dist/cli/check/relations.js.map +1 -1
- package/dist/cli/check.d.ts.map +1 -1
- package/dist/cli/check.js +7 -4
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/describe.d.ts.map +1 -1
- package/dist/cli/describe.js +44 -3
- package/dist/cli/describe.js.map +1 -1
- package/dist/cli/docs.d.ts.map +1 -1
- package/dist/cli/docs.js +4 -3
- package/dist/cli/docs.js.map +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +10 -1
- package/dist/cli/types.js.map +1 -1
- package/dist/clock-readers.d.ts +18 -0
- package/dist/clock-readers.d.ts.map +1 -0
- package/dist/clock-readers.js +70 -0
- package/dist/clock-readers.js.map +1 -0
- package/dist/clock.d.ts +30 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +41 -0
- package/dist/clock.js.map +1 -0
- package/dist/columns.d.ts.map +1 -1
- package/dist/columns.js +2 -1
- package/dist/columns.js.map +1 -1
- package/dist/conformance/fixtures.d.ts.map +1 -1
- package/dist/conformance/fixtures.js +326 -43
- package/dist/conformance/fixtures.js.map +1 -1
- package/dist/days.d.ts +53 -4
- package/dist/days.d.ts.map +1 -1
- package/dist/days.js +136 -16
- package/dist/days.js.map +1 -1
- package/dist/describe.d.ts +1 -0
- package/dist/describe.d.ts.map +1 -1
- package/dist/describe.js +1 -0
- package/dist/describe.js.map +1 -1
- package/dist/document/act-findings.d.ts.map +1 -1
- package/dist/document/act-findings.js +13 -3
- package/dist/document/act-findings.js.map +1 -1
- package/dist/document/amount.d.ts +4 -0
- package/dist/document/amount.d.ts.map +1 -0
- package/dist/document/amount.js +22 -0
- package/dist/document/amount.js.map +1 -0
- package/dist/document/block-context.d.ts.map +1 -1
- package/dist/document/block-context.js +1 -0
- package/dist/document/block-context.js.map +1 -1
- package/dist/document/blocks.d.ts +13 -3
- package/dist/document/blocks.d.ts.map +1 -1
- package/dist/document/blocks.js +56 -12
- package/dist/document/blocks.js.map +1 -1
- package/dist/document/compile-checked.d.ts.map +1 -1
- package/dist/document/compile-checked.js +3 -2
- package/dist/document/compile-checked.js.map +1 -1
- package/dist/document/compile.d.ts.map +1 -1
- package/dist/document/compile.js +30 -7
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts +4 -2
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +50 -19
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/describe-coverage.d.ts.map +1 -1
- package/dist/document/describe-coverage.js +2 -1
- package/dist/document/describe-coverage.js.map +1 -1
- package/dist/document/describe-place.d.ts +6 -2
- package/dist/document/describe-place.d.ts.map +1 -1
- package/dist/document/describe-place.js +14 -8
- package/dist/document/describe-place.js.map +1 -1
- package/dist/document/diff.d.ts +2 -0
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +34 -6
- package/dist/document/diff.js.map +1 -1
- package/dist/document/durations.d.ts +8 -0
- package/dist/document/durations.d.ts.map +1 -0
- package/dist/document/durations.js +82 -0
- package/dist/document/durations.js.map +1 -0
- package/dist/document/edit.d.ts +1 -1
- package/dist/document/edit.d.ts.map +1 -1
- package/dist/document/edit.js +195 -22
- package/dist/document/edit.js.map +1 -1
- package/dist/document/expr/evaluate.d.ts +1 -1
- package/dist/document/expr/evaluate.d.ts.map +1 -1
- package/dist/document/expr/evaluate.js +17 -4
- package/dist/document/expr/evaluate.js.map +1 -1
- package/dist/document/field-spec.d.ts.map +1 -1
- package/dist/document/field-spec.js +15 -1
- package/dist/document/field-spec.js.map +1 -1
- package/dist/document/format-findings.d.ts +4 -0
- package/dist/document/format-findings.d.ts.map +1 -0
- package/dist/document/format-findings.js +39 -0
- package/dist/document/format-findings.js.map +1 -0
- package/dist/document/format-rules.d.ts +8 -0
- package/dist/document/format-rules.d.ts.map +1 -0
- package/dist/document/format-rules.js +19 -0
- package/dist/document/format-rules.js.map +1 -0
- package/dist/document/format-words.d.ts +9 -0
- package/dist/document/format-words.d.ts.map +1 -0
- package/dist/document/format-words.js +29 -0
- package/dist/document/format-words.js.map +1 -0
- package/dist/document/graview-template.d.ts +2 -2
- package/dist/document/migrate.d.ts +1 -0
- package/dist/document/migrate.d.ts.map +1 -1
- package/dist/document/migrate.js +45 -1
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/money.d.ts +14 -0
- package/dist/document/money.d.ts.map +1 -0
- package/dist/document/money.js +14 -0
- package/dist/document/money.js.map +1 -0
- package/dist/document/policy-words.d.ts +2 -0
- package/dist/document/policy-words.d.ts.map +1 -1
- package/dist/document/policy-words.js +19 -4
- package/dist/document/policy-words.js.map +1 -1
- package/dist/document/rule-line.d.ts.map +1 -1
- package/dist/document/rule-line.js +16 -12
- package/dist/document/rule-line.js.map +1 -1
- package/dist/document/rules.d.ts.map +1 -1
- package/dist/document/rules.js +6 -5
- package/dist/document/rules.js.map +1 -1
- package/dist/document/schema.d.ts +62 -19
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +30 -4
- package/dist/document/schema.js.map +1 -1
- package/dist/document/template-parse.d.ts.map +1 -1
- package/dist/document/template-parse.js +9 -2
- package/dist/document/template-parse.js.map +1 -1
- package/dist/document/template.d.ts +3 -13
- package/dist/document/template.d.ts.map +1 -1
- package/dist/document/template.js +24 -22
- package/dist/document/template.js.map +1 -1
- package/dist/document/thumbnail.d.ts.map +1 -1
- package/dist/document/thumbnail.js +4 -3
- package/dist/document/thumbnail.js.map +1 -1
- package/dist/document/to-document.d.ts +0 -1
- package/dist/document/to-document.d.ts.map +1 -1
- package/dist/document/to-document.js +19 -2
- package/dist/document/to-document.js.map +1 -1
- package/dist/document/view-specs.d.ts.map +1 -1
- package/dist/document/view-specs.js +3 -0
- package/dist/document/view-specs.js.map +1 -1
- package/dist/document/views.d.ts +2 -0
- package/dist/document/views.d.ts.map +1 -1
- package/dist/document/views.js +18 -6
- package/dist/document/views.js.map +1 -1
- package/dist/document.schema.json +63 -6
- package/dist/excerpt-of.d.ts +14 -0
- package/dist/excerpt-of.d.ts.map +1 -0
- package/dist/excerpt-of.js +120 -0
- package/dist/excerpt-of.js.map +1 -0
- package/dist/excerpt.d.ts +9 -0
- package/dist/excerpt.d.ts.map +1 -0
- package/dist/excerpt.js +43 -0
- package/dist/excerpt.js.map +1 -0
- package/dist/field-sight.d.ts +33 -0
- package/dist/field-sight.d.ts.map +1 -0
- package/dist/field-sight.js +313 -0
- package/dist/field-sight.js.map +1 -0
- package/dist/forms.d.ts +1 -0
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +1 -0
- package/dist/forms.js.map +1 -1
- package/dist/graph/archived.d.ts +25 -0
- package/dist/graph/archived.d.ts.map +1 -0
- package/dist/graph/archived.js +16 -0
- package/dist/graph/archived.js.map +1 -0
- package/dist/graph/diff.d.ts.map +1 -1
- package/dist/graph/diff.js +2 -1
- package/dist/graph/diff.js.map +1 -1
- package/dist/graph/graph.d.ts +37 -13
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +86 -40
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/tracked.d.ts +8 -8
- package/dist/graph/tracked.d.ts.map +1 -1
- package/dist/graph/tracked.js +15 -20
- package/dist/graph/tracked.js.map +1 -1
- package/dist/graph/types.d.ts +16 -8
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/graph/types.js.map +1 -1
- package/dist/import/coerce.d.ts +45 -0
- package/dist/import/coerce.d.ts.map +1 -0
- package/dist/import/coerce.js +252 -0
- package/dist/import/coerce.js.map +1 -0
- package/dist/import/csv.d.ts +16 -0
- package/dist/import/csv.d.ts.map +1 -0
- package/dist/import/csv.js +77 -0
- package/dist/import/csv.js.map +1 -0
- package/dist/import/index.d.ts +17 -0
- package/dist/import/index.d.ts.map +1 -0
- package/dist/import/index.js +13 -0
- package/dist/import/index.js.map +1 -0
- package/dist/import/mapping.d.ts +99 -0
- package/dist/import/mapping.d.ts.map +1 -0
- package/dist/import/mapping.js +182 -0
- package/dist/import/mapping.js.map +1 -0
- package/dist/import/rows.d.ts +116 -0
- package/dist/import/rows.d.ts.map +1 -0
- package/dist/import/rows.js +584 -0
- package/dist/import/rows.js.map +1 -0
- package/dist/index.d.ts +38 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -16
- package/dist/index.js.map +1 -1
- package/dist/invariants/engine.d.ts +5 -1
- package/dist/invariants/engine.d.ts.map +1 -1
- package/dist/invariants/engine.js +4 -3
- package/dist/invariants/engine.js.map +1 -1
- package/dist/invariants/types.d.ts +18 -3
- package/dist/invariants/types.d.ts.map +1 -1
- package/dist/json-schema.d.ts +1 -0
- package/dist/json-schema.d.ts.map +1 -1
- package/dist/json-schema.js +2 -0
- package/dist/json-schema.js.map +1 -1
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +2 -1
- package/dist/labels.js.map +1 -1
- package/dist/lines.d.ts +1 -0
- package/dist/lines.d.ts.map +1 -1
- package/dist/lines.js +5 -3
- package/dist/lines.js.map +1 -1
- package/dist/markdown.d.ts +102 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +460 -0
- package/dist/markdown.js.map +1 -0
- package/dist/mutations/arg-shape.d.ts +95 -0
- package/dist/mutations/arg-shape.d.ts.map +1 -0
- package/dist/mutations/arg-shape.js +101 -0
- package/dist/mutations/arg-shape.js.map +1 -0
- package/dist/mutations/define-mutation.d.ts +48 -2
- package/dist/mutations/define-mutation.d.ts.map +1 -1
- package/dist/mutations/define-mutation.js +103 -36
- package/dist/mutations/define-mutation.js.map +1 -1
- package/dist/mutations/derive-edits.d.ts +16 -1
- package/dist/mutations/derive-edits.d.ts.map +1 -1
- package/dist/mutations/derive-edits.js +67 -28
- package/dist/mutations/derive-edits.js.map +1 -1
- package/dist/mutations/derive-repeats.d.ts +8 -0
- package/dist/mutations/derive-repeats.d.ts.map +1 -0
- package/dist/mutations/derive-repeats.js +118 -0
- package/dist/mutations/derive-repeats.js.map +1 -0
- package/dist/mutations/derived-names.d.ts +20 -0
- package/dist/mutations/derived-names.d.ts.map +1 -0
- package/dist/mutations/derived-names.js +19 -0
- package/dist/mutations/derived-names.js.map +1 -0
- package/dist/mutations/form.d.ts +21 -1
- package/dist/mutations/form.d.ts.map +1 -1
- package/dist/mutations/form.js +19 -2
- package/dist/mutations/form.js.map +1 -1
- package/dist/mutations/invalid-arguments.d.ts +14 -0
- package/dist/mutations/invalid-arguments.d.ts.map +1 -0
- package/dist/mutations/invalid-arguments.js +18 -0
- package/dist/mutations/invalid-arguments.js.map +1 -0
- package/dist/mutations/keep-link.d.ts +27 -0
- package/dist/mutations/keep-link.d.ts.map +1 -0
- package/dist/mutations/keep-link.js +56 -0
- package/dist/mutations/keep-link.js.map +1 -0
- package/dist/mutations/kept-arguments.d.ts +26 -0
- package/dist/mutations/kept-arguments.d.ts.map +1 -0
- package/dist/mutations/kept-arguments.js +77 -0
- package/dist/mutations/kept-arguments.js.map +1 -0
- package/dist/mutations/node-ref.d.ts +0 -80
- package/dist/mutations/node-ref.d.ts.map +1 -1
- package/dist/mutations/node-ref.js +0 -93
- package/dist/mutations/node-ref.js.map +1 -1
- package/dist/mutations/types.d.ts +17 -1
- package/dist/mutations/types.d.ts.map +1 -1
- package/dist/mutations/words.d.ts +0 -13
- package/dist/mutations/words.d.ts.map +1 -1
- package/dist/mutations/words.js +1 -12
- package/dist/mutations/words.js.map +1 -1
- package/dist/ops/kept-fields.d.ts +7 -0
- package/dist/ops/kept-fields.d.ts.map +1 -0
- package/dist/ops/kept-fields.js +24 -0
- package/dist/ops/kept-fields.js.map +1 -0
- package/dist/ops/lineage.d.ts +37 -0
- package/dist/ops/lineage.d.ts.map +1 -0
- package/dist/ops/lineage.js +26 -0
- package/dist/ops/lineage.js.map +1 -0
- package/dist/ops/log.d.ts.map +1 -1
- package/dist/ops/log.js +1 -0
- package/dist/ops/log.js.map +1 -1
- package/dist/ops/provenance.d.ts +68 -0
- package/dist/ops/provenance.d.ts.map +1 -0
- package/dist/ops/provenance.js +83 -0
- package/dist/ops/provenance.js.map +1 -0
- package/dist/ops/types.d.ts +25 -0
- package/dist/ops/types.d.ts.map +1 -1
- package/dist/ops/withheld.d.ts +25 -2
- package/dist/ops/withheld.d.ts.map +1 -1
- package/dist/ops/withheld.js +6 -15
- package/dist/ops/withheld.js.map +1 -1
- package/dist/permissions/policy.d.ts +6 -1
- package/dist/permissions/policy.d.ts.map +1 -1
- package/dist/permissions/policy.js +29 -9
- package/dist/permissions/policy.js.map +1 -1
- package/dist/permissions/sight.d.ts +40 -2
- package/dist/permissions/sight.d.ts.map +1 -1
- package/dist/permissions/sight.js +25 -2
- package/dist/permissions/sight.js.map +1 -1
- package/dist/permissions/types.d.ts +21 -0
- package/dist/permissions/types.d.ts.map +1 -1
- package/dist/permissions/types.js.map +1 -1
- package/dist/places.d.ts +0 -49
- package/dist/places.d.ts.map +1 -1
- package/dist/places.js +2 -141
- package/dist/places.js.map +1 -1
- package/dist/provenance.d.ts +14 -0
- package/dist/provenance.d.ts.map +1 -0
- package/dist/provenance.js +13 -0
- package/dist/provenance.js.map +1 -0
- package/dist/repeat-words.d.ts +13 -0
- package/dist/repeat-words.d.ts.map +1 -0
- package/dist/repeat-words.js +56 -0
- package/dist/repeat-words.js.map +1 -0
- package/dist/repeat.d.ts +59 -0
- package/dist/repeat.d.ts.map +1 -0
- package/dist/repeat.js +155 -0
- package/dist/repeat.js.map +1 -0
- package/dist/scaffold/project.d.ts.map +1 -1
- package/dist/scaffold/project.js +13 -0
- package/dist/scaffold/project.js.map +1 -1
- package/dist/scaffold/ui.js +2 -2
- package/dist/scene-districts.d.ts +2 -1
- package/dist/scene-districts.d.ts.map +1 -1
- package/dist/scene-districts.js +2 -1
- package/dist/scene-districts.js.map +1 -1
- package/dist/scene.d.ts +4 -2
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +2 -1
- package/dist/scene.js.map +1 -1
- package/dist/schema/amount-mark.d.ts +13 -0
- package/dist/schema/amount-mark.d.ts.map +1 -0
- package/dist/schema/amount-mark.js +20 -0
- package/dist/schema/amount-mark.js.map +1 -0
- package/dist/schema/amount-words.d.ts +12 -0
- package/dist/schema/amount-words.d.ts.map +1 -0
- package/dist/schema/amount-words.js +31 -0
- package/dist/schema/amount-words.js.map +1 -0
- package/dist/schema/app-link-field.d.ts +4 -0
- package/dist/schema/app-link-field.d.ts.map +1 -0
- package/dist/schema/app-link-field.js +19 -0
- package/dist/schema/app-link-field.js.map +1 -0
- package/dist/schema/app-link.d.ts +41 -0
- package/dist/schema/app-link.d.ts.map +1 -0
- package/dist/schema/app-link.js +40 -0
- package/dist/schema/app-link.js.map +1 -0
- package/dist/schema/define-node.d.ts +25 -94
- package/dist/schema/define-node.d.ts.map +1 -1
- package/dist/schema/define-node.js +3 -247
- package/dist/schema/define-node.js.map +1 -1
- package/dist/schema/field-words.d.ts +45 -0
- package/dist/schema/field-words.d.ts.map +1 -0
- package/dist/schema/field-words.js +124 -0
- package/dist/schema/field-words.js.map +1 -0
- package/dist/schema/json-schema.d.ts +6 -1
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +83 -2
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/schema/markdown-field.d.ts +4 -0
- package/dist/schema/markdown-field.d.ts.map +1 -0
- package/dist/schema/markdown-field.js +20 -0
- package/dist/schema/markdown-field.js.map +1 -0
- package/dist/schema/markdown.d.ts +6 -0
- package/dist/schema/markdown.d.ts.map +1 -0
- package/dist/schema/markdown.js +27 -0
- package/dist/schema/markdown.js.map +1 -0
- package/dist/schema/reading.d.ts +86 -0
- package/dist/schema/reading.d.ts.map +1 -0
- package/dist/schema/reading.js +270 -0
- package/dist/schema/reading.js.map +1 -0
- package/dist/schema/repeat-field.d.ts +5 -0
- package/dist/schema/repeat-field.d.ts.map +1 -0
- package/dist/schema/repeat-field.js +20 -0
- package/dist/schema/repeat-field.js.map +1 -0
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +5 -1
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/to-json-schema.d.ts +14 -0
- package/dist/schema/to-json-schema.d.ts.map +1 -0
- package/dist/schema/to-json-schema.js +616 -0
- package/dist/schema/to-json-schema.js.map +1 -0
- package/dist/schema/typed-field-builders.d.ts +8 -0
- package/dist/schema/typed-field-builders.d.ts.map +1 -0
- package/dist/schema/typed-field-builders.js +30 -0
- package/dist/schema/typed-field-builders.js.map +1 -0
- package/dist/schema/typed-field-of.d.ts +4 -0
- package/dist/schema/typed-field-of.d.ts.map +1 -0
- package/dist/schema/typed-field-of.js +14 -0
- package/dist/schema/typed-field-of.js.map +1 -0
- package/dist/schema/typed-fields.d.ts +11 -0
- package/dist/schema/typed-fields.d.ts.map +1 -0
- package/dist/schema/typed-fields.js +16 -0
- package/dist/schema/typed-fields.js.map +1 -0
- package/dist/schema/types.d.ts +14 -0
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/value-words.d.ts +21 -0
- package/dist/schema/value-words.d.ts.map +1 -0
- package/dist/schema/value-words.js +32 -0
- package/dist/schema/value-words.js.map +1 -0
- package/dist/search.d.ts +91 -4
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +288 -53
- package/dist/search.js.map +1 -1
- package/dist/seat.d.ts +19 -0
- package/dist/seat.d.ts.map +1 -0
- package/dist/seat.js +19 -0
- package/dist/seat.js.map +1 -0
- package/dist/seen.d.ts +15 -33
- package/dist/seen.d.ts.map +1 -1
- package/dist/seen.js +44 -135
- package/dist/seen.js.map +1 -1
- package/dist/store.d.ts +46 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +121 -22
- package/dist/store.js.map +1 -1
- package/dist/theme/types.d.ts +7 -1
- package/dist/theme/types.d.ts.map +1 -1
- package/dist/theme/types.js.map +1 -1
- package/dist/typed.d.ts +12 -3
- package/dist/typed.d.ts.map +1 -1
- package/dist/typed.js.map +1 -1
- package/dist/validate-graph.d.ts.map +1 -1
- package/dist/validate-graph.js +3 -10
- package/dist/validate-graph.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/views/types.d.ts +57 -8
- package/dist/views/types.d.ts.map +1 -1
- package/dist/views/types.js +22 -3
- package/dist/views/types.js.map +1 -1
- package/dist/village.d.ts +63 -0
- package/dist/village.d.ts.map +1 -0
- package/dist/village.js +143 -0
- package/dist/village.js.map +1 -0
- package/dist/watched.d.ts +12 -45
- package/dist/watched.d.ts.map +1 -1
- package/dist/watched.js +7 -119
- package/dist/watched.js.map +1 -1
- package/dist/words.d.ts +33 -0
- package/dist/words.d.ts.map +1 -0
- package/dist/words.js +36 -0
- package/dist/words.js.map +1 -0
- package/package.json +37 -2
package/dist/document/edit.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { DERIVED_ACTS, derivedActOf, derivedActsOf, givenWhenNeverArchived } from "../mutations/derived-names.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
import { ExprSyntaxError, parseExpr } from "./expr/parse.js";
|
|
3
4
|
import { printExpr } from "./expr/print.js";
|
|
4
5
|
import { error } from "./findings.js";
|
|
5
6
|
import { coerce } from "./migrate.js";
|
|
6
7
|
import { outsideRange, rangeWords } from "./range.js";
|
|
8
|
+
import { formatWords } from "./format-words.js";
|
|
9
|
+
import { formatFits, formatMisplaced } from "./format-rules.js";
|
|
10
|
+
/** Why a format is refused where it does not fit, in the checker's words (`field-format`). */
|
|
11
|
+
const refusedFormat = (format, type) => {
|
|
12
|
+
const { sentence, fix } = formatMisplaced(format, type);
|
|
13
|
+
return `${sentence}; ${fix}`;
|
|
14
|
+
};
|
|
7
15
|
import { farEnd } from "./far-end.js";
|
|
8
16
|
import { ActSpec, EDGE_NAME, EdgeSpec, FIELD_NAME, FIELD_TYPES, FieldSpec, GrantSpec, KindSpec, NAME, RuleSpec, SightSpec, } from "./schema.js";
|
|
9
17
|
import { SHIPPED_LENSES, isShippedLens, SHIPPED_LENS_NAMES } from "../places.js";
|
|
@@ -16,11 +24,12 @@ import { canonicalize } from "./canonical.js";
|
|
|
16
24
|
import { quotedAtTheEnd } from "./quote.js";
|
|
17
25
|
import { isRecord as isObject, respellDocument } from "./respell.js";
|
|
18
26
|
import { refName } from "./compiled.js";
|
|
27
|
+
import { localeSentence } from "./diff.js";
|
|
19
28
|
import { accentProblem } from "../theme/accent.js";
|
|
20
29
|
import { pageFieldFindings, pageNames, renamedOnPage, withoutOnPage } from "./page-fields.js";
|
|
21
30
|
import { capitalize, listed as listOf } from "../capital.js";
|
|
22
31
|
import { quoted } from "./quote.js";
|
|
23
|
-
import { FIRST_GRANT, FIRST_SIGHT, grantBody, grantGone, grantSentence, NO_GRANT_LEFT, NO_SIGHT_LEFT, peopleKinds, peopleSentence, nounWords, pluralWords as pluralOf, sightGone, sightSentence, sightWords, whoWords } from "./policy-words.js";
|
|
32
|
+
import { FIRST_GRANT, FIRST_SIGHT, grantBody, grantGone, grantSentence, NO_GRANT_LEFT, NO_SIGHT_LEFT, peopleKinds, peopleSentence, archivesSentence, nounWords, pluralWords as pluralOf, sightGone, sightSentence, sightWords, whoWords } from "./policy-words.js";
|
|
24
33
|
/** The ops, for tool schemas and the guide. */
|
|
25
34
|
export const EDIT_OPS = [
|
|
26
35
|
"add-kind",
|
|
@@ -31,8 +40,10 @@ export const EDIT_OPS = [
|
|
|
31
40
|
"retype-field",
|
|
32
41
|
"set-options",
|
|
33
42
|
"set-range",
|
|
43
|
+
"set-format",
|
|
34
44
|
"set-required",
|
|
35
45
|
"set-default",
|
|
46
|
+
"set-repeats",
|
|
36
47
|
"remove-field",
|
|
37
48
|
"add-relation",
|
|
38
49
|
"rename-relation",
|
|
@@ -55,6 +66,7 @@ export const EDIT_OPS = [
|
|
|
55
66
|
"arrange-pages",
|
|
56
67
|
"set-computed",
|
|
57
68
|
"set-people",
|
|
69
|
+
"set-archives",
|
|
58
70
|
"add-grant",
|
|
59
71
|
"remove-grant",
|
|
60
72
|
"add-sight",
|
|
@@ -75,11 +87,13 @@ const SHAPES = {
|
|
|
75
87
|
"remove-kind": z.object({ op: z.literal("remove-kind"), kind: kindName }).strict(),
|
|
76
88
|
"add-field": z.object({ op: z.literal("add-field"), kind: kindName, field: fieldName, fill: z.unknown().optional(), spec: z.record(z.string(), z.unknown()).optional() }).passthrough(),
|
|
77
89
|
"rename-field": z.object({ op: z.literal("rename-field"), kind: kindName, field: fieldName, to: fieldName }).strict(),
|
|
78
|
-
"retype-field": z.object({ op: z.literal("retype-field"), kind: kindName, field: fieldName, type: z.enum(FIELD_TYPES), options: z.array(z.string().min(1).max(80)).min(1).max(100).optional(), of: z.enum(["string", "number", "date", "image", "file"]).optional(), format: z.enum(["money", "percent", "duration"]).optional() }).strict(),
|
|
90
|
+
"retype-field": z.object({ op: z.literal("retype-field"), kind: kindName, field: fieldName, type: z.enum(FIELD_TYPES), options: z.array(z.string().min(1).max(80)).min(1).max(100).optional(), of: z.enum(["string", "number", "date", "image", "file"]).optional(), format: z.enum(["money", "percent", "duration", "markdown"]).optional() }).strict(),
|
|
79
91
|
"set-options": z.object({ op: z.literal("set-options"), kind: kindName, field: fieldName, add: z.array(z.string().min(1).max(80)).optional(), remove: z.array(z.string().min(1).max(80)).optional() }).strict(),
|
|
92
|
+
"set-format": z.object({ op: z.literal("set-format"), kind: kindName, field: fieldName, format: z.union([z.enum(["money", "percent", "duration", "markdown"]), z.null()]).optional(), unit: z.union([z.string().min(1).max(12), z.null()]).optional() }).strict(),
|
|
80
93
|
"set-range": z.object({ op: z.literal("set-range"), kind: kindName, field: fieldName, min: z.union([z.number(), z.null()]).optional(), max: z.union([z.number(), z.null()]).optional(), step: z.union([z.number().positive(), z.null()]).optional() }).strict(),
|
|
81
94
|
"set-required": z.object({ op: z.literal("set-required"), kind: kindName, field: fieldName, required: z.boolean() }).strict(),
|
|
82
95
|
"set-default": z.object({ op: z.literal("set-default"), kind: kindName, field: fieldName, default: z.unknown() }).strict(),
|
|
96
|
+
"set-repeats": z.object({ op: z.literal("set-repeats"), kind: kindName, field: fieldName, repeats: z.boolean() }).strict(),
|
|
83
97
|
"remove-field": z.object({ op: z.literal("remove-field"), kind: kindName, field: fieldName }).strict(),
|
|
84
98
|
"add-relation": z.object({ op: z.literal("add-relation"), kind: kindName, relation: edgeName }).passthrough(),
|
|
85
99
|
"rename-relation": z.object({ op: z.literal("rename-relation"), kind: kindName, relation: edgeName, to: edgeName }).strict(),
|
|
@@ -143,6 +157,8 @@ const SHAPES = {
|
|
|
143
157
|
primary: z.union([z.array(z.string().min(1).max(80)).max(40), z.null()]).optional(),
|
|
144
158
|
scene: z.union([z.string().min(1).max(40), z.null()]).optional(),
|
|
145
159
|
pages: z.union([z.string().min(1).max(40), z.null()]).optional(),
|
|
160
|
+
// What a kind's list offers to filter by: `{ "request": ["status", "became.stage"] }`; null or [] gives a kind back its derived filters.
|
|
161
|
+
filters: z.record(kindName, z.union([z.array(z.string().min(1).max(120)).max(40), z.null()])).optional(),
|
|
146
162
|
// The scene's word as a chat or a tool written before 0.1.17 sends it (FR-132's key, RESPELLED as `scene`).
|
|
147
163
|
overview: z.union([z.string().min(1).max(40), z.null()]).optional(),
|
|
148
164
|
})
|
|
@@ -159,6 +175,8 @@ const SHAPES = {
|
|
|
159
175
|
.strict(),
|
|
160
176
|
// Who the people are, and who may do and see what (FR-170): a grant and a sight as the document holds one.
|
|
161
177
|
"set-people": z.object({ op: z.literal("set-people"), kind: kindName, people: z.boolean() }).strict(),
|
|
178
|
+
// Whether a kind's records are archived and merged, or only kept and removed (FR-173).
|
|
179
|
+
"set-archives": z.object({ op: z.literal("set-archives"), kind: kindName, archives: z.boolean() }).strict(),
|
|
162
180
|
"add-grant": z.object({ op: z.literal("add-grant") }).passthrough(),
|
|
163
181
|
"remove-grant": z.object({ op: z.literal("remove-grant") }).passthrough(),
|
|
164
182
|
"add-sight": z.object({ op: z.literal("add-sight") }).passthrough(),
|
|
@@ -271,9 +289,10 @@ function mapNames(doc, e, ctx, rename) {
|
|
|
271
289
|
const first = x.args[0];
|
|
272
290
|
const literal = first?.t === "lit" && typeof first.value === "string" ? first.value : undefined;
|
|
273
291
|
let args;
|
|
274
|
-
if ((x.fn === "out" || x.fn === "in" || x.fn === "all") && literal !== undefined && x.args.length === 1) {
|
|
292
|
+
if ((x.fn === "out" || x.fn === "in" || x.fn === "all") && literal !== undefined && (x.args.length === 1 || (x.fn === "all" && x.args.length === 2))) {
|
|
275
293
|
const name = rename({ role: x.fn === "all" ? "kind" : "edge", kinds: NONE, name: literal });
|
|
276
|
-
|
|
294
|
+
// all('task', 'all') keeps what it asked of the archived (FR-173).
|
|
295
|
+
args = name === literal ? [...x.args] : [{ ...first, value: name }, ...x.args.slice(1)];
|
|
277
296
|
}
|
|
278
297
|
else if ((x.fn === "out" || x.fn === "in") && x.args.length === 2 && x.args[1].t === "lit" && typeof x.args[1].value === "string") {
|
|
279
298
|
// out(S, 'edge'): the set is read where the walk stands, and its relation renamed like any walk's (FR-101).
|
|
@@ -507,13 +526,17 @@ class Editor {
|
|
|
507
526
|
brand["currency"] = e.currency;
|
|
508
527
|
this.said.push(`Money is said in ${e.currency}.`);
|
|
509
528
|
}
|
|
510
|
-
if (e.locale === null)
|
|
529
|
+
if (e.locale === null) {
|
|
530
|
+
if (brand["locale"] !== undefined)
|
|
531
|
+
this.said.push(localeSentence(undefined));
|
|
511
532
|
delete brand["locale"];
|
|
533
|
+
}
|
|
512
534
|
else if (e.locale !== undefined) {
|
|
513
535
|
if (!/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e.locale))
|
|
514
536
|
return this.fail(i, "locale", 'a locale is a language tag, like "en-US" or "de-DE"');
|
|
515
537
|
brand["locale"] = e.locale;
|
|
516
|
-
|
|
538
|
+
// Its days, times and numbers as well as its money (FR-178).
|
|
539
|
+
this.said.push(localeSentence(e.locale));
|
|
517
540
|
}
|
|
518
541
|
if (e.name === null) {
|
|
519
542
|
delete brand["name"];
|
|
@@ -651,6 +674,8 @@ class Editor {
|
|
|
651
674
|
return this.setOptions(i, e);
|
|
652
675
|
case "set-range":
|
|
653
676
|
return this.setRange(i, e);
|
|
677
|
+
case "set-format":
|
|
678
|
+
return this.setFormat(i, e);
|
|
654
679
|
case "set-required": {
|
|
655
680
|
const f = this.field(i, e.kind, e.field);
|
|
656
681
|
if (!f)
|
|
@@ -681,6 +706,20 @@ class Editor {
|
|
|
681
706
|
}
|
|
682
707
|
return;
|
|
683
708
|
}
|
|
709
|
+
case "set-repeats": {
|
|
710
|
+
// A date that repeats keeps how it does beside it, as `<field>Repeat` (`repeat.ts`).
|
|
711
|
+
const f = this.field(i, e.kind, e.field);
|
|
712
|
+
if (!f)
|
|
713
|
+
return;
|
|
714
|
+
if (e.repeats && f.type !== "date" && f.type !== "datetime")
|
|
715
|
+
return this.fail(i, "repeats", `${e.kind}'s ${e.field} is ${f.type === "enum" ? "a choice" : `a ${f.type}`}, and only a date or a date and time can repeat`);
|
|
716
|
+
if (e.repeats)
|
|
717
|
+
f.repeats = true;
|
|
718
|
+
else
|
|
719
|
+
delete f.repeats;
|
|
720
|
+
this.said.push(e.repeats ? `${e.kind}'s ${e.field} may repeat: weekly, monthly, on chosen days, until a day.` : `${e.kind}'s ${e.field} no longer repeats.`);
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
684
723
|
case "remove-field":
|
|
685
724
|
return this.removeField(i, e.kind, e.field);
|
|
686
725
|
case "add-relation":
|
|
@@ -800,6 +839,8 @@ class Editor {
|
|
|
800
839
|
return this.setComputed(i, e);
|
|
801
840
|
case "set-people":
|
|
802
841
|
return this.setPeople(i, e);
|
|
842
|
+
case "set-archives":
|
|
843
|
+
return this.setArchives(i, e);
|
|
803
844
|
case "add-grant":
|
|
804
845
|
case "remove-grant":
|
|
805
846
|
case "add-sight":
|
|
@@ -1005,8 +1046,17 @@ class Editor {
|
|
|
1005
1046
|
// `overview` is the scene's word as 0.1.15 and 0.1.16 took it (FR-134): read as `scene`, which wins when both are said.
|
|
1006
1047
|
const { overview, ...rest } = given;
|
|
1007
1048
|
const e = rest.scene === undefined && overview !== undefined ? { ...rest, scene: overview } : rest;
|
|
1008
|
-
if (e.order === undefined && e.hide === undefined && e.first === undefined && e.scene === undefined && e.pages === undefined && e.primary === undefined)
|
|
1009
|
-
return this.fail(i, "", 'arrange-pages says at least one of "order", "hide", "first", "primary", "scene" or "
|
|
1049
|
+
if (e.order === undefined && e.hide === undefined && e.first === undefined && e.scene === undefined && e.pages === undefined && e.primary === undefined && e.filters === undefined)
|
|
1050
|
+
return this.fail(i, "", 'arrange-pages says at least one of "order", "hide", "first", "primary", "scene", "pages" or "filters"');
|
|
1051
|
+
for (const [kind, keys] of Object.entries((e.filters ?? {}))) {
|
|
1052
|
+
if (!this.doc.kinds[kind])
|
|
1053
|
+
return this.fail(i, `filters.${kind}`, `"${kind}" is not a kind this app has; it has ${Object.keys(this.doc.kinds).join(", ")}`);
|
|
1054
|
+
for (const [n, key] of (keys ?? []).entries()) {
|
|
1055
|
+
const offered = this.filterKeys(kind);
|
|
1056
|
+
if (!offered.includes(key))
|
|
1057
|
+
return this.fail(i, `filters.${kind}.${n}`, `${kind} cannot be filtered by "${key}"`, `name one of ${offered.join(", ")}`);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1010
1060
|
for (const [n, word] of (e.primary ?? []).entries()) {
|
|
1011
1061
|
if (typeof word !== "string" || !this.opens(word) || word.trim().toLowerCase() === "home") {
|
|
1012
1062
|
const titles = (this.doc.lenses ?? []).flatMap((lens) => (isObject(lens) && typeof lens["title"] === "string" ? [`"${lens["title"]}"`] : []));
|
|
@@ -1085,10 +1135,46 @@ class Editor {
|
|
|
1085
1135
|
said.push(`the switch calls the ${face} "${pages[face]}"`);
|
|
1086
1136
|
}
|
|
1087
1137
|
}
|
|
1138
|
+
for (const [kind, keys] of Object.entries((e.filters ?? {}))) {
|
|
1139
|
+
const lists = (pages.lists ??= {});
|
|
1140
|
+
if (keys === null || keys.length === 0) {
|
|
1141
|
+
delete lists[kind];
|
|
1142
|
+
said.push(`the list of ${pluralWords(this.doc, kind)} offers its own filters again`);
|
|
1143
|
+
}
|
|
1144
|
+
else {
|
|
1145
|
+
lists[kind] = { filters: [...keys] };
|
|
1146
|
+
said.push(`the list of ${pluralWords(this.doc, kind)} filters by ${listOf(keys.map((key) => `"${key}"`))}`);
|
|
1147
|
+
}
|
|
1148
|
+
if (Object.keys(lists).length === 0)
|
|
1149
|
+
delete pages.lists;
|
|
1150
|
+
}
|
|
1088
1151
|
if (Object.keys(pages).length === 0)
|
|
1089
1152
|
delete this.doc.pages;
|
|
1090
1153
|
this.said.push(`${capitalize(listOf(said))}.`);
|
|
1091
1154
|
}
|
|
1155
|
+
/** What a kind's list may be filtered by: its fields, its relations either way, `is`, and a choice at a relation's single far kind. */
|
|
1156
|
+
filterKeys(kind) {
|
|
1157
|
+
const kinds = this.doc.kinds;
|
|
1158
|
+
const keys = new Set(["is", ...Object.keys(kinds[kind]?.fields ?? {})]);
|
|
1159
|
+
const edges = new Map();
|
|
1160
|
+
for (const [edge, spec] of Object.entries((kinds[kind]?.edges ?? {})))
|
|
1161
|
+
edges.set(edge, spec.to === "*" ? [] : [spec.to].flat());
|
|
1162
|
+
for (const [other, spec] of Object.entries(kinds)) {
|
|
1163
|
+
for (const [edge, declared] of Object.entries((spec.edges ?? {}))) {
|
|
1164
|
+
if (other !== kind && !edges.has(edge) && (declared.to === "*" || [declared.to].flat().includes(kind)))
|
|
1165
|
+
edges.set(edge, [other]);
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
for (const [edge, far] of edges) {
|
|
1169
|
+
keys.add(edge);
|
|
1170
|
+
if (far.length !== 1 || far[0] === kind)
|
|
1171
|
+
continue;
|
|
1172
|
+
for (const [field, spec] of Object.entries((kinds[far[0]]?.fields ?? {})))
|
|
1173
|
+
if (spec.type === "enum")
|
|
1174
|
+
keys.add(`${edge}.${field}`);
|
|
1175
|
+
}
|
|
1176
|
+
return [...keys];
|
|
1177
|
+
}
|
|
1092
1178
|
/** Whether `first` names something the app can open on: home, a kind or its plural, a titled lens. */
|
|
1093
1179
|
opens(first) {
|
|
1094
1180
|
const word = first.trim();
|
|
@@ -1179,6 +1265,28 @@ class Editor {
|
|
|
1179
1265
|
delete spec.people;
|
|
1180
1266
|
this.said.push(peopleSentence(this.doc.kinds, e.kind, e.people, already));
|
|
1181
1267
|
}
|
|
1268
|
+
/** A kind's records kept or removed, never archived (FR-173) — or archived and merged again. */
|
|
1269
|
+
setArchives(i, e) {
|
|
1270
|
+
const spec = this.kind(i, e.kind);
|
|
1271
|
+
if (!spec)
|
|
1272
|
+
return;
|
|
1273
|
+
const already = (spec.archives !== false) === e.archives;
|
|
1274
|
+
if (!e.archives && !already) {
|
|
1275
|
+
// A grant that names one of the three acts would name an act the app no longer has.
|
|
1276
|
+
const gone = new Set(["archive", "unarchive", "merge"].map((verb) => `${verb}-${e.kind}`).filter((act) => !this.doc.acts?.[act]));
|
|
1277
|
+
const grant = (this.doc.policy?.grants ?? []).find((g) => Array.isArray(g.mutations) && g.mutations.some((m) => gone.has(m)));
|
|
1278
|
+
if (grant) {
|
|
1279
|
+
const named = grant.mutations.filter((m) => gone.has(m));
|
|
1280
|
+
return this.failAs("grant-unknown-mutation", i, "archives", `a grant names ${listOf(named.map((m) => `"${m}"`))}, which ${pluralOf(this.doc.kinds, e.kind)} would no longer have`, `{"op": "remove-grant", "roles": ${JSON.stringify(grant.roles)}, "mutations": ${JSON.stringify(grant.mutations)}} first, in the same change`);
|
|
1281
|
+
}
|
|
1282
|
+
spec.archives = false;
|
|
1283
|
+
}
|
|
1284
|
+
else if (e.archives)
|
|
1285
|
+
delete spec.archives;
|
|
1286
|
+
if (!already)
|
|
1287
|
+
this.toolsMoved.add(`archive-${e.kind}, unarchive-${e.kind} and merge-${e.kind} ${e.archives ? "are offered" : "are gone"}`);
|
|
1288
|
+
this.said.push(archivesSentence(this.doc.kinds, e.kind, e.archives, already));
|
|
1289
|
+
}
|
|
1182
1290
|
/** A grant or a sight as the document holds one, or undefined having said why not. */
|
|
1183
1291
|
policyPart(i, e, sight) {
|
|
1184
1292
|
const { op: _op, ...rest } = e;
|
|
@@ -1202,12 +1310,21 @@ class Editor {
|
|
|
1202
1310
|
if (!this.doc.kinds[kind])
|
|
1203
1311
|
return this.failAs(sight ? "sight-kind" : "edit", i, `kinds.${n}`, `"${kind}" is not a kind this app has; it has ${Object.keys(this.doc.kinds).join(", ")}`);
|
|
1204
1312
|
}
|
|
1313
|
+
// A field a sight shows or hides is one of the kinds it shows (Roadmap f-field-sight).
|
|
1314
|
+
for (const key of sight ? ["fields", "hide"] : []) {
|
|
1315
|
+
for (const [n, field] of (part[key] ?? []).entries()) {
|
|
1316
|
+
const kinds = part.kinds;
|
|
1317
|
+
if (kinds.some((kind) => this.doc.kinds[kind]?.fields[field]))
|
|
1318
|
+
continue;
|
|
1319
|
+
return this.failAs("sight-field", i, `${key}.${n}`, `"${field}" is not a field of ${kinds.join(" or ")}`, `one of ${[...new Set(kinds.flatMap((kind) => Object.keys(this.doc.kinds[kind]?.fields ?? {})))].join(", ")}`);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1205
1322
|
if (!sight && part.mutations !== "*") {
|
|
1206
1323
|
for (const [n, act] of part.mutations.entries()) {
|
|
1207
|
-
const derived =
|
|
1208
|
-
if (this.doc.acts?.[act] || (derived && this.doc.kinds[derived[
|
|
1324
|
+
const derived = derivedActOf(act);
|
|
1325
|
+
if (this.doc.acts?.[act] || (derived && this.doc.kinds[derived.kind] && (this.doc.kinds[derived.kind].archives !== false || givenWhenNeverArchived(derived.act))))
|
|
1209
1326
|
continue;
|
|
1210
|
-
return this.failAs("grant-act", i, `mutations.${n}`, `"${act}" is not an act this app has`, `one of ${[...Object.keys(this.doc.acts ?? {}), ...Object.keys(this.doc.kinds).flatMap(
|
|
1327
|
+
return this.failAs("grant-act", i, `mutations.${n}`, `"${act}" is not an act this app has`, `one of ${[...Object.keys(this.doc.acts ?? {}), ...Object.keys(this.doc.kinds).flatMap(derivedActsOf)].join(", ")}`);
|
|
1211
1328
|
}
|
|
1212
1329
|
}
|
|
1213
1330
|
const said = [];
|
|
@@ -1306,8 +1423,8 @@ class Editor {
|
|
|
1306
1423
|
const to = e.to;
|
|
1307
1424
|
const touched = this.rewriteAll({ t: "kind", from, to });
|
|
1308
1425
|
// The acts the framework derives for every kind are named for it, so they move with it.
|
|
1309
|
-
|
|
1310
|
-
|
|
1426
|
+
for (const act of DERIVED_ACTS)
|
|
1427
|
+
this.toolsMoved.add(`${act}-${from} is now ${act}-${to}`);
|
|
1311
1428
|
// The kind itself, in order, continuing its records.
|
|
1312
1429
|
const kinds = {};
|
|
1313
1430
|
for (const [k, v] of Object.entries(this.doc.kinds))
|
|
@@ -1424,7 +1541,7 @@ class Editor {
|
|
|
1424
1541
|
* whose last act is removed — kept, it read as a grant on every kind.
|
|
1425
1542
|
*/
|
|
1426
1543
|
if (this.doc.policy) {
|
|
1427
|
-
const derived =
|
|
1544
|
+
const derived = derivedActsOf(kind);
|
|
1428
1545
|
this.doc.policy.grants = this.doc.policy.grants.flatMap((g) => {
|
|
1429
1546
|
const kinds = Array.isArray(g.kinds) ? g.kinds.filter((k) => k !== kind) : g.kinds;
|
|
1430
1547
|
const mutations = Array.isArray(g.mutations) ? g.mutations.filter((m) => !derived.includes(m) || this.doc.acts?.[m]) : g.mutations;
|
|
@@ -1491,6 +1608,8 @@ class Editor {
|
|
|
1491
1608
|
delete f.renamedFrom;
|
|
1492
1609
|
if (f.type === "enum" && f.default !== undefined && !f.options.includes(f.default))
|
|
1493
1610
|
return this.fail(i, "default", `"${String(f.default)}" is not one of the options`);
|
|
1611
|
+
if (f.format && !formatFits(f.format, f.type))
|
|
1612
|
+
return this.fail(i, "format", refusedFormat(f.format, f.type));
|
|
1494
1613
|
spec.fields[field] = f;
|
|
1495
1614
|
this.fieldOrigin.set(`${kind}.${field}`, undefined);
|
|
1496
1615
|
let filled = "";
|
|
@@ -1510,7 +1629,9 @@ class Editor {
|
|
|
1510
1629
|
filled = `, set to ${JSON.stringify(fill)} on the records already there`;
|
|
1511
1630
|
}
|
|
1512
1631
|
}
|
|
1513
|
-
|
|
1632
|
+
// What it is said as, in words: "(number, money in USD — 10000 reads $10,000)".
|
|
1633
|
+
const said = formatWords(f, this.doc.brand);
|
|
1634
|
+
this.said.push(`${kind} gains a field, ${field} (${f.type}${said ? `, ${said}` : ""}${f.required ? ", required" : ""})${filled}.`);
|
|
1514
1635
|
}
|
|
1515
1636
|
renameField(i, kind, field, to) {
|
|
1516
1637
|
const f = this.field(i, kind, field);
|
|
@@ -1572,6 +1693,9 @@ class Editor {
|
|
|
1572
1693
|
return;
|
|
1573
1694
|
if (e.type === "enum" && !e.options && !f.options)
|
|
1574
1695
|
return this.fail(i, "options", `to make ${e.field} a choice, list its "options"`);
|
|
1696
|
+
// A format goes where it says something (FR-180): money, a percent and a duration on a number, Markdown on a text field.
|
|
1697
|
+
if (e.format && !formatFits(e.format, e.type))
|
|
1698
|
+
return this.fail(i, "format", refusedFormat(e.format, e.type));
|
|
1575
1699
|
const was = f.type;
|
|
1576
1700
|
f.type = e.type;
|
|
1577
1701
|
if (e.type === "enum")
|
|
@@ -1584,25 +1708,69 @@ class Editor {
|
|
|
1584
1708
|
delete f.of;
|
|
1585
1709
|
if (e.format)
|
|
1586
1710
|
f.format = e.format;
|
|
1587
|
-
else if (e.type
|
|
1711
|
+
else if (e.type === "text" || !formatFits(f.format ?? "", e.type))
|
|
1588
1712
|
delete f.format;
|
|
1589
1713
|
// A range is a number's (FR-114): a field that is no longer one lets it go.
|
|
1590
|
-
if (e.type !== "number" && e.type !== "integer")
|
|
1714
|
+
if (e.type !== "number" && e.type !== "integer" && e.type !== "duration")
|
|
1591
1715
|
for (const key of ["min", "max", "step"])
|
|
1592
1716
|
delete f[key];
|
|
1717
|
+
// Only a date repeats: a field that is no longer one lets its repeat go.
|
|
1718
|
+
if (e.type !== "date" && e.type !== "datetime")
|
|
1719
|
+
delete f.repeats;
|
|
1593
1720
|
if (f.default !== undefined && coerce(f.default, was, f) === undefined)
|
|
1594
1721
|
delete f.default;
|
|
1595
1722
|
else if (f.default !== undefined)
|
|
1596
1723
|
f.default = coerce(f.default, was, f);
|
|
1597
|
-
|
|
1724
|
+
const said = f.format && f.format !== "markdown" ? formatWords(f, this.doc.brand) : undefined;
|
|
1725
|
+
if (was === e.type && e.type === "text")
|
|
1726
|
+
this.said.push(`${e.kind}'s ${e.field} ${e.format === "markdown" ? "is now written in Markdown, drawn as prose on the record's page" : "is drawn as written, not as Markdown"}; its values are kept.`);
|
|
1727
|
+
else
|
|
1728
|
+
this.said.push(`${e.kind}'s ${e.field} changes from ${was} to ${e.type}${said ? `, said as ${said}` : ""}; values that convert are kept.`);
|
|
1729
|
+
}
|
|
1730
|
+
/**
|
|
1731
|
+
* HOW A FIELD IS SAID, and nothing else about it: a number's `format`
|
|
1732
|
+
* (money, a percent, a duration) and `unit` (a currency like "EUR" for
|
|
1733
|
+
* money, a measure like "kg"), or a text field's `format`, `markdown`
|
|
1734
|
+
* (FR-180) — each set by a value, cleared by `null`, kept when left out.
|
|
1735
|
+
* The values stay as they are; every face says them anew.
|
|
1736
|
+
*/
|
|
1737
|
+
setFormat(i, e) {
|
|
1738
|
+
const f = this.field(i, e.kind, e.field);
|
|
1739
|
+
if (!f)
|
|
1740
|
+
return;
|
|
1741
|
+
if (e.format === undefined && e.unit === undefined)
|
|
1742
|
+
return this.fail(i, "format", 'say a "format" ("money", "percent" or "duration" for a number, "markdown" for a text field, or null for neither), a "unit" ("EUR", "kg", or null), or both');
|
|
1743
|
+
if (f.type === "text") {
|
|
1744
|
+
if (e.unit !== undefined && e.unit !== null)
|
|
1745
|
+
return this.fail(i, "unit", refusedFormat("a unit", f.type));
|
|
1746
|
+
if (e.format && e.format !== "markdown")
|
|
1747
|
+
return this.fail(i, "format", refusedFormat(e.format, f.type));
|
|
1748
|
+
if (e.format === "markdown")
|
|
1749
|
+
f.format = "markdown";
|
|
1750
|
+
else if (e.format === null)
|
|
1751
|
+
delete f.format;
|
|
1752
|
+
this.said.push(`${e.kind}'s ${e.field} ${f.format === "markdown" ? "is now written in Markdown, drawn as prose on the record's page" : "is drawn as written, not as Markdown"}; its values are kept.`);
|
|
1753
|
+
return;
|
|
1754
|
+
}
|
|
1755
|
+
if (!formatFits(typeof e.format === "string" ? e.format : "money", f.type))
|
|
1756
|
+
return this.fail(i, "field", refusedFormat(typeof e.format === "string" ? e.format : "a unit", f.type));
|
|
1757
|
+
const before = formatWords(f, this.doc.brand);
|
|
1758
|
+
for (const key of ["format", "unit"]) {
|
|
1759
|
+
if (e[key] === null)
|
|
1760
|
+
delete f[key];
|
|
1761
|
+
else if (e[key] !== undefined)
|
|
1762
|
+
f[key] = e[key];
|
|
1763
|
+
}
|
|
1764
|
+
const now = formatWords(f, this.doc.brand);
|
|
1765
|
+
this.said.push(`${e.kind}'s ${e.field} is said as ${now ?? "a plain number"}${before ? `, where it was ${before.replace(/ — .*/, "")}` : ""}; its values are kept.`);
|
|
1598
1766
|
}
|
|
1599
1767
|
/** A number's range (FR-114): a key given sets it, `null` clears it, one left out stays. */
|
|
1600
1768
|
setRange(i, e) {
|
|
1601
1769
|
const f = this.field(i, e.kind, e.field);
|
|
1602
1770
|
if (!f)
|
|
1603
1771
|
return;
|
|
1604
|
-
if (f.type !== "number" && f.type !== "integer")
|
|
1605
|
-
return this.fail(i, "field", `${e.field} is ${f.type === "integer" ? "an" : "a"} ${f.type}, not a number; a range belongs on a number or
|
|
1772
|
+
if (f.type !== "number" && f.type !== "integer" && f.type !== "duration")
|
|
1773
|
+
return this.fail(i, "field", `${e.field} is ${f.type === "integer" ? "an" : "a"} ${f.type}, not a number; a range belongs on a number, integer or duration field`);
|
|
1606
1774
|
const next = { ...f };
|
|
1607
1775
|
for (const key of ["min", "max", "step"]) {
|
|
1608
1776
|
if (e[key] === null)
|
|
@@ -2025,7 +2193,7 @@ class Editor {
|
|
|
2025
2193
|
rule.over = r.to;
|
|
2026
2194
|
for (const rep of rule.repairs ?? []) {
|
|
2027
2195
|
if (r.t === "kind")
|
|
2028
|
-
rep.act = rep.act
|
|
2196
|
+
rep.act = renamedAct(rep.act, r.from, r.to);
|
|
2029
2197
|
const args = renamedArgs.get(rep.act);
|
|
2030
2198
|
if (args && rep.args)
|
|
2031
2199
|
for (const [a, b] of args)
|
|
@@ -2052,7 +2220,7 @@ class Editor {
|
|
|
2052
2220
|
if (Array.isArray(g.kinds))
|
|
2053
2221
|
g.kinds = g.kinds.map(swap);
|
|
2054
2222
|
if (Array.isArray(g.mutations))
|
|
2055
|
-
g.mutations = g.mutations.map((m) => (m
|
|
2223
|
+
g.mutations = g.mutations.map((m) => renamedAct(m, r.from, r.to));
|
|
2056
2224
|
}
|
|
2057
2225
|
for (const s of doc.policy.sees ?? [])
|
|
2058
2226
|
s.kinds = s.kinds.map(swap);
|
|
@@ -2808,4 +2976,9 @@ export function renameIn(kinds, over, text, change) {
|
|
|
2808
2976
|
return rewriteTemplate(doc, text.template, ctx, r);
|
|
2809
2977
|
return undefined;
|
|
2810
2978
|
}
|
|
2979
|
+
/** A derived act of a renamed kind, renamed with it: `archive-task` becomes `archive-chore`. Any other act as it was. */
|
|
2980
|
+
function renamedAct(act, from, to) {
|
|
2981
|
+
const derived = derivedActOf(act);
|
|
2982
|
+
return derived && derived.kind === from ? `${derived.act}-${to}` : act;
|
|
2983
|
+
}
|
|
2811
2984
|
//# sourceMappingURL=edit.js.map
|