@graview/core 0.1.27 → 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 (505) 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/capital.d.ts +2 -0
  35. package/dist/capital.d.ts.map +1 -1
  36. package/dist/capital.js +2 -0
  37. package/dist/capital.js.map +1 -1
  38. package/dist/check.d.ts +3 -0
  39. package/dist/check.d.ts.map +1 -1
  40. package/dist/check.js +3 -0
  41. package/dist/check.js.map +1 -1
  42. package/dist/city.d.ts +58 -50
  43. package/dist/city.d.ts.map +1 -1
  44. package/dist/city.js +160 -147
  45. package/dist/city.js.map +1 -1
  46. package/dist/cli/check/brand.js +1 -1
  47. package/dist/cli/check/brand.js.map +1 -1
  48. package/dist/cli/check/clock-rules.d.ts +4 -0
  49. package/dist/cli/check/clock-rules.d.ts.map +1 -0
  50. package/dist/cli/check/clock-rules.js +26 -0
  51. package/dist/cli/check/clock-rules.js.map +1 -0
  52. package/dist/cli/check/field-sight.d.ts +11 -0
  53. package/dist/cli/check/field-sight.d.ts.map +1 -0
  54. package/dist/cli/check/field-sight.js +113 -0
  55. package/dist/cli/check/field-sight.js.map +1 -0
  56. package/dist/cli/check/index.d.ts +2 -0
  57. package/dist/cli/check/index.d.ts.map +1 -1
  58. package/dist/cli/check/index.js +2 -0
  59. package/dist/cli/check/index.js.map +1 -1
  60. package/dist/cli/check/lenses.d.ts +1 -1
  61. package/dist/cli/check/lenses.d.ts.map +1 -1
  62. package/dist/cli/check/lenses.js +43 -2
  63. package/dist/cli/check/lenses.js.map +1 -1
  64. package/dist/cli/check/relations.d.ts.map +1 -1
  65. package/dist/cli/check/relations.js +2 -1
  66. package/dist/cli/check/relations.js.map +1 -1
  67. package/dist/cli/check.d.ts.map +1 -1
  68. package/dist/cli/check.js +7 -4
  69. package/dist/cli/check.js.map +1 -1
  70. package/dist/cli/describe.d.ts.map +1 -1
  71. package/dist/cli/describe.js +44 -3
  72. package/dist/cli/describe.js.map +1 -1
  73. package/dist/cli/docs.d.ts.map +1 -1
  74. package/dist/cli/docs.js +4 -3
  75. package/dist/cli/docs.js.map +1 -1
  76. package/dist/cli/types.d.ts.map +1 -1
  77. package/dist/cli/types.js +10 -1
  78. package/dist/cli/types.js.map +1 -1
  79. package/dist/clock-readers.d.ts +18 -0
  80. package/dist/clock-readers.d.ts.map +1 -0
  81. package/dist/clock-readers.js +70 -0
  82. package/dist/clock-readers.js.map +1 -0
  83. package/dist/clock.d.ts +30 -0
  84. package/dist/clock.d.ts.map +1 -0
  85. package/dist/clock.js +41 -0
  86. package/dist/clock.js.map +1 -0
  87. package/dist/columns.d.ts.map +1 -1
  88. package/dist/columns.js +2 -1
  89. package/dist/columns.js.map +1 -1
  90. package/dist/conformance/fixtures.d.ts.map +1 -1
  91. package/dist/conformance/fixtures.js +326 -43
  92. package/dist/conformance/fixtures.js.map +1 -1
  93. package/dist/days.d.ts +53 -4
  94. package/dist/days.d.ts.map +1 -1
  95. package/dist/days.js +136 -16
  96. package/dist/days.js.map +1 -1
  97. package/dist/describe.d.ts +1 -0
  98. package/dist/describe.d.ts.map +1 -1
  99. package/dist/describe.js +1 -0
  100. package/dist/describe.js.map +1 -1
  101. package/dist/document/act-findings.d.ts.map +1 -1
  102. package/dist/document/act-findings.js +13 -3
  103. package/dist/document/act-findings.js.map +1 -1
  104. package/dist/document/amount.d.ts +4 -0
  105. package/dist/document/amount.d.ts.map +1 -0
  106. package/dist/document/amount.js +22 -0
  107. package/dist/document/amount.js.map +1 -0
  108. package/dist/document/block-context.d.ts.map +1 -1
  109. package/dist/document/block-context.js +1 -0
  110. package/dist/document/block-context.js.map +1 -1
  111. package/dist/document/blocks.d.ts +13 -3
  112. package/dist/document/blocks.d.ts.map +1 -1
  113. package/dist/document/blocks.js +56 -12
  114. package/dist/document/blocks.js.map +1 -1
  115. package/dist/document/compile-checked.d.ts.map +1 -1
  116. package/dist/document/compile-checked.js +3 -2
  117. package/dist/document/compile-checked.js.map +1 -1
  118. package/dist/document/compile.d.ts.map +1 -1
  119. package/dist/document/compile.js +30 -7
  120. package/dist/document/compile.js.map +1 -1
  121. package/dist/document/compiled.d.ts +4 -2
  122. package/dist/document/compiled.d.ts.map +1 -1
  123. package/dist/document/compiled.js +52 -21
  124. package/dist/document/compiled.js.map +1 -1
  125. package/dist/document/describe-coverage.d.ts.map +1 -1
  126. package/dist/document/describe-coverage.js +2 -1
  127. package/dist/document/describe-coverage.js.map +1 -1
  128. package/dist/document/describe-place.d.ts +6 -2
  129. package/dist/document/describe-place.d.ts.map +1 -1
  130. package/dist/document/describe-place.js +14 -8
  131. package/dist/document/describe-place.js.map +1 -1
  132. package/dist/document/diff.d.ts +2 -0
  133. package/dist/document/diff.d.ts.map +1 -1
  134. package/dist/document/diff.js +78 -7
  135. package/dist/document/diff.js.map +1 -1
  136. package/dist/document/durations.d.ts +8 -0
  137. package/dist/document/durations.d.ts.map +1 -0
  138. package/dist/document/durations.js +82 -0
  139. package/dist/document/durations.js.map +1 -0
  140. package/dist/document/edit.d.ts +1 -1
  141. package/dist/document/edit.d.ts.map +1 -1
  142. package/dist/document/edit.js +434 -34
  143. package/dist/document/edit.js.map +1 -1
  144. package/dist/document/expr/evaluate.d.ts +1 -1
  145. package/dist/document/expr/evaluate.d.ts.map +1 -1
  146. package/dist/document/expr/evaluate.js +17 -4
  147. package/dist/document/expr/evaluate.js.map +1 -1
  148. package/dist/document/field-spec.d.ts.map +1 -1
  149. package/dist/document/field-spec.js +15 -1
  150. package/dist/document/field-spec.js.map +1 -1
  151. package/dist/document/format-findings.d.ts +4 -0
  152. package/dist/document/format-findings.d.ts.map +1 -0
  153. package/dist/document/format-findings.js +39 -0
  154. package/dist/document/format-findings.js.map +1 -0
  155. package/dist/document/format-rules.d.ts +8 -0
  156. package/dist/document/format-rules.d.ts.map +1 -0
  157. package/dist/document/format-rules.js +19 -0
  158. package/dist/document/format-rules.js.map +1 -0
  159. package/dist/document/format-words.d.ts +9 -0
  160. package/dist/document/format-words.d.ts.map +1 -0
  161. package/dist/document/format-words.js +29 -0
  162. package/dist/document/format-words.js.map +1 -0
  163. package/dist/document/graview-template.d.ts +2 -2
  164. package/dist/document/migrate.d.ts +1 -0
  165. package/dist/document/migrate.d.ts.map +1 -1
  166. package/dist/document/migrate.js +45 -1
  167. package/dist/document/migrate.js.map +1 -1
  168. package/dist/document/money.d.ts +14 -0
  169. package/dist/document/money.d.ts.map +1 -0
  170. package/dist/document/money.js +14 -0
  171. package/dist/document/money.js.map +1 -0
  172. package/dist/document/policy-words.d.ts +33 -0
  173. package/dist/document/policy-words.d.ts.map +1 -0
  174. package/dist/document/policy-words.js +69 -0
  175. package/dist/document/policy-words.js.map +1 -0
  176. package/dist/document/rule-line.d.ts.map +1 -1
  177. package/dist/document/rule-line.js +16 -12
  178. package/dist/document/rule-line.js.map +1 -1
  179. package/dist/document/rules.d.ts.map +1 -1
  180. package/dist/document/rules.js +6 -5
  181. package/dist/document/rules.js.map +1 -1
  182. package/dist/document/schema.d.ts +62 -19
  183. package/dist/document/schema.d.ts.map +1 -1
  184. package/dist/document/schema.js +30 -4
  185. package/dist/document/schema.js.map +1 -1
  186. package/dist/document/template-parse.d.ts.map +1 -1
  187. package/dist/document/template-parse.js +9 -2
  188. package/dist/document/template-parse.js.map +1 -1
  189. package/dist/document/template.d.ts +3 -13
  190. package/dist/document/template.d.ts.map +1 -1
  191. package/dist/document/template.js +27 -28
  192. package/dist/document/template.js.map +1 -1
  193. package/dist/document/thumbnail.d.ts.map +1 -1
  194. package/dist/document/thumbnail.js +4 -3
  195. package/dist/document/thumbnail.js.map +1 -1
  196. package/dist/document/to-document.d.ts +0 -1
  197. package/dist/document/to-document.d.ts.map +1 -1
  198. package/dist/document/to-document.js +19 -2
  199. package/dist/document/to-document.js.map +1 -1
  200. package/dist/document/view-specs.d.ts.map +1 -1
  201. package/dist/document/view-specs.js +3 -0
  202. package/dist/document/view-specs.js.map +1 -1
  203. package/dist/document/views.d.ts +2 -0
  204. package/dist/document/views.d.ts.map +1 -1
  205. package/dist/document/views.js +18 -6
  206. package/dist/document/views.js.map +1 -1
  207. package/dist/document.schema.json +63 -6
  208. package/dist/excerpt-of.d.ts +14 -0
  209. package/dist/excerpt-of.d.ts.map +1 -0
  210. package/dist/excerpt-of.js +120 -0
  211. package/dist/excerpt-of.js.map +1 -0
  212. package/dist/excerpt.d.ts +9 -0
  213. package/dist/excerpt.d.ts.map +1 -0
  214. package/dist/excerpt.js +43 -0
  215. package/dist/excerpt.js.map +1 -0
  216. package/dist/field-sight.d.ts +33 -0
  217. package/dist/field-sight.d.ts.map +1 -0
  218. package/dist/field-sight.js +313 -0
  219. package/dist/field-sight.js.map +1 -0
  220. package/dist/forms.d.ts +1 -0
  221. package/dist/forms.d.ts.map +1 -1
  222. package/dist/forms.js +1 -0
  223. package/dist/forms.js.map +1 -1
  224. package/dist/graph/archived.d.ts +25 -0
  225. package/dist/graph/archived.d.ts.map +1 -0
  226. package/dist/graph/archived.js +16 -0
  227. package/dist/graph/archived.js.map +1 -0
  228. package/dist/graph/diff.d.ts.map +1 -1
  229. package/dist/graph/diff.js +2 -1
  230. package/dist/graph/diff.js.map +1 -1
  231. package/dist/graph/graph.d.ts +37 -13
  232. package/dist/graph/graph.d.ts.map +1 -1
  233. package/dist/graph/graph.js +86 -40
  234. package/dist/graph/graph.js.map +1 -1
  235. package/dist/graph/tracked.d.ts +8 -8
  236. package/dist/graph/tracked.d.ts.map +1 -1
  237. package/dist/graph/tracked.js +15 -20
  238. package/dist/graph/tracked.js.map +1 -1
  239. package/dist/graph/types.d.ts +16 -8
  240. package/dist/graph/types.d.ts.map +1 -1
  241. package/dist/graph/types.js.map +1 -1
  242. package/dist/import/coerce.d.ts +45 -0
  243. package/dist/import/coerce.d.ts.map +1 -0
  244. package/dist/import/coerce.js +252 -0
  245. package/dist/import/coerce.js.map +1 -0
  246. package/dist/import/csv.d.ts +16 -0
  247. package/dist/import/csv.d.ts.map +1 -0
  248. package/dist/import/csv.js +77 -0
  249. package/dist/import/csv.js.map +1 -0
  250. package/dist/import/index.d.ts +17 -0
  251. package/dist/import/index.d.ts.map +1 -0
  252. package/dist/import/index.js +13 -0
  253. package/dist/import/index.js.map +1 -0
  254. package/dist/import/mapping.d.ts +99 -0
  255. package/dist/import/mapping.d.ts.map +1 -0
  256. package/dist/import/mapping.js +182 -0
  257. package/dist/import/mapping.js.map +1 -0
  258. package/dist/import/rows.d.ts +116 -0
  259. package/dist/import/rows.d.ts.map +1 -0
  260. package/dist/import/rows.js +584 -0
  261. package/dist/import/rows.js.map +1 -0
  262. package/dist/index.d.ts +38 -21
  263. package/dist/index.d.ts.map +1 -1
  264. package/dist/index.js +27 -16
  265. package/dist/index.js.map +1 -1
  266. package/dist/invariants/engine.d.ts +5 -1
  267. package/dist/invariants/engine.d.ts.map +1 -1
  268. package/dist/invariants/engine.js +4 -3
  269. package/dist/invariants/engine.js.map +1 -1
  270. package/dist/invariants/types.d.ts +18 -3
  271. package/dist/invariants/types.d.ts.map +1 -1
  272. package/dist/json-schema.d.ts +1 -0
  273. package/dist/json-schema.d.ts.map +1 -1
  274. package/dist/json-schema.js +2 -0
  275. package/dist/json-schema.js.map +1 -1
  276. package/dist/labels.d.ts.map +1 -1
  277. package/dist/labels.js +2 -1
  278. package/dist/labels.js.map +1 -1
  279. package/dist/lines.d.ts +1 -0
  280. package/dist/lines.d.ts.map +1 -1
  281. package/dist/lines.js +5 -3
  282. package/dist/lines.js.map +1 -1
  283. package/dist/markdown.d.ts +102 -0
  284. package/dist/markdown.d.ts.map +1 -0
  285. package/dist/markdown.js +460 -0
  286. package/dist/markdown.js.map +1 -0
  287. package/dist/mutations/arg-shape.d.ts +95 -0
  288. package/dist/mutations/arg-shape.d.ts.map +1 -0
  289. package/dist/mutations/arg-shape.js +101 -0
  290. package/dist/mutations/arg-shape.js.map +1 -0
  291. package/dist/mutations/define-mutation.d.ts +48 -2
  292. package/dist/mutations/define-mutation.d.ts.map +1 -1
  293. package/dist/mutations/define-mutation.js +103 -36
  294. package/dist/mutations/define-mutation.js.map +1 -1
  295. package/dist/mutations/derive-edits.d.ts +16 -1
  296. package/dist/mutations/derive-edits.d.ts.map +1 -1
  297. package/dist/mutations/derive-edits.js +67 -28
  298. package/dist/mutations/derive-edits.js.map +1 -1
  299. package/dist/mutations/derive-repeats.d.ts +8 -0
  300. package/dist/mutations/derive-repeats.d.ts.map +1 -0
  301. package/dist/mutations/derive-repeats.js +118 -0
  302. package/dist/mutations/derive-repeats.js.map +1 -0
  303. package/dist/mutations/derived-names.d.ts +20 -0
  304. package/dist/mutations/derived-names.d.ts.map +1 -0
  305. package/dist/mutations/derived-names.js +19 -0
  306. package/dist/mutations/derived-names.js.map +1 -0
  307. package/dist/mutations/form.d.ts +21 -1
  308. package/dist/mutations/form.d.ts.map +1 -1
  309. package/dist/mutations/form.js +19 -2
  310. package/dist/mutations/form.js.map +1 -1
  311. package/dist/mutations/invalid-arguments.d.ts +14 -0
  312. package/dist/mutations/invalid-arguments.d.ts.map +1 -0
  313. package/dist/mutations/invalid-arguments.js +18 -0
  314. package/dist/mutations/invalid-arguments.js.map +1 -0
  315. package/dist/mutations/keep-link.d.ts +27 -0
  316. package/dist/mutations/keep-link.d.ts.map +1 -0
  317. package/dist/mutations/keep-link.js +56 -0
  318. package/dist/mutations/keep-link.js.map +1 -0
  319. package/dist/mutations/kept-arguments.d.ts +26 -0
  320. package/dist/mutations/kept-arguments.d.ts.map +1 -0
  321. package/dist/mutations/kept-arguments.js +77 -0
  322. package/dist/mutations/kept-arguments.js.map +1 -0
  323. package/dist/mutations/node-ref.d.ts +0 -80
  324. package/dist/mutations/node-ref.d.ts.map +1 -1
  325. package/dist/mutations/node-ref.js +0 -93
  326. package/dist/mutations/node-ref.js.map +1 -1
  327. package/dist/mutations/types.d.ts +17 -1
  328. package/dist/mutations/types.d.ts.map +1 -1
  329. package/dist/mutations/words.d.ts +0 -13
  330. package/dist/mutations/words.d.ts.map +1 -1
  331. package/dist/mutations/words.js +1 -12
  332. package/dist/mutations/words.js.map +1 -1
  333. package/dist/ops/kept-fields.d.ts +7 -0
  334. package/dist/ops/kept-fields.d.ts.map +1 -0
  335. package/dist/ops/kept-fields.js +24 -0
  336. package/dist/ops/kept-fields.js.map +1 -0
  337. package/dist/ops/lineage.d.ts +37 -0
  338. package/dist/ops/lineage.d.ts.map +1 -0
  339. package/dist/ops/lineage.js +26 -0
  340. package/dist/ops/lineage.js.map +1 -0
  341. package/dist/ops/log.d.ts.map +1 -1
  342. package/dist/ops/log.js +1 -0
  343. package/dist/ops/log.js.map +1 -1
  344. package/dist/ops/provenance.d.ts +68 -0
  345. package/dist/ops/provenance.d.ts.map +1 -0
  346. package/dist/ops/provenance.js +83 -0
  347. package/dist/ops/provenance.js.map +1 -0
  348. package/dist/ops/types.d.ts +25 -0
  349. package/dist/ops/types.d.ts.map +1 -1
  350. package/dist/ops/withheld.d.ts +25 -2
  351. package/dist/ops/withheld.d.ts.map +1 -1
  352. package/dist/ops/withheld.js +6 -15
  353. package/dist/ops/withheld.js.map +1 -1
  354. package/dist/permissions/policy.d.ts +6 -1
  355. package/dist/permissions/policy.d.ts.map +1 -1
  356. package/dist/permissions/policy.js +31 -11
  357. package/dist/permissions/policy.js.map +1 -1
  358. package/dist/permissions/sight.d.ts +40 -2
  359. package/dist/permissions/sight.d.ts.map +1 -1
  360. package/dist/permissions/sight.js +25 -2
  361. package/dist/permissions/sight.js.map +1 -1
  362. package/dist/permissions/types.d.ts +21 -0
  363. package/dist/permissions/types.d.ts.map +1 -1
  364. package/dist/permissions/types.js.map +1 -1
  365. package/dist/places.d.ts +0 -49
  366. package/dist/places.d.ts.map +1 -1
  367. package/dist/places.js +2 -141
  368. package/dist/places.js.map +1 -1
  369. package/dist/provenance.d.ts +14 -0
  370. package/dist/provenance.d.ts.map +1 -0
  371. package/dist/provenance.js +13 -0
  372. package/dist/provenance.js.map +1 -0
  373. package/dist/repeat-words.d.ts +13 -0
  374. package/dist/repeat-words.d.ts.map +1 -0
  375. package/dist/repeat-words.js +56 -0
  376. package/dist/repeat-words.js.map +1 -0
  377. package/dist/repeat.d.ts +59 -0
  378. package/dist/repeat.d.ts.map +1 -0
  379. package/dist/repeat.js +155 -0
  380. package/dist/repeat.js.map +1 -0
  381. package/dist/scaffold/project.d.ts.map +1 -1
  382. package/dist/scaffold/project.js +13 -0
  383. package/dist/scaffold/project.js.map +1 -1
  384. package/dist/scaffold/ui.js +2 -2
  385. package/dist/scene-districts.d.ts +2 -1
  386. package/dist/scene-districts.d.ts.map +1 -1
  387. package/dist/scene-districts.js +2 -1
  388. package/dist/scene-districts.js.map +1 -1
  389. package/dist/scene.d.ts +4 -2
  390. package/dist/scene.d.ts.map +1 -1
  391. package/dist/scene.js +2 -1
  392. package/dist/scene.js.map +1 -1
  393. package/dist/schema/amount-mark.d.ts +13 -0
  394. package/dist/schema/amount-mark.d.ts.map +1 -0
  395. package/dist/schema/amount-mark.js +20 -0
  396. package/dist/schema/amount-mark.js.map +1 -0
  397. package/dist/schema/amount-words.d.ts +12 -0
  398. package/dist/schema/amount-words.d.ts.map +1 -0
  399. package/dist/schema/amount-words.js +31 -0
  400. package/dist/schema/amount-words.js.map +1 -0
  401. package/dist/schema/app-link-field.d.ts +4 -0
  402. package/dist/schema/app-link-field.d.ts.map +1 -0
  403. package/dist/schema/app-link-field.js +19 -0
  404. package/dist/schema/app-link-field.js.map +1 -0
  405. package/dist/schema/app-link.d.ts +41 -0
  406. package/dist/schema/app-link.d.ts.map +1 -0
  407. package/dist/schema/app-link.js +40 -0
  408. package/dist/schema/app-link.js.map +1 -0
  409. package/dist/schema/define-node.d.ts +25 -94
  410. package/dist/schema/define-node.d.ts.map +1 -1
  411. package/dist/schema/define-node.js +3 -247
  412. package/dist/schema/define-node.js.map +1 -1
  413. package/dist/schema/field-words.d.ts +45 -0
  414. package/dist/schema/field-words.d.ts.map +1 -0
  415. package/dist/schema/field-words.js +124 -0
  416. package/dist/schema/field-words.js.map +1 -0
  417. package/dist/schema/json-schema.d.ts +6 -1
  418. package/dist/schema/json-schema.d.ts.map +1 -1
  419. package/dist/schema/json-schema.js +83 -2
  420. package/dist/schema/json-schema.js.map +1 -1
  421. package/dist/schema/markdown-field.d.ts +4 -0
  422. package/dist/schema/markdown-field.d.ts.map +1 -0
  423. package/dist/schema/markdown-field.js +20 -0
  424. package/dist/schema/markdown-field.js.map +1 -0
  425. package/dist/schema/markdown.d.ts +6 -0
  426. package/dist/schema/markdown.d.ts.map +1 -0
  427. package/dist/schema/markdown.js +27 -0
  428. package/dist/schema/markdown.js.map +1 -0
  429. package/dist/schema/reading.d.ts +86 -0
  430. package/dist/schema/reading.d.ts.map +1 -0
  431. package/dist/schema/reading.js +270 -0
  432. package/dist/schema/reading.js.map +1 -0
  433. package/dist/schema/repeat-field.d.ts +5 -0
  434. package/dist/schema/repeat-field.d.ts.map +1 -0
  435. package/dist/schema/repeat-field.js +20 -0
  436. package/dist/schema/repeat-field.js.map +1 -0
  437. package/dist/schema/schema.d.ts.map +1 -1
  438. package/dist/schema/schema.js +5 -1
  439. package/dist/schema/schema.js.map +1 -1
  440. package/dist/schema/to-json-schema.d.ts +14 -0
  441. package/dist/schema/to-json-schema.d.ts.map +1 -0
  442. package/dist/schema/to-json-schema.js +616 -0
  443. package/dist/schema/to-json-schema.js.map +1 -0
  444. package/dist/schema/typed-field-builders.d.ts +8 -0
  445. package/dist/schema/typed-field-builders.d.ts.map +1 -0
  446. package/dist/schema/typed-field-builders.js +30 -0
  447. package/dist/schema/typed-field-builders.js.map +1 -0
  448. package/dist/schema/typed-field-of.d.ts +4 -0
  449. package/dist/schema/typed-field-of.d.ts.map +1 -0
  450. package/dist/schema/typed-field-of.js +14 -0
  451. package/dist/schema/typed-field-of.js.map +1 -0
  452. package/dist/schema/typed-fields.d.ts +11 -0
  453. package/dist/schema/typed-fields.d.ts.map +1 -0
  454. package/dist/schema/typed-fields.js +16 -0
  455. package/dist/schema/typed-fields.js.map +1 -0
  456. package/dist/schema/types.d.ts +14 -0
  457. package/dist/schema/types.d.ts.map +1 -1
  458. package/dist/schema/value-words.d.ts +21 -0
  459. package/dist/schema/value-words.d.ts.map +1 -0
  460. package/dist/schema/value-words.js +32 -0
  461. package/dist/schema/value-words.js.map +1 -0
  462. package/dist/search.d.ts +91 -4
  463. package/dist/search.d.ts.map +1 -1
  464. package/dist/search.js +290 -59
  465. package/dist/search.js.map +1 -1
  466. package/dist/seat.d.ts +19 -0
  467. package/dist/seat.d.ts.map +1 -0
  468. package/dist/seat.js +19 -0
  469. package/dist/seat.js.map +1 -0
  470. package/dist/seen.d.ts +15 -33
  471. package/dist/seen.d.ts.map +1 -1
  472. package/dist/seen.js +44 -135
  473. package/dist/seen.js.map +1 -1
  474. package/dist/store.d.ts +46 -1
  475. package/dist/store.d.ts.map +1 -1
  476. package/dist/store.js +121 -22
  477. package/dist/store.js.map +1 -1
  478. package/dist/theme/types.d.ts +7 -1
  479. package/dist/theme/types.d.ts.map +1 -1
  480. package/dist/theme/types.js.map +1 -1
  481. package/dist/typed.d.ts +12 -3
  482. package/dist/typed.d.ts.map +1 -1
  483. package/dist/typed.js.map +1 -1
  484. package/dist/validate-graph.d.ts.map +1 -1
  485. package/dist/validate-graph.js +3 -10
  486. package/dist/validate-graph.js.map +1 -1
  487. package/dist/version.d.ts +1 -1
  488. package/dist/version.js +1 -1
  489. package/dist/views/types.d.ts +57 -8
  490. package/dist/views/types.d.ts.map +1 -1
  491. package/dist/views/types.js +22 -3
  492. package/dist/views/types.js.map +1 -1
  493. package/dist/village.d.ts +63 -0
  494. package/dist/village.d.ts.map +1 -0
  495. package/dist/village.js +143 -0
  496. package/dist/village.js.map +1 -0
  497. package/dist/watched.d.ts +12 -45
  498. package/dist/watched.d.ts.map +1 -1
  499. package/dist/watched.js +7 -119
  500. package/dist/watched.js.map +1 -1
  501. package/dist/words.d.ts +33 -0
  502. package/dist/words.d.ts.map +1 -0
  503. package/dist/words.js +36 -0
  504. package/dist/words.js.map +1 -0
  505. package/package.json +37 -2
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ /** A field that holds another app's address: `@owner/app`, its id, or its https:// address. */
3
+ export declare function appLinkField(): z.ZodString;
4
+ //# sourceMappingURL=app-link-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-link-field.d.ts","sourceRoot":"","sources":["../../src/schema/app-link-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgBxB,+FAA+F;AAC/F,wBAAgB,YAAY,IAAI,CAAC,CAAC,SAAS,CAE1C"}
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ import { APP_ADDRESS, markAppLink } from "./app-link.js";
3
+ /*
4
+ * A DECLARATION'S LINK TO ANOTHER APP (FR-171), in the classic zod a product
5
+ * writes its kinds in, so it chains like any other field:
6
+ *
7
+ * fields: z.object({
8
+ * name: z.string(),
9
+ * house: appLinkField().optional(),
10
+ * })
11
+ *
12
+ * A document says the same as `{"type": "app-link"}`. The value is another
13
+ * app's address; the host's `resolveApp` says what it is called.
14
+ */
15
+ /** A field that holds another app's address: `@owner/app`, its id, or its https:// address. */
16
+ export function appLinkField() {
17
+ return markAppLink(z.string().max(500).regex(APP_ADDRESS, "another app's address"));
18
+ }
19
+ //# sourceMappingURL=app-link-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-link-field.js","sourceRoot":"","sources":["../../src/schema/app-link-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEzD;;;;;;;;;;;GAWG;AAEH,+FAA+F;AAC/F,MAAM,UAAU,YAAY;IAC1B,OAAO,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC,CAAC;AACtF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import * as z from "./zod.js";
2
+ /** What an app-link field holds: `@owner/app`, an id, or an absolute http(s) address. */
3
+ export declare const APP_ADDRESS: RegExp;
4
+ /** Whether a value is another app's address: `@owner/app`, an app id, or an absolute http(s) address, of at most 500 characters. */
5
+ export declare const isAppAddress: (value: unknown) => value is string;
6
+ /** Marks a schema as holding another app's address. */
7
+ export declare const markAppLink: <T extends object>(schema: T) => T;
8
+ /** Whether a field holds another app's address — under optional, default and nullable. */
9
+ export declare function isAppLinkField(schema: unknown): boolean;
10
+ /** A document's `app-link` field, in zod/mini: at most 500 characters. */
11
+ export declare const appLinkSchema: () => z.ZodMiniType;
12
+ /** Another app, as the host says it to this viewer: its name, its icon, its home's headline, and where it opens. */
13
+ export interface LinkedApp {
14
+ readonly name: string;
15
+ /** A picture the host serves (a path on the host or an http(s) address), or an emoji or a letter or two. */
16
+ readonly icon?: string;
17
+ /** What the app's home says first, in a line. */
18
+ readonly headline?: string;
19
+ /** Where the app opens: a path on the host or an http(s) address. */
20
+ readonly href: string;
21
+ }
22
+ /**
23
+ * THE HOST'S ANSWER for one address and one viewer: the app; `{ denied:
24
+ * true }` when this viewer may not open it (the field says "linked app (no
25
+ * access)" and nothing of it); or null when the host knows no such app (the
26
+ * field draws the address, plainly).
27
+ */
28
+ export type AppResolution = LinkedApp | {
29
+ readonly denied: true;
30
+ } | null;
31
+ /**
32
+ * THE HOST'S WAY TO NAME ANOTHER APP (FR-171): handed to `mount`, `<Embed>`,
33
+ * `GraviewProvider` or the routed face as `resolveApp`. Asked once per
34
+ * address and viewer, and remembered; a throw is taken as null.
35
+ */
36
+ export type ResolveApp = (address: string, viewer: {
37
+ readonly kind: string;
38
+ readonly id?: string | undefined;
39
+ readonly roles?: readonly string[] | undefined;
40
+ }) => Promise<AppResolution>;
41
+ //# sourceMappingURL=app-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-link.d.ts","sourceRoot":"","sources":["../../src/schema/app-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAsB9B,yFAAyF;AACzF,eAAO,MAAM,WAAW,QAAwE,CAAC;AAEjG,oIAAoI;AACpI,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAoF,CAAC;AAS5I,uDAAuD;AACvD,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,MAAM,EAAE,QAAQ,CAAC,KAAG,CAA8F,CAAC;AAEzJ,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAGvD;AAED,0EAA0E;AAC1E,eAAO,MAAM,aAAa,QAAO,CAAC,CAAC,WAA6G,CAAC;AAEjJ,oHAAoH;AACpH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,4GAA4G;IAC5G,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAA;CAAE,GAAG,IAAI,CAAC;AAEzE;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import * as z from "./zod.js";
2
+ import { defOf } from "./zod.js";
3
+ /*
4
+ * A LINK TO ANOTHER APP (FR-171).
5
+ *
6
+ * A relation's `to` names kinds inside one document, so a scenario in one
7
+ * app could not point at a house in another. This is the first step there:
8
+ * a field whose value is ANOTHER APP'S ADDRESS — `@nick/house`, an id the
9
+ * host knows its apps by (`app_kf5eydr9z58jzf`), or the app's absolute
10
+ * `https:` address. The record keeps the address as any other value; what
11
+ * the address is CALLED, and whether this viewer may open it, is the
12
+ * host's to say (`ResolveApp`), and the field draws as that app's name,
13
+ * icon and home headline rather than as the address.
14
+ *
15
+ * A hosted page loads this up front to build a document's fields, so it
16
+ * holds that and no more; what draws one is `@graview/primitives`'s,
17
+ * fetched with the first drawn. A relation whose `to` is another app's
18
+ * kind, an expression that walks it and the history of the far value are
19
+ * left for 0.2.
20
+ */
21
+ /** What an app-link field holds: `@owner/app`, an id, or an absolute http(s) address. */
22
+ export const APP_ADDRESS = /^(?:https?:\/\/[^\s<>"'`\\]+|@?[A-Za-z0-9][\w.~-]*(?:\/[\w.~-]+)*)$/;
23
+ /** Whether a value is another app's address: `@owner/app`, an app id, or an absolute http(s) address, of at most 500 characters. */
24
+ export const isAppAddress = (value) => typeof value === "string" && value.length < 501 && APP_ADDRESS.test(value);
25
+ /*
26
+ * WHICH FIELDS HOLD AN APP'S ADDRESS: a mark on the schema's def, as a file
27
+ * field is marked (`files.ts`), so a clone shares it, a refinement spreads it
28
+ * and a wrapper holds it inside.
29
+ */
30
+ const APP_LINK = Symbol.for("@graview/core:app-link");
31
+ /** Marks a schema as holding another app's address. */
32
+ export const markAppLink = (schema) => (Object.defineProperty(defOf(schema), APP_LINK, { value: 1, enumerable: true }), schema);
33
+ /** Whether a field holds another app's address — under optional, default and nullable. */
34
+ export function isAppLinkField(schema) {
35
+ const def = defOf(schema);
36
+ return !!def && (def[APP_LINK] === 1 || isAppLinkField(def.innerType));
37
+ }
38
+ /** A document's `app-link` field, in zod/mini: at most 500 characters. */
39
+ export const appLinkSchema = () => markAppLink(z.string().check(z.maxLength(500), z.regex(APP_ADDRESS, "another app's address")));
40
+ //# sourceMappingURL=app-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-link.js","sourceRoot":"","sources":["../../src/schema/app-link.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AAEH,yFAAyF;AACzF,MAAM,CAAC,MAAM,WAAW,GAAG,qEAAqE,CAAC;AAEjG,oIAAoI;AACpI,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAE5I;;;;GAIG;AACH,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;AAEtD,uDAAuD;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAmB,MAAS,EAAK,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAE,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEzJ,0FAA0F;AAC1F,MAAM,UAAU,cAAc,CAAC,MAAe;IAC5C,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAwD,CAAC;IACjF,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,aAAa,GAAG,GAAkB,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { z } from "zod";
2
- import { type FileValue } from "./files.js";
2
+ import type { FileValue } from "./files.js";
3
3
  import type { AnyNodeDefinition, EdgeMap, EmptyEdgeMap, NodeDefinition, NodeDefinitionSpec } from "./types.js";
4
4
  /**
5
5
  * The single declaration everything else derives from. Views, agent tool
@@ -19,19 +19,6 @@ export declare function isCurrent(definition: AnyNodeDefinition | undefined, nod
19
19
  id: string;
20
20
  kind: string;
21
21
  } & Record<string, unknown>, today?: string): boolean;
22
- /**
23
- * WHAT TELLS TWO SAME-NAMED THINGS APART, among the nodes a person is
24
- * choosing from. A single and its album are both "Blue Hour", and every
25
- * picker, every ask and the Find strip listed "Blue Hour, Blue Hour": a
26
- * choice nobody could make. For each node whose name another in the list
27
- * shares, the first fact that differs between them — "single" and "album",
28
- * or the dates — else its kind, else its id. Nodes with a name of their
29
- * own get nothing.
30
- */
31
- export declare function tellApart(nodes: readonly ({
32
- id: string;
33
- kind: string;
34
- } & Record<string, unknown>)[], definitionOf: (kind: string) => AnyNodeDefinition | undefined): Map<string, string>;
35
22
  /** Resolves a node's display label, honoring the declaration's override. */
36
23
  export declare function labelOf(definition: AnyNodeDefinition | undefined, node: {
37
24
  id: string;
@@ -50,11 +37,6 @@ export declare function labelOf(definition: AnyNodeDefinition | undefined, node:
50
37
  * is a heading that ignores the limit it was given.
51
38
  */
52
39
  export declare function summarize(text: string, max?: number): string;
53
- /** Resolves a node's prose description, used for a11y and tool text. */
54
- export declare function describeNode(definition: AnyNodeDefinition | undefined, node: {
55
- id: string;
56
- kind: string;
57
- } & Record<string, unknown>): string;
58
40
  /** One field, as a person sees it. */
59
41
  export interface ReadableField {
60
42
  readonly key: string;
@@ -64,6 +46,23 @@ export interface ReadableField {
64
46
  * and its words are their names. A glance leaves them out of its words.
65
47
  */
66
48
  readonly files?: readonly FileValue[];
49
+ /**
50
+ * ANOTHER APP'S ADDRESS (FR-171), where the field links to one: a record
51
+ * draws it as the app the host's `resolveApp` names, never as the
52
+ * address. A glance leaves it out of its words, as it does a file.
53
+ */
54
+ readonly app?: string;
55
+ /**
56
+ * A DATE THAT MAY REPEAT (`repeat.ts`): its value says how and the next
57
+ * one ("Every Tuesday, next Oct 27"), and a record draws, beside it, the
58
+ * control that changes how it repeats (`<field>Repeat`).
59
+ */
60
+ readonly repeats?: true;
61
+ /**
62
+ * WHERE A PHONE OR A PLACE TAKES ITS READER: a `tel:` link, or the
63
+ * reader's maps app. A face draws the value as a link to it.
64
+ */
65
+ readonly href?: string;
67
66
  /** The field name in words, after `display.labels` and humanizing. */
68
67
  readonly label: string;
69
68
  /** The value in words, after `display.format` and the built-in defaults: a day as a person reads it, a choice as it is declared. */
@@ -89,6 +88,13 @@ export interface ReadableField {
89
88
  * edits it in a text area.
90
89
  */
91
90
  readonly long: boolean;
91
+ /**
92
+ * WRITTEN IN MARKDOWN (FR-180): the declaration says so
93
+ * (`markdownField()`, `{"type": "text", "format": "markdown"}`). A
94
+ * record's page draws it as prose; a glance says its start with the
95
+ * syntax taken out.
96
+ */
97
+ readonly markdown?: true;
92
98
  }
93
99
  /** `effectiveFrom` shown to a person is a schema leaking through a surface. */
94
100
  /**
@@ -108,13 +114,6 @@ export declare function humanizeField(field: string): string;
108
114
  * so `plannedAt` never reaches a person from one surface while another says
109
115
  * "Planned at".
110
116
  */
111
- /**
112
- * One of a field's values, as the declaration says it: its `display.format`
113
- * where it has one ("SUV", "Plug-in hybrid"), else the value spoken. A
114
- * filter that offered "suv" and "plug-in-hybrid" beside a record that said
115
- * "SUV" and "Plug-in hybrid" read one field two ways.
116
- */
117
- export declare function valueWords(definition: AnyNodeDefinition | undefined, key: string, value: unknown): string;
118
117
  /**
119
118
  * HOW MANY OF A KIND, in its words: "1 car", "3 cars", "1 test drive" —
120
119
  * the noun for one, the plural for the rest. Sentences that took the kind's
@@ -149,18 +148,6 @@ export declare function pluralLabel(schema: {
149
148
  readonly plural?: string;
150
149
  } | undefined;
151
150
  }, kind: string): string;
152
- /**
153
- * A RELATION IN WORDS, read from the end you are standing on (FR-142): from
154
- * the kind that declares it, its `description`; from the far end, its
155
- * `inverse`. Where the declaration says nothing, the key is spoken —
156
- * "partOf" is "part of", never `partOf` — so a sentence a person reads never
157
- * carries a key, whichever surface wrote it.
158
- */
159
- export declare function edgeWords(schema: {
160
- tryDefinition(kind: string): {
161
- readonly edges?: unknown;
162
- } | undefined;
163
- }, ownerKind: string, edgeKind: string, direction: "out" | "in"): string;
164
151
  export declare function fieldWords(definition: {
165
152
  readonly display?: {
166
153
  readonly labels?: Readonly<Record<string, string>>;
@@ -186,60 +173,4 @@ export declare function withArticle(word: string): string;
186
173
  export declare function nounOf(definition: {
187
174
  readonly noun?: string;
188
175
  } | undefined, kind: string): string;
189
- /**
190
- * WHICH of a node's fields a person sees, and HOW each one reads.
191
- *
192
- * One implementation, because there were two: the record on a page and the
193
- * summary on a card each decided this for themselves, and every rule — hide an
194
- * ordering key, format minutes as a time, render a boolean as a word, drop a
195
- * value the heading already said — had to be written into both and kept in
196
- * step by hand. They diverged the day the second one was written, which is how
197
- * a summary card ended up showing a list's ordering key as a chip reading "0"
198
- * while the page beside it did not.
199
- *
200
- * `said` is what the surrounding view has already put on screen. A value the
201
- * heading already carries is not information twice, it is the same sentence
202
- * twice — and where the heading is a SHORTENED form of a field, an exact
203
- * comparison never catches it, so the summary's stem is compared too.
204
- */
205
- export declare function readableFields(node: Record<string, unknown>, definition: AnyNodeDefinition | undefined, options?: {
206
- /** How many a GLANCE shows. Unset, every field: a record is read whole (W-156). */
207
- readonly limit?: number;
208
- readonly said?: readonly (string | undefined)[];
209
- /**
210
- * A GLANCE drops a value the heading already says as a WORD, not only as
211
- * the whole heading: a vehicle's summary is headed "2027 Subaru Forester
212
- * Sport", and "Year 2027 · Subaru" under it spent two of its three facts
213
- * saying the heading again while the price never appeared. A record's
214
- * full facts keep every field — that is where each is changed.
215
- */
216
- readonly glance?: boolean;
217
- }): readonly ReadableField[];
218
- /**
219
- * WHETHER A FIELD'S VALUE IS PROSE (FR-147): a string field declared to hold
220
- * more than 500 characters — a document's `text`, or `z.string().max(5000)`
221
- * in TypeScript — whatever it holds now, so an empty draft is still edited
222
- * in a text area; or a value with a line break in it, or longer than 160
223
- * characters.
224
- */
225
- export declare function isLongText(definition: AnyNodeDefinition | undefined, key: string, value: unknown): boolean;
226
- /** One run of a record's facts: under a group's title, or (the first) under none. */
227
- export interface FieldSection<F extends {
228
- readonly key: string;
229
- } = ReadableField> {
230
- readonly title?: string;
231
- readonly fields: readonly F[];
232
- }
233
- /**
234
- * A RECORD'S FACTS, IN THE SECTIONS ITS PAGE DECLARES (FR-148).
235
- *
236
- * `fields` are read as `readableFields` ordered them. Unsaid, one untitled
237
- * section of all of them. With `display.page`, its `fields` first, untitled;
238
- * each of its `groups` under its title; and what neither names under
239
- * "Details" when there are groups, else after the first fields. A section
240
- * with nothing to show is left out.
241
- */
242
- export declare function pageSections<F extends {
243
- readonly key: string;
244
- }>(definition: AnyNodeDefinition | undefined, fields: readonly F[]): readonly FieldSection<F>[];
245
176
  //# sourceMappingURL=define-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-node.d.ts","sourceRoot":"","sources":["../../src/schema/define-node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EACV,iBAAiB,EACjB,OAAO,EACP,YAAY,EACZ,cAAc,EACd,kBAAkB,EAEnB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EACpC,KAAK,CAAC,CAAC,SAAS,OAAO,GAAG,YAAY,EACtC,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAMlE;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CACvB,UAAU,EAAE,iBAAiB,GAAG,SAAS,EACzC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EA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,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnI;AAED,wBAAgB,UAAU,CACxB,UAAU,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;KAAE,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,CAAA;CAAE,GAAG,SAAS,EACzL,GAAG,EAAE,MAAM,GACV,MAAM,CAKR;AAmBD,2CAA2C;AAC3C,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI,CAKhD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/F"}
@@ -1,6 +1,5 @@
1
- import { dayAsRead, ISO_DAY, isoToday } from "../days.js";
1
+ import { isoToday, numberAsRead } from "../days.js";
2
2
  import { capitalize } from "../capital.js";
3
- import { filesOf } from "./files.js";
4
3
  /**
5
4
  * The single declaration everything else derives from. Views, agent tool
6
5
  * schemas, drag legality, aggregate contents and accessibility labels all
@@ -35,48 +34,6 @@ export function isCurrent(definition, node, today) {
35
34
  }
36
35
  return !lifecycle.retired.includes(value);
37
36
  }
38
- /**
39
- * WHAT TELLS TWO SAME-NAMED THINGS APART, among the nodes a person is
40
- * choosing from. A single and its album are both "Blue Hour", and every
41
- * picker, every ask and the Find strip listed "Blue Hour, Blue Hour": a
42
- * choice nobody could make. For each node whose name another in the list
43
- * shares, the first fact that differs between them — "single" and "album",
44
- * or the dates — else its kind, else its id. Nodes with a name of their
45
- * own get nothing.
46
- */
47
- export function tellApart(nodes, definitionOf) {
48
- const apart = new Map();
49
- const byName = new Map();
50
- for (const node of nodes) {
51
- const name = labelOf(definitionOf(node.kind), node).trim().toLowerCase();
52
- byName.set(name, [...(byName.get(name) ?? []), node]);
53
- }
54
- for (const same of byName.values()) {
55
- if (same.length < 2)
56
- continue;
57
- const byKind = new Map();
58
- for (const node of same)
59
- byKind.set(node.kind, [...(byKind.get(node.kind) ?? []), node]);
60
- for (const [kind, alike] of byKind) {
61
- // One of its kind among namesakes of other kinds: the kind is what differs.
62
- if (alike.length === 1) {
63
- apart.set(alike[0].id, nounOf(definitionOf(kind), kind));
64
- continue;
65
- }
66
- const facts = alike.map((node) => new Map(readableFields(node, definitionOf(node.kind)).map((field) => [field.key, field.alone])));
67
- const keys = [...new Set(facts.flatMap((fact) => [...fact.keys()]))];
68
- // A word before a number: "single" and "album" say more than two dates.
69
- const wordy = (key) => facts.every((fact) => !/\d/.test(fact.get(key) ?? ""));
70
- const ordered = [...keys.filter(wordy), ...keys.filter((key) => !wordy(key))];
71
- const telling = ordered.find((key) => new Set(facts.map((fact) => fact.get(key) ?? "")).size === alike.length);
72
- alike.forEach((node, at) => {
73
- const fact = telling ? facts[at].get(telling) : undefined;
74
- apart.set(node.id, fact ?? node.id);
75
- });
76
- }
77
- }
78
- return apart;
79
- }
80
37
  /** Resolves a node's display label, honoring the declaration's override. */
81
38
  export function labelOf(definition, node) {
82
39
  if (definition?.label) {
@@ -106,15 +63,6 @@ export function summarize(text, max = 60) {
106
63
  // A trailing comma or full stop before the ellipsis reads as a typo.
107
64
  return `${(boundary > max * 0.5 ? cut.slice(0, boundary) : cut).replace(/[\s,.;:]+$/, "")}…`;
108
65
  }
109
- /** Resolves a node's prose description, used for a11y and tool text. */
110
- export function describeNode(definition, node) {
111
- if (definition?.describe) {
112
- return definition.describe(node);
113
- }
114
- return `${node.kind} ${labelOf(definition, node)}`;
115
- }
116
- /** Never shown: identity and the name, which the heading already is. */
117
- const NOT_A_FIELD = new Set(["id", "kind", "label"]);
118
66
  /** `effectiveFrom` shown to a person is a schema leaking through a surface. */
119
67
  /**
120
68
  * WHAT AN ACT IS CALLED, everywhere it is offered — the actions strip, the
@@ -139,16 +87,6 @@ export function humanizeField(field) {
139
87
  * so `plannedAt` never reaches a person from one surface while another says
140
88
  * "Planned at".
141
89
  */
142
- /**
143
- * One of a field's values, as the declaration says it: its `display.format`
144
- * where it has one ("SUV", "Plug-in hybrid"), else the value spoken. A
145
- * filter that offered "suv" and "plug-in-hybrid" beside a record that said
146
- * "SUV" and "Plug-in hybrid" read one field two ways.
147
- */
148
- export function valueWords(definition, key, value) {
149
- const format = definition?.display?.format?.[key];
150
- return format ? format(value) : typeof value === "string" ? humanizeField(value) : String(value);
151
- }
152
90
  /**
153
91
  * HOW MANY OF A KIND, in its words: "1 car", "3 cars", "1 test drive" —
154
92
  * the noun for one, the plural for the rest. Sentences that took the kind's
@@ -157,7 +95,8 @@ export function valueWords(definition, key, value) {
157
95
  */
158
96
  export function counted(schema, kind, count) {
159
97
  const definition = schema.tryDefinition(kind);
160
- return `${count} ${count === 1 ? nounOf(definition, kind) : pluralOf(schema, kind).toLowerCase()}`;
98
+ // A count is a figure, said in the page's locale like every other (W-198): "7,540 inspections", never "7540".
99
+ return `${numberAsRead(count)} ${count === 1 ? nounOf(definition, kind) : pluralOf(schema, kind).toLowerCase()}`;
161
100
  }
162
101
  /**
163
102
  * WHAT A KIND'S RECORDS ARE CALLED TOGETHER, inside a sentence: its
@@ -177,19 +116,6 @@ export function pluralOf(schema, kind) {
177
116
  export function pluralLabel(schema, kind) {
178
117
  return capitalize(pluralOf(schema, kind));
179
118
  }
180
- /**
181
- * A RELATION IN WORDS, read from the end you are standing on (FR-142): from
182
- * the kind that declares it, its `description`; from the far end, its
183
- * `inverse`. Where the declaration says nothing, the key is spoken —
184
- * "partOf" is "part of", never `partOf` — so a sentence a person reads never
185
- * carries a key, whichever surface wrote it.
186
- */
187
- export function edgeWords(schema, ownerKind, edgeKind, direction) {
188
- const edges = schema.tryDefinition(ownerKind)?.edges;
189
- const declared = edges && Object.hasOwn(edges, edgeKind) ? edges[edgeKind] : undefined;
190
- const said = direction === "out" ? declared?.description : declared?.inverse;
191
- return said ?? humanizeField(edgeKind).toLowerCase();
192
- }
193
119
  export function fieldWords(definition, key) {
194
120
  // A computed field's own label is its words too (FR-83), where the display does not say otherwise.
195
121
  const computed = definition?.computed && Object.hasOwn(definition.computed, key) ? definition.computed[key] : undefined;
@@ -238,174 +164,4 @@ export function withArticle(word) {
238
164
  export function nounOf(definition, kind) {
239
165
  return definition?.noun ?? humanizeField(kind).toLowerCase();
240
166
  }
241
- /** Whether `line` carries `value` as whole words: "2027 Subaru Forester" says "Subaru" and "2027", not "Sub". */
242
- function saysAsWords(line, value) {
243
- if (value.length === 0)
244
- return false;
245
- const escaped = value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
246
- return new RegExp(`(^|[\\s·,(/])${escaped}($|[\\s·,)/])`).test(line);
247
- }
248
- /**
249
- * WHICH of a node's fields a person sees, and HOW each one reads.
250
- *
251
- * One implementation, because there were two: the record on a page and the
252
- * summary on a card each decided this for themselves, and every rule — hide an
253
- * ordering key, format minutes as a time, render a boolean as a word, drop a
254
- * value the heading already said — had to be written into both and kept in
255
- * step by hand. They diverged the day the second one was written, which is how
256
- * a summary card ended up showing a list's ordering key as a chip reading "0"
257
- * while the page beside it did not.
258
- *
259
- * `said` is what the surrounding view has already put on screen. A value the
260
- * heading already carries is not information twice, it is the same sentence
261
- * twice — and where the heading is a SHORTENED form of a field, an exact
262
- * comparison never catches it, so the summary's stem is compared too.
263
- */
264
- export function readableFields(node, definition, options = {}) {
265
- const display = definition?.display;
266
- const skip = new Set([...NOT_A_FIELD, ...(display?.hide ?? [])]);
267
- const said = (options.said ?? []).filter((text) => Boolean(text));
268
- const stems = said
269
- .filter((text) => text.endsWith("…"))
270
- .map((text) => text.replace(/…$/, "").trim())
271
- .filter((stem) => stem.length > 12);
272
- const fields = [];
273
- /*
274
- * IN THE ORDER THE DECLARATION SAYS, NOT THE ORDER THE RECORD WAS WRITTEN
275
- * IN (FR-148). This read `Object.entries(node)`, so a record created with
276
- * three of its fields and given two more later read Status, Summary, Due,
277
- * Draft, Subject line — the order of its writes, which nobody chose.
278
- * A glance says what the declaration chose for it first (`display.glance`);
279
- * a record's page, what its page chose (`display.page`); then the fields
280
- * as the kind declares them, its computed ones after.
281
- */
282
- // Unchosen, a glance leads with who made the record and when, where the kind's roles say (`fieldRoles.who`, `.when`).
283
- const roles = definition?.fieldRoles;
284
- const chosen = options.glance ? (display?.glance ?? [roles?.["who"], roles?.["when"]].filter((key) => !!key)) : pageOrder(display?.page);
285
- const keys = [...new Set([...chosen, ...declaredOrder(definition), ...Object.keys(node)])].filter((key) => Object.hasOwn(node, key));
286
- const entries = keys.map((key) => [key, node[key]]);
287
- for (const [key, value] of entries) {
288
- if (skip.has(key) || value === undefined || value === null)
289
- continue;
290
- const format = display?.format?.[key];
291
- // A picture or a document (FR-162) is drawn, not said on a glance; its words are its names.
292
- const files = format ? [] : filesOf(value);
293
- if (files[0] && options.glance)
294
- continue;
295
- /*
296
- * A NESTED OBJECT HAS NO ONE-LINE RENDERING, and inventing one is worse
297
- * than leaving it to a view that knows what it is.
298
- *
299
- * That was true of an object and was not checked of an ARRAY of them,
300
- * which fell through to `join(", ")` — so a piece of ground with a
301
- * five-corner outline had a field on its record reading "[object
302
- * Object], [object Object], [object Object], [object Object]". Nobody
303
- * wrote that; nobody could have read it. The shape is drawn on the map
304
- * and belongs there, not in a list of words.
305
- *
306
- * A declaration that HAS a one-line rendering says so with `format`,
307
- * and then it is the declaration's sentence rather than this one's
308
- * guess — "5 corners" is a useful thing to say and only the app knows
309
- * that the numbers are corners.
310
- */
311
- const nested = !files[0] &&
312
- typeof value === "object" &&
313
- (!Array.isArray(value) || value.some((one) => typeof one === "object" && one !== null));
314
- if (nested && format === undefined)
315
- continue;
316
- const stored = files[0] ? files.map((file) => (file.caption ? `${file.name} — ${file.caption}` : file.name)).join(", ") : Array.isArray(value) ? value.join(", ") : typeof value === "boolean" ? (value ? "Yes" : "No") : String(value);
317
- const text = format
318
- ? format(value)
319
- : Array.isArray(value) || typeof value === "boolean"
320
- ? // Nobody says "false". A boolean is a state, and the words for a
321
- // state are words.
322
- stored
323
- : /*
324
- * A DAY AS A PERSON READS IT ("28 Aug 2026"), on a glance and in a
325
- * record's facts alike; the edit control holds it as it is written
326
- * (`stored`). And a CHOICE as it is declared — its `display.format`,
327
- * else the value spoken — never the code it is kept as ("tue").
328
- */
329
- typeof value === "string" && ISO_DAY.test(value)
330
- ? dayAsRead(value)
331
- : typeof value === "string" && isChoice(definition, key)
332
- ? valueWords(definition, key, value)
333
- : stored;
334
- if (said.includes(text) || stems.some((stem) => text.startsWith(stem)))
335
- continue;
336
- if (options.glance && (typeof value === "string" || typeof value === "number") && said.some((line) => saysAsWords(line, text)))
337
- continue;
338
- const label = fieldWords(definition, key);
339
- const alone =
340
- // A yes or no the kind words itself ("Not yet inducted") is said whole; "Inducted: not yet inducted" said it twice (W-187).
341
- typeof value === "number" ? `${label} ${text}` : typeof value === "boolean" && !format ? `${label}: ${text.toLowerCase()}` : text;
342
- fields.push({ key, label, value: text, stored, alone, long: typeof value === "string" && isLongText(definition, key, text), ...(files[0] ? { files } : {}) });
343
- if (options.limit !== undefined && fields.length >= options.limit)
344
- break;
345
- }
346
- return fields;
347
- }
348
- /** Whether a field is one of a declared set of values (`z.enum`), under optional, default and nullable. */
349
- function isChoice(definition, key) {
350
- let at = definition?.fields?.shape?.[key];
351
- for (let depth = 0; depth < 6 && at?._zod?.def?.innerType !== undefined; depth++)
352
- at = at._zod.def.innerType;
353
- return at?._zod?.def?.type === "enum";
354
- }
355
- /** The kind's fields as it declares them, then its computed fields. */
356
- function declaredOrder(definition) {
357
- const shape = definition?.fields?.shape;
358
- return [...Object.keys(shape ?? {}), ...Object.keys(definition?.computed ?? {})];
359
- }
360
- /** Every field a page names, in the order it names them: its first fields, then each group's. */
361
- function pageOrder(page) {
362
- return [...(page?.fields ?? []), ...(page?.groups ?? []).flatMap((group) => group.fields)];
363
- }
364
- /** What a string field may hold beyond which it is prose: a document's `string` holds 500, its `text` 20,000. */
365
- const PROSE_ALLOWED = 500;
366
- /** A value this long, or with a line break in it, is read as prose whatever its field allows. */
367
- const PROSE_LENGTH = 160;
368
- /** The string schema under optional, default and nullable. */
369
- function stringSchema(schema) {
370
- let at = schema;
371
- for (let depth = 0; depth < 6 && at?._zod?.def?.innerType !== undefined; depth++)
372
- at = at._zod.def.innerType;
373
- return at?._zod?.def?.type === "string" ? at._zod.def : undefined;
374
- }
375
- /**
376
- * WHETHER A FIELD'S VALUE IS PROSE (FR-147): a string field declared to hold
377
- * more than 500 characters — a document's `text`, or `z.string().max(5000)`
378
- * in TypeScript — whatever it holds now, so an empty draft is still edited
379
- * in a text area; or a value with a line break in it, or longer than 160
380
- * characters.
381
- */
382
- export function isLongText(definition, key, value) {
383
- const field = stringSchema(definition?.fields?.shape?.[key]);
384
- if (field?.checks?.some((check) => check._zod?.def?.check === "max_length" && (check._zod.def.maximum ?? 0) > PROSE_ALLOWED))
385
- return true;
386
- return typeof value === "string" && (value.includes("\n") || value.length > PROSE_LENGTH);
387
- }
388
- /**
389
- * A RECORD'S FACTS, IN THE SECTIONS ITS PAGE DECLARES (FR-148).
390
- *
391
- * `fields` are read as `readableFields` ordered them. Unsaid, one untitled
392
- * section of all of them. With `display.page`, its `fields` first, untitled;
393
- * each of its `groups` under its title; and what neither names under
394
- * "Details" when there are groups, else after the first fields. A section
395
- * with nothing to show is left out.
396
- */
397
- export function pageSections(definition, fields) {
398
- const page = definition?.display?.page;
399
- const groups = page?.groups ?? [];
400
- const byKey = new Map(fields.map((field) => [field.key, field]));
401
- const named = new Set(pageOrder(page));
402
- const pick = (keys) => keys.flatMap((key) => (byKey.has(key) ? [byKey.get(key)] : []));
403
- const rest = fields.filter((field) => !named.has(field.key));
404
- const sections = [
405
- { fields: [...pick(page?.fields ?? []), ...(groups.length > 0 ? [] : rest)] },
406
- ...groups.map((group) => ({ title: group.title, fields: pick(group.fields) })),
407
- ...(groups.length > 0 ? [{ title: "Details", fields: rest }] : []),
408
- ];
409
- return sections.filter((section) => section.fields.length > 0);
410
- }
411
167
  //# sourceMappingURL=define-node.js.map