@agentshouse/mdmodel 0.1.0-cc58fdf3541b7 → 0.1.0-ccb295d7b1fee

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 (447) hide show
  1. package/API.md +229 -235
  2. package/README.md +27 -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 +24 -11
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +188 -128
  12. package/dist/document.d.ts +15 -9
  13. package/dist/document.d.ts.map +1 -1
  14. package/dist/document.js +769 -149
  15. package/dist/event.d.ts +77 -0
  16. package/dist/event.d.ts.map +1 -0
  17. package/dist/event.js +200 -0
  18. package/dist/facts.d.ts +15 -0
  19. package/dist/facts.d.ts.map +1 -0
  20. package/dist/facts.js +41 -0
  21. package/dist/fields.d.ts +1 -1
  22. package/dist/fields.d.ts.map +1 -1
  23. package/dist/fields.js +2 -2
  24. package/dist/form.d.ts +4 -0
  25. package/dist/form.d.ts.map +1 -0
  26. package/dist/form.js +153 -0
  27. package/dist/house-model.d.ts +930 -0
  28. package/dist/house-model.d.ts.map +1 -0
  29. package/dist/house-model.js +511 -0
  30. package/dist/house-references/crockford.d.ts +4 -0
  31. package/dist/house-references/crockford.d.ts.map +1 -0
  32. package/dist/house-references/crockford.js +3 -0
  33. package/dist/house-references/patterns.d.ts +9 -0
  34. package/dist/house-references/patterns.d.ts.map +1 -0
  35. package/dist/house-references/patterns.js +13 -0
  36. package/dist/index.d.ts +44 -17
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +27 -11
  39. package/dist/indexed.d.ts +9 -0
  40. package/dist/indexed.d.ts.map +1 -0
  41. package/dist/indexed.js +55 -0
  42. package/dist/kinds.d.ts +21 -0
  43. package/dist/kinds.d.ts.map +1 -0
  44. package/dist/kinds.js +210 -0
  45. package/dist/markdown.d.ts +71 -0
  46. package/dist/markdown.d.ts.map +1 -0
  47. package/dist/markdown.js +232 -0
  48. package/dist/media-type.d.ts +72 -0
  49. package/dist/media-type.d.ts.map +1 -0
  50. package/dist/media-type.js +157 -0
  51. package/dist/moment.d.ts +7 -0
  52. package/dist/moment.d.ts.map +1 -0
  53. package/dist/moment.js +18 -0
  54. package/dist/not-ready.d.ts +2 -0
  55. package/dist/not-ready.d.ts.map +1 -0
  56. package/dist/not-ready.js +5 -0
  57. package/dist/paths.d.ts +16 -1
  58. package/dist/paths.d.ts.map +1 -1
  59. package/dist/paths.js +107 -22
  60. package/dist/pattern.d.ts.map +1 -1
  61. package/dist/pattern.js +4 -3
  62. package/dist/query/language.d.ts +255 -0
  63. package/dist/query/language.d.ts.map +1 -0
  64. package/dist/query/language.js +620 -0
  65. package/dist/query/match.d.ts +14 -0
  66. package/dist/query/match.d.ts.map +1 -0
  67. package/dist/query/match.js +150 -0
  68. package/dist/query/rows.d.ts +32 -0
  69. package/dist/query/rows.d.ts.map +1 -0
  70. package/dist/query/rows.js +158 -0
  71. package/dist/query/sql.d.ts +43 -0
  72. package/dist/query/sql.d.ts.map +1 -0
  73. package/dist/query/sql.js +285 -0
  74. package/dist/query/walk.d.ts +63 -0
  75. package/dist/query/walk.d.ts.map +1 -0
  76. package/dist/query/walk.js +263 -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 +7 -0
  84. package/dist/reserved.d.ts.map +1 -0
  85. package/dist/reserved.js +32 -0
  86. package/dist/room-types.d.ts +7 -0
  87. package/dist/room-types.d.ts.map +1 -0
  88. package/dist/room-types.js +136 -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 +22 -43
  93. package/dist/types.d.ts.map +1 -1
  94. package/dist/validate.d.ts +12 -6
  95. package/dist/validate.d.ts.map +1 -1
  96. package/dist/validate.js +217 -179
  97. package/dist/yaml.d.ts +7 -5
  98. package/dist/yaml.d.ts.map +1 -1
  99. package/dist/yaml.js +158 -44
  100. package/fixtures/README.md +89 -69
  101. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  102. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  103. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  104. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  105. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  106. package/fixtures/cases/absolute-link/library/item.md +1 -1
  107. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  108. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  109. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  110. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  111. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  112. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  113. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  114. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  115. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  116. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  117. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  118. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  119. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  120. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  121. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  122. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  123. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  124. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  125. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  126. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  127. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  128. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  129. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  130. package/fixtures/cases/block-scalar-frontmatter/library/notes/literal.md +17 -0
  131. package/fixtures/cases/block-scalar-frontmatter/library/skills/notes/SKILL.md +10 -0
  132. package/fixtures/cases/boolean-field/expected.json +2 -1
  133. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  134. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  135. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  136. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  137. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  138. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  139. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  140. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  141. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  142. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  143. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  144. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  145. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  146. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  147. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  148. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  149. package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
  150. package/fixtures/cases/date-time-format/expected.json +2 -1
  151. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  152. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  153. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  154. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  155. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  156. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  157. package/fixtures/cases/defs-pattern/expected.json +2 -1
  158. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  159. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  160. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  161. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  162. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  163. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  164. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  165. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  166. package/fixtures/cases/email-format/expected.json +2 -1
  167. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  168. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  169. package/fixtures/cases/email-format/schema.yaml +10 -11
  170. package/fixtures/cases/equal-labels/expected.json +5 -0
  171. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  172. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  173. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  174. package/fixtures/cases/field-enum/expected.json +2 -1
  175. package/fixtures/cases/field-enum/library/item.md +2 -2
  176. package/fixtures/cases/field-enum/schema.yaml +3 -4
  177. package/fixtures/cases/frontmatter-construct/expected.json +7 -0
  178. package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
  179. package/fixtures/cases/integer-field/expected.json +2 -1
  180. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  181. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  182. package/fixtures/cases/integer-field/schema.yaml +10 -11
  183. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  184. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  185. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  186. package/fixtures/cases/labels-in-the-rooms-language/expected.json +1 -0
  187. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  188. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  189. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  190. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  191. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  192. package/fixtures/cases/link-into-a-reserved-name/expected.json +5 -0
  193. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +6 -0
  194. package/fixtures/cases/link-into-a-reserved-name/schema.yaml +3 -0
  195. package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/expected.json +5 -0
  196. package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/library/notes/b.md +5 -0
  197. package/fixtures/cases/list-item-enum/expected.json +7 -0
  198. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  199. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  200. package/fixtures/cases/list-item-kind/expected.json +7 -0
  201. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  202. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  203. package/fixtures/cases/list-items/context.json +1 -0
  204. package/fixtures/cases/list-items/expected.json +1 -0
  205. package/fixtures/cases/list-items/library/page.md +26 -0
  206. package/fixtures/cases/list-items/schema.yaml +10 -0
  207. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  208. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  209. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  210. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  211. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  212. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  213. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  214. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  215. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  216. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  217. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  218. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  219. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  220. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  221. package/fixtures/cases/list-reference-path/context.json +1 -0
  222. package/fixtures/cases/list-reference-path/expected.json +7 -0
  223. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  224. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  225. package/fixtures/cases/list-reference-type/context.json +1 -0
  226. package/fixtures/cases/list-reference-type/expected.json +7 -0
  227. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  228. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  229. package/fixtures/cases/list-size/expected.json +2 -1
  230. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  231. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  232. package/fixtures/cases/list-size/schema.yaml +10 -11
  233. package/fixtures/cases/long-value-past-six-levels/context.json +1 -0
  234. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  235. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  236. package/fixtures/cases/malformed-list/context.json +1 -0
  237. package/fixtures/cases/malformed-list/expected.json +7 -0
  238. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  239. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  240. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  241. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  242. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  243. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  244. package/fixtures/cases/misspelled-key/expected.json +2 -1
  245. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  246. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  247. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  248. package/fixtures/cases/name-not-a-string/context.json +1 -0
  249. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  250. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  251. package/fixtures/cases/nested-defs/expected.json +2 -1
  252. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  253. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  254. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  255. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  256. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  257. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  258. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  259. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  260. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  261. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  262. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  263. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  264. package/fixtures/cases/nested-required-field/expected.json +2 -1
  265. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  266. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  267. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  268. package/fixtures/cases/numeric-range/expected.json +2 -1
  269. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  270. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  271. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  272. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  273. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  274. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  275. package/fixtures/cases/one-key-two-types/context.json +1 -0
  276. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  277. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  278. package/fixtures/cases/one-of-variant/expected.json +2 -1
  279. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  280. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  281. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  282. package/fixtures/cases/other-room-reference/expected.json +2 -1
  283. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  284. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  285. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  286. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  287. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  288. package/fixtures/cases/prototype-field/expected.json +2 -1
  289. package/fixtures/cases/prototype-field/library/item.md +2 -2
  290. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  291. package/fixtures/cases/reference-into-a-reserved-name/context.json +1 -0
  292. package/fixtures/cases/reference-into-a-reserved-name/expected.json +7 -0
  293. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +4 -0
  294. package/fixtures/cases/reference-into-a-reserved-name/library/settings/brief.md +1 -0
  295. package/fixtures/cases/reference-into-a-reserved-name/schema.yaml +3 -0
  296. package/fixtures/cases/reference-to-any-file-name/context.json +1 -0
  297. package/fixtures/cases/reference-to-any-file-name/expected.json +1 -0
  298. package/fixtures/cases/reference-to-any-file-name/library/people/100%.md +4 -0
  299. package/fixtures/cases/reference-to-any-file-name/library/people/C#.md +4 -0
  300. package/fixtures/cases/reference-to-any-file-name/library/people/My notes.md +4 -0
  301. package/fixtures/cases/reference-to-any-file-name/library/people/[draft].md +4 -0
  302. package/fixtures/cases/reference-to-any-file-name/library/people/c (d).md +4 -0
  303. package/fixtures/cases/reference-to-any-file-name/library/people/caf/303/251.md +4 -0
  304. package/fixtures/cases/reference-to-any-file-name/library/people//320/236/321/202/321/207/321/221/321/202.md +4 -0
  305. package/fixtures/cases/reference-to-any-file-name/library/tasks/bracket.md +9 -0
  306. package/fixtures/cases/reference-to-any-file-name/library/tasks/cyrillic.md +9 -0
  307. package/fixtures/cases/reference-to-any-file-name/library/tasks/decomposed.md +9 -0
  308. package/fixtures/cases/reference-to-any-file-name/library/tasks/hash.md +9 -0
  309. package/fixtures/cases/reference-to-any-file-name/library/tasks/parenthesis.md +9 -0
  310. package/fixtures/cases/reference-to-any-file-name/library/tasks/percent.md +9 -0
  311. package/fixtures/cases/reference-to-any-file-name/library/tasks/spaced.md +9 -0
  312. package/fixtures/cases/reference-to-any-file-name/schema.yaml +10 -0
  313. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  314. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  315. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  316. package/fixtures/cases/referenced-missing-non-latin-file/context.json +1 -0
  317. package/fixtures/cases/referenced-missing-non-latin-file/expected.json +6 -0
  318. package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/a.md +9 -0
  319. package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/b.md +9 -0
  320. package/fixtures/cases/referenced-missing-non-latin-file/schema.yaml +10 -0
  321. package/fixtures/cases/room-md-declares-a-type/context.json +1 -0
  322. package/fixtures/cases/room-md-declares-a-type/expected.json +6 -0
  323. package/fixtures/cases/room-md-declares-a-type/library/ROOM.md +5 -0
  324. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  325. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  326. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  327. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  328. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  329. package/fixtures/cases/string-length/expected.json +2 -1
  330. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  331. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  332. package/fixtures/cases/string-length/schema.yaml +10 -11
  333. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  334. package/fixtures/cases/text-field-kind/expected.json +1 -4
  335. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  336. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  337. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  338. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  339. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  340. package/fixtures/cases/typed-path-names-another-type/context.json +11 -0
  341. package/fixtures/cases/typed-path-names-another-type/expected.json +6 -0
  342. package/fixtures/cases/typed-path-names-another-type/library/settings/prefs/one.md +3 -0
  343. package/fixtures/cases/typed-path-names-another-type/schema.yaml +6 -0
  344. package/fixtures/cases/typed-path-names-its-type/context.json +11 -0
  345. package/fixtures/cases/typed-path-names-its-type/expected.json +3 -0
  346. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/deeper/two.md +1 -0
  347. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +4 -0
  348. package/fixtures/cases/typed-path-names-its-type/schema.yaml +6 -0
  349. package/fixtures/cases/typed-path-names-no-type/context.json +11 -0
  350. package/fixtures/cases/typed-path-names-no-type/expected.json +6 -0
  351. package/fixtures/cases/typed-path-names-no-type/library/settings/prefs/one.md +1 -0
  352. package/fixtures/cases/typed-path-names-no-type/schema.yaml +6 -0
  353. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  354. package/fixtures/cases/undeclared-field/expected.json +2 -1
  355. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  356. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  357. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  358. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  359. package/fixtures/cases/unnamed-typed-path-checks-its-fields/context.json +11 -0
  360. package/fixtures/cases/unnamed-typed-path-checks-its-fields/expected.json +6 -0
  361. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +5 -0
  362. package/fixtures/cases/unnamed-typed-path-checks-its-fields/schema.yaml +5 -0
  363. package/fixtures/cases/unnamed-typed-path-names-a-type/context.json +11 -0
  364. package/fixtures/cases/unnamed-typed-path-names-a-type/expected.json +6 -0
  365. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +7 -0
  366. package/fixtures/cases/unnamed-typed-path-names-a-type/schema.yaml +5 -0
  367. package/fixtures/cases/unnamed-typed-path-reads-its-type/context.json +11 -0
  368. package/fixtures/cases/unnamed-typed-path-reads-its-type/expected.json +3 -0
  369. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/plan.md +1 -0
  370. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +6 -0
  371. package/fixtures/cases/unnamed-typed-path-reads-its-type/schema.yaml +5 -0
  372. package/fixtures/cases/unnamed-typed-path-without-a-body/context.json +11 -0
  373. package/fixtures/cases/unnamed-typed-path-without-a-body/expected.json +5 -0
  374. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +5 -0
  375. package/fixtures/cases/unnamed-typed-path-without-a-body/schema.yaml +5 -0
  376. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  377. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  378. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  379. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  380. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  381. package/fixtures/forms.json +371 -0
  382. package/fixtures/preamble.json +29 -8
  383. package/fixtures/queries.json +1359 -0
  384. package/package.json +10 -1
  385. package/dist/blocks.d.ts +0 -11
  386. package/dist/blocks.d.ts.map +0 -1
  387. package/dist/blocks.js +0 -91
  388. package/dist/condition.d.ts +0 -181
  389. package/dist/condition.d.ts.map +0 -1
  390. package/dist/condition.js +0 -633
  391. package/dist/divide.d.ts +0 -3
  392. package/dist/divide.d.ts.map +0 -1
  393. package/dist/divide.js +0 -320
  394. package/dist/links.d.ts +0 -29
  395. package/dist/links.d.ts.map +0 -1
  396. package/dist/links.js +0 -831
  397. package/dist/profile.d.ts +0 -6
  398. package/dist/profile.d.ts.map +0 -1
  399. package/dist/profile.js +0 -5
  400. package/dist/project.d.ts +0 -22
  401. package/dist/project.d.ts.map +0 -1
  402. package/dist/project.js +0 -128
  403. package/dist/sections.d.ts +0 -11
  404. package/dist/sections.d.ts.map +0 -1
  405. package/dist/sections.js +0 -57
  406. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  407. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  408. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  409. package/fixtures/cases/null-refused/expected.json +0 -6
  410. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  411. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  412. package/fixtures/cases/null-refused/schema.yaml +0 -56
  413. package/fixtures/cases/open-map-value/expected.json +0 -6
  414. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  415. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  416. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  417. package/fixtures/cases/section-item-enum/expected.json +0 -6
  418. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  419. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  420. package/fixtures/cases/section-item-kind/expected.json +0 -6
  421. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  422. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  423. package/fixtures/cases/section-items/library/page.md +0 -42
  424. package/fixtures/cases/section-items/schema.yaml +0 -10
  425. package/fixtures/cases/section-reference-path/expected.json +0 -6
  426. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  427. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  428. package/fixtures/cases/section-reference-type/expected.json +0 -6
  429. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  430. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  431. package/fixtures/cases/structured-section/expected.json +0 -6
  432. package/fixtures/division.json +0 -409
  433. package/fixtures/projection.json +0 -255
  434. /package/fixtures/cases/{conditional-section → block-scalar-frontmatter}/context.json +0 -0
  435. /package/fixtures/cases/{section-items → block-scalar-frontmatter}/expected.json +0 -0
  436. /package/fixtures/cases/{missing-section-item-kind → conditional-long-text}/context.json +0 -0
  437. /package/fixtures/cases/{null-refused → equal-labels}/context.json +0 -0
  438. /package/fixtures/cases/{open-map-value → frontmatter-construct}/context.json +0 -0
  439. /package/fixtures/cases/{section-item-enum → labels-in-the-rooms-language}/context.json +0 -0
  440. /package/fixtures/cases/{section-item-kind → lazy-list-item}/context.json +0 -0
  441. /package/fixtures/cases/{section-reference-path → link-into-a-reserved-name}/context.json +0 -0
  442. /package/fixtures/cases/{section-items → link-into-a-reserved-name-from-an-untyped-document}/context.json +0 -0
  443. /package/fixtures/cases/{section-reference-type → list-item-enum}/context.json +0 -0
  444. /package/fixtures/cases/{structured-section → list-item-kind}/context.json +0 -0
  445. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  446. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  447. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
@@ -0,0 +1,232 @@
1
+ import { fromMarkdown, } from 'mdast-util-from-markdown';
2
+ import { gfmFootnoteFromMarkdown } from 'mdast-util-gfm-footnote';
3
+ import { gfmStrikethroughFromMarkdown } from 'mdast-util-gfm-strikethrough';
4
+ import { gfmTableFromMarkdown } from 'mdast-util-gfm-table';
5
+ import { gfmTaskListItemFromMarkdown } from 'mdast-util-gfm-task-list-item';
6
+ import { gfmFootnote } from 'micromark-extension-gfm-footnote';
7
+ import { gfmStrikethrough } from 'micromark-extension-gfm-strikethrough';
8
+ import { gfmTable } from 'micromark-extension-gfm-table';
9
+ import { gfmTaskListItem } from 'micromark-extension-gfm-task-list-item';
10
+ const BYTE_ORDER_MARK = 0xfeff;
11
+ const LINKED = new Set(['link', 'image', 'linkReference', 'imageReference']);
12
+ const REFERENCED = new Set(['linkReference', 'imageReference']);
13
+ const SYNTAX = [gfmFootnote(), gfmStrikethrough(), gfmTable(), gfmTaskListItem()];
14
+ function startOf(node) {
15
+ return node.position.start.offset;
16
+ }
17
+ function endOf(node) {
18
+ return node.position.end.offset;
19
+ }
20
+ function marked(marks, node) {
21
+ let mark = marks.get(node);
22
+ if (mark === undefined) {
23
+ mark = {};
24
+ marks.set(node, mark);
25
+ }
26
+ return mark;
27
+ }
28
+ function marking(text, shift, marks, labelled) {
29
+ const at = (point) => point.offset + shift;
30
+ return {
31
+ afterExit(token) {
32
+ const top = this.stack[this.stack.length - 1];
33
+ const start = at(token.start);
34
+ const end = at(token.end);
35
+ switch (token.type) {
36
+ case 'labelText': {
37
+ const node = this.stack[this.stack.length - 2];
38
+ marked(marks, node).label = { start, end };
39
+ labelled.push(node);
40
+ return;
41
+ }
42
+ case 'resourceDestinationLiteral':
43
+ case 'definitionDestinationLiteral':
44
+ marked(marks, top).destination = {
45
+ href: text.slice(start + 1, end - 1),
46
+ start,
47
+ end,
48
+ bracketed: true,
49
+ };
50
+ return;
51
+ case 'resourceDestinationRaw':
52
+ case 'definitionDestinationRaw':
53
+ marked(marks, top).destination = {
54
+ href: text.slice(start, end),
55
+ start,
56
+ end,
57
+ bracketed: false,
58
+ };
59
+ return;
60
+ case 'resource':
61
+ marked(marks, top).resourceEnd = end;
62
+ return;
63
+ case 'atxHeadingText':
64
+ case 'setextHeadingText':
65
+ marked(marks, top).text = { start, end };
66
+ return;
67
+ }
68
+ },
69
+ };
70
+ }
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) {
90
+ let at = index;
91
+ while (at > 0 && text[at - 1] !== '\n' && text[at - 1] !== '\r')
92
+ at -= 1;
93
+ return at;
94
+ }
95
+ export function lineEnd(text, index) {
96
+ let at = index;
97
+ while (at < text.length && text[at] !== '\n' && text[at] !== '\r')
98
+ at += 1;
99
+ if (at === text.length)
100
+ return { end: at, next: at };
101
+ return { end: at, next: text[at] === '\r' && text[at + 1] === '\n' ? at + 2 : at + 1 };
102
+ }
103
+ function shifted(value, by) {
104
+ return { ...value, start: value.start + by, end: value.end + by };
105
+ }
106
+ function walked(root, visit) {
107
+ const pending = [root];
108
+ while (pending.length > 0) {
109
+ const node = pending.pop();
110
+ visit(node);
111
+ const children = node.children ?? [];
112
+ for (let index = children.length - 1; index >= 0; index -= 1)
113
+ pending.push(children[index]);
114
+ }
115
+ }
116
+ export function read(text, at = 0) {
117
+ const marks = new WeakMap();
118
+ const labelled = [];
119
+ const shift = text.charCodeAt(0) === BYTE_ORDER_MARK ? 1 : 0;
120
+ const root = fromMarkdown(text, {
121
+ extensions: SYNTAX,
122
+ mdastExtensions: [
123
+ gfmFootnoteFromMarkdown(),
124
+ gfmStrikethroughFromMarkdown(),
125
+ gfmTableFromMarkdown(),
126
+ gfmTaskListItemFromMarkdown(),
127
+ marking(text, shift, marks, labelled),
128
+ ],
129
+ });
130
+ const local = (offset) => offset + shift;
131
+ const headings = [];
132
+ for (const node of root.children ?? []) {
133
+ let start = local(startOf(node));
134
+ while (start > 0 && (text[start - 1] === ' ' || text[start - 1] === '\t'))
135
+ start -= 1;
136
+ const end = local(endOf(node));
137
+ if (node.type === 'heading') {
138
+ const name = marks.get(node)?.text;
139
+ const line = lineEnd(text, end);
140
+ headings.push({
141
+ level: node.depth,
142
+ name: name === undefined ? '' : text.slice(name.start, name.end),
143
+ start: at + start,
144
+ textEnd: at + line.end,
145
+ next: at + line.next,
146
+ });
147
+ }
148
+ }
149
+ const destinations = new Map();
150
+ const definitions = [];
151
+ walked(root, (node) => {
152
+ const mark = marks.get(node);
153
+ if (node.type !== 'definition' || mark?.destination === undefined)
154
+ return;
155
+ const destination = shifted(mark.destination, at);
156
+ if (!destinations.has(node.identifier))
157
+ destinations.set(node.identifier, destination);
158
+ definitions.push({
159
+ start: at + lineStart(text, local(startOf(node))),
160
+ end: at + lineEnd(text, local(endOf(node))).next,
161
+ destination,
162
+ });
163
+ });
164
+ const uses = [];
165
+ for (const node of labelled) {
166
+ if (!LINKED.has(node.type))
167
+ continue;
168
+ const mark = marks.get(node);
169
+ const destination = REFERENCED.has(node.type)
170
+ ? destinations.get(node.identifier)
171
+ : mark.destination !== undefined
172
+ ? shifted(mark.destination, at)
173
+ : mark.resourceEnd === undefined
174
+ ? undefined
175
+ : {
176
+ href: '',
177
+ start: at + mark.resourceEnd - 1,
178
+ end: at + mark.resourceEnd - 1,
179
+ bracketed: false,
180
+ };
181
+ if (destination === undefined)
182
+ continue;
183
+ uses.push({
184
+ start: at + local(startOf(node)),
185
+ end: at + local(endOf(node)),
186
+ labelStart: at + mark.label.start,
187
+ labelEnd: at + mark.label.end,
188
+ destination,
189
+ });
190
+ }
191
+ uses.sort((left, right) => left.start - right.start);
192
+ return { headings, uses, definitions, tree: root.children ?? [], base: at + shift };
193
+ }
194
+ export function destinations(reading) {
195
+ const byStart = new Map();
196
+ for (const use of reading.uses)
197
+ byStart.set(use.destination.start, use.destination);
198
+ return [...byStart.values()].sort((left, right) => left.start - right.start);
199
+ }
200
+ export function linkable(text, from = 0) {
201
+ return text.includes('](', from) || text.includes(']:', from);
202
+ }
203
+ export function hrefOccurrences(body) {
204
+ return linkable(body) ? destinations(read(body)) : [];
205
+ }
206
+ export function headingLines(content, from, to) {
207
+ return [...read(content.slice(from, to), from).headings];
208
+ }
209
+ export function sectionSpans(reading, end) {
210
+ const found = [];
211
+ for (const heading of reading.headings) {
212
+ if (heading.level !== 2)
213
+ continue;
214
+ if (found.length > 0)
215
+ found[found.length - 1] = { ...found[found.length - 1], bodyEnd: heading.start };
216
+ found.push({
217
+ name: heading.name,
218
+ headingStart: heading.start,
219
+ bodyStart: heading.next,
220
+ bodyEnd: end,
221
+ });
222
+ }
223
+ return found;
224
+ }
225
+ export function sectionsRecord(spans, content) {
226
+ const record = Object.create(null);
227
+ for (const span of spans) {
228
+ if (record[span.name] === undefined)
229
+ record[span.name] = content.slice(span.bodyStart, span.bodyEnd);
230
+ }
231
+ return record;
232
+ }
@@ -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,S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 'text/csv',
8
+ json: 'application/json',
9
+ xml: 'application/xml',
10
+ yaml: 'application/yaml',
11
+ ndjson: 'application/x-ndjson',
12
+ webManifest: 'application/manifest+json',
13
+ reports: 'application/reports+json',
14
+ githubJson: 'application/vnd.github+json',
15
+ form: 'application/x-www-form-urlencoded',
16
+ octetStream: 'application/octet-stream',
17
+ gzip: 'application/gzip',
18
+ tar: 'application/x-tar',
19
+ zip: 'application/zip',
20
+ gitBundle: 'application/x-git-bundle',
21
+ wasm: 'application/wasm',
22
+ pdf: 'application/pdf',
23
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
24
+ pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
25
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
26
+ avif: 'image/avif',
27
+ gif: 'image/gif',
28
+ heic: 'image/heic',
29
+ icon: 'image/vnd.microsoft.icon',
30
+ jpeg: 'image/jpeg',
31
+ png: 'image/png',
32
+ svg: 'image/svg+xml',
33
+ webp: 'image/webp',
34
+ aac: 'audio/aac',
35
+ amr: 'audio/amr',
36
+ m4a: 'audio/mp4',
37
+ mp3: 'audio/mpeg',
38
+ ogg: 'audio/ogg',
39
+ wav: 'audio/wav',
40
+ threeGpp: 'video/3gpp',
41
+ mp4: 'video/mp4',
42
+ quickTime: 'video/quicktime',
43
+ webm: 'video/webm',
44
+ otf: 'font/otf',
45
+ ttf: 'font/ttf',
46
+ woff: 'font/woff',
47
+ woff2: 'font/woff2',
48
+ };
49
+ const UTF8 = 'utf-8';
50
+ export function withCharset(type, charset) {
51
+ return `${type}; charset=${charset}`;
52
+ }
53
+ function utf8(type) {
54
+ return withCharset(type, UTF8);
55
+ }
56
+ export const UTF8_TEXT = {
57
+ html: utf8(MEDIA_TYPES.html),
58
+ css: utf8(MEDIA_TYPES.css),
59
+ javascript: utf8(MEDIA_TYPES.javascript),
60
+ plainText: utf8(MEDIA_TYPES.plainText),
61
+ markdown: utf8(MEDIA_TYPES.markdown),
62
+ xml: utf8(MEDIA_TYPES.xml),
63
+ };
64
+ export const SCRIPT_MEDIA_TYPES = [
65
+ MEDIA_TYPES.javascript,
66
+ 'application/javascript',
67
+ 'text/ecmascript',
68
+ 'application/ecmascript',
69
+ ];
70
+ const FILE_TYPES = [
71
+ [MEDIA_TYPES.aac, 'aac'],
72
+ [MEDIA_TYPES.amr, 'amr'],
73
+ [MEDIA_TYPES.avif, 'avif'],
74
+ [MEDIA_TYPES.css, 'css'],
75
+ [MEDIA_TYPES.csv, 'csv'],
76
+ [MEDIA_TYPES.docx, 'docx'],
77
+ [MEDIA_TYPES.gif, 'gif'],
78
+ [MEDIA_TYPES.heic, 'heic'],
79
+ [MEDIA_TYPES.html, 'html'],
80
+ [MEDIA_TYPES.icon, 'ico'],
81
+ [MEDIA_TYPES.javascript, 'js', 'mjs'],
82
+ [MEDIA_TYPES.jpeg, 'jpg', 'jpeg'],
83
+ [MEDIA_TYPES.json, 'json', 'map'],
84
+ [MEDIA_TYPES.m4a, 'm4a'],
85
+ [MEDIA_TYPES.markdown, 'md'],
86
+ [MEDIA_TYPES.mp3, 'mp3'],
87
+ [MEDIA_TYPES.mp4, 'mp4'],
88
+ [MEDIA_TYPES.ogg, 'ogg'],
89
+ [MEDIA_TYPES.otf, 'otf'],
90
+ [MEDIA_TYPES.pdf, 'pdf'],
91
+ [MEDIA_TYPES.plainText, 'txt'],
92
+ [MEDIA_TYPES.png, 'png'],
93
+ [MEDIA_TYPES.pptx, 'pptx'],
94
+ [MEDIA_TYPES.quickTime, 'mov'],
95
+ [MEDIA_TYPES.svg, 'svg'],
96
+ [MEDIA_TYPES.threeGpp, '3gp'],
97
+ [MEDIA_TYPES.ttf, 'ttf'],
98
+ [MEDIA_TYPES.wasm, 'wasm'],
99
+ [MEDIA_TYPES.wav, 'wav'],
100
+ [MEDIA_TYPES.webm, 'webm'],
101
+ [MEDIA_TYPES.webManifest, 'webmanifest'],
102
+ [MEDIA_TYPES.webp, 'webp'],
103
+ [MEDIA_TYPES.woff, 'woff'],
104
+ [MEDIA_TYPES.woff2, 'woff2'],
105
+ [MEDIA_TYPES.xlsx, 'xlsx'],
106
+ [MEDIA_TYPES.zip, 'zip'],
107
+ ];
108
+ export const FILE_MEDIA_TYPES = FILE_TYPES.reduce((table, [type, ...extensions]) => extensions.reduce((named, extension) => ({ ...named, [extension]: type }), table), {});
109
+ export function servedMediaType(path) {
110
+ const dot = path.lastIndexOf('.');
111
+ const extension = dot === -1 ? '' : path.slice(dot + 1).toLowerCase();
112
+ const type = FILE_TYPES.find(([, ...extensions]) => extensions.includes(extension))?.[0] ??
113
+ MEDIA_TYPES.octetStream;
114
+ return type.startsWith('text/') ? utf8(type) : type;
115
+ }
116
+ export function fileExtension(type) {
117
+ const essence = mediaTypeEssence(type);
118
+ return FILE_TYPES.find(([named]) => named === essence)?.[1] ?? null;
119
+ }
120
+ export function dataUrl(type, base64) {
121
+ return `data:${type};base64,${base64}`;
122
+ }
123
+ function caseless(text) {
124
+ return text.replace(/[a-z]/gu, (letter) => `[${letter}${letter.toUpperCase()}]`);
125
+ }
126
+ export function dataUrlPattern(types) {
127
+ const named = types.map((type) => caseless(type).replace(/[+.]/gu, '\\$&')).join('|');
128
+ return new RegExp(`^${caseless('data:')}(${named});${caseless('base64')},([A-Za-z0-9+/]+={0,2})$`, 'u');
129
+ }
130
+ export function formDataType(boundary) {
131
+ return `multipart/form-data; boundary=${boundary}`;
132
+ }
133
+ export function gitMediaType(service, part) {
134
+ return `application/x-${service}-${part}`;
135
+ }
136
+ export function mediaTypeEssence(value) {
137
+ return value.split(';', 1)[0].trim().toLowerCase();
138
+ }
139
+ export function declaresUtf8(value) {
140
+ const match = /;\s*charset\s*=\s*(?:"([^"]*)"|([^;\s]*))/iu.exec(value);
141
+ return match === null || (match[1] ?? match[2]).toLowerCase() === UTF8;
142
+ }
143
+ export function acceptsType(accept, type) {
144
+ return (accept ?? '').split(',').some((range) => mediaTypeEssence(range) === type);
145
+ }
146
+ function ofTopLevel(value, top) {
147
+ return mediaTypeEssence(value).startsWith(`${top}/`);
148
+ }
149
+ export function isImageType(value) {
150
+ return ofTopLevel(value, 'image');
151
+ }
152
+ export function isVideoType(value) {
153
+ return ofTopLevel(value, 'video');
154
+ }
155
+ export function isAudioType(value) {
156
+ return ofTopLevel(value, 'audio');
157
+ }
@@ -0,0 +1,7 @@
1
+ export interface MomentReader {
2
+ readonly language: string;
3
+ readonly zone: string | null;
4
+ }
5
+ export declare function shownMoment(at: Date, reader: MomentReader): string;
6
+ export declare function shownDay(at: Date, reader: MomentReader): string;
7
+ //# sourceMappingURL=moment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"moment.d.ts","sourceRoot":"","sources":["../src/moment.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAWD,wBAAgB,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAOlE;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAE/D"}
package/dist/moment.js ADDED
@@ -0,0 +1,18 @@
1
+ const DAY = { day: 'numeric', month: 'short', year: 'numeric' };
2
+ function shown(at, reader, form) {
3
+ return new Intl.DateTimeFormat(reader.language, {
4
+ ...form,
5
+ timeZone: reader.zone ?? 'UTC',
6
+ }).format(at);
7
+ }
8
+ export function shownMoment(at, reader) {
9
+ return shown(at, reader, {
10
+ ...DAY,
11
+ hour: '2-digit',
12
+ minute: '2-digit',
13
+ ...(reader.zone === null ? { timeZoneName: 'short' } : {}),
14
+ });
15
+ }
16
+ export function shownDay(at, reader) {
17
+ return shown(at, reader, DAY);
18
+ }
@@ -0,0 +1,2 @@
1
+ export declare function notReadyWaitMs(asked: number): number;
2
+ //# sourceMappingURL=not-ready.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"not-ready.d.ts","sourceRoot":"","sources":["../src/not-ready.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -0,0 +1,5 @@
1
+ // A Room answered not ready is asked again after these waits, the last repeating, so a chunk build that catches up within seconds installs at once and a long one is asked every 15 seconds.
2
+ const NOT_READY_WAITS_MS = [1_000, 2_000, 3_000, 5_000, 8_000, 11_000, 15_000];
3
+ export function notReadyWaitMs(asked) {
4
+ return NOT_READY_WAITS_MS[Math.min(asked, NOT_READY_WAITS_MS.length - 1)];
5
+ }
package/dist/paths.d.ts CHANGED
@@ -6,7 +6,7 @@ export type RoomTarget = {
6
6
  readonly handle: string;
7
7
  readonly path: string;
8
8
  };
9
- export declare function classifyHref(from: string, href: string): {
9
+ type Classified = {
10
10
  kind: 'skip';
11
11
  } | {
12
12
  kind: 'path';
@@ -16,11 +16,26 @@ export declare function classifyHref(from: string, href: string): {
16
16
  } & RoomTarget) | {
17
17
  kind: 'invalid';
18
18
  };
19
+ export declare function classifyHref(from: string, href: string): Classified;
19
20
  export declare function roomTarget(href: string): RoomTarget | null;
20
21
  export declare function roomPath(href: string): string | null;
21
22
  export declare function target(from: string, href: string): string | null;
23
+ export interface LinkedPath {
24
+ readonly handle: string | null;
25
+ readonly path: string;
26
+ readonly fragment: string | null;
27
+ }
28
+ export declare function linkedPath(from: string, href: string): LinkedPath | null;
29
+ export interface KeyedLink extends RoomTarget {
30
+ readonly key: string;
31
+ }
32
+ export declare function keyedLink(href: string): KeyedLink | null;
33
+ export declare function urlDestination(url: string): string;
34
+ export declare function keyedDestination(path: string, key: string): string;
22
35
  export declare function retarget(href: string, to: string): string;
23
36
  export declare function relative(from: string, target: string): string;
24
37
  export declare const SHELL_ROOMS = "/rooms/";
25
38
  export declare function shellTarget(href: string, handle: string): string | null;
39
+ export declare function destinationText(to: string, bracketed: boolean): string | null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