@agentshouse/mdmodel 0.1.0-cf24f2baa8f2d → 0.1.0-cf39345b743fb

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 (350) hide show
  1. package/API.md +145 -110
  2. package/README.md +25 -25
  3. package/dist/body.d.ts +85 -0
  4. package/dist/body.d.ts.map +1 -0
  5. package/dist/body.js +1083 -0
  6. package/dist/built-in.d.ts +4 -0
  7. package/dist/built-in.d.ts.map +1 -0
  8. package/dist/built-in.js +19 -0
  9. package/dist/definition.d.ts +19 -10
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +161 -115
  12. package/dist/divide.d.ts.map +1 -1
  13. package/dist/divide.js +5 -4
  14. package/dist/document.d.ts +13 -8
  15. package/dist/document.d.ts.map +1 -1
  16. package/dist/document.js +707 -132
  17. package/dist/event.d.ts +1 -2
  18. package/dist/event.d.ts.map +1 -1
  19. package/dist/event.js +2 -3
  20. package/dist/facts.d.ts.map +1 -1
  21. package/dist/facts.js +3 -0
  22. package/dist/fields.d.ts +1 -1
  23. package/dist/fields.d.ts.map +1 -1
  24. package/dist/fields.js +2 -2
  25. package/dist/form.d.ts +4 -0
  26. package/dist/form.d.ts.map +1 -0
  27. package/dist/form.js +153 -0
  28. package/dist/house-model.d.ts +870 -0
  29. package/dist/house-model.d.ts.map +1 -0
  30. package/dist/house-model.js +472 -0
  31. package/dist/house-references/crockford.d.ts +4 -0
  32. package/dist/house-references/crockford.d.ts.map +1 -0
  33. package/dist/house-references/crockford.js +3 -0
  34. package/dist/house-references/patterns.d.ts +9 -0
  35. package/dist/house-references/patterns.d.ts.map +1 -0
  36. package/dist/house-references/patterns.js +13 -0
  37. package/dist/index.d.ts +24 -13
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +16 -8
  40. package/dist/markdown.d.ts +75 -0
  41. package/dist/markdown.d.ts.map +1 -0
  42. package/dist/markdown.js +265 -0
  43. package/dist/media-type.d.ts +72 -0
  44. package/dist/media-type.d.ts.map +1 -0
  45. package/dist/media-type.js +157 -0
  46. package/dist/not-ready.d.ts +2 -0
  47. package/dist/not-ready.d.ts.map +1 -0
  48. package/dist/not-ready.js +5 -0
  49. package/dist/paths.d.ts +15 -1
  50. package/dist/paths.d.ts.map +1 -1
  51. package/dist/paths.js +88 -19
  52. package/dist/project.d.ts.map +1 -1
  53. package/dist/project.js +29 -54
  54. package/dist/query/match.d.ts +1 -1
  55. package/dist/query/match.d.ts.map +1 -1
  56. package/dist/query/rows.d.ts +1 -1
  57. package/dist/query/rows.d.ts.map +1 -1
  58. package/dist/query/rows.js +1 -1
  59. package/dist/references.d.ts +2 -2
  60. package/dist/references.d.ts.map +1 -1
  61. package/dist/references.js +1 -1
  62. package/dist/refuse.d.ts +1 -0
  63. package/dist/refuse.d.ts.map +1 -1
  64. package/dist/refuse.js +1 -0
  65. package/dist/reserved.d.ts +1 -0
  66. package/dist/reserved.d.ts.map +1 -1
  67. package/dist/reserved.js +2 -1
  68. package/dist/room-types.d.ts +7 -0
  69. package/dist/room-types.d.ts.map +1 -0
  70. package/dist/room-types.js +136 -0
  71. package/dist/schema.d.ts +1 -3
  72. package/dist/schema.d.ts.map +1 -1
  73. package/dist/schema.js +9 -73
  74. package/dist/types.d.ts +11 -17
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/validate.d.ts +6 -2
  77. package/dist/validate.d.ts.map +1 -1
  78. package/dist/validate.js +110 -178
  79. package/dist/yaml.d.ts +4 -4
  80. package/dist/yaml.d.ts.map +1 -1
  81. package/dist/yaml.js +1 -1
  82. package/fixtures/README.md +40 -23
  83. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  84. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  85. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  86. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  87. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  88. package/fixtures/cases/absolute-link/library/item.md +1 -1
  89. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  90. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  91. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  92. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  93. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  94. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  95. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  96. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  97. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  98. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  99. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  100. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  101. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  102. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  103. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  104. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  105. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  106. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  107. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  108. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  109. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  110. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  111. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  112. package/fixtures/cases/boolean-field/expected.json +2 -1
  113. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  114. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  115. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  116. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  117. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  118. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  119. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  120. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  121. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  122. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  123. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  124. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  125. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  126. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  127. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  128. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  129. package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
  130. package/fixtures/cases/date-time-format/expected.json +2 -1
  131. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  132. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  133. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  134. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  135. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  136. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  137. package/fixtures/cases/defs-pattern/expected.json +2 -1
  138. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  139. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  140. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  141. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  142. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  143. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  144. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  145. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  146. package/fixtures/cases/email-format/expected.json +2 -1
  147. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  148. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  149. package/fixtures/cases/email-format/schema.yaml +10 -11
  150. package/fixtures/cases/equal-labels/expected.json +5 -0
  151. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  152. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  153. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  154. package/fixtures/cases/field-enum/expected.json +2 -1
  155. package/fixtures/cases/field-enum/library/item.md +2 -2
  156. package/fixtures/cases/field-enum/schema.yaml +3 -4
  157. package/fixtures/cases/integer-field/expected.json +2 -1
  158. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  159. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  160. package/fixtures/cases/integer-field/schema.yaml +10 -11
  161. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  162. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  163. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  164. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  165. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  166. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  167. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  168. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  169. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
  170. package/fixtures/cases/list-item-enum/expected.json +7 -0
  171. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  172. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  173. package/fixtures/cases/list-item-kind/expected.json +7 -0
  174. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  175. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  176. package/fixtures/cases/list-items/expected.json +1 -0
  177. package/fixtures/cases/list-items/library/page.md +26 -0
  178. package/fixtures/cases/list-items/schema.yaml +10 -0
  179. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  180. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  181. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  182. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  183. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  184. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  185. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  186. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  187. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  188. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  189. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  190. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  191. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  192. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  193. package/fixtures/cases/list-reference-path/expected.json +7 -0
  194. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  195. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  196. package/fixtures/cases/list-reference-type/expected.json +7 -0
  197. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  198. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  199. package/fixtures/cases/list-size/expected.json +2 -1
  200. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  201. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  202. package/fixtures/cases/list-size/schema.yaml +10 -11
  203. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  204. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  205. package/fixtures/cases/malformed-list/context.json +1 -0
  206. package/fixtures/cases/malformed-list/expected.json +7 -0
  207. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  208. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  209. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  210. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  211. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  212. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  213. package/fixtures/cases/misspelled-key/expected.json +2 -1
  214. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  215. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  216. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  217. package/fixtures/cases/name-not-a-string/context.json +1 -0
  218. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  219. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  220. package/fixtures/cases/nested-defs/expected.json +2 -1
  221. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  222. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  223. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  224. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  225. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  226. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  227. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  228. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  229. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  230. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  231. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  232. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  233. package/fixtures/cases/nested-required-field/expected.json +2 -1
  234. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  235. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  236. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  237. package/fixtures/cases/numeric-range/expected.json +2 -1
  238. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  239. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  240. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  241. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  242. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  243. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  244. package/fixtures/cases/one-key-two-types/context.json +1 -0
  245. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  246. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  247. package/fixtures/cases/one-of-variant/expected.json +2 -1
  248. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  249. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  250. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  251. package/fixtures/cases/other-room-reference/expected.json +2 -1
  252. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  253. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  254. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  255. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  256. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  257. package/fixtures/cases/prototype-field/expected.json +2 -1
  258. package/fixtures/cases/prototype-field/library/item.md +2 -2
  259. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  260. package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
  261. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
  262. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  263. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  264. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  265. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  266. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  267. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  268. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  269. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  270. package/fixtures/cases/string-length/expected.json +2 -1
  271. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  272. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  273. package/fixtures/cases/string-length/schema.yaml +10 -11
  274. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  275. package/fixtures/cases/text-field-kind/expected.json +1 -4
  276. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  277. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  278. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  279. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  280. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  281. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
  282. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  283. package/fixtures/cases/undeclared-field/expected.json +2 -1
  284. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  285. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  286. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  287. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  288. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
  289. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
  290. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
  291. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
  292. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  293. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  294. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  295. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  296. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  297. package/fixtures/division.json +85 -39
  298. package/fixtures/forms.json +347 -0
  299. package/fixtures/preamble.json +26 -5
  300. package/fixtures/projection.json +120 -16
  301. package/package.json +10 -1
  302. package/dist/blocks.d.ts +0 -11
  303. package/dist/blocks.d.ts.map +0 -1
  304. package/dist/blocks.js +0 -87
  305. package/dist/links.d.ts +0 -29
  306. package/dist/links.d.ts.map +0 -1
  307. package/dist/links.js +0 -821
  308. package/dist/sections.d.ts +0 -11
  309. package/dist/sections.d.ts.map +0 -1
  310. package/dist/sections.js +0 -57
  311. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  312. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  313. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  314. package/fixtures/cases/null-refused/expected.json +0 -6
  315. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  316. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  317. package/fixtures/cases/null-refused/schema.yaml +0 -56
  318. package/fixtures/cases/open-map-value/expected.json +0 -6
  319. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  320. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  321. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  322. package/fixtures/cases/section-item-enum/expected.json +0 -6
  323. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  324. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  325. package/fixtures/cases/section-item-kind/expected.json +0 -6
  326. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  327. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  328. package/fixtures/cases/section-items/library/page.md +0 -42
  329. package/fixtures/cases/section-items/schema.yaml +0 -10
  330. package/fixtures/cases/section-reference-path/expected.json +0 -6
  331. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  332. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  333. package/fixtures/cases/section-reference-type/expected.json +0 -6
  334. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  335. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  336. package/fixtures/cases/structured-section/expected.json +0 -6
  337. /package/fixtures/cases/{conditional-section → conditional-long-text}/context.json +0 -0
  338. /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
  339. /package/fixtures/cases/{null-refused → labels-in-the-rooms-language}/context.json +0 -0
  340. /package/fixtures/cases/{section-items → labels-in-the-rooms-language}/expected.json +0 -0
  341. /package/fixtures/cases/{open-map-value → lazy-list-item}/context.json +0 -0
  342. /package/fixtures/cases/{section-item-enum → list-item-enum}/context.json +0 -0
  343. /package/fixtures/cases/{section-item-kind → list-item-kind}/context.json +0 -0
  344. /package/fixtures/cases/{section-items → list-items}/context.json +0 -0
  345. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  346. /package/fixtures/cases/{section-reference-path → list-reference-path}/context.json +0 -0
  347. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  348. /package/fixtures/cases/{section-reference-type → list-reference-type}/context.json +0 -0
  349. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
  350. /package/fixtures/cases/{structured-section → long-value-past-six-levels}/context.json +0 -0
@@ -0,0 +1,4 @@
1
+ import type { VerifiedModel } from './types.js';
2
+ export declare const HOUSE_MODEL: VerifiedModel;
3
+ export declare const HOUSE_ROOM_TYPES: VerifiedModel;
4
+ //# sourceMappingURL=built-in.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"built-in.d.ts","sourceRoot":"","sources":["../src/built-in.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAiBhD,eAAO,MAAM,WAAW,eAA8C,CAAC;AAEvE,eAAO,MAAM,gBAAgB,EAAE,aAG7B,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { HOUSE_MODEL_DECLARATION } from './house-model.js';
2
+ import { INBOX_TYPES, ROOM_TYPES_TEXT } from './room-types.js';
3
+ import { verify } from './validate.js';
4
+ function modelText(model) {
5
+ return `${Object.entries(model)
6
+ .map(([name, declared]) => `${name}: ${JSON.stringify(declared)}`)
7
+ .join('\n')}\n`;
8
+ }
9
+ function builtIn(text, provided) {
10
+ const checked = verify(text, provided);
11
+ if (checked.verdict === 'accept')
12
+ return checked.model;
13
+ throw new Error(`House's built-in types refuse: ${checked.rule} ${checked.location ?? ''}`.trim());
14
+ }
15
+ export const HOUSE_MODEL = builtIn(modelText(HOUSE_MODEL_DECLARATION));
16
+ export const HOUSE_ROOM_TYPES = Object.freeze({
17
+ ...builtIn(ROOM_TYPES_TEXT, HOUSE_MODEL),
18
+ nameable: INBOX_TYPES,
19
+ });
@@ -8,6 +8,9 @@ export type ValueFacts = {
8
8
  readonly crossRoom?: true;
9
9
  readonly prose: boolean;
10
10
  readonly conditional?: true;
11
+ readonly title?: string;
12
+ readonly markdown?: true;
13
+ readonly json?: true;
11
14
  readonly prefix?: readonly ValueFacts[];
12
15
  readonly items?: ValueFacts;
13
16
  readonly properties?: Readonly<Record<string, ValueFacts>>;
@@ -18,14 +21,6 @@ export type PatternFacts = {
18
21
  readonly pattern: string;
19
22
  readonly facts: ValueFacts;
20
23
  };
21
- export type SectionSpec = {
22
- readonly kind: 'text';
23
- readonly required: boolean;
24
- } | {
25
- readonly kind: 'list';
26
- readonly required: boolean;
27
- readonly items: ValueFacts;
28
- };
29
24
  export type Shape = {
30
25
  readonly schema: Readonly<Record<string, unknown>>;
31
26
  readonly defs: Readonly<Record<string, unknown>>;
@@ -44,9 +39,8 @@ export type FieldRules = {
44
39
  export type Definition = {
45
40
  readonly name: string;
46
41
  readonly memberDocument: boolean;
47
- readonly frontmatter: ValueFacts;
42
+ readonly root: ValueFacts;
48
43
  readonly fields: Readonly<Record<string, ValueFacts>>;
49
- readonly sections: Readonly<Record<string, SectionSpec>>;
50
44
  readonly rules: Readonly<Record<string, FieldRules>>;
51
45
  readonly createRoles?: readonly string[];
52
46
  readonly deleteRoles?: readonly string[];
@@ -56,17 +50,31 @@ export type Failure = {
56
50
  readonly rule: string;
57
51
  readonly location?: string;
58
52
  };
53
+ export type Placed = {
54
+ readonly node: Record<string, unknown>;
55
+ readonly at: string;
56
+ };
59
57
  export declare const JSON_TYPES: readonly JsonType[];
60
58
  export declare const BUILT_IN_TYPE = "any";
61
59
  export declare const ATTACHMENT = "attachment";
60
+ export declare const OPENING: readonly string[];
62
61
  export declare const ARRAY_INDEX: RegExp;
63
62
  export declare const JSON_POINTER: RegExp;
63
+ export declare function refuse(rule: string, location: string): Failure;
64
64
  export declare function escapePointer(key: string): string;
65
65
  export declare function pointerSegments(pointer: string): string[];
66
66
  export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
67
67
  readonly name: string;
68
68
  readonly node: unknown;
69
69
  } | undefined;
70
+ export declare function conjoined(declared: readonly {
71
+ readonly node: unknown;
72
+ readonly at: string;
73
+ }[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): {
74
+ readonly held: readonly Placed[];
75
+ readonly ancestry: ReadonlySet<unknown>;
76
+ };
77
+ export declare function variantsOf({ node, at }: Placed): Placed[];
70
78
  export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
71
79
  export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
72
80
  export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
@@ -78,5 +86,6 @@ export type PointerFacts = {
78
86
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
87
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
88
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
89
+ export declare function untitled(definition: Definition): Definition;
81
90
  export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
82
91
  //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAA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,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,EAAE,CAK5D;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAItF;AAqBD,wBAAgB,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAc9F;AAmED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAY3D;AAgND,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,aAAwB,EAClC,OAAO,UAAO,GACb,aAAa,GAAG,OAAO,CA0CzB"}
@@ -1,4 +1,5 @@
1
- import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
1
+ import { MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
2
+ import { MEDIA_TYPES } from './media-type.js';
2
3
  import { linearPattern } from './pattern.js';
3
4
  import { equalValue, isRecord, jsValue, parseYamlMapping, YamlError } from './yaml.js';
4
5
  export const JSON_TYPES = [
@@ -12,7 +13,6 @@ export const JSON_TYPES = [
12
13
  ];
13
14
  export const BUILT_IN_TYPE = 'any';
14
15
  export const ATTACHMENT = 'attachment';
15
- const SCALAR_TYPES = new Set(['string', 'number', 'integer', 'boolean']);
16
16
  const COMPOSITES = ['array', 'object'];
17
17
  const ANNOTATIONS = new Set([
18
18
  '$comment',
@@ -24,20 +24,22 @@ const ANNOTATIONS = new Set([
24
24
  'readOnly',
25
25
  'writeOnly',
26
26
  ]);
27
+ export const OPENING = ['additionalProperties', 'unevaluatedProperties'];
27
28
  const FIELD_RULES = ['change_roles', 'initial_roles', 'transitions'];
28
29
  const PROVIDED_KEYWORDS = ['create_roles', 'delete_roles'];
29
30
  const NO_TYPES = Object.freeze({ types: Object.freeze({}) });
30
31
  const DEFS_REFERENCE = '#/$defs/';
31
32
  const UNBOUNDED_FORMAT = 'url';
33
+ const UNIONS = ['anyOf', 'oneOf'];
32
34
  const UNRESOLVED = /[\u0000-\u001f\u007f%[\]\\^{|}]|\s$/u;
33
35
  export const ARRAY_INDEX = /^(?:0|[1-9][0-9]*)$/u;
34
36
  export const JSON_POINTER = /^(?:\/(?:[^~/]|~[01])*)*$/u;
35
37
  const HOUSE_KEYS = {
36
38
  [TYPE_FIELD]: { prose: false },
37
39
  [SITE_FIELD]: { prose: false },
38
- [RECEIVED_FIELD]: { prose: false },
40
+ [SUBMITTED_FIELD]: { prose: false },
39
41
  };
40
- function refuse(rule, location) {
42
+ export function refuse(rule, location) {
41
43
  return { rule, location };
42
44
  }
43
45
  export function escapePointer(key) {
@@ -247,36 +249,41 @@ function firstOf(held, read) {
247
249
  }
248
250
  return undefined;
249
251
  }
250
- function conjoined(nodes, defs, ancestry) {
252
+ export function conjoined(declared, defs, ancestry) {
251
253
  const held = [];
252
254
  const reached = new Set(ancestry);
253
- const visit = (node) => {
254
- if (!isRecord(node) || held.includes(node))
255
+ const visit = (node, at) => {
256
+ if (!isRecord(node) || held.some((one) => one.node === node))
255
257
  return;
256
- held.push(node);
258
+ held.push({ node, at });
257
259
  if (typeof node.$ref === 'string') {
258
260
  const target = refTarget(node.$ref, defs)?.node;
259
261
  if (target !== undefined && !reached.has(target)) {
260
262
  reached.add(target);
261
- visit(target);
263
+ visit(target, node.$ref.slice('#'.length));
262
264
  }
263
265
  }
264
266
  if (Array.isArray(node.allOf))
265
- for (const one of node.allOf)
266
- visit(one);
267
+ node.allOf.forEach((one, index) => visit(one, `${at}/allOf/${index}`));
267
268
  };
268
- for (const node of nodes)
269
- visit(node);
269
+ for (const { node, at } of declared)
270
+ visit(node, at);
270
271
  return { held, ancestry: reached };
271
272
  }
272
- function variantsOf(node) {
273
+ export function variantsOf({ node, at }) {
274
+ const listed = (keyword) => {
275
+ const branches = node[keyword];
276
+ return Array.isArray(branches)
277
+ ? branches.map((branch, index) => ({ node: branch, at: `${at}/${keyword}/${index}` }))
278
+ : [];
279
+ };
273
280
  return [
274
- ...(Array.isArray(node.anyOf) ? node.anyOf : []),
275
- ...(Array.isArray(node.oneOf) ? node.oneOf : []),
276
- node.then,
277
- node.else,
278
- ...(isRecord(node.dependentSchemas) ? Object.values(node.dependentSchemas) : []),
279
- ].filter(isRecord);
281
+ ...listed('anyOf'),
282
+ ...listed('oneOf'),
283
+ { node: node.then, at: `${at}/then` },
284
+ { node: node.else, at: `${at}/else` },
285
+ ...Object.entries(isRecord(node.dependentSchemas) ? node.dependentSchemas : {}).map(([key, branch]) => ({ node: branch, at: `${at}/dependentSchemas/${escapePointer(key)}` })),
286
+ ].filter((one) => isRecord(one.node));
280
287
  }
281
288
  function united(left, right) {
282
289
  if (left === undefined || right === undefined)
@@ -307,6 +314,7 @@ function joined(left, right) {
307
314
  return shared === undefined ? [] : [{ pattern, facts: shared }];
308
315
  });
309
316
  const additional = both(left.additional, right.additional);
317
+ const title = left.title ?? right.title;
310
318
  return {
311
319
  ...(type === undefined ? {} : { type }),
312
320
  ...(format === undefined ? {} : { format }),
@@ -314,6 +322,9 @@ function joined(left, right) {
314
322
  ...(reference === undefined ? {} : { reference }),
315
323
  ...(reference !== undefined && crossRoom ? { crossRoom: true } : {}),
316
324
  prose: left.prose && right.prose,
325
+ ...(title === undefined ? {} : { title }),
326
+ ...(left.markdown === true || right.markdown === true ? { markdown: true } : {}),
327
+ ...(left.json === true || right.json === true ? { json: true } : {}),
317
328
  ...(prefix === undefined ? {} : { prefix }),
318
329
  ...(items === undefined ? {} : { items }),
319
330
  ...(Object.keys(properties).length === 0 ? {} : { properties }),
@@ -368,12 +379,78 @@ function inheritedOf(held) {
368
379
  return Object.keys(kept).length === 0 ? [] : [kept];
369
380
  });
370
381
  }
382
+ function typeSet(type) {
383
+ const listed = typeof type === 'string' ? [type] : Array.isArray(type) ? type : null;
384
+ return listed === null
385
+ ? null
386
+ : new Set(listed.map((one) => (one === 'integer' ? 'number' : String(one))));
387
+ }
388
+ function valueType(value) {
389
+ if (value === null)
390
+ return 'null';
391
+ if (Array.isArray(value))
392
+ return 'array';
393
+ return typeof value;
394
+ }
395
+ function narrowed(left, right) {
396
+ if (left === null)
397
+ return right;
398
+ if (right === null)
399
+ return left;
400
+ return new Set([...left].filter((one) => right.has(one)));
401
+ }
402
+ function admitted(nodes, defs, ancestry) {
403
+ const conjunction = conjoined(nodes.map((node) => ({ node, at: '' })), defs, ancestry);
404
+ let kept = null;
405
+ for (const { node } of conjunction.held) {
406
+ kept = narrowed(kept, typeSet(node.type));
407
+ if (Array.isArray(node.enum))
408
+ kept = narrowed(kept, new Set(node.enum.map(valueType)));
409
+ if (Object.hasOwn(node, 'const'))
410
+ kept = narrowed(kept, new Set([valueType(node.const)]));
411
+ for (const keyword of UNIONS) {
412
+ const branches = node[keyword];
413
+ if (!Array.isArray(branches))
414
+ continue;
415
+ let union = new Set();
416
+ for (const branch of branches) {
417
+ const one = admitted([branch], defs, conjunction.ancestry);
418
+ if (one === null) {
419
+ union = null;
420
+ break;
421
+ }
422
+ for (const type of one)
423
+ union.add(type);
424
+ }
425
+ kept = narrowed(kept, union);
426
+ }
427
+ }
428
+ return kept;
429
+ }
430
+ function structuredUnion(held, defs, ancestry) {
431
+ return held.some((node) => UNIONS.some((keyword) => Array.isArray(node[keyword]) &&
432
+ node[keyword].some((branch) => {
433
+ const types = admitted([branch], defs, ancestry);
434
+ return types === null || types.has('object') || types.has('array');
435
+ })));
436
+ }
437
+ function openWhole(held) {
438
+ return held.some((node) => OPENING.some((keyword) => node[keyword] === true));
439
+ }
440
+ function writtenAsJson(held, defs, ancestry) {
441
+ const types = admitted(held, defs, ancestry);
442
+ if (types === null || types.size !== 1)
443
+ return true;
444
+ return structuredUnion(held, defs, ancestry) || (types.has('object') && openWhole(held));
445
+ }
371
446
  function factsOf(nodes, defs, ancestry) {
372
- const { held, ancestry: reached } = conjoined(nodes, defs, ancestry);
447
+ const conjunction = conjoined(nodes.map((node) => ({ node, at: '' })), defs, ancestry);
448
+ const reached = conjunction.ancestry;
449
+ const held = conjunction.held.map(({ node }) => node);
373
450
  const inherited = inheritedOf(held);
374
- const variants = new Map(held
451
+ const variants = new Map(conjunction.held
375
452
  .flatMap(variantsOf)
376
- .map((branch) => [branch, factsOf([branch, ...inherited], defs, reached)]));
453
+ .map(({ node: branch }) => [branch, factsOf([branch, ...inherited], defs, reached)]));
377
454
  const unions = alternativesOf(held, variants);
378
455
  const alternatives = unions.map((kept) => kept.reduce(joined));
379
456
  const listed = [
@@ -418,9 +495,11 @@ function factsOf(nodes, defs, ancestry) {
418
495
  ? held.flatMap((node) => Object.entries(isRecord(node.patternProperties) ? node.patternProperties : {}).map(([pattern, schema]) => ({ pattern, facts: factsOf([schema], defs, reached) })))
419
496
  : [];
420
497
  const opened = mapped
421
- ? held.flatMap((node) => [node.additionalProperties, node.unevaluatedProperties].filter(isRecord))
498
+ ? held.flatMap((node) => OPENING.map((keyword) => (node[keyword] === true ? {} : node[keyword])).filter(isRecord))
422
499
  : [];
423
500
  const additional = opened.length === 0 ? undefined : factsOf(opened, defs, reached);
501
+ const title = firstOf(nodes.filter(isRecord), (node) => typeof node.title === 'string' ? node.title : undefined);
502
+ const markdown = held.some((node) => node.contentMediaType === MEDIA_TYPES.markdown);
424
503
  return {
425
504
  ...(type === undefined ? {} : { type }),
426
505
  ...(format === undefined ? {} : { format }),
@@ -428,6 +507,9 @@ function factsOf(nodes, defs, ancestry) {
428
507
  ...(reference === undefined ? {} : { reference }),
429
508
  ...(reference !== undefined && crossRoom ? { crossRoom: true } : {}),
430
509
  prose,
510
+ ...(title === undefined ? {} : { title }),
511
+ ...(markdown ? { markdown: true } : {}),
512
+ ...(writtenAsJson(held, defs, ancestry) ? { json: true } : {}),
431
513
  ...(prefix === undefined ? {} : { prefix }),
432
514
  ...(items === undefined ? {} : { items }),
433
515
  ...(properties === undefined ? {} : { properties }),
@@ -457,7 +539,7 @@ export function fieldFacts(definition, key) {
457
539
  return definition.fields[key];
458
540
  if (Object.hasOwn(HOUSE_KEYS, key))
459
541
  return undefined;
460
- return memberFacts(definition.frontmatter, key);
542
+ return memberFacts(definition.root, key);
461
543
  }
462
544
  function stepped({ facts, through, conditional }, token) {
463
545
  if (facts.type === 'array' && ARRAY_INDEX.test(token)) {
@@ -515,87 +597,60 @@ function reachedDefs(value, defs, reached) {
515
597
  reachedDefs(held, defs, reached);
516
598
  }
517
599
  }
518
- function readSections(value, at, context) {
519
- const failed = (rule, location) => ({ failure: refuse(rule, location) });
520
- if (!isRecord(value))
521
- return failed('sections', at);
522
- const sections = Object.create(null);
523
- for (const [name, spec] of Object.entries(value)) {
524
- const where = `${at}/${escapePointer(name)}`;
525
- if (!isRecord(spec) || (spec.kind !== 'text' && spec.kind !== 'list'))
526
- return failed('sections', where);
527
- const allowed = spec.kind === 'list' ? ['kind', 'required', 'items'] : ['kind', 'required'];
528
- const extra = Object.keys(spec).find((key) => !allowed.includes(key));
529
- if (extra !== undefined)
530
- return failed('sections', `${where}/${escapePointer(extra)}`);
531
- if (spec.required !== undefined && typeof spec.required !== 'boolean')
532
- return failed('sections', `${where}/required`);
533
- const required = spec.required === true;
534
- if (spec.kind === 'text') {
535
- sections[name] = { kind: 'text', required };
600
+ function untitledSchema(node) {
601
+ if (!isRecord(node))
602
+ return node;
603
+ const kept = {};
604
+ for (const [key, held] of Object.entries(node)) {
605
+ if (key === 'title' && typeof held === 'string')
536
606
  continue;
537
- }
538
- if (spec.items === undefined)
539
- return failed('sections', `${where}/items`);
540
- const failure = schemaFailure(spec.items, `${where}/items`, context);
541
- if (failure !== undefined)
542
- return { failure };
543
- const items = valueFacts(spec.items, context.defs);
544
- if (items.type === undefined || !SCALAR_TYPES.has(items.type))
545
- return failed('sections', `${where}/items`);
546
- sections[name] = { kind: 'list', required, items };
547
- }
548
- return { sections };
549
- }
550
- function branchSectionsFailure(sections, declared, where) {
551
- if (!isRecord(sections))
552
- return refuse('sections', where);
553
- for (const [name, spec] of Object.entries(sections)) {
554
- const place = `${where}/${escapePointer(name)}`;
555
- const own = isRecord(declared) && Object.hasOwn(declared, name) ? declared[name] : undefined;
556
- if (!isRecord(spec) || !isRecord(own))
557
- return refuse('sections', place);
558
- const { required, ...kind } = spec;
559
- const { required: _required, ...ownKind } = own;
560
- if (required !== undefined && typeof required !== 'boolean')
561
- return refuse('sections', `${place}/required`);
562
- if (!equalValue(kind, ownKind))
563
- return refuse('sections', place);
607
+ const check = Object.hasOwn(KEYWORDS, key) ? KEYWORDS[key] : undefined;
608
+ if (check === SCHEMA)
609
+ kept[key] = untitledSchema(held);
610
+ else if (check === SCHEMA_LIST && Array.isArray(held))
611
+ kept[key] = held.map(untitledSchema);
612
+ else if (check === SCHEMA_MAP && isRecord(held))
613
+ kept[key] = untitledMap(held);
614
+ else
615
+ kept[key] = held;
564
616
  }
565
- return undefined;
617
+ return kept;
566
618
  }
567
- function withoutBranchSections(schema, declared, at) {
568
- const kept = { ...schema };
569
- if (Array.isArray(schema.allOf)) {
570
- const entries = [];
571
- for (const [index, entry] of schema.allOf.entries()) {
572
- const read = isRecord(entry)
573
- ? withoutBranchSections(entry, declared, `${at}/allOf/${index}`)
574
- : { schema: entry };
575
- if ('failure' in read)
576
- return read;
577
- entries.push(read.schema);
578
- }
579
- kept.allOf = entries;
580
- }
581
- if (schema.if === undefined)
582
- return { schema: kept };
583
- for (const branch of ['then', 'else']) {
584
- const held = schema[branch];
585
- if (!isRecord(held))
586
- continue;
587
- const { sections, ...rest } = held;
588
- const failure = sections === undefined
589
- ? undefined
590
- : branchSectionsFailure(sections, declared, `${at}/${branch}/sections`);
591
- if (failure !== undefined)
592
- return { failure };
593
- const read = withoutBranchSections(rest, declared, `${at}/${branch}`);
594
- if ('failure' in read)
595
- return read;
596
- kept[branch] = read.schema;
597
- }
598
- return { schema: kept };
619
+ function untitledMap(map) {
620
+ return Object.fromEntries(Object.entries(map).map(([key, held]) => [key, untitledSchema(held)]));
621
+ }
622
+ function untitledFacts(facts) {
623
+ const { title: _title, prefix, items, properties, patterns, additional, ...kept } = facts;
624
+ return {
625
+ ...kept,
626
+ ...(prefix === undefined ? {} : { prefix: prefix.map(untitledFacts) }),
627
+ ...(items === undefined ? {} : { items: untitledFacts(items) }),
628
+ ...(properties === undefined
629
+ ? {}
630
+ : {
631
+ properties: Object.fromEntries(Object.entries(properties).map(([key, held]) => [key, untitledFacts(held)])),
632
+ }),
633
+ ...(patterns === undefined
634
+ ? {}
635
+ : {
636
+ patterns: patterns.map(({ pattern, facts: held }) => ({
637
+ pattern,
638
+ facts: untitledFacts(held),
639
+ })),
640
+ }),
641
+ ...(additional === undefined ? {} : { additional: untitledFacts(additional) }),
642
+ };
643
+ }
644
+ export function untitled(definition) {
645
+ return {
646
+ ...definition,
647
+ root: untitledFacts(definition.root),
648
+ fields: Object.fromEntries(Object.entries(definition.fields).map(([key, held]) => [key, untitledFacts(held)])),
649
+ shape: {
650
+ schema: untitledSchema(definition.shape.schema),
651
+ defs: untitledMap(definition.shape.defs),
652
+ },
653
+ };
599
654
  }
600
655
  function deepFreeze(value) {
601
656
  if (value !== null && typeof value === 'object' && !Object.isFrozen(value)) {
@@ -729,22 +784,14 @@ function readType(name, value, context) {
729
784
  const at = `/${escapePointer(name)}`;
730
785
  if (!isRecord(value))
731
786
  return refuse('schema', at);
732
- const { sections: declared, member_document: mark, create_roles: createRoles, delete_roles: deleteRoles, ...ruled } = value;
787
+ const { member_document: mark, create_roles: createRoles, delete_roles: deleteRoles, ...ruled } = value;
733
788
  if (mark !== undefined && typeof mark !== 'boolean')
734
789
  return refuse('member_document', `${at}/member_document`);
735
790
  if (createRoles !== undefined && !roleNames(createRoles))
736
791
  return refuse('create_roles', `${at}/create_roles`);
737
792
  if (deleteRoles !== undefined && !roleNames(deleteRoles))
738
793
  return refuse('delete_roles', `${at}/delete_roles`);
739
- const read = declared === undefined
740
- ? { sections: Object.create(null) }
741
- : readSections(declared, `${at}/sections`, context);
742
- if ('failure' in read)
743
- return read.failure;
744
- const unbranched = withoutBranchSections(ruled, declared, at);
745
- if ('failure' in unbranched)
746
- return unbranched.failure;
747
- const { schema, written } = unruled(unbranched.schema);
794
+ const { schema, written } = unruled(ruled);
748
795
  const failure = schemaFailure(schema, at, context);
749
796
  if (failure !== undefined)
750
797
  return failure;
@@ -768,9 +815,8 @@ function readType(name, value, context) {
768
815
  return {
769
816
  name,
770
817
  memberDocument,
771
- frontmatter: { ...root, properties: { ...HOUSE_KEYS, ...fields } },
818
+ root: { ...root, properties: { ...HOUSE_KEYS, ...fields } },
772
819
  fields,
773
- sections: read.sections,
774
820
  rules,
775
821
  ...(createRoles === undefined ? {} : { createRoles }),
776
822
  ...(deleteRoles === undefined ? {} : { deleteRoles }),
@@ -1 +1 @@
1
- {"version":3,"file":"divide.d.ts","sourceRoot":"","sources":["../src/divide.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AAwXpF,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,QAAQ,CAc3F"}
1
+ {"version":3,"file":"divide.d.ts","sourceRoot":"","sources":["../src/divide.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC;AAwXpF,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,QAAQ,CAe3F"}
package/dist/divide.js CHANGED
@@ -1,4 +1,5 @@
1
- import { blockRanges, headingLines } from './blocks.js';
1
+ import { readingOf } from './document.js';
2
+ import { blockRanges, headingsIn } from './markdown.js';
2
3
  import { firstEditFrom, projectionInput, rangeText, } from './project.js';
3
4
  import { refusal } from './refuse.js';
4
5
  const SMALLEST_BOUND = 2;
@@ -12,8 +13,7 @@ function node(draft) {
12
13
  };
13
14
  }
14
15
  function forest(state, range) {
15
- const content = state.content;
16
- const headings = headingLines(content, range.start, range.end);
16
+ const headings = headingsIn(state.reading, range.start, range.end);
17
17
  const roots = [];
18
18
  const open = [];
19
19
  const first = headings[0]?.start ?? range.end;
@@ -282,7 +282,7 @@ function ownBlocks(subject, end, blocks) {
282
282
  }
283
283
  function divideNode(state, subject) {
284
284
  const end = subject.children[0]?.start ?? subject.end;
285
- const blocks = blockRanges(state.content, subject.bodyStart, end);
285
+ const blocks = blockRanges(state.reading, subject.bodyStart, end);
286
286
  const children = { heading: '', emitted: 0 };
287
287
  if (blocks.length === 0 && subject.children.length > 0) {
288
288
  const [first, ...rest] = subject.children;
@@ -311,6 +311,7 @@ export function divide(document, file, context) {
311
311
  return { ok: false, refusal: result.refusal };
312
312
  const state = {
313
313
  content: document.content,
314
+ reading: readingOf(document),
314
315
  edits: result.input.edits,
315
316
  bound: context.bound,
316
317
  spans: [],
@@ -1,17 +1,22 @@
1
+ import { type Body, type Naming } from './body.js';
1
2
  import { type Definition } from './definition.js';
2
- import { type LinkInventory } from './links.js';
3
- import type { ApplyResult, BodyResult, FrontmatterResult, Change, Document, Link, ParseResult, UnlinkedBody } from './types.js';
4
- import { type YamlMap } from './yaml.js';
5
- export declare function inventoryOf(document: Document): LinkInventory;
6
- export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
7
- export declare function parse(content: string, file?: string): ParseResult;
3
+ import { type HrefOccurrence, type Reading } from './markdown.js';
4
+ import type { ApplyResult, BodyResult, Change, DefinitionOf, Document, Link, ParseResult, Refusal, Span, UnlinkedBody } from './types.js';
5
+ export declare function readingOf(document: Document): Reading;
6
+ export declare function bodyOf(document: Document): Body | null;
7
+ export declare function linkDestinations(document: Document): readonly HrefOccurrence[];
8
+ export declare function textSpans(document: Document): readonly Span[];
9
+ export declare function parse(content: string, file?: string, definition?: Definition | DefinitionOf): ParseResult;
10
+ export declare function create(type: string | undefined, definition?: Definition): Document;
8
11
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
9
12
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
10
13
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
11
14
  export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
12
15
  export declare function links(document: Document, file: string): readonly Link[];
13
16
  export declare function bodyLinks(body: string, file: string): readonly Link[];
14
- export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
17
+ export declare function bodyWith(document: Document, definition: Definition | undefined): Body | null | Refusal;
18
+ export declare function apply(document: Document, changes: readonly Change[], definition?: Definition, nameOf?: Naming): ApplyResult;
19
+ export declare function relabel(document: Document, before: Definition, after: Definition): string;
20
+ export declare function relabels(before: Definition, after: Definition): boolean;
15
21
  export declare function serialize(document: Document): string;
16
- export declare function frontmatter(document: Document): YamlMap | null;
17
22
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,YAAY,CAAC;AAcpB,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,WAAW,EAEX,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAcL,KAAK,OAAO,EAEb,MAAM,WAAW,CAAC;AAgBnB,wBAAgB,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,aAAa,CAM7D;AA4DD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,iBAAiB,CAW9E;AAED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