@agentshouse/mdmodel 0.1.0-c83456e1cebfb → 0.1.0-cabd61587647f

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 (295) hide show
  1. package/API.md +242 -181
  2. package/README.md +17 -18
  3. package/dist/blocks.d.ts.map +1 -1
  4. package/dist/blocks.js +33 -26
  5. package/dist/condition.d.ts +149 -0
  6. package/dist/condition.d.ts.map +1 -0
  7. package/dist/condition.js +500 -0
  8. package/dist/definition.d.ts +62 -24
  9. package/dist/definition.d.ts.map +1 -1
  10. package/dist/definition.js +703 -138
  11. package/dist/divide.d.ts.map +1 -1
  12. package/dist/divide.js +18 -8
  13. package/dist/document.d.ts +10 -2
  14. package/dist/document.d.ts.map +1 -1
  15. package/dist/document.js +370 -114
  16. package/dist/fields.d.ts +2 -0
  17. package/dist/fields.d.ts.map +1 -1
  18. package/dist/fields.js +7 -0
  19. package/dist/index.d.ts +14 -6
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +9 -4
  22. package/dist/links.d.ts +2 -0
  23. package/dist/links.d.ts.map +1 -1
  24. package/dist/links.js +23 -12
  25. package/dist/paths.d.ts +4 -0
  26. package/dist/paths.d.ts.map +1 -1
  27. package/dist/paths.js +110 -10
  28. package/dist/project.d.ts +1 -0
  29. package/dist/project.d.ts.map +1 -1
  30. package/dist/project.js +52 -30
  31. package/dist/references.d.ts +4 -0
  32. package/dist/references.d.ts.map +1 -0
  33. package/dist/references.js +25 -0
  34. package/dist/schema.d.ts +7 -6
  35. package/dist/schema.d.ts.map +1 -1
  36. package/dist/schema.js +157 -31
  37. package/dist/types.d.ts +43 -1
  38. package/dist/types.d.ts.map +1 -1
  39. package/dist/validate.d.ts +6 -1
  40. package/dist/validate.d.ts.map +1 -1
  41. package/dist/validate.js +167 -144
  42. package/dist/yaml.d.ts +8 -3
  43. package/dist/yaml.d.ts.map +1 -1
  44. package/dist/yaml.js +133 -43
  45. package/fixtures/README.md +49 -38
  46. package/fixtures/cases/absent-link-dangles/context.json +1 -0
  47. package/fixtures/cases/absent-link-dangles/expected.json +1 -0
  48. package/fixtures/cases/absent-link-dangles/library/item.md +8 -0
  49. package/fixtures/cases/absent-link-dangles/schema.yaml +6 -0
  50. package/fixtures/cases/absent-optional-field/context.json +1 -0
  51. package/fixtures/cases/absent-optional-field/expected.json +1 -0
  52. package/fixtures/cases/absent-optional-field/library/companies/acme.md +4 -0
  53. package/fixtures/cases/absent-optional-field/library/deals/lead.md +6 -0
  54. package/fixtures/cases/absent-optional-field/schema.yaml +56 -0
  55. package/fixtures/cases/absolute-link/context.json +1 -0
  56. package/fixtures/cases/{missing-binary-image → absolute-link}/expected.json +1 -1
  57. package/fixtures/cases/absolute-link/library/item.md +8 -0
  58. package/fixtures/cases/absolute-link/schema.yaml +6 -0
  59. package/fixtures/cases/attachment-reference-any-file/context.json +1 -0
  60. package/fixtures/cases/attachment-reference-any-file/expected.json +1 -0
  61. package/fixtures/cases/attachment-reference-any-file/library/companies/acme.md +4 -0
  62. package/fixtures/cases/attachment-reference-any-file/library/deals/renewal.md +15 -0
  63. package/fixtures/cases/attachment-reference-any-file/library/places/depot.md +4 -0
  64. package/fixtures/cases/attachment-reference-any-file/library/products/seats.md +4 -0
  65. package/fixtures/cases/attachment-reference-any-file/library/products/support.md +4 -0
  66. package/fixtures/cases/attachment-reference-any-file/schema.yaml +32 -0
  67. package/fixtures/cases/attachment-reference-dangles/context.json +1 -0
  68. package/fixtures/cases/attachment-reference-dangles/expected.json +1 -0
  69. package/fixtures/cases/attachment-reference-dangles/library/companies/acme.md +4 -0
  70. package/fixtures/cases/attachment-reference-dangles/library/deals/renewal.md +15 -0
  71. package/fixtures/cases/attachment-reference-dangles/library/places/depot.md +4 -0
  72. package/fixtures/cases/attachment-reference-dangles/library/products/seats.md +4 -0
  73. package/fixtures/cases/attachment-reference-dangles/library/products/support.md +4 -0
  74. package/fixtures/cases/attachment-reference-dangles/schema.yaml +32 -0
  75. package/fixtures/cases/attachment-reference-outside/context.json +1 -0
  76. package/fixtures/cases/attachment-reference-outside/expected.json +6 -0
  77. package/fixtures/cases/attachment-reference-outside/library/companies/acme.md +4 -0
  78. package/fixtures/cases/attachment-reference-outside/library/deals/renewal.md +15 -0
  79. package/fixtures/cases/attachment-reference-outside/library/places/depot.md +4 -0
  80. package/fixtures/cases/attachment-reference-outside/library/products/seats.md +4 -0
  81. package/fixtures/cases/attachment-reference-outside/library/products/support.md +4 -0
  82. package/fixtures/cases/attachment-reference-outside/schema.yaml +32 -0
  83. package/fixtures/cases/binary-any-reference/expected.json +1 -1
  84. package/fixtures/cases/binary-any-reference/schema.yaml +4 -4
  85. package/fixtures/cases/binary-document-collision/schema.yaml +1 -2
  86. package/fixtures/cases/binary-image-dangles/expected.json +1 -0
  87. package/fixtures/cases/binary-image-dangles/schema.yaml +1 -0
  88. package/fixtures/cases/binary-link-dangles/expected.json +1 -0
  89. package/fixtures/cases/binary-link-dangles/schema.yaml +1 -0
  90. package/fixtures/cases/binary-link-outside-collection/schema.yaml +1 -2
  91. package/fixtures/cases/binary-prototype-reference/expected.json +1 -1
  92. package/fixtures/cases/binary-prototype-reference/schema.yaml +4 -4
  93. package/fixtures/cases/binary-typed-reference/expected.json +1 -1
  94. package/fixtures/cases/binary-typed-reference/schema.yaml +5 -5
  95. package/fixtures/cases/boolean-field/context.json +1 -0
  96. package/fixtures/cases/boolean-field/expected.json +6 -0
  97. package/fixtures/cases/boolean-field/library/companies/acme.md +4 -0
  98. package/fixtures/cases/boolean-field/library/deals/renewal.md +31 -0
  99. package/fixtures/cases/boolean-field/schema.yaml +56 -0
  100. package/fixtures/cases/bracketed-link-definition/schema.yaml +6 -6
  101. package/fixtures/cases/closed-nested-object/context.json +1 -0
  102. package/fixtures/cases/closed-nested-object/expected.json +6 -0
  103. package/fixtures/cases/closed-nested-object/library/companies/acme.md +4 -0
  104. package/fixtures/cases/closed-nested-object/library/deals/renewal.md +32 -0
  105. package/fixtures/cases/closed-nested-object/schema.yaml +56 -0
  106. package/fixtures/cases/composed-root-reference/context.json +1 -0
  107. package/fixtures/cases/composed-root-reference/expected.json +6 -0
  108. package/fixtures/cases/composed-root-reference/library/a.md +5 -0
  109. package/fixtures/cases/composed-root-reference/schema.yaml +13 -0
  110. package/fixtures/cases/date-time-format/context.json +1 -0
  111. package/fixtures/cases/date-time-format/expected.json +6 -0
  112. package/fixtures/cases/date-time-format/library/companies/acme.md +4 -0
  113. package/fixtures/cases/date-time-format/library/deals/renewal.md +31 -0
  114. package/fixtures/cases/date-time-format/schema.yaml +56 -0
  115. package/fixtures/cases/declared-binary-links/schema.yaml +1 -2
  116. package/fixtures/cases/default-unfilled/context.json +1 -0
  117. package/fixtures/cases/default-unfilled/expected.json +6 -0
  118. package/fixtures/cases/default-unfilled/library/companies/acme.md +4 -0
  119. package/fixtures/cases/default-unfilled/library/deals/renewal.md +29 -0
  120. package/fixtures/cases/default-unfilled/schema.yaml +56 -0
  121. package/fixtures/cases/defs-pattern/context.json +1 -0
  122. package/fixtures/cases/defs-pattern/expected.json +6 -0
  123. package/fixtures/cases/defs-pattern/library/companies/acme.md +4 -0
  124. package/fixtures/cases/defs-pattern/library/deals/renewal.md +31 -0
  125. package/fixtures/cases/defs-pattern/schema.yaml +56 -0
  126. package/fixtures/cases/dependent-rule/context.json +1 -0
  127. package/fixtures/cases/dependent-rule/expected.json +6 -0
  128. package/fixtures/cases/dependent-rule/library/companies/acme.md +4 -0
  129. package/fixtures/cases/dependent-rule/library/deals/renewal.md +30 -0
  130. package/fixtures/cases/dependent-rule/schema.yaml +56 -0
  131. package/fixtures/cases/duplicate-link-definition/schema.yaml +6 -6
  132. package/fixtures/cases/email-format/context.json +1 -0
  133. package/fixtures/cases/email-format/expected.json +6 -0
  134. package/fixtures/cases/email-format/library/companies/acme.md +4 -0
  135. package/fixtures/cases/email-format/library/deals/renewal.md +31 -0
  136. package/fixtures/cases/email-format/schema.yaml +56 -0
  137. package/fixtures/cases/fenced-link-definition/schema.yaml +6 -6
  138. package/fixtures/cases/field-enum/expected.json +2 -2
  139. package/fixtures/cases/field-enum/schema.yaml +7 -7
  140. package/fixtures/cases/frontmatter-schema/schema.yaml +3 -4
  141. package/fixtures/cases/integer-field/context.json +1 -0
  142. package/fixtures/cases/integer-field/expected.json +6 -0
  143. package/fixtures/cases/integer-field/library/companies/acme.md +4 -0
  144. package/fixtures/cases/integer-field/library/deals/renewal.md +31 -0
  145. package/fixtures/cases/integer-field/schema.yaml +56 -0
  146. package/fixtures/cases/interrupted-link-definition/schema.yaml +1 -2
  147. package/fixtures/cases/json-schema-constructs/context.json +1 -0
  148. package/fixtures/cases/json-schema-constructs/expected.json +1 -0
  149. package/fixtures/cases/json-schema-constructs/library/companies/acme.md +4 -0
  150. package/fixtures/cases/json-schema-constructs/library/deals/renewal.md +31 -0
  151. package/fixtures/cases/json-schema-constructs/schema.yaml +56 -0
  152. package/fixtures/cases/list-of-objects-closed/context.json +1 -0
  153. package/fixtures/cases/list-of-objects-closed/expected.json +6 -0
  154. package/fixtures/cases/list-of-objects-closed/library/companies/acme.md +4 -0
  155. package/fixtures/cases/list-of-objects-closed/library/deals/renewal.md +32 -0
  156. package/fixtures/cases/list-of-objects-closed/schema.yaml +56 -0
  157. package/fixtures/cases/list-of-objects-item/context.json +1 -0
  158. package/fixtures/cases/list-of-objects-item/expected.json +6 -0
  159. package/fixtures/cases/list-of-objects-item/library/companies/acme.md +4 -0
  160. package/fixtures/cases/list-of-objects-item/library/deals/renewal.md +31 -0
  161. package/fixtures/cases/list-of-objects-item/schema.yaml +56 -0
  162. package/fixtures/cases/list-of-objects-reference/context.json +1 -0
  163. package/fixtures/cases/list-of-objects-reference/expected.json +6 -0
  164. package/fixtures/cases/list-of-objects-reference/library/companies/acme.md +4 -0
  165. package/fixtures/cases/list-of-objects-reference/library/deals/renewal.md +14 -0
  166. package/fixtures/cases/list-of-objects-reference/library/places/depot.md +4 -0
  167. package/fixtures/cases/list-of-objects-reference/library/products/seats.md +4 -0
  168. package/fixtures/cases/list-of-objects-reference/library/products/support.md +4 -0
  169. package/fixtures/cases/list-of-objects-reference/schema.yaml +32 -0
  170. package/fixtures/cases/list-size/context.json +1 -0
  171. package/fixtures/cases/list-size/expected.json +6 -0
  172. package/fixtures/cases/list-size/library/companies/acme.md +4 -0
  173. package/fixtures/cases/list-size/library/deals/renewal.md +31 -0
  174. package/fixtures/cases/list-size/schema.yaml +56 -0
  175. package/fixtures/cases/long-fence-link-definition/schema.yaml +1 -2
  176. package/fixtures/cases/malformed-definition/expected.json +2 -2
  177. package/fixtures/cases/malformed-definition/schema.yaml +3 -4
  178. package/fixtures/cases/member-document/schema.yaml +5 -5
  179. package/fixtures/cases/missing-required-field/expected.json +2 -2
  180. package/fixtures/cases/missing-required-field/schema.yaml +7 -7
  181. package/fixtures/cases/missing-section-item-kind/expected.json +2 -2
  182. package/fixtures/cases/missing-section-item-kind/schema.yaml +6 -6
  183. package/fixtures/cases/misspelled-key/context.json +1 -0
  184. package/fixtures/cases/misspelled-key/expected.json +6 -0
  185. package/fixtures/cases/misspelled-key/library/companies/acme.md +4 -0
  186. package/fixtures/cases/misspelled-key/library/deals/renewal.md +32 -0
  187. package/fixtures/cases/misspelled-key/schema.yaml +56 -0
  188. package/fixtures/cases/nested-defs/context.json +1 -0
  189. package/fixtures/cases/nested-defs/expected.json +6 -0
  190. package/fixtures/cases/nested-defs/library/deal.md +6 -0
  191. package/fixtures/cases/nested-defs/schema.yaml +11 -0
  192. package/fixtures/cases/nested-object-reference/context.json +1 -0
  193. package/fixtures/cases/nested-object-reference/expected.json +6 -0
  194. package/fixtures/cases/nested-object-reference/library/companies/acme.md +4 -0
  195. package/fixtures/cases/nested-object-reference/library/deals/renewal.md +14 -0
  196. package/fixtures/cases/nested-object-reference/library/places/depot.md +4 -0
  197. package/fixtures/cases/nested-object-reference/library/products/seats.md +4 -0
  198. package/fixtures/cases/nested-object-reference/library/products/support.md +4 -0
  199. package/fixtures/cases/nested-object-reference/schema.yaml +32 -0
  200. package/fixtures/cases/nested-reference/context.json +1 -0
  201. package/fixtures/cases/nested-reference/expected.json +1 -0
  202. package/fixtures/cases/nested-reference/library/companies/acme.md +4 -0
  203. package/fixtures/cases/nested-reference/library/deals/renewal.md +15 -0
  204. package/fixtures/cases/nested-reference/library/places/depot.md +4 -0
  205. package/fixtures/cases/nested-reference/library/products/seats.md +4 -0
  206. package/fixtures/cases/nested-reference/library/products/support.md +4 -0
  207. package/fixtures/cases/nested-reference/schema.yaml +32 -0
  208. package/fixtures/cases/nested-required-field/context.json +1 -0
  209. package/fixtures/cases/nested-required-field/expected.json +6 -0
  210. package/fixtures/cases/nested-required-field/library/companies/acme.md +4 -0
  211. package/fixtures/cases/nested-required-field/library/deals/renewal.md +30 -0
  212. package/fixtures/cases/nested-required-field/schema.yaml +56 -0
  213. package/fixtures/cases/null-refused/context.json +1 -0
  214. package/fixtures/cases/null-refused/expected.json +6 -0
  215. package/fixtures/cases/null-refused/library/companies/acme.md +4 -0
  216. package/fixtures/cases/null-refused/library/deals/renewal.md +31 -0
  217. package/fixtures/cases/null-refused/schema.yaml +56 -0
  218. package/fixtures/cases/numeric-range/context.json +1 -0
  219. package/fixtures/cases/numeric-range/expected.json +6 -0
  220. package/fixtures/cases/numeric-range/library/companies/acme.md +4 -0
  221. package/fixtures/cases/numeric-range/library/deals/renewal.md +31 -0
  222. package/fixtures/cases/numeric-range/schema.yaml +56 -0
  223. package/fixtures/cases/one-of-variant/context.json +1 -0
  224. package/fixtures/cases/one-of-variant/expected.json +6 -0
  225. package/fixtures/cases/one-of-variant/library/companies/acme.md +4 -0
  226. package/fixtures/cases/one-of-variant/library/deals/renewal.md +31 -0
  227. package/fixtures/cases/one-of-variant/schema.yaml +56 -0
  228. package/fixtures/cases/open-map-value/context.json +1 -0
  229. package/fixtures/cases/open-map-value/expected.json +6 -0
  230. package/fixtures/cases/open-map-value/library/companies/acme.md +4 -0
  231. package/fixtures/cases/open-map-value/library/deals/renewal.md +31 -0
  232. package/fixtures/cases/open-map-value/schema.yaml +56 -0
  233. package/fixtures/cases/other-room-reference/context.json +1 -0
  234. package/fixtures/cases/other-room-reference/expected.json +6 -0
  235. package/fixtures/cases/other-room-reference/library/companies/acme.md +4 -0
  236. package/fixtures/cases/other-room-reference/library/deals/renewal.md +14 -0
  237. package/fixtures/cases/other-room-reference/library/places/depot.md +4 -0
  238. package/fixtures/cases/other-room-reference/library/products/seats.md +4 -0
  239. package/fixtures/cases/other-room-reference/library/products/support.md +4 -0
  240. package/fixtures/cases/other-room-reference/schema.yaml +32 -0
  241. package/fixtures/cases/paragraph-link-definition/schema.yaml +1 -2
  242. package/fixtures/cases/prototype-field/expected.json +1 -1
  243. package/fixtures/cases/prototype-field/schema.yaml +6 -6
  244. package/fixtures/cases/quoted-link-definition/library/notes/draft.md +1 -1
  245. package/fixtures/cases/quoted-link-definition/schema.yaml +1 -2
  246. package/fixtures/cases/referenced-missing-file/schema.yaml +11 -10
  247. package/fixtures/cases/remote-ref/context.json +1 -0
  248. package/fixtures/cases/remote-ref/expected.json +5 -0
  249. package/fixtures/cases/remote-ref/schema.yaml +3 -0
  250. package/fixtures/cases/second-member-document/expected.json +2 -2
  251. package/fixtures/cases/second-member-document/schema.yaml +4 -5
  252. package/fixtures/cases/section-item-enum/schema.yaml +3 -4
  253. package/fixtures/cases/section-item-kind/schema.yaml +3 -4
  254. package/fixtures/cases/section-items/library/page.md +14 -0
  255. package/fixtures/cases/section-items/schema.yaml +10 -8
  256. package/fixtures/cases/section-reference-path/schema.yaml +3 -4
  257. package/fixtures/cases/section-reference-type/schema.yaml +3 -4
  258. package/fixtures/cases/shortcut-reference-link/library/item.md +1 -1
  259. package/fixtures/cases/shortcut-reference-link/schema.yaml +6 -6
  260. package/fixtures/cases/string-length/context.json +1 -0
  261. package/fixtures/cases/string-length/expected.json +6 -0
  262. package/fixtures/cases/string-length/library/companies/acme.md +4 -0
  263. package/fixtures/cases/string-length/library/deals/renewal.md +31 -0
  264. package/fixtures/cases/string-length/schema.yaml +56 -0
  265. package/fixtures/cases/structured-section/schema.yaml +7 -7
  266. package/fixtures/cases/submission-keys/schema.yaml +4 -4
  267. package/fixtures/cases/text-field-kind/expected.json +2 -2
  268. package/fixtures/cases/text-field-kind/schema.yaml +4 -4
  269. package/fixtures/cases/truncated-link-definition/library/notes/draft.md +1 -1
  270. package/fixtures/cases/truncated-link-definition/schema.yaml +1 -2
  271. package/fixtures/cases/types-folder-content/schema.yaml +4 -4
  272. package/fixtures/cases/undeclared-field/expected.json +1 -1
  273. package/fixtures/cases/undeclared-field/schema.yaml +6 -6
  274. package/fixtures/cases/unevaluated-items-closed/context.json +1 -0
  275. package/fixtures/cases/unevaluated-items-closed/expected.json +6 -0
  276. package/fixtures/cases/unevaluated-items-closed/library/trip.md +6 -0
  277. package/fixtures/cases/unevaluated-items-closed/schema.yaml +10 -0
  278. package/fixtures/cases/unknown-type/expected.json +1 -1
  279. package/fixtures/cases/unknown-type/schema.yaml +3 -4
  280. package/fixtures/cases/unlisted-reference-type/expected.json +2 -2
  281. package/fixtures/cases/unlisted-reference-type/schema.yaml +3 -4
  282. package/fixtures/cases/unresolved-link/library/item.md +1 -1
  283. package/fixtures/cases/unresolved-link/schema.yaml +6 -6
  284. package/fixtures/cases/valid-typed-document/schema.yaml +16 -15
  285. package/fixtures/cases/wide-item-fence-link/schema.yaml +1 -2
  286. package/fixtures/division.json +1 -1
  287. package/fixtures/projection.json +33 -1
  288. package/package.json +4 -2
  289. package/fixtures/cases/missing-binary-image/schema.yaml +0 -2
  290. package/fixtures/cases/missing-binary-link/expected.json +0 -5
  291. package/fixtures/cases/missing-binary-link/schema.yaml +0 -2
  292. /package/fixtures/cases/{missing-binary-image → binary-image-dangles}/context.json +0 -0
  293. /package/fixtures/cases/{missing-binary-image → binary-image-dangles}/library/notes/draft.md +0 -0
  294. /package/fixtures/cases/{missing-binary-link → binary-link-dangles}/context.json +0 -0
  295. /package/fixtures/cases/{missing-binary-link → binary-link-dangles}/library/notes/draft.md +0 -0
@@ -0,0 +1,500 @@
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
+ }
@@ -1,42 +1,80 @@
1
1
  import type { VerifiedModel } from './types.js';
2
- export type TextSpec = {
3
- readonly kind: 'text';
4
- readonly required: boolean;
2
+ export type JsonType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
3
+ export type ValueFacts = {
4
+ readonly type?: JsonType;
5
+ readonly format?: string;
6
+ readonly values?: readonly unknown[];
7
+ readonly reference?: readonly string[];
8
+ readonly prose: boolean;
9
+ readonly conditional?: true;
10
+ readonly prefix?: readonly ValueFacts[];
11
+ readonly items?: ValueFacts;
12
+ readonly properties?: Readonly<Record<string, ValueFacts>>;
13
+ readonly patterns?: readonly PatternFacts[];
14
+ readonly additional?: ValueFacts;
5
15
  };
6
- export type ScalarSpec = TextSpec | {
7
- readonly kind: 'string';
8
- readonly required: boolean;
9
- } | {
10
- readonly kind: 'number';
11
- readonly required: boolean;
12
- } | {
13
- readonly kind: 'date';
14
- readonly required: boolean;
15
- } | {
16
- readonly kind: 'enum';
16
+ export type PatternFacts = {
17
+ readonly pattern: string;
18
+ readonly facts: ValueFacts;
19
+ };
20
+ export type SectionSpec = {
21
+ readonly kind: 'text';
17
22
  readonly required: boolean;
18
- readonly values: readonly string[];
19
23
  } | {
20
- readonly kind: 'reference';
21
- readonly required: boolean;
22
- readonly to: string;
23
- };
24
- export type ListSpec = {
25
24
  readonly kind: 'list';
26
25
  readonly required: boolean;
27
- readonly of: ScalarSpec;
26
+ readonly items: ValueFacts;
27
+ };
28
+ export type Shape = {
29
+ readonly schema: Readonly<Record<string, unknown>>;
30
+ readonly defs: Readonly<Record<string, unknown>>;
31
+ };
32
+ export type RuleValue = string | number | boolean | null;
33
+ export type Transition = {
34
+ readonly from: RuleValue;
35
+ readonly to: RuleValue;
36
+ readonly roles?: readonly string[];
37
+ };
38
+ export type FieldRules = {
39
+ readonly changeRoles?: readonly string[];
40
+ readonly initialRoles?: readonly string[];
41
+ readonly transitions?: readonly Transition[];
28
42
  };
29
- export type FieldSpec = ScalarSpec | ListSpec;
30
- export type SectionSpec = TextSpec | ListSpec;
31
43
  export type Definition = {
32
44
  readonly name: string;
33
45
  readonly memberDocument: boolean;
34
- readonly fields: Readonly<Record<string, FieldSpec>>;
46
+ readonly frontmatter: ValueFacts;
47
+ readonly fields: Readonly<Record<string, ValueFacts>>;
35
48
  readonly sections: Readonly<Record<string, SectionSpec>>;
49
+ readonly rules: Readonly<Record<string, FieldRules>>;
50
+ readonly createRoles?: readonly string[];
51
+ readonly deleteRoles?: readonly string[];
52
+ readonly shape: Shape;
36
53
  };
37
54
  export type Failure = {
38
55
  readonly rule: string;
39
56
  readonly location?: string;
40
57
  };
58
+ export declare const JSON_TYPES: readonly JsonType[];
59
+ export declare const BUILT_IN_TYPE = "any";
60
+ export declare const ATTACHMENT = "attachment";
61
+ export declare const ARRAY_INDEX: RegExp;
62
+ export declare function escapePointer(key: string): string;
63
+ export declare function pointerSegments(pointer: string): string[];
64
+ export declare function refTarget(reference: string, defs: Readonly<Record<string, unknown>>): {
65
+ readonly name: string;
66
+ readonly node: unknown;
67
+ } | undefined;
68
+ export declare function valueFacts(node: unknown, defs: Readonly<Record<string, unknown>>): ValueFacts;
69
+ export declare function itemFacts(facts: ValueFacts, index: number): ValueFacts | undefined;
70
+ export declare function memberFacts(facts: ValueFacts, key: string): ValueFacts | undefined;
71
+ export type PointerFacts = {
72
+ readonly facts: ValueFacts;
73
+ readonly through: boolean;
74
+ readonly conditional: boolean;
75
+ };
76
+ export declare function crossedFacts(facts: ValueFacts): ValueFacts[];
77
+ export declare function fieldFacts(definition: Definition, key: string): ValueFacts | undefined;
78
+ export declare function pointerFacts(definition: Definition, pointer: string): PointerFacts | undefined;
41
79
  export declare function readSchema(text: string): VerifiedModel | Failure;
42
80
  //# sourceMappingURL=definition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../src/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,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