@agentshouse/mdmodel 0.1.0-c3c0e116a89f8 → 0.1.0-c3ebba90039b4

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 (545) hide show
  1. package/API.md +200 -196
  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 +28 -0
  9. package/dist/definition.d.ts +28 -11
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +250 -126
  12. package/dist/document.d.ts +12 -6
  13. package/dist/document.d.ts.map +1 -1
  14. package/dist/document.js +705 -105
  15. package/dist/event.d.ts +1 -2
  16. package/dist/event.d.ts.map +1 -1
  17. package/dist/event.js +4 -4
  18. package/dist/facts.d.ts.map +1 -1
  19. package/dist/facts.js +7 -4
  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/folders.d.ts +5 -0
  24. package/dist/folders.d.ts.map +1 -0
  25. package/dist/folders.js +19 -0
  26. package/dist/form.d.ts +4 -0
  27. package/dist/form.d.ts.map +1 -0
  28. package/dist/form.js +153 -0
  29. package/dist/house-model.d.ts +912 -0
  30. package/dist/house-model.d.ts.map +1 -0
  31. package/dist/house-model.js +502 -0
  32. package/dist/house-references/crockford.d.ts +4 -0
  33. package/dist/house-references/crockford.d.ts.map +1 -0
  34. package/dist/house-references/crockford.js +3 -0
  35. package/dist/house-references/patterns.d.ts +13 -0
  36. package/dist/house-references/patterns.d.ts.map +1 -0
  37. package/dist/house-references/patterns.js +20 -0
  38. package/dist/index.d.ts +30 -14
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +20 -10
  41. package/dist/indexed.d.ts +10 -0
  42. package/dist/indexed.d.ts.map +1 -0
  43. package/dist/indexed.js +63 -0
  44. package/dist/kinds.d.ts +9 -1
  45. package/dist/kinds.d.ts.map +1 -1
  46. package/dist/kinds.js +68 -0
  47. package/dist/markdown.d.ts +27 -7
  48. package/dist/markdown.d.ts.map +1 -1
  49. package/dist/markdown.js +25 -64
  50. package/dist/media-type.d.ts +72 -0
  51. package/dist/media-type.d.ts.map +1 -0
  52. package/dist/media-type.js +157 -0
  53. package/dist/moment.d.ts +7 -0
  54. package/dist/moment.d.ts.map +1 -0
  55. package/dist/moment.js +18 -0
  56. package/dist/not-ready.d.ts +2 -0
  57. package/dist/not-ready.d.ts.map +1 -0
  58. package/dist/not-ready.js +5 -0
  59. package/dist/paths.d.ts +16 -1
  60. package/dist/paths.d.ts.map +1 -1
  61. package/dist/paths.js +102 -21
  62. package/dist/query/language.d.ts +4 -1
  63. package/dist/query/language.d.ts.map +1 -1
  64. package/dist/query/language.js +4 -3
  65. package/dist/query/match.d.ts +1 -1
  66. package/dist/query/match.d.ts.map +1 -1
  67. package/dist/query/match.js +3 -24
  68. package/dist/query/rows.d.ts +6 -1
  69. package/dist/query/rows.d.ts.map +1 -1
  70. package/dist/query/rows.js +37 -8
  71. package/dist/query/sql.d.ts +10 -1
  72. package/dist/query/sql.d.ts.map +1 -1
  73. package/dist/query/sql.js +22 -3
  74. package/dist/query/walk.d.ts +73 -0
  75. package/dist/query/walk.d.ts.map +1 -0
  76. package/dist/query/walk.js +277 -0
  77. package/dist/references.d.ts +2 -2
  78. package/dist/references.d.ts.map +1 -1
  79. package/dist/references.js +1 -1
  80. package/dist/refuse.d.ts +1 -0
  81. package/dist/refuse.d.ts.map +1 -1
  82. package/dist/refuse.js +1 -0
  83. package/dist/reserved.d.ts +1 -0
  84. package/dist/reserved.d.ts.map +1 -1
  85. package/dist/reserved.js +15 -4
  86. package/dist/room-types.d.ts +8 -0
  87. package/dist/room-types.d.ts.map +1 -0
  88. package/dist/room-types.js +144 -0
  89. package/dist/schema.d.ts +1 -3
  90. package/dist/schema.d.ts.map +1 -1
  91. package/dist/schema.js +9 -73
  92. package/dist/types.d.ts +21 -38
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/validate.d.ts +8 -2
  95. package/dist/validate.d.ts.map +1 -1
  96. package/dist/validate.js +174 -174
  97. package/dist/view.d.ts +5 -0
  98. package/dist/view.d.ts.map +1 -0
  99. package/dist/view.js +27 -0
  100. package/dist/yaml.d.ts +7 -5
  101. package/dist/yaml.d.ts.map +1 -1
  102. package/dist/yaml.js +154 -33
  103. package/fixtures/README.md +93 -71
  104. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  105. package/fixtures/cases/absent-link-dangles/schema.md +7 -0
  106. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  107. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  108. package/fixtures/cases/absent-optional-field/{schema.yaml → schema.md} +12 -11
  109. package/fixtures/cases/absolute-link/library/item.md +1 -1
  110. package/fixtures/cases/absolute-link/schema.md +7 -0
  111. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  112. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  113. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  114. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  115. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  116. package/fixtures/cases/attachment-reference-any-file/{schema.yaml → schema.md} +2 -0
  117. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  118. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  119. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  120. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  121. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  122. package/fixtures/cases/attachment-reference-dangles/{schema.yaml → schema.md} +2 -0
  123. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  124. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  125. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  126. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  127. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  128. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  129. package/fixtures/cases/attachment-reference-outside/{schema.yaml → schema.md} +2 -0
  130. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  131. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  132. package/fixtures/cases/binary-any-reference/{schema.yaml → schema.md} +2 -0
  133. package/fixtures/cases/binary-document-collision/{schema.yaml → schema.md} +2 -0
  134. package/fixtures/cases/binary-image-dangles/{schema.yaml → schema.md} +2 -0
  135. package/fixtures/cases/binary-link-dangles/{schema.yaml → schema.md} +2 -0
  136. package/fixtures/cases/binary-link-outside-collection/{schema.yaml → schema.md} +2 -0
  137. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  138. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  139. package/fixtures/cases/binary-prototype-reference/{schema.yaml → schema.md} +2 -0
  140. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  141. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  142. package/fixtures/cases/binary-typed-reference/{schema.yaml → schema.md} +2 -0
  143. package/fixtures/cases/block-scalar-frontmatter/library/notes/literal.md +17 -0
  144. package/fixtures/cases/block-scalar-frontmatter/library/skills/notes/SKILL.md +10 -0
  145. package/fixtures/cases/boolean-field/expected.json +2 -1
  146. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  147. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  148. package/fixtures/cases/boolean-field/{schema.yaml → schema.md} +12 -11
  149. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  150. package/fixtures/cases/bracketed-link-definition/schema.md +7 -0
  151. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  152. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  153. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  154. package/fixtures/cases/closed-nested-object/{schema.yaml → schema.md} +12 -11
  155. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  156. package/fixtures/cases/composed-root-reference/{schema.yaml → schema.md} +2 -0
  157. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  158. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  159. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  160. package/fixtures/cases/conditional-long-text/schema.md +15 -0
  161. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  162. package/fixtures/cases/cross-room-link/{schema.yaml → schema.md} +2 -0
  163. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  164. package/fixtures/cases/cross-room-reference/{schema.yaml → schema.md} +3 -2
  165. package/fixtures/cases/date-time-format/expected.json +2 -1
  166. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  167. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  168. package/fixtures/cases/date-time-format/{schema.yaml → schema.md} +12 -11
  169. package/fixtures/cases/declared-binary-links/schema.md +3 -0
  170. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  171. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  172. package/fixtures/cases/default-unfilled/schema.md +57 -0
  173. package/fixtures/cases/defs-pattern/expected.json +2 -1
  174. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  175. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  176. package/fixtures/cases/defs-pattern/schema.md +57 -0
  177. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  178. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  179. package/fixtures/cases/dependent-rule/schema.md +57 -0
  180. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  181. package/fixtures/cases/duplicate-link-definition/schema.md +7 -0
  182. package/fixtures/cases/email-format/expected.json +2 -1
  183. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  184. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  185. package/fixtures/cases/email-format/schema.md +57 -0
  186. package/fixtures/cases/equal-labels/expected.json +5 -0
  187. package/fixtures/cases/equal-labels/schema.md +6 -0
  188. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  189. package/fixtures/cases/fenced-link-definition/schema.md +7 -0
  190. package/fixtures/cases/field-enum/expected.json +2 -1
  191. package/fixtures/cases/field-enum/library/item.md +2 -2
  192. package/fixtures/cases/field-enum/schema.md +8 -0
  193. package/fixtures/cases/folder-keeps-a-built-in-type/expected.json +1 -0
  194. package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/door.md +3 -0
  195. package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/host.md +13 -0
  196. package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/map.md +24 -0
  197. package/fixtures/cases/folder-keeps-a-built-in-type/library/tickets/open.md +13 -0
  198. package/fixtures/cases/folder-keeps-a-built-in-type/schema.md +9 -0
  199. package/fixtures/cases/folder-names-no-type-of-the-schema/expected.json +5 -0
  200. package/fixtures/cases/folder-names-no-type-of-the-schema/schema.md +7 -0
  201. package/fixtures/cases/folder-nearer-entry-types-a-document/expected.json +6 -0
  202. package/fixtures/cases/folder-nearer-entry-types-a-document/library/tickets/archive/2025/old.md +1 -0
  203. package/fixtures/cases/folder-nearer-entry-types-a-document/schema.md +15 -0
  204. package/fixtures/cases/folder-refuses-a-declared-any/expected.json +6 -0
  205. package/fixtures/cases/folder-refuses-a-declared-any/library/tickets/door.md +5 -0
  206. package/fixtures/cases/folder-refuses-a-declared-any/schema.md +9 -0
  207. package/fixtures/cases/folder-refuses-another-declared-type/expected.json +6 -0
  208. package/fixtures/cases/folder-refuses-another-declared-type/library/tickets/door.md +5 -0
  209. package/fixtures/cases/folder-refuses-another-declared-type/schema.md +12 -0
  210. package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/expected.json +1 -0
  211. package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/notes/plan.md +7 -0
  212. package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/tickets/door.md +3 -0
  213. package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/library/tickets/gate.md +7 -0
  214. package/fixtures/cases/folder-type-is-the-type-a-reference-reaches/schema.md +13 -0
  215. package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/expected.json +6 -0
  216. package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/library/tickets/2026/gate.md +1 -0
  217. package/fixtures/cases/folder-types-a-document-in-a-folder-below-it/schema.md +9 -0
  218. package/fixtures/cases/folder-types-a-document-that-names-no-type/expected.json +7 -0
  219. package/fixtures/cases/folder-types-a-document-that-names-no-type/library/tickets/door.md +3 -0
  220. package/fixtures/cases/folder-types-a-document-that-names-no-type/schema.md +9 -0
  221. package/fixtures/cases/folder-under-a-reserved-name/expected.json +5 -0
  222. package/fixtures/cases/folder-under-a-reserved-name/schema.md +7 -0
  223. package/fixtures/cases/folder-without-a-trailing-slash/context.json +1 -0
  224. package/fixtures/cases/folder-without-a-trailing-slash/expected.json +5 -0
  225. package/fixtures/cases/folder-without-a-trailing-slash/schema.md +7 -0
  226. package/fixtures/cases/frontmatter-construct/context.json +1 -0
  227. package/fixtures/cases/frontmatter-construct/expected.json +7 -0
  228. package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
  229. package/fixtures/cases/integer-field/expected.json +2 -1
  230. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  231. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  232. package/fixtures/cases/integer-field/schema.md +57 -0
  233. package/fixtures/cases/interrupted-link-definition/schema.md +3 -0
  234. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  235. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  236. package/fixtures/cases/json-schema-constructs/schema.md +57 -0
  237. package/fixtures/cases/labels-in-the-rooms-language/context.json +1 -0
  238. package/fixtures/cases/labels-in-the-rooms-language/expected.json +1 -0
  239. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  240. package/fixtures/cases/labels-in-the-rooms-language/schema.md +11 -0
  241. package/fixtures/cases/lazy-list-item/library/item.md +3 -1
  242. package/fixtures/cases/lazy-list-item/schema.md +5 -0
  243. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
  244. package/fixtures/cases/link-into-a-reserved-name/{schema.yaml → schema.md} +2 -0
  245. package/fixtures/cases/list-item-enum/context.json +1 -0
  246. package/fixtures/cases/list-item-enum/expected.json +7 -0
  247. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  248. package/fixtures/cases/list-item-enum/schema.md +5 -0
  249. package/fixtures/cases/list-item-kind/context.json +1 -0
  250. package/fixtures/cases/list-item-kind/expected.json +7 -0
  251. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  252. package/fixtures/cases/list-item-kind/schema.md +5 -0
  253. package/fixtures/cases/list-items/context.json +1 -0
  254. package/fixtures/cases/list-items/expected.json +1 -0
  255. package/fixtures/cases/list-items/library/page.md +26 -0
  256. package/fixtures/cases/list-items/schema.md +12 -0
  257. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  258. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  259. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  260. package/fixtures/cases/list-of-objects-closed/schema.md +57 -0
  261. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  262. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  263. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  264. package/fixtures/cases/list-of-objects-item/schema.md +57 -0
  265. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  266. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  267. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  268. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  269. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  270. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  271. package/fixtures/cases/list-of-objects-reference/{schema.yaml → schema.md} +2 -0
  272. package/fixtures/cases/list-reference-path/context.json +1 -0
  273. package/fixtures/cases/list-reference-path/expected.json +7 -0
  274. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  275. package/fixtures/cases/list-reference-path/schema.md +5 -0
  276. package/fixtures/cases/list-reference-type/context.json +1 -0
  277. package/fixtures/cases/list-reference-type/expected.json +7 -0
  278. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  279. package/fixtures/cases/list-reference-type/schema.md +5 -0
  280. package/fixtures/cases/list-size/expected.json +2 -1
  281. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  282. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  283. package/fixtures/cases/list-size/schema.md +57 -0
  284. package/fixtures/cases/long-fence-link-definition/schema.md +3 -0
  285. package/fixtures/cases/long-value-past-six-levels/context.json +1 -0
  286. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  287. package/fixtures/cases/long-value-past-six-levels/schema.md +17 -0
  288. package/fixtures/cases/malformed-definition/{schema.yaml → schema.md} +2 -0
  289. package/fixtures/cases/malformed-list/context.json +1 -0
  290. package/fixtures/cases/malformed-list/expected.json +7 -0
  291. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  292. package/fixtures/cases/malformed-list/schema.md +8 -0
  293. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  294. package/fixtures/cases/member-document/{schema.yaml → schema.md} +2 -0
  295. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  296. package/fixtures/cases/member-on-another-type/{schema.yaml → schema.md} +2 -0
  297. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  298. package/fixtures/cases/missing-required-field/schema.md +8 -0
  299. package/fixtures/cases/misspelled-key/expected.json +2 -1
  300. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  301. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  302. package/fixtures/cases/misspelled-key/schema.md +57 -0
  303. package/fixtures/cases/name-not-a-string/context.json +1 -0
  304. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  305. package/fixtures/cases/name-not-a-string/schema.md +7 -0
  306. package/fixtures/cases/nested-defs/expected.json +2 -1
  307. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  308. package/fixtures/cases/nested-defs/{schema.yaml → schema.md} +2 -0
  309. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  310. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  311. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  312. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  313. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  314. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  315. package/fixtures/cases/nested-object-reference/schema.md +34 -0
  316. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  317. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  318. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  319. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  320. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  321. package/fixtures/cases/nested-reference/schema.md +34 -0
  322. package/fixtures/cases/nested-required-field/expected.json +2 -1
  323. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  324. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  325. package/fixtures/cases/nested-required-field/schema.md +57 -0
  326. package/fixtures/cases/numeric-range/expected.json +2 -1
  327. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  328. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  329. package/fixtures/cases/numeric-range/schema.md +57 -0
  330. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  331. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  332. package/fixtures/cases/one-key-two-labels/schema.md +7 -0
  333. package/fixtures/cases/one-key-two-types/context.json +1 -0
  334. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  335. package/fixtures/cases/one-key-two-types/schema.md +6 -0
  336. package/fixtures/cases/one-of-variant/expected.json +2 -1
  337. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  338. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  339. package/fixtures/cases/one-of-variant/schema.md +57 -0
  340. package/fixtures/cases/other-room-reference/expected.json +2 -1
  341. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  342. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  343. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  344. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  345. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  346. package/fixtures/cases/other-room-reference/schema.md +34 -0
  347. package/fixtures/cases/paragraph-link-definition/schema.md +3 -0
  348. package/fixtures/cases/prototype-field/expected.json +2 -1
  349. package/fixtures/cases/prototype-field/library/item.md +2 -2
  350. package/fixtures/cases/prototype-field/schema.md +7 -0
  351. package/fixtures/cases/quoted-link-definition/schema.md +3 -0
  352. package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
  353. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
  354. package/fixtures/cases/reference-into-a-reserved-name/{schema.yaml → schema.md} +2 -0
  355. package/fixtures/cases/reference-to-any-file-name/context.json +1 -0
  356. package/fixtures/cases/reference-to-any-file-name/expected.json +1 -0
  357. package/fixtures/cases/reference-to-any-file-name/library/people/100%.md +4 -0
  358. package/fixtures/cases/reference-to-any-file-name/library/people/C#.md +4 -0
  359. package/fixtures/cases/reference-to-any-file-name/library/people/My notes.md +4 -0
  360. package/fixtures/cases/reference-to-any-file-name/library/people/[draft].md +4 -0
  361. package/fixtures/cases/reference-to-any-file-name/library/people/c (d).md +4 -0
  362. package/fixtures/cases/reference-to-any-file-name/library/people/caf/303/251.md +4 -0
  363. package/fixtures/cases/reference-to-any-file-name/library/people//320/236/321/202/321/207/321/221/321/202.md +4 -0
  364. package/fixtures/cases/reference-to-any-file-name/library/tasks/bracket.md +9 -0
  365. package/fixtures/cases/reference-to-any-file-name/library/tasks/cyrillic.md +9 -0
  366. package/fixtures/cases/reference-to-any-file-name/library/tasks/decomposed.md +9 -0
  367. package/fixtures/cases/reference-to-any-file-name/library/tasks/hash.md +9 -0
  368. package/fixtures/cases/reference-to-any-file-name/library/tasks/parenthesis.md +9 -0
  369. package/fixtures/cases/reference-to-any-file-name/library/tasks/percent.md +9 -0
  370. package/fixtures/cases/reference-to-any-file-name/library/tasks/spaced.md +9 -0
  371. package/fixtures/cases/reference-to-any-file-name/schema.md +12 -0
  372. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  373. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  374. package/fixtures/cases/referenced-missing-file/schema.md +12 -0
  375. package/fixtures/cases/referenced-missing-non-latin-file/context.json +1 -0
  376. package/fixtures/cases/referenced-missing-non-latin-file/expected.json +6 -0
  377. package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/a.md +9 -0
  378. package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/b.md +9 -0
  379. package/fixtures/cases/referenced-missing-non-latin-file/schema.md +12 -0
  380. package/fixtures/cases/remote-ref/{schema.yaml → schema.md} +2 -0
  381. package/fixtures/cases/schema-body-ignored/context.json +1 -0
  382. package/fixtures/cases/schema-body-ignored/expected.json +1 -0
  383. package/fixtures/cases/schema-body-ignored/schema.md +9 -0
  384. package/fixtures/cases/schema-type-named-folders/context.json +1 -0
  385. package/fixtures/cases/schema-type-named-folders/expected.json +5 -0
  386. package/fixtures/cases/schema-type-named-folders/schema.md +5 -0
  387. package/fixtures/cases/schema-type-named-type/context.json +1 -0
  388. package/fixtures/cases/schema-type-named-type/expected.json +5 -0
  389. package/fixtures/cases/{unknown-type/schema.yaml → schema-type-named-type/schema.md} +3 -1
  390. package/fixtures/cases/second-member-document/{schema.yaml → schema.md} +2 -0
  391. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  392. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  393. package/fixtures/cases/{structured-section/schema.yaml → sections-keyword-refused/schema.md} +3 -2
  394. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  395. package/fixtures/cases/shortcut-reference-link/schema.md +7 -0
  396. package/fixtures/cases/string-length/expected.json +2 -1
  397. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  398. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  399. package/fixtures/cases/string-length/schema.md +57 -0
  400. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  401. package/fixtures/cases/submission-keys/{schema.yaml → schema.md} +2 -0
  402. package/fixtures/cases/text-field-kind/expected.json +1 -4
  403. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  404. package/fixtures/cases/text-field-kind/{schema.yaml → schema.md} +2 -0
  405. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  406. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  407. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  408. package/fixtures/cases/thematic-break-ends-the-values/schema.md +5 -0
  409. package/fixtures/cases/truncated-link-definition/schema.md +3 -0
  410. package/fixtures/cases/{typed-path-names-its-type/schema.yaml → typed-path-names-another-type/schema.md} +2 -0
  411. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
  412. package/fixtures/cases/{typed-path-names-no-type/schema.yaml → typed-path-names-its-type/schema.md} +2 -0
  413. package/fixtures/cases/{typed-path-names-another-type/schema.yaml → typed-path-names-no-type/schema.md} +2 -0
  414. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  415. package/fixtures/cases/types-folder-content/{schema.yaml → schema.md} +2 -0
  416. package/fixtures/cases/undeclared-field/expected.json +2 -1
  417. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  418. package/fixtures/cases/undeclared-field/schema.md +7 -0
  419. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  420. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  421. package/fixtures/cases/unevaluated-items-closed/{schema.yaml → schema.md} +2 -0
  422. package/fixtures/cases/unique-in-app-schema/context.json +1 -0
  423. package/fixtures/cases/unique-in-app-schema/expected.json +5 -0
  424. package/fixtures/cases/unique-in-app-schema/schema.yaml +7 -0
  425. package/fixtures/cases/unique-indexed-field/context.json +1 -0
  426. package/fixtures/cases/unique-indexed-field/expected.json +1 -0
  427. package/fixtures/cases/unique-indexed-field/library/tickets/first.md +8 -0
  428. package/fixtures/cases/unique-indexed-field/library/tickets/second.md +8 -0
  429. package/fixtures/cases/unique-indexed-field/schema.md +9 -0
  430. package/fixtures/cases/unique-off-indexed-field/context.json +1 -0
  431. package/fixtures/cases/unique-off-indexed-field/expected.json +5 -0
  432. package/fixtures/cases/unique-off-indexed-field/schema.md +9 -0
  433. package/fixtures/cases/unlisted-reference-type/{schema.yaml → schema.md} +2 -0
  434. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
  435. package/fixtures/cases/{unnamed-typed-path-without-a-body/schema.yaml → unnamed-typed-path-checks-its-fields/schema.md} +2 -0
  436. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
  437. package/fixtures/cases/{unnamed-typed-path-checks-its-fields/schema.yaml → unnamed-typed-path-names-a-type/schema.md} +2 -0
  438. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
  439. package/fixtures/cases/{unnamed-typed-path-names-a-type/schema.yaml → unnamed-typed-path-reads-its-type/schema.md} +2 -0
  440. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
  441. package/fixtures/cases/{unnamed-typed-path-reads-its-type/schema.yaml → unnamed-typed-path-without-a-body/schema.md} +2 -0
  442. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  443. package/fixtures/cases/unresolved-link/schema.md +7 -0
  444. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  445. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  446. package/fixtures/cases/valid-typed-document/schema.md +17 -0
  447. package/fixtures/cases/wide-item-fence-link/schema.md +3 -0
  448. package/fixtures/forms.json +371 -0
  449. package/fixtures/preamble.json +6 -6
  450. package/fixtures/queries.json +827 -2
  451. package/fixtures/references.json +15 -0
  452. package/package.json +2 -2
  453. package/dist/divide.d.ts +0 -3
  454. package/dist/divide.d.ts.map +0 -1
  455. package/dist/divide.js +0 -321
  456. package/dist/project.d.ts +0 -22
  457. package/dist/project.d.ts.map +0 -1
  458. package/dist/project.js +0 -123
  459. package/fixtures/cases/absent-link-dangles/schema.yaml +0 -6
  460. package/fixtures/cases/absolute-link/schema.yaml +0 -6
  461. package/fixtures/cases/bracketed-link-definition/schema.yaml +0 -6
  462. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  463. package/fixtures/cases/declared-binary-links/schema.yaml +0 -1
  464. package/fixtures/cases/default-unfilled/schema.yaml +0 -56
  465. package/fixtures/cases/defs-pattern/schema.yaml +0 -56
  466. package/fixtures/cases/dependent-rule/schema.yaml +0 -56
  467. package/fixtures/cases/duplicate-link-definition/schema.yaml +0 -6
  468. package/fixtures/cases/email-format/schema.yaml +0 -56
  469. package/fixtures/cases/fenced-link-definition/schema.yaml +0 -6
  470. package/fixtures/cases/field-enum/schema.yaml +0 -7
  471. package/fixtures/cases/frontmatter-schema/expected.json +0 -5
  472. package/fixtures/cases/integer-field/schema.yaml +0 -56
  473. package/fixtures/cases/interrupted-link-definition/schema.yaml +0 -1
  474. package/fixtures/cases/json-schema-constructs/schema.yaml +0 -56
  475. package/fixtures/cases/lazy-list-item/schema.yaml +0 -3
  476. package/fixtures/cases/list-of-objects-closed/schema.yaml +0 -56
  477. package/fixtures/cases/list-of-objects-item/schema.yaml +0 -56
  478. package/fixtures/cases/list-size/schema.yaml +0 -56
  479. package/fixtures/cases/long-fence-link-definition/schema.yaml +0 -1
  480. package/fixtures/cases/missing-required-field/schema.yaml +0 -7
  481. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  482. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  483. package/fixtures/cases/misspelled-key/schema.yaml +0 -56
  484. package/fixtures/cases/nested-object-reference/schema.yaml +0 -32
  485. package/fixtures/cases/nested-reference/schema.yaml +0 -32
  486. package/fixtures/cases/nested-required-field/schema.yaml +0 -56
  487. package/fixtures/cases/null-refused/expected.json +0 -6
  488. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  489. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  490. package/fixtures/cases/null-refused/schema.yaml +0 -56
  491. package/fixtures/cases/numeric-range/schema.yaml +0 -56
  492. package/fixtures/cases/one-of-variant/schema.yaml +0 -56
  493. package/fixtures/cases/open-map-value/expected.json +0 -6
  494. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  495. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  496. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  497. package/fixtures/cases/other-room-reference/schema.yaml +0 -32
  498. package/fixtures/cases/paragraph-link-definition/schema.yaml +0 -1
  499. package/fixtures/cases/prototype-field/schema.yaml +0 -6
  500. package/fixtures/cases/quoted-link-definition/schema.yaml +0 -1
  501. package/fixtures/cases/referenced-missing-file/schema.yaml +0 -11
  502. package/fixtures/cases/section-item-enum/expected.json +0 -6
  503. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  504. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  505. package/fixtures/cases/section-item-kind/expected.json +0 -6
  506. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  507. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  508. package/fixtures/cases/section-items/library/page.md +0 -42
  509. package/fixtures/cases/section-items/schema.yaml +0 -10
  510. package/fixtures/cases/section-reference-path/expected.json +0 -6
  511. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  512. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  513. package/fixtures/cases/section-reference-type/expected.json +0 -6
  514. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  515. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  516. package/fixtures/cases/shortcut-reference-link/schema.yaml +0 -6
  517. package/fixtures/cases/string-length/schema.yaml +0 -56
  518. package/fixtures/cases/structured-section/expected.json +0 -6
  519. package/fixtures/cases/thematic-break-in-a-list-section/expected.json +0 -6
  520. package/fixtures/cases/thematic-break-in-a-list-section/library/item.md +0 -7
  521. package/fixtures/cases/thematic-break-in-a-list-section/schema.yaml +0 -3
  522. package/fixtures/cases/truncated-link-definition/schema.yaml +0 -1
  523. package/fixtures/cases/undeclared-field/schema.yaml +0 -6
  524. package/fixtures/cases/unresolved-link/schema.yaml +0 -6
  525. package/fixtures/cases/valid-typed-document/schema.yaml +0 -16
  526. package/fixtures/cases/wide-item-fence-link/schema.yaml +0 -1
  527. package/fixtures/division.json +0 -454
  528. package/fixtures/projection.json +0 -358
  529. /package/fixtures/cases/{conditional-section → block-scalar-frontmatter}/context.json +0 -0
  530. /package/fixtures/cases/{section-items → block-scalar-frontmatter}/expected.json +0 -0
  531. /package/fixtures/cases/{frontmatter-schema → conditional-long-text}/context.json +0 -0
  532. /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
  533. /package/fixtures/cases/{null-refused → folder-keeps-a-built-in-type}/context.json +0 -0
  534. /package/fixtures/cases/{open-map-value → folder-names-no-type-of-the-schema}/context.json +0 -0
  535. /package/fixtures/cases/{section-item-enum → folder-nearer-entry-types-a-document}/context.json +0 -0
  536. /package/fixtures/cases/{section-item-kind → folder-refuses-a-declared-any}/context.json +0 -0
  537. /package/fixtures/cases/{section-items → folder-refuses-another-declared-type}/context.json +0 -0
  538. /package/fixtures/cases/{section-reference-path → folder-type-is-the-type-a-reference-reaches}/context.json +0 -0
  539. /package/fixtures/cases/{section-reference-type → folder-types-a-document-in-a-folder-below-it}/context.json +0 -0
  540. /package/fixtures/cases/{structured-section → folder-types-a-document-that-names-no-type}/context.json +0 -0
  541. /package/fixtures/cases/{thematic-break-in-a-list-section → folder-under-a-reserved-name}/context.json +0 -0
  542. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  543. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  544. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
  545. /package/fixtures/cases/{frontmatter-schema/schema.yaml → unknown-type/schema.md} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
2
  export type { Actor, DocumentEvent, DocumentFacts, Fact, ItemFacts, MessageFacts, Resolved, WriteDoor, } from './event.js';
3
- export { byCodePoint, compared, dated, fitsKind, instant, instantKey, kindOf, kindWords, } from './kinds.js';
3
+ export { byCodePoint, compared, dated, fieldKey, fitsKind, indexKey, instant, instantKey, kindOf, kindWords, } from './kinds.js';
4
4
  export type { Kind, Ordering } from './kinds.js';
5
+ export { folderType } from './folders.js';
5
6
  export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
6
7
  export type { Clause, Continuation, Direction, DocumentQuery, DocumentShape, Filter, GroupKey, GroupOrder, GroupQuery, GroupSelect, GroupShape, HeldRooms, Key, KeyPlan, LocalQuery, OrderOptions, Place, Predicate, QueryErrorCode, QueryPlan, Related, RoomFacts, Scope, Select, Test, Value, Where, } from './query/language.js';
8
+ export { countOf, countShape, hopTargets, pageOrder, walkedValue, walkOf } from './query/walk.js';
9
+ export type { Count, HopTarget, KeyBound, KeyRange, PageOrder, Walk, WalkedFacts, WalkRun, } from './query/walk.js';
10
+ export { verifyIndexBounds } from './indexed.js';
11
+ export type { IndexBounds } from './indexed.js';
7
12
  export { heldAt, matches } from './query/match.js';
8
13
  export type { Candidate } from './query/match.js';
9
14
  export { heldKind, indexed } from './query/rows.js';
@@ -11,23 +16,34 @@ export type { HeldKind, HeldLink, HeldValue, Indexed, Reach } from './query/rows
11
16
  export * as sql from './query/sql.js';
12
17
  export { headingLines } from './markdown.js';
13
18
  export type { HeadingLine } from './markdown.js';
14
- export { divide } from './divide.js';
15
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
19
+ export { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
20
+ export { shownDay, shownMoment } from './moment.js';
21
+ export type { MomentReader } from './moment.js';
22
+ export { labelAt, NAME_FIELD } from './body.js';
23
+ export type { Naming } from './body.js';
24
+ export { apply, bodyLinks, create, links, linkSpans, parse, partText, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
16
25
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
26
+ export { notReadyWaitMs } from './not-ready.js';
17
27
  export type { ReferenceTarget, SavedFacts } from './facts.js';
18
- export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
19
- export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
28
+ export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './house-references/crockford.js';
29
+ export { HOUSE_FIELDS, MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
30
+ export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
31
+ export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
32
+ export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ATTACHMENT_REFERENCE_PATTERN, ATTACHMENT_REFERENCE_PREFIX, DOCUMENT_REFERENCE_PATTERN, DOCUMENT_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, REVISION_REFERENCE_PATTERN, REVISION_REFERENCE_PREFIX, ROOM_REFERENCE_PREFIX, SPACE_REFERENCE_PATTERN, SPACE_REFERENCE_PREFIX, } from './house-references/patterns.js';
33
+ export type { HouseDocumentFields, HouseModelType } from './house-model.js';
34
+ export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES, VIEW_TYPE, } from './room-types.js';
35
+ export type { InboxChannelKind } from './room-types.js';
36
+ export { destinationText, keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, urlDestination, } from './paths.js';
20
37
  export { openPatternBudget } from './pattern.js';
21
- export type { RoomTarget } from './paths.js';
22
- export { project } from './project.js';
38
+ export type { LinkedPath, RoomTarget } from './paths.js';
23
39
  export { references } from './references.js';
24
- export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
25
- export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
26
- export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, SectionSpec, Shape, Transition, ValueFacts, } from './definition.js';
27
- export type { ApplyResult, BodyResult, Change, Division, DivisionContext, Document, DocumentCheck, Frontmatter, FrontmatterResult, Library, ModelVerification, Link, ParseResult, Projection, ProjectionContext, Reached, Reference, Refusal, RoomReference, Span, TypedPath, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
28
- export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
40
+ export { CAPTURE_HOME, foldedName, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
41
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
42
+ export type { Definition, FieldRules, JsonType, PatternFacts, PointerFacts, RuleValue, Shape, Transition, ValueFacts, } from './definition.js';
43
+ export type { ApplyResult, BodyResult, Change, DefinitionOf, Document, DocumentCheck, Extent, Library, ModelVerification, Link, ParseResult, Reached, Reference, Refusal, RoleNeed, RoomReference, Span, TypedPath, LinkSpan, UnlinkedBody, Validation, ValidationContext, ValidationStep, VerifiedModel, } from './types.js';
44
+ export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readSchemaDocument, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, verifySchemaDocument, } from './validate.js';
29
45
  export type { Assessment, Verdicts } from './validate.js';
30
46
  export { VERSION } from './version.js';
31
- export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
32
- export type { FrontmatterValue } from './yaml.js';
47
+ export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
48
+ export type { DocumentValue } from './yaml.js';
33
49
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,KAAK,EACL,cAAc,EACd,OAAO,EACP,OAAO,EACP,UAAU,EACV,UAAU,EACV,YAAY,EACZ,WAAW,GACZ,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,KAAK,E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b,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,cAAc,EACd,QAAQ,EACR,cAAc,EACd,UAAU,EACV,QAAQ,EACR,MAAM,EACN,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACnF,YAAY,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1,20 +1,30 @@
1
1
  export { candidateOf, datePointers, facts, memberPointers, members, pointed, prosePaths, TEXT_FIELD, valuedChange, WRITE_DOORS, } from './event.js';
2
- export { byCodePoint, compared, dated, fitsKind, instant, instantKey, kindOf, kindWords, } from './kinds.js';
2
+ export { byCodePoint, compared, dated, fieldKey, fitsKind, indexKey, instant, instantKey, kindOf, kindWords, } from './kinds.js';
3
+ export { folderType } from './folders.js';
3
4
  export { bodied, cursorOf, decodedCursor, identityOf, invalid, known, placeText, planOf, QueryError, queryKey, } from './query/language.js';
5
+ export { countOf, countShape, hopTargets, pageOrder, walkedValue, walkOf } from './query/walk.js';
6
+ export { verifyIndexBounds } from './indexed.js';
4
7
  export { heldAt, matches } from './query/match.js';
5
8
  export { heldKind, indexed } from './query/rows.js';
6
9
  export * as sql from './query/sql.js';
7
10
  export { headingLines } from './markdown.js';
8
- export { divide } from './divide.js';
9
- export { apply, bodyLinks, links, parse, parseFrontmatter, relativize, relativizeBody, relinkBody, serialize, unlinkBody, } from './document.js';
11
+ export { acceptsType, dataUrl, dataUrlPattern, declaresUtf8, FILE_MEDIA_TYPES, fileExtension, formDataType, gitMediaType, isAudioType, isImageType, isVideoType, MEDIA_TYPES, mediaTypeEssence, SCRIPT_MEDIA_TYPES, servedMediaType, UTF8_TEXT, withCharset, } from './media-type.js';
12
+ export { shownDay, shownMoment } from './moment.js';
13
+ export { labelAt, NAME_FIELD } from './body.js';
14
+ export { apply, bodyLinks, create, links, linkSpans, parse, partText, relabel, relabels, relativize, relativizeBody, relinkBody, serialize, textSpans, unlinkBody, } from './document.js';
10
15
  export { documentFacts, referenceTarget, referenceTargets } from './facts.js';
11
- export { HOUSE_FIELDS, MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD, TYPE_FIELD } from './fields.js';
12
- export { relative, retarget, roomPath, roomTarget, target } from './paths.js';
16
+ export { notReadyWaitMs } from './not-ready.js';
17
+ export { CROCKFORD_ALPHABET, CROCKFORD_CHARACTER, CROCKFORD_LEADING_CHARACTER, } from './house-references/crockford.js';
18
+ export { HOUSE_FIELDS, MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
19
+ export { HOUSE_MODEL, HOUSE_ROOM_TYPES } from './built-in.js';
20
+ export { APP_PREFERENCES_HOME, HOUSE_MODEL_DECLARATION, HOUSE_TYPED_PATHS } from './house-model.js';
21
+ export { APP_REFERENCE_PATTERN, APP_REFERENCE_PREFIX, ATTACHMENT_REFERENCE_PATTERN, ATTACHMENT_REFERENCE_PREFIX, DOCUMENT_REFERENCE_PATTERN, DOCUMENT_REFERENCE_PREFIX, ROOM_REFERENCE_PATTERN, REVISION_REFERENCE_PATTERN, REVISION_REFERENCE_PREFIX, ROOM_REFERENCE_PREFIX, SPACE_REFERENCE_PATTERN, SPACE_REFERENCE_PREFIX, } from './house-references/patterns.js';
22
+ export { CHAT_MESSAGE_TYPE, CHAT_TYPE, INBOX_CHANNEL_KINDS, INBOX_TYPES, VIEW_TYPE, } from './room-types.js';
23
+ export { destinationText, keyedDestination, keyedLink, linkedPath, relative, retarget, roomPath, roomTarget, target, urlDestination, } from './paths.js';
13
24
  export { openPatternBudget } from './pattern.js';
14
- export { project } from './project.js';
15
25
  export { references } from './references.js';
16
- export { CAPTURE_HOME, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
17
- export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, } from './definition.js';
18
- export { assess, assessReferences, bodyRoomLinks, checkDocument, readTypes, resolves, roomReferences, validate, validating, verdicts, verify, } from './validate.js';
26
+ export { CAPTURE_HOME, foldedName, isDocumentPath, isReservedName, RESERVED_NAMES, ROOM_DESCRIPTION, } from './reserved.js';
27
+ export { ARRAY_INDEX, ATTACHMENT, crossedFacts, escapePointer, itemFacts, JSON_POINTER, memberFacts, pointerFacts, pointerSegments, untitled, } from './definition.js';
28
+ export { assess, assessReferences, bodyKeyedLinks, bodyRoomLinks, checkDocument, definitionAt, readSchemaDocument, readTypes, resolves, roomReferences, validate, validateParsed, validating, verdicts, verify, verifySchemaDocument, } from './validate.js';
19
29
  export { VERSION } from './version.js';
20
- export { bodyAfterFrontmatter, equalValue, frontmatterValue, plain } from './yaml.js';
30
+ export { bodyAfterFrontmatter, documentValue, equalValue, plain } from './yaml.js';
@@ -0,0 +1,10 @@
1
+ import { type Failure } from './definition.js';
2
+ import type { ModelVerification, VerifiedModel } from './types.js';
3
+ export type IndexBounds = {
4
+ readonly perType: number;
5
+ readonly longestText: number;
6
+ };
7
+ export declare function indexedFailure(model: VerifiedModel): Failure | undefined;
8
+ export declare function uniqueFailure(model: VerifiedModel): Failure | undefined;
9
+ export declare function verifyIndexBounds(model: VerifiedModel, bounds: IndexBounds): ModelVerification;
10
+ //# sourceMappingURL=indexed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexed.d.ts","sourceRoot":"","sources":["../src/indexed.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,OAAO,EACb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGnE,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AA+CrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,CAQxE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,GAAG,SAAS,CAOvE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,GAAG,iBAAiB,CAW9F"}
@@ -0,0 +1,63 @@
1
+ import { admitted, conjoined, escapePointer, refuse, UNIONS, } from './definition.js';
2
+ import { HOUSE_FIELDS } from './fields.js';
3
+ import { kindOf } from './kinds.js';
4
+ import { isRecord } from './yaml.js';
5
+ const PLAIN = ['string', 'number', 'boolean'];
6
+ const UNBOUNDED_KINDS = ['enum', 'date', 'date-time', 'time'];
7
+ function declarations(definition, field) {
8
+ const { schema, defs } = definition.shape;
9
+ return conjoined([{ node: schema, at: '' }], defs, new Set()).held.flatMap(({ node }) => isRecord(node.properties) && Object.hasOwn(node.properties, field)
10
+ ? [node.properties[field]]
11
+ : []);
12
+ }
13
+ function indexable(definition, field) {
14
+ if (HOUSE_FIELDS.includes(field) || !Object.hasOwn(definition.fields, field))
15
+ return null;
16
+ const facts = definition.fields[field];
17
+ if (facts.markdown === true || facts.reference !== undefined)
18
+ return null;
19
+ const declared = declarations(definition, field);
20
+ const { defs } = definition.shape;
21
+ const held = conjoined(declared.map((node) => ({ node, at: '' })), defs, new Set()).held.map(({ node }) => node);
22
+ if (held.length === 0 ||
23
+ held.some((node) => UNIONS.some((keyword) => node[keyword] !== undefined)))
24
+ return null;
25
+ const types = admitted(declared, defs, new Set());
26
+ const plain = types === null ? [] : [...types].filter((type) => type !== 'null');
27
+ if (plain.length !== 1 || !PLAIN.includes(plain[0]))
28
+ return null;
29
+ if (plain[0] !== 'string' || UNBOUNDED_KINDS.includes(kindOf(facts) ?? ''))
30
+ return { text: null };
31
+ const lengths = held.flatMap((node) => typeof node.maxLength === 'number' ? [node.maxLength] : []);
32
+ return lengths.length === 0 ? null : { text: Math.min(...lengths) };
33
+ }
34
+ function at(name, index) {
35
+ return `/${escapePointer(name)}/indexed/${index}`;
36
+ }
37
+ export function indexedFailure(model) {
38
+ for (const [name, definition] of Object.entries(model.types)) {
39
+ const index = (definition.indexed ?? []).findIndex((field) => indexable(definition, field) === null);
40
+ if (index !== -1)
41
+ return refuse('indexed', at(name, index));
42
+ }
43
+ return undefined;
44
+ }
45
+ export function uniqueFailure(model) {
46
+ for (const [name, definition] of Object.entries(model.types)) {
47
+ const [field] = definition.unique ?? [];
48
+ if (field !== undefined)
49
+ return refuse('unique', `/${escapePointer(name)}/properties/${escapePointer(field)}/unique`);
50
+ }
51
+ return undefined;
52
+ }
53
+ export function verifyIndexBounds(model, bounds) {
54
+ for (const [name, definition] of Object.entries(model.types)) {
55
+ const indexed = definition.indexed ?? [];
56
+ if (indexed.length > bounds.perType)
57
+ return { verdict: 'refuse', rule: 'indexed', location: at(name, bounds.perType) };
58
+ const index = indexed.findIndex((field) => (indexable(definition, field)?.text ?? 0) > bounds.longestText);
59
+ if (index !== -1)
60
+ return { verdict: 'refuse', rule: 'indexed', location: at(name, index) };
61
+ }
62
+ return { verdict: 'accept', model };
63
+ }
package/dist/kinds.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ValueFacts } from './definition.js';
1
+ import type { Definition, ValueFacts } from './definition.js';
2
2
  export type Kind = 'string' | 'number' | 'integer' | 'boolean' | 'date' | 'date-time' | 'time' | 'enum' | 'reference';
3
3
  export type Ordering = {
4
4
  readonly direction: 'asc' | 'desc';
@@ -13,6 +13,14 @@ export declare function kindWords(facts: ValueFacts | undefined): readonly strin
13
13
  export declare function dated(value: unknown): value is string;
14
14
  export declare function instant(value: unknown): bigint | undefined;
15
15
  export declare function instantKey(value: unknown): string | null;
16
+ export declare function instantOf(facts: ValueFacts | undefined, value: unknown): string | null;
17
+ export declare function indexKey(facts: ValueFacts, value: unknown): Uint8Array;
18
+ export declare function fieldKey(definition: Pick<Definition, 'fields' | 'unique'>, fields: Readonly<Record<string, unknown>>, field: string): {
19
+ readonly value: unknown;
20
+ readonly key: string;
21
+ readonly unique: boolean;
22
+ };
23
+ export declare function sortedKey(value: unknown): Uint8Array | null;
16
24
  export declare function byCodePoint(left: string, right: string): number;
17
25
  export declare function compared(left: unknown, right: unknown, ordering: Ordering): number;
18
26
  //# sourceMappingURL=kinds.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"kinds.d.ts","sourceRoot":"","sources":["../src/kinds.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,MAAM,MAAM,IAAI,GACZ,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,SAAS,GACT,MAAM,GACN,WAAW,GACX,MAAM,GACN,MAAM,GACN,WAAW,CAAC;AAEhB,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,aAAa,EAAE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;CAC1D,CAAC;AASF,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAWrD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE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AQ,EAAE,QAAQ,GAAG,MAAM,CAMlF"}
package/dist/kinds.js CHANGED
@@ -3,6 +3,10 @@ import { normalize } from './paths.js';
3
3
  const DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt\s](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:[Zz]|([+-])(\d{2})(?::?(\d{2}))?)$/u;
4
4
  const BEFORE_YEAR_ZERO = 62200000000000000000n;
5
5
  const INSTANT_DIGITS = 21;
6
+ const MISSING_KEY = 0;
7
+ const NUMBER_KEYS = 1;
8
+ const INSTANT_KEYS = 2;
9
+ const TEXT_KEYS = 3;
6
10
  export function kindOf(facts) {
7
11
  if (facts.reference !== undefined)
8
12
  return 'reference';
@@ -86,6 +90,70 @@ export function instantKey(value) {
86
90
  const at = instant(value);
87
91
  return at === undefined ? null : (at + BEFORE_YEAR_ZERO).toString().padStart(INSTANT_DIGITS, '0');
88
92
  }
93
+ export function instantOf(facts, value) {
94
+ return facts !== undefined && kindOf(facts) === 'date-time' ? instantKey(value) : null;
95
+ }
96
+ function utf8(text) {
97
+ const bytes = [];
98
+ for (const char of text) {
99
+ const code = char.codePointAt(0);
100
+ if (code < 0x80)
101
+ bytes.push(code);
102
+ else if (code < 0x800)
103
+ bytes.push(0xc0 | (code >> 6), 0x80 | (code & 0x3f));
104
+ else if (code < 0x10000)
105
+ bytes.push(0xe0 | (code >> 12), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f));
106
+ else
107
+ bytes.push(0xf0 | (code >> 18), 0x80 | ((code >> 12) & 0x3f), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f));
108
+ }
109
+ return bytes;
110
+ }
111
+ function numberKey(value) {
112
+ const key = new Uint8Array(9);
113
+ const view = new DataView(key.buffer);
114
+ view.setUint8(0, NUMBER_KEYS);
115
+ view.setFloat64(1, value === 0 ? 0 : value);
116
+ const sign = view.getUint8(1);
117
+ if (sign < 0x80)
118
+ view.setUint8(1, sign | 0x80);
119
+ else
120
+ for (let at = 1; at < key.length; at += 1)
121
+ view.setUint8(at, ~view.getUint8(at) & 0xff);
122
+ return key;
123
+ }
124
+ export function indexKey(facts, value) {
125
+ if (value === undefined || value === null)
126
+ return Uint8Array.of(MISSING_KEY);
127
+ if (typeof value === 'boolean')
128
+ return numberKey(value ? 1 : 0);
129
+ if (typeof value === 'number')
130
+ return numberKey(value);
131
+ if (typeof value !== 'string')
132
+ throw new Error('an indexed value is a number, a boolean or a string');
133
+ const at = instantOf(facts, value);
134
+ return at === null
135
+ ? Uint8Array.of(TEXT_KEYS, ...utf8(value))
136
+ : Uint8Array.of(INSTANT_KEYS, ...utf8(at));
137
+ }
138
+ export function fieldKey(definition, fields, field) {
139
+ const value = Object.hasOwn(fields, field) ? fields[field] : undefined;
140
+ return {
141
+ value,
142
+ key: Array.from(indexKey(definition.fields[field], value), (byte) => byte.toString(16).padStart(2, '0')).join(''),
143
+ unique: value !== undefined && value !== null && definition.unique?.includes(field) === true,
144
+ };
145
+ }
146
+ export function sortedKey(value) {
147
+ if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
148
+ const { instant, ...rest } = value;
149
+ return typeof instant === 'string' && Object.keys(rest).length === 0
150
+ ? Uint8Array.of(INSTANT_KEYS, ...utf8(instant))
151
+ : null;
152
+ }
153
+ return value === null || ['boolean', 'number', 'string'].includes(typeof value)
154
+ ? indexKey({ prose: false }, value)
155
+ : null;
156
+ }
89
157
  function rank(value) {
90
158
  if (typeof value === 'boolean' || typeof value === 'number')
91
159
  return 1;
@@ -1,4 +1,3 @@
1
- import type { Extent } from './types.js';
2
1
  export type HeadingLine = {
3
2
  readonly level: number;
4
3
  readonly name: string;
@@ -24,17 +23,41 @@ export type DefinitionBlock = {
24
23
  readonly end: number;
25
24
  readonly destination: HrefOccurrence;
26
25
  };
27
- export type Block = Extent & {
28
- readonly items: readonly Extent[] | null;
26
+ export type Node = {
27
+ readonly type: string;
28
+ readonly position?: {
29
+ readonly start: {
30
+ readonly offset?: number;
31
+ };
32
+ readonly end: {
33
+ readonly offset?: number;
34
+ };
35
+ };
36
+ readonly children?: readonly Node[];
37
+ readonly depth?: number;
38
+ readonly identifier?: string;
39
+ readonly checked?: boolean | null;
40
+ readonly ordered?: boolean | null;
41
+ readonly lang?: string | null;
42
+ readonly value?: string;
29
43
  };
30
44
  export type Reading = {
31
45
  readonly headings: readonly HeadingLine[];
32
- readonly blocks: readonly Block[];
33
46
  readonly uses: readonly LinkUse[];
34
47
  readonly definitions: readonly DefinitionBlock[];
48
+ readonly tree: readonly Node[];
49
+ readonly base: number;
50
+ };
51
+ export declare function lineBreaks(text: string): readonly number[];
52
+ export declare function lineNumber(breaks: readonly number[], offset: number): number;
53
+ export declare function lineStart(text: string, index: number): number;
54
+ export declare function lineEnd(text: string, index: number): {
55
+ readonly end: number;
56
+ readonly next: number;
35
57
  };
36
58
  export declare function read(text: string, at?: number): Reading;
37
59
  export declare function destinations(reading: Reading): readonly HrefOccurrence[];
60
+ export declare function linkable(text: string, from?: number): boolean;
38
61
  export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
39
62
  export declare function headingLines(content: string, from: number, to: number): HeadingLine[];
40
63
  export type SectionSpan = {
@@ -45,7 +68,4 @@ export type SectionSpan = {
45
68
  };
46
69
  export declare function sectionSpans(reading: Reading, end: number): SectionSpan[];
47
70
  export declare function sectionsRecord(spans: readonly SectionSpan[], content: string): Record<string, string>;
48
- export declare function headingsIn(reading: Reading, from: number, to: number): readonly HeadingLine[];
49
- export declare function listItems(reading: Reading, from: number, to: number): Extent[] | null;
50
- export declare function blockRanges(reading: Reading, from: number, to: number): Extent[];
51
71
  //# sourceMappingURL=markdown.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,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wElD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,cAAc,EAAE,CAIxE;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,SAAI,GAAG,OAAO,CAExD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAEvE;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,EAAE,CAErF;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,EAAE,CAczE;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,OAAO,EAAE,MAAM,GACd,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOxB"}
package/dist/markdown.js CHANGED
@@ -64,20 +64,35 @@ function marking(text, shift, marks, labelled) {
64
64
  case 'setextHeadingText':
65
65
  marked(marks, top).text = { start, end };
66
66
  return;
67
- case 'listItemPrefix':
68
- marked(marks, top).content = end;
69
- return;
70
67
  }
71
68
  },
72
69
  };
73
70
  }
74
- function lineStart(text, index) {
71
+ export function lineBreaks(text) {
72
+ const breaks = [];
73
+ for (let at = text.indexOf('\n'); at !== -1; at = text.indexOf('\n', at + 1))
74
+ breaks.push(at);
75
+ return breaks;
76
+ }
77
+ export function lineNumber(breaks, offset) {
78
+ let low = 0;
79
+ let high = breaks.length;
80
+ while (low < high) {
81
+ const middle = (low + high) >>> 1;
82
+ if (breaks[middle] < offset)
83
+ low = middle + 1;
84
+ else
85
+ high = middle;
86
+ }
87
+ return low + 1;
88
+ }
89
+ export function lineStart(text, index) {
75
90
  let at = index;
76
91
  while (at > 0 && text[at - 1] !== '\n' && text[at - 1] !== '\r')
77
92
  at -= 1;
78
93
  return at;
79
94
  }
80
- function lineEnd(text, index) {
95
+ export function lineEnd(text, index) {
81
96
  let at = index;
82
97
  while (at < text.length && text[at] !== '\n' && text[at] !== '\r')
83
98
  at += 1;
@@ -85,15 +100,6 @@ function lineEnd(text, index) {
85
100
  return { end: at, next: at };
86
101
  return { end: at, next: text[at] === '\r' && text[at + 1] === '\n' ? at + 2 : at + 1 };
87
102
  }
88
- function trimmed(text, start, end) {
89
- let from = start;
90
- let to = end;
91
- while (from < to && /\s/.test(text[from]))
92
- from += 1;
93
- while (to > from && /\s/.test(text[to - 1]))
94
- to -= 1;
95
- return { start: from, end: to };
96
- }
97
103
  function shifted(value, by) {
98
104
  return { ...value, start: value.start + by, end: value.end + by };
99
105
  }
@@ -123,7 +129,6 @@ export function read(text, at = 0) {
123
129
  });
124
130
  const local = (offset) => offset + shift;
125
131
  const headings = [];
126
- const blocks = [];
127
132
  for (const node of root.children ?? []) {
128
133
  let start = local(startOf(node));
129
134
  while (start > 0 && (text[start - 1] === ' ' || text[start - 1] === '\t'))
@@ -140,13 +145,6 @@ export function read(text, at = 0) {
140
145
  next: at + line.next,
141
146
  });
142
147
  }
143
- blocks.push({
144
- start: at + start,
145
- end: at + end,
146
- items: node.type === 'list'
147
- ? (node.children ?? []).map((item) => shifted(trimmed(text, marks.get(item)?.content ?? local(startOf(item)), local(endOf(item))), at))
148
- : null,
149
- });
150
148
  }
151
149
  const destinations = new Map();
152
150
  const definitions = [];
@@ -191,7 +189,7 @@ export function read(text, at = 0) {
191
189
  });
192
190
  }
193
191
  uses.sort((left, right) => left.start - right.start);
194
- return { headings, blocks, uses, definitions };
192
+ return { headings, uses, definitions, tree: root.children ?? [], base: at + shift };
195
193
  }
196
194
  export function destinations(reading) {
197
195
  const byStart = new Map();
@@ -199,8 +197,11 @@ export function destinations(reading) {
199
197
  byStart.set(use.destination.start, use.destination);
200
198
  return [...byStart.values()].sort((left, right) => left.start - right.start);
201
199
  }
200
+ export function linkable(text, from = 0) {
201
+ return text.includes('](', from) || text.includes(']:', from);
202
+ }
202
203
  export function hrefOccurrences(body) {
203
- return destinations(read(body));
204
+ return linkable(body) ? destinations(read(body)) : [];
204
205
  }
205
206
  export function headingLines(content, from, to) {
206
207
  return [...read(content.slice(from, to), from).headings];
@@ -229,43 +230,3 @@ export function sectionsRecord(spans, content) {
229
230
  }
230
231
  return record;
231
232
  }
232
- function firstPast(items, at, key) {
233
- let low = 0;
234
- let high = items.length;
235
- while (low < high) {
236
- const middle = (low + high) >>> 1;
237
- if (key(items[middle]) <= at)
238
- low = middle + 1;
239
- else
240
- high = middle;
241
- }
242
- return low;
243
- }
244
- function blocksIn(reading, from, to) {
245
- const blocks = reading.blocks;
246
- const first = firstPast(blocks, from, (block) => block.end);
247
- let end = first;
248
- while (end < blocks.length && blocks[end].start < to)
249
- end += 1;
250
- return blocks.slice(first, end);
251
- }
252
- export function headingsIn(reading, from, to) {
253
- const start = (heading) => heading.start;
254
- return reading.headings.slice(firstPast(reading.headings, from - 1, start), firstPast(reading.headings, to - 1, start));
255
- }
256
- export function listItems(reading, from, to) {
257
- const items = [];
258
- for (const block of blocksIn(reading, from, to)) {
259
- if (block.items === null)
260
- return null;
261
- items.push(...block.items);
262
- }
263
- return items;
264
- }
265
- export function blockRanges(reading, from, to) {
266
- const starts = blocksIn(reading, from, to).map((block) => block.start);
267
- return starts.map((start, index) => ({
268
- start: index === 0 ? from : start,
269
- end: starts[index + 1] ?? to,
270
- }));
271
- }
@@ -0,0 +1,72 @@
1
+ export declare const MEDIA_TYPES: {
2
+ readonly html: 'text/html';
3
+ readonly css: 'text/css';
4
+ readonly javascript: 'text/javascript';
5
+ readonly plainText: 'text/plain';
6
+ readonly markdown: 'text/markdown';
7
+ readonly csv: 'text/csv';
8
+ readonly json: 'application/json';
9
+ readonly xml: 'application/xml';
10
+ readonly yaml: 'application/yaml';
11
+ readonly ndjson: 'application/x-ndjson';
12
+ readonly webManifest: 'application/manifest+json';
13
+ readonly reports: 'application/reports+json';
14
+ readonly githubJson: 'application/vnd.github+json';
15
+ readonly form: 'application/x-www-form-urlencoded';
16
+ readonly octetStream: 'application/octet-stream';
17
+ readonly gzip: 'application/gzip';
18
+ readonly tar: 'application/x-tar';
19
+ readonly zip: 'application/zip';
20
+ readonly gitBundle: 'application/x-git-bundle';
21
+ readonly wasm: 'application/wasm';
22
+ readonly pdf: 'application/pdf';
23
+ readonly docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document';
24
+ readonly pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation';
25
+ readonly xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
26
+ readonly avif: 'image/avif';
27
+ readonly gif: 'image/gif';
28
+ readonly heic: 'image/heic';
29
+ readonly icon: 'image/vnd.microsoft.icon';
30
+ readonly jpeg: 'image/jpeg';
31
+ readonly png: 'image/png';
32
+ readonly svg: 'image/svg+xml';
33
+ readonly webp: 'image/webp';
34
+ readonly aac: 'audio/aac';
35
+ readonly amr: 'audio/amr';
36
+ readonly m4a: 'audio/mp4';
37
+ readonly mp3: 'audio/mpeg';
38
+ readonly ogg: 'audio/ogg';
39
+ readonly wav: 'audio/wav';
40
+ readonly threeGpp: 'video/3gpp';
41
+ readonly mp4: 'video/mp4';
42
+ readonly quickTime: 'video/quicktime';
43
+ readonly webm: 'video/webm';
44
+ readonly otf: 'font/otf';
45
+ readonly ttf: 'font/ttf';
46
+ readonly woff: 'font/woff';
47
+ readonly woff2: 'font/woff2';
48
+ };
49
+ export declare function withCharset(type: string, charset: string): string;
50
+ export declare const UTF8_TEXT: {
51
+ readonly html: string;
52
+ readonly css: string;
53
+ readonly javascript: string;
54
+ readonly plainText: string;
55
+ readonly markdown: string;
56
+ readonly xml: string;
57
+ };
58
+ export declare const SCRIPT_MEDIA_TYPES: readonly string[];
59
+ export declare const FILE_MEDIA_TYPES: Readonly<Record<string, string>>;
60
+ export declare function servedMediaType(path: string): string;
61
+ export declare function fileExtension(type: string): string | null;
62
+ export declare function dataUrl(type: string, base64: string): string;
63
+ export declare function dataUrlPattern(types: readonly string[]): RegExp;
64
+ export declare function formDataType(boundary: string): string;
65
+ export declare function gitMediaType(service: string, part: 'advertisement' | 'request' | 'result'): string;
66
+ export declare function mediaTypeEssence(value: string): string;
67
+ export declare function declaresUtf8(value: string): boolean;
68
+ export declare function acceptsType(accept: string | undefined, type: string): boolean;
69
+ export declare function isImageType(value: string): boolean;
70
+ export declare function isVideoType(value: string): boolean;
71
+ export declare function isAudioType(value: string): boolean;
72
+ //# sourceMappingURL=media-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-type.d.ts","sourceRoot":"","sources":["../src/media-type.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;aACtB,IAAI,EAAE,WAAW;aACjB,GAAG,EAAE,UAAU;aACf,UAAU,EAAE,iBAAiB;aAC7B,SAAS,EAAE,YAAY;aACvB,QAAQ,EAAE,eAAe;aACzB,GAAG,EAAE,UAAU;aACf,IAAI,EAAE,kBAAkB;aACxB,GAAG,EAAE,iBAAiB;aACtB,IAAI,EAAE,kBAAkB;aACxB,MAAM,EAAE,sBAAsB;aAC9B,WAAW,EAAE,2BAA2B;aACxC,OAAO,EAAE,0BAA0B;aACnC,UAAU,EAAE,6BAA6B;aACzC,IAAI,EAAE,mCAAmC;aACzC,WAAW,EAAE,0BAA0B;aACvC,IAAI,EAAE,kBAAkB;aACxB,GAAG,EAAE,mBAAmB;aACxB,GAAG,EAAE,iBAAiB;aACtB,SAAS,EAAE,0BAA0B;aACrC,IAAI,EAAE,kBAAkB;aACxB,GAAG,EAAE,iBAAiB;aACtB,IAAI,EAAE,yEAAyE;aAC/E,IAAI,EAAE,2EAA2E;aACjF,IA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