@graview/core 0.2.5 → 0.2.7
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/archived-seen.d.ts.map +1 -1
- package/dist/archived-seen.js +1 -0
- package/dist/archived-seen.js.map +1 -1
- package/dist/arrangement.d.ts +2 -0
- package/dist/arrangement.d.ts.map +1 -1
- package/dist/arrangement.js +1 -1
- package/dist/arrangement.js.map +1 -1
- package/dist/arranging.js +2 -2
- package/dist/arranging.js.map +1 -1
- package/dist/binding-served.d.ts +23 -3
- package/dist/binding-served.d.ts.map +1 -1
- package/dist/binding-served.js +51 -2
- package/dist/binding-served.js.map +1 -1
- package/dist/binding-ungranted.d.ts +6 -1
- package/dist/binding-ungranted.d.ts.map +1 -1
- package/dist/binding-ungranted.js +21 -6
- package/dist/binding-ungranted.js.map +1 -1
- package/dist/binding.d.ts +39 -0
- package/dist/binding.d.ts.map +1 -1
- package/dist/binding.js +380 -29
- package/dist/binding.js.map +1 -1
- package/dist/cli/check/policy.d.ts +1 -1
- package/dist/cli/check/policy.d.ts.map +1 -1
- package/dist/cli/check/policy.js +17 -11
- package/dist/cli/check/policy.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +7 -1
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/document-schema.d.ts.map +1 -1
- package/dist/cli/document-schema.js +9 -2
- package/dist/cli/document-schema.js.map +1 -1
- package/dist/clock.d.ts +2 -1
- package/dist/clock.d.ts.map +1 -1
- package/dist/clock.js +2 -2
- package/dist/clock.js.map +1 -1
- package/dist/document/blocks.js +1 -1
- package/dist/document/blocks.js.map +1 -1
- package/dist/document/compile.d.ts.map +1 -1
- package/dist/document/compile.js +40 -13
- package/dist/document/compile.js.map +1 -1
- package/dist/document/compiled.d.ts +2 -1
- package/dist/document/compiled.d.ts.map +1 -1
- package/dist/document/compiled.js +24 -1
- package/dist/document/compiled.js.map +1 -1
- package/dist/document/computed-values.d.ts +4 -1
- package/dist/document/computed-values.d.ts.map +1 -1
- package/dist/document/computed-values.js +3 -3
- package/dist/document/computed-values.js.map +1 -1
- package/dist/document/describe-place.js +5 -5
- package/dist/document/describe-place.js.map +1 -1
- package/dist/document/edit.js +8 -8
- package/dist/document/edit.js.map +1 -1
- package/dist/document/expr/evaluate.d.ts.map +1 -1
- package/dist/document/expr/evaluate.js +25 -8
- package/dist/document/expr/evaluate.js.map +1 -1
- package/dist/document/expr/when.d.ts +9 -0
- package/dist/document/expr/when.d.ts.map +1 -1
- package/dist/document/expr/when.js +22 -0
- package/dist/document/expr/when.js.map +1 -1
- package/dist/document/graview-template.d.ts.map +1 -1
- package/dist/document/graview-template.js +3 -1
- package/dist/document/graview-template.js.map +1 -1
- package/dist/document/rules.js +9 -9
- package/dist/document/rules.js.map +1 -1
- package/dist/document/schema.d.ts +19 -4
- package/dist/document/schema.d.ts.map +1 -1
- package/dist/document/schema.js +20 -2
- package/dist/document/schema.js.map +1 -1
- package/dist/document/template.d.ts.map +1 -1
- package/dist/document/template.js +2 -1
- package/dist/document/template.js.map +1 -1
- package/dist/document.schema.json +199 -179
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/invariants/engine.js +2 -2
- package/dist/invariants/engine.js.map +1 -1
- package/dist/invariants/types.d.ts +4 -0
- package/dist/invariants/types.d.ts.map +1 -1
- package/dist/jobs.js +1 -1
- package/dist/jobs.js.map +1 -1
- package/dist/lines.d.ts.map +1 -1
- package/dist/lines.js +3 -2
- package/dist/lines.js.map +1 -1
- package/dist/linked.js +1 -1
- package/dist/linked.js.map +1 -1
- package/dist/ops/undo.d.ts.map +1 -1
- package/dist/ops/undo.js +27 -3
- package/dist/ops/undo.js.map +1 -1
- package/dist/past.d.ts.map +1 -1
- package/dist/past.js +1 -0
- package/dist/past.js.map +1 -1
- package/dist/scaffold/index.d.ts +1 -1
- package/dist/scaffold/index.d.ts.map +1 -1
- package/dist/scaffold/index.js +1 -1
- package/dist/scaffold/index.js.map +1 -1
- package/dist/scaffold/project.d.ts +7 -0
- package/dist/scaffold/project.d.ts.map +1 -1
- package/dist/scaffold/project.js +21 -2
- package/dist/scaffold/project.js.map +1 -1
- package/dist/schema/define-node.d.ts +3 -1
- package/dist/schema/define-node.d.ts.map +1 -1
- package/dist/schema/define-node.js +12 -3
- package/dist/schema/define-node.js.map +1 -1
- package/dist/search.js +1 -1
- package/dist/search.js.map +1 -1
- package/dist/shown-list.d.ts +2 -0
- package/dist/shown-list.d.ts.map +1 -1
- package/dist/shown-list.js +2 -1
- package/dist/shown-list.js.map +1 -1
- package/dist/store.d.ts +25 -2
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +75 -24
- package/dist/store.js.map +1 -1
- package/dist/subscriptions.d.ts.map +1 -1
- package/dist/subscriptions.js +5 -3
- package/dist/subscriptions.js.map +1 -1
- package/dist/sync/engine.js +1 -1
- package/dist/sync/engine.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/views/types.d.ts +8 -0
- package/dist/views/types.d.ts.map +1 -1
- package/dist/views/types.js +1 -1
- package/dist/views/types.js.map +1 -1
- package/dist/workflows/findings.d.ts.map +1 -1
- package/dist/workflows/findings.js +15 -2
- package/dist/workflows/findings.js.map +1 -1
- package/dist/workflows/policies.d.ts +2 -1
- package/dist/workflows/policies.d.ts.map +1 -1
- package/dist/workflows/policies.js +3 -2
- package/dist/workflows/policies.js.map +1 -1
- package/dist/workflows/triggered.d.ts.map +1 -1
- package/dist/workflows/triggered.js +2 -1
- package/dist/workflows/triggered.js.map +1 -1
- package/dist/workflows/values.js +1 -1
- package/dist/workflows/values.js.map +1 -1
- package/package.json +2 -2
package/dist/store.js
CHANGED
|
@@ -20,7 +20,7 @@ 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 {
|
|
23
|
+
import { BINDING, boundAtHorizon, isBindingAct } from "./binding-served.js";
|
|
24
24
|
import { PERSON_SEAT } from "./graph/archived.js";
|
|
25
25
|
import { ActRefusal } from "./refused.js";
|
|
26
26
|
import { advisoryVoterOf, signedOutSeat, SIGN_IN_TO_VOTE, VOTE_SUGGESTION, VOTING, voteSuggestionMutation } from "./mutations/vote-suggestion.js";
|
|
@@ -229,8 +229,12 @@ export class Store {
|
|
|
229
229
|
voter;
|
|
230
230
|
/** "Propose changes" (Roadmap f-proposals-for-review), when the app declared no act by that name. */
|
|
231
231
|
proposer;
|
|
232
|
-
/** "Bind a person" (Roadmap f-invite-binds-existing-person): answered where a kind is the people, offered by no list. */
|
|
233
|
-
|
|
232
|
+
/** "Bind a person" and "Move a person" (Roadmap f-invite-binds-existing-person, f-rebind-after-acting), by name: answered where a kind is the people, offered by no list. */
|
|
233
|
+
binders = new Map();
|
|
234
|
+
/** Whether an act is one `@graview/core/binding` made: judged by it, and offered by no list. */
|
|
235
|
+
isBinder(mutation) {
|
|
236
|
+
return mutation !== undefined && this.binders.get(mutation.name) === mutation;
|
|
237
|
+
}
|
|
234
238
|
invariants;
|
|
235
239
|
invariantOptions;
|
|
236
240
|
policy;
|
|
@@ -287,6 +291,18 @@ export class Store {
|
|
|
287
291
|
ticked;
|
|
288
292
|
/** The app's time zone (`StoreOptions.timeZone`): the day today() reads is the date there. */
|
|
289
293
|
timeZone;
|
|
294
|
+
/** The zone the app declares (`StoreOptions.appTimeZone`): what the rule language reads an instant on. */
|
|
295
|
+
appTimeZone;
|
|
296
|
+
/**
|
|
297
|
+
* THE ZONE THE STORE'S DAY IS IN: the app's, else UTC's where the host
|
|
298
|
+
* gave only its own clock (`timeZone` with `appTimeZone: null`), else none
|
|
299
|
+
* — the clock as it reads. What `today()` says, the day rules are judged
|
|
300
|
+
* on, and the midnight `tickEachDay` turns it at: an app with no zone keeps
|
|
301
|
+
* UTC's day on every host.
|
|
302
|
+
*/
|
|
303
|
+
get dayTimeZone() {
|
|
304
|
+
return this.appTimeZone ?? (this.timeZone ? "UTC" : undefined);
|
|
305
|
+
}
|
|
290
306
|
/** Where this store stands in the past, when it is one (`pastOf`): read, never changed. */
|
|
291
307
|
past;
|
|
292
308
|
/** How often `pastOf` keeps a point to fold from, in ops (`StoreOptions.pastEvery`). */
|
|
@@ -301,9 +317,10 @@ export class Store {
|
|
|
301
317
|
this.invariants = options.invariants ?? [];
|
|
302
318
|
this.invariantOptions = options.invariantOptions ?? {};
|
|
303
319
|
this.timeZone = options.timeZone;
|
|
320
|
+
this.appTimeZone = options.appTimeZone === null ? undefined : (options.appTimeZone ?? options.timeZone);
|
|
304
321
|
// A store that knows its app's zone begins on the day there, so the first turn of the day says what it moved.
|
|
305
|
-
if (this.
|
|
306
|
-
this.ticked = { day: isoToday(this.
|
|
322
|
+
if (this.dayTimeZone)
|
|
323
|
+
this.ticked = { day: isoToday(this.dayTimeZone), on: isoToday(this.dayTimeZone) };
|
|
307
324
|
this.policy = options.policy;
|
|
308
325
|
this.publishing = options.publishing;
|
|
309
326
|
this.tidying = options.tidying;
|
|
@@ -328,7 +345,7 @@ export class Store {
|
|
|
328
345
|
throw new GraphError(`Duplicate mutation "${mutation.name}"`);
|
|
329
346
|
}
|
|
330
347
|
// A name the framework keeps for an act of its own is never an app's (`binding-act-taken`): the framework's answers it.
|
|
331
|
-
if (mutation.name
|
|
348
|
+
if (isBindingAct(mutation.name))
|
|
332
349
|
continue;
|
|
333
350
|
this.mutations.set(mutation.name, mutation);
|
|
334
351
|
}
|
|
@@ -340,7 +357,7 @@ export class Store {
|
|
|
340
357
|
* invariants — and by the policy, through the acts that already write or
|
|
341
358
|
* create the kind (see `permits`). Nothing an app declares is replaced.
|
|
342
359
|
*/
|
|
343
|
-
for (const mutation of options.past ? [] : deriveMutations(options.schema, (options.mutations ?? []).filter((mutation) => mutation.name
|
|
360
|
+
for (const mutation of options.past ? [] : deriveMutations(options.schema, (options.mutations ?? []).filter((mutation) => !isBindingAct(mutation.name)))) {
|
|
344
361
|
this.mutations.set(mutation.name, mutation);
|
|
345
362
|
}
|
|
346
363
|
// "Keep this link" (FR-172): answered by every store, offered by no list. An app's own `keep-link` keeps its name.
|
|
@@ -552,11 +569,13 @@ export class Store {
|
|
|
552
569
|
// "Type text" (Roadmap f-collab-text): answered by every store once `@graview/core/typing` is loaded, and offered by no list.
|
|
553
570
|
if (name === TYPE_TEXT && !this.typer && TYPING.typeText && !this.past && !this.mutations.has(name))
|
|
554
571
|
this.mutations.set(name, (this.typer = TYPING.typeText(this)));
|
|
555
|
-
// "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.
|
|
556
|
-
if (name
|
|
557
|
-
const binder = BINDING.act(this);
|
|
558
|
-
if (binder)
|
|
559
|
-
this.
|
|
572
|
+
// "Bind a person" and "Move a person" (Roadmap f-invite-binds-existing-person, f-rebind-after-acting): answered where a kind is the people once the host loads `@graview/core/binding`, and offered by no list.
|
|
573
|
+
if (isBindingAct(name) && !this.binders.has(name) && BINDING.act && !this.past) {
|
|
574
|
+
const binder = BINDING.act(this, name);
|
|
575
|
+
if (binder) {
|
|
576
|
+
this.binders.set(name, binder);
|
|
577
|
+
this.mutations.set(name, binder);
|
|
578
|
+
}
|
|
560
579
|
}
|
|
561
580
|
return this.mutations.has(name) ? name : (actSpelledAs(name, this.mutations.keys()) ?? name);
|
|
562
581
|
}
|
|
@@ -633,7 +652,7 @@ export class Store {
|
|
|
633
652
|
return mutation.derived !== undefined && this.modules.disabledKinds.has(mutation.derived.kind);
|
|
634
653
|
}
|
|
635
654
|
allMutations() {
|
|
636
|
-
return [...this.mutations.values(), ...(this.publisher ? [this.publisher] : [])].filter((mutation) => mutation !== this.keeper && mutation !== this.typer && mutation !== this.voter && mutation !== this.proposer &&
|
|
655
|
+
return [...this.mutations.values(), ...(this.publisher ? [this.publisher] : [])].filter((mutation) => mutation !== this.keeper && mutation !== this.typer && mutation !== this.voter && mutation !== this.proposer && !this.isBinder(mutation) && !this.mutationDisabled(mutation));
|
|
637
656
|
}
|
|
638
657
|
/** The declared acts a derived act resolves its permission through; keeping a link, those that make or break its relation. */
|
|
639
658
|
viaOf(mutation, call, principal) {
|
|
@@ -743,7 +762,7 @@ export class Store {
|
|
|
743
762
|
if (nobody)
|
|
744
763
|
return { ok: false, refusal: nobody };
|
|
745
764
|
// Binding a seat to a person is judged by `@graview/core/binding`, which made the act: the host, or a grant that names it.
|
|
746
|
-
if (mutation &&
|
|
765
|
+
if (mutation && this.isBinder(mutation))
|
|
747
766
|
return BINDING.judged(this, call, principal);
|
|
748
767
|
// Publishing is the declaration's `publishers`, not a grant's.
|
|
749
768
|
if (mutation && mutation === this.publisher)
|
|
@@ -827,7 +846,7 @@ export class Store {
|
|
|
827
846
|
return false;
|
|
828
847
|
call = this.spelledCall(call);
|
|
829
848
|
const mutation = this.mutations.get(call.name);
|
|
830
|
-
if (!mutation || mutation === this.proposer || mutation === this.voter ||
|
|
849
|
+
if (!mutation || mutation === this.proposer || mutation === this.voter || this.isBinder(mutation) || this.refusesAgent(call, principal) || this.namesTurnedOff(call, principal))
|
|
831
850
|
return false;
|
|
832
851
|
return !this.permits(call, principal).ok && proposes(this.policy, principal, call.name, this.subjectKindOf(call, principal));
|
|
833
852
|
}
|
|
@@ -1313,7 +1332,8 @@ export class Store {
|
|
|
1313
1332
|
* that day, and an app in New York about New York's.
|
|
1314
1333
|
*/
|
|
1315
1334
|
today() {
|
|
1316
|
-
|
|
1335
|
+
const zone = this.dayTimeZone;
|
|
1336
|
+
return this.pinned() ?? (this.ticked && this.ticked.on === isoToday(zone) ? this.ticked.day : undefined) ?? (zone ? isoToday(zone) : undefined);
|
|
1317
1337
|
}
|
|
1318
1338
|
/** The day `invariantOptions` pins, if it pins one: a tick does not move it. */
|
|
1319
1339
|
pinned() {
|
|
@@ -1331,7 +1351,7 @@ export class Store {
|
|
|
1331
1351
|
// A rule written as a function reads the day from its context too, as `openStore` handed it (W-186): the app's, where the store knows its zone and the call hands no context of its own.
|
|
1332
1352
|
const base = linking ?? given;
|
|
1333
1353
|
const judged = this.timeZone && today !== undefined && context === undefined && !(base && "today" in base) ? { ...base, today } : linking;
|
|
1334
|
-
return { ...this.invariantOptions, ...(judged === undefined ? {} : { context: judged }), ...(today === undefined ? {} : { today }) };
|
|
1354
|
+
return { ...this.invariantOptions, ...(judged === undefined ? {} : { context: judged }), ...(today === undefined ? {} : { today }), ...(this.appTimeZone && this.invariantOptions.timeZone === undefined ? { timeZone: this.appTimeZone } : {}) };
|
|
1335
1355
|
}
|
|
1336
1356
|
/**
|
|
1337
1357
|
* THE DAY TURNED (FR-176). Rules are judged on every change and once on
|
|
@@ -1357,8 +1377,8 @@ export class Store {
|
|
|
1357
1377
|
const pinned = this.pinned();
|
|
1358
1378
|
if (pinned !== undefined)
|
|
1359
1379
|
return { day: pinned, was: pinned, appeared: [], cleared: [] };
|
|
1360
|
-
const day = dayOf(now, this.
|
|
1361
|
-
const on = isoToday(this.
|
|
1380
|
+
const day = dayOf(now, this.dayTimeZone);
|
|
1381
|
+
const on = isoToday(this.dayTimeZone);
|
|
1362
1382
|
// What stood is judged on the day the store was last ticked to, even when the clock has just left it: the turn at midnight says what it moved.
|
|
1363
1383
|
if (this.ticked)
|
|
1364
1384
|
this.ticked = { day: this.ticked.day, on };
|
|
@@ -1509,7 +1529,7 @@ export class Store {
|
|
|
1509
1529
|
permittedTo(call, as) {
|
|
1510
1530
|
// 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).
|
|
1511
1531
|
const voting = this.voter !== undefined && this.mutations.get(call.name) === this.voter;
|
|
1512
|
-
const binding = this.
|
|
1532
|
+
const binding = this.isBinder(this.mutations.get(call.name));
|
|
1513
1533
|
const verdict = this.policy || (this.publisher && call.name === PUBLISH) || voting || binding || this.mutations.get(call.name) === this.proposer ? this.judged(call, as) : undefined;
|
|
1514
1534
|
// Rehearsing a proposal, an act its author may propose stands as the reviewer's would (Roadmap f-proposals-for-review).
|
|
1515
1535
|
if (verdict && !verdict.ok && !(this.proposing && this.mayPropose(call, as)))
|
|
@@ -1532,7 +1552,7 @@ export class Store {
|
|
|
1532
1552
|
if (missing)
|
|
1533
1553
|
throw missing;
|
|
1534
1554
|
// An act takes only the kinds it names: its subject's, and each record argument's. Binding a person says its own refusal.
|
|
1535
|
-
if (
|
|
1555
|
+
if (!this.isBinder(definition))
|
|
1536
1556
|
this.keepsToItsKinds(definition, call);
|
|
1537
1557
|
let compiled;
|
|
1538
1558
|
try {
|
|
@@ -1545,7 +1565,7 @@ export class Store {
|
|
|
1545
1565
|
throw error;
|
|
1546
1566
|
}
|
|
1547
1567
|
// Whose record a person is, only binding says (Roadmap f-invite-binds-existing-person): no other act writes the mark.
|
|
1548
|
-
if (
|
|
1568
|
+
if (!this.isBinder(definition) && compiled.primitives.some((one) => (one.op === "add-node" && Object.hasOwn(one.node, PERSON_SEAT)) || (one.op === "patch-node" && Object.hasOwn(one.after, PERSON_SEAT)))) {
|
|
1549
1569
|
throw new ActRefusal(`"${definition.title ?? definition.name}" cannot say whose record a person is: only binding an account to it does.`);
|
|
1550
1570
|
}
|
|
1551
1571
|
if (isAutomated(as)) {
|
|
@@ -2366,12 +2386,31 @@ export class Store {
|
|
|
2366
2386
|
const message = seen.ok ? "Cannot undo on its own — a later change you cannot see depends on it, which only somebody who can see it can take back." : seen.message;
|
|
2367
2387
|
return { ok: false, ops: [], blockedBy: [], includeBatches: [], message, ...(check.reason ? { reason: check.reason } : {}) };
|
|
2368
2388
|
}
|
|
2389
|
+
/** The record a seat was bound to just before `seq`: from the bindings where the log begins, through every one it holds since. Undefined where it was bound to none. */
|
|
2390
|
+
boundWhen(seat, seq) {
|
|
2391
|
+
let record = [...boundAtHorizon(this)].find(([, one]) => one === seat)?.[0];
|
|
2392
|
+
for (const op of this.log.all()) {
|
|
2393
|
+
if (op.seq >= seq)
|
|
2394
|
+
break;
|
|
2395
|
+
for (const primitive of op.primitives) {
|
|
2396
|
+
if (primitive.op === "add-node" && primitive.node[PERSON_SEAT] === seat)
|
|
2397
|
+
record = primitive.node.id;
|
|
2398
|
+
else if (primitive.op === "patch-node" && Object.hasOwn(primitive.after, PERSON_SEAT)) {
|
|
2399
|
+
if (primitive.after[PERSON_SEAT] === seat)
|
|
2400
|
+
record = primitive.id;
|
|
2401
|
+
else if (record === primitive.id)
|
|
2402
|
+
record = undefined;
|
|
2403
|
+
}
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
return record;
|
|
2407
|
+
}
|
|
2369
2408
|
/** Why a binding among these ops stays (`BINDING.undo`), or nothing. */
|
|
2370
2409
|
bindingKept(ops) {
|
|
2371
2410
|
for (const target of ops) {
|
|
2372
2411
|
// Judged as the change its undo chain begins with, however often it was taken back and put back.
|
|
2373
2412
|
const root = this.rootOf(target);
|
|
2374
|
-
if (root.mutation?.name
|
|
2413
|
+
if (!isBindingAct(root.mutation?.name))
|
|
2375
2414
|
continue;
|
|
2376
2415
|
const kept = BINDING.undo ? BINDING.undo(this, target, root) : "This binding cannot be taken back here.";
|
|
2377
2416
|
if (kept)
|
|
@@ -2394,6 +2433,15 @@ export class Store {
|
|
|
2394
2433
|
const kept = this.bindingKept(ops);
|
|
2395
2434
|
if (kept)
|
|
2396
2435
|
return kept;
|
|
2436
|
+
// Taken back by whoever may make it, with a policy or without one: the host's own seat (Roadmap f-rebind-follow-ups).
|
|
2437
|
+
for (const target of ops) {
|
|
2438
|
+
const root = this.rootOf(target);
|
|
2439
|
+
if (!isBindingAct(root.mutation?.name) || !BINDING.judged)
|
|
2440
|
+
continue;
|
|
2441
|
+
const verdict = BINDING.judged(this, root.mutation, author);
|
|
2442
|
+
if (!verdict.ok)
|
|
2443
|
+
return { ...verdict.refusal, message: `Not permitted to undo "${target.intent}": ${verdict.refusal.message}` };
|
|
2444
|
+
}
|
|
2397
2445
|
if (this.policy || this.publisher) {
|
|
2398
2446
|
for (const target of ops) {
|
|
2399
2447
|
/*
|
|
@@ -2453,7 +2501,10 @@ export class Store {
|
|
|
2453
2501
|
// Or the record the seat was bound to last, where it is bound to none now: what it did is still theirs.
|
|
2454
2502
|
const seatOfAuthor = seatPersonOf(judged.author);
|
|
2455
2503
|
const doneAs = meOf(this.seated(judged.author)) ?? (seatOfAuthor === undefined ? undefined : everBound(this).get(seatOfAuthor));
|
|
2456
|
-
|
|
2504
|
+
// And the record it was done as then: a person moved to another record since still did what they did as the first (Roadmap f-rebind-after-acting).
|
|
2505
|
+
const doneAsThen = seatOfAuthor === undefined ? undefined : this.boundWhen(seatOfAuthor, judged.seq);
|
|
2506
|
+
const named = (value, id) => id !== undefined && (JSON.stringify(value) ?? "").includes(JSON.stringify(id));
|
|
2507
|
+
const names = (value) => named(value, doneAs) || (doneAsThen !== doneAs && named(value, doneAsThen));
|
|
2457
2508
|
const verdict = by !== undefined && by !== actingAs(author).id && !isSystem(author) && !names(judged.mutation.args) && names(judged.primitives)
|
|
2458
2509
|
? { ok: false, refusal: { mutation: judged.mutation.name, wouldNeed: [], message: "it was done as somebody else." } }
|
|
2459
2510
|
: this.judged(judged.mutation, author, true);
|