@graview/core 0.1.73 → 0.2.0

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.
Files changed (246) hide show
  1. package/README.md +7 -0
  2. package/dist/app-places.d.ts +1 -0
  3. package/dist/app-places.d.ts.map +1 -1
  4. package/dist/app-places.js +117 -1
  5. package/dist/app-places.js.map +1 -1
  6. package/dist/app.d.ts +13 -0
  7. package/dist/app.d.ts.map +1 -1
  8. package/dist/app.js.map +1 -1
  9. package/dist/arrangement.d.ts.map +1 -1
  10. package/dist/arrangement.js +3 -0
  11. package/dist/arrangement.js.map +1 -1
  12. package/dist/blocks.d.ts +1 -0
  13. package/dist/blocks.d.ts.map +1 -1
  14. package/dist/blocks.js +2 -0
  15. package/dist/blocks.js.map +1 -1
  16. package/dist/check.d.ts +1 -1
  17. package/dist/check.d.ts.map +1 -1
  18. package/dist/check.js +1 -1
  19. package/dist/check.js.map +1 -1
  20. package/dist/cli/check/devices.d.ts +12 -0
  21. package/dist/cli/check/devices.d.ts.map +1 -0
  22. package/dist/cli/check/devices.js +25 -0
  23. package/dist/cli/check/devices.js.map +1 -0
  24. package/dist/cli/check/index.d.ts +1 -0
  25. package/dist/cli/check/index.d.ts.map +1 -1
  26. package/dist/cli/check/index.js +1 -0
  27. package/dist/cli/check/index.js.map +1 -1
  28. package/dist/cli/check/lenses.js +2 -2
  29. package/dist/cli/check/lenses.js.map +1 -1
  30. package/dist/cli/check/relations.js +1 -1
  31. package/dist/cli/check/relations.js.map +1 -1
  32. package/dist/cli/check.d.ts.map +1 -1
  33. package/dist/cli/check.js +2 -1
  34. package/dist/cli/check.js.map +1 -1
  35. package/dist/cli/create.d.ts +1 -1
  36. package/dist/cli/create.d.ts.map +1 -1
  37. package/dist/cli/create.js +34 -3
  38. package/dist/cli/create.js.map +1 -1
  39. package/dist/cli/document-schema.d.ts.map +1 -1
  40. package/dist/cli/document-schema.js +7 -0
  41. package/dist/cli/document-schema.js.map +1 -1
  42. package/dist/cli/index.d.ts +1 -1
  43. package/dist/cli/index.d.ts.map +1 -1
  44. package/dist/cli/index.js +23 -3
  45. package/dist/cli/index.js.map +1 -1
  46. package/dist/cli/types.d.ts.map +1 -1
  47. package/dist/cli/types.js +1 -0
  48. package/dist/cli/types.js.map +1 -1
  49. package/dist/compose-home.d.ts +48 -0
  50. package/dist/compose-home.d.ts.map +1 -0
  51. package/dist/compose-home.js +190 -0
  52. package/dist/compose-home.js.map +1 -0
  53. package/dist/compose.d.ts +8 -0
  54. package/dist/compose.d.ts.map +1 -1
  55. package/dist/compose.js +21 -17
  56. package/dist/compose.js.map +1 -1
  57. package/dist/days.d.ts +15 -1
  58. package/dist/days.d.ts.map +1 -1
  59. package/dist/days.js +56 -3
  60. package/dist/days.js.map +1 -1
  61. package/dist/device-findings.d.ts +27 -0
  62. package/dist/device-findings.d.ts.map +1 -0
  63. package/dist/device-findings.js +100 -0
  64. package/dist/device-findings.js.map +1 -0
  65. package/dist/device-screens.d.ts +50 -0
  66. package/dist/device-screens.d.ts.map +1 -0
  67. package/dist/device-screens.js +92 -0
  68. package/dist/device-screens.js.map +1 -0
  69. package/dist/device-shape.d.ts +41 -0
  70. package/dist/device-shape.d.ts.map +1 -0
  71. package/dist/device-shape.js +81 -0
  72. package/dist/device-shape.js.map +1 -0
  73. package/dist/devices.d.ts +7 -0
  74. package/dist/devices.d.ts.map +1 -0
  75. package/dist/devices.js +16 -0
  76. package/dist/devices.js.map +1 -0
  77. package/dist/document/act-findings.d.ts.map +1 -1
  78. package/dist/document/act-findings.js +1 -0
  79. package/dist/document/act-findings.js.map +1 -1
  80. package/dist/document/blocks.d.ts.map +1 -1
  81. package/dist/document/blocks.js +11 -3
  82. package/dist/document/blocks.js.map +1 -1
  83. package/dist/document/compile-checked.d.ts.map +1 -1
  84. package/dist/document/compile-checked.js +3 -2
  85. package/dist/document/compile-checked.js.map +1 -1
  86. package/dist/document/compiled.d.ts.map +1 -1
  87. package/dist/document/compiled.js +43 -16
  88. package/dist/document/compiled.js.map +1 -1
  89. package/dist/document/describe-forms.d.ts.map +1 -1
  90. package/dist/document/describe-forms.js +2 -0
  91. package/dist/document/describe-forms.js.map +1 -1
  92. package/dist/document/describe-place.d.ts.map +1 -1
  93. package/dist/document/describe-place.js +30 -6
  94. package/dist/document/describe-place.js.map +1 -1
  95. package/dist/document/devices-spec.d.ts +14 -0
  96. package/dist/document/devices-spec.d.ts.map +1 -0
  97. package/dist/document/devices-spec.js +22 -0
  98. package/dist/document/devices-spec.js.map +1 -0
  99. package/dist/document/edit.d.ts +1 -1
  100. package/dist/document/edit.d.ts.map +1 -1
  101. package/dist/document/edit.js +172 -0
  102. package/dist/document/edit.js.map +1 -1
  103. package/dist/document/expr/typing.d.ts.map +1 -1
  104. package/dist/document/expr/typing.js +1 -0
  105. package/dist/document/expr/typing.js.map +1 -1
  106. package/dist/document/graview-template.d.ts +79 -1
  107. package/dist/document/graview-template.d.ts.map +1 -1
  108. package/dist/document/graview-template.js +150 -7
  109. package/dist/document/graview-template.js.map +1 -1
  110. package/dist/document/index.d.ts +2 -2
  111. package/dist/document/index.d.ts.map +1 -1
  112. package/dist/document/index.js +1 -1
  113. package/dist/document/index.js.map +1 -1
  114. package/dist/document/instantiate-template.d.ts +12 -0
  115. package/dist/document/instantiate-template.d.ts.map +1 -1
  116. package/dist/document/instantiate-template.js +14 -0
  117. package/dist/document/instantiate-template.js.map +1 -1
  118. package/dist/document/migrate.d.ts.map +1 -1
  119. package/dist/document/migrate.js +9 -0
  120. package/dist/document/migrate.js.map +1 -1
  121. package/dist/document/says-the-line.d.ts +18 -0
  122. package/dist/document/says-the-line.d.ts.map +1 -0
  123. package/dist/document/says-the-line.js +46 -0
  124. package/dist/document/says-the-line.js.map +1 -0
  125. package/dist/document/schema.d.ts +10 -2
  126. package/dist/document/schema.d.ts.map +1 -1
  127. package/dist/document/schema.js +9 -2
  128. package/dist/document/schema.js.map +1 -1
  129. package/dist/document/template.d.ts +6 -1
  130. package/dist/document/template.d.ts.map +1 -1
  131. package/dist/document/template.js +29 -2
  132. package/dist/document/template.js.map +1 -1
  133. package/dist/document/to-document.d.ts.map +1 -1
  134. package/dist/document/to-document.js +2 -0
  135. package/dist/document/to-document.js.map +1 -1
  136. package/dist/document.schema.json +37 -4
  137. package/dist/graph/graph.d.ts +48 -0
  138. package/dist/graph/graph.d.ts.map +1 -1
  139. package/dist/graph/graph.js +103 -48
  140. package/dist/graph/graph.js.map +1 -1
  141. package/dist/graph/would-refuse.d.ts +13 -0
  142. package/dist/graph/would-refuse.d.ts.map +1 -0
  143. package/dist/graph/would-refuse.js +69 -0
  144. package/dist/graph/would-refuse.js.map +1 -0
  145. package/dist/import/coerce.d.ts.map +1 -1
  146. package/dist/import/coerce.js +7 -0
  147. package/dist/import/coerce.js.map +1 -1
  148. package/dist/index.d.ts +4 -3
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.js +3 -3
  151. package/dist/index.js.map +1 -1
  152. package/dist/kind-date.d.ts +18 -0
  153. package/dist/kind-date.d.ts.map +1 -0
  154. package/dist/kind-date.js +10 -0
  155. package/dist/kind-date.js.map +1 -0
  156. package/dist/kind-list.js +1 -1
  157. package/dist/kind-list.js.map +1 -1
  158. package/dist/may-run.d.ts +46 -0
  159. package/dist/may-run.d.ts.map +1 -0
  160. package/dist/may-run.js +162 -0
  161. package/dist/may-run.js.map +1 -0
  162. package/dist/mutations/arg-shape.d.ts +4 -0
  163. package/dist/mutations/arg-shape.d.ts.map +1 -1
  164. package/dist/mutations/arg-shape.js +3 -0
  165. package/dist/mutations/arg-shape.js.map +1 -1
  166. package/dist/mutations/derive-edits.d.ts.map +1 -1
  167. package/dist/mutations/derive-edits.js +4 -1
  168. package/dist/mutations/derive-edits.js.map +1 -1
  169. package/dist/mutations/form.d.ts +2 -1
  170. package/dist/mutations/form.d.ts.map +1 -1
  171. package/dist/mutations/form.js +6 -0
  172. package/dist/mutations/form.js.map +1 -1
  173. package/dist/mutations/node-ref.d.ts +7 -0
  174. package/dist/mutations/node-ref.d.ts.map +1 -1
  175. package/dist/mutations/node-ref.js +17 -0
  176. package/dist/mutations/node-ref.js.map +1 -1
  177. package/dist/mutations/types.d.ts +11 -0
  178. package/dist/mutations/types.d.ts.map +1 -1
  179. package/dist/permissions/policy.d.ts.map +1 -1
  180. package/dist/permissions/policy.js +1 -0
  181. package/dist/permissions/policy.js.map +1 -1
  182. package/dist/permissions/types.d.ts +6 -0
  183. package/dist/permissions/types.d.ts.map +1 -1
  184. package/dist/permissions/types.js.map +1 -1
  185. package/dist/places.d.ts +2 -0
  186. package/dist/places.d.ts.map +1 -1
  187. package/dist/places.js.map +1 -1
  188. package/dist/scaffold/from-template.d.ts +16 -0
  189. package/dist/scaffold/from-template.d.ts.map +1 -1
  190. package/dist/scaffold/from-template.js +29 -0
  191. package/dist/scaffold/from-template.js.map +1 -1
  192. package/dist/scaffold/index.d.ts +9 -0
  193. package/dist/scaffold/index.d.ts.map +1 -1
  194. package/dist/scaffold/index.js +2 -2
  195. package/dist/scaffold/index.js.map +1 -1
  196. package/dist/schema/field-words.d.ts +1 -1
  197. package/dist/schema/field-words.d.ts.map +1 -1
  198. package/dist/schema/field-words.js +4 -2
  199. package/dist/schema/field-words.js.map +1 -1
  200. package/dist/schema/json-schema.d.ts.map +1 -1
  201. package/dist/schema/json-schema.js +2 -1
  202. package/dist/schema/json-schema.js.map +1 -1
  203. package/dist/schema/reading.d.ts +7 -0
  204. package/dist/schema/reading.d.ts.map +1 -1
  205. package/dist/schema/reading.js +27 -3
  206. package/dist/schema/reading.js.map +1 -1
  207. package/dist/schema/typed-field-builders.d.ts +2 -0
  208. package/dist/schema/typed-field-builders.d.ts.map +1 -1
  209. package/dist/schema/typed-field-builders.js +5 -0
  210. package/dist/schema/typed-field-builders.js.map +1 -1
  211. package/dist/schema/typed-fields.d.ts +2 -2
  212. package/dist/schema/typed-fields.d.ts.map +1 -1
  213. package/dist/schema/typed-fields.js +2 -2
  214. package/dist/schema/typed-fields.js.map +1 -1
  215. package/dist/seat.d.ts +4 -1
  216. package/dist/seat.d.ts.map +1 -1
  217. package/dist/seat.js +5 -1
  218. package/dist/seat.js.map +1 -1
  219. package/dist/store.d.ts +39 -0
  220. package/dist/store.d.ts.map +1 -1
  221. package/dist/store.js +160 -38
  222. package/dist/store.js.map +1 -1
  223. package/dist/theme/accent.d.ts.map +1 -1
  224. package/dist/theme/accent.js +13 -16
  225. package/dist/theme/accent.js.map +1 -1
  226. package/dist/theme/derive.d.ts +8 -0
  227. package/dist/theme/derive.d.ts.map +1 -1
  228. package/dist/theme/derive.js +1 -1
  229. package/dist/theme/derive.js.map +1 -1
  230. package/dist/theme/layers.d.ts +15 -0
  231. package/dist/theme/layers.d.ts.map +1 -1
  232. package/dist/theme/layers.js +8 -0
  233. package/dist/theme/layers.js.map +1 -1
  234. package/dist/time-typed.d.ts +7 -0
  235. package/dist/time-typed.d.ts.map +1 -0
  236. package/dist/time-typed.js +31 -0
  237. package/dist/time-typed.js.map +1 -0
  238. package/dist/version.d.ts +1 -1
  239. package/dist/version.d.ts.map +1 -1
  240. package/dist/version.js +1 -1
  241. package/dist/version.js.map +1 -1
  242. package/dist/words.d.ts +1 -0
  243. package/dist/words.d.ts.map +1 -1
  244. package/dist/words.js +2 -0
  245. package/dist/words.js.map +1 -1
  246. package/package.json +5 -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";
@@ -31,7 +31,7 @@ import { actingAs, boundPersonOf, grantsTo, isSystem, meIn, meOf, ownsId, permit
31
31
  import { MOST_PROPOSED, PROPOSE_CHANGES, proposeChangesMutation } from "./mutations/propose-changes.js";
32
32
  import { namesUnseen, redact } from "./ops/withheld.js";
33
33
  import { writersBehind } from "./ops/writers.js";
34
- import { nounOf } from "./schema/define-node.js";
34
+ import { nounOf, withArticle } from "./schema/define-node.js";
35
35
  import { behind, fieldsJudged, mayKeepField, partialSight, recordsOf, sees } from "./permissions/sight.js";
36
36
  import { PermissionDeniedError } from "./permissions/types.js";
37
37
  import { checkUndo, UndoBlockedError, undoneInverses, undoPrimitives } from "./ops/undo.js";
@@ -953,6 +953,28 @@ export class Store {
953
953
  wouldNeed: [],
954
954
  };
955
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
+ }
956
978
  /**
957
979
  * AN ACT RUNS UNDER ITS AUTHOR'S SIGHT (FR-55). Its body, its guard, its
958
980
  * refusal and its sentence read the store as the author is served it,
@@ -1417,6 +1439,139 @@ export class Store {
1417
1439
  }
1418
1440
  });
1419
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
+ }
1420
1575
  /**
1421
1576
  * HOW MANY TIMES THIS STORE HAS TOLD ITS SUBSCRIBERS SOMETHING, or would
1422
1577
  * have: a change, an adopt, the day turning, something read beside the
@@ -1578,20 +1733,8 @@ export class Store {
1578
1733
  * seat holds say what it may do at all; `may` narrows what THIS provider
1579
1734
  * was brought in for, and the narrower of the two wins.
1580
1735
  */
1581
- const permitted = (call, as = author) => {
1582
- // 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).
1583
- const voting = this.voter !== undefined && this.mutations.get(call.name) === this.voter;
1584
- const binding = this.binder !== undefined && this.mutations.get(call.name) === this.binder;
1585
- const verdict = this.policy || (this.publisher && call.name === PUBLISH) || voting || binding || this.mutations.get(call.name) === this.proposer ? this.judged(call, as) : undefined;
1586
- // Rehearsing a proposal, an act its author may propose stands as the reviewer's would (Roadmap f-proposals-for-review).
1587
- if (verdict && !verdict.ok && !(this.proposing && this.mayPropose(call, as)))
1588
- this.refuse(verdict.refusal, as.id);
1589
- };
1590
- const declared = (call, as = author) => {
1591
- const refusal = this.refusesAgent(call, as) ?? this.namesTurnedOff(call, as);
1592
- if (refusal)
1593
- this.refuse(refusal, as.id);
1594
- };
1736
+ const permitted = (call, as = author) => this.permittedTo(call, as);
1737
+ const declared = (call, as = author) => this.declaredTo(call, as);
1595
1738
  /* A call that names a record an earlier call makes (`{ $made: n }`, FR-193) is asked once that record is there to name. */
1596
1739
  const naming = calls.map(namesMade);
1597
1740
  calls.forEach((call, at) => naming[at] || permitted(call));
@@ -1681,30 +1824,9 @@ export class Store {
1681
1824
  intents.push(op.intent);
1682
1825
  continue;
1683
1826
  }
1684
- const missing = this.missingFor(call, as);
1685
- if (missing)
1686
- throw missing;
1687
- let compiled;
1688
- try {
1689
- compiled = compileMutation(this.graph, definition, call.args, { ...this.sighted(as), hint });
1690
- }
1691
- catch (error) {
1692
- // A press the act's own input refused: the watch tells a form filled wrongly from an act offered whole.
1693
- if (error instanceof InvalidArguments && !this.rehearsing)
1694
- tellTheWatchOfAnInputRefusal(error, as.id);
1695
- throw error;
1696
- }
1827
+ const compiled = this.judgedCall(definition, call, as, decided, hint);
1697
1828
  if (hint !== undefined && compiled.firstMinted !== undefined && compiled.firstMinted !== hint)
1698
1829
  renamed.set(hint, compiled.firstMinted);
1699
- // Whose record a person is, only binding says (Roadmap f-invite-binds-existing-person): no other act writes the mark.
1700
- 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)))) {
1701
- throw new ActRefusal(`"${definition.title ?? definition.name}" cannot say whose record a person is: only binding an account to it does.`);
1702
- }
1703
- if (isAutomated(as)) {
1704
- const refused = tidyingRefusal(this.schema, this.graph, compiled.primitives, this.authorName(as), { declaration: !this.suggesting && !decided });
1705
- if (refused)
1706
- this.refuse({ mutation: call.name, message: refused, wouldNeed: [] }, as.id);
1707
- }
1708
1830
  /*
1709
1831
  * AN ACT THAT DID NOTHING DOES NOT GO IN THE HISTORY.
1710
1832
  *