@agentshouse/mdmodel 0.1.0-cf24f2baa8f2d → 0.1.0-cf39345b743fb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (350) hide show
  1. package/API.md +145 -110
  2. package/README.md +25 -25
  3. package/dist/body.d.ts +85 -0
  4. package/dist/body.d.ts.map +1 -0
  5. package/dist/body.js +1083 -0
  6. package/dist/built-in.d.ts +4 -0
  7. package/dist/built-in.d.ts.map +1 -0
  8. package/dist/built-in.js +19 -0
  9. package/dist/definition.d.ts +19 -10
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +161 -115
  12. package/dist/divide.d.ts.map +1 -1
  13. package/dist/divide.js +5 -4
  14. package/dist/document.d.ts +13 -8
  15. package/dist/document.d.ts.map +1 -1
  16. package/dist/document.js +707 -132
  17. package/dist/event.d.ts +1 -2
  18. package/dist/event.d.ts.map +1 -1
  19. package/dist/event.js +2 -3
  20. package/dist/facts.d.ts.map +1 -1
  21. package/dist/facts.js +3 -0
  22. package/dist/fields.d.ts +1 -1
  23. package/dist/fields.d.ts.map +1 -1
  24. package/dist/fields.js +2 -2
  25. package/dist/form.d.ts +4 -0
  26. package/dist/form.d.ts.map +1 -0
  27. package/dist/form.js +153 -0
  28. package/dist/house-model.d.ts +870 -0
  29. package/dist/house-model.d.ts.map +1 -0
  30. package/dist/house-model.js +472 -0
  31. package/dist/house-references/crockford.d.ts +4 -0
  32. package/dist/house-references/crockford.d.ts.map +1 -0
  33. package/dist/house-references/crockford.js +3 -0
  34. package/dist/house-references/patterns.d.ts +9 -0
  35. package/dist/house-references/patterns.d.ts.map +1 -0
  36. package/dist/house-references/patterns.js +13 -0
  37. package/dist/index.d.ts +24 -13
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +16 -8
  40. package/dist/markdown.d.ts +75 -0
  41. package/dist/markdown.d.ts.map +1 -0
  42. package/dist/markdown.js +265 -0
  43. package/dist/media-type.d.ts +72 -0
  44. package/dist/media-type.d.ts.map +1 -0
  45. package/dist/media-type.js +157 -0
  46. package/dist/not-ready.d.ts +2 -0
  47. package/dist/not-ready.d.ts.map +1 -0
  48. package/dist/not-ready.js +5 -0
  49. package/dist/paths.d.ts +15 -1
  50. package/dist/paths.d.ts.map +1 -1
  51. package/dist/paths.js +88 -19
  52. package/dist/project.d.ts.map +1 -1
  53. package/dist/project.js +29 -54
  54. package/dist/query/match.d.ts +1 -1
  55. package/dist/query/match.d.ts.map +1 -1
  56. package/dist/query/rows.d.ts +1 -1
  57. package/dist/query/rows.d.ts.map +1 -1
  58. package/dist/query/rows.js +1 -1
  59. package/dist/references.d.ts +2 -2
  60. package/dist/references.d.ts.map +1 -1
  61. package/dist/references.js +1 -1
  62. package/dist/refuse.d.ts +1 -0
  63. package/dist/refuse.d.ts.map +1 -1
  64. package/dist/refuse.js +1 -0
  65. package/dist/reserved.d.ts +1 -0
  66. package/dist/reserved.d.ts.map +1 -1
  67. package/dist/reserved.js +2 -1
  68. package/dist/room-types.d.ts +7 -0
  69. package/dist/room-types.d.ts.map +1 -0
  70. package/dist/room-types.js +136 -0
  71. package/dist/schema.d.ts +1 -3
  72. package/dist/schema.d.ts.map +1 -1
  73. package/dist/schema.js +9 -73
  74. package/dist/types.d.ts +11 -17
  75. package/dist/types.d.ts.map +1 -1
  76. package/dist/validate.d.ts +6 -2
  77. package/dist/validate.d.ts.map +1 -1
  78. package/dist/validate.js +110 -178
  79. package/dist/yaml.d.ts +4 -4
  80. package/dist/yaml.d.ts.map +1 -1
  81. package/dist/yaml.js +1 -1
  82. package/fixtures/README.md +40 -23
  83. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  84. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  85. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  86. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  87. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  88. package/fixtures/cases/absolute-link/library/item.md +1 -1
  89. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  90. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  91. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  92. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  93. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  94. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  95. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  96. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  97. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  98. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  99. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  100. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  101. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  102. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  103. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  104. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  105. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  106. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  107. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  108. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  109. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  110. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  111. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  112. package/fixtures/cases/boolean-field/expected.json +2 -1
  113. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  114. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  115. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  116. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  117. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  118. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  119. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  120. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  121. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  122. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  123. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  124. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  125. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  126. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  127. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  128. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  129. package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
  130. package/fixtures/cases/date-time-format/expected.json +2 -1
  131. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  132. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  133. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  134. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  135. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  136. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  137. package/fixtures/cases/defs-pattern/expected.json +2 -1
  138. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  139. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  140. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  141. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  142. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  143. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  144. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  145. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  146. package/fixtures/cases/email-format/expected.json +2 -1
  147. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  148. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  149. package/fixtures/cases/email-format/schema.yaml +10 -11
  150. package/fixtures/cases/equal-labels/expected.json +5 -0
  151. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  152. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  153. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  154. package/fixtures/cases/field-enum/expected.json +2 -1
  155. package/fixtures/cases/field-enum/library/item.md +2 -2
  156. package/fixtures/cases/field-enum/schema.yaml +3 -4
  157. package/fixtures/cases/integer-field/expected.json +2 -1
  158. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  159. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  160. package/fixtures/cases/integer-field/schema.yaml +10 -11
  161. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  162. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  163. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  164. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  165. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  166. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  167. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  168. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  169. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
  170. package/fixtures/cases/list-item-enum/expected.json +7 -0
  171. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  172. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  173. package/fixtures/cases/list-item-kind/expected.json +7 -0
  174. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  175. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  176. package/fixtures/cases/list-items/expected.json +1 -0
  177. package/fixtures/cases/list-items/library/page.md +26 -0
  178. package/fixtures/cases/list-items/schema.yaml +10 -0
  179. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  180. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  181. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  182. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  183. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  184. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  185. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  186. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  187. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  188. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  189. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  190. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  191. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  192. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  193. package/fixtures/cases/list-reference-path/expected.json +7 -0
  194. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  195. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  196. package/fixtures/cases/list-reference-type/expected.json +7 -0
  197. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  198. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  199. package/fixtures/cases/list-size/expected.json +2 -1
  200. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  201. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  202. package/fixtures/cases/list-size/schema.yaml +10 -11
  203. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  204. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  205. package/fixtures/cases/malformed-list/context.json +1 -0
  206. package/fixtures/cases/malformed-list/expected.json +7 -0
  207. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  208. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  209. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  210. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  211. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  212. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  213. package/fixtures/cases/misspelled-key/expected.json +2 -1
  214. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  215. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  216. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  217. package/fixtures/cases/name-not-a-string/context.json +1 -0
  218. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  219. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  220. package/fixtures/cases/nested-defs/expected.json +2 -1
  221. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  222. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  223. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  224. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  225. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  226. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  227. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  228. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  229. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  230. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  231. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  232. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  233. package/fixtures/cases/nested-required-field/expected.json +2 -1
  234. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  235. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  236. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  237. package/fixtures/cases/numeric-range/expected.json +2 -1
  238. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  239. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  240. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  241. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  242. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  243. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  244. package/fixtures/cases/one-key-two-types/context.json +1 -0
  245. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  246. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  247. package/fixtures/cases/one-of-variant/expected.json +2 -1
  248. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  249. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  250. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  251. package/fixtures/cases/other-room-reference/expected.json +2 -1
  252. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  253. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  254. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  255. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  256. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  257. package/fixtures/cases/prototype-field/expected.json +2 -1
  258. package/fixtures/cases/prototype-field/library/item.md +2 -2
  259. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  260. package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
  261. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
  262. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  263. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  264. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  265. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  266. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  267. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  268. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  269. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  270. package/fixtures/cases/string-length/expected.json +2 -1
  271. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  272. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  273. package/fixtures/cases/string-length/schema.yaml +10 -11
  274. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  275. package/fixtures/cases/text-field-kind/expected.json +1 -4
  276. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  277. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  278. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  279. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  280. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  281. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
  282. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  283. package/fixtures/cases/undeclared-field/expected.json +2 -1
  284. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  285. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  286. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  287. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  288. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
  289. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
  290. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
  291. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
  292. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  293. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  294. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  295. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  296. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  297. package/fixtures/division.json +85 -39
  298. package/fixtures/forms.json +347 -0
  299. package/fixtures/preamble.json +26 -5
  300. package/fixtures/projection.json +120 -16
  301. package/package.json +10 -1
  302. package/dist/blocks.d.ts +0 -11
  303. package/dist/blocks.d.ts.map +0 -1
  304. package/dist/blocks.js +0 -87
  305. package/dist/links.d.ts +0 -29
  306. package/dist/links.d.ts.map +0 -1
  307. package/dist/links.js +0 -821
  308. package/dist/sections.d.ts +0 -11
  309. package/dist/sections.d.ts.map +0 -1
  310. package/dist/sections.js +0 -57
  311. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  312. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  313. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  314. package/fixtures/cases/null-refused/expected.json +0 -6
  315. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  316. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  317. package/fixtures/cases/null-refused/schema.yaml +0 -56
  318. package/fixtures/cases/open-map-value/expected.json +0 -6
  319. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  320. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  321. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  322. package/fixtures/cases/section-item-enum/expected.json +0 -6
  323. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  324. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  325. package/fixtures/cases/section-item-kind/expected.json +0 -6
  326. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  327. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  328. package/fixtures/cases/section-items/library/page.md +0 -42
  329. package/fixtures/cases/section-items/schema.yaml +0 -10
  330. package/fixtures/cases/section-reference-path/expected.json +0 -6
  331. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  332. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  333. package/fixtures/cases/section-reference-type/expected.json +0 -6
  334. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  335. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  336. package/fixtures/cases/structured-section/expected.json +0 -6
  337. /package/fixtures/cases/{conditional-section → conditional-long-text}/context.json +0 -0
  338. /package/fixtures/cases/{missing-section-item-kind → equal-labels}/context.json +0 -0
  339. /package/fixtures/cases/{null-refused → labels-in-the-rooms-language}/context.json +0 -0
  340. /package/fixtures/cases/{section-items → labels-in-the-rooms-language}/expected.json +0 -0
  341. /package/fixtures/cases/{open-map-value → lazy-list-item}/context.json +0 -0
  342. /package/fixtures/cases/{section-item-enum → list-item-enum}/context.json +0 -0
  343. /package/fixtures/cases/{section-item-kind → list-item-kind}/context.json +0 -0
  344. /package/fixtures/cases/{section-items → list-items}/context.json +0 -0
  345. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  346. /package/fixtures/cases/{section-reference-path → list-reference-path}/context.json +0 -0
  347. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  348. /package/fixtures/cases/{section-reference-type → list-reference-type}/context.json +0 -0
  349. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
  350. /package/fixtures/cases/{structured-section → long-value-past-six-levels}/context.json +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAG3D;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYrD;AAwDD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW3D;AAgBD,MAAM,MAAM,UAAU,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAY5E,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GAEV;IAAE,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E,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAW7D;AAED,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMvE;AAoBD,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAI7E"}
package/dist/paths.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { decodeNamedCharacterReference } from 'decode-named-character-reference';
2
2
  import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';
3
- import { escapes } from './links.js';
3
+ const BACKSLASH = 0x5c;
4
+ const PUNCTUATION = /^[!-/:-@[-`{-~]$/;
5
+ function escapes(text, index) {
6
+ return text.charCodeAt(index) === BACKSLASH && PUNCTUATION.test(text[index + 1] ?? '');
7
+ }
4
8
  export function dirname(path) {
5
9
  const index = path.lastIndexOf('/');
6
10
  return index === -1 ? '' : path.slice(0, index);
@@ -43,19 +47,23 @@ function referenceAt(text, at) {
43
47
  end,
44
48
  };
45
49
  }
46
- function unescaped(written) {
47
- let base = '';
48
- let i = 0;
50
+ function spelled(written, from, stops) {
51
+ let text = '';
52
+ let i = from;
49
53
  while (i < written.length) {
50
54
  const escaped = escapes(written, i);
51
55
  const reference = escaped || written[i] !== '&' ? null : referenceAt(written, i);
52
- const text = escaped ? written[i + 1] : (reference?.text ?? written[i]);
53
- if (text.startsWith('?') || text.startsWith('#'))
54
- return { base, suffix: i };
55
- base += text;
56
+ const one = escaped ? written[i + 1] : (reference?.text ?? written[i]);
57
+ if (stops && (one.startsWith('?') || one.startsWith('#')))
58
+ return { text, end: i };
59
+ text += one;
56
60
  i = escaped ? i + 2 : (reference?.end ?? i + 1);
57
61
  }
58
- return { base, suffix: written.length };
62
+ return { text, end: written.length };
63
+ }
64
+ function unescaped(written) {
65
+ const { text, end } = spelled(written, 0, true);
66
+ return { base: text, suffix: end };
59
67
  }
60
68
  function located(href) {
61
69
  const written = href.trim();
@@ -107,18 +115,22 @@ function written(path) {
107
115
  }
108
116
  return text;
109
117
  }
110
- function roomTargetOf(path) {
118
+ function roomAt(path) {
111
119
  if (!path.startsWith(SHELL_ROOMS))
112
120
  return null;
113
121
  const rest = path.slice(SHELL_ROOMS.length);
114
122
  const slash = rest.indexOf('/');
115
- const handle = rest.slice(0, slash);
116
- if (slash <= 0 || handle === '.' || handle === '..')
123
+ const handle = slash === -1 ? rest : rest.slice(0, slash);
124
+ if (handle === '' || handle === '.' || handle === '..')
117
125
  return null;
118
- const within = normalize(rest.slice(slash + 1));
119
- return within === null || within === '' ? null : { handle, path: within };
126
+ const within = normalize(slash === -1 ? '' : rest.slice(slash + 1));
127
+ return within === null ? null : { handle, path: within };
120
128
  }
121
- export function classifyHref(from, href) {
129
+ function roomTargetOf(path) {
130
+ const room = roomAt(path);
131
+ return room === null || room.path === '' ? null : room;
132
+ }
133
+ function resolvedOf(from, href) {
122
134
  const base = located(href).base;
123
135
  if (base === '')
124
136
  return { kind: 'skip' };
@@ -128,13 +140,15 @@ export function classifyHref(from, href) {
128
140
  if (path === null)
129
141
  return { kind: 'invalid' };
130
142
  if (path.startsWith('/')) {
131
- const room = roomTargetOf(path);
143
+ const room = roomAt(path);
132
144
  return room === null ? { kind: 'invalid' } : { kind: 'room', ...room };
133
145
  }
134
146
  const resolved = normalize(join(dirname(from), path));
135
- if (resolved === null || resolved === '')
136
- return { kind: 'invalid' };
137
- return { kind: 'path', path: resolved };
147
+ return resolved === null ? { kind: 'invalid' } : { kind: 'path', path: resolved };
148
+ }
149
+ export function classifyHref(from, href) {
150
+ const resolved = resolvedOf(from, href);
151
+ return 'path' in resolved && resolved.path === '' ? { kind: 'invalid' } : resolved;
138
152
  }
139
153
  export function roomTarget(href) {
140
154
  const path = destinationPath(href);
@@ -148,6 +162,34 @@ export function target(from, href) {
148
162
  const resolved = classifyHref(from, href);
149
163
  return resolved.kind === 'path' ? resolved.path : null;
150
164
  }
165
+ export function linkedPath(from, href) {
166
+ const resolved = located(href).base === '' ? { kind: 'path', path: from } : resolvedOf(from, href);
167
+ if (!('path' in resolved))
168
+ return null;
169
+ const written = href.trim();
170
+ const suffix = spelled(written, unescaped(written).suffix, false).text;
171
+ const hash = suffix.indexOf('#');
172
+ const fragment = hash === -1 ? '' : suffix.slice(hash + 1);
173
+ return {
174
+ handle: resolved.kind === 'room' ? resolved.handle : null,
175
+ path: resolved.path,
176
+ fragment: fragment === '' ? null : (decodedRun(fragment) ?? fragment),
177
+ };
178
+ }
179
+ const LINK_KEY = /^\?key=([A-Za-z0-9._~-]+)(?:#|$)/u;
180
+ export function keyedLink(href) {
181
+ const written = href.trim();
182
+ if (!written.includes('?') && !written.includes('&'))
183
+ return null;
184
+ const key = LINK_KEY.exec(spelled(written, unescaped(written).suffix, false).text)?.[1];
185
+ if (key === undefined)
186
+ return null;
187
+ const room = roomTarget(href);
188
+ return room === null ? null : { ...room, key };
189
+ }
190
+ export function keyedDestination(path, key) {
191
+ return `${written(path)}?key=${key}`;
192
+ }
151
193
  export function retarget(href, to) {
152
194
  const trimmed = href.trim();
153
195
  return written(to) + trimmed.slice(unescaped(trimmed).suffix);
@@ -173,3 +215,30 @@ export function shellTarget(href, handle) {
173
215
  const path = normalize(decoded.slice(prefix.length));
174
216
  return path === null || path === '' ? null : path;
175
217
  }
218
+ function fitsBare(to) {
219
+ if (to === '' || to.startsWith('<'))
220
+ return false;
221
+ let depth = 0;
222
+ for (const character of to) {
223
+ if (/[\s\u0000-\u001f\u007f]/.test(character))
224
+ return false;
225
+ if (character === '(')
226
+ depth += 1;
227
+ else if (character === ')') {
228
+ if (depth === 0)
229
+ return false;
230
+ depth -= 1;
231
+ }
232
+ }
233
+ return depth === 0;
234
+ }
235
+ function fitsBrackets(to) {
236
+ return to !== '' && !/[<>\n\r]/.test(to);
237
+ }
238
+ export function destinationText(to, bracketed) {
239
+ if (fitsBare(to))
240
+ return bracketed && fitsBrackets(to) ? `<${to}>` : to;
241
+ if (fitsBrackets(to))
242
+ return `<${to}>`;
243
+ return null;
244
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAG3F,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC;AAEzB,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GAC5C;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC;AA0CtD,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAS3E;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,MAAM,CAWxF;AA4BD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,E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WAAW,CA4Bb;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,iBAA2C,GACnD,UAAU,CAMZ"}
package/dist/project.js CHANGED
@@ -1,12 +1,10 @@
1
- import { memberFacts } from './definition.js';
2
- import { frontmatter, inventoryOf } from './document.js';
1
+ import { bodyWith, readingOf } from './document.js';
3
2
  import { classifyHref } from './paths.js';
4
3
  import { refusal } from './refuse.js';
5
- import { headingSpans } from './sections.js';
6
4
  import { bodyStartOf } from './yaml.js';
7
- function internalEdits(content, inventory, bodyStart, file, documentTargets) {
5
+ function internalEdits(content, reading, file, documentTargets) {
8
6
  const internal = new Set();
9
- const uses = inventory.uses
7
+ const uses = reading.uses
10
8
  .filter((use) => {
11
9
  const resolved = classifyHref(file, use.destination.href);
12
10
  return (resolved.kind === 'room' || (resolved.kind === 'path' && documentTargets.has(resolved.path)));
@@ -16,7 +14,7 @@ function internalEdits(content, inventory, bodyStart, file, documentTargets) {
16
14
  for (let index = uses.length - 1; index >= 0; index -= 1) {
17
15
  const use = uses[index];
18
16
  internal.add(use.destination.start);
19
- const label = { start: bodyStart + use.labelStart, end: bodyStart + use.labelEnd };
17
+ const label = { start: use.labelStart, end: use.labelEnd };
20
18
  const inner = [];
21
19
  for (let nested = index + 1; nested < uses.length; nested += 1) {
22
20
  const edit = edits[uses.length - 1 - nested];
@@ -25,16 +23,12 @@ function internalEdits(content, inventory, bodyStart, file, documentTargets) {
25
23
  if (edit.end <= label.end)
26
24
  inner.push(edit);
27
25
  }
28
- edits.push({
29
- start: bodyStart + use.start,
30
- end: bodyStart + use.end,
31
- text: rangeText(content, label, inner),
32
- });
26
+ edits.push({ start: use.start, end: use.end, text: rangeText(content, label, inner) });
33
27
  }
34
- for (const block of inventory.blocks) {
28
+ for (const block of reading.definitions) {
35
29
  if (!internal.has(block.destination.start))
36
30
  continue;
37
- edits.push({ start: bodyStart + block.start, end: bodyStart + block.end, text: '' });
31
+ edits.push({ start: block.start, end: block.end, text: '' });
38
32
  }
39
33
  return edits.sort((left, right) => left.start - right.start);
40
34
  }
@@ -64,57 +58,38 @@ export function rangeText(content, range, edits) {
64
58
  }
65
59
  return text + content.slice(cursor, range.end);
66
60
  }
67
- function structural(spec) {
68
- return spec.kind === 'list' && !spec.items.prose;
69
- }
70
- function proseValues(node, facts, values) {
71
- if (facts === undefined)
72
- return;
73
- if (node.kind === 'scalar') {
74
- if (facts.prose && typeof node.value === 'string')
75
- values.push({ start: node.start, end: node.end, text: `${node.value}\n\n` });
76
- return;
77
- }
78
- if (node.kind === 'seq') {
79
- for (const item of node.items)
80
- proseValues(item, facts.items, values);
81
- return;
82
- }
83
- for (const entry of node.entries)
84
- proseValues(entry.value, memberFacts(facts, entry.key), values);
85
- }
86
- function freeTextValues(definition, document) {
87
- const root = frontmatter(document);
88
- if (root === null)
89
- return [];
90
- const values = [];
91
- proseValues(root, definition.frontmatter, values);
92
- return values;
61
+ function linked(edits, range) {
62
+ const at = firstEditFrom(edits, range.start);
63
+ return at < edits.length && edits[at].start < range.end;
93
64
  }
94
65
  export function projectionInput(document, file, context) {
95
66
  const content = document.content;
96
67
  const bodyStart = bodyStartOf(content);
97
- const edits = internalEdits(content, inventoryOf(document), bodyStart, file, new Set(context.documentTargets));
68
+ const reading = readingOf(document);
69
+ const edits = internalEdits(content, reading, file, new Set(context.documentTargets));
98
70
  const declared = document.type;
99
- if (declared === undefined || declared === 'any') {
71
+ const definition = context.definition;
72
+ if (definition === undefined && declared !== undefined && declared !== 'any')
73
+ return { ok: false, refusal: refusal(file, 'unknown-type') };
74
+ const body = definition === undefined ? null : bodyWith(document, definition);
75
+ if (body === null || !('top' in body)) {
100
76
  return {
101
77
  ok: true,
102
78
  input: { values: [], ranges: [{ start: bodyStart, end: content.length }], edits },
103
79
  };
104
80
  }
105
- const definition = context.definition;
106
- if (definition === undefined) {
107
- return { ok: false, refusal: refusal(file, 'unknown-type') };
108
- }
109
- const structure = new Set(Object.entries(definition.sections).flatMap(([name, spec]) => (structural(spec) ? [name] : [])));
110
- const headings = headingSpans(content, bodyStart);
111
- const ranges = [{ start: bodyStart, end: headings[0]?.headingStart ?? content.length }];
112
- for (const heading of headings) {
113
- if (structure.has(heading.name))
114
- continue;
115
- ranges.push({ start: heading.headingStart, end: heading.bodyEnd });
116
- }
117
- return { ok: true, input: { values: freeTextValues(definition, document), ranges, edits } };
81
+ const values = body.prose
82
+ .filter((one) => !one.markdown)
83
+ .map((one) => ({
84
+ start: one.start,
85
+ end: one.end,
86
+ text: `${linked(edits, one) ? rangeText(content, one, edits) : one.text}\n\n`,
87
+ }));
88
+ const ranges = [
89
+ ...body.prose.filter((one) => one.markdown).map(({ start, end }) => ({ start, end })),
90
+ ...body.free,
91
+ ].sort((left, right) => left.start - right.start);
92
+ return { ok: true, input: { values, ranges, edits } };
118
93
  }
119
94
  export function project(document, file, context = { documentTargets: [] }) {
120
95
  const result = projectionInput(document, file, context);
@@ -6,7 +6,7 @@ export type Candidate = {
6
6
  readonly type: string | null;
7
7
  readonly fileId: string | null;
8
8
  readonly fields: Readonly<Record<string, unknown>>;
9
- readonly definition?: Pick<Definition, 'frontmatter'>;
9
+ readonly definition?: Pick<Definition, 'root'>;
10
10
  readonly text: string | null;
11
11
  };
12
12
  export declare function heldAt(candidate: Candidate, field: string): readonly HeldValue[];
@@ -1 +1 @@
1
- {"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/query/match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAGL,KAAK,SAAS,EAIf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,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AE,CAEhF;AAiCD,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,GAAG,OAAO,CAYtE"}
@@ -28,5 +28,5 @@ export type Placed = {
28
28
  };
29
29
  export declare function placedOf(pointer: string, reach: Reach): Placed;
30
30
  export declare function heldKind(value: unknown): HeldKind;
31
- export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'frontmatter'> | undefined): Indexed;
31
+ export declare function indexed(path: string, fields: Readonly<Record<string, unknown>>, definition: Pick<Definition, 'root'> | undefined): Indexed;
32
32
  //# sourceMappingURL=rows.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/query/rows.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEnG,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAA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AAC,GAAG,SAAS,GAC/C,OAAO,CAcT"}
@@ -154,7 +154,7 @@ export function indexed(path, fields, definition) {
154
154
  head: '',
155
155
  tail: '',
156
156
  exact: `/${segment}`,
157
- facts: definition === undefined ? undefined : memberFacts(definition.frontmatter, name),
157
+ facts: definition === undefined ? undefined : memberFacts(definition.root, name),
158
158
  });
159
159
  }
160
160
  return { values: reading.values, links: reading.links };
@@ -1,4 +1,4 @@
1
1
  import { type Definition } from './definition.js';
2
- import type { Frontmatter, Reference } from './types.js';
3
- export declare function references(document: Pick<Frontmatter, 'fields'>, definition: Definition): readonly Reference[];
2
+ import type { Document, Reference } from './types.js';
3
+ export declare function references(document: Pick<Document, 'fields'>, definition: Definition): readonly Reference[];
4
4
  //# sourceMappingURL=references.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA8BzD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,EACrC,UAAU,EAAE,UAAU,GACrB,SAAS,SAAS,EAAE,CAItB"}
1
+ {"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../src/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AA8BtD,wBAAgB,UAAU,CACxB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAClC,UAAU,EAAE,UAAU,GACrB,SAAS,SAAS,EAAE,CAItB"}
@@ -25,6 +25,6 @@ function collect(value, facts, pointer, found) {
25
25
  }
26
26
  export function references(document, definition) {
27
27
  const found = [];
28
- collect(document.fields, definition.frontmatter, '', found);
28
+ collect(document.fields, definition.root, '', found);
29
29
  return found;
30
30
  }
package/dist/refuse.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Refusal } from './types.js';
2
2
  export declare function refusal(file: string, rule: string, extra?: {
3
3
  location?: string;
4
+ line?: number;
4
5
  referrers?: readonly string[];
5
6
  }): Refusal;
6
7
  //# sourceMappingURL=refuse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC3D,OAAO,CAOT"}
1
+ {"version":3,"file":"refuse.d.ts","sourceRoot":"","sources":["../src/refuse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAC1E,OAAO,CAQT"}
package/dist/refuse.js CHANGED
@@ -3,6 +3,7 @@ export function refusal(file, rule, extra) {
3
3
  file,
4
4
  rule,
5
5
  ...(extra?.location === undefined ? {} : { location: extra.location }),
6
+ ...(extra?.line === undefined ? {} : { line: extra.line }),
6
7
  ...(extra?.referrers === undefined ? {} : { referrers: extra.referrers }),
7
8
  };
8
9
  }
@@ -1,4 +1,5 @@
1
1
  export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const CAPTURE_HOME = "capture";
2
3
  export declare const RESERVED_NAMES: readonly string[];
3
4
  export declare function isReservedName(name: string): boolean;
4
5
  export declare function isDocumentPath(path: string): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
1
+ {"version":3,"file":"reserved.d.ts","sourceRoot":"","sources":["../src/reserved.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,YAAY,YAAY,CAAC;AAEtC,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAO3C,CAAC;AAQF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD"}
package/dist/reserved.js CHANGED
@@ -1,7 +1,8 @@
1
1
  export const ROOM_DESCRIPTION = 'ROOM.md';
2
+ export const CAPTURE_HOME = 'capture';
2
3
  export const RESERVED_NAMES = [
3
4
  ROOM_DESCRIPTION,
4
- 'capture',
5
+ CAPTURE_HOME,
5
6
  'settings',
6
7
  'rooms',
7
8
  'agents',
@@ -0,0 +1,7 @@
1
+ export declare const CHAT_TYPE = "chat";
2
+ export declare const CHAT_MESSAGE_TYPE = "chat-message";
3
+ export declare const INBOX_TYPES: readonly string[];
4
+ export declare const INBOX_CHANNEL_KINDS: readonly ['telegram-bot', 'telegram-business', 'whatsapp', 'messenger', 'instagram', 'tiktok'];
5
+ export type InboxChannelKind = (typeof INBOX_CHANNEL_KINDS)[number];
6
+ export declare const ROOM_TYPES_TEXT: string;
7
+ //# sourceMappingURL=room-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room-types.d.ts","sourceRoot":"","sources":["../src/room-types.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,SAAS,SAAS,CAAC;AAEhC,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,eAAO,MAAM,WAAW,EAAE,SAAS,MAAM,EAAmC,CAAC;AAE7E,eAAO,MAAM,mBAAmB,YAC9B,cAAc,EACd,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,CACA,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAkCpE,eAAO,MAAM,eAAe,QAiGhB,CAAC"}
@@ -0,0 +1,136 @@
1
+ import { APP_REFERENCE_PATTERN } from './house-references/patterns.js';
2
+ import { MEDIA_TYPES } from './media-type.js';
3
+ export const CHAT_TYPE = 'chat';
4
+ export const CHAT_MESSAGE_TYPE = 'chat-message';
5
+ export const INBOX_TYPES = [CHAT_TYPE, CHAT_MESSAGE_TYPE];
6
+ export const INBOX_CHANNEL_KINDS = [
7
+ 'telegram-bot',
8
+ 'telegram-business',
9
+ 'whatsapp',
10
+ 'messenger',
11
+ 'instagram',
12
+ 'tiktok',
13
+ ];
14
+ const WAYFINDING_MAP_TYPE = 'wayfinding-map';
15
+ const WAYFINDING_TICKET_TYPE = 'wayfinding-ticket';
16
+ const WAYFINDING_MAP_TEXTS = [
17
+ ['destination', 'Destination'],
18
+ ['notes', 'Notes'],
19
+ ['decisions_so_far', 'Decisions so far'],
20
+ ['not_yet_specified', 'Not yet specified'],
21
+ ['out_of_scope', 'Out of scope'],
22
+ ];
23
+ function markdown(title) {
24
+ return `{ type: string, contentMediaType: ${MEDIA_TYPES.markdown}, title: ${title} }`;
25
+ }
26
+ function identity(title) {
27
+ return `{ type: string, pattern: '^\\S+$', title: ${title} }`;
28
+ }
29
+ const AGENT = [
30
+ ' agent: { type: string, format: uuid, title: Agent }',
31
+ ' name: { type: string, title: Name }',
32
+ ];
33
+ const ASSIGNEE = [
34
+ ' type: object',
35
+ ' properties:',
36
+ ' user: { type: string, format: uuid, title: User }',
37
+ ...AGENT,
38
+ ];
39
+ export const ROOM_TYPES_TEXT = [
40
+ `${CHAT_TYPE}:`,
41
+ ' properties:',
42
+ ' inbox: { type: string, format: uuid, title: Inbox }',
43
+ ` channel: { enum: [${INBOX_CHANNEL_KINDS.join(', ')}], title: Channel }`,
44
+ ` chat: ${identity('Chat')}`,
45
+ ' customer:',
46
+ ' title: Customer',
47
+ ' type: object',
48
+ ' properties:',
49
+ ' name: { type: string, title: Name }',
50
+ ` username: ${identity('Username')}`,
51
+ ` phone: ${identity('Phone')}`,
52
+ ' assignee:',
53
+ ' title: Assignee',
54
+ ...ASSIGNEE,
55
+ ' return_to:',
56
+ ' title: Return to',
57
+ ' type: object',
58
+ ' properties:',
59
+ ...AGENT,
60
+ ' required: [chat, customer]',
61
+ `${CHAT_MESSAGE_TYPE}:`,
62
+ ' properties:',
63
+ ' direction: { enum: [in, out], title: Direction }',
64
+ ' sender:',
65
+ ' title: Sender',
66
+ ...ASSIGNEE,
67
+ ` username: ${identity('Username')}`,
68
+ ' sent_at: { type: string, format: date-time, title: Sent at }',
69
+ ` channel_message: ${identity('Channel message')}`,
70
+ ' labelled: { const: true, title: Labelled }',
71
+ ' reactions:',
72
+ ' title: Reactions',
73
+ ' type: array',
74
+ ' items:',
75
+ ' type: object',
76
+ ' properties:',
77
+ ' reaction: { type: string, minLength: 1, title: Reaction }',
78
+ ' sender:',
79
+ ' title: Sender',
80
+ ' type: object',
81
+ ' properties:',
82
+ ` id: ${identity('ID')}`,
83
+ ' name: { type: string, title: Name }',
84
+ ` username: ${identity('Username')}`,
85
+ ' count: { type: integer, minimum: 1, title: Count }',
86
+ ' required: [reaction]',
87
+ ` post: ${identity('Post')}`,
88
+ ' assignee:',
89
+ ' title: Assignee',
90
+ ...ASSIGNEE,
91
+ ' sent_outside: { const: true, title: Sent outside }',
92
+ ' template:',
93
+ ' title: Template',
94
+ ' type: object',
95
+ ' properties:',
96
+ ' name: { type: string, minLength: 1, title: Name }',
97
+ ' language: { type: string, minLength: 1, title: Language }',
98
+ ' required: [name, language]',
99
+ ' values:',
100
+ ' title: Values',
101
+ ' type: object',
102
+ ' additionalProperties: { type: string }',
103
+ ' withheld: { const: true, title: Withheld }',
104
+ ' required: [direction]',
105
+ ' if: { properties: { direction: { const: in } } }',
106
+ ' then: { required: [sent_at] }',
107
+ `${WAYFINDING_MAP_TYPE}:`,
108
+ ' properties:',
109
+ ' name: { type: string, title: Name }',
110
+ ...WAYFINDING_MAP_TEXTS.map(([key, title]) => ` ${key}: ${markdown(title)}`),
111
+ ` required: [name, ${WAYFINDING_MAP_TEXTS.map(([key]) => key).join(', ')}]`,
112
+ `${WAYFINDING_TICKET_TYPE}:`,
113
+ ' properties:',
114
+ ' name: { type: string, title: Name }',
115
+ ' kind: { enum: [research, prototype, grilling, task], title: Kind }',
116
+ ' status: { enum: [open, in-progress, done, out-of-scope], title: Status }',
117
+ ` map: { type: string, reference: ${WAYFINDING_MAP_TYPE}, title: Map }`,
118
+ ` blocked_by: { type: array, items: { type: string, reference: ${WAYFINDING_TICKET_TYPE} }, title: Blocked by }`,
119
+ ' assignee:',
120
+ ' title: Assignee',
121
+ ...ASSIGNEE,
122
+ ' conversation: { type: string, format: uuid, title: Conversation }',
123
+ ` app: { type: string, pattern: '${APP_REFERENCE_PATTERN.source}', title: App }`,
124
+ ` question: ${markdown('Question')}`,
125
+ ` answer: ${markdown('Answer')}`,
126
+ ' required: [name, kind, status, map, blocked_by]',
127
+ ' allOf:',
128
+ ' - if: { properties: { status: { enum: [in-progress, done, out-of-scope] } }, required: [status] }',
129
+ ' then: { required: [assignee] }',
130
+ ' else: { properties: { assignee: false } }',
131
+ ' - if: { properties: { assignee: { required: [agent] } }, required: [assignee] }',
132
+ ' else: { properties: { conversation: false } }',
133
+ ' - if: { properties: { status: { enum: [done, out-of-scope] } }, required: [status] }',
134
+ ' then: { required: [answer], properties: { answer: { minLength: 1, title: Answer } } }',
135
+ '',
136
+ ].join('\n');
package/dist/schema.d.ts CHANGED
@@ -3,7 +3,5 @@ export type SchemaRefusal = {
3
3
  readonly rule: string;
4
4
  readonly location: string;
5
5
  };
6
- export declare function frontmatterRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
7
- export declare function conditionedSections(definition: Definition, fields: Readonly<Record<string, unknown>>): readonly string[];
8
- export declare function fitsItem(definition: Definition, section: string, text: string): boolean;
6
+ export declare function schemaRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
9
7
  //# sourceMappingURL=schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA0B5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA6NjF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAI3B;AAYD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,SAAS,MAAM,EAAE,CAGnB;AAED,wBAAgB,QAAQ,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMvF"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAK5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA8JjF,wBAAgB,aAAa,CAC3B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAI3B"}