@mx-space/cli 0.15.1 → 0.15.2
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.
- package/dist/{Lexical.dev-BSvx45_E.mjs → Lexical.dev-Df5TNMgP.mjs} +2 -2
- package/dist/{Lexical.node-kAh5GM2n.mjs → Lexical.node-B064E4Hy.mjs} +1 -1
- package/dist/{Lexical.prod-Bqwgb3ez.mjs → Lexical.prod-DRFSwoE7.mjs} +2 -2
- package/dist/{LexicalClipboard.dev-BWU3KXIa.mjs → LexicalClipboard.dev-ClOWeg5v.mjs} +5 -5
- package/dist/{LexicalClipboard.node-BygAdNdF.mjs → LexicalClipboard.node-BJBLWpEi.mjs} +1 -1
- package/dist/{LexicalClipboard.prod-BtMuKNyT.mjs → LexicalClipboard.prod-Ytt65eQo.mjs} +5 -5
- package/dist/{LexicalCodeCore.dev-CD2xgvDs.mjs → LexicalCodeCore.dev-CzEPINOT.mjs} +4 -4
- package/dist/{LexicalCodeCore.prod-Bl6FFMc7.mjs → LexicalCodeCore.prod-DOVk7lL_.mjs} +4 -4
- package/dist/{LexicalDragon.dev-BwdYhm4K.mjs → LexicalDragon.dev-DxePN9fP.mjs} +2 -2
- package/dist/{LexicalDragon.node-CpJhkCVV.mjs → LexicalDragon.node-DBwaqStp.mjs} +1 -1
- package/dist/{LexicalDragon.prod-CvXmWwo1.mjs → LexicalDragon.prod-Bji84-Hq.mjs} +2 -2
- package/dist/{LexicalExtension.dev-LcRLXI5Z.mjs → LexicalExtension.dev-DtSRyjbf.mjs} +2 -2
- package/dist/{LexicalExtension.node-BwJt2LXV.mjs → LexicalExtension.node-3nsS5NjU.mjs} +1 -1
- package/dist/{LexicalExtension.prod-lg8_33-H.mjs → LexicalExtension.prod-Ddk0ja_6.mjs} +2 -2
- package/dist/{LexicalHeadless.dev-BeUbKBes.mjs → LexicalHeadless.dev-DdWJsPoH.mjs} +1 -1
- package/dist/{LexicalHeadless.prod-4gbIA8HM.mjs → LexicalHeadless.prod-CH74ZDMt.mjs} +1 -1
- package/dist/{LexicalHtml.dev-BLdZWTCJ.mjs → LexicalHtml.dev-DN7QIb_7.mjs} +4 -4
- package/dist/{LexicalHtml.node-BeuJMvvt.mjs → LexicalHtml.node-DAwuaPeI.mjs} +1 -1
- package/dist/{LexicalHtml.prod-CHUyCocN.mjs → LexicalHtml.prod-X4eTHEfI.mjs} +4 -4
- package/dist/{LexicalLink.dev-DgsFRqw0.mjs → LexicalLink.dev-owitIl6I.mjs} +4 -4
- package/dist/{LexicalLink.prod-CkXkeKY2.mjs → LexicalLink.prod-BZ7ZZkVD.mjs} +4 -4
- package/dist/{LexicalList.dev-OOms3kQi.mjs → LexicalList.dev-CUbi09Yo.mjs} +4 -4
- package/dist/{LexicalList.prod-DzMBeqHn.mjs → LexicalList.prod-pUsUZa0r.mjs} +4 -4
- package/dist/{LexicalMarkdown.dev-DJLKbZtD.mjs → LexicalMarkdown.dev-S2yWckH9.mjs} +3 -3
- package/dist/{LexicalMarkdown.prod-Cp21kDCU.mjs → LexicalMarkdown.prod-TRkMWfmC.mjs} +3 -3
- package/dist/{LexicalRichText.dev-0rkAGjUf.mjs → LexicalRichText.dev-Y3ybFF2S.mjs} +7 -7
- package/dist/{LexicalRichText.node-Cd-BySPE.mjs → LexicalRichText.node-wNAi2Z4i.mjs} +4 -4
- package/dist/{LexicalRichText.prod-DTQiEr8C.mjs → LexicalRichText.prod-HLxqZ6hQ.mjs} +7 -7
- package/dist/{LexicalSelection.dev-Bi0VlUEv.mjs → LexicalSelection.dev-CyhKOKbs.mjs} +1 -1
- package/dist/{LexicalSelection.node-t2U46EF_.mjs → LexicalSelection.node-BCuHMbzl.mjs} +1 -1
- package/dist/{LexicalSelection.prod-CrFG111g.mjs → LexicalSelection.prod-RebDJliC.mjs} +1 -1
- package/dist/{LexicalTable.dev-D-sFhO-o.mjs → LexicalTable.dev-DN3ezVey.mjs} +5 -5
- package/dist/{LexicalTable.prod-DwYaa_dN.mjs → LexicalTable.prod-B0MioVyq.mjs} +5 -5
- package/dist/{LexicalUtils.dev-Q2q3-UDM.mjs → LexicalUtils.dev-Bw6LFRlt.mjs} +2 -2
- package/dist/{LexicalUtils.node-Dl7OvqJV.mjs → LexicalUtils.node-BPKMFN80.mjs} +1 -1
- package/dist/{LexicalUtils.prod-CBnq_iEV.mjs → LexicalUtils.prod-CJYQVQJO.mjs} +2 -2
- package/dist/bin/mxs.mjs +1 -1
- package/dist/{esm-ZXjJmLEC.mjs → esm-7vSMGlFz.mjs} +171 -245
- package/dist/esm-ZrfYH2y2.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{mxs-DC9zR3f2.mjs → mxs-DKv-4ZTg.mjs} +362 -297
- package/dist/vendor/litexml/cli.mjs +94 -38
- package/dist/vendor/litexml/litexml-html-preview-client.css +329 -836
- package/dist/vendor/litexml/litexml-html-preview-client.js +6048 -5832
- package/dist/vendor/litexml/style.css +5 -1
- package/package.json +10 -10
- package/dist/esm-CNZ7kdTg.mjs +0 -2
- package/dist/src/bin/mxs.d.ts +0 -2
- package/dist/src/bin/mxs.js +0 -310
- package/dist/src/cli/ai/_poll.d.ts +0 -12
- package/dist/src/cli/ai/_poll.js +0 -38
- package/dist/src/cli/ai/_resolve.d.ts +0 -8
- package/dist/src/cli/ai/_resolve.js +0 -27
- package/dist/src/cli/ai/index.d.ts +0 -127
- package/dist/src/cli/ai/index.js +0 -46
- package/dist/src/cli/ai/insights/by-article.d.ts +0 -10
- package/dist/src/cli/ai/insights/by-article.js +0 -21
- package/dist/src/cli/ai/insights/delete.d.ts +0 -7
- package/dist/src/cli/ai/insights/delete.js +0 -18
- package/dist/src/cli/ai/insights/edit.d.ts +0 -8
- package/dist/src/cli/ai/insights/edit.js +0 -54
- package/dist/src/cli/ai/insights/get.d.ts +0 -6
- package/dist/src/cli/ai/insights/get.js +0 -11
- package/dist/src/cli/ai/insights/index.d.ts +0 -30
- package/dist/src/cli/ai/insights/index.js +0 -17
- package/dist/src/cli/ai/insights/list.d.ts +0 -10
- package/dist/src/cli/ai/insights/list.js +0 -20
- package/dist/src/cli/ai/insights/refresh.d.ts +0 -10
- package/dist/src/cli/ai/insights/refresh.js +0 -25
- package/dist/src/cli/ai/insights/translate.d.ts +0 -10
- package/dist/src/cli/ai/insights/translate.js +0 -25
- package/dist/src/cli/ai/overview/by-article.d.ts +0 -7
- package/dist/src/cli/ai/overview/by-article.js +0 -15
- package/dist/src/cli/ai/overview/index.d.ts +0 -11
- package/dist/src/cli/ai/overview/index.js +0 -4
- package/dist/src/cli/ai/overview/list.d.ts +0 -10
- package/dist/src/cli/ai/overview/list.js +0 -20
- package/dist/src/cli/ai/summary/by-article.d.ts +0 -10
- package/dist/src/cli/ai/summary/by-article.js +0 -21
- package/dist/src/cli/ai/summary/delete.d.ts +0 -7
- package/dist/src/cli/ai/summary/delete.js +0 -18
- package/dist/src/cli/ai/summary/edit.d.ts +0 -8
- package/dist/src/cli/ai/summary/edit.js +0 -54
- package/dist/src/cli/ai/summary/get.d.ts +0 -6
- package/dist/src/cli/ai/summary/get.js +0 -11
- package/dist/src/cli/ai/summary/index.d.ts +0 -30
- package/dist/src/cli/ai/summary/index.js +0 -9
- package/dist/src/cli/ai/summary/list.d.ts +0 -10
- package/dist/src/cli/ai/summary/list.js +0 -20
- package/dist/src/cli/ai/summary/regen.d.ts +0 -10
- package/dist/src/cli/ai/summary/regen.js +0 -25
- package/dist/src/cli/ai/summary/translate.d.ts +0 -10
- package/dist/src/cli/ai/summary/translate.js +0 -25
- package/dist/src/cli/ai/translate/by-article.d.ts +0 -9
- package/dist/src/cli/ai/translate/by-article.js +0 -19
- package/dist/src/cli/ai/translate/delete.d.ts +0 -7
- package/dist/src/cli/ai/translate/delete.js +0 -18
- package/dist/src/cli/ai/translate/edit.d.ts +0 -8
- package/dist/src/cli/ai/translate/edit.js +0 -97
- package/dist/src/cli/ai/translate/entries/delete.d.ts +0 -7
- package/dist/src/cli/ai/translate/entries/delete.js +0 -18
- package/dist/src/cli/ai/translate/entries/edit.d.ts +0 -8
- package/dist/src/cli/ai/translate/entries/edit.js +0 -73
- package/dist/src/cli/ai/translate/entries/generate.d.ts +0 -7
- package/dist/src/cli/ai/translate/entries/generate.js +0 -15
- package/dist/src/cli/ai/translate/entries/index.d.ts +0 -17
- package/dist/src/cli/ai/translate/entries/index.js +0 -6
- package/dist/src/cli/ai/translate/entries/list.d.ts +0 -10
- package/dist/src/cli/ai/translate/entries/list.js +0 -20
- package/dist/src/cli/ai/translate/get.d.ts +0 -6
- package/dist/src/cli/ai/translate/get.js +0 -11
- package/dist/src/cli/ai/translate/index.d.ts +0 -40
- package/dist/src/cli/ai/translate/index.js +0 -19
- package/dist/src/cli/ai/translate/languages.d.ts +0 -7
- package/dist/src/cli/ai/translate/languages.js +0 -15
- package/dist/src/cli/ai/translate/list.d.ts +0 -9
- package/dist/src/cli/ai/translate/list.js +0 -19
- package/dist/src/cli/ai/translate/run.d.ts +0 -10
- package/dist/src/cli/ai/translate/run.js +0 -31
- package/dist/src/cli/ai/tts/by-article.d.ts +0 -7
- package/dist/src/cli/ai/tts/by-article.js +0 -15
- package/dist/src/cli/ai/tts/delete.d.ts +0 -7
- package/dist/src/cli/ai/tts/delete.js +0 -18
- package/dist/src/cli/ai/tts/index.d.ts +0 -22
- package/dist/src/cli/ai/tts/index.js +0 -7
- package/dist/src/cli/ai/tts/list.d.ts +0 -10
- package/dist/src/cli/ai/tts/list.js +0 -20
- package/dist/src/cli/ai/tts/run.d.ts +0 -10
- package/dist/src/cli/ai/tts/run.js +0 -25
- package/dist/src/cli/ai/tts/voices.d.ts +0 -7
- package/dist/src/cli/ai/tts/voices.js +0 -12
- package/dist/src/cli/ai/views.d.ts +0 -3
- package/dist/src/cli/ai/views.js +0 -45
- package/dist/src/cli/auth/index.d.ts +0 -6
- package/dist/src/cli/auth/index.js +0 -22
- package/dist/src/cli/auth/login.d.ts +0 -11
- package/dist/src/cli/auth/login.js +0 -168
- package/dist/src/cli/auth/logout.d.ts +0 -6
- package/dist/src/cli/auth/logout.js +0 -21
- package/dist/src/cli/auth/status.d.ts +0 -4
- package/dist/src/cli/auth/status.js +0 -31
- package/dist/src/cli/auth/view.d.ts +0 -25
- package/dist/src/cli/auth/view.js +0 -46
- package/dist/src/cli/auth/whoami.d.ts +0 -7
- package/dist/src/cli/auth/whoami.js +0 -44
- package/dist/src/cli/category/create.d.ts +0 -10
- package/dist/src/cli/category/create.js +0 -24
- package/dist/src/cli/category/delete.d.ts +0 -8
- package/dist/src/cli/category/delete.js +0 -21
- package/dist/src/cli/category/get.d.ts +0 -6
- package/dist/src/cli/category/get.js +0 -11
- package/dist/src/cli/category/index.d.ts +0 -20
- package/dist/src/cli/category/index.js +0 -41
- package/dist/src/cli/category/list.d.ts +0 -4
- package/dist/src/cli/category/list.js +0 -10
- package/dist/src/cli/category/update.d.ts +0 -12
- package/dist/src/cli/category/update.js +0 -34
- package/dist/src/cli/comment/_flags.d.ts +0 -28
- package/dist/src/cli/comment/_flags.js +0 -48
- package/dist/src/cli/comment/approve.d.ts +0 -9
- package/dist/src/cli/comment/approve.js +0 -23
- package/dist/src/cli/comment/delete.d.ts +0 -9
- package/dist/src/cli/comment/delete.js +0 -24
- package/dist/src/cli/comment/get.d.ts +0 -6
- package/dist/src/cli/comment/get.js +0 -12
- package/dist/src/cli/comment/index.d.ts +0 -34
- package/dist/src/cli/comment/index.js +0 -53
- package/dist/src/cli/comment/list.d.ts +0 -9
- package/dist/src/cli/comment/list.js +0 -20
- package/dist/src/cli/comment/reject.d.ts +0 -9
- package/dist/src/cli/comment/reject.js +0 -23
- package/dist/src/cli/comment/reply.d.ts +0 -9
- package/dist/src/cli/comment/reply.js +0 -31
- package/dist/src/cli/comment/unread.d.ts +0 -7
- package/dist/src/cli/comment/unread.js +0 -21
- package/dist/src/cli/comment/view.d.ts +0 -3
- package/dist/src/cli/comment/view.js +0 -197
- package/dist/src/cli/config/edit.d.ts +0 -5
- package/dist/src/cli/config/edit.js +0 -36
- package/dist/src/cli/config/get.d.ts +0 -6
- package/dist/src/cli/config/get.js +0 -11
- package/dist/src/cli/config/index.d.ts +0 -10
- package/dist/src/cli/config/index.js +0 -22
- package/dist/src/cli/config/list.d.ts +0 -4
- package/dist/src/cli/config/list.js +0 -10
- package/dist/src/cli/config/set.d.ts +0 -9
- package/dist/src/cli/config/set.js +0 -48
- package/dist/src/cli/draft/_shared.d.ts +0 -27
- package/dist/src/cli/draft/_shared.js +0 -85
- package/dist/src/cli/draft/create.d.ts +0 -21
- package/dist/src/cli/draft/create.js +0 -34
- package/dist/src/cli/draft/delete.d.ts +0 -7
- package/dist/src/cli/draft/delete.js +0 -20
- package/dist/src/cli/draft/get.d.ts +0 -6
- package/dist/src/cli/draft/get.js +0 -11
- package/dist/src/cli/draft/index.d.ts +0 -54
- package/dist/src/cli/draft/index.js +0 -42
- package/dist/src/cli/draft/list.d.ts +0 -11
- package/dist/src/cli/draft/list.js +0 -23
- package/dist/src/cli/draft/publish.d.ts +0 -8
- package/dist/src/cli/draft/publish.js +0 -64
- package/dist/src/cli/draft/update.d.ts +0 -22
- package/dist/src/cli/draft/update.js +0 -29
- package/dist/src/cli/file/_shared.d.ts +0 -6
- package/dist/src/cli/file/_shared.js +0 -5
- package/dist/src/cli/file/delete.d.ts +0 -8
- package/dist/src/cli/file/delete.js +0 -21
- package/dist/src/cli/file/index.d.ts +0 -19
- package/dist/src/cli/file/index.js +0 -33
- package/dist/src/cli/file/list.d.ts +0 -6
- package/dist/src/cli/file/list.js +0 -11
- package/dist/src/cli/file/rename.d.ts +0 -8
- package/dist/src/cli/file/rename.js +0 -16
- package/dist/src/cli/file/upload.d.ts +0 -9
- package/dist/src/cli/file/upload.js +0 -32
- package/dist/src/cli/help/index.d.ts +0 -62
- package/dist/src/cli/help/index.js +0 -276
- package/dist/src/cli/help/registry.d.ts +0 -28
- package/dist/src/cli/help/registry.js +0 -29
- package/dist/src/cli/note/_flags.d.ts +0 -66
- package/dist/src/cli/note/_flags.js +0 -73
- package/dist/src/cli/note/create.d.ts +0 -23
- package/dist/src/cli/note/create.js +0 -25
- package/dist/src/cli/note/delete.d.ts +0 -8
- package/dist/src/cli/note/delete.js +0 -21
- package/dist/src/cli/note/edit.d.ts +0 -28
- package/dist/src/cli/note/edit.js +0 -114
- package/dist/src/cli/note/get.d.ts +0 -6
- package/dist/src/cli/note/get.js +0 -29
- package/dist/src/cli/note/index.d.ts +0 -77
- package/dist/src/cli/note/index.js +0 -63
- package/dist/src/cli/note/list.d.ts +0 -10
- package/dist/src/cli/note/list.js +0 -22
- package/dist/src/cli/note/publish.d.ts +0 -7
- package/dist/src/cli/note/publish.js +0 -17
- package/dist/src/cli/note/unpublish.d.ts +0 -7
- package/dist/src/cli/note/unpublish.js +0 -17
- package/dist/src/cli/note/update.d.ts +0 -25
- package/dist/src/cli/note/update.js +0 -36
- package/dist/src/cli/note/view.d.ts +0 -3
- package/dist/src/cli/note/view.js +0 -162
- package/dist/src/cli/page/create.d.ts +0 -41
- package/dist/src/cli/page/create.js +0 -56
- package/dist/src/cli/page/delete.d.ts +0 -7
- package/dist/src/cli/page/delete.js +0 -37
- package/dist/src/cli/page/edit.d.ts +0 -19
- package/dist/src/cli/page/edit.js +0 -117
- package/dist/src/cli/page/get.d.ts +0 -6
- package/dist/src/cli/page/get.js +0 -16
- package/dist/src/cli/page/index.d.ts +0 -44
- package/dist/src/cli/page/index.js +0 -38
- package/dist/src/cli/page/list.d.ts +0 -4
- package/dist/src/cli/page/list.js +0 -10
- package/dist/src/cli/page/update.d.ts +0 -16
- package/dist/src/cli/page/update.js +0 -48
- package/dist/src/cli/page/view.d.ts +0 -2
- package/dist/src/cli/page/view.js +0 -79
- package/dist/src/cli/post/_flags.d.ts +0 -66
- package/dist/src/cli/post/_flags.js +0 -96
- package/dist/src/cli/post/apply.d.ts +0 -7
- package/dist/src/cli/post/apply.js +0 -70
- package/dist/src/cli/post/create.d.ts +0 -21
- package/dist/src/cli/post/create.js +0 -24
- package/dist/src/cli/post/delete.d.ts +0 -8
- package/dist/src/cli/post/delete.js +0 -21
- package/dist/src/cli/post/edit.d.ts +0 -26
- package/dist/src/cli/post/edit.js +0 -115
- package/dist/src/cli/post/get.d.ts +0 -7
- package/dist/src/cli/post/get.js +0 -15
- package/dist/src/cli/post/index.d.ts +0 -91
- package/dist/src/cli/post/index.js +0 -73
- package/dist/src/cli/post/list.d.ts +0 -10
- package/dist/src/cli/post/list.js +0 -23
- package/dist/src/cli/post/publish.d.ts +0 -7
- package/dist/src/cli/post/publish.js +0 -17
- package/dist/src/cli/post/stage.d.ts +0 -23
- package/dist/src/cli/post/stage.js +0 -55
- package/dist/src/cli/post/unpublish.d.ts +0 -7
- package/dist/src/cli/post/unpublish.js +0 -17
- package/dist/src/cli/post/update.d.ts +0 -23
- package/dist/src/cli/post/update.js +0 -38
- package/dist/src/cli/post/view.d.ts +0 -3
- package/dist/src/cli/post/view.js +0 -150
- package/dist/src/cli/preview/index.d.ts +0 -13
- package/dist/src/cli/preview/index.js +0 -226
- package/dist/src/cli/profile/index.d.ts +0 -14
- package/dist/src/cli/profile/index.js +0 -36
- package/dist/src/cli/profile/ls.d.ts +0 -5
- package/dist/src/cli/profile/ls.js +0 -26
- package/dist/src/cli/profile/mark.d.ts +0 -9
- package/dist/src/cli/profile/mark.js +0 -23
- package/dist/src/cli/profile/rm.d.ts +0 -12
- package/dist/src/cli/profile/rm.js +0 -50
- package/dist/src/cli/profile/show.d.ts +0 -9
- package/dist/src/cli/profile/show.js +0 -40
- package/dist/src/cli/profile/use.d.ts +0 -6
- package/dist/src/cli/profile/use.js +0 -11
- package/dist/src/cli/profile/view.d.ts +0 -8
- package/dist/src/cli/profile/view.js +0 -21
- package/dist/src/cli/project/_flags.d.ts +0 -56
- package/dist/src/cli/project/_flags.js +0 -130
- package/dist/src/cli/project/create.d.ts +0 -17
- package/dist/src/cli/project/create.js +0 -25
- package/dist/src/cli/project/delete.d.ts +0 -8
- package/dist/src/cli/project/delete.js +0 -22
- package/dist/src/cli/project/edit.d.ts +0 -11
- package/dist/src/cli/project/edit.js +0 -61
- package/dist/src/cli/project/get.d.ts +0 -7
- package/dist/src/cli/project/get.js +0 -14
- package/dist/src/cli/project/index.d.ts +0 -43
- package/dist/src/cli/project/index.js +0 -52
- package/dist/src/cli/project/list.d.ts +0 -8
- package/dist/src/cli/project/list.js +0 -19
- package/dist/src/cli/project/update.d.ts +0 -18
- package/dist/src/cli/project/update.js +0 -24
- package/dist/src/cli/project/view-cmd.d.ts +0 -7
- package/dist/src/cli/project/view-cmd.js +0 -15
- package/dist/src/cli/project/view.d.ts +0 -3
- package/dist/src/cli/project/view.js +0 -102
- package/dist/src/cli/render/codehighlight.d.ts +0 -8
- package/dist/src/cli/render/codehighlight.js +0 -264
- package/dist/src/cli/render/envelope.d.ts +0 -7
- package/dist/src/cli/render/envelope.js +0 -23
- package/dist/src/cli/render/frontmatter.d.ts +0 -8
- package/dist/src/cli/render/frontmatter.js +0 -50
- package/dist/src/cli/render/helpers.d.ts +0 -2
- package/dist/src/cli/render/helpers.js +0 -11
- package/dist/src/cli/render/index.d.ts +0 -7
- package/dist/src/cli/render/index.js +0 -10
- package/dist/src/cli/render/lexical/blocks.d.ts +0 -19
- package/dist/src/cli/render/lexical/blocks.js +0 -208
- package/dist/src/cli/render/lexical/code.d.ts +0 -2
- package/dist/src/cli/render/lexical/code.js +0 -22
- package/dist/src/cli/render/lexical/embeds.d.ts +0 -6
- package/dist/src/cli/render/lexical/embeds.js +0 -51
- package/dist/src/cli/render/lexical/index.d.ts +0 -9
- package/dist/src/cli/render/lexical/index.js +0 -25
- package/dist/src/cli/render/lexical/inlines.d.ts +0 -17
- package/dist/src/cli/render/lexical/inlines.js +0 -76
- package/dist/src/cli/render/lexical/parser.d.ts +0 -10
- package/dist/src/cli/render/lexical/parser.js +0 -64
- package/dist/src/cli/render/lexical/walker.d.ts +0 -21
- package/dist/src/cli/render/lexical/walker.js +0 -51
- package/dist/src/cli/render/markdown.d.ts +0 -18
- package/dist/src/cli/render/markdown.js +0 -196
- package/dist/src/cli/render/metadata-block.d.ts +0 -14
- package/dist/src/cli/render/metadata-block.js +0 -50
- package/dist/src/cli/skill/all.d.ts +0 -4
- package/dist/src/cli/skill/all.js +0 -11
- package/dist/src/cli/skill/get.d.ts +0 -6
- package/dist/src/cli/skill/get.js +0 -12
- package/dist/src/cli/skill/index.d.ts +0 -10
- package/dist/src/cli/skill/index.js +0 -34
- package/dist/src/cli/skill/list.d.ts +0 -4
- package/dist/src/cli/skill/list.js +0 -11
- package/dist/src/cli/skill/search.d.ts +0 -6
- package/dist/src/cli/skill/search.js +0 -12
- package/dist/src/cli/skill/views.d.ts +0 -6
- package/dist/src/cli/skill/views.js +0 -90
- package/dist/src/cli/snippet/_flags.d.ts +0 -57
- package/dist/src/cli/snippet/_flags.js +0 -123
- package/dist/src/cli/snippet/_resolve.d.ts +0 -4
- package/dist/src/cli/snippet/_resolve.js +0 -32
- package/dist/src/cli/snippet/_sync.d.ts +0 -5
- package/dist/src/cli/snippet/_sync.js +0 -54
- package/dist/src/cli/snippet/create.d.ts +0 -19
- package/dist/src/cli/snippet/create.js +0 -35
- package/dist/src/cli/snippet/delete.d.ts +0 -8
- package/dist/src/cli/snippet/delete.js +0 -28
- package/dist/src/cli/snippet/edit.d.ts +0 -7
- package/dist/src/cli/snippet/edit.js +0 -29
- package/dist/src/cli/snippet/get.d.ts +0 -6
- package/dist/src/cli/snippet/get.js +0 -12
- package/dist/src/cli/snippet/index.d.ts +0 -43
- package/dist/src/cli/snippet/index.js +0 -58
- package/dist/src/cli/snippet/list.d.ts +0 -9
- package/dist/src/cli/snippet/list.js +0 -20
- package/dist/src/cli/snippet/pull.d.ts +0 -8
- package/dist/src/cli/snippet/pull.js +0 -33
- package/dist/src/cli/snippet/push.d.ts +0 -10
- package/dist/src/cli/snippet/push.js +0 -31
- package/dist/src/cli/snippet/update.d.ts +0 -8
- package/dist/src/cli/snippet/update.js +0 -16
- package/dist/src/cli/topic/create.d.ts +0 -10
- package/dist/src/cli/topic/create.js +0 -24
- package/dist/src/cli/topic/delete.d.ts +0 -7
- package/dist/src/cli/topic/delete.js +0 -37
- package/dist/src/cli/topic/get.d.ts +0 -6
- package/dist/src/cli/topic/get.js +0 -15
- package/dist/src/cli/topic/index.d.ts +0 -20
- package/dist/src/cli/topic/index.js +0 -32
- package/dist/src/cli/topic/list.d.ts +0 -4
- package/dist/src/cli/topic/list.js +0 -10
- package/dist/src/cli/topic/update.d.ts +0 -11
- package/dist/src/cli/topic/update.js +0 -51
- package/dist/src/cli/ui/index.d.ts +0 -24
- package/dist/src/cli/ui/index.js +0 -83
- package/dist/src/cli/update/index.d.ts +0 -10
- package/dist/src/cli/update/index.js +0 -142
- package/dist/src/domain/admin-link.d.ts +0 -12
- package/dist/src/domain/admin-link.js +0 -45
- package/dist/src/domain/content-spec.d.ts +0 -20
- package/dist/src/domain/content-spec.js +0 -78
- package/dist/src/domain/envelope-compat.d.ts +0 -68
- package/dist/src/domain/envelope-compat.js +0 -121
- package/dist/src/domain/envelope.d.ts +0 -34
- package/dist/src/domain/envelope.js +0 -355
- package/dist/src/domain/errors.d.ts +0 -336
- package/dist/src/domain/errors.js +0 -239
- package/dist/src/domain/gate.d.ts +0 -14
- package/dist/src/domain/gate.js +0 -18
- package/dist/src/domain/payload.d.ts +0 -64
- package/dist/src/domain/payload.js +0 -237
- package/dist/src/domain/preflight-guards.d.ts +0 -54
- package/dist/src/domain/preflight-guards.js +0 -130
- package/dist/src/domain/runtime-flags.d.ts +0 -33
- package/dist/src/domain/runtime-flags.js +0 -166
- package/dist/src/domain/schema/api-envelope.d.ts +0 -67
- package/dist/src/domain/schema/api-envelope.js +0 -65
- package/dist/src/domain/schema/category.d.ts +0 -23
- package/dist/src/domain/schema/category.js +0 -19
- package/dist/src/domain/schema/config.d.ts +0 -13
- package/dist/src/domain/schema/config.js +0 -18
- package/dist/src/domain/schema/note.d.ts +0 -76
- package/dist/src/domain/schema/note.js +0 -35
- package/dist/src/domain/schema/page.d.ts +0 -40
- package/dist/src/domain/schema/page.js +0 -22
- package/dist/src/domain/schema/post.d.ts +0 -68
- package/dist/src/domain/schema/post.js +0 -35
- package/dist/src/domain/schema/profile.d.ts +0 -14
- package/dist/src/domain/schema/profile.js +0 -22
- package/dist/src/domain/schema/topic.d.ts +0 -24
- package/dist/src/domain/schema/topic.js +0 -16
- package/dist/src/domain/version.d.ts +0 -15
- package/dist/src/domain/version.js +0 -43
- package/dist/src/index.d.ts +0 -4
- package/dist/src/index.js +0 -8
- package/dist/src/layers/App.d.ts +0 -30
- package/dist/src/layers/App.js +0 -39
- package/dist/src/services/Ai/index.d.ts +0 -13
- package/dist/src/services/Ai/index.js +0 -127
- package/dist/src/services/Ai/overview.d.ts +0 -7
- package/dist/src/services/Ai/overview.js +0 -11
- package/dist/src/services/Ai/resources.d.ts +0 -7
- package/dist/src/services/Ai/resources.js +0 -59
- package/dist/src/services/Ai/shared.d.ts +0 -2
- package/dist/src/services/Ai/shared.js +0 -11
- package/dist/src/services/Ai/tasks.d.ts +0 -8
- package/dist/src/services/Ai/tasks.js +0 -144
- package/dist/src/services/Ai/types.d.ts +0 -130
- package/dist/src/services/Ai/types.js +0 -1
- package/dist/src/services/Api.d.ts +0 -67
- package/dist/src/services/Api.js +0 -348
- package/dist/src/services/Auth.d.ts +0 -101
- package/dist/src/services/Auth.js +0 -402
- package/dist/src/services/Backup.d.ts +0 -8
- package/dist/src/services/Backup.js +0 -4
- package/dist/src/services/Cache.d.ts +0 -8
- package/dist/src/services/Cache.js +0 -4
- package/dist/src/services/Comment.d.ts +0 -48
- package/dist/src/services/Comment.js +0 -102
- package/dist/src/services/Config.d.ts +0 -95
- package/dist/src/services/Config.js +0 -359
- package/dist/src/services/Editor.d.ts +0 -28
- package/dist/src/services/Editor.js +0 -95
- package/dist/src/services/Lexical.d.ts +0 -27
- package/dist/src/services/Lexical.js +0 -56
- package/dist/src/services/Migration.d.ts +0 -31
- package/dist/src/services/Migration.js +0 -177
- package/dist/src/services/Profile.d.ts +0 -29
- package/dist/src/services/Profile.js +0 -115
- package/dist/src/services/Renderer/content.d.ts +0 -16
- package/dist/src/services/Renderer/content.js +0 -110
- package/dist/src/services/Renderer/datetime.d.ts +0 -38
- package/dist/src/services/Renderer/datetime.js +0 -147
- package/dist/src/services/Renderer/errors.d.ts +0 -3
- package/dist/src/services/Renderer/errors.js +0 -59
- package/dist/src/services/Renderer/index.d.ts +0 -13
- package/dist/src/services/Renderer/index.js +0 -11
- package/dist/src/services/Renderer/lists.d.ts +0 -1
- package/dist/src/services/Renderer/lists.js +0 -101
- package/dist/src/services/Renderer/options.d.ts +0 -10
- package/dist/src/services/Renderer/options.js +0 -13
- package/dist/src/services/Renderer/primitives.d.ts +0 -4
- package/dist/src/services/Renderer/primitives.js +0 -12
- package/dist/src/services/Renderer/service.d.ts +0 -35
- package/dist/src/services/Renderer/service.js +0 -123
- package/dist/src/services/Renderer/view.d.ts +0 -16
- package/dist/src/services/Renderer/view.js +0 -1
- package/dist/src/services/Resolver.d.ts +0 -47
- package/dist/src/services/Resolver.js +0 -269
- package/dist/src/services/Skill.d.ts +0 -29
- package/dist/src/services/Skill.js +0 -421
- package/dist/src/services/UpdateNotifier.d.ts +0 -162
- package/dist/src/services/UpdateNotifier.js +0 -572
- package/dist/test/cli/ai/ai.test.d.ts +0 -1
- package/dist/test/cli/ai/ai.test.js +0 -507
- package/dist/test/cli/ai/verbs.test.d.ts +0 -1
- package/dist/test/cli/ai/verbs.test.js +0 -235
- package/dist/test/cli/auth/login.test.d.ts +0 -1
- package/dist/test/cli/auth/login.test.js +0 -236
- package/dist/test/cli/auth/logout-whoami.test.d.ts +0 -1
- package/dist/test/cli/auth/logout-whoami.test.js +0 -124
- package/dist/test/cli/auth/status.test.d.ts +0 -1
- package/dist/test/cli/auth/status.test.js +0 -90
- package/dist/test/cli/category/category.test.d.ts +0 -1
- package/dist/test/cli/category/category.test.js +0 -175
- package/dist/test/cli/comment/comment.test.d.ts +0 -1
- package/dist/test/cli/comment/comment.test.js +0 -445
- package/dist/test/cli/config/config.test.d.ts +0 -1
- package/dist/test/cli/config/config.test.js +0 -281
- package/dist/test/cli/edit-roundtrip.test.d.ts +0 -1
- package/dist/test/cli/edit-roundtrip.test.js +0 -259
- package/dist/test/cli/file/file.test.d.ts +0 -1
- package/dist/test/cli/file/file.test.js +0 -185
- package/dist/test/cli/help.test.d.ts +0 -1
- package/dist/test/cli/help.test.js +0 -289
- package/dist/test/cli/note/create.test.d.ts +0 -1
- package/dist/test/cli/note/create.test.js +0 -155
- package/dist/test/cli/note/list.test.d.ts +0 -1
- package/dist/test/cli/note/list.test.js +0 -115
- package/dist/test/cli/note/publish.test.d.ts +0 -1
- package/dist/test/cli/note/publish.test.js +0 -123
- package/dist/test/cli/page/page.test.d.ts +0 -1
- package/dist/test/cli/page/page.test.js +0 -185
- package/dist/test/cli/post/create.test.d.ts +0 -1
- package/dist/test/cli/post/create.test.js +0 -172
- package/dist/test/cli/post/list.test.d.ts +0 -1
- package/dist/test/cli/post/list.test.js +0 -133
- package/dist/test/cli/post/publish.test.d.ts +0 -1
- package/dist/test/cli/post/publish.test.js +0 -139
- package/dist/test/cli/post/stage-apply.test.d.ts +0 -1
- package/dist/test/cli/post/stage-apply.test.js +0 -215
- package/dist/test/cli/post/update.test.d.ts +0 -1
- package/dist/test/cli/post/update.test.js +0 -160
- package/dist/test/cli/post-note-crud.test.d.ts +0 -1
- package/dist/test/cli/post-note-crud.test.js +0 -362
- package/dist/test/cli/profile/ls.test.d.ts +0 -1
- package/dist/test/cli/profile/ls.test.js +0 -93
- package/dist/test/cli/profile/mark-use.test.d.ts +0 -1
- package/dist/test/cli/profile/mark-use.test.js +0 -216
- package/dist/test/cli/project-crud.test.d.ts +0 -1
- package/dist/test/cli/project-crud.test.js +0 -315
- package/dist/test/cli/render/lexical.test.d.ts +0 -1
- package/dist/test/cli/render/lexical.test.js +0 -216
- package/dist/test/cli/render/markdown.test.d.ts +0 -1
- package/dist/test/cli/render/markdown.test.js +0 -39
- package/dist/test/cli/snippet-crud.test.d.ts +0 -1
- package/dist/test/cli/snippet-crud.test.js +0 -293
- package/dist/test/cli/topic/topic.test.d.ts +0 -1
- package/dist/test/cli/topic/topic.test.js +0 -181
- package/dist/test/cli/update.test.d.ts +0 -1
- package/dist/test/cli/update.test.js +0 -395
- package/dist/test/domain/content-spec.test.d.ts +0 -1
- package/dist/test/domain/content-spec.test.js +0 -126
- package/dist/test/domain/envelope-compat.test.d.ts +0 -1
- package/dist/test/domain/envelope-compat.test.js +0 -126
- package/dist/test/domain/envelope.test.d.ts +0 -1
- package/dist/test/domain/envelope.test.js +0 -149
- package/dist/test/domain/errors.test.d.ts +0 -1
- package/dist/test/domain/errors.test.js +0 -127
- package/dist/test/domain/gate.test.d.ts +0 -1
- package/dist/test/domain/gate.test.js +0 -128
- package/dist/test/domain/payload.test.d.ts +0 -1
- package/dist/test/domain/payload.test.js +0 -259
- package/dist/test/helper/test-fs.d.ts +0 -24
- package/dist/test/helper/test-fs.js +0 -161
- package/dist/test/helper/test-http.d.ts +0 -31
- package/dist/test/helper/test-http.js +0 -66
- package/dist/test/integration/_helpers.d.ts +0 -5
- package/dist/test/integration/_helpers.js +0 -24
- package/dist/test/integration/cli-error-envelope.test.d.ts +0 -1
- package/dist/test/integration/cli-error-envelope.test.js +0 -137
- package/dist/test/integration/cli-help-render.test.d.ts +0 -1
- package/dist/test/integration/cli-help-render.test.js +0 -149
- package/dist/test/integration/cli-help.test.d.ts +0 -1
- package/dist/test/integration/cli-help.test.js +0 -67
- package/dist/test/integration/cli-post-list.test.d.ts +0 -1
- package/dist/test/integration/cli-post-list.test.js +0 -140
- package/dist/test/integration/cli-skill.test.d.ts +0 -1
- package/dist/test/integration/cli-skill.test.js +0 -74
- package/dist/test/integration/cli-version.test.d.ts +0 -1
- package/dist/test/integration/cli-version.test.js +0 -37
- package/dist/test/services/Api.test.d.ts +0 -1
- package/dist/test/services/Api.test.js +0 -553
- package/dist/test/services/Auth.test.d.ts +0 -1
- package/dist/test/services/Auth.test.js +0 -650
- package/dist/test/services/Config.test.d.ts +0 -1
- package/dist/test/services/Config.test.js +0 -510
- package/dist/test/services/Datetime.test.d.ts +0 -1
- package/dist/test/services/Datetime.test.js +0 -113
- package/dist/test/services/Editor.test.d.ts +0 -1
- package/dist/test/services/Editor.test.js +0 -205
- package/dist/test/services/Lexical.errors.test.d.ts +0 -1
- package/dist/test/services/Lexical.errors.test.js +0 -60
- package/dist/test/services/Lexical.test.d.ts +0 -1
- package/dist/test/services/Lexical.test.js +0 -68
- package/dist/test/services/Migration.test.d.ts +0 -1
- package/dist/test/services/Migration.test.js +0 -376
- package/dist/test/services/Profile.test.d.ts +0 -1
- package/dist/test/services/Profile.test.js +0 -277
- package/dist/test/services/Renderer.test.d.ts +0 -1
- package/dist/test/services/Renderer.test.js +0 -538
- package/dist/test/services/Resolver.test.d.ts +0 -1
- package/dist/test/services/Resolver.test.js +0 -320
- package/dist/test/services/Skill.test.d.ts +0 -1
- package/dist/test/services/Skill.test.js +0 -261
- package/dist/test/services/UpdateNotifier.spawn.test.d.ts +0 -1
- package/dist/test/services/UpdateNotifier.spawn.test.js +0 -73
- package/dist/test/services/UpdateNotifier.test.d.ts +0 -1
- package/dist/test/services/UpdateNotifier.test.js +0 -912
|
@@ -1,395 +0,0 @@
|
|
|
1
|
-
import { Effect, Exit, Layer, Option } from 'effect';
|
|
2
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
-
import { updateCmd as update } from '../../src/cli/update';
|
|
4
|
-
import { UpdatePmUnknown } from '../../src/domain/errors';
|
|
5
|
-
import { Editor } from '../../src/services/Editor';
|
|
6
|
-
import { Renderer } from '../../src/services/Renderer';
|
|
7
|
-
import * as UpdaterMod from '../../src/services/UpdateNotifier';
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
// Helpers
|
|
10
|
-
// ---------------------------------------------------------------------------
|
|
11
|
-
const tagOf = (cause) => {
|
|
12
|
-
const err = cause?.error ?? cause?.failure ?? cause;
|
|
13
|
-
return err?._tag ?? err?.error?._tag ?? err?.failure?._tag;
|
|
14
|
-
};
|
|
15
|
-
const captureStdout = () => {
|
|
16
|
-
const data = [];
|
|
17
|
-
const orig = process.stdout.write.bind(process.stdout);
|
|
18
|
-
process.stdout.write = (s) => {
|
|
19
|
-
data.push(typeof s === 'string' ? s : s.toString());
|
|
20
|
-
return true;
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
data,
|
|
24
|
-
restore: () => {
|
|
25
|
-
;
|
|
26
|
-
process.stdout.write = orig;
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
const captureStderr = () => {
|
|
31
|
-
const data = [];
|
|
32
|
-
const orig = process.stderr.write.bind(process.stderr);
|
|
33
|
-
process.stderr.write = (s) => {
|
|
34
|
-
data.push(typeof s === 'string' ? s : s.toString());
|
|
35
|
-
return true;
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
data,
|
|
39
|
-
restore: () => {
|
|
40
|
-
;
|
|
41
|
-
process.stderr.write = orig;
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const makeEditor = (overrides = {}) => ({
|
|
46
|
-
openEditor: () => Effect.succeed(''),
|
|
47
|
-
prompt: () => Effect.succeed(''),
|
|
48
|
-
confirm: () => Effect.succeed(true),
|
|
49
|
-
readFileOrStdin: () => Effect.succeed(''),
|
|
50
|
-
...overrides,
|
|
51
|
-
});
|
|
52
|
-
const buildLayer = (editorOverride = {}) => Layer.mergeAll(Renderer.Default, Layer.succeed(Editor, makeEditor(editorOverride)));
|
|
53
|
-
beforeEach(() => {
|
|
54
|
-
vi.restoreAllMocks();
|
|
55
|
-
});
|
|
56
|
-
afterEach(() => {
|
|
57
|
-
vi.restoreAllMocks();
|
|
58
|
-
});
|
|
59
|
-
// ---------------------------------------------------------------------------
|
|
60
|
-
// Tests
|
|
61
|
-
// ---------------------------------------------------------------------------
|
|
62
|
-
describe('update command', () => {
|
|
63
|
-
it('emits up_to_date envelope when local >= registry latest', async () => {
|
|
64
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
65
|
-
maybeNotify: () => Effect.void,
|
|
66
|
-
runUpdate: () => Effect.succeed({
|
|
67
|
-
fromVersion: '0.3.0',
|
|
68
|
-
toVersion: '0.3.0',
|
|
69
|
-
pm: 'pnpm',
|
|
70
|
-
channel: 'stable',
|
|
71
|
-
status: 0,
|
|
72
|
-
upgraded: false,
|
|
73
|
-
dryRun: true,
|
|
74
|
-
upToDate: true,
|
|
75
|
-
}),
|
|
76
|
-
});
|
|
77
|
-
const cap = captureStdout();
|
|
78
|
-
const errCap = captureStderr();
|
|
79
|
-
try {
|
|
80
|
-
const exit = await Effect.runPromiseExit(update
|
|
81
|
-
.handler({
|
|
82
|
-
check: Option.none(),
|
|
83
|
-
prerelease: Option.none(),
|
|
84
|
-
pm: Option.none(),
|
|
85
|
-
force: Option.none(),
|
|
86
|
-
yes: Option.some(true),
|
|
87
|
-
})
|
|
88
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
89
|
-
json: true,
|
|
90
|
-
output: 'json',
|
|
91
|
-
quiet: false,
|
|
92
|
-
verbose: false,
|
|
93
|
-
})));
|
|
94
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
95
|
-
const stdout = cap.data.join('');
|
|
96
|
-
expect(stdout).toContain('"up_to_date":true');
|
|
97
|
-
}
|
|
98
|
-
finally {
|
|
99
|
-
cap.restore();
|
|
100
|
-
errCap.restore();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
it('emits dry_run envelope when --check is set', async () => {
|
|
104
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
105
|
-
maybeNotify: () => Effect.void,
|
|
106
|
-
runUpdate: (opts) => Effect.succeed({
|
|
107
|
-
fromVersion: opts.currentVersion,
|
|
108
|
-
toVersion: '0.4.0',
|
|
109
|
-
pm: 'npm',
|
|
110
|
-
channel: 'stable',
|
|
111
|
-
status: 0,
|
|
112
|
-
upgraded: false,
|
|
113
|
-
dryRun: true,
|
|
114
|
-
upToDate: false,
|
|
115
|
-
}),
|
|
116
|
-
});
|
|
117
|
-
const cap = captureStdout();
|
|
118
|
-
try {
|
|
119
|
-
const exit = await Effect.runPromiseExit(update
|
|
120
|
-
.handler({
|
|
121
|
-
check: Option.some(true),
|
|
122
|
-
prerelease: Option.none(),
|
|
123
|
-
pm: Option.none(),
|
|
124
|
-
force: Option.none(),
|
|
125
|
-
yes: Option.none(),
|
|
126
|
-
})
|
|
127
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
128
|
-
json: true,
|
|
129
|
-
output: 'json',
|
|
130
|
-
quiet: false,
|
|
131
|
-
verbose: false,
|
|
132
|
-
})));
|
|
133
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
134
|
-
const stdout = cap.data.join('');
|
|
135
|
-
const parsed = JSON.parse(stdout.trim());
|
|
136
|
-
expect(parsed.ok).toBe(true);
|
|
137
|
-
expect(parsed.data.latest).toBe('0.4.0');
|
|
138
|
-
expect(parsed.data.up_to_date).toBe(false);
|
|
139
|
-
}
|
|
140
|
-
finally {
|
|
141
|
-
cap.restore();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
it('emits upgraded envelope when runUpdate succeeds and an install ran', async () => {
|
|
145
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
146
|
-
maybeNotify: () => Effect.void,
|
|
147
|
-
runUpdate: () => Effect.succeed({
|
|
148
|
-
fromVersion: '0.3.0',
|
|
149
|
-
toVersion: '0.4.0',
|
|
150
|
-
pm: 'pnpm',
|
|
151
|
-
channel: 'stable',
|
|
152
|
-
status: 0,
|
|
153
|
-
upgraded: true,
|
|
154
|
-
dryRun: false,
|
|
155
|
-
upToDate: false,
|
|
156
|
-
command: 'pnpm add -g @mx-space/cli@latest',
|
|
157
|
-
}),
|
|
158
|
-
});
|
|
159
|
-
const cap = captureStdout();
|
|
160
|
-
try {
|
|
161
|
-
const exit = await Effect.runPromiseExit(update
|
|
162
|
-
.handler({
|
|
163
|
-
check: Option.none(),
|
|
164
|
-
prerelease: Option.none(),
|
|
165
|
-
pm: Option.none(),
|
|
166
|
-
force: Option.none(),
|
|
167
|
-
yes: Option.some(true),
|
|
168
|
-
})
|
|
169
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
170
|
-
json: true,
|
|
171
|
-
output: 'json',
|
|
172
|
-
quiet: false,
|
|
173
|
-
verbose: false,
|
|
174
|
-
})));
|
|
175
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
176
|
-
const parsed = JSON.parse(cap.data.join('').trim());
|
|
177
|
-
expect(parsed.data.upgraded).toBe(true);
|
|
178
|
-
expect(parsed.data.latest).toBe('0.4.0');
|
|
179
|
-
}
|
|
180
|
-
finally {
|
|
181
|
-
cap.restore();
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
it('passes option flags through and emits cancelled envelope', async () => {
|
|
185
|
-
const runUpdate = vi.fn((opts) => {
|
|
186
|
-
const channel = opts.prerelease ? 'next' : 'stable';
|
|
187
|
-
return Effect.succeed({
|
|
188
|
-
fromVersion: opts.currentVersion,
|
|
189
|
-
toVersion: '0.4.0',
|
|
190
|
-
pm: opts.pm,
|
|
191
|
-
channel,
|
|
192
|
-
status: 0,
|
|
193
|
-
upgraded: false,
|
|
194
|
-
dryRun: true,
|
|
195
|
-
upToDate: false,
|
|
196
|
-
command: 'pnpm add -g @mx-space/cli@next',
|
|
197
|
-
cancelled: true,
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
201
|
-
maybeNotify: () => Effect.void,
|
|
202
|
-
runUpdate,
|
|
203
|
-
});
|
|
204
|
-
const cap = captureStdout();
|
|
205
|
-
try {
|
|
206
|
-
const exit = await Effect.runPromiseExit(update
|
|
207
|
-
.handler({
|
|
208
|
-
check: Option.none(),
|
|
209
|
-
prerelease: Option.some(true),
|
|
210
|
-
pm: Option.some('pnpm'),
|
|
211
|
-
force: Option.some(true),
|
|
212
|
-
yes: Option.some(false),
|
|
213
|
-
})
|
|
214
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
215
|
-
json: true,
|
|
216
|
-
output: 'json',
|
|
217
|
-
quiet: false,
|
|
218
|
-
verbose: false,
|
|
219
|
-
})));
|
|
220
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
221
|
-
expect(runUpdate).toHaveBeenCalledWith(expect.objectContaining({
|
|
222
|
-
prerelease: true,
|
|
223
|
-
pm: 'pnpm',
|
|
224
|
-
force: true,
|
|
225
|
-
yes: false,
|
|
226
|
-
json: true,
|
|
227
|
-
}));
|
|
228
|
-
const parsed = JSON.parse(cap.data.join('').trim());
|
|
229
|
-
expect(parsed.data).toMatchObject({
|
|
230
|
-
latest: '0.4.0',
|
|
231
|
-
pm: 'pnpm',
|
|
232
|
-
cancelled: true,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
finally {
|
|
236
|
-
cap.restore();
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
it('runs the upgrade without prompting (auto-install default)', async () => {
|
|
240
|
-
let confirmImplPassed = 'sentinel';
|
|
241
|
-
vi.spyOn(UpdaterMod, 'make').mockImplementation((deps = {}) => {
|
|
242
|
-
confirmImplPassed = deps.confirmImpl;
|
|
243
|
-
return {
|
|
244
|
-
maybeNotify: () => Effect.void,
|
|
245
|
-
runUpdate: () => Effect.succeed({
|
|
246
|
-
fromVersion: '0.3.0',
|
|
247
|
-
toVersion: '0.4.0',
|
|
248
|
-
pm: 'npm',
|
|
249
|
-
channel: 'stable',
|
|
250
|
-
status: 0,
|
|
251
|
-
upgraded: true,
|
|
252
|
-
dryRun: false,
|
|
253
|
-
upToDate: false,
|
|
254
|
-
command: 'npm install -g @mx-space/cli@latest',
|
|
255
|
-
}),
|
|
256
|
-
};
|
|
257
|
-
});
|
|
258
|
-
const cap = captureStdout();
|
|
259
|
-
try {
|
|
260
|
-
const exit = await Effect.runPromiseExit(update
|
|
261
|
-
.handler({
|
|
262
|
-
check: Option.none(),
|
|
263
|
-
prerelease: Option.none(),
|
|
264
|
-
pm: Option.none(),
|
|
265
|
-
force: Option.none(),
|
|
266
|
-
yes: Option.none(),
|
|
267
|
-
})
|
|
268
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
269
|
-
json: true,
|
|
270
|
-
output: 'json',
|
|
271
|
-
quiet: false,
|
|
272
|
-
verbose: false,
|
|
273
|
-
})));
|
|
274
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
275
|
-
// The controller no longer threads Editor.confirm into the notifier —
|
|
276
|
-
// updates proceed without a prompt.
|
|
277
|
-
expect(confirmImplPassed).toBeUndefined();
|
|
278
|
-
const parsed = JSON.parse(cap.data.join('').trim());
|
|
279
|
-
expect(parsed.data).toMatchObject({ upgraded: true, latest: '0.4.0' });
|
|
280
|
-
}
|
|
281
|
-
finally {
|
|
282
|
-
cap.restore();
|
|
283
|
-
}
|
|
284
|
-
});
|
|
285
|
-
it('emits dry_run command envelope when no install ran outside --check', async () => {
|
|
286
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
287
|
-
maybeNotify: () => Effect.void,
|
|
288
|
-
runUpdate: () => Effect.succeed({
|
|
289
|
-
fromVersion: '0.3.0',
|
|
290
|
-
toVersion: '0.4.0',
|
|
291
|
-
pm: 'npm',
|
|
292
|
-
channel: 'stable',
|
|
293
|
-
status: 0,
|
|
294
|
-
upgraded: false,
|
|
295
|
-
dryRun: true,
|
|
296
|
-
upToDate: false,
|
|
297
|
-
command: 'npm install -g @mx-space/cli@latest',
|
|
298
|
-
}),
|
|
299
|
-
});
|
|
300
|
-
const cap = captureStdout();
|
|
301
|
-
try {
|
|
302
|
-
const exit = await Effect.runPromiseExit(update
|
|
303
|
-
.handler({
|
|
304
|
-
check: Option.none(),
|
|
305
|
-
prerelease: Option.none(),
|
|
306
|
-
pm: Option.none(),
|
|
307
|
-
force: Option.none(),
|
|
308
|
-
yes: Option.none(),
|
|
309
|
-
})
|
|
310
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
311
|
-
json: true,
|
|
312
|
-
output: 'json',
|
|
313
|
-
quiet: false,
|
|
314
|
-
verbose: false,
|
|
315
|
-
})));
|
|
316
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
317
|
-
const parsed = JSON.parse(cap.data.join('').trim());
|
|
318
|
-
expect(parsed.data).toMatchObject({
|
|
319
|
-
command: 'npm install -g @mx-space/cli@latest',
|
|
320
|
-
dry_run: true,
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
finally {
|
|
324
|
-
cap.restore();
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
it('surfaces UpdatePmUnknown when the underlying service fails', async () => {
|
|
328
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
329
|
-
maybeNotify: () => Effect.void,
|
|
330
|
-
runUpdate: () => Effect.fail(new UpdatePmUnknown({
|
|
331
|
-
message: "unknown package manager 'foo'",
|
|
332
|
-
hint: 'supported values: npm | pnpm | yarn | bun',
|
|
333
|
-
})),
|
|
334
|
-
});
|
|
335
|
-
const exit = await Effect.runPromiseExit(update
|
|
336
|
-
.handler({
|
|
337
|
-
check: Option.none(),
|
|
338
|
-
prerelease: Option.none(),
|
|
339
|
-
pm: Option.some('npm'),
|
|
340
|
-
force: Option.none(),
|
|
341
|
-
yes: Option.some(true),
|
|
342
|
-
})
|
|
343
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
344
|
-
json: true,
|
|
345
|
-
output: 'json',
|
|
346
|
-
quiet: false,
|
|
347
|
-
verbose: false,
|
|
348
|
-
})));
|
|
349
|
-
expect(Exit.isFailure(exit)).toBe(true);
|
|
350
|
-
if (Exit.isFailure(exit)) {
|
|
351
|
-
expect(tagOf(exit.cause)).toBe('UpdatePmUnknown');
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
it('emits an informational up-to-date line for non-json output', async () => {
|
|
355
|
-
vi.spyOn(UpdaterMod, 'make').mockReturnValue({
|
|
356
|
-
maybeNotify: () => Effect.void,
|
|
357
|
-
runUpdate: () => Effect.succeed({
|
|
358
|
-
fromVersion: '0.3.0',
|
|
359
|
-
toVersion: '0.3.0',
|
|
360
|
-
pm: 'npm',
|
|
361
|
-
channel: 'stable',
|
|
362
|
-
status: 0,
|
|
363
|
-
upgraded: false,
|
|
364
|
-
dryRun: true,
|
|
365
|
-
upToDate: true,
|
|
366
|
-
}),
|
|
367
|
-
});
|
|
368
|
-
const cap = captureStdout();
|
|
369
|
-
const errCap = captureStderr();
|
|
370
|
-
try {
|
|
371
|
-
const exit = await Effect.runPromiseExit(update
|
|
372
|
-
.handler({
|
|
373
|
-
check: Option.none(),
|
|
374
|
-
prerelease: Option.none(),
|
|
375
|
-
pm: Option.none(),
|
|
376
|
-
force: Option.none(),
|
|
377
|
-
yes: Option.some(true),
|
|
378
|
-
})
|
|
379
|
-
.pipe(Effect.provide(buildLayer()), Renderer.withOptions({
|
|
380
|
-
json: false,
|
|
381
|
-
output: 'readable',
|
|
382
|
-
quiet: false,
|
|
383
|
-
verbose: false,
|
|
384
|
-
})));
|
|
385
|
-
expect(Exit.isSuccess(exit)).toBe(true);
|
|
386
|
-
const stdout = cap.data.join('');
|
|
387
|
-
expect(stdout).toContain('up to date');
|
|
388
|
-
expect(stdout).toContain('0.3.0');
|
|
389
|
-
}
|
|
390
|
-
finally {
|
|
391
|
-
cap.restore();
|
|
392
|
-
errCap.restore();
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { promises as fs } from 'node:fs';
|
|
2
|
-
import os from 'node:os';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { NodeContext } from '@effect/platform-node';
|
|
5
|
-
import { Effect } from 'effect';
|
|
6
|
-
import { beforeEach, describe, expect, it } from 'vitest';
|
|
7
|
-
import { readContentSpec, readJsonSpec } from '../../src/domain/content-spec';
|
|
8
|
-
let tmpDir;
|
|
9
|
-
beforeEach(async () => {
|
|
10
|
-
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'mxs-content-spec-'));
|
|
11
|
-
});
|
|
12
|
-
const run = (eff) => Effect.runPromise(Effect.provide(eff, NodeContext.layer));
|
|
13
|
-
describe('readContentSpec', () => {
|
|
14
|
-
it('returns null when no content spec is provided', async () => {
|
|
15
|
-
await expect(run(readContentSpec(undefined))).resolves.toBeNull();
|
|
16
|
-
});
|
|
17
|
-
it('treats ordinary values as inline content', async () => {
|
|
18
|
-
await expect(run(readContentSpec('plain text'))).resolves.toEqual({
|
|
19
|
-
text: 'plain text',
|
|
20
|
-
origin: 'inline',
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
it('reads file= paths relative to the provided cwd', async () => {
|
|
24
|
-
await fs.writeFile(path.join(tmpDir, 'body.md'), '# title\n', 'utf8');
|
|
25
|
-
await expect(run(readContentSpec('file=body.md', { cwd: tmpDir }))).resolves.toEqual({
|
|
26
|
-
text: '# title\n',
|
|
27
|
-
origin: 'file',
|
|
28
|
-
path: path.join(tmpDir, 'body.md'),
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
it('wraps file read failures as ValidationFailed', async () => {
|
|
32
|
-
const err = await run(Effect.flip(readContentSpec('file=missing.md', { cwd: tmpDir })));
|
|
33
|
-
expect(err._tag).toBe('ValidationFailed');
|
|
34
|
-
expect(err.message).toContain('failed to read');
|
|
35
|
-
});
|
|
36
|
-
it('rejects stdin specs when stdin is a TTY', async () => {
|
|
37
|
-
const descriptor = Object.getOwnPropertyDescriptor(process.stdin, 'isTTY');
|
|
38
|
-
Object.defineProperty(process.stdin, 'isTTY', {
|
|
39
|
-
configurable: true,
|
|
40
|
-
value: true,
|
|
41
|
-
});
|
|
42
|
-
try {
|
|
43
|
-
const err = await run(Effect.flip(readContentSpec('-')));
|
|
44
|
-
expect(err._tag).toBe('ValidationFailed');
|
|
45
|
-
expect(err.message).toContain('stdin is a TTY');
|
|
46
|
-
}
|
|
47
|
-
finally {
|
|
48
|
-
if (descriptor)
|
|
49
|
-
Object.defineProperty(process.stdin, 'isTTY', descriptor);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
it('reads stdin specs when stdin is a stream', async () => {
|
|
53
|
-
const descriptor = Object.getOwnPropertyDescriptor(process, 'stdin');
|
|
54
|
-
const fakeStdin = {
|
|
55
|
-
isTTY: false,
|
|
56
|
-
async *[Symbol.asyncIterator]() {
|
|
57
|
-
yield 'hello ';
|
|
58
|
-
yield Buffer.from('world');
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(process, 'stdin', {
|
|
62
|
-
configurable: true,
|
|
63
|
-
value: fakeStdin,
|
|
64
|
-
});
|
|
65
|
-
try {
|
|
66
|
-
await expect(run(readContentSpec('stdin'))).resolves.toEqual({
|
|
67
|
-
text: 'hello world',
|
|
68
|
-
origin: 'stdin',
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
finally {
|
|
72
|
-
if (descriptor)
|
|
73
|
-
Object.defineProperty(process, 'stdin', descriptor);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
it('wraps stdin read failures as ValidationFailed', async () => {
|
|
77
|
-
const descriptor = Object.getOwnPropertyDescriptor(process, 'stdin');
|
|
78
|
-
const fakeStdin = {
|
|
79
|
-
isTTY: false,
|
|
80
|
-
async *[Symbol.asyncIterator]() {
|
|
81
|
-
throw 'stream failed';
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
Object.defineProperty(process, 'stdin', {
|
|
85
|
-
configurable: true,
|
|
86
|
-
value: fakeStdin,
|
|
87
|
-
});
|
|
88
|
-
try {
|
|
89
|
-
const err = await run(Effect.flip(readContentSpec('-')));
|
|
90
|
-
expect(err._tag).toBe('ValidationFailed');
|
|
91
|
-
expect(err.message).toContain('stream failed');
|
|
92
|
-
}
|
|
93
|
-
finally {
|
|
94
|
-
if (descriptor)
|
|
95
|
-
Object.defineProperty(process, 'stdin', descriptor);
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
describe('readJsonSpec', () => {
|
|
100
|
-
it('returns undefined when no JSON spec is provided', async () => {
|
|
101
|
-
await expect(run(readJsonSpec(undefined))).resolves.toBeUndefined();
|
|
102
|
-
});
|
|
103
|
-
it('parses inline JSON', async () => {
|
|
104
|
-
await expect(run(readJsonSpec('{"a":1}'))).resolves.toEqual({ a: 1 });
|
|
105
|
-
});
|
|
106
|
-
it('parses JSON from file=', async () => {
|
|
107
|
-
const filePath = path.join(tmpDir, 'meta.json');
|
|
108
|
-
await fs.writeFile(filePath, '{"tags":["a","b"]}', 'utf8');
|
|
109
|
-
await expect(run(readJsonSpec(`file=${filePath}`))).resolves.toEqual({
|
|
110
|
-
tags: ['a', 'b'],
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
it('reports invalid inline and file JSON as ValidationFailed', async () => {
|
|
114
|
-
const inlineErr = await run(Effect.flip(readJsonSpec('{')));
|
|
115
|
-
expect(inlineErr._tag).toBe('ValidationFailed');
|
|
116
|
-
const filePath = path.join(tmpDir, 'bad.json');
|
|
117
|
-
await fs.writeFile(filePath, '{', 'utf8');
|
|
118
|
-
const fileErr = await run(Effect.flip(readJsonSpec(`file=${filePath}`)));
|
|
119
|
-
expect(fileErr._tag).toBe('ValidationFailed');
|
|
120
|
-
});
|
|
121
|
-
it('wraps file read failures for JSON specs', async () => {
|
|
122
|
-
const err = await run(Effect.flip(readJsonSpec(`file=${path.join(tmpDir, 'missing.json')}`)));
|
|
123
|
-
expect(err._tag).toBe('ValidationFailed');
|
|
124
|
-
expect(err.message).toContain('failed to read JSON');
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { detectWireVersion, normalizeErrorBody, normalizeSuccessBody, } from '../../src/domain/envelope-compat';
|
|
3
|
-
describe('detectWireVersion', () => {
|
|
4
|
-
it('classifies V3 success envelope with meta', () => {
|
|
5
|
-
expect(detectWireVersion({ data: [], meta: {} })).toBe('v3');
|
|
6
|
-
});
|
|
7
|
-
it('classifies V3 error envelope by error.code', () => {
|
|
8
|
-
expect(detectWireVersion({ error: { code: 'POST_NOT_FOUND' } })).toBe('v3');
|
|
9
|
-
});
|
|
10
|
-
it('classifies V3 error envelope by error.message', () => {
|
|
11
|
-
expect(detectWireVersion({ error: { message: 'not found' } })).toBe('v3');
|
|
12
|
-
});
|
|
13
|
-
it('classifies V2 paginated body via root pagination', () => {
|
|
14
|
-
expect(detectWireVersion({
|
|
15
|
-
data: [],
|
|
16
|
-
pagination: { page: 1, size: 10, total: 0 },
|
|
17
|
-
})).toBe('v2');
|
|
18
|
-
});
|
|
19
|
-
it('classifies V2 error by root-level string message', () => {
|
|
20
|
-
expect(detectWireVersion({ message: 'oops' })).toBe('v2');
|
|
21
|
-
});
|
|
22
|
-
it('classifies V2 error by root-level array message', () => {
|
|
23
|
-
expect(detectWireVersion({ message: ['a', 'b'] })).toBe('v2');
|
|
24
|
-
});
|
|
25
|
-
it('returns null for scalar / null / array / non-object', () => {
|
|
26
|
-
expect(detectWireVersion(null)).toBeNull();
|
|
27
|
-
expect(detectWireVersion(42)).toBeNull();
|
|
28
|
-
expect(detectWireVersion('plain text')).toBeNull();
|
|
29
|
-
expect(detectWireVersion([1, 2, 3])).toBeNull();
|
|
30
|
-
expect(detectWireVersion(undefined)).toBeNull();
|
|
31
|
-
});
|
|
32
|
-
it('prefers V3 when both V2 and V3 markers are present', () => {
|
|
33
|
-
expect(detectWireVersion({
|
|
34
|
-
data: [],
|
|
35
|
-
pagination: { page: 1 },
|
|
36
|
-
meta: { pagination: { page: 1 } },
|
|
37
|
-
})).toBe('v3');
|
|
38
|
-
});
|
|
39
|
-
it('returns null for an empty object', () => {
|
|
40
|
-
expect(detectWireVersion({})).toBeNull();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
describe('normalizeSuccessBody', () => {
|
|
44
|
-
it('passes V3 envelope through unchanged', () => {
|
|
45
|
-
const input = { data: [{ id: '1' }], meta: { pagination: { page: 1 } } };
|
|
46
|
-
expect(normalizeSuccessBody(input)).toBe(input);
|
|
47
|
-
});
|
|
48
|
-
it('lifts V2 root pagination under meta', () => {
|
|
49
|
-
const input = {
|
|
50
|
-
data: [{ id: '1' }],
|
|
51
|
-
pagination: { page: 1, size: 10, total: 5 },
|
|
52
|
-
};
|
|
53
|
-
expect(normalizeSuccessBody(input)).toEqual({
|
|
54
|
-
data: [{ id: '1' }],
|
|
55
|
-
meta: { pagination: { page: 1, size: 10, total: 5 } },
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
it('passes a bare V2 { data } envelope through unchanged', () => {
|
|
59
|
-
const input = { data: { id: '1', title: 'hi' } };
|
|
60
|
-
expect(normalizeSuccessBody(input)).toBe(input);
|
|
61
|
-
});
|
|
62
|
-
it('passes a scalar / null / array through unchanged', () => {
|
|
63
|
-
expect(normalizeSuccessBody(42)).toBe(42);
|
|
64
|
-
expect(normalizeSuccessBody(null)).toBe(null);
|
|
65
|
-
const arr = [1, 2, 3];
|
|
66
|
-
expect(normalizeSuccessBody(arr)).toBe(arr);
|
|
67
|
-
});
|
|
68
|
-
it('passes an already-unwrapped document (no data key) through unchanged', () => {
|
|
69
|
-
const input = { id: '1', title: 'already unwrapped' };
|
|
70
|
-
expect(normalizeSuccessBody(input)).toBe(input);
|
|
71
|
-
});
|
|
72
|
-
it('does not mutate the input', () => {
|
|
73
|
-
const input = { data: [], pagination: { page: 1 } };
|
|
74
|
-
const snapshot = JSON.parse(JSON.stringify(input));
|
|
75
|
-
normalizeSuccessBody(input);
|
|
76
|
-
expect(input).toEqual(snapshot);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
describe('normalizeErrorBody', () => {
|
|
80
|
-
it('unwraps a V3 error envelope', () => {
|
|
81
|
-
expect(normalizeErrorBody({
|
|
82
|
-
error: {
|
|
83
|
-
code: 'POST_NOT_FOUND',
|
|
84
|
-
message: 'post not found',
|
|
85
|
-
details: { id: 'p1' },
|
|
86
|
-
},
|
|
87
|
-
})).toEqual({
|
|
88
|
-
code: 'POST_NOT_FOUND',
|
|
89
|
-
message: 'post not found',
|
|
90
|
-
details: { id: 'p1' },
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
it('flattens a V2 string-message error', () => {
|
|
94
|
-
expect(normalizeErrorBody({ message: 'oops', code: 'BAD' })).toEqual({
|
|
95
|
-
code: 'BAD',
|
|
96
|
-
message: 'oops',
|
|
97
|
-
details: undefined,
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
it('joins a V2 array-message error with "; "', () => {
|
|
101
|
-
expect(normalizeErrorBody({ message: ['a', 'b'] })).toEqual({
|
|
102
|
-
code: undefined,
|
|
103
|
-
message: 'a; b',
|
|
104
|
-
details: undefined,
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
it('returns empty object for non-object body', () => {
|
|
108
|
-
expect(normalizeErrorBody(null)).toEqual({});
|
|
109
|
-
expect(normalizeErrorBody(42)).toEqual({});
|
|
110
|
-
expect(normalizeErrorBody('plain')).toEqual({});
|
|
111
|
-
expect(normalizeErrorBody([1, 2, 3])).toEqual({});
|
|
112
|
-
});
|
|
113
|
-
it('preserves V2 details if present', () => {
|
|
114
|
-
expect(normalizeErrorBody({ message: 'x', details: { field: 'y' } })).toEqual({ code: undefined, message: 'x', details: { field: 'y' } });
|
|
115
|
-
});
|
|
116
|
-
it('ignores non-string V2 message', () => {
|
|
117
|
-
expect(normalizeErrorBody({ message: 42 })).toEqual({
|
|
118
|
-
code: undefined,
|
|
119
|
-
message: undefined,
|
|
120
|
-
details: undefined,
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
it('ignores non-string V3 error.code / error.message', () => {
|
|
124
|
-
expect(normalizeErrorBody({ error: { code: 42, message: { x: 1 } } })).toEqual({ code: undefined, message: undefined, details: undefined });
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|