@agentshouse/mdmodel 0.1.0-c0bdbbc92d020 → 0.1.0-c11dbb11b07a8

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 (425) hide show
  1. package/API.md +366 -235
  2. package/README.md +29 -29
  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 +48 -11
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +490 -106
  12. package/dist/divide.d.ts.map +1 -1
  13. package/dist/divide.js +32 -21
  14. package/dist/document.d.ts +18 -13
  15. package/dist/document.d.ts.map +1 -1
  16. package/dist/document.js +1006 -213
  17. package/dist/event.d.ts +77 -0
  18. package/dist/event.d.ts.map +1 -0
  19. package/dist/event.js +200 -0
  20. package/dist/facts.d.ts +15 -0
  21. package/dist/facts.d.ts.map +1 -0
  22. package/dist/facts.js +41 -0
  23. package/dist/fields.d.ts +3 -1
  24. package/dist/fields.d.ts.map +1 -1
  25. package/dist/fields.js +8 -1
  26. package/dist/form.d.ts +4 -0
  27. package/dist/form.d.ts.map +1 -0
  28. package/dist/form.js +153 -0
  29. package/dist/house-model.d.ts +870 -0
  30. package/dist/house-model.d.ts.map +1 -0
  31. package/dist/house-model.js +472 -0
  32. package/dist/house-references/crockford.d.ts +4 -0
  33. package/dist/house-references/crockford.d.ts.map +1 -0
  34. package/dist/house-references/crockford.js +3 -0
  35. package/dist/house-references/patterns.d.ts +9 -0
  36. package/dist/house-references/patterns.d.ts.map +1 -0
  37. package/dist/house-references/patterns.js +13 -0
  38. package/dist/index.d.ts +43 -10
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +26 -7
  41. package/dist/indexed.d.ts +9 -0
  42. package/dist/indexed.d.ts.map +1 -0
  43. package/dist/indexed.js +55 -0
  44. package/dist/kinds.d.ts +20 -0
  45. package/dist/kinds.d.ts.map +1 -0
  46. package/dist/kinds.js +199 -0
  47. package/dist/markdown.d.ts +75 -0
  48. package/dist/markdown.d.ts.map +1 -0
  49. package/dist/markdown.js +265 -0
  50. package/dist/media-type.d.ts +72 -0
  51. package/dist/media-type.d.ts.map +1 -0
  52. package/dist/media-type.js +157 -0
  53. package/dist/moment.d.ts +7 -0
  54. package/dist/moment.d.ts.map +1 -0
  55. package/dist/moment.js +18 -0
  56. package/dist/not-ready.d.ts +2 -0
  57. package/dist/not-ready.d.ts.map +1 -0
  58. package/dist/not-ready.js +5 -0
  59. package/dist/paths.d.ts +25 -2
  60. package/dist/paths.d.ts.map +1 -1
  61. package/dist/paths.js +191 -16
  62. package/dist/pattern.d.ts +10 -0
  63. package/dist/pattern.d.ts.map +1 -0
  64. package/dist/pattern.js +356 -0
  65. package/dist/project.d.ts +1 -0
  66. package/dist/project.d.ts.map +1 -1
  67. package/dist/project.js +61 -65
  68. package/dist/query/language.d.ts +254 -0
  69. package/dist/query/language.d.ts.map +1 -0
  70. package/dist/query/language.js +620 -0
  71. package/dist/query/match.d.ts +14 -0
  72. package/dist/query/match.d.ts.map +1 -0
  73. package/dist/query/match.js +150 -0
  74. package/dist/query/rows.d.ts +32 -0
  75. package/dist/query/rows.d.ts.map +1 -0
  76. package/dist/query/rows.js +158 -0
  77. package/dist/query/sql.d.ts +39 -0
  78. package/dist/query/sql.d.ts.map +1 -0
  79. package/dist/query/sql.js +285 -0
  80. package/dist/references.d.ts +1 -1
  81. package/dist/references.d.ts.map +1 -1
  82. package/dist/references.js +7 -2
  83. package/dist/refuse.d.ts +1 -0
  84. package/dist/refuse.d.ts.map +1 -1
  85. package/dist/refuse.js +1 -0
  86. package/dist/reserved.d.ts +6 -0
  87. package/dist/reserved.d.ts.map +1 -0
  88. package/dist/reserved.js +21 -0
  89. package/dist/room-types.d.ts +7 -0
  90. package/dist/room-types.d.ts.map +1 -0
  91. package/dist/room-types.js +136 -0
  92. package/dist/schema.d.ts +1 -2
  93. package/dist/schema.d.ts.map +1 -1
  94. package/dist/schema.js +11 -24
  95. package/dist/types.d.ts +62 -2
  96. package/dist/types.d.ts.map +1 -1
  97. package/dist/validate.d.ts +36 -2
  98. package/dist/validate.d.ts.map +1 -1
  99. package/dist/validate.js +387 -142
  100. package/dist/yaml.d.ts +7 -3
  101. package/dist/yaml.d.ts.map +1 -1
  102. package/dist/yaml.js +110 -55
  103. package/fixtures/README.md +67 -25
  104. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  105. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  106. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  107. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  108. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  109. package/fixtures/cases/absolute-link/library/item.md +1 -1
  110. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  111. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  112. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  113. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  114. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  115. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  116. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  117. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  118. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  119. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  120. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  121. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  122. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  123. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  124. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  125. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  126. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  127. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  128. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  129. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  130. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  131. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  132. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  133. package/fixtures/cases/boolean-field/expected.json +2 -1
  134. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  135. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  136. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  137. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  138. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  139. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  140. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  141. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  142. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  143. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  144. package/fixtures/cases/conditional-long-text/expected.json +7 -0
  145. package/fixtures/cases/conditional-long-text/library/questions/hosting.md +9 -0
  146. package/fixtures/cases/conditional-long-text/library/questions/payments.md +12 -0
  147. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  148. package/fixtures/cases/cross-room-link/library/clients/acme.md +6 -0
  149. package/fixtures/cases/cross-room-link/schema.yaml +3 -0
  150. package/fixtures/cases/cross-room-reference/expected.json +1 -0
  151. package/fixtures/cases/cross-room-reference/library/clients/acme.md +9 -0
  152. package/fixtures/cases/cross-room-reference/schema.yaml +8 -0
  153. package/fixtures/cases/date-time-format/expected.json +2 -1
  154. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  155. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  156. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  157. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  158. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  159. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  160. package/fixtures/cases/defs-pattern/expected.json +2 -1
  161. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  162. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  163. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  164. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  165. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  166. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  167. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  168. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  169. package/fixtures/cases/email-format/expected.json +2 -1
  170. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  171. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  172. package/fixtures/cases/email-format/schema.yaml +10 -11
  173. package/fixtures/cases/equal-labels/expected.json +5 -0
  174. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  175. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  176. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  177. package/fixtures/cases/field-enum/expected.json +2 -1
  178. package/fixtures/cases/field-enum/library/item.md +2 -2
  179. package/fixtures/cases/field-enum/schema.yaml +3 -4
  180. package/fixtures/cases/integer-field/expected.json +2 -1
  181. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  182. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  183. package/fixtures/cases/integer-field/schema.yaml +10 -11
  184. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  185. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  186. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  187. package/fixtures/cases/labels-in-the-rooms-language/expected.json +1 -0
  188. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  189. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  190. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  191. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  192. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  193. package/fixtures/cases/link-into-a-reserved-name/expected.json +5 -0
  194. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +6 -0
  195. package/fixtures/cases/link-into-a-reserved-name/schema.yaml +3 -0
  196. package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/expected.json +5 -0
  197. package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/library/notes/b.md +5 -0
  198. package/fixtures/cases/list-item-enum/expected.json +7 -0
  199. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  200. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  201. package/fixtures/cases/list-item-kind/context.json +1 -0
  202. package/fixtures/cases/list-item-kind/expected.json +7 -0
  203. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  204. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  205. package/fixtures/cases/list-items/context.json +1 -0
  206. package/fixtures/cases/list-items/expected.json +1 -0
  207. package/fixtures/cases/list-items/library/page.md +26 -0
  208. package/fixtures/cases/list-items/schema.yaml +10 -0
  209. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  210. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  211. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  212. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  213. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  214. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  215. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  216. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  217. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  218. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  219. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  220. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  221. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  222. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  223. package/fixtures/cases/list-reference-path/context.json +1 -0
  224. package/fixtures/cases/list-reference-path/expected.json +7 -0
  225. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  226. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  227. package/fixtures/cases/list-reference-type/context.json +1 -0
  228. package/fixtures/cases/list-reference-type/expected.json +7 -0
  229. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  230. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  231. package/fixtures/cases/list-size/expected.json +2 -1
  232. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  233. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  234. package/fixtures/cases/list-size/schema.yaml +10 -11
  235. package/fixtures/cases/long-value-past-six-levels/context.json +1 -0
  236. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  237. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  238. package/fixtures/cases/malformed-list/context.json +1 -0
  239. package/fixtures/cases/malformed-list/expected.json +7 -0
  240. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  241. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  242. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  243. package/fixtures/cases/member-on-an-untyped-document/context.json +1 -0
  244. package/fixtures/cases/member-on-an-untyped-document/expected.json +6 -0
  245. package/fixtures/cases/member-on-an-untyped-document/library/note.md +4 -0
  246. package/fixtures/cases/member-on-another-type/context.json +1 -0
  247. package/fixtures/cases/member-on-another-type/expected.json +6 -0
  248. package/fixtures/cases/member-on-another-type/library/note.md +4 -0
  249. package/fixtures/cases/member-on-another-type/schema.yaml +7 -0
  250. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  251. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  252. package/fixtures/cases/misspelled-key/expected.json +2 -1
  253. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  254. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  255. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  256. package/fixtures/cases/name-not-a-string/context.json +1 -0
  257. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  258. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  259. package/fixtures/cases/nested-defs/expected.json +2 -1
  260. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  261. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  262. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  263. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  264. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  265. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  266. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  267. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  268. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  269. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  270. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  271. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  272. package/fixtures/cases/nested-required-field/expected.json +2 -1
  273. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  274. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  275. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  276. package/fixtures/cases/numeric-range/expected.json +2 -1
  277. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  278. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  279. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  280. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  281. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  282. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  283. package/fixtures/cases/one-key-two-types/context.json +1 -0
  284. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  285. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  286. package/fixtures/cases/one-of-variant/expected.json +2 -1
  287. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  288. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  289. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  290. package/fixtures/cases/other-room-reference/expected.json +2 -1
  291. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  292. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  293. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  294. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  295. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  296. package/fixtures/cases/prototype-field/expected.json +2 -1
  297. package/fixtures/cases/prototype-field/library/item.md +2 -2
  298. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  299. package/fixtures/cases/reference-into-a-reserved-name/context.json +1 -0
  300. package/fixtures/cases/reference-into-a-reserved-name/expected.json +7 -0
  301. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +4 -0
  302. package/fixtures/cases/reference-into-a-reserved-name/library/settings/brief.md +1 -0
  303. package/fixtures/cases/reference-into-a-reserved-name/schema.yaml +3 -0
  304. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  305. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  306. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  307. package/fixtures/cases/room-md-declares-a-type/context.json +1 -0
  308. package/fixtures/cases/room-md-declares-a-type/expected.json +6 -0
  309. package/fixtures/cases/room-md-declares-a-type/library/ROOM.md +5 -0
  310. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  311. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  312. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  313. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  314. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  315. package/fixtures/cases/string-length/expected.json +2 -1
  316. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  317. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  318. package/fixtures/cases/string-length/schema.yaml +10 -11
  319. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  320. package/fixtures/cases/text-field-kind/expected.json +1 -4
  321. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  322. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  323. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  324. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  325. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  326. package/fixtures/cases/typed-path-names-another-type/context.json +11 -0
  327. package/fixtures/cases/typed-path-names-another-type/expected.json +6 -0
  328. package/fixtures/cases/typed-path-names-another-type/library/settings/prefs/one.md +3 -0
  329. package/fixtures/cases/typed-path-names-another-type/schema.yaml +6 -0
  330. package/fixtures/cases/typed-path-names-its-type/context.json +11 -0
  331. package/fixtures/cases/typed-path-names-its-type/expected.json +3 -0
  332. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/deeper/two.md +1 -0
  333. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +4 -0
  334. package/fixtures/cases/typed-path-names-its-type/schema.yaml +6 -0
  335. package/fixtures/cases/typed-path-names-no-type/context.json +11 -0
  336. package/fixtures/cases/typed-path-names-no-type/expected.json +6 -0
  337. package/fixtures/cases/typed-path-names-no-type/library/settings/prefs/one.md +1 -0
  338. package/fixtures/cases/typed-path-names-no-type/schema.yaml +6 -0
  339. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  340. package/fixtures/cases/undeclared-field/expected.json +2 -1
  341. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  342. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  343. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  344. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  345. package/fixtures/cases/unnamed-typed-path-checks-its-fields/context.json +11 -0
  346. package/fixtures/cases/unnamed-typed-path-checks-its-fields/expected.json +6 -0
  347. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +5 -0
  348. package/fixtures/cases/unnamed-typed-path-checks-its-fields/schema.yaml +5 -0
  349. package/fixtures/cases/unnamed-typed-path-names-a-type/context.json +11 -0
  350. package/fixtures/cases/unnamed-typed-path-names-a-type/expected.json +6 -0
  351. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +7 -0
  352. package/fixtures/cases/unnamed-typed-path-names-a-type/schema.yaml +5 -0
  353. package/fixtures/cases/unnamed-typed-path-reads-its-type/context.json +11 -0
  354. package/fixtures/cases/unnamed-typed-path-reads-its-type/expected.json +3 -0
  355. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/plan.md +1 -0
  356. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +6 -0
  357. package/fixtures/cases/unnamed-typed-path-reads-its-type/schema.yaml +5 -0
  358. package/fixtures/cases/unnamed-typed-path-without-a-body/context.json +11 -0
  359. package/fixtures/cases/unnamed-typed-path-without-a-body/expected.json +5 -0
  360. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +5 -0
  361. package/fixtures/cases/unnamed-typed-path-without-a-body/schema.yaml +5 -0
  362. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  363. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  364. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  365. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  366. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  367. package/fixtures/division.json +111 -66
  368. package/fixtures/forms.json +347 -0
  369. package/fixtures/preamble.json +29 -8
  370. package/fixtures/projection.json +121 -18
  371. package/fixtures/queries.json +1150 -0
  372. package/package.json +19 -3
  373. package/dist/blocks.d.ts +0 -11
  374. package/dist/blocks.d.ts.map +0 -1
  375. package/dist/blocks.js +0 -62
  376. package/dist/condition.d.ts +0 -137
  377. package/dist/condition.d.ts.map +0 -1
  378. package/dist/condition.js +0 -394
  379. package/dist/links.d.ts +0 -26
  380. package/dist/links.d.ts.map +0 -1
  381. package/dist/links.js +0 -774
  382. package/dist/profile.d.ts +0 -6
  383. package/dist/profile.d.ts.map +0 -1
  384. package/dist/profile.js +0 -5
  385. package/dist/sections.d.ts +0 -11
  386. package/dist/sections.d.ts.map +0 -1
  387. package/dist/sections.js +0 -57
  388. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  389. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  390. package/fixtures/cases/null-refused/expected.json +0 -6
  391. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  392. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  393. package/fixtures/cases/null-refused/schema.yaml +0 -56
  394. package/fixtures/cases/open-map-value/expected.json +0 -6
  395. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  396. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  397. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  398. package/fixtures/cases/section-item-enum/expected.json +0 -6
  399. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  400. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  401. package/fixtures/cases/section-item-kind/expected.json +0 -6
  402. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  403. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  404. package/fixtures/cases/section-items/library/page.md +0 -42
  405. package/fixtures/cases/section-items/schema.yaml +0 -10
  406. package/fixtures/cases/section-reference-path/expected.json +0 -6
  407. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  408. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  409. package/fixtures/cases/section-reference-type/expected.json +0 -6
  410. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  411. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  412. package/fixtures/cases/structured-section/expected.json +0 -6
  413. /package/fixtures/cases/{missing-section-item-kind → conditional-long-text}/context.json +0 -0
  414. /package/fixtures/cases/{null-refused → cross-room-link}/context.json +0 -0
  415. /package/fixtures/cases/{section-items → cross-room-link}/expected.json +0 -0
  416. /package/fixtures/cases/{open-map-value → cross-room-reference}/context.json +0 -0
  417. /package/fixtures/cases/{section-item-enum → equal-labels}/context.json +0 -0
  418. /package/fixtures/cases/{section-item-kind → labels-in-the-rooms-language}/context.json +0 -0
  419. /package/fixtures/cases/{section-items → lazy-list-item}/context.json +0 -0
  420. /package/fixtures/cases/{section-reference-type → link-into-a-reserved-name}/context.json +0 -0
  421. /package/fixtures/cases/{section-reference-path → link-into-a-reserved-name-from-an-untyped-document}/context.json +0 -0
  422. /package/fixtures/cases/{structured-section → list-item-enum}/context.json +0 -0
  423. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  424. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  425. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
@@ -1,4 +1,4 @@
1
1
  import { type Definition } from './definition.js';
2
2
  import type { Document, Reference } from './types.js';
3
- export declare function references(document: Document, definition: Definition): readonly Reference[];
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,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAwBtD,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG,SAAS,SAAS,EAAE,CAI3F"}
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"}
@@ -5,7 +5,12 @@ function collect(value, facts, pointer, found) {
5
5
  return;
6
6
  if (typeof value === 'string') {
7
7
  if (facts.reference !== undefined)
8
- found.push({ pointer, value, to: facts.reference });
8
+ found.push({
9
+ pointer,
10
+ value,
11
+ to: facts.reference,
12
+ ...(facts.crossRoom === true ? { crossRoom: true } : {}),
13
+ });
9
14
  return;
10
15
  }
11
16
  if (Array.isArray(value)) {
@@ -20,6 +25,6 @@ function collect(value, facts, pointer, found) {
20
25
  }
21
26
  export function references(document, definition) {
22
27
  const found = [];
23
- collect(document.fields, definition.frontmatter, '', found);
28
+ collect(document.fields, definition.root, '', found);
24
29
  return found;
25
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
  }
@@ -0,0 +1,6 @@
1
+ export declare const ROOM_DESCRIPTION = "ROOM.md";
2
+ export declare const CAPTURE_HOME = "capture";
3
+ export declare const RESERVED_NAMES: readonly string[];
4
+ export declare function isReservedName(name: string): boolean;
5
+ export declare function isDocumentPath(path: string): boolean;
6
+ //# sourceMappingURL=reserved.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,21 @@
1
+ export const ROOM_DESCRIPTION = 'ROOM.md';
2
+ export const CAPTURE_HOME = 'capture';
3
+ export const RESERVED_NAMES = [
4
+ ROOM_DESCRIPTION,
5
+ CAPTURE_HOME,
6
+ 'settings',
7
+ 'rooms',
8
+ 'agents',
9
+ 'house',
10
+ ];
11
+ function folded(name) {
12
+ return name.replace(/[A-Z]/g, (letter) => letter.toLowerCase());
13
+ }
14
+ const FOLDED_RESERVED_NAMES = new Set(RESERVED_NAMES.map(folded));
15
+ export function isReservedName(name) {
16
+ return FOLDED_RESERVED_NAMES.has(folded(name));
17
+ }
18
+ export function isDocumentPath(path) {
19
+ const first = path.split('/', 1)[0];
20
+ return first !== '' && !isReservedName(first);
21
+ }
@@ -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,6 +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 fitsItem(definition: Definition, section: string, text: string): boolean;
6
+ export declare function schemaRefusal(definition: Definition, fields: Readonly<Record<string, unknown>>): SchemaRefusal | undefined;
8
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;AAS5E,MAAM,MAAM,aAAa,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AA2KjF,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxC,aAAa,GAAG,SAAS,CAG3B;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"}
package/dist/schema.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { Validator } from '@cfworker/json-schema';
2
2
  import { escapePointer, refTarget } from './definition.js';
3
- import { MEMBER_FIELD, RECEIVED_FIELD, SITE_FIELD } from './fields.js';
4
- import { interpretPlain, isRecord } from './yaml.js';
3
+ import { MEMBER_FIELD, SITE_FIELD, SUBMITTED_FIELD, TYPE_FIELD } from './fields.js';
4
+ import { withLinearRegExp } from './pattern.js';
5
+ import { isRecord } from './yaml.js';
5
6
  const STANDING_MAPS = ['properties', 'patternProperties'];
6
7
  const STANDING = [
7
8
  'additionalProperties',
@@ -97,24 +98,17 @@ function copied(value) {
97
98
  }
98
99
  function compile(definition) {
99
100
  const defs = copied(definition.shape.defs);
100
- const { sections, member_document: _mark, ...root } = copied(definition.shape.schema);
101
+ const { member_document: _mark, ...written } = copied(definition.shape.schema);
101
102
  const closedDefs = mapped(defs, (held) => closed(held, true, defs));
102
- const declared = isRecord(root.properties) ? root.properties : {};
103
+ const declared = isRecord(written.properties) ? written.properties : {};
103
104
  const properties = {
104
- type: true,
105
+ [TYPE_FIELD]: true,
105
106
  [SITE_FIELD]: true,
106
- [RECEIVED_FIELD]: true,
107
+ [SUBMITTED_FIELD]: true,
107
108
  ...(definition.memberDocument ? { [MEMBER_FIELD]: { type: 'string' } } : {}),
108
109
  ...declared,
109
110
  };
110
- const frontmatter = new Validator({ ...closed({ ...root, properties }, false, defs, true), $defs: closedDefs }, '2020-12', false);
111
- const lists = new Map();
112
- for (const [name, spec] of Object.entries(isRecord(sections) ? sections : {})) {
113
- if (!isRecord(spec) || spec.kind !== 'list')
114
- continue;
115
- lists.set(name, new Validator({ ...closed(spec.items, false, defs), $defs: closedDefs }, '2020-12', false));
116
- }
117
- return { frontmatter, sections: lists };
111
+ return new Validator({ ...closed({ ...written, properties }, false, defs, true), $defs: closedDefs }, '2020-12', false);
118
112
  }
119
113
  function compiledOf(definition) {
120
114
  const held = compiled.get(definition);
@@ -149,15 +143,8 @@ function refusalOf(errors) {
149
143
  }
150
144
  return { rule: 'schema', location: '' };
151
145
  }
152
- export function frontmatterRefusal(definition, fields) {
153
- const result = compiledOf(definition).frontmatter.validate(fields);
146
+ export function schemaRefusal(definition, fields) {
147
+ const validator = compiledOf(definition);
148
+ const result = withLinearRegExp(() => validator.validate(fields));
154
149
  return result.valid ? undefined : refusalOf(result.errors);
155
150
  }
156
- export function fitsItem(definition, section, text) {
157
- const spec = definition.sections[section];
158
- const validator = compiledOf(definition).sections.get(section);
159
- if (spec?.kind !== 'list' || validator === undefined)
160
- return false;
161
- const typed = spec.items.type === 'string' ? text : interpretPlain(text);
162
- return validator.validate(typed).valid;
163
- }
package/dist/types.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { Definition } from './definition.js';
2
2
  export type Library = Readonly<Record<string, string>>;
3
3
  export type VerifiedModel = {
4
4
  readonly types: Readonly<Record<string, Definition>>;
5
+ readonly nameable?: readonly string[];
5
6
  };
6
7
  export type ModelVerification = {
7
8
  readonly verdict: 'accept';
@@ -11,15 +12,23 @@ export type ModelVerification = {
11
12
  readonly rule: string;
12
13
  readonly location?: string;
13
14
  };
15
+ export type TypedPath = {
16
+ readonly path: string;
17
+ readonly type: string;
18
+ readonly named: boolean;
19
+ readonly body: boolean;
20
+ };
14
21
  export type ValidationContext = {
15
22
  readonly binaryTargets: readonly string[];
23
+ readonly anyRoom?: true;
24
+ readonly typedPaths?: readonly TypedPath[];
16
25
  };
17
26
  export type ProjectionContext = {
18
27
  readonly documentTargets: readonly string[];
19
28
  readonly definition?: Definition;
20
29
  };
21
30
  export type DivisionContext = ProjectionContext & {
22
- readonly budget: number;
31
+ readonly bound: number;
23
32
  };
24
33
  export type Extent = {
25
34
  readonly start: number;
@@ -34,18 +43,39 @@ export type Document = {
34
43
  readonly fields: Readonly<Record<string, unknown>>;
35
44
  readonly preamble: string;
36
45
  readonly sections: Readonly<Record<string, string>>;
46
+ readonly text: string;
47
+ readonly ranges: Readonly<Record<string, Extent>>;
48
+ readonly listEnd: number;
37
49
  };
50
+ export type DefinitionOf = (type: string | undefined) => Definition | undefined;
38
51
  export type Refusal = {
39
52
  readonly file: string;
40
53
  readonly rule: string;
41
54
  readonly location?: string;
55
+ readonly line?: number;
42
56
  readonly referrers?: readonly string[];
43
57
  };
58
+ export type Reached = {
59
+ readonly target: string | null;
60
+ readonly to: readonly string[];
61
+ };
62
+ export type DocumentCheck = {
63
+ readonly ok: false;
64
+ } | {
65
+ readonly ok: true;
66
+ readonly type: string;
67
+ readonly typed: boolean;
68
+ readonly references: readonly Reached[];
69
+ };
44
70
  export type Validation = {
45
71
  readonly verdict: 'accept';
46
72
  } | ({
47
73
  readonly verdict: 'refuse';
48
74
  } & Refusal);
75
+ export type ValidationStep = {
76
+ readonly path: string;
77
+ readonly resolved: number;
78
+ };
49
79
  export type Projection = {
50
80
  readonly ok: true;
51
81
  readonly text: string;
@@ -75,7 +105,21 @@ export type Reference = {
75
105
  readonly pointer: string;
76
106
  readonly value: string;
77
107
  readonly to: readonly string[];
108
+ readonly crossRoom?: true;
78
109
  };
110
+ export type RoomReference = {
111
+ readonly handle: string;
112
+ readonly path: string;
113
+ } & ({
114
+ readonly kind: 'link';
115
+ readonly href: string;
116
+ } | {
117
+ readonly kind: 'field';
118
+ readonly pointer: string;
119
+ readonly value: string;
120
+ readonly to: readonly string[];
121
+ readonly crossRoom?: true;
122
+ });
79
123
  export type Change = {
80
124
  readonly kind: 'field';
81
125
  readonly name: string;
@@ -85,11 +129,15 @@ export type Change = {
85
129
  readonly kind: 'section';
86
130
  readonly name: string;
87
131
  readonly value: string;
88
- readonly prior: string;
132
+ readonly prior: string | undefined;
89
133
  } | {
90
134
  readonly kind: 'preamble';
91
135
  readonly value: string;
92
136
  readonly prior: string;
137
+ } | {
138
+ readonly kind: 'text';
139
+ readonly value: string;
140
+ readonly prior: string;
93
141
  } | {
94
142
  readonly kind: 'link';
95
143
  readonly href: string;
@@ -106,8 +154,20 @@ export type ApplyResult = {
106
154
  } | {
107
155
  readonly outcome: 'stale';
108
156
  readonly document: Document;
157
+ readonly stale: readonly number[];
109
158
  } | {
110
159
  readonly outcome: 'refuse';
111
160
  readonly refusal: Refusal;
112
161
  };
162
+ export type BodyResult = {
163
+ readonly outcome: 'applied';
164
+ readonly body: string;
165
+ } | {
166
+ readonly outcome: 'refuse';
167
+ readonly refusal: Refusal;
168
+ };
169
+ export type UnlinkedBody = {
170
+ readonly body: string;
171
+ readonly links: ReadonlyMap<string, string>;
172
+ };
113
173
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAA;CAAE,GAC7D;IACE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEN,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC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
2
- export declare function verify(schema: string): ModelVerification;
1
+ import { type Definition } from './definition.js';
2
+ import { type KeyedLink } from './paths.js';
3
+ import type { DefinitionOf, Document, DocumentCheck, Library, ModelVerification, ParseResult, Reached, RoomReference, TypedPath, Validation, ValidationContext, ValidationStep, VerifiedModel } from './types.js';
4
+ export declare function definitionAt(model: VerifiedModel, file: string, typedPaths?: readonly TypedPath[]): DefinitionOf;
5
+ export declare function resolves(reference: Reached, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): boolean;
6
+ export declare function verify(schema: string, provided?: VerifiedModel): ModelVerification;
7
+ export declare function readTypes(schema: string, provided?: VerifiedModel): VerifiedModel;
8
+ type Placing = Pick<ValidationContext, 'anyRoom' | 'typedPaths'>;
9
+ export declare function checkDocument(file: string, content: string, model: VerifiedModel, context?: Placing): DocumentCheck;
10
+ export declare function bodyRoomLinks(body: string): RoomReference[];
11
+ export declare function bodyKeyedLinks(body: string): KeyedLink[];
12
+ export declare function roomReferences(document: Document, definition?: Definition): readonly RoomReference[];
13
+ type Placed = {
14
+ readonly reference: Reached;
15
+ readonly location: string;
16
+ readonly line?: number;
17
+ };
18
+ export type Assessment = {
19
+ readonly file: string;
20
+ readonly type: string | undefined;
21
+ readonly targets: readonly string[];
22
+ readonly read: Validation | null;
23
+ readonly structured: Validation | null;
24
+ readonly fields: readonly Placed[];
25
+ readonly linked: boolean;
26
+ };
27
+ export declare function assess(file: string, parsed: ParseResult, binary: boolean, model?: VerifiedModel, context?: Placing): Assessment;
28
+ export declare function assessReferences(file: string, parsed: ParseResult, changed: ReadonlySet<string>, model?: VerifiedModel, context?: Placing): Assessment;
29
+ export type Verdicts = {
30
+ add(assessment: Assessment, typeOf: (path: string) => string | undefined, binary: (path: string) => boolean): number;
31
+ verdict(): Validation;
32
+ };
33
+ export declare function verdicts(): Verdicts;
34
+ export declare function validating(library: ReadonlyMap<string, string>, context?: ValidationContext, model?: VerifiedModel): Generator<ValidationStep, Validation, void>;
3
35
  export declare function validate(library: Library, context?: ValidationContext, model?: VerifiedModel): Validation;
36
+ export declare function validateParsed(library: ReadonlyMap<string, ParseResult>, context?: ValidationContext, model?: VerifiedModel): Validation;
37
+ export {};
4
38
  //# sourceMappingURL=validate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAGV,OAAO,EACP,iBAAiB,EAEjB,UAAU,EACV,iBAAiB,EACjB,aAAa,EACd,MAAM,YAAY,CAAC;AAwDpB,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAQxD;AAED,wBAAgB,QAAQ,CACtB,OAAO,EAAE,OAAO,EAChB,OAAO,GAAE,iBAAyC,EAClD,KAAK,GAAE,aAA6B,GACnC,UAAU,CAyGZ"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAMjF,OAAO,KAAK,EACV,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,OAAO,EACP,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,aAAa,EACb,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACd,MAAM,YAAY,CAAC;AA6FpB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,SAAS,SAAS,EAAE,GAChC,YAAY,CAOd;AA8BD,wBAAgB,QAAQ,CACtB,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAChC,OAAO,CAET;AAUD,wBAAgB,MAAM,C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