@agentshouse/mdmodel 0.1.0-c1b026eddaa7c → 0.1.0-c2003dca37973

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 (403) hide show
  1. package/API.md +163 -191
  2. package/README.md +25 -25
  3. package/dist/body.d.ts +85 -0
  4. package/dist/body.d.ts.map +1 -0
  5. package/dist/body.js +1083 -0
  6. package/dist/built-in.d.ts +4 -0
  7. package/dist/built-in.d.ts.map +1 -0
  8. package/dist/built-in.js +19 -0
  9. package/dist/definition.d.ts +23 -10
  10. package/dist/definition.d.ts.map +1 -1
  11. package/dist/definition.js +171 -116
  12. package/dist/document.d.ts +14 -8
  13. package/dist/document.d.ts.map +1 -1
  14. package/dist/document.js +747 -137
  15. package/dist/event.d.ts +1 -2
  16. package/dist/event.d.ts.map +1 -1
  17. package/dist/event.js +2 -3
  18. package/dist/facts.d.ts.map +1 -1
  19. package/dist/facts.js +3 -0
  20. package/dist/fields.d.ts +1 -1
  21. package/dist/fields.d.ts.map +1 -1
  22. package/dist/fields.js +2 -2
  23. package/dist/form.d.ts +4 -0
  24. package/dist/form.d.ts.map +1 -0
  25. package/dist/form.js +153 -0
  26. package/dist/house-model.d.ts +870 -0
  27. package/dist/house-model.d.ts.map +1 -0
  28. package/dist/house-model.js +472 -0
  29. package/dist/house-references/crockford.d.ts +4 -0
  30. package/dist/house-references/crockford.d.ts.map +1 -0
  31. package/dist/house-references/crockford.js +3 -0
  32. package/dist/house-references/patterns.d.ts +9 -0
  33. package/dist/house-references/patterns.d.ts.map +1 -0
  34. package/dist/house-references/patterns.js +13 -0
  35. package/dist/index.d.ts +31 -17
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +20 -12
  38. package/dist/indexed.d.ts +9 -0
  39. package/dist/indexed.d.ts.map +1 -0
  40. package/dist/indexed.js +55 -0
  41. package/dist/kinds.d.ts +4 -2
  42. package/dist/kinds.d.ts.map +1 -1
  43. package/dist/kinds.js +60 -11
  44. package/dist/markdown.d.ts +71 -0
  45. package/dist/markdown.d.ts.map +1 -0
  46. package/dist/markdown.js +232 -0
  47. package/dist/media-type.d.ts +72 -0
  48. package/dist/media-type.d.ts.map +1 -0
  49. package/dist/media-type.js +157 -0
  50. package/dist/moment.d.ts +7 -0
  51. package/dist/moment.d.ts.map +1 -0
  52. package/dist/moment.js +18 -0
  53. package/dist/not-ready.d.ts +2 -0
  54. package/dist/not-ready.d.ts.map +1 -0
  55. package/dist/not-ready.js +5 -0
  56. package/dist/paths.d.ts +16 -1
  57. package/dist/paths.d.ts.map +1 -1
  58. package/dist/paths.js +95 -22
  59. package/dist/query/language.d.ts +2 -1
  60. package/dist/query/language.d.ts.map +1 -1
  61. package/dist/query/language.js +1 -1
  62. package/dist/query/match.d.ts +1 -1
  63. package/dist/query/match.d.ts.map +1 -1
  64. package/dist/query/rows.d.ts +1 -1
  65. package/dist/query/rows.d.ts.map +1 -1
  66. package/dist/query/rows.js +2 -5
  67. package/dist/query/sql.d.ts +5 -1
  68. package/dist/query/sql.d.ts.map +1 -1
  69. package/dist/query/sql.js +3 -3
  70. package/dist/query/walk.d.ts +63 -0
  71. package/dist/query/walk.d.ts.map +1 -0
  72. package/dist/query/walk.js +263 -0
  73. package/dist/references.d.ts +2 -2
  74. package/dist/references.d.ts.map +1 -1
  75. package/dist/references.js +1 -1
  76. package/dist/refuse.d.ts +1 -0
  77. package/dist/refuse.d.ts.map +1 -1
  78. package/dist/refuse.js +1 -0
  79. package/dist/reserved.d.ts +1 -0
  80. package/dist/reserved.d.ts.map +1 -1
  81. package/dist/reserved.js +2 -1
  82. package/dist/room-types.d.ts +7 -0
  83. package/dist/room-types.d.ts.map +1 -0
  84. package/dist/room-types.js +136 -0
  85. package/dist/schema.d.ts +1 -3
  86. package/dist/schema.d.ts.map +1 -1
  87. package/dist/schema.js +9 -73
  88. package/dist/types.d.ts +11 -38
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/validate.d.ts +6 -2
  91. package/dist/validate.d.ts.map +1 -1
  92. package/dist/validate.js +111 -178
  93. package/dist/yaml.d.ts +7 -5
  94. package/dist/yaml.d.ts.map +1 -1
  95. package/dist/yaml.js +154 -33
  96. package/fixtures/README.md +73 -68
  97. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  98. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  99. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  100. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  101. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  102. package/fixtures/cases/absolute-link/library/item.md +1 -1
  103. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  104. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  105. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  106. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  107. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  108. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  109. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  110. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  111. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  112. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  113. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  114. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  115. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  116. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  117. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  118. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  119. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  120. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  121. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  122. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  123. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  124. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  125. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  126. package/fixtures/cases/block-scalar-frontmatter/library/notes/literal.md +17 -0
  127. package/fixtures/cases/block-scalar-frontmatter/library/skills/notes/SKILL.md +10 -0
  128. package/fixtures/cases/boolean-field/expected.json +2 -1
  129. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  130. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  131. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  132. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  133. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  134. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  135. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  136. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  137. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  138. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  139. package/fixtures/cases/{conditional-section → conditional-long-text}/expected.json +3 -2
  140. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/hosting.md +2 -2
  141. package/fixtures/cases/{conditional-section → conditional-long-text}/library/questions/payments.md +2 -2
  142. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  143. package/fixtures/cases/cross-room-link/library/clients/acme.md +1 -1
  144. package/fixtures/cases/cross-room-reference/library/clients/acme.md +4 -4
  145. package/fixtures/cases/cross-room-reference/schema.yaml +1 -2
  146. package/fixtures/cases/date-time-format/expected.json +2 -1
  147. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  148. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  149. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  150. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  151. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  152. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  153. package/fixtures/cases/defs-pattern/expected.json +2 -1
  154. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  155. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  156. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  157. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  158. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  159. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  160. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  161. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  162. package/fixtures/cases/email-format/expected.json +2 -1
  163. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  164. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  165. package/fixtures/cases/email-format/schema.yaml +10 -11
  166. package/fixtures/cases/equal-labels/expected.json +5 -0
  167. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  168. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  169. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  170. package/fixtures/cases/field-enum/expected.json +2 -1
  171. package/fixtures/cases/field-enum/library/item.md +2 -2
  172. package/fixtures/cases/field-enum/schema.yaml +3 -4
  173. package/fixtures/cases/frontmatter-construct/expected.json +7 -0
  174. package/fixtures/cases/frontmatter-construct/library/note.md +6 -0
  175. package/fixtures/cases/integer-field/expected.json +2 -1
  176. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  177. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  178. package/fixtures/cases/integer-field/schema.yaml +10 -11
  179. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  180. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  181. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  182. package/fixtures/cases/labels-in-the-rooms-language/expected.json +1 -0
  183. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  184. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  185. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  186. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  187. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  188. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +1 -1
  189. package/fixtures/cases/list-item-enum/expected.json +7 -0
  190. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  191. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  192. package/fixtures/cases/list-item-kind/expected.json +7 -0
  193. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  194. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  195. package/fixtures/cases/list-items/expected.json +1 -0
  196. package/fixtures/cases/list-items/library/page.md +26 -0
  197. package/fixtures/cases/list-items/schema.yaml +10 -0
  198. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  199. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  200. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  201. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  202. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  203. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  204. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  205. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  206. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  207. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  208. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  209. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  210. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  211. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  212. package/fixtures/cases/list-reference-path/expected.json +7 -0
  213. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  214. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  215. package/fixtures/cases/list-reference-type/context.json +1 -0
  216. package/fixtures/cases/list-reference-type/expected.json +7 -0
  217. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  218. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  219. package/fixtures/cases/list-size/expected.json +2 -1
  220. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  221. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  222. package/fixtures/cases/list-size/schema.yaml +10 -11
  223. package/fixtures/cases/long-value-past-six-levels/context.json +1 -0
  224. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  225. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  226. package/fixtures/cases/malformed-list/context.json +1 -0
  227. package/fixtures/cases/malformed-list/expected.json +7 -0
  228. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  229. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  230. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  231. package/fixtures/cases/member-on-another-type/library/note.md +1 -1
  232. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  233. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  234. package/fixtures/cases/misspelled-key/expected.json +2 -1
  235. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  236. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  237. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  238. package/fixtures/cases/name-not-a-string/context.json +1 -0
  239. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  240. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  241. package/fixtures/cases/nested-defs/expected.json +2 -1
  242. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  243. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  244. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  245. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  246. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  247. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  248. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  249. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  250. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  251. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  252. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  253. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  254. package/fixtures/cases/nested-required-field/expected.json +2 -1
  255. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  256. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  257. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  258. package/fixtures/cases/numeric-range/expected.json +2 -1
  259. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  260. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  261. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  262. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  263. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  264. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  265. package/fixtures/cases/one-key-two-types/context.json +1 -0
  266. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  267. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  268. package/fixtures/cases/one-of-variant/expected.json +2 -1
  269. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  270. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  271. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  272. package/fixtures/cases/other-room-reference/expected.json +2 -1
  273. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  274. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  275. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  276. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  277. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  278. package/fixtures/cases/prototype-field/expected.json +2 -1
  279. package/fixtures/cases/prototype-field/library/item.md +2 -2
  280. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  281. package/fixtures/cases/reference-into-a-reserved-name/expected.json +2 -1
  282. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +1 -1
  283. package/fixtures/cases/reference-to-any-file-name/context.json +1 -0
  284. package/fixtures/cases/reference-to-any-file-name/expected.json +1 -0
  285. package/fixtures/cases/reference-to-any-file-name/library/people/100%.md +4 -0
  286. package/fixtures/cases/reference-to-any-file-name/library/people/C#.md +4 -0
  287. package/fixtures/cases/reference-to-any-file-name/library/people/My notes.md +4 -0
  288. package/fixtures/cases/reference-to-any-file-name/library/people/[draft].md +4 -0
  289. package/fixtures/cases/reference-to-any-file-name/library/people/c (d).md +4 -0
  290. package/fixtures/cases/reference-to-any-file-name/library/people/caf/303/251.md +4 -0
  291. package/fixtures/cases/reference-to-any-file-name/library/people//320/236/321/202/321/207/321/221/321/202.md +4 -0
  292. package/fixtures/cases/reference-to-any-file-name/library/tasks/bracket.md +9 -0
  293. package/fixtures/cases/reference-to-any-file-name/library/tasks/cyrillic.md +9 -0
  294. package/fixtures/cases/reference-to-any-file-name/library/tasks/decomposed.md +9 -0
  295. package/fixtures/cases/reference-to-any-file-name/library/tasks/hash.md +9 -0
  296. package/fixtures/cases/reference-to-any-file-name/library/tasks/parenthesis.md +9 -0
  297. package/fixtures/cases/reference-to-any-file-name/library/tasks/percent.md +9 -0
  298. package/fixtures/cases/reference-to-any-file-name/library/tasks/spaced.md +9 -0
  299. package/fixtures/cases/reference-to-any-file-name/schema.yaml +10 -0
  300. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  301. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  302. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  303. package/fixtures/cases/referenced-missing-non-latin-file/context.json +1 -0
  304. package/fixtures/cases/referenced-missing-non-latin-file/expected.json +6 -0
  305. package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/a.md +9 -0
  306. package/fixtures/cases/referenced-missing-non-latin-file/library/tasks/b.md +9 -0
  307. package/fixtures/cases/referenced-missing-non-latin-file/schema.yaml +10 -0
  308. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  309. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  310. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  311. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  312. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  313. package/fixtures/cases/string-length/expected.json +2 -1
  314. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  315. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  316. package/fixtures/cases/string-length/schema.yaml +10 -11
  317. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  318. package/fixtures/cases/text-field-kind/expected.json +1 -4
  319. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  320. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  321. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  322. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  323. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  324. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +1 -1
  325. package/fixtures/cases/types-folder-content/library/types/task.md +1 -1
  326. package/fixtures/cases/undeclared-field/expected.json +2 -1
  327. package/fixtures/cases/undeclared-field/library/item.md +2 -2
  328. package/fixtures/cases/undeclared-field/schema.yaml +2 -3
  329. package/fixtures/cases/unevaluated-items-closed/expected.json +2 -1
  330. package/fixtures/cases/unevaluated-items-closed/library/trip.md +13 -3
  331. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +2 -1
  332. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +3 -2
  333. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +3 -2
  334. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +2 -2
  335. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  336. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  337. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  338. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  339. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  340. package/fixtures/forms.json +371 -0
  341. package/fixtures/preamble.json +29 -8
  342. package/fixtures/queries.json +397 -2
  343. package/package.json +10 -1
  344. package/dist/blocks.d.ts +0 -11
  345. package/dist/blocks.d.ts.map +0 -1
  346. package/dist/blocks.js +0 -87
  347. package/dist/divide.d.ts +0 -3
  348. package/dist/divide.d.ts.map +0 -1
  349. package/dist/divide.js +0 -320
  350. package/dist/links.d.ts +0 -29
  351. package/dist/links.d.ts.map +0 -1
  352. package/dist/links.js +0 -821
  353. package/dist/profile.d.ts +0 -6
  354. package/dist/profile.d.ts.map +0 -1
  355. package/dist/profile.js +0 -5
  356. package/dist/project.d.ts +0 -22
  357. package/dist/project.d.ts.map +0 -1
  358. package/dist/project.js +0 -126
  359. package/dist/sections.d.ts +0 -11
  360. package/dist/sections.d.ts.map +0 -1
  361. package/dist/sections.js +0 -57
  362. package/fixtures/cases/conditional-section/schema.yaml +0 -14
  363. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  364. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  365. package/fixtures/cases/null-refused/expected.json +0 -6
  366. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  367. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  368. package/fixtures/cases/null-refused/schema.yaml +0 -56
  369. package/fixtures/cases/open-map-value/expected.json +0 -6
  370. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  371. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  372. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  373. package/fixtures/cases/section-item-enum/expected.json +0 -6
  374. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  375. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  376. package/fixtures/cases/section-item-kind/expected.json +0 -6
  377. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  378. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  379. package/fixtures/cases/section-items/library/page.md +0 -42
  380. package/fixtures/cases/section-items/schema.yaml +0 -10
  381. package/fixtures/cases/section-reference-path/expected.json +0 -6
  382. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  383. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  384. package/fixtures/cases/section-reference-type/expected.json +0 -6
  385. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  386. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  387. package/fixtures/cases/structured-section/expected.json +0 -6
  388. package/fixtures/division.json +0 -409
  389. package/fixtures/projection.json +0 -255
  390. /package/fixtures/cases/{conditional-section → block-scalar-frontmatter}/context.json +0 -0
  391. /package/fixtures/cases/{section-items → block-scalar-frontmatter}/expected.json +0 -0
  392. /package/fixtures/cases/{missing-section-item-kind → conditional-long-text}/context.json +0 -0
  393. /package/fixtures/cases/{null-refused → equal-labels}/context.json +0 -0
  394. /package/fixtures/cases/{open-map-value → frontmatter-construct}/context.json +0 -0
  395. /package/fixtures/cases/{section-item-enum → labels-in-the-rooms-language}/context.json +0 -0
  396. /package/fixtures/cases/{section-item-kind → lazy-list-item}/context.json +0 -0
  397. /package/fixtures/cases/{section-items → list-item-enum}/context.json +0 -0
  398. /package/fixtures/cases/{section-reference-path → list-item-kind}/context.json +0 -0
  399. /package/fixtures/cases/{section-reference-type → list-items}/context.json +0 -0
  400. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  401. /package/fixtures/cases/{structured-section → list-reference-path}/context.json +0 -0
  402. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  403. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
@@ -0,0 +1,63 @@
1
+ import { type Definition } from '../definition.js';
2
+ import type { VerifiedModel } from '../types.js';
3
+ import { type Direction, type QueryPlan } from './language.js';
4
+ export type KeyBound = {
5
+ readonly key: Uint8Array;
6
+ readonly inclusive: boolean;
7
+ };
8
+ export type KeyRange = {
9
+ readonly lower: KeyBound;
10
+ readonly upper: KeyBound | null;
11
+ };
12
+ export type WalkRun = {
13
+ readonly by: 'key';
14
+ readonly key: Uint8Array;
15
+ readonly after: boolean;
16
+ } | {
17
+ readonly by: 'range';
18
+ readonly range: KeyRange;
19
+ };
20
+ export type PageOrder = {
21
+ readonly by: 'path';
22
+ readonly direction: Direction;
23
+ } | {
24
+ readonly by: 'field';
25
+ readonly field: string;
26
+ readonly direction: Direction;
27
+ readonly nulls: 'first' | 'last';
28
+ readonly lexical: boolean;
29
+ readonly after: {
30
+ readonly key: Uint8Array;
31
+ readonly tie: unknown;
32
+ } | null;
33
+ };
34
+ export type Walk = {
35
+ readonly by: 'path';
36
+ readonly direction: Direction;
37
+ } | {
38
+ readonly by: 'keys';
39
+ readonly field: string;
40
+ readonly direction: Direction;
41
+ readonly types: readonly {
42
+ readonly type: string;
43
+ readonly keys: readonly Uint8Array[];
44
+ }[];
45
+ } | {
46
+ readonly by: 'order';
47
+ readonly field: string;
48
+ readonly direction: Direction;
49
+ readonly types: readonly {
50
+ readonly type: string;
51
+ readonly runs: readonly WalkRun[];
52
+ }[];
53
+ };
54
+ export type Count = {
55
+ readonly walk: Walk;
56
+ readonly fields: readonly string[];
57
+ };
58
+ export declare function pageOrder(plan: QueryPlan): PageOrder;
59
+ export declare function walkOf(plan: QueryPlan, model: VerifiedModel): Walk;
60
+ export declare function countShape(plan: QueryPlan): boolean;
61
+ export declare function countOf(plan: QueryPlan, model: VerifiedModel, where: unknown): Count | null;
62
+ export declare function walkedValue(definition: Definition, field: string, value: unknown): unknown;
63
+ //# sourceMappingURL=walk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"walk.d.ts","sourceRoot":"","sources":["../../src/query/walk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,UAAU,EAAmB,MAAM,kBAAkB,CAAC;AAEpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAEvB,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAAE,CAAC;AAEjF,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAA;CAAE,CAAC;AAErF,MAAM,MAAM,OAAO,GACf;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACzE;IAAE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAIvD,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GACtD;IACE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACjC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CAC5E,CAAC;AAEN,MAAM,MAAM,IAAI,GACZ;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GACtD;IACE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,UAAU,EAAE,CAAA;KAAE,EAAE,CAAC;CAC5F,GACD;IACE,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAA;KAAE,EAAE,CAAC;CACzF,CAAC;AAEN,MAAM,MAAM,KAAK,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AA6EhF,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAwBpD;AA2ED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,GAAG,IAAI,CA6BlE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO,CAmBnD;AAwCD,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,IAAI,CAqB3F;AAED,wBAAgB,WAAW,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAG1F"}
@@ -0,0 +1,263 @@
1
+ import { escapePointer, pointerSegments } from '../definition.js';
2
+ import { indexKey, instantOf, sortedKey } from '../kinds.js';
3
+ import { plain } from '../yaml.js';
4
+ import { invalid, textless, } from './language.js';
5
+ function keyOrder(left, right) {
6
+ for (let at = 0; at < Math.min(left.length, right.length); at += 1) {
7
+ if (left[at] !== right[at])
8
+ return left[at] - right[at];
9
+ }
10
+ return left.length - right.length;
11
+ }
12
+ function tighter(held, bound, sign) {
13
+ if (held === null)
14
+ return bound;
15
+ const order = sign * keyOrder(bound.key, held.key);
16
+ return order > 0 || (order === 0 && !bound.inclusive) ? bound : held;
17
+ }
18
+ function everyValue(facts) {
19
+ return { lower: { key: indexKey(facts, null), inclusive: false }, upper: null };
20
+ }
21
+ function rangeOf(facts, bounds) {
22
+ let { lower } = everyValue(facts);
23
+ let upper = null;
24
+ for (const [operator, value] of bounds) {
25
+ const bound = { key: indexKey(facts, value), inclusive: operator.endsWith('e') };
26
+ if (operator.startsWith('g'))
27
+ lower = tighter(lower, bound, 1);
28
+ else
29
+ upper = tighter(upper, bound, -1);
30
+ }
31
+ return { lower, upper };
32
+ }
33
+ function distinct(keys) {
34
+ return [...new Map(keys.map((key) => [key.join(','), key])).values()];
35
+ }
36
+ function testedKeys(facts, test) {
37
+ if (test.op === 'eq')
38
+ return { keys: [indexKey(facts, test.value)] };
39
+ if (test.op === 'in')
40
+ return { keys: distinct(test.values.map((value) => indexKey(facts, value))) };
41
+ if (test.op === 'range')
42
+ return { range: rangeOf(facts, test.bounds) };
43
+ return null;
44
+ }
45
+ function conjuncts(where) {
46
+ if (where === null || 'some' in where)
47
+ return [];
48
+ return 'every' in where ? where.every.flatMap(conjuncts) : [where];
49
+ }
50
+ function named(pointer) {
51
+ const segments = pointerSegments(pointer);
52
+ return segments.length === 1 ? segments[0] : null;
53
+ }
54
+ function indexing(model, types, field) {
55
+ const definitions = types.map((type) => Object.hasOwn(model.types, type) ? model.types[type] : null);
56
+ return definitions.every((definition) => definition?.indexed?.includes(field) === true)
57
+ ? definitions
58
+ : null;
59
+ }
60
+ function afterOf(plan) {
61
+ const values = plan.after?.values ?? null;
62
+ if (values === null)
63
+ return null;
64
+ const key = sortedKey(values[0]);
65
+ if (key === null)
66
+ invalid('after', 'expects the next an earlier result of this query returned');
67
+ return { key, tie: values[1] };
68
+ }
69
+ export function pageOrder(plan) {
70
+ if (plan.shape.kind !== 'documents')
71
+ return invalid('groupBy', 'a page answers Documents');
72
+ const [term, second] = plan.shape.orderBy;
73
+ if (second !== undefined)
74
+ invalid(['orderBy', 1], 'a page orders by one term');
75
+ if (term === undefined)
76
+ return { by: 'path', direction: 'asc' };
77
+ const { key, options } = term;
78
+ if (key.of === 'path') {
79
+ if (options.stringSort !== 'lexical')
80
+ invalid(['orderBy', 0, 'stringSort'], 'a page orders Paths by code point, as lexical');
81
+ return { by: 'path', direction: options.direction };
82
+ }
83
+ const field = key.of === 'field' ? named(key.field) : null;
84
+ if (field === null)
85
+ return invalid(['orderBy', 0, 'by'], 'a page orders by Path or by a field its types index');
86
+ if (plan.root.types === null)
87
+ invalid('types', 'an order by a field names the types whose index it walks');
88
+ return {
89
+ by: 'field',
90
+ field,
91
+ direction: options.direction,
92
+ nulls: options.nulls ?? 'first',
93
+ lexical: options.stringSort === 'lexical',
94
+ after: afterOf(plan),
95
+ };
96
+ }
97
+ function keysWalk(plan, model, direction) {
98
+ const types = plan.root.types;
99
+ for (const { field: pointer, test } of conjuncts(plan.root.where)) {
100
+ const field = named(pointer);
101
+ if (types === null || field === null || (test.op !== 'eq' && test.op !== 'in'))
102
+ continue;
103
+ const definitions = indexing(model, types, field);
104
+ if (definitions === null)
105
+ continue;
106
+ return {
107
+ by: 'keys',
108
+ field,
109
+ direction,
110
+ types: definitions.map((definition) => ({
111
+ type: definition.name,
112
+ keys: testedKeys(definition.fields[field], test).keys,
113
+ })),
114
+ };
115
+ }
116
+ return { by: 'path', direction };
117
+ }
118
+ function common(types) {
119
+ const [first, ...rest] = types;
120
+ return (first?.indexed ?? [])
121
+ .filter((field) => rest.every((definition) => definition.indexed?.includes(field)))
122
+ .map((field) => `/${escapePointer(field)}`);
123
+ }
124
+ function ranged(facts, tests) {
125
+ if (tests.length === 0)
126
+ return null;
127
+ return tests
128
+ .map(({ test }) => testedKeys(facts, test).range)
129
+ .reduce((held, range) => ({
130
+ lower: tighter(held.lower, range.lower, 1),
131
+ upper: range.upper === null ? held.upper : tighter(held.upper, range.upper, -1),
132
+ }));
133
+ }
134
+ function past(range, key, direction) {
135
+ const beyond = { key, inclusive: false };
136
+ return direction === 'asc'
137
+ ? { ...range, lower: tighter(range.lower, beyond, 1) }
138
+ : { ...range, upper: tighter(range.upper, beyond, -1) };
139
+ }
140
+ function runsOf(facts, order, range) {
141
+ const missing = indexKey(facts, null);
142
+ const cursor = order.after?.key ?? null;
143
+ const amongNulls = cursor !== null && keyOrder(cursor, missing) === 0;
144
+ const nulls = range === null ? [{ by: 'key', key: missing, after: amongNulls }] : [];
145
+ const span = range ?? everyValue(facts);
146
+ if (cursor === null || amongNulls) {
147
+ if (order.nulls === 'first')
148
+ return [...nulls, { by: 'range', range: span }];
149
+ return amongNulls ? nulls : [{ by: 'range', range: span }, ...nulls];
150
+ }
151
+ const values = [
152
+ { by: 'key', key: cursor, after: true },
153
+ { by: 'range', range: past(span, cursor, order.direction) },
154
+ ];
155
+ return order.nulls === 'first' ? values : [...values, ...nulls];
156
+ }
157
+ function unindexed(model, types, at, problem) {
158
+ const declared = types.flatMap((type) => Object.hasOwn(model.types, type) ? [model.types[type]] : []);
159
+ return invalid(at, problem, declared.length === types.length ? common(declared) : []);
160
+ }
161
+ export function walkOf(plan, model) {
162
+ const order = pageOrder(plan);
163
+ if (order.by === 'path')
164
+ return keysWalk(plan, model, order.direction);
165
+ const types = plan.root.types;
166
+ const definitions = indexing(model, types, order.field);
167
+ if (definitions === null)
168
+ return unindexed(model, types, ['orderBy', 0, 'by'], 'orders by a field every type it names indexes');
169
+ if (!order.lexical &&
170
+ definitions.some((definition) => !textless(definition.fields[order.field])))
171
+ invalid(['orderBy', 0, 'stringSort'], 'a page orders text by code point, as lexical');
172
+ const bounding = conjuncts(plan.root.where).filter(({ field, test }) => test.op === 'range' && named(field) === order.field);
173
+ return {
174
+ by: 'order',
175
+ field: order.field,
176
+ direction: order.direction,
177
+ types: definitions.map((definition) => {
178
+ const facts = definition.fields[order.field];
179
+ return { type: definition.name, runs: runsOf(facts, order, ranged(facts, bounding)) };
180
+ }),
181
+ };
182
+ }
183
+ export function countShape(plan) {
184
+ const { shape } = plan;
185
+ if (shape.kind === 'documents' && !plan.total)
186
+ return false;
187
+ if (plan.root.types === null)
188
+ invalid('types', 'a count names the types whose index it reads');
189
+ if (plan.text !== null)
190
+ invalid('text', 'a count tests no text');
191
+ if (shape.kind === 'documents')
192
+ return true;
193
+ if (plan.total)
194
+ invalid('total', 'a page of groups answers no total');
195
+ const key = shape.groupBy[0];
196
+ if (shape.groupBy.length > 1)
197
+ invalid(['groupBy', 1], 'a page groups by one field');
198
+ if (key.of !== 'field' || named(key.field) === null)
199
+ invalid(['groupBy', 0], 'a page groups by a field its types index');
200
+ for (const part of ['size', 'updated', 'greatest'])
201
+ if (shape[part] !== false && shape[part] !== null)
202
+ invalid(['select', part], 'a group selects only its count');
203
+ shape.orderBy.forEach(({ by }, index) => {
204
+ if (typeof by === 'string' && by !== 'count')
205
+ invalid(['orderBy', index, 'by'], 'a page of groups orders by its count or its key');
206
+ });
207
+ return true;
208
+ }
209
+ function testedPlaces(where, at) {
210
+ if (!plain(where))
211
+ return [];
212
+ return Object.keys(where)
213
+ .sort()
214
+ .flatMap((name) => name === '$and' || name === '$or'
215
+ ? where[name].flatMap((part, index) => testedPlaces(part, [...at, name, index]))
216
+ : [{ pointer: name, place: [...at, name] }]);
217
+ }
218
+ function countWalk(plan, model) {
219
+ const keyed = keysWalk(plan, model, 'asc');
220
+ if (keyed.by !== 'path')
221
+ return keyed;
222
+ const tests = conjuncts(plan.root.where);
223
+ for (const { field: pointer, test } of tests) {
224
+ const field = named(pointer);
225
+ if (test.op !== 'range' || field === null)
226
+ continue;
227
+ const definitions = indexing(model, plan.root.types, field);
228
+ if (definitions === null)
229
+ continue;
230
+ const bounding = tests.filter((bounded) => bounded.test.op === 'range' && bounded.field === pointer);
231
+ return {
232
+ by: 'order',
233
+ field,
234
+ direction: 'asc',
235
+ types: definitions.map((definition) => ({
236
+ type: definition.name,
237
+ runs: [{ by: 'range', range: ranged(definition.fields[field], bounding) }],
238
+ })),
239
+ };
240
+ }
241
+ return keyed;
242
+ }
243
+ export function countOf(plan, model, where) {
244
+ if (!countShape(plan))
245
+ return null;
246
+ const types = plan.root.types;
247
+ const grouped = plan.shape.kind === 'groups'
248
+ ? [{ pointer: plan.shape.groupBy[0].field, place: ['groupBy', 0] }]
249
+ : [];
250
+ const fields = [...grouped, ...testedPlaces(where, ['where'])].map(({ pointer, place }) => {
251
+ const field = named(pointer);
252
+ if (field === null || indexing(model, types, field) === null)
253
+ return unindexed(model, types, place, place[0] === 'groupBy'
254
+ ? 'groups by a field every type it names indexes'
255
+ : 'a count tests only fields every type it names indexes');
256
+ return field;
257
+ });
258
+ return { walk: countWalk(plan, model), fields: [...new Set(fields)].sort() };
259
+ }
260
+ export function walkedValue(definition, field, value) {
261
+ const instant = instantOf(definition.fields[field], value);
262
+ return instant === null ? (value ?? null) : { instant };
263
+ }
@@ -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"}