@knpkv/confluence-to-markdown 0.5.0 → 0.7.0

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 (395) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +58 -14
  3. package/dist/AdfPlaceholders.d.ts +42 -0
  4. package/dist/AdfPlaceholders.d.ts.map +1 -0
  5. package/dist/AdfPlaceholders.js +547 -0
  6. package/dist/AdfPlaceholders.js.map +1 -0
  7. package/dist/AdfSchemaValidator.d.ts +37 -0
  8. package/dist/AdfSchemaValidator.d.ts.map +1 -0
  9. package/dist/AdfSchemaValidator.js +37 -0
  10. package/dist/AdfSchemaValidator.js.map +1 -0
  11. package/dist/AdfWalker.d.ts +39 -0
  12. package/dist/AdfWalker.d.ts.map +1 -0
  13. package/dist/AdfWalker.js +527 -0
  14. package/dist/AdfWalker.js.map +1 -0
  15. package/dist/AtlaskitTransformers.d.ts +35 -0
  16. package/dist/AtlaskitTransformers.d.ts.map +1 -0
  17. package/dist/AtlaskitTransformers.js +48 -0
  18. package/dist/AtlaskitTransformers.js.map +1 -0
  19. package/dist/Brand.d.ts +6 -6
  20. package/dist/Brand.d.ts.map +1 -1
  21. package/dist/Brand.js +8 -6
  22. package/dist/Brand.js.map +1 -1
  23. package/dist/ConfluenceAuth.d.ts +4 -4
  24. package/dist/ConfluenceAuth.d.ts.map +1 -1
  25. package/dist/ConfluenceAuth.js +15 -27
  26. package/dist/ConfluenceAuth.js.map +1 -1
  27. package/dist/ConfluenceClient.d.ts +4 -4
  28. package/dist/ConfluenceClient.d.ts.map +1 -1
  29. package/dist/ConfluenceClient.js +21 -14
  30. package/dist/ConfluenceClient.js.map +1 -1
  31. package/dist/ConfluenceConfig.d.ts +3 -3
  32. package/dist/ConfluenceConfig.d.ts.map +1 -1
  33. package/dist/ConfluenceConfig.js +13 -11
  34. package/dist/ConfluenceConfig.js.map +1 -1
  35. package/dist/ConfluenceError.d.ts +56 -4
  36. package/dist/ConfluenceError.d.ts.map +1 -1
  37. package/dist/ConfluenceError.js +30 -1
  38. package/dist/ConfluenceError.js.map +1 -1
  39. package/dist/GitService.d.ts +11 -3
  40. package/dist/GitService.d.ts.map +1 -1
  41. package/dist/GitService.js +19 -27
  42. package/dist/GitService.js.map +1 -1
  43. package/dist/LocalFileSystem.d.ts +3 -3
  44. package/dist/LocalFileSystem.d.ts.map +1 -1
  45. package/dist/LocalFileSystem.js +6 -6
  46. package/dist/LocalFileSystem.js.map +1 -1
  47. package/dist/MarkdownConverter.d.ts +16 -65
  48. package/dist/MarkdownConverter.d.ts.map +1 -1
  49. package/dist/MarkdownConverter.js +64 -85
  50. package/dist/MarkdownConverter.js.map +1 -1
  51. package/dist/Schemas.d.ts +128 -141
  52. package/dist/Schemas.d.ts.map +1 -1
  53. package/dist/Schemas.js +21 -23
  54. package/dist/Schemas.js.map +1 -1
  55. package/dist/SyncEngine.d.ts +8 -5
  56. package/dist/SyncEngine.d.ts.map +1 -1
  57. package/dist/SyncEngine.js +189 -113
  58. package/dist/SyncEngine.js.map +1 -1
  59. package/dist/bin.js +23 -35
  60. package/dist/bin.js.map +1 -1
  61. package/dist/commands/auth.d.ts +2 -14
  62. package/dist/commands/auth.d.ts.map +1 -1
  63. package/dist/commands/auth.js +11 -16
  64. package/dist/commands/auth.js.map +1 -1
  65. package/dist/commands/clone.d.ts +4 -6
  66. package/dist/commands/clone.d.ts.map +1 -1
  67. package/dist/commands/clone.js +34 -32
  68. package/dist/commands/clone.js.map +1 -1
  69. package/dist/commands/delete.d.ts +2 -10
  70. package/dist/commands/delete.d.ts.map +1 -1
  71. package/dist/commands/delete.js +5 -4
  72. package/dist/commands/delete.js.map +1 -1
  73. package/dist/commands/errorHandler.d.ts +2 -1
  74. package/dist/commands/errorHandler.d.ts.map +1 -1
  75. package/dist/commands/errorHandler.js +22 -15
  76. package/dist/commands/errorHandler.js.map +1 -1
  77. package/dist/commands/fetch.d.ts +27 -0
  78. package/dist/commands/fetch.d.ts.map +1 -0
  79. package/dist/commands/fetch.js +48 -0
  80. package/dist/commands/fetch.js.map +1 -0
  81. package/dist/commands/git.d.ts +7 -10
  82. package/dist/commands/git.d.ts.map +1 -1
  83. package/dist/commands/git.js +6 -6
  84. package/dist/commands/git.js.map +1 -1
  85. package/dist/commands/index.d.ts +1 -0
  86. package/dist/commands/index.d.ts.map +1 -1
  87. package/dist/commands/index.js +1 -0
  88. package/dist/commands/index.js.map +1 -1
  89. package/dist/commands/layers.d.ts +10 -9
  90. package/dist/commands/layers.d.ts.map +1 -1
  91. package/dist/commands/layers.js +41 -30
  92. package/dist/commands/layers.js.map +1 -1
  93. package/dist/commands/new.d.ts +2 -6
  94. package/dist/commands/new.d.ts.map +1 -1
  95. package/dist/commands/new.js +5 -4
  96. package/dist/commands/new.js.map +1 -1
  97. package/dist/commands/pageInput.d.ts +19 -0
  98. package/dist/commands/pageInput.d.ts.map +1 -0
  99. package/dist/commands/pageInput.js +68 -0
  100. package/dist/commands/pageInput.js.map +1 -0
  101. package/dist/commands/root.d.ts +8 -0
  102. package/dist/commands/root.d.ts.map +1 -0
  103. package/dist/commands/root.js +29 -0
  104. package/dist/commands/root.js.map +1 -0
  105. package/dist/commands/sync.d.ts +6 -9
  106. package/dist/commands/sync.d.ts.map +1 -1
  107. package/dist/commands/sync.js +5 -6
  108. package/dist/commands/sync.js.map +1 -1
  109. package/dist/index.d.ts +3 -8
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.js +2 -13
  112. package/dist/index.js.map +1 -1
  113. package/dist/internal/NodeLayers.d.ts.map +1 -1
  114. package/dist/internal/NodeLayers.js +1 -2
  115. package/dist/internal/NodeLayers.js.map +1 -1
  116. package/dist/internal/adfMetadata.d.ts +30 -0
  117. package/dist/internal/adfMetadata.d.ts.map +1 -0
  118. package/dist/internal/adfMetadata.js +126 -0
  119. package/dist/internal/adfMetadata.js.map +1 -0
  120. package/dist/internal/cleanMarkdown.d.ts +5 -0
  121. package/dist/internal/cleanMarkdown.d.ts.map +1 -0
  122. package/dist/internal/cleanMarkdown.js +13 -0
  123. package/dist/internal/cleanMarkdown.js.map +1 -0
  124. package/dist/internal/frontmatter.d.ts.map +1 -1
  125. package/dist/internal/frontmatter.js +41 -8
  126. package/dist/internal/frontmatter.js.map +1 -1
  127. package/dist/internal/gitCommands.d.ts +9 -3
  128. package/dist/internal/gitCommands.d.ts.map +1 -1
  129. package/dist/internal/gitCommands.js +18 -9
  130. package/dist/internal/gitCommands.js.map +1 -1
  131. package/dist/internal/hashUtils.d.ts +1 -1
  132. package/dist/internal/hashUtils.d.ts.map +1 -1
  133. package/dist/internal/hashUtils.js +1 -1
  134. package/dist/internal/hashUtils.js.map +1 -1
  135. package/dist/internal/oauthServer.d.ts +10 -5
  136. package/dist/internal/oauthServer.d.ts.map +1 -1
  137. package/dist/internal/oauthServer.js +19 -40
  138. package/dist/internal/oauthServer.js.map +1 -1
  139. package/dist/internal/pathUtils.d.ts +1 -1
  140. package/dist/internal/pathUtils.d.ts.map +1 -1
  141. package/dist/internal/pathUtils.js +1 -1
  142. package/dist/internal/pathUtils.js.map +1 -1
  143. package/dist/internal/process.d.ts +15 -0
  144. package/dist/internal/process.d.ts.map +1 -0
  145. package/dist/internal/process.js +10 -0
  146. package/dist/internal/process.js.map +1 -0
  147. package/dist/internal/stdio.d.ts +6 -0
  148. package/dist/internal/stdio.d.ts.map +1 -0
  149. package/dist/internal/stdio.js +15 -0
  150. package/dist/internal/stdio.js.map +1 -0
  151. package/dist/internal/tokenStorage.d.ts +3 -13
  152. package/dist/internal/tokenStorage.d.ts.map +1 -1
  153. package/dist/internal/tokenStorage.js +26 -24
  154. package/dist/internal/tokenStorage.js.map +1 -1
  155. package/dist/internal/userCache.d.ts +1 -1
  156. package/dist/internal/userCache.d.ts.map +1 -1
  157. package/dist/internal/userCache.js +1 -1
  158. package/dist/internal/userCache.js.map +1 -1
  159. package/package.json +29 -20
  160. package/skills/confluence/SKILL.md +143 -0
  161. package/skills/confluence/agents/openai.yaml +4 -0
  162. package/src/AdfPlaceholders.ts +563 -0
  163. package/src/AdfSchemaValidator.ts +65 -0
  164. package/src/AdfWalker.ts +591 -0
  165. package/src/AtlaskitTransformers.ts +70 -0
  166. package/src/Brand.ts +11 -16
  167. package/src/ConfluenceAuth.ts +22 -30
  168. package/src/ConfluenceClient.ts +28 -24
  169. package/src/ConfluenceConfig.ts +14 -14
  170. package/src/ConfluenceError.ts +65 -3
  171. package/src/GitService.ts +39 -49
  172. package/src/LocalFileSystem.ts +7 -9
  173. package/src/MarkdownConverter.ts +108 -143
  174. package/src/Schemas.ts +17 -16
  175. package/src/SyncEngine.ts +272 -127
  176. package/src/atlaskit-adf-schema.d.ts +3 -0
  177. package/src/bin.ts +30 -56
  178. package/src/commands/auth.ts +21 -18
  179. package/src/commands/clone.ts +46 -38
  180. package/src/commands/delete.ts +5 -4
  181. package/src/commands/errorHandler.ts +25 -18
  182. package/src/commands/fetch.ts +90 -0
  183. package/src/commands/git.ts +6 -6
  184. package/src/commands/index.ts +1 -0
  185. package/src/commands/layers.ts +64 -37
  186. package/src/commands/new.ts +5 -4
  187. package/src/commands/pageInput.ts +103 -0
  188. package/src/commands/root.ts +59 -0
  189. package/src/commands/sync.ts +7 -6
  190. package/src/index.ts +3 -18
  191. package/src/internal/NodeLayers.ts +1 -2
  192. package/src/internal/adfMetadata.ts +145 -0
  193. package/src/internal/cleanMarkdown.ts +15 -0
  194. package/src/internal/frontmatter.ts +45 -8
  195. package/src/internal/gitCommands.ts +23 -17
  196. package/src/internal/hashUtils.ts +2 -2
  197. package/src/internal/oauthServer.ts +84 -105
  198. package/src/internal/pathUtils.ts +1 -1
  199. package/src/internal/process.ts +15 -0
  200. package/src/internal/stdio.ts +22 -0
  201. package/src/internal/tokenStorage.ts +39 -29
  202. package/src/internal/userCache.ts +2 -2
  203. package/test/AdfPlaceholders.test.ts +508 -0
  204. package/test/AdfSchemaValidator.test.ts +34 -0
  205. package/test/AdfWalker.test.ts +676 -0
  206. package/test/AtlaskitTransformers.test.ts +25 -0
  207. package/test/Brand.test.ts +11 -11
  208. package/test/GitService.test.ts +6 -2
  209. package/test/MarkdownConverter.test.ts +121 -105
  210. package/test/RoundTrip.test.ts +521 -0
  211. package/test/Schemas.test.ts +40 -40
  212. package/test/adfMetadata.test.ts +110 -0
  213. package/test/cleanMarkdown.test.ts +36 -0
  214. package/test/commandHarness.test.ts +79 -0
  215. package/test/commandHarness.ts +147 -0
  216. package/test/fetch.test.ts +61 -0
  217. package/test/frontmatter.test.ts +41 -0
  218. package/test/integration.test.ts +569 -156
  219. package/test/layers.test.ts +12 -0
  220. package/test/oauthServer.test.ts +4 -5
  221. package/test/pageInput.test.ts +83 -0
  222. package/test/tokenStorage.test.ts +17 -17
  223. package/dist/SchemaConverterError.d.ts +0 -108
  224. package/dist/SchemaConverterError.d.ts.map +0 -1
  225. package/dist/SchemaConverterError.js +0 -84
  226. package/dist/SchemaConverterError.js.map +0 -1
  227. package/dist/ast/BlockNode.d.ts +0 -453
  228. package/dist/ast/BlockNode.d.ts.map +0 -1
  229. package/dist/ast/BlockNode.js +0 -310
  230. package/dist/ast/BlockNode.js.map +0 -1
  231. package/dist/ast/Document.d.ts +0 -216
  232. package/dist/ast/Document.d.ts.map +0 -1
  233. package/dist/ast/Document.js +0 -69
  234. package/dist/ast/Document.js.map +0 -1
  235. package/dist/ast/InlineNode.d.ts +0 -477
  236. package/dist/ast/InlineNode.d.ts.map +0 -1
  237. package/dist/ast/InlineNode.js +0 -263
  238. package/dist/ast/InlineNode.js.map +0 -1
  239. package/dist/ast/MacroNode.d.ts +0 -267
  240. package/dist/ast/MacroNode.d.ts.map +0 -1
  241. package/dist/ast/MacroNode.js +0 -164
  242. package/dist/ast/MacroNode.js.map +0 -1
  243. package/dist/ast/index.d.ts +0 -10
  244. package/dist/ast/index.d.ts.map +0 -1
  245. package/dist/ast/index.js +0 -14
  246. package/dist/ast/index.js.map +0 -1
  247. package/dist/parsers/ConfluenceParser.d.ts +0 -26
  248. package/dist/parsers/ConfluenceParser.d.ts.map +0 -1
  249. package/dist/parsers/ConfluenceParser.js +0 -797
  250. package/dist/parsers/ConfluenceParser.js.map +0 -1
  251. package/dist/parsers/MarkdownParser.d.ts +0 -26
  252. package/dist/parsers/MarkdownParser.d.ts.map +0 -1
  253. package/dist/parsers/MarkdownParser.js +0 -982
  254. package/dist/parsers/MarkdownParser.js.map +0 -1
  255. package/dist/parsers/index.d.ts +0 -8
  256. package/dist/parsers/index.d.ts.map +0 -1
  257. package/dist/parsers/index.js +0 -8
  258. package/dist/parsers/index.js.map +0 -1
  259. package/dist/schemas/ConfluenceSchema.d.ts +0 -21
  260. package/dist/schemas/ConfluenceSchema.d.ts.map +0 -1
  261. package/dist/schemas/ConfluenceSchema.js +0 -38
  262. package/dist/schemas/ConfluenceSchema.js.map +0 -1
  263. package/dist/schemas/ConversionSchema.d.ts +0 -35
  264. package/dist/schemas/ConversionSchema.d.ts.map +0 -1
  265. package/dist/schemas/ConversionSchema.js +0 -208
  266. package/dist/schemas/ConversionSchema.js.map +0 -1
  267. package/dist/schemas/MarkdownSchema.d.ts +0 -21
  268. package/dist/schemas/MarkdownSchema.d.ts.map +0 -1
  269. package/dist/schemas/MarkdownSchema.js +0 -38
  270. package/dist/schemas/MarkdownSchema.js.map +0 -1
  271. package/dist/schemas/hast/HastFromHtml.d.ts +0 -27
  272. package/dist/schemas/hast/HastFromHtml.d.ts.map +0 -1
  273. package/dist/schemas/hast/HastFromHtml.js +0 -107
  274. package/dist/schemas/hast/HastFromHtml.js.map +0 -1
  275. package/dist/schemas/hast/HastSchema.d.ts +0 -195
  276. package/dist/schemas/hast/HastSchema.d.ts.map +0 -1
  277. package/dist/schemas/hast/HastSchema.js +0 -183
  278. package/dist/schemas/hast/HastSchema.js.map +0 -1
  279. package/dist/schemas/hast/index.d.ts +0 -9
  280. package/dist/schemas/hast/index.d.ts.map +0 -1
  281. package/dist/schemas/hast/index.js +0 -3
  282. package/dist/schemas/hast/index.js.map +0 -1
  283. package/dist/schemas/index.d.ts +0 -14
  284. package/dist/schemas/index.d.ts.map +0 -1
  285. package/dist/schemas/index.js +0 -16
  286. package/dist/schemas/index.js.map +0 -1
  287. package/dist/schemas/mdast/MdastFromMarkdown.d.ts +0 -30
  288. package/dist/schemas/mdast/MdastFromMarkdown.d.ts.map +0 -1
  289. package/dist/schemas/mdast/MdastFromMarkdown.js +0 -79
  290. package/dist/schemas/mdast/MdastFromMarkdown.js.map +0 -1
  291. package/dist/schemas/mdast/MdastSchema.d.ts +0 -385
  292. package/dist/schemas/mdast/MdastSchema.d.ts.map +0 -1
  293. package/dist/schemas/mdast/MdastSchema.js +0 -266
  294. package/dist/schemas/mdast/MdastSchema.js.map +0 -1
  295. package/dist/schemas/mdast/index.d.ts +0 -10
  296. package/dist/schemas/mdast/index.d.ts.map +0 -1
  297. package/dist/schemas/mdast/index.js +0 -4
  298. package/dist/schemas/mdast/index.js.map +0 -1
  299. package/dist/schemas/mdast/mdastToString.d.ts +0 -13
  300. package/dist/schemas/mdast/mdastToString.d.ts.map +0 -1
  301. package/dist/schemas/mdast/mdastToString.js +0 -85
  302. package/dist/schemas/mdast/mdastToString.js.map +0 -1
  303. package/dist/schemas/nodes/block/BlockSchema.d.ts +0 -43
  304. package/dist/schemas/nodes/block/BlockSchema.d.ts.map +0 -1
  305. package/dist/schemas/nodes/block/BlockSchema.js +0 -634
  306. package/dist/schemas/nodes/block/BlockSchema.js.map +0 -1
  307. package/dist/schemas/nodes/block/index.d.ts +0 -7
  308. package/dist/schemas/nodes/block/index.d.ts.map +0 -1
  309. package/dist/schemas/nodes/block/index.js +0 -7
  310. package/dist/schemas/nodes/block/index.js.map +0 -1
  311. package/dist/schemas/nodes/index.d.ts +0 -9
  312. package/dist/schemas/nodes/index.d.ts.map +0 -1
  313. package/dist/schemas/nodes/index.js +0 -12
  314. package/dist/schemas/nodes/index.js.map +0 -1
  315. package/dist/schemas/nodes/inline/InlineSchema.d.ts +0 -48
  316. package/dist/schemas/nodes/inline/InlineSchema.d.ts.map +0 -1
  317. package/dist/schemas/nodes/inline/InlineSchema.js +0 -436
  318. package/dist/schemas/nodes/inline/InlineSchema.js.map +0 -1
  319. package/dist/schemas/nodes/inline/index.d.ts +0 -7
  320. package/dist/schemas/nodes/inline/index.d.ts.map +0 -1
  321. package/dist/schemas/nodes/inline/index.js +0 -7
  322. package/dist/schemas/nodes/inline/index.js.map +0 -1
  323. package/dist/schemas/nodes/macro/MacroSchema.d.ts +0 -27
  324. package/dist/schemas/nodes/macro/MacroSchema.d.ts.map +0 -1
  325. package/dist/schemas/nodes/macro/MacroSchema.js +0 -162
  326. package/dist/schemas/nodes/macro/MacroSchema.js.map +0 -1
  327. package/dist/schemas/nodes/macro/index.d.ts +0 -7
  328. package/dist/schemas/nodes/macro/index.d.ts.map +0 -1
  329. package/dist/schemas/nodes/macro/index.js +0 -7
  330. package/dist/schemas/nodes/macro/index.js.map +0 -1
  331. package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts +0 -24
  332. package/dist/schemas/preprocessing/ConfluencePreprocessor.d.ts.map +0 -1
  333. package/dist/schemas/preprocessing/ConfluencePreprocessor.js +0 -359
  334. package/dist/schemas/preprocessing/ConfluencePreprocessor.js.map +0 -1
  335. package/dist/schemas/preprocessing/index.d.ts +0 -8
  336. package/dist/schemas/preprocessing/index.d.ts.map +0 -1
  337. package/dist/schemas/preprocessing/index.js +0 -2
  338. package/dist/schemas/preprocessing/index.js.map +0 -1
  339. package/dist/serializers/ConfluenceSerializer.d.ts +0 -30
  340. package/dist/serializers/ConfluenceSerializer.d.ts.map +0 -1
  341. package/dist/serializers/ConfluenceSerializer.js +0 -560
  342. package/dist/serializers/ConfluenceSerializer.js.map +0 -1
  343. package/dist/serializers/MarkdownSerializer.d.ts +0 -34
  344. package/dist/serializers/MarkdownSerializer.d.ts.map +0 -1
  345. package/dist/serializers/MarkdownSerializer.js +0 -395
  346. package/dist/serializers/MarkdownSerializer.js.map +0 -1
  347. package/dist/serializers/index.d.ts +0 -8
  348. package/dist/serializers/index.d.ts.map +0 -1
  349. package/dist/serializers/index.js +0 -8
  350. package/dist/serializers/index.js.map +0 -1
  351. package/src/SchemaConverterError.ts +0 -108
  352. package/src/ast/BlockNode.ts +0 -469
  353. package/src/ast/Document.ts +0 -90
  354. package/src/ast/InlineNode.ts +0 -323
  355. package/src/ast/MacroNode.ts +0 -245
  356. package/src/ast/index.ts +0 -83
  357. package/src/parsers/ConfluenceParser.ts +0 -956
  358. package/src/parsers/MarkdownParser.ts +0 -1338
  359. package/src/parsers/index.ts +0 -8
  360. package/src/schemas/ConfluenceSchema.ts +0 -56
  361. package/src/schemas/ConversionSchema.ts +0 -318
  362. package/src/schemas/MarkdownSchema.ts +0 -56
  363. package/src/schemas/hast/HastFromHtml.ts +0 -153
  364. package/src/schemas/hast/HastSchema.ts +0 -274
  365. package/src/schemas/hast/index.ts +0 -35
  366. package/src/schemas/index.ts +0 -20
  367. package/src/schemas/mdast/MdastFromMarkdown.ts +0 -118
  368. package/src/schemas/mdast/MdastSchema.ts +0 -566
  369. package/src/schemas/mdast/index.ts +0 -59
  370. package/src/schemas/mdast/mdastToString.ts +0 -102
  371. package/src/schemas/nodes/block/BlockSchema.ts +0 -773
  372. package/src/schemas/nodes/block/index.ts +0 -13
  373. package/src/schemas/nodes/index.ts +0 -20
  374. package/src/schemas/nodes/inline/InlineSchema.ts +0 -523
  375. package/src/schemas/nodes/inline/index.ts +0 -14
  376. package/src/schemas/nodes/macro/MacroSchema.ts +0 -226
  377. package/src/schemas/nodes/macro/index.ts +0 -6
  378. package/src/schemas/preprocessing/ConfluencePreprocessor.ts +0 -455
  379. package/src/schemas/preprocessing/index.ts +0 -8
  380. package/src/serializers/ConfluenceSerializer.ts +0 -737
  381. package/src/serializers/MarkdownSerializer.ts +0 -543
  382. package/src/serializers/index.ts +0 -8
  383. package/test/ast/BlockNode.test.ts +0 -265
  384. package/test/ast/Document.test.ts +0 -126
  385. package/test/ast/InlineNode.test.ts +0 -161
  386. package/test/fixtures/integration-test.html.fixture +0 -103
  387. package/test/fixtures/integration-test.md.expected +0 -257
  388. package/test/parsers/ConfluenceParser.test.ts +0 -452
  389. package/test/schemas/ConfluencePreprocessor.test.ts +0 -180
  390. package/test/schemas/ConversionSchema.test.ts +0 -159
  391. package/test/schemas/HastSchema.test.ts +0 -138
  392. package/test/schemas/MdastSchema.test.ts +0 -145
  393. package/test/schemas/nodes/block/BlockSchema.test.ts +0 -173
  394. package/test/schemas/nodes/inline/InlineSchema.test.ts +0 -198
  395. package/test/schemas/nodes/macro/MacroSchema.test.ts +0 -142
@@ -0,0 +1,508 @@
1
+ import { describe, expect, it } from "vitest"
2
+ import { revertPlaceholders } from "../src/AdfPlaceholders.js"
3
+
4
+ const docOf = (content: ReadonlyArray<unknown>) => ({ version: 1, type: "doc", content })
5
+ const para = (text: string) => ({ type: "paragraph", content: [{ type: "text", text }] })
6
+ const b64 = (value: unknown): string => Buffer.from(JSON.stringify(value)).toString("base64")
7
+
8
+ describe("revertPlaceholders", () => {
9
+ it("rewrites a status span placeholder into a status node", () => {
10
+ const out = revertPlaceholders(
11
+ docOf([para(`Some <span class="adf-status" data-color="blue">TESTING</span> here`)])
12
+ ) as { content: Array<{ content: Array<{ type: string; attrs?: Record<string, unknown> }> }> }
13
+
14
+ const cellContent = out.content[0]!.content
15
+ expect(cellContent).toHaveLength(3)
16
+ expect(cellContent[0]).toMatchObject({ type: "text", text: "Some " })
17
+ expect(cellContent[1]).toMatchObject({
18
+ type: "status",
19
+ attrs: { text: "TESTING", color: "blue" }
20
+ })
21
+ expect(cellContent[2]).toMatchObject({ type: "text", text: " here" })
22
+ })
23
+
24
+ it("replaces a single-comment paragraph with a block extension node", () => {
25
+ const out = revertPlaceholders(
26
+ docOf([para(`<!-- adf:extension key=toc type=com.atlassian.confluence.macro.core -->`)])
27
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown> }> }
28
+
29
+ expect(out.content[0]).toMatchObject({
30
+ type: "extension",
31
+ attrs: { extensionKey: "toc", extensionType: "com.atlassian.confluence.macro.core" }
32
+ })
33
+ })
34
+
35
+ it("rewrites native TOC syntax into a Confluence core extension node", () => {
36
+ const out = revertPlaceholders(docOf([para("[[toc]]")])) as {
37
+ content: Array<{ type: string; attrs?: Record<string, unknown> }>
38
+ }
39
+
40
+ expect(out.content[0]).toEqual({
41
+ type: "extension",
42
+ attrs: {
43
+ extensionKey: "toc",
44
+ extensionType: "com.atlassian.confluence.macro.core"
45
+ }
46
+ })
47
+ })
48
+
49
+ it("rewrites native TOC syntax with levels into macro parameters", () => {
50
+ const out = revertPlaceholders(docOf([para("[[toc:min=2,max=4]]")])) as {
51
+ content: Array<{ type: string; attrs?: Record<string, unknown> }>
52
+ }
53
+
54
+ expect(out.content[0]).toEqual({
55
+ type: "extension",
56
+ attrs: {
57
+ extensionKey: "toc",
58
+ extensionType: "com.atlassian.confluence.macro.core",
59
+ parameters: {
60
+ macroParams: {
61
+ minLevel: { value: "2" },
62
+ maxLevel: { value: "4" }
63
+ }
64
+ }
65
+ }
66
+ })
67
+ })
68
+
69
+ it("leaves invalid or code-marked native TOC syntax as text", () => {
70
+ const invalid = revertPlaceholders(docOf([para("[[toc:min=0]]")])) as {
71
+ content: Array<{ type: string; content?: ReadonlyArray<unknown> }>
72
+ }
73
+ const quoted = revertPlaceholders(docOf([{
74
+ type: "paragraph",
75
+ content: [{ type: "text", text: "[[toc]]", marks: [{ type: "code" }] }]
76
+ }])) as { content: Array<{ type: string; content?: ReadonlyArray<unknown> }> }
77
+
78
+ expect(invalid.content[0]!.type).toBe("paragraph")
79
+ expect(quoted.content[0]!.type).toBe("paragraph")
80
+ })
81
+
82
+ it("rewrites status and extension placeholders inside table cells", () => {
83
+ const cell = (text: string) => ({
84
+ type: "tableCell",
85
+ attrs: {},
86
+ content: [{ type: "paragraph", content: [{ type: "text", text }] }]
87
+ })
88
+ const out = revertPlaceholders(
89
+ docOf([{
90
+ type: "table",
91
+ attrs: { isNumberColumnEnabled: false, layout: "default" },
92
+ content: [{
93
+ type: "tableRow",
94
+ content: [
95
+ cell(`<span class="adf-status" data-color="green">OK</span>`),
96
+ cell(`<!-- adf:extension key=toc type=t -->`)
97
+ ]
98
+ }]
99
+ }])
100
+ ) as {
101
+ content: Array<{
102
+ content: Array<{
103
+ content: Array<{
104
+ content: Array<{ type: string; attrs?: Record<string, unknown>; content?: ReadonlyArray<unknown> }>
105
+ }>
106
+ }>
107
+ }>
108
+ }
109
+
110
+ const cells = out.content[0]!.content[0]!.content
111
+ // First cell: paragraph wrapping a status node
112
+ expect(cells[0]!.content[0]).toMatchObject({
113
+ type: "paragraph",
114
+ content: [{ type: "status", attrs: { text: "OK", color: "green" } }]
115
+ })
116
+ // Second cell: extension replaces the paragraph entirely
117
+ expect(cells[1]!.content[0]).toMatchObject({
118
+ type: "extension",
119
+ attrs: { extensionKey: "toc", extensionType: "t" }
120
+ })
121
+ })
122
+
123
+ it("rewrites inlineExtension placeholders inline", () => {
124
+ const out = revertPlaceholders(
125
+ docOf([para(`before <!-- adf:inlineExtension key=jira type=t --> after`)])
126
+ ) as { content: Array<{ content: Array<{ type: string; attrs?: Record<string, unknown> }> }> }
127
+
128
+ const inlineContent = out.content[0]!.content
129
+ expect(inlineContent).toHaveLength(3)
130
+ expect(inlineContent[1]).toMatchObject({
131
+ type: "inlineExtension",
132
+ attrs: { extensionKey: "jira", extensionType: "t" }
133
+ })
134
+ })
135
+
136
+ it("rewrites fallback inline formatting HTML into native marks", () => {
137
+ const out = revertPlaceholders(
138
+ docOf([para(
139
+ `Plain <u>underline</u>, H<sub>2</sub>O, x<sup>2</sup>, ` +
140
+ `<span style="color:#ff5630">Colored text</span>, ` +
141
+ `<span style="background-color:#f8e6a0">highlighted text</span>.`
142
+ )])
143
+ ) as {
144
+ content: Array<{
145
+ content: Array<{ type: string; text?: string; marks?: ReadonlyArray<{ type: string; attrs?: unknown }> }>
146
+ }>
147
+ }
148
+
149
+ const inlineContent = out.content[0]!.content
150
+ expect(inlineContent).toContainEqual({
151
+ type: "text",
152
+ text: "underline",
153
+ marks: [{ type: "underline" }]
154
+ })
155
+ expect(inlineContent).toContainEqual({
156
+ type: "text",
157
+ text: "2",
158
+ marks: [{ type: "subsup", attrs: { type: "sub" } }]
159
+ })
160
+ expect(inlineContent).toContainEqual({
161
+ type: "text",
162
+ text: "2",
163
+ marks: [{ type: "subsup", attrs: { type: "sup" } }]
164
+ })
165
+ expect(inlineContent).toContainEqual({
166
+ type: "text",
167
+ text: "Colored text",
168
+ marks: [{ type: "textColor", attrs: { color: "#ff5630" } }]
169
+ })
170
+ expect(inlineContent).toContainEqual({
171
+ type: "text",
172
+ text: "highlighted text",
173
+ marks: [{ type: "backgroundColor", attrs: { color: "#f8e6a0" } }]
174
+ })
175
+ })
176
+
177
+ it("rewrites inlineCard placeholders into native smart-link nodes", () => {
178
+ const attrs = { url: "https://www.atlassian.com" }
179
+ const out = revertPlaceholders(
180
+ docOf([para(`Inline smart link: <!-- adf:inlineCard attrs=${b64(attrs)} -->.`)])
181
+ ) as { content: Array<{ content: Array<{ type: string; attrs?: Record<string, unknown> }> }> }
182
+
183
+ expect(out.content[0]!.content[1]).toEqual({ type: "inlineCard", attrs })
184
+ })
185
+
186
+ it("rewrites encoded date and emoji placeholders into native inline nodes", () => {
187
+ const date = { type: "date", attrs: { timestamp: "1782259200000" } }
188
+ const emoji = { type: "emoji", attrs: { shortName: ":white_check_mark:", text: "✅" } }
189
+ const out = revertPlaceholders(
190
+ docOf([para(`Example <!-- adf:date node=${b64(date)} --> <!-- adf:emoji node=${b64(emoji)} -->`)])
191
+ ) as { content: Array<{ content: Array<unknown> }> }
192
+
193
+ expect(out.content[0]!.content).toContainEqual(date)
194
+ expect(out.content[0]!.content).toContainEqual(emoji)
195
+ })
196
+
197
+ it("restores the full attrs (parameters included) from an attrs blob", () => {
198
+ const attrs = {
199
+ extensionKey: "toc",
200
+ extensionType: "com.atlassian.confluence.macro.core",
201
+ layout: "default",
202
+ localId: "abc-123",
203
+ parameters: { macroParams: { maxLevel: { value: "3" } } }
204
+ }
205
+ const blob = Buffer.from(JSON.stringify(attrs)).toString("base64")
206
+ const out = revertPlaceholders(
207
+ docOf([para(`<!-- adf:extension key=toc type=com.atlassian.confluence.macro.core attrs=${blob} -->`)])
208
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown> }> }
209
+
210
+ expect(out.content[0]).toEqual({ type: "extension", attrs })
211
+ })
212
+
213
+ it("falls back to key/type when the attrs blob does not decode to JSON", () => {
214
+ // "aGVsbG8=" is valid base64 but decodes to "hello", which is not JSON.
215
+ const out = revertPlaceholders(
216
+ docOf([para(`<!-- adf:extension key=toc type=t attrs=aGVsbG8= -->`)])
217
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown> }> }
218
+
219
+ expect(out.content[0]).toEqual({
220
+ type: "extension",
221
+ attrs: { extensionKey: "toc", extensionType: "t" }
222
+ })
223
+ })
224
+
225
+ it("re-attaches the blocks between bodiedExtension markers as its body", () => {
226
+ const attrs = { extensionKey: "details", extensionType: "com.example" }
227
+ const blob = Buffer.from(JSON.stringify(attrs)).toString("base64")
228
+ const out = revertPlaceholders(
229
+ docOf([
230
+ para(`<!-- adf:bodiedExtension key=details type=com.example attrs=${blob} -->`),
231
+ para("first body paragraph"),
232
+ para("second body paragraph"),
233
+ para(`<!-- adf:/bodiedExtension -->`),
234
+ para("after")
235
+ ])
236
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown>; content?: ReadonlyArray<unknown> }> }
237
+
238
+ expect(out.content).toHaveLength(2)
239
+ expect(out.content[0]).toEqual({
240
+ type: "bodiedExtension",
241
+ attrs,
242
+ content: [para("first body paragraph"), para("second body paragraph")]
243
+ })
244
+ expect(out.content[1]).toEqual(para("after"))
245
+ })
246
+
247
+ it("re-attaches the blocks between panel markers as a panel body", () => {
248
+ const attrs = { panelType: "warning" }
249
+ const blob = Buffer.from(JSON.stringify(attrs)).toString("base64")
250
+ const out = revertPlaceholders(
251
+ docOf([
252
+ para(`<!-- adf:panel type=warning attrs=${blob} -->`),
253
+ para("panel body"),
254
+ para(`<!-- adf:/panel -->`),
255
+ para("after")
256
+ ])
257
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown>; content?: ReadonlyArray<unknown> }> }
258
+
259
+ expect(out.content).toHaveLength(2)
260
+ expect(out.content[0]).toEqual({
261
+ type: "panel",
262
+ attrs,
263
+ content: [para("panel body")]
264
+ })
265
+ expect(out.content[1]).toEqual(para("after"))
266
+ })
267
+
268
+ it("re-attaches paragraph-level marks from paragraph markers", () => {
269
+ const marks = [{ type: "alignment", attrs: { align: "center" } }]
270
+ const out = revertPlaceholders(
271
+ docOf([
272
+ para(`<!-- adf:paragraph marks=${b64(marks)} -->`),
273
+ para("Centered paragraph for alignment validation."),
274
+ para(`<!-- adf:/paragraph -->`)
275
+ ])
276
+ ) as { content: Array<{ type: string; marks?: unknown; content?: ReadonlyArray<unknown> }> }
277
+
278
+ expect(out.content).toEqual([{
279
+ type: "paragraph",
280
+ marks,
281
+ content: [{ type: "text", text: "Centered paragraph for alignment validation." }]
282
+ }])
283
+ })
284
+
285
+ it("restores encoded native block nodes", () => {
286
+ const taskList = {
287
+ type: "taskList",
288
+ attrs: { localId: "tasks-1" },
289
+ content: [{
290
+ type: "taskItem",
291
+ attrs: { localId: "task-1", state: "DONE" },
292
+ content: [{ type: "text", text: "Existing primitive coverage reviewed" }]
293
+ }]
294
+ }
295
+ const decisionList = {
296
+ type: "decisionList",
297
+ attrs: { localId: "decisions-1" },
298
+ content: [{
299
+ type: "decisionItem",
300
+ attrs: { localId: "decision-1", state: "DECIDED" },
301
+ content: [{ type: "text", text: "Decide whether to maintain a separate asset for advanced macros." }]
302
+ }]
303
+ }
304
+ const expand = {
305
+ type: "expand",
306
+ attrs: { title: "Expandable supplementary content" },
307
+ content: [para("This section can be expanded.")]
308
+ }
309
+ const table = {
310
+ type: "table",
311
+ content: [{ type: "tableRow", content: [{ type: "tableCell", content: [para("Date")] }] }]
312
+ }
313
+ const layoutSection = {
314
+ type: "layoutSection",
315
+ content: [{ type: "layoutColumn", attrs: { width: 50 }, content: [para("Left column")] }]
316
+ }
317
+ const blockCard = { type: "blockCard", attrs: { url: "https://www.atlassian.com/software/confluence" } }
318
+ const embedCard = {
319
+ type: "embedCard",
320
+ attrs: { url: "https://www.atlassian.com/software/confluence", layout: "center" }
321
+ }
322
+ const out = revertPlaceholders(
323
+ docOf([
324
+ para(`<!-- adf:taskList node=${b64(taskList)} -->`),
325
+ para("[x] Existing primitive coverage reviewed"),
326
+ para("<!-- adf:/taskList -->"),
327
+ para(`<!-- adf:decisionList node=${b64(decisionList)} -->`),
328
+ para("This page will act as the baseline integration test asset for editor primitive coverage."),
329
+ para("<!-- adf:/decisionList -->"),
330
+ para(`<!-- adf:expand node=${b64(expand)} -->`),
331
+ para("This section can be expanded."),
332
+ para("<!-- adf:/expand -->"),
333
+ para(`<!-- adf:table node=${b64(table)} -->`),
334
+ para("| Date |"),
335
+ para("<!-- adf:/table -->"),
336
+ para(`<!-- adf:layoutSection node=${b64(layoutSection)} -->`),
337
+ para("Left column"),
338
+ para("<!-- adf:/layoutSection -->"),
339
+ para(`<!-- adf:blockCard node=${b64(blockCard)} -->`),
340
+ para("https://www.atlassian.com/software/confluence"),
341
+ para("<!-- adf:/blockCard -->"),
342
+ para(`<!-- adf:embedCard node=${b64(embedCard)} -->`),
343
+ para("https://www.atlassian.com/software/confluence"),
344
+ para("<!-- adf:/embedCard -->")
345
+ ])
346
+ ) as { content: Array<unknown> }
347
+
348
+ expect(out.content).toEqual([taskList, decisionList, expand, table, layoutSection, blockCard, embedCard])
349
+ })
350
+
351
+ it("reverts an extension marker nested inside a bodiedExtension body", () => {
352
+ const out = revertPlaceholders(
353
+ docOf([
354
+ para(`<!-- adf:bodiedExtension key=outer type=com.example -->`),
355
+ para(`<!-- adf:extension key=inner type=com.example -->`),
356
+ para(`<!-- adf:/bodiedExtension -->`)
357
+ ])
358
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown>; content?: ReadonlyArray<unknown> }> }
359
+
360
+ expect(out.content[0]).toEqual({
361
+ type: "bodiedExtension",
362
+ attrs: { extensionKey: "outer", extensionType: "com.example" },
363
+ content: [{ type: "extension", attrs: { extensionKey: "inner", extensionType: "com.example" } }]
364
+ })
365
+ })
366
+
367
+ it("downgrades a bodiedExtension marker without an end marker to a plain extension", () => {
368
+ const out = revertPlaceholders(
369
+ docOf([
370
+ para(`<!-- adf:bodiedExtension key=details type=com.example -->`),
371
+ para("just a paragraph, no end marker")
372
+ ])
373
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown> }> }
374
+
375
+ expect(out.content[0]).toEqual({
376
+ type: "extension",
377
+ attrs: { extensionKey: "details", extensionType: "com.example" }
378
+ })
379
+ expect(out.content[1]).toEqual(para("just a paragraph, no end marker"))
380
+ })
381
+
382
+ it("keeps the bodied kind for an empty-body open/end pair via a stub paragraph", () => {
383
+ const out = revertPlaceholders(
384
+ docOf([
385
+ para(`<!-- adf:bodiedExtension key=excerpt type=com.example -->`),
386
+ para(`<!-- adf:/bodiedExtension -->`)
387
+ ])
388
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown>; content?: ReadonlyArray<unknown> }> }
389
+
390
+ expect(out.content[0]).toEqual({
391
+ type: "bodiedExtension",
392
+ attrs: { extensionKey: "excerpt", extensionType: "com.example" },
393
+ content: [{ type: "paragraph", content: [] }]
394
+ })
395
+ })
396
+
397
+ it("does not let an unpaired open marker steal a later macro's end marker", () => {
398
+ const out = revertPlaceholders(
399
+ docOf([
400
+ para(`<!-- adf:bodiedExtension key=legacy type=com.example -->`),
401
+ para("unrelated paragraph"),
402
+ para(`<!-- adf:bodiedExtension key=modern type=com.example -->`),
403
+ para("modern body"),
404
+ para(`<!-- adf:/bodiedExtension -->`)
405
+ ])
406
+ ) as { content: Array<{ type: string; attrs?: Record<string, unknown>; content?: ReadonlyArray<unknown> }> }
407
+
408
+ expect(out.content).toEqual([
409
+ { type: "extension", attrs: { extensionKey: "legacy", extensionType: "com.example" } },
410
+ para("unrelated paragraph"),
411
+ {
412
+ type: "bodiedExtension",
413
+ attrs: { extensionKey: "modern", extensionType: "com.example" },
414
+ content: [para("modern body")]
415
+ }
416
+ ])
417
+ })
418
+
419
+ it("downgrades a bodied marker to extension where the schema forbids bodiedExtension", () => {
420
+ // blockquote content allows extension but not bodiedExtension — emitting
421
+ // one would fail outgoing validation and the push would error out.
422
+ const out = revertPlaceholders(
423
+ docOf([{
424
+ type: "blockquote",
425
+ content: [
426
+ para(`<!-- adf:bodiedExtension key=k type=t -->`),
427
+ para("body text"),
428
+ para(`<!-- adf:/bodiedExtension -->`)
429
+ ]
430
+ }])
431
+ ) as { content: Array<{ type: string; content?: ReadonlyArray<unknown> }> }
432
+
433
+ expect(out.content[0]!.content).toEqual([
434
+ { type: "extension", attrs: { extensionKey: "k", extensionType: "t" } },
435
+ para("body text")
436
+ ])
437
+ })
438
+
439
+ it("drops a stray end marker", () => {
440
+ const out = revertPlaceholders(
441
+ docOf([para("before"), para(`<!-- adf:/bodiedExtension -->`), para("after")])
442
+ ) as { content: Array<unknown> }
443
+
444
+ expect(out.content).toEqual([para("before"), para("after")])
445
+ })
446
+
447
+ it("leaves code-marked text that quotes placeholder syntax untouched", () => {
448
+ const codeText = (text: string) => ({
449
+ type: "paragraph",
450
+ content: [{ type: "text", text, marks: [{ type: "code" }] }]
451
+ })
452
+ const input = docOf([
453
+ codeText(`<span class="adf-status" data-color="green">DONE</span>`),
454
+ codeText(`<!-- adf:extension key=k type=t -->`),
455
+ codeText(`<!-- adf:/bodiedExtension -->`)
456
+ ])
457
+ expect(revertPlaceholders(input)).toEqual(input)
458
+ })
459
+
460
+ it("leaves placeholder-looking text inside a codeBlock untouched", () => {
461
+ // A code sample *quoting* the placeholder syntax must not get structured
462
+ // nodes injected — codeBlock only permits text children, so the document
463
+ // would fail outgoing schema validation and the push would error out.
464
+ const code = `<span class="adf-status" data-color="blue">X</span>\n<!-- adf:inlineExtension key=k type=t -->`
465
+ const input = docOf([{
466
+ type: "codeBlock",
467
+ attrs: { language: "html" },
468
+ content: [{ type: "text", text: code }]
469
+ }])
470
+ expect(revertPlaceholders(input)).toEqual(input)
471
+ })
472
+
473
+ it("leaves text without placeholders untouched", () => {
474
+ const input = docOf([para("plain content")])
475
+ const out = revertPlaceholders(input)
476
+ expect(out).toEqual(input)
477
+ })
478
+
479
+ it("rewrites a confluence-mention link into a mention node", () => {
480
+ const out = revertPlaceholders(
481
+ docOf([{
482
+ type: "paragraph",
483
+ content: [{
484
+ type: "text",
485
+ text: "@Andrey Konopkov",
486
+ marks: [{ type: "link", attrs: { href: "confluence-mention://557057%3Aabc-123" } }]
487
+ }]
488
+ }])
489
+ ) as { content: Array<{ content: Array<{ type: string; attrs?: Record<string, unknown> }> }> }
490
+
491
+ expect(out.content[0]!.content[0]).toMatchObject({
492
+ type: "mention",
493
+ attrs: { id: "557057:abc-123", text: "@Andrey Konopkov" }
494
+ })
495
+ })
496
+
497
+ it("leaves ordinary links alone", () => {
498
+ const input = docOf([{
499
+ type: "paragraph",
500
+ content: [{
501
+ type: "text",
502
+ text: "click",
503
+ marks: [{ type: "link", attrs: { href: "https://example.com" } }]
504
+ }]
505
+ }])
506
+ expect(revertPlaceholders(input)).toEqual(input)
507
+ })
508
+ })
@@ -0,0 +1,34 @@
1
+ import { describe, expect, it } from "@effect/vitest"
2
+ import * as Effect from "effect/Effect"
3
+ import { AdfSchemaValidator, layer as AdfSchemaValidatorLayer } from "../src/AdfSchemaValidator.js"
4
+
5
+ describe("AdfSchemaValidator", () => {
6
+ it.effect("accepts a valid minimal doc and narrows the type", () =>
7
+ Effect.gen(function*() {
8
+ const v = yield* AdfSchemaValidator
9
+ const doc = {
10
+ version: 1,
11
+ type: "doc",
12
+ content: [{ type: "paragraph", content: [{ type: "text", text: "hi" }] }]
13
+ }
14
+ const result = yield* v.check(doc, "incoming")
15
+ expect(result.type).toBe("doc")
16
+ }).pipe(Effect.provide(AdfSchemaValidatorLayer)))
17
+
18
+ it.effect("fails with structured issues on a structurally invalid doc", () =>
19
+ Effect.gen(function*() {
20
+ const v = yield* AdfSchemaValidator
21
+ const doc = {
22
+ version: 1,
23
+ type: "doc",
24
+ content: [{ type: "paragraph", content: [{ type: "text", text: 42 }] }]
25
+ }
26
+ const result = yield* Effect.result(v.check(doc, "incoming"))
27
+ expect(result._tag).toBe("Failure")
28
+ if (result._tag === "Failure") {
29
+ expect(result.failure._tag).toBe("AdfSchemaError")
30
+ expect(result.failure.direction).toBe("incoming")
31
+ expect(result.failure.issues.length).toBeGreaterThan(0)
32
+ }
33
+ }).pipe(Effect.provide(AdfSchemaValidatorLayer)))
34
+ })