@graview/core 0.1.28 → 0.1.30

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 (647) hide show
  1. package/README.md +17 -0
  2. package/dist/amount-input.d.ts +21 -0
  3. package/dist/amount-input.d.ts.map +1 -0
  4. package/dist/amount-input.js +96 -0
  5. package/dist/amount-input.js.map +1 -0
  6. package/dist/answer-seen.d.ts +38 -0
  7. package/dist/answer-seen.d.ts.map +1 -0
  8. package/dist/answer-seen.js +122 -0
  9. package/dist/answer-seen.js.map +1 -0
  10. package/dist/app-places.d.ts +56 -0
  11. package/dist/app-places.d.ts.map +1 -0
  12. package/dist/app-places.js +203 -0
  13. package/dist/app-places.js.map +1 -0
  14. package/dist/app.d.ts +16 -0
  15. package/dist/app.d.ts.map +1 -1
  16. package/dist/app.js.map +1 -1
  17. package/dist/arrange.d.ts +4 -2
  18. package/dist/arrange.d.ts.map +1 -1
  19. package/dist/arrange.js +4 -2
  20. package/dist/arrange.js.map +1 -1
  21. package/dist/arrangement-words.d.ts +3 -0
  22. package/dist/arrangement-words.d.ts.map +1 -0
  23. package/dist/arrangement-words.js +50 -0
  24. package/dist/arrangement-words.js.map +1 -0
  25. package/dist/arrangement.d.ts +43 -3
  26. package/dist/arrangement.d.ts.map +1 -1
  27. package/dist/arrangement.js +69 -31
  28. package/dist/arrangement.js.map +1 -1
  29. package/dist/arranging.d.ts.map +1 -1
  30. package/dist/arranging.js +36 -14
  31. package/dist/arranging.js.map +1 -1
  32. package/dist/bind.d.ts +3 -0
  33. package/dist/bind.d.ts.map +1 -1
  34. package/dist/bind.js.map +1 -1
  35. package/dist/blocks.d.ts +1 -1
  36. package/dist/blocks.d.ts.map +1 -1
  37. package/dist/capabilities.js +1 -1
  38. package/dist/capabilities.js.map +1 -1
  39. package/dist/check.d.ts +3 -0
  40. package/dist/check.d.ts.map +1 -1
  41. package/dist/check.js +3 -0
  42. package/dist/check.js.map +1 -1
  43. package/dist/city.d.ts +58 -50
  44. package/dist/city.d.ts.map +1 -1
  45. package/dist/city.js +160 -147
  46. package/dist/city.js.map +1 -1
  47. package/dist/cli/check/brand.d.ts.map +1 -1
  48. package/dist/cli/check/brand.js +30 -2
  49. package/dist/cli/check/brand.js.map +1 -1
  50. package/dist/cli/check/clock-rules.d.ts +4 -0
  51. package/dist/cli/check/clock-rules.d.ts.map +1 -0
  52. package/dist/cli/check/clock-rules.js +26 -0
  53. package/dist/cli/check/clock-rules.js.map +1 -0
  54. package/dist/cli/check/field-sight.d.ts +11 -0
  55. package/dist/cli/check/field-sight.d.ts.map +1 -0
  56. package/dist/cli/check/field-sight.js +113 -0
  57. package/dist/cli/check/field-sight.js.map +1 -0
  58. package/dist/cli/check/index.d.ts +2 -0
  59. package/dist/cli/check/index.d.ts.map +1 -1
  60. package/dist/cli/check/index.js +2 -0
  61. package/dist/cli/check/index.js.map +1 -1
  62. package/dist/cli/check/lenses.d.ts +1 -1
  63. package/dist/cli/check/lenses.d.ts.map +1 -1
  64. package/dist/cli/check/lenses.js +48 -2
  65. package/dist/cli/check/lenses.js.map +1 -1
  66. package/dist/cli/check/relations.d.ts +23 -0
  67. package/dist/cli/check/relations.d.ts.map +1 -1
  68. package/dist/cli/check/relations.js +55 -4
  69. package/dist/cli/check/relations.js.map +1 -1
  70. package/dist/cli/check.d.ts.map +1 -1
  71. package/dist/cli/check.js +7 -4
  72. package/dist/cli/check.js.map +1 -1
  73. package/dist/cli/create.d.ts.map +1 -1
  74. package/dist/cli/create.js +32 -0
  75. package/dist/cli/create.js.map +1 -1
  76. package/dist/cli/describe.d.ts.map +1 -1
  77. package/dist/cli/describe.js +71 -7
  78. package/dist/cli/describe.js.map +1 -1
  79. package/dist/cli/docs.d.ts.map +1 -1
  80. package/dist/cli/docs.js +4 -3
  81. package/dist/cli/docs.js.map +1 -1
  82. package/dist/cli/doctor.d.ts +18 -1
  83. package/dist/cli/doctor.d.ts.map +1 -1
  84. package/dist/cli/doctor.js +58 -5
  85. package/dist/cli/doctor.js.map +1 -1
  86. package/dist/cli/document-schema.d.ts +2 -0
  87. package/dist/cli/document-schema.d.ts.map +1 -1
  88. package/dist/cli/document-schema.js +154 -5
  89. package/dist/cli/document-schema.js.map +1 -1
  90. package/dist/cli/index.d.ts +1 -1
  91. package/dist/cli/index.d.ts.map +1 -1
  92. package/dist/cli/types.d.ts.map +1 -1
  93. package/dist/cli/types.js +16 -2
  94. package/dist/cli/types.js.map +1 -1
  95. package/dist/clock-readers.d.ts +18 -0
  96. package/dist/clock-readers.d.ts.map +1 -0
  97. package/dist/clock-readers.js +70 -0
  98. package/dist/clock-readers.js.map +1 -0
  99. package/dist/clock.d.ts +30 -0
  100. package/dist/clock.d.ts.map +1 -0
  101. package/dist/clock.js +41 -0
  102. package/dist/clock.js.map +1 -0
  103. package/dist/columns.d.ts.map +1 -1
  104. package/dist/columns.js +2 -1
  105. package/dist/columns.js.map +1 -1
  106. package/dist/conformance/fixtures.d.ts.map +1 -1
  107. package/dist/conformance/fixtures.js +491 -43
  108. package/dist/conformance/fixtures.js.map +1 -1
  109. package/dist/coverage-words.d.ts +18 -0
  110. package/dist/coverage-words.d.ts.map +1 -0
  111. package/dist/coverage-words.js +18 -0
  112. package/dist/coverage-words.js.map +1 -0
  113. package/dist/days.d.ts +53 -4
  114. package/dist/days.d.ts.map +1 -1
  115. package/dist/days.js +136 -16
  116. package/dist/days.js.map +1 -1
  117. package/dist/describe.d.ts +1 -0
  118. package/dist/describe.d.ts.map +1 -1
  119. package/dist/describe.js +1 -0
  120. package/dist/describe.js.map +1 -1
  121. package/dist/document/act-findings.d.ts.map +1 -1
  122. package/dist/document/act-findings.js +32 -4
  123. package/dist/document/act-findings.js.map +1 -1
  124. package/dist/document/amount.d.ts +4 -0
  125. package/dist/document/amount.d.ts.map +1 -0
  126. package/dist/document/amount.js +22 -0
  127. package/dist/document/amount.js.map +1 -0
  128. package/dist/document/block-context.d.ts.map +1 -1
  129. package/dist/document/block-context.js +1 -0
  130. package/dist/document/block-context.js.map +1 -1
  131. package/dist/document/blocks.d.ts +33 -10
  132. package/dist/document/blocks.d.ts.map +1 -1
  133. package/dist/document/blocks.js +139 -25
  134. package/dist/document/blocks.js.map +1 -1
  135. package/dist/document/brand-check.d.ts +5 -0
  136. package/dist/document/brand-check.d.ts.map +1 -1
  137. package/dist/document/brand-check.js +16 -2
  138. package/dist/document/brand-check.js.map +1 -1
  139. package/dist/document/compile-checked.d.ts.map +1 -1
  140. package/dist/document/compile-checked.js +12 -4
  141. package/dist/document/compile-checked.js.map +1 -1
  142. package/dist/document/compile.d.ts +0 -2
  143. package/dist/document/compile.d.ts.map +1 -1
  144. package/dist/document/compile.js +49 -24
  145. package/dist/document/compile.js.map +1 -1
  146. package/dist/document/compiled.d.ts +6 -2
  147. package/dist/document/compiled.d.ts.map +1 -1
  148. package/dist/document/compiled.js +94 -26
  149. package/dist/document/compiled.js.map +1 -1
  150. package/dist/document/computed-values.d.ts +3 -0
  151. package/dist/document/computed-values.d.ts.map +1 -1
  152. package/dist/document/computed-values.js +12 -2
  153. package/dist/document/computed-values.js.map +1 -1
  154. package/dist/document/describe-coverage.d.ts +3 -0
  155. package/dist/document/describe-coverage.d.ts.map +1 -1
  156. package/dist/document/describe-coverage.js +14 -6
  157. package/dist/document/describe-coverage.js.map +1 -1
  158. package/dist/document/describe-place.d.ts +6 -2
  159. package/dist/document/describe-place.d.ts.map +1 -1
  160. package/dist/document/describe-place.js +17 -9
  161. package/dist/document/describe-place.js.map +1 -1
  162. package/dist/document/diff.d.ts +2 -0
  163. package/dist/document/diff.d.ts.map +1 -1
  164. package/dist/document/diff.js +70 -11
  165. package/dist/document/diff.js.map +1 -1
  166. package/dist/document/durations.d.ts +8 -0
  167. package/dist/document/durations.d.ts.map +1 -0
  168. package/dist/document/durations.js +82 -0
  169. package/dist/document/durations.js.map +1 -0
  170. package/dist/document/edit.d.ts +1 -1
  171. package/dist/document/edit.d.ts.map +1 -1
  172. package/dist/document/edit.js +436 -27
  173. package/dist/document/edit.js.map +1 -1
  174. package/dist/document/expr/evaluate.d.ts +26 -1
  175. package/dist/document/expr/evaluate.d.ts.map +1 -1
  176. package/dist/document/expr/evaluate.js +55 -4
  177. package/dist/document/expr/evaluate.js.map +1 -1
  178. package/dist/document/field-spec.d.ts.map +1 -1
  179. package/dist/document/field-spec.js +15 -1
  180. package/dist/document/field-spec.js.map +1 -1
  181. package/dist/document/format-findings.d.ts +4 -0
  182. package/dist/document/format-findings.d.ts.map +1 -0
  183. package/dist/document/format-findings.js +39 -0
  184. package/dist/document/format-findings.js.map +1 -0
  185. package/dist/document/format-rules.d.ts +8 -0
  186. package/dist/document/format-rules.d.ts.map +1 -0
  187. package/dist/document/format-rules.js +19 -0
  188. package/dist/document/format-rules.js.map +1 -0
  189. package/dist/document/format-words.d.ts +9 -0
  190. package/dist/document/format-words.d.ts.map +1 -0
  191. package/dist/document/format-words.js +31 -0
  192. package/dist/document/format-words.js.map +1 -0
  193. package/dist/document/framework-path.d.ts +11 -0
  194. package/dist/document/framework-path.d.ts.map +1 -0
  195. package/dist/document/framework-path.js +122 -0
  196. package/dist/document/framework-path.js.map +1 -0
  197. package/dist/document/graview-template.d.ts +2 -2
  198. package/dist/document/index.d.ts +2 -2
  199. package/dist/document/index.d.ts.map +1 -1
  200. package/dist/document/index.js +1 -1
  201. package/dist/document/index.js.map +1 -1
  202. package/dist/document/linked-findings.d.ts +5 -0
  203. package/dist/document/linked-findings.d.ts.map +1 -0
  204. package/dist/document/linked-findings.js +100 -0
  205. package/dist/document/linked-findings.js.map +1 -0
  206. package/dist/document/migrate.d.ts +1 -0
  207. package/dist/document/migrate.d.ts.map +1 -1
  208. package/dist/document/migrate.js +48 -1
  209. package/dist/document/migrate.js.map +1 -1
  210. package/dist/document/money.d.ts +14 -0
  211. package/dist/document/money.d.ts.map +1 -0
  212. package/dist/document/money.js +14 -0
  213. package/dist/document/money.js.map +1 -0
  214. package/dist/document/policy-words.d.ts +4 -0
  215. package/dist/document/policy-words.d.ts.map +1 -1
  216. package/dist/document/policy-words.js +34 -4
  217. package/dist/document/policy-words.js.map +1 -1
  218. package/dist/document/right-names.d.ts +10 -0
  219. package/dist/document/right-names.d.ts.map +1 -0
  220. package/dist/document/right-names.js +57 -0
  221. package/dist/document/right-names.js.map +1 -0
  222. package/dist/document/rule-line.d.ts.map +1 -1
  223. package/dist/document/rule-line.js +16 -12
  224. package/dist/document/rule-line.js.map +1 -1
  225. package/dist/document/rules.d.ts.map +1 -1
  226. package/dist/document/rules.js +15 -6
  227. package/dist/document/rules.js.map +1 -1
  228. package/dist/document/schema.d.ts +142 -22
  229. package/dist/document/schema.d.ts.map +1 -1
  230. package/dist/document/schema.js +86 -10
  231. package/dist/document/schema.js.map +1 -1
  232. package/dist/document/template-parse.d.ts.map +1 -1
  233. package/dist/document/template-parse.js +45 -5
  234. package/dist/document/template-parse.js.map +1 -1
  235. package/dist/document/template.d.ts +16 -14
  236. package/dist/document/template.d.ts.map +1 -1
  237. package/dist/document/template.js +52 -30
  238. package/dist/document/template.js.map +1 -1
  239. package/dist/document/thumbnail.d.ts.map +1 -1
  240. package/dist/document/thumbnail.js +4 -3
  241. package/dist/document/thumbnail.js.map +1 -1
  242. package/dist/document/to-document.d.ts +0 -1
  243. package/dist/document/to-document.d.ts.map +1 -1
  244. package/dist/document/to-document.js +30 -2
  245. package/dist/document/to-document.js.map +1 -1
  246. package/dist/document/view-specs.d.ts.map +1 -1
  247. package/dist/document/view-specs.js +3 -0
  248. package/dist/document/view-specs.js.map +1 -1
  249. package/dist/document/views.d.ts +38 -4
  250. package/dist/document/views.d.ts.map +1 -1
  251. package/dist/document/views.js +81 -26
  252. package/dist/document/views.js.map +1 -1
  253. package/dist/document.schema.json +1184 -141
  254. package/dist/excerpt-of.d.ts +14 -0
  255. package/dist/excerpt-of.d.ts.map +1 -0
  256. package/dist/excerpt-of.js +120 -0
  257. package/dist/excerpt-of.js.map +1 -0
  258. package/dist/excerpt.d.ts +9 -0
  259. package/dist/excerpt.d.ts.map +1 -0
  260. package/dist/excerpt.js +43 -0
  261. package/dist/excerpt.js.map +1 -0
  262. package/dist/field-sight.d.ts +33 -0
  263. package/dist/field-sight.d.ts.map +1 -0
  264. package/dist/field-sight.js +313 -0
  265. package/dist/field-sight.js.map +1 -0
  266. package/dist/forms.d.ts +2 -0
  267. package/dist/forms.d.ts.map +1 -1
  268. package/dist/forms.js +3 -0
  269. package/dist/forms.js.map +1 -1
  270. package/dist/graph/archived.d.ts +34 -0
  271. package/dist/graph/archived.d.ts.map +1 -0
  272. package/dist/graph/archived.js +25 -0
  273. package/dist/graph/archived.js.map +1 -0
  274. package/dist/graph/diff.d.ts +16 -0
  275. package/dist/graph/diff.d.ts.map +1 -1
  276. package/dist/graph/diff.js +20 -1
  277. package/dist/graph/diff.js.map +1 -1
  278. package/dist/graph/graph.d.ts +37 -13
  279. package/dist/graph/graph.d.ts.map +1 -1
  280. package/dist/graph/graph.js +84 -41
  281. package/dist/graph/graph.js.map +1 -1
  282. package/dist/graph/tracked.d.ts +8 -8
  283. package/dist/graph/tracked.d.ts.map +1 -1
  284. package/dist/graph/tracked.js +15 -20
  285. package/dist/graph/tracked.js.map +1 -1
  286. package/dist/graph/types.d.ts +16 -8
  287. package/dist/graph/types.d.ts.map +1 -1
  288. package/dist/graph/types.js.map +1 -1
  289. package/dist/grid-sort.d.ts +20 -0
  290. package/dist/grid-sort.d.ts.map +1 -0
  291. package/dist/grid-sort.js +58 -0
  292. package/dist/grid-sort.js.map +1 -0
  293. package/dist/history.d.ts +88 -0
  294. package/dist/history.d.ts.map +1 -0
  295. package/dist/history.js +146 -0
  296. package/dist/history.js.map +1 -0
  297. package/dist/import/coerce.d.ts +45 -0
  298. package/dist/import/coerce.d.ts.map +1 -0
  299. package/dist/import/coerce.js +252 -0
  300. package/dist/import/coerce.js.map +1 -0
  301. package/dist/import/csv.d.ts +16 -0
  302. package/dist/import/csv.d.ts.map +1 -0
  303. package/dist/import/csv.js +77 -0
  304. package/dist/import/csv.js.map +1 -0
  305. package/dist/import/index.d.ts +17 -0
  306. package/dist/import/index.d.ts.map +1 -0
  307. package/dist/import/index.js +13 -0
  308. package/dist/import/index.js.map +1 -0
  309. package/dist/import/mapping.d.ts +99 -0
  310. package/dist/import/mapping.d.ts.map +1 -0
  311. package/dist/import/mapping.js +182 -0
  312. package/dist/import/mapping.js.map +1 -0
  313. package/dist/import/rows.d.ts +116 -0
  314. package/dist/import/rows.d.ts.map +1 -0
  315. package/dist/import/rows.js +584 -0
  316. package/dist/import/rows.js.map +1 -0
  317. package/dist/index.d.ts +53 -26
  318. package/dist/index.d.ts.map +1 -1
  319. package/dist/index.js +38 -18
  320. package/dist/index.js.map +1 -1
  321. package/dist/invariants/engine.d.ts +5 -1
  322. package/dist/invariants/engine.d.ts.map +1 -1
  323. package/dist/invariants/engine.js +4 -3
  324. package/dist/invariants/engine.js.map +1 -1
  325. package/dist/invariants/types.d.ts +18 -3
  326. package/dist/invariants/types.d.ts.map +1 -1
  327. package/dist/json-schema.d.ts +1 -0
  328. package/dist/json-schema.d.ts.map +1 -1
  329. package/dist/json-schema.js +2 -0
  330. package/dist/json-schema.js.map +1 -1
  331. package/dist/kind-list.d.ts +78 -0
  332. package/dist/kind-list.d.ts.map +1 -0
  333. package/dist/kind-list.js +176 -0
  334. package/dist/kind-list.js.map +1 -0
  335. package/dist/labels.d.ts.map +1 -1
  336. package/dist/labels.js +2 -1
  337. package/dist/labels.js.map +1 -1
  338. package/dist/lines.d.ts +1 -0
  339. package/dist/lines.d.ts.map +1 -1
  340. package/dist/lines.js +5 -3
  341. package/dist/lines.js.map +1 -1
  342. package/dist/linked.d.ts +95 -0
  343. package/dist/linked.d.ts.map +1 -0
  344. package/dist/linked.js +181 -0
  345. package/dist/linked.js.map +1 -0
  346. package/dist/markdown.d.ts +102 -0
  347. package/dist/markdown.d.ts.map +1 -0
  348. package/dist/markdown.js +460 -0
  349. package/dist/markdown.js.map +1 -0
  350. package/dist/mutations/arg-shape.d.ts +95 -0
  351. package/dist/mutations/arg-shape.d.ts.map +1 -0
  352. package/dist/mutations/arg-shape.js +101 -0
  353. package/dist/mutations/arg-shape.js.map +1 -0
  354. package/dist/mutations/define-mutation.d.ts +48 -2
  355. package/dist/mutations/define-mutation.d.ts.map +1 -1
  356. package/dist/mutations/define-mutation.js +103 -36
  357. package/dist/mutations/define-mutation.js.map +1 -1
  358. package/dist/mutations/derive-edits.d.ts +16 -1
  359. package/dist/mutations/derive-edits.d.ts.map +1 -1
  360. package/dist/mutations/derive-edits.js +146 -56
  361. package/dist/mutations/derive-edits.js.map +1 -1
  362. package/dist/mutations/derive-repeats.d.ts +8 -0
  363. package/dist/mutations/derive-repeats.d.ts.map +1 -0
  364. package/dist/mutations/derive-repeats.js +118 -0
  365. package/dist/mutations/derive-repeats.js.map +1 -0
  366. package/dist/mutations/derived-names.d.ts +22 -0
  367. package/dist/mutations/derived-names.d.ts.map +1 -0
  368. package/dist/mutations/derived-names.js +21 -0
  369. package/dist/mutations/derived-names.js.map +1 -0
  370. package/dist/mutations/edit-start.d.ts +28 -0
  371. package/dist/mutations/edit-start.d.ts.map +1 -0
  372. package/dist/mutations/edit-start.js +24 -0
  373. package/dist/mutations/edit-start.js.map +1 -0
  374. package/dist/mutations/form.d.ts +33 -1
  375. package/dist/mutations/form.d.ts.map +1 -1
  376. package/dist/mutations/form.js +23 -2
  377. package/dist/mutations/form.js.map +1 -1
  378. package/dist/mutations/invalid-arguments.d.ts +14 -0
  379. package/dist/mutations/invalid-arguments.d.ts.map +1 -0
  380. package/dist/mutations/invalid-arguments.js +18 -0
  381. package/dist/mutations/invalid-arguments.js.map +1 -0
  382. package/dist/mutations/keep-link.d.ts +27 -0
  383. package/dist/mutations/keep-link.d.ts.map +1 -0
  384. package/dist/mutations/keep-link.js +56 -0
  385. package/dist/mutations/keep-link.js.map +1 -0
  386. package/dist/mutations/kept-arguments.d.ts +26 -0
  387. package/dist/mutations/kept-arguments.d.ts.map +1 -0
  388. package/dist/mutations/kept-arguments.js +77 -0
  389. package/dist/mutations/kept-arguments.js.map +1 -0
  390. package/dist/mutations/node-ref.d.ts +0 -80
  391. package/dist/mutations/node-ref.d.ts.map +1 -1
  392. package/dist/mutations/node-ref.js +0 -93
  393. package/dist/mutations/node-ref.js.map +1 -1
  394. package/dist/mutations/types.d.ts +17 -1
  395. package/dist/mutations/types.d.ts.map +1 -1
  396. package/dist/mutations/words.d.ts +0 -13
  397. package/dist/mutations/words.d.ts.map +1 -1
  398. package/dist/mutations/words.js +1 -12
  399. package/dist/mutations/words.js.map +1 -1
  400. package/dist/navigate.d.ts +13 -0
  401. package/dist/navigate.d.ts.map +1 -0
  402. package/dist/navigate.js +13 -0
  403. package/dist/navigate.js.map +1 -0
  404. package/dist/ops/digest.d.ts +33 -0
  405. package/dist/ops/digest.d.ts.map +1 -0
  406. package/dist/ops/digest.js +47 -0
  407. package/dist/ops/digest.js.map +1 -0
  408. package/dist/ops/kept-fields.d.ts +7 -0
  409. package/dist/ops/kept-fields.d.ts.map +1 -0
  410. package/dist/ops/kept-fields.js +24 -0
  411. package/dist/ops/kept-fields.js.map +1 -0
  412. package/dist/ops/lineage.d.ts +43 -0
  413. package/dist/ops/lineage.d.ts.map +1 -0
  414. package/dist/ops/lineage.js +27 -0
  415. package/dist/ops/lineage.js.map +1 -0
  416. package/dist/ops/log.d.ts +6 -0
  417. package/dist/ops/log.d.ts.map +1 -1
  418. package/dist/ops/log.js +20 -12
  419. package/dist/ops/log.js.map +1 -1
  420. package/dist/ops/provenance.d.ts +68 -0
  421. package/dist/ops/provenance.d.ts.map +1 -0
  422. package/dist/ops/provenance.js +83 -0
  423. package/dist/ops/provenance.js.map +1 -0
  424. package/dist/ops/suggestions.d.ts +26 -0
  425. package/dist/ops/suggestions.d.ts.map +1 -0
  426. package/dist/ops/suggestions.js +21 -0
  427. package/dist/ops/suggestions.js.map +1 -0
  428. package/dist/ops/tidying.d.ts +48 -0
  429. package/dist/ops/tidying.d.ts.map +1 -0
  430. package/dist/ops/tidying.js +84 -0
  431. package/dist/ops/tidying.js.map +1 -0
  432. package/dist/ops/types.d.ts +42 -0
  433. package/dist/ops/types.d.ts.map +1 -1
  434. package/dist/ops/undo.d.ts.map +1 -1
  435. package/dist/ops/undo.js +10 -0
  436. package/dist/ops/undo.js.map +1 -1
  437. package/dist/ops/withheld.d.ts +25 -2
  438. package/dist/ops/withheld.d.ts.map +1 -1
  439. package/dist/ops/withheld.js +6 -15
  440. package/dist/ops/withheld.js.map +1 -1
  441. package/dist/past.d.ts +35 -0
  442. package/dist/past.d.ts.map +1 -0
  443. package/dist/past.js +173 -0
  444. package/dist/past.js.map +1 -0
  445. package/dist/permissions/policy.d.ts +13 -1
  446. package/dist/permissions/policy.d.ts.map +1 -1
  447. package/dist/permissions/policy.js +44 -9
  448. package/dist/permissions/policy.js.map +1 -1
  449. package/dist/permissions/sight.d.ts +40 -2
  450. package/dist/permissions/sight.d.ts.map +1 -1
  451. package/dist/permissions/sight.js +25 -2
  452. package/dist/permissions/sight.js.map +1 -1
  453. package/dist/permissions/types.d.ts +21 -0
  454. package/dist/permissions/types.d.ts.map +1 -1
  455. package/dist/permissions/types.js.map +1 -1
  456. package/dist/places.d.ts +6 -51
  457. package/dist/places.d.ts.map +1 -1
  458. package/dist/places.js +50 -144
  459. package/dist/places.js.map +1 -1
  460. package/dist/provenance.d.ts +14 -0
  461. package/dist/provenance.d.ts.map +1 -0
  462. package/dist/provenance.js +13 -0
  463. package/dist/provenance.js.map +1 -0
  464. package/dist/repeat-words.d.ts +13 -0
  465. package/dist/repeat-words.d.ts.map +1 -0
  466. package/dist/repeat-words.js +56 -0
  467. package/dist/repeat-words.js.map +1 -0
  468. package/dist/repeat.d.ts +59 -0
  469. package/dist/repeat.d.ts.map +1 -0
  470. package/dist/repeat.js +155 -0
  471. package/dist/repeat.js.map +1 -0
  472. package/dist/scaffold/agents.d.ts.map +1 -1
  473. package/dist/scaffold/agents.js +13 -0
  474. package/dist/scaffold/agents.js.map +1 -1
  475. package/dist/scaffold/project.d.ts.map +1 -1
  476. package/dist/scaffold/project.js +18 -0
  477. package/dist/scaffold/project.js.map +1 -1
  478. package/dist/scaffold/ui.d.ts.map +1 -1
  479. package/dist/scaffold/ui.js +17 -7
  480. package/dist/scaffold/ui.js.map +1 -1
  481. package/dist/scene-districts.d.ts +2 -1
  482. package/dist/scene-districts.d.ts.map +1 -1
  483. package/dist/scene-districts.js +2 -1
  484. package/dist/scene-districts.js.map +1 -1
  485. package/dist/scene.d.ts +4 -2
  486. package/dist/scene.d.ts.map +1 -1
  487. package/dist/scene.js +2 -1
  488. package/dist/scene.js.map +1 -1
  489. package/dist/schema/amount-mark.d.ts +13 -0
  490. package/dist/schema/amount-mark.d.ts.map +1 -0
  491. package/dist/schema/amount-mark.js +20 -0
  492. package/dist/schema/amount-mark.js.map +1 -0
  493. package/dist/schema/amount-words.d.ts +12 -0
  494. package/dist/schema/amount-words.d.ts.map +1 -0
  495. package/dist/schema/amount-words.js +31 -0
  496. package/dist/schema/amount-words.js.map +1 -0
  497. package/dist/schema/app-address.d.ts +5 -0
  498. package/dist/schema/app-address.d.ts.map +1 -0
  499. package/dist/schema/app-address.js +10 -0
  500. package/dist/schema/app-address.js.map +1 -0
  501. package/dist/schema/app-link-field.d.ts +4 -0
  502. package/dist/schema/app-link-field.d.ts.map +1 -0
  503. package/dist/schema/app-link-field.js +19 -0
  504. package/dist/schema/app-link-field.js.map +1 -0
  505. package/dist/schema/app-link.d.ts +38 -0
  506. package/dist/schema/app-link.d.ts.map +1 -0
  507. package/dist/schema/app-link.js +38 -0
  508. package/dist/schema/app-link.js.map +1 -0
  509. package/dist/schema/define-node.d.ts +39 -92
  510. package/dist/schema/define-node.d.ts.map +1 -1
  511. package/dist/schema/define-node.js +8 -246
  512. package/dist/schema/define-node.js.map +1 -1
  513. package/dist/schema/field-words.d.ts +45 -0
  514. package/dist/schema/field-words.d.ts.map +1 -0
  515. package/dist/schema/field-words.js +124 -0
  516. package/dist/schema/field-words.js.map +1 -0
  517. package/dist/schema/files.d.ts +8 -0
  518. package/dist/schema/files.d.ts.map +1 -1
  519. package/dist/schema/files.js.map +1 -1
  520. package/dist/schema/json-schema.d.ts +6 -1
  521. package/dist/schema/json-schema.d.ts.map +1 -1
  522. package/dist/schema/json-schema.js +101 -2
  523. package/dist/schema/json-schema.js.map +1 -1
  524. package/dist/schema/linked-field.d.ts +6 -0
  525. package/dist/schema/linked-field.d.ts.map +1 -0
  526. package/dist/schema/linked-field.js +34 -0
  527. package/dist/schema/linked-field.js.map +1 -0
  528. package/dist/schema/linked-reads.d.ts +20 -0
  529. package/dist/schema/linked-reads.d.ts.map +1 -0
  530. package/dist/schema/linked-reads.js +69 -0
  531. package/dist/schema/linked-reads.js.map +1 -0
  532. package/dist/schema/linked-schema.d.ts +5 -0
  533. package/dist/schema/linked-schema.d.ts.map +1 -0
  534. package/dist/schema/linked-schema.js +9 -0
  535. package/dist/schema/linked-schema.js.map +1 -0
  536. package/dist/schema/linked.d.ts +147 -0
  537. package/dist/schema/linked.d.ts.map +1 -0
  538. package/dist/schema/linked.js +151 -0
  539. package/dist/schema/linked.js.map +1 -0
  540. package/dist/schema/markdown-field.d.ts +4 -0
  541. package/dist/schema/markdown-field.d.ts.map +1 -0
  542. package/dist/schema/markdown-field.js +20 -0
  543. package/dist/schema/markdown-field.js.map +1 -0
  544. package/dist/schema/markdown.d.ts +6 -0
  545. package/dist/schema/markdown.d.ts.map +1 -0
  546. package/dist/schema/markdown.js +27 -0
  547. package/dist/schema/markdown.js.map +1 -0
  548. package/dist/schema/reading.d.ts +86 -0
  549. package/dist/schema/reading.d.ts.map +1 -0
  550. package/dist/schema/reading.js +325 -0
  551. package/dist/schema/reading.js.map +1 -0
  552. package/dist/schema/repeat-field.d.ts +5 -0
  553. package/dist/schema/repeat-field.d.ts.map +1 -0
  554. package/dist/schema/repeat-field.js +20 -0
  555. package/dist/schema/repeat-field.js.map +1 -0
  556. package/dist/schema/schema.d.ts.map +1 -1
  557. package/dist/schema/schema.js +12 -1
  558. package/dist/schema/schema.js.map +1 -1
  559. package/dist/schema/to-json-schema.d.ts +14 -0
  560. package/dist/schema/to-json-schema.d.ts.map +1 -0
  561. package/dist/schema/to-json-schema.js +616 -0
  562. package/dist/schema/to-json-schema.js.map +1 -0
  563. package/dist/schema/typed-field-builders.d.ts +8 -0
  564. package/dist/schema/typed-field-builders.d.ts.map +1 -0
  565. package/dist/schema/typed-field-builders.js +30 -0
  566. package/dist/schema/typed-field-builders.js.map +1 -0
  567. package/dist/schema/typed-field-of.d.ts +4 -0
  568. package/dist/schema/typed-field-of.d.ts.map +1 -0
  569. package/dist/schema/typed-field-of.js +14 -0
  570. package/dist/schema/typed-field-of.js.map +1 -0
  571. package/dist/schema/typed-fields.d.ts +11 -0
  572. package/dist/schema/typed-fields.d.ts.map +1 -0
  573. package/dist/schema/typed-fields.js +16 -0
  574. package/dist/schema/typed-fields.js.map +1 -0
  575. package/dist/schema/types.d.ts +31 -0
  576. package/dist/schema/types.d.ts.map +1 -1
  577. package/dist/schema/value-words.d.ts +21 -0
  578. package/dist/schema/value-words.d.ts.map +1 -0
  579. package/dist/schema/value-words.js +32 -0
  580. package/dist/schema/value-words.js.map +1 -0
  581. package/dist/search.d.ts +91 -4
  582. package/dist/search.d.ts.map +1 -1
  583. package/dist/search.js +317 -54
  584. package/dist/search.js.map +1 -1
  585. package/dist/seat-of.d.ts +9 -0
  586. package/dist/seat-of.d.ts.map +1 -0
  587. package/dist/seat-of.js +14 -0
  588. package/dist/seat-of.js.map +1 -0
  589. package/dist/seat.d.ts +19 -0
  590. package/dist/seat.d.ts.map +1 -0
  591. package/dist/seat.js +19 -0
  592. package/dist/seat.js.map +1 -0
  593. package/dist/seen.d.ts +15 -45
  594. package/dist/seen.d.ts.map +1 -1
  595. package/dist/seen.js +49 -135
  596. package/dist/seen.js.map +1 -1
  597. package/dist/store.d.ts +104 -1
  598. package/dist/store.d.ts.map +1 -1
  599. package/dist/store.js +214 -30
  600. package/dist/store.js.map +1 -1
  601. package/dist/theme/derive.d.ts +16 -0
  602. package/dist/theme/derive.d.ts.map +1 -1
  603. package/dist/theme/derive.js +14 -0
  604. package/dist/theme/derive.js.map +1 -1
  605. package/dist/theme/marks.d.ts +19 -2
  606. package/dist/theme/marks.d.ts.map +1 -1
  607. package/dist/theme/marks.js +67 -2
  608. package/dist/theme/marks.js.map +1 -1
  609. package/dist/theme/types.d.ts +14 -3
  610. package/dist/theme/types.d.ts.map +1 -1
  611. package/dist/theme/types.js.map +1 -1
  612. package/dist/tidying.d.ts +62 -0
  613. package/dist/tidying.d.ts.map +1 -0
  614. package/dist/tidying.js +131 -0
  615. package/dist/tidying.js.map +1 -0
  616. package/dist/typed.d.ts +12 -3
  617. package/dist/typed.d.ts.map +1 -1
  618. package/dist/typed.js.map +1 -1
  619. package/dist/validate-graph.d.ts.map +1 -1
  620. package/dist/validate-graph.js +3 -10
  621. package/dist/validate-graph.js.map +1 -1
  622. package/dist/version.d.ts +1 -1
  623. package/dist/version.js +1 -1
  624. package/dist/via.d.ts.map +1 -1
  625. package/dist/via.js +2 -1
  626. package/dist/via.js.map +1 -1
  627. package/dist/views/address.d.ts +13 -0
  628. package/dist/views/address.d.ts.map +1 -0
  629. package/dist/views/address.js +29 -0
  630. package/dist/views/address.js.map +1 -0
  631. package/dist/views/types.d.ts +106 -8
  632. package/dist/views/types.d.ts.map +1 -1
  633. package/dist/views/types.js +24 -4
  634. package/dist/views/types.js.map +1 -1
  635. package/dist/village.d.ts +63 -0
  636. package/dist/village.d.ts.map +1 -0
  637. package/dist/village.js +143 -0
  638. package/dist/village.js.map +1 -0
  639. package/dist/watched.d.ts +12 -45
  640. package/dist/watched.d.ts.map +1 -1
  641. package/dist/watched.js +7 -119
  642. package/dist/watched.js.map +1 -1
  643. package/dist/words.d.ts +33 -0
  644. package/dist/words.d.ts.map +1 -0
  645. package/dist/words.js +36 -0
  646. package/dist/words.js.map +1 -0
  647. package/package.json +57 -2
package/dist/store.js CHANGED
@@ -1,7 +1,8 @@
1
- import { hidesFrom, readingOf, seatLens, seenBy, seesId } from "./seen.js";
1
+ import { hidesFrom, readingOf, seatLens, seenBy, seesEveryRecord, seesId } from "./seen.js";
2
+ import { isoToday } from "./days.js";
2
3
  import { Graph, GraphError, MissingRecordError } from "./graph/graph.js";
3
4
  import { resolveModules } from "./modules.js";
4
- import { diffSnapshots, EMPTY_DIFF, isEmptyDiff } from "./graph/diff.js";
5
+ import { diffSnapshots, diffTouched, EMPTY_DIFF, isEmptyDiff } from "./graph/diff.js";
5
6
  import { invert, normalize, writesOf } from "./graph/primitives.js";
6
7
  import { LabelIndex, refusalFor } from "./labels.js";
7
8
  import { nodeRefArgs } from "./mutations/node-ref.js";
@@ -10,16 +11,29 @@ import { evaluate } from "./invariants/engine.js";
10
11
  import { compileMutation } from "./mutations/define-mutation.js";
11
12
  import { deriveMutations, derivedVia } from "./mutations/derive-edits.js";
12
13
  import { OperationLog } from "./ops/log.js";
14
+ import { lineageOf } from "./ops/lineage.js";
15
+ import { KEEP_LINK, keepLinkMutation, keepLinkVia } from "./mutations/keep-link.js";
16
+ import { declinedIn, isAutomated, tidyingRefusal } from "./ops/tidying.js";
17
+ import { nameOfAuthor } from "./who.js";
13
18
  import { actingAs, grantsTo, isSystem, permits, permittedMutations, subjectKinds } from "./permissions/policy.js";
14
19
  import { namesUnseen, redact } from "./ops/withheld.js";
15
20
  import { nounOf } from "./schema/define-node.js";
16
- import { creatorsBefore } from "./permissions/sight.js";
21
+ import { creatorsBefore, fieldsJudged, partialSight, recordsOf } from "./permissions/sight.js";
17
22
  import { PermissionDeniedError } from "./permissions/types.js";
18
23
  import { checkUndo, UndoBlockedError, undoPrimitives } from "./ops/undo.js";
19
24
  import { validateGraph } from "./validate-graph.js";
20
- import { tellTheWatchItsNames, tellTheWatchOfAStore, tellTheWatchOfAnAuthor, tellTheWatchOfARefusal } from "./watched.js";
25
+ import { tellTheWatchOfAStore, tellTheWatchOfAnAuthor, tellTheWatchOfARefusal } from "./watched.js";
21
26
  import { capitalize } from "./capital.js";
27
+ import { dayOf } from "./clock.js";
22
28
  import { pluralOf } from "./schema/define-node.js";
29
+ import { linkedReaderOf } from "./schema/linked.js";
30
+ /** A change asked of a store of the past (Roadmap f-playback): the past is read, never changed. */
31
+ export class PastError extends GraphError {
32
+ constructor(at) {
33
+ super(`This is the app as it stood${at.at ? ` at ${at.at}` : " at the start"}: the past is read, never changed`);
34
+ this.name = "PastError";
35
+ }
36
+ }
23
37
  /** The batch a preview's ops are under when it was given none: no store mints it. */
24
38
  export const PREVIEW_BATCH = "preview";
25
39
  /** `{ [key]: value }` where the value is said, and nothing where it is not: an optional key left off rather than undefined. */
@@ -53,6 +67,10 @@ const putsBack = (op) => op.mutation === null && op.undoes === undefined;
53
67
  export function violationKey(v, shaped) {
54
68
  return `${v.invariant}|${v.subjectId ?? ""}|${v.line || shaped?.has(v.invariant) ? v.label : v.message}`;
55
69
  }
70
+ /** Every rule, as `violationKey` reads its `shaped`: a problem known by its rule, its record and its name. */
71
+ /** The derived acts that take a record out or fold it away: riding the making of a kind, they reach only what the principal made (W-201). */
72
+ const UNMAKING = new Set(["remove", "archive", "unarchive", "merge"]);
73
+ const EVERY_RULE = { has: () => true };
56
74
  /** The rules that have a shape, by name: what `violationKey` keys by the rule and the record. */
57
75
  export const shapedRules = (rules) => new Set(rules.filter((rule) => rule.shape).map((rule) => rule.name));
58
76
  /**
@@ -66,7 +84,29 @@ export function problemsMoved(rules, before, after) {
66
84
  const key = (v) => violationKey(v, shaped);
67
85
  const was = new Set(before.map(key));
68
86
  const is = new Set(after.map(key));
69
- return { introduces: after.filter((v) => !was.has(key(v))), resolves: before.filter((v) => !is.has(key(v))) };
87
+ const introduces = after.filter((v) => !was.has(key(v)));
88
+ const resolves = before.filter((v) => !is.has(key(v)));
89
+ if (introduces.length === 0 || resolves.length === 0)
90
+ return { introduces, resolves };
91
+ /*
92
+ * REWORDED IS NOT MENDED (the ninth walk, W-191). A rule that is a
93
+ * function says its count in its message — "not opened for 22 days" —
94
+ * so the day turning, or an act that leaves it broken, rewords it. The
95
+ * same rule about the same record under the same name, said differently,
96
+ * is the problem it was: paired off one for one, it is neither made nor
97
+ * mended.
98
+ */
99
+ // Who a problem is when its words are set aside: its rule, its record and its name, as a rule with a line is known.
100
+ const who = (v) => v.subjectId && violationKey(v, EVERY_RULE);
101
+ // Each mended problem's who, until a reworded one is paired off with it (null).
102
+ const left = resolves.map(who);
103
+ return {
104
+ introduces: introduces.filter((v) => {
105
+ const at = who(v) ? left.indexOf(who(v)) : -1;
106
+ return at < 0 || ((left[at] = null), false);
107
+ }),
108
+ resolves: resolves.filter((_, at) => left[at] !== null),
109
+ };
70
110
  }
71
111
  /**
72
112
  * The unit of the framework an app holds: a graph, the log it folds from,
@@ -123,6 +163,8 @@ export class Store {
123
163
  graph;
124
164
  log;
125
165
  mutations = new Map();
166
+ /** The store's own "Keep this link" (FR-172), when the app declared none by that name. */
167
+ keeper;
126
168
  invariants;
127
169
  invariantOptions;
128
170
  policy;
@@ -160,8 +202,23 @@ export class Store {
160
202
  quiet = 0;
161
203
  /** True of a rehearsal (`previewAll`): what it does is told to nobody. */
162
204
  rehearsing = false;
205
+ /** True of a rehearsal for a suggestion: the actor is held to what a person said, not to the declaration's `tidying`, since a person decides it. */
206
+ suggesting = false;
207
+ /**
208
+ * The day a host last ticked this store to (FR-176), and the day the clock
209
+ * read when it did: what its rules are judged on, where nothing pins one,
210
+ * until the clock's day moves past the one it was ticked on — a timer
211
+ * that slept through midnight never leaves the store on yesterday.
212
+ */
213
+ ticked;
214
+ /** Where this store stands in the past, when it is one (`pastOf`): read, never changed. */
215
+ past;
216
+ /** How often `pastOf` keeps a point to fold from, in ops (`StoreOptions.pastEvery`). */
217
+ pastEvery;
163
218
  listeners = new Set();
164
219
  constructor(options) {
220
+ this.pastEvery = Math.max(1, options.pastEvery ?? 64);
221
+ this.past = options.past;
165
222
  this.schema = options.schema;
166
223
  this.invariants = options.invariants ?? [];
167
224
  this.invariantOptions = options.invariantOptions ?? {};
@@ -180,7 +237,8 @@ export class Store {
180
237
  const tag = storeTag();
181
238
  this.batchTag = options.batchIds ? undefined : tag;
182
239
  this.mintBatch = options.batchIds ?? ((kind) => `${kind}:${tag}:${++this.counter}`);
183
- for (const mutation of options.mutations ?? []) {
240
+ // A store of the past offers no act: not one declared, derived or kept (Roadmap f-playback).
241
+ for (const mutation of options.past ? [] : (options.mutations ?? [])) {
184
242
  if (this.mutations.has(mutation.name)) {
185
243
  throw new GraphError(`Duplicate mutation "${mutation.name}"`);
186
244
  }
@@ -194,10 +252,14 @@ export class Store {
194
252
  * invariants — and by the policy, through the acts that already write or
195
253
  * create the kind (see `permits`). Nothing an app declares is replaced.
196
254
  */
197
- for (const mutation of deriveMutations(options.schema, options.mutations ?? [])) {
255
+ for (const mutation of options.past ? [] : deriveMutations(options.schema, options.mutations ?? [])) {
198
256
  this.mutations.set(mutation.name, mutation);
199
257
  }
200
- tellTheWatchItsNames(options.schema, this.mutations.values(), options.policy);
258
+ // "Keep this link" (FR-172): answered by every store, offered by no list. An app's own `keep-link` keeps its name.
259
+ if (!options.past && !this.mutations.has(KEEP_LINK)) {
260
+ this.keeper = keepLinkMutation(options.schema);
261
+ this.mutations.set(KEEP_LINK, this.keeper);
262
+ }
201
263
  const horizon = given("horizon", options.horizon);
202
264
  const validate = { validate: this.validate };
203
265
  if (options.log) {
@@ -227,9 +289,16 @@ export class Store {
227
289
  * Only the DEFAULT generators are wound forward; an app that supplies
228
290
  * its own `ids` owns their uniqueness.
229
291
  */
292
+ if (options.past)
293
+ return;
230
294
  this.countPastTheLog();
231
295
  tellTheWatchOfAStore(this);
232
296
  }
297
+ /** Refuses any change to a store of the past (Roadmap f-playback). */
298
+ stillNow() {
299
+ if (this.past)
300
+ throw new PastError(this.past);
301
+ }
233
302
  /** Winds the default op and batch counters past every id the log holds, and past the horizon (FR-23). */
234
303
  countPastTheLog() {
235
304
  const trailing = (value) => {
@@ -288,6 +357,7 @@ export class Store {
288
357
  * when the set is the one the store already has.
289
358
  */
290
359
  setEnabledModules(enabled, options = {}) {
360
+ this.stillNow();
291
361
  const before = this.modules.enabled;
292
362
  const after = resolveModules(this.declaredModules, enabled).enabled;
293
363
  const off = [...before].filter((name) => !after.has(name));
@@ -339,10 +409,12 @@ export class Store {
339
409
  return mutation.derived !== undefined && this.modules.disabledKinds.has(mutation.derived.kind);
340
410
  }
341
411
  allMutations() {
342
- return [...this.mutations.values()].filter((mutation) => !this.mutationDisabled(mutation));
412
+ return [...this.mutations.values()].filter((mutation) => mutation !== this.keeper && !this.mutationDisabled(mutation));
343
413
  }
344
- /** The declared acts a derived act resolves its permission through. */
345
- viaOf(mutation) {
414
+ /** The declared acts a derived act resolves its permission through; keeping a link, those that make or break its relation. */
415
+ viaOf(mutation, call) {
416
+ if (mutation !== undefined && mutation === this.keeper)
417
+ return keepLinkVia(this.mutations.values(), call?.args["kind"]);
346
418
  if (!mutation?.derived)
347
419
  return undefined;
348
420
  return derivedVia(this.schema, [...this.mutations.values()], mutation);
@@ -384,6 +456,9 @@ export class Store {
384
456
  * repair as the starter seat, which may only add, and the press met
385
457
  * "starter may not take-off here" (W-110).
386
458
  */
459
+ // The app as it was is read, never changed (Roadmap f-playback): a control asking says so rather than offering a press.
460
+ if (this.past)
461
+ return { ok: false, refusal: { mutation: call.name, wouldNeed: [], message: "Nothing changes while you look back." } };
387
462
  const narrowed = this.refusesAgent(call, principal) ?? this.namesTurnedOff(call, principal);
388
463
  if (narrowed)
389
464
  return { ok: false, refusal: narrowed };
@@ -396,7 +471,7 @@ export class Store {
396
471
  * names. A call that cannot be compiled is refused by `apply`, in its
397
472
  * own words.
398
473
  */
399
- return permits(this.policy, principal, call.name, this.subjectKindOf(call, principal), this.viaOf(mutation), typeof id === "string" ? id : undefined, this.words, () => {
474
+ return permits(this.policy, principal, call.name, this.subjectKindOf(call, principal), this.viaOf(mutation, call), typeof id === "string" ? id : undefined, this.words, () => {
400
475
  const me = actingAs(principal).id;
401
476
  const far = this.namedIn(call, false);
402
477
  try {
@@ -408,7 +483,11 @@ export class Store {
408
483
  // Refused by `apply`.
409
484
  }
410
485
  return far;
411
- });
486
+ },
487
+ // Who made the record a derived act is about: riding only everybody's grant, it reaches what this principal made (W-201).
488
+ mutation?.derived && (() => recordsOf(this.log).creatorOf(id)),
489
+ // Taking a record out, or folding it away, rides the making of the kind only over what this principal made (W-201).
490
+ mutation?.derived !== undefined && UNMAKING.has(mutation.derived.act));
412
491
  }
413
492
  /** The ids a call names in its record arguments: its subject's too, unless `subject` is false (the far ends of what it links). */
414
493
  namedIn(call, subject = true) {
@@ -493,7 +572,7 @@ export class Store {
493
572
  return me;
494
573
  // And a seat that writes a value naming what it may not see has written its own words, though the store held them already.
495
574
  const hidden = seesId(this, author);
496
- return { ...me, seen: seenBy(this, author).graph, keepUnchanged: (value) => namesUnseen(value, hidden) };
575
+ return { ...me, seen: seenBy(this, author).graph, keepUnchanged: (value) => namesUnseen(value, hidden), seesInFull: seesEveryRecord(this, author) };
497
576
  }
498
577
  /**
499
578
  * A CALL THAT NAMES A RECORD THAT IS NOT THERE FOR ITS CALLER IS REFUSED
@@ -568,9 +647,14 @@ export class Store {
568
647
  if (named && visible(given))
569
648
  return { ok: true, id: given, label: this.labels.labelOf(given) ?? given, by: "id" };
570
649
  const found = this.labels.lookup(arg.kinds, given);
571
- const exact = found.exact.filter(visible);
650
+ // A name is a live record's when one has it, and an archived one's only when none does (FR-173).
651
+ const live = (ids) => {
652
+ const kept = ids.filter((id) => !this.graph.isArchived(id));
653
+ return kept.length ? kept : ids;
654
+ };
655
+ const exact = live(found.exact.filter(visible));
572
656
  const exactly = exact.length > 0;
573
- const candidates = (exactly ? exact : found.prefix.filter(visible))
657
+ const candidates = (exactly ? exact : live(found.prefix.filter(visible)))
574
658
  .map((id) => ({ id, kind: this.graph.getNode(id).kind, label: this.labels.labelOf(id) ?? id }))
575
659
  .sort((a, b) => (a.label < b.label ? -1 : a.label > b.label ? 1 : a.id < b.id ? -1 : 1));
576
660
  if (candidates.length === 1)
@@ -595,9 +679,11 @@ export class Store {
595
679
  const sights = this.policy?.sees ?? [];
596
680
  if (sights.length > 0 && !isSystem(principal)) {
597
681
  const creatable = new Set(this.permittedMutations(principal).flatMap((mutation) => mutation.creates ?? []));
682
+ // A sight that shows only some fields shows nothing until they can be judged, as `sees` says (Roadmap f-field-sight).
683
+ const judged = fieldsJudged(this);
598
684
  // Every kind: once a policy says who sees what, a kind no sight names is seen by nobody.
599
685
  for (const kind of this.schema.kinds) {
600
- const seeing = sights.some((sight) => sight.kinds.includes(kind) && grantsTo(sight, principal) && ((!sight.own && !sight.via) || principal.id !== undefined));
686
+ const seeing = sights.some((sight) => sight.kinds.includes(kind) && grantsTo(sight, principal) && ((!sight.own && !sight.via) || principal.id !== undefined) && (judged || !partialSight(sight)));
601
687
  if (!seeing && !creatable.has(kind))
602
688
  kept.add(kind);
603
689
  }
@@ -653,19 +739,75 @@ export class Store {
653
739
  * a day (a test, a demo, a replay) is asked about that day.
654
740
  */
655
741
  today() {
742
+ return this.pinned() ?? (this.ticked && this.ticked.on === isoToday() ? this.ticked.day : undefined);
743
+ }
744
+ /** The day `invariantOptions` pins, if it pins one: a tick does not move it. */
745
+ pinned() {
656
746
  const context = this.invariantOptions.context;
657
747
  const pinned = this.invariantOptions.today ?? context?.today;
658
748
  return typeof pinned === "string" && /^\d{4}-\d{2}-\d{2}$/.test(pinned) ? pinned : undefined;
659
749
  }
750
+ /** What every judgment is handed: the store's options, a call's context, and the day it judges on. */
751
+ judging(context) {
752
+ const today = this.today();
753
+ // A rule that walks a link to another app reads it as the viewer this graph is read for (FR-171), unless the call hands its own reader.
754
+ const linked = linkedReaderOf(this.graph);
755
+ const given = context ?? this.invariantOptions.context;
756
+ const judged = linked && !(given && "linked" in given) ? { ...given, linked } : context;
757
+ return { ...this.invariantOptions, ...(judged === undefined ? {} : { context: judged }), ...(today === undefined ? {} : { today }) };
758
+ }
759
+ /**
760
+ * THE DAY TURNED (FR-176). Rules are judged on every change and once on
761
+ * load; one that reads the clock — "overdue", "due this week" — is broken
762
+ * or mended by the day turning with nothing changed, and a room that stays
763
+ * open for weeks would go on saying the day it last heard a change. A host
764
+ * calls this when the day turns (`tickEachDay` does, just after each
765
+ * midnight by the clock `today()` reads; `@graview/ship`'s `openStore`
766
+ * and `openRemote` start it): from now on the store's rules are judged on
767
+ * `now`'s day (UTC, as `today()` reads the clock; or a day given as
768
+ * `YYYY-MM-DD`), and the answer is the problems that appeared and cleared
769
+ * with it. Which rules those can be is the declaration's to say
770
+ * (`clockReaders` on `@graview/core/check`, which `graview check` reads);
771
+ * the store judges every rule on the day before and the day after, once
772
+ * a day, and so needs no list. Every subscriber hears the day turn, with
773
+ * an empty diff and no ops, so the bar, the problems page and a count
774
+ * read again. Nothing is written or logged. A store whose day is pinned
775
+ * (`invariantOptions.today`) is judged on that day still, and answers
776
+ * that nothing moved.
777
+ */
778
+ tick(now = new Date()) {
779
+ const pinned = this.pinned();
780
+ if (pinned !== undefined)
781
+ return { day: pinned, was: pinned, appeared: [], cleared: [] };
782
+ const day = dayOf(now);
783
+ const was = this.today();
784
+ const before = this.violations();
785
+ this.ticked = { day, on: isoToday() };
786
+ const moved = this.moved(before, this.violations());
787
+ if (day !== was && !this.rehearsing && this.quiet === 0)
788
+ for (const listener of this.listeners)
789
+ listener(EMPTY_DIFF, []);
790
+ return { day, ...(was === undefined ? {} : { was }), appeared: moved.introduces, cleared: moved.resolves };
791
+ }
792
+ /**
793
+ * SOMETHING READ BESIDE THE GRAPH ANSWERED (FR-171): a record in another
794
+ * app that a computed field, a rule or a label walks to has been read, or
795
+ * read again. Nothing here changed, and nothing is written or logged;
796
+ * every subscriber hears it, as they hear the day turn, with an empty
797
+ * diff and no ops, so what reads through the link reads again.
798
+ */
799
+ reread() {
800
+ if (this.rehearsing || this.quiet > 0)
801
+ return;
802
+ for (const listener of this.listeners)
803
+ listener(EMPTY_DIFF, []);
804
+ }
660
805
  /**
661
806
  * Current violations, evaluated fresh — nothing is cached or stale. `over`
662
807
  * judges them over another reading of this graph: a seat's (FR-55).
663
808
  */
664
809
  violations(context, over = this.graph) {
665
- return evaluate(over, this.allInvariants(), {
666
- ...this.invariantOptions,
667
- ...(context === undefined ? {} : { context }),
668
- });
810
+ return evaluate(over, this.allInvariants(), this.judging(context));
669
811
  }
670
812
  /**
671
813
  * What a mutation would do, without doing it. Every action in the interface
@@ -755,10 +897,7 @@ export class Store {
755
897
  const before = this.violations(meta.context);
756
898
  const trial = Graph.from(this.schema, this.graph.snapshot());
757
899
  const diff = trial.applyPrimitives(primitives, { restoring: meta.restoring === true });
758
- const after = evaluate(trial, this.allInvariants(), {
759
- ...this.invariantOptions,
760
- ...(meta.context === undefined ? {} : { context: meta.context }),
761
- });
900
+ const after = evaluate(trial, this.allInvariants(), this.judging(meta.context));
762
901
  return {
763
902
  diff,
764
903
  primitives,
@@ -783,8 +922,10 @@ export class Store {
783
922
  * (`openRemote` sends each one down the wire).
784
923
  */
785
924
  applying(calls, options, context) {
925
+ this.stillNow();
786
926
  const batch = options.batch ?? this.mintBatch("batch");
787
927
  const author = options.author ?? this.by;
928
+ const lineage = lineageOf(options.lineage);
788
929
  const ops = [];
789
930
  const allPrimitives = [];
790
931
  const reads = new Set();
@@ -824,6 +965,16 @@ export class Store {
824
965
  if (refusal)
825
966
  this.refuse(refusal, author.id);
826
967
  }
968
+ /*
969
+ * THE APP'S OWN ACTOR IS HELD TO WHAT PEOPLE SAID: a change a person
970
+ * declined is not made again, a record a person said to leave alone is
971
+ * not changed, and what the declaration says is never tidied is not
972
+ * tidied on its own (`@graview/core/tidying`). Each refused in a
973
+ * sentence, and the whole gesture with it.
974
+ */
975
+ const automated = isAutomated(author);
976
+ if (automated)
977
+ this.refuseDeclined(calls, author);
827
978
  if (!this.rehearsing)
828
979
  tellTheWatchOfAnAuthor(author.id);
829
980
  try {
@@ -833,6 +984,11 @@ export class Store {
833
984
  if (missing)
834
985
  throw missing;
835
986
  const compiled = compileMutation(this.graph, definition, call.args, this.sighted(author));
987
+ if (automated) {
988
+ const refused = tidyingRefusal(this.schema, this.graph, compiled.primitives, this.authorName(author), { declaration: !this.suggesting });
989
+ if (refused)
990
+ this.refuse({ mutation: call.name, message: refused, wouldNeed: [] }, author.id);
991
+ }
836
992
  /*
837
993
  * AN ACT THAT DID NOTHING DOES NOT GO IN THE HISTORY.
838
994
  *
@@ -872,8 +1028,10 @@ export class Store {
872
1028
  writes: compiled.writes,
873
1029
  // Which records its sentence read, so a reader who may not see one is not handed the sentence (FR-55).
874
1030
  ...(definition.describe !== undefined && compiled.described && compiled.described.length > 0 ? { described: compiled.described } : {}),
1031
+ ...given("mergedInto", compiled.mergedInto),
875
1032
  at: this.now(),
876
1033
  ...given("via", options.via),
1034
+ ...given("lineage", lineage),
877
1035
  };
878
1036
  this.graph.applyPrimitives(op.primitives);
879
1037
  this.log.append(op);
@@ -891,7 +1049,8 @@ export class Store {
891
1049
  this.putBack(rollback, kept);
892
1050
  throw error;
893
1051
  }
894
- const diff = diffSnapshots(rollback, this.graph.snapshot());
1052
+ // What the act touched, never the whole graph again (W-205).
1053
+ const diff = diffTouched(rollback, this.graph.snapshot(), allPrimitives);
895
1054
  this.admitted(options, ops, allPrimitives, diff, rollback, kept);
896
1055
  const after = this.violations(context);
897
1056
  this.notify(diff, ops);
@@ -936,6 +1095,7 @@ export class Store {
936
1095
  * sequence must keep it themselves; `openRemote` does.
937
1096
  */
938
1097
  receive(ops, options = {}) {
1098
+ this.stillNow();
939
1099
  const known = new Set(this.log.all().map((op) => op.id));
940
1100
  const fresh = ops.filter((op) => !known.has(op.id));
941
1101
  if (fresh.length === 0)
@@ -973,7 +1133,7 @@ export class Store {
973
1133
  this.log.append(here);
974
1134
  landed.push(here);
975
1135
  }
976
- this.notify(diffSnapshots(before, this.graph.snapshot()), landed);
1136
+ this.notify(diffTouched(before, this.graph.snapshot(), fresh.flatMap((op) => op.primitives)), landed);
977
1137
  return landed;
978
1138
  }
979
1139
  /**
@@ -995,6 +1155,7 @@ export class Store {
995
1155
  * lands. Subscribers hear one change, and every op undoes like any other.
996
1156
  */
997
1157
  append(ops, options = {}) {
1158
+ this.stillNow();
998
1159
  if (ops.length === 0)
999
1160
  return [];
1000
1161
  const taken = new Set(this.log.all().map((op) => op.id));
@@ -1016,6 +1177,7 @@ export class Store {
1016
1177
  at: made.at ?? this.now(),
1017
1178
  ...given("undoes", made.undoes),
1018
1179
  ...given("via", made.via),
1180
+ ...given("lineage", lineageOf(made.lineage)),
1019
1181
  };
1020
1182
  if (taken.has(op.id))
1021
1183
  throw new GraphError(`Op "${op.id}" (${op.intent}) is already in the log`, "A host-made op needs an id of its own; leave `id` out and the store mints one.");
@@ -1036,7 +1198,7 @@ export class Store {
1036
1198
  this.log.append(op);
1037
1199
  for (const op of built)
1038
1200
  tellTheWatchOfAnAuthor(op.author.id);
1039
- this.notify(diffSnapshots(before, this.graph.snapshot()), built);
1201
+ this.notify(diffTouched(before, this.graph.snapshot(), built.flatMap((op) => op.primitives)), built);
1040
1202
  return built;
1041
1203
  }
1042
1204
  /**
@@ -1050,11 +1212,13 @@ export class Store {
1050
1212
  * primitive that does not fit leaves the store as it was and throws.
1051
1213
  */
1052
1214
  applyPrimitives(primitives, options = {}) {
1215
+ this.stillNow();
1053
1216
  const batch = options.batch ?? this.mintBatch("batch");
1054
1217
  const author = options.author ?? this.by;
1055
1218
  const before = this.violations();
1056
1219
  const rollback = this.graph.snapshot();
1057
1220
  const intent = options.intent ?? "Apply a change";
1221
+ const lineage = lineageOf(options.lineage);
1058
1222
  const recorded = primitives.map(normalize);
1059
1223
  const ops = [];
1060
1224
  if (recorded.length > 0) {
@@ -1071,6 +1235,7 @@ export class Store {
1071
1235
  writes: [...new Set(recorded.flatMap(writesOf))],
1072
1236
  at: this.now(),
1073
1237
  ...given("via", options.via),
1238
+ ...given("lineage", lineage),
1074
1239
  };
1075
1240
  this.graph.applyPrimitives(op.primitives);
1076
1241
  this.log.append(op);
@@ -1078,7 +1243,7 @@ export class Store {
1078
1243
  tellTheWatchOfAnAuthor(author.id);
1079
1244
  }
1080
1245
  const after = this.violations();
1081
- const diff = diffSnapshots(rollback, this.graph.snapshot());
1246
+ const diff = diffTouched(rollback, this.graph.snapshot(), recorded);
1082
1247
  this.notify(diff, ops);
1083
1248
  return {
1084
1249
  batch,
@@ -1145,6 +1310,7 @@ export class Store {
1145
1310
  }
1146
1311
  /** `undo` itself, kept apart for the same reason as `applying`. */
1147
1312
  undoing(batchIds, options) {
1313
+ this.stillNow();
1148
1314
  const ids = typeof batchIds === "string" ? [batchIds] : batchIds;
1149
1315
  const author = options.author ?? this.by;
1150
1316
  /*
@@ -1167,6 +1333,7 @@ export class Store {
1167
1333
  : check);
1168
1334
  }
1169
1335
  const batch = options.batch ?? this.mintBatch("undo");
1336
+ const lineage = lineageOf(options.lineage);
1170
1337
  /*
1171
1338
  * Undo is a CHANGE, and it is judged like one.
1172
1339
  *
@@ -1215,12 +1382,15 @@ export class Store {
1215
1382
  at: this.now(),
1216
1383
  undoes: target.id,
1217
1384
  ...given("via", options.via),
1385
+ ...given("lineage", lineage),
1386
+ // What was declined, kept on the declining (FR-172): "do not make this again".
1387
+ ...given("undoneLineage", target.lineage),
1218
1388
  };
1219
1389
  this.graph.applyPrimitives(op.primitives, { restoring: putsBack(target) });
1220
1390
  this.log.append(op);
1221
1391
  ops.push(op);
1222
1392
  }
1223
- const diff = diffSnapshots(rollback, this.graph.snapshot());
1393
+ const diff = diffTouched(rollback, this.graph.snapshot(), ops.flatMap((op) => [...op.primitives]));
1224
1394
  this.admitted(options, ops, ops.flatMap((op) => [...op.primitives]), diff, rollback, kept);
1225
1395
  const after = this.violations();
1226
1396
  this.notify(diff, ops);
@@ -1236,6 +1406,16 @@ export class Store {
1236
1406
  violationsAfter: after,
1237
1407
  };
1238
1408
  }
1409
+ /** An author named as Activity names one, for a sentence that refuses them. */
1410
+ authorName(author) {
1411
+ return nameOfAuthor(author, { graph: this.graph, schema: this.schema });
1412
+ }
1413
+ /** A change a person declined is not made or suggested again: refused, in a sentence. */
1414
+ refuseDeclined(calls, author) {
1415
+ const declined = declinedIn(this.log.all(), calls);
1416
+ if (declined)
1417
+ this.refuse({ mutation: calls[0].name, message: `${this.authorName(author)} may not make this again: a person declined it on ${declined.at.slice(0, 10)}.`, wouldNeed: [] }, author.id);
1418
+ }
1239
1419
  /** A change not kept: the graph as it was, and the log cut back to where it stood. */
1240
1420
  putBack(rollback, kept) {
1241
1421
  this.graph.load(rollback);
@@ -1319,6 +1499,7 @@ export class Store {
1319
1499
  * never flickers through the states in between.
1320
1500
  */
1321
1501
  rebase(change) {
1502
+ this.stillNow();
1322
1503
  const settling = new Set([...change.pending, ...(change.drop ?? [])]);
1323
1504
  const all = this.log.all();
1324
1505
  const first = all.findIndex((op) => settling.has(op.batch));
@@ -1412,6 +1593,7 @@ export class Store {
1412
1593
  * store did not hold before and the re-applied ones.
1413
1594
  */
1414
1595
  adopt(state) {
1596
+ this.stillNow();
1415
1597
  const dropped = new Set(state.drop ?? []);
1416
1598
  const pending = (state.pending ?? []).filter((batch) => !dropped.has(batch));
1417
1599
  const held = this.log.all();
@@ -1468,6 +1650,7 @@ export class Store {
1468
1650
  batch,
1469
1651
  ...given("intent", head.batchIntent),
1470
1652
  ...given("via", head.via),
1653
+ ...given("lineage", head.lineage),
1471
1654
  };
1472
1655
  if (head.undoes !== undefined) {
1473
1656
  const targets = ops.map((op) => this.log.get(op.undoes ?? ""));
@@ -1550,6 +1733,7 @@ export class Store {
1550
1733
  * Ship's `opened.compact()` archives first and calls this after.
1551
1734
  */
1552
1735
  compact(checkpoint) {
1736
+ this.stillNow();
1553
1737
  return this.log.compact(checkpoint);
1554
1738
  }
1555
1739
  }