@agentshouse/mdmodel 0.1.0-ccf1367190878 → 0.1.0-cd6a8e5bc7efc

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 (411) hide show
  1. package/API.md +281 -232
  2. package/README.md +27 -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/crockford.d.ts +4 -0
  10. package/dist/crockford.d.ts.map +1 -0
  11. package/dist/crockford.js +3 -0
  12. package/dist/definition.d.ts +22 -10
  13. package/dist/definition.d.ts.map +1 -1
  14. package/dist/definition.js +219 -84
  15. package/dist/divide.d.ts.map +1 -1
  16. package/dist/divide.js +32 -21
  17. package/dist/document.d.ts +15 -8
  18. package/dist/document.d.ts.map +1 -1
  19. package/dist/document.js +968 -241
  20. package/dist/event.d.ts +77 -0
  21. package/dist/event.d.ts.map +1 -0
  22. package/dist/event.js +200 -0
  23. package/dist/facts.d.ts +15 -0
  24. package/dist/facts.d.ts.map +1 -0
  25. package/dist/facts.js +41 -0
  26. package/dist/fields.d.ts +1 -1
  27. package/dist/fields.d.ts.map +1 -1
  28. package/dist/fields.js +1 -1
  29. package/dist/form.d.ts +4 -0
  30. package/dist/form.d.ts.map +1 -0
  31. package/dist/form.js +152 -0
  32. package/dist/house-model.d.ts +827 -0
  33. package/dist/house-model.d.ts.map +1 -0
  34. package/dist/house-model.js +459 -0
  35. package/dist/house-references.d.ts +4 -0
  36. package/dist/house-references.d.ts.map +1 -0
  37. package/dist/house-references.js +7 -0
  38. package/dist/index.d.ts +35 -12
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +21 -8
  41. package/dist/kinds.d.ts +18 -0
  42. package/dist/kinds.d.ts.map +1 -0
  43. package/dist/kinds.js +150 -0
  44. package/dist/markdown.d.ts +75 -0
  45. package/dist/markdown.d.ts.map +1 -0
  46. package/dist/markdown.js +265 -0
  47. package/dist/paths.d.ts +19 -2
  48. package/dist/paths.d.ts.map +1 -1
  49. package/dist/paths.js +96 -15
  50. package/dist/pattern.d.ts +10 -0
  51. package/dist/pattern.d.ts.map +1 -0
  52. package/dist/pattern.js +356 -0
  53. package/dist/project.d.ts +1 -0
  54. package/dist/project.d.ts.map +1 -1
  55. package/dist/project.js +61 -65
  56. package/dist/query/language.d.ts +254 -0
  57. package/dist/query/language.d.ts.map +1 -0
  58. package/dist/query/language.js +620 -0
  59. package/dist/query/match.d.ts +14 -0
  60. package/dist/query/match.d.ts.map +1 -0
  61. package/dist/query/match.js +150 -0
  62. package/dist/query/rows.d.ts +32 -0
  63. package/dist/query/rows.d.ts.map +1 -0
  64. package/dist/query/rows.js +161 -0
  65. package/dist/query/sql.d.ts +39 -0
  66. package/dist/query/sql.d.ts.map +1 -0
  67. package/dist/query/sql.js +285 -0
  68. package/dist/references.d.ts.map +1 -1
  69. package/dist/references.js +6 -1
  70. package/dist/refuse.d.ts +1 -0
  71. package/dist/refuse.d.ts.map +1 -1
  72. package/dist/refuse.js +1 -0
  73. package/dist/reserved.d.ts +6 -0
  74. package/dist/reserved.d.ts.map +1 -0
  75. package/dist/reserved.js +21 -0
  76. package/dist/room-types.d.ts +7 -0
  77. package/dist/room-types.d.ts.map +1 -0
  78. package/dist/room-types.js +136 -0
  79. package/dist/schema.d.ts +0 -1
  80. package/dist/schema.d.ts.map +1 -1
  81. package/dist/schema.js +8 -20
  82. package/dist/types.d.ts +43 -5
  83. package/dist/types.d.ts.map +1 -1
  84. package/dist/validate.d.ts +32 -4
  85. package/dist/validate.d.ts.map +1 -1
  86. package/dist/validate.js +344 -151
  87. package/dist/yaml.d.ts.map +1 -1
  88. package/dist/yaml.js +40 -14
  89. package/fixtures/README.md +61 -24
  90. package/fixtures/cases/absent-link-dangles/library/item.md +1 -1
  91. package/fixtures/cases/absent-link-dangles/schema.yaml +2 -3
  92. package/fixtures/cases/absent-optional-field/library/companies/acme.md +1 -1
  93. package/fixtures/cases/absent-optional-field/library/deals/lead.md +3 -3
  94. package/fixtures/cases/absent-optional-field/schema.yaml +10 -11
  95. package/fixtures/cases/absolute-link/library/item.md +1 -1
  96. package/fixtures/cases/absolute-link/schema.yaml +2 -3
  97. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +1 -1
  98. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +13 -10
  99. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +1 -1
  100. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +1 -1
  101. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +1 -1
  102. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +1 -1
  103. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +13 -10
  104. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +1 -1
  105. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +1 -1
  106. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +1 -1
  107. package/fixtures/cases/attachment-reference-outside/expected.json +2 -1
  108. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +1 -1
  109. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +13 -10
  110. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +1 -1
  111. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +1 -1
  112. package/fixtures/cases/attachment-reference-outside/library/products/support.md +1 -1
  113. package/fixtures/cases/binary-any-reference/expected.json +2 -1
  114. package/fixtures/cases/binary-any-reference/library/notes/draft.md +1 -1
  115. package/fixtures/cases/binary-prototype-reference/expected.json +2 -1
  116. package/fixtures/cases/binary-prototype-reference/library/notes/draft.md +1 -1
  117. package/fixtures/cases/binary-typed-reference/expected.json +2 -1
  118. package/fixtures/cases/binary-typed-reference/library/notes/draft.md +1 -1
  119. package/fixtures/cases/boolean-field/expected.json +2 -1
  120. package/fixtures/cases/boolean-field/library/companies/acme.md +1 -1
  121. package/fixtures/cases/boolean-field/library/deals/renewal.md +49 -24
  122. package/fixtures/cases/boolean-field/schema.yaml +10 -11
  123. package/fixtures/cases/bracketed-link-definition/library/item.md +1 -1
  124. package/fixtures/cases/bracketed-link-definition/schema.yaml +2 -3
  125. package/fixtures/cases/closed-nested-object/expected.json +2 -1
  126. package/fixtures/cases/closed-nested-object/library/companies/acme.md +1 -1
  127. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +50 -25
  128. package/fixtures/cases/closed-nested-object/schema.yaml +10 -11
  129. package/fixtures/cases/composed-root-reference/library/a.md +2 -2
  130. package/fixtures/cases/conditional-long-text/expected.json +7 -0
  131. package/fixtures/cases/conditional-long-text/library/questions/hosting.md +9 -0
  132. package/fixtures/cases/conditional-long-text/library/questions/payments.md +12 -0
  133. package/fixtures/cases/conditional-long-text/schema.yaml +13 -0
  134. package/fixtures/cases/cross-room-link/library/clients/acme.md +6 -0
  135. package/fixtures/cases/cross-room-link/schema.yaml +3 -0
  136. package/fixtures/cases/cross-room-reference/expected.json +1 -0
  137. package/fixtures/cases/cross-room-reference/library/clients/acme.md +9 -0
  138. package/fixtures/cases/cross-room-reference/schema.yaml +8 -0
  139. package/fixtures/cases/date-time-format/expected.json +2 -1
  140. package/fixtures/cases/date-time-format/library/companies/acme.md +1 -1
  141. package/fixtures/cases/date-time-format/library/deals/renewal.md +49 -24
  142. package/fixtures/cases/date-time-format/schema.yaml +10 -11
  143. package/fixtures/cases/default-unfilled/library/companies/acme.md +1 -1
  144. package/fixtures/cases/default-unfilled/library/deals/renewal.md +47 -22
  145. package/fixtures/cases/default-unfilled/schema.yaml +10 -11
  146. package/fixtures/cases/defs-pattern/expected.json +2 -1
  147. package/fixtures/cases/defs-pattern/library/companies/acme.md +1 -1
  148. package/fixtures/cases/defs-pattern/library/deals/renewal.md +49 -24
  149. package/fixtures/cases/defs-pattern/schema.yaml +10 -11
  150. package/fixtures/cases/dependent-rule/library/companies/acme.md +1 -1
  151. package/fixtures/cases/dependent-rule/library/deals/renewal.md +48 -23
  152. package/fixtures/cases/dependent-rule/schema.yaml +10 -11
  153. package/fixtures/cases/duplicate-link-definition/library/item.md +1 -1
  154. package/fixtures/cases/duplicate-link-definition/schema.yaml +2 -3
  155. package/fixtures/cases/email-format/expected.json +2 -1
  156. package/fixtures/cases/email-format/library/companies/acme.md +1 -1
  157. package/fixtures/cases/email-format/library/deals/renewal.md +49 -24
  158. package/fixtures/cases/email-format/schema.yaml +10 -11
  159. package/fixtures/cases/equal-labels/expected.json +5 -0
  160. package/fixtures/cases/equal-labels/schema.yaml +4 -0
  161. package/fixtures/cases/fenced-link-definition/library/item.md +1 -1
  162. package/fixtures/cases/fenced-link-definition/schema.yaml +2 -3
  163. package/fixtures/cases/field-enum/expected.json +2 -1
  164. package/fixtures/cases/field-enum/library/item.md +2 -2
  165. package/fixtures/cases/field-enum/schema.yaml +3 -4
  166. package/fixtures/cases/integer-field/expected.json +2 -1
  167. package/fixtures/cases/integer-field/library/companies/acme.md +1 -1
  168. package/fixtures/cases/integer-field/library/deals/renewal.md +49 -24
  169. package/fixtures/cases/integer-field/schema.yaml +10 -11
  170. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +1 -1
  171. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +49 -24
  172. package/fixtures/cases/json-schema-constructs/schema.yaml +10 -11
  173. package/fixtures/cases/labels-in-the-rooms-language/expected.json +1 -0
  174. package/fixtures/cases/labels-in-the-rooms-language/library/deals/atlas.md +7 -0
  175. package/fixtures/cases/labels-in-the-rooms-language/schema.yaml +9 -0
  176. package/fixtures/cases/lazy-list-item/expected.json +3 -0
  177. package/fixtures/cases/lazy-list-item/library/item.md +10 -0
  178. package/fixtures/cases/lazy-list-item/schema.yaml +3 -0
  179. package/fixtures/cases/link-into-a-reserved-name/expected.json +5 -0
  180. package/fixtures/cases/link-into-a-reserved-name/library/notes/a.md +6 -0
  181. package/fixtures/cases/link-into-a-reserved-name/schema.yaml +3 -0
  182. package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/expected.json +5 -0
  183. package/fixtures/cases/link-into-a-reserved-name-from-an-untyped-document/library/notes/b.md +5 -0
  184. package/fixtures/cases/list-item-enum/expected.json +7 -0
  185. package/fixtures/cases/list-item-enum/library/task.md +7 -0
  186. package/fixtures/cases/list-item-enum/schema.yaml +3 -0
  187. package/fixtures/cases/list-item-kind/context.json +1 -0
  188. package/fixtures/cases/list-item-kind/expected.json +7 -0
  189. package/fixtures/cases/list-item-kind/library/task.md +6 -0
  190. package/fixtures/cases/list-item-kind/schema.yaml +3 -0
  191. package/fixtures/cases/list-items/context.json +1 -0
  192. package/fixtures/cases/list-items/expected.json +1 -0
  193. package/fixtures/cases/list-items/library/page.md +26 -0
  194. package/fixtures/cases/list-items/schema.yaml +10 -0
  195. package/fixtures/cases/list-of-objects-closed/expected.json +2 -1
  196. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +1 -1
  197. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +49 -25
  198. package/fixtures/cases/list-of-objects-closed/schema.yaml +10 -11
  199. package/fixtures/cases/list-of-objects-item/expected.json +2 -1
  200. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +1 -1
  201. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +49 -24
  202. package/fixtures/cases/list-of-objects-item/schema.yaml +10 -11
  203. package/fixtures/cases/list-of-objects-reference/expected.json +2 -1
  204. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +1 -1
  205. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +12 -9
  206. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +1 -1
  207. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +1 -1
  208. package/fixtures/cases/list-of-objects-reference/library/products/support.md +1 -1
  209. package/fixtures/cases/list-reference-path/context.json +1 -0
  210. package/fixtures/cases/list-reference-path/expected.json +7 -0
  211. package/fixtures/cases/list-reference-path/library/page.md +5 -0
  212. package/fixtures/cases/list-reference-path/schema.yaml +3 -0
  213. package/fixtures/cases/list-reference-type/context.json +1 -0
  214. package/fixtures/cases/list-reference-type/expected.json +7 -0
  215. package/fixtures/cases/list-reference-type/library/page.md +6 -0
  216. package/fixtures/cases/list-reference-type/schema.yaml +3 -0
  217. package/fixtures/cases/list-size/expected.json +2 -1
  218. package/fixtures/cases/list-size/library/companies/acme.md +1 -1
  219. package/fixtures/cases/list-size/library/deals/renewal.md +51 -24
  220. package/fixtures/cases/list-size/schema.yaml +10 -11
  221. package/fixtures/cases/long-value-past-six-levels/context.json +1 -0
  222. package/fixtures/cases/long-value-past-six-levels/expected.json +5 -0
  223. package/fixtures/cases/long-value-past-six-levels/schema.yaml +15 -0
  224. package/fixtures/cases/malformed-list/context.json +1 -0
  225. package/fixtures/cases/malformed-list/expected.json +7 -0
  226. package/fixtures/cases/{structured-section → malformed-list}/library/item.md +1 -1
  227. package/fixtures/cases/malformed-list/schema.yaml +6 -0
  228. package/fixtures/cases/member-document/library/people/ana.md +2 -2
  229. package/fixtures/cases/member-on-an-untyped-document/context.json +1 -0
  230. package/fixtures/cases/member-on-an-untyped-document/expected.json +6 -0
  231. package/fixtures/cases/member-on-an-untyped-document/library/note.md +4 -0
  232. package/fixtures/cases/member-on-another-type/context.json +1 -0
  233. package/fixtures/cases/member-on-another-type/expected.json +6 -0
  234. package/fixtures/cases/member-on-another-type/library/note.md +4 -0
  235. package/fixtures/cases/member-on-another-type/schema.yaml +7 -0
  236. package/fixtures/cases/missing-required-field/library/item.md +1 -1
  237. package/fixtures/cases/missing-required-field/schema.yaml +3 -4
  238. package/fixtures/cases/misspelled-key/expected.json +2 -1
  239. package/fixtures/cases/misspelled-key/library/companies/acme.md +1 -1
  240. package/fixtures/cases/misspelled-key/library/deals/renewal.md +50 -25
  241. package/fixtures/cases/misspelled-key/schema.yaml +10 -11
  242. package/fixtures/cases/name-not-a-string/context.json +1 -0
  243. package/fixtures/cases/name-not-a-string/expected.json +5 -0
  244. package/fixtures/cases/name-not-a-string/schema.yaml +5 -0
  245. package/fixtures/cases/nested-defs/expected.json +2 -1
  246. package/fixtures/cases/nested-defs/library/deal.md +3 -3
  247. package/fixtures/cases/nested-object-reference/expected.json +2 -1
  248. package/fixtures/cases/nested-object-reference/library/companies/acme.md +1 -1
  249. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +12 -9
  250. package/fixtures/cases/nested-object-reference/library/places/depot.md +1 -1
  251. package/fixtures/cases/nested-object-reference/library/products/seats.md +1 -1
  252. package/fixtures/cases/nested-object-reference/library/products/support.md +1 -1
  253. package/fixtures/cases/nested-reference/library/companies/acme.md +1 -1
  254. package/fixtures/cases/nested-reference/library/deals/renewal.md +13 -10
  255. package/fixtures/cases/nested-reference/library/places/depot.md +1 -1
  256. package/fixtures/cases/nested-reference/library/products/seats.md +1 -1
  257. package/fixtures/cases/nested-reference/library/products/support.md +1 -1
  258. package/fixtures/cases/nested-required-field/expected.json +2 -1
  259. package/fixtures/cases/nested-required-field/library/companies/acme.md +1 -1
  260. package/fixtures/cases/nested-required-field/library/deals/renewal.md +48 -23
  261. package/fixtures/cases/nested-required-field/schema.yaml +10 -11
  262. package/fixtures/cases/numeric-range/expected.json +2 -1
  263. package/fixtures/cases/numeric-range/library/companies/acme.md +1 -1
  264. package/fixtures/cases/numeric-range/library/deals/renewal.md +49 -24
  265. package/fixtures/cases/numeric-range/schema.yaml +10 -11
  266. package/fixtures/cases/one-key-two-labels/context.json +1 -0
  267. package/fixtures/cases/one-key-two-labels/expected.json +5 -0
  268. package/fixtures/cases/one-key-two-labels/schema.yaml +5 -0
  269. package/fixtures/cases/one-key-two-types/context.json +1 -0
  270. package/fixtures/cases/one-key-two-types/expected.json +5 -0
  271. package/fixtures/cases/one-key-two-types/schema.yaml +4 -0
  272. package/fixtures/cases/one-of-variant/expected.json +2 -1
  273. package/fixtures/cases/one-of-variant/library/companies/acme.md +1 -1
  274. package/fixtures/cases/one-of-variant/library/deals/renewal.md +49 -24
  275. package/fixtures/cases/one-of-variant/schema.yaml +10 -11
  276. package/fixtures/cases/other-room-reference/expected.json +2 -1
  277. package/fixtures/cases/other-room-reference/library/companies/acme.md +1 -1
  278. package/fixtures/cases/other-room-reference/library/deals/renewal.md +12 -9
  279. package/fixtures/cases/other-room-reference/library/places/depot.md +1 -1
  280. package/fixtures/cases/other-room-reference/library/products/seats.md +1 -1
  281. package/fixtures/cases/other-room-reference/library/products/support.md +1 -1
  282. package/fixtures/cases/prototype-field/expected.json +2 -1
  283. package/fixtures/cases/prototype-field/library/item.md +2 -2
  284. package/fixtures/cases/prototype-field/schema.yaml +2 -3
  285. package/fixtures/cases/reference-into-a-reserved-name/context.json +1 -0
  286. package/fixtures/cases/reference-into-a-reserved-name/expected.json +7 -0
  287. package/fixtures/cases/reference-into-a-reserved-name/library/notes/a.md +4 -0
  288. package/fixtures/cases/reference-into-a-reserved-name/library/settings/brief.md +1 -0
  289. package/fixtures/cases/reference-into-a-reserved-name/schema.yaml +3 -0
  290. package/fixtures/cases/referenced-missing-file/library/a.md +2 -2
  291. package/fixtures/cases/referenced-missing-file/library/b.md +2 -2
  292. package/fixtures/cases/referenced-missing-file/schema.yaml +3 -4
  293. package/fixtures/cases/room-md-declares-a-type/context.json +1 -0
  294. package/fixtures/cases/room-md-declares-a-type/expected.json +6 -0
  295. package/fixtures/cases/room-md-declares-a-type/library/ROOM.md +5 -0
  296. package/fixtures/cases/sections-keyword-refused/context.json +1 -0
  297. package/fixtures/cases/sections-keyword-refused/expected.json +5 -0
  298. package/fixtures/cases/{structured-section → sections-keyword-refused}/schema.yaml +1 -2
  299. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  300. package/fixtures/cases/shortcut-reference-link/schema.yaml +2 -3
  301. package/fixtures/cases/string-length/expected.json +2 -1
  302. package/fixtures/cases/string-length/library/companies/acme.md +1 -1
  303. package/fixtures/cases/string-length/library/deals/renewal.md +49 -24
  304. package/fixtures/cases/string-length/schema.yaml +10 -11
  305. package/fixtures/cases/submission-keys/library/notes/visitor.md +2 -2
  306. package/fixtures/cases/text-field-kind/expected.json +1 -4
  307. package/fixtures/cases/text-field-kind/library/page.md +1 -1
  308. package/fixtures/cases/thematic-break-ends-the-values/context.json +1 -0
  309. package/fixtures/cases/thematic-break-ends-the-values/expected.json +1 -0
  310. package/fixtures/cases/thematic-break-ends-the-values/library/item.md +10 -0
  311. package/fixtures/cases/thematic-break-ends-the-values/schema.yaml +3 -0
  312. package/fixtures/cases/typed-path-names-another-type/context.json +11 -0
  313. package/fixtures/cases/typed-path-names-another-type/expected.json +6 -0
  314. package/fixtures/cases/typed-path-names-another-type/library/settings/prefs/one.md +3 -0
  315. package/fixtures/cases/typed-path-names-another-type/schema.yaml +6 -0
  316. package/fixtures/cases/typed-path-names-its-type/context.json +11 -0
  317. package/fixtures/cases/typed-path-names-its-type/expected.json +3 -0
  318. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/deeper/two.md +1 -0
  319. package/fixtures/cases/typed-path-names-its-type/library/settings/prefs/one.md +4 -0
  320. package/fixtures/cases/typed-path-names-its-type/schema.yaml +6 -0
  321. package/fixtures/cases/typed-path-names-no-type/context.json +11 -0
  322. package/fixtures/cases/typed-path-names-no-type/expected.json +6 -0
  323. package/fixtures/cases/typed-path-names-no-type/library/settings/prefs/one.md +1 -0
  324. package/fixtures/cases/typed-path-names-no-type/schema.yaml +6 -0
  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/context.json +11 -0
  332. package/fixtures/cases/unnamed-typed-path-checks-its-fields/expected.json +6 -0
  333. package/fixtures/cases/unnamed-typed-path-checks-its-fields/library/rooms/team/tasks/plan.md +5 -0
  334. package/fixtures/cases/unnamed-typed-path-checks-its-fields/schema.yaml +5 -0
  335. package/fixtures/cases/unnamed-typed-path-names-a-type/context.json +11 -0
  336. package/fixtures/cases/unnamed-typed-path-names-a-type/expected.json +6 -0
  337. package/fixtures/cases/unnamed-typed-path-names-a-type/library/rooms/team/tasks/plan.md +7 -0
  338. package/fixtures/cases/unnamed-typed-path-names-a-type/schema.yaml +5 -0
  339. package/fixtures/cases/unnamed-typed-path-reads-its-type/context.json +11 -0
  340. package/fixtures/cases/unnamed-typed-path-reads-its-type/expected.json +3 -0
  341. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/plan.md +1 -0
  342. package/fixtures/cases/unnamed-typed-path-reads-its-type/library/rooms/team/tasks/plan.md +6 -0
  343. package/fixtures/cases/unnamed-typed-path-reads-its-type/schema.yaml +5 -0
  344. package/fixtures/cases/unnamed-typed-path-without-a-body/context.json +11 -0
  345. package/fixtures/cases/unnamed-typed-path-without-a-body/expected.json +5 -0
  346. package/fixtures/cases/unnamed-typed-path-without-a-body/library/rooms/team/tasks/plan.md +5 -0
  347. package/fixtures/cases/unnamed-typed-path-without-a-body/schema.yaml +5 -0
  348. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  349. package/fixtures/cases/unresolved-link/schema.yaml +2 -3
  350. package/fixtures/cases/valid-typed-document/library/people/ada.md +1 -1
  351. package/fixtures/cases/valid-typed-document/library/tasks/one.md +11 -11
  352. package/fixtures/cases/valid-typed-document/schema.yaml +5 -6
  353. package/fixtures/division.json +111 -66
  354. package/fixtures/forms.json +347 -0
  355. package/fixtures/preamble.json +26 -5
  356. package/fixtures/projection.json +121 -18
  357. package/fixtures/queries.json +964 -0
  358. package/package.json +16 -2
  359. package/dist/blocks.d.ts +0 -11
  360. package/dist/blocks.d.ts.map +0 -1
  361. package/dist/blocks.js +0 -76
  362. package/dist/condition.d.ts +0 -149
  363. package/dist/condition.d.ts.map +0 -1
  364. package/dist/condition.js +0 -500
  365. package/dist/links.d.ts +0 -27
  366. package/dist/links.d.ts.map +0 -1
  367. package/dist/links.js +0 -774
  368. package/dist/profile.d.ts +0 -6
  369. package/dist/profile.d.ts.map +0 -1
  370. package/dist/profile.js +0 -5
  371. package/dist/sections.d.ts +0 -11
  372. package/dist/sections.d.ts.map +0 -1
  373. package/dist/sections.js +0 -57
  374. package/fixtures/cases/missing-section-item-kind/expected.json +0 -5
  375. package/fixtures/cases/missing-section-item-kind/schema.yaml +0 -6
  376. package/fixtures/cases/null-refused/expected.json +0 -6
  377. package/fixtures/cases/null-refused/library/companies/acme.md +0 -4
  378. package/fixtures/cases/null-refused/library/deals/renewal.md +0 -31
  379. package/fixtures/cases/null-refused/schema.yaml +0 -56
  380. package/fixtures/cases/open-map-value/expected.json +0 -6
  381. package/fixtures/cases/open-map-value/library/companies/acme.md +0 -4
  382. package/fixtures/cases/open-map-value/library/deals/renewal.md +0 -31
  383. package/fixtures/cases/open-map-value/schema.yaml +0 -56
  384. package/fixtures/cases/section-item-enum/expected.json +0 -6
  385. package/fixtures/cases/section-item-enum/library/task.md +0 -8
  386. package/fixtures/cases/section-item-enum/schema.yaml +0 -3
  387. package/fixtures/cases/section-item-kind/expected.json +0 -6
  388. package/fixtures/cases/section-item-kind/library/task.md +0 -8
  389. package/fixtures/cases/section-item-kind/schema.yaml +0 -3
  390. package/fixtures/cases/section-items/library/page.md +0 -42
  391. package/fixtures/cases/section-items/schema.yaml +0 -10
  392. package/fixtures/cases/section-reference-path/expected.json +0 -6
  393. package/fixtures/cases/section-reference-path/library/page.md +0 -7
  394. package/fixtures/cases/section-reference-path/schema.yaml +0 -3
  395. package/fixtures/cases/section-reference-type/expected.json +0 -6
  396. package/fixtures/cases/section-reference-type/library/page.md +0 -7
  397. package/fixtures/cases/section-reference-type/schema.yaml +0 -3
  398. package/fixtures/cases/structured-section/expected.json +0 -6
  399. /package/fixtures/cases/{missing-section-item-kind → conditional-long-text}/context.json +0 -0
  400. /package/fixtures/cases/{null-refused → cross-room-link}/context.json +0 -0
  401. /package/fixtures/cases/{section-items → cross-room-link}/expected.json +0 -0
  402. /package/fixtures/cases/{open-map-value → cross-room-reference}/context.json +0 -0
  403. /package/fixtures/cases/{section-item-enum → equal-labels}/context.json +0 -0
  404. /package/fixtures/cases/{section-item-kind → labels-in-the-rooms-language}/context.json +0 -0
  405. /package/fixtures/cases/{section-items → lazy-list-item}/context.json +0 -0
  406. /package/fixtures/cases/{section-reference-type → link-into-a-reserved-name}/context.json +0 -0
  407. /package/fixtures/cases/{section-reference-path → link-into-a-reserved-name-from-an-untyped-document}/context.json +0 -0
  408. /package/fixtures/cases/{structured-section → list-item-enum}/context.json +0 -0
  409. /package/fixtures/cases/{section-items → list-items}/library/other.md +0 -0
  410. /package/fixtures/cases/{section-reference-path → list-reference-path}/library/other.md +0 -0
  411. /package/fixtures/cases/{section-reference-type → list-reference-type}/library/note.md +0 -0
package/dist/condition.js DELETED
@@ -1,500 +0,0 @@
1
- import { ARRAY_INDEX, escapePointer, fieldFacts, itemFacts, memberFacts, pointerSegments, } from './definition.js';
2
- import { target } from './paths.js';
3
- import { isRecord, plain } from './yaml.js';
4
- export const WRITE_DOORS = ['browser', 'agent', 'client'];
5
- const PROSE = { kind: 'prose' };
6
- const NULL = { kind: 'null' };
7
- const UNREADABLE = { kind: 'unreadable' };
8
- const UNREAD = { present: undefined, values: [undefined], items: [undefined] };
9
- const NO_ITEM = { present: false, values: [], items: [] };
10
- const DATE = /^\d{4}-\d{2}-\d{2}$/u;
11
- const DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[Tt](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:[Zz]|([+-])(\d{2}):(\d{2}))$/u;
12
- export function factKind(facts) {
13
- if (facts.reference !== undefined)
14
- return 'reference';
15
- if (facts.values !== undefined)
16
- return 'enum';
17
- if (facts.type === 'number' || facts.type === 'integer')
18
- return 'number';
19
- if (facts.type === 'boolean')
20
- return 'boolean';
21
- if (facts.type !== 'string')
22
- return null;
23
- if (facts.format === 'date')
24
- return 'date';
25
- if (facts.format === 'date-time')
26
- return 'time';
27
- return 'string';
28
- }
29
- function fits(kind, facts, value) {
30
- if (!scalar(value))
31
- return false;
32
- if (kind === 'enum')
33
- return (facts.values ?? []).includes(value);
34
- if (kind === 'number')
35
- return typeof value === 'number';
36
- if (kind === 'boolean')
37
- return typeof value === 'boolean';
38
- if (typeof value !== 'string')
39
- return false;
40
- if (kind === 'date')
41
- return dated(value);
42
- if (kind === 'time')
43
- return instant(value) !== undefined;
44
- return true;
45
- }
46
- function factOf(value, declared, place) {
47
- if (value === null)
48
- return NULL;
49
- if (Array.isArray(value)) {
50
- if (declared?.type !== undefined && declared.type !== 'array')
51
- return UNREADABLE;
52
- return {
53
- kind: 'list',
54
- items: value.map((item, index) => factOf(item, declared === undefined ? undefined : itemFacts(declared, index), place)),
55
- };
56
- }
57
- if (plain(value)) {
58
- if (declared?.type !== undefined && declared.type !== 'object')
59
- return UNREADABLE;
60
- const fields = Object.create(null);
61
- for (const [key, held] of Object.entries(value))
62
- fields[key] = factOf(held, declared === undefined ? undefined : memberFacts(declared, key), place);
63
- return { kind: 'object', fields };
64
- }
65
- if (declared?.type === 'array' || declared?.type === 'object')
66
- return UNREADABLE;
67
- const kind = declared === undefined || declared.prose ? null : factKind(declared);
68
- if (kind === null)
69
- return PROSE;
70
- if (!fits(kind, declared, value))
71
- return UNREADABLE;
72
- if (kind !== 'reference')
73
- return { kind, value };
74
- const reached = target(place.path, value);
75
- const resolved = reached === null ? undefined : place.resolve(reached);
76
- if (resolved === undefined)
77
- return UNREADABLE;
78
- return resolved.member === undefined
79
- ? { kind, value: resolved.id }
80
- : { kind, value: resolved.id, member: resolved.member };
81
- }
82
- export function facts(document, at, model, resolve) {
83
- const type = document.type ?? null;
84
- const definition = type !== null && Object.hasOwn(model.types, type) ? model.types[type] : null;
85
- const fields = Object.create(null);
86
- const place = { path: at.path, resolve };
87
- for (const [name, value] of Object.entries(document.fields)) {
88
- const declared = definition === null ? undefined : fieldFacts(definition, name);
89
- if (declared !== undefined)
90
- fields[name] = factOf(value, declared, place);
91
- }
92
- return {
93
- id: at.id,
94
- path: `/${at.path}`,
95
- type,
96
- fields,
97
- sections: Object.keys(document.sections).sort(),
98
- };
99
- }
100
- function rootOf(facts, prefix) {
101
- return { pointer: prefix, fact: { kind: 'object', fields: facts.fields } };
102
- }
103
- export function prosePaths(facts) {
104
- const paths = facts.sections.map((heading) => `/sections/${heading}`);
105
- const visit = ({ pointer, fact }) => {
106
- if (fact.kind === 'prose')
107
- paths.push(pointer);
108
- if (fact.kind === 'list')
109
- fact.items.forEach((item, index) => visit({ pointer: `${pointer}/${index}`, fact: item }));
110
- if (fact.kind === 'object')
111
- for (const [key, held] of Object.entries(fact.fields))
112
- visit({ pointer: `${pointer}/${escapePointer(key)}`, fact: held });
113
- };
114
- visit(rootOf(facts, '/fields'));
115
- return paths.sort();
116
- }
117
- function walked(start, pointer) {
118
- let reached = [start];
119
- let several = false;
120
- let missing = false;
121
- const each = (from, next) => from.flatMap((one) => {
122
- const found = next(one);
123
- if (found === null)
124
- missing = true;
125
- return found ?? [];
126
- });
127
- for (const token of pointerSegments(pointer)) {
128
- const step = ({ pointer: at, fact }) => {
129
- if (fact.kind === 'unreadable')
130
- return [{ pointer: at, fact }];
131
- if (fact.kind === 'object')
132
- return Object.hasOwn(fact.fields, token)
133
- ? [{ pointer: `${at}/${escapePointer(token)}`, fact: fact.fields[token] }]
134
- : null;
135
- if (fact.kind !== 'list')
136
- return null;
137
- if (ARRAY_INDEX.test(token)) {
138
- const item = fact.items[Number(token)];
139
- return item === undefined ? null : [{ pointer: `${at}/${token}`, fact: item }];
140
- }
141
- several = true;
142
- return each(fact.items.map((item, index) => ({ pointer: `${at}/${index}`, fact: item })), step);
143
- };
144
- reached = each(reached, step);
145
- }
146
- return { reached, several, missing };
147
- }
148
- function expand(fact) {
149
- return fact.kind === 'list' ? fact.items.flatMap(expand) : [fact];
150
- }
151
- function fieldHeld(fact) {
152
- if (fact.kind === 'unreadable')
153
- return undefined;
154
- if (fact.kind === 'null')
155
- return { kind: 'null' };
156
- return 'value' in fact ? { kind: fact.kind, value: fact.value } : { kind: 'prose' };
157
- }
158
- function memberHeld(fact) {
159
- if (fact.kind === 'unreadable')
160
- return undefined;
161
- return fact.kind === 'reference' && fact.member !== undefined
162
- ? { kind: 'member', value: fact.member }
163
- : null;
164
- }
165
- function single(held) {
166
- return { present: true, values: [held], items: null };
167
- }
168
- function documentRead({ reached, several, missing }, held) {
169
- if (reached.length === 0)
170
- return missing ? undefined : NO_ITEM;
171
- const facts = reached.map(({ fact }) => fact);
172
- const kept = (all) => all.map(held).filter((value) => value !== null);
173
- const unknown = missing ? [undefined] : [];
174
- const values = kept(facts.filter((fact) => fact.kind !== 'list'));
175
- const listed = several || facts.some((fact) => fact.kind === 'list');
176
- const present = facts.some((fact) => fact.kind === 'list') || values.some(Boolean);
177
- return {
178
- present: present ? true : values.length > 0 ? undefined : false,
179
- values: [...values, ...unknown],
180
- items: listed ? [...kept(facts.flatMap(expand)), ...unknown] : null,
181
- };
182
- }
183
- function readDocument(facts, path) {
184
- if (path === '/path')
185
- return single({ kind: 'path', value: facts.path });
186
- if (path === '/type')
187
- return facts.type === null ? undefined : single({ kind: 'string', value: facts.type });
188
- if (path.startsWith('/sections/'))
189
- return facts.sections.includes(path.slice('/sections/'.length))
190
- ? single({ kind: 'prose' })
191
- : undefined;
192
- if (path.startsWith('/fields/'))
193
- return documentRead(walked(rootOf(facts, '/fields'), path.slice('/fields'.length)), fieldHeld);
194
- if (path.startsWith('/members/'))
195
- return documentRead(walked(rootOf(facts, '/members'), path.slice('/members'.length)), memberHeld);
196
- return undefined;
197
- }
198
- function readActor(actor, path) {
199
- const value = path === '/user'
200
- ? actor.user
201
- : path === '/site'
202
- ? actor.site
203
- : path === '/door'
204
- ? actor.door
205
- : undefined;
206
- return value === undefined ? undefined : single({ kind: 'actor', value });
207
- }
208
- export function datePointers(fields) {
209
- return Object.entries(fields)
210
- .filter(([, facts]) => facts.type === 'string' && facts.format === 'date')
211
- .map(([name]) => `/fields/${name}`)
212
- .sort();
213
- }
214
- export function dated(value) {
215
- return (typeof value === 'string' && DATE.test(value) && instant(`${value}T00:00:00Z`) !== undefined);
216
- }
217
- export function instant(value) {
218
- if (typeof value !== 'string')
219
- return undefined;
220
- const parts = DATE_TIME.exec(value);
221
- if (parts === null)
222
- return undefined;
223
- const [year, month, day, hour, minute, second, offsetHours, offsetMinutes] = [
224
- 1, 2, 3, 4, 5, 6, 9, 10,
225
- ].map((at) => Number(parts[at] ?? 0));
226
- const at = new Date(0);
227
- at.setUTCFullYear(year, month - 1, day);
228
- at.setUTCHours(hour, minute, second);
229
- if (at.getUTCFullYear() !== year ||
230
- at.getUTCMonth() !== month - 1 ||
231
- at.getUTCDate() !== day ||
232
- at.getUTCHours() !== hour ||
233
- at.getUTCMinutes() !== minute ||
234
- offsetHours > 23 ||
235
- offsetMinutes > 59)
236
- return undefined;
237
- const offset = (parts[8] === '-' ? -1 : 1) * (offsetHours * 60 + offsetMinutes);
238
- const fraction = (parts[7] ?? '').padEnd(9, '0').slice(0, 9);
239
- return (BigInt(at.getTime()) - BigInt(offset) * 60000n) * 1000000n + BigInt(fraction);
240
- }
241
- export function pointed(value, pointer) {
242
- if (pointer === '')
243
- return value;
244
- let reached = value;
245
- for (const part of pointer.slice(1).split('/')) {
246
- const token = part.replaceAll('~1', '/').replaceAll('~0', '~');
247
- if (Array.isArray(reached)) {
248
- if (!ARRAY_INDEX.test(token))
249
- return undefined;
250
- reached = reached[Number(token)];
251
- }
252
- else if (plain(reached) && Object.hasOwn(reached, token)) {
253
- reached = reached[token];
254
- }
255
- else {
256
- return undefined;
257
- }
258
- }
259
- return reached;
260
- }
261
- function scalar(value) {
262
- return (typeof value === 'string' ||
263
- typeof value === 'boolean' ||
264
- (typeof value === 'number' && Number.isFinite(value)));
265
- }
266
- function jsonHeld(value) {
267
- if (typeof value === 'string')
268
- return {
269
- kind: dated(value) ? 'date' : instant(value) === undefined ? 'string' : 'time',
270
- value,
271
- };
272
- if (typeof value === 'boolean')
273
- return { kind: 'boolean', value };
274
- return { kind: 'number', value };
275
- }
276
- function jsonRead(value) {
277
- if (value === undefined)
278
- return undefined;
279
- if (scalar(value))
280
- return single(jsonHeld(value));
281
- if (!Array.isArray(value))
282
- return single({ kind: 'prose' });
283
- return { present: true, values: [], items: value.filter(scalar).map(jsonHeld), loose: true };
284
- }
285
- function readItem(item, path) {
286
- if (path.startsWith('/json/')) {
287
- if (item.json === null)
288
- return UNREAD;
289
- return jsonRead(pointed(item.json.value, path.slice('/json'.length)));
290
- }
291
- if (path.startsWith('/headers/')) {
292
- const name = path.slice('/headers/'.length);
293
- return Object.hasOwn(item.headers, name)
294
- ? single({ kind: 'string', value: item.headers[name] })
295
- : undefined;
296
- }
297
- if (path === '/has_attachment')
298
- return single({ kind: 'boolean', value: item.has_attachment });
299
- const value = path === '/delivery'
300
- ? item.delivery
301
- : path === '/source'
302
- ? item.source
303
- : path === '/container'
304
- ? item.container
305
- : path === '/author'
306
- ? item.author
307
- : null;
308
- return value === null ? undefined : single({ kind: 'string', value });
309
- }
310
- function wanted(value, owner) {
311
- return isRecord(value) && value.owner === true ? owner : value;
312
- }
313
- function equal(held, value, owner) {
314
- if (!('value' in held))
315
- return undefined;
316
- const expected = wanted(value, owner);
317
- if (typeof expected !== typeof held.value)
318
- return undefined;
319
- if (held.kind !== 'time')
320
- return expected === held.value;
321
- const left = instant(held.value);
322
- const right = instant(expected);
323
- return left === undefined || right === undefined ? undefined : left === right;
324
- }
325
- function sign(left, right) {
326
- return left < right ? -1 : left > right ? 1 : 0;
327
- }
328
- function ordered(held, value, compare) {
329
- if (!('value' in held))
330
- return undefined;
331
- if (held.kind === 'number') {
332
- if (typeof value !== 'number' || typeof held.value !== 'number')
333
- return undefined;
334
- return compare(Math.sign(held.value - value));
335
- }
336
- if (held.kind === 'date') {
337
- if (!dated(value) || !dated(held.value))
338
- return undefined;
339
- return compare(sign(held.value, value));
340
- }
341
- if (held.kind !== 'time')
342
- return undefined;
343
- const at = instant(held.value);
344
- const wanted = instant(value);
345
- if (at === undefined || wanted === undefined)
346
- return undefined;
347
- return compare(sign(at, wanted));
348
- }
349
- function anyOf(truths) {
350
- if (truths.some((truth) => truth === true))
351
- return true;
352
- return truths.some((truth) => truth === undefined) ? undefined : false;
353
- }
354
- function allOf(truths) {
355
- if (truths.some((truth) => truth === false))
356
- return false;
357
- return truths.some((truth) => truth === undefined) ? undefined : true;
358
- }
359
- function compared(test, held, owner) {
360
- if ('eq' in test)
361
- return equal(held, test.eq, owner);
362
- if ('in' in test)
363
- return anyOf(test.in.map((value) => equal(held, value, owner)));
364
- if ('prefix' in test) {
365
- if (!('value' in held) || typeof held.value !== 'string')
366
- return undefined;
367
- if (held.kind === 'number' || held.kind === 'reference' || held.kind === 'member')
368
- return undefined;
369
- return held.value.startsWith(test.prefix);
370
- }
371
- if ('gt' in test)
372
- return ordered(held, test.gt, (sign) => sign > 0);
373
- if ('gte' in test)
374
- return ordered(held, test.gte, (sign) => sign >= 0);
375
- if ('lt' in test)
376
- return ordered(held, test.lt, (sign) => sign < 0);
377
- return ordered(held, test.lte, (sign) => sign <= 0);
378
- }
379
- function leaf(test, read, owner) {
380
- if ('exists' in test) {
381
- const present = read === undefined ? false : read.present;
382
- return present === undefined ? undefined : present === test.exists;
383
- }
384
- if (read === undefined)
385
- return undefined;
386
- if ('contains' in test) {
387
- if (read.items === null)
388
- return undefined;
389
- const truths = read.items.map((item) => item === undefined ? undefined : equal(item, test.contains, owner));
390
- return read.loose === true && !truths.includes(true) ? false : anyOf(truths);
391
- }
392
- if (read.values.length === 0)
393
- return read === NO_ITEM ? false : undefined;
394
- return anyOf(read.values.map((value) => (value === undefined ? undefined : compared(test, value, owner))));
395
- }
396
- function evaluated(test, read, owner) {
397
- if ('all' in test)
398
- return allOf(test.all.map((part) => evaluated(part, read, owner)));
399
- if ('any' in test)
400
- return anyOf(test.any.map((part) => evaluated(part, read, owner)));
401
- if ('not' in test) {
402
- const truth = evaluated(test.not, read, owner);
403
- return truth === undefined ? undefined : !truth;
404
- }
405
- return leaf(test, read(test.path), owner);
406
- }
407
- export function holds(test, document, owner) {
408
- return evaluated(test, (path) => readDocument(document, path), owner);
409
- }
410
- function inScope(scope, document) {
411
- if (document === null)
412
- return false;
413
- if ('type' in scope)
414
- return document.type === scope.type;
415
- if ('document' in scope)
416
- return document.id === scope.document;
417
- return scope.folder === '/' || document.path.startsWith(`${scope.folder}/`);
418
- }
419
- function matched(condition, test, document, owner) {
420
- if (!inScope(condition.scope, document))
421
- return false;
422
- return test === undefined || holds(test, document, owner) === true;
423
- }
424
- function reachedAt(document, field) {
425
- if (document === null)
426
- return [];
427
- if (field.startsWith('/sections/'))
428
- return document.sections.includes(field.slice('/sections/'.length))
429
- ? [{ pointer: field, fact: PROSE }]
430
- : [];
431
- if (!field.startsWith('/fields/'))
432
- return [];
433
- return walked(rootOf(document, '/fields'), field.slice('/fields'.length)).reached;
434
- }
435
- function valueOf(fact) {
436
- if (fact.kind === 'list')
437
- return { kind: fact.kind, items: fact.items.map(valueOf) };
438
- if (fact.kind === 'object')
439
- return {
440
- kind: fact.kind,
441
- fields: Object.keys(fact.fields)
442
- .sort()
443
- .map((key) => [key, valueOf(fact.fields[key])]),
444
- };
445
- if (fact.kind === 'time') {
446
- const at = instant(fact.value);
447
- if (at !== undefined)
448
- return { kind: fact.kind, at: String(at) };
449
- }
450
- return 'value' in fact ? { kind: fact.kind, value: fact.value } : fact;
451
- }
452
- function signature(reached) {
453
- return JSON.stringify(reached.map(({ fact }) => valueOf(fact)));
454
- }
455
- function among(values, document, field, owner) {
456
- return holds({ path: field, in: values }, document, owner) === true;
457
- }
458
- function fieldChanged(condition, event, owner) {
459
- const { field, from, to } = condition;
460
- const before = reachedAt(event.before, field);
461
- const after = reachedAt(event.after, field);
462
- const pointers = [field, ...[...before, ...after].map(({ pointer }) => pointer)];
463
- const prose = event.changed.some((changed) => pointers.some((pointer) => changed === pointer || changed.startsWith(`${pointer}/`)));
464
- if (from === undefined && to === undefined && prose)
465
- return true;
466
- if (before.length === 0 && after.length === 0)
467
- return false;
468
- if (event.before !== null && event.after !== null && signature(before) === signature(after))
469
- return false;
470
- if (from === 'new'
471
- ? event.before !== null
472
- : from !== undefined && (event.before === null || !among(from, event.before, field, owner)))
473
- return false;
474
- if (to === 'deleted'
475
- ? event.after !== null
476
- : to !== undefined && (event.after === null || !among(to, event.after, field, owner)))
477
- return false;
478
- return true;
479
- }
480
- export function fires(condition, event, owner) {
481
- if (condition.by !== undefined &&
482
- evaluated(condition.by, (path) => readActor(event.by, path), owner) !== true)
483
- return false;
484
- if (condition.mode === 'starts_matching') {
485
- if (event.before === null && !condition.new_documents)
486
- return false;
487
- return (matched(condition, condition.match, event.after, owner) &&
488
- !matched(condition, condition.match, event.before, owner));
489
- }
490
- const side = event.after ?? event.before;
491
- return matched(condition, condition.match, side, owner) && fieldChanged(condition, event, owner);
492
- }
493
- export function itemFires(condition, item, owner) {
494
- if (condition.source !== undefined && item.source !== condition.source)
495
- return false;
496
- if (condition.address !== undefined && item.address !== condition.address)
497
- return false;
498
- return (condition.match === undefined ||
499
- evaluated(condition.match, (path) => readItem(item, path), owner) === true);
500
- }
package/dist/links.d.ts DELETED
@@ -1,27 +0,0 @@
1
- export declare function escapes(text: string, index: number): boolean;
2
- export type HrefOccurrence = {
3
- readonly href: string;
4
- readonly start: number;
5
- readonly end: number;
6
- readonly bracketed: boolean;
7
- };
8
- export type LinkUse = {
9
- readonly start: number;
10
- readonly end: number;
11
- readonly labelStart: number;
12
- readonly labelEnd: number;
13
- readonly destination: HrefOccurrence;
14
- };
15
- export type DefinitionBlock = {
16
- readonly start: number;
17
- readonly end: number;
18
- readonly destination: HrefOccurrence;
19
- };
20
- export type LinkInventory = {
21
- readonly uses: readonly LinkUse[];
22
- readonly blocks: readonly DefinitionBlock[];
23
- };
24
- export declare function fenceSpans(text: string): readonly (readonly [number, number])[];
25
- export declare function linkInventory(body: string): LinkInventory;
26
- export declare function hrefOccurrences(body: string): readonly HrefOccurrence[];
27
- //# sourceMappingURL=links.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"links.d.ts","sourceRoot":"","sources":["../src/links.ts"],"names":[],"mappings":"AAsgBA,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAE5D;AAkMD,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,cAAc,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,OAAO,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,eAAe,EAAE,CAAC;CAC7C,CAAC;AAEF,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,CAe/E;AAYD,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CA2DzD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,cAAc,EAAE,CAIvE"}