@velastack/patterns 0.13.0 → 0.13.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/chunks/{_layout-DQhSAhfF.js → _layout-xBzFhszN.js} +36 -20
- package/dist/chunks/_layout-xBzFhszN.js.map +1 -0
- package/dist/chunks/{_page-C7kGoW7_.js → _page-44USwLXO.js} +2 -3
- package/dist/chunks/{_page-C7kGoW7_.js.map → _page-44USwLXO.js.map} +1 -1
- package/dist/chunks/{_page-DoPdZgZv.js → _page-Bt37d4uo.js} +2 -3
- package/dist/chunks/_page-Bt37d4uo.js.map +1 -0
- package/dist/chunks/{_page-B6yd6_Vl.js → _page-DcbEFpyw.js} +2 -3
- package/dist/chunks/_page-DcbEFpyw.js.map +1 -0
- package/dist/chunks/{auth-pages-jsyDV1GR.js → auth-pages-BW3_yluN.js} +6 -9
- package/dist/chunks/{auth-pages-jsyDV1GR.js.map → auth-pages-BW3_yluN.js.map} +1 -1
- package/dist/chunks/{collections-DZOuRpvS.js → collections-CFW9ZqUE.js} +5 -7
- package/dist/chunks/{collections-DZOuRpvS.js.map → collections-CFW9ZqUE.js.map} +1 -1
- package/dist/chunks/{collections-zEoRuILr.js → collections-D-xbHi4M.js} +39 -45
- package/dist/chunks/{collections-zEoRuILr.js.map → collections-D-xbHi4M.js.map} +1 -1
- package/dist/chunks/{compose-handle-BBlamPfx.js → compose-handle-Da7m6lV_.js} +3 -4
- package/dist/chunks/{compose-handle-BBlamPfx.js.map → compose-handle-Da7m6lV_.js.map} +1 -1
- package/dist/chunks/{config-target-BgyFkbFL.js → config-target-DJbVHwHl.js} +3 -4
- package/dist/chunks/{config-target-BgyFkbFL.js.map → config-target-DJbVHwHl.js.map} +1 -1
- package/dist/chunks/{constants-CUv536Rj.js → constants-DpK-r_m5.js} +2 -4
- package/dist/chunks/{constants-CUv536Rj.js.map → constants-DpK-r_m5.js.map} +1 -1
- package/dist/chunks/{currency.server-DygAf6a1.js → currency.server-BwuXG0a9.js} +9 -11
- package/dist/chunks/{currency.server-DygAf6a1.js.map → currency.server-BwuXG0a9.js.map} +1 -1
- package/dist/chunks/{dedent-Gq6Krl4n.js → dedent-CCUOcPFW.js} +2 -3
- package/dist/chunks/{dedent-Gq6Krl4n.js.map → dedent-CCUOcPFW.js.map} +1 -1
- package/dist/chunks/{dispatch-BIvOwbKN.js → dispatch-BxlKS_5v.js} +2 -3
- package/dist/chunks/{dispatch-BIvOwbKN.js.map → dispatch-BxlKS_5v.js.map} +1 -1
- package/dist/chunks/{env-BugddEjd.js → env-AxyRWcC_.js} +2 -3
- package/dist/chunks/{env-BugddEjd.js.map → env-AxyRWcC_.js.map} +1 -1
- package/dist/chunks/{env-vars-mnRA0hOe.js → env-vars-CUh4mLM_.js} +2 -3
- package/dist/chunks/{env-vars-mnRA0hOe.js.map → env-vars-CUh4mLM_.js.map} +1 -1
- package/dist/chunks/{env-vars-XvAeH6u5.js → env-vars-CVn2076k.js} +58 -59
- package/dist/chunks/{env-vars-XvAeH6u5.js.map → env-vars-CVn2076k.js.map} +1 -1
- package/dist/chunks/{env-vars-Cr4lbMD_.js → env-vars-T3_7JNSg.js} +3 -4
- package/dist/chunks/{env-vars-Cr4lbMD_.js.map → env-vars-T3_7JNSg.js.map} +1 -1
- package/dist/chunks/{env-vars-file-B_6esJW3.js → env-vars-file-B2zHQZqO.js} +2 -3
- package/dist/chunks/{env-vars-file-B_6esJW3.js.map → env-vars-file-B2zHQZqO.js.map} +1 -1
- package/dist/chunks/{env.preview-uMRKT5Pc.js → env.preview-C676UTOP.js} +2 -3
- package/dist/chunks/{env.preview-uMRKT5Pc.js.map → env.preview-C676UTOP.js.map} +1 -1
- package/dist/chunks/{errors-DR3gF_7a.js → errors-DdSUZI8f.js} +2 -3
- package/dist/chunks/{errors-DR3gF_7a.js.map → errors-DdSUZI8f.js.map} +1 -1
- package/dist/chunks/{format-result-BVoLVknk.js → format-result-CojavkIZ.js} +2 -3
- package/dist/chunks/{format-result-BVoLVknk.js.map → format-result-CojavkIZ.js.map} +1 -1
- package/dist/chunks/{generate-Cbg-Z3sA.js → generate-BCYvhyF9.js} +62 -63
- package/dist/chunks/{generate-Cbg-Z3sA.js.map → generate-BCYvhyF9.js.map} +1 -1
- package/dist/chunks/{generate-DyV5R8NP.js → generate-CKuUg3p-.js} +3 -4
- package/dist/chunks/{generate-DyV5R8NP.js.map → generate-CKuUg3p-.js.map} +1 -1
- package/dist/chunks/{generate-DjuhSibA.js → generate-CY_Ii_bz.js} +61 -64
- package/dist/chunks/{generate-DjuhSibA.js.map → generate-CY_Ii_bz.js.map} +1 -1
- package/dist/chunks/generate-CuOm66dn.js +57 -0
- package/dist/chunks/{generate-BtWZCvuO.js.map → generate-CuOm66dn.js.map} +1 -1
- package/dist/chunks/{generate-BrOPb9tW.js → generate-DYq5Oj58.js} +3 -4
- package/dist/chunks/{generate-BrOPb9tW.js.map → generate-DYq5Oj58.js.map} +1 -1
- package/dist/chunks/{generate-Crdzw45a.js → generate-F4FDWvFo.js} +13 -14
- package/dist/chunks/{generate-Crdzw45a.js.map → generate-F4FDWvFo.js.map} +1 -1
- package/dist/chunks/{generate-DgZhFNjO.js → generate-oZ1QeqPr.js} +17 -19
- package/dist/chunks/{generate-DgZhFNjO.js.map → generate-oZ1QeqPr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-ByC9kOl2.js → generate.runtime-22jW8aVT.js} +37 -41
- package/dist/chunks/{generate.runtime-ByC9kOl2.js.map → generate.runtime-22jW8aVT.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BfQlxsWK.js → generate.runtime-B06rPt_j.js} +103 -108
- package/dist/chunks/{generate.runtime-BfQlxsWK.js.map → generate.runtime-B06rPt_j.js.map} +1 -1
- package/dist/chunks/{generate.runtime-s9ai7PxV.js → generate.runtime-B6FeCL5I.js} +85 -90
- package/dist/chunks/{generate.runtime-s9ai7PxV.js.map → generate.runtime-B6FeCL5I.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DzCVGruq.js → generate.runtime-BgGeOqYG.js} +19 -21
- package/dist/chunks/{generate.runtime-DzCVGruq.js.map → generate.runtime-BgGeOqYG.js.map} +1 -1
- package/dist/chunks/{generate.runtime-USnFqTbU.js → generate.runtime-Bv_16lWi.js} +94 -99
- package/dist/chunks/{generate.runtime-USnFqTbU.js.map → generate.runtime-Bv_16lWi.js.map} +1 -1
- package/dist/chunks/generate.runtime-Bz9z0VPR.js +108 -0
- package/dist/chunks/{generate.runtime-DVUj1LJK.js.map → generate.runtime-Bz9z0VPR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CHaE6Mm9.js → generate.runtime-C37djibw.js} +25 -27
- package/dist/chunks/{generate.runtime-CHaE6Mm9.js.map → generate.runtime-C37djibw.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BsjcGBme.js → generate.runtime-CM3bj0nP.js} +12 -14
- package/dist/chunks/{generate.runtime-BsjcGBme.js.map → generate.runtime-CM3bj0nP.js.map} +1 -1
- package/dist/chunks/generate.runtime-CMuxVUIY.js +46 -0
- package/dist/chunks/{generate.runtime-BfM3dX_R.js.map → generate.runtime-CMuxVUIY.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DRZDjZqw.js → generate.runtime-CVqPHddZ.js} +44 -46
- package/dist/chunks/generate.runtime-CVqPHddZ.js.map +1 -0
- package/dist/chunks/{generate.runtime-CEd3qCtW.js → generate.runtime-C_SdcnRs.js} +44 -47
- package/dist/chunks/generate.runtime-C_SdcnRs.js.map +1 -0
- package/dist/chunks/generate.runtime-Cco2mFW2.js +63 -0
- package/dist/chunks/{generate.runtime-taYl9Tg5.js.map → generate.runtime-Cco2mFW2.js.map} +1 -1
- package/dist/chunks/generate.runtime-Cg-dfN9B.js +48 -0
- package/dist/chunks/{generate.runtime-TKR-qAJM.js.map → generate.runtime-Cg-dfN9B.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DqYYJXAz.js → generate.runtime-CjqX4tDg.js} +5 -6
- package/dist/chunks/{generate.runtime-DqYYJXAz.js.map → generate.runtime-CjqX4tDg.js.map} +1 -1
- package/dist/chunks/generate.runtime-Cry-DBNl.js +111 -0
- package/dist/chunks/{generate.runtime-2GD2E1NK.js.map → generate.runtime-Cry-DBNl.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DGmpjkRe.js → generate.runtime-Ct7cG8va.js} +76 -79
- package/dist/chunks/generate.runtime-Ct7cG8va.js.map +1 -0
- package/dist/chunks/generate.runtime-Cxg1b_BK.js +63 -0
- package/dist/chunks/{generate.runtime-CXGiQWDK.js.map → generate.runtime-Cxg1b_BK.js.map} +1 -1
- package/dist/chunks/{generate.runtime-4TxcYKld.js → generate.runtime-CyWuhV6m.js} +16 -18
- package/dist/chunks/{generate.runtime-4TxcYKld.js.map → generate.runtime-CyWuhV6m.js.map} +1 -1
- package/dist/chunks/generate.runtime-CzYArKUA.js +42 -0
- package/dist/chunks/{generate.runtime-g6qaIY3k.js.map → generate.runtime-CzYArKUA.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C_5Ghjri.js → generate.runtime-D769VJFt.js} +3 -4
- package/dist/chunks/{generate.runtime-C_5Ghjri.js.map → generate.runtime-D769VJFt.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C9yduilW.js → generate.runtime-DICcLOts.js} +19 -22
- package/dist/chunks/{generate.runtime-C9yduilW.js.map → generate.runtime-DICcLOts.js.map} +1 -1
- package/dist/chunks/generate.runtime-DLg2CKxQ.js +341 -0
- package/dist/chunks/generate.runtime-DLg2CKxQ.js.map +1 -0
- package/dist/chunks/{generate.runtime-C2pIioyZ.js → generate.runtime-DaPA2NNL.js} +47 -50
- package/dist/chunks/{generate.runtime-C2pIioyZ.js.map → generate.runtime-DaPA2NNL.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B2DI0x05.js → generate.runtime-DfHFd8xs.js} +36 -44
- package/dist/chunks/{generate.runtime-B2DI0x05.js.map → generate.runtime-DfHFd8xs.js.map} +1 -1
- package/dist/chunks/generate.runtime-Dfl-07VS.js +428 -0
- package/dist/chunks/generate.runtime-Dfl-07VS.js.map +1 -0
- package/dist/chunks/{generate.runtime-BO1KyRcJ.js → generate.runtime-DhNspd-h.js} +64 -76
- package/dist/chunks/generate.runtime-DhNspd-h.js.map +1 -0
- package/dist/chunks/{generate.runtime-BPVZsAL0.js → generate.runtime-DkS7CBmK.js} +8 -10
- package/dist/chunks/{generate.runtime-BPVZsAL0.js.map → generate.runtime-DkS7CBmK.js.map} +1 -1
- package/dist/chunks/generate.runtime-Dtae524O.js +34 -0
- package/dist/chunks/{generate.runtime-Du8puIJQ.js.map → generate.runtime-Dtae524O.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CvtSK0E1.js → generate.runtime-EB8vpc7D.js} +57 -66
- package/dist/chunks/{generate.runtime-CvtSK0E1.js.map → generate.runtime-EB8vpc7D.js.map} +1 -1
- package/dist/chunks/{generate.runtime-UrLaWKvN.js → generate.runtime-TCVlsBbJ.js} +7 -8
- package/dist/chunks/{generate.runtime-UrLaWKvN.js.map → generate.runtime-TCVlsBbJ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B8y_l-6N.js → generate.runtime-YFyuyFhh.js} +108 -132
- package/dist/chunks/generate.runtime-YFyuyFhh.js.map +1 -0
- package/dist/chunks/{generate.runtime-bWGwyz2U.js → generate.runtime-cYh0CQ5d.js} +36 -41
- package/dist/chunks/{generate.runtime-bWGwyz2U.js.map → generate.runtime-cYh0CQ5d.js.map} +1 -1
- package/dist/chunks/generate.runtime-erWI6j7m.js +64 -0
- package/dist/chunks/{generate.runtime-B-WOQsda.js.map → generate.runtime-erWI6j7m.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DI73x08q.js → generate.runtime-hq8xt0m_.js} +21 -23
- package/dist/chunks/generate.runtime-hq8xt0m_.js.map +1 -0
- package/dist/chunks/{generate.runtime-C4hyve9h.js → generate.runtime-i3tMIA1A.js} +85 -108
- package/dist/chunks/{generate.runtime-C4hyve9h.js.map → generate.runtime-i3tMIA1A.js.map} +1 -1
- package/dist/chunks/generate.runtime-j_5K3Uue.js +120 -0
- package/dist/chunks/generate.runtime-j_5K3Uue.js.map +1 -0
- package/dist/chunks/{generate.runtime-BEvi6bml.js → generate.runtime-mE0knt2T.js} +34 -38
- package/dist/chunks/{generate.runtime-BEvi6bml.js.map → generate.runtime-mE0knt2T.js.map} +1 -1
- package/dist/chunks/{layout.svelte-Cb12mxua.js → layout.svelte-B6wOQ7SM.js} +10 -11
- package/dist/chunks/{layout.svelte-Cb12mxua.js.map → layout.svelte-B6wOQ7SM.js.map} +1 -1
- package/dist/chunks/{lib-specifier-Cngo1zF_.js → lib-specifier-C3M0WTev.js} +2 -3
- package/dist/chunks/{lib-specifier-Cngo1zF_.js.map → lib-specifier-C3M0WTev.js.map} +1 -1
- package/dist/chunks/{load-function-Dmkhg1pQ.js → load-function-BFvIVsh7.js} +3 -4
- package/dist/chunks/{load-function-Dmkhg1pQ.js.map → load-function-BFvIVsh7.js.map} +1 -1
- package/dist/chunks/{logger-CQONztPm.js → logger-t1HxmpG2.js} +2 -3
- package/dist/chunks/{logger-CQONztPm.js.map → logger-t1HxmpG2.js.map} +1 -1
- package/dist/chunks/{modify-file-D9U2LXEa.js → modify-file-CRZ_gMg0.js} +7 -10
- package/dist/chunks/{modify-file-D9U2LXEa.js.map → modify-file-CRZ_gMg0.js.map} +1 -1
- package/dist/chunks/{modify-nav-user-CJ1LevSU.js → modify-nav-user--7OwY9fI.js} +7 -16
- package/dist/chunks/{modify-nav-user-CJ1LevSU.js.map → modify-nav-user--7OwY9fI.js.map} +1 -1
- package/dist/chunks/{modify-nav-user-iUpv2lm-.js → modify-nav-user-D42kWyU6.js} +8 -14
- package/dist/chunks/{modify-nav-user-iUpv2lm-.js.map → modify-nav-user-D42kWyU6.js.map} +1 -1
- package/dist/chunks/modify-svelte-config-remote-wE5K2bU_.js +20 -0
- package/dist/chunks/{modify-svelte-config-remote-CEyYydL7.js.map → modify-svelte-config-remote-wE5K2bU_.js.map} +1 -1
- package/dist/chunks/{modify-user-signup-DLtopazD.js → modify-user-signup-ENhadGKH.js} +5 -6
- package/dist/chunks/{modify-user-signup-DLtopazD.js.map → modify-user-signup-ENhadGKH.js.map} +1 -1
- package/dist/chunks/{modify-utils-Cw-on_cL.js → modify-utils--zro3IGe.js} +3 -4
- package/dist/chunks/{modify-utils-Cw-on_cL.js.map → modify-utils--zro3IGe.js.map} +1 -1
- package/dist/chunks/{package-imports-B9Asv3ZH.js → package-imports-CcIIHbp5.js} +3 -4
- package/dist/chunks/{package-imports-B9Asv3ZH.js.map → package-imports-CcIIHbp5.js.map} +1 -1
- package/dist/chunks/{pocketbase-C5GS-Dh5.js → pocketbase-CvsJYXj-.js} +2 -3
- package/dist/chunks/{pocketbase-C5GS-Dh5.js.map → pocketbase-CvsJYXj-.js.map} +1 -1
- package/dist/chunks/{pocketbase-DpudAAmd.js → pocketbase-YG9yht8R.js} +2 -3
- package/dist/chunks/{pocketbase-DpudAAmd.js.map → pocketbase-YG9yht8R.js.map} +1 -1
- package/dist/chunks/{pocketbase-BTR3gI8o.js → pocketbase-gUn2UrDd.js} +6 -14
- package/dist/chunks/{pocketbase-BTR3gI8o.js.map → pocketbase-gUn2UrDd.js.map} +1 -1
- package/dist/chunks/{providers-CpRRQdMg.js → providers-BB3Z2TrN.js} +4 -5
- package/dist/chunks/{providers-CpRRQdMg.js.map → providers-BB3Z2TrN.js.map} +1 -1
- package/dist/chunks/{providers-CL9kQ4hp.js → providers-tjlFH5di.js} +4 -5
- package/dist/chunks/{providers-CL9kQ4hp.js.map → providers-tjlFH5di.js.map} +1 -1
- package/dist/chunks/{rolldown-runtime-5HNE8Q1r.js → rolldown-runtime-CwxnZyOB.js} +1 -2
- package/dist/chunks/{root-layout.svelte-CUVbnlX-.js → root-layout.svelte-DE0c_y-T.js} +12 -16
- package/dist/chunks/{root-layout.svelte-CUVbnlX-.js.map → root-layout.svelte-DE0c_y-T.js.map} +1 -1
- package/dist/chunks/{shared-CAjLx_8Z.js → shared-DE-J_b1j.js} +4 -5
- package/dist/chunks/{shared-CAjLx_8Z.js.map → shared-DE-J_b1j.js.map} +1 -1
- package/dist/chunks/{site-D0IuWkAR.js → site-B9hDxucR.js} +11 -12
- package/dist/chunks/{site-D0IuWkAR.js.map → site-B9hDxucR.js.map} +1 -1
- package/dist/chunks/{stripe-customer-B3tP8gtD.js → stripe-customer-5S-nOXP1.js} +2 -3
- package/dist/chunks/stripe-customer-5S-nOXP1.js.map +1 -0
- package/dist/chunks/{svelte-file-Dv5-bl79.js → svelte-file-DfplF3BU.js} +2 -3
- package/dist/chunks/{svelte-file-Dv5-bl79.js.map → svelte-file-DfplF3BU.js.map} +1 -1
- package/dist/chunks/{table-core-BKBoEStB.js → table-core-BXmnfjln.js} +26 -33
- package/dist/chunks/{table-core-BKBoEStB.js.map → table-core-BXmnfjln.js.map} +1 -1
- package/dist/chunks/{taggedTemplateLiteral-KSUnuvOk.js → taggedTemplateLiteral-CLenToGE.js} +1 -2
- package/dist/chunks/test-setup-cZj1tqaf.js +176 -0
- package/dist/chunks/test-setup-cZj1tqaf.js.map +1 -0
- package/dist/chunks/{ts-morph-helpers-CHI9wAil.js → ts-morph-helpers-B4KZXP44.js} +2 -3
- package/dist/chunks/{ts-morph-helpers-CHI9wAil.js.map → ts-morph-helpers-B4KZXP44.js.map} +1 -1
- package/dist/chunks/{ui-DD4NltyN.js → ui-D5xgIDR_.js} +3 -4
- package/dist/chunks/{ui-DD4NltyN.js.map → ui-D5xgIDR_.js.map} +1 -1
- package/dist/chunks/{ui-B3Db8cQg.js → ui-IkdkLwmB.js} +53 -55
- package/dist/chunks/{ui-B3Db8cQg.js.map → ui-IkdkLwmB.js.map} +1 -1
- package/dist/chunks/{unmodify-load-Buak-r1f.js → unmodify-load-CdWXJ_Ac.js} +3 -4
- package/dist/chunks/{unmodify-load-Buak-r1f.js.map → unmodify-load-CdWXJ_Ac.js.map} +1 -1
- package/dist/chunks/{util-BLYliuUK.js → util-ILWdjRAd.js} +2 -3
- package/dist/chunks/{util-BLYliuUK.js.map → util-ILWdjRAd.js.map} +1 -1
- package/dist/chunks/{whatsapp-Pya8Zi07.js → whatsapp-Bt4o4_q2.js} +3 -4
- package/dist/chunks/{whatsapp-Pya8Zi07.js.map → whatsapp-Bt4o4_q2.js.map} +1 -1
- package/dist/chunks/write-result-C1GYInL8.js +499 -0
- package/dist/chunks/write-result-C1GYInL8.js.map +1 -0
- package/dist/chunks/{wuchale-config-c3Q4JVSF.js → wuchale-config-CNXoq4rc.js} +2 -3
- package/dist/chunks/{wuchale-config-c3Q4JVSF.js.map → wuchale-config-CNXoq4rc.js.map} +1 -1
- package/dist/index.js +1497 -1581
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_layout-DQhSAhfF.js.map +0 -1
- package/dist/chunks/_page-B6yd6_Vl.js.map +0 -1
- package/dist/chunks/_page-DoPdZgZv.js.map +0 -1
- package/dist/chunks/generate-BtWZCvuO.js +0 -58
- package/dist/chunks/generate.runtime-2GD2E1NK.js +0 -114
- package/dist/chunks/generate.runtime-7sU7RzIA.js +0 -483
- package/dist/chunks/generate.runtime-7sU7RzIA.js.map +0 -1
- package/dist/chunks/generate.runtime-B-WOQsda.js +0 -67
- package/dist/chunks/generate.runtime-B8y_l-6N.js.map +0 -1
- package/dist/chunks/generate.runtime-BO1KyRcJ.js.map +0 -1
- package/dist/chunks/generate.runtime-BfM3dX_R.js +0 -48
- package/dist/chunks/generate.runtime-CEd3qCtW.js.map +0 -1
- package/dist/chunks/generate.runtime-CXGiQWDK.js +0 -64
- package/dist/chunks/generate.runtime-DGmpjkRe.js.map +0 -1
- package/dist/chunks/generate.runtime-DI73x08q.js.map +0 -1
- package/dist/chunks/generate.runtime-DIkM5xIB.js +0 -326
- package/dist/chunks/generate.runtime-DIkM5xIB.js.map +0 -1
- package/dist/chunks/generate.runtime-DRZDjZqw.js.map +0 -1
- package/dist/chunks/generate.runtime-DVUj1LJK.js +0 -112
- package/dist/chunks/generate.runtime-Deg1Tz9u.js +0 -124
- package/dist/chunks/generate.runtime-Deg1Tz9u.js.map +0 -1
- package/dist/chunks/generate.runtime-Du8puIJQ.js +0 -35
- package/dist/chunks/generate.runtime-TKR-qAJM.js +0 -50
- package/dist/chunks/generate.runtime-g6qaIY3k.js +0 -43
- package/dist/chunks/generate.runtime-taYl9Tg5.js +0 -65
- package/dist/chunks/modify-svelte-config-remote-CEyYydL7.js +0 -42
- package/dist/chunks/stripe-customer-B3tP8gtD.js.map +0 -1
- package/dist/chunks/test-setup-CbCXmPkE.js +0 -179
- package/dist/chunks/test-setup-CbCXmPkE.js.map +0 -1
- package/dist/chunks/write-result-BWXq9RRn.js +0 -499
- package/dist/chunks/write-result-BWXq9RRn.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "./
|
|
3
|
-
import { n } from "./logger-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { _ as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./dispatch-BxlKS_5v.js";
|
|
2
|
+
import { t as s } from "./errors-DdSUZI8f.js";
|
|
3
|
+
import { n as c } from "./logger-t1HxmpG2.js";
|
|
4
|
+
import { n as l, r as u } from "./modify-file-CRZ_gMg0.js";
|
|
5
|
+
import { t as d } from "./dedent-CCUOcPFW.js";
|
|
6
|
+
import { _ as f, o as p, r as m } from "./ts-morph-helpers-B4KZXP44.js";
|
|
7
|
+
import { t as h } from "./svelte-file-DfplF3BU.js";
|
|
8
|
+
import { n as g } from "./modify-nav-user--7OwY9fI.js";
|
|
9
|
+
import { t as _ } from "./stripe-customer-5S-nOXP1.js";
|
|
10
10
|
import v from "node:fs";
|
|
11
11
|
import y from "node:path";
|
|
12
12
|
import { Project as b, QuoteKind as x, SyntaxKind as S } from "ts-morph";
|
|
13
|
-
|
|
14
|
-
var C =
|
|
13
|
+
// src/patterns/enable/subscriptions/modifies/modify-webhook-server.ts
|
|
14
|
+
var C = d`
|
|
15
15
|
Wire the subscription event handlers into src/routes/webhooks/stripe/handlers/dispatch.ts:
|
|
16
16
|
|
|
17
17
|
Add imports:
|
|
@@ -29,7 +29,7 @@ var C = t`
|
|
|
29
29
|
case "customer.subscription.deleted":
|
|
30
30
|
await handleSubscriptionDeleted(event.data.object, locals);
|
|
31
31
|
break;
|
|
32
|
-
`, w = "Enable payments first — src/routes/webhooks/stripe/handlers/dispatch.ts is created by enable-payments.", T =
|
|
32
|
+
`, w = "Enable payments first — src/routes/webhooks/stripe/handlers/dispatch.ts is created by enable-payments.", T = d`
|
|
33
33
|
case "customer.subscription.created":
|
|
34
34
|
await handleSubscriptionCreated(event.data.object, locals);
|
|
35
35
|
break;
|
|
@@ -52,8 +52,8 @@ function E(e) {
|
|
|
52
52
|
status: "success",
|
|
53
53
|
changed: !1
|
|
54
54
|
};
|
|
55
|
-
let n = !1, { source: r } =
|
|
56
|
-
|
|
55
|
+
let n = !1, { source: r } = f(t, (e) => {
|
|
56
|
+
m(e, [
|
|
57
57
|
{
|
|
58
58
|
namedImports: ["handleSubscriptionCreated"],
|
|
59
59
|
moduleSpecifier: "./subscription/created"
|
|
@@ -75,7 +75,7 @@ function E(e) {
|
|
|
75
75
|
let e = r[r.length - 1];
|
|
76
76
|
e.replaceWithText(e.getText() + `\n\n${T}`);
|
|
77
77
|
} else return;
|
|
78
|
-
|
|
78
|
+
p(e), n = !0;
|
|
79
79
|
});
|
|
80
80
|
return n ? (v.writeFileSync(e, r, "utf8"), {
|
|
81
81
|
status: "success",
|
|
@@ -85,9 +85,8 @@ function E(e) {
|
|
|
85
85
|
message: C
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var D = "const subscription = await loadActiveSubscription(locals, user.id);", O = ["Create src/routes/(app)/+layout.server.ts before enabling subscriptions.", "Enable auth first — the (app) layout is provided by the velastack-auth baseline."].join("\n"), k = (e) => [
|
|
88
|
+
// src/patterns/enable/subscriptions/modifies/modify-app-layout-server.ts
|
|
89
|
+
var D = "const subscription = await loadActiveSubscription(locals, user.id);", O = "Create src/routes/(app)/+layout.server.ts before enabling subscriptions.\nEnable auth first — the (app) layout is provided by the velastack-auth baseline.", k = (e) => [
|
|
91
90
|
"Could not find the user and the returned object in the (app) layout load.",
|
|
92
91
|
"Add the active subscription to it by hand:",
|
|
93
92
|
"",
|
|
@@ -133,33 +132,28 @@ function M(e, t) {
|
|
|
133
132
|
status: "failed",
|
|
134
133
|
message: k(r)
|
|
135
134
|
};
|
|
136
|
-
let s = o.asKindOrThrow(S.Block), c = a.fn.getParameters()[0]?.getNameNode(), l = c?.getKind() === S.ObjectBindingPattern && c.asKindOrThrow(S.ObjectBindingPattern).getElements().some((e) => e.getName() === "locals"), u = s.getStatements().findIndex((e) => e.getKind() === S.VariableStatement && e.asKindOrThrow(S.VariableStatement).getDeclarations().some((e) => e.getName() === "user")), d = s.getStatements(),
|
|
137
|
-
if (!l || u === -1 || !
|
|
135
|
+
let s = o.asKindOrThrow(S.Block), c = a.fn.getParameters()[0]?.getNameNode(), l = c?.getKind() === S.ObjectBindingPattern && c.asKindOrThrow(S.ObjectBindingPattern).getElements().some((e) => e.getName() === "locals"), u = s.getStatements().findIndex((e) => e.getKind() === S.VariableStatement && e.asKindOrThrow(S.VariableStatement).getDeclarations().some((e) => e.getName() === "user")), d = s.getStatements(), f = [...d].reverse().find((e) => e.getKind() === S.ReturnStatement)?.asKind(S.ReturnStatement), m = f?.getExpression()?.asKind(S.ObjectLiteralExpression);
|
|
136
|
+
if (!l || u === -1 || !f || !m) return {
|
|
138
137
|
status: "failed",
|
|
139
138
|
message: k(r)
|
|
140
139
|
};
|
|
141
|
-
if (s.insertStatements(d.indexOf(
|
|
140
|
+
if (s.insertStatements(d.indexOf(f), D), !m.getProperty("subscription")) {
|
|
142
141
|
let e = m.getText();
|
|
143
142
|
e.includes("\n") ? m.addShorthandPropertyAssignment({ name: "subscription" }) : m.replaceWithText(e.replace(/\s*\}$/, ", subscription }"));
|
|
144
143
|
}
|
|
145
|
-
return a.fn.isAsync() || a.fn.setIsAsync(!0), i.insertStatements(i.getStatements().indexOf(a.statement), (e) => e.write(r).blankLine()),
|
|
144
|
+
return a.fn.isAsync() || a.fn.setIsAsync(!0), i.insertStatements(i.getStatements().indexOf(a.statement), (e) => e.write(r).blankLine()), p(i), i.saveSync(), {
|
|
146
145
|
status: "success",
|
|
147
146
|
changed: i.getFullText() !== n
|
|
148
147
|
};
|
|
149
148
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
var N = [
|
|
153
|
-
"Pass the subscription prop to <AppSidebar> in src/routes/(app)/+layout.svelte:",
|
|
154
|
-
"",
|
|
155
|
-
"<AppSidebar user={data.user} subscription={data.subscription} />"
|
|
156
|
-
].join("\n"), P = ["Create src/routes/(app)/+layout.svelte with an <AppSidebar /> that receives the subscription prop."].join("\n");
|
|
149
|
+
// src/patterns/enable/subscriptions/modifies/modify-app-layout-svelte.ts
|
|
150
|
+
var N = "Pass the subscription prop to <AppSidebar> in src/routes/(app)/+layout.svelte:\n\n<AppSidebar user={data.user} subscription={data.subscription} />", P = "Create src/routes/(app)/+layout.svelte with an <AppSidebar /> that receives the subscription prop.";
|
|
157
151
|
function F(e) {
|
|
158
152
|
if (!v.existsSync(e)) return {
|
|
159
153
|
status: "not-found",
|
|
160
154
|
message: P
|
|
161
155
|
};
|
|
162
|
-
let t =
|
|
156
|
+
let t = h.fromPath(e);
|
|
163
157
|
return t.hasElement("AppSidebar") ? t.hasAttribute("AppSidebar", "subscription") ? {
|
|
164
158
|
status: "success",
|
|
165
159
|
changed: !1
|
|
@@ -174,17 +168,16 @@ function F(e) {
|
|
|
174
168
|
message: N
|
|
175
169
|
};
|
|
176
170
|
}
|
|
177
|
-
|
|
178
|
-
//#region src/patterns/enable/subscriptions/modifies/modify-app-sidebar.ts
|
|
171
|
+
// src/patterns/enable/subscriptions/modifies/modify-app-sidebar.ts
|
|
179
172
|
var I = "{ id: string; productName: string | null } | null", L = [
|
|
180
173
|
"Update src/lib/components/app-sidebar.svelte to forward a subscription prop:",
|
|
181
174
|
"",
|
|
182
175
|
"1. Add `subscription = null` to the destructured $props() call.",
|
|
183
176
|
`2. Add \`subscription?: ${I}\` to the props type.`,
|
|
184
177
|
"3. Pass `{subscription}` to <NavUser>."
|
|
185
|
-
].join("\n"), R =
|
|
178
|
+
].join("\n"), R = "Create src/lib/components/app-sidebar.svelte before enabling subscriptions.";
|
|
186
179
|
function z(e) {
|
|
187
|
-
let t = !1, { source: n } =
|
|
180
|
+
let t = !1, { source: n } = f(e, (e) => {
|
|
188
181
|
for (let n of e.getVariableDeclarations()) {
|
|
189
182
|
let e = n.getInitializer();
|
|
190
183
|
if (!e || e.getText() !== "$props()") continue;
|
|
@@ -207,7 +200,7 @@ function z(e) {
|
|
|
207
200
|
let s = a.map((e) => e.getText()), c = a.findIndex((e) => e.getDotDotDotToken() || e.getInitializer());
|
|
208
201
|
c === -1 && (c = s.length), s.splice(c, 0, "subscription = null"), i.replaceWithText(`{ ${s.join(", ")} }`), t = !0;
|
|
209
202
|
}
|
|
210
|
-
|
|
203
|
+
p(e);
|
|
211
204
|
});
|
|
212
205
|
return {
|
|
213
206
|
source: n,
|
|
@@ -224,7 +217,7 @@ function B(e) {
|
|
|
224
217
|
status: "success",
|
|
225
218
|
changed: !1
|
|
226
219
|
};
|
|
227
|
-
let n = new
|
|
220
|
+
let n = new h(t);
|
|
228
221
|
if (!n.hasElement("NavUser")) return {
|
|
229
222
|
status: "failed",
|
|
230
223
|
message: L
|
|
@@ -238,8 +231,7 @@ function B(e) {
|
|
|
238
231
|
changed: n.hasChanged()
|
|
239
232
|
});
|
|
240
233
|
}
|
|
241
|
-
|
|
242
|
-
//#region src/patterns/enable/subscriptions/modifies/modify-by-template.ts
|
|
234
|
+
// src/patterns/enable/subscriptions/modifies/modify-by-template.ts
|
|
243
235
|
function V(e, t, n, r) {
|
|
244
236
|
if (!v.existsSync(e)) return {
|
|
245
237
|
status: "not-found",
|
|
@@ -259,23 +251,20 @@ function V(e, t, n, r) {
|
|
|
259
251
|
changed: !0
|
|
260
252
|
});
|
|
261
253
|
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
var H = ["src/routes/(app)/billing/+page.server.ts is missing.", "Enable payments first — subscriptions extends the billing page with plan management."].join("\n");
|
|
254
|
+
// src/patterns/enable/subscriptions/modifies/modify-billing-page-server.ts
|
|
255
|
+
var H = "src/routes/(app)/billing/+page.server.ts is missing.\nEnable payments first — subscriptions extends the billing page with plan management.";
|
|
265
256
|
function U(e, t) {
|
|
266
257
|
return V(e, t, "selectPlan", H);
|
|
267
258
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var W = ["src/routes/(app)/billing/+page.svelte is missing.", "Enable payments first — subscriptions extends the billing page with plan management."].join("\n");
|
|
259
|
+
// src/patterns/enable/subscriptions/modifies/modify-billing-page-svelte.ts
|
|
260
|
+
var W = "src/routes/(app)/billing/+page.svelte is missing.\nEnable payments first — subscriptions extends the billing page with plan management.";
|
|
271
261
|
function G(e, t) {
|
|
272
262
|
return V(e, t, "availablePlans", W);
|
|
273
263
|
}
|
|
274
|
-
|
|
275
|
-
//#region src/patterns/enable/subscriptions/generate.runtime.ts
|
|
264
|
+
// src/patterns/enable/subscriptions/generate.runtime.ts
|
|
276
265
|
var K = "src/lib/server/stripe-customer.ts", q = "src/routes/(app)/billing/+page.server.ts";
|
|
277
|
-
function J(
|
|
278
|
-
if (!v.existsSync(y.join(
|
|
266
|
+
function J(e) {
|
|
267
|
+
if (!v.existsSync(y.join(e, q))) throw new s([
|
|
279
268
|
"Subscriptions need payments set up with auth on: they add plans to the billing page",
|
|
280
269
|
`(${q}) and link to the stripe_customers collection, which enable-payments`,
|
|
281
270
|
"creates only when auth is already enabled. This project enabled payments before auth.",
|
|
@@ -285,13 +274,13 @@ function J(t) {
|
|
|
285
274
|
].join("\n"));
|
|
286
275
|
}
|
|
287
276
|
var Y = /* #__PURE__ */ Object.assign({
|
|
288
|
-
"./preview-modifies/src/lib/components/app-sidebar.svelte":
|
|
289
|
-
"./preview-modifies/src/lib/components/nav-user.svelte":
|
|
290
|
-
"./preview-modifies/src/routes/(app)/+layout.server.ts":
|
|
291
|
-
"./preview-modifies/src/routes/(app)/+layout.svelte":
|
|
292
|
-
"./preview-modifies/src/routes/(app)/billing/+page.server.ts":
|
|
293
|
-
"./preview-modifies/src/routes/(app)/billing/+page.svelte":
|
|
294
|
-
"./preview-modifies/src/routes/webhooks/stripe/handlers/dispatch.ts":
|
|
277
|
+
"./preview-modifies/src/lib/components/app-sidebar.svelte": a,
|
|
278
|
+
"./preview-modifies/src/lib/components/nav-user.svelte": r,
|
|
279
|
+
"./preview-modifies/src/routes/(app)/+layout.server.ts": e,
|
|
280
|
+
"./preview-modifies/src/routes/(app)/+layout.svelte": t,
|
|
281
|
+
"./preview-modifies/src/routes/(app)/billing/+page.server.ts": i,
|
|
282
|
+
"./preview-modifies/src/routes/(app)/billing/+page.svelte": n,
|
|
283
|
+
"./preview-modifies/src/routes/webhooks/stripe/handlers/dispatch.ts": o
|
|
295
284
|
});
|
|
296
285
|
function X(e) {
|
|
297
286
|
let t = Y[`./preview-modifies/${e}`];
|
|
@@ -299,31 +288,31 @@ function X(e) {
|
|
|
299
288
|
return t;
|
|
300
289
|
}
|
|
301
290
|
async function Z(e) {
|
|
302
|
-
let t =
|
|
303
|
-
e &&
|
|
291
|
+
let t = c(e), n = [], r = (e) => {
|
|
292
|
+
e && n.push(e);
|
|
304
293
|
};
|
|
305
294
|
t.info("Modifying webhooks/stripe/handlers/dispatch.ts");
|
|
306
|
-
let
|
|
307
|
-
|
|
308
|
-
let
|
|
309
|
-
|
|
310
|
-
let
|
|
311
|
-
|
|
312
|
-
let
|
|
313
|
-
|
|
314
|
-
let
|
|
315
|
-
|
|
316
|
-
let
|
|
317
|
-
|
|
318
|
-
let
|
|
319
|
-
return
|
|
320
|
-
creates:
|
|
295
|
+
let i = y.join(e.root, "src", "routes", "webhooks", "stripe", "handlers", "dispatch.ts");
|
|
296
|
+
r(u(i, E(i))), t.info("Modifying (app)/+layout.server.ts");
|
|
297
|
+
let a = y.join(e.root, "src", "routes", "(app)", "+layout.server.ts");
|
|
298
|
+
r(u(a, M(a, X("src/routes/(app)/+layout.server.ts")))), t.info("Modifying (app)/+layout.svelte");
|
|
299
|
+
let o = y.join(e.root, "src", "routes", "(app)", "+layout.svelte");
|
|
300
|
+
r(u(o, F(o))), t.info("Modifying app-sidebar.svelte");
|
|
301
|
+
let s = y.join(e.root, "src", "lib", "components", "app-sidebar.svelte");
|
|
302
|
+
r(u(s, B(s))), t.info("Modifying nav-user.svelte");
|
|
303
|
+
let d = y.join(e.root, "src", "lib", "components", "nav-user.svelte");
|
|
304
|
+
r(u(d, g(d))), t.info("Modifying billing/+page.server.ts");
|
|
305
|
+
let f = y.join(e.root, "src", "routes", "(app)", "billing", "+page.server.ts");
|
|
306
|
+
r(u(f, U(f, X("src/routes/(app)/billing/+page.server.ts")))), t.info("Modifying billing/+page.svelte");
|
|
307
|
+
let p = y.join(e.root, "src", "routes", "(app)", "billing", "+page.svelte");
|
|
308
|
+
return r(u(p, G(p, X("src/routes/(app)/billing/+page.svelte")))), {
|
|
309
|
+
creates: l([{
|
|
321
310
|
path: K,
|
|
322
311
|
language: "ts",
|
|
323
|
-
content:
|
|
312
|
+
content: _,
|
|
324
313
|
status: "success"
|
|
325
314
|
}], e.root),
|
|
326
|
-
modifies:
|
|
315
|
+
modifies: n,
|
|
327
316
|
deletes: [],
|
|
328
317
|
components: [],
|
|
329
318
|
packages: [],
|
|
@@ -332,7 +321,6 @@ async function Z(e) {
|
|
|
332
321
|
collectionDrops: []
|
|
333
322
|
};
|
|
334
323
|
}
|
|
335
|
-
//#endregion
|
|
336
324
|
export { J as assertPaymentsAppMode, Z as generate };
|
|
337
325
|
|
|
338
|
-
//# sourceMappingURL=generate.runtime-
|
|
326
|
+
//# sourceMappingURL=generate.runtime-DhNspd-h.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.runtime-DhNspd-h.js","names":["FAILURE_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","FAILURE_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","NOT_FOUND_HINT","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","stripeCustomerHelper","_layout_server_default","_layout_default","nav_user_default","_page_server_default","app_sidebar_default","dispatch_default","InvalidArgumentError","getLogger","keepMissing","modifyOutcomeToFile","dedent","withInMemoryScript","formatLikeSource","ensureImports","SvelteFile","modifyNavUser","stripe_customer_default","fs","path","FAILURE_HINT$2","NOT_FOUND_HINT$5","SUBSCRIPTION_CASES_SNIPPET","modifyWebhookServer","filePath","original","addedCases","sf","switchStmt","SyntaxKind","stmt","clauses","defaultClause","c","prefix","last","source","LOAD_LINE","NOT_FOUND_HINT$4","failureHint","helper","helperFrom","clean","template","start","end","findLoad","varDecl","init","fn","modifyAppLayoutServer","Project","QuoteKind","load","body","block","binding","hasLocals","el","userIndex","s","d","statements","ret","returned","text","writer","FAILURE_HINT$1","NOT_FOUND_HINT$3","modifyAppLayoutSvelte","file","SUBSCRIPTION_TYPE","FAILURE_HINT","NOT_FOUND_HINT$2","updateScript","wasAdded","out","decl","nameNode","pattern","elements","typeNode","intersection","member","lit","propTexts","p","t","elementTexts","insertIdx","modifyAppSidebar","scriptChanged","src","templateChanged","modifyByTemplate","notFoundHint","current","idempotencyMarker","stripped","NOT_FOUND_HINT$1","modifyBillingPageServer","NOT_FOUND_HINT","modifyBillingPageSvelte","STRIPE_CUSTOMER_HELPER","BILLING_PAGE","assertPaymentsAppMode","root","previewRaw","_page_default","content","relativePath","generate","logger","options","modifies","pushResult","webhookServerPath","appLayoutServerPath","appLayoutSveltePath","appSidebarPath","navUserPath","billingPageServerPath","billingPageSveltePath"],"sources":["../../src/patterns/enable/subscriptions/modifies/modify-webhook-server.ts","../../src/patterns/enable/subscriptions/modifies/modify-app-layout-server.ts","../../src/patterns/enable/subscriptions/modifies/modify-app-layout-svelte.ts","../../src/patterns/enable/subscriptions/modifies/modify-app-sidebar.ts","../../src/patterns/enable/subscriptions/modifies/modify-by-template.ts","../../src/patterns/enable/subscriptions/modifies/modify-billing-page-server.ts","../../src/patterns/enable/subscriptions/modifies/modify-billing-page-svelte.ts","../../src/patterns/enable/subscriptions/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport dedent from \"dedent\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport {\n ensureImports,\n withInMemoryScript,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\n\nconst FAILURE_HINT = dedent`\n Wire the subscription event handlers into src/routes/webhooks/stripe/handlers/dispatch.ts:\n\n Add imports:\n import { handleSubscriptionCreated } from \"./subscription/created\";\n import { handleSubscriptionUpdated } from \"./subscription/updated\";\n import { handleSubscriptionDeleted } from \"./subscription/deleted\";\n\n Add switch cases inside the event.type switch:\n case \"customer.subscription.created\":\n await handleSubscriptionCreated(event.data.object, locals);\n break;\n case \"customer.subscription.updated\":\n await handleSubscriptionUpdated(event.data.object, locals);\n break;\n case \"customer.subscription.deleted\":\n await handleSubscriptionDeleted(event.data.object, locals);\n break;\n`;\n\nconst NOT_FOUND_HINT =\n \"Enable payments first — src/routes/webhooks/stripe/handlers/dispatch.ts is created by enable-payments.\";\n\nconst SUBSCRIPTION_CASES_SNIPPET = dedent`\n case \"customer.subscription.created\":\n await handleSubscriptionCreated(event.data.object, locals);\n break;\n\n case \"customer.subscription.updated\":\n await handleSubscriptionUpdated(event.data.object, locals);\n break;\n\n case \"customer.subscription.deleted\":\n await handleSubscriptionDeleted(event.data.object, locals);\n break;\n`;\n\nexport function modifyWebhookServer(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(filePath, \"utf8\");\n if (original.includes(\"handleSubscriptionCreated\")) {\n return { status: \"success\", changed: false };\n }\n\n let addedCases = false;\n const { source } = withInMemoryScript(original, (sf) => {\n ensureImports(sf, [\n {\n namedImports: [\"handleSubscriptionCreated\"],\n moduleSpecifier: \"./subscription/created\",\n },\n {\n namedImports: [\"handleSubscriptionUpdated\"],\n moduleSpecifier: \"./subscription/updated\",\n },\n {\n namedImports: [\"handleSubscriptionDeleted\"],\n moduleSpecifier: \"./subscription/deleted\",\n },\n ]);\n\n const switchStmt = sf\n .getDescendantsOfKind(SyntaxKind.SwitchStatement)\n .find((stmt) => stmt.getExpression().getText().includes(\"event.type\"));\n if (!switchStmt) return;\n\n const caseBlock = switchStmt.getCaseBlock();\n const clauses = caseBlock.getClauses();\n const defaultClause = clauses.find(\n (c) => c.getKind() === SyntaxKind.DefaultClause,\n );\n\n // Prepend subscription cases in front of the default clause, or append\n // before the closing brace of the case block if there's no default.\n const prefix = `${SUBSCRIPTION_CASES_SNIPPET}\\n\\n`;\n if (defaultClause) {\n defaultClause.replaceWithText(prefix + defaultClause.getText());\n } else if (clauses.length > 0) {\n const last = clauses[clauses.length - 1];\n last.replaceWithText(\n last.getText() + `\\n\\n${SUBSCRIPTION_CASES_SNIPPET}`,\n );\n } else {\n return;\n }\n\n formatLikeSource(sf);\n addedCases = true;\n });\n\n if (!addedCases) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n fs.writeFileSync(filePath, source, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport { Project, QuoteKind, SyntaxKind, type SourceFile } from \"ts-morph\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\nimport { formatLikeSource } from \"../../../../runtime/ts-morph-helpers\";\n\nconst LOAD_LINE =\n \"const subscription = await loadActiveSubscription(locals, user.id);\";\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(app)/+layout.server.ts before enabling subscriptions.\",\n \"Enable auth first — the (app) layout is provided by the velastack-auth baseline.\",\n].join(\"\\n\");\n\nconst failureHint = (helper: string) =>\n [\n \"Could not find the user and the returned object in the (app) layout load.\",\n \"Add the active subscription to it by hand:\",\n \"\",\n helper,\n \"\",\n \"// In load, once `user` is set:\",\n LOAD_LINE,\n \"// ...and return it with the rest:\",\n \"return { ..., subscription };\",\n ].join(\"\\n\");\n\n/**\n * The `loadActiveSubscription` helper, taken from the preview template so the\n * docs and what gets written stay the same.\n */\nfunction helperFrom(template: string): string {\n const clean = template.replace(\n /^[ \\t]*\\/\\/[ \\t]*\\[!code highlight:\\d+\\][ \\t]*\\r?\\n/gm,\n \"\",\n );\n const start = clean.indexOf(\"async function loadActiveSubscription\");\n const end = clean.indexOf(\"\\n}\\n\", start);\n if (start === -1 || end === -1) {\n throw new Error(\"No loadActiveSubscription in the layout template\");\n }\n return clean.slice(start, end + 2);\n}\n\nfunction findLoad(sf: SourceFile) {\n const varDecl = sf.getVariableDeclaration(\"load\");\n if (varDecl?.getVariableStatement()?.hasExportKeyword()) {\n const init = varDecl.getInitializer();\n const fn =\n varDecl.getInitializerIfKind(SyntaxKind.ArrowFunction) ??\n init?.getFirstDescendantByKind(SyntaxKind.ArrowFunction) ??\n init?.getFirstDescendantByKind(SyntaxKind.FunctionExpression);\n if (fn) return { fn, statement: varDecl.getVariableStatement()! };\n }\n const fn = sf.getFunction(\"load\");\n return fn?.isExported() ? { fn, statement: fn } : undefined;\n}\n\n/**\n * Adds the active subscription to the (app) layout's data: the\n * `loadActiveSubscription` helper, a call to it in `load`, and `subscription`\n * in what `load` returns. Edits the file rather than replacing it, so what\n * other patterns put in the load (teams' `team`/`teams`, say) stays.\n */\nexport function modifyAppLayoutServer(\n filePath: string,\n template: string,\n): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n const original = fs.readFileSync(filePath, \"utf8\");\n if (original.includes(\"loadActiveSubscription\")) {\n return { status: \"success\", changed: false };\n }\n\n const helper = helperFrom(template);\n const project = new Project({\n manipulationSettings: { quoteKind: QuoteKind.Single },\n });\n const sf = project.addSourceFileAtPath(filePath);\n const load = findLoad(sf);\n const body = load?.fn.getBody();\n if (!load || !body || body.getKind() !== SyntaxKind.Block) {\n return { status: \"failed\", message: failureHint(helper) };\n }\n const block = body.asKindOrThrow(SyntaxKind.Block);\n\n // The call needs `locals` and `user`, and goes before the return.\n const params = load.fn.getParameters();\n const binding = params[0]?.getNameNode();\n const hasLocals =\n binding?.getKind() === SyntaxKind.ObjectBindingPattern &&\n binding\n .asKindOrThrow(SyntaxKind.ObjectBindingPattern)\n .getElements()\n .some((el) => el.getName() === \"locals\");\n const userIndex = block.getStatements().findIndex(\n (s) =>\n s.getKind() === SyntaxKind.VariableStatement &&\n s\n .asKindOrThrow(SyntaxKind.VariableStatement)\n .getDeclarations()\n .some((d) => d.getName() === \"user\"),\n );\n const statements = block.getStatements();\n const ret = [...statements]\n .reverse()\n .find((s) => s.getKind() === SyntaxKind.ReturnStatement)\n ?.asKind(SyntaxKind.ReturnStatement);\n const returned = ret\n ?.getExpression()\n ?.asKind(SyntaxKind.ObjectLiteralExpression);\n if (!hasLocals || userIndex === -1 || !ret || !returned) {\n return { status: \"failed\", message: failureHint(helper) };\n }\n\n block.insertStatements(statements.indexOf(ret), LOAD_LINE);\n if (!returned.getProperty(\"subscription\")) {\n const text = returned.getText();\n if (text.includes(\"\\n\")) {\n returned.addShorthandPropertyAssignment({ name: \"subscription\" });\n } else {\n // Kept on one line, as written.\n returned.replaceWithText(text.replace(/\\s*\\}$/, \", subscription }\"));\n }\n }\n if (!load.fn.isAsync()) load.fn.setIsAsync(true);\n sf.insertStatements(sf.getStatements().indexOf(load.statement), (writer) =>\n writer.write(helper).blankLine(),\n );\n\n formatLikeSource(sf);\n sf.saveSync();\n return { status: \"success\", changed: sf.getFullText() !== original };\n}\n","import fs from \"node:fs\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst FAILURE_HINT = [\n \"Pass the subscription prop to <AppSidebar> in src/routes/(app)/+layout.svelte:\",\n \"\",\n \"<AppSidebar user={data.user} subscription={data.subscription} />\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/routes/(app)/+layout.svelte with an <AppSidebar /> that receives the subscription prop.\",\n].join(\"\\n\");\n\nexport function modifyAppLayoutSvelte(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const file = SvelteFile.fromPath(filePath);\n if (!file.hasElement(\"AppSidebar\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n if (file.hasAttribute(\"AppSidebar\", \"subscription\")) {\n return { status: \"success\", changed: false };\n }\n\n const appended = file.appendToAttributes(\n \"AppSidebar\",\n \" subscription={data.subscription}\",\n );\n if (!appended) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.writeTo(filePath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { SvelteFile } from \"../../../../runtime/svelte-file\";\nimport {\n withInMemoryScript,\n formatLikeSource,\n} from \"../../../../runtime/ts-morph-helpers\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst SUBSCRIPTION_TYPE = \"{ id: string; productName: string | null } | null\";\n\nconst FAILURE_HINT = [\n \"Update src/lib/components/app-sidebar.svelte to forward a subscription prop:\",\n \"\",\n \"1. Add `subscription = null` to the destructured $props() call.\",\n `2. Add \\`subscription?: ${SUBSCRIPTION_TYPE}\\` to the props type.`,\n \"3. Pass `{subscription}` to <NavUser>.\",\n].join(\"\\n\");\n\nconst NOT_FOUND_HINT = [\n \"Create src/lib/components/app-sidebar.svelte before enabling subscriptions.\",\n].join(\"\\n\");\n\nfunction updateScript(source: string): {\n source: string;\n wasAdded: boolean;\n} {\n let wasAdded = false;\n const { source: out } = withInMemoryScript(source, (sf) => {\n for (const decl of sf.getVariableDeclarations()) {\n const init = decl.getInitializer();\n if (!init || init.getText() !== \"$props()\") continue;\n\n const nameNode = decl.getNameNode();\n if (nameNode.getKind() !== SyntaxKind.ObjectBindingPattern) continue;\n const pattern = nameNode.asKindOrThrow(SyntaxKind.ObjectBindingPattern);\n const elements = pattern.getElements();\n if (elements.some((e) => e.getName() === \"subscription\")) {\n // Already has subscription prop — no-op.\n return;\n }\n\n // Insert subscription?: ... into the props type literal if present.\n const typeNode = decl.getTypeNode();\n if (typeNode?.getKind() === SyntaxKind.IntersectionType) {\n const intersection = typeNode.asKindOrThrow(\n SyntaxKind.IntersectionType,\n );\n for (const member of intersection.getTypeNodes()) {\n if (member.getKind() !== SyntaxKind.TypeLiteral) continue;\n const lit = member.asKindOrThrow(SyntaxKind.TypeLiteral);\n const propTexts = lit\n .getProperties()\n .map((p) => p.getText().replace(/[;,]\\s*$/, \"\"));\n if (propTexts.some((t) => /^\\s*subscription\\??\\s*:/.test(t))) {\n continue;\n }\n propTexts.push(`subscription?: ${SUBSCRIPTION_TYPE}`);\n lit.replaceWithText(`{ ${propTexts.join(\"; \")}; }`);\n break;\n }\n }\n\n // Insert `subscription = null` before the first rest/default-only element.\n const elementTexts = elements.map((e) => e.getText());\n let insertIdx = elements.findIndex(\n (e) => e.getDotDotDotToken() || e.getInitializer(),\n );\n if (insertIdx === -1) insertIdx = elementTexts.length;\n elementTexts.splice(insertIdx, 0, \"subscription = null\");\n pattern.replaceWithText(`{ ${elementTexts.join(\", \")} }`);\n wasAdded = true;\n }\n formatLikeSource(sf);\n });\n return { source: out, wasAdded };\n}\n\nexport function modifyAppSidebar(filePath: string): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: NOT_FOUND_HINT };\n }\n\n const original = fs.readFileSync(filePath, \"utf8\");\n if (\n original.includes(\"subscription?: {\") ||\n original.includes(\"subscription={subscription}\") ||\n original.includes(\"{subscription}\")\n ) {\n return { status: \"success\", changed: false };\n }\n\n const file = new SvelteFile(original);\n if (!file.hasElement(\"NavUser\")) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n const scriptChanged = file.modifyScript((src) => updateScript(src).source);\n\n const templateChanged = !file.hasAttribute(\"NavUser\", \"subscription\")\n ? file.appendToAttributes(\"NavUser\", \" {subscription}\")\n : false;\n\n if (!scriptChanged && !templateChanged) {\n return { status: \"failed\", message: FAILURE_HINT };\n }\n\n file.writeTo(filePath);\n return { status: \"success\", changed: file.hasChanged() };\n}\n","import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * Overwrites a file with the given template content, guarded by an idempotency\n * marker: if the current file already contains the marker, the modify is a\n * no-op. Used for complex rewrites where surgical AST changes aren't worth it\n * (e.g. pages that are largely replaced).\n *\n * Strips leading `// [!code highlight:N]` and `<!-- [!code highlight:N] -->`\n * lines so the same content can be shared with preview-modifies, which uses\n * those comments for documentation highlighting.\n */\nexport function modifyByTemplate(\n filePath: string,\n template: string,\n idempotencyMarker: string,\n notFoundHint: string,\n): ModifyOutcome {\n if (!fs.existsSync(filePath)) {\n return { status: \"not-found\", message: notFoundHint };\n }\n const current = fs.readFileSync(filePath, \"utf8\");\n if (current.includes(idempotencyMarker)) {\n return { status: \"success\", changed: false };\n }\n const stripped = template\n .replace(/^[ \\t]*\\/\\/[ \\t]*\\[!code highlight:\\d+\\][ \\t]*\\r?\\n/gm, \"\")\n .replace(\n /^[ \\t]*<!--[ \\t]*\\[!code highlight:\\d+\\][ \\t]*-->[ \\t]*\\r?\\n/gm,\n \"\",\n );\n if (current === stripped) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(filePath, stripped, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import { modifyByTemplate } from \"./modify-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst NOT_FOUND_HINT = [\n \"src/routes/(app)/billing/+page.server.ts is missing.\",\n \"Enable payments first — subscriptions extends the billing page with plan management.\",\n].join(\"\\n\");\n\nexport function modifyBillingPageServer(\n filePath: string,\n template: string,\n): ModifyOutcome {\n return modifyByTemplate(filePath, template, \"selectPlan\", NOT_FOUND_HINT);\n}\n","import { modifyByTemplate } from \"./modify-by-template\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\nconst NOT_FOUND_HINT = [\n \"src/routes/(app)/billing/+page.svelte is missing.\",\n \"Enable payments first — subscriptions extends the billing page with plan management.\",\n].join(\"\\n\");\n\nexport function modifyBillingPageSvelte(\n filePath: string,\n template: string,\n): ModifyOutcome {\n return modifyByTemplate(filePath, template, \"availablePlans\", NOT_FOUND_HINT);\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { keepMissing, modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { modifyWebhookServer } from \"./modifies/modify-webhook-server\";\nimport { modifyAppLayoutServer } from \"./modifies/modify-app-layout-server\";\nimport { modifyAppLayoutSvelte } from \"./modifies/modify-app-layout-svelte\";\nimport { modifyAppSidebar } from \"./modifies/modify-app-sidebar\";\nimport { modifyNavUser } from \"./modifies/modify-nav-user\";\nimport { modifyBillingPageServer } from \"./modifies/modify-billing-page-server\";\nimport { modifyBillingPageSvelte } from \"./modifies/modify-billing-page-svelte\";\nimport stripeCustomerHelper from \"../payments/providers-app-mode/stripe/src/lib/server/stripe-customer.ts?raw\";\n\n// The billing page imports this payments helper, which apps that enabled\n// payments before it existed do not have yet.\nconst STRIPE_CUSTOMER_HELPER = \"src/lib/server/stripe-customer.ts\";\n\n// enable-payments writes the billing page (and the stripe_customers collection\n// subscriptions relate to) only when auth is already on.\nconst BILLING_PAGE = \"src/routes/(app)/billing/+page.server.ts\";\n\n/**\n * Refuses a project whose payments were enabled before auth. Every `requires`\n * flag passes there (auth and payments are both on), yet the billing page and\n * `stripe_customers` don't exist, so this runs before any collection is made.\n */\nexport function assertPaymentsAppMode(root: string): void {\n if (fs.existsSync(path.join(root, BILLING_PAGE))) return;\n throw new InvalidArgumentError(\n [\n \"Subscriptions need payments set up with auth on: they add plans to the billing page\",\n `(${BILLING_PAGE}) and link to the stripe_customers collection, which enable-payments`,\n \"creates only when auth is already enabled. This project enabled payments before auth.\",\n \"\",\n \"Re-enable payments now that auth is on: `vela disable payments`, then `vela enable payments`.\",\n \"disable-payments drops the catalog collections, which the sync workflow refills from Stripe.\",\n ].join(\"\\n\"),\n );\n}\n\n// Share the final-state files between preview (rendered as-is) and runtime\n// (used as overwrite templates for modifies that amount to full rewrites).\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nfunction template(relativePath: string): string {\n const key = `./preview-modifies/${relativePath}`;\n const content = previewRaw[key];\n if (content === undefined) {\n throw new Error(\n `Missing template for ${relativePath} in subscriptions preview-modifies`,\n );\n }\n return content;\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const pushResult = (file: File | null) => {\n if (file) modifies.push(file);\n };\n\n logger.info(\"Modifying webhooks/stripe/handlers/dispatch.ts\");\n const webhookServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"webhooks\",\n \"stripe\",\n \"handlers\",\n \"dispatch.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n webhookServerPath,\n modifyWebhookServer(webhookServerPath),\n ),\n );\n\n logger.info(\"Modifying (app)/+layout.server.ts\");\n const appLayoutServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutServerPath,\n modifyAppLayoutServer(\n appLayoutServerPath,\n template(\"src/routes/(app)/+layout.server.ts\"),\n ),\n ),\n );\n\n logger.info(\"Modifying (app)/+layout.svelte\");\n const appLayoutSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"+layout.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n appLayoutSveltePath,\n modifyAppLayoutSvelte(appLayoutSveltePath),\n ),\n );\n\n logger.info(\"Modifying app-sidebar.svelte\");\n const appSidebarPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"app-sidebar.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(appSidebarPath, modifyAppSidebar(appSidebarPath)),\n );\n\n logger.info(\"Modifying nav-user.svelte\");\n const navUserPath = path.join(\n options.root,\n \"src\",\n \"lib\",\n \"components\",\n \"nav-user.svelte\",\n );\n pushResult(modifyOutcomeToFile(navUserPath, modifyNavUser(navUserPath)));\n\n logger.info(\"Modifying billing/+page.server.ts\");\n const billingPageServerPath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"billing\",\n \"+page.server.ts\",\n );\n pushResult(\n modifyOutcomeToFile(\n billingPageServerPath,\n modifyBillingPageServer(\n billingPageServerPath,\n template(\"src/routes/(app)/billing/+page.server.ts\"),\n ),\n ),\n );\n\n logger.info(\"Modifying billing/+page.svelte\");\n const billingPageSveltePath = path.join(\n options.root,\n \"src\",\n \"routes\",\n \"(app)\",\n \"billing\",\n \"+page.svelte\",\n );\n pushResult(\n modifyOutcomeToFile(\n billingPageSveltePath,\n modifyBillingPageSvelte(\n billingPageSveltePath,\n template(\"src/routes/(app)/billing/+page.svelte\"),\n ),\n ),\n );\n\n const creates = keepMissing(\n [\n {\n path: STRIPE_CUSTOMER_HELPER,\n language: \"ts\",\n content: stripeCustomerHelper,\n status: \"success\",\n },\n ],\n options.root,\n );\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,IAAMA,IAAe,CAAM;;;;;;;;;;;;;;;;;;GAoBrBC,IACJ,0GAEImC,IAA6B,CAAM;;;;;;;;;;;;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3C,CACF,GAEAN,EAAO,KAAK,8BAA8B;CAC1C,IAAMO,IAAiBpG,EAAK,KAC1B8F,EAAQ,MACR,OACA,OACA,cACA,oBACF;CAKA,AAJAE,EACEzG,EAAoB6G,GAAgB7B,EAAiB6B,CAAc,CAAC,CACtE,GAEAP,EAAO,KAAK,2BAA2B;CACvC,IAAMQ,IAAcrG,EAAK,KACvB8F,EAAQ,MACR,OACA,OACA,cACA,iBACF;CAGA,AAFAE,EAAWzG,EAAoB8G,GAAaxG,EAAcwG,CAAW,CAAC,CAAC,GAEvER,EAAO,KAAK,mCAAmC;CAC/C,IAAMS,IAAwBtG,EAAK,KACjC8F,EAAQ,MACR,OACA,UACA,SACA,WACA,iBACF;CAWA,AAVAE,EACEzG,EACE+G,GACArB,EACEqB,GACA9E,EAAS,0CAA0C,CACrD,CACF,CACF,GAEAqE,EAAO,KAAK,gCAAgC;CAC5C,IAAMU,IAAwBvG,EAAK,KACjC8F,EAAQ,MACR,OACA,UACA,SACA,WACA,cACF;CAuBA,OAtBAE,EACEzG,EACEgH,GACApB,EACEoB,GACA/E,EAAS,uCAAuC,CAClD,CACF,CACF,GAcO;EACL,SAbclC,EACd,CACE;GACE,MAAM8F;GACN,UAAU;GACV,SAASvG;GACT,QAAQ;EACV,CACF,GACAiH,EAAQ,IAIR;EACA;EACA,SAAS,CAAC;EACV,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { n as e } from "./logger-
|
|
2
|
-
import { i as t, n, t as r } from "./pocketbase-
|
|
3
|
-
import { r as i } from "./modify-file-
|
|
4
|
-
import { a, i as o, o as s, r as c, t as l } from "./whatsapp-
|
|
5
|
-
import { swapAuthPages as u } from "./auth-pages-
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { i as t, n, t as r } from "./pocketbase-gUn2UrDd.js";
|
|
3
|
+
import { r as i } from "./modify-file-CRZ_gMg0.js";
|
|
4
|
+
import { a, i as o, o as s, r as c, t as l } from "./whatsapp-Bt4o4_q2.js";
|
|
5
|
+
import { swapAuthPages as u } from "./auth-pages-BW3_yluN.js";
|
|
6
6
|
import d from "node:fs";
|
|
7
7
|
import f from "node:path";
|
|
8
|
-
|
|
8
|
+
// src/patterns/enable/whatsapp/modifies/modify-test-setup.ts
|
|
9
9
|
function p(e) {
|
|
10
10
|
if (!d.existsSync(e)) return {
|
|
11
11
|
status: "success",
|
|
@@ -20,8 +20,7 @@ function p(e) {
|
|
|
20
20
|
changed: !0
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
//#region src/patterns/enable/whatsapp/generate.runtime.ts
|
|
23
|
+
// src/patterns/enable/whatsapp/generate.runtime.ts
|
|
25
24
|
var m = "https://velastack.dev/docs/enable/whatsapp";
|
|
26
25
|
function h(e) {
|
|
27
26
|
return {
|
|
@@ -62,7 +61,6 @@ async function g(d) {
|
|
|
62
61
|
collectionDrops: []
|
|
63
62
|
};
|
|
64
63
|
}
|
|
65
|
-
//#endregion
|
|
66
64
|
export { g as generate };
|
|
67
65
|
|
|
68
|
-
//# sourceMappingURL=generate.runtime-
|
|
66
|
+
//# sourceMappingURL=generate.runtime-DkS7CBmK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-DkS7CBmK.js","names":["getLogger","withPocketbase","getMigrationFile","modifyOutcomeToFile","hasWhatsAppPlugin","writeWhatsAppConfigMigration","enableWhatsAppAuth","MIN_POCKETBASE_SERVER","fs","path","modifyTestSetup","setupPath","original","content","indent","head","tail","bodyIndent","value","fieldIndent","DOCS_URL","migrationCreate","file","generate","logger","options","creates","pb","setupWhatsAppFields","migrationDelay","configMigration","modifies","outcomes","swapAuthPages","filePath","outcome","testSetup","testSetupFile"],"sources":["../../src/patterns/enable/whatsapp/modifies/modify-test-setup.ts","../../src/patterns/enable/whatsapp/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport type { ModifyOutcome } from \"../../../../core/types\";\n\n/**\n * `email` turns optional on `users`, which the generated types follow, so a\n * test setup from before enable-backend handled that no longer type-checks:\n * its `authenticateUser` takes `{ email: string }` and it signs the test\n * user in with `context.user.email`. Brings those two spots up to the\n * current setup; anything else in the file is the project's own.\n */\nexport function modifyTestSetup(setupPath: string): ModifyOutcome {\n if (!fs.existsSync(setupPath)) {\n return { status: \"success\", changed: false };\n }\n\n const original = fs.readFileSync(setupPath, \"utf8\");\n let content = original;\n\n content = content.replace(\n /^([ \\t]*)(async function authenticateUser\\(agent: Agent, user: \\{ )email: string( \\}\\) \\{\\n)([ \\t]*)/m,\n (_, indent, head, tail, bodyIndent) =>\n `${indent}${head}email?: string${tail}` +\n `${bodyIndent}// Logs in with the password, so it needs the email (made optional by\\n` +\n `${bodyIndent}// enable-whatsapp, for accounts that sign in with a phone number).\\n` +\n `${bodyIndent}if (!user.email) {\\n` +\n `${bodyIndent}${bodyIndent.includes(\"\\t\") ? \"\\t\" : \" \"}throw new Error('authenticateUser needs a user with an email');\\n` +\n `${bodyIndent}}\\n` +\n bodyIndent,\n );\n\n // The user is made with a known email: sign in with that.\n content = content.replace(\n /^([ \\t]*)context\\.user = await context\\.admin\\.collection\\('users'\\)\\.create\\(\\{\\n([ \\t]*)email: (`test-\\$\\{Math\\.random\\(\\)\\.toString\\(36\\)\\.slice\\(2\\)\\}@example\\.com`),/m,\n (_, indent, fieldIndent, value) =>\n `${indent}const email = ${value};\\n` +\n `${indent}context.user = await context.admin.collection('users').create({\\n` +\n `${fieldIndent}email,`,\n );\n if (content.includes(\"const email = `test-\")) {\n content = content.replace(\n \".authWithPassword(context.user.email, testUserPassword)\",\n \".authWithPassword(email, testUserPassword)\",\n );\n }\n\n if (content === original) {\n return { status: \"success\", changed: false };\n }\n fs.writeFileSync(setupPath, content, \"utf8\");\n return { status: \"success\", changed: true };\n}\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport {\n getMigrationFile,\n migrationDelay,\n withPocketbase,\n} from \"../../../runtime/pocketbase\";\nimport { modifyOutcomeToFile } from \"../../../runtime/modify-file\";\nimport {\n MIN_POCKETBASE_SERVER,\n enableWhatsAppAuth,\n hasWhatsAppPlugin,\n setupWhatsAppFields,\n writeWhatsAppConfigMigration,\n} from \"./runtime/whatsapp\";\nimport { swapAuthPages } from \"./modifies/auth-pages\";\nimport { modifyTestSetup } from \"./modifies/modify-test-setup\";\n\nexport const DOCS_URL = \"https://velastack.dev/docs/enable/whatsapp\";\n\nfunction migrationCreate(file: string): File {\n return {\n path: file,\n language: \"js\",\n content: fs.readFileSync(file, \"utf8\"),\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const creates: File[] = [];\n\n await withPocketbase(options.root, async (pb) => {\n if (!(await hasWhatsAppPlugin(pb))) {\n throw new Error(\n `This PocketBase has no WhatsApp sign-in. It comes with pocketbase-server ${MIN_POCKETBASE_SERVER} and later: run \\`npm install -D pocketbase-server@^${MIN_POCKETBASE_SERVER}\\`, then \\`vela enable whatsapp\\` again.`,\n );\n }\n\n logger.info(\"Adding the phone fields to users and making email optional\");\n if (await setupWhatsAppFields(pb)) {\n await migrationDelay();\n const file = getMigrationFile(\"users\", \"updated\", options);\n if (file) creates.push(migrationCreate(file));\n }\n\n logger.info(\"Turning on WhatsApp sign-in for users\");\n await enableWhatsAppAuth(pb);\n await migrationDelay();\n const configMigration = writeWhatsAppConfigMigration(options, true);\n if (configMigration) creates.push(migrationCreate(configMigration));\n });\n\n logger.info(\"Adding WhatsApp to the login and signup pages\");\n const modifies: File[] = [];\n const outcomes = await swapAuthPages(\n options.root,\n \"enable\",\n (filePath) =>\n `${path.relative(options.root, filePath)} is not the page enable-auth wrote, so it was left as it is. Add the WhatsApp option to it by hand: ${DOCS_URL}`,\n );\n for (const [filePath, outcome] of outcomes) {\n const file = modifyOutcomeToFile(filePath, outcome);\n if (file) modifies.push(file);\n }\n\n logger.info(\"Updating test/setup.ts for an optional email\");\n const testSetup = path.join(options.root, \"test\", \"setup.ts\");\n const testSetupFile = modifyOutcomeToFile(\n testSetup,\n modifyTestSetup(testSetup),\n );\n if (testSetupFile) modifies.push(testSetupFile);\n\n return {\n creates,\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;AAUA,SAAgBU,EAAgB,GAAkC;CAChE,IAAI,CAACF,EAAG,WAAWG,CAAS,GAC1B,OAAO;EAAE,QAAQ;EAAW,SAAS;CAAM;CAG7C,IAAMC,IAAWJ,EAAG,aAAaG,GAAW,MAAM,GAC9CE,IAAUD;CAiCd,OA/BA,IAAUC,EAAQ,QAChB,0GACC,GAAG,GAAQ,GAAM,GAAM,MACtB,GAAGC,IAASC,EAAK,gBAAgBC,IAC9BC,EAAW,yEACXA,EAAW,uEACXA,EAAW,sBACXA,IAAaA,EAAW,SAAS,GAAI,IAAI,MAAO,KAAK,mEACrDA,EAAW,OACdA,CACJ,GAGA,IAAUJ,EAAQ,QAChB,gLACC,GAAG,GAAQ,GAAa,MACvB,GAAGC,EAAO,gBAAgBI,EAAM,KAC7BJ,EAAO,mEACPK,EAAY,OACnB,GACIN,EAAQ,SAAS,sBAAsB,MACzC,IAAUA,EAAQ,QAChB,2DACA,4CACF,IAGEA,MAAYD,IACP;EAAE,QAAQ;EAAW,SAAS;CAAM,KAE7CJ,EAAG,cAAcG,GAAWE,GAAS,MAAM,GACpC;EAAE,QAAQ;EAAW,SAAS;CAAK;AAC5C;;AC9BA,IAAaO,IAAW;AAExB,SAASC,EAAgB,GAAoB;CAC3C,OAAO;EACL,MAAMC;EACN,UAAU;EACV,SAASd,EAAG,aAAac,GAAM,MAAM;EACrC,QAAQ;CACV;A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CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { n as e } from "./logger-t1HxmpG2.js";
|
|
2
|
+
import { n as t } from "./env-AxyRWcC_.js";
|
|
3
|
+
import { t as n } from "./modify-file-CRZ_gMg0.js";
|
|
4
|
+
import { n as r } from "./shared-DE-J_b1j.js";
|
|
5
|
+
import { o as i } from "./generate-CY_Ii_bz.js";
|
|
6
|
+
import { n as a, r as o, t as s } from "./generate-CuOm66dn.js";
|
|
7
|
+
import { unmodifyEnvVarsFiles as c } from "./env-vars-CVn2076k.js";
|
|
8
|
+
import l from "node:fs";
|
|
9
|
+
import u from "node:path";
|
|
10
|
+
// src/patterns/disable/ai/generate.runtime.ts
|
|
11
|
+
async function d(d) {
|
|
12
|
+
let f = e(d), p = [], m = [], h = i(d);
|
|
13
|
+
for (let e of o(d)) {
|
|
14
|
+
let t = `${e}/+page.svelte`;
|
|
15
|
+
e !== h && l.existsSync(u.join(d.root, t)) && m.push(r(t));
|
|
16
|
+
}
|
|
17
|
+
f.info("Removing the AI provider's API key from src/env.ts");
|
|
18
|
+
let g = c(d.root, a());
|
|
19
|
+
g.modify && p.push(g.modify), g.delete && m.push(g.delete), f.info("Removing the AI provider's API key from .env");
|
|
20
|
+
let _ = u.join(d.root, ".env"), v = n(_, t(_, s()));
|
|
21
|
+
return v.modify && p.push(v.modify), v.delete && m.push(v.delete), {
|
|
22
|
+
creates: [],
|
|
23
|
+
modifies: p,
|
|
24
|
+
deletes: m,
|
|
25
|
+
components: [],
|
|
26
|
+
packages: [],
|
|
27
|
+
collections: [],
|
|
28
|
+
collectionPatches: [],
|
|
29
|
+
collectionDrops: []
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export { d as generate };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=generate.runtime-Dtae524O.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.runtime-
|
|
1
|
+
{"version":3,"file":"generate.runtime-Dtae524O.js","names":["getLogger","modifyEnvRemove","envRevertOutcomeToFile","toDeleteEntry","demoDir","allEnvNames","demoDirs","allEnvEdits","fs","path","generate","logger","options","modifies","deletes","current","dir","page","envVars","unmodifyEnvVarsFiles","envPath","env"],"sources":["../../src/patterns/disable/ai/generate.runtime.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport path from \"node:path\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { getLogger } from \"../../../core/logger\";\nimport { modifyEnvRemove } from \"../../../runtime/env\";\nimport { envRevertOutcomeToFile } from \"../../../runtime/modify-file\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { demoDir } from \"../../enable/ai/generate\";\nimport { allEnvEdits, allEnvNames, demoDirs } from \"./generate\";\nimport { unmodifyEnvVarsFiles } from \"../../../runtime/env-vars\";\n\nexport async function generate(options: Options) {\n const logger = getLogger(options);\n const modifies: File[] = [];\n const deletes: File[] = [];\n\n // The base result names the page in the current default group; a page\n // generated before auth was enabled sits in the other one.\n const current = demoDir(options);\n for (const dir of demoDirs(options)) {\n const page = `${dir}/+page.svelte`;\n if (dir !== current && fs.existsSync(path.join(options.root, page))) {\n deletes.push(toDeleteEntry(page));\n }\n }\n\n // Which provider was chosen is not recorded, so every one's key goes; the\n // file goes too when these were all it declared.\n logger.info(\"Removing the AI provider's API key from src/env.ts\");\n const envVars = unmodifyEnvVarsFiles(options.root, allEnvNames());\n if (envVars.modify) modifies.push(envVars.modify);\n if (envVars.delete) deletes.push(envVars.delete);\n\n logger.info(\"Removing the AI provider's API key from .env\");\n const envPath = path.join(options.root, \".env\");\n const env = envRevertOutcomeToFile(\n envPath,\n modifyEnvRemove(envPath, allEnvEdits()),\n );\n if (env.modify) modifies.push(env.modify);\n if (env.delete) deletes.push(env.delete);\n\n return {\n creates: [],\n modifies,\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n"],"mappings":";;;;;;;;;;AAWA,eAAsBU,EAAS,GAAkB;CAC/C,IAAMC,IAASX,EAAUY,CAAO,GAC1BC,IAAmB,CAAC,GACpBC,IAAkB,CAAC,GAInBC,IAAUX,EAAQQ,CAAO;CAC/B,KAAK,IAAMI,KAAOV,EAASM,CAAO,GAAG;EACnC,IAAMK,IAAO,GAAGD,EAAI;EACpB,AAAIA,MAAQD,KAAWP,EAAG,WAAWC,EAAK,KAAKG,EAAQ,MAAMK,CAAI,CAAC,KAChEH,EAAQ,KAAKX,EAAcc,CAAI,CAAC;CAEpC;CAIA,EAAO,KAAK,oDAAoD;CAChE,IAAMC,IAAUC,EAAqBP,EAAQ,MAAMP,EAAY,CAAC;CAIhE,AAHIa,EAAQ,UAAQL,EAAS,KAAKK,EAAQ,MAAM,GAC5CA,EAAQ,UAAQJ,EAAQ,KAAKI,EAAQ,MAAM,GAE/CP,EAAO,KAAK,8CAA8C;CAC1D,IAAMS,IAAUX,EAAK,KAAKG,EAAQ,MAAM,MAAM,GACxCS,IAAMnB,EACVkB,GACAnB,EAAgBmB,GAASb,EAAY,CAAC,CACxC;CAIA,OAHIc,EAAI,UAAQR,EAAS,KAAKQ,EAAI,MAAM,GACpCA,EAAI,UAAQP,EAAQ,KAAKO,EAAI,MAAM,GAEhC;EACL,SAAS,CAAC;EACV;EACA;EACA,YAAY,CAAC;EACb,UAAU,CAAC;EACX,aAAa,CAAC;EACd,mBAAmB,CAAC;EACpB,iBAAiB,CAAC;CACpB;AACF"}
|