@agentshouse/mdmodel 0.1.0-caefdbe3e3d42 → 0.1.0-caf6545f57b5d

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 (343) hide show
  1. package/API.md +160 -158
  2. package/README.md +14 -15
  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/definition.d.ts +20 -10
  7. package/dist/definition.d.ts.map +1 -1
  8. package/dist/definition.js +174 -123
  9. package/dist/divide.d.ts.map +1 -1
  10. package/dist/divide.js +5 -4
  11. package/dist/document.d.ts +14 -7
  12. package/dist/document.d.ts.map +1 -1
  13. package/dist/document.js +720 -110
  14. package/dist/event.d.ts +77 -0
  15. package/dist/event.d.ts.map +1 -0
  16. package/dist/event.js +200 -0
  17. package/dist/facts.d.ts +15 -0
  18. package/dist/facts.d.ts.map +1 -0
  19. package/dist/facts.js +41 -0
  20. package/dist/fields.d.ts +1 -1
  21. package/dist/fields.d.ts.map +1 -1
  22. package/dist/fields.js +1 -1
  23. package/dist/form.d.ts +4 -0
  24. package/dist/form.d.ts.map +1 -0
  25. package/dist/form.js +152 -0
  26. package/dist/index.d.ts +21 -17
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +13 -11
  29. package/dist/kinds.d.ts +2 -2
  30. package/dist/kinds.d.ts.map +1 -1
  31. package/dist/kinds.js +20 -11
  32. package/dist/markdown.d.ts +75 -0
  33. package/dist/markdown.d.ts.map +1 -0
  34. package/dist/markdown.js +265 -0
  35. package/dist/paths.d.ts +10 -1
  36. package/dist/paths.d.ts.map +1 -1
  37. package/dist/paths.js +74 -19
  38. package/dist/pattern.d.ts.map +1 -1
  39. package/dist/pattern.js +4 -3
  40. package/dist/project.d.ts.map +1 -1
  41. package/dist/project.js +33 -60
  42. package/dist/query/language.d.ts +43 -7
  43. package/dist/query/language.d.ts.map +1 -1
  44. package/dist/query/language.js +151 -57
  45. package/dist/query/match.d.ts +3 -1
  46. package/dist/query/match.d.ts.map +1 -1
  47. package/dist/query/match.js +40 -8
  48. package/dist/query/rows.d.ts +1 -1
  49. package/dist/query/rows.d.ts.map +1 -1
  50. package/dist/query/sql.d.ts.map +1 -1
  51. package/dist/query/sql.js +7 -1
  52. package/dist/refuse.d.ts +1 -0
  53. package/dist/refuse.d.ts.map +1 -1
  54. package/dist/refuse.js +1 -0
  55. package/dist/reserved.d.ts +1 -0
  56. package/dist/reserved.d.ts.map +1 -1
  57. package/dist/reserved.js +2 -1
  58. package/dist/schema.d.ts +0 -2
  59. package/dist/schema.d.ts.map +1 -1
  60. package/dist/schema.js +5 -68
  61. package/dist/types.d.ts +14 -7
  62. package/dist/types.d.ts.map +1 -1
  63. package/dist/validate.d.ts +8 -5
  64. package/dist/validate.d.ts.map +1 -1
  65. package/dist/validate.js +141 -179
  66. package/dist/yaml.d.ts.map +1 -1
  67. package/dist/yaml.js +4 -11
  68. package/fixtures/README.md +40 -23
  69. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  70. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  71. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  72. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  73. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  74. package/fixtures/cases/absolute-link/library/item.md +1 -1
  75. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  76. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  77. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  78. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  79. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  80. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  81. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  82. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  83. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  84. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  85. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  86. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  87. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  88. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  89. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  90. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  91. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  92. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  93. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  94. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  95. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  96. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  97. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  98. package/fixtures/cases/boolean-field/expected.json +2 -1
  99. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  100. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  101. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  102. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  103. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  104. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  105. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  106. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  107. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  108. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  109. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  110. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  111. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  112. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  113. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  114. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  115. package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
  116. package/fixtures/cases/date-time-format/expected.json +2 -1
  117. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  118. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  119. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  120. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  121. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  122. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  123. package/fixtures/cases/defs-pattern/expected.json +2 -1
  124. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  125. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  126. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  127. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  128. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  129. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  130. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  131. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  132. package/fixtures/cases/email-format/expected.json +2 -1
  133. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  134. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  135. package/fixtures/cases/email-format/schema.yaml +10 -11
  136. package/fixtures/cases/equal-labels/expected.json +5 -0
  137. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  138. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  139. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  140. package/fixtures/cases/field-enum/expected.json +2 -1
  141. package/fixtures/cases/field-enum/library/item.md +2 -2
  142. package/fixtures/cases/field-enum/schema.yaml +3 -4
  143. package/fixtures/cases/integer-field/expected.json +2 -1
  144. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  145. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  146. package/fixtures/cases/integer-field/schema.yaml +10 -11
  147. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  148. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  149. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  150. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  151. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  152. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  153. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  154. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  155. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
  156. package/fixtures/cases/list-item-enum/expected.json +7 -0
  157. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  158. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  159. package/fixtures/cases/list-item-kind/expected.json +7 -0
  160. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  161. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  162. package/fixtures/cases/list-items/expected.json +1 -0
  163. package/fixtures/cases/list-items/library/page.md +26 -0
  164. package/fixtures/cases/list-items/schema.yaml +10 -0
  165. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  166. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  167. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  168. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  169. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  170. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  171. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  172. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  173. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  174. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  175. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  176. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  177. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  178. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  179. package/fixtures/cases/list-reference-path/expected.json +7 -0
  180. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  181. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  182. package/fixtures/cases/list-reference-type/expected.json +7 -0
  183. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  184. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  185. package/fixtures/cases/list-size/expected.json +2 -1
  186. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  187. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  188. package/fixtures/cases/list-size/schema.yaml +10 -11
  189. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  190. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  191. package/fixtures/cases/malformed-list/context.json +1 -0
  192. package/fixtures/cases/malformed-list/expected.json +7 -0
  193. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  194. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  195. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  196. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  197. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  198. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  199. package/fixtures/cases/misspelled-key/expected.json +2 -1
  200. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  201. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  202. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  203. package/fixtures/cases/name-not-a-string/context.json +1 -0
  204. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  205. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  206. package/fixtures/cases/nested-defs/expected.json +2 -1
  207. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  208. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  209. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  210. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  211. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  212. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  213. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  214. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  215. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  216. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  217. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  218. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  219. package/fixtures/cases/nested-required-field/expected.json +2 -1
  220. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  221. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  222. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  223. package/fixtures/cases/numeric-range/expected.json +2 -1
  224. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  225. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  226. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  227. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  228. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  229. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  230. package/fixtures/cases/one-key-two-types/context.json +1 -0
  231. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  232. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  233. package/fixtures/cases/one-of-variant/expected.json +2 -1
  234. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  235. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  236. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  237. package/fixtures/cases/other-room-reference/expected.json +2 -1
  238. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  239. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  240. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  241. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  242. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  243. package/fixtures/cases/prototype-field/expected.json +2 -1
  244. package/fixtures/cases/prototype-field/library/item.md +2 -2
  245. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  246. package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
  247. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
  248. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  249. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  250. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  251. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  252. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  253. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  254. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  255. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  256. package/fixtures/cases/string-length/expected.json +2 -1
  257. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  258. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  259. package/fixtures/cases/string-length/schema.yaml +10 -11
  260. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  261. package/fixtures/cases/text-field-kind/expected.json +1 -4
  262. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  263. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  264. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  265. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  266. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  267. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
  268. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  269. package/fixtures/cases/undeclared-field/expected.json +2 -1
  270. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  271. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  272. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  273. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  274. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
  275. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
  276. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
  277. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
  278. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  279. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  280. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  281. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  282. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  283. package/fixtures/division.json +86 -41
  284. package/fixtures/forms.json +347 -0
  285. package/fixtures/preamble.json +26 -5
  286. package/fixtures/projection.json +121 -18
  287. package/fixtures/queries.json +51 -0
  288. package/package.json +10 -1
  289. package/dist/blocks.d.ts +0 -11
  290. package/dist/blocks.d.ts.map +0 -1
  291. package/dist/blocks.js +0 -91
  292. package/dist/condition.d.ts +0 -179
  293. package/dist/condition.d.ts.map +0 -1
  294. package/dist/condition.js +0 -598
  295. package/dist/links.d.ts +0 -29
  296. package/dist/links.d.ts.map +0 -1
  297. package/dist/links.js +0 -831
  298. package/dist/profile.d.ts +0 -6
  299. package/dist/profile.d.ts.map +0 -1
  300. package/dist/profile.js +0 -5
  301. package/dist/sections.d.ts +0 -11
  302. package/dist/sections.d.ts.map +0 -1
  303. package/dist/sections.js +0 -57
  304. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  305. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  306. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  307. package/fixtures/cases/null-refused/expected.json +0 -6
  308. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  309. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  310. package/fixtures/cases/null-refused/schema.yaml +0 -56
  311. package/fixtures/cases/open-map-value/expected.json +0 -6
  312. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  313. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  314. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  315. package/fixtures/cases/section-item-enum/expected.json +0 -6
  316. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  317. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  318. package/fixtures/cases/section-item-kind/expected.json +0 -6
  319. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  320. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  321. package/fixtures/cases/section-items/library/page.md +0 -42
  322. package/fixtures/cases/section-items/schema.yaml +0 -10
  323. package/fixtures/cases/section-reference-path/expected.json +0 -6
  324. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  325. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  326. package/fixtures/cases/section-reference-type/expected.json +0 -6
  327. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  328. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  329. package/fixtures/cases/structured-section/expected.json +0 -6
  330. /package/fixtures/cases/{conditional-section → conditional-long-text}/context.json +0 -0
  331. /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
  332. /package/fixtures/cases/{null-refused → labels-in-the-rooms-language}/context.json +0 -0
  333. /package/fixtures/cases/{section-items → labels-in-the-rooms-language}/expected.json +0 -0
  334. /package/fixtures/cases/{open-map-value → lazy-list-item}/context.json +0 -0
  335. /package/fixtures/cases/{section-item-enum → list-item-enum}/context.json +0 -0
  336. /package/fixtures/cases/{section-item-kind → list-item-kind}/context.json +0 -0
  337. /package/fixtures/cases/{section-items → list-items}/context.json +0 -0
  338. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  339. /package/fixtures/cases/{section-reference-path → list-reference-path}/context.json +0 -0
  340. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  341. /package/fixtures/cases/{section-reference-type → list-reference-type}/context.json +0 -0
  342. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
  343. /package/fixtures/cases/{structured-section → long-value-past-six-levels}/context.json +0 -0
@@ -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>>;
@@ -46,7 +41,6 @@ export type Definition = {
46
41
  readonly memberDocument: boolean;
47
42
  readonly frontmatter: 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,32 @@ 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[];
61
+ export declare const LONG_TEXT = "text/markdown";
62
62
  export declare const ARRAY_INDEX: RegExp;
63
63
  export declare const JSON_POINTER: RegExp;
64
+ export declare function refuse(rule: string, location: string): Failure;
64
65
  export declare function escapePointer(key: string): string;
65
66
  export declare function pointerSegments(pointer: string): string[];
66
67
  export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
67
68
  readonly name: string;
68
69
  readonly node: unknown;
69
70
  } | undefined;
71
+ export declare function conjoined(declared: readonly {
72
+ readonly node: unknown;
73
+ readonly at: string;
74
+ }[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): {
75
+ readonly held: readonly Placed[];
76
+ readonly ancestry: ReadonlySet<unknown>;
77
+ };
78
+ export declare function variantsOf({ node, at }: Placed): Placed[];
70
79
  export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
71
80
  export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
72
81
  export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
@@ -78,5 +87,6 @@ export type PointerFacts = {
78
87
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
88
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
89
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
81
- export declare function readSchema(text: string, provided?: VerifiedModel): VerifiedModel | Failure;
90
+ export declare function untitled(definition: Definition): Definition;
91
+ export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
82
92
  //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.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,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAKlF;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,QAAQ,CAAC,OAAO,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"}
@@ -12,7 +12,6 @@ export const JSON_TYPES = [
12
12
  ];
13
13
  export const BUILT_IN_TYPE = 'any';
14
14
  export const ATTACHMENT = 'attachment';
15
- const SCALAR_TYPES = new Set(['string', 'number', 'integer', 'boolean']);
16
15
  const COMPOSITES = ['array', 'object'];
17
16
  const ANNOTATIONS = new Set([
18
17
  '$comment',
@@ -24,11 +23,14 @@ const ANNOTATIONS = new Set([
24
23
  'readOnly',
25
24
  'writeOnly',
26
25
  ]);
26
+ export const OPENING = ['additionalProperties', 'unevaluatedProperties'];
27
27
  const FIELD_RULES = ['change_roles', 'initial_roles', 'transitions'];
28
28
  const PROVIDED_KEYWORDS = ['create_roles', 'delete_roles'];
29
29
  const NO_TYPES = Object.freeze({ types: Object.freeze({}) });
30
30
  const DEFS_REFERENCE = '#/$defs/';
31
31
  const UNBOUNDED_FORMAT = 'url';
32
+ export const LONG_TEXT = 'text/markdown';
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;
@@ -37,8 +39,8 @@ const HOUSE_KEYS = {
37
39
  [SITE_FIELD]: { prose: false },
38
40
  [RECEIVED_FIELD]: { prose: false },
39
41
  };
40
- function refuse(rule, location) {
41
- return location === undefined ? { rule } : { rule, location };
42
+ export function refuse(rule, location) {
43
+ return { rule, location };
42
44
  }
43
45
  export function escapePointer(key) {
44
46
  return key.replaceAll('~', '~0').replaceAll('/', '~1');
@@ -100,7 +102,7 @@ function strings(value) {
100
102
  new Set(value).size === value.length);
101
103
  }
102
104
  function schemaFailure(value, at, context) {
103
- if (typeof value === 'boolean')
105
+ if (!context.checked || typeof value === 'boolean')
104
106
  return undefined;
105
107
  if (!isRecord(value))
106
108
  return refuse('schema', at);
@@ -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 === LONG_TEXT);
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 }),
@@ -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
+ frontmatter: untitledFacts(definition.frontmatter),
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)) {
@@ -634,8 +689,9 @@ function composites(node, defs, seen) {
634
689
  const target = typeof node.$ref === 'string' ? refTarget(node.$ref, defs)?.node : undefined;
635
690
  const conditioned = () => {
636
691
  const met = composites(node.then ?? true, defs, seen);
637
- return COMPOSITES.filter((kind) => (composites(node.if, defs, seen).includes(kind) && met.includes(kind)) ||
638
- composites(node.else ?? true, defs, seen).includes(kind));
692
+ const condition = composites(node.if, defs, seen);
693
+ const otherwise = composites(node.else ?? true, defs, seen);
694
+ return COMPOSITES.filter((kind) => (condition.includes(kind) && met.includes(kind)) || otherwise.includes(kind));
639
695
  };
640
696
  const bounds = [
641
697
  typed(node.type),
@@ -704,14 +760,14 @@ function unruled(schema) {
704
760
  }
705
761
  return { schema: written.size === 0 ? schema : { ...schema, properties }, written };
706
762
  }
707
- function providedType(name, value, provided) {
763
+ function providedType(name, value, provided, checked) {
708
764
  const at = `/${escapePointer(name)}`;
709
- if (provided.nameable?.includes(name) !== true)
765
+ if (checked && provided.nameable?.includes(name) !== true)
710
766
  return refuse('provided-type', at);
711
767
  if (!isRecord(value))
712
768
  return refuse('schema', at);
713
769
  const declared = Object.keys(value).find((key) => !PROVIDED_KEYWORDS.includes(key));
714
- if (declared !== undefined)
770
+ if (checked && declared !== undefined)
715
771
  return refuse('provided-type', `${at}/${escapePointer(declared)}`);
716
772
  const { create_roles: createRoles, delete_roles: deleteRoles } = value;
717
773
  if (createRoles !== undefined && !roleNames(createRoles))
@@ -728,22 +784,14 @@ function readType(name, value, context) {
728
784
  const at = `/${escapePointer(name)}`;
729
785
  if (!isRecord(value))
730
786
  return refuse('schema', at);
731
- 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;
732
788
  if (mark !== undefined && typeof mark !== 'boolean')
733
789
  return refuse('member_document', `${at}/member_document`);
734
790
  if (createRoles !== undefined && !roleNames(createRoles))
735
791
  return refuse('create_roles', `${at}/create_roles`);
736
792
  if (deleteRoles !== undefined && !roleNames(deleteRoles))
737
793
  return refuse('delete_roles', `${at}/delete_roles`);
738
- const read = declared === undefined
739
- ? { sections: Object.create(null) }
740
- : readSections(declared, `${at}/sections`, context);
741
- if ('failure' in read)
742
- return read.failure;
743
- const unbranched = withoutBranchSections(ruled, declared, at);
744
- if ('failure' in unbranched)
745
- return unbranched.failure;
746
- const { schema, written } = unruled(unbranched.schema);
794
+ const { schema, written } = unruled(ruled);
747
795
  const failure = schemaFailure(schema, at, context);
748
796
  if (failure !== undefined)
749
797
  return failure;
@@ -769,7 +817,6 @@ function readType(name, value, context) {
769
817
  memberDocument,
770
818
  frontmatter: { ...root, properties: { ...HOUSE_KEYS, ...fields } },
771
819
  fields,
772
- sections: read.sections,
773
820
  rules,
774
821
  ...(createRoles === undefined ? {} : { createRoles }),
775
822
  ...(deleteRoles === undefined ? {} : { deleteRoles }),
@@ -782,7 +829,7 @@ function readType(name, value, context) {
782
829
  function lineAt(text, offset) {
783
830
  return text.slice(0, offset).split(/\r\n|\r|\n/).length;
784
831
  }
785
- export function readSchema(text, provided = NO_TYPES) {
832
+ export function readSchema(text, provided = NO_TYPES, checked = true) {
786
833
  let root;
787
834
  try {
788
835
  root = jsValue(parseYamlMapping(text, 0, text.length));
@@ -796,11 +843,15 @@ export function readSchema(text, provided = NO_TYPES) {
796
843
  if (!isRecord(defs))
797
844
  return refuse('$defs', '/$defs');
798
845
  const names = Object.keys(root).filter((key) => key !== '$defs');
799
- for (const name of names) {
846
+ for (const name of checked ? names : []) {
800
847
  if (name === '' || name.startsWith('$') || name === BUILT_IN_TYPE || name === ATTACHMENT)
801
848
  return refuse('schema-type-name', `/${escapePointer(name)}`);
802
849
  }
803
- const context = { defs, types: new Set([...names, ...Object.keys(provided.types)]) };
850
+ const context = {
851
+ defs,
852
+ types: new Set([...names, ...Object.keys(provided.types)]),
853
+ checked,
854
+ };
804
855
  for (const [name, def] of Object.entries(defs)) {
805
856
  const failure = schemaFailure(def, `/$defs/${escapePointer(name)}`, context);
806
857
  if (failure !== undefined)
@@ -810,11 +861,11 @@ export function readSchema(text, provided = NO_TYPES) {
810
861
  let marked = false;
811
862
  for (const name of names) {
812
863
  const definition = Object.hasOwn(provided.types, name)
813
- ? providedType(name, root[name], provided)
864
+ ? providedType(name, root[name], provided, checked)
814
865
  : readType(name, root[name], context);
815
866
  if ('rule' in definition)
816
867
  return definition;
817
- if (definition.memberDocument) {
868
+ if (checked && definition.memberDocument) {
818
869
  if (marked)
819
870
  return refuse('member_document', `/${escapePointer(name)}/member_document`);
820
871
  marked = true;
@@ -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,16 +1,23 @@
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 } from './types.js';
4
- import { type YamlMap } from './yaml.js';
5
- export declare function inventoryOf(document: Document): LinkInventory;
3
+ import { type HrefOccurrence, type Reading } from './markdown.js';
4
+ import type { ApplyResult, BodyResult, FrontmatterResult, 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[];
6
9
  export declare function parseFrontmatter(content: string, file?: string): FrontmatterResult;
7
- export declare function parse(content: string, file?: string): ParseResult;
10
+ export declare function parse(content: string, file?: string, definition?: Definition | DefinitionOf): ParseResult;
11
+ export declare function create(type: string | undefined, definition?: Definition): Document;
8
12
  export declare function relativize(document: Document, file: string, handle: string, definition?: Definition, kept?: ReadonlySet<string>): ApplyResult;
9
13
  export declare function relativizeBody(body: string, file: string, handle: string): BodyResult;
10
14
  export declare function relinkBody(body: string, file: string, moves: ReadonlyMap<string, string>): BodyResult;
15
+ export declare function unlinkBody(body: string, hrefs: ReadonlySet<string>): UnlinkedBody;
11
16
  export declare function links(document: Document, file: string): readonly Link[];
12
17
  export declare function bodyLinks(body: string, file: string): readonly Link[];
13
- export declare function apply(document: Document, changes: readonly Change[]): ApplyResult;
18
+ export declare function bodyWith(document: Document, definition: Definition | undefined): Body | null | Refusal;
19
+ export declare function apply(document: Document, changes: readonly Change[], definition?: Definition, nameOf?: Naming): ApplyResult;
20
+ export declare function relabel(document: Document, before: Definition, after: Definition): string;
21
+ export declare function relabels(before: Definition, after: Definition): boolean;
14
22
  export declare function serialize(document: Document): string;
15
- export declare function frontmatter(document: Document): YamlMap | null;
16
23
  //# sourceMappingURL=document.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":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