@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
package/dist/yaml.js CHANGED
@@ -1,11 +1,23 @@
1
1
  export class YamlError extends Error {
2
2
  offset;
3
3
  constructor(offset) {
4
- super('yaml');
4
+ super();
5
5
  this.offset = offset;
6
6
  this.name = 'YamlError';
7
7
  }
8
8
  }
9
+ const YAML_DEPTH_MAX = 64;
10
+ function nested(c, parse) {
11
+ if (c.depth >= YAML_DEPTH_MAX)
12
+ throw new YamlError(c.i);
13
+ c.depth += 1;
14
+ try {
15
+ return parse();
16
+ }
17
+ finally {
18
+ c.depth -= 1;
19
+ }
20
+ }
9
21
  function peek(c) {
10
22
  return c.i < c.end ? c.text[c.i] : '';
11
23
  }
@@ -70,7 +82,10 @@ function indentAt(c) {
70
82
  }
71
83
  return n;
72
84
  }
85
+ const UNHELD_TEXT = /[\0\ud800-\udfff]/u;
73
86
  function scalar(value, start, end) {
87
+ if (typeof value === 'string' && UNHELD_TEXT.test(value))
88
+ throw new YamlError(start);
74
89
  return { kind: 'scalar', value, start, end };
75
90
  }
76
91
  export function interpretPlain(text) {
@@ -84,6 +99,30 @@ export function interpretPlain(text) {
84
99
  return Number(text);
85
100
  return text;
86
101
  }
102
+ const ESCAPES = {
103
+ b: '\b',
104
+ f: '\f',
105
+ n: '\n',
106
+ r: '\r',
107
+ t: '\t',
108
+ '"': '"',
109
+ '/': '/',
110
+ '\\': '\\',
111
+ };
112
+ function parseEscape(c) {
113
+ c.i += 1;
114
+ const escaped = peek(c);
115
+ const held = ESCAPES[escaped];
116
+ if (held !== undefined) {
117
+ c.i += 1;
118
+ return held;
119
+ }
120
+ const hex = c.text.slice(c.i + 1, c.i + 5);
121
+ if (escaped !== 'u' || c.i + 5 > c.end || !/^[0-9A-Fa-f]{4}$/.test(hex))
122
+ throw new YamlError(c.i);
123
+ c.i += 5;
124
+ return String.fromCharCode(Number.parseInt(hex, 16));
125
+ }
87
126
  function parseQuoted(c) {
88
127
  const quote = peek(c);
89
128
  const start = c.i;
@@ -91,31 +130,19 @@ function parseQuoted(c) {
91
130
  let out = '';
92
131
  while (c.i < c.end) {
93
132
  const ch = peek(c);
133
+ if (quote === "'" && ch === "'" && c.i + 1 < c.end && c.text[c.i + 1] === "'") {
134
+ out += "'";
135
+ c.i += 2;
136
+ continue;
137
+ }
94
138
  if (ch === quote) {
95
139
  c.i += 1;
96
140
  return scalar(out, start, c.i);
97
141
  }
98
142
  if (ch === '\n' || ch === '\r')
99
143
  throw new YamlError(c.i);
100
- if (quote === "'" && ch === "'" && c.text[c.i + 1] === "'") {
101
- out += "'";
102
- c.i += 2;
103
- continue;
104
- }
105
144
  if (quote === '"' && ch === '\\') {
106
- c.i += 1;
107
- const escaped = peek(c);
108
- if (escaped === 'n')
109
- out += '\n';
110
- else if (escaped === 't')
111
- out += '\t';
112
- else if (escaped === '"')
113
- out += '"';
114
- else if (escaped === '\\')
115
- out += '\\';
116
- else
117
- throw new YamlError(c.i);
118
- c.i += 1;
145
+ out += parseEscape(c);
119
146
  continue;
120
147
  }
121
148
  out += ch;
@@ -190,9 +217,10 @@ function parseFlowValue(c) {
190
217
  return parseScalar(c, true);
191
218
  }
192
219
  function parseFlowMap(c) {
220
+ return nested(c, () => flowMap(c));
221
+ }
222
+ function flowMap(c) {
193
223
  const start = c.i;
194
- if (peek(c) !== '{')
195
- throw new YamlError(c.i);
196
224
  c.i += 1;
197
225
  skipFlowSpace(c);
198
226
  const entries = [];
@@ -208,11 +236,12 @@ function parseFlowMap(c) {
208
236
  if (peek(c) !== ':')
209
237
  throw new YamlError(c.i);
210
238
  c.i += 1;
239
+ const after = c.i;
211
240
  const value = parseFlowValue(c);
212
241
  if (seen.has(key.name))
213
242
  throw new YamlError(key.start);
214
243
  seen.add(key.name);
215
- entries.push({ key: key.name, keyStart: key.start, keyEnd: key.end, value });
244
+ entries.push({ key: key.name, after, value });
216
245
  skipFlowSpace(c);
217
246
  if (peek(c) === ',') {
218
247
  c.i += 1;
@@ -227,9 +256,10 @@ function parseFlowMap(c) {
227
256
  throw new YamlError(c.i);
228
257
  }
229
258
  function parseFlowSeq(c) {
259
+ return nested(c, () => flowSeq(c));
260
+ }
261
+ function flowSeq(c) {
230
262
  const start = c.i;
231
- if (peek(c) !== '[')
232
- throw new YamlError(c.i);
233
263
  c.i += 1;
234
264
  skipFlowSpace(c);
235
265
  const items = [];
@@ -254,6 +284,7 @@ function parseFlowSeq(c) {
254
284
  throw new YamlError(c.i);
255
285
  }
256
286
  function parseValue(c, parentKeyIndent) {
287
+ const at = c.i;
257
288
  skipSpaces(c);
258
289
  if (peek(c) === '#')
259
290
  skipToEol(c);
@@ -262,12 +293,12 @@ function parseValue(c, parentKeyIndent) {
262
293
  skipEol(c);
263
294
  skipBlankAndComments(c);
264
295
  if (c.i >= c.end)
265
- return scalar(null, c.i, c.i);
296
+ return scalar(null, at, at);
266
297
  const nextIndent = indentAt(c);
267
298
  if (nextIndent === parentKeyIndent && seqAhead(c))
268
299
  return parseBlockSeq(c, nextIndent);
269
300
  if (nextIndent <= parentKeyIndent)
270
- return scalar(null, c.i, c.i);
301
+ return scalar(null, at, at);
271
302
  if (peek(c) === '-')
272
303
  return parseBlockSeq(c, nextIndent);
273
304
  if (peek(c) === '[')
@@ -300,10 +331,8 @@ function mappingAhead(c) {
300
331
  const next = c.text[c.i + 1];
301
332
  return next === ' ' || next === '\n' || next === '\r' || c.i + 1 >= c.end;
302
333
  }
303
- catch (error) {
304
- if (error instanceof YamlError)
305
- return false;
306
- throw error;
334
+ catch {
335
+ return false;
307
336
  }
308
337
  finally {
309
338
  c.i = start;
@@ -315,9 +344,6 @@ function lineStartOf(c) {
315
344
  j -= 1;
316
345
  return j;
317
346
  }
318
- function valueEnd(value, marked) {
319
- return value.kind === 'scalar' && value.start === value.end ? marked : value.end;
320
- }
321
347
  function parseSeqItem(c, indent) {
322
348
  skipSpaces(c);
323
349
  if (peek(c) !== '#' && peek(c) !== '\n' && peek(c) !== '\r' && c.i < c.end && mappingAhead(c))
@@ -325,6 +351,9 @@ function parseSeqItem(c, indent) {
325
351
  return parseValue(c, indent);
326
352
  }
327
353
  function parseBlockSeq(c, indent) {
354
+ return nested(c, () => blockSeq(c, indent));
355
+ }
356
+ function blockSeq(c, indent) {
328
357
  const start = c.i;
329
358
  const items = [];
330
359
  let end = start;
@@ -337,14 +366,16 @@ function parseBlockSeq(c, indent) {
337
366
  if (peek(c) !== '-')
338
367
  break;
339
368
  c.i += 1;
340
- const marked = c.i;
341
369
  const item = parseSeqItem(c, indent);
342
370
  items.push(item);
343
- end = valueEnd(item, marked);
371
+ end = item.end;
344
372
  }
345
373
  return { kind: 'seq', items, start, end };
346
374
  }
347
375
  function parseBlockMap(c, indent, inline = false) {
376
+ return nested(c, () => blockMap(c, indent, inline));
377
+ }
378
+ function blockMap(c, indent, inline) {
348
379
  const start = c.i;
349
380
  const entries = [];
350
381
  const seen = new Set();
@@ -366,18 +397,18 @@ function parseBlockMap(c, indent, inline = false) {
366
397
  if (peek(c) !== ':')
367
398
  throw new YamlError(c.i);
368
399
  c.i += 1;
369
- const marked = c.i;
400
+ const after = c.i;
370
401
  const value = parseValue(c, indent);
371
402
  if (seen.has(key.name))
372
403
  throw new YamlError(key.start);
373
404
  seen.add(key.name);
374
- entries.push({ key: key.name, keyStart: key.start, keyEnd: key.end, value });
375
- end = valueEnd(value, marked);
405
+ entries.push({ key: key.name, after, value });
406
+ end = value.end;
376
407
  }
377
408
  return { kind: 'map', entries, start, end };
378
409
  }
379
410
  export function parseYamlMapping(text, start, end) {
380
- const c = { text, i: start, end };
411
+ const c = { text, i: start, end, depth: 0 };
381
412
  skipBlankAndComments(c);
382
413
  if (c.i >= end)
383
414
  return { kind: 'map', entries: [], start, end };
@@ -418,24 +449,48 @@ export function isPlainSafe(text) {
418
449
  return false;
419
450
  return true;
420
451
  }
452
+ export function plain(value) {
453
+ if (!isRecord(value))
454
+ return false;
455
+ const prototype = Object.getPrototypeOf(value);
456
+ return prototype === Object.prototype || prototype === null;
457
+ }
458
+ function listed(value) {
459
+ const keys = Object.keys(value);
460
+ return keys.length === value.length && keys.every((key, index) => key === String(index));
461
+ }
462
+ function heldWithin(value, within) {
463
+ if (typeof value === 'string')
464
+ return !UNHELD_TEXT.test(value);
465
+ if (value === null || typeof value === 'boolean')
466
+ return true;
467
+ if (typeof value === 'number')
468
+ return Number.isFinite(value);
469
+ if (typeof value !== 'object' || within.includes(value))
470
+ return false;
471
+ if (within.length + 1 >= YAML_DEPTH_MAX)
472
+ return false;
473
+ const path = [...within, value];
474
+ const held = (item) => heldWithin(item, path);
475
+ if (Array.isArray(value))
476
+ return listed(value) && value.every(held);
477
+ return (plain(value) &&
478
+ Object.keys(value).every((key) => !UNHELD_TEXT.test(key)) &&
479
+ Object.values(value).every(held));
480
+ }
481
+ export function documentValue(value) {
482
+ return heldWithin(value, []);
483
+ }
421
484
  export function serializeJs(value) {
422
- if (value === null)
423
- return 'null';
424
- if (value === true)
425
- return 'true';
426
- if (value === false)
427
- return 'false';
428
- if (typeof value === 'number' && Number.isFinite(value))
429
- return JSON.stringify(value);
430
485
  if (typeof value === 'string')
431
486
  return isPlainSafe(value) ? value : JSON.stringify(value);
487
+ if (value === null || typeof value !== 'object')
488
+ return JSON.stringify(value);
432
489
  if (Array.isArray(value))
433
490
  return `[${value.map(serializeJs).join(', ')}]`;
434
- if (isRecord(value))
435
- return `{${Object.entries(value)
436
- .map(([key, held]) => `${serializeKey(key)}: ${serializeJs(held)}`)
437
- .join(', ')}}`;
438
- throw new YamlError(0);
491
+ return `{${Object.entries(value)
492
+ .map(([key, held]) => `${serializeKey(key)}: ${serializeJs(held)}`)
493
+ .join(', ')}}`;
439
494
  }
440
495
  export function isRecord(value) {
441
496
  return value !== null && typeof value === 'object' && !Array.isArray(value);
@@ -467,7 +522,7 @@ export function extractFrontmatter(content) {
467
522
  return { kind: 'unclosed' };
468
523
  const yamlStart = firstNl + 1;
469
524
  let i = yamlStart;
470
- while (i <= content.length) {
525
+ for (;;) {
471
526
  const nl = content.indexOf('\n', i);
472
527
  const lineEnd = nl === -1 ? content.length : nl;
473
528
  let line = content.slice(i, lineEnd);
@@ -479,13 +534,13 @@ export function extractFrontmatter(content) {
479
534
  return { kind: 'unclosed' };
480
535
  i = nl + 1;
481
536
  }
482
- return { kind: 'unclosed' };
483
537
  }
484
538
  export function equalValue(left, right) {
485
539
  if (left === right)
486
540
  return true;
487
541
  if (Array.isArray(left) && Array.isArray(right)) {
488
- return (left.length === right.length && left.every((item, index) => equalValue(item, right[index])));
542
+ return (left.length === right.length &&
543
+ Array.from(left).every((item, index) => equalValue(item, right[index])));
489
544
  }
490
545
  if (isRecord(left) && isRecord(right)) {
491
546
  const keys = Object.keys(left);
@@ -10,6 +10,20 @@ cases compare `validate(library, context)` directly. Text-only cases carry
10
10
  `{ "binaryTargets": [] }`. Binary targets are membership declarations; the
11
11
  corpus supplies no binary bytes or placeholder Documents.
12
12
 
13
+ ## Forms
14
+
15
+ `forms.json` exercises how a typed Document writes its values in its body. It carries `schema`,
16
+ one schema text, `names`, the name each reference value's target shows, and three lists. Each of
17
+ `cases` carries `name`, the `type` its source declares, exact `source` and the `value` `parse`
18
+ reads with that type's definition, and optionally `ranges`, the exact source text of each listed
19
+ pointer's `Document.ranges` entry, `after`, the text `Document.listEnd` is followed by, the
20
+ `preamble`, `sections` and `text` it reads, `written: true` where `create(type)` with one `field`
21
+ change per value but `type` and a `text` change of the case's `text`, applied with the definition
22
+ and a `nameOf` reading `names`, serializes to `source` exactly, and `rendered`, each pointer's
23
+ exact text as GitHub Flavored Markdown renders it. Each of `refused` carries `name`, `type`,
24
+ `source` and the `refusal` `parse` answers, its `rule`, `location` and `line`. Each of `applied`
25
+ carries `name`, `type`, `source`, `changes` and the exact source `apply` writes.
26
+
13
27
  ## Preamble operations
14
28
 
15
29
  `preamble.json` exercises the public parse/apply/serialize seam separately from
@@ -18,7 +32,9 @@ the validation Libraries. Each row carries `name`, exact `source`, expected
18
32
  the source, compare `Document.preamble`, apply
19
33
  `{ kind: 'preamble', prior: preamble, value }`, and compare the serialized result.
20
34
  These cases cover empty and heading-free Documents, frontmatter boundaries,
21
- fenced headings, newline/source preservation, and a moved-export link rewrite.
35
+ fenced headings and a heading an HTML block holds, setext, indented and empty
36
+ headings that open a section, newline/source preservation, and a moved-export
37
+ link rewrite.
22
38
 
23
39
  ## Projection
24
40
 
@@ -31,8 +47,8 @@ optional `relabel`, an optional `filtered`, and `expected`.
31
47
  A case carrying a `move` lists both the Path its target sits at and the Path the
32
48
  move takes it to, because the collection holds that target either way.
33
49
 
34
- Verify the schema, parse the source, call `project(document, file, context)`
35
- with `documentTargets` and the verified type `definition` names, and compare against `expected`. Where
50
+ Verify the schema, parse the source with the verified type `definition` names, call
51
+ `project(document, file, context)` with `documentTargets` and that definition, and compare against `expected`. Where
36
52
  `links` is present, compare `links(document, file)` against it. Then check
37
53
  that the source is unchanged. Where `move` is present, apply
38
54
  `{ kind: 'link', href, to }`, confirm the serialized Document changed, and
@@ -43,7 +59,7 @@ exactly once, join the pieces with its `to`, parse the result, and confirm its
43
59
  projection is exactly the relabel's own `expected` and differs from the case's:
44
60
  a changed visible label changes the projection. Where `filtered` is present,
45
61
  apply `{ kind: 'field', name: field, value, prior }` with its `field` and
46
- `value` and the Document's current value as `prior`, confirm the serialized
62
+ `value` and the Document's current value as `prior` with the definition, confirm the serialized
47
63
  Document changed, and confirm its projection is still exactly `expected`: a
48
64
  change to a value that is not prose leaves the projection alone.
49
65
 
@@ -51,20 +67,35 @@ change to a value that is not prose leaves the projection alone.
51
67
 
52
68
  `division.json` exercises the public `divide` seam separately from the
53
69
  validation Libraries. It carries `schema` and `cases` like `projection.json`,
54
- and each case adds the `budget` the division runs under. Parse the source, call
55
- `divide(document, file, context)` with `{ documentTargets, definition, budget }`,
70
+ and each case adds the `bound` the division runs under. Parse the source, call
71
+ `divide(document, file, context)` with `{ documentTargets, definition, bound }`,
56
72
  and compare against `expected`: either `{ "ok": true, "spans": [...] }`, where
57
73
  each span carries the exact `text` to embed and the exact `source` the returned
58
74
  `start` and `end` address in that case's source, or `{ "ok": false, "refusal": ... }`. Then
59
75
  check that the source is unchanged. A span's `text` and `source` differ where
60
76
  the embedded text repeats a continuation's own heading, carries an internal
61
- link's visible label, or carries a frontmatter value without the quotes the
62
- author wrote, and where the addressed extent encloses a declared structured
63
- section between two pieces one span packs together or the whole of a free-text
64
- value one span carries part of. `start` and `end` are UTF-8 byte offsets into the case's
77
+ link's visible label or carries a value without the escape the author wrote, and where the
78
+ addressed extent encloses a value list or a label between two pieces one span packs together. `start` and `end` are UTF-8 byte offsets into the case's
65
79
  source; every source in this corpus is ASCII, so a consumer compares the
66
80
  addressed `source` with an ordinary string slice.
67
81
 
82
+ ## Queries
83
+
84
+ `queries.json` is the one table of cases both query evaluators answer. It carries `schema`,
85
+ one schema text; `documents`, each named and carrying its `path`, the `type` a collection
86
+ stores for it (`any` for an untyped Markdown Document, `null` for one that is not Markdown),
87
+ its `fileId`, the `text` the device holds or `null`, and its `fields`; and `cases`, each with a
88
+ `name`, a `query` of filter parts, the `document` it names and whether it `matches`. Verify
89
+ the schema and plan `{ ...query, select: {} }` with `planOf` against its types. Then
90
+ `matches(plan, candidate)` over the named Document, given its type's definition, and the
91
+ condition `sql.tests` writes over a collection holding every Document of the table with the
92
+ values `indexed` derives from it must both answer `matches`. A new operator adds its cases
93
+ here first. Each of `orders` carries a `name`, one `orderBy` clause on a field the `task` type
94
+ names `indexed` and the `order` of every `task` Document, ties by Path in code-point order in
95
+ either direction. The SQL order `sql.sorted` writes over that collection, `compared` over the
96
+ value `heldAt` reads, its instant for a date-time, and the bytes of each Document's `indexKey`,
97
+ a missing value and `null` placed as the clause's `nulls` asks, must each give that order.
98
+
68
99
  ## Verdict format
69
100
 
70
101
  Acceptance:
@@ -79,22 +110,23 @@ Refusal:
79
110
  {
80
111
  "verdict": "refuse",
81
112
  "file": "<library path>",
82
- "location": "<JSON Pointer or section name>",
113
+ "location": "<JSON Pointer>",
83
114
  "rule": "<rule id>",
115
+ "line": 5,
84
116
  "referrers": ["<library path>"]
85
117
  }
86
118
  ```
87
119
 
88
- `location` is the JSON Pointer of the frontmatter value a rule concerns, such
89
- as `/shipping/city`, or the name of the section it concerns, and is omitted when
90
- the rule concerns neither. `referrers` is present only for
120
+ `location` is the JSON Pointer of the value a rule concerns, such as `/shipping/city`, and is
121
+ omitted when the rule concerns none. `line` is the line, from 1, of the Document's source the value
122
+ is written on, present when the value is written; a missing one has none. `referrers` is present only for
91
123
  `referenced-missing-file`. A schema refusal carries no `file`; its `location`
92
124
  is the JSON Pointer of the schema part it concerns, such as
93
125
  `/task/properties/title/type`, or `line <n>` for `schema-yaml`.
94
126
 
95
127
  ## Rule ids
96
128
 
97
- A frontmatter value that fails a JSON Schema keyword is refused under that
129
+ A value that fails a JSON Schema keyword is refused under that
98
130
  keyword's name, such as `required`, `type`, `enum`, `format`, `pattern`,
99
131
  `minimum`, `maxLength`, `maxItems` or `oneOf`, at the value's JSON Pointer; a
100
132
  missing required key is named by the Pointer it would sit at. A malformed
@@ -107,25 +139,35 @@ schema text. The model's own rules:
107
139
  | `frontmatter-fence` | A present frontmatter fence does not parse as the accepted YAML subset |
108
140
  | `schema-yaml` | A schema text is not a mapping in the accepted YAML subset |
109
141
  | `schema-type-name` | A type name is empty, starts with `$`, or is `any` or `attachment` |
142
+ | `provided-type` | A schema names a type its caller provides with a key but its two role keywords |
110
143
  | `schema` | A type or subschema is neither a mapping nor a boolean |
111
144
  | `schema-keyword` | A schema carries a key that is no JSON Schema 2020-12 keyword the model admits |
112
145
  | `$defs` | `$defs` is not a mapping |
113
146
  | `$ref` | A `$ref` reaches no subschema under `#/$defs/` of the same file |
114
147
  | `reference` | `reference` is not on a string or names something but a type, `any`, `attachment` |
115
- | `sections` | A section is not `{ kind: text }` or `{ kind: list, items }` over one scalar |
116
148
  | `member_document` | The mark is not a boolean, or a second type carries it |
117
- | `unknown-type` | A file declares a type absent from the governing schema |
149
+ | `indexed` | `indexed` names a field a type cannot index, or more than its caller's bounds |
150
+ | `duplicate-label` | Two fields of one object show one label: a field's `title`, else its key |
151
+ | `conflicting-label` | Declarations of one key in `anyOf`, `oneOf`, `then`, `else` or a composed shape give it two `title`s |
152
+ | `conflicting-type` | Such declarations give one key two JSON types, integer and number counting as one |
153
+ | `name-type` | A type's top-level `name` is not a string |
154
+ | `heading-depth` | A value written under a heading sits past `######`: `##` at the top, a level deeper per property or list item, none inside a `json` block |
155
+ | `unknown-type` | A file declares a type absent from the governing schema, or other than its typed path requires it to name |
118
156
  | `undeclared-field` | A closed object carries a key it does not declare |
119
- | `required-section` | A required section heading is missing |
120
- | `unresolved-reference` | A reference at any depth or a section item reaches no member it admits |
121
- | `unresolved-link` | A body link is an absolute path or leaves the collection |
122
- | `structured-section` | A declared list section is not a list of values of its item schema |
157
+ | `malformed-value` | A value is not written in its form, or a typed Document's frontmatter holds a key that is not House's |
158
+ | `repeated-value` | A value is written twice: two lines, a line and a heading, or two headings |
159
+ | `unknown-label` | A line, heading or column of a closed object names no field |
160
+ | `unresolved-reference` | A reference at any depth reaches no member it admits |
161
+ | `unresolved-link` | A body link is an absolute path, leaves the collection or, from a typed Document at a document path, reaches a reserved name |
162
+ | `room-md-type` | `ROOM.md` declares a type |
163
+ | `required-body` | A file at a typed path that requires a body has a body holding no text |
123
164
  | `referenced-missing-file` | Remaining files still reference an absent path |
124
165
  | `unwritable-link` | No Markdown destination form can carry a new link destination |
125
- | `division-budget` | A division budget is not a whole number of at least 2 |
166
+ | `required-section` | A section change names no free section of the Document |
167
+ | `division-bound` | A division bound is not a whole number of at least 2 |
126
168
 
127
- `unwritable-link` is refused by `apply` and `division-budget` by `divide`, not
128
- by `validate`, so no case under `cases/` carries either.
169
+ `unwritable-link` and `required-section` are refused by `apply` and `division-bound` by
170
+ `divide`, not by `validate`, so no case under `cases/` carries them.
129
171
 
130
172
  A reference that admits `attachment` reaches any path in the same Library, so
131
173
  neither `unresolved-reference` for an absent target nor
@@ -136,6 +178,6 @@ Library is accepted too, so `unresolved-link` never names it and
136
178
  ## YAML subset
137
179
 
138
180
  Frontmatter and a schema text are each a mapping in a closed YAML subset: block and flow mappings,
139
- block and flow sequences, a block sequence item that opens a mapping, plain and quoted scalars, `true`, `false`, `null`,
181
+ block and flow sequences, a block sequence item that opens a mapping, plain and quoted scalars (a single-quoted scalar doubles its apostrophe, a double-quoted one takes JSON's escapes), `true`, `false`, `null`,
140
182
  and decimal numbers. It does not take YAML 1.1 boolean or timestamp aliases,
141
183
  octal numbers, anchors, tags, or block scalars. A mapping carries each key once.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  type: task
3
- title: Ship
4
3
  ---
4
+ - **title**: Ship
5
5
 
6
6
  ## Description
7
7
 
@@ -1,6 +1,5 @@
1
1
  task:
2
2
  properties:
3
3
  title: { type: string }
4
- required: [title]
5
- sections:
6
- Description: { kind: text, required: true }
4
+ description: { type: string, contentMediaType: text/markdown, minLength: 1, title: Description }
5
+ required: [ title, description ]
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  type: company
3
- name: Acme
4
3
  ---
4
+ # Acme
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  type: deal
3
- title: Lead
4
- company: ../companies/acme.md
5
- stage: lead
6
3
  ---
4
+ - **title**: Lead
5
+ - **company**: [Acme](../companies/acme.md)
6
+ - **stage**: lead
@@ -4,7 +4,7 @@ $defs:
4
4
  properties:
5
5
  city: { type: string }
6
6
  country: { type: string, pattern: '^[A-Z]{2}$' }
7
- required: [city]
7
+ required: [ city ]
8
8
  company:
9
9
  properties:
10
10
  name: { type: string }
@@ -13,13 +13,13 @@ deal:
13
13
  properties:
14
14
  title: { type: string, minLength: 1, maxLength: 40 }
15
15
  company: { type: string, reference: company }
16
- stage: { enum: [lead, proposal, won, lost], default: lead }
16
+ stage: { enum: [ lead, proposal, won, lost ], default: lead }
17
17
  amount: { type: integer, minimum: 0 }
18
18
  probability: { type: number, minimum: 0, maximum: 1 }
19
19
  open: { type: boolean }
20
20
  closes_at: { type: string, format: date-time }
21
21
  contact_email: { type: string, format: email }
22
- note: { type: [string, 'null'] }
22
+ note: { type: [ string, 'null' ] }
23
23
  shipping: { $ref: '#/$defs/address' }
24
24
  tags: { type: array, items: { type: string }, maxItems: 3 }
25
25
  lines:
@@ -29,7 +29,7 @@ deal:
29
29
  properties:
30
30
  product: { type: string }
31
31
  quantity: { type: integer, minimum: 1 }
32
- required: [product, quantity]
32
+ required: [ product, quantity ]
33
33
  blocks:
34
34
  type: array
35
35
  items:
@@ -37,20 +37,19 @@ deal:
37
37
  - properties:
38
38
  kind: { const: paragraph }
39
39
  text: { type: string }
40
- required: [kind, text]
40
+ required: [ kind, text ]
41
41
  - properties:
42
42
  kind: { const: quiz }
43
43
  question: { type: string }
44
- required: [kind, question]
44
+ required: [ kind, question ]
45
45
  attributes:
46
46
  type: object
47
47
  additionalProperties: { type: string }
48
- required: [title, company, stage]
48
+ description: { type: string, contentMediaType: text/markdown, title: Description }
49
+ required: [ title, company, stage ]
49
50
  if:
50
51
  properties:
51
52
  stage: { const: won }
52
- required: [stage]
53
+ required: [ stage ]
53
54
  then:
54
- required: [amount]
55
- sections:
56
- Description: { kind: text }
55
+ required: [ amount ]
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  type: task
3
- title: Ship
4
3
  ---
4
+ - **title**: Ship
5
5
 
6
6
  ## Description
7
7
 
@@ -1,6 +1,5 @@
1
1
  task:
2
2
  properties:
3
3
  title: { type: string }
4
- required: [title]
5
- sections:
6
- Description: { kind: text, required: true }
4
+ description: { type: string, contentMediaType: text/markdown, minLength: 1, title: Description }
5
+ required: [ title, description ]
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  type: company
3
- name: Acme
4
3
  ---
4
+ # Acme
@@ -1,15 +1,18 @@
1
1
  ---
2
2
  type: deal
3
- title: Renewal
4
- company: ../companies/acme.md
5
- shipping:
6
- city: Paris
7
- depot: ../places/depot.md
8
- lines:
9
- - product: ../products/seats.md
10
- quantity: 10
11
- - { product: ../products/support.md, quantity: 1 }
12
- contract: ../products/seats.md
13
3
  ---
4
+ - **title**: Renewal
5
+ - **company**: [Acme](../companies/acme.md)
6
+ - **shipping**:
7
+ - **city**: Paris
8
+ - **depot**: [Depot](../places/depot.md)
9
+ - **contract**: [Seats](../products/seats.md)
14
10
 
15
11
  The yearly renewal.
12
+
13
+ ## lines
14
+
15
+ | product | quantity |
16
+ | --- | --- |
17
+ | [Seats](../products/seats.md) | 10 |
18
+ | [Support](../products/support.md) | 1 |
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  type: place
3
- name: Depot
4
3
  ---
4
+ # Depot
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  type: product
3
- name: Seats
4
3
  ---
4
+ # Seats