@graview/core 0.2.3 → 0.2.5
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/dist/across-copies.d.ts +3 -0
- package/dist/across-copies.d.ts.map +1 -0
- package/dist/across-copies.js +39 -0
- package/dist/across-copies.js.map +1 -0
- package/dist/binding-served.d.ts +11 -2
- package/dist/binding-served.d.ts.map +1 -1
- package/dist/binding-served.js +19 -0
- package/dist/binding-served.js.map +1 -1
- package/dist/binding.d.ts +25 -0
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +128 -19
- package/dist/binding.js.map +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +37 -1
- package/dist/catalog.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/cited.d.ts +55 -0
- package/dist/cited.d.ts.map +1 -0
- package/dist/cited.js +48 -0
- package/dist/cited.js.map +1 -0
- package/dist/cli/check/cites.d.ts +4 -0
- package/dist/cli/check/cites.d.ts.map +1 -0
- package/dist/cli/check/cites.js +35 -0
- package/dist/cli/check/cites.js.map +1 -0
- package/dist/cli/check/context-of.d.ts +12 -0
- package/dist/cli/check/context-of.d.ts.map +1 -0
- package/dist/cli/check/context-of.js +25 -0
- package/dist/cli/check/context-of.js.map +1 -0
- package/dist/cli/check/index.d.ts +1 -0
- package/dist/cli/check/index.d.ts.map +1 -1
- package/dist/cli/check/index.js +1 -0
- package/dist/cli/check/index.js.map +1 -1
- package/dist/cli/check/policy.d.ts.map +1 -1
- package/dist/cli/check/policy.js +28 -3
- package/dist/cli/check/policy.js.map +1 -1
- package/dist/cli/check.d.ts.map +1 -1
- package/dist/cli/check.js +4 -12
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +42 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/compose-change.d.ts +33 -0
- package/dist/compose-change.d.ts.map +1 -0
- package/dist/compose-change.js +43 -0
- package/dist/compose-change.js.map +1 -0
- package/dist/compose-home.d.ts +46 -6
- package/dist/compose-home.d.ts.map +1 -1
- package/dist/compose-home.js +189 -47
- package/dist/compose-home.js.map +1 -1
- package/dist/compose.d.ts +6 -4
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +18 -39
- package/dist/compose.js.map +1 -1
- package/dist/composer-check.d.ts +16 -0
- package/dist/composer-check.d.ts.map +1 -0
- package/dist/composer-check.js +48 -0
- package/dist/composer-check.js.map +1 -0
- package/dist/composer.d.ts +19 -0
- package/dist/composer.d.ts.map +1 -0
- package/dist/composer.js +49 -0
- package/dist/composer.js.map +1 -0
- package/dist/css/faces-words.d.ts.map +1 -1
- package/dist/css/faces-words.js +2 -0
- package/dist/css/faces-words.js.map +1 -1
- package/dist/css/faces.d.ts +1 -1
- package/dist/css/faces.d.ts.map +1 -1
- package/dist/css/sanitize.d.ts +5 -1
- package/dist/css/sanitize.d.ts.map +1 -1
- package/dist/css/sanitize.js +16 -1
- package/dist/css/sanitize.js.map +1 -1
- package/dist/document/compile.d.ts.map +1 -1
- package/dist/document/compile.js +5 -2
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +6 -0
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/design-findings.d.ts.map +1 -1
- package/dist/document/design-findings.js +2 -1
- package/dist/document/design-findings.js.map +1 -1
- package/dist/document/edit.d.ts +1 -1
- package/dist/document/edit.d.ts.map +1 -1
- package/dist/document/edit.js +184 -152
- package/dist/document/edit.js.map +1 -1
- package/dist/document/expr/evaluate.d.ts +3 -1
- package/dist/document/expr/evaluate.d.ts.map +1 -1
- package/dist/document/expr/evaluate.js +29 -1
- package/dist/document/expr/evaluate.js.map +1 -1
- package/dist/document/expr/typing.d.ts.map +1 -1
- package/dist/document/expr/typing.js +1 -0
- package/dist/document/expr/typing.js.map +1 -1
- package/dist/document/field-spec.d.ts.map +1 -1
- package/dist/document/field-spec.js +6 -1
- package/dist/document/field-spec.js.map +1 -1
- package/dist/document/format-findings.d.ts.map +1 -1
- package/dist/document/format-findings.js +8 -0
- package/dist/document/format-findings.js.map +1 -1
- package/dist/document/instantiate-template.d.ts.map +1 -1
- package/dist/document/instantiate-template.js +16 -1
- package/dist/document/instantiate-template.js.map +1 -1
- package/dist/document/rules.d.ts.map +1 -1
- package/dist/document/rules.js +4 -0
- package/dist/document/rules.js.map +1 -1
- package/dist/document/schema.d.ts +5 -0
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +7 -0
- package/dist/document/schema.js.map +1 -1
- package/dist/document/uncited-findings.d.ts +9 -0
- package/dist/document/uncited-findings.d.ts.map +1 -0
- package/dist/document/uncited-findings.js +10 -0
- package/dist/document/uncited-findings.js.map +1 -0
- package/dist/document.schema.json +12 -2
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +4 -0
- package/dist/graph/graph.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/mutations/define-mutation.d.ts +8 -0
- package/dist/mutations/define-mutation.d.ts.map +1 -1
- package/dist/mutations/define-mutation.js +23 -1
- package/dist/mutations/define-mutation.js.map +1 -1
- package/dist/mutations/invalid-arguments.d.ts.map +1 -1
- package/dist/mutations/invalid-arguments.js +3 -0
- package/dist/mutations/invalid-arguments.js.map +1 -1
- package/dist/ops/revisions.d.ts.map +1 -1
- package/dist/ops/revisions.js +10 -3
- package/dist/ops/revisions.js.map +1 -1
- package/dist/ops/undo.d.ts.map +1 -1
- package/dist/ops/undo.js +49 -1
- package/dist/ops/undo.js.map +1 -1
- package/dist/permissions/policy.d.ts +19 -18
- package/dist/permissions/policy.d.ts.map +1 -1
- package/dist/permissions/policy.js +27 -22
- package/dist/permissions/policy.js.map +1 -1
- package/dist/permissions/types.d.ts.map +1 -1
- package/dist/permissions/types.js +3 -0
- package/dist/permissions/types.js.map +1 -1
- package/dist/persistence/memory.d.ts.map +1 -1
- package/dist/persistence/memory.js +6 -0
- package/dist/persistence/memory.js.map +1 -1
- package/dist/persistence/sql.d.ts.map +1 -1
- package/dist/persistence/sql.js +18 -0
- package/dist/persistence/sql.js.map +1 -1
- package/dist/persistence/types.d.ts +10 -0
- package/dist/persistence/types.d.ts.map +1 -1
- package/dist/refused.d.ts.map +1 -1
- package/dist/refused.js +3 -0
- package/dist/refused.js.map +1 -1
- package/dist/schema/cites.d.ts +30 -0
- package/dist/schema/cites.d.ts.map +1 -0
- package/dist/schema/cites.js +70 -0
- package/dist/schema/cites.js.map +1 -0
- package/dist/schema/files.d.ts +28 -0
- package/dist/schema/files.d.ts.map +1 -1
- package/dist/schema/files.js +13 -1
- package/dist/schema/files.js.map +1 -1
- package/dist/schema/reading.d.ts.map +1 -1
- package/dist/schema/reading.js +3 -2
- package/dist/schema/reading.js.map +1 -1
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +3 -0
- package/dist/schema/schema.js.map +1 -1
- package/dist/seen.d.ts +8 -0
- package/dist/seen.d.ts.map +1 -1
- package/dist/seen.js +6 -4
- package/dist/seen.js.map +1 -1
- package/dist/store.d.ts +12 -5
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +74 -35
- package/dist/store.js.map +1 -1
- package/dist/tidying.d.ts +2 -0
- package/dist/tidying.d.ts.map +1 -1
- package/dist/tidying.js +2 -0
- package/dist/tidying.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/views/types.d.ts +7 -0
- package/dist/views/types.d.ts.map +1 -1
- package/dist/views/types.js.map +1 -1
- package/dist/who.d.ts.map +1 -1
- package/dist/who.js +7 -3
- package/dist/who.js.map +1 -1
- package/package.json +5 -1
package/dist/document/edit.js
CHANGED
|
@@ -2,7 +2,7 @@ import { BIND_PERSON } from "../binding-served.js";
|
|
|
2
2
|
import { BINDING_UNGRANTED } from "../binding-ungranted.js";
|
|
3
3
|
import { DERIVED_ACTS, derivedActOf, derivedActsOf, givenWhenNeverArchived, givenWhenNeverTidied, RELATION_ACTS, relationActName, relationActsOf } from "../mutations/derived-names.js";
|
|
4
4
|
import { documentRelations, givesRelationAct, renamedRelationAct } from "./relation-acts.js";
|
|
5
|
-
import * as z from "zod";
|
|
5
|
+
import * as z from "../schema/zod.js";
|
|
6
6
|
import { ExprSyntaxError, parseExpr } from "./expr/parse.js";
|
|
7
7
|
import { printExpr } from "./expr/print.js";
|
|
8
8
|
import { dollarOf, SUBJECT_NAME } from "./expr/subject.js";
|
|
@@ -68,6 +68,7 @@ export const EDIT_OPS = [
|
|
|
68
68
|
"set-required",
|
|
69
69
|
"set-default",
|
|
70
70
|
"set-repeats",
|
|
71
|
+
"set-cites",
|
|
71
72
|
"remove-field",
|
|
72
73
|
"add-relation",
|
|
73
74
|
"rename-relation",
|
|
@@ -129,204 +130,187 @@ const VIEW_NAME = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
|
129
130
|
* never edits one does not build sixty zod schemas to get there.
|
|
130
131
|
*/
|
|
131
132
|
function buildShapes() {
|
|
132
|
-
const kindName = z.string().regex(NAME, 'kind names are lower-case words joined by hyphens, like "guest-list"');
|
|
133
|
-
const listKey = z.string().
|
|
134
|
-
const listDirection = z.enum(["asc", "desc"])
|
|
135
|
-
const listSortShape = z.union([listKey, z.
|
|
136
|
-
const listGroupShape = z.union([listKey, z.
|
|
137
|
-
const fieldName = z.string().regex(FIELD_NAME, 'field names are one word or camelCase, like "dueDate"');
|
|
138
|
-
const edgeName = z.string().regex(EDGE_NAME, 'relation names are one camelCase word, like "tendedBy"');
|
|
139
|
-
const actName = z.string().regex(NAME, 'act names are lower-case words joined by hyphens, like "mark-paid"');
|
|
140
|
-
const lensTitle = z.string().
|
|
141
|
-
const jobName = z.string().regex(NAME, 'job names are lower-case words joined by hyphens, like "unbooked-soon"');
|
|
133
|
+
const kindName = z.string().check(z.regex(NAME, 'kind names are lower-case words joined by hyphens, like "guest-list"'));
|
|
134
|
+
const listKey = z.string().check(z.minLength(1), z.maxLength(120));
|
|
135
|
+
const listDirection = z.optional(z.enum(["asc", "desc"]));
|
|
136
|
+
const listSortShape = z.union([listKey, z.strictObject({ by: listKey, direction: listDirection, then: z.optional(z.union([listKey, z.strictObject({ by: listKey, direction: listDirection })])) })]);
|
|
137
|
+
const listGroupShape = z.union([listKey, z.strictObject({ by: listKey, order: z.optional(z.array(z.string().check(z.minLength(1), z.maxLength(80))).check(z.maxLength(40))), closed: z.optional(z.array(z.string().check(z.minLength(1), z.maxLength(80))).check(z.maxLength(40))) })]);
|
|
138
|
+
const fieldName = z.string().check(z.regex(FIELD_NAME, 'field names are one word or camelCase, like "dueDate"'));
|
|
139
|
+
const edgeName = z.string().check(z.regex(EDGE_NAME, 'relation names are one camelCase word, like "tendedBy"'));
|
|
140
|
+
const actName = z.string().check(z.regex(NAME, 'act names are lower-case words joined by hyphens, like "mark-paid"'));
|
|
141
|
+
const lensTitle = z.string().check(z.minLength(1), z.maxLength(80));
|
|
142
|
+
const jobName = z.string().check(z.regex(NAME, 'job names are lower-case words joined by hyphens, like "unbooked-soon"'));
|
|
142
143
|
return {
|
|
143
|
-
"add-kind": z.
|
|
144
|
-
"rename-kind": z.
|
|
145
|
-
"remove-kind": z.
|
|
146
|
-
"add-field": z.
|
|
147
|
-
"rename-field": z.
|
|
148
|
-
"retype-field": z.
|
|
149
|
-
"set-options": z.
|
|
150
|
-
"set-format": z.
|
|
151
|
-
"set-range": z.
|
|
152
|
-
"set-required": z.
|
|
153
|
-
"set-default": z.
|
|
154
|
-
"set-repeats": z.
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
|
|
144
|
+
"add-kind": z.looseObject({ op: z.literal("add-kind"), kind: kindName, act: z.optional(z.boolean()) }),
|
|
145
|
+
"rename-kind": z.strictObject({ op: z.literal("rename-kind"), kind: kindName, to: kindName, noun: z.optional(z.string().check(z.minLength(1), z.maxLength(40))), plural: z.optional(z.string().check(z.minLength(1), z.maxLength(40))) }),
|
|
146
|
+
"remove-kind": z.strictObject({ op: z.literal("remove-kind"), kind: kindName }),
|
|
147
|
+
"add-field": z.looseObject({ op: z.literal("add-field"), kind: kindName, field: fieldName, fill: z.optional(z.unknown()), spec: z.optional(z.record(z.string(), z.unknown())) }),
|
|
148
|
+
"rename-field": z.strictObject({ op: z.literal("rename-field"), kind: kindName, field: fieldName, to: fieldName }),
|
|
149
|
+
"retype-field": z.strictObject({ op: z.literal("retype-field"), kind: kindName, field: fieldName, type: z.enum(FIELD_TYPES), options: z.optional(z.array(z.string().check(z.minLength(1), z.maxLength(80))).check(z.minLength(1), z.maxLength(100))), multiple: z.optional(z.boolean()), of: z.optional(z.enum(["string", "number", "date", "image", "video", "file"])), format: z.optional(z.enum(["money", "percent", "duration", "markdown"])) }),
|
|
150
|
+
"set-options": z.strictObject({ op: z.literal("set-options"), kind: kindName, field: fieldName, add: z.optional(z.array(z.string().check(z.minLength(1), z.maxLength(80)))), remove: z.optional(z.array(z.string().check(z.minLength(1), z.maxLength(80)))), labels: z.optional(z.record(z.string().check(z.minLength(1), z.maxLength(80)), z.union([z.string().check(z.minLength(1), z.maxLength(80)), z.null()]))) }),
|
|
151
|
+
"set-format": z.strictObject({ op: z.literal("set-format"), kind: kindName, field: fieldName, format: z.optional(z.union([z.enum(["money", "percent", "duration", "markdown"]), z.null()])), unit: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(12)), z.null()])), places: z.optional(z.union([z.literal(0), z.null()])) }),
|
|
152
|
+
"set-range": z.strictObject({ op: z.literal("set-range"), kind: kindName, field: fieldName, min: z.optional(z.union([z.number(), z.null()])), max: z.optional(z.union([z.number(), z.null()])), step: z.optional(z.union([z.number().check(z.positive()), z.null()])) }),
|
|
153
|
+
"set-required": z.strictObject({ op: z.literal("set-required"), kind: kindName, field: fieldName, required: z.boolean() }),
|
|
154
|
+
"set-default": z.strictObject({ op: z.literal("set-default"), kind: kindName, field: fieldName, default: z.unknown() }),
|
|
155
|
+
"set-repeats": z.strictObject({ op: z.literal("set-repeats"), kind: kindName, field: fieldName, repeats: z.boolean() }),
|
|
156
|
+
"set-cites": z.strictObject({ op: z.literal("set-cites"), kind: kindName, field: fieldName, cites: z.union([z.string().check(z.minLength(1), z.maxLength(80)), z.null()]) }),
|
|
157
|
+
"remove-field": z.strictObject({ op: z.literal("remove-field"), kind: kindName, field: fieldName }),
|
|
158
|
+
"add-relation": z.looseObject({ op: z.literal("add-relation"), kind: kindName, relation: edgeName }),
|
|
159
|
+
"rename-relation": z.strictObject({ op: z.literal("rename-relation"), kind: kindName, relation: edgeName, to: edgeName }),
|
|
160
|
+
"remove-relation": z.strictObject({ op: z.literal("remove-relation"), kind: kindName, relation: edgeName }),
|
|
161
|
+
"add-act": z.looseObject({ op: z.literal("add-act"), act: actName, replace: z.optional(z.boolean()) }),
|
|
162
|
+
"remove-act": z.strictObject({ op: z.literal("remove-act"), act: actName }),
|
|
163
|
+
"add-rule": z.looseObject({ op: z.literal("add-rule"), rule: actName, replace: z.optional(z.boolean()) }),
|
|
164
|
+
"remove-rule": z.strictObject({ op: z.literal("remove-rule"), rule: actName }),
|
|
165
|
+
"set-brand": z.strictObject({
|
|
165
166
|
op: z.literal("set-brand"),
|
|
166
|
-
accent: z.union([z.string(), z.null()])
|
|
167
|
+
accent: z.optional(z.union([z.string(), z.null()])),
|
|
167
168
|
// The page background (Roadmap f-brand-ground): one color, or one for each scheme; null for Graview's.
|
|
168
|
-
ground: z.union([z.string(), z.
|
|
169
|
-
name: z.union([z.string().
|
|
170
|
-
currency: z.union([z.string(), z.null()])
|
|
171
|
-
locale: z.union([z.string(), z.null()])
|
|
169
|
+
ground: z.optional(z.union([z.string(), z.strictObject({ light: z.optional(z.string()), dark: z.optional(z.string()) }), z.null()])),
|
|
170
|
+
name: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(60)), z.null()])),
|
|
171
|
+
currency: z.optional(z.union([z.string(), z.null()])),
|
|
172
|
+
locale: z.optional(z.union([z.string(), z.null()])),
|
|
172
173
|
// An IANA time zone its instants are said in (Roadmap f-app-time-zone).
|
|
173
|
-
timeZone: z.union([z.string().
|
|
174
|
+
timeZone: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(64)), z.null()])),
|
|
174
175
|
// The rest of the brand (FR-124, FR-125): each as the document holds it, null to clear it.
|
|
175
|
-
logo: z
|
|
176
|
-
.
|
|
177
|
-
z.string().
|
|
178
|
-
z.object({ src: z.string().min(1), alt: z.string().min(1).max(120).optional() }).strict(),
|
|
176
|
+
logo: z.optional(z.union([
|
|
177
|
+
z.string().check(z.minLength(1)),
|
|
178
|
+
z.strictObject({ src: z.string().check(z.minLength(1)), alt: z.optional(z.string().check(z.minLength(1), z.maxLength(120))) }),
|
|
179
179
|
// One for each scheme; with no dark one, `darkFallback: "invert"` asks for the light one inverted in the dark.
|
|
180
|
-
z.
|
|
180
|
+
z.strictObject({ light: z.string().check(z.minLength(1)), dark: z.optional(z.string().check(z.minLength(1))), alt: z.optional(z.string().check(z.minLength(1), z.maxLength(120))), darkFallback: z.optional(z.literal("invert")) }),
|
|
181
181
|
z.null(),
|
|
182
|
-
])
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
scheme: z.union([z.enum(["light", "dark", "auto"]), z.null()]).optional(),
|
|
182
|
+
])),
|
|
183
|
+
favicon: z.optional(z.union([z.string().check(z.minLength(1)), z.strictObject({ emoji: z.string() }), z.null()])),
|
|
184
|
+
typography: z.optional(z.union([z.strictObject({ display: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(200)), z.null()])), body: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(200)), z.null()])), mono: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(200)), z.null()])) }), z.null()])),
|
|
185
|
+
shape: z.optional(z.union([z.strictObject({ radius: z.optional(z.union([z.number().check(z.gte(0), z.lte(32)), z.null()])), density: z.optional(z.union([z.number().check(z.gte(0.75), z.lte(1.5)), z.null()])) }), z.null()])),
|
|
186
|
+
accents: z.optional(z.union([z.record(z.string(), z.union([z.number().check(z.gte(0), z.lte(360)), z.null()])), z.null()])),
|
|
187
|
+
scheme: z.optional(z.union([z.enum(["light", "dark", "auto"]), z.null()])),
|
|
189
188
|
// Whether the home draws the description as the line under the name (Roadmap f-home-subtitle-separate): false keeps it off, true or null draws it again.
|
|
190
|
-
subtitle: z.union([z.boolean(), z.null()])
|
|
189
|
+
subtitle: z.optional(z.union([z.boolean(), z.null()])),
|
|
191
190
|
// The opening screen (Roadmap f-splash-in-document), whole; null for Graview's own.
|
|
192
|
-
splash: z.union([z.
|
|
191
|
+
splash: z.optional(z.union([z.strictObject({ style: z.string(), image: z.optional(z.string().check(z.minLength(1))), title: z.optional(z.string().check(z.minLength(1), z.maxLength(80))), kicker: z.optional(z.string().check(z.minLength(1), z.maxLength(80))), shader: z.optional(z.string().check(z.minLength(1), z.maxLength(40))), scheme: z.optional(z.enum(["light", "dark", "device"])) }), z.null()])),
|
|
193
192
|
// What every worker view inherits (Roadmap f-app-wide-view-theme): a stylesheet that wins over each view's own (its length the sanitizer's to refuse, in `brandFindings`), and a fade between records; null clears either, or all of it.
|
|
194
|
-
views: z
|
|
195
|
-
.
|
|
196
|
-
|
|
197
|
-
.
|
|
198
|
-
css: z.union([z.string().min(1), z.null()]).optional(),
|
|
199
|
-
motion: z.union([z.enum(["none", "fade"]), z.null()]).optional(),
|
|
193
|
+
views: z.optional(z.union([
|
|
194
|
+
z.strictObject({
|
|
195
|
+
css: z.optional(z.union([z.string().check(z.minLength(1)), z.null()])),
|
|
196
|
+
motion: z.optional(z.union([z.enum(["none", "fade"]), z.null()])),
|
|
200
197
|
// The faces it lends its views, whole (Roadmap f-view-authoring-friction-2026-11); judged by `brandFindings` (brand-views-font) as the stylesheet is.
|
|
201
|
-
fonts: z.union([z.array(z.
|
|
202
|
-
})
|
|
203
|
-
.strict(),
|
|
198
|
+
fonts: z.optional(z.union([z.array(z.strictObject({ family: z.string().check(z.minLength(1)), src: z.string().check(z.minLength(1)), weight: z.optional(z.union([z.number(), z.string()])), style: z.optional(z.enum(["normal", "italic"])) })), z.null()])),
|
|
199
|
+
}),
|
|
204
200
|
z.null(),
|
|
205
|
-
])
|
|
206
|
-
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
"set-
|
|
210
|
-
"set-
|
|
211
|
-
"set-label": z.object({ op: z.literal("set-label"), kind: kindName, field: fieldName.optional(), label: z.union([z.string().min(1).max(300), z.null()]) }).strict(),
|
|
212
|
-
"set-describe": z.object({ op: z.literal("set-describe"), kind: kindName, describe: z.union([z.string().min(1).max(300), z.null()]) }).strict(),
|
|
201
|
+
])),
|
|
202
|
+
}),
|
|
203
|
+
"set-name": z.strictObject({ op: z.literal("set-name"), name: z.string().check(z.minLength(1), z.maxLength(80)) }),
|
|
204
|
+
"set-description": z.strictObject({ op: z.literal("set-description"), description: z.union([z.string().check(z.minLength(1), z.maxLength(500)), z.null()]) }),
|
|
205
|
+
"set-label": z.strictObject({ op: z.literal("set-label"), kind: kindName, field: z.optional(fieldName), label: z.union([z.string().check(z.minLength(1), z.maxLength(300)), z.null()]) }),
|
|
206
|
+
"set-describe": z.strictObject({ op: z.literal("set-describe"), kind: kindName, describe: z.union([z.string().check(z.minLength(1), z.maxLength(300)), z.null()]) }),
|
|
213
207
|
// A kind's slot; the front page (`slot: "home"`, no kind); or a blocks lens's blocks, by its title (FR-84).
|
|
214
|
-
"set-view": z.
|
|
208
|
+
"set-view": z.strictObject({ op: z.literal("set-view"), kind: z.optional(kindName), slot: z.optional(z.enum([...VIEW_SLOTS, "home"])), lens: z.optional(lensTitle), blocks: z.union([z.array(z.unknown()).check(z.minLength(1)), z.null()]) }),
|
|
215
209
|
// A view the host keeps, by its name (`view:<name>` or bare), and what it is called now (Roadmap f-rename-view).
|
|
216
|
-
"rename-view": z.
|
|
217
|
-
"set-glance": z.
|
|
210
|
+
"rename-view": z.strictObject({ op: z.literal("rename-view"), view: z.string().check(z.minLength(1), z.maxLength(80)), to: z.string().check(z.minLength(1), z.maxLength(80)) }),
|
|
211
|
+
"set-glance": z.strictObject({ op: z.literal("set-glance"), kind: kindName, fields: z.array(fieldName).check(z.maxLength(20)) }),
|
|
218
212
|
// How a record's page orders and groups its facts (FR-148): these first, then each group under its title; none of either takes the choice away.
|
|
219
|
-
"set-page-fields": z
|
|
220
|
-
.object({
|
|
213
|
+
"set-page-fields": z.strictObject({
|
|
221
214
|
op: z.literal("set-page-fields"),
|
|
222
215
|
kind: kindName,
|
|
223
|
-
fields: z.array(fieldName).
|
|
224
|
-
groups: z.union([z.array(z.
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
"add-lens": z
|
|
228
|
-
.object({
|
|
216
|
+
fields: z.array(fieldName).check(z.maxLength(40)),
|
|
217
|
+
groups: z.optional(z.union([z.array(z.strictObject({ title: z.string().check(z.minLength(1), z.maxLength(60)), fields: z.array(fieldName).check(z.minLength(1), z.maxLength(40)) })).check(z.maxLength(12)), z.null()])),
|
|
218
|
+
}),
|
|
219
|
+
"add-lens": z.strictObject({
|
|
229
220
|
op: z.literal("add-lens"),
|
|
230
221
|
title: lensTitle,
|
|
231
|
-
lens: z.string().
|
|
232
|
-
on:
|
|
233
|
-
bindings: z.record(z.string(), z.unknown())
|
|
234
|
-
options: z.record(z.string(), z.unknown())
|
|
222
|
+
lens: z.optional(z.string().check(z.minLength(1), z.maxLength(40))),
|
|
223
|
+
on: z.optional(kindName),
|
|
224
|
+
bindings: z.optional(z.record(z.string(), z.unknown())),
|
|
225
|
+
options: z.optional(z.record(z.string(), z.unknown())),
|
|
235
226
|
// False: the place's page leaves off the forms that begin its kind.
|
|
236
|
-
create: z.
|
|
237
|
-
at: z.
|
|
238
|
-
replace:
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
"remove-lens": z.object({ op: z.literal("remove-lens"), title: lensTitle, on: kindName.optional() }).strict(),
|
|
227
|
+
create: z.optional(z.boolean()),
|
|
228
|
+
at: z.optional(z.int().check(z.gte(0))),
|
|
229
|
+
replace: z.optional(lensTitle),
|
|
230
|
+
}),
|
|
231
|
+
"remove-lens": z.strictObject({ op: z.literal("remove-lens"), title: lensTitle, on: z.optional(kindName) }),
|
|
242
232
|
// A lens kept off the bar's places, the page list and the home's gallery, still reached by its address, a link or navigate.
|
|
243
|
-
"set-lens-hidden": z.
|
|
233
|
+
"set-lens-hidden": z.strictObject({ op: z.literal("set-lens-hidden"), title: lensTitle, on: z.optional(kindName), hidden: z.boolean() }),
|
|
244
234
|
// Whether a place that lists records offers "Export CSV" (a lens, or a kind's list by its kind or plural): on unless switched off.
|
|
245
|
-
"set-lens-export": z.
|
|
246
|
-
"set-home": z.
|
|
247
|
-
"arrange-pages": z
|
|
248
|
-
.object({
|
|
235
|
+
"set-lens-export": z.strictObject({ op: z.literal("set-lens-export"), title: lensTitle, on: z.optional(kindName), export: z.boolean() }),
|
|
236
|
+
"set-home": z.strictObject({ op: z.literal("set-home"), blocks: z.union([z.array(z.unknown()).check(z.minLength(1)), z.null()]) }),
|
|
237
|
+
"arrange-pages": z.strictObject({
|
|
249
238
|
op: z.literal("arrange-pages"),
|
|
250
239
|
// A kind, or a view the host keeps: `view:<its name>`, or its title where the host says its views.
|
|
251
|
-
order: z.union([z.array(z.string().
|
|
252
|
-
hide: z.union([z.array(kindName).
|
|
253
|
-
first: z.union([z.string().
|
|
254
|
-
primary: z.union([z.array(z.string().
|
|
255
|
-
scene: z.union([z.string().
|
|
256
|
-
pages: z.union([z.string().
|
|
240
|
+
order: z.optional(z.union([z.array(z.string().check(z.minLength(1), z.maxLength(80))).check(z.maxLength(40)), z.null()])),
|
|
241
|
+
hide: z.optional(z.union([z.array(kindName).check(z.maxLength(40)), z.null()])),
|
|
242
|
+
first: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(80)), z.null()])),
|
|
243
|
+
primary: z.optional(z.union([z.array(z.string().check(z.minLength(1), z.maxLength(80))).check(z.maxLength(40)), z.null()])),
|
|
244
|
+
scene: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(40)), z.null()])),
|
|
245
|
+
pages: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(40)), z.null()])),
|
|
257
246
|
// What a kind's list offers to filter by: `{ "request": ["status", "became.stage"] }`; null or [] gives a kind back its derived filters.
|
|
258
|
-
filters: z.record(kindName, z.union([z.array(z.string().
|
|
247
|
+
filters: z.optional(z.record(kindName, z.union([z.array(z.string().check(z.minLength(1), z.maxLength(120))).check(z.maxLength(40)), z.null()]))),
|
|
259
248
|
// The order a kind's list opens in: `{ "feature": { "by": "score", "direction": "desc", "then": "label" } }` or a key; null gives it back its own.
|
|
260
|
-
sort: z.record(kindName, z.union([listSortShape, z.null()]))
|
|
249
|
+
sort: z.optional(z.record(kindName, z.union([listSortShape, z.null()]))),
|
|
261
250
|
// How a kind's list opens grouped: `{ "request": { "by": "status", "order": [...], "closed": ["done"] } }` or a field; null opens it ungrouped.
|
|
262
|
-
group: z.record(kindName, z.union([listGroupShape, z.null()]))
|
|
251
|
+
group: z.optional(z.record(kindName, z.union([listGroupShape, z.null()]))),
|
|
263
252
|
// The place a kind's list opens as, by a lens's title: `{ "task": "Tasks by status" }`; null opens it as a list again.
|
|
264
|
-
opens: z.record(kindName, z.union([lensTitle, z.null()]))
|
|
253
|
+
opens: z.optional(z.record(kindName, z.union([lensTitle, z.null()]))),
|
|
265
254
|
// The scene's word as a chat or a tool written before 0.1.17 sends it (FR-132's key, RESPELLED as `scene`).
|
|
266
|
-
overview: z.union([z.string().
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
"set-computed": z
|
|
270
|
-
.object({
|
|
255
|
+
overview: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(40)), z.null()])),
|
|
256
|
+
}),
|
|
257
|
+
"set-computed": z.strictObject({
|
|
271
258
|
op: z.literal("set-computed"),
|
|
272
259
|
kind: kindName,
|
|
273
260
|
name: fieldName,
|
|
274
|
-
expr: z.union([z.string().
|
|
275
|
-
label: z.union([z.string().
|
|
276
|
-
description: z.union([z.string().
|
|
261
|
+
expr: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(2000)), z.null()])),
|
|
262
|
+
label: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(60)), z.null()])),
|
|
263
|
+
description: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(500)), z.null()])),
|
|
277
264
|
// Kept off a record's page, card and CSV, still worked out for a sort, a rule or a view (FR-217): true hides it, false or null shows it.
|
|
278
|
-
hidden: z.union([z.boolean(), z.null()])
|
|
279
|
-
})
|
|
280
|
-
.strict(),
|
|
265
|
+
hidden: z.optional(z.union([z.boolean(), z.null()])),
|
|
266
|
+
}),
|
|
281
267
|
// Who the people are, and who may do and see what (FR-170): a grant and a sight as the document holds one.
|
|
282
|
-
"set-people": z.
|
|
268
|
+
"set-people": z.strictObject({ op: z.literal("set-people"), kind: kindName, people: z.boolean() }),
|
|
283
269
|
// Whether a kind's records are archived and merged, or only kept and removed (FR-173).
|
|
284
|
-
"set-archives": z.
|
|
270
|
+
"set-archives": z.strictObject({ op: z.literal("set-archives"), kind: kindName, archives: z.boolean() }),
|
|
285
271
|
// What the app's own actor may do on its own to a kind, or to one relation of it (`@graview/core/tidying`).
|
|
286
|
-
"set-tidying": z.
|
|
272
|
+
"set-tidying": z.strictObject({ op: z.literal("set-tidying"), kind: kindName, relation: z.optional(z.string()), tidying: z.enum(["never", "no-links", "allowed"]) }),
|
|
287
273
|
// What the app says of suggestions as a whole (`tidying` at the top of the document): the votes at which the app's own actor makes one; null takes it away.
|
|
288
|
-
"set-app-tidying": z.
|
|
274
|
+
"set-app-tidying": z.strictObject({ op: z.literal("set-app-tidying"), autoAcceptAt: z.union([z.int().check(z.gte(1), z.lte(10_000)), z.null()]) }),
|
|
289
275
|
// What a kind follows (Roadmap f-keep-linked): the kind, the relation joining them and the fields worked out from it; null, it follows nothing.
|
|
290
|
-
"set-derives": z.
|
|
291
|
-
"add-grant": z.
|
|
292
|
-
"remove-grant": z.
|
|
293
|
-
"add-sight": z.
|
|
294
|
-
"remove-sight": z.
|
|
276
|
+
"set-derives": z.strictObject({ op: z.literal("set-derives"), kind: kindName, derives: z.union([z.strictObject({ from: kindName, via: z.string(), set: z.record(z.string(), z.unknown()) }), z.null()]) }),
|
|
277
|
+
"add-grant": z.looseObject({ op: z.literal("add-grant") }),
|
|
278
|
+
"remove-grant": z.looseObject({ op: z.literal("remove-grant") }),
|
|
279
|
+
"add-sight": z.looseObject({ op: z.literal("add-sight") }),
|
|
280
|
+
"remove-sight": z.looseObject({ op: z.literal("remove-sight") }),
|
|
295
281
|
// Who the app is for, in words (Roadmap f-app-jobs); null takes the sentence away.
|
|
296
|
-
"set-purpose": z.
|
|
282
|
+
"set-purpose": z.strictObject({ op: z.literal("set-purpose"), for: z.union([z.string().check(z.minLength(1), z.maxLength(300)), z.null()]) }),
|
|
297
283
|
// A job as the document holds one (`purpose.jobs[]`), placed at `at` or last.
|
|
298
|
-
"add-job": z.
|
|
284
|
+
"add-job": z.strictObject({ op: z.literal("add-job"), job: z.record(z.string(), z.unknown()), at: z.optional(z.int().check(z.gte(0))) }),
|
|
299
285
|
// A job by its name, each key given set, null clearing an optional one.
|
|
300
|
-
"edit-job": z
|
|
301
|
-
.object({
|
|
286
|
+
"edit-job": z.strictObject({
|
|
302
287
|
op: z.literal("edit-job"),
|
|
303
288
|
name: jobName,
|
|
304
|
-
ask: z.string().
|
|
305
|
-
kind:
|
|
306
|
-
where: z.union([z.string().
|
|
307
|
-
sort: z.union([listKey, z.
|
|
308
|
-
act: z.union([actName, z.null()])
|
|
309
|
-
roles: z.union([z.array(z.string().regex(NAME)).
|
|
310
|
-
})
|
|
311
|
-
|
|
312
|
-
"remove-job": z.object({ op: z.literal("remove-job"), name: jobName }).strict(),
|
|
289
|
+
ask: z.optional(z.string().check(z.minLength(1), z.maxLength(200))),
|
|
290
|
+
kind: z.optional(kindName),
|
|
291
|
+
where: z.optional(z.union([z.string().check(z.minLength(1), z.maxLength(2000)), z.null()])),
|
|
292
|
+
sort: z.optional(z.union([listKey, z.strictObject({ by: listKey, direction: listDirection }), z.null()])),
|
|
293
|
+
act: z.optional(z.union([actName, z.null()])),
|
|
294
|
+
roles: z.optional(z.union([z.array(z.string().check(z.regex(NAME))).check(z.minLength(1), z.maxLength(40)), z.null()])),
|
|
295
|
+
}),
|
|
296
|
+
"remove-job": z.strictObject({ op: z.literal("remove-job"), name: jobName }),
|
|
313
297
|
// A device's screen (`devices.screens[]`, Roadmap f-device-nav-bar): a place and the word under its press, placed at `at` or last.
|
|
314
|
-
"add-device-screen": z.
|
|
298
|
+
"add-device-screen": z.strictObject({ op: z.literal("add-device-screen"), screen: z.record(z.string(), z.unknown()), at: z.optional(z.int().check(z.gte(0))) }),
|
|
315
299
|
// A screen by the place it shows, moved to `to` (0 first).
|
|
316
|
-
"move-device-screen": z.
|
|
317
|
-
"remove-device-screen": z.
|
|
300
|
+
"move-device-screen": z.strictObject({ op: z.literal("move-device-screen"), place: z.string().check(z.minLength(1), z.maxLength(200)), to: z.int().check(z.gte(0)) }),
|
|
301
|
+
"remove-device-screen": z.strictObject({ op: z.literal("remove-device-screen"), place: z.string().check(z.minLength(1), z.maxLength(200)) }),
|
|
318
302
|
// Another word people use for a kind, or for one of its fields (Roadmap f-learned-suggestions).
|
|
319
|
-
"add-alias": z.
|
|
303
|
+
"add-alias": z.strictObject({ op: z.literal("add-alias"), kind: kindName, field: z.optional(fieldName), alias: z.string().check(z.minLength(1), z.maxLength(40)) }),
|
|
320
304
|
// All of a kind's or a field's other words at once; null or [] takes them away.
|
|
321
|
-
"set-aliases": z.
|
|
305
|
+
"set-aliases": z.strictObject({ op: z.literal("set-aliases"), kind: kindName, field: z.optional(fieldName), aliases: z.union([z.array(z.string().check(z.minLength(1), z.maxLength(40))).check(z.maxLength(MOST_ALIASES)), z.null()]) }),
|
|
322
306
|
// A connection declared whole, by its name: set where there was none, or replaced (FR-229); null takes it away.
|
|
323
|
-
"set-connection": z.
|
|
307
|
+
"set-connection": z.strictObject({ op: z.literal("set-connection"), name: kindName, connection: z.union([z.record(z.string(), z.unknown()), z.null()]) }),
|
|
324
308
|
// A workflow by its name (Roadmap f-jobs-declared): added where there was none, replaced whole, removed, paused or resumed.
|
|
325
|
-
"add-workflow": z.
|
|
326
|
-
"set-workflow": z.
|
|
327
|
-
"remove-workflow": z.
|
|
328
|
-
"pause-workflow": z.
|
|
329
|
-
"resume-workflow": z.
|
|
309
|
+
"add-workflow": z.strictObject({ op: z.literal("add-workflow"), name: kindName, workflow: z.record(z.string(), z.unknown()) }),
|
|
310
|
+
"set-workflow": z.strictObject({ op: z.literal("set-workflow"), name: kindName, workflow: z.record(z.string(), z.unknown()) }),
|
|
311
|
+
"remove-workflow": z.strictObject({ op: z.literal("remove-workflow"), name: kindName }),
|
|
312
|
+
"pause-workflow": z.strictObject({ op: z.literal("pause-workflow"), name: kindName }),
|
|
313
|
+
"resume-workflow": z.strictObject({ op: z.literal("resume-workflow"), name: kindName }),
|
|
330
314
|
};
|
|
331
315
|
}
|
|
332
316
|
let shapes;
|
|
@@ -1029,6 +1013,25 @@ class Editor {
|
|
|
1029
1013
|
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.`);
|
|
1030
1014
|
return;
|
|
1031
1015
|
}
|
|
1016
|
+
case "set-cites": {
|
|
1017
|
+
// Where its value came from (Roadmap f-field-cites-marker): a field or relation of the same kind, never itself.
|
|
1018
|
+
const f = this.field(i, e.kind, e.field);
|
|
1019
|
+
if (!f)
|
|
1020
|
+
return;
|
|
1021
|
+
if (e.cites === null) {
|
|
1022
|
+
delete f.cites;
|
|
1023
|
+
this.said.push(`${e.kind}'s ${e.field} no longer says what cites it.`);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
1026
|
+
const spec = this.doc.kinds[e.kind];
|
|
1027
|
+
if (e.cites === e.field)
|
|
1028
|
+
return this.fail(i, "cites", `${e.kind}'s ${e.field} cannot cite itself; name the field or relation that holds where it came from`);
|
|
1029
|
+
if (!spec.fields[e.cites] && !spec.edges?.[e.cites])
|
|
1030
|
+
return this.fail(i, "cites", `${e.kind} has no field or relation "${e.cites}" to hold the citation`);
|
|
1031
|
+
f.cites = e.cites;
|
|
1032
|
+
this.said.push(`${e.kind}'s ${e.field} is cited by its ${e.cites}: a record holding a ${e.field} with no ${e.cites} is said to be uncited.`);
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1032
1035
|
case "remove-field":
|
|
1033
1036
|
return this.removeField(i, e.kind, e.field);
|
|
1034
1037
|
case "add-relation":
|
|
@@ -2821,7 +2824,7 @@ class Editor {
|
|
|
2821
2824
|
if (!(asArray(act.on).includes(to) || act.creates === to || (act.effects ?? []).some((x) => x.create === to)))
|
|
2822
2825
|
continue;
|
|
2823
2826
|
const next = swapToken(name, from, to);
|
|
2824
|
-
if (next !== name && !this.doc.acts[next] && NAME.test(next)) {
|
|
2827
|
+
if (next !== name && next !== BIND_PERSON && !this.doc.acts[next] && NAME.test(next)) {
|
|
2825
2828
|
this.renameAct(name, next);
|
|
2826
2829
|
touched.push(`act ${name} → ${next}`);
|
|
2827
2830
|
}
|
|
@@ -3023,6 +3026,13 @@ class Editor {
|
|
|
3023
3026
|
for (const [k, v] of Object.entries(spec.fields))
|
|
3024
3027
|
fields[k === field ? to : k] = v;
|
|
3025
3028
|
spec.fields = fields;
|
|
3029
|
+
// A field cited by this one is cited by it under its new name (Roadmap f-field-cites-marker).
|
|
3030
|
+
for (const [name, other] of Object.entries(fields)) {
|
|
3031
|
+
if (other.cites !== field)
|
|
3032
|
+
continue;
|
|
3033
|
+
other.cites = to;
|
|
3034
|
+
touched.push(`${kind}'s ${name} citation`);
|
|
3035
|
+
}
|
|
3026
3036
|
const origin = this.fieldOrigin.get(`${kind}.${field}`);
|
|
3027
3037
|
this.fieldOrigin.delete(`${kind}.${field}`);
|
|
3028
3038
|
this.fieldOrigin.set(`${kind}.${to}`, origin);
|
|
@@ -3324,6 +3334,7 @@ class Editor {
|
|
|
3324
3334
|
for (const x of [...this.fills])
|
|
3325
3335
|
if (x.kind === kind && (x.field === field || x.from === field))
|
|
3326
3336
|
this.fills.splice(this.fills.indexOf(x), 1);
|
|
3337
|
+
gone.push(...dropCitesOf(spec, kind, field));
|
|
3327
3338
|
this.said.push(`${kind} loses its ${field} field, and every value in it${gone.length ? `; ${listOf(gone)} ${gone.length === 1 ? "goes" : "go"} with it` : ""}.`);
|
|
3328
3339
|
}
|
|
3329
3340
|
// ── relations ──
|
|
@@ -3394,6 +3405,13 @@ class Editor {
|
|
|
3394
3405
|
edges[to].renamedFrom = origin;
|
|
3395
3406
|
else
|
|
3396
3407
|
delete edges[to].renamedFrom;
|
|
3408
|
+
// A field this relation cites is cited by it under its new name (Roadmap f-field-cites-marker).
|
|
3409
|
+
for (const [name, field] of Object.entries(s.fields)) {
|
|
3410
|
+
if (field.cites !== relation)
|
|
3411
|
+
continue;
|
|
3412
|
+
field.cites = to;
|
|
3413
|
+
touched.push(`${k}'s ${name} citation`);
|
|
3414
|
+
}
|
|
3397
3415
|
}
|
|
3398
3416
|
this.said.push(`The "${relation}" relation is renamed to "${to}"; its links are kept${touched.length ? `, and ${listOf(touched)} follow${touched.length === 1 ? "s" : ""}` : ""}.`);
|
|
3399
3417
|
}
|
|
@@ -3411,6 +3429,7 @@ class Editor {
|
|
|
3411
3429
|
return this.fail(i, "relation", `a sight shows what "${relation}" joins to each seat's own record`, "change the policy's sight first");
|
|
3412
3430
|
const gone = [];
|
|
3413
3431
|
this.dropRelation(kind, relation, gone);
|
|
3432
|
+
gone.push(...dropCitesOf(spec, kind, relation));
|
|
3414
3433
|
this.said.push(`The "${relation}" relation from ${kind} is removed, with every link of that kind${gone.length ? `; ${listOf(gone)} ${gone.length === 1 ? "goes" : "go"} with it` : ""}.`);
|
|
3415
3434
|
}
|
|
3416
3435
|
dropRelation(kind, relation, gone) {
|
|
@@ -3436,6 +3455,8 @@ class Editor {
|
|
|
3436
3455
|
// ── acts and rules ──
|
|
3437
3456
|
addAct(i, e) {
|
|
3438
3457
|
const { op: _op, act, replace, ...rest } = e;
|
|
3458
|
+
if (act === BIND_PERSON)
|
|
3459
|
+
return this.failAs("binding-act-taken", i, "act", `"${BIND_PERSON}" is a name the framework keeps for an act of its own`, "give the act another name");
|
|
3439
3460
|
if (this.doc.acts?.[act] && !replace)
|
|
3440
3461
|
return this.fail(i, "act", `there is already an act "${act}"`, "pass replace: true to change it, or pick another name");
|
|
3441
3462
|
const parsed = ActSpec.safeParse(rest);
|
|
@@ -3669,7 +3690,7 @@ class Editor {
|
|
|
3669
3690
|
if (r.t === "field") {
|
|
3670
3691
|
for (const name of [...renamedArgs.keys()]) {
|
|
3671
3692
|
const next = swapToken(name, kebab(r.from), kebab(r.to));
|
|
3672
|
-
if (next !== name && !doc.acts[next] && NAME.test(next)) {
|
|
3693
|
+
if (next !== name && next !== BIND_PERSON && !doc.acts[next] && NAME.test(next)) {
|
|
3673
3694
|
this.renameAct(name, next);
|
|
3674
3695
|
const at = touched.indexOf(`act ${name}`);
|
|
3675
3696
|
if (at >= 0)
|
|
@@ -4617,4 +4638,15 @@ function renamedAct(act, from, to) {
|
|
|
4617
4638
|
const derived = derivedActOf(act);
|
|
4618
4639
|
return derived && derived.kind === from ? `${derived.act}-${to}` : act;
|
|
4619
4640
|
}
|
|
4641
|
+
/** A kind's fields that said this field or relation cites them say nothing now (Roadmap f-field-cites-marker): what goes, in words. */
|
|
4642
|
+
function dropCitesOf(spec, kind, name) {
|
|
4643
|
+
const gone = [];
|
|
4644
|
+
for (const [field, f] of Object.entries(spec.fields ?? {})) {
|
|
4645
|
+
if (f.cites !== name)
|
|
4646
|
+
continue;
|
|
4647
|
+
delete f.cites;
|
|
4648
|
+
gone.push(`${kind}'s ${field} citation`);
|
|
4649
|
+
}
|
|
4650
|
+
return gone;
|
|
4651
|
+
}
|
|
4620
4652
|
//# sourceMappingURL=edit.js.map
|