@graview/core 0.1.28 → 0.1.29

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 (501) 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 +153 -0
  13. package/dist/app-places.js.map +1 -0
  14. package/dist/arrange.d.ts +2 -2
  15. package/dist/arrange.d.ts.map +1 -1
  16. package/dist/arrange.js +2 -2
  17. package/dist/arrange.js.map +1 -1
  18. package/dist/arrangement-words.d.ts +3 -0
  19. package/dist/arrangement-words.d.ts.map +1 -0
  20. package/dist/arrangement-words.js +50 -0
  21. package/dist/arrangement-words.js.map +1 -0
  22. package/dist/arrangement.d.ts +25 -3
  23. package/dist/arrangement.d.ts.map +1 -1
  24. package/dist/arrangement.js +36 -32
  25. package/dist/arrangement.js.map +1 -1
  26. package/dist/arranging.d.ts.map +1 -1
  27. package/dist/arranging.js +19 -8
  28. package/dist/arranging.js.map +1 -1
  29. package/dist/bind.d.ts +3 -0
  30. package/dist/bind.d.ts.map +1 -1
  31. package/dist/bind.js.map +1 -1
  32. package/dist/capabilities.js +1 -1
  33. package/dist/capabilities.js.map +1 -1
  34. package/dist/check.d.ts +3 -0
  35. package/dist/check.d.ts.map +1 -1
  36. package/dist/check.js +3 -0
  37. package/dist/check.js.map +1 -1
  38. package/dist/city.d.ts +58 -50
  39. package/dist/city.d.ts.map +1 -1
  40. package/dist/city.js +160 -147
  41. package/dist/city.js.map +1 -1
  42. package/dist/cli/check/brand.js +1 -1
  43. package/dist/cli/check/brand.js.map +1 -1
  44. package/dist/cli/check/clock-rules.d.ts +4 -0
  45. package/dist/cli/check/clock-rules.d.ts.map +1 -0
  46. package/dist/cli/check/clock-rules.js +26 -0
  47. package/dist/cli/check/clock-rules.js.map +1 -0
  48. package/dist/cli/check/field-sight.d.ts +11 -0
  49. package/dist/cli/check/field-sight.d.ts.map +1 -0
  50. package/dist/cli/check/field-sight.js +113 -0
  51. package/dist/cli/check/field-sight.js.map +1 -0
  52. package/dist/cli/check/index.d.ts +2 -0
  53. package/dist/cli/check/index.d.ts.map +1 -1
  54. package/dist/cli/check/index.js +2 -0
  55. package/dist/cli/check/index.js.map +1 -1
  56. package/dist/cli/check/lenses.d.ts +1 -1
  57. package/dist/cli/check/lenses.d.ts.map +1 -1
  58. package/dist/cli/check/lenses.js +43 -2
  59. package/dist/cli/check/lenses.js.map +1 -1
  60. package/dist/cli/check/relations.d.ts.map +1 -1
  61. package/dist/cli/check/relations.js +2 -1
  62. package/dist/cli/check/relations.js.map +1 -1
  63. package/dist/cli/check.d.ts.map +1 -1
  64. package/dist/cli/check.js +7 -4
  65. package/dist/cli/check.js.map +1 -1
  66. package/dist/cli/describe.d.ts.map +1 -1
  67. package/dist/cli/describe.js +44 -3
  68. package/dist/cli/describe.js.map +1 -1
  69. package/dist/cli/docs.d.ts.map +1 -1
  70. package/dist/cli/docs.js +4 -3
  71. package/dist/cli/docs.js.map +1 -1
  72. package/dist/cli/types.d.ts.map +1 -1
  73. package/dist/cli/types.js +10 -1
  74. package/dist/cli/types.js.map +1 -1
  75. package/dist/clock-readers.d.ts +18 -0
  76. package/dist/clock-readers.d.ts.map +1 -0
  77. package/dist/clock-readers.js +70 -0
  78. package/dist/clock-readers.js.map +1 -0
  79. package/dist/clock.d.ts +30 -0
  80. package/dist/clock.d.ts.map +1 -0
  81. package/dist/clock.js +41 -0
  82. package/dist/clock.js.map +1 -0
  83. package/dist/columns.d.ts.map +1 -1
  84. package/dist/columns.js +2 -1
  85. package/dist/columns.js.map +1 -1
  86. package/dist/conformance/fixtures.d.ts.map +1 -1
  87. package/dist/conformance/fixtures.js +326 -43
  88. package/dist/conformance/fixtures.js.map +1 -1
  89. package/dist/days.d.ts +53 -4
  90. package/dist/days.d.ts.map +1 -1
  91. package/dist/days.js +136 -16
  92. package/dist/days.js.map +1 -1
  93. package/dist/describe.d.ts +1 -0
  94. package/dist/describe.d.ts.map +1 -1
  95. package/dist/describe.js +1 -0
  96. package/dist/describe.js.map +1 -1
  97. package/dist/document/act-findings.d.ts.map +1 -1
  98. package/dist/document/act-findings.js +13 -3
  99. package/dist/document/act-findings.js.map +1 -1
  100. package/dist/document/amount.d.ts +4 -0
  101. package/dist/document/amount.d.ts.map +1 -0
  102. package/dist/document/amount.js +22 -0
  103. package/dist/document/amount.js.map +1 -0
  104. package/dist/document/block-context.d.ts.map +1 -1
  105. package/dist/document/block-context.js +1 -0
  106. package/dist/document/block-context.js.map +1 -1
  107. package/dist/document/blocks.d.ts +13 -3
  108. package/dist/document/blocks.d.ts.map +1 -1
  109. package/dist/document/blocks.js +56 -12
  110. package/dist/document/blocks.js.map +1 -1
  111. package/dist/document/compile-checked.d.ts.map +1 -1
  112. package/dist/document/compile-checked.js +3 -2
  113. package/dist/document/compile-checked.js.map +1 -1
  114. package/dist/document/compile.d.ts.map +1 -1
  115. package/dist/document/compile.js +30 -7
  116. package/dist/document/compile.js.map +1 -1
  117. package/dist/document/compiled.d.ts +4 -2
  118. package/dist/document/compiled.d.ts.map +1 -1
  119. package/dist/document/compiled.js +50 -19
  120. package/dist/document/compiled.js.map +1 -1
  121. package/dist/document/describe-coverage.d.ts.map +1 -1
  122. package/dist/document/describe-coverage.js +2 -1
  123. package/dist/document/describe-coverage.js.map +1 -1
  124. package/dist/document/describe-place.d.ts +6 -2
  125. package/dist/document/describe-place.d.ts.map +1 -1
  126. package/dist/document/describe-place.js +14 -8
  127. package/dist/document/describe-place.js.map +1 -1
  128. package/dist/document/diff.d.ts +2 -0
  129. package/dist/document/diff.d.ts.map +1 -1
  130. package/dist/document/diff.js +34 -6
  131. package/dist/document/diff.js.map +1 -1
  132. package/dist/document/durations.d.ts +8 -0
  133. package/dist/document/durations.d.ts.map +1 -0
  134. package/dist/document/durations.js +82 -0
  135. package/dist/document/durations.js.map +1 -0
  136. package/dist/document/edit.d.ts +1 -1
  137. package/dist/document/edit.d.ts.map +1 -1
  138. package/dist/document/edit.js +195 -22
  139. package/dist/document/edit.js.map +1 -1
  140. package/dist/document/expr/evaluate.d.ts +1 -1
  141. package/dist/document/expr/evaluate.d.ts.map +1 -1
  142. package/dist/document/expr/evaluate.js +17 -4
  143. package/dist/document/expr/evaluate.js.map +1 -1
  144. package/dist/document/field-spec.d.ts.map +1 -1
  145. package/dist/document/field-spec.js +15 -1
  146. package/dist/document/field-spec.js.map +1 -1
  147. package/dist/document/format-findings.d.ts +4 -0
  148. package/dist/document/format-findings.d.ts.map +1 -0
  149. package/dist/document/format-findings.js +39 -0
  150. package/dist/document/format-findings.js.map +1 -0
  151. package/dist/document/format-rules.d.ts +8 -0
  152. package/dist/document/format-rules.d.ts.map +1 -0
  153. package/dist/document/format-rules.js +19 -0
  154. package/dist/document/format-rules.js.map +1 -0
  155. package/dist/document/format-words.d.ts +9 -0
  156. package/dist/document/format-words.d.ts.map +1 -0
  157. package/dist/document/format-words.js +29 -0
  158. package/dist/document/format-words.js.map +1 -0
  159. package/dist/document/graview-template.d.ts +2 -2
  160. package/dist/document/migrate.d.ts +1 -0
  161. package/dist/document/migrate.d.ts.map +1 -1
  162. package/dist/document/migrate.js +45 -1
  163. package/dist/document/migrate.js.map +1 -1
  164. package/dist/document/money.d.ts +14 -0
  165. package/dist/document/money.d.ts.map +1 -0
  166. package/dist/document/money.js +14 -0
  167. package/dist/document/money.js.map +1 -0
  168. package/dist/document/policy-words.d.ts +2 -0
  169. package/dist/document/policy-words.d.ts.map +1 -1
  170. package/dist/document/policy-words.js +19 -4
  171. package/dist/document/policy-words.js.map +1 -1
  172. package/dist/document/rule-line.d.ts.map +1 -1
  173. package/dist/document/rule-line.js +16 -12
  174. package/dist/document/rule-line.js.map +1 -1
  175. package/dist/document/rules.d.ts.map +1 -1
  176. package/dist/document/rules.js +6 -5
  177. package/dist/document/rules.js.map +1 -1
  178. package/dist/document/schema.d.ts +62 -19
  179. package/dist/document/schema.d.ts.map +1 -1
  180. package/dist/document/schema.js +30 -4
  181. package/dist/document/schema.js.map +1 -1
  182. package/dist/document/template-parse.d.ts.map +1 -1
  183. package/dist/document/template-parse.js +9 -2
  184. package/dist/document/template-parse.js.map +1 -1
  185. package/dist/document/template.d.ts +3 -13
  186. package/dist/document/template.d.ts.map +1 -1
  187. package/dist/document/template.js +24 -22
  188. package/dist/document/template.js.map +1 -1
  189. package/dist/document/thumbnail.d.ts.map +1 -1
  190. package/dist/document/thumbnail.js +4 -3
  191. package/dist/document/thumbnail.js.map +1 -1
  192. package/dist/document/to-document.d.ts +0 -1
  193. package/dist/document/to-document.d.ts.map +1 -1
  194. package/dist/document/to-document.js +19 -2
  195. package/dist/document/to-document.js.map +1 -1
  196. package/dist/document/view-specs.d.ts.map +1 -1
  197. package/dist/document/view-specs.js +3 -0
  198. package/dist/document/view-specs.js.map +1 -1
  199. package/dist/document/views.d.ts +2 -0
  200. package/dist/document/views.d.ts.map +1 -1
  201. package/dist/document/views.js +18 -6
  202. package/dist/document/views.js.map +1 -1
  203. package/dist/document.schema.json +63 -6
  204. package/dist/excerpt-of.d.ts +14 -0
  205. package/dist/excerpt-of.d.ts.map +1 -0
  206. package/dist/excerpt-of.js +120 -0
  207. package/dist/excerpt-of.js.map +1 -0
  208. package/dist/excerpt.d.ts +9 -0
  209. package/dist/excerpt.d.ts.map +1 -0
  210. package/dist/excerpt.js +43 -0
  211. package/dist/excerpt.js.map +1 -0
  212. package/dist/field-sight.d.ts +33 -0
  213. package/dist/field-sight.d.ts.map +1 -0
  214. package/dist/field-sight.js +313 -0
  215. package/dist/field-sight.js.map +1 -0
  216. package/dist/forms.d.ts +1 -0
  217. package/dist/forms.d.ts.map +1 -1
  218. package/dist/forms.js +1 -0
  219. package/dist/forms.js.map +1 -1
  220. package/dist/graph/archived.d.ts +25 -0
  221. package/dist/graph/archived.d.ts.map +1 -0
  222. package/dist/graph/archived.js +16 -0
  223. package/dist/graph/archived.js.map +1 -0
  224. package/dist/graph/diff.d.ts.map +1 -1
  225. package/dist/graph/diff.js +2 -1
  226. package/dist/graph/diff.js.map +1 -1
  227. package/dist/graph/graph.d.ts +37 -13
  228. package/dist/graph/graph.d.ts.map +1 -1
  229. package/dist/graph/graph.js +86 -40
  230. package/dist/graph/graph.js.map +1 -1
  231. package/dist/graph/tracked.d.ts +8 -8
  232. package/dist/graph/tracked.d.ts.map +1 -1
  233. package/dist/graph/tracked.js +15 -20
  234. package/dist/graph/tracked.js.map +1 -1
  235. package/dist/graph/types.d.ts +16 -8
  236. package/dist/graph/types.d.ts.map +1 -1
  237. package/dist/graph/types.js.map +1 -1
  238. package/dist/import/coerce.d.ts +45 -0
  239. package/dist/import/coerce.d.ts.map +1 -0
  240. package/dist/import/coerce.js +252 -0
  241. package/dist/import/coerce.js.map +1 -0
  242. package/dist/import/csv.d.ts +16 -0
  243. package/dist/import/csv.d.ts.map +1 -0
  244. package/dist/import/csv.js +77 -0
  245. package/dist/import/csv.js.map +1 -0
  246. package/dist/import/index.d.ts +17 -0
  247. package/dist/import/index.d.ts.map +1 -0
  248. package/dist/import/index.js +13 -0
  249. package/dist/import/index.js.map +1 -0
  250. package/dist/import/mapping.d.ts +99 -0
  251. package/dist/import/mapping.d.ts.map +1 -0
  252. package/dist/import/mapping.js +182 -0
  253. package/dist/import/mapping.js.map +1 -0
  254. package/dist/import/rows.d.ts +116 -0
  255. package/dist/import/rows.d.ts.map +1 -0
  256. package/dist/import/rows.js +584 -0
  257. package/dist/import/rows.js.map +1 -0
  258. package/dist/index.d.ts +38 -21
  259. package/dist/index.d.ts.map +1 -1
  260. package/dist/index.js +27 -16
  261. package/dist/index.js.map +1 -1
  262. package/dist/invariants/engine.d.ts +5 -1
  263. package/dist/invariants/engine.d.ts.map +1 -1
  264. package/dist/invariants/engine.js +4 -3
  265. package/dist/invariants/engine.js.map +1 -1
  266. package/dist/invariants/types.d.ts +18 -3
  267. package/dist/invariants/types.d.ts.map +1 -1
  268. package/dist/json-schema.d.ts +1 -0
  269. package/dist/json-schema.d.ts.map +1 -1
  270. package/dist/json-schema.js +2 -0
  271. package/dist/json-schema.js.map +1 -1
  272. package/dist/labels.d.ts.map +1 -1
  273. package/dist/labels.js +2 -1
  274. package/dist/labels.js.map +1 -1
  275. package/dist/lines.d.ts +1 -0
  276. package/dist/lines.d.ts.map +1 -1
  277. package/dist/lines.js +5 -3
  278. package/dist/lines.js.map +1 -1
  279. package/dist/markdown.d.ts +102 -0
  280. package/dist/markdown.d.ts.map +1 -0
  281. package/dist/markdown.js +460 -0
  282. package/dist/markdown.js.map +1 -0
  283. package/dist/mutations/arg-shape.d.ts +95 -0
  284. package/dist/mutations/arg-shape.d.ts.map +1 -0
  285. package/dist/mutations/arg-shape.js +101 -0
  286. package/dist/mutations/arg-shape.js.map +1 -0
  287. package/dist/mutations/define-mutation.d.ts +48 -2
  288. package/dist/mutations/define-mutation.d.ts.map +1 -1
  289. package/dist/mutations/define-mutation.js +103 -36
  290. package/dist/mutations/define-mutation.js.map +1 -1
  291. package/dist/mutations/derive-edits.d.ts +16 -1
  292. package/dist/mutations/derive-edits.d.ts.map +1 -1
  293. package/dist/mutations/derive-edits.js +67 -28
  294. package/dist/mutations/derive-edits.js.map +1 -1
  295. package/dist/mutations/derive-repeats.d.ts +8 -0
  296. package/dist/mutations/derive-repeats.d.ts.map +1 -0
  297. package/dist/mutations/derive-repeats.js +118 -0
  298. package/dist/mutations/derive-repeats.js.map +1 -0
  299. package/dist/mutations/derived-names.d.ts +20 -0
  300. package/dist/mutations/derived-names.d.ts.map +1 -0
  301. package/dist/mutations/derived-names.js +19 -0
  302. package/dist/mutations/derived-names.js.map +1 -0
  303. package/dist/mutations/form.d.ts +21 -1
  304. package/dist/mutations/form.d.ts.map +1 -1
  305. package/dist/mutations/form.js +19 -2
  306. package/dist/mutations/form.js.map +1 -1
  307. package/dist/mutations/invalid-arguments.d.ts +14 -0
  308. package/dist/mutations/invalid-arguments.d.ts.map +1 -0
  309. package/dist/mutations/invalid-arguments.js +18 -0
  310. package/dist/mutations/invalid-arguments.js.map +1 -0
  311. package/dist/mutations/keep-link.d.ts +27 -0
  312. package/dist/mutations/keep-link.d.ts.map +1 -0
  313. package/dist/mutations/keep-link.js +56 -0
  314. package/dist/mutations/keep-link.js.map +1 -0
  315. package/dist/mutations/kept-arguments.d.ts +26 -0
  316. package/dist/mutations/kept-arguments.d.ts.map +1 -0
  317. package/dist/mutations/kept-arguments.js +77 -0
  318. package/dist/mutations/kept-arguments.js.map +1 -0
  319. package/dist/mutations/node-ref.d.ts +0 -80
  320. package/dist/mutations/node-ref.d.ts.map +1 -1
  321. package/dist/mutations/node-ref.js +0 -93
  322. package/dist/mutations/node-ref.js.map +1 -1
  323. package/dist/mutations/types.d.ts +17 -1
  324. package/dist/mutations/types.d.ts.map +1 -1
  325. package/dist/mutations/words.d.ts +0 -13
  326. package/dist/mutations/words.d.ts.map +1 -1
  327. package/dist/mutations/words.js +1 -12
  328. package/dist/mutations/words.js.map +1 -1
  329. package/dist/ops/kept-fields.d.ts +7 -0
  330. package/dist/ops/kept-fields.d.ts.map +1 -0
  331. package/dist/ops/kept-fields.js +24 -0
  332. package/dist/ops/kept-fields.js.map +1 -0
  333. package/dist/ops/lineage.d.ts +37 -0
  334. package/dist/ops/lineage.d.ts.map +1 -0
  335. package/dist/ops/lineage.js +26 -0
  336. package/dist/ops/lineage.js.map +1 -0
  337. package/dist/ops/log.d.ts.map +1 -1
  338. package/dist/ops/log.js +1 -0
  339. package/dist/ops/log.js.map +1 -1
  340. package/dist/ops/provenance.d.ts +68 -0
  341. package/dist/ops/provenance.d.ts.map +1 -0
  342. package/dist/ops/provenance.js +83 -0
  343. package/dist/ops/provenance.js.map +1 -0
  344. package/dist/ops/types.d.ts +25 -0
  345. package/dist/ops/types.d.ts.map +1 -1
  346. package/dist/ops/withheld.d.ts +25 -2
  347. package/dist/ops/withheld.d.ts.map +1 -1
  348. package/dist/ops/withheld.js +6 -15
  349. package/dist/ops/withheld.js.map +1 -1
  350. package/dist/permissions/policy.d.ts +6 -1
  351. package/dist/permissions/policy.d.ts.map +1 -1
  352. package/dist/permissions/policy.js +29 -9
  353. package/dist/permissions/policy.js.map +1 -1
  354. package/dist/permissions/sight.d.ts +40 -2
  355. package/dist/permissions/sight.d.ts.map +1 -1
  356. package/dist/permissions/sight.js +25 -2
  357. package/dist/permissions/sight.js.map +1 -1
  358. package/dist/permissions/types.d.ts +21 -0
  359. package/dist/permissions/types.d.ts.map +1 -1
  360. package/dist/permissions/types.js.map +1 -1
  361. package/dist/places.d.ts +0 -49
  362. package/dist/places.d.ts.map +1 -1
  363. package/dist/places.js +2 -141
  364. package/dist/places.js.map +1 -1
  365. package/dist/provenance.d.ts +14 -0
  366. package/dist/provenance.d.ts.map +1 -0
  367. package/dist/provenance.js +13 -0
  368. package/dist/provenance.js.map +1 -0
  369. package/dist/repeat-words.d.ts +13 -0
  370. package/dist/repeat-words.d.ts.map +1 -0
  371. package/dist/repeat-words.js +56 -0
  372. package/dist/repeat-words.js.map +1 -0
  373. package/dist/repeat.d.ts +59 -0
  374. package/dist/repeat.d.ts.map +1 -0
  375. package/dist/repeat.js +155 -0
  376. package/dist/repeat.js.map +1 -0
  377. package/dist/scaffold/project.d.ts.map +1 -1
  378. package/dist/scaffold/project.js +13 -0
  379. package/dist/scaffold/project.js.map +1 -1
  380. package/dist/scaffold/ui.js +2 -2
  381. package/dist/scene-districts.d.ts +2 -1
  382. package/dist/scene-districts.d.ts.map +1 -1
  383. package/dist/scene-districts.js +2 -1
  384. package/dist/scene-districts.js.map +1 -1
  385. package/dist/scene.d.ts +4 -2
  386. package/dist/scene.d.ts.map +1 -1
  387. package/dist/scene.js +2 -1
  388. package/dist/scene.js.map +1 -1
  389. package/dist/schema/amount-mark.d.ts +13 -0
  390. package/dist/schema/amount-mark.d.ts.map +1 -0
  391. package/dist/schema/amount-mark.js +20 -0
  392. package/dist/schema/amount-mark.js.map +1 -0
  393. package/dist/schema/amount-words.d.ts +12 -0
  394. package/dist/schema/amount-words.d.ts.map +1 -0
  395. package/dist/schema/amount-words.js +31 -0
  396. package/dist/schema/amount-words.js.map +1 -0
  397. package/dist/schema/app-link-field.d.ts +4 -0
  398. package/dist/schema/app-link-field.d.ts.map +1 -0
  399. package/dist/schema/app-link-field.js +19 -0
  400. package/dist/schema/app-link-field.js.map +1 -0
  401. package/dist/schema/app-link.d.ts +41 -0
  402. package/dist/schema/app-link.d.ts.map +1 -0
  403. package/dist/schema/app-link.js +40 -0
  404. package/dist/schema/app-link.js.map +1 -0
  405. package/dist/schema/define-node.d.ts +25 -94
  406. package/dist/schema/define-node.d.ts.map +1 -1
  407. package/dist/schema/define-node.js +3 -247
  408. package/dist/schema/define-node.js.map +1 -1
  409. package/dist/schema/field-words.d.ts +45 -0
  410. package/dist/schema/field-words.d.ts.map +1 -0
  411. package/dist/schema/field-words.js +124 -0
  412. package/dist/schema/field-words.js.map +1 -0
  413. package/dist/schema/json-schema.d.ts +6 -1
  414. package/dist/schema/json-schema.d.ts.map +1 -1
  415. package/dist/schema/json-schema.js +83 -2
  416. package/dist/schema/json-schema.js.map +1 -1
  417. package/dist/schema/markdown-field.d.ts +4 -0
  418. package/dist/schema/markdown-field.d.ts.map +1 -0
  419. package/dist/schema/markdown-field.js +20 -0
  420. package/dist/schema/markdown-field.js.map +1 -0
  421. package/dist/schema/markdown.d.ts +6 -0
  422. package/dist/schema/markdown.d.ts.map +1 -0
  423. package/dist/schema/markdown.js +27 -0
  424. package/dist/schema/markdown.js.map +1 -0
  425. package/dist/schema/reading.d.ts +86 -0
  426. package/dist/schema/reading.d.ts.map +1 -0
  427. package/dist/schema/reading.js +270 -0
  428. package/dist/schema/reading.js.map +1 -0
  429. package/dist/schema/repeat-field.d.ts +5 -0
  430. package/dist/schema/repeat-field.d.ts.map +1 -0
  431. package/dist/schema/repeat-field.js +20 -0
  432. package/dist/schema/repeat-field.js.map +1 -0
  433. package/dist/schema/schema.d.ts.map +1 -1
  434. package/dist/schema/schema.js +5 -1
  435. package/dist/schema/schema.js.map +1 -1
  436. package/dist/schema/to-json-schema.d.ts +14 -0
  437. package/dist/schema/to-json-schema.d.ts.map +1 -0
  438. package/dist/schema/to-json-schema.js +616 -0
  439. package/dist/schema/to-json-schema.js.map +1 -0
  440. package/dist/schema/typed-field-builders.d.ts +8 -0
  441. package/dist/schema/typed-field-builders.d.ts.map +1 -0
  442. package/dist/schema/typed-field-builders.js +30 -0
  443. package/dist/schema/typed-field-builders.js.map +1 -0
  444. package/dist/schema/typed-field-of.d.ts +4 -0
  445. package/dist/schema/typed-field-of.d.ts.map +1 -0
  446. package/dist/schema/typed-field-of.js +14 -0
  447. package/dist/schema/typed-field-of.js.map +1 -0
  448. package/dist/schema/typed-fields.d.ts +11 -0
  449. package/dist/schema/typed-fields.d.ts.map +1 -0
  450. package/dist/schema/typed-fields.js +16 -0
  451. package/dist/schema/typed-fields.js.map +1 -0
  452. package/dist/schema/types.d.ts +14 -0
  453. package/dist/schema/types.d.ts.map +1 -1
  454. package/dist/schema/value-words.d.ts +21 -0
  455. package/dist/schema/value-words.d.ts.map +1 -0
  456. package/dist/schema/value-words.js +32 -0
  457. package/dist/schema/value-words.js.map +1 -0
  458. package/dist/search.d.ts +91 -4
  459. package/dist/search.d.ts.map +1 -1
  460. package/dist/search.js +288 -53
  461. package/dist/search.js.map +1 -1
  462. package/dist/seat.d.ts +19 -0
  463. package/dist/seat.d.ts.map +1 -0
  464. package/dist/seat.js +19 -0
  465. package/dist/seat.js.map +1 -0
  466. package/dist/seen.d.ts +15 -33
  467. package/dist/seen.d.ts.map +1 -1
  468. package/dist/seen.js +44 -135
  469. package/dist/seen.js.map +1 -1
  470. package/dist/store.d.ts +46 -1
  471. package/dist/store.d.ts.map +1 -1
  472. package/dist/store.js +121 -22
  473. package/dist/store.js.map +1 -1
  474. package/dist/theme/types.d.ts +7 -1
  475. package/dist/theme/types.d.ts.map +1 -1
  476. package/dist/theme/types.js.map +1 -1
  477. package/dist/typed.d.ts +12 -3
  478. package/dist/typed.d.ts.map +1 -1
  479. package/dist/typed.js.map +1 -1
  480. package/dist/validate-graph.d.ts.map +1 -1
  481. package/dist/validate-graph.js +3 -10
  482. package/dist/validate-graph.js.map +1 -1
  483. package/dist/version.d.ts +1 -1
  484. package/dist/version.js +1 -1
  485. package/dist/views/types.d.ts +57 -8
  486. package/dist/views/types.d.ts.map +1 -1
  487. package/dist/views/types.js +22 -3
  488. package/dist/views/types.js.map +1 -1
  489. package/dist/village.d.ts +63 -0
  490. package/dist/village.d.ts.map +1 -0
  491. package/dist/village.js +143 -0
  492. package/dist/village.js.map +1 -0
  493. package/dist/watched.d.ts +12 -45
  494. package/dist/watched.d.ts.map +1 -1
  495. package/dist/watched.js +7 -119
  496. package/dist/watched.js.map +1 -1
  497. package/dist/words.d.ts +33 -0
  498. package/dist/words.d.ts.map +1 -0
  499. package/dist/words.js +36 -0
  500. package/dist/words.js.map +1 -0
  501. package/package.json +37 -2
@@ -1,9 +1,17 @@
1
+ import { DERIVED_ACTS, derivedActOf, derivedActsOf, givenWhenNeverArchived } from "../mutations/derived-names.js";
1
2
  import { z } from "zod";
2
3
  import { ExprSyntaxError, parseExpr } from "./expr/parse.js";
3
4
  import { printExpr } from "./expr/print.js";
4
5
  import { error } from "./findings.js";
5
6
  import { coerce } from "./migrate.js";
6
7
  import { outsideRange, rangeWords } from "./range.js";
8
+ import { formatWords } from "./format-words.js";
9
+ import { formatFits, formatMisplaced } from "./format-rules.js";
10
+ /** Why a format is refused where it does not fit, in the checker's words (`field-format`). */
11
+ const refusedFormat = (format, type) => {
12
+ const { sentence, fix } = formatMisplaced(format, type);
13
+ return `${sentence}; ${fix}`;
14
+ };
7
15
  import { farEnd } from "./far-end.js";
8
16
  import { ActSpec, EDGE_NAME, EdgeSpec, FIELD_NAME, FIELD_TYPES, FieldSpec, GrantSpec, KindSpec, NAME, RuleSpec, SightSpec, } from "./schema.js";
9
17
  import { SHIPPED_LENSES, isShippedLens, SHIPPED_LENS_NAMES } from "../places.js";
@@ -16,11 +24,12 @@ import { canonicalize } from "./canonical.js";
16
24
  import { quotedAtTheEnd } from "./quote.js";
17
25
  import { isRecord as isObject, respellDocument } from "./respell.js";
18
26
  import { refName } from "./compiled.js";
27
+ import { localeSentence } from "./diff.js";
19
28
  import { accentProblem } from "../theme/accent.js";
20
29
  import { pageFieldFindings, pageNames, renamedOnPage, withoutOnPage } from "./page-fields.js";
21
30
  import { capitalize, listed as listOf } from "../capital.js";
22
31
  import { quoted } from "./quote.js";
23
- import { FIRST_GRANT, FIRST_SIGHT, grantBody, grantGone, grantSentence, NO_GRANT_LEFT, NO_SIGHT_LEFT, peopleKinds, peopleSentence, nounWords, pluralWords as pluralOf, sightGone, sightSentence, sightWords, whoWords } from "./policy-words.js";
32
+ import { FIRST_GRANT, FIRST_SIGHT, grantBody, grantGone, grantSentence, NO_GRANT_LEFT, NO_SIGHT_LEFT, peopleKinds, peopleSentence, archivesSentence, nounWords, pluralWords as pluralOf, sightGone, sightSentence, sightWords, whoWords } from "./policy-words.js";
24
33
  /** The ops, for tool schemas and the guide. */
25
34
  export const EDIT_OPS = [
26
35
  "add-kind",
@@ -31,8 +40,10 @@ export const EDIT_OPS = [
31
40
  "retype-field",
32
41
  "set-options",
33
42
  "set-range",
43
+ "set-format",
34
44
  "set-required",
35
45
  "set-default",
46
+ "set-repeats",
36
47
  "remove-field",
37
48
  "add-relation",
38
49
  "rename-relation",
@@ -55,6 +66,7 @@ export const EDIT_OPS = [
55
66
  "arrange-pages",
56
67
  "set-computed",
57
68
  "set-people",
69
+ "set-archives",
58
70
  "add-grant",
59
71
  "remove-grant",
60
72
  "add-sight",
@@ -75,11 +87,13 @@ const SHAPES = {
75
87
  "remove-kind": z.object({ op: z.literal("remove-kind"), kind: kindName }).strict(),
76
88
  "add-field": z.object({ op: z.literal("add-field"), kind: kindName, field: fieldName, fill: z.unknown().optional(), spec: z.record(z.string(), z.unknown()).optional() }).passthrough(),
77
89
  "rename-field": z.object({ op: z.literal("rename-field"), kind: kindName, field: fieldName, to: fieldName }).strict(),
78
- "retype-field": z.object({ op: z.literal("retype-field"), kind: kindName, field: fieldName, type: z.enum(FIELD_TYPES), options: z.array(z.string().min(1).max(80)).min(1).max(100).optional(), of: z.enum(["string", "number", "date", "image", "file"]).optional(), format: z.enum(["money", "percent", "duration"]).optional() }).strict(),
90
+ "retype-field": z.object({ op: z.literal("retype-field"), kind: kindName, field: fieldName, type: z.enum(FIELD_TYPES), options: z.array(z.string().min(1).max(80)).min(1).max(100).optional(), of: z.enum(["string", "number", "date", "image", "file"]).optional(), format: z.enum(["money", "percent", "duration", "markdown"]).optional() }).strict(),
79
91
  "set-options": z.object({ op: z.literal("set-options"), kind: kindName, field: fieldName, add: z.array(z.string().min(1).max(80)).optional(), remove: z.array(z.string().min(1).max(80)).optional() }).strict(),
92
+ "set-format": z.object({ op: z.literal("set-format"), kind: kindName, field: fieldName, format: z.union([z.enum(["money", "percent", "duration", "markdown"]), z.null()]).optional(), unit: z.union([z.string().min(1).max(12), z.null()]).optional() }).strict(),
80
93
  "set-range": z.object({ op: z.literal("set-range"), kind: kindName, field: fieldName, min: z.union([z.number(), z.null()]).optional(), max: z.union([z.number(), z.null()]).optional(), step: z.union([z.number().positive(), z.null()]).optional() }).strict(),
81
94
  "set-required": z.object({ op: z.literal("set-required"), kind: kindName, field: fieldName, required: z.boolean() }).strict(),
82
95
  "set-default": z.object({ op: z.literal("set-default"), kind: kindName, field: fieldName, default: z.unknown() }).strict(),
96
+ "set-repeats": z.object({ op: z.literal("set-repeats"), kind: kindName, field: fieldName, repeats: z.boolean() }).strict(),
83
97
  "remove-field": z.object({ op: z.literal("remove-field"), kind: kindName, field: fieldName }).strict(),
84
98
  "add-relation": z.object({ op: z.literal("add-relation"), kind: kindName, relation: edgeName }).passthrough(),
85
99
  "rename-relation": z.object({ op: z.literal("rename-relation"), kind: kindName, relation: edgeName, to: edgeName }).strict(),
@@ -143,6 +157,8 @@ const SHAPES = {
143
157
  primary: z.union([z.array(z.string().min(1).max(80)).max(40), z.null()]).optional(),
144
158
  scene: z.union([z.string().min(1).max(40), z.null()]).optional(),
145
159
  pages: z.union([z.string().min(1).max(40), z.null()]).optional(),
160
+ // What a kind's list offers to filter by: `{ "request": ["status", "became.stage"] }`; null or [] gives a kind back its derived filters.
161
+ filters: z.record(kindName, z.union([z.array(z.string().min(1).max(120)).max(40), z.null()])).optional(),
146
162
  // The scene's word as a chat or a tool written before 0.1.17 sends it (FR-132's key, RESPELLED as `scene`).
147
163
  overview: z.union([z.string().min(1).max(40), z.null()]).optional(),
148
164
  })
@@ -159,6 +175,8 @@ const SHAPES = {
159
175
  .strict(),
160
176
  // Who the people are, and who may do and see what (FR-170): a grant and a sight as the document holds one.
161
177
  "set-people": z.object({ op: z.literal("set-people"), kind: kindName, people: z.boolean() }).strict(),
178
+ // Whether a kind's records are archived and merged, or only kept and removed (FR-173).
179
+ "set-archives": z.object({ op: z.literal("set-archives"), kind: kindName, archives: z.boolean() }).strict(),
162
180
  "add-grant": z.object({ op: z.literal("add-grant") }).passthrough(),
163
181
  "remove-grant": z.object({ op: z.literal("remove-grant") }).passthrough(),
164
182
  "add-sight": z.object({ op: z.literal("add-sight") }).passthrough(),
@@ -271,9 +289,10 @@ function mapNames(doc, e, ctx, rename) {
271
289
  const first = x.args[0];
272
290
  const literal = first?.t === "lit" && typeof first.value === "string" ? first.value : undefined;
273
291
  let args;
274
- if ((x.fn === "out" || x.fn === "in" || x.fn === "all") && literal !== undefined && x.args.length === 1) {
292
+ if ((x.fn === "out" || x.fn === "in" || x.fn === "all") && literal !== undefined && (x.args.length === 1 || (x.fn === "all" && x.args.length === 2))) {
275
293
  const name = rename({ role: x.fn === "all" ? "kind" : "edge", kinds: NONE, name: literal });
276
- args = name === literal ? [...x.args] : [{ ...first, value: name }];
294
+ // all('task', 'all') keeps what it asked of the archived (FR-173).
295
+ args = name === literal ? [...x.args] : [{ ...first, value: name }, ...x.args.slice(1)];
277
296
  }
278
297
  else if ((x.fn === "out" || x.fn === "in") && x.args.length === 2 && x.args[1].t === "lit" && typeof x.args[1].value === "string") {
279
298
  // out(S, 'edge'): the set is read where the walk stands, and its relation renamed like any walk's (FR-101).
@@ -507,13 +526,17 @@ class Editor {
507
526
  brand["currency"] = e.currency;
508
527
  this.said.push(`Money is said in ${e.currency}.`);
509
528
  }
510
- if (e.locale === null)
529
+ if (e.locale === null) {
530
+ if (brand["locale"] !== undefined)
531
+ this.said.push(localeSentence(undefined));
511
532
  delete brand["locale"];
533
+ }
512
534
  else if (e.locale !== undefined) {
513
535
  if (!/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(e.locale))
514
536
  return this.fail(i, "locale", 'a locale is a language tag, like "en-US" or "de-DE"');
515
537
  brand["locale"] = e.locale;
516
- this.said.push(`Money is written for ${e.locale}.`);
538
+ // Its days, times and numbers as well as its money (FR-178).
539
+ this.said.push(localeSentence(e.locale));
517
540
  }
518
541
  if (e.name === null) {
519
542
  delete brand["name"];
@@ -651,6 +674,8 @@ class Editor {
651
674
  return this.setOptions(i, e);
652
675
  case "set-range":
653
676
  return this.setRange(i, e);
677
+ case "set-format":
678
+ return this.setFormat(i, e);
654
679
  case "set-required": {
655
680
  const f = this.field(i, e.kind, e.field);
656
681
  if (!f)
@@ -681,6 +706,20 @@ class Editor {
681
706
  }
682
707
  return;
683
708
  }
709
+ case "set-repeats": {
710
+ // A date that repeats keeps how it does beside it, as `<field>Repeat` (`repeat.ts`).
711
+ const f = this.field(i, e.kind, e.field);
712
+ if (!f)
713
+ return;
714
+ if (e.repeats && f.type !== "date" && f.type !== "datetime")
715
+ return this.fail(i, "repeats", `${e.kind}'s ${e.field} is ${f.type === "enum" ? "a choice" : `a ${f.type}`}, and only a date or a date and time can repeat`);
716
+ if (e.repeats)
717
+ f.repeats = true;
718
+ else
719
+ delete f.repeats;
720
+ this.said.push(e.repeats ? `${e.kind}'s ${e.field} may repeat: weekly, monthly, on chosen days, until a day.` : `${e.kind}'s ${e.field} no longer repeats.`);
721
+ return;
722
+ }
684
723
  case "remove-field":
685
724
  return this.removeField(i, e.kind, e.field);
686
725
  case "add-relation":
@@ -800,6 +839,8 @@ class Editor {
800
839
  return this.setComputed(i, e);
801
840
  case "set-people":
802
841
  return this.setPeople(i, e);
842
+ case "set-archives":
843
+ return this.setArchives(i, e);
803
844
  case "add-grant":
804
845
  case "remove-grant":
805
846
  case "add-sight":
@@ -1005,8 +1046,17 @@ class Editor {
1005
1046
  // `overview` is the scene's word as 0.1.15 and 0.1.16 took it (FR-134): read as `scene`, which wins when both are said.
1006
1047
  const { overview, ...rest } = given;
1007
1048
  const e = rest.scene === undefined && overview !== undefined ? { ...rest, scene: overview } : rest;
1008
- if (e.order === undefined && e.hide === undefined && e.first === undefined && e.scene === undefined && e.pages === undefined && e.primary === undefined)
1009
- return this.fail(i, "", 'arrange-pages says at least one of "order", "hide", "first", "primary", "scene" or "pages"');
1049
+ if (e.order === undefined && e.hide === undefined && e.first === undefined && e.scene === undefined && e.pages === undefined && e.primary === undefined && e.filters === undefined)
1050
+ return this.fail(i, "", 'arrange-pages says at least one of "order", "hide", "first", "primary", "scene", "pages" or "filters"');
1051
+ for (const [kind, keys] of Object.entries((e.filters ?? {}))) {
1052
+ if (!this.doc.kinds[kind])
1053
+ return this.fail(i, `filters.${kind}`, `"${kind}" is not a kind this app has; it has ${Object.keys(this.doc.kinds).join(", ")}`);
1054
+ for (const [n, key] of (keys ?? []).entries()) {
1055
+ const offered = this.filterKeys(kind);
1056
+ if (!offered.includes(key))
1057
+ return this.fail(i, `filters.${kind}.${n}`, `${kind} cannot be filtered by "${key}"`, `name one of ${offered.join(", ")}`);
1058
+ }
1059
+ }
1010
1060
  for (const [n, word] of (e.primary ?? []).entries()) {
1011
1061
  if (typeof word !== "string" || !this.opens(word) || word.trim().toLowerCase() === "home") {
1012
1062
  const titles = (this.doc.lenses ?? []).flatMap((lens) => (isObject(lens) && typeof lens["title"] === "string" ? [`"${lens["title"]}"`] : []));
@@ -1085,10 +1135,46 @@ class Editor {
1085
1135
  said.push(`the switch calls the ${face} "${pages[face]}"`);
1086
1136
  }
1087
1137
  }
1138
+ for (const [kind, keys] of Object.entries((e.filters ?? {}))) {
1139
+ const lists = (pages.lists ??= {});
1140
+ if (keys === null || keys.length === 0) {
1141
+ delete lists[kind];
1142
+ said.push(`the list of ${pluralWords(this.doc, kind)} offers its own filters again`);
1143
+ }
1144
+ else {
1145
+ lists[kind] = { filters: [...keys] };
1146
+ said.push(`the list of ${pluralWords(this.doc, kind)} filters by ${listOf(keys.map((key) => `"${key}"`))}`);
1147
+ }
1148
+ if (Object.keys(lists).length === 0)
1149
+ delete pages.lists;
1150
+ }
1088
1151
  if (Object.keys(pages).length === 0)
1089
1152
  delete this.doc.pages;
1090
1153
  this.said.push(`${capitalize(listOf(said))}.`);
1091
1154
  }
1155
+ /** What a kind's list may be filtered by: its fields, its relations either way, `is`, and a choice at a relation's single far kind. */
1156
+ filterKeys(kind) {
1157
+ const kinds = this.doc.kinds;
1158
+ const keys = new Set(["is", ...Object.keys(kinds[kind]?.fields ?? {})]);
1159
+ const edges = new Map();
1160
+ for (const [edge, spec] of Object.entries((kinds[kind]?.edges ?? {})))
1161
+ edges.set(edge, spec.to === "*" ? [] : [spec.to].flat());
1162
+ for (const [other, spec] of Object.entries(kinds)) {
1163
+ for (const [edge, declared] of Object.entries((spec.edges ?? {}))) {
1164
+ if (other !== kind && !edges.has(edge) && (declared.to === "*" || [declared.to].flat().includes(kind)))
1165
+ edges.set(edge, [other]);
1166
+ }
1167
+ }
1168
+ for (const [edge, far] of edges) {
1169
+ keys.add(edge);
1170
+ if (far.length !== 1 || far[0] === kind)
1171
+ continue;
1172
+ for (const [field, spec] of Object.entries((kinds[far[0]]?.fields ?? {})))
1173
+ if (spec.type === "enum")
1174
+ keys.add(`${edge}.${field}`);
1175
+ }
1176
+ return [...keys];
1177
+ }
1092
1178
  /** Whether `first` names something the app can open on: home, a kind or its plural, a titled lens. */
1093
1179
  opens(first) {
1094
1180
  const word = first.trim();
@@ -1179,6 +1265,28 @@ class Editor {
1179
1265
  delete spec.people;
1180
1266
  this.said.push(peopleSentence(this.doc.kinds, e.kind, e.people, already));
1181
1267
  }
1268
+ /** A kind's records kept or removed, never archived (FR-173) — or archived and merged again. */
1269
+ setArchives(i, e) {
1270
+ const spec = this.kind(i, e.kind);
1271
+ if (!spec)
1272
+ return;
1273
+ const already = (spec.archives !== false) === e.archives;
1274
+ if (!e.archives && !already) {
1275
+ // A grant that names one of the three acts would name an act the app no longer has.
1276
+ const gone = new Set(["archive", "unarchive", "merge"].map((verb) => `${verb}-${e.kind}`).filter((act) => !this.doc.acts?.[act]));
1277
+ const grant = (this.doc.policy?.grants ?? []).find((g) => Array.isArray(g.mutations) && g.mutations.some((m) => gone.has(m)));
1278
+ if (grant) {
1279
+ const named = grant.mutations.filter((m) => gone.has(m));
1280
+ return this.failAs("grant-unknown-mutation", i, "archives", `a grant names ${listOf(named.map((m) => `"${m}"`))}, which ${pluralOf(this.doc.kinds, e.kind)} would no longer have`, `{"op": "remove-grant", "roles": ${JSON.stringify(grant.roles)}, "mutations": ${JSON.stringify(grant.mutations)}} first, in the same change`);
1281
+ }
1282
+ spec.archives = false;
1283
+ }
1284
+ else if (e.archives)
1285
+ delete spec.archives;
1286
+ if (!already)
1287
+ this.toolsMoved.add(`archive-${e.kind}, unarchive-${e.kind} and merge-${e.kind} ${e.archives ? "are offered" : "are gone"}`);
1288
+ this.said.push(archivesSentence(this.doc.kinds, e.kind, e.archives, already));
1289
+ }
1182
1290
  /** A grant or a sight as the document holds one, or undefined having said why not. */
1183
1291
  policyPart(i, e, sight) {
1184
1292
  const { op: _op, ...rest } = e;
@@ -1202,12 +1310,21 @@ class Editor {
1202
1310
  if (!this.doc.kinds[kind])
1203
1311
  return this.failAs(sight ? "sight-kind" : "edit", i, `kinds.${n}`, `"${kind}" is not a kind this app has; it has ${Object.keys(this.doc.kinds).join(", ")}`);
1204
1312
  }
1313
+ // A field a sight shows or hides is one of the kinds it shows (Roadmap f-field-sight).
1314
+ for (const key of sight ? ["fields", "hide"] : []) {
1315
+ for (const [n, field] of (part[key] ?? []).entries()) {
1316
+ const kinds = part.kinds;
1317
+ if (kinds.some((kind) => this.doc.kinds[kind]?.fields[field]))
1318
+ continue;
1319
+ return this.failAs("sight-field", i, `${key}.${n}`, `"${field}" is not a field of ${kinds.join(" or ")}`, `one of ${[...new Set(kinds.flatMap((kind) => Object.keys(this.doc.kinds[kind]?.fields ?? {})))].join(", ")}`);
1320
+ }
1321
+ }
1205
1322
  if (!sight && part.mutations !== "*") {
1206
1323
  for (const [n, act] of part.mutations.entries()) {
1207
- const derived = /^(?:edit|remove)-(.+)$/.exec(act);
1208
- if (this.doc.acts?.[act] || (derived && this.doc.kinds[derived[1]]))
1324
+ const derived = derivedActOf(act);
1325
+ if (this.doc.acts?.[act] || (derived && this.doc.kinds[derived.kind] && (this.doc.kinds[derived.kind].archives !== false || givenWhenNeverArchived(derived.act))))
1209
1326
  continue;
1210
- return this.failAs("grant-act", i, `mutations.${n}`, `"${act}" is not an act this app has`, `one of ${[...Object.keys(this.doc.acts ?? {}), ...Object.keys(this.doc.kinds).flatMap((kind) => [`edit-${kind}`, `remove-${kind}`])].join(", ")}`);
1327
+ return this.failAs("grant-act", i, `mutations.${n}`, `"${act}" is not an act this app has`, `one of ${[...Object.keys(this.doc.acts ?? {}), ...Object.keys(this.doc.kinds).flatMap(derivedActsOf)].join(", ")}`);
1211
1328
  }
1212
1329
  }
1213
1330
  const said = [];
@@ -1306,8 +1423,8 @@ class Editor {
1306
1423
  const to = e.to;
1307
1424
  const touched = this.rewriteAll({ t: "kind", from, to });
1308
1425
  // The acts the framework derives for every kind are named for it, so they move with it.
1309
- this.toolsMoved.add(`edit-${from} is now edit-${to}`);
1310
- this.toolsMoved.add(`remove-${from} is now remove-${to}`);
1426
+ for (const act of DERIVED_ACTS)
1427
+ this.toolsMoved.add(`${act}-${from} is now ${act}-${to}`);
1311
1428
  // The kind itself, in order, continuing its records.
1312
1429
  const kinds = {};
1313
1430
  for (const [k, v] of Object.entries(this.doc.kinds))
@@ -1424,7 +1541,7 @@ class Editor {
1424
1541
  * whose last act is removed — kept, it read as a grant on every kind.
1425
1542
  */
1426
1543
  if (this.doc.policy) {
1427
- const derived = [`edit-${kind}`, `remove-${kind}`];
1544
+ const derived = derivedActsOf(kind);
1428
1545
  this.doc.policy.grants = this.doc.policy.grants.flatMap((g) => {
1429
1546
  const kinds = Array.isArray(g.kinds) ? g.kinds.filter((k) => k !== kind) : g.kinds;
1430
1547
  const mutations = Array.isArray(g.mutations) ? g.mutations.filter((m) => !derived.includes(m) || this.doc.acts?.[m]) : g.mutations;
@@ -1491,6 +1608,8 @@ class Editor {
1491
1608
  delete f.renamedFrom;
1492
1609
  if (f.type === "enum" && f.default !== undefined && !f.options.includes(f.default))
1493
1610
  return this.fail(i, "default", `"${String(f.default)}" is not one of the options`);
1611
+ if (f.format && !formatFits(f.format, f.type))
1612
+ return this.fail(i, "format", refusedFormat(f.format, f.type));
1494
1613
  spec.fields[field] = f;
1495
1614
  this.fieldOrigin.set(`${kind}.${field}`, undefined);
1496
1615
  let filled = "";
@@ -1510,7 +1629,9 @@ class Editor {
1510
1629
  filled = `, set to ${JSON.stringify(fill)} on the records already there`;
1511
1630
  }
1512
1631
  }
1513
- this.said.push(`${kind} gains a field, ${field} (${f.type}${f.required ? ", required" : ""})${filled}.`);
1632
+ // What it is said as, in words: "(number, money in USD — 10000 reads $10,000)".
1633
+ const said = formatWords(f, this.doc.brand);
1634
+ this.said.push(`${kind} gains a field, ${field} (${f.type}${said ? `, ${said}` : ""}${f.required ? ", required" : ""})${filled}.`);
1514
1635
  }
1515
1636
  renameField(i, kind, field, to) {
1516
1637
  const f = this.field(i, kind, field);
@@ -1572,6 +1693,9 @@ class Editor {
1572
1693
  return;
1573
1694
  if (e.type === "enum" && !e.options && !f.options)
1574
1695
  return this.fail(i, "options", `to make ${e.field} a choice, list its "options"`);
1696
+ // A format goes where it says something (FR-180): money, a percent and a duration on a number, Markdown on a text field.
1697
+ if (e.format && !formatFits(e.format, e.type))
1698
+ return this.fail(i, "format", refusedFormat(e.format, e.type));
1575
1699
  const was = f.type;
1576
1700
  f.type = e.type;
1577
1701
  if (e.type === "enum")
@@ -1584,25 +1708,69 @@ class Editor {
1584
1708
  delete f.of;
1585
1709
  if (e.format)
1586
1710
  f.format = e.format;
1587
- else if (e.type !== "number" && e.type !== "integer")
1711
+ else if (e.type === "text" || !formatFits(f.format ?? "", e.type))
1588
1712
  delete f.format;
1589
1713
  // A range is a number's (FR-114): a field that is no longer one lets it go.
1590
- if (e.type !== "number" && e.type !== "integer")
1714
+ if (e.type !== "number" && e.type !== "integer" && e.type !== "duration")
1591
1715
  for (const key of ["min", "max", "step"])
1592
1716
  delete f[key];
1717
+ // Only a date repeats: a field that is no longer one lets its repeat go.
1718
+ if (e.type !== "date" && e.type !== "datetime")
1719
+ delete f.repeats;
1593
1720
  if (f.default !== undefined && coerce(f.default, was, f) === undefined)
1594
1721
  delete f.default;
1595
1722
  else if (f.default !== undefined)
1596
1723
  f.default = coerce(f.default, was, f);
1597
- this.said.push(`${e.kind}'s ${e.field} changes from ${was} to ${e.type}; values that convert are kept.`);
1724
+ const said = f.format && f.format !== "markdown" ? formatWords(f, this.doc.brand) : undefined;
1725
+ if (was === e.type && e.type === "text")
1726
+ this.said.push(`${e.kind}'s ${e.field} ${e.format === "markdown" ? "is now written in Markdown, drawn as prose on the record's page" : "is drawn as written, not as Markdown"}; its values are kept.`);
1727
+ else
1728
+ this.said.push(`${e.kind}'s ${e.field} changes from ${was} to ${e.type}${said ? `, said as ${said}` : ""}; values that convert are kept.`);
1729
+ }
1730
+ /**
1731
+ * HOW A FIELD IS SAID, and nothing else about it: a number's `format`
1732
+ * (money, a percent, a duration) and `unit` (a currency like "EUR" for
1733
+ * money, a measure like "kg"), or a text field's `format`, `markdown`
1734
+ * (FR-180) — each set by a value, cleared by `null`, kept when left out.
1735
+ * The values stay as they are; every face says them anew.
1736
+ */
1737
+ setFormat(i, e) {
1738
+ const f = this.field(i, e.kind, e.field);
1739
+ if (!f)
1740
+ return;
1741
+ if (e.format === undefined && e.unit === undefined)
1742
+ return this.fail(i, "format", 'say a "format" ("money", "percent" or "duration" for a number, "markdown" for a text field, or null for neither), a "unit" ("EUR", "kg", or null), or both');
1743
+ if (f.type === "text") {
1744
+ if (e.unit !== undefined && e.unit !== null)
1745
+ return this.fail(i, "unit", refusedFormat("a unit", f.type));
1746
+ if (e.format && e.format !== "markdown")
1747
+ return this.fail(i, "format", refusedFormat(e.format, f.type));
1748
+ if (e.format === "markdown")
1749
+ f.format = "markdown";
1750
+ else if (e.format === null)
1751
+ delete f.format;
1752
+ this.said.push(`${e.kind}'s ${e.field} ${f.format === "markdown" ? "is now written in Markdown, drawn as prose on the record's page" : "is drawn as written, not as Markdown"}; its values are kept.`);
1753
+ return;
1754
+ }
1755
+ if (!formatFits(typeof e.format === "string" ? e.format : "money", f.type))
1756
+ return this.fail(i, "field", refusedFormat(typeof e.format === "string" ? e.format : "a unit", f.type));
1757
+ const before = formatWords(f, this.doc.brand);
1758
+ for (const key of ["format", "unit"]) {
1759
+ if (e[key] === null)
1760
+ delete f[key];
1761
+ else if (e[key] !== undefined)
1762
+ f[key] = e[key];
1763
+ }
1764
+ const now = formatWords(f, this.doc.brand);
1765
+ this.said.push(`${e.kind}'s ${e.field} is said as ${now ?? "a plain number"}${before ? `, where it was ${before.replace(/ — .*/, "")}` : ""}; its values are kept.`);
1598
1766
  }
1599
1767
  /** A number's range (FR-114): a key given sets it, `null` clears it, one left out stays. */
1600
1768
  setRange(i, e) {
1601
1769
  const f = this.field(i, e.kind, e.field);
1602
1770
  if (!f)
1603
1771
  return;
1604
- if (f.type !== "number" && f.type !== "integer")
1605
- return this.fail(i, "field", `${e.field} is ${f.type === "integer" ? "an" : "a"} ${f.type}, not a number; a range belongs on a number or integer field`);
1772
+ if (f.type !== "number" && f.type !== "integer" && f.type !== "duration")
1773
+ return this.fail(i, "field", `${e.field} is ${f.type === "integer" ? "an" : "a"} ${f.type}, not a number; a range belongs on a number, integer or duration field`);
1606
1774
  const next = { ...f };
1607
1775
  for (const key of ["min", "max", "step"]) {
1608
1776
  if (e[key] === null)
@@ -2025,7 +2193,7 @@ class Editor {
2025
2193
  rule.over = r.to;
2026
2194
  for (const rep of rule.repairs ?? []) {
2027
2195
  if (r.t === "kind")
2028
- rep.act = rep.act === `edit-${r.from}` ? `edit-${r.to}` : rep.act === `remove-${r.from}` ? `remove-${r.to}` : rep.act;
2196
+ rep.act = renamedAct(rep.act, r.from, r.to);
2029
2197
  const args = renamedArgs.get(rep.act);
2030
2198
  if (args && rep.args)
2031
2199
  for (const [a, b] of args)
@@ -2052,7 +2220,7 @@ class Editor {
2052
2220
  if (Array.isArray(g.kinds))
2053
2221
  g.kinds = g.kinds.map(swap);
2054
2222
  if (Array.isArray(g.mutations))
2055
- g.mutations = g.mutations.map((m) => (m === `edit-${r.from}` ? `edit-${r.to}` : m === `remove-${r.from}` ? `remove-${r.to}` : m));
2223
+ g.mutations = g.mutations.map((m) => renamedAct(m, r.from, r.to));
2056
2224
  }
2057
2225
  for (const s of doc.policy.sees ?? [])
2058
2226
  s.kinds = s.kinds.map(swap);
@@ -2808,4 +2976,9 @@ export function renameIn(kinds, over, text, change) {
2808
2976
  return rewriteTemplate(doc, text.template, ctx, r);
2809
2977
  return undefined;
2810
2978
  }
2979
+ /** A derived act of a renamed kind, renamed with it: `archive-task` becomes `archive-chore`. Any other act as it was. */
2980
+ function renamedAct(act, from, to) {
2981
+ const derived = derivedActOf(act);
2982
+ return derived && derived.kind === from ? `${derived.act}-${to}` : act;
2983
+ }
2811
2984
  //# sourceMappingURL=edit.js.map