@agentshouse/mdmodel 0.1.0-ce4af152f38d8 → 0.1.0-ce7e4efd1b42d

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 (368) hide show
  1. package/API.md +153 -186
  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 +23 -10
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +171 -116
  12. package/dist/document.d.ts +14 -8
  13. package/dist/document.d.ts.map +1 -1
  14. package/dist/document.js +747 -137
  15. package/dist/event.d.ts +1 -2
  16. package/dist/event.d.ts.map +1 -1
  17. package/dist/event.js +2 -3
  18. package/dist/facts.d.ts.map +1 -1
  19. package/dist/facts.js +3 -0
  20. package/dist/fields.d.ts +1 -1
  21. package/dist/fields.d.ts.map +1 -1
  22. package/dist/fields.js +2 -2
  23. package/dist/form.d.ts +4 -0
  24. package/dist/form.d.ts.map +1 -0
  25. package/dist/form.js +153 -0
  26. package/dist/house-model.d.ts +870 -0
  27. package/dist/house-model.d.ts.map +1 -0
  28. package/dist/house-model.js +472 -0
  29. package/dist/house-references/crockford.d.ts +4 -0
  30. package/dist/house-references/crockford.d.ts.map +1 -0
  31. package/dist/house-references/crockford.js +3 -0
  32. package/dist/house-references/patterns.d.ts +9 -0
  33. package/dist/house-references/patterns.d.ts.map +1 -0
  34. package/dist/house-references/patterns.js +13 -0
  35. package/dist/index.d.ts +30 -15
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +19 -10
  38. package/dist/indexed.d.ts +9 -0
  39. package/dist/indexed.d.ts.map +1 -0
  40. package/dist/indexed.js +55 -0
  41. package/dist/kinds.d.ts +3 -0
  42. package/dist/kinds.d.ts.map +1 -1
  43. package/dist/kinds.js +60 -0
  44. package/dist/markdown.d.ts +71 -0
  45. package/dist/markdown.d.ts.map +1 -0
  46. package/dist/markdown.js +232 -0
  47. package/dist/media-type.d.ts +72 -0
  48. package/dist/media-type.d.ts.map +1 -0
  49. package/dist/media-type.js +157 -0
  50. package/dist/moment.d.ts +7 -0
  51. package/dist/moment.d.ts.map +1 -0
  52. package/dist/moment.js +18 -0
  53. package/dist/not-ready.d.ts +2 -0
  54. package/dist/not-ready.d.ts.map +1 -0
  55. package/dist/not-ready.js +5 -0
  56. package/dist/paths.d.ts +15 -1
  57. package/dist/paths.d.ts.map +1 -1
  58. package/dist/paths.js +88 -19
  59. package/dist/query/language.d.ts +2 -1
  60. package/dist/query/language.d.ts.map +1 -1
  61. package/dist/query/language.js +1 -1
  62. package/dist/query/match.d.ts +1 -1
  63. package/dist/query/match.d.ts.map +1 -1
  64. package/dist/query/rows.d.ts +1 -1
  65. package/dist/query/rows.d.ts.map +1 -1
  66. package/dist/query/rows.js +2 -5
  67. package/dist/query/sql.d.ts +5 -1
  68. package/dist/query/sql.d.ts.map +1 -1
  69. package/dist/query/sql.js +3 -3
  70. package/dist/query/walk.d.ts +63 -0
  71. package/dist/query/walk.d.ts.map +1 -0
  72. package/dist/query/walk.js +263 -0
  73. package/dist/references.d.ts +2 -2
  74. package/dist/references.d.ts.map +1 -1
  75. package/dist/references.js +1 -1
  76. package/dist/refuse.d.ts +1 -0
  77. package/dist/refuse.d.ts.map +1 -1
  78. package/dist/refuse.js +1 -0
  79. package/dist/room-types.d.ts +7 -0
  80. package/dist/room-types.d.ts.map +1 -0
  81. package/dist/room-types.js +136 -0
  82. package/dist/schema.d.ts +1 -3
  83. package/dist/schema.d.ts.map +1 -1
  84. package/dist/schema.js +9 -73
  85. package/dist/types.d.ts +11 -38
  86. package/dist/types.d.ts.map +1 -1
  87. package/dist/validate.d.ts +6 -2
  88. package/dist/validate.d.ts.map +1 -1
  89. package/dist/validate.js +111 -178
  90. package/dist/yaml.d.ts +4 -4
  91. package/dist/yaml.d.ts.map +1 -1
  92. package/dist/yaml.js +1 -1
  93. package/fixtures/README.md +45 -63
  94. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  95. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  96. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  97. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  98. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  99. package/fixtures/cases/absolute-link/library/item.md +1 -1
  100. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  101. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  102. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  103. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  104. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  105. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  106. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  107. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  108. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  109. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  110. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  111. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  112. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  113. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  114. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  115. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  116. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  117. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  118. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  119. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  120. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  121. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  122. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  123. package/fixtures/cases/boolean-field/expected.json +2 -1
  124. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  125. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  126. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  127. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  128. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  129. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  130. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  131. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  132. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  133. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  134. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  135. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  136. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  137. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  138. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  139. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  140. package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
  141. package/fixtures/cases/date-time-format/expected.json +2 -1
  142. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  143. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  144. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  145. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  146. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  147. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  148. package/fixtures/cases/defs-pattern/expected.json +2 -1
  149. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  150. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  151. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  152. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  153. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  154. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  155. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  156. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  157. package/fixtures/cases/email-format/expected.json +2 -1
  158. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  159. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  160. package/fixtures/cases/email-format/schema.yaml +10 -11
  161. package/fixtures/cases/equal-labels/expected.json +5 -0
  162. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  163. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  164. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  165. package/fixtures/cases/field-enum/expected.json +2 -1
  166. package/fixtures/cases/field-enum/library/item.md +2 -2
  167. package/fixtures/cases/field-enum/schema.yaml +3 -4
  168. package/fixtures/cases/integer-field/expected.json +2 -1
  169. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  170. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  171. package/fixtures/cases/integer-field/schema.yaml +10 -11
  172. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  173. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  174. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  175. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  176. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  177. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  178. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  179. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  180. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
  181. package/fixtures/cases/list-item-enum/expected.json +7 -0
  182. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  183. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  184. package/fixtures/cases/list-item-kind/expected.json +7 -0
  185. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  186. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  187. package/fixtures/cases/list-items/expected.json +1 -0
  188. package/fixtures/cases/list-items/library/page.md +26 -0
  189. package/fixtures/cases/list-items/schema.yaml +10 -0
  190. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  191. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  192. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  193. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  194. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  195. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  196. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  197. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  198. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  199. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  200. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  201. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  202. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  203. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  204. package/fixtures/cases/list-reference-path/expected.json +7 -0
  205. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  206. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  207. package/fixtures/cases/list-reference-type/expected.json +7 -0
  208. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  209. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  210. package/fixtures/cases/list-size/expected.json +2 -1
  211. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  212. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  213. package/fixtures/cases/list-size/schema.yaml +10 -11
  214. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  215. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  216. package/fixtures/cases/malformed-list/context.json +1 -0
  217. package/fixtures/cases/malformed-list/expected.json +7 -0
  218. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  219. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  220. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  221. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  222. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  223. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  224. package/fixtures/cases/misspelled-key/expected.json +2 -1
  225. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  226. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  227. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  228. package/fixtures/cases/name-not-a-string/context.json +1 -0
  229. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  230. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  231. package/fixtures/cases/nested-defs/expected.json +2 -1
  232. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  233. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  234. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  235. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  236. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  237. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  238. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  239. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  240. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  241. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  242. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  243. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  244. package/fixtures/cases/nested-required-field/expected.json +2 -1
  245. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  246. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  247. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  248. package/fixtures/cases/numeric-range/expected.json +2 -1
  249. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  250. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  251. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  252. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  253. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  254. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  255. package/fixtures/cases/one-key-two-types/context.json +1 -0
  256. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  257. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  258. package/fixtures/cases/one-of-variant/expected.json +2 -1
  259. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  260. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  261. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  262. package/fixtures/cases/other-room-reference/expected.json +2 -1
  263. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  264. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  265. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  266. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  267. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  268. package/fixtures/cases/prototype-field/expected.json +2 -1
  269. package/fixtures/cases/prototype-field/library/item.md +2 -2
  270. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  271. package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
  272. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
  273. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  274. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  275. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  276. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  277. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  278. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  279. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  280. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  281. package/fixtures/cases/string-length/expected.json +2 -1
  282. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  283. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  284. package/fixtures/cases/string-length/schema.yaml +10 -11
  285. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  286. package/fixtures/cases/text-field-kind/expected.json +1 -4
  287. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  288. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  289. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  290. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  291. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  292. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
  293. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  294. package/fixtures/cases/undeclared-field/expected.json +2 -1
  295. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  296. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  297. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  298. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  299. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
  300. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
  301. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
  302. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
  303. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  304. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  305. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  306. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  307. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  308. package/fixtures/forms.json +347 -0
  309. package/fixtures/preamble.json +29 -8
  310. package/fixtures/queries.json +397 -2
  311. package/package.json +10 -1
  312. package/dist/blocks.d.ts +0 -11
  313. package/dist/blocks.d.ts.map +0 -1
  314. package/dist/blocks.js +0 -87
  315. package/dist/divide.d.ts +0 -3
  316. package/dist/divide.d.ts.map +0 -1
  317. package/dist/divide.js +0 -320
  318. package/dist/links.d.ts +0 -29
  319. package/dist/links.d.ts.map +0 -1
  320. package/dist/links.js +0 -821
  321. package/dist/project.d.ts +0 -22
  322. package/dist/project.d.ts.map +0 -1
  323. package/dist/project.js +0 -126
  324. package/dist/sections.d.ts +0 -11
  325. package/dist/sections.d.ts.map +0 -1
  326. package/dist/sections.js +0 -57
  327. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  328. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  329. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  330. package/fixtures/cases/null-refused/expected.json +0 -6
  331. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  332. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  333. package/fixtures/cases/null-refused/schema.yaml +0 -56
  334. package/fixtures/cases/open-map-value/expected.json +0 -6
  335. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  336. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  337. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  338. package/fixtures/cases/section-item-enum/expected.json +0 -6
  339. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  340. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  341. package/fixtures/cases/section-item-kind/expected.json +0 -6
  342. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  343. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  344. package/fixtures/cases/section-items/library/page.md +0 -42
  345. package/fixtures/cases/section-items/schema.yaml +0 -10
  346. package/fixtures/cases/section-reference-path/expected.json +0 -6
  347. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  348. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  349. package/fixtures/cases/section-reference-type/expected.json +0 -6
  350. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  351. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  352. package/fixtures/cases/structured-section/expected.json +0 -6
  353. package/fixtures/division.json +0 -408
  354. package/fixtures/projection.json +0 -254
  355. /package/fixtures/cases/{conditional-section → conditional-long-text}/context.json +0 -0
  356. /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
  357. /package/fixtures/cases/{null-refused → labels-in-the-rooms-language}/context.json +0 -0
  358. /package/fixtures/cases/{section-items → labels-in-the-rooms-language}/expected.json +0 -0
  359. /package/fixtures/cases/{open-map-value → lazy-list-item}/context.json +0 -0
  360. /package/fixtures/cases/{section-item-enum → list-item-enum}/context.json +0 -0
  361. /package/fixtures/cases/{section-item-kind → list-item-kind}/context.json +0 -0
  362. /package/fixtures/cases/{section-items → list-items}/context.json +0 -0
  363. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  364. /package/fixtures/cases/{section-reference-path → list-reference-path}/context.json +0 -0
  365. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  366. /package/fixtures/cases/{section-reference-type → list-reference-type}/context.json +0 -0
  367. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
  368. /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,9 +8,13 @@ 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>>;
17
+ readonly required?: readonly string[];
14
18
  readonly patterns?: readonly PatternFacts[];
15
19
  readonly additional?: ValueFacts;
16
20
  };
@@ -18,14 +22,6 @@ export type PatternFacts = {
18
22
  readonly pattern: string;
19
23
  readonly facts: ValueFacts;
20
24
  };
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
25
  export type Shape = {
30
26
  readonly schema: Readonly<Record<string, unknown>>;
31
27
  readonly defs: Readonly<Record<string, unknown>>;
@@ -44,29 +40,45 @@ export type FieldRules = {
44
40
  export type Definition = {
45
41
  readonly name: string;
46
42
  readonly memberDocument: boolean;
47
- readonly frontmatter: ValueFacts;
43
+ readonly root: ValueFacts;
48
44
  readonly fields: Readonly<Record<string, ValueFacts>>;
49
- readonly sections: Readonly<Record<string, SectionSpec>>;
50
45
  readonly rules: Readonly<Record<string, FieldRules>>;
51
46
  readonly createRoles?: readonly string[];
52
47
  readonly deleteRoles?: readonly string[];
48
+ readonly indexed?: readonly string[];
53
49
  readonly shape: Shape;
54
50
  };
55
51
  export type Failure = {
56
52
  readonly rule: string;
57
53
  readonly location?: string;
58
54
  };
55
+ export type Placed = {
56
+ readonly node: Record<string, unknown>;
57
+ readonly at: string;
58
+ };
59
59
  export declare const JSON_TYPES: readonly JsonType[];
60
60
  export declare const BUILT_IN_TYPE = "any";
61
61
  export declare const ATTACHMENT = "attachment";
62
+ export declare const OPENING: readonly string[];
63
+ export declare const UNIONS: readonly string[];
62
64
  export declare const ARRAY_INDEX: RegExp;
63
65
  export declare const JSON_POINTER: RegExp;
66
+ export declare function refuse(rule: string, location: string): Failure;
64
67
  export declare function escapePointer(key: string): string;
65
68
  export declare function pointerSegments(pointer: string): string[];
66
69
  export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
67
70
  readonly name: string;
68
71
  readonly node: unknown;
69
72
  } | undefined;
73
+ export declare function conjoined(declared: readonly {
74
+ readonly node: unknown;
75
+ readonly at: string;
76
+ }[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): {
77
+ readonly held: readonly Placed[];
78
+ readonly ancestry: ReadonlySet<unknown>;
79
+ };
80
+ export declare function variantsOf({ node, at }: Placed): Placed[];
81
+ export declare function admitted(nodes: readonly unknown[], defs: Readonly<Record<string, unknown>>, ancestry: ReadonlySet<unknown>): Set<string> | null;
70
82
  export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
71
83
  export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
72
84
  export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
@@ -78,5 +90,6 @@ export type PointerFacts = {
78
90
  export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
79
91
  export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
80
92
  export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
93
+ export declare function untitled(definition: Definition): Definition;
81
94
  export declare function readSchema(text: string, provided?: VerifiedModel, checked?: boolean): VerifiedModel | Failure;
82
95
  //# 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,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjG,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;I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G,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;AAmND,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
+ export 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,8 @@ 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 required = (left.required ?? []).filter((name) => right.required?.includes(name) === true);
318
+ const title = left.title ?? right.title;
310
319
  return {
311
320
  ...(type === undefined ? {} : { type }),
312
321
  ...(format === undefined ? {} : { format }),
@@ -314,9 +323,13 @@ function joined(left, right) {
314
323
  ...(reference === undefined ? {} : { reference }),
315
324
  ...(reference !== undefined && crossRoom ? { crossRoom: true } : {}),
316
325
  prose: left.prose && right.prose,
326
+ ...(title === undefined ? {} : { title }),
327
+ ...(left.markdown === true || right.markdown === true ? { markdown: true } : {}),
328
+ ...(left.json === true || right.json === true ? { json: true } : {}),
317
329
  ...(prefix === undefined ? {} : { prefix }),
318
330
  ...(items === undefined ? {} : { items }),
319
331
  ...(Object.keys(properties).length === 0 ? {} : { properties }),
332
+ ...(required.length === 0 ? {} : { required }),
320
333
  ...(patterns.length === 0 ? {} : { patterns }),
321
334
  ...(additional === undefined ? {} : { additional }),
322
335
  };
@@ -368,12 +381,78 @@ function inheritedOf(held) {
368
381
  return Object.keys(kept).length === 0 ? [] : [kept];
369
382
  });
370
383
  }
384
+ function typeSet(type) {
385
+ const listed = typeof type === 'string' ? [type] : Array.isArray(type) ? type : null;
386
+ return listed === null
387
+ ? null
388
+ : new Set(listed.map((one) => (one === 'integer' ? 'number' : String(one))));
389
+ }
390
+ function valueType(value) {
391
+ if (value === null)
392
+ return 'null';
393
+ if (Array.isArray(value))
394
+ return 'array';
395
+ return typeof value;
396
+ }
397
+ function narrowed(left, right) {
398
+ if (left === null)
399
+ return right;
400
+ if (right === null)
401
+ return left;
402
+ return new Set([...left].filter((one) => right.has(one)));
403
+ }
404
+ export function admitted(nodes, defs, ancestry) {
405
+ const conjunction = conjoined(nodes.map((node) => ({ node, at: '' })), defs, ancestry);
406
+ let kept = null;
407
+ for (const { node } of conjunction.held) {
408
+ kept = narrowed(kept, typeSet(node.type));
409
+ if (Array.isArray(node.enum))
410
+ kept = narrowed(kept, new Set(node.enum.map(valueType)));
411
+ if (Object.hasOwn(node, 'const'))
412
+ kept = narrowed(kept, new Set([valueType(node.const)]));
413
+ for (const keyword of UNIONS) {
414
+ const branches = node[keyword];
415
+ if (!Array.isArray(branches))
416
+ continue;
417
+ let union = new Set();
418
+ for (const branch of branches) {
419
+ const one = admitted([branch], defs, conjunction.ancestry);
420
+ if (one === null) {
421
+ union = null;
422
+ break;
423
+ }
424
+ for (const type of one)
425
+ union.add(type);
426
+ }
427
+ kept = narrowed(kept, union);
428
+ }
429
+ }
430
+ return kept;
431
+ }
432
+ function structuredUnion(held, defs, ancestry) {
433
+ return held.some((node) => UNIONS.some((keyword) => Array.isArray(node[keyword]) &&
434
+ node[keyword].some((branch) => {
435
+ const types = admitted([branch], defs, ancestry);
436
+ return types === null || types.has('object') || types.has('array');
437
+ })));
438
+ }
439
+ function openWhole(held) {
440
+ return held.some((node) => OPENING.some((keyword) => node[keyword] === true));
441
+ }
442
+ function writtenAsJson(held, defs, ancestry) {
443
+ const types = admitted(held, defs, ancestry);
444
+ if (types === null || types.size !== 1)
445
+ return true;
446
+ return structuredUnion(held, defs, ancestry) || (types.has('object') && openWhole(held));
447
+ }
371
448
  function factsOf(nodes, defs, ancestry) {
372
- const { held, ancestry: reached } = conjoined(nodes, defs, ancestry);
449
+ const conjunction = conjoined(nodes.map((node) => ({ node, at: '' })), defs, ancestry);
450
+ const reached = conjunction.ancestry;
451
+ const held = conjunction.held.map(({ node }) => node);
373
452
  const inherited = inheritedOf(held);
374
- const variants = new Map(held
453
+ const variants = new Map(conjunction.held
375
454
  .flatMap(variantsOf)
376
- .map((branch) => [branch, factsOf([branch, ...inherited], defs, reached)]));
455
+ .map(({ node: branch }) => [branch, factsOf([branch, ...inherited], defs, reached)]));
377
456
  const unions = alternativesOf(held, variants);
378
457
  const alternatives = unions.map((kept) => kept.reduce(joined));
379
458
  const listed = [
@@ -414,13 +493,18 @@ function factsOf(nodes, defs, ancestry) {
414
493
  : Array.from({ length: Math.max(...tuples.map((tuple) => tuple.length)) }, (_, index) => factsOf(tuples.flatMap((tuple) => (index < tuple.length ? [tuple[index]] : [])), defs, reached))));
415
494
  const mapped = type === 'object' || type === undefined;
416
495
  const properties = mapped ? propertiesOf(held, variants, defs, reached) : undefined;
496
+ const required = mapped
497
+ ? [...new Set(held.flatMap((node) => (Array.isArray(node.required) ? node.required : [])))]
498
+ : [];
417
499
  const patterns = mapped
418
500
  ? held.flatMap((node) => Object.entries(isRecord(node.patternProperties) ? node.patternProperties : {}).map(([pattern, schema]) => ({ pattern, facts: factsOf([schema], defs, reached) })))
419
501
  : [];
420
502
  const opened = mapped
421
- ? held.flatMap((node) => [node.additionalProperties, node.unevaluatedProperties].filter(isRecord))
503
+ ? held.flatMap((node) => OPENING.map((keyword) => (node[keyword] === true ? {} : node[keyword])).filter(isRecord))
422
504
  : [];
423
505
  const additional = opened.length === 0 ? undefined : factsOf(opened, defs, reached);
506
+ const title = firstOf(nodes.filter(isRecord), (node) => typeof node.title === 'string' ? node.title : undefined);
507
+ const markdown = held.some((node) => node.contentMediaType === MEDIA_TYPES.markdown);
424
508
  return {
425
509
  ...(type === undefined ? {} : { type }),
426
510
  ...(format === undefined ? {} : { format }),
@@ -428,9 +512,13 @@ function factsOf(nodes, defs, ancestry) {
428
512
  ...(reference === undefined ? {} : { reference }),
429
513
  ...(reference !== undefined && crossRoom ? { crossRoom: true } : {}),
430
514
  prose,
515
+ ...(title === undefined ? {} : { title }),
516
+ ...(markdown ? { markdown: true } : {}),
517
+ ...(writtenAsJson(held, defs, ancestry) ? { json: true } : {}),
431
518
  ...(prefix === undefined ? {} : { prefix }),
432
519
  ...(items === undefined ? {} : { items }),
433
520
  ...(properties === undefined ? {} : { properties }),
521
+ ...(required.length === 0 ? {} : { required }),
434
522
  ...(patterns.length === 0 ? {} : { patterns }),
435
523
  ...(additional === undefined ? {} : { additional }),
436
524
  };
@@ -457,7 +545,7 @@ export function fieldFacts(definition, key) {
457
545
  return definition.fields[key];
458
546
  if (Object.hasOwn(HOUSE_KEYS, key))
459
547
  return undefined;
460
- return memberFacts(definition.frontmatter, key);
548
+ return memberFacts(definition.root, key);
461
549
  }
462
550
  function stepped({ facts, through, conditional }, token) {
463
551
  if (facts.type === 'array' && ARRAY_INDEX.test(token)) {
@@ -515,87 +603,60 @@ function reachedDefs(value, defs, reached) {
515
603
  reachedDefs(held, defs, reached);
516
604
  }
517
605
  }
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 };
606
+ function untitledSchema(node) {
607
+ if (!isRecord(node))
608
+ return node;
609
+ const kept = {};
610
+ for (const [key, held] of Object.entries(node)) {
611
+ if (key === 'title' && typeof held === 'string')
536
612
  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);
613
+ const check = Object.hasOwn(KEYWORDS, key) ? KEYWORDS[key] : undefined;
614
+ if (check === SCHEMA)
615
+ kept[key] = untitledSchema(held);
616
+ else if (check === SCHEMA_LIST && Array.isArray(held))
617
+ kept[key] = held.map(untitledSchema);
618
+ else if (check === SCHEMA_MAP && isRecord(held))
619
+ kept[key] = untitledMap(held);
620
+ else
621
+ kept[key] = held;
564
622
  }
565
- return undefined;
623
+ return kept;
566
624
  }
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 };
625
+ function untitledMap(map) {
626
+ return Object.fromEntries(Object.entries(map).map(([key, held]) => [key, untitledSchema(held)]));
627
+ }
628
+ function untitledFacts(facts) {
629
+ const { title: _title, prefix, items, properties, patterns, additional, ...kept } = facts;
630
+ return {
631
+ ...kept,
632
+ ...(prefix === undefined ? {} : { prefix: prefix.map(untitledFacts) }),
633
+ ...(items === undefined ? {} : { items: untitledFacts(items) }),
634
+ ...(properties === undefined
635
+ ? {}
636
+ : {
637
+ properties: Object.fromEntries(Object.entries(properties).map(([key, held]) => [key, untitledFacts(held)])),
638
+ }),
639
+ ...(patterns === undefined
640
+ ? {}
641
+ : {
642
+ patterns: patterns.map(({ pattern, facts: held }) => ({
643
+ pattern,
644
+ facts: untitledFacts(held),
645
+ })),
646
+ }),
647
+ ...(additional === undefined ? {} : { additional: untitledFacts(additional) }),
648
+ };
649
+ }
650
+ export function untitled(definition) {
651
+ return {
652
+ ...definition,
653
+ root: untitledFacts(definition.root),
654
+ fields: Object.fromEntries(Object.entries(definition.fields).map(([key, held]) => [key, untitledFacts(held)])),
655
+ shape: {
656
+ schema: untitledSchema(definition.shape.schema),
657
+ defs: untitledMap(definition.shape.defs),
658
+ },
659
+ };
599
660
  }
600
661
  function deepFreeze(value) {
601
662
  if (value !== null && typeof value === 'object' && !Object.isFrozen(value)) {
@@ -729,22 +790,16 @@ function readType(name, value, context) {
729
790
  const at = `/${escapePointer(name)}`;
730
791
  if (!isRecord(value))
731
792
  return refuse('schema', at);
732
- const { sections: declared, member_document: mark, create_roles: createRoles, delete_roles: deleteRoles, ...ruled } = value;
793
+ const { member_document: mark, create_roles: createRoles, delete_roles: deleteRoles, indexed, ...ruled } = value;
733
794
  if (mark !== undefined && typeof mark !== 'boolean')
734
795
  return refuse('member_document', `${at}/member_document`);
735
796
  if (createRoles !== undefined && !roleNames(createRoles))
736
797
  return refuse('create_roles', `${at}/create_roles`);
737
798
  if (deleteRoles !== undefined && !roleNames(deleteRoles))
738
799
  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);
800
+ if (indexed !== undefined && !strings(indexed))
801
+ return refuse('indexed', `${at}/indexed`);
802
+ const { schema, written } = unruled(ruled);
748
803
  const failure = schemaFailure(schema, at, context);
749
804
  if (failure !== undefined)
750
805
  return failure;
@@ -764,16 +819,16 @@ function readType(name, value, context) {
764
819
  fields[MEMBER_FIELD] = { type: 'string', prose: false };
765
820
  const defs = Object.create(null);
766
821
  reachedDefs(value, context.defs, defs);
767
- const { create_roles: _create, delete_roles: _delete, ...shaped } = value;
822
+ const { create_roles: _create, delete_roles: _delete, indexed: _indexed, ...shaped } = value;
768
823
  return {
769
824
  name,
770
825
  memberDocument,
771
- frontmatter: { ...root, properties: { ...HOUSE_KEYS, ...fields } },
826
+ root: { ...root, properties: { ...HOUSE_KEYS, ...fields } },
772
827
  fields,
773
- sections: read.sections,
774
828
  rules,
775
829
  ...(createRoles === undefined ? {} : { createRoles }),
776
830
  ...(deleteRoles === undefined ? {} : { deleteRoles }),
831
+ ...(indexed === undefined ? {} : { indexed }),
777
832
  shape: {
778
833
  schema: written.size === 0 ? shaped : { ...shaped, properties: schema.properties },
779
834
  defs,
@@ -1,17 +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, 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 partText(part: string): string;
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;
15
22
  export declare function serialize(document: Document): string;
16
- export declare function frontmatter(document: Document): YamlMap | null;
17
23
  //# 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,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,WAAW,CAgB7D;AAmED,wBAAgB,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,UAAU,EACvB,IAAI,GAAE,WAAW,CAAC,MAAM,CAAa,GACpC,WAAW,CAuBb;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUrF;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,UAAU,CAkBZ;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,YAAY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