@graview/core 0.1.72 → 0.1.74
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 +7 -0
- package/dist/answer-seen.d.ts.map +1 -1
- package/dist/answer-seen.js +7 -2
- package/dist/answer-seen.js.map +1 -1
- package/dist/app.d.ts +13 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js.map +1 -1
- package/dist/arrangement.d.ts.map +1 -1
- package/dist/arrangement.js +3 -0
- package/dist/arrangement.js.map +1 -1
- package/dist/binding-served.d.ts +47 -0
- package/dist/binding-served.d.ts.map +1 -0
- package/dist/binding-served.js +90 -0
- package/dist/binding-served.js.map +1 -0
- package/dist/binding.d.ts +15 -0
- package/dist/binding.d.ts.map +1 -0
- package/dist/binding.js +168 -0
- package/dist/binding.js.map +1 -0
- package/dist/blocks.d.ts +1 -0
- package/dist/blocks.d.ts.map +1 -1
- package/dist/blocks.js +2 -0
- package/dist/blocks.js.map +1 -1
- package/dist/check.d.ts +1 -1
- package/dist/check.d.ts.map +1 -1
- package/dist/check.js +1 -1
- package/dist/check.js.map +1 -1
- package/dist/cli/check/devices.d.ts +12 -0
- package/dist/cli/check/devices.d.ts.map +1 -0
- package/dist/cli/check/devices.js +25 -0
- package/dist/cli/check/devices.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/relations.js +1 -1
- package/dist/cli/check/relations.js.map +1 -1
- package/dist/cli/check.d.ts.map +1 -1
- package/dist/cli/check.js +2 -1
- package/dist/cli/check.js.map +1 -1
- package/dist/cli/create.d.ts +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +34 -3
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/document-schema.d.ts.map +1 -1
- package/dist/cli/document-schema.js +7 -0
- package/dist/cli/document-schema.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 +23 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +1 -0
- package/dist/cli/types.js.map +1 -1
- package/dist/compose-home.d.ts +48 -0
- package/dist/compose-home.d.ts.map +1 -0
- package/dist/compose-home.js +190 -0
- package/dist/compose-home.js.map +1 -0
- package/dist/compose.d.ts +8 -0
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +21 -17
- package/dist/compose.js.map +1 -1
- package/dist/css/faces-words.d.ts +4 -0
- package/dist/css/faces-words.d.ts.map +1 -0
- package/dist/css/faces-words.js +48 -0
- package/dist/css/faces-words.js.map +1 -0
- package/dist/css/faces.d.ts +82 -0
- package/dist/css/faces.d.ts.map +1 -0
- package/dist/css/faces.js +317 -0
- package/dist/css/faces.js.map +1 -0
- package/dist/css/fonts.d.ts +13 -0
- package/dist/css/fonts.d.ts.map +1 -1
- package/dist/css/fonts.js +28 -5
- package/dist/css/fonts.js.map +1 -1
- package/dist/css/sanitize.d.ts +45 -7
- package/dist/css/sanitize.d.ts.map +1 -1
- package/dist/css/sanitize.js +112 -34
- package/dist/css/sanitize.js.map +1 -1
- package/dist/css.d.ts +4 -1
- package/dist/css.d.ts.map +1 -1
- package/dist/css.js +2 -0
- package/dist/css.js.map +1 -1
- package/dist/days.d.ts +15 -1
- package/dist/days.d.ts.map +1 -1
- package/dist/days.js +56 -3
- package/dist/days.js.map +1 -1
- package/dist/device-findings.d.ts +27 -0
- package/dist/device-findings.d.ts.map +1 -0
- package/dist/device-findings.js +100 -0
- package/dist/device-findings.js.map +1 -0
- package/dist/device-screens.d.ts +50 -0
- package/dist/device-screens.d.ts.map +1 -0
- package/dist/device-screens.js +92 -0
- package/dist/device-screens.js.map +1 -0
- package/dist/device-shape.d.ts +41 -0
- package/dist/device-shape.d.ts.map +1 -0
- package/dist/device-shape.js +81 -0
- package/dist/device-shape.js.map +1 -0
- package/dist/devices.d.ts +7 -0
- package/dist/devices.d.ts.map +1 -0
- package/dist/devices.js +16 -0
- package/dist/devices.js.map +1 -0
- package/dist/document/act-findings.d.ts.map +1 -1
- package/dist/document/act-findings.js +1 -0
- package/dist/document/act-findings.js.map +1 -1
- package/dist/document/blocks.d.ts.map +1 -1
- package/dist/document/blocks.js +11 -3
- package/dist/document/blocks.js.map +1 -1
- package/dist/document/brand-check.d.ts.map +1 -1
- package/dist/document/brand-check.js +2 -0
- package/dist/document/brand-check.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 +6 -0
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +52 -16
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/describe-forms.d.ts.map +1 -1
- package/dist/document/describe-forms.js +2 -0
- package/dist/document/describe-forms.js.map +1 -1
- package/dist/document/describe-place.d.ts.map +1 -1
- package/dist/document/describe-place.js +30 -6
- package/dist/document/describe-place.js.map +1 -1
- package/dist/document/devices-spec.d.ts +14 -0
- package/dist/document/devices-spec.d.ts.map +1 -0
- package/dist/document/devices-spec.js +22 -0
- package/dist/document/devices-spec.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 +172 -0
- package/dist/document/edit.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/graview-template.d.ts +79 -1
- package/dist/document/graview-template.d.ts.map +1 -1
- package/dist/document/graview-template.js +153 -8
- package/dist/document/graview-template.js.map +1 -1
- package/dist/document/index.d.ts +2 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +1 -1
- package/dist/document/index.js.map +1 -1
- package/dist/document/instantiate-template.d.ts +12 -0
- package/dist/document/instantiate-template.d.ts.map +1 -1
- package/dist/document/instantiate-template.js +14 -0
- package/dist/document/instantiate-template.js.map +1 -1
- package/dist/document/migrate.d.ts.map +1 -1
- package/dist/document/migrate.js +13 -1
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/says-the-line.d.ts +18 -0
- package/dist/document/says-the-line.d.ts.map +1 -0
- package/dist/document/says-the-line.js +46 -0
- package/dist/document/says-the-line.js.map +1 -0
- package/dist/document/schema.d.ts +10 -2
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +9 -2
- package/dist/document/schema.js.map +1 -1
- package/dist/document/template.d.ts +6 -1
- package/dist/document/template.d.ts.map +1 -1
- package/dist/document/template.js +29 -2
- package/dist/document/template.js.map +1 -1
- package/dist/document/to-document.d.ts.map +1 -1
- package/dist/document/to-document.js +2 -0
- package/dist/document/to-document.js.map +1 -1
- package/dist/document.schema.json +37 -4
- package/dist/field-sight.d.ts.map +1 -1
- package/dist/field-sight.js +3 -2
- package/dist/field-sight.js.map +1 -1
- package/dist/graph/archived.d.ts +10 -0
- package/dist/graph/archived.d.ts.map +1 -1
- package/dist/graph/archived.js +14 -1
- package/dist/graph/archived.js.map +1 -1
- package/dist/graph/graph.d.ts +67 -0
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +155 -45
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/would-refuse.d.ts +13 -0
- package/dist/graph/would-refuse.d.ts.map +1 -0
- package/dist/graph/would-refuse.js +69 -0
- package/dist/graph/would-refuse.js.map +1 -0
- package/dist/import/coerce.d.ts.map +1 -1
- package/dist/import/coerce.js +7 -0
- package/dist/import/coerce.js.map +1 -1
- package/dist/import/rows.js +2 -2
- package/dist/import/rows.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/kind-date.d.ts +18 -0
- package/dist/kind-date.d.ts.map +1 -0
- package/dist/kind-date.js +10 -0
- package/dist/kind-date.js.map +1 -0
- package/dist/kind-list.js +1 -1
- package/dist/kind-list.js.map +1 -1
- package/dist/may-run.d.ts +46 -0
- package/dist/may-run.d.ts.map +1 -0
- package/dist/may-run.js +162 -0
- package/dist/may-run.js.map +1 -0
- package/dist/mutations/arg-shape.d.ts +4 -0
- package/dist/mutations/arg-shape.d.ts.map +1 -1
- package/dist/mutations/arg-shape.js +3 -0
- package/dist/mutations/arg-shape.js.map +1 -1
- package/dist/mutations/derive-edits.d.ts.map +1 -1
- package/dist/mutations/derive-edits.js +4 -1
- package/dist/mutations/derive-edits.js.map +1 -1
- package/dist/mutations/form.d.ts +2 -1
- package/dist/mutations/form.d.ts.map +1 -1
- package/dist/mutations/form.js +6 -0
- package/dist/mutations/form.js.map +1 -1
- package/dist/mutations/node-ref.d.ts +7 -0
- package/dist/mutations/node-ref.d.ts.map +1 -1
- package/dist/mutations/node-ref.js +17 -0
- package/dist/mutations/node-ref.js.map +1 -1
- package/dist/mutations/types.d.ts +11 -0
- package/dist/mutations/types.d.ts.map +1 -1
- package/dist/ops/withheld.d.ts +2 -0
- package/dist/ops/withheld.d.ts.map +1 -1
- package/dist/ops/withheld.js +3 -1
- package/dist/ops/withheld.js.map +1 -1
- package/dist/permissions/policy.d.ts +31 -2
- package/dist/permissions/policy.d.ts.map +1 -1
- package/dist/permissions/policy.js +55 -3
- package/dist/permissions/policy.js.map +1 -1
- package/dist/permissions/sight.d.ts +4 -0
- package/dist/permissions/sight.d.ts.map +1 -1
- package/dist/permissions/sight.js.map +1 -1
- package/dist/permissions/types.d.ts +6 -0
- package/dist/permissions/types.d.ts.map +1 -1
- package/dist/permissions/types.js.map +1 -1
- package/dist/scaffold/from-template.d.ts +16 -0
- package/dist/scaffold/from-template.d.ts.map +1 -1
- package/dist/scaffold/from-template.js +29 -0
- package/dist/scaffold/from-template.js.map +1 -1
- package/dist/scaffold/index.d.ts +9 -0
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/index.js +2 -2
- package/dist/scaffold/index.js.map +1 -1
- package/dist/scene.d.ts +1 -1
- package/dist/scene.d.ts.map +1 -1
- package/dist/scene.js +1 -1
- package/dist/scene.js.map +1 -1
- package/dist/schema/field-words.d.ts +1 -1
- package/dist/schema/field-words.d.ts.map +1 -1
- package/dist/schema/field-words.js +4 -2
- package/dist/schema/field-words.js.map +1 -1
- package/dist/schema/json-schema.d.ts.map +1 -1
- package/dist/schema/json-schema.js +6 -2
- package/dist/schema/json-schema.js.map +1 -1
- package/dist/schema/reading.d.ts +7 -0
- package/dist/schema/reading.d.ts.map +1 -1
- package/dist/schema/reading.js +27 -3
- package/dist/schema/reading.js.map +1 -1
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +4 -1
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/typed-field-builders.d.ts +2 -0
- package/dist/schema/typed-field-builders.d.ts.map +1 -1
- package/dist/schema/typed-field-builders.js +5 -0
- package/dist/schema/typed-field-builders.js.map +1 -1
- package/dist/schema/typed-fields.d.ts +2 -2
- package/dist/schema/typed-fields.d.ts.map +1 -1
- package/dist/schema/typed-fields.js +2 -2
- package/dist/schema/typed-fields.js.map +1 -1
- package/dist/seat.d.ts +6 -1
- package/dist/seat.d.ts.map +1 -1
- package/dist/seat.js +7 -1
- package/dist/seat.js.map +1 -1
- package/dist/seen.d.ts +16 -1
- package/dist/seen.d.ts.map +1 -1
- package/dist/seen.js +112 -10
- package/dist/seen.js.map +1 -1
- package/dist/store.d.ts +65 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +280 -38
- package/dist/store.js.map +1 -1
- package/dist/theme/accent.d.ts.map +1 -1
- package/dist/theme/accent.js +13 -16
- package/dist/theme/accent.js.map +1 -1
- package/dist/theme/derive.d.ts +8 -0
- package/dist/theme/derive.d.ts.map +1 -1
- package/dist/theme/derive.js +1 -1
- package/dist/theme/derive.js.map +1 -1
- package/dist/time-typed.d.ts +7 -0
- package/dist/time-typed.d.ts.map +1 -0
- package/dist/time-typed.js +31 -0
- package/dist/time-typed.js.map +1 -0
- package/dist/validate-graph.d.ts +2 -1
- package/dist/validate-graph.d.ts.map +1 -1
- package/dist/validate-graph.js +29 -0
- package/dist/validate-graph.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/village.d.ts +16 -1
- package/dist/village.d.ts.map +1 -1
- package/dist/village.js +29 -0
- package/dist/village.js.map +1 -1
- package/dist/who.d.ts +1 -0
- package/dist/who.d.ts.map +1 -1
- package/dist/who.js +7 -1
- package/dist/who.js.map +1 -1
- package/dist/words.d.ts +1 -0
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +2 -0
- package/dist/words.js.map +1 -1
- package/package.json +9 -1
package/dist/store.js
CHANGED
|
@@ -7,7 +7,7 @@ import { normalize, writesOf } from "./graph/primitives.js";
|
|
|
7
7
|
import { keepLinked, keepsLinked } from "./keep-linked.js";
|
|
8
8
|
import { bareOp, inverseOf } from "./ops/inverse.js";
|
|
9
9
|
import { LabelIndex, refusalFor } from "./labels.js";
|
|
10
|
-
import { nodeRefArgs } from "./mutations/node-ref.js";
|
|
10
|
+
import { heldRefKinds, nodeRefArgs } from "./mutations/node-ref.js";
|
|
11
11
|
import { verifyFold } from "./integrity.js";
|
|
12
12
|
import { evaluate } from "./invariants/engine.js";
|
|
13
13
|
import { compileMutation } from "./mutations/define-mutation.js";
|
|
@@ -20,15 +20,18 @@ import { namesMade, resolveMade } from "./mutations/made.js";
|
|
|
20
20
|
import { OperationLog } from "./ops/log.js";
|
|
21
21
|
import { lineageOf } from "./ops/lineage.js";
|
|
22
22
|
import { KEEP_LINK, keepLinkMutation, keepLinkVia } from "./mutations/keep-link.js";
|
|
23
|
+
import { BIND_PERSON, BINDING } from "./binding-served.js";
|
|
24
|
+
import { PERSON_SEAT } from "./graph/archived.js";
|
|
25
|
+
import { ActRefusal } from "./refused.js";
|
|
23
26
|
import { advisoryVoterOf, signedOutSeat, SIGN_IN_TO_VOTE, VOTE_SUGGESTION, VOTING, voteSuggestionMutation } from "./mutations/vote-suggestion.js";
|
|
24
27
|
import { TYPE_TEXT, TYPING } from "./text/typing-hook.js";
|
|
25
28
|
import { DECLINES, isAutomated, isTidyingActor, tidyingRefusal } from "./ops/tidying.js";
|
|
26
29
|
import { nameOfAuthor } from "./who.js";
|
|
27
|
-
import { actingAs, grantsTo, isSystem, meIn, meOf, ownsId, permits, profileOf, rolesSaid, withValidProfile, permittedMutations, proposes, subjectKinds } from "./permissions/policy.js";
|
|
30
|
+
import { actingAs, boundPersonOf, grantsTo, isSystem, meIn, meOf, ownsId, permits, profileOf, rolesSaid, seatedIn, withValidProfile, permittedMutations, proposes, subjectKinds } from "./permissions/policy.js";
|
|
28
31
|
import { MOST_PROPOSED, PROPOSE_CHANGES, proposeChangesMutation } from "./mutations/propose-changes.js";
|
|
29
32
|
import { namesUnseen, redact } from "./ops/withheld.js";
|
|
30
33
|
import { writersBehind } from "./ops/writers.js";
|
|
31
|
-
import { nounOf } from "./schema/define-node.js";
|
|
34
|
+
import { nounOf, withArticle } from "./schema/define-node.js";
|
|
32
35
|
import { behind, fieldsJudged, mayKeepField, partialSight, recordsOf, sees } from "./permissions/sight.js";
|
|
33
36
|
import { PermissionDeniedError } from "./permissions/types.js";
|
|
34
37
|
import { checkUndo, UndoBlockedError, undoneInverses, undoPrimitives } from "./ops/undo.js";
|
|
@@ -168,6 +171,39 @@ const batchesOf = (ops) => new Map(ops.map((op) => [op.id, op.batch]));
|
|
|
168
171
|
* from the platform's random source where there is one, which every page
|
|
169
172
|
* and Node 22 has.
|
|
170
173
|
*/
|
|
174
|
+
/** The most seats `kindsKeptFrom` keeps an answer for at once: past it, the answers kept are let go and worked out again as asked. */
|
|
175
|
+
const KEPT_KINDS_SEATS = 64;
|
|
176
|
+
/**
|
|
177
|
+
* THE SEAT A KEPT-KINDS ANSWER IS FOR: exactly what working it out reads of
|
|
178
|
+
* a principal — its kind, its id, its roles, the profile it is judged by
|
|
179
|
+
* (`profileOf`'s reading, not the fields it reads that from), and the same
|
|
180
|
+
* of whom it acts for — each read by name, never the principal serialized
|
|
181
|
+
* whole, and roles in one order. What it does not read (a session, a
|
|
182
|
+
* display name, which visitor of a shared seat) is no part of it, so a seat
|
|
183
|
+
* every visitor shares is one entry. Only strings are said: a kind, an id
|
|
184
|
+
* or a role that is anything else, or a seat past eight deep, has no key,
|
|
185
|
+
* and its answer is worked out each time and kept for nobody.
|
|
186
|
+
*/
|
|
187
|
+
function keptKindsSeat(principal, depth = 0) {
|
|
188
|
+
if (typeof principal !== "object" || principal === null)
|
|
189
|
+
return undefined;
|
|
190
|
+
const behalf = principal.onBehalfOf;
|
|
191
|
+
// No one to act for, as `actingAs` reads it, absent or null; said apart, since `isSystem` asks which.
|
|
192
|
+
const behind = behalf === undefined ? "absent" : behalf === null ? "null" : depth < 8 ? keptKindsSeat(behalf, depth + 1) : undefined;
|
|
193
|
+
if (behind === undefined)
|
|
194
|
+
return undefined;
|
|
195
|
+
const kind = principal.kind;
|
|
196
|
+
const id = principal.id;
|
|
197
|
+
const given = principal.roles;
|
|
198
|
+
if ((kind !== undefined && typeof kind !== "string") || (id !== undefined && typeof id !== "string"))
|
|
199
|
+
return undefined;
|
|
200
|
+
if (given !== undefined && (!Array.isArray(given) || !given.every((role) => typeof role === "string")))
|
|
201
|
+
return undefined;
|
|
202
|
+
const roles = given === undefined ? null : [...new Set(given)].sort();
|
|
203
|
+
const profile = profileOf(principal);
|
|
204
|
+
// And the record the store bound it to (`seatedIn`, read before this is asked): a binding and its undo are two seats.
|
|
205
|
+
return JSON.stringify([kind ?? null, id ?? null, roles, profile ? [profile.id, profile.name] : null, boundPersonOf(principal) ?? null, behind]);
|
|
206
|
+
}
|
|
171
207
|
function storeTag() {
|
|
172
208
|
const random = globalThis.crypto;
|
|
173
209
|
const bytes = new Uint8Array(6);
|
|
@@ -191,6 +227,8 @@ export class Store {
|
|
|
191
227
|
voter;
|
|
192
228
|
/** "Propose changes" (Roadmap f-proposals-for-review), when the app declared no act by that name. */
|
|
193
229
|
proposer;
|
|
230
|
+
/** "Bind a person" (Roadmap f-invite-binds-existing-person): answered where a kind is the people, offered by no list. */
|
|
231
|
+
binder;
|
|
194
232
|
invariants;
|
|
195
233
|
invariantOptions;
|
|
196
234
|
policy;
|
|
@@ -509,6 +547,12 @@ export class Store {
|
|
|
509
547
|
// "Type text" (Roadmap f-collab-text): answered by every store once `@graview/core/typing` is loaded, and offered by no list.
|
|
510
548
|
if (name === TYPE_TEXT && !this.typer && TYPING.typeText && !this.past && !this.mutations.has(name))
|
|
511
549
|
this.mutations.set(name, (this.typer = TYPING.typeText(this)));
|
|
550
|
+
// "Bind a person" (Roadmap f-invite-binds-existing-person): answered where a kind is the people once the host loads `@graview/core/binding`, and offered by no list.
|
|
551
|
+
if (name === BIND_PERSON && !this.binder && BINDING.act && !this.past && !this.mutations.has(name)) {
|
|
552
|
+
const binder = BINDING.act(this);
|
|
553
|
+
if (binder)
|
|
554
|
+
this.mutations.set(name, (this.binder = binder));
|
|
555
|
+
}
|
|
512
556
|
return this.mutations.has(name) ? name : (actSpelledAs(name, this.mutations.keys()) ?? name);
|
|
513
557
|
}
|
|
514
558
|
/** A call with its act's name as the store spells it, so the log and every check read the one name. */
|
|
@@ -523,7 +567,7 @@ export class Store {
|
|
|
523
567
|
return mutation.derived !== undefined && this.modules.disabledKinds.has(mutation.derived.kind);
|
|
524
568
|
}
|
|
525
569
|
allMutations() {
|
|
526
|
-
return [...this.mutations.values(), ...(this.publisher ? [this.publisher] : [])].filter((mutation) => mutation !== this.keeper && mutation !== this.typer && mutation !== this.voter && mutation !== this.proposer && !this.mutationDisabled(mutation));
|
|
570
|
+
return [...this.mutations.values(), ...(this.publisher ? [this.publisher] : [])].filter((mutation) => mutation !== this.keeper && mutation !== this.typer && mutation !== this.voter && mutation !== this.proposer && mutation !== this.binder && !this.mutationDisabled(mutation));
|
|
527
571
|
}
|
|
528
572
|
/** The declared acts a derived act resolves its permission through; keeping a link, those that make or break its relation. */
|
|
529
573
|
viaOf(mutation, call, principal) {
|
|
@@ -614,6 +658,8 @@ export class Store {
|
|
|
614
658
|
/** What `permits` answers from the grants alone; on an undo, a call already made, so it asks no record of who took it back. */
|
|
615
659
|
judged(call, principal, undoing = false) {
|
|
616
660
|
call = this.spelledCall(call);
|
|
661
|
+
// The seat as it is bound now: `self`, `ownEnd` and `$me` read the record it was bound to, and nothing a caller said of one.
|
|
662
|
+
principal = this.seated(principal);
|
|
617
663
|
/*
|
|
618
664
|
* The same answer `apply` would give. A declared agent's `may` narrows
|
|
619
665
|
* it before the policy does; asked without it, the chat offered a
|
|
@@ -630,6 +676,9 @@ export class Store {
|
|
|
630
676
|
const nobody = mutation && !undoing && this.noOneToBe(mutation, principal);
|
|
631
677
|
if (nobody)
|
|
632
678
|
return { ok: false, refusal: nobody };
|
|
679
|
+
// Binding a seat to a person is judged by `@graview/core/binding`, which made the act: the host, or a grant that names it.
|
|
680
|
+
if (mutation && mutation === this.binder)
|
|
681
|
+
return BINDING.judged(this, call, principal);
|
|
633
682
|
// Publishing is the declaration's `publishers`, not a grant's.
|
|
634
683
|
if (mutation && mutation === this.publisher)
|
|
635
684
|
return PUBLISHING.verdict(this, principal);
|
|
@@ -712,7 +761,7 @@ export class Store {
|
|
|
712
761
|
return false;
|
|
713
762
|
call = this.spelledCall(call);
|
|
714
763
|
const mutation = this.mutations.get(call.name);
|
|
715
|
-
if (!mutation || mutation === this.proposer || mutation === this.voter || this.refusesAgent(call, principal) || this.namesTurnedOff(call, principal))
|
|
764
|
+
if (!mutation || mutation === this.proposer || mutation === this.voter || mutation === this.binder || this.refusesAgent(call, principal) || this.namesTurnedOff(call, principal))
|
|
716
765
|
return false;
|
|
717
766
|
return !this.permits(call, principal).ok && proposes(this.policy, principal, call.name, this.subjectKindOf(call, principal));
|
|
718
767
|
}
|
|
@@ -904,6 +953,28 @@ export class Store {
|
|
|
904
953
|
wouldNeed: [],
|
|
905
954
|
};
|
|
906
955
|
}
|
|
956
|
+
/** Refuses a record named for an act that is of none of the kinds it takes — at its subject or any record argument — as a document's act on the wrong kind is refused. */
|
|
957
|
+
keepsToItsKinds(definition, call) {
|
|
958
|
+
const subject = definition.subject;
|
|
959
|
+
if (subject && subject.kinds !== "*")
|
|
960
|
+
this.ofKinds(definition, call.args[subject.arg], subject.kinds);
|
|
961
|
+
const shape = definition.input.shape ?? {};
|
|
962
|
+
for (const [name, field] of Object.entries(shape)) {
|
|
963
|
+
const kinds = name === subject?.arg ? undefined : heldRefKinds(field);
|
|
964
|
+
if (kinds)
|
|
965
|
+
this.ofKinds(definition, call.args[name], kinds);
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
ofKinds(definition, id, kinds) {
|
|
969
|
+
// A list of records: each one held to the kinds.
|
|
970
|
+
if (Array.isArray(id))
|
|
971
|
+
return id.forEach((one) => this.ofKinds(definition, one, kinds));
|
|
972
|
+
if (typeof id !== "string" || kinds.includes("*"))
|
|
973
|
+
return;
|
|
974
|
+
const node = this.graph.getNode(id);
|
|
975
|
+
if (node && !kinds.includes(node.kind))
|
|
976
|
+
throw new ActRefusal(`"${definition.title ?? definition.name}" acts on ${kinds.join(" or ")}, not on ${withArticle(node.kind)}`, "invalid");
|
|
977
|
+
}
|
|
907
978
|
/**
|
|
908
979
|
* AN ACT RUNS UNDER ITS AUTHOR'S SIGHT (FR-55). Its body, its guard, its
|
|
909
980
|
* refusal and its sentence read the store as the author is served it,
|
|
@@ -916,6 +987,7 @@ export class Store {
|
|
|
916
987
|
* the store's own graph.
|
|
917
988
|
*/
|
|
918
989
|
sighted(author) {
|
|
990
|
+
author = author && this.seated(author);
|
|
919
991
|
// Who `$me` is: the person, for an agent acting for one (Roadmap f-act-as-me).
|
|
920
992
|
const me = {
|
|
921
993
|
me: author && meIn(this.schema, author),
|
|
@@ -1005,6 +1077,18 @@ export class Store {
|
|
|
1005
1077
|
sees(principal, id) {
|
|
1006
1078
|
return this.graph.has(id) && seesId(this, principal)(id);
|
|
1007
1079
|
}
|
|
1080
|
+
/**
|
|
1081
|
+
* WHO `$me` IS FOR THIS SEAT HERE: the record it was bound to
|
|
1082
|
+
* (`bindPerson`), where it was; else its account's id, or its profile's
|
|
1083
|
+
* person (`meOf`). What a host or a view says "you" with.
|
|
1084
|
+
*/
|
|
1085
|
+
personOf(principal) {
|
|
1086
|
+
return meOf(this.seated(principal));
|
|
1087
|
+
}
|
|
1088
|
+
/** The seat as this store judges it now: its bound person read from the graph (`seatedIn`). */
|
|
1089
|
+
seated(principal) {
|
|
1090
|
+
return seatedIn(this.graph, principal);
|
|
1091
|
+
}
|
|
1008
1092
|
labels;
|
|
1009
1093
|
/**
|
|
1010
1094
|
* WHAT A NAME GIVEN FOR A NODE ARGUMENT MEANS, to this principal (FR-33).
|
|
@@ -1038,8 +1122,42 @@ export class Store {
|
|
|
1038
1122
|
return { ok: true, id: candidates[0].id, label: candidates[0].label, by: exactly ? "label" : "prefix" };
|
|
1039
1123
|
return refusalFor(this.schema, arg, given, candidates);
|
|
1040
1124
|
}
|
|
1041
|
-
/**
|
|
1125
|
+
/**
|
|
1126
|
+
* The kinds of administered modules this principal may not see at all.
|
|
1127
|
+
*
|
|
1128
|
+
* KEPT WHILE NOTHING IT READS HAS CHANGED: for a seat under a `sees` rule
|
|
1129
|
+
* it is worked out from every act the seat may do, and a page asks it for
|
|
1130
|
+
* each link it draws. The answer is kept per seat and asked again once
|
|
1131
|
+
* the store has told its subscribers anything, an op is logged, a change
|
|
1132
|
+
* is put back, or what judges a partial sight or offers publishing is
|
|
1133
|
+
* loaded. A seat is what working it out reads of the principal
|
|
1134
|
+
* (`keptKindsSeat`), so every visitor of a shared seat is one entry; at
|
|
1135
|
+
* most `KEPT_KINDS_SEATS` are kept at once. Each call is handed its own
|
|
1136
|
+
* copy: what a caller does to it is never the next caller's answer.
|
|
1137
|
+
*/
|
|
1042
1138
|
kindsKeptFrom(principal = HUMAN) {
|
|
1139
|
+
// Kept for the seat as it is bound now (`seatedIn`): a binding, and its undo, is another seat's answer.
|
|
1140
|
+
principal = this.seated(principal);
|
|
1141
|
+
const all = this.log.all();
|
|
1142
|
+
const state = `${this.told}|${this.log.length}|${all.at(-1)?.id ?? ""}|${fieldsJudged(this) ? 1 : 0}|${PUBLISHING.act ? 1 : 0}`;
|
|
1143
|
+
if (this.keptKinds?.state !== state)
|
|
1144
|
+
this.keptKinds = { state, seats: new Map() };
|
|
1145
|
+
const seats = this.keptKinds.seats;
|
|
1146
|
+
const seat = keptKindsSeat(principal);
|
|
1147
|
+
if (seat === undefined)
|
|
1148
|
+
return this.kindsKeptNow(principal);
|
|
1149
|
+
let kept = seats.get(seat);
|
|
1150
|
+
if (!kept) {
|
|
1151
|
+
kept = this.kindsKeptNow(principal);
|
|
1152
|
+
if (seats.size >= KEPT_KINDS_SEATS)
|
|
1153
|
+
seats.clear();
|
|
1154
|
+
seats.set(seat, kept);
|
|
1155
|
+
}
|
|
1156
|
+
return new Set(kept);
|
|
1157
|
+
}
|
|
1158
|
+
/** What `kindsKeptFrom` keeps: the store's state it was worked out at, and each seat's answer there, never handed out. */
|
|
1159
|
+
keptKinds;
|
|
1160
|
+
kindsKeptNow(principal) {
|
|
1043
1161
|
const kept = new Set();
|
|
1044
1162
|
for (const [name, module] of this.modules.administered) {
|
|
1045
1163
|
if (this.mayAdminister(name, principal))
|
|
@@ -1075,6 +1193,7 @@ export class Store {
|
|
|
1075
1193
|
* second list to keep in step.
|
|
1076
1194
|
*/
|
|
1077
1195
|
permittedMutations(principal = HUMAN) {
|
|
1196
|
+
principal = this.seated(principal);
|
|
1078
1197
|
const all = this.allMutations();
|
|
1079
1198
|
const declared = permittedMutations(this.policy, principal, all.filter((mutation) => !mutation.derived && mutation !== this.publisher));
|
|
1080
1199
|
// Publishing is offered to the declaration's publishers (Roadmap f-publishing-lifecycle).
|
|
@@ -1320,6 +1439,139 @@ export class Store {
|
|
|
1320
1439
|
}
|
|
1321
1440
|
});
|
|
1322
1441
|
}
|
|
1442
|
+
/** Who may: the policy's verdict on a call, refused as `apply` refuses it. */
|
|
1443
|
+
permittedTo(call, as) {
|
|
1444
|
+
// A vote is judged with no policy too: a shared seat's vote is refused whether or not the app says who may do what (Roadmap f-votes-shared-seat).
|
|
1445
|
+
const voting = this.voter !== undefined && this.mutations.get(call.name) === this.voter;
|
|
1446
|
+
const binding = this.binder !== undefined && this.mutations.get(call.name) === this.binder;
|
|
1447
|
+
const verdict = this.policy || (this.publisher && call.name === PUBLISH) || voting || binding || this.mutations.get(call.name) === this.proposer ? this.judged(call, as) : undefined;
|
|
1448
|
+
// Rehearsing a proposal, an act its author may propose stands as the reviewer's would (Roadmap f-proposals-for-review).
|
|
1449
|
+
if (verdict && !verdict.ok && !(this.proposing && this.mayPropose(call, as)))
|
|
1450
|
+
this.refuse(verdict.refusal, as.id);
|
|
1451
|
+
}
|
|
1452
|
+
/** What an agent was declared able to do, and the modules turned off. */
|
|
1453
|
+
declaredTo(call, as) {
|
|
1454
|
+
const refusal = this.refusesAgent(call, as) ?? this.namesTurnedOff(call, as);
|
|
1455
|
+
if (refusal)
|
|
1456
|
+
this.refuse(refusal, as.id);
|
|
1457
|
+
}
|
|
1458
|
+
/**
|
|
1459
|
+
* ONE CALL JUDGED AS `apply` JUDGES IT once who may has been asked: what
|
|
1460
|
+
* it names there for this seat, its input and its own rule (compiled),
|
|
1461
|
+
* the mark only binding writes, and what the app's own actor is held to.
|
|
1462
|
+
* What it makes, or the refusal thrown.
|
|
1463
|
+
*/
|
|
1464
|
+
judgedCall(definition, call, as, decided, hint) {
|
|
1465
|
+
const missing = this.missingFor(call, as);
|
|
1466
|
+
if (missing)
|
|
1467
|
+
throw missing;
|
|
1468
|
+
// An act takes only the kinds it names: its subject's, and each record argument's. Binding a person says its own refusal.
|
|
1469
|
+
if (definition !== this.binder)
|
|
1470
|
+
this.keepsToItsKinds(definition, call);
|
|
1471
|
+
let compiled;
|
|
1472
|
+
try {
|
|
1473
|
+
compiled = compileMutation(this.graph, definition, call.args, { ...this.sighted(as), hint });
|
|
1474
|
+
}
|
|
1475
|
+
catch (error) {
|
|
1476
|
+
// A press the act's own input refused: the watch tells a form filled wrongly from an act offered whole.
|
|
1477
|
+
if (error instanceof InvalidArguments && !this.rehearsing)
|
|
1478
|
+
tellTheWatchOfAnInputRefusal(error, as.id);
|
|
1479
|
+
throw error;
|
|
1480
|
+
}
|
|
1481
|
+
// Whose record a person is, only binding says (Roadmap f-invite-binds-existing-person): no other act writes the mark.
|
|
1482
|
+
if (definition !== this.binder && compiled.primitives.some((one) => (one.op === "add-node" && Object.hasOwn(one.node, PERSON_SEAT)) || (one.op === "patch-node" && Object.hasOwn(one.after, PERSON_SEAT)))) {
|
|
1483
|
+
throw new ActRefusal(`"${definition.title ?? definition.name}" cannot say whose record a person is: only binding an account to it does.`);
|
|
1484
|
+
}
|
|
1485
|
+
if (isAutomated(as)) {
|
|
1486
|
+
const refused = tidyingRefusal(this.schema, this.graph, compiled.primitives, this.authorName(as), { declaration: !this.suggesting && !decided });
|
|
1487
|
+
if (refused)
|
|
1488
|
+
this.refuse({ mutation: call.name, message: refused, wouldNeed: [] }, as.id);
|
|
1489
|
+
}
|
|
1490
|
+
return compiled;
|
|
1491
|
+
}
|
|
1492
|
+
/**
|
|
1493
|
+
* WHAT `apply` WOULD SAY OF ONE CALL, WITHOUT APPLYING IT: undefined where
|
|
1494
|
+
* it would run, else the refusal it would throw. The same steps `apply`
|
|
1495
|
+
* takes, in its order — who may, what an agent was declared able to do,
|
|
1496
|
+
* what the app's own actor is held to, what the call names for this seat,
|
|
1497
|
+
* its input and rule, the mark only binding writes — and what it makes
|
|
1498
|
+
* judged by `land` over the graph as it stands (`wouldRefuse`, handed in,
|
|
1499
|
+
* so a page carries none of it), the graph's own checks of a write.
|
|
1500
|
+
* Publishing, a vote and a proposal are judged by making their op as
|
|
1501
|
+
* `apply` makes it and keeping none (a proposal rehearses its calls, as it
|
|
1502
|
+
* does when applied). Where a kind follows another (`derives`), what
|
|
1503
|
+
* follows the change is worked out as `apply` works it out, over a copy of
|
|
1504
|
+
* the graph with the change made. A seat whose profile's person is not
|
|
1505
|
+
* made yet is judged as the person `apply` makes first, on the one copy of
|
|
1506
|
+
* the store `wouldDo` keeps for it. Nothing else is copied, nothing is
|
|
1507
|
+
* written and nobody is told. What `mayRun` (`@graview/core/seat`) asks.
|
|
1508
|
+
*/
|
|
1509
|
+
wouldApply(call, author, land) {
|
|
1510
|
+
const as = withValidProfile(author);
|
|
1511
|
+
const person = this.personFor(as);
|
|
1512
|
+
const store = person ? this.withPersonMade(as, person.id) : this;
|
|
1513
|
+
const was = store.rehearsing;
|
|
1514
|
+
store.rehearsing = true;
|
|
1515
|
+
try {
|
|
1516
|
+
store.stillNow();
|
|
1517
|
+
const spelled = store.spelledCall(call);
|
|
1518
|
+
store.permittedTo(spelled, as);
|
|
1519
|
+
store.declaredTo(spelled, as);
|
|
1520
|
+
if (isAutomated(as))
|
|
1521
|
+
store.refuseDeclined([spelled], as);
|
|
1522
|
+
if (isTidyingActor(as))
|
|
1523
|
+
store.refuseStopped([spelled], as, store.suggesting);
|
|
1524
|
+
const definition = store.mutation(spelled.name);
|
|
1525
|
+
// Publishing, a vote and a proposal make an op of their own, as `apply` makes it: each judged by making it and keeping none.
|
|
1526
|
+
const made = { id: `${PREVIEW_BATCH}:0`, at: store.now() };
|
|
1527
|
+
if (definition === store.publisher)
|
|
1528
|
+
return void PUBLISHING.op(store, made, spelled, PREVIEW_BATCH, as, {});
|
|
1529
|
+
if (definition === store.voter) {
|
|
1530
|
+
if (!VOTING.op)
|
|
1531
|
+
throw new GraphError("Load @graview/core/tidying to vote on a suggestion.");
|
|
1532
|
+
return void VOTING.op(store, made, spelled, PREVIEW_BATCH, as, {});
|
|
1533
|
+
}
|
|
1534
|
+
if (definition === store.proposer) {
|
|
1535
|
+
const ids = store.nextId;
|
|
1536
|
+
store.nextId = () => made.id;
|
|
1537
|
+
try {
|
|
1538
|
+
return void store.proposal(spelled, PREVIEW_BATCH, as, undefined);
|
|
1539
|
+
}
|
|
1540
|
+
finally {
|
|
1541
|
+
store.nextId = ids;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
const { primitives } = store.judgedCall(definition, spelled, as, false);
|
|
1545
|
+
if (primitives.length === 0)
|
|
1546
|
+
return undefined;
|
|
1547
|
+
const splices = store.asSplices(primitives, undefined).map(normalize);
|
|
1548
|
+
// Where a kind follows another, what follows a change is worked out over the graph the change leaves, as `apply` works it out: on a copy of the graph, the one place this asks one.
|
|
1549
|
+
if (keepsLinked(store.schema)) {
|
|
1550
|
+
const copy = Graph.from(store.schema, store.graph.snapshot(), { validate: store.validate });
|
|
1551
|
+
copy.applyPrimitives(splices);
|
|
1552
|
+
keepLinked(store.schema, copy, splices, { mayWriteBack: store.writesBack(as) });
|
|
1553
|
+
return undefined;
|
|
1554
|
+
}
|
|
1555
|
+
return land(store.graph, splices);
|
|
1556
|
+
}
|
|
1557
|
+
catch (error) {
|
|
1558
|
+
return error;
|
|
1559
|
+
}
|
|
1560
|
+
finally {
|
|
1561
|
+
store.rehearsing = was;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
/**
|
|
1565
|
+
* The store a seat's call is judged on: this one, or — for a seat whose
|
|
1566
|
+
* profile's person is not made yet — the one copy with that person made
|
|
1567
|
+
* that `wouldDo` keeps while this store stands. What `mayRun` reads a
|
|
1568
|
+
* seat's sight and records from, as `apply` would after making the person.
|
|
1569
|
+
*/
|
|
1570
|
+
judgedAs(author) {
|
|
1571
|
+
const as = withValidProfile(author);
|
|
1572
|
+
const person = this.personFor(as);
|
|
1573
|
+
return person ? this.withPersonMade(as, person.id) : this;
|
|
1574
|
+
}
|
|
1323
1575
|
/**
|
|
1324
1576
|
* HOW MANY TIMES THIS STORE HAS TOLD ITS SUBSCRIBERS SOMETHING, or would
|
|
1325
1577
|
* have: a change, an adopt, the day turning, something read beside the
|
|
@@ -1395,6 +1647,7 @@ export class Store {
|
|
|
1395
1647
|
mintBatch: () => PREVIEW_BATCH,
|
|
1396
1648
|
rehearsing: true,
|
|
1397
1649
|
personMade: undefined,
|
|
1650
|
+
keptKinds: undefined,
|
|
1398
1651
|
});
|
|
1399
1652
|
// Its own acts, so "Type text" reads the text back off the rehearsal's log, as the apply would off this one's.
|
|
1400
1653
|
const typer = this.typer && TYPING.typeText(twin);
|
|
@@ -1480,19 +1733,8 @@ export class Store {
|
|
|
1480
1733
|
* seat holds say what it may do at all; `may` narrows what THIS provider
|
|
1481
1734
|
* was brought in for, and the narrower of the two wins.
|
|
1482
1735
|
*/
|
|
1483
|
-
const permitted = (call, as = author) =>
|
|
1484
|
-
|
|
1485
|
-
const voting = this.voter !== undefined && this.mutations.get(call.name) === this.voter;
|
|
1486
|
-
const verdict = this.policy || (this.publisher && call.name === PUBLISH) || voting || this.mutations.get(call.name) === this.proposer ? this.judged(call, as) : undefined;
|
|
1487
|
-
// Rehearsing a proposal, an act its author may propose stands as the reviewer's would (Roadmap f-proposals-for-review).
|
|
1488
|
-
if (verdict && !verdict.ok && !(this.proposing && this.mayPropose(call, as)))
|
|
1489
|
-
this.refuse(verdict.refusal, as.id);
|
|
1490
|
-
};
|
|
1491
|
-
const declared = (call, as = author) => {
|
|
1492
|
-
const refusal = this.refusesAgent(call, as) ?? this.namesTurnedOff(call, as);
|
|
1493
|
-
if (refusal)
|
|
1494
|
-
this.refuse(refusal, as.id);
|
|
1495
|
-
};
|
|
1736
|
+
const permitted = (call, as = author) => this.permittedTo(call, as);
|
|
1737
|
+
const declared = (call, as = author) => this.declaredTo(call, as);
|
|
1496
1738
|
/* A call that names a record an earlier call makes (`{ $made: n }`, FR-193) is asked once that record is there to name. */
|
|
1497
1739
|
const naming = calls.map(namesMade);
|
|
1498
1740
|
calls.forEach((call, at) => naming[at] || permitted(call));
|
|
@@ -1582,26 +1824,9 @@ export class Store {
|
|
|
1582
1824
|
intents.push(op.intent);
|
|
1583
1825
|
continue;
|
|
1584
1826
|
}
|
|
1585
|
-
const
|
|
1586
|
-
if (missing)
|
|
1587
|
-
throw missing;
|
|
1588
|
-
let compiled;
|
|
1589
|
-
try {
|
|
1590
|
-
compiled = compileMutation(this.graph, definition, call.args, { ...this.sighted(as), hint });
|
|
1591
|
-
}
|
|
1592
|
-
catch (error) {
|
|
1593
|
-
// A press the act's own input refused: the watch tells a form filled wrongly from an act offered whole.
|
|
1594
|
-
if (error instanceof InvalidArguments && !this.rehearsing)
|
|
1595
|
-
tellTheWatchOfAnInputRefusal(error, as.id);
|
|
1596
|
-
throw error;
|
|
1597
|
-
}
|
|
1827
|
+
const compiled = this.judgedCall(definition, call, as, decided, hint);
|
|
1598
1828
|
if (hint !== undefined && compiled.firstMinted !== undefined && compiled.firstMinted !== hint)
|
|
1599
1829
|
renamed.set(hint, compiled.firstMinted);
|
|
1600
|
-
if (isAutomated(as)) {
|
|
1601
|
-
const refused = tidyingRefusal(this.schema, this.graph, compiled.primitives, this.authorName(as), { declaration: !this.suggesting && !decided });
|
|
1602
|
-
if (refused)
|
|
1603
|
-
this.refuse({ mutation: call.name, message: refused, wouldNeed: [] }, as.id);
|
|
1604
|
-
}
|
|
1605
1830
|
/*
|
|
1606
1831
|
* AN ACT THAT DID NOTHING DOES NOT GO IN THE HISTORY.
|
|
1607
1832
|
*
|
|
@@ -2066,6 +2291,19 @@ export class Store {
|
|
|
2066
2291
|
const stop = DECLINES.undoRefusal ? DECLINES.undoRefusal(this, ops, author) : ops.some((target) => target.undoes !== undefined && target.mutation === null && (target.lineage?.stopsKind || target.lineage?.liftedStop)) ? { mutation: "undo", wouldNeed: [], message: "This cannot be taken back here yet." } : undefined;
|
|
2067
2292
|
if (stop)
|
|
2068
2293
|
return stop;
|
|
2294
|
+
/*
|
|
2295
|
+
* A BINDING STAYS ONCE ITS SEAT HAS ACTED AS THE RECORD (Roadmap
|
|
2296
|
+
* f-invite-binds-existing-person): taking it back would leave what they
|
|
2297
|
+
* did to whoever is bound there next. Judged by `@graview/core/binding`;
|
|
2298
|
+
* a store that has not loaded it takes no binding back.
|
|
2299
|
+
*/
|
|
2300
|
+
for (const target of ops) {
|
|
2301
|
+
if (target.undoes !== undefined || target.mutation?.name !== BIND_PERSON)
|
|
2302
|
+
continue;
|
|
2303
|
+
const kept = BINDING.undo ? BINDING.undo(this, target) : "This binding cannot be taken back here.";
|
|
2304
|
+
if (kept)
|
|
2305
|
+
return { mutation: "undo", wouldNeed: [], message: kept };
|
|
2306
|
+
}
|
|
2069
2307
|
if (this.policy || this.publisher) {
|
|
2070
2308
|
for (const target of ops) {
|
|
2071
2309
|
/*
|
|
@@ -2122,7 +2360,7 @@ export class Store {
|
|
|
2122
2360
|
* it" is everybody's to run, and undoing Ann's was taking back her vote.
|
|
2123
2361
|
*/
|
|
2124
2362
|
/* What the act wrote as them: the profile's person, where they were one. */
|
|
2125
|
-
const names = (value) => JSON.stringify(value).includes(JSON.stringify(meOf(judged.author)));
|
|
2363
|
+
const names = (value) => JSON.stringify(value).includes(JSON.stringify(meOf(this.seated(judged.author))));
|
|
2126
2364
|
const verdict = by !== undefined && by !== actingAs(author).id && !isSystem(author) && !names(judged.mutation.args) && names(judged.primitives)
|
|
2127
2365
|
? { ok: false, refusal: { mutation: judged.mutation.name, wouldNeed: [], message: "it was done as somebody else." } }
|
|
2128
2366
|
: this.judged(judged.mutation, author, true);
|
|
@@ -2156,6 +2394,7 @@ export class Store {
|
|
|
2156
2394
|
* record: one removed stays removed.
|
|
2157
2395
|
*/
|
|
2158
2396
|
personFor(author) {
|
|
2397
|
+
author = this.seated(author);
|
|
2159
2398
|
const profile = profileOf(author);
|
|
2160
2399
|
const id = meOf(author);
|
|
2161
2400
|
if (!profile || id === undefined)
|
|
@@ -2182,6 +2421,7 @@ export class Store {
|
|
|
2182
2421
|
* refused in the words it would refuse in, with a profile or without.
|
|
2183
2422
|
*/
|
|
2184
2423
|
hasNoRecord(author, bySight = true) {
|
|
2424
|
+
author = this.seated(author);
|
|
2185
2425
|
const people = this.schema.definitions.find((definition) => definition.people);
|
|
2186
2426
|
if (!people)
|
|
2187
2427
|
return false;
|
|
@@ -2272,6 +2512,8 @@ export class Store {
|
|
|
2272
2512
|
this.graph.load(rollback);
|
|
2273
2513
|
if (this.log.length > kept)
|
|
2274
2514
|
this.log.truncate(kept);
|
|
2515
|
+
// What a seat is kept from, if a host's `admit` asked it of the change put back: never an answer for whatever is logged at that length next.
|
|
2516
|
+
this.keptKinds = undefined;
|
|
2275
2517
|
}
|
|
2276
2518
|
/** Asks the host's `admit`, when there is one, with the change as planned; one it refuses is put back, and its word goes on up. */
|
|
2277
2519
|
admitted(options, ops, primitives, diff, rollback, kept) {
|