@velastack/patterns 0.15.2 → 0.15.4
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/_page-CFeYIl2d.js +5 -0
- package/dist/chunks/_page-CFeYIl2d.js.map +1 -0
- package/dist/chunks/_page-CiazQY4O.js +5 -0
- package/dist/chunks/{_page-BFUn0CG1.js.map → _page-CiazQY4O.js.map} +1 -1
- package/dist/chunks/{auth-pages-D8n8gfCL.js → auth-pages-B8H3kQPW.js} +2 -2
- package/dist/chunks/{auth-pages-D8n8gfCL.js.map → auth-pages-B8H3kQPW.js.map} +1 -1
- package/dist/chunks/{collections-Daxlnbm0.js → collections-CFTIAty-.js} +2 -2
- package/dist/chunks/{collections-Daxlnbm0.js.map → collections-CFTIAty-.js.map} +1 -1
- package/dist/chunks/{currency.server-BkzwY17R.js → currency.server-CHzEhyTx.js} +74 -74
- package/dist/chunks/currency.server-CHzEhyTx.js.map +1 -0
- package/dist/chunks/dispatch-DSkRrJFe.js +5 -0
- package/dist/chunks/{dispatch-BxlKS_5v.js.map → dispatch-DSkRrJFe.js.map} +1 -1
- package/dist/chunks/{env-vars-C3TSZc4f.js → env-vars--fyhY-ew.js} +3 -3
- package/dist/chunks/{env-vars-C3TSZc4f.js.map → env-vars--fyhY-ew.js.map} +1 -1
- package/dist/chunks/{generate-CbchamhA.js → generate-B2z0kA5C.js} +2 -2
- package/dist/chunks/{generate-CbchamhA.js.map → generate-B2z0kA5C.js.map} +1 -1
- package/dist/chunks/{generate-CAYM7OUF.js → generate-BSCDKlyL.js} +2 -2
- package/dist/chunks/{generate-CAYM7OUF.js.map → generate-BSCDKlyL.js.map} +1 -1
- package/dist/chunks/{generate-DI58vuk1.js → generate-DZ2S8KDR.js} +3 -3
- package/dist/chunks/{generate-DI58vuk1.js.map → generate-DZ2S8KDR.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CZMVPVjS.js → generate.runtime-2T2j6Cgc.js} +5 -5
- package/dist/chunks/{generate.runtime-CZMVPVjS.js.map → generate.runtime-2T2j6Cgc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-_426A1Ij.js → generate.runtime-7rRHLyjy.js} +3 -3
- package/dist/chunks/{generate.runtime-_426A1Ij.js.map → generate.runtime-7rRHLyjy.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bo_s7gYB.js → generate.runtime-9wfx5sJK.js} +2 -2
- package/dist/chunks/{generate.runtime-Bo_s7gYB.js.map → generate.runtime-9wfx5sJK.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B7VubPTW.js → generate.runtime-B6Tce286.js} +3 -3
- package/dist/chunks/{generate.runtime-B7VubPTW.js.map → generate.runtime-B6Tce286.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B11mOr45.js → generate.runtime-B9nqVvxO.js} +2 -2
- package/dist/chunks/{generate.runtime-B11mOr45.js.map → generate.runtime-B9nqVvxO.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BL6DpWFI.js → generate.runtime-BCa20dNN.js} +3 -3
- package/dist/chunks/{generate.runtime-BL6DpWFI.js.map → generate.runtime-BCa20dNN.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DP63Wwea.js → generate.runtime-BFyTIABc.js} +4 -4
- package/dist/chunks/{generate.runtime-DP63Wwea.js.map → generate.runtime-BFyTIABc.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DlAJQ5Js.js → generate.runtime-B_md4EZa.js} +76 -68
- package/dist/chunks/generate.runtime-B_md4EZa.js.map +1 -0
- package/dist/chunks/{generate.runtime-BH6hHygm.js → generate.runtime-BpXoagaq.js} +76 -76
- package/dist/chunks/generate.runtime-BpXoagaq.js.map +1 -0
- package/dist/chunks/{generate.runtime-DW9bqOtC.js → generate.runtime-C1zb2WxI.js} +2 -2
- package/dist/chunks/{generate.runtime-DW9bqOtC.js.map → generate.runtime-C1zb2WxI.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C3IswX7B.js → generate.runtime-C4R919oE.js} +113 -104
- package/dist/chunks/generate.runtime-C4R919oE.js.map +1 -0
- package/dist/chunks/{generate.runtime-BCv4F1Wm.js → generate.runtime-C4qZ7Q30.js} +4 -4
- package/dist/chunks/{generate.runtime-BCv4F1Wm.js.map → generate.runtime-C4qZ7Q30.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C90_2L-8.js → generate.runtime-C8xFPEgP.js} +2 -2
- package/dist/chunks/{generate.runtime-C90_2L-8.js.map → generate.runtime-C8xFPEgP.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Cs73i6Zf.js → generate.runtime-CC4XoTnb.js} +2 -2
- package/dist/chunks/{generate.runtime-Cs73i6Zf.js.map → generate.runtime-CC4XoTnb.js.map} +1 -1
- package/dist/chunks/{generate.runtime-jIlQ2GMh.js → generate.runtime-CCL_doqr.js} +2 -2
- package/dist/chunks/{generate.runtime-jIlQ2GMh.js.map → generate.runtime-CCL_doqr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BEWp57Y7.js → generate.runtime-CKyi82cZ.js} +2 -2
- package/dist/chunks/{generate.runtime-BEWp57Y7.js.map → generate.runtime-CKyi82cZ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-D7KYlnvb.js → generate.runtime-CNHEuhx4.js} +4 -4
- package/dist/chunks/{generate.runtime-D7KYlnvb.js.map → generate.runtime-CNHEuhx4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-JftBoKYS.js → generate.runtime-CPF0TcjM.js} +3 -3
- package/dist/chunks/{generate.runtime-JftBoKYS.js.map → generate.runtime-CPF0TcjM.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bs77Oc8P.js → generate.runtime-CWNIo1xQ.js} +4 -4
- package/dist/chunks/{generate.runtime-Bs77Oc8P.js.map → generate.runtime-CWNIo1xQ.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CDY0Ot_t.js → generate.runtime-Cb2u0ft4.js} +5 -5
- package/dist/chunks/{generate.runtime-CDY0Ot_t.js.map → generate.runtime-Cb2u0ft4.js.map} +1 -1
- package/dist/chunks/{generate.runtime-ChSVP7cD.js → generate.runtime-CdpLsiqC.js} +4 -4
- package/dist/chunks/{generate.runtime-ChSVP7cD.js.map → generate.runtime-CdpLsiqC.js.map} +1 -1
- package/dist/chunks/{generate.runtime-CdZ3GzPS.js → generate.runtime-ChstrVRw.js} +6 -6
- package/dist/chunks/{generate.runtime-CdZ3GzPS.js.map → generate.runtime-ChstrVRw.js.map} +1 -1
- package/dist/chunks/{generate.runtime-Bhs7ttZS.js → generate.runtime-CpDUk3Ev.js} +2 -2
- package/dist/chunks/{generate.runtime-Bhs7ttZS.js.map → generate.runtime-CpDUk3Ev.js.map} +1 -1
- package/dist/chunks/{generate.runtime-xrxAElb3.js → generate.runtime-Ctd_522e.js} +3 -3
- package/dist/chunks/{generate.runtime-xrxAElb3.js.map → generate.runtime-Ctd_522e.js.map} +1 -1
- package/dist/chunks/{generate.runtime-B1Y2JrGW.js → generate.runtime-CviYhOWW.js} +202 -117
- package/dist/chunks/generate.runtime-CviYhOWW.js.map +1 -0
- package/dist/chunks/{generate.runtime-BRV9hIl5.js → generate.runtime-CxJaHusI.js} +2 -2
- package/dist/chunks/{generate.runtime-BRV9hIl5.js.map → generate.runtime-CxJaHusI.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DRPxOLnB.js → generate.runtime-D0acTMRF.js} +4 -4
- package/dist/chunks/{generate.runtime-DRPxOLnB.js.map → generate.runtime-D0acTMRF.js.map} +1 -1
- package/dist/chunks/{generate.runtime-fs6GEMx-.js → generate.runtime-D6vRzBoU.js} +4 -4
- package/dist/chunks/{generate.runtime-fs6GEMx-.js.map → generate.runtime-D6vRzBoU.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BRcP6sFt.js → generate.runtime-D7aGjoTD.js} +2 -2
- package/dist/chunks/{generate.runtime-BRcP6sFt.js.map → generate.runtime-D7aGjoTD.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DG9LRwbt.js → generate.runtime-DPtjvhGr.js} +2 -2
- package/dist/chunks/{generate.runtime-DG9LRwbt.js.map → generate.runtime-DPtjvhGr.js.map} +1 -1
- package/dist/chunks/{generate.runtime-BjrtdoYE.js → generate.runtime-DmHZZz4Z.js} +2 -2
- package/dist/chunks/{generate.runtime-BjrtdoYE.js.map → generate.runtime-DmHZZz4Z.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DdY44Ulv.js → generate.runtime-O5eQdhHV.js} +4 -4
- package/dist/chunks/{generate.runtime-DdY44Ulv.js.map → generate.runtime-O5eQdhHV.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DKL7VAAd.js → generate.runtime-Uq_L7TtO.js} +5 -5
- package/dist/chunks/{generate.runtime-DKL7VAAd.js.map → generate.runtime-Uq_L7TtO.js.map} +1 -1
- package/dist/chunks/{generate.runtime-C_hrLPD4.js → generate.runtime-VWQfzXXv.js} +3 -3
- package/dist/chunks/{generate.runtime-C_hrLPD4.js.map → generate.runtime-VWQfzXXv.js.map} +1 -1
- package/dist/chunks/{generate.runtime-v3KCv1B6.js → generate.runtime-WL1mm8gp.js} +2 -2
- package/dist/chunks/{generate.runtime-v3KCv1B6.js.map → generate.runtime-WL1mm8gp.js.map} +1 -1
- package/dist/chunks/{generate.runtime-DjEj-n6m.js → generate.runtime-vJFz9Q7V.js} +8 -8
- package/dist/chunks/{generate.runtime-DjEj-n6m.js.map → generate.runtime-vJFz9Q7V.js.map} +1 -1
- package/dist/chunks/{gitignore-CBiWFRif.js → gitignore-DUzIQXIo.js} +2 -2
- package/dist/chunks/{gitignore-CBiWFRif.js.map → gitignore-DUzIQXIo.js.map} +1 -1
- package/dist/chunks/{i18n-Ho8H91Ze.js → i18n-BoYcqVBi.js} +2 -2
- package/dist/chunks/{i18n-Ho8H91Ze.js.map → i18n-BoYcqVBi.js.map} +1 -1
- package/dist/chunks/{modify-file-BOEKlIDw.js → modify-file-DRdmZIvW.js} +2 -2
- package/dist/chunks/{modify-file-BOEKlIDw.js.map → modify-file-DRdmZIvW.js.map} +1 -1
- package/dist/chunks/{pocketbase-CvsJYXj-.js → pocketbase-BrDs1_84.js} +23 -7
- package/dist/chunks/pocketbase-BrDs1_84.js.map +1 -0
- package/dist/chunks/{providers-BEjDonyG.js → providers-Dhr_mzm6.js} +2 -2
- package/dist/chunks/{providers-BEjDonyG.js.map → providers-Dhr_mzm6.js.map} +1 -1
- package/dist/chunks/{schema-DnMqw2Hn.js → schema-C16iVOAG.js} +2 -2
- package/dist/chunks/{schema-DnMqw2Hn.js.map → schema-C16iVOAG.js.map} +1 -1
- package/dist/chunks/{shared-CSwGWMcN.js → shared-D7-ZAoqr.js} +2 -2
- package/dist/chunks/{shared-CSwGWMcN.js.map → shared-D7-ZAoqr.js.map} +1 -1
- package/dist/chunks/{ui-CpjUq_lm.js → ui-BI9OQpuR.js} +2 -2
- package/dist/chunks/{ui-CpjUq_lm.js.map → ui-BI9OQpuR.js.map} +1 -1
- package/dist/chunks/{unmodify-load-CdWXJ_Ac.js → unmodify-load-DWixBz7y.js} +17 -4
- package/dist/chunks/unmodify-load-DWixBz7y.js.map +1 -0
- package/dist/chunks/{write-result-DlB-id5k.js → write-result-Do8AcYbL.js} +2 -2
- package/dist/chunks/{write-result-DlB-id5k.js.map → write-result-Do8AcYbL.js.map} +1 -1
- package/dist/index.js +1700 -1681
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/_page-BFUn0CG1.js +0 -5
- package/dist/chunks/_page-Bt37d4uo.js +0 -5
- package/dist/chunks/_page-Bt37d4uo.js.map +0 -1
- package/dist/chunks/currency.server-BkzwY17R.js.map +0 -1
- package/dist/chunks/dispatch-BxlKS_5v.js +0 -5
- package/dist/chunks/generate.runtime-B1Y2JrGW.js.map +0 -1
- package/dist/chunks/generate.runtime-BH6hHygm.js.map +0 -1
- package/dist/chunks/generate.runtime-C3IswX7B.js.map +0 -1
- package/dist/chunks/generate.runtime-DlAJQ5Js.js.map +0 -1
- package/dist/chunks/pocketbase-CvsJYXj-.js.map +0 -1
- package/dist/chunks/unmodify-load-CdWXJ_Ac.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["exhaustiveType","changeCase.kebabCase","exhaustiveType","_templateObject","_templateObject2","parsePatternArgs","hasFiles","findInjectables","injectableHiddenInputs","pbInstance","pageImports","pageSnippet","plainPageSnippet","toFile","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","_templateObject","_templateObject2","parsePatternArgs","hasFiles","findInjectables","pbInstance","toFile","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","parsePatternArgs","pluralize","SLUG","VERSION","SOURCE","DOCS","generate","parsePatternArgs","toFile","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","exhaustiveType","_templateObject","_templateObject2","propsLine","_templateObject","_templateObject2","_templateObject3","parsePatternArgs","toFile","hasFiles","selectLabelMaps","pbInstance","scaffoldNotes","findInjectables","newHiddenInputs","editHiddenInputs","propsLine","newPageSnippet","editPageSnippet","listServerSnippet","newServerSnippet","showServerSnippet","showPageSnippet","editServerSnippet","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","_templateObject","_templateObject2","parsePatternArgs","toFile","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","toFile","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","PROVIDERS","META","providersRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","PROVIDERS","META","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generate","META","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","PROVIDERS","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","META","envEditsFor","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","PROVIDERS","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","variantsRaw","__import_glob__1_0_","__import_glob__1_1_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","filesFromGlob","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","__import_glob__0_56_","__import_glob__0_57_","__import_glob__0_58_","__import_glob__0_59_","__import_glob__0_60_","__import_glob__0_61_","__import_glob__0_62_","__import_glob__0_63_","__import_glob__0_64_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__1_0_","CREATES_PREFIX","filesFromGlob","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","createsWithBlogRaw","__import_glob__1_0_","CREATES_PREFIX","CREATES_WITH_BLOG_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__1_0_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","users","rulesFor","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","generate","META","envEditsFor","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","PROVIDERS","createsRaw","__import_glob__0_0_","providersRaw","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__1_5_","__import_glob__1_6_","__import_glob__1_7_","__import_glob__1_8_","__import_glob__1_9_","__import_glob__1_10_","__import_glob__1_11_","__import_glob__1_12_","__import_glob__1_13_","__import_glob__1_14_","__import_glob__2_0_","generate","filesFromGlob","previewRaw","__import_glob__0_0_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","CREATES_PREFIX","generate","previewRaw","__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_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__2_0_","__import_glob__2_1_","__import_glob__2_2_","__import_glob__2_3_","__import_glob__2_4_","generate","filesFromGlob","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","CREATES_PREFIX","generate","__import_glob__0_0_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","SLUG","VERSION","SOURCE","DOCS","generate","SLUG","VERSION","SOURCE","DOCS","generate","SLUG","VERSION","SOURCE","DOCS","generate","SLUG","VERSION","SOURCE","DOCS","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__1_5_","__import_glob__1_6_","__import_glob__1_7_","__import_glob__1_8_","__import_glob__1_9_","__import_glob__1_10_","__import_glob__1_11_","__import_glob__1_12_","__import_glob__1_13_","__import_glob__1_14_","__import_glob__1_15_","__import_glob__1_16_","__import_glob__1_18_","__import_glob__1_19_","__import_glob__1_20_","__import_glob__1_21_","__import_glob__1_22_","__import_glob__1_23_","__import_glob__1_24_","__import_glob__1_25_","__import_glob__1_26_","__import_glob__1_27_","__import_glob__1_28_","__import_glob__1_29_","__import_glob__1_30_","__import_glob__1_31_","__import_glob__1_32_","__import_glob__1_33_","__import_glob__1_34_","__import_glob__1_35_","__import_glob__1_36_","__import_glob__1_37_","__import_glob__1_38_","__import_glob__1_39_","__import_glob__1_40_","__import_glob__1_41_","__import_glob__1_42_","__import_glob__1_43_","__import_glob__1_44_","__import_glob__1_45_","__import_glob__1_46_","__import_glob__1_47_","__import_glob__1_48_","__import_glob__1_49_","__import_glob__1_50_","__import_glob__1_51_","__import_glob__1_52_","__import_glob__1_53_","__import_glob__1_54_","__import_glob__1_55_","__import_glob__1_56_","__import_glob__1_57_","__import_glob__1_58_","__import_glob__1_59_","__import_glob__1_60_","__import_glob__1_61_","__import_glob__1_62_","__import_glob__1_63_","__import_glob__1_64_","__import_glob__2_0_","__import_glob__2_1_","__import_glob__2_2_","__import_glob__2_3_","__import_glob__2_4_","__import_glob__2_5_","__import_glob__2_6_","__import_glob__2_7_","__import_glob__2_8_","__import_glob__2_9_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__1_0_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__1_5_","__import_glob__1_6_","__import_glob__1_7_","__import_glob__1_8_","__import_glob__1_9_","__import_glob__1_10_","__import_glob__1_11_","__import_glob__1_12_","__import_glob__1_13_","__import_glob__1_14_","__import_glob__1_15_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__2_0_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","generate","generateBase","packageJson","generateForm","generateFormRemote","generateMigration","generateSchema","generateWorkflow","generateResource","generateScaffold","generateScaffoldRemote","generateShop","enableAi","enableAnalytics","enableOg","enableAuth","enableAuthRemote","enableApi","enableApiKeys","enableBackend","enableBlog","enableCms","enableContentNegotiation","enableI18n","enableNotifications","enablePayments","enableEcommerce","enableSubscriptions","enableOrders","enableTeams","enableWhatsapp","enableWorkflows","destroySchema","destroyForm","destroyResource","destroyScaffold","destroyShop","disableAi","disableAnalytics","disableOg","disableApi","disableApiKeys","disableAuth","disableBackend","disableContentNegotiation","disableI18n","disableNotifications","disableTeams","disablePayments","disableEcommerce","disableSubscriptions","disableOrders","disableWhatsapp","__toESM","MissingShadcnError","RegistryUnavailableError","InvalidArgumentError","libAliasPath","libModule","isLibSpecifier","envVarsFile","envVarEntry","ENV_DECL_CANDIDATES","WUCHALE_SVELTE","VERSION_HOLDS","VERSIONS","VERSION_TRACKS","WUCHALE","NODE_FLOOR","FLASH","VELASTACK_POCKETBASE","POCKETBASE_TYPES","PUBLIC_DIR","TANSTACK_TABLE_CORE","TAKUMI","spec","NEGOTIATE","SUPERFORMS_VERSION","ADAPTER_STATIC","FORMSNAP","SUPERFORMS","LEGACY_POCKETBASE_TYPES","ADAPTER_NODE","POCKETBASE_BIN_ENV","VELASTACK_CMS","ZOD","VELASTACK_KIT","providerEnvVars","resolveProvider","capabilityName","providerFromArgv","providerCreates","providerMarkers","allProviderPaths","unknownProviderMessage","validateModelName","relationExpandParam","resolveInputFields","toCollectionFieldSpec","parseModel","resolveFields","loadCollections","rulesModeForCreate","uniqueRelationCollections","collectionSpecFromModelFields","relationLoadLines","uniqueIndexes","generateSchemaSnippet","relationLoadReturnVars","RULES_MODES","rulesNotes","require_pluralize","FIELD_SYNTAX_HELP","formatResult","dedent","languageFromPath","filesUnderPrefix","composeCreates","mergeResults","filesFromGlob$2","withNotes","appRelativePath","scaffoldUrls","kebabCase","scaffoldFilePaths","isProtectedRoute","parseRoute","resolveUi","_taggedTemplateLiteral","getLogger","generate$109","PROVIDERS$2","META$2","envEditsFor","generate$110","PROVIDERS$3","envEditsFor$1","META$3","_page_default$62","_page_server_default$21","server_test_default$26","_page_server_default$26","_page_default$67","_page_server_default$24","server_test_default$28","server_test_default$20","_page_server_default$33","server_test_default$19","_page_default$71","_page_server_default$27","server_test_default$25","server_test_default$17","_page_default$65","_page_default$48","server_test_default$23","_server_default$2","_server_default$4","_server_default$3","_page_default$64","_page_default$47","_page_server_default$30","_page_server_default$23","server_test_default$24","server_test_default$16","_page_default$70","_page_default$53","_page_default$69","_page_default$52","server_test_default$27","_page_default$55","_page_server_default$32","_page_server_default$25","server_test_default$22","_page_default$44","form_remote_default$4","_page_default$51","_page_server_default$34","_page_server_default$28","_page_default$72","_page_default$56","form_remote_default$3","server_test_default$14","_page_server_default$31","server_test_default$15","_page_default$66","_page_default$49","_page_server_default$29","_page_server_default$22","_page_default$63","_page_default$46","_layout_server_default$10","_page_default$45","_page_server_default$35","nav_user_default$2","_page_default$61","signup_default$2","user_default","reset_default$1","_page_default$74","_page_default$59","next_url_default","reset_default","login_default$1","_page_default$77","login_default","changePassword_default$1","_layout_server_default$8","_layout_default$10","_page_server_default$36","changeEmail_default$1","_page_default$75","user_avatar_default","app_sidebar_default$2","_page_default$76","changeEmail_default","nav_main_default$1","_page_server_default$37","_layout_server_default$7","signup_default$1","form_remote_default$5","server_test_default$18","_server_default$5","_page_default$54","form_remote_default$9","profile_default","confirmReset_default$1","form_remote_default$8","changePassword_default","nav_user_default$3","_page_server_default$38","_page_default$43","user_default$1","login_default$2","welcome_default","profile_default$1","server_test_default$30","confirmEmailChange_default","user_avatar_default$1","form_remote_default$2","server_test_default$13","_page_default$79","_layout_default$9","welcome_default$1","server_test_default$31","signup_default","otp_default$1","_page_default$80","server_test_default$12","_layout_server_default$9","_page_default$78","otp_default","confirmEmailChange_default$1","server_test_default$29","nav_main_default","_page_default$60","form_remote_default$6","_page_default$57","_page_default$73","_page_default$58","form_remote_default$7","app_sidebar_default$1","server_test_default$21","_page_default$68","_page_default$50","BACKEND_ENV_VARS","generate$111","NOTIFICATION_RULE_PATCHES","envEditsFor$2","PROVIDERS$4","generate$112","META$4","buyPageSnippet","PAYMENTS_BASE_COLLECTIONS","PAYMENTS_APP_MODE_COLLECTIONS","siteModule","_page_default$83","_page_server_default$40","completed_default","async_payment_default","shared_default$2","shared_default$1","_page_server_default$39","generate$113","_page_server_default$41","_page_default$81","completed_default$1","_page_default$82","server_test_default$32","_layout_server_default$11","_layout_default$11","_page_default$84","nav_user_default$4","_page_server_default$42","app_sidebar_default$3","dispatch_default$1","_page_server_default$43","_page_default$85","TEAM_RULE_PATCHES","WORKFLOWS_ENV_VARS","toDeleteEntry","planDropsForCollections","generate$114","generate$115","providersToRemove","generate$116","package_default","\"private\"","\"type\"","\"url\"","\"node\"","\"build\"","\"dev\"","\"clean\"","\"demo\"","\"format\"","\"lint\"","\"test\"","\"prepare\"","\"prettier\"","\"pocketbase\"","\"stripe\"","\"svelte\"","\"optional\"","\"dedent\"","\"pluralize\"","\"semver\"","\"typescript\"","\"vite\"","\"vitest\"","blockingFeatures","pattern","features","flag","unmetRequirements","context","providerId","detected","provider","candidate","requires","mergeRequires","unmet","missingFeatures","key","value","wanted","entry","reported","capability","want","have","referenced","extra","merged","FIELD_COMPONENTS","FIELD_IMPORTS","fieldValueBinding","field","renderInputProps","renderLabel","renderInputField","required","type","renderTextareaField","renderBoolField","renderGeoPointField","renderFileField","fileMode","renderSelectField","multiType","placeholder","options","option","renderRelationField","searchPlaceholder","emptyText","modelName","listName","renderAutodateField","renderField","selectFieldLabelMap","labels","getFieldComponents","components","fields","getFieldImports","component","displayDataPath","model","renderDisplaySimple","valueExpression","renderDisplayDateField","dataPath","dateLine","body","renderDisplayUrlField","anchor","renderDisplaySelectField","badge","renderDisplayFileField","relationListUrl","renderDisplayRelationField","relationPath","listUrl","renderDisplayGeoPointField","content","renderDisplayField","SHADCN_STYLE","layout","NATIVE_STYLE","binding","isMultiple","on","attr","REMOTE_INPUT_TYPES","remoteFormSupports","isWriteOnly","remoteBinding","as","formVar","tail","kind","asType","htmlType","multiple","errorAttrs","remoteSeedExpression","record","superformsErrors","CONSTRAINED","usesConstraints","superformsBinding","errors","aria","plainRenderer","label","htmlFor","style","input","textarea","tag","control","element","checkbox","select","relation","file","autodate","geoPoint","point","geoPointState","GENERATED_DATE","RawExpression","expression","fixtureToCode","fixtureObjectToCode","data","fieldTypeFromCollectionField","rawType","relationUrl","url","idExpression","testizeUrl","dynamicParams","name","match","dynamicParamsTodo","mockValueForField","suffix","relationId","relationIdsByCollectionId","fixtureDataFromFields","fixtureDataFromCollectionFields","firstValue","ensureAuthCollectionFixture","orderedDependencyCollections","collection","byId","collections","visited","visiting","ordered","walk","collectionId","uniqueVarName","used","base","index","fallbackCollectionFromFields","relationDependencyContext","dependencies","users","dependencyVars","usedVarNames","dependency","varName","declarations","setupLines","payload","cleanupLines","requestAgent","authSetup","hasBeforeEach","hasAfterEach","setupSection","generateScaffoldServerTestSnippet","list","urls","newUrl","show","edit","todo","vitestImport","modelFormData","modelDbData","generateScaffoldRemoteServerTestSnippet","generateFormServerTestSnippet","formUrl","generateFormRemoteServerTestSnippet","_templateObject$5","_templateObject2$5","parsePatternArgs$6","modelPath","argv","hasFiles$3","findInjectables$3","injectableHiddenInputs$1","sentinels","injectables","pbInstance$3","relationLoad","vars","pb","pageImports$1","imports","pageScriptSnippet","labelMaps","pageSnippet$1","scriptSnippet","fieldSnippet","hiddenInputs","enctype","plainPageSnippet$1","renderer","stores","flash","status","genericServerSnippet","withFiles","relations","success","createServerSnippet","injections","authMode","currentUserField","currentTeamField","createPayload","toFile$6","path","generate$108","fieldDefs","route","ui","serverTests","createMode","shouldCreateCollection","uiFields","serverContent","SLUG$49","VERSION$49","SOURCE$49","DOCS$49","generate$107","baseRes","n","writeResult","form_default$1","REMOTE_FIELD_COMPONENTS","REMOTE_FIELD_IMPORTS","getRemoteFieldComponents","getRemoteFieldImports","renderRemoteField","REQUIRE_USER_IMPORT","requireUserLines","guard","usesUser","_templateObject$4","_templateObject2$4","parsePatternArgs$5","hasFiles$2","submitFormIdentifier","findInjectables$2","injectableHiddenInputs","pbInstance$2","pageImports","pageSnippet","plainPageSnippet","genericRemoteSnippet","createRemoteSnippet","toFile$5","generate$106","remoteContent","creates","previewRaw$20","PREVIEW_PREFIX$16","generate$105","a","b","SLUG$48","VERSION$48","SOURCE$48","DOCS$48","generate$104","previewRes","remote","modifySvelteConfigRemote","svelteConfigFile","modifyOutcomeToFile","runtimeRes","form_remote_default$1","import_pluralize","VALID_OPS","parsePatternArgs$4","collectionName","op","rest","resolveMigration","c","parent","existingNames","f","changes","indexes","added","referencesFieldDef","requireNonEmpty","fieldNames","fieldName","from","to","ref","message","SLUG$47","VERSION$47","SOURCE$47","DOCS$47","generate$103","migration","logger","migrationCreates","withPocketbase","applyCollectionFieldsPatches","schemaFile","modifySchemaForMigration","migration_default","parsePatternArgs$3","toFile$4","generate$102","rules","auth","SLUG$46","VERSION$46","SOURCE$46","DOCS$46","generate$101","createCollections","resource_default$1","renderPlainValue","expanded","href","filename","DYNAMIC_PARAM_RE","interpolateParams","template","paramSource","urlJsExpr","urlJsExprWithSuffix","urlSvelteAttrValue","svelteSuffix","jsSuffix","_templateObject$3","_templateObject2$3","selectFields","propsLine$2","searchField","filterFnName","search","cellSnippet","listPageSnippet","selects","hasFilters","filterFns","newHref","rowPath","columnDefs","filterFn","tableCoreImports","facetingSlots","filterFnsSlot","searchInput","facets","toolbar","plainListPageSnippet","recordHref","headers","cells","_templateObject$2","_templateObject2$2","_templateObject3$1","_templateObject4","_templateObject5","parsePatternArgs$2","toFile$3","hasFiles$1","uniqueImports","selectLabelMaps$1","pbInstance$1","scaffoldNotes$1","findInjectables$1","newHiddenInputs$1","editHiddenInputs$1","propsLine$1","withParams","formScript","includeParams","newPageSnippet$1","fieldContent","listHref","editPageSnippet$1","cancelHref","listServerSnippet$1","expand","getFullListArgs","newServerSnippet$1","relationLoads","relationVars","relationReturn","showServerSnippet$1","getOneArgs","showPageSnippet$1","hasSelectFields","hasRelationFields","hasFileFields","displays","editHref","plainFormPageSnippet","plainNewPageSnippet","plainEditPageSnippet","plainShowPageSnippet","details","editServerSnippet$1","preservations","updatePayload","generate$100","paths","pages","SLUG$45","VERSION$45","SOURCE$45","DOCS$45","generate$99","assertTableCoreV9","assertRegistryPagination","assertComponentsAvailable","scaffold_default$1","_templateObject$1","_templateObject2$1","_templateObject3","parsePatternArgs$1","toFile$2","hasFiles","selectLabelMaps","pbInstance","scaffoldNotes","createFormIdentifier","updateFormIdentifier","hasRelations","findInjectables","newHiddenInputs","editHiddenInputs","propsLine","names","withData","newPageSnippet","editSeedSnippet","seeds","comment","editPageSnippet","seed","listServerSnippet","newServerSnippet","newRemoteSnippet","showServerSnippet","showPageSnippet","editServerSnippet","editRemoteSnippet","rendered","writeOnly","bools","jsons","overrides","preserved","taken","existing","update","optionalOnEdit","updateSchema","schemaDeclaration","schema","generate$98","newServerContent","previewRaw$19","PREVIEW_PREFIX$15","generate$97","SLUG$44","VERSION$44","SOURCE$44","DOCS$44","generate$96","scaffold_remote_default","parsePatternArgs","toFile$1","generate$95","SLUG$43","VERSION$43","SOURCE$43","DOCS$43","generate$94","schema_default$1","_page_default$42","_page_default$41","_page_default$40","_page_default$39","_page_server_default$20","_page_default$38","_page_server_default$19","_page_default$37","catalog_default","_page_default$36","_page_default$35","_page_default$34","_page_default$33","_page_default$32","_page_default$31","PROVIDERS$1","META$1","providersRaw$2","providersCmsRaw","shopFiles","files","cms","generate$93","SLUG$42","VERSION$42","SOURCE$42","DOCS$42","generate$92","shop_default$1","NAME_RE","CRON_RE","toKebabCase","toCamelCase","kebab","parseWorkflowArgs","raw","cron","arg","workflowSnippet","exportName","cronWorkflowSnippet","testSnippet","run","toFile","generate$91","args","dir","SLUG$41","VERSION$41","SOURCE$41","DOCS$41","generate$90","workflow_default","generate$89","envLines","SLUG$40","VERSION$40","SOURCE$40","DOCS$40","generate$88","generateRuntime","ai_default$1","previewRaw$18","PREVIEW_PREFIX$14","generate$87","modifies","SLUG$39","VERSION$39","SOURCE$39","DOCS$39","generate$86","analytics_default$1","createsRaw$25","confirmReset_default","variantsRaw$1","CREATES_PREFIX$20","generate$85","variant","previewRaw$17","PREVIEW_PREFIX$13","generate$84","SLUG$38","VERSION$38","SOURCE$38","DOCS$38","generate$83","writtenBase","writtenRuntime","auth_default$1","createsRaw$24","CREATES_PREFIX$19","createdPaths","generate$82","previewRaw$16","PREVIEW_PREFIX$12","generate$81","SLUG$37","VERSION$37","SOURCE$37","DOCS$37","generate$80","og_default$1","createsRaw$23","CREATES_PREFIX$18","generate$79","previewRaw$15","PREVIEW_PREFIX$11","generate$78","SLUG$36","VERSION$36","SOURCE$36","DOCS$36","generate$77","written","localized","localizeAuthPages","writtenLocalized","auth_remote_default","server_test_default$11","createsRaw$22","CREATES_PREFIX$17","generate$76","previewRaw$14","PREVIEW_PREFIX$10","generate$75","SLUG$35","VERSION$35","SOURCE$35","DOCS$35","generate$74","api_default$1","apiKey_default","_layout_server_default$4","_layout_default$6","_page_default$30","_page_server_default$18","_page_server_default$17","_page_default$29","_page_default$28","create_api_key_default","server_test_default$10","server_test_default$9","createsRaw$21","CREATES_PREFIX$16","apiKeysCollection","generate$73","previewRaw$13","PREVIEW_PREFIX$9","generate$72","SLUG$34","VERSION$34","SOURCE$34","DOCS$34","generate$71","api_keys_default$1","README_default$3","README_default$2","README_default$1","hooks_server_default$3","createsRaw$20","CREATES_PREFIX$15","generate$70","previewRaw$12","PREVIEW_PREFIX$8","generate$69","SLUG$33","VERSION$33","SOURCE$33","DOCS$33","generate$68","keepMissing","backend_default$1","twinkleplop_vsc_dark_plus_default","AuthorChip_default","PostCard_default","design_system_notes_default","getting_started_with_sveltekit_default","performance_checklist_default","welcome_to_the_blog_default","why_we_chose_tailwind_v4_default","writing_posts_with_mdsvex_default","content_default","date_default","_layout_default$5","_page_default$27","_page_default$26","_page_default$25","_page_default$24","_server_default","_page_default$23","_page_default$22","_page_default$21","_page_default$20","_page_server_default$16","createsRaw$19","createsWithNegotiationRaw","CREATES_PREFIX$14","CREATES_WITH_NEGOTIATION_PREFIX","filesFromGlob$1","prefix","generate$67","withNegotiation","previewRaw$11","PREVIEW_PREFIX$7","generate$66","SLUG$32","VERSION$32","SOURCE$32","DOCS$32","generate$65","blog_default","previewRaw$10","PREVIEW_PREFIX$6","generate$64","SLUG$31","VERSION$31","SOURCE$31","DOCS$31","generate$63","cms_default","negotiate_default","_page_server_default$15","_page_default$19","_page_default$18","_page_server_default$14","createsRaw$18","createsWithBlogRaw$1","CREATES_PREFIX$13","CREATES_WITH_BLOG_PREFIX$1","STORED_PUBLIC_DIR","inPublicGroup","routeGroups","filePath","META_TAGS_LOADER","filesFromGlob","generate$62","withBlog","metaTags","previewRaw$9","PREVIEW_PREFIX$5","generate$61","SLUG$30","VERSION$30","SOURCE$30","DOCS$30","generate$60","content_negotiation_default$1","language_select_default$1","locale_default","url_default","wuchale_config_default","language_select_default","createsRaw$17","variantsRaw","CREATES_PREFIX$12","generate$59","previewRaw$8","PREVIEW_PREFIX$4","generate$58","SLUG$29","VERSION$29","SOURCE$29","DOCS$29","generate$57","withLibraryTexts","i18n_default$1","notifications_bell_default","notifications_default$2","_page_server_default$13","_page_default$17","createsRaw$16","CREATES_PREFIX$11","generate$56","utils_default","users$1","rulesFor$1","p","x","NOTIFICATIONS_PREVIEW_COLLECTIONS","previewRaw$7","PREVIEW_PREFIX$3","generate$55","SLUG$28","VERSION$28","SOURCE$28","DOCS$28","generate$54","notifications_default$1","env_default$2","env_default$1","nav_user_default$1","_page_server_default$12","env_default","_templateObject","_templateObject2","previewRaw$6","PREVIEW_PRICE_ID","PREVIEW_VARIANT_ID","orderPageSnippet","paymentPageSnippet","priceId","generate$53","isStripe","isAppMode","paymentPage","SLUG$27","VERSION$27","SOURCE$27","DOCS$27","generate$52","hasVitest","payments_default$1","cart_button_default","cart_svelte_default$2","add_to_cart_default$2","cart_sheet_default$2","cart_svelte_default$1","add_to_cart_default$1","cart_items_default","cart_sheet_default$1","_page_server_default$11","_page_default$16","server_test_default$8","cart_svelte_default","add_to_cart_default","cart_sheet_default","_page_server_default$10","PROVIDERS","META","createsRaw$15","providersRaw$1","providersAppModeRaw","generate$51","add","stripeCustomer","previewRaw$5","generate$50","SLUG$26","VERSION$26","SOURCE$26","DOCS$26","generate$49","hasStripeCustomer","ecommerce_default$1","sync_stripe_subscriptions_default","created_default","deleted_default","shared_default","updated_default","createsRaw$14","CREATES_PREFIX$10","stripeSubscriptions","generate$48","previewRaw$4","PREVIEW_PREFIX$2","generate$47","SLUG$25","VERSION$25","SOURCE$25","DOCS$25","generate$46","subscriptions_default$1","previewRaw$3","generate$45","SLUG$24","VERSION$24","SOURCE$24","DOCS$24","generate$44","orders_default$1","team_switcher_default","team_default","teamInvite_default","teamRole_default","_layout__default$1","_page_server_default$9","_page_default$15","_page_default$14","_layout__default","_page_server_default$8","_page_default$13","_page_default$12","_layout_server_default$2","_layout_default$1","_page_server_default$7","_page_default$11","_layout_server_default$1","_layout__app__default","_page_server_default$6","_page_default$10","authorization_default","_page_server_default$5","_page_default$9","_page_default$8","server_test_default$7","_page_server_default$4","_page_default$7","_page_default$6","server_test_default$6","server_test_default$5","_page_server_default$3","_page_default$5","_page_default$4","server_test_default$4","server_test_default$3","_page_server_default$2","server_test_default$2","createsRaw$13","CREATES_PREFIX$9","generate$43","app_sidebar_default","nav_user_default","_layout_server_default","_layout_default","teams","teamMemberships","rulesFor","TEAMS_PREVIEW_COLLECTIONS","previewRaw$2","PREVIEW_PREFIX$1","generate$42","SLUG$23","VERSION$23","SOURCE$23","DOCS$23","generate$41","teams_default$1","whatsapp_default$2","_page_server_default$1","_page_default$3","_page_default$2","server_test_default$1","_page_server_default","_page_default$1","_page_default","form_remote_default","server_test_default","createsRaw$12","createsSuperformsRaw","createsRemoteRaw","generate$40","mode","previewRaw$1","generate$39","SLUG$22","VERSION$22","SOURCE$22","DOCS$22","generate$38","detectMode","whatsapp_default$1","createsRaw$11","CREATES_PREFIX$8","WORKFLOW_PACKAGES","generate$37","previewRaw","PREVIEW_PREFIX","generate$36","SLUG$21","VERSION$21","SOURCE$21","DOCS$21","generate$35","workflows_default","generate$34","schemaPath","SLUG$20","VERSION$20","SOURCE$20","DOCS$20","generate$33","formatted","schema_default","SLUG$19","VERSION$19","SOURCE$19","DOCS$19","generate$32","routeDir","result","form_default","SLUG$18","VERSION$18","SOURCE$18","DOCS$18","generate$31","collectionDrops","resource_default","SLUG$17","VERSION$17","SOURCE$17","DOCS$17","generate$30","scaffold_default","SLUG$16","VERSION$16","SOURCE$16","DOCS$16","shopRaw","SHOP_PATHS","generate$29","shop_default","SLUG$15","VERSION$15","SOURCE$15","DOCS$15","generate$28","ai_default","SLUG$14","VERSION$14","SOURCE$14","DOCS$14","generate$27","analytics_default","generate$26","SLUG$13","VERSION$13","SOURCE$13","DOCS$13","generate$25","og_default","createsRaw$10","CREATES_PREFIX$7","generate$24","SLUG$12","VERSION$12","SOURCE$12","DOCS$12","generate$23","api_default","createsRaw$9","CREATES_PREFIX$6","generate$22","SLUG$11","VERSION$11","SOURCE$11","DOCS$11","generate$21","api_keys_default","authCreatesRaw","authRemoteCreatesRaw","whatsappCreatesRaw","AUTH_CREATES_PREFIX","AUTH_REMOTE_CREATES_PREFIX","WHATSAPP_CREATES_PREFIX","generate$20","SLUG$10","VERSION$10","SOURCE$10","DOCS$10","generate$19","auth_default","createsRaw$8","CREATES_PREFIX$5","WORKFLOW_PATHS","packageName","at","generate$18","SLUG$9","VERSION$9","SOURCE$9","DOCS$9","generate$17","backend_default","createsRaw$7","createsWithBlogRaw","CREATES_PREFIX$4","CREATES_WITH_BLOG_PREFIX","generate$16","SLUG$8","VERSION$8","SOURCE$8","DOCS$8","generate$15","content_negotiation_default","createsRaw$6","CREATES_PREFIX$3","WUCHALE_CACHE","generate$14","SLUG$7","VERSION$7","SOURCE$7","DOCS$7","generate$13","i18n_default","createsRaw$5","CREATES_PREFIX$2","generate$12","SLUG$6","VERSION$6","SOURCE$6","DOCS$6","generate$11","notifications_default","createsRaw$4","CREATES_PREFIX$1","generate$10","SLUG$5","VERSION$5","SOURCE$5","DOCS$5","generate$9","teams_default","SLUG$4","VERSION$4","SOURCE$4","DOCS$4","generate$8","patchCreates","unlinkStripePaymentMethodsCustomer","finalResult","error","payments_default","createsRaw$3","providersRaw","generate$7","providers","id","SLUG$3","VERSION$3","SOURCE$3","DOCS$3","generate$6","ecommerce_default","createsRaw$2","CREATES_PREFIX","generate$5","SLUG$2","VERSION$2","SOURCE$2","DOCS$2","generate$4","subscriptions_default","createsRaw$1","createsAppModeRaw","createsNotificationsRaw","generate$3","SLUG$1","VERSION$1","SOURCE$1","DOCS$1","generate$2","orders_default","createsRaw","PREFIX","generate$1","SLUG","VERSION","SOURCE","DOCS","generate","whatsapp_default","version","patterns","bySlug","byCategory","category","acc","installComponents","runtime","root","listComponents","switchStyle","applyBaseColor","applyTheme","detectProviders","modifyEnvVars","specs","unmodifyEnvVars","ensurePackageImports","entries","removePackageImports","keys","expected","ensurePackageOverrides","libSpecifier"],"sources":["../src/core/requires.ts","../src/core/field/index.ts","../src/core/field/plain.ts","../src/core/tests.ts","../src/patterns/generate/form/generate.ts","../src/patterns/generate/form/index.ts","../src/core/field/remote.ts","../src/patterns/generate/form-remote/generate.ts","../src/patterns/generate/form-remote/generate.preview.ts","../src/patterns/generate/form-remote/index.ts","../src/patterns/generate/migration/generate.ts","../src/patterns/generate/migration/index.ts","../src/patterns/generate/resource/generate.ts","../src/patterns/generate/resource/index.ts","../src/core/field/plain-display.ts","../src/core/url.ts","../src/core/scaffold-list.ts","../src/patterns/generate/scaffold/generate.ts","../src/patterns/generate/scaffold/index.ts","../src/patterns/generate/scaffold-remote/generate.ts","../src/patterns/generate/scaffold-remote/generate.preview.ts","../src/patterns/generate/scaffold-remote/index.ts","../src/patterns/generate/schema/generate.ts","../src/patterns/generate/schema/index.ts","../src/patterns/generate/shop/generate.ts","../src/patterns/generate/shop/index.ts","../src/patterns/generate/workflow/generate.ts","../src/patterns/generate/workflow/index.ts","../src/patterns/enable/ai/generate.preview.ts","../src/patterns/enable/ai/index.ts","../src/patterns/enable/analytics/generate.preview.ts","../src/patterns/enable/analytics/index.ts","../src/patterns/enable/auth/generate.ts","../src/patterns/enable/auth/generate.preview.ts","../src/patterns/enable/auth/index.ts","../src/patterns/enable/og/generate.ts","../src/patterns/enable/og/generate.preview.ts","../src/patterns/enable/og/index.ts","../src/patterns/enable/auth-remote/generate.ts","../src/patterns/enable/auth-remote/generate.preview.ts","../src/patterns/enable/auth-remote/index.ts","../src/patterns/enable/api/generate.ts","../src/patterns/enable/api/generate.preview.ts","../src/patterns/enable/api/index.ts","../src/patterns/enable/api-keys/generate.ts","../src/patterns/enable/api-keys/generate.preview.ts","../src/patterns/enable/api-keys/index.ts","../src/patterns/enable/backend/generate.ts","../src/patterns/enable/backend/generate.preview.ts","../src/patterns/enable/backend/index.ts","../src/patterns/enable/blog/generate.ts","../src/patterns/enable/blog/generate.preview.ts","../src/patterns/enable/blog/index.ts","../src/patterns/enable/cms/generate.preview.ts","../src/patterns/enable/cms/index.ts","../src/patterns/enable/content-negotiation/generate.ts","../src/patterns/enable/content-negotiation/generate.preview.ts","../src/patterns/enable/content-negotiation/index.ts","../src/patterns/enable/i18n/generate.ts","../src/patterns/enable/i18n/generate.preview.ts","../src/patterns/enable/i18n/index.ts","../src/patterns/enable/notifications/generate.ts","../src/patterns/enable/notifications/runtime/collections.ts","../src/patterns/enable/notifications/generate.preview.ts","../src/patterns/enable/notifications/index.ts","../src/patterns/enable/payments/generate.preview.ts","../src/patterns/enable/payments/index.ts","../src/patterns/enable/ecommerce/generate.ts","../src/patterns/enable/ecommerce/generate.preview.ts","../src/patterns/enable/ecommerce/index.ts","../src/patterns/enable/subscriptions/generate.ts","../src/patterns/enable/subscriptions/generate.preview.ts","../src/patterns/enable/subscriptions/index.ts","../src/patterns/enable/orders/generate.preview.ts","../src/patterns/enable/orders/index.ts","../src/patterns/enable/teams/generate.ts","../src/patterns/enable/teams/runtime/collections.ts","../src/patterns/enable/teams/generate.preview.ts","../src/patterns/enable/teams/index.ts","../src/patterns/enable/whatsapp/generate.ts","../src/patterns/enable/whatsapp/generate.preview.ts","../src/patterns/enable/whatsapp/index.ts","../src/patterns/enable/workflows/generate.ts","../src/patterns/enable/workflows/generate.preview.ts","../src/patterns/enable/workflows/index.ts","../src/patterns/destroy/schema/generate.ts","../src/patterns/destroy/schema/index.ts","../src/patterns/destroy/form/index.ts","../src/patterns/destroy/resource/index.ts","../src/patterns/destroy/scaffold/index.ts","../src/patterns/destroy/shop/index.ts","../src/patterns/disable/ai/index.ts","../src/patterns/disable/analytics/index.ts","../src/patterns/disable/og/generate.ts","../src/patterns/disable/og/index.ts","../src/patterns/disable/api/generate.ts","../src/patterns/disable/api/index.ts","../src/patterns/disable/api-keys/generate.ts","../src/patterns/disable/api-keys/index.ts","../src/patterns/disable/auth/generate.ts","../src/patterns/disable/auth/index.ts","../src/patterns/disable/backend/generate.ts","../src/patterns/disable/backend/index.ts","../src/patterns/disable/content-negotiation/generate.ts","../src/patterns/disable/content-negotiation/index.ts","../src/patterns/disable/i18n/generate.ts","../src/patterns/disable/i18n/index.ts","../src/patterns/disable/notifications/generate.ts","../src/patterns/disable/notifications/index.ts","../src/patterns/disable/teams/generate.ts","../src/patterns/disable/teams/index.ts","../src/patterns/disable/payments/index.ts","../src/patterns/disable/ecommerce/generate.ts","../src/patterns/disable/ecommerce/index.ts","../src/patterns/disable/subscriptions/generate.ts","../src/patterns/disable/subscriptions/index.ts","../src/patterns/disable/orders/generate.ts","../src/patterns/disable/orders/index.ts","../src/patterns/disable/whatsapp/generate.ts","../src/patterns/disable/whatsapp/index.ts","../src/index.ts"],"sourcesContent":["import type {\n DetectedProviders,\n FeatureFlag,\n Features,\n Pattern,\n Provider,\n Requires,\n} from \"./types\";\n\n/**\n * The features in `pattern.blockedBy` that the project has on, in the\n * pattern's order. Empty means nothing stands in the way. A disable pattern\n * names the features whose code imports what it removes, so that\n * `disable-payments` refuses while the cart still imports the Stripe client.\n */\nexport function blockingFeatures(\n pattern: Pick<Pattern, \"blockedBy\">,\n features: Features,\n): FeatureFlag[] {\n return (pattern.blockedBy ?? []).filter((flag) => features[flag] === true);\n}\n\n/** One prerequisite a project is missing for a pattern. */\nexport type Unmet =\n | { kind: \"feature\"; feature: keyof Features }\n | {\n kind: \"provider\";\n capability: string;\n /** Provider ids that would satisfy the pattern. */\n want: string[];\n /** What the project has, `null` for none. */\n have: string | null;\n }\n | { kind: \"ambiguous\"; capability: string; ids: string[] };\n\ntype RequiresPattern = Pick<\n Pattern,\n \"requires\" | \"providers\" | \"inheritsProvider\"\n>;\n\nexport interface RequirementsContext {\n features: Features;\n detected: DetectedProviders;\n /** The provider chosen for this run, when the caller already knows it. */\n provider?: string;\n}\n\n/**\n * What `pattern` needs that the project doesn't have, in a stable order:\n * missing features, then providers, then ambiguous detections. Empty means\n * the pattern can run.\n *\n * Only `true` flags are requirements. `false` means \"not required\", never\n * \"must be absent\", and `ui` is left to its own check, since it is a value\n * rather than a flag. The chosen provider's own `requires` is added to the\n * pattern's; for a pattern with `inheritsProvider`, the chosen provider is the\n * detected one.\n */\nexport function unmetRequirements(\n pattern: RequiresPattern,\n context: RequirementsContext,\n): Unmet[] {\n const { features, detected } = context;\n const providerId =\n context.provider ??\n (pattern.inheritsProvider\n ? detected.providers[pattern.inheritsProvider]\n : undefined);\n const provider = pattern.providers?.find(\n (candidate) => candidate.id === providerId,\n );\n const requires = mergeRequires(pattern.requires, provider);\n\n const unmet: Unmet[] = [];\n const missingFeatures = new Set<string>();\n\n for (const [key, value] of Object.entries(requires)) {\n if (key === \"ui\" || key === \"providers\" || value !== true) continue;\n if (!features[key as keyof Features]) {\n missingFeatures.add(key);\n unmet.push({ kind: \"feature\", feature: key as keyof Features });\n }\n }\n\n const wanted: [string, string[]][] = Object.entries(\n requires.providers ?? {},\n ).filter((entry): entry is [string, string[]] => entry[1] !== undefined);\n if (pattern.inheritsProvider && pattern.providers) {\n wanted.push([\n pattern.inheritsProvider,\n pattern.providers.map((candidate) => candidate.id),\n ]);\n }\n\n const reported = new Set<string>();\n for (const [capability, want] of wanted) {\n if (reported.has(capability)) continue;\n const have = detected.providers[capability] ?? null;\n if (have !== null && want.includes(have)) continue;\n // A capability that is also a missing feature is already reported.\n if (have === null && missingFeatures.has(capability)) continue;\n if (detected.ambiguous.some((entry) => entry.capability === capability)) {\n continue;\n }\n reported.add(capability);\n unmet.push({ kind: \"provider\", capability, want, have });\n }\n\n const referenced = new Set(wanted.map(([capability]) => capability));\n for (const entry of detected.ambiguous) {\n if (referenced.has(entry.capability)) {\n unmet.push({\n kind: \"ambiguous\",\n capability: entry.capability,\n ids: entry.ids,\n });\n }\n }\n\n return unmet;\n}\n\n/**\n * The pattern's requirements with the provider's on top. A flag is required\n * when either says so; a provider's list for a capability replaces the\n * pattern's.\n */\nfunction mergeRequires(requires: Requires, provider?: Provider): Requires {\n const extra = provider?.requires;\n if (!extra) return requires;\n\n const merged: Requires = { ...requires };\n for (const key of Object.keys(extra) as (keyof Requires)[]) {\n if (key === \"providers\" || key === \"ui\") continue;\n if (extra[key] === true) merged[key] = true;\n }\n if (extra.ui) merged.ui = extra.ui;\n if (extra.providers) {\n merged.providers = { ...requires.providers, ...extra.providers };\n }\n return merged;\n}\n","import * as changeCase from \"change-case\";\nimport dedent from \"dedent\";\nimport type { Field, Model } from \"../../parse\";\n\ntype InputPropValue = string | number | boolean | null | undefined;\n\ninterface FieldRenderExtensions {\n inputProps?: Record<string, InputPropValue>;\n labelAside?: string;\n}\n\nexport type RenderableField = Field & FieldRenderExtensions;\n\nexport type FieldComponent =\n | \"form\"\n | \"file-form\"\n | \"multiselect\"\n | \"input\"\n | \"checkbox\"\n | \"textarea\"\n | \"select\"\n | \"geopoint\"\n | \"button\";\n\nconst FIELD_COMPONENTS: Record<Field[\"type\"], FieldComponent[]> = {\n text: [\"form\", \"input\"],\n number: [\"form\", \"input\"],\n email: [\"form\", \"input\"],\n password: [\"form\", \"input\"],\n bool: [\"form\", \"checkbox\"],\n date: [\"form\", \"input\"],\n select: [\"form\", \"multiselect\"],\n file: [\"form\", \"input\", \"file-form\", \"button\"],\n json: [\"form\", \"textarea\"],\n geoPoint: [\"form\", \"geopoint\"],\n relation: [\"form\", \"multiselect\"],\n url: [\"form\", \"input\"],\n editor: [\"form\", \"textarea\"],\n autodate: [\"form\", \"input\"],\n};\n\nconst FIELD_IMPORTS: Record<FieldComponent, string[]> = {\n form: ['import * as Form from \"#lib/components/ui/form/index.js\";'],\n \"file-form\": [\n 'import * as FileForm from \"#lib/components/ui/file-form/index.js\";',\n ],\n multiselect: [\n 'import * as MultiSelect from \"#lib/components/ui/multiselect/index.js\";',\n 'import * as Command from \"#lib/components/ui/command/index.js\";',\n ],\n input: ['import { Input } from \"#lib/components/ui/input/index.js\";'],\n checkbox: [\n 'import { Checkbox } from \"#lib/components/ui/checkbox/index.js\";',\n ],\n textarea: [\n 'import { Textarea } from \"#lib/components/ui/textarea/index.js\";',\n ],\n select: ['import * as Select from \"#lib/components/ui/select/index.js\";'],\n geopoint: [\n 'import { GeopointInput } from \"#lib/components/ui/geopoint/index.js\";',\n ],\n button: ['import { Button } from \"#lib/components/ui/button/index.js\";'],\n};\n\nexport function fieldValueBinding(field: Pick<Field, \"name\">): string {\n return `$formData.${field.name}`;\n}\n\nfunction renderInputProps(field: RenderableField): string {\n if (!field.inputProps) {\n return \"\";\n }\n\n return Object.entries(field.inputProps)\n .flatMap(([key, value]) => {\n if (value === undefined || value === null || value === false) {\n return [];\n }\n\n if (value === true) {\n return [` ${key}`];\n }\n\n return [` ${key}=${JSON.stringify(String(value))}`];\n })\n .join(\"\");\n}\n\nfunction renderLabel(field: RenderableField): string {\n if (!field.labelAside) {\n return `<Form.Label>${field.title}</Form.Label>`;\n }\n\n return dedent`\n <div class=\"flex justify-between\">\n <Form.Label>${field.title}</Form.Label>\n ${field.labelAside}\n </div>\n `;\n}\n\nfunction renderInputField(field: RenderableField, type: string): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Input {...props} type=\"${type}\" bind:value={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderTextareaField(field: RenderableField): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-2\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Textarea {...props} bind:value={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderBoolField(field: RenderableField): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1 flex items-start space-x-2\">\n <Form.Control>\n {#snippet children({ props })}\n <Checkbox {...props} bind:checked={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n ${renderLabel(field)}\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderGeoPointField(field: RenderableField): string {\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <GeopointInput {...props} bind:value={${fieldValueBinding(field)}} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderFileField(\n field: Extract<RenderableField, { type: \"file\" }>,\n): string {\n const required = field.required ? \" required\" : \"\";\n const fileMode = field.maxSelect > 1 ? \"Multiple\" : \"Single\";\n\n return dedent`\n <FileForm.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <FileForm.${fileMode}>\n {#snippet display({ file, filename, onremove })}\n <div class=\"flex gap-2 justify-between items-center\">\n <div class=\"flex gap-2 items-center\">\n <FileForm.Thumb {file} {filename} class=\"w-16 h-16 rounded-md object-cover\" />\n <p class=\"text-sm text-muted-foreground\">{filename}</p>\n </div>\n <Button variant=\"outline\" onclick={() => onremove(file)}>Remove</Button>\n </div>\n {/snippet}\n {#snippet input()}\n <FileForm.Input {...props}${required}${renderInputProps(field)} />\n {/snippet}\n </FileForm.${fileMode}>\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </FileForm.Field>\n `;\n}\n\nfunction renderSelectField(\n field: Extract<RenderableField, { type: \"select\" }>,\n): string {\n const multiType = field.maxSelect > 1 ? \"multiple\" : \"single\";\n const required = field.required ? \" required\" : \"\";\n const placeholder =\n field.maxSelect > 1 ? \"Select options\" : \"Select an option\";\n\n const options = field.options\n .map(\n (option) =>\n `<MultiSelect.Item value=${JSON.stringify(option.value)} label={${field.name}Labels[${JSON.stringify(option.value)}].label} />`,\n )\n .join(\"\\n \");\n\n return dedent`\n <MultiSelect.Field {form} type=\"${multiType}\" name=\"${field.name}\"${required} class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <MultiSelect.Trigger class=\"w-full justify-between\">\n <MultiSelect.Input bind:value={${fieldValueBinding(field)}} placeholder=\"${placeholder}\" {...props}>\n {#snippet children({ selected })}\n <div class=\"flex flex-wrap gap-1\">\n {#each selected as value}\n <MultiSelect.Chip>{${field.name}Labels[value].label}</MultiSelect.Chip>\n {/each}\n </div>\n {/snippet}\n </MultiSelect.Input>\n </MultiSelect.Trigger>\n {/snippet}\n </Form.Control>\n\n <MultiSelect.Content class=\"p-0\">\n <Command.Root>\n <Command.Input autofocus placeholder=\"Search...\" />\n <Command.Empty>No options found</Command.Empty>\n <Command.Group>\n ${options}\n </Command.Group>\n </Command.Root>\n </MultiSelect.Content>\n\n <Form.FieldErrors class=\"contents text-destructive\" />\n </MultiSelect.Field>\n `;\n}\n\nfunction renderRelationField(\n field: Extract<RenderableField, { type: \"relation\" }>,\n): string {\n const multiType = field.maxSelect > 1 ? \"multiple\" : \"single\";\n const placeholder =\n field.maxSelect > 1\n ? `Select ${field.relatedModel.pluralDisplayName.toLowerCase()}`\n : `Select ${field.relatedModel.displayName.toLowerCase()}`;\n const searchPlaceholder = `Search ${field.relatedModel.pluralDisplayName.toLowerCase()}...`;\n const emptyText = `No ${field.relatedModel.pluralDisplayName.toLowerCase()} found`;\n const modelName = field.relatedModel.name;\n const listName = field.relatedModel.pluralName;\n\n return dedent`\n <MultiSelect.Field {form} type=\"${multiType}\" name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>${field.title}</Form.Label>\n <MultiSelect.Trigger class=\"w-full justify-between\">\n <MultiSelect.Input bind:value={${fieldValueBinding(field)}} placeholder=\"${placeholder}\" {...props}>\n {#snippet children({ selected })}\n <div class=\"flex flex-wrap gap-1\">\n {#each selected as value}\n {@const ${modelName} = data.${listName}.find((${modelName}) => ${modelName}.id === value)!}\n <MultiSelect.Chip>{${modelName}.${field.displayField}}</MultiSelect.Chip>\n {/each}\n </div>\n {/snippet}\n </MultiSelect.Input>\n </MultiSelect.Trigger>\n {/snippet}\n </Form.Control>\n\n <MultiSelect.Content class=\"p-0\">\n <Command.Root>\n <Command.Input autofocus placeholder=\"${searchPlaceholder}\" />\n <Command.Empty>${emptyText}</Command.Empty>\n <Command.Group>\n {#each data.${listName} as ${modelName}}\n <MultiSelect.Item value={${modelName}.id} label={${modelName}.${field.displayField}} />\n {/each}\n </Command.Group>\n </Command.Root>\n </MultiSelect.Content>\n\n <Form.FieldErrors class=\"contents text-destructive\" />\n </MultiSelect.Field>\n `;\n}\n\nfunction renderAutodateField(field: RenderableField): string {\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Input {...props} type=\"text\" value={${fieldValueBinding(field)}}${renderInputProps(field)} readonly />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nexport function renderField(field: RenderableField): string {\n switch (field.type) {\n case \"text\":\n return renderInputField(field, \"text\");\n case \"number\":\n return renderInputField(field, \"number\");\n case \"date\":\n return renderInputField(field, \"date\");\n case \"email\":\n return renderInputField(field, \"email\");\n case \"password\":\n return renderInputField(field, \"password\");\n case \"url\":\n return renderInputField(field, \"url\");\n case \"autodate\":\n return renderAutodateField(field);\n case \"editor\":\n case \"json\":\n return renderTextareaField(field);\n case \"bool\":\n return renderBoolField(field);\n case \"geoPoint\":\n return renderGeoPointField(field);\n case \"file\":\n return renderFileField(field);\n case \"select\":\n return renderSelectField(field);\n case \"relation\":\n return renderRelationField(field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n\nexport function selectFieldLabelMap(\n field: Extract<Field, { type: \"select\" }>,\n): string {\n const labels = field.options\n .map(\n (option) => dedent`\n ${JSON.stringify(option.value)}: {\n label: ${JSON.stringify(option.label)},\n value: ${JSON.stringify(option.value)}\n }\n `,\n )\n .join(\",\\n\");\n\n return dedent`\n const ${field.name}Labels = {\n ${labels}\n } as const;\n `;\n}\n\nexport function getFieldComponents(fields: Field[]): FieldComponent[] {\n const components = fields.flatMap((field) => FIELD_COMPONENTS[field.type]);\n return [...new Set(components)];\n}\n\nexport function getFieldImports(components: FieldComponent[]): string[] {\n return [\n ...new Set(components.flatMap((component) => FIELD_IMPORTS[component])),\n ];\n}\n\nfunction displayDataPath(model: Model, field: Pick<Field, \"name\">): string {\n return `data.${model.name}.${field.name}`;\n}\n\nfunction renderDisplaySimple(\n model: Model,\n field: Pick<Field, \"name\" | \"title\">,\n valueExpression: string,\n): string {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">${valueExpression}</p>\n </div>\n `;\n}\n\nfunction renderDisplayDateField(\n model: Model,\n field: Field & { type: \"date\" | \"autodate\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const dateLine = `<p class=\"text-muted-foreground\">{new Date(${dataPath}).toLocaleDateString()}</p>`;\n const body = field.required\n ? dateLine\n : dedent`\n {#if ${dataPath}}\n ${dateLine}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nfunction renderDisplayUrlField(\n model: Model,\n field: Field & { type: \"url\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const anchor = dedent`\n <a href={${dataPath}} target=\"_blank\" rel=\"noopener noreferrer\">\n {${dataPath}}\n </a>\n `;\n const body = field.required\n ? anchor\n : dedent`\n {#if ${dataPath}}\n ${anchor}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">\n ${body}\n </p>\n </div>\n `;\n}\n\nfunction renderDisplaySelectField(\n model: Model,\n field: Extract<Field, { type: \"select\" }>,\n): string {\n const dataPath = displayDataPath(model, field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#each ${dataPath} as ${field.name}}\n <Badge variant=\"outline\" class=\"mr-1\">{${field.name}Labels[${field.name}].label}</Badge>\n {/each}\n </div>\n `;\n }\n\n const badge = `<Badge variant=\"outline\" class=\"mr-1\">{${field.name}Labels[${dataPath}].label}</Badge>`;\n const body = field.required\n ? badge\n : dedent`\n {#if ${dataPath}}\n ${badge}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nfunction renderDisplayFileField(\n model: Model,\n field: Extract<Field, { type: \"file\" }>,\n): string {\n const dataPath = displayDataPath(model, field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${dataPath}}\n {#each ${dataPath} as filename}\n <div class=\"flex gap-2 items-center\">\n {#if [\".jpg\", \".png\", \".jpeg\", \".webp\", \".gif\"].some((ext) => filename.endsWith(ext))}\n <img\n src=\"/api/files/{data.${model.name}.collectionId}/{data.${model.name}.id}/{filename}\"\n alt={filename}\n class=\"w-16 h-16 rounded-md object-cover\"\n />\n {:else}\n <div class=\"flex items-center justify-center w-16 h-16 bg-muted rounded-md\">\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n <p class=\"text-sm text-muted-foreground\">{filename}</p>\n </div>\n {/each}\n {/if}\n </div>\n `;\n }\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${dataPath}}\n <div class=\"flex gap-2 items-center\">\n {#if [\".jpg\", \".png\", \".jpeg\", \".webp\", \".gif\"].some((ext) => ${dataPath}?.endsWith(ext))}\n <img\n src=\"/api/files/{data.${model.name}.collectionId}/{data.${model.name}.id}/{${dataPath}}\"\n alt={${dataPath}}\n class=\"w-16 h-16 rounded-md object-cover\"\n />\n {:else}\n <div class=\"flex items-center justify-center w-16 h-16 bg-muted rounded-md\">\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n <p class=\"text-sm text-muted-foreground\">{${dataPath}}</p>\n </div>\n {/if}\n </div>\n `;\n}\n\nfunction relationListUrl(field: Extract<Field, { type: \"relation\" }>): string {\n return `/${changeCase.kebabCase(field.relatedModel.pluralDisplayName)}`;\n}\n\nfunction renderDisplayRelationField(\n model: Model,\n field: Extract<Field, { type: \"relation\" }>,\n): string {\n const relationPath = `data.${model.name}.expand?.${field.name}`;\n const listUrl = relationListUrl(field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#each ${relationPath} ?? [] as ${field.singularRelationName}}\n <a href=\"${listUrl}/{${field.singularRelationName}.id}\">\n <Badge variant=\"outline\" class=\"text-muted-foreground\">\n {${field.singularRelationName}.${field.displayField}}\n <CircleArrowRightIcon class=\"w-4 h-4\" />\n </Badge>\n </a>\n {/each}\n </div>\n `;\n }\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${relationPath}}\n <a href=\"${listUrl}/{${relationPath}.id}\">\n <Badge variant=\"outline\" class=\"text-muted-foreground\">\n {${relationPath}.${field.displayField}}\n <CircleArrowRightIcon class=\"w-4 h-4\" />\n </Badge>\n </a>\n {/if}\n </div>\n `;\n}\n\nfunction renderDisplayGeoPointField(\n model: Model,\n field: Field & { type: \"geoPoint\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const content = dedent`\n {#await import(\"#lib/components/ui/leaflet/leaflet.svelte\")}\n <div class=\"h-56.25 w-full bg-input rounded-md\"></div>\n {:then { default: Leaflet }}\n <Leaflet point={${dataPath}} readonly class=\"rounded-md overflow-hidden\" />\n {/await}\n <p class=\"text-muted-foreground\">\n {${dataPath}?.lat.toFixed(6)}, {${dataPath}?.lon.toFixed(6)}\n </p>\n `;\n const body = field.required\n ? content\n : dedent`\n {#if ${dataPath}}\n ${content}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nexport function renderDisplayField(model: Model, field: Field): string {\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"editor\":\n return renderDisplaySimple(\n model,\n field,\n `{${displayDataPath(model, field)}}`,\n );\n case \"password\":\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">\n <code class=\"text-xs font-mono bg-muted rounded-md px-1 py-0.5\">********</code>\n </p>\n </div>\n `;\n case \"bool\":\n return renderDisplaySimple(\n model,\n field,\n `{${displayDataPath(model, field)} ? \"Yes\" : \"No\"}`,\n );\n case \"date\":\n case \"autodate\":\n return renderDisplayDateField(\n model,\n field as Field & { type: \"date\" | \"autodate\" },\n );\n case \"url\":\n return renderDisplayUrlField(model, field as Field & { type: \"url\" });\n case \"select\":\n return renderDisplaySelectField(model, field);\n case \"file\":\n return renderDisplayFileField(model, field);\n case \"json\":\n return renderDisplaySimple(\n model,\n field,\n `{JSON.stringify(${displayDataPath(model, field)})}`,\n );\n case \"geoPoint\":\n return renderDisplayGeoPointField(\n model,\n field as Field & { type: \"geoPoint\" },\n );\n case \"relation\":\n return renderDisplayRelationField(model, field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n","import dedent from \"dedent\";\nimport type { Field } from \"../../parse\";\n\n/**\n * Native-element field markup, shared by every form flavour that does not go\n * through formsnap. Two things vary independently:\n *\n * - the **binding**: how a control is tied to the form library (superforms\n * stores, or a SvelteKit remote form's `.as()` / `.issues()`), and\n * - the **style**: shadcn's `Input`/`Textarea` plus tailwind classes, or bare\n * elements with `data-*` hooks for projects that have neither.\n */\n\nexport type ControlKind =\n \"input\" | \"textarea\" | \"checkbox\" | \"select\" | \"file\" | \"readonly\";\n\nexport interface ControlOptions {\n /** The `type` attribute of an `<input>`. */\n htmlType?: string;\n multiple?: boolean;\n required?: boolean;\n}\n\nexport interface PlainBinding {\n /** Attributes tying a control to its field, emitted right after `id`. */\n control(field: Field, kind: ControlKind, options: ControlOptions): string;\n /** Markup listing the field's validation errors. */\n errors(field: Field, errorAttrs: string): string;\n /** Expression that is truthy while the field has errors. */\n invalid(field: Field): string;\n /** Field types the binding has no markup for; they render as a TODO comment. */\n unsupported: Field[\"type\"][];\n /** Further fields the binding has no markup for, rendered the same way. */\n unsupportedField?(field: Field): boolean;\n /** Name used in the TODO comment of an unsupported field. */\n label: string;\n}\n\ntype Layout = \"default\" | \"wide\" | \"inline\";\n\nexport interface PlainStyle {\n input: string;\n textarea: string;\n wrapper(field: Field, layout: Layout, binding: PlainBinding): string;\n labelAttrs: string;\n selectAttrs: string;\n fileAttrs: string;\n errorAttrs: string;\n}\n\n/** shadcn `Input`/`Textarea` and tailwind classes: what the remote generators emit. */\nexport const SHADCN_STYLE: PlainStyle = {\n input: \"Input\",\n textarea: \"Textarea\",\n wrapper(_field, layout) {\n const classes: Record<Layout, string> = {\n default: \"space-y-2 col-span-1\",\n wide: \"space-y-2 col-span-2\",\n inline: \"col-span-1 flex items-start space-x-2\",\n };\n return ` class=\"${classes[layout]}\"`;\n },\n labelAttrs: ' class=\"text-sm font-medium\"',\n selectAttrs:\n ' class=\"border-input bg-background flex h-9 w-full rounded-md border px-3 py-1 text-sm\"',\n fileAttrs: ' class=\"text-sm\"',\n errorAttrs: ' class=\"text-destructive text-sm\"',\n};\n\n/**\n * No components and no classes. `data-field` / `data-invalid` / `data-error`\n * let a project style every generated form from one stylesheet.\n */\nexport const NATIVE_STYLE: PlainStyle = {\n input: \"input\",\n textarea: \"textarea\",\n wrapper(field, _layout, binding) {\n return ` data-field=\"${field.name}\" data-invalid={${binding.invalid(field)} ? \"\" : undefined}`;\n },\n labelAttrs: \"\",\n selectAttrs: \"\",\n fileAttrs: \"\",\n errorAttrs: \" data-error\",\n};\n\nexport function isMultiple(field: Field): boolean {\n return (\n (field.type === \"select\" ||\n field.type === \"relation\" ||\n field.type === \"file\") &&\n field.maxSelect > 1\n );\n}\n\nconst flag = (on: boolean | undefined, attr: string) => (on ? ` ${attr}` : \"\");\n\n/** `<input>` types a remote form field's `.as()` takes as they are. */\nconst REMOTE_INPUT_TYPES = [\n \"text\",\n \"number\",\n \"email\",\n \"password\",\n \"url\",\n \"date\",\n];\n\n/**\n * Fields a remote form has a control for. A relation needs the related\n * records and a geoPoint its own two inputs, neither of which this renderer\n * writes yet. A multi-file field uploads through PocketBase's `name+` key,\n * which is not a valid remote form field path, and its own key holds the\n * kept filenames, so neither takes `.as(\"file multiple\")`.\n */\nexport function remoteFormSupports(field: Field): boolean {\n return (\n field.type !== \"geoPoint\" &&\n field.type !== \"relation\" &&\n !(field.type === \"file\" && isMultiple(field))\n );\n}\n\n/**\n * Fields a form cannot show the stored value of. On a form that edits a\n * record they start empty, are never `required`, and leave the stored value\n * alone when posted empty.\n */\nexport function isWriteOnly(field: Field): boolean {\n return field.type === \"file\" || field.type === \"password\";\n}\n\nexport interface RemoteBindingOptions {\n /**\n * The form edits an existing record, so a write-only field may be left\n * empty to keep what is stored.\n */\n edit?: boolean;\n}\n\n/**\n * A remote form posts each control under the name `.as()` generates (the\n * field path plus a type prefix, an array marker and the form id), and\n * SvelteKit 3 rejects any other name. So every control spreads `.as()` and\n * none writes `name`, `type` or `multiple` by hand: `.as()` sets `type` for\n * everything but text and selects, and `multiple` for `select multiple`,\n * whose `[]` name marker is what lets several values through.\n */\nexport function remoteBinding(\n formVar: string,\n options: RemoteBindingOptions = {},\n): PlainBinding {\n const as = (field: Field, type: string) =>\n `{...${formVar}.fields.${field.name}.as(${JSON.stringify(type)})}`;\n\n return {\n label: \"remote form variant\",\n unsupported: [],\n unsupportedField: (field) => !remoteFormSupports(field),\n control(field, kind, { htmlType, multiple, required }) {\n const tail = flag(\n required && !(options.edit && isWriteOnly(field)),\n \"required\",\n );\n switch (kind) {\n case \"input\": {\n const asType =\n htmlType && REMOTE_INPUT_TYPES.includes(htmlType)\n ? htmlType\n : \"text\";\n return `${as(field, asType)}${tail}`;\n }\n case \"textarea\":\n return `${as(field, \"text\")}${tail}`;\n case \"checkbox\":\n return `${as(field, \"checkbox\")}${tail}`;\n case \"select\":\n return `${as(field, multiple ? \"select multiple\" : \"select\")}${tail}`;\n case \"file\":\n return `${as(field, \"file\")}${tail}`;\n case \"readonly\":\n return `${as(field, \"text\")} readonly`;\n }\n },\n errors(field, errorAttrs) {\n return dedent`\n {#each ${formVar}.fields.${field.name}.issues() as issue}\n <p${errorAttrs}>{issue.message}</p>\n {/each}\n `;\n },\n invalid(field) {\n return `${formVar}.fields.${field.name}.issues()?.length`;\n },\n };\n}\n\n/**\n * The value a remote form control starts from when the form edits `record`\n * (an expression, `data.post`), or `undefined` for a field with no control\n * or nothing to show. What PocketBase returns is not always what the control\n * takes: `<input type=\"date\">` wants `YYYY-MM-DD`, not a timestamp, and a\n * json field is edited as text.\n */\nexport function remoteSeedExpression(\n field: Field,\n record: string,\n): string | undefined {\n if (!remoteFormSupports(field) || isWriteOnly(field)) return undefined;\n const value = `${record}.${field.name}`;\n switch (field.type) {\n case \"date\":\n return `${value}?.slice(0, 10)`;\n case \"json\":\n return `${value} == null ? \"\" : JSON.stringify(${value}, null, 2)`;\n default:\n return value;\n }\n}\n\n/** Array-valued fields report their own errors under `_errors`. */\nfunction superformsErrors(field: Field): string {\n return isMultiple(field)\n ? `$errors.${field.name}?._errors`\n : `$errors.${field.name}`;\n}\n\n/** Controls that take superforms' `$constraints` instead of a literal `required`. */\nconst CONSTRAINED: ControlKind[] = [\"input\", \"textarea\"];\n\nexport function usesConstraints(fields: Field[]): boolean {\n return fields.some((field) =>\n [\n \"text\",\n \"number\",\n \"email\",\n \"password\",\n \"url\",\n \"date\",\n \"editor\",\n \"json\",\n ].includes(field.type),\n );\n}\n\nexport function superformsBinding(): PlainBinding {\n return {\n label: \"plain form variant\",\n unsupported: [],\n control(field, kind, { htmlType, multiple, required }) {\n const value = `$formData.${field.name}`;\n const errors = superformsErrors(field);\n const aria = ` aria-invalid={${errors} ? \"true\" : undefined} aria-describedby={${errors} ? \"${field.name}-error\" : undefined}`;\n const tail = CONSTRAINED.includes(kind)\n ? ` {...$constraints.${field.name}}`\n : `${flag(multiple, \"multiple\")}${flag(required, \"required\")}`;\n\n switch (kind) {\n case \"input\":\n return `name=\"${field.name}\" type=\"${htmlType ?? \"text\"}\" bind:value={${value}}${aria}${tail}`;\n case \"textarea\":\n case \"select\":\n return `name=\"${field.name}\" bind:value={${value}}${aria}${tail}`;\n case \"checkbox\":\n return `name=\"${field.name}\" type=\"checkbox\" bind:checked={${value}}${aria}${tail}`;\n case \"file\":\n // Multi-file fields follow PocketBase's `name+` (append) convention;\n // the schema carries a matching `name+` key.\n return multiple\n ? `name=\"${field.name}+\" type=\"file\" oninput={(e) => ($formData[\"${field.name}+\"] = Array.from(e.currentTarget.files ?? []))}${aria}${tail}`\n : `name=\"${field.name}\" type=\"file\" oninput={(e) => (${value} = e.currentTarget.files?.[0] ?? \"\")}${aria}${tail}`;\n case \"readonly\":\n return `name=\"${field.name}\" type=\"text\" value={${value}} readonly`;\n }\n },\n errors(field, errorAttrs) {\n const errors = superformsErrors(field);\n return dedent`\n {#if ${errors}}\n <p id=\"${field.name}-error\"${errorAttrs}>{${errors}}</p>\n {/if}\n `;\n },\n invalid: superformsErrors,\n };\n}\n\nexport interface PlainRenderer {\n render(field: Field): string;\n}\n\nexport function plainRenderer(\n binding: PlainBinding,\n style: PlainStyle,\n): PlainRenderer {\n const label = (field: Field, htmlFor = field.name) =>\n `<label for=\"${htmlFor}\"${style.labelAttrs}>${field.title}</label>`;\n\n function input(field: Field, htmlType: string): string {\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <${style.input} id=\"${field.name}\" ${binding.control(field, \"input\", { htmlType, required: field.required })} />\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function textarea(field: Field): string {\n const tag = style.textarea;\n const control = binding.control(field, \"textarea\", {\n required: field.required,\n });\n const element =\n tag === \"textarea\"\n ? `<textarea id=\"${field.name}\" ${control}></textarea>`\n : `<${tag} id=\"${field.name}\" ${control} />`;\n return dedent`\n <div${style.wrapper(field, \"wide\", binding)}>\n ${label(field)}\n ${element}\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function checkbox(field: Field): string {\n return dedent`\n <div${style.wrapper(field, \"inline\", binding)}>\n <input id=\"${field.name}\" ${binding.control(field, \"checkbox\", { required: field.required })} />\n ${label(field)}\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function select(field: Extract<Field, { type: \"select\" }>): string {\n const options = field.options\n .map(\n (option) =>\n `<option value=${JSON.stringify(option.value)}>${option.label}</option>`,\n )\n .join(\"\\n \");\n\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <select id=\"${field.name}\" ${binding.control(field, \"select\", { multiple: isMultiple(field), required: field.required })}${style.selectAttrs}>\n ${options}\n </select>\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function relation(field: Extract<Field, { type: \"relation\" }>): string {\n const multiple = isMultiple(field);\n const modelName = field.relatedModel.name;\n const placeholder = multiple\n ? \"\"\n : `<option value=\"\">Select ${field.relatedModel.displayName.toLowerCase()}</option>`;\n\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <select id=\"${field.name}\" ${binding.control(field, \"select\", { multiple, required: field.required })}${style.selectAttrs}>\n ${placeholder}\n {#each data.${field.relatedModel.pluralName} as ${modelName}}\n <option value={${modelName}.id}>{${modelName}.${field.displayField}}</option>\n {/each}\n </select>\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function file(field: Extract<Field, { type: \"file\" }>): string {\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <input id=\"${field.name}\" ${binding.control(field, \"file\", { multiple: isMultiple(field), required: field.required })}${style.fileAttrs} />\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function autodate(field: Field): string {\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <${style.input} id=\"${field.name}\" ${binding.control(field, \"readonly\", {})} />\n </div>\n `;\n }\n\n /**\n * PocketBase takes a geoPoint as `{ lat, lon }`; the form schema carries it\n * as a JSON string, kept in sync from `<name>Point` (see `geoPointState`).\n */\n function geoPoint(field: Field): string {\n const point = `${field.name}Point`;\n return dedent`\n <fieldset${style.wrapper(field, \"default\", binding)}>\n <legend>${field.title}</legend>\n <label for=\"${field.name}-lat\"${style.labelAttrs}>Latitude</label>\n <${style.input} id=\"${field.name}-lat\" type=\"number\" step=\"any\" min=\"-90\" max=\"90\" bind:value={${point}.lat} />\n <label for=\"${field.name}-lon\"${style.labelAttrs}>Longitude</label>\n <${style.input} id=\"${field.name}-lon\" type=\"number\" step=\"any\" min=\"-180\" max=\"180\" bind:value={${point}.lon} />\n <input type=\"hidden\" name=\"${field.name}\" value={$formData.${field.name}} />\n ${binding.errors(field, style.errorAttrs)}\n </fieldset>\n `;\n }\n\n return {\n render(field) {\n if (\n binding.unsupported.includes(field.type) ||\n binding.unsupportedField?.(field)\n ) {\n return `<!-- TODO: ${field.type} field \"${field.name}\" is not yet supported by the ${binding.label} -->`;\n }\n\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"password\":\n case \"url\":\n case \"date\":\n return input(field, field.type);\n case \"editor\":\n case \"json\":\n return textarea(field);\n case \"bool\":\n return checkbox(field);\n case \"select\":\n return select(field);\n case \"relation\":\n return relation(field);\n case \"file\":\n return file(field);\n case \"autodate\":\n return autodate(field);\n case \"geoPoint\":\n return geoPoint(field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n },\n };\n}\n\n/** Script-side state backing the lat/lon inputs of each geoPoint field. */\nexport function geoPointState(fields: Field[]): string {\n return fields\n .filter((field) => field.type === \"geoPoint\")\n .map(\n (field) => dedent`\n let ${field.name}Point = $state<{ lat: number; lon: number }>(\n JSON.parse($formData.${field.name} || '{\"lat\":0,\"lon\":0}'),\n );\n $effect(() => {\n $formData.${field.name} = JSON.stringify(${field.name}Point);\n });\n `,\n )\n .join(\"\\n\\n\");\n}\n","import dedent from \"dedent\";\nimport type { Options } from \"./types\";\nimport { parseModel, type Collection, type Field, type Model } from \"../parse\";\n\nconst GENERATED_DATE = \"2024-01-01T00:00:00.000Z\";\n\nclass RawExpression {\n constructor(public readonly expression: string) {}\n}\n\ntype FixtureValue =\n | string\n | number\n | boolean\n | null\n | FixtureValue[]\n | { [key: string]: FixtureValue }\n | RawExpression;\n\ntype RuntimeCollectionField = Collection[\"fields\"][number] & {\n values?: string[];\n system?: boolean;\n};\n\ntype ScaffoldUrls = {\n list: string;\n new: string;\n show: string;\n edit: string;\n};\n\nfunction fixtureToCode(value: FixtureValue): string {\n if (value instanceof RawExpression) {\n return value.expression;\n }\n\n if (Array.isArray(value)) {\n return `[${value.map((entry) => fixtureToCode(entry)).join(\", \")}]`;\n }\n\n if (value && typeof value === \"object\") {\n const entries = Object.entries(value)\n .map(([key, entry]) => `${JSON.stringify(key)}: ${fixtureToCode(entry)}`)\n .join(\", \");\n return `{ ${entries} }`;\n }\n\n return JSON.stringify(value);\n}\n\nfunction fixtureObjectToCode(data: Record<string, FixtureValue>): string {\n const entries = Object.entries(data).map(\n ([key, value]) => `${JSON.stringify(key)}: ${fixtureToCode(value)}`,\n );\n return `{ ${entries.join(\", \")} }`;\n}\n\nfunction fieldTypeFromCollectionField(\n rawType: string,\n): Field[\"type\"] | undefined {\n switch (rawType) {\n case \"text\":\n case \"number\":\n case \"bool\":\n case \"date\":\n case \"email\":\n case \"password\":\n case \"url\":\n case \"editor\":\n case \"autodate\":\n case \"select\":\n case \"file\":\n case \"json\":\n case \"geoPoint\":\n case \"relation\":\n return rawType;\n case \"string\":\n return \"text\";\n case \"boolean\":\n return \"bool\";\n case \"datetime\":\n case \"timestamp\":\n return \"date\";\n case \"references\":\n return \"relation\";\n case \"float\":\n case \"integer\":\n case \"int\":\n case \"decimal\":\n case \"double\":\n return \"number\";\n default:\n return undefined;\n }\n}\n\nfunction relationUrl(url: string, idExpression: string): string {\n return url.replace(\"[id]\", `\\${${idExpression}}`);\n}\n\nfunction testizeUrl(url: string, dynamicParams: string[]): string {\n if (dynamicParams.length === 0) return url;\n return url.replace(/\\[([^\\]]+)\\]/g, (match, name) =>\n dynamicParams.includes(name) ? `test_${name}` : match,\n );\n}\n\nfunction dynamicParamsTodo(dynamicParams: string[]): string {\n if (dynamicParams.length === 0) return \"\";\n return `// TODO: customize test fixture values for dynamic route params: ${dynamicParams.join(\", \")}\\n`;\n}\n\nfunction mockValueForField(\n field: Pick<Field, \"name\" | \"type\"> & Partial<Field>,\n relationIdsByCollectionId: Record<string, string>,\n options: { forForm: boolean; authEnabled: boolean },\n): FixtureValue | undefined {\n // A unique field cannot hold the same sample in two records, and the tests\n // create several. `crypto` is a global in the Node versions vitest runs on.\n if (field.unique) {\n const suffix = \"${crypto.randomUUID().slice(0, 8)}\";\n switch (field.type) {\n case \"text\":\n case \"editor\":\n return new RawExpression(`\\`${field.name}-${suffix}\\``);\n case \"email\":\n return new RawExpression(`\\`test-${suffix}@example.com\\``);\n case \"url\":\n return new RawExpression(`\\`https://example.com/${suffix}\\``);\n case \"number\":\n return new RawExpression(\"Math.floor(Math.random() * 1e9)\");\n }\n }\n switch (field.type) {\n case \"text\":\n case \"editor\":\n return `${field.name} value`;\n case \"number\":\n return 42;\n case \"bool\":\n return true;\n case \"date\":\n return GENERATED_DATE;\n case \"email\":\n return `test-${field.name}@example.com`;\n case \"password\":\n return \"password\";\n case \"url\":\n return \"https://example.com\";\n case \"json\":\n return options.forForm\n ? JSON.stringify({ [field.name]: \"value\" })\n : { [field.name]: \"value\" };\n case \"geoPoint\":\n return options.forForm\n ? JSON.stringify({ lat: 40.7128, lon: -74.006 })\n : { lat: 40.7128, lon: -74.006 };\n case \"select\": {\n const value = field.options?.[0]?.value ?? \"default\";\n return field.maxSelect && field.maxSelect > 1 ? [value] : value;\n }\n case \"relation\": {\n if (\n options.authEnabled &&\n (field.isCurrentUser || field.relatedModel?.tableName === \"users\")\n ) {\n return new RawExpression(\"context.user.id\");\n }\n\n const relationId = field.collectionId\n ? relationIdsByCollectionId[field.collectionId]\n : undefined;\n if (relationId) {\n return new RawExpression(relationId);\n }\n return \"missing-relation-id\";\n }\n case \"file\":\n case \"autodate\":\n return undefined;\n default:\n return undefined;\n }\n}\n\nfunction fixtureDataFromFields(\n fields: Field[],\n relationIdsByCollectionId: Record<string, string>,\n options: { forForm: boolean; authEnabled: boolean },\n): Record<string, FixtureValue> {\n const data: Record<string, FixtureValue> = {};\n\n for (const field of fields) {\n if (field.type === \"file\" || field.type === \"autodate\") {\n continue;\n }\n\n if (\n options.authEnabled &&\n field.type === \"relation\" &&\n field.isCurrentUser\n ) {\n if (!options.forForm) {\n data[field.name] = new RawExpression(\"context.user.id\");\n }\n continue;\n }\n\n const value = mockValueForField(field, relationIdsByCollectionId, options);\n if (value !== undefined) {\n data[field.name] = value;\n }\n }\n\n return data;\n}\n\nfunction fixtureDataFromCollectionFields(\n fields: RuntimeCollectionField[],\n relationIdsByCollectionId: Record<string, string>,\n options: Pick<Options, \"features\">,\n): Record<string, FixtureValue> {\n const data: Record<string, FixtureValue> = {};\n\n for (const field of fields) {\n if (field.system || field.name === \"id\") {\n continue;\n }\n\n const type = fieldTypeFromCollectionField(field.type);\n if (!type || type === \"file\" || type === \"autodate\") {\n continue;\n }\n\n if (type === \"relation\" && !field.collectionId) {\n continue;\n }\n\n let value: FixtureValue | undefined;\n if (type === \"relation\") {\n value = field.collectionId\n ? new RawExpression(\n relationIdsByCollectionId[field.collectionId] ??\n '\"missing-relation-id\"',\n )\n : undefined;\n } else if (type === \"select\") {\n const firstValue = field.values?.[0] ?? \"default\";\n value = (field.maxSelect ?? 1) > 1 ? [firstValue] : firstValue;\n } else {\n value = mockValueForField(\n { name: field.name, type },\n relationIdsByCollectionId,\n { forForm: false, authEnabled: options.features.auth },\n );\n }\n\n if (value !== undefined) {\n data[field.name] = value;\n }\n }\n\n return data;\n}\n\nfunction ensureAuthCollectionFixture(data: Record<string, FixtureValue>) {\n data.email = new RawExpression(\n \"`test-${Math.random().toString(36).slice(2)}@example.com`\",\n );\n data.password = \"password\";\n data.passwordConfirm = \"password\";\n}\n\nfunction orderedDependencyCollections(\n collection: Collection | undefined,\n collections: Collection[],\n): Collection[] {\n if (!collection) {\n return [];\n }\n\n const byId = new Map(collections.map((entry) => [entry.id, entry]));\n const visited = new Set<string>();\n const visiting = new Set<string>();\n const ordered: Collection[] = [];\n\n const walk = (collectionId: string) => {\n if (visited.has(collectionId) || visiting.has(collectionId)) {\n return;\n }\n\n const candidate = byId.get(collectionId);\n if (!candidate) {\n return;\n }\n\n visiting.add(collectionId);\n for (const field of candidate.fields as RuntimeCollectionField[]) {\n if (field.type !== \"relation\" || !field.collectionId) {\n continue;\n }\n walk(field.collectionId);\n }\n visiting.delete(collectionId);\n visited.add(collectionId);\n ordered.push(candidate);\n };\n\n for (const field of collection.fields as RuntimeCollectionField[]) {\n if (field.type !== \"relation\" || !field.collectionId) {\n continue;\n }\n walk(field.collectionId);\n }\n\n return ordered;\n}\n\nfunction uniqueVarName(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n\n let index = 2;\n while (used.has(`${base}${index}`)) {\n index += 1;\n }\n\n const name = `${base}${index}`;\n used.add(name);\n return name;\n}\n\nfunction fallbackCollectionFromFields(\n model: Model,\n fields: Field[],\n): Collection {\n return {\n id: `generated-${model.tableName}`,\n name: model.tableName,\n type: \"base\",\n fields: fields.map((field) => {\n if (field.type === \"relation\") {\n return {\n name: field.name,\n type: field.type,\n collectionId: field.collectionId,\n maxSelect: field.maxSelect,\n };\n }\n\n if (field.type === \"select\") {\n return {\n name: field.name,\n type: field.type,\n maxSelect: field.maxSelect,\n values: field.options.map((option) => option.value),\n };\n }\n\n if (field.type === \"file\" || field.type === \"autodate\") {\n return {\n name: field.name,\n type: field.type,\n maxSelect: field.type === \"file\" ? field.maxSelect : undefined,\n };\n }\n\n return { name: field.name, type: field.type };\n }),\n };\n}\n\nfunction relationDependencyContext(\n model: Model,\n fields: Field[],\n options: Options,\n collections: Collection[],\n) {\n const collection =\n collections.find((entry) => entry.name === model.tableName) ??\n fallbackCollectionFromFields(model, fields);\n\n const dependencies = orderedDependencyCollections(\n collection,\n collections,\n ).filter((entry) => !(options.features.auth && entry.name === \"users\"));\n\n const relationIdsByCollectionId: Record<string, string> = {};\n // The authenticated user stands in for `users`, also where a dependency\n // points at it (`teams.owner`).\n const users = collections.find((entry) => entry.name === \"users\");\n if (options.features.auth && users) {\n relationIdsByCollectionId[users.id] = \"context.user.id\";\n }\n const dependencyVars: Array<{ varName: string; collection: Collection }> = [];\n const usedVarNames = new Set<string>();\n\n for (const dependency of dependencies) {\n const varName = uniqueVarName(\n parseModel(dependency.name).name,\n usedVarNames,\n );\n dependencyVars.push({ varName, collection: dependency });\n relationIdsByCollectionId[dependency.id] = `${varName}.id`;\n }\n\n const declarations = dependencyVars.length\n ? `${dependencyVars.map((dependency) => `let ${dependency.varName}: { id: string };`).join(\"\\n\")}\\n\\n`\n : \"\";\n\n const setupLines = dependencyVars.map(\n ({ varName, collection: dependency }) => {\n const payload = fixtureDataFromCollectionFields(\n dependency.fields as RuntimeCollectionField[],\n relationIdsByCollectionId,\n options,\n );\n if (dependency.type === \"auth\") {\n ensureAuthCollectionFixture(payload);\n }\n return `${varName} = await context.admin.collection(\"${dependency.name}\").create(${fixtureObjectToCode(payload)});`;\n },\n );\n\n const cleanupLines = dependencyVars\n .slice()\n .reverse()\n .map(\n ({ varName, collection: dependency }) =>\n `await context.admin.collection(\"${dependency.name}\").delete(${varName}.id);`,\n );\n\n const requestAgent = options.features.auth\n ? \"context.agent\"\n : \"context.request\";\n const authSetup = options.features.auth\n ? \"await context.agent.authenticateUser();\\n \"\n : \"\";\n\n const hasBeforeEach = setupLines.length > 0 || options.features.auth;\n const hasAfterEach = cleanupLines.length > 0;\n\n let setupSection = \"\";\n if (hasBeforeEach) {\n setupSection += dedent`\n beforeEach(async (context) => {\n ${authSetup}${setupLines.join(\"\\n \")}\n });\n `;\n }\n\n if (hasAfterEach) {\n setupSection +=\n \"\\n\\n\" +\n dedent`\n afterEach(async (context) => {\n ${cleanupLines.join(\"\\n \")}\n });\n `;\n }\n\n // Only the hooks that are used: the projects type-check with noUnusedLocals.\n const vitestImport = `import { ${[\n ...(hasAfterEach ? [\"afterEach\"] : []),\n ...(hasBeforeEach ? [\"beforeEach\"] : []),\n \"describe\",\n \"expect\",\n \"it\",\n ].join(\", \")} } from \"vitest\";`;\n\n return {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelDbData: fixtureObjectToCode(\n fixtureDataFromFields(fields, relationIdsByCollectionId, {\n forForm: false,\n authEnabled: options.features.auth,\n }),\n ),\n modelFormData: fixtureObjectToCode(\n fixtureDataFromFields(fields, relationIdsByCollectionId, {\n forForm: true,\n authEnabled: options.features.auth,\n }),\n ),\n };\n}\n\nexport function generateScaffoldServerTestSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelDbData,\n modelFormData,\n } = relationDependencyContext(model, fields, options, collections);\n\n const list = testizeUrl(urls.list, dynamicParams);\n const newUrl = testizeUrl(urls.new, dynamicParams);\n const show = testizeUrl(urls.show, dynamicParams);\n const edit = testizeUrl(urls.edit, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${model.pluralName}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${list}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${list}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${newUrl}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${newUrl}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${newUrl}\", () => {\n it(\"should create a new ${model.displayName.toLowerCase()}\", async (context) => {\n const response = await ${requestAgent}.post(\"${newUrl}\").type(\"form\").send(${modelFormData});\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(response.body.location);\n expect(response2.status).toBe(200);\n });\n });\n\n describe(\"GET ${show}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n\n it(\"should return a 404 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${show.replace(\"[id]\", \"non-existent\")}\");\n expect(response.status).toBe(404);\n });\n });\n\n describe(\"POST ${show}\", () => {\n it(\"should delete a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.post(\\`${relationUrl(show, \"id\")}\\`).type(\"form\");\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response2.status).toBe(404);\n });\n });\n\n describe(\"GET ${edit}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(edit, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${edit}\", () => {\n it(\"should update a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}\n .post(\\`${relationUrl(edit, \"id\")}\\`)\n .type(\"form\")\n .send(${modelFormData});\n expect(response.body.status).toBe(303);\n expect(response.body.location).toBe(\\`${relationUrl(show, \"id\")}\\`);\n });\n });\n });\n `;\n}\n\nexport function generateScaffoldRemoteServerTestSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelDbData,\n } = relationDependencyContext(model, fields, options, collections);\n\n const list = testizeUrl(urls.list, dynamicParams);\n const newUrl = testizeUrl(urls.new, dynamicParams);\n const show = testizeUrl(urls.show, dynamicParams);\n const edit = testizeUrl(urls.edit, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${model.pluralName}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${list}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${list}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${newUrl}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${newUrl}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${show}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n\n it(\"should return a 404 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${show.replace(\"[id]\", \"non-existent\")}\");\n expect(response.status).toBe(404);\n });\n });\n\n describe(\"POST ${show}\", () => {\n it(\"should delete a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.post(\\`${relationUrl(show, \"id\")}\\`).type(\"form\");\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response2.status).toBe(404);\n });\n });\n\n describe(\"GET ${edit}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(edit, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n });\n });\n `;\n}\n\nexport function generateFormServerTestSnippet(\n model: Model,\n formUrl: string,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelFormData,\n } = relationDependencyContext(model, fields, options, collections);\n\n const url = testizeUrl(formUrl, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${url}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${url}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${url}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${url}\", () => {\n it(\"should submit the form successfully\", async (context) => {\n const response = await ${requestAgent}.post(\"${url}\").type(\"form\").send(${modelFormData});\n expect(response.body.status).toBe(200);\n });\n });\n });\n `;\n}\n\nexport function generateFormRemoteServerTestSnippet(\n model: Model,\n formUrl: string,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const { declarations, vitestImport, setupSection, requestAgent } =\n relationDependencyContext(model, fields, options, collections);\n\n const url = testizeUrl(formUrl, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${url}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${url}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${url}\");\n expect(response.status).toBe(200);\n });\n });\n });\n `;\n}\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n getFieldComponents,\n getFieldImports,\n renderField,\n selectFieldLabelMap,\n} from \"../../../core/field\";\nimport {\n NATIVE_STYLE,\n geoPointState,\n plainRenderer,\n superformsBinding,\n usesConstraints,\n} from \"../../../core/field/plain\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport { SUPERFORMS, ZOD } from \"../../../core/constants\";\nimport { parseRoute, type Field, type Model } from \"../../../parse\";\nimport { generateFormServerTestSnippet } from \"../../../core/tests\";\nimport {\n generateSchemaSnippet,\n relationLoadLines,\n relationLoadReturnVars,\n resolveInputFields,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fieldDefs: fields };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\nfunction injectableHiddenInputs(injectables: Injectables): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input type=\"hidden\" name=\"${field.name}\" value=\"${value}\" />`,\n )\n .join(\"\\n\");\n}\n\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth ? \"locals.pb\" : \"locals.admin\";\n}\n\n/**\n * The relation field renderers read the related records from\n * `data.<pluralName>`, so `load` has to fetch them.\n */\nfunction relationLoad(fields: Field[], pb: string) {\n const vars = relationLoadReturnVars(fields);\n return {\n args: vars ? \"{ locals }\" : \"\",\n lines: relationLoadLines(fields, pb),\n returns: vars ? `, ${vars}` : \"\",\n };\n}\n\nfunction pageImports(model: Model, fields: Field[]): string[] {\n const components = getFieldComponents(fields);\n const imports = [\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zod4Client } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";`,\n ...getFieldImports(components),\n ];\n\n return [...new Set(imports)];\n}\n\nfunction pageScriptSnippet(model: Model, fields: Field[]): string {\n const selectFields = fields.filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n );\n const labelMaps = selectFields\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n\n return dedent`\n ${labelMaps}\n\n const form = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n const { form: formData } = form;\n `;\n}\n\nfunction pageSnippet(\n model: Model,\n fields: Field[],\n injectables: Injectables,\n): string {\n const imports = pageImports(model, fields).join(\"\\n\");\n const scriptSnippet = pageScriptSnippet(model, fields);\n const fieldSnippet = fields.map((field) => renderField(field)).join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n let { data } = $props();\n ${scriptSnippet}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName}</h1>\n </div>\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldSnippet}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button>Submit</Form.Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\n/**\n * The same page without shadcn-svelte, formsnap or tailwind: native elements\n * bound to the superforms stores. Without flash messages the action's\n * `message()` is shown inline.\n */\nfunction plainPageSnippet(\n model: Model,\n fields: Field[],\n injectables: Injectables,\n flash: boolean,\n): string {\n const renderer = plainRenderer(superformsBinding(), NATIVE_STYLE);\n const fieldSnippet = fields.map((field) => renderer.render(field)).join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const stores = [\n \"form: formData\",\n \"errors\",\n ...(usesConstraints(fields) ? [\"constraints\"] : []),\n ...(flash ? [] : [\"message\"]),\n \"enhance\",\n ].join(\", \");\n const status = flash\n ? \"\"\n : dedent`\n {#if $message}\n <p role=\"status\">{$message}</p>\n {/if}\n `;\n\n return dedent`\n <script lang=\"ts\">\n import { untrack } from \"svelte\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n let { data } = $props();\n\n const { ${stores} } = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n ${geoPointState(fields)}\n </script>\n\n <h1>${model.displayName}</h1>\n\n ${status}\n\n <form method=\"POST\"${enctype} use:enhance>\n ${fieldSnippet}\n ${hiddenInputs}\n <button type=\"submit\">Submit</button>\n </form>\n `;\n}\n\nfunction genericServerSnippet(\n model: Model,\n fields: Field[],\n pb: string,\n flash: boolean,\n): string {\n const withFiles = hasFiles(fields) && flash;\n const relations = relationLoad(fields, pb);\n const imports = dedent`\n import { fail, ${flash ? \"\" : \"message, \"}superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n ${flash ? 'import { setFlash } from \"sveltekit-flash-message/server\";' : \"\"}\n `;\n // `message()` strips files from the returned form itself.\n const success = flash\n ? dedent`\n setFlash({ type: \"toast\", message: \"Form posted successfully\" }, cookies);\n\n return ${withFiles ? \"withFiles({ form })\" : \"{ form }\"};\n `\n : 'return message(form, \"Form posted successfully\");';\n\n return dedent`\n ${imports}\n\n export const load = async (${relations.args}) => {\n ${relations.lines}\n const form = await superValidate(zod4(${model.schemaName}));\n return { form${relations.returns} };\n };\n\n export const actions = {\n default: async ({ request${flash ? \", cookies\" : \"\"} }) => {\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n ${success}\n }\n };\n `;\n}\n\nfunction createServerSnippet(\n model: Model,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n authMode: boolean,\n flash: boolean,\n): string {\n const withFiles = hasFiles(fields);\n const relations = relationLoad(fields, pb);\n const success = flash\n ? dedent`\n setFlash({ type: \"toast\", message: \"${model.displayName} created\" }, cookies);\n\n return ${withFiles ? \"withFiles({ form })\" : \"{ form }\"};\n `\n : `return message(form, \"${model.displayName} created\");`;\n const { currentUserField, currentTeamField } = injectables;\n const injections: string[] = [];\n if (authMode && currentUserField) {\n injections.push(`${currentUserField.name}: locals.pb.authStore.record?.id`);\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...form.data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"form.data\";\n\n return dedent`\n import { fail } from \"@sveltejs/kit\";\n import { ${flash ? \"\" : \"message, \"}superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\n ${flash ? 'import { setFlash } from \"sveltekit-flash-message/server\";' : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const load = async (${relations.args}) => {\n ${relations.lines}\n return { form: await superValidate(zod4(${model.schemaName}))${relations.returns} };\n };\n\n export const actions = {\n default: async ({ locals, request${flash ? \", cookies\" : \"\"} }) => {\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n try {\n await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n ${success}\n }\n };\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const route = parseRoute(options.input.route, model, options, \"form\");\n const ui = resolveUi(options);\n const flash = options.input.flash ?? true;\n const serverTests = options.input.serverTests ?? true;\n\n // When fields were derived from an existing collection (no fieldDefs given),\n // generate a server action that creates a record in that collection. When\n // fields were explicitly provided, keep generic-form behavior (validate +\n // flash, no DB write) — the user has signaled custom field shape.\n const createMode = !shouldCreateCollection;\n const injectables = createMode ? findInjectables(fields) : {};\n const uiFields = createMode\n ? fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n )\n : fields;\n\n const serverContent = createMode\n ? createServerSnippet(\n model,\n uiFields,\n injectables,\n pbInstance(options),\n options.features.auth,\n flash,\n )\n : genericServerSnippet(model, uiFields, pbInstance(options), flash);\n\n const creates = [\n toFile(\n `${route.fileBase}/+page.svelte`,\n ui === \"plain\"\n ? plainPageSnippet(model, uiFields, injectables, flash)\n : pageSnippet(model, uiFields, injectables),\n ),\n toFile(`${route.fileBase}/+page.server.ts`, serverContent),\n ...(serverTests\n ? [\n toFile(\n `${route.fileBase}/server.test.ts`,\n generateFormServerTestSnippet(\n model,\n route.urlBase,\n fields,\n options,\n collections,\n route.dynamicParams,\n ),\n ),\n ]\n : []),\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: false,\n forForm: true,\n }),\n ),\n ];\n\n // Plain markup needs nothing from the shadcn-svelte registry.\n const components =\n ui === \"plain\" ? [] : (getFieldComponents(uiFields) as Component[]);\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n packages: [SUPERFORMS, ZOD],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-form\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/generate/form\";\nconst DOCS = \"/generate/form\";\n\n// Generate entrypoint for the pattern. This function is roughly the same for all patterns.\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a form\",\n summary: \"Generates a form.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"sveltekit\", \"superforms\", \"validation\", \"zod\"],\n\n command: {\n raw: \"vela generate form contact name:text email:email message:editor\",\n base: \"vela generate form\",\n argv: [\"contact\", \"name:text\", \"email:email\", \"message:editor\"],\n },\n\n examples: [\n {\n command: \"contact name:text! email:email! message:editor\",\n description: \"Contact form with required text fields and a rich editor.\",\n },\n {\n command: \"profile avatar:file bio:editor website:url\",\n description: \"File upload, editor, and URL validation.\",\n },\n {\n command: \"feedback rating:select(1,2,3,4,5) comment:editor\",\n description: \"Select enum with a long-form comment.\",\n },\n {\n command:\n 'project name:text! description:editor --route \"(app)/[team_id]/projects/new\"',\n description:\n \"Team-scoped create form. Schema lives at /lib/schemas/project.ts; the form lives under the dynamic team route.\",\n },\n ],\n\n tests: 2,\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import type { Field } from \"../../parse\";\nimport {\n NATIVE_STYLE,\n SHADCN_STYLE,\n plainRenderer,\n remoteBinding,\n} from \"./plain\";\n\nexport type RemoteFieldComponent = \"input\" | \"textarea\" | \"button\";\n\nconst REMOTE_FIELD_COMPONENTS: Record<Field[\"type\"], RemoteFieldComponent[]> = {\n text: [\"input\"],\n number: [\"input\"],\n email: [\"input\"],\n password: [\"input\"],\n url: [\"input\"],\n date: [\"input\"],\n bool: [],\n editor: [\"textarea\"],\n json: [\"textarea\"],\n select: [],\n file: [],\n autodate: [\"input\"],\n geoPoint: [],\n relation: [],\n};\n\nconst REMOTE_FIELD_IMPORTS: Record<RemoteFieldComponent, string> = {\n input: 'import { Input } from \"#lib/components/ui/input/index.js\";',\n textarea: 'import { Textarea } from \"#lib/components/ui/textarea/index.js\";',\n button: 'import { Button } from \"#lib/components/ui/button/index.js\";',\n};\n\nexport function getRemoteFieldComponents(\n fields: Field[],\n): RemoteFieldComponent[] {\n const components = fields.flatMap(\n (field) => REMOTE_FIELD_COMPONENTS[field.type],\n );\n return [...new Set(components)];\n}\n\nexport function getRemoteFieldImports(\n components: RemoteFieldComponent[],\n): string[] {\n return components.map((component) => REMOTE_FIELD_IMPORTS[component]);\n}\n\ninterface RemoteRenderOptions {\n formVar: string;\n /** Bare elements instead of shadcn's `Input`/`Textarea`; see `PlainStyle`. */\n native?: boolean;\n /** The form edits an existing record; see `RemoteBindingOptions`. */\n edit?: boolean;\n}\n\nexport function renderRemoteField(\n field: Field,\n options: RemoteRenderOptions,\n): string {\n return plainRenderer(\n remoteBinding(options.formVar, { edit: options.edit }),\n options.native ? NATIVE_STYLE : SHADCN_STYLE,\n ).render(field);\n}\n\n/** The import a generated remote function needs to call `requireUser()`. */\nexport const REQUIRE_USER_IMPORT =\n 'import { requireUser } from \"@velastack/pocketbase/auth\";';\n\n/**\n * The first lines of a generated remote function in a protected route: the\n * session check, kept in `user` when the function goes on to use it. Empty\n * when the route is public.\n */\nexport function requireUserLines(guard: boolean, usesUser: boolean): string {\n if (!guard) return \"\";\n return [\n \"// The folder this file is in protects its pages, not this function: a\",\n \"// remote function is an endpoint of its own, so it checks the session.\",\n usesUser ? \"const user = requireUser();\" : \"requireUser();\",\n ].join(\"\\n\");\n}\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n getRemoteFieldComponents,\n getRemoteFieldImports,\n renderRemoteField,\n REQUIRE_USER_IMPORT,\n requireUserLines,\n} from \"../../../core/field/remote\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport { VELASTACK_POCKETBASE, ZOD } from \"../../../core/constants\";\nimport {\n isProtectedRoute,\n parseRoute,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport { generateFormRemoteServerTestSnippet } from \"../../../core/tests\";\nimport {\n generateSchemaSnippet,\n resolveInputFields,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fieldDefs: fields };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction submitFormIdentifier(model: Model): string {\n return `submit${model.typeName}Form`;\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\nfunction injectableHiddenInputs(\n injectables: Injectables,\n formVar: string,\n): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input {...${formVar}.fields.${field.name}.as(\"hidden\", \"${value}\")} />`,\n )\n .join(\"\\n\");\n}\n\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth ? \"locals.pb\" : \"locals.admin\";\n}\n\nfunction pageImports(fields: Field[], formVar: string): string[] {\n const components = getRemoteFieldComponents(fields);\n const imports = [\n `import { ${formVar} } from \"./form.remote\";`,\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n ...getRemoteFieldImports(components),\n ];\n\n return [...new Set(imports)];\n}\n\nfunction pageSnippet(\n model: Model,\n fields: Field[],\n formVar: string,\n injectables: Injectables,\n): string {\n const imports = pageImports(fields, formVar).join(\"\\n\");\n const fieldSnippet = fields\n .map((field) => renderRemoteField(field, { formVar }))\n .join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName}</h1>\n </div>\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form {...${formVar}}${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldSnippet}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Button type=\"submit\">Submit</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\n/** The same page with native elements only; see `NATIVE_STYLE`. */\nfunction plainPageSnippet(\n model: Model,\n fields: Field[],\n formVar: string,\n injectables: Injectables,\n flash: boolean,\n): string {\n const fieldSnippet = fields\n .map((field) => renderRemoteField(field, { formVar, native: true }))\n .join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const status = flash\n ? \"\"\n : dedent`\n {#if ${formVar}.result?.success}\n <p role=\"status\">Form posted successfully</p>\n {/if}\n `;\n\n return dedent`\n <script lang=\"ts\">\n import { ${formVar} } from \"./form.remote\";\n </script>\n\n <h1>${model.displayName}</h1>\n\n ${status}\n\n <form {...${formVar}}${enctype}>\n ${fieldSnippet}\n ${hiddenInputs}\n <button type=\"submit\">Submit</button>\n </form>\n `;\n}\n\nfunction genericRemoteSnippet(\n model: Model,\n formVar: string,\n flash: boolean,\n guard: boolean,\n): string {\n if (!flash) {\n return dedent`\n import { form } from \"$app/server\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async () => {\n ${requireUserLines(guard, false)}\n return { success: true };\n });\n `;\n }\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n import { setFlash } from \"sveltekit-flash-message/server\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async (data) => {\n ${requireUserLines(guard, false)}\n const { cookies } = getRequestEvent();\n setFlash({ type: \"toast\", message: \"Form posted successfully\" }, cookies);\n return { success: true };\n });\n `;\n}\n\nfunction createRemoteSnippet(\n model: Model,\n formVar: string,\n injectables: Injectables,\n pb: string,\n authMode: boolean,\n flash: boolean,\n guard: boolean,\n): string {\n const { currentUserField, currentTeamField } = injectables;\n const injections: string[] = [];\n const usesUser = authMode && Boolean(currentUserField);\n if (authMode && currentUserField) {\n injections.push(\n `${currentUserField.name}: ${guard ? \"user.id\" : \"locals.pb.authStore.record?.id\"}`,\n );\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"data\";\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n ${flash ? 'import { setFlash } from \"sveltekit-flash-message/server\";' : \"\"}\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async (data) => {\n ${requireUserLines(guard, usesUser)}\n const { locals${flash ? \", cookies\" : \"\"} } = getRequestEvent();\n await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n ${flash ? `setFlash({ type: \"toast\", message: \"${model.displayName} created\" }, cookies);` : \"\"}\n return { success: true };\n });\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const route = parseRoute(options.input.route, model, options, \"form\");\n const formVar = submitFormIdentifier(model);\n const guard = isProtectedRoute(route, options);\n const ui = resolveUi(options);\n const flash = options.input.flash ?? true;\n const serverTests = options.input.serverTests ?? true;\n\n // When fields were derived from an existing collection (no fieldDefs given),\n // generate a remote form that creates a record. When fields were explicitly\n // provided, keep generic-form behavior (validate + flash, no DB write).\n const createMode = !shouldCreateCollection;\n const injectables = createMode ? findInjectables(fields) : {};\n const uiFields = createMode\n ? fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n )\n : fields;\n\n const remoteContent = createMode\n ? createRemoteSnippet(\n model,\n formVar,\n injectables,\n pbInstance(options),\n options.features.auth,\n flash,\n guard,\n )\n : genericRemoteSnippet(model, formVar, flash, guard);\n\n const creates = [\n toFile(\n `${route.fileBase}/+page.svelte`,\n ui === \"plain\"\n ? plainPageSnippet(model, uiFields, formVar, injectables, flash)\n : pageSnippet(model, uiFields, formVar, injectables),\n ),\n toFile(`${route.fileBase}/form.remote.ts`, remoteContent),\n ...(serverTests\n ? [\n toFile(\n `${route.fileBase}/server.test.ts`,\n generateFormRemoteServerTestSnippet(\n model,\n route.urlBase,\n fields,\n options,\n collections,\n route.dynamicParams,\n ),\n ),\n ]\n : []),\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: false,\n forForm: true,\n remote: true,\n }),\n ),\n ];\n\n // Plain markup needs nothing from the shadcn-svelte registry.\n const components =\n ui === \"plain\" ? [] : (getRemoteFieldComponents(uiFields) as Component[]);\n if (ui !== \"plain\" && !components.includes(\"button\")) {\n components.push(\"button\");\n }\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n packages: [ZOD, ...(guard ? [VELASTACK_POCKETBASE] : [])],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"generate-form-remote\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/generate/form-remote\";\nconst DOCS = \"/generate/form\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { modifyOutcomeToFile } = await import(\"../../../runtime/modify-file\");\n const { modifySvelteConfigRemote } =\n await import(\"../../../runtime/modify-svelte-config-remote\");\n const logger = getLogger(options);\n logger.info(\"Modifying config for remote functions\");\n const remote = modifySvelteConfigRemote(options.root);\n const svelteConfigFile = modifyOutcomeToFile(remote.filePath, remote.outcome);\n\n const runtimeRes = {\n ...baseRes,\n modifies: [\n ...baseRes.modifies,\n ...(svelteConfigFile ? [svelteConfigFile] : []),\n ],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(runtimeRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a form (remote functions)\",\n summary:\n \"Generates a form using SvelteKit remote functions instead of sveltekit-superforms.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"sveltekit\", \"remote-functions\", \"validation\", \"zod\"],\n\n command: {\n raw: \"vela generate form --remote contact name:text email:email message:editor\",\n base: \"vela generate form --remote\",\n argv: [\"contact\", \"name:text\", \"email:email\", \"message:editor\"],\n },\n\n examples: [\n {\n command: \"contact name:text! email:email! message:editor\",\n description: \"Contact form using remote functions.\",\n },\n {\n command: \"profile avatar:file bio:editor website:url\",\n description: \"File upload (multipart) + editor + URL validation.\",\n },\n {\n command: \"feedback rating:select(1,2,3,4,5) comment:editor\",\n description: \"Select enum with a long-form comment.\",\n },\n {\n command:\n 'project name:text! description:editor --route \"(app)/[team_id]/projects/new\"',\n description:\n \"Team-scoped create form using remote functions and a dynamic route param.\",\n },\n ],\n\n tests: 1,\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import pluralize from \"pluralize\";\nimport type { FieldChange, Options, Result } from \"../../../core/types\";\nimport type { Field, Model } from \"../../../parse\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport {\n loadCollections,\n toCollectionFieldSpec,\n uniqueIndexes,\n} from \"../../../core/shared\";\nimport { parseModel, resolveFields, validateModelName } from \"../../../parse\";\n\ntype Op = \"add\" | \"remove\" | \"rename\" | \"references\";\nconst VALID_OPS: ReadonlySet<Op> = new Set<Op>([\n \"add\",\n \"remove\",\n \"rename\",\n \"references\",\n]);\n\nfunction parsePatternArgs(argv: string[]): {\n collectionName: string;\n op: Op;\n rest: string[];\n} {\n const [collectionName, op, ...rest] = argv;\n if (!collectionName || !op) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <collection> <add|remove|rename|references> <args...>\",\n );\n }\n if (!VALID_OPS.has(op as Op)) {\n throw new InvalidArgumentError(\n `Invalid op: \"${op}\". Expected one of: add, remove, rename, references`,\n );\n }\n return { collectionName, op: op as Op, rest };\n}\n\n/**\n * A migration as the collection sees it (`result`) and as the parsed fields\n * it was made from, which is what the zod schema is patched with.\n */\nexport interface ResolvedMigration {\n result: Result;\n model: Model;\n /** The fields an `add` or `references` adds, as parsed. */\n added: Field[];\n changes: FieldChange[];\n}\n\nexport async function generate(options: Options): Promise<Result> {\n return (await resolveMigration(options)).result;\n}\n\nexport async function resolveMigration(\n options: Options,\n): Promise<ResolvedMigration> {\n const { collectionName, op, rest } = parsePatternArgs(options.argv);\n validateModelName(collectionName);\n\n const collections = await loadCollections(options);\n const collection = collections.find((c) => c.name === collectionName);\n if (!collection) {\n throw new InvalidArgumentError(`Collection \"${collectionName}\" not found`);\n }\n\n const parent = parseModel(collectionName);\n const existingNames = new Set(collection.fields.map((f) => f.name));\n const changes: FieldChange[] = [];\n let indexes: string[] = [];\n let added: Field[] = [];\n\n if (op === \"add\" || op === \"references\") {\n const fieldDefs =\n op === \"references\"\n ? [referencesFieldDef(rest)]\n : requireNonEmpty(\n rest,\n \"Expected at least one field definition for add\",\n );\n\n const { fields } = resolveFields(fieldDefs, parent, collections, options);\n for (const field of fields) {\n if (existingNames.has(field.name)) {\n throw new InvalidArgumentError(\n `Field \"${field.name}\" already exists on collection \"${collectionName}\"`,\n );\n }\n changes.push({ op: \"add\", field: toCollectionFieldSpec(field) });\n }\n indexes = uniqueIndexes({ tableName: collectionName }, fields);\n added = fields;\n } else if (op === \"remove\") {\n const fieldNames = requireNonEmpty(\n rest,\n \"Expected at least one field name for remove\",\n );\n for (const fieldName of fieldNames) {\n if (!existingNames.has(fieldName)) {\n throw new InvalidArgumentError(\n `Field \"${fieldName}\" does not exist on collection \"${collectionName}\"`,\n );\n }\n changes.push({ op: \"remove\", fieldName });\n }\n } else {\n if (rest.length !== 2) {\n throw new InvalidArgumentError(\n `Expected exactly two arguments for rename (old and new), got ${rest.length}`,\n );\n }\n const [from, to] = rest;\n if (!existingNames.has(from)) {\n throw new InvalidArgumentError(\n `Field \"${from}\" does not exist on collection \"${collectionName}\"`,\n );\n }\n if (existingNames.has(to)) {\n throw new InvalidArgumentError(\n `Field \"${to}\" already exists on collection \"${collectionName}\"`,\n );\n }\n changes.push({ op: \"rename\", from, to });\n }\n\n const result = {\n creates: [],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [\n { collectionName, changes, ...(indexes.length > 0 ? { indexes } : {}) },\n ],\n collectionDrops: [],\n } satisfies Result;\n\n return { result, model: parent, added, changes };\n}\n\nfunction referencesFieldDef(rest: string[]): string {\n if (rest.length !== 1) {\n throw new InvalidArgumentError(\n `Expected exactly one argument for references, got ${rest.length}`,\n );\n }\n const ref = rest[0];\n const target = pluralize.plural(pluralize.singular(ref));\n return `${ref}:${target}`;\n}\n\nfunction requireNonEmpty(rest: string[], message: string): string[] {\n if (rest.length === 0) {\n throw new InvalidArgumentError(message);\n }\n return rest;\n}\n","import type { File, Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { resolveMigration } from \"./generate\";\n\nconst SLUG = \"generate-migration\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/generate/migration\";\nconst DOCS = \"/generate/migration\";\n\nexport async function generate(options: Options) {\n const migration = await resolveMigration(options);\n const baseRes = migration.result;\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { applyCollectionFieldsPatches } =\n await import(\"../../../runtime/collections\");\n const { withPocketbase } = await import(\"../../../runtime/pocketbase\");\n\n const logger = getLogger(options);\n let migrationCreates: File[] = [];\n await withPocketbase(options.root, async (pb) => {\n migrationCreates = await applyCollectionFieldsPatches(\n pb,\n baseRes.collectionPatches,\n options,\n logger,\n );\n });\n\n // After the collection changed, so the schema never runs ahead of it.\n // `generate resource` and the scaffolds wrote this file; one that is not\n // there is nobody's to patch.\n const { modifySchemaForMigration } = await import(\"./modifies/schema\");\n logger.info(\"Updating the zod schema\");\n const schemaFile = modifySchemaForMigration(options.root, migration);\n\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n modifies: [...baseRes.modifies, ...(schemaFile ? [schemaFile] : [])],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(runtimeRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a migration\",\n summary:\n \"Adds, removes, renames, or references fields on an existing collection.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"pocketbase\", \"migration\", \"schema\"],\n\n command: {\n raw: \"vela generate migration users add birthday:date\",\n base: \"vela generate migration\",\n argv: [\"users\", \"add\", \"birthday:date\"],\n },\n\n examples: [\n {\n command: \"posts add title:text! body:editor\",\n description: \"Add two fields to the posts collection.\",\n },\n {\n command: \"posts remove legacy_flag\",\n description: \"Drop a deprecated field from the posts collection.\",\n },\n {\n command: \"posts rename title heading\",\n description: \"Rename a field on the posts collection.\",\n },\n {\n command: \"posts references users\",\n description: \"Add a multi-relation field named users (maxSelect: 999).\",\n },\n {\n command: \"posts references user\",\n description: \"Add a single-relation field named user (maxSelect: 1).\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n collectionSpecFromModelFields,\n generateSchemaSnippet,\n resolveInputFields,\n rulesModeForCreate,\n rulesNotes,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n\n if (collections.some((collection) => collection.name === model.tableName)) {\n throw new InvalidArgumentError(\n `Collection \"${model.tableName}\" already exists. To update the schema to the latest definition, run vela generate schema ${model.tableName}`,\n );\n }\n\n const rules = rulesModeForCreate(options, model, shouldCreateCollection);\n\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const schema = generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n });\n\n return {\n creates: [toFile(schemaPath, schema)],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth, rules)]\n : [],\n collectionPatches: [],\n collectionDrops: [],\n notes: rulesNotes(model, rules),\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { withNotes } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-resource\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/generate/resource\";\nconst DOCS = \"/generate/resource\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return withNotes(\n await writeResult(await formatResult(runtimeRes, options), options),\n baseRes,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a resource\",\n summary: \"Generates model schema resources.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"pocketbase\", \"resource\", \"schema\"],\n\n command: {\n raw: \"vela generate resource contact name:text email:email\",\n base: \"vela generate resource\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"articles title:text! body:editor author:current_user\",\n description: \"Content model with an auth-bound author relation.\",\n },\n {\n command: \"projects name:text! status:select(active:Active,done:Done)\",\n description: \"Resource with an enum status field.\",\n },\n {\n command: \"comment body:editor! author:current_user\",\n description: \"Auth-bound comment with rich-text body.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { Field } from \"../../parse\";\n\n/**\n * Native markup showing one field of a record, for pages without\n * shadcn-svelte: a list page's table cell and a detail page's `<dd>`.\n * `record` is the expression the record is in (`contact`, `data.contact`).\n *\n * Select fields read the `<name>Labels` map the page declares (see\n * `selectFieldLabelMap`); relations read the record's `expand`, so the load\n * has to expand them.\n */\nexport function renderPlainValue(field: Field, record: string): string {\n const value = `${record}.${field.name}`;\n\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"editor\":\n return `{${value}}`;\n case \"password\":\n return \"********\";\n case \"bool\":\n return `{${value} ? \"Yes\" : \"No\"}`;\n case \"date\":\n case \"autodate\":\n return `{${value} ? new Date(${value}).toLocaleDateString() : \"\"}`;\n case \"url\":\n return dedent`\n {#if ${value}}\n <a href={${value}}>{${value}}</a>\n {/if}\n `;\n case \"json\":\n return `{JSON.stringify(${value})}`;\n case \"geoPoint\":\n return dedent`\n {#if ${value}}\n {${value}.lat.toFixed(6)}, {${value}.lon.toFixed(6)}\n {/if}\n `;\n case \"select\":\n return field.maxSelect > 1\n ? `{${value}?.map((option) => ${field.name}Labels[option].label).join(\", \")}`\n : `{${value} ? ${field.name}Labels[${value}].label : \"\"}`;\n case \"relation\": {\n const expanded = `${record}.expand?.${field.name}`;\n return field.maxSelect > 1\n ? `{${expanded}?.map((${field.singularRelationName}) => ${field.singularRelationName}.${field.displayField}).join(\", \")}`\n : `{${expanded}?.${field.displayField}}`;\n }\n case \"file\": {\n const href = (filename: string) =>\n `/api/files/{${record}.collectionId}/{${record}.id}/{${filename}}`;\n return field.maxSelect > 1\n ? dedent`\n {#each ${value} ?? [] as filename (filename)}\n <a href=\"${href(\"filename\")}\">{filename}</a>\n {/each}\n `\n : dedent`\n {#if ${value}}\n <a href=\"${href(value)}\">{${value}}</a>\n {/if}\n `;\n }\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n","const DYNAMIC_PARAM_RE = /\\[([^\\]]+)\\]/g;\n\nfunction interpolateParams(template: string, paramSource: string): string {\n return template.replace(\n DYNAMIC_PARAM_RE,\n (_, name) => `\\${${paramSource}.${name}}`,\n );\n}\n\n/**\n * JS source for a URL value: a quoted string when the URL has no dynamic\n * params, otherwise a template literal that interpolates them via\n * `${paramSource.<name>}`.\n *\n * urlJsExpr(\"/projects\", []) => '\"/projects\"'\n * urlJsExpr(\"/[team_id]/projects\", [\"team_id\"])\n * => '`/${params.team_id}/projects`'\n */\nexport function urlJsExpr(\n template: string,\n dynamicParams: string[],\n paramSource = \"params\",\n): string {\n if (dynamicParams.length === 0) {\n return JSON.stringify(template);\n }\n return `\\`${interpolateParams(template, paramSource)}\\``;\n}\n\n/**\n * JS template-literal source for a URL value followed by a JS-template-literal\n * suffix (already containing any `${...}` interpolations the caller wants).\n * Always returns a template literal — even with no dynamic params — because\n * the suffix usually carries one.\n *\n * urlJsExprWithSuffix(\"/projects\", [], \"/${id}\")\n * => '`/projects/${id}`'\n * urlJsExprWithSuffix(\"/[team_id]/projects\", [\"team_id\"], \"/${id}\")\n * => '`/${params.team_id}/projects/${id}`'\n */\nexport function urlJsExprWithSuffix(\n template: string,\n dynamicParams: string[],\n suffix: string,\n paramSource = \"params\",\n): string {\n const head =\n dynamicParams.length === 0\n ? template\n : interpolateParams(template, paramSource);\n return `\\`${head}${suffix}\\``;\n}\n\n/**\n * Svelte attribute source for a URL — the `=` sign and value together, so the\n * caller writes the attribute name then drops this in:\n *\n * `<Button href${urlSvelteAttrValue(url, params)}>`\n *\n * Result:\n * urlSvelteAttrValue(\"/projects\", []) => '=\"/projects\"'\n * urlSvelteAttrValue(\"/[team_id]/projects\", [\"team_id\"])\n * => '={`/${params.team_id}/projects`}'\n *\n * `svelteSuffix` lets the caller append additional path segments that may\n * themselves contain Svelte mustache interpolations like `/{data.x.id}`. In\n * the dynamic case those `{var}` segments are converted to JS `${var}` so the\n * whole expression becomes a single template literal.\n *\n * urlSvelteAttrValue(\"/projects\", [], \"/{data.x.id}/edit\")\n * => '=\"/projects/{data.x.id}/edit\"'\n * urlSvelteAttrValue(\"/[team_id]/projects\", [\"team_id\"], \"/{data.x.id}/edit\")\n * => '={`/${params.team_id}/projects/${data.x.id}/edit`}'\n */\nexport function urlSvelteAttrValue(\n template: string,\n dynamicParams: string[],\n svelteSuffix = \"\",\n paramSource = \"params\",\n): string {\n if (dynamicParams.length === 0) {\n return `=\"${template}${svelteSuffix}\"`;\n }\n // Convert Svelte mustache `{var}` to JS `${var}`, but leave any preexisting\n // `${var}` alone (negative lookbehind on `$`).\n const jsSuffix = svelteSuffix.replace(/(?<!\\$)\\{([^}]+)\\}/g, \"${$1}\");\n return `={\\`${interpolateParams(template, paramSource)}${jsSuffix}\\`}`;\n}\n\n/**\n * Substitute dynamic params with `test_<name>` placeholders. Used in generated\n * test fixtures where param values must be supplied as literals.\n */\nexport function testFixtureUrl(template: string): string {\n return template.replace(DYNAMIC_PARAM_RE, (_, name) => `test_${name}`);\n}\n","import dedent from \"dedent\";\nimport type { Field, Model, ScaffoldUrls, SelectField } from \"../parse\";\nimport { selectFieldLabelMap } from \"./field\";\nimport { renderPlainValue } from \"./field/plain-display\";\nimport { urlJsExprWithSuffix, urlSvelteAttrValue } from \"./url\";\n\n/**\n * The list page of the scaffold generators (`generate-scaffold` and\n * `generate-scaffold-remote` share it): a TanStack Table v9 data table built\n * from the helpers under `src/ui/components`, or a native `<table>` without\n * shadcn-svelte.\n */\n\nfunction selectFields(fields: Field[]): SelectField[] {\n return fields.filter(\n (field): field is SelectField => field.type === \"select\",\n );\n}\n\nfunction labelMaps(fields: Field[]): string {\n return selectFields(fields)\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\n/** `params` is declared only where a URL interpolates a dynamic segment (noUnusedLocals). */\nfunction propsLine(dynamicParams: string[]): string {\n return dynamicParams.length > 0\n ? \"let { data, params } = $props();\"\n : \"let { data } = $props();\";\n}\n\n/** The column the search box filters: the first free-text one, if any. */\nfunction searchField(fields: Field[]): Field | undefined {\n return fields.find((field) => [\"text\", \"email\", \"url\"].includes(field.type));\n}\n\n/**\n * The filter each filterable column registers. A facet sets an array of\n * option values: a single select matches one of them exactly (`arrHas`), a\n * multi select any of its own (`arrIncludesSome`).\n */\nfunction filterFnName(field: Field, search: Field | undefined): string | null {\n if (field === search) return \"includesString\";\n if (field.type === \"select\") {\n return field.maxSelect > 1 ? \"arrIncludesSome\" : \"arrHas\";\n }\n return null;\n}\n\nfunction cellSnippet(field: Field): string {\n const component = `Cells.${field.type.charAt(0).toUpperCase() + field.type.slice(1)}Cell`;\n switch (field.type) {\n case \"relation\":\n return `({ getValue, row }) => renderComponent(${component}, { value: getValue(), expanded: row.original.expand?.${field.name}, displayField: \"${field.displayField}\" })`;\n case \"select\":\n return `({ getValue }) => renderComponent(${component}, { value: getValue(), options: ${field.name}Labels })`;\n case \"file\":\n return `({ getValue, row }) => renderComponent(${component}, { value: getValue(), collectionId: row.original.collectionId, id: row.original.id })`;\n default:\n return `({ getValue }) => renderComponent(${component}, { value: getValue() })`;\n }\n}\n\nexport function listPageSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const selects = selectFields(fields);\n const search = searchField(fields);\n const hasFilters = Boolean(search) || selects.length > 0;\n const filterFns = [\n ...new Set(\n fields\n .map((field) => filterFnName(field, search))\n .filter((name): name is string => name !== null),\n ),\n ];\n\n const newHref = urlSvelteAttrValue(urls.new, dynamicParams);\n const rowPath = (suffix: string) =>\n urlJsExprWithSuffix(\n urls.list,\n dynamicParams,\n `/\\${row.original.id}${suffix}`,\n );\n\n const columnDefs = fields\n .map((field) => {\n const filterFn = filterFnName(field, search);\n return dedent`\n columnHelper.accessor(\"${field.name}\", {\n header: ({ column }) => renderComponent(ColumnHeader, { column, title: \"${field.title}\" }),\n cell: ${cellSnippet(field)},${filterFn ? `\\nfilterFn: \"${filterFn}\",` : \"\"}\n })\n `;\n })\n .join(\",\\n\");\n\n const tableCoreImports = [\n \"columnFilteringFeature\",\n \"createColumnHelper\",\n \"createFilteredRowModel\",\n \"createPaginatedRowModel\",\n \"createSortedRowModel\",\n \"rowPaginationFeature\",\n \"rowSelectionFeature\",\n \"rowSortingFeature\",\n \"sortFn_alphanumeric\",\n \"sortFn_text\",\n \"tableFeatures\",\n ...(selects.length > 0\n ? [\n \"columnFacetingFeature\",\n \"createFacetedRowModel\",\n \"createFacetedUniqueValues\",\n ]\n : []),\n ...filterFns.map((name) => `filterFn_${name}`),\n ].sort();\n\n const facetingSlots =\n selects.length > 0\n ? dedent`\n columnFacetingFeature,\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n `\n : \"\";\n const filterFnsSlot =\n filterFns.length > 0\n ? `filterFns: { ${filterFns.map((name) => `${name}: filterFn_${name}`).join(\", \")} },`\n : \"\";\n\n const searchInput = search\n ? dedent`\n <Input\n placeholder=\"Filter ${model.pluralDisplayName.toLowerCase()}...\"\n value={(table.getColumn(\"${search.name}\")?.getFilterValue() as string) ?? \"\"}\n oninput={(e) => {\n table.getColumn(\"${search.name}\")?.setFilterValue(e.currentTarget.value);\n }}\n class=\"h-8 w-[150px] lg:w-[250px]\"\n />\n `\n : \"\";\n const facets = selects\n .map(\n (field) =>\n `<FacetedFilter column={table.getColumn(\"${field.name}\")!} title=\"${field.title}\" options={Object.values(${field.name}Labels)} />`,\n )\n .join(\"\\n\");\n const toolbar = hasFilters\n ? dedent`\n <div class=\"flex flex-1 items-center space-x-2\">\n ${searchInput}\n ${facets}\n {#if table.atoms.columnFilters.get().length > 0}\n <Button variant=\"ghost\" onclick={() => table.resetColumnFilters()} class=\"h-8 px-2 lg:px-3\">\n Reset\n <XIcon />\n </Button>\n {/if}\n </div>\n `\n : '<div class=\"flex-1\"></div>';\n\n const imports = [\n `import {\\n${tableCoreImports.join(\",\\n\")}\\n} from \"@tanstack/table-core\";`,\n 'import { createTable, FlexRender, renderComponent } from \"#lib/components/ui/data-table/index.js\";',\n 'import * as Table from \"#lib/components/ui/table/index.js\";',\n 'import { Checkbox } from \"#lib/components/ui/checkbox/index.js\";',\n 'import { ColumnHeader } from \"#lib/components/ui/column-header/index.js\";',\n 'import { DataTablePagination } from \"#lib/components/ui/data-table-pagination/index.js\";',\n 'import { RowActions } from \"#lib/components/ui/row-actions/index.js\";',\n 'import * as Cells from \"#lib/components/ui/cells/index.js\";',\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n search ? 'import { Input } from \"#lib/components/ui/input/index.js\";' : \"\",\n selects.length > 0\n ? 'import { FacetedFilter } from \"#lib/components/ui/faceted-filter/index.js\";'\n : \"\",\n hasFilters ? 'import XIcon from \"@lucide/svelte/icons/x\";' : \"\",\n 'import PlusIcon from \"@lucide/svelte/icons/plus\";',\n 'import type { Models } from \"@velastack/pocketbase\";',\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n ${propsLine(dynamicParams)}\n\n ${labelMaps(fields)}\n\n const features = tableFeatures({\n rowSelectionFeature,\n rowSortingFeature,\n columnFilteringFeature,\n rowPaginationFeature,\n ${facetingSlots}\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },\n ${filterFnsSlot}\n });\n\n const columnHelper = createColumnHelper<typeof features, Models[\"${model.tableName}\"]>();\n const columns = columnHelper.columns([\n columnHelper.display({\n id: \"select\",\n header: ({ table }) =>\n renderComponent(Checkbox, {\n checked: table.getIsAllPageRowsSelected(),\n onCheckedChange: (value) => table.toggleAllPageRowsSelected(value),\n indeterminate: table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected(),\n \"aria-label\": \"Select all\"\n }),\n cell: ({ row }) =>\n renderComponent(Checkbox, {\n checked: row.getIsSelected(),\n onCheckedChange: (value) => row.toggleSelected(value),\n \"aria-label\": \"Select row\"\n }),\n enableSorting: false,\n meta: { class: \"w-0\" },\n }),\n ${columnDefs}${fields.length > 0 ? \",\" : \"\"}\n columnHelper.display({\n id: \"actions\",\n cell: ({ row }) =>\n renderComponent(RowActions, {\n viewPath: ${rowPath(\"\")},\n editPath: ${rowPath(\"/edit\")},\n deletePath: ${rowPath(\"\")}\n }),\n meta: { class: \"w-0 text-right\" },\n })\n ]);\n\n const table = createTable({\n features,\n columns,\n get data() {\n return data.${model.pluralName};\n },\n enableRowSelection: true,\n });\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.pluralDisplayName}</h1>\n </div>\n\n <div class=\"space-y-4\">\n <div class=\"flex items-center justify-between\">\n ${toolbar}\n\n <Button href${newHref} variant=\"outline\" size=\"sm\">\n <PlusIcon class=\"w-4 h-4\" />\n New ${model.displayName.toLowerCase()}\n </Button>\n </div>\n\n <div class=\"rounded-md border overflow-hidden\">\n <Table.Root>\n <Table.Header>\n {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}\n <Table.Row>\n {#each headerGroup.headers as header (header.id)}\n <Table.Head colspan={header.colSpan} class={header.column.columnDef.meta?.class}>\n {#if !header.isPlaceholder}\n <FlexRender {header} />\n {/if}\n </Table.Head>\n {/each}\n </Table.Row>\n {/each}\n </Table.Header>\n <Table.Body>\n {#each table.getRowModel().rows as row (row.id)}\n <Table.Row data-state={row.getIsSelected() && \"selected\"}>\n {#each row.getAllCells() as cell (cell.id)}\n <Table.Cell class={cell.column.columnDef.meta?.class}>\n <FlexRender {cell} />\n </Table.Cell>\n {/each}\n </Table.Row>\n {:else}\n <Table.Row>\n <Table.Cell colspan={columns.length} class=\"h-24 text-center\">No results.</Table.Cell>\n </Table.Row>\n {/each}\n </Table.Body>\n </Table.Root>\n </div>\n\n <DataTablePagination {table} />\n </div>\n </section>\n `;\n}\n\n/**\n * The list page without shadcn-svelte, TanStack Table or tailwind: a native\n * `<table>` of every record, each row linking to its detail and edit pages\n * and carrying a delete form that posts to the detail page's action.\n */\nexport function plainListPageSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const record = model.name;\n const recordHref = (suffix = \"\") =>\n urlSvelteAttrValue(urls.list, dynamicParams, `/{${record}.id}${suffix}`);\n const headers = fields\n .map((field) => `<th scope=\"col\">${field.title}</th>`)\n .join(\"\\n\");\n const cells = fields\n .map((field) => `<td>${renderPlainValue(field, record)}</td>`)\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${propsLine(dynamicParams)}\n\n ${labelMaps(fields)}\n </script>\n\n <h1>${model.pluralDisplayName}</h1>\n\n <p><a href${urlSvelteAttrValue(urls.new, dynamicParams)}>New ${model.displayName.toLowerCase()}</a></p>\n\n <table>\n <thead>\n <tr>\n ${headers}\n <th scope=\"col\">Actions</th>\n </tr>\n </thead>\n <tbody>\n {#each data.${model.pluralName} as ${record} (${record}.id)}\n <tr>\n ${cells}\n <td>\n <a href${recordHref()}>View</a>\n <a href${recordHref(\"/edit\")}>Edit</a>\n <form method=\"POST\" action${recordHref()}>\n <button type=\"submit\">Delete</button>\n </form>\n </td>\n </tr>\n {:else}\n <tr>\n <td colspan=\"${fields.length + 1}\">No ${model.pluralDisplayName.toLowerCase()} yet.</td>\n </tr>\n {/each}\n </tbody>\n </table>\n `;\n}\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { SUPERFORMS, TANSTACK_TABLE_CORE, ZOD } from \"../../../core/constants\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n parseRoute,\n scaffoldFilePaths,\n scaffoldUrls,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport {\n getFieldComponents,\n getFieldImports,\n renderDisplayField,\n renderField,\n selectFieldLabelMap,\n} from \"../../../core/field\";\nimport {\n collectionSpecFromModelFields,\n generateSchemaSnippet,\n relationExpandParam,\n relationLoadLines,\n relationLoadReturnVars,\n resolveInputFields,\n rulesModeForCreate,\n rulesNotes,\n type RulesMode,\n} from \"../../../core/shared\";\nimport {\n NATIVE_STYLE,\n geoPointState,\n plainRenderer,\n superformsBinding,\n usesConstraints,\n} from \"../../../core/field/plain\";\nimport { renderPlainValue } from \"../../../core/field/plain-display\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport {\n listPageSnippet,\n plainListPageSnippet,\n} from \"../../../core/scaffold-list\";\nimport { generateScaffoldServerTestSnippet } from \"../../../core/tests\";\nimport {\n urlJsExpr,\n urlJsExprWithSuffix,\n urlSvelteAttrValue,\n} from \"../../../core/url\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction uniqueImports(imports: string[]): string[] {\n return [...new Set(imports.filter(Boolean))];\n}\n\nfunction selectLabelMaps(fields: Field[]): string {\n return fields\n .filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n )\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\n/**\n * The client the pages talk to PocketBase with: the signed-in user's, unless\n * the project has no auth or the collection is kept to the superuser.\n */\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n rules?: RulesMode,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth && rules !== \"superuser\"\n ? \"locals.pb\"\n : \"locals.admin\";\n}\n\nfunction scaffoldNotes(model: Model, rules: RulesMode | undefined): string[] {\n if (rules !== \"superuser\") return [];\n return [\n ...rulesNotes(model, rules),\n `The generated ${model.pluralDisplayName.toLowerCase()} pages use \\`locals.admin\\`, so everyone who can open them can read and write every record. Check who is asking in their load functions and actions.`,\n ];\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\nfunction newHiddenInputs(injectables: Injectables): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input type=\"hidden\" name=\"${field.name}\" value=\"${value}\" />`,\n )\n .join(\"\\n\");\n}\n\nfunction editHiddenInputs(injectables: Injectables): string {\n const fields = [\n injectables.currentUserField,\n injectables.currentTeamField,\n ].filter((field): field is InjectableField => Boolean(field));\n return fields\n .map(\n (field) =>\n `<input type=\"hidden\" name=\"${field.name}\" bind:value={$formData.${field.name}} />`,\n )\n .join(\"\\n\");\n}\n\n/**\n * SvelteKit hands every page `params`; it is declared only where a link or\n * redirect interpolates a dynamic route segment, since the projects\n * type-check with noUnusedLocals.\n */\nfunction propsLine(withParams: boolean): string {\n return withParams\n ? \"let { data, params } = $props();\"\n : \"let { data } = $props();\";\n}\n\nfunction formScript(\n model: Model,\n fields: Field[],\n includeParams = false,\n): string {\n const labels = selectLabelMaps(fields);\n\n return dedent`\n ${labels}\n ${propsLine(includeParams)}\n\n const form = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n const { form: formData } = form;\n `;\n}\n\nfunction newPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const imports = uniqueImports([\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zod4Client } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";`,\n ...getFieldImports(getFieldComponents(fields)),\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n 'import * as Form from \"#lib/components/ui/form/index.js\";',\n ]).join(\"\\n\");\n const fieldContent = fields.map((field) => renderField(field)).join(\"\\n\");\n const hiddenInputs = newHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${formScript(model, fields, dynamicParams.length > 0)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">New ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button size=\"sm\">Save</Form.Button>\n <Button href${listHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction editPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const imports = uniqueImports([\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zod4Client } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";`,\n ...getFieldImports(getFieldComponents(fields)),\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n 'import * as Form from \"#lib/components/ui/form/index.js\";',\n ]).join(\"\\n\");\n const fieldContent = fields.map((field) => renderField(field)).join(\"\\n\");\n const hiddenInputs = editHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const cancelHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n \"/{params.id}\",\n );\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${formScript(model, fields, true)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">Edit ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button size=\"sm\">Save changes</Form.Button>\n <Button href${cancelHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction listServerSnippet(model: Model, fields: Field[], pb: string): string {\n const expand = relationExpandParam(fields);\n const getFullListArgs = expand ? `{ expand: \"${expand}\" }` : \"\";\n\n return dedent`\n export const load = async ({ locals }) => {\n const ${model.pluralName} = await ${pb}.collection(\"${model.tableName}\").getFullList(${getFullListArgs});\n return { ${model.pluralName} };\n };\n `;\n}\n\nfunction newServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n authMode: boolean,\n dynamicParams: string[],\n): string {\n const withFiles = hasFiles(fields);\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n const { currentUserField, currentTeamField } = injectables;\n const injections: string[] = [];\n if (authMode && currentUserField) {\n injections.push(`${currentUserField.name}: locals.pb.authStore.record?.id`);\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...form.data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"form.data\";\n\n return dedent`\n import { fail, redirect } from \"@sveltejs/kit\";\n import { superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const load = async ({ locals }) => {\n ${relationLoads}\n return { form: await superValidate(zod4(${model.schemaName}))${relationReturn} };\n };\n\n export const actions = {\n default: async ({ locals, request${dynamicParams.length > 0 ? \", params\" : \"\"} }) => {\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n let ${model.name};\n\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, `/\\${${model.name}.id}`)});\n },\n };\n `;\n}\n\nfunction showServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n pb: string,\n dynamicParams: string[],\n): string {\n const expand = relationExpandParam(fields);\n const getOneArgs = expand ? `, { expand: \"${expand}\" }` : \"\";\n return dedent`\n import { error, redirect } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n try {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id${getOneArgs});\n return { ${model.name} };\n } catch {\n error(404, \"Not found\");\n }\n };\n\n export const actions = {\n default: async ({ locals, params }) => {\n await ${pb}.collection(\"${model.tableName}\").delete(params.id);\n redirect(303, ${urlJsExpr(urls.list, dynamicParams)});\n },\n };\n `;\n}\n\nfunction showPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const hasRelationFields = fields.some((field) => field.type === \"relation\");\n const hasFileFields = fields.some((field) => field.type === \"file\");\n\n const imports = [\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n hasSelectFields || hasRelationFields\n ? 'import { Badge } from \"#lib/components/ui/badge/index.js\";'\n : \"\",\n hasRelationFields\n ? 'import CircleArrowRightIcon from \"@lucide/svelte/icons/circle-arrow-right\";'\n : \"\",\n hasFileFields ? 'import FileIcon from \"@lucide/svelte/icons/file\";' : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n const labels = selectLabelMaps(fields);\n const displays = fields\n .map((field) => renderDisplayField(model, field))\n .join(\"\\n\");\n\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const editHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n `/{data.${model.name}.id}/edit`,\n );\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${labels}\n\n ${propsLine(dynamicParams.length > 0)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName} details</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm\">\n ${displays}\n </div>\n\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4 justify-between\">\n <Button href${editHref} variant=\"outline\" size=\"sm\">\n Edit\n </Button>\n <form method=\"POST\">\n <Button type=\"submit\" variant=\"destructive\" size=\"sm\">Delete</Button>\n </form>\n </div>\n </div>\n </section>\n `;\n}\n\n/**\n * The new/edit page without shadcn-svelte, formsnap or tailwind: native\n * elements bound to the superforms stores, as generate-form's plain page.\n */\nfunction plainFormPageSnippet(\n model: Model,\n fields: Field[],\n options: {\n title: string;\n submit: string;\n cancelHref: string;\n hiddenInputs: string;\n withParams: boolean;\n },\n): string {\n const renderer = plainRenderer(superformsBinding(), NATIVE_STYLE);\n const fieldContent = fields.map((field) => renderer.render(field)).join(\"\\n\");\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const stores = [\n \"form: formData\",\n \"errors\",\n ...(usesConstraints(fields) ? [\"constraints\"] : []),\n \"enhance\",\n ].join(\", \");\n\n return dedent`\n <script lang=\"ts\">\n import { untrack } from \"svelte\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n ${propsLine(options.withParams)}\n\n const { ${stores} } = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n ${geoPointState(fields)}\n </script>\n\n <h1>${options.title}</h1>\n\n <form method=\"POST\"${enctype} use:enhance>\n ${fieldContent}\n ${options.hiddenInputs}\n <button type=\"submit\">${options.submit}</button>\n <a href${options.cancelHref}>Cancel</a>\n </form>\n `;\n}\n\nfunction plainNewPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n return plainFormPageSnippet(model, fields, {\n title: `New ${model.displayName.toLowerCase()}`,\n submit: \"Save\",\n cancelHref: urlSvelteAttrValue(urls.list, dynamicParams),\n hiddenInputs: newHiddenInputs(injectables),\n withParams: dynamicParams.length > 0,\n });\n}\n\nfunction plainEditPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n return plainFormPageSnippet(model, fields, {\n title: `Edit ${model.displayName.toLowerCase()}`,\n submit: \"Save changes\",\n cancelHref: urlSvelteAttrValue(urls.list, dynamicParams, \"/{params.id}\"),\n hiddenInputs: editHiddenInputs(injectables),\n withParams: true,\n });\n}\n\n/** The detail page as a `<dl>`, with the edit link and the delete form. */\nfunction plainShowPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const record = `data.${model.name}`;\n const details = fields\n .map(\n (field) => dedent`\n <dt>${field.title}</dt>\n <dd>${renderPlainValue(field, record)}</dd>\n `,\n )\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${selectLabelMaps(fields)}\n\n ${propsLine(dynamicParams.length > 0)}\n </script>\n\n <h1>${model.displayName} details</h1>\n\n <dl>\n ${details}\n </dl>\n\n <p><a href${urlSvelteAttrValue(urls.list, dynamicParams, `/{${record}.id}/edit`)}>Edit</a></p>\n <form method=\"POST\">\n <button type=\"submit\">Delete</button>\n </form>\n <p><a href${urlSvelteAttrValue(urls.list, dynamicParams)}>Back to list</a></p>\n `;\n}\n\nfunction editServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n dynamicParams: string[],\n): string {\n const withFiles = hasFiles(fields);\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n const { currentUserField, currentTeamField } = injectables;\n const preservations: string[] = [];\n if (currentUserField) {\n preservations.push(\n `${currentUserField.name}: ${model.name}.${currentUserField.name}`,\n );\n }\n if (currentTeamField) {\n preservations.push(\n `${currentTeamField.name}: ${model.name}.${currentTeamField.name}`,\n );\n }\n const updatePayload =\n preservations.length > 0\n ? dedent`\n {\n ...form.data,\n ${preservations.join(\",\\n \")}\n }\n `\n : \"form.data\";\n\n return dedent`\n import { error, fail, redirect } from \"@sveltejs/kit\";\n import { setPocketbaseErrors, setDefaultData } from \"@velastack/pocketbase/form\";\n import { superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const load = async ({ locals, params }) => {\n let ${model.name};\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n } catch {\n error(404, \"Not found\");\n }\n ${relationLoads}\n return { form: await superValidate(${model.name}, zod4(${model.schemaName}))${relationReturn} };\n };\n\n export const actions = {\n default: async ({ locals, params, request }) => {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n setDefaultData(form, ${model.name});\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n try {\n await ${pb}.collection(\"${model.tableName}\").update(params.id, ${updatePayload});\n } catch (error) {\n setPocketbaseErrors(form, error);\n setDefaultData(form, ${model.name});\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n // Outside the try: redirect() throws, and the catch would swallow it.\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, \"/${params.id}\")});\n },\n };\n `;\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n\n if (\n fieldDefs.length > 0 &&\n collections.some((collection) => collection.name === model.tableName)\n ) {\n throw new InvalidArgumentError(\n `Collection \"${model.tableName}\" already exists. To run scaffold with an existing collection, omit the field definitions.`,\n );\n }\n\n const route = parseRoute(options.input.route, model, options, \"scaffold\");\n const paths = scaffoldFilePaths(route);\n const urls = scaffoldUrls(route);\n const dynamicParams = route.dynamicParams;\n const rules = rulesModeForCreate(options, model, shouldCreateCollection);\n const pb = pbInstance(options, rules);\n const uiFields = fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n );\n const injectables = findInjectables(fields);\n const ui = resolveUi(options);\n const serverTests = options.input.serverTests ?? true;\n const pages =\n ui === \"plain\"\n ? {\n list: plainListPageSnippet(model, urls, uiFields, dynamicParams),\n new: plainNewPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n show: plainShowPageSnippet(model, urls, uiFields, dynamicParams),\n edit: plainEditPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n }\n : {\n list: listPageSnippet(model, urls, uiFields, dynamicParams),\n new: newPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n show: showPageSnippet(model, urls, uiFields, dynamicParams),\n edit: editPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n };\n\n const creates: File[] = [\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n }),\n ),\n toFile(\n `${paths.list}/+page.server.ts`,\n listServerSnippet(model, uiFields, pb),\n ),\n toFile(`${paths.list}/+page.svelte`, pages.list),\n toFile(\n `${paths.new}/+page.server.ts`,\n newServerSnippet(\n model,\n urls,\n uiFields,\n injectables,\n pb,\n options.features.auth,\n dynamicParams,\n ),\n ),\n toFile(`${paths.new}/+page.svelte`, pages.new),\n toFile(\n `${paths.show}/+page.server.ts`,\n showServerSnippet(model, urls, uiFields, pb, dynamicParams),\n ),\n toFile(`${paths.show}/+page.svelte`, pages.show),\n toFile(\n `${paths.edit}/+page.server.ts`,\n editServerSnippet(model, urls, uiFields, injectables, pb, dynamicParams),\n ),\n toFile(`${paths.edit}/+page.svelte`, pages.edit),\n ...(serverTests\n ? [\n toFile(\n `${paths.list}/server.test.ts`,\n generateScaffoldServerTestSnippet(\n model,\n urls,\n fields,\n options,\n collections,\n dynamicParams,\n ),\n ),\n ]\n : []),\n ];\n\n // Plain markup needs nothing from the registry, and no TanStack Table.\n const components =\n ui === \"plain\"\n ? []\n : ([\n ...getFieldComponents(uiFields),\n \"button\",\n \"table\",\n \"data-table\",\n \"command\",\n \"popover\",\n \"separator\",\n \"badge\",\n \"dropdown-menu\",\n \"checkbox\",\n \"select\",\n \"cells\",\n \"column-header\",\n \"faceted-filter\",\n \"data-table-pagination\",\n \"row-actions\",\n ] as Component[]);\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [...new Set(components)],\n packages:\n ui === \"plain\"\n ? [SUPERFORMS, ZOD]\n : [SUPERFORMS, ZOD, TANSTACK_TABLE_CORE],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth, rules)]\n : [],\n collectionPatches: [],\n collectionDrops: [],\n notes: scaffoldNotes(model, rules),\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { withNotes } from \"../../../core/util\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-scaffold\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/generate/scaffold\";\nconst DOCS = \"/generate/scaffold\";\n\nexport async function generate(options: Options) {\n if (options.env === \"runtime\" && resolveUi(options) === \"shadcn\") {\n // Before the collection is created: nothing is written for a v8 project.\n const { assertRegistryPagination, assertTableCoreV9 } =\n await import(\"../../../runtime/table-core\");\n assertTableCoreV9(options.root);\n assertRegistryPagination(options.root);\n }\n\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return withNotes(\n await writeResult(await formatResult(runtimeRes, options), options),\n baseRes,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a scaffold\",\n summary: \"Generates CRUD routes and schema.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\"],\n\n command: {\n raw: \"vela generate scaffold contact name:text email:email\",\n base: \"vela generate scaffold\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"todos title:text! done:bool\",\n description: \"Todos with required title and boolean flag.\",\n },\n {\n command: \"pets type:select(dog:Dog,cat:Cat) owner:user\",\n description: \"Enum field and a one-to-many relation to user.\",\n },\n {\n command: \"pet name:text! breed:text! owner:current_user\",\n description: \"Auth-bound owner relation.\",\n },\n {\n command:\n 'project name:text! status:select(active,done) --route \"(app)/[team_id]/projects\"',\n description:\n \"Team-scoped CRUD via dynamic route param. Generated hrefs and redirects interpolate params.team_id.\",\n },\n ],\n\n tests: 8,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport {\n TANSTACK_TABLE_CORE,\n VELASTACK_POCKETBASE,\n} from \"../../../core/constants\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n isProtectedRoute,\n parseRoute,\n scaffoldFilePaths,\n scaffoldUrls,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport { renderDisplayField, selectFieldLabelMap } from \"../../../core/field\";\nimport {\n getRemoteFieldComponents,\n getRemoteFieldImports,\n renderRemoteField,\n REQUIRE_USER_IMPORT,\n requireUserLines,\n} from \"../../../core/field/remote\";\nimport {\n isWriteOnly,\n remoteFormSupports,\n remoteSeedExpression,\n} from \"../../../core/field/plain\";\nimport {\n collectionSpecFromModelFields,\n generateSchemaSnippet,\n relationExpandParam,\n relationLoadLines,\n relationLoadReturnVars,\n resolveInputFields,\n rulesModeForCreate,\n rulesNotes,\n type RulesMode,\n uniqueRelationCollections,\n} from \"../../../core/shared\";\nimport { listPageSnippet } from \"../../../core/scaffold-list\";\nimport { generateScaffoldRemoteServerTestSnippet } from \"../../../core/tests\";\nimport {\n urlJsExpr,\n urlJsExprWithSuffix,\n urlSvelteAttrValue,\n} from \"../../../core/url\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction selectLabelMaps(fields: Field[]): string {\n return fields\n .filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n )\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\n/**\n * The client the pages talk to PocketBase with: the signed-in user's, unless\n * the project has no auth or the collection is kept to the superuser.\n */\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n rules?: RulesMode,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth && rules !== \"superuser\"\n ? \"locals.pb\"\n : \"locals.admin\";\n}\n\nfunction scaffoldNotes(model: Model, rules: RulesMode | undefined): string[] {\n if (rules !== \"superuser\") return [];\n return [\n ...rulesNotes(model, rules),\n `The generated ${model.pluralDisplayName.toLowerCase()} pages use \\`locals.admin\\`, so everyone who can open them can read and write every record. Check who is asking in their load functions and actions.`,\n ];\n}\n\nfunction createFormIdentifier(model: Model): string {\n return `create${model.typeName}Form`;\n}\n\nfunction updateFormIdentifier(model: Model): string {\n return `update${model.typeName}Form`;\n}\n\nfunction hasRelations(fields: Field[]): boolean {\n return uniqueRelationCollections(fields).length > 0;\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\n/**\n * SvelteKit 3 rejects a remote form input whose `name` was written by hand:\n * hidden inputs spread `.as(\"hidden\", value)` like every other control.\n */\nfunction newHiddenInputs(injectables: Injectables, formVar: string): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input {...${formVar}.fields.${field.name}.as(\"hidden\", \"${value}\")} />`,\n )\n .join(\"\\n\");\n}\n\nfunction editHiddenInputs(\n model: Model,\n injectables: Injectables,\n formVar: string,\n): string {\n const fields = [\n injectables.currentUserField,\n injectables.currentTeamField,\n ].filter((field): field is InjectableField => Boolean(field));\n return fields\n .map(\n (field) =>\n `<input {...${formVar}.fields.${field.name}.as(\"hidden\", data.${model.name}.${field.name})} />`,\n )\n .join(\"\\n\");\n}\n\n/**\n * SvelteKit hands every page `params`; it is declared only where a link\n * interpolates a dynamic route segment, since the projects type-check with\n * noUnusedLocals.\n */\nfunction propsLine(dynamicParams: string[], withData = true): string {\n const names = [\n ...(withData ? [\"data\"] : []),\n ...(dynamicParams.length > 0 ? [\"params\"] : []),\n ];\n return names.length > 0 ? `let { ${names.join(\", \")} } = $props();` : \"\";\n}\n\nfunction newPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const formVar = createFormIdentifier(model);\n const components = getRemoteFieldComponents(fields);\n const imports = [\n `import { ${formVar} } from \"./form.remote\";`,\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n ...getRemoteFieldImports(components),\n ].join(\"\\n\");\n const fieldContent = fields\n .map((field) => renderRemoteField(field, { formVar }))\n .join(\"\\n\");\n const hiddenInputs = newHiddenInputs(injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${propsLine(dynamicParams, false)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">New ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form {...${formVar}}${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Button type=\"submit\" size=\"sm\">Save</Button>\n <Button href${listHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\n/**\n * Script statement that starts the edit form from the saved record.\n *\n * A remote form's controls hold what the form's own state says, which is\n * empty until someone types: left that way, the page shows a blank form and\n * saving it writes a blank over every field. The state is module-level and\n * outlives the page, so it is set afresh each time the page is created; that\n * also clears what an earlier record's edit left in it.\n */\nfunction editSeedSnippet(\n model: Model,\n fields: Field[],\n formVar: string,\n): string {\n const record = `data.${model.name}`;\n const seeds = fields.flatMap((field) => {\n const value = remoteSeedExpression(field, record);\n return value === undefined ? [] : [`${field.name}: ${value},`];\n });\n if (seeds.length === 0) return \"\";\n\n const writeOnly = fields.some(\n (field) => remoteFormSupports(field) && isWriteOnly(field),\n );\n const comment = [\n \"// The form starts from the saved record, so a field left alone is saved\",\n \"// as it was.\",\n ...(writeOnly\n ? [\n \"// Files and passwords cannot be shown: left empty, they keep what is\",\n \"// stored (see form.remote.ts).\",\n ]\n : []),\n ].join(\"\\n\");\n\n return dedent`\n ${comment}\n ${formVar}.fields.set(\n untrack(() => ({\n ${seeds.join(\"\\n\")}\n })),\n );\n `;\n}\n\nfunction editPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const formVar = updateFormIdentifier(model);\n const components = getRemoteFieldComponents(fields);\n const seed = editSeedSnippet(model, fields, formVar);\n const imports = [\n ...(seed ? ['import { untrack } from \"svelte\";'] : []),\n `import { ${formVar} } from \"./form.remote\";`,\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n ...getRemoteFieldImports(components),\n ].join(\"\\n\");\n const fieldContent = fields\n .map((field) => renderRemoteField(field, { formVar, edit: true }))\n .join(\"\\n\");\n const hiddenInputs = editHiddenInputs(model, injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const cancelHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n \"/{params.id}\",\n );\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n let { data, params } = $props();\n\n ${seed}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">Edit ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form {...${formVar}}${enctype}>\n <input {...${formVar}.fields.id.as(\"hidden\", data.${model.name}.id)} />\n ${hiddenInputs}\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Button type=\"submit\" size=\"sm\">Save changes</Button>\n <Button href${cancelHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction listServerSnippet(model: Model, fields: Field[], pb: string): string {\n const expand = relationExpandParam(fields);\n const getFullListArgs = expand ? `{ expand: \"${expand}\" }` : \"\";\n\n return dedent`\n export const load = async ({ locals }) => {\n const ${model.pluralName} = await ${pb}.collection(\"${model.tableName}\").getFullList(${getFullListArgs});\n return { ${model.pluralName} };\n };\n `;\n}\n\nfunction newServerSnippet(model: Model, fields: Field[], pb: string): string {\n if (!hasRelations(fields)) {\n return \"\";\n }\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n return dedent`\n export const load = async ({ locals }) => {\n ${relationLoads}\n return { ${relationVars} };\n };\n `;\n}\n\nfunction newRemoteSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n pb: string,\n authMode: boolean,\n dynamicParams: string[],\n guard: boolean,\n): string {\n const formVar = createFormIdentifier(model);\n const currentUserField = fields.find(\n (field): field is Extract<Field, { type: \"relation\" }> =>\n field.type === \"relation\" && field.isCurrentUser,\n );\n const currentTeamField = fields.find(\n (field): field is Extract<Field, { type: \"relation\" }> =>\n field.type === \"relation\" && field.isCurrentTeam,\n );\n const injections: string[] = [];\n const usesUser = authMode && Boolean(currentUserField);\n if (authMode && currentUserField) {\n injections.push(\n `${currentUserField.name}: ${guard ? \"user.id\" : \"locals.pb.authStore.record?.id\"}`,\n );\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"data\";\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n import { redirect } from \"@sveltejs/kit\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async (data) => {\n ${requireUserLines(guard, usesUser)}\n const { locals${dynamicParams.length > 0 ? \", params\" : \"\"} } = getRequestEvent();\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, `/\\${${model.name}.id}`)});\n });\n `;\n}\n\nfunction showServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n pb: string,\n dynamicParams: string[],\n): string {\n const expand = relationExpandParam(fields);\n const getOneArgs = expand ? `, { expand: \"${expand}\" }` : \"\";\n return dedent`\n import { error, redirect } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n try {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id${getOneArgs});\n return { ${model.name} };\n } catch {\n error(404, \"Not found\");\n }\n };\n\n export const actions = {\n default: async ({ locals, params }) => {\n await ${pb}.collection(\"${model.tableName}\").delete(params.id);\n redirect(303, ${urlJsExpr(urls.list, dynamicParams)});\n },\n };\n `;\n}\n\nfunction showPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const hasRelationFields = fields.some((field) => field.type === \"relation\");\n const hasFileFields = fields.some((field) => field.type === \"file\");\n\n const imports = [\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n hasSelectFields || hasRelationFields\n ? 'import { Badge } from \"#lib/components/ui/badge/index.js\";'\n : \"\",\n hasRelationFields\n ? 'import CircleArrowRightIcon from \"@lucide/svelte/icons/circle-arrow-right\";'\n : \"\",\n hasFileFields ? 'import FileIcon from \"@lucide/svelte/icons/file\";' : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n const labels = selectLabelMaps(fields);\n const displays = fields\n .map((field) => renderDisplayField(model, field))\n .join(\"\\n\");\n\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const editHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n `/{data.${model.name}.id}/edit`,\n );\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${labels}\n\n ${propsLine(dynamicParams)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName} details</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm\">\n ${displays}\n </div>\n\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4 justify-between\">\n <Button href${editHref} variant=\"outline\" size=\"sm\">\n Edit\n </Button>\n <form method=\"POST\">\n <Button type=\"submit\" variant=\"destructive\" size=\"sm\">Delete</Button>\n </form>\n </div>\n </div>\n </section>\n `;\n}\n\nfunction editServerSnippet(model: Model, fields: Field[], pb: string): string {\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n return dedent`\n import { error } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n let ${model.name};\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n } catch {\n error(404, \"Not found\");\n }\n ${relationLoads}\n return { ${model.name}${relationReturn} };\n };\n `;\n}\n\nfunction editRemoteSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n dynamicParams: string[],\n guard: boolean,\n): string {\n const formVar = updateFormIdentifier(model);\n const { currentUserField, currentTeamField } = injectables;\n const rendered = fields.filter(remoteFormSupports);\n const writeOnly = rendered.filter(isWriteOnly);\n const bools = rendered.filter((field) => field.type === \"bool\");\n const jsons = rendered.filter((field) => field.type === \"json\");\n\n // What the form posts is not always what should be written.\n const overrides: string[] = [];\n if (bools.length > 0) {\n overrides.push(\n \"// An unticked checkbox posts nothing at all, so absent means off.\",\n ...bools.map((field) => `${field.name}: rest.${field.name} ?? false,`),\n );\n }\n if (jsons.length > 0) {\n overrides.push(\n \"// An empty textarea is no value. Posted as it is, PocketBase would store\",\n '// the string \"\".',\n ...jsons.map((field) => `${field.name}: rest.${field.name} || null,`),\n );\n }\n if (writeOnly.length > 0) {\n overrides.push(\n \"// Left empty, these keep what is stored: an empty value would delete it.\",\n ...writeOnly.map((field) =>\n field.type === \"file\"\n ? `...(${field.name} instanceof File ? { ${field.name} } : {}),`\n : `...(${field.name} ? { ${field.name} } : {}),`,\n ),\n );\n }\n const preserved = [currentUserField, currentTeamField].filter(\n (field): field is InjectableField => Boolean(field),\n );\n if (preserved.length > 0) {\n overrides.push(\n ...preserved.map((field) => `${field.name}: existing.${field.name},`),\n );\n }\n\n const taken = [\"id\", \"collectionId\", ...writeOnly.map((field) => field.name)];\n const existing =\n preserved.length > 0\n ? `const existing = await ${pb}.collection(\"${model.tableName}\").getOne(id);`\n : \"\";\n const update =\n overrides.length > 0\n ? dedent`\n await ${pb}.collection(\"${model.tableName}\").update(id, {\n ...rest,\n ${overrides.join(\"\\n\")}\n });\n `\n : `await ${pb}.collection(\"${model.tableName}\").update(id, rest);`;\n\n // The create form requires these; here an empty one means \"no change\".\n const optionalOnEdit = writeOnly.filter(\n (field) => field.type === \"file\" && field.required,\n );\n const updateSchema = `update${model.typeName}Schema`;\n const schemaDeclaration =\n optionalOnEdit.length > 0\n ? dedent`\n // A stored file stays unless a new one is chosen, so the edit form does\n // not ask for it again.\n const ${updateSchema} = ${model.schemaName}.extend({\n ${optionalOnEdit.map((field) => `${field.name}: ${model.schemaName}.shape.${field.name}.optional(),`).join(\"\\n\")}\n });\n `\n : \"\";\n const schema = optionalOnEdit.length > 0 ? updateSchema : model.schemaName;\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n import { error, redirect } from \"@sveltejs/kit\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n ${schemaDeclaration}\n\n export const ${formVar} = form(${schema}, async (data) => {\n ${requireUserLines(guard, false)}\n const { locals${dynamicParams.length > 0 ? \", params\" : \"\"} } = getRequestEvent();\n const { ${taken.join(\", \")}, ...rest } = data;\n if (!id) error(400, \"id is required\");\n ${[existing, update].filter(Boolean).join(\"\\n\")}\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, \"/${id}\")});\n });\n `;\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const route = parseRoute(options.input.route, model, options, \"scaffold\");\n const paths = scaffoldFilePaths(route);\n const urls = scaffoldUrls(route);\n const dynamicParams = route.dynamicParams;\n const rules = rulesModeForCreate(options, model, shouldCreateCollection);\n const pb = pbInstance(options, rules);\n const guard = isProtectedRoute(route, options);\n const uiFields = fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n );\n const injectables = findInjectables(fields);\n\n const creates: File[] = [\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n remote: true,\n }),\n ),\n toFile(\n `${paths.list}/+page.server.ts`,\n listServerSnippet(model, uiFields, pb),\n ),\n toFile(\n `${paths.list}/+page.svelte`,\n listPageSnippet(model, urls, uiFields, dynamicParams),\n ),\n ];\n\n const newServerContent = newServerSnippet(model, uiFields, pb);\n if (newServerContent) {\n creates.push(toFile(`${paths.new}/+page.server.ts`, newServerContent));\n }\n creates.push(\n toFile(\n `${paths.new}/form.remote.ts`,\n newRemoteSnippet(\n model,\n urls,\n fields,\n pb,\n options.features.auth,\n dynamicParams,\n guard,\n ),\n ),\n toFile(\n `${paths.new}/+page.svelte`,\n newPageSnippet(model, urls, uiFields, injectables, dynamicParams),\n ),\n toFile(\n `${paths.show}/+page.server.ts`,\n showServerSnippet(model, urls, uiFields, pb, dynamicParams),\n ),\n toFile(\n `${paths.show}/+page.svelte`,\n showPageSnippet(model, urls, uiFields, dynamicParams),\n ),\n toFile(\n `${paths.edit}/+page.server.ts`,\n editServerSnippet(model, uiFields, pb),\n ),\n toFile(\n `${paths.edit}/form.remote.ts`,\n editRemoteSnippet(\n model,\n urls,\n uiFields,\n injectables,\n pb,\n dynamicParams,\n guard,\n ),\n ),\n toFile(\n `${paths.edit}/+page.svelte`,\n editPageSnippet(model, urls, uiFields, injectables, dynamicParams),\n ),\n toFile(\n `${paths.list}/server.test.ts`,\n generateScaffoldRemoteServerTestSnippet(\n model,\n urls,\n fields,\n options,\n collections,\n dynamicParams,\n ),\n ),\n );\n\n const components = [\n ...getRemoteFieldComponents(uiFields),\n \"button\",\n \"table\",\n \"data-table\",\n \"popover\",\n \"separator\",\n \"badge\",\n \"dropdown-menu\",\n \"checkbox\",\n \"select\",\n \"cells\",\n \"column-header\",\n \"faceted-filter\",\n \"data-table-pagination\",\n \"row-actions\",\n ] as Component[];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [...new Set(components)],\n packages: [TANSTACK_TABLE_CORE, ...(guard ? [VELASTACK_POCKETBASE] : [])],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth, rules)]\n : [],\n collectionPatches: [],\n collectionDrops: [],\n notes: scaffoldNotes(model, rules),\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { mergeResults, withNotes } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"generate-scaffold-remote\" as const;\nconst VERSION = \"1.3.0\";\nconst SOURCE = \"src/patterns/generate/scaffold-remote\";\nconst DOCS = \"/generate/scaffold\";\n\nexport async function generate(options: Options) {\n if (options.env === \"runtime\") {\n // Before the collection is created: nothing is written for a v8 project.\n const { assertRegistryPagination, assertTableCoreV9 } =\n await import(\"../../../runtime/table-core\");\n assertTableCoreV9(options.root);\n assertRegistryPagination(options.root);\n }\n\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(\n withNotes(mergeResults([baseRes, previewRes]), baseRes),\n options,\n );\n }\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { modifyOutcomeToFile } = await import(\"../../../runtime/modify-file\");\n const { modifySvelteConfigRemote } =\n await import(\"../../../runtime/modify-svelte-config-remote\");\n const logger = getLogger(options);\n logger.info(\"Modifying config for remote functions\");\n const remote = modifySvelteConfigRemote(options.root);\n const svelteConfigFile = modifyOutcomeToFile(remote.filePath, remote.outcome);\n\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n modifies: [\n ...baseRes.modifies,\n ...(svelteConfigFile ? [svelteConfigFile] : []),\n ],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return withNotes(\n await writeResult(await formatResult(runtimeRes, options), options),\n baseRes,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a scaffold (remote functions)\",\n summary:\n \"Generates CRUD routes and schema using SvelteKit remote functions for create/update forms.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"generators\" as const,\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\", \"remote-functions\"],\n\n command: {\n raw: \"vela generate scaffold --remote contact name:text email:email\",\n base: \"vela generate scaffold --remote\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"todos title:text! done:bool\",\n description: \"Todos with required title and boolean flag.\",\n },\n {\n command: \"pets type:select(dog:Dog,cat:Cat) owner:user\",\n description: \"Enum field and a one-to-many relation to user.\",\n },\n {\n command: \"pet name:text! breed:text! owner:current_user\",\n description: \"Auth-bound owner relation.\",\n },\n {\n command:\n 'project name:text! status:select(active,done) --route \"(app)/[team_id]/projects\"',\n description:\n \"Team-scoped CRUD via dynamic route param. Generated hrefs and redirects interpolate params.team_id.\",\n },\n ],\n\n tests: 6,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { ZOD } from \"../../../core/constants\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n generateSchemaSnippet,\n resolveInputFields,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, shouldCreateCollection } = await resolveInputFields(\n options,\n modelPath,\n fieldDefs,\n );\n\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const schema = generateSchemaSnippet(model, fields, {\n includeModelFields: !shouldCreateCollection,\n forForm: true,\n });\n\n return {\n creates: [toFile(schemaPath, schema)],\n modifies: [],\n deletes: [],\n components: [],\n // vela's templates already have zod; a project vela did not create may not.\n packages: [ZOD],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-schema\" as const;\nconst VERSION = \"1.0.8\";\nconst SOURCE = \"src/patterns/generate/schema\";\nconst DOCS = \"/generate/schema\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a schema\",\n summary: \"Generates a zod schema.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"zod\", \"schema\", \"pocketbase\"],\n\n command: {\n raw: \"vela generate schema contact name:text email:email\",\n base: \"vela generate schema\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"login email:email! password:text!\",\n description: \"Validation schema for a login form.\",\n },\n {\n command:\n \"settings theme:select(light:Light,dark:Dark) notifications:bool\",\n description: \"Schema with an enum and a boolean flag.\",\n },\n {\n command: \"address street:text! city:text! postal:text!\",\n description: \"Schema with all required text fields.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Provider, Result } from \"../../../core/types\";\nimport { providerCreates, resolveProvider } from \"../../../core/providers\";\n\n/**\n * The payments providers a shop can be generated for. The pages are each\n * provider's own: Stripe's read the synced catalog on the server, Shopify's\n * query the Storefront API, WhatsApp's read a module the developer edits (or\n * the CMS, when the project has one). Nothing is shared between them.\n */\nexport const PROVIDERS: Provider[] = [\n // The listing and product pages read PocketBase on the server.\n { id: \"stripe\", label: \"Stripe\", requires: { backend: true } },\n { id: \"shopify\", label: \"Shopify\" },\n { id: \"whatsapp\", label: \"WhatsApp\" },\n];\n\nexport const META = {\n slug: \"generate-shop\",\n providers: PROVIDERS,\n inheritsProvider: \"payments\",\n};\n\nconst providersRaw = import.meta.glob<string>(\"./providers/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n// With the CMS, the catalog is content edited in place rather than a module.\nconst providersCmsRaw = import.meta.glob<string>(\"./providers-cms/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/** The files `generate-shop` writes for `provider`, as app-relative paths. */\nexport function shopFiles(options: Options): File[] {\n const provider = resolveProvider(META, options);\n const files = new Map<string, File>();\n for (const file of providerCreates(providersRaw, provider.id)) {\n files.set(file.path, file);\n }\n if (options.features.cms) {\n const cms = providerCreates(\n providersCmsRaw,\n provider.id,\n \"./providers-cms/\",\n );\n if (cms.length > 0) {\n // The CMS pages replace the module and its pages wholesale.\n files.clear();\n for (const file of cms) files.set(file.path, file);\n }\n }\n return [...files.values()].sort((a, b) => a.path.localeCompare(b.path));\n}\n\nexport async function generate(options: Options) {\n return {\n creates: shopFiles(options),\n modifies: [],\n deletes: [],\n components: [\"button\"],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase, META, PROVIDERS } from \"./generate\";\n\nconst SLUG = \"generate-shop\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/generate/shop\";\nconst DOCS = \"/generate/shop\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { assertNoneExist } = await import(\"./generate.runtime\");\n assertNoneExist(options.root, baseRes.creates);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Generate a shop\",\n summary:\n \"Generates a product listing and product pages for the project's cart, in its payments provider's own terms: Stripe's synced catalog read on the server, Shopify's Storefront API, or a catalog module (or the CMS) for WhatsApp. The pages are yours to edit; the generator never writes over them.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n ecommerce: true,\n // The pages are shadcn-svelte markup, like the cart they add to.\n ui: \"shadcn\",\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"ecommerce\",\n \"shop\",\n \"catalog\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela generate shop\",\n base: \"vela generate shop\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n inheritsProvider: META.inheritsProvider,\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\n\nexport interface WorkflowArgs {\n /** Kebab-case: the workflow's registered name and its file name. */\n name: string;\n /** camelCase: the exported binding. */\n exportName: string;\n cron?: string;\n}\n\nconst NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nconst CRON_RE = /^\\S+(?:\\s+\\S+){4,5}$/;\n\nexport function toKebabCase(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[_\\s]+/g, \"-\")\n .toLowerCase();\n}\n\nexport function toCamelCase(kebab: string): string {\n return kebab.replace(/-([a-z0-9])/g, (_, c: string) => c.toUpperCase());\n}\n\n/** `<name> [--cron <expr>]`, in either order; `--cron=<expr>` works too. */\nexport function parseWorkflowArgs(argv: string[]): WorkflowArgs {\n let raw: string | undefined;\n let cron: string | undefined;\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--cron\") {\n cron = argv[++i];\n if (cron === undefined) {\n throw new InvalidArgumentError(\n \"--cron needs a schedule, e.g. --cron '*/5 * * * *'\",\n );\n }\n } else if (arg.startsWith(\"--cron=\")) {\n cron = arg.slice(\"--cron=\".length);\n } else if (arg.startsWith(\"-\")) {\n throw new InvalidArgumentError(`Unknown option: ${arg}`);\n } else if (raw === undefined) {\n raw = arg;\n } else {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <name> [--cron <schedule>]\",\n );\n }\n }\n\n if (!raw) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <name> [--cron <schedule>]\",\n );\n }\n\n const name = toKebabCase(raw);\n if (!NAME_RE.test(name)) {\n throw new InvalidArgumentError(\n `Invalid workflow name: \"${raw}\". Use letters, numbers and dashes, e.g. send-welcome-email.`,\n );\n }\n if (cron !== undefined && !CRON_RE.test(cron.trim())) {\n throw new InvalidArgumentError(\n `Invalid cron schedule: \"${cron}\". Expected five fields, e.g. '*/5 * * * *'.`,\n );\n }\n\n return { name, exportName: toCamelCase(name), cron: cron?.trim() };\n}\n\nfunction workflowSnippet({ name, exportName }: WorkflowArgs): string {\n return dedent`\n import { z } from 'zod';\n import { ow } from '#lib/server/workflows.js';\n\n /**\n * Start a run from any server code with \\`${exportName}.run(input)\\`. Runs\n * are listed under Workflows in the PocketBase dashboard.\n */\n export const ${exportName} = ow.defineWorkflow(\n {\n name: '${name}',\n // What \\`run()\\` takes, checked before the run is queued.\n schema: z.object({}),\n retryPolicy: { maximumAttempts: 3 }\n },\n async ({ input, step }) => {\n // Each step's return value is saved, so a retry or a restart carries on\n // after the last step that finished. Keep every step safe to repeat.\n const result = await step.run({ name: 'first-step' }, async () => {\n return input;\n });\n return result;\n }\n );\n `;\n}\n\nfunction cronWorkflowSnippet({ name, exportName, cron }: WorkflowArgs): string {\n return dedent`\n import { ow } from '#lib/server/workflows.js';\n\n /**\n * Runs on the schedule below; \\`${exportName}.run()\\` starts an extra run.\n * Runs are listed under Workflows in the PocketBase dashboard.\n */\n export const ${exportName} = ow.defineWorkflow(\n { name: '${name}', retryPolicy: { maximumAttempts: 3 } },\n async ({ step }) => {\n // Each step's return value is saved, so a retry or a restart carries on\n // after the last step that finished. Keep every step safe to repeat.\n await step.run({ name: 'first-step' }, async () => {\n // ...\n });\n }\n );\n\n /** Every workflow in this file starts on this schedule, once per minute across all servers. */\n export const cron = '${cron}';\n `;\n}\n\nfunction testSnippet({ name, exportName, cron }: WorkflowArgs): string {\n const run = cron ? `${exportName}.run()` : `${exportName}.run({})`;\n // A workflow that returns nothing completes with a null output.\n const expectation = cron ? \"resolves.toBeNull()\" : \"resolves.toEqual({})\";\n return dedent`\n import { afterAll, beforeAll, describe, expect, it } from 'vitest';\n import { startWorker, stopWorker } from '#lib/server/workflows.js';\n import { ${exportName} } from './${name}';\n\n describe('${name}', () => {\n // The test process runs a worker of its own, so a run completes here\n // without going through the dev server.\n beforeAll(() => startWorker());\n afterAll(() => stopWorker());\n\n it('completes', async () => {\n const handle = await ${run};\n await expect(handle.result({ timeoutMs: 15_000 })).${expectation};\n });\n });\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content: `${content}\\n`,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options): Promise<Result> {\n const args = parseWorkflowArgs(options.argv);\n const dir = `src/lib/workflows`;\n\n const creates = [\n toFile(\n `${dir}/${args.name}.ts`,\n args.cron ? cronWorkflowSnippet(args) : workflowSnippet(args),\n ),\n // Named to match the `server` filter `vela test:server` runs by default.\n toFile(`${dir}/${args.name}.server.test.ts`, testSnippet(args)),\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","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-workflow\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/generate/workflow\";\nconst DOCS = \"/generate/workflow\";\n\nexport async function generate(options: Options) {\n // The worker and client the generated file imports come with the base\n // template; a project from before then gets them from `enable workflows`.\n if (options.env === \"runtime\" && !options.features.workflows) {\n throw new InvalidArgumentError(\n \"This project has no workflow runtime yet. Run `vela enable workflows` first.\",\n );\n }\n\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a workflow\",\n summary:\n \"Adds a durable background workflow to src/lib/workflows, with a server test; --cron makes it recurring.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n workflows: true,\n },\n category: \"generators\" as const,\n tags: [\"openworkflow\", \"workflows\", \"background jobs\", \"cron\", \"pocketbase\"],\n\n command: {\n raw: \"vela generate workflow send-welcome-email\",\n base: \"vela generate workflow\",\n argv: [\"send-welcome-email\"],\n },\n\n examples: [\n {\n command: \"send-welcome-email\",\n description:\n \"A workflow started from server code with sendWelcomeEmail.run(input).\",\n },\n {\n command: \"sync-prices --cron '*/5 * * * *'\",\n description: \"A recurring workflow that runs every five minutes.\",\n },\n ],\n\n tests: 1,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { providerEnvVars, resolveProvider } from \"../../../core/providers\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { envEditsFor, META } from \"./generate\";\n\nexport async function generate(options: Options) {\n const provider = resolveProvider(META, options);\n\n // Same shape `applyEnvEdits` appends at runtime.\n const envLines = envEditsFor(provider).map((edit) =>\n edit.type === \"comment\" ? `# ${edit.key}` : `${edit.key}=${edit.value}`,\n );\n\n return {\n creates: [],\n modifies: [\n {\n // The declaration `$app/env/private` needs, for this provider's key.\n path: \"src/env.ts\",\n language: \"ts\",\n content: envVarsFile(providerEnvVars(provider)),\n status: \"success\" as const,\n },\n {\n path: \".env\",\n language: \"text\",\n content: envLines.join(\"\\n\") + \"\\n\",\n status: \"success\" as const,\n },\n ],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-ai\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/ai\";\nconst DOCS = \"/enable/ai\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable AI\",\n summary:\n \"Adds the Vercel AI SDK (through Vercel AI Gateway, OpenAI or Anthropic): a streaming /api/chat endpoint and an /ai chat page built on @ai-sdk/svelte.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"ai\" as const,\n tags: [\n \"sveltekit\",\n \"ai\",\n \"ai-sdk\",\n \"chat\",\n \"vercel-ai-gateway\",\n \"openai\",\n \"anthropic\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable ai --provider gateway\",\n base: \"vela enable ai\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--provider gateway\",\n description:\n \"Reach hundreds of models with one AI_GATEWAY_API_KEY through Vercel AI Gateway.\",\n },\n {\n command: \"--provider openai\",\n description:\n \"Call OpenAI directly with OPENAI_API_KEY via @ai-sdk/openai.\",\n },\n {\n command: \"--provider anthropic\",\n description:\n \"Call Anthropic directly with ANTHROPIC_API_KEY via @ai-sdk/anthropic.\",\n },\n ],\n\n tests: 3,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { providerEnvVars, resolveProvider } from \"../../../core/providers\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { envEditsFor, META } from \"./generate\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(options: Options) {\n const provider = resolveProvider(META, options);\n\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n // The declarations and `.env` lines depend on the provider, so they are\n // built rather than stored as fixtures. Same shapes the runtime writes.\n modifies.push({\n path: \"src/env.ts\",\n language: \"ts\",\n content: envVarsFile(providerEnvVars(provider)),\n status: \"success\" as const,\n });\n const envLines = envEditsFor(provider).map((edit) =>\n edit.type === \"comment\" ? `# ${edit.key}` : `${edit.key}=${edit.value}`,\n );\n modifies.push({\n path: \".env\",\n language: \"text\",\n content: envLines.join(\"\\n\") + \"\\n\",\n status: \"success\" as const,\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","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-analytics\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/analytics\";\nconst DOCS = \"/enable/analytics\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable analytics\",\n summary:\n \"Adds a web analytics component (Plausible, Google Analytics or PostHog) mounted in the root layout and configured from .env.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"analytics\" as const,\n tags: [\n \"sveltekit\",\n \"analytics\",\n \"plausible\",\n \"google-analytics\",\n \"posthog\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable analytics --provider plausible\",\n base: \"vela enable analytics\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--provider plausible\",\n description:\n \"Load the Plausible script for the site named by PUBLIC_PLAUSIBLE_DOMAIN.\",\n },\n {\n command: \"--provider google\",\n description:\n \"Load gtag.js for PUBLIC_GA_MEASUREMENT_ID and send a page_view on every navigation.\",\n },\n {\n command: \"--provider posthog\",\n description:\n \"Initialise posthog-js with PUBLIC_POSTHOG_KEY and PUBLIC_POSTHOG_HOST.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n\n generate,\n} satisfies Pattern;\n","import { Options, Result } from \"../../../core/types\";\nimport { composeCreates } from \"../../../core/util\";\nimport { FLASH, FORMSNAP, SUPERFORMS, ZOD } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst variantsRaw = import.meta.glob<string>(\"./variants/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const variant =\n typeof options.input?.variant === \"string\"\n ? options.input.variant\n : undefined;\n\n const creates = composeCreates(\n createsRaw,\n CREATES_PREFIX,\n variantsRaw,\n variant,\n );\n\n const components = [\n \"sidebar\",\n \"breadcrumb\",\n \"separator\",\n \"form\",\n \"collapsible\",\n \"avatar\",\n \"dropdown-menu\",\n \"card\",\n \"input\",\n \"label\",\n \"button\",\n \"badge\",\n \"dialog\",\n \"checkbox\",\n \"file-form\",\n \"auth-menu\",\n ];\n\n if (options.features.payments) {\n components.push(\"alert-dialog\");\n }\n\n const collections = [\n {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n name: \"oauth_accounts\",\n type: \"base\" as const,\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n name: \"user\",\n type: \"relation\",\n required: true,\n maxSelect: 1,\n },\n {\n name: \"providerId\",\n required: true,\n type: \"text\",\n },\n {\n name: \"provider\",\n required: true,\n type: \"text\",\n },\n {\n name: \"accessToken\",\n type: \"text\",\n },\n {\n name: \"refreshToken\",\n type: \"text\",\n },\n {\n name: \"avatarURL\",\n type: \"text\",\n },\n {\n name: \"expiry\",\n type: \"date\",\n },\n {\n name: \"email\",\n type: \"text\",\n },\n {\n name: \"name\",\n type: \"text\",\n },\n {\n name: \"username\",\n type: \"text\",\n },\n {\n name: \"rawUser\",\n type: \"json\",\n },\n ],\n },\n ];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n // The minimal template ships these; a static project turned backend\n // does not. Pinned to the template's versions.\n packages: [FORMSNAP, FLASH, SUPERFORMS, ZOD],\n collections,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-auth\" as const;\nconst VERSION = \"1.4.0\";\nconst SOURCE = \"src/patterns/enable/auth\";\nconst DOCS = \"/enable/auth\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n\n // Install components and write creates first so runtime modifies that\n // read from disk (e.g. the shadcn-installed sidebar) see the post-install\n // state. Without this, modifies targeting installed components run against\n // a non-existent file, return `not-found`, and are silently dropped.\n const writtenBase = await writeResult(\n await formatResult(\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n options,\n ),\n options,\n );\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const writtenRuntime = await writeResult(\n await formatResult(runtimeRes, options),\n options,\n );\n\n return mergeResults([writtenBase, writtenRuntime]);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable authentication\",\n summary: \"Enables authentication.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"velastack\",\n \"oauth\",\n \"pocketbase\",\n ],\n\n command: {\n raw: \"vela enable auth\",\n base: \"vela enable auth\",\n argv: [],\n },\n\n examples: [],\n\n tests: 26,\n\n baseline: \"velastack\",\n\n variants: [\"split\"],\n\n generate: generate,\n} satisfies Pattern;\n","import { TAKUMI } from \"../../../core/constants\";\nimport type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\n/** The paths this pattern writes; disable-og deletes the same ones. */\nexport function createdPaths(): string[] {\n return Object.keys(filesFromGlob(createsRaw, CREATES_PREFIX)).sort();\n}\n\nexport async function generate(_options: Options) {\n const creates = Object.values(filesFromGlob(createsRaw, CREATES_PREFIX)).sort(\n (a, b) => a.path.localeCompare(b.path),\n );\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [TAKUMI],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-og\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/enable/og\";\nconst DOCS = \"/enable/og\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable Open Graph images\",\n summary:\n \"Generates a share card for every page from a Svelte component: files at build time for prerendered pages, on request for the rest.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"content\" as const,\n tags: [\"sveltekit\", \"open-graph\", \"og-image\", \"seo\", \"takumi\", \"velastack\"],\n\n command: {\n raw: \"vela enable og\",\n base: \"vela enable og\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { FLASH, VELASTACK_POCKETBASE, ZOD } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n const components = [\n \"sidebar\",\n \"breadcrumb\",\n \"separator\",\n \"collapsible\",\n \"avatar\",\n \"dropdown-menu\",\n \"card\",\n \"input\",\n \"label\",\n \"button\",\n \"badge\",\n \"dialog\",\n \"checkbox\",\n \"auth-menu\",\n ];\n\n if (options.features.payments) {\n components.push(\"alert-dialog\");\n }\n\n const collections = [\n {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n name: \"oauth_accounts\",\n type: \"base\" as const,\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n name: \"user\",\n type: \"relation\",\n required: true,\n maxSelect: 1,\n },\n {\n name: \"providerId\",\n required: true,\n type: \"text\",\n },\n {\n name: \"provider\",\n required: true,\n type: \"text\",\n },\n {\n name: \"accessToken\",\n type: \"text\",\n },\n {\n name: \"refreshToken\",\n type: \"text\",\n },\n {\n name: \"avatarURL\",\n type: \"text\",\n },\n {\n name: \"expiry\",\n type: \"date\",\n },\n {\n name: \"email\",\n type: \"text\",\n },\n {\n name: \"name\",\n type: \"text\",\n },\n {\n name: \"username\",\n type: \"text\",\n },\n {\n name: \"rawUser\",\n type: \"json\",\n },\n ],\n },\n ];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n // The minimal template ships these; a static project turned backend\n // does not. Pinned to the template's versions.\n // `requireUser` in the settings functions is new in the floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [FLASH, ZOD, VELASTACK_POCKETBASE],\n collections,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-auth-remote\" as const;\nconst VERSION = \"1.5.0\";\nconst SOURCE = \"src/patterns/enable/auth-remote\";\nconst DOCS = \"/enable/auth-remote\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n const written = await writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n\n // In a project that already has i18n: the language select and the Spanish\n // enable-i18n would have added had these pages been there when it ran.\n // After the write, because both read the pages from disk.\n const { localizeAuthPages } = await import(\"../auth/i18n\");\n const localized = localizeAuthPages(options);\n if (localized.creates.length === 0 && localized.modifies.length === 0) {\n return written;\n }\n const writtenLocalized = await writeResult(\n await formatResult(\n {\n creates: localized.creates,\n modifies: localized.modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n },\n options,\n ),\n options,\n );\n return mergeResults([written, writtenLocalized]);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable authentication (remote functions)\",\n summary:\n \"Enables authentication using SvelteKit remote functions for login, signup, reset, and settings forms.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"velastack\",\n \"oauth\",\n \"pocketbase\",\n \"remote-functions\",\n ],\n\n command: {\n raw: \"vela enable auth --remote\",\n base: \"vela enable auth --remote\",\n argv: [],\n },\n\n examples: [],\n\n tests: 20,\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-api\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/enable/api\";\nconst DOCS = \"/enable/api\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable API\",\n summary: \"Enables the PocketBase API.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"api\", \"rest\", \"backend\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela enable api\",\n base: \"vela enable api\",\n argv: [],\n },\n\n examples: [],\n\n tests: 1,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { CollectionSpec, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nconst apiKeysCollection: CollectionSpec = {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n createRule: \"@request.auth.id = user.id\",\n updateRule: \"@request.auth.id = user.id\",\n deleteRule: \"@request.auth.id = user.id\",\n name: \"api_keys\",\n type: \"base\",\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n name: \"user\",\n type: \"relation\",\n },\n {\n name: \"key_hash\",\n type: \"text\",\n },\n {\n name: \"label\",\n type: \"text\",\n required: true,\n },\n {\n name: \"last_used\",\n type: \"date\",\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n};\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n // `form`: the new-key page is a superforms page. Auth's own pages bring\n // the component in, but `enable auth --remote` has none.\n components: [\"alert-dialog\", \"button\", \"badge\", \"form\"],\n packages: [spec(\"@types/node\")],\n collections: [apiKeysCollection],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-api-keys\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/enable/api-keys\";\nconst DOCS = \"/enable/api-keys\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable API keys\",\n summary:\n \"Adds API key management for authenticated users and PocketBase API access.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"api\" as const,\n tags: [\n \"sveltekit\",\n \"api\",\n \"api-keys\",\n \"pocketbase\",\n \"velastack\",\n \"authentication\",\n ],\n\n command: {\n raw: \"vela enable api-keys\",\n base: \"vela enable api-keys\",\n argv: [],\n },\n\n examples: [],\n\n tests: 6,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport {\n ADAPTER_NODE,\n VELASTACK_KIT,\n VELASTACK_POCKETBASE,\n} from \"../../../core/constants\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [\n VELASTACK_POCKETBASE,\n VELASTACK_KIT,\n spec(\"pocketbase-sveltekit\"),\n // The adapter the config is switched to has to be installed with it,\n // or the config fails to load and takes every .svelte file with it.\n ADAPTER_NODE,\n // test/setup.ts and the server tests other patterns add need these; the\n // minimal template ships them, the static one does not. The same\n // ranges as the template's, so both kinds of project end up alike.\n spec(\"vitest\"),\n spec(\"supertest\"),\n spec(\"@types/supertest\"),\n ],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { BACKEND_ENV_VARS } from \"./env-vars\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .concat({\n // Built from the same declarations the runtime writes.\n path: \"src/env.ts\",\n language: languageFromPath(\"src/env.ts\"),\n content: envVarsFile(BACKEND_ENV_VARS),\n status: \"success\" as const,\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-backend\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/enable/backend\";\nconst DOCS = \"/enable/backend\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n // An existing hooks.server.ts is composed into by the runtime instead.\n const { keepMissing } = await import(\"../../../runtime/modify-file\");\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: keepMissing(baseRes.creates, options.root) },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable Backend\",\n summary:\n \"Adds the PocketBase backend: installs @velastack/pocketbase and pocketbase-sveltekit, wires up hooks.server.ts, scaffolds the data/ directory, and switches the SvelteKit adapter to adapter-node.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"backend\" as const,\n tags: [\"sveltekit\", \"pocketbase\", \"backend\", \"velastack\"],\n\n command: {\n raw: \"vela enable backend\",\n base: \"vela enable backend\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsWithNegotiationRaw = import.meta.glob<string>(\n \"./creates-with-negotiation/**\",\n {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n },\n);\n\nconst CREATES_PREFIX = \"./creates/\";\nconst CREATES_WITH_NEGOTIATION_PREFIX = \"./creates-with-negotiation/\";\n\nfunction filesFromGlob(\n raw: Record<string, string>,\n prefix: string,\n): Record<string, File> {\n const files: Record<string, File> = {};\n for (const [key, content] of Object.entries(raw)) {\n const path = appRelativePath(key, prefix);\n files[path] = {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n }\n return files;\n}\n\nexport async function generate(options: Options) {\n const base = filesFromGlob(createsRaw, CREATES_PREFIX);\n const creates: Record<string, File> = { ...base };\n\n if (options.features.contentNegotiation) {\n const withNegotiation = filesFromGlob(\n createsWithNegotiationRaw,\n CREATES_WITH_NEGOTIATION_PREFIX,\n );\n Object.assign(creates, withNegotiation);\n }\n\n const sortedCreates = Object.values(creates).sort((a, b) =>\n a.path.localeCompare(b.path),\n );\n\n return {\n creates: sortedCreates,\n modifies: [],\n deletes: [],\n components: [\"avatar\", \"badge\", \"breadcrumb\", \"card\", \"separator\"],\n packages: [spec(\"mdsvex\")],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-blog\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/blog\";\nconst DOCS = \"/enable/blog\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable blog\",\n summary:\n \"Adds an mdsvex-powered blog with post list, tags, RSS feed, and example posts.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"content\" as const,\n tags: [\"sveltekit\", \"blog\", \"mdsvex\", \"markdown\", \"content\", \"rss\"],\n\n command: {\n raw: \"vela enable blog\",\n base: \"vela enable blog\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-cms\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/enable/cms\";\nconst DOCS = \"/enable/cms\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const { keepMissing } = await import(\"../../../runtime/modify-file\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: keepMissing(baseRes.creates, options.root) },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable CMS\",\n summary:\n \"Adds an inline-editing CMS with an admin bar, served from the app's own backend or a hosted one.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n // An app with a server hosts the backend itself; a static site reads from\n // a hosted CMS via --endpoint. Neither needs PocketBase.\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"content\" as const,\n tags: [\n \"sveltekit\",\n \"cms\",\n \"content\",\n \"inline-editing\",\n \"sqlite\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable cms\",\n base: \"vela enable cms\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--endpoint https://velastack.dev/v1/projects/<project>/cms\",\n description:\n \"Read from a hosted CMS instead of running the backend in the app — the only shape a static site can use.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import { NEGOTIATE, PUBLIC_DIR } from \"../../../core/constants\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsWithBlogRaw = import.meta.glob<string>(\"./creates-with-blog/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\nconst CREATES_WITH_BLOG_PREFIX = \"./creates-with-blog/\";\n\n/** Where the routes are stored; `inPublicGroup` moves them to the project's own group. */\nconst STORED_PUBLIC_DIR = `src/routes/${PUBLIC_DIR}/`;\n\n/**\n * A stored route path in the project's public group, or straight under\n * `src/routes` in a project without one (a SvelteKit project vela did not\n * create). Shared with disable-content-negotiation so it deletes what this\n * wrote.\n */\nexport function inPublicGroup(\n filePath: string,\n { routeGroups }: Pick<Options, \"routeGroups\">,\n): string {\n if (!routeGroups || !filePath.startsWith(STORED_PUBLIC_DIR)) return filePath;\n const group = routeGroups.public ? `${routeGroups.public}/` : \"\";\n return `src/routes/${group}${filePath.slice(STORED_PUBLIC_DIR.length)}`;\n}\n\n/** The demo page's meta tags loader, which imports `svelte-meta-tags`. */\nconst META_TAGS_LOADER = /\\/negotiate\\/\\+page\\.ts$/;\n\nfunction filesFromGlob(\n raw: Record<string, string>,\n prefix: string,\n): Record<string, File> {\n const files: Record<string, File> = {};\n for (const [key, content] of Object.entries(raw)) {\n const path = appRelativePath(key, prefix);\n files[path] = {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n }\n return files;\n}\n\nexport async function generate(options: Options) {\n const base = filesFromGlob(createsRaw, CREATES_PREFIX);\n const creates: Record<string, File> = { ...base };\n\n if (options.features.blog) {\n const withBlog = filesFromGlob(\n createsWithBlogRaw,\n CREATES_WITH_BLOG_PREFIX,\n );\n Object.assign(creates, withBlog);\n }\n\n // `svelte-meta-tags` is part of vela's templates, where the root layout\n // renders what the loader returns. A project without it has nothing to\n // render them with, so the loader is left out rather than the package added.\n const metaTags = options.input.metaTags ?? true;\n\n const sortedCreates = Object.values(creates)\n .filter((file) => metaTags || !META_TAGS_LOADER.test(file.path))\n .map((file) => ({ ...file, path: inPublicGroup(file.path, options) }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: sortedCreates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [NEGOTIATE],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-content-negotiation\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/content-negotiation\";\nconst DOCS = \"/enable/content-negotiation\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable content negotiation\",\n summary:\n \"Serves the same route as HTML, Markdown, or JSON using sveltekit-negotiate.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"content-negotiation\", \"markdown\", \"json\", \"api\"],\n\n command: {\n raw: \"vela enable content-negotiation\",\n base: \"vela enable content-negotiation\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { WUCHALE, WUCHALE_SVELTE } from \"../../../core/constants\";\nimport { composeCreates } from \"../../../core/util\";\nimport { resolveUi } from \"../../../core/field/ui\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n// A plain project gets a native <select> in place of the shadcn one, at the\n// same path, so the root layout import and disable-i18n cover both.\nconst variantsRaw = import.meta.glob<string>(\"./variants/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const ui = resolveUi(options);\n const creates = composeCreates(\n createsRaw,\n CREATES_PREFIX,\n variantsRaw,\n ui === \"plain\" ? \"plain\" : undefined,\n );\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: ui === \"plain\" ? [] : [\"select\"],\n packages: [WUCHALE, WUCHALE_SVELTE],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-i18n\" as const;\nconst VERSION = \"1.3.0\";\nconst SOURCE = \"src/patterns/enable/i18n\";\nconst DOCS = \"/enable/i18n\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime, withLibraryTexts } =\n await import(\"./generate.runtime\");\n baseRes.creates = withLibraryTexts(options.root, baseRes.creates);\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable i18n\",\n summary: \"Enables i18n with Wuchale and locale-aware routing.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"i18n\" as const,\n tags: [\"sveltekit\", \"i18n\", \"localization\", \"wuchale\", \"velastack\"],\n\n command: {\n raw: \"vela enable i18n\",\n base: \"vela enable i18n\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { CollectionSpec } from \"../../../../core/types\";\nimport { NOTIFICATION_RULE_PATCHES } from \"./pocketbase\";\n\nconst users = \"users\";\n\nfunction rulesFor(collectionName: string) {\n const p = NOTIFICATION_RULE_PATCHES.find(\n (x) => x.collectionName === collectionName,\n );\n if (!p) {\n throw new Error(\n `notifications: missing NOTIFICATION_RULE_PATCHES entry for \"${collectionName}\"`,\n );\n }\n return {\n listRule: p.listRule,\n viewRule: p.viewRule,\n createRule: p.createRule,\n updateRule: p.updateRule,\n deleteRule: p.deleteRule,\n };\n}\n\nexport const NOTIFICATIONS_PREVIEW_COLLECTIONS: CollectionSpec[] = [\n {\n name: \"notifications\",\n type: \"base\",\n ...rulesFor(\"notifications\"),\n indexes: [\n \"CREATE INDEX `idx_notifications_user_read_created` ON `notifications` (`user`, `read`, `created` DESC)\",\n ],\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"user\",\n type: \"relation\",\n cascadeDelete: true,\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"title\",\n type: \"text\",\n required: true,\n },\n {\n name: \"body\",\n type: \"text\",\n },\n {\n name: \"read\",\n type: \"bool\",\n },\n {\n name: \"created\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: false,\n },\n {\n name: \"updated\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: true,\n },\n ],\n },\n];\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { NOTIFICATIONS_PREVIEW_COLLECTIONS } from \"./runtime/collections\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: NOTIFICATIONS_PREVIEW_COLLECTIONS,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-notifications\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/enable/notifications\";\nconst DOCS = \"/enable/notifications\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable notifications\",\n summary:\n \"Adds an in-app notifications collection, a bell dropdown with 30s polling, and a /notifications page for managing read state.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"notifications\",\n \"pocketbase\",\n \"velastack\",\n \"in-app\",\n \"polling\",\n ],\n\n command: {\n raw: \"vela enable notifications\",\n base: \"vela enable notifications\",\n argv: [],\n },\n\n examples: [],\n\n tests: 6,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { resolveProvider } from \"../../../core/providers\";\nimport { filesUnderPrefix } from \"../../../core/util\";\nimport { envEditsFor, META } from \"./generate\";\nimport { buyPageSnippet } from \"./shopify-page\";\nimport { siteModule } from \"../../../runtime/site\";\nimport {\n PAYMENTS_APP_MODE_COLLECTIONS,\n PAYMENTS_BASE_COLLECTIONS,\n} from \"./runtime/collections\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PRICE_ID = \"price_preview_placeholder\";\nconst PREVIEW_VARIANT_ID = \"gid://shopify/ProductVariant/preview\";\n\nfunction orderPageSnippet(): string {\n return dedent`\n <script lang=\"ts\">\n import OrderButton from '#lib/components/payments/order-button.svelte';\n </script>\n\n <section data-role=\"content\">\n <OrderButton name=\"Sourdough loaf\" price={4.5} />\n </section>\n `;\n}\n\nfunction paymentPageSnippet(priceId: string): string {\n return dedent`\n <script lang=\"ts\">\n import PaymentButton from '#lib/components/payments/payment-button.svelte';\n </script>\n\n <section data-role=\"content\">\n <PaymentButton priceId=\"${priceId}\" />\n </section>\n `;\n}\n\nexport async function generate(options: Options) {\n const provider = resolveProvider(META, options);\n const isStripe = provider.id === \"stripe\";\n const isAppMode = options.features.auth;\n\n const modifies = Object.values(\n filesUnderPrefix(previewRaw, `./preview-modifies/${provider.id}/`),\n );\n // Built, not stored: Vite will not serve a file named `.env`, and these are\n // the lines the runtime writes.\n modifies.push({\n path: \".env\",\n language: \"text\",\n content:\n envEditsFor(provider)\n .map((edit) =>\n edit.type === \"comment\"\n ? `# ${edit.key}`\n : `${edit.key}=${edit.value}`,\n )\n .join(\"\\n\") + \"\\n\",\n status: \"success\",\n });\n // What the business declares: its currency and country, and the other\n // currencies it shows prices in.\n modifies.push({\n path: \"src/lib/site.ts\",\n language: \"typescript\",\n content: siteModule(\"My App\", undefined, {\n currency: \"MXN\",\n country: \"MX\",\n currencies: [\"USD\"],\n }),\n status: \"success\",\n });\n modifies.sort((a, b) => a.path.localeCompare(b.path));\n\n const paymentPage: File = {\n path: \"src/routes/(public)/payment/+page.svelte\",\n language: \"svelte\",\n content:\n provider.id === \"stripe\"\n ? paymentPageSnippet(PREVIEW_PRICE_ID)\n : provider.id === \"shopify\"\n ? buyPageSnippet(PREVIEW_VARIANT_ID)\n : orderPageSnippet(),\n status: \"success\",\n };\n\n const collections = isStripe\n ? [\n ...PAYMENTS_BASE_COLLECTIONS,\n ...(isAppMode ? PAYMENTS_APP_MODE_COLLECTIONS : []),\n ]\n : [];\n\n return {\n creates: [paymentPage],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-payments\" as const;\nconst VERSION = \"2.4.0\";\nconst SOURCE = \"src/patterns/enable/payments\";\nconst DOCS = \"/enable/payments\";\n\nexport async function generate(options: Options) {\n if (options.env === \"preview\") {\n const baseRes = await generateBase(options);\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime, hasVitest } =\n await import(\"./generate.runtime\");\n const baseRes = await generateBase(options, {\n unitTests: hasVitest(options.root),\n });\n // Before the runtime step creates collections: a component that cannot be\n // installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable payments\",\n summary:\n \"Adds payments with Stripe (product/price sync, a checkout dialog, and saved payment methods when auth is enabled), Shopify (a Storefront client and a Buy button that hands off to Shopify's checkout), or WhatsApp (an Order button that opens a prefilled chat with the business and records the order to a hosted VelaStack form).\",\n // Stripe adds backend and workflows; see its provider entry.\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"pocketbase\",\n \"velastack\",\n \"checkout\",\n ],\n\n command: {\n raw: \"vela enable payments --provider stripe\",\n base: \"vela enable payments\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--provider stripe\",\n description:\n \"Stripe keys in .env, products and prices synced into PocketBase, and a /payment page with a checkout dialog.\",\n },\n {\n command: \"--provider shopify\",\n description:\n \"A Storefront API client and a Buy button that sends the buyer to Shopify's checkout. No backend needed.\",\n },\n {\n command: \"--provider whatsapp\",\n description:\n \"An Order on WhatsApp button: the customer's name, phone and order open a chat with the business, and the order is recorded to a hosted VelaStack form. No backend needed.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Provider, Result } from \"../../../core/types\";\nimport { providerCreates, resolveProvider } from \"../../../core/providers\";\nimport { filesFromGlob } from \"../../../core/util\";\n\n/**\n * The payments providers ecommerce supports. It writes no env of its own:\n * the provider is whichever payments uses, and payments wrote the keys.\n */\nexport const PROVIDERS: Provider[] = [\n // The cart page's checkout action and the demo page run on the server.\n { id: \"stripe\", label: \"Stripe\", requires: { backend: true } },\n { id: \"shopify\", label: \"Shopify\" },\n // Checkout opens a WhatsApp chat in the browser; nothing runs on a server.\n { id: \"whatsapp\", label: \"WhatsApp\" },\n];\n\nexport const META = {\n slug: \"enable-ecommerce\",\n providers: PROVIDERS,\n inheritsProvider: \"payments\",\n};\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst providersRaw = import.meta.glob<string>(\"./providers/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst providersAppModeRaw = import.meta.glob<string>(\n \"./providers-app-mode/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nexport interface GenerateContext {\n /**\n * The project has payments' Stripe customer helper, so checkout can attach\n * the signed-in buyer. Only the runtime can look; preview shows the guest\n * version.\n */\n stripeCustomer?: boolean;\n}\n\nexport async function generate(\n options: Options,\n { stripeCustomer = false }: GenerateContext = {},\n) {\n const provider = resolveProvider(META, options);\n\n const creates = new Map<string, File>();\n const add = (files: File[]) => {\n for (const file of files) creates.set(file.path, file);\n };\n add(Object.values(filesFromGlob(createsRaw, \"./creates/\")));\n add(providerCreates(providersRaw, provider.id));\n if (provider.id === \"stripe\" && stripeCustomer) {\n add(\n providerCreates(\n providersAppModeRaw,\n provider.id,\n \"./providers-app-mode/\",\n ),\n );\n }\n\n return {\n creates: [...creates.values()].sort((a, b) => a.path.localeCompare(b.path)),\n modifies: [],\n deletes: [],\n components: [\"sheet\", \"button\", \"badge\", \"separator\"],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { resolveProvider } from \"../../../core/providers\";\nimport { filesFromGlob } from \"../../../core/util\";\nimport { META } from \"./generate\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nexport async function generate(options: Options) {\n // The cart's files come from the base generator; the preview adds the\n // navbar change. A shop page is `generate-shop`'s.\n resolveProvider(META, options);\n\n return {\n creates: [],\n modifies: Object.values(\n filesFromGlob(previewRaw, \"./preview-modifies/\"),\n ).sort((a, b) => a.path.localeCompare(b.path)),\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, META, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-ecommerce\" as const;\nconst VERSION = \"2.2.0\";\nconst SOURCE = \"src/patterns/enable/ecommerce\";\nconst DOCS = \"/enable/ecommerce\";\n\nexport async function generate(options: Options) {\n if (options.env === \"preview\") {\n const baseRes = await generateBase(options);\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime, hasStripeCustomer } =\n await import(\"./generate.runtime\");\n const baseRes = await generateBase(options, {\n stripeCustomer: hasStripeCustomer(options.root),\n });\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable ecommerce\",\n summary:\n \"Adds a cart to the navbar and a checkout, on the project's payments provider: a browser cart that checks out through Stripe Checkout, a Shopify Storefront cart that hands off to Shopify's checkout, or a browser cart whose checkout opens a WhatsApp chat with the business and records the order to a hosted VelaStack form.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The cart is shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"ecommerce\",\n \"cart\",\n \"checkout\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable ecommerce\",\n base: \"vela enable ecommerce\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n inheritsProvider: META.inheritsProvider,\n\n generate,\n} satisfies Pattern;\n","import type { CollectionSpec, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nconst stripeSubscriptions: CollectionSpec = {\n name: \"stripe_subscriptions\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n {\n collectionId: \"stripe_customers\",\n maxSelect: 1,\n minSelect: 0,\n name: \"customer\",\n required: true,\n type: \"relation\",\n cascadeDelete: true,\n },\n {\n collectionId: \"stripe_prices\",\n maxSelect: 1,\n minSelect: 0,\n name: \"price\",\n required: true,\n type: \"relation\",\n },\n { name: \"status\", required: true, type: \"text\" },\n { name: \"current_period_start\", required: false, type: \"date\" },\n { name: \"current_period_end\", required: false, type: \"date\" },\n { name: \"cancel_at_period_end\", required: false, type: \"bool\" },\n { name: \"canceled_at\", required: false, type: \"date\" },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n};\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [stripeSubscriptions],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-subscriptions\" as const;\nconst VERSION = \"1.1.2\";\nconst SOURCE = \"src/patterns/enable/subscriptions\";\nconst DOCS = \"/enable/subscriptions\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { assertPaymentsAppMode, generate: generateRuntime } =\n await import(\"./generate.runtime\");\n assertPaymentsAppMode(options.root);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable subscriptions\",\n summary:\n \"Adds Stripe subscription billing with plan selection, cancel/resume, and webhook-synced subscription state. Requires enable-payments.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n workflows: true,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n // Stripe Billing: Shopify sells subscriptions through its own apps.\n providers: { payments: [\"stripe\"] },\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"subscriptions\",\n \"pocketbase\",\n \"velastack\",\n \"billing\",\n ],\n\n command: {\n raw: \"vela enable subscriptions\",\n base: \"vela enable subscriptions\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/** The files enable-orders changes, in their final state, for the preview. */\nexport async function generate(_options: Options) {\n return {\n creates: [],\n modifies: Object.values(\n filesFromGlob(previewRaw, \"./preview-modifies/\"),\n ).sort((a, b) => a.path.localeCompare(b.path)),\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-orders\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/enable/orders\";\nconst DOCS = \"/enable/orders\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable orders\",\n summary:\n \"Records what was bought through Stripe Checkout: orders and their lines, written by the webhook so a redelivery updates rather than duplicates. The success page shows the order; with auth, users see their own orders, and a paid order notifies them when notifications are on.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n workflows: true,\n ecommerce: true,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n // Shopify keeps its own orders; WhatsApp orders are hosted-form submissions.\n providers: { payments: [\"stripe\"] },\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"ecommerce\",\n \"orders\",\n \"stripe\",\n \"webhooks\",\n \"pocketbase\",\n \"velastack\",\n ],\n command: {\n raw: \"vela enable orders\",\n base: \"vela enable orders\",\n argv: [],\n },\n examples: [],\n tests: 0,\n baseline: \"velastack\",\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [\n \"card\",\n \"button\",\n \"avatar\",\n \"badge\",\n \"table\",\n \"alert-dialog\",\n \"form\",\n \"input\",\n \"dialog\",\n \"select\",\n \"dropdown-menu\",\n ],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { CollectionSpec } from \"../../../../core/types\";\nimport { TEAM_RULE_PATCHES } from \"./pocketbase\";\n\n/** Relation targets use collection names as readable stand-ins for PocketBase collection ids in preview. */\nconst users = \"users\";\nconst teams = \"teams\";\nconst teamMemberships = \"team_memberships\";\n\nfunction rulesFor(collectionName: string) {\n const p = TEAM_RULE_PATCHES.find((x) => x.collectionName === collectionName);\n if (!p) {\n throw new Error(\n `teams: missing TEAM_RULE_PATCHES entry for \"${collectionName}\"`,\n );\n }\n return {\n listRule: p.listRule,\n viewRule: p.viewRule,\n createRule: p.createRule,\n updateRule: p.updateRule,\n deleteRule: p.deleteRule,\n };\n}\n\n/**\n * PocketBase collections created at runtime (see `generate.runtime.ts`), with API rules merged.\n * Exposed in preview results for docs and schema previews without running migrations.\n */\nexport const TEAMS_PREVIEW_COLLECTIONS: CollectionSpec[] = [\n {\n name: \"teams\",\n type: \"base\",\n ...rulesFor(\"teams\"),\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"name\",\n type: \"text\",\n required: true,\n },\n {\n name: \"owner\",\n type: \"relation\",\n cascadeDelete: false,\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"created\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: false,\n },\n {\n name: \"updated\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: true,\n },\n ],\n },\n {\n name: \"team_memberships\",\n type: \"base\",\n ...rulesFor(\"team_memberships\"),\n fields: [\n {\n name: \"id\",\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n name: \"team\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"user\",\n cascadeDelete: true,\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"role\",\n maxSelect: 1,\n required: true,\n type: \"select\",\n values: [\"owner\", \"admin\", \"member\"],\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n },\n {\n name: \"team_users\",\n type: \"view\",\n ...rulesFor(\"team_users\"),\n viewQuery:\n \"select users.id, users.email, users.name, team_memberships.id as membership_id, team_memberships.team, team_memberships.role from users join team_memberships on team_memberships.user = users.id;\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n name: \"email\",\n exceptDomains: null,\n onlyDomains: null,\n // Accounts made with a phone number may have no email.\n required: false,\n type: \"email\",\n },\n {\n name: \"name\",\n max: 255,\n required: false,\n type: \"text\",\n },\n {\n name: \"membership_id\",\n cascadeDelete: false,\n collectionId: teamMemberships,\n maxSelect: 1,\n minSelect: 0,\n required: false,\n type: \"relation\",\n },\n {\n name: \"team\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"role\",\n maxSelect: 1,\n required: true,\n type: \"select\",\n values: [\"owner\", \"admin\", \"member\"],\n },\n ],\n },\n {\n name: \"team_invites\",\n type: \"base\",\n ...rulesFor(\"team_invites\"),\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"team\",\n type: \"relation\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"email\",\n type: \"email\",\n required: true,\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n },\n {\n name: \"team_invite_links\",\n type: \"base\",\n ...rulesFor(\"team_invite_links\"),\n indexes: [\n \"CREATE UNIQUE INDEX `idx_9y3Oz1KVzz` ON `team_invite_links` (`team`)\",\n ],\n fields: [\n {\n name: \"id\",\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n name: \"team\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n },\n];\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { TEAMS_PREVIEW_COLLECTIONS } from \"./runtime/collections\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: TEAMS_PREVIEW_COLLECTIONS,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-teams\" as const;\nconst VERSION = \"1.1.2\";\nconst SOURCE = \"src/patterns/enable/teams\";\nconst DOCS = \"/enable/teams\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the runtime step creates collections: a component that cannot be\n // installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable teams\",\n summary:\n \"Adds multi-tenant teams with memberships, invites, and a sidebar team switcher.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"teams\",\n \"pocketbase\",\n \"velastack\",\n \"multi-tenant\",\n \"collaboration\",\n ],\n\n command: {\n raw: \"vela enable teams\",\n base: \"vela enable teams\",\n argv: [],\n },\n\n examples: [],\n\n tests: 36,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsSuperformsRaw = import.meta.glob<string>(\n \"./creates-superforms/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst createsRemoteRaw = import.meta.glob<string>(\"./creates-remote/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/**\n * The WhatsApp client helpers and the code page, in the form style of the\n * project's auth pages: superforms actions, or remote functions (auth-remote).\n */\nexport async function generate(\n _options: Options,\n mode: \"superforms\" | \"remote\" = \"superforms\",\n) {\n const creates: Record<string, File> = {\n ...filesFromGlob(createsRaw, \"./creates/\"),\n ...(mode === \"remote\"\n ? filesFromGlob(createsRemoteRaw, \"./creates-remote/\")\n : filesFromGlob(createsSuperformsRaw, \"./creates-superforms/\")),\n };\n\n return {\n creates: Object.values(creates).sort((a, b) =>\n a.path.localeCompare(b.path),\n ),\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\n// The base login and signup pages with WhatsApp, as `enable whatsapp` writes\n// them over the stock enable-auth ones.\nconst previewRaw = import.meta.glob<string>(\"./templates/base/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nexport async function generate(_options: Options) {\n const modifies = Object.values(\n filesFromGlob(previewRaw, \"./templates/base/\"),\n ).sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-whatsapp\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/whatsapp\";\nconst DOCS = \"/enable/whatsapp\";\n\nexport async function generate(options: Options) {\n if (options.env === \"runtime\" && !options.features.auth) {\n throw new InvalidArgumentError(\n \"WhatsApp sign-in goes on the login and signup pages. Run `vela enable auth` first.\",\n );\n }\n\n if (options.env === \"preview\") {\n const baseRes = await generateBase(options);\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs, prettier or ts-morph into SSR.\n const { detectMode } = await import(\"./modifies/auth-pages\");\n const { keepMissing } = await import(\"../../../runtime/modify-file\");\n const baseRes = await generateBase(options, detectMode(options.root));\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n // A re-run keeps the code page and helpers as the project has them.\n { ...baseRes, creates: keepMissing(baseRes.creates, options.root) },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable WhatsApp sign-in\",\n summary:\n \"Adds sign-in and signup with a code sent on WhatsApp to the login and signup pages, next to email. Requires enable-auth.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"whatsapp\",\n \"otp\",\n \"pocketbase\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable whatsapp\",\n base: \"vela enable whatsapp\",\n argv: [],\n },\n\n examples: [],\n\n tests: 2,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\n/**\n * The same three packages the base template lists. `openworkflow` is the\n * engine's client and worker, `openworkflow-pocketbase` its PocketBase\n * backend, and `croner` matches the cron expressions recurring workflows\n * export; none of them has runtime dependencies of its own.\n */\nexport const WORKFLOW_PACKAGES = [\n spec(\"openworkflow\"),\n spec(\"openworkflow-pocketbase\"),\n spec(\"croner\"),\n];\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: WORKFLOW_PACKAGES,\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { WORKFLOWS_ENV_VARS } from \"./env-vars\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .concat({\n // Built from the same declarations the runtime writes.\n path: \"src/env.ts\",\n language: languageFromPath(\"src/env.ts\"),\n content: envVarsFile(WORKFLOWS_ENV_VARS),\n status: \"success\" as const,\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-workflows\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/workflows\";\nconst DOCS = \"/enable/workflows\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\n/**\n * The upgrade path. Projects created from the base template already carry\n * `src/lib/server/workflows.ts`, `src/lib/workflows/` and the `init` hook;\n * this brings a project created before that up to the same shape. The files\n * it creates are the template's, byte for byte, so on a current project it\n * changes nothing.\n */\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable workflows\",\n summary:\n \"Adds durable background workflows on the OpenWorkflow engine built into PocketBase: a worker started from hooks.server.ts, src/lib/workflows/ for workflow modules, and cron support for recurring ones.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"backend\" as const,\n tags: [\n \"sveltekit\",\n \"pocketbase\",\n \"openworkflow\",\n \"workflows\",\n \"background jobs\",\n \"cron\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable workflows\",\n base: \"vela enable workflows\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport { parseModel } from \"../../../parse/model\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n\n const schemaFile: File = {\n path: schemaPath,\n language: languageFromPath(schemaPath),\n content: \"\",\n status: \"success\",\n };\n\n return {\n creates: [],\n modifies: [],\n deletes: [schemaFile],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"destroy-schema\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/schema\";\nconst DOCS = \"/destroy/schema\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n const formatted = await formatResult(baseRes, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a schema\",\n summary: \"Removes the zod schema file created by generate-schema.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"zod\", \"schema\", \"pocketbase\"],\n\n command: {\n raw: \"vela destroy schema contact\",\n base: \"vela destroy schema\",\n argv: [\"contact\"],\n },\n\n examples: [\n {\n command: \"login\",\n description: \"Remove the login validation schema.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { parseModel, parseRoute } from \"../../../parse\";\nimport { toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-form\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/form\";\nconst DOCS = \"/destroy/form\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const route = parseRoute(options.input.route, model, options, \"form\");\n const routeDir = route.fileBase;\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: [toDeleteEntry(routeDir), toDeleteEntry(schemaPath)],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a form\",\n summary:\n \"Removes the route directory and schema file created by generate-form.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"form\", \"sveltekit\", \"pocketbase\"],\n\n command: {\n raw: \"vela destroy form contact\",\n base: \"vela destroy form\",\n argv: [\"contact\"],\n },\n\n examples: [\n {\n command: \"login\",\n description: \"Remove the login form.\",\n },\n {\n command: 'project --route \"(app)/[team_id]/projects/new\"',\n description:\n \"Remove a form generated under a custom route. --route must match the create command.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { parseModel } from \"../../../parse/model\";\nimport { planDropsForCollections, toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-resource\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/resource\";\nconst DOCS = \"/destroy/resource\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const collectionDrops = await planDropsForCollections(\n [model.tableName],\n options,\n );\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: [toDeleteEntry(schemaPath)],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a resource\",\n summary:\n \"Drops the collection and removes the schema file created by generate-resource.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"pocketbase\", \"resource\", \"schema\"],\n\n command: {\n raw: \"vela destroy resource contacts\",\n base: \"vela destroy resource\",\n argv: [\"contacts\"],\n },\n\n examples: [\n {\n command: \"articles\",\n description: \"Remove an articles resource.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { parseModel, parseRoute, scaffoldFilePaths } from \"../../../parse\";\nimport { planDropsForCollections, toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-scaffold\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/scaffold\";\nconst DOCS = \"/destroy/scaffold\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const route = parseRoute(options.input.route, model, options, \"scaffold\");\n const paths = scaffoldFilePaths(route);\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const collectionDrops = await planDropsForCollections(\n [model.tableName],\n options,\n );\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: [toDeleteEntry(paths.list), toDeleteEntry(schemaPath)],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a scaffold\",\n summary:\n \"Removes the route directory and schema file created by generate-scaffold and drops the collection. Retains shadcn components.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\"],\n\n command: {\n raw: \"vela destroy scaffold contacts\",\n base: \"vela destroy scaffold\",\n argv: [\"contacts\"],\n },\n\n examples: [\n {\n command: \"todos\",\n description: \"Remove a todos scaffold.\",\n },\n {\n command: 'project --route \"(app)/[team_id]/projects\"',\n description:\n \"Remove a scaffold generated under a custom route. --route must match the create command.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-shop\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/shop\";\nconst DOCS = \"/destroy/shop\";\n\nconst shopRaw = import.meta.glob<string>(\n [\"../../generate/shop/providers/**\", \"../../generate/shop/providers-cms/**\"],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n/** Every path `generate-shop` can write, whichever provider wrote it. */\nexport const SHOP_PATHS = allProviderPaths(shopRaw);\n\nexport async function generate(options: Options) {\n // The shop follows the payments provider; with none detected (payments\n // already gone) every provider's files are removed, missing ones skipped.\n const detected = options.providers?.payments;\n const paths = detected ? allProviderPaths(shopRaw, detected) : SHOP_PATHS;\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: paths.map(toDeleteEntry),\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Destroy a shop\",\n summary:\n \"Removes the shop pages generate-shop wrote (and the catalog module on WhatsApp). The cart, payments and anything in Stripe, Shopify or the CMS stay.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"payments\" as const,\n tags: [\"sveltekit\", \"ecommerce\", \"shop\", \"velastack\"],\n\n command: {\n raw: \"vela destroy shop\",\n base: \"vela destroy shop\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-ai\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/ai\";\nconst DOCS = \"/disable/ai\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable AI\",\n summary:\n \"Removes the AI SDK model module, the /api/chat endpoint and the /ai demo page, strips the provider's API key from .env and uninstalls the AI SDK packages.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"ai\" as const,\n tags: [\n \"sveltekit\",\n \"ai\",\n \"ai-sdk\",\n \"chat\",\n \"vercel-ai-gateway\",\n \"openai\",\n \"anthropic\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela disable ai\",\n base: \"vela disable ai\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-analytics\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/analytics\";\nconst DOCS = \"/disable/analytics\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable analytics\",\n summary:\n \"Removes the analytics component and <Analytics /> from the root layout, strips the provider's variables from .env and uninstalls posthog-js.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"analytics\" as const,\n tags: [\n \"sveltekit\",\n \"analytics\",\n \"plausible\",\n \"google-analytics\",\n \"posthog\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela disable analytics\",\n base: \"vela disable analytics\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { createdPaths } from \"../../enable/og/generate\";\n\nexport async function generate(_options: Options) {\n return {\n creates: [],\n modifies: [],\n // A card.svelte the project has redesigned goes too; that is what\n // `--destructive` is asked for.\n deletes: createdPaths().map(toDeleteEntry),\n components: [],\n packages: [],\n uninstalls: [\"@takumi-rs/core\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-og\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/og\";\nconst DOCS = \"/disable/og\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable Open Graph images\",\n summary:\n \"Removes the share card, its route and renderer, takes withCard off the root layout and uninstalls @takumi-rs/core.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"content\" as const,\n tags: [\"sveltekit\", \"open-graph\", \"og-image\", \"seo\", \"velastack\"],\n\n command: {\n raw: \"vela disable og\",\n base: \"vela disable og\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/api/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/api/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-api\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/api\";\nconst DOCS = \"/disable/api\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable API\",\n summary: \"Disables the PocketBase API handler.\",\n requires: {\n auth: false,\n api: true,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"api\", \"rest\", \"backend\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable api\",\n base: \"vela disable api\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/api-keys/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/api-keys/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-api-keys\" as const;\nconst VERSION = \"1.0.1\";\nconst SOURCE = \"src/patterns/disable/api-keys\";\nconst DOCS = \"/disable/api-keys\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable API keys\",\n summary:\n \"Removes API key management: drops the api_keys collection, reverts hooks.server and nav-user, deletes generated API key routes.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: true,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\n \"sveltekit\",\n \"api\",\n \"api-keys\",\n \"pocketbase\",\n \"velastack\",\n \"authentication\",\n ],\n\n command: {\n raw: \"vela disable api-keys\",\n base: \"vela disable api-keys\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst authCreatesRaw = import.meta.glob<string>(\n \"../../enable/auth/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\nconst authRemoteCreatesRaw = import.meta.glob<string>(\n \"../../enable/auth-remote/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n// enable-whatsapp's code page and helpers live on the auth pages too.\nconst whatsappCreatesRaw = import.meta.glob<string>(\n [\n \"../../enable/whatsapp/creates/**\",\n \"../../enable/whatsapp/creates-superforms/**\",\n \"../../enable/whatsapp/creates-remote/**\",\n ],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst AUTH_CREATES_PREFIX = \"../../enable/auth/creates/\";\nconst AUTH_REMOTE_CREATES_PREFIX = \"../../enable/auth-remote/creates/\";\nconst WHATSAPP_CREATES_PREFIX =\n /^\\.\\.\\/\\.\\.\\/enable\\/whatsapp\\/creates(-superforms|-remote)?\\//;\n\nexport async function generate(_options: Options) {\n const paths = new Set<string>();\n for (const key of Object.keys(authCreatesRaw)) {\n paths.add(appRelativePath(key, AUTH_CREATES_PREFIX));\n }\n for (const key of Object.keys(authRemoteCreatesRaw)) {\n paths.add(appRelativePath(key, AUTH_REMOTE_CREATES_PREFIX));\n }\n for (const key of Object.keys(whatsappCreatesRaw)) {\n paths.add(key.replace(WHATSAPP_CREATES_PREFIX, \"\"));\n }\n\n const deletes = Array.from(paths)\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-auth\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/disable/auth\";\nconst DOCS = \"/disable/auth\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable auth\",\n summary:\n \"Reverts auth integration (including the remote-functions variant): removes auth routes, reverts layout/hooks edits, drops oauth_accounts. Does NOT delete the users collection or user data.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"auth\", \"sveltekit\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable auth\",\n base: \"vela disable auth\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { ADAPTER_STATIC } from \"../../../core/constants\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { WORKFLOW_PACKAGES } from \"../../enable/workflows/generate\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/backend/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/backend/creates/\";\n\n/**\n * Workflows run on PocketBase and their worker starts from hooks.server.ts, so\n * they go with the backend: the runtime, and the workflow modules that import\n * `ow` from it. Left behind they no longer type-check (`App.Locals[\"admin\"]`).\n */\nconst WORKFLOW_PATHS = [\"src/lib/server/workflows.ts\", \"src/lib/workflows\"];\n\n/** `openworkflow@^0.11.0` -> `openworkflow`, `@scope/name@1` -> `@scope/name`. */\nfunction packageName(spec: string): string {\n const at = spec.lastIndexOf(\"@\");\n return at > 0 ? spec.slice(0, at) : spec;\n}\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .concat(\n [\"data\", ...WORKFLOW_PATHS].map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n })),\n )\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n // The adapter the config is switched back to, so the project still builds.\n packages: [ADAPTER_STATIC],\n uninstalls: WORKFLOW_PACKAGES.map(packageName),\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-backend\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/backend\";\nconst DOCS = \"/disable/backend\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n // The runtime reverts hooks.server.ts instead of deleting it, so handles\n // other patterns composed in survive; it reports a delete when nothing did.\n const merged = await formatResult(\n mergeResults([\n {\n ...baseRes,\n deletes: baseRes.deletes.filter(\n (file) => file.path !== \"src/hooks.server.ts\",\n ),\n },\n runtimeRes,\n ]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable Backend\",\n summary:\n \"Removes the PocketBase backend: deletes data/ (the local database, fixtures, hooks and seeds), the background workflows (which run on PocketBase, uninstalling their packages) and every server.test.ts, takes the backend out of hooks.server.ts, removes the PocketBase and workflow variables from src/env.ts, switches the SvelteKit adapter back to static with SPA fallback, and reverts test/setup.ts and .gitignore. An older root layout that read the app name from PocketBase is pointed at src/lib/site.ts. Leaves @velastack/pocketbase and pocketbase-sveltekit installed; uninstall manually.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"backend\" as const,\n tags: [\"sveltekit\", \"pocketbase\", \"backend\", \"velastack\"],\n\n command: {\n raw: \"vela disable backend\",\n base: \"vela disable backend\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { inPublicGroup } from \"../../enable/content-negotiation/generate\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/content-negotiation/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n// With blog on, enable-content-negotiation (or enable-blog after it) writes\n// a negotiating blog post loader; it only exists because negotiation did.\nconst createsWithBlogRaw = import.meta.glob<string>(\n \"../../enable/content-negotiation/creates-with-blog/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/content-negotiation/creates/\";\nconst CREATES_WITH_BLOG_PREFIX =\n \"../../enable/content-negotiation/creates-with-blog/\";\n\nexport async function generate(options: Options) {\n const paths = [\n ...Object.keys(createsRaw).map((key) =>\n appRelativePath(key, CREATES_PREFIX),\n ),\n ...Object.keys(createsWithBlogRaw).map((key) =>\n appRelativePath(key, CREATES_WITH_BLOG_PREFIX),\n ),\n ];\n const deletes = [...new Set(paths)]\n .map((path) => inPublicGroup(path, options))\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n // What enable-content-negotiation installed; the CLI detects the feature\n // by this dependency, so disabling has to remove it.\n uninstalls: [\"sveltekit-negotiate\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-content-negotiation\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/content-negotiation\";\nconst DOCS = \"/disable/content-negotiation\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable content negotiation\",\n summary:\n \"Removes sveltekit-negotiate wiring: deletes creates, unwraps hooks.server handle, reverts reroute (preserving i18n compose), removes <Negotiate /> from the root layout.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: true,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"content-negotiation\", \"markdown\", \"json\", \"api\"],\n\n command: {\n raw: \"vela disable content-negotiation\",\n base: \"vela disable content-negotiation\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/i18n/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/i18n/creates/\";\nconst WUCHALE_CACHE = \"src/locales/.wuchale\";\n\nexport async function generate(_options: Options) {\n const deletes = [\n ...Object.keys(createsRaw).map((key) =>\n appRelativePath(key, CREATES_PREFIX),\n ),\n // wuchale's compiled catalogs and proxies: a cache, and git-ignored only\n // while the feature is on.\n WUCHALE_CACHE,\n ]\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n // What enable-i18n installed; the CLI detects the feature by the wuchale\n // dependency, so disabling has to remove it.\n uninstalls: [\"wuchale\", \"@wuchale/svelte\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-i18n\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/disable/i18n\";\nconst DOCS = \"/disable/i18n\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable i18n\",\n summary:\n \"Removes i18n: deletes the generated files, uninstalls wuchale, and reverts vite.config, the package.json #locales import, hooks.server, app.html, the root +layout.ts and layout, and the .gitignore and .prettierignore blocks. The wuchale cache (src/locales/.wuchale) and the loaders wuchale wrote in src/locales go; the translation catalogs there stay.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: true,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"i18n\" as const,\n tags: [\"sveltekit\", \"i18n\", \"localization\", \"wuchale\", \"velastack\"],\n\n command: {\n raw: \"vela disable i18n\",\n base: \"vela disable i18n\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/notifications/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/notifications/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-notifications\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/disable/notifications\";\nconst DOCS = \"/disable/notifications\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable notifications\",\n summary:\n \"Drops the notifications collection, deletes the bell component, server helpers and /notifications page, and takes the bell and its loader out of the (app) layout.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"sveltekit\", \"notifications\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable notifications\",\n base: \"vela disable notifications\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/teams/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/teams/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-teams\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/disable/teams\";\nconst DOCS = \"/disable/teams\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable teams\",\n summary:\n \"Removes the teams collections and routes, and reverts the Teams nav item, the team switcher in app-sidebar, the team props in the (app) layout, and the team loader in its +layout.server.ts.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: true,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"teams\", \"pocketbase\", \"velastack\", \"sveltekit\"],\n\n command: {\n raw: \"vela disable teams\",\n base: \"vela disable teams\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, providersToRemove } from \"./generate\";\n\nconst SLUG = \"disable-payments\" as const;\nconst VERSION = \"2.4.0\";\nconst SOURCE = \"src/patterns/disable/payments\";\nconst DOCS = \"/disable/payments\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n // Stripe's collections live in PocketBase; a Shopify project may have none.\n const isStripe = providersToRemove(options).some(\n (provider) => provider.id === \"stripe\",\n );\n const patchCreates =\n isStripe && options.features.backend\n ? await unlinkStripePaymentMethodsCustomer(options)\n : [];\n // The patch's migration is PocketBase's own writing; format it with the rest.\n const finalResult = await formatResult(\n { ...merged, creates: [...merged.creates, ...patchCreates] },\n options,\n );\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(finalResult, options);\n}\n\nasync function unlinkStripePaymentMethodsCustomer(\n options: Options,\n): Promise<File[]> {\n const { withPocketbase } = await import(\"../../../runtime/pocketbase\");\n const { applyCollectionFieldsPatches } =\n await import(\"../../../runtime/collections\");\n const logger = getLogger(options);\n\n let creates: File[] = [];\n await withPocketbase(options.root, async (pb) => {\n let collection;\n try {\n collection = await pb.collections.getOne(\"stripe_payment_methods\");\n } catch (error) {\n if ((error as { status?: number }).status === 404) return;\n throw error;\n }\n\n if (\n !collection.fields.some((f: { name: string }) => f.name === \"customer\")\n ) {\n return;\n }\n\n creates = await applyCollectionFieldsPatches(\n pb,\n [\n {\n collectionName: \"stripe_payment_methods\",\n changes: [{ op: \"remove\", fieldName: \"customer\" }],\n },\n ],\n options,\n logger,\n );\n });\n return creates;\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable payments\",\n summary:\n \"Removes the detected payment provider's files and env credentials. For Stripe it also drops the Stripe collections and reverts the nav/signup edits. Does NOT touch products in the Stripe dashboard or Shopify admin, orders recorded to a hosted VelaStack form, or uninstall the provider's packages.\",\n // Stripe's collections need the backend, which enable-payments already\n // required for Stripe; Shopify and WhatsApp have none to drop.\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n // The cart imports the payments client, so it has to go first. (Subscriptions\n // would belong here too, but there is no feature flag for it yet.)\n // Each imports the Stripe client or the cart; they come out first.\n blockedBy: [\"ecommerce\", \"subscriptions\", \"orders\"],\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"pocketbase\",\n \"velastack\",\n \"checkout\",\n ],\n\n command: {\n raw: \"vela disable payments\",\n base: \"vela disable payments\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { filesFromGlob, languageFromPath } from \"../../../core/util\";\nimport { PROVIDERS } from \"../../enable/ecommerce/generate\";\nimport { SHOP_PATHS } from \"../../destroy/shop\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/ecommerce/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst providersRaw = import.meta.glob<string>(\n [\n \"../../enable/ecommerce/providers/**\",\n \"../../enable/ecommerce/providers-app-mode/**\",\n ],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nexport async function generate(options: Options) {\n // The cart follows the payments provider; with payments already gone,\n // every provider's files are removed, and the missing ones skipped.\n const detected = options.providers?.payments;\n const providers = PROVIDERS.some((provider) => provider.id === detected)\n ? [detected]\n : PROVIDERS.map((provider) => provider.id);\n\n const paths = new Set([\n ...Object.keys(\n filesFromGlob(createsRaw, \"../../enable/ecommerce/creates/\"),\n ),\n ...providers.flatMap((id) => allProviderPaths(providersRaw, id)),\n // The shop pages import the cart, so they go with it (the demo page an\n // older enable-ecommerce wrote shares the listing's paths). The catalog\n // module is the developer's product list and stays; destroy-shop takes it.\n ...SHOP_PATHS.filter((path) => path !== \"src/lib/catalog.ts\"),\n ]);\n\n const deletes: File[] = [...paths].sort().map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\",\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","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-ecommerce\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/disable/ecommerce\";\nconst DOCS = \"/disable/ecommerce\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable ecommerce\",\n summary:\n \"Removes the cart, the checkout pages and the navbar cart button enable-ecommerce added. Payments, and the shadcn components the cart used, stay.\",\n // Its own feature only: requiring payments would strand the cart if payments\n // went first (disable-payments is blocked while the cart exists, but a\n // project may have lost payments another way).\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n ecommerce: true,\n },\n // The order pages and handlers import the cart store.\n blockedBy: [\"orders\"],\n category: \"payments\" as const,\n tags: [\"sveltekit\", \"ecommerce\", \"cart\", \"stripe\", \"shopify\", \"velastack\"],\n\n command: {\n raw: \"vela disable ecommerce\",\n base: \"vela disable ecommerce\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/subscriptions/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/subscriptions/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-subscriptions\" as const;\nconst VERSION = \"1.0.1\";\nconst SOURCE = \"src/patterns/disable/subscriptions\";\nconst DOCS = \"/disable/subscriptions\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable subscriptions\",\n summary:\n \"Drops the stripe_subscriptions collection, reverts billing / layout / nav edits, and removes subscription webhook handlers and sync endpoint. Leaves the payments pattern intact.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // Stripe Billing: Shopify sells subscriptions through its own apps.\n providers: { payments: [\"stripe\"] },\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"subscriptions\",\n \"pocketbase\",\n \"velastack\",\n \"billing\",\n ],\n\n command: {\n raw: \"vela disable subscriptions\",\n base: \"vela disable subscriptions\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob, languageFromPath } from \"../../../core/util\";\n\n// Every variant goes, whatever auth and notifications are now: either may\n// have changed since orders was enabled.\nconst createsRaw = import.meta.glob<string>(\"../../enable/orders/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\nconst createsAppModeRaw = import.meta.glob<string>(\n \"../../enable/orders/creates-app-mode/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\nconst createsNotificationsRaw = import.meta.glob<string>(\n \"../../enable/orders/creates-notifications/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nexport async function generate(_options: Options) {\n const paths = new Set([\n ...Object.keys(filesFromGlob(createsRaw, \"../../enable/orders/creates/\")),\n ...Object.keys(\n filesFromGlob(createsAppModeRaw, \"../../enable/orders/creates-app-mode/\"),\n ),\n ...Object.keys(\n filesFromGlob(\n createsNotificationsRaw,\n \"../../enable/orders/creates-notifications/\",\n ),\n ),\n ]);\n\n return {\n creates: [],\n modifies: [],\n deletes: [...paths].sort().map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n })),\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-orders\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/orders\";\nconst DOCS = \"/disable/orders\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n if (options.input.destructive !== true) {\n return merged;\n }\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable orders\",\n summary:\n \"Removes the order handlers, the orders pages and the orders and order_lines collections enable-orders added, and puts the success page back to Stripe's summary. Payments and the cart stay.\",\n // Nothing required: a project may have lost payments or the cart another\n // way, and the order files should still come out.\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"payments\" as const,\n tags: [\"sveltekit\", \"ecommerce\", \"orders\", \"stripe\", \"velastack\"],\n command: {\n raw: \"vela disable orders\",\n base: \"vela disable orders\",\n argv: [],\n },\n examples: [],\n tests: 0,\n baseline: \"velastack\",\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { languageFromPath } from \"../../../core/util\";\n\n// Every file enable-whatsapp creates, in either form style.\nconst createsRaw = import.meta.glob<string>(\n [\n \"../../enable/whatsapp/creates/**\",\n \"../../enable/whatsapp/creates-superforms/**\",\n \"../../enable/whatsapp/creates-remote/**\",\n ],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst PREFIX = /^\\.\\.\\/\\.\\.\\/enable\\/whatsapp\\/creates(-superforms|-remote)?\\//;\n\nexport async function generate(_options: Options) {\n const paths = new Set(\n Object.keys(createsRaw).map((key) => key.replace(PREFIX, \"\")),\n );\n\n const deletes = Array.from(paths)\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-whatsapp\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/whatsapp\";\nconst DOCS = \"/disable/whatsapp\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n // Turning WhatsApp off in PocketBase and rewriting the pages only happens\n // with consent; without it this lists the files that would go.\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable WhatsApp sign-in\",\n summary:\n \"Takes WhatsApp sign-in off the login and signup pages and turns it off in PocketBase. Keeps the phone fields on users and email optional, since they hold user data.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"auth\", \"whatsapp\", \"sveltekit\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable whatsapp\",\n base: \"vela disable whatsapp\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import packageJson from \"../package.json\";\nimport type { AssertComponentsAvailableOptions } from \"./runtime/write-result\";\nimport type {\n ApplyBaseColorOptions,\n ApplyColorsResult,\n ApplyThemeOptions,\n Component,\n DetectedProviders,\n InstallComponentsOptions,\n InstallComponentsResult,\n ListComponentsOptions,\n ListComponentsResult,\n SwitchStyleOptions,\n SwitchStyleResult,\n WriteResultRuntime,\n} from \"./core/types\";\nimport type { EnvVarSpec } from \"./runtime/env-vars-file\";\nimport type {\n ModifyEnvVarsResult,\n UnmodifyEnvVarsResult,\n} from \"./runtime/env-vars\";\nimport type {\n OverrideValue,\n PackageJsonEditResult,\n} from \"./runtime/package-imports\";\nexport {\n InvalidArgumentError,\n MissingShadcnError,\n RegistryUnavailableError,\n} from \"./core/errors\";\nexport type {\n ApplyBaseColorOptions,\n ApplyColorsResult,\n ApplyThemeOptions,\n Component,\n DetectedProviders,\n ExecuteCommand,\n FeatureFlag,\n ExecuteCommandOptions,\n File,\n InstallComponentsOptions,\n InstallComponentsResult,\n ListComponentsOptions,\n ListComponentsResult,\n ModifyOutcome,\n Options,\n Package,\n Pattern,\n Provider,\n ProviderEnvVar,\n ProviderMarker,\n RegistryItem,\n Requires,\n SwitchStyleOptions,\n SwitchStyleResult,\n WriteResultRuntime,\n} from \"./core/types\";\nexport {\n isLibSpecifier,\n libAliasPath,\n libModule,\n libSpecifier,\n} from \"./runtime/lib-specifier\";\nexport {\n ENV_DECL_CANDIDATES,\n envVarEntry,\n envVarsFile,\n type EnvVarSpec,\n} from \"./runtime/env-vars-file\";\nexport type { ModifyEnvVarsResult, UnmodifyEnvVarsResult };\nexport type { AssertComponentsAvailableOptions };\nexport type { OverrideValue, PackageJsonEditResult };\nexport {\n ADAPTER_NODE,\n ADAPTER_STATIC,\n FLASH,\n FORMSNAP,\n LEGACY_POCKETBASE_TYPES,\n NEGOTIATE,\n POCKETBASE_BIN_ENV,\n POCKETBASE_TYPES,\n SUPERFORMS,\n SUPERFORMS_VERSION,\n VELASTACK_CMS,\n VELASTACK_KIT,\n VELASTACK_POCKETBASE,\n} from \"./core/constants\";\nexport {\n NODE_FLOOR,\n VERSIONS,\n VERSION_HOLDS,\n VERSION_TRACKS,\n spec,\n} from \"./core/versions\";\nexport {\n capabilityName,\n providerEnvVars,\n providerFromArgv,\n providerMarkers,\n resolveProvider,\n unknownProviderMessage,\n} from \"./core/providers\";\nexport { FIELD_SYNTAX_HELP } from \"./parse/syntax\";\nexport { RULES_MODES, type RulesMode } from \"./core/shared\";\nexport {\n blockingFeatures,\n unmetRequirements,\n type RequirementsContext,\n type Unmet,\n} from \"./core/requires\";\nimport generateForm from \"./patterns/generate/form\";\nimport generateFormRemote from \"./patterns/generate/form-remote\";\nimport generateMigration from \"./patterns/generate/migration\";\nimport generateResource from \"./patterns/generate/resource\";\nimport generateScaffold from \"./patterns/generate/scaffold\";\nimport generateScaffoldRemote from \"./patterns/generate/scaffold-remote\";\nimport generateSchema from \"./patterns/generate/schema\";\nimport generateShop from \"./patterns/generate/shop\";\nimport generateWorkflow from \"./patterns/generate/workflow\";\nimport enableAi from \"./patterns/enable/ai\";\nimport enableAnalytics from \"./patterns/enable/analytics\";\nimport enableAuth from \"./patterns/enable/auth\";\nimport enableOg from \"./patterns/enable/og\";\nimport enableAuthRemote from \"./patterns/enable/auth-remote\";\nimport enableApi from \"./patterns/enable/api\";\nimport enableApiKeys from \"./patterns/enable/api-keys\";\nimport enableBackend from \"./patterns/enable/backend\";\nimport enableBlog from \"./patterns/enable/blog\";\nimport enableCms from \"./patterns/enable/cms\";\nimport enableContentNegotiation from \"./patterns/enable/content-negotiation\";\nimport enableI18n from \"./patterns/enable/i18n\";\nimport enableNotifications from \"./patterns/enable/notifications\";\nimport enablePayments from \"./patterns/enable/payments\";\nimport enableEcommerce from \"./patterns/enable/ecommerce\";\nimport enableSubscriptions from \"./patterns/enable/subscriptions\";\nimport enableOrders from \"./patterns/enable/orders\";\nimport enableTeams from \"./patterns/enable/teams\";\nimport enableWhatsapp from \"./patterns/enable/whatsapp\";\nimport enableWorkflows from \"./patterns/enable/workflows\";\nimport destroySchema from \"./patterns/destroy/schema\";\nimport destroyForm from \"./patterns/destroy/form\";\nimport destroyResource from \"./patterns/destroy/resource\";\nimport destroyScaffold from \"./patterns/destroy/scaffold\";\nimport destroyShop from \"./patterns/destroy/shop\";\nimport disableAi from \"./patterns/disable/ai\";\nimport disableAnalytics from \"./patterns/disable/analytics\";\nimport disableOg from \"./patterns/disable/og\";\nimport disableApi from \"./patterns/disable/api\";\nimport disableApiKeys from \"./patterns/disable/api-keys\";\nimport disableAuth from \"./patterns/disable/auth\";\nimport disableBackend from \"./patterns/disable/backend\";\nimport disableContentNegotiation from \"./patterns/disable/content-negotiation\";\nimport disableI18n from \"./patterns/disable/i18n\";\nimport disableNotifications from \"./patterns/disable/notifications\";\nimport disableTeams from \"./patterns/disable/teams\";\nimport disablePayments from \"./patterns/disable/payments\";\nimport disableEcommerce from \"./patterns/disable/ecommerce\";\nimport disableSubscriptions from \"./patterns/disable/subscriptions\";\nimport disableOrders from \"./patterns/disable/orders\";\nimport disableWhatsapp from \"./patterns/disable/whatsapp\";\n\nexport const version = packageJson.version;\n\nexport const patterns = [\n generateForm,\n generateFormRemote,\n generateMigration,\n generateSchema,\n generateWorkflow,\n generateResource,\n generateScaffold,\n generateScaffoldRemote,\n generateShop,\n enableAi,\n enableAnalytics,\n enableOg,\n enableAuth,\n enableAuthRemote,\n enableApi,\n enableApiKeys,\n enableBackend,\n enableBlog,\n enableCms,\n enableContentNegotiation,\n enableI18n,\n enableNotifications,\n enablePayments,\n enableEcommerce,\n enableSubscriptions,\n enableOrders,\n enableTeams,\n enableWhatsapp,\n enableWorkflows,\n destroySchema,\n destroyForm,\n destroyResource,\n destroyScaffold,\n destroyShop,\n disableAi,\n disableAnalytics,\n disableOg,\n disableApi,\n disableApiKeys,\n disableAuth,\n disableBackend,\n disableContentNegotiation,\n disableI18n,\n disableNotifications,\n disableTeams,\n disablePayments,\n disableEcommerce,\n disableSubscriptions,\n disableOrders,\n disableWhatsapp,\n];\n\ntype PatternEntry = (typeof patterns)[number];\n\nexport type Slug = PatternEntry[\"slug\"];\nexport type Category = PatternEntry[\"category\"];\n\nexport const bySlug = Object.fromEntries(\n patterns.map((pattern) => [pattern.slug, pattern]),\n) as Record<Slug, PatternEntry>;\n\nexport const byCategory = patterns.reduce(\n (acc, pattern) => {\n const category = pattern.category;\n acc[category] ??= [];\n acc[category].push(pattern);\n return acc;\n },\n {} as Record<Category, PatternEntry[]>,\n);\n\n/**\n * Installs shadcn-svelte items and the components this package ships\n * (`data-table`, `multiselect`, `geopoint`, ...) into a project, pulling in\n * the shadcn and npm dependencies they need. Node-only: the runtime is loaded\n * on the first call so this entry stays importable in the browser preview.\n */\nexport async function installComponents(\n options: InstallComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<InstallComponentsResult> {\n const { installComponents: run } = await import(\"./runtime/write-result\");\n return run(options, runtime);\n}\n\n/**\n * The preflight for `installComponents`: throws what it would throw for these\n * components (`MissingShadcnError`, or `InvalidArgumentError` for a name the\n * style's registry does not list) and changes nothing. For a caller with side\n * effects of its own ahead of the install; a pattern that lists components\n * and creates collections runs it first. A registry that cannot be read is not an error\n * here: the names go unchecked and the install reports it. Node-only, loaded\n * on first call like `installComponents`.\n */\nexport async function assertComponentsAvailable(\n root: string,\n components: Component[],\n options: AssertComponentsAvailableOptions = {},\n runtime?: WriteResultRuntime,\n): Promise<void> {\n const { assertComponentsAvailable: run } =\n await import(\"./runtime/write-result\");\n return run(root, components, options, runtime);\n}\n\n/**\n * What a project has installed, what this package can copy in, and what the\n * configured style's registry offers. Node-only, loaded on first call like\n * `installComponents`.\n */\nexport async function listComponents(\n options: ListComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<ListComponentsResult> {\n const { listComponents: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/** Moves a project to another shadcn-svelte style, re-adding its registry components. */\nexport async function switchStyle(\n options: SwitchStyleOptions,\n runtime?: WriteResultRuntime,\n): Promise<SwitchStyleResult> {\n const { switchStyle: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/** Sets the base palette through `shadcn-svelte apply`. */\nexport async function applyBaseColor(\n options: ApplyBaseColorOptions,\n runtime?: WriteResultRuntime,\n): Promise<ApplyColorsResult> {\n const { applyBaseColor: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/** Sets the accent color through `shadcn-svelte apply`, keeping the base palette. */\nexport async function applyTheme(\n options: ApplyThemeOptions,\n runtime?: WriteResultRuntime,\n): Promise<ApplyColorsResult> {\n const { applyTheme: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/**\n * The provider in use for each capability (`{ payments: \"stripe\" }`), read\n * from what each registered provider leaves in the project. Node-only, loaded\n * on first call like `installComponents`.\n */\nexport async function detectProviders(\n root: string,\n): Promise<DetectedProviders> {\n const { detectProviders: run } = await import(\"./runtime/providers\");\n return run(root, patterns);\n}\n\n/*\n * Project-file editors the CLI's `bless` and `migrate sveltekit-3` share with\n * the patterns. Node-only, so each loads its module on first call (like\n * `installComponents`) and the entry stays importable in the browser\n * preview; the module functions themselves are synchronous.\n */\n\n/**\n * Declare `specs` in `src/env.ts` (or `src/env.js`); existing entries are\n * never touched. Without a declaration file, `create` holds a new\n * `src/env.ts` for the caller to write. An edited file is saved in place and\n * reported in `modify`; one that can't be edited safely fails with the\n * entries to paste.\n */\nexport async function modifyEnvVars(\n root: string,\n specs: EnvVarSpec[],\n): Promise<ModifyEnvVarsResult> {\n const { modifyEnvVars: run } = await import(\"./runtime/env-vars\");\n return run(root, specs);\n}\n\n/**\n * Remove the declarations of `names` from `src/env.ts`. `deleted` means only\n * the import and an empty `variables` are left (the emptied file is saved;\n * delete it).\n */\nexport async function unmodifyEnvVars(\n root: string,\n names: string[],\n): Promise<UnmodifyEnvVarsResult> {\n const { unmodifyEnvVars: run } = await import(\"./runtime/env-vars\");\n return run(root, names);\n}\n\n/** Add missing package.json `imports` entries; never overwrites a different value. */\nexport async function ensurePackageImports(\n root: string,\n entries: Record<string, string>,\n): Promise<PackageJsonEditResult> {\n const { ensurePackageImports: run } =\n await import(\"./runtime/package-imports\");\n return run(root, entries);\n}\n\n/**\n * Remove package.json `imports` keys (only those still equal to `expected`,\n * when given), dropping an `imports` left empty.\n */\nexport async function removePackageImports(\n root: string,\n keys: string[],\n expected?: Record<string, string>,\n): Promise<PackageJsonEditResult> {\n const { removePackageImports: run } =\n await import(\"./runtime/package-imports\");\n return run(root, keys, expected);\n}\n\n/** Deep-merge package.json `overrides`; never overwrites a different version. */\nexport async function ensurePackageOverrides(\n root: string,\n overrides: Record<string, OverrideValue>,\n): Promise<PackageJsonEditResult> {\n const { ensurePackageOverrides: run } =\n await import(\"./runtime/package-imports\");\n return run(root, overrides);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAgB25C,GACd,GACA,GACe;CACf,QAAQC,EAAQ,aAAa,CAAC,EAAA,CAAG,QAAQ,MAASC,EAASC,OAAU,EAAI;AAC3E;AAsCA,SAAgBC,GACd,GACA,GACS;CACT,IAAM,EAAE,aAAU,gBAAaC,GACzBC,IACJD,E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GACH,MAAU,MACR,+CAA+Cle,EAAe,EAChE;CAEF,OAAO;EACL,UAAUke,EAAE;EACZ,UAAUA,EAAE;EACZ,YAAYA,EAAE;EACd,YAAYA,EAAE;EACd,YAAYA,EAAE;CAChB;AACF;AAMA,IAAa6I,KAA8C;CACzD;EACE,MAAM;EACN,MAAM;EACN,GAAGD,GAAS,OAAO;EACnB,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,qBAAqB;IACrB,KAAK;IACL,KAAK;IACL,SAAS;IACT,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,eAAe;IACf,cAAclvB;IACd,WAAW;IACX,WAAW;IACX,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,UAAU;IACV,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,UAAU;IACV,UAAU;GACZ;EACF;CACF;CACA;EACE,MAAM;EACN,MAAM;EACN,GAAGkvB,GAAS,kBAAkB;EAC9B,QAAQ;GACN;IACE,MAAM;IACN,qBAAqB;IACrB,KAAK;IACL,KAAK;IACL,SAAS;IACT,YAAY;IACZ,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAcF;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAchvB;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,WAAW;IACX,UAAU;IACV,MAAM;IACN,QAAQ;KAAC;KAAS;KAAS;IAAQ;GACrC;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;EACF;CACF;CACA;EACE,MAAM;EACN,MAAM;EACN,GAAGkvB,GAAS,YAAY;EACxB,WACE;EACF,QAAQ;GACN;IACE,MAAM;IACN,SAAS;IACT,YAAY;IACZ,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,aAAa;IAEb,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,KAAK;IACL,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAcD;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAcD;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,WAAW;IACX,UAAU;IACV,MAAM;IACN,QAAQ;KAAC;KAAS;KAAS;IAAQ;GACrC;EACF;CACF;CACA;EACE,MAAM;EACN,MAAM;EACN,GAAGE,GAAS,cAAc;EAC1B,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,qBAAqB;IACrB,KAAK;IACL,KAAK;IACL,SAAS;IACT,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,eAAe;IACf,cAAcF;IACd,WAAW;IACX,WAAW;IACX,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,UAAU;GACZ;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;EACF;CACF;CACA;EACE,MAAM;EACN,MAAM;EACN,GAAGE,GAAS,mBAAmB;EAC/B,SAAS,CACP,sEACF;EACA,QAAQ;GACN;IACE,MAAM;IACN,qBAAqB;IACrB,KAAK;IACL,KAAK;IACL,SAAS;IACT,YAAY;IACZ,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAcF;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,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a,GACpB,GACA,GAC8B;CAC9B,IAAM,EAAE,eAAehnB,MAAQ,MAAM,OAAO;CAC5C,OAAOA,EAAI0mB,GAAMO,CAAK;AACxB;AAOA,eAAsBC,GACpB,GACA,GACgC;CAChC,IAAM,EAAE,iBAAiBlnB,MAAQ,MAAM,OAAO;CAC9C,OAAOA,EAAI0mB,GAAMpsB,CAAK;AACxB;AAGA,eAAsB6sB,GACpB,GACA,GACgC;CAChC,IAAM,EAAE,sBAAsBnnB,MAC5B,MAAM,OAAO,uCAAA,CAAA,MAAA,MAAAzS,EAAA,CAAA;CACf,OAAOyS,EAAI0mB,GAAMU,CAAO;AAC1B;AAMA,eAAsBC,GACpB,GACA,GACA,GACgC;CAChC,IAAM,EAAE,sBAAsBrnB,MAC5B,MAAM,OAAO,uCAAA,CAAA,MAAA,MAAAzS,EAAA,CAAA;CACf,OAAOyS,EAAI0mB,GAAMY,GAAMC,CAAQ;AACjC;AAGA,eAAsBC,GACpB,GACA,GACgC;CAChC,IAAM,EAAE,wBAAwBxnB,MAC9B,MAAM,OAAO,uCAAA,CAAA,MAAA,MAAAzS,EAAA,CAAA;CACf,OAAOyS,EAAI0mB,GAAMjrB,CAAS;AAC5B"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["exhaustiveType","changeCase.kebabCase","exhaustiveType","_templateObject","_templateObject2","parsePatternArgs","hasFiles","findInjectables","injectableHiddenInputs","pbInstance","pageImports","pageSnippet","plainPageSnippet","toFile","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","_templateObject","_templateObject2","parsePatternArgs","hasFiles","findInjectables","pbInstance","toFile","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","parsePatternArgs","pluralize","SLUG","VERSION","SOURCE","DOCS","generate","parsePatternArgs","toFile","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","exhaustiveType","_templateObject","_templateObject2","propsLine","_templateObject","_templateObject2","_templateObject3","parsePatternArgs","toFile","hasFiles","selectLabelMaps","pbInstance","scaffoldNotes","findInjectables","newHiddenInputs","editHiddenInputs","propsLine","newPageSnippet","editPageSnippet","listServerSnippet","newServerSnippet","showServerSnippet","showPageSnippet","editServerSnippet","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","_templateObject","_templateObject2","parsePatternArgs","toFile","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","toFile","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","PROVIDERS","META","providersRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","PROVIDERS","META","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generate","META","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","PROVIDERS","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","META","envEditsFor","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","PROVIDERS","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","variantsRaw","__import_glob__1_0_","__import_glob__1_1_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","filesFromGlob","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","__import_glob__0_56_","__import_glob__0_57_","__import_glob__0_58_","__import_glob__0_59_","__import_glob__0_60_","__import_glob__0_61_","__import_glob__0_62_","__import_glob__0_63_","__import_glob__0_64_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__1_0_","CREATES_PREFIX","filesFromGlob","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","createsWithBlogRaw","__import_glob__1_0_","CREATES_PREFIX","CREATES_WITH_BLOG_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__1_0_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","users","rulesFor","previewRaw","__import_glob__0_0_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","generate","META","envEditsFor","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","PROVIDERS","createsRaw","__import_glob__0_0_","providersRaw","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__1_5_","__import_glob__1_6_","__import_glob__1_7_","__import_glob__1_8_","__import_glob__1_9_","__import_glob__1_10_","__import_glob__1_11_","__import_glob__1_12_","__import_glob__1_13_","__import_glob__1_14_","__import_glob__2_0_","generate","filesFromGlob","previewRaw","__import_glob__0_0_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","CREATES_PREFIX","generate","previewRaw","__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_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","CREATES_PREFIX","generate","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","PREVIEW_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__2_0_","__import_glob__2_1_","__import_glob__2_2_","__import_glob__2_3_","__import_glob__2_4_","generate","filesFromGlob","previewRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","__import_glob__0_5_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","createsRaw","__import_glob__0_0_","__import_glob__0_1_","CREATES_PREFIX","generate","__import_glob__0_0_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generatePreview","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","SLUG","VERSION","SOURCE","DOCS","generate","SLUG","VERSION","SOURCE","DOCS","generate","SLUG","VERSION","SOURCE","DOCS","generate","SLUG","VERSION","SOURCE","DOCS","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_4_","__import_glob__0_5_","__import_glob__0_6_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_18_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_23_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","__import_glob__0_42_","__import_glob__0_43_","__import_glob__0_44_","__import_glob__0_45_","__import_glob__0_46_","__import_glob__0_47_","__import_glob__0_48_","__import_glob__0_49_","__import_glob__0_50_","__import_glob__0_51_","__import_glob__0_52_","__import_glob__0_53_","__import_glob__0_54_","__import_glob__0_55_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__1_5_","__import_glob__1_6_","__import_glob__1_7_","__import_glob__1_8_","__import_glob__1_9_","__import_glob__1_10_","__import_glob__1_11_","__import_glob__1_12_","__import_glob__1_13_","__import_glob__1_14_","__import_glob__1_15_","__import_glob__1_16_","__import_glob__1_18_","__import_glob__1_19_","__import_glob__1_20_","__import_glob__1_21_","__import_glob__1_22_","__import_glob__1_23_","__import_glob__1_24_","__import_glob__1_25_","__import_glob__1_26_","__import_glob__1_27_","__import_glob__1_28_","__import_glob__1_29_","__import_glob__1_30_","__import_glob__1_31_","__import_glob__1_32_","__import_glob__1_33_","__import_glob__1_34_","__import_glob__1_35_","__import_glob__1_36_","__import_glob__1_37_","__import_glob__1_38_","__import_glob__1_39_","__import_glob__1_40_","__import_glob__1_41_","__import_glob__1_42_","__import_glob__1_43_","__import_glob__1_44_","__import_glob__1_45_","__import_glob__1_46_","__import_glob__1_47_","__import_glob__1_48_","__import_glob__1_49_","__import_glob__1_50_","__import_glob__1_51_","__import_glob__1_52_","__import_glob__1_53_","__import_glob__1_54_","__import_glob__1_55_","__import_glob__1_56_","__import_glob__1_57_","__import_glob__1_58_","__import_glob__1_59_","__import_glob__1_60_","__import_glob__1_61_","__import_glob__1_62_","__import_glob__1_63_","__import_glob__1_64_","__import_glob__2_0_","__import_glob__2_1_","__import_glob__2_2_","__import_glob__2_3_","__import_glob__2_4_","__import_glob__2_5_","__import_glob__2_6_","__import_glob__2_7_","__import_glob__2_8_","__import_glob__2_9_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__1_0_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","__import_glob__0_10_","__import_glob__0_11_","__import_glob__0_12_","__import_glob__0_13_","__import_glob__0_14_","__import_glob__0_15_","__import_glob__0_16_","__import_glob__0_17_","__import_glob__0_19_","__import_glob__0_20_","__import_glob__0_21_","__import_glob__0_22_","__import_glob__0_24_","__import_glob__0_25_","__import_glob__0_26_","__import_glob__0_27_","__import_glob__0_28_","__import_glob__0_29_","__import_glob__0_30_","__import_glob__0_31_","__import_glob__0_32_","__import_glob__0_33_","__import_glob__0_34_","__import_glob__0_35_","__import_glob__0_36_","__import_glob__0_37_","__import_glob__0_38_","__import_glob__0_39_","__import_glob__0_40_","__import_glob__0_41_","CREATES_PREFIX","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__1_5_","__import_glob__1_6_","__import_glob__1_7_","__import_glob__1_8_","__import_glob__1_9_","__import_glob__1_10_","__import_glob__1_11_","__import_glob__1_12_","__import_glob__1_13_","__import_glob__1_14_","__import_glob__1_15_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__0_4_","generate","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","createsRaw","__import_glob__0_0_","__import_glob__0_1_","__import_glob__0_2_","__import_glob__0_3_","__import_glob__1_0_","__import_glob__1_1_","__import_glob__1_2_","__import_glob__1_3_","__import_glob__1_4_","__import_glob__2_0_","generate","filesFromGlob","SLUG","VERSION","SOURCE","DOCS","generate","generateBase","__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_","__import_glob__0_7_","__import_glob__0_8_","__import_glob__0_9_","generate","generateBase","packageJson","generateForm","generateFormRemote","generateMigration","generateSchema","generateWorkflow","generateResource","generateScaffold","generateScaffoldRemote","generateShop","enableAi","enableAnalytics","enableOg","enableAuth","enableAuthRemote","enableApi","enableApiKeys","enableBackend","enableBlog","enableCms","enableContentNegotiation","enableI18n","enableNotifications","enablePayments","enableEcommerce","enableSubscriptions","enableOrders","enableTeams","enableWhatsapp","enableWorkflows","destroySchema","destroyForm","destroyResource","destroyScaffold","destroyShop","disableAi","disableAnalytics","disableOg","disableApi","disableApiKeys","disableAuth","disableBackend","disableContentNegotiation","disableI18n","disableNotifications","disableTeams","disablePayments","disableEcommerce","disableSubscriptions","disableOrders","disableWhatsapp","__toESM","MissingShadcnError","RegistryUnavailableError","InvalidArgumentError","libAliasPath","libModule","isLibSpecifier","envVarsFile","envVarEntry","ENV_DECL_CANDIDATES","WUCHALE_SVELTE","VERSION_HOLDS","VERSIONS","VERSION_TRACKS","WUCHALE","NODE_FLOOR","FLASH","VELASTACK_POCKETBASE","POCKETBASE_TYPES","PUBLIC_DIR","TANSTACK_TABLE_CORE","TAKUMI","spec","NEGOTIATE","SUPERFORMS_VERSION","ADAPTER_STATIC","FORMSNAP","SUPERFORMS","LEGACY_POCKETBASE_TYPES","ADAPTER_NODE","POCKETBASE_BIN_ENV","VELASTACK_CMS","ZOD","VELASTACK_KIT","providerEnvVars","resolveProvider","capabilityName","providerFromArgv","providerCreates","providerMarkers","allProviderPaths","unknownProviderMessage","validateModelName","relationExpandParam","resolveInputFields","toCollectionFieldSpec","parseModel","resolveFields","loadCollections","rulesModeForCreate","uniqueRelationCollections","collectionSpecFromModelFields","relationLoadLines","uniqueIndexes","generateSchemaSnippet","relationLoadReturnVars","RULES_MODES","rulesNotes","require_pluralize","FIELD_SYNTAX_HELP","formatResult","dedent","languageFromPath","filesUnderPrefix","composeCreates","mergeResults","filesFromGlob$2","withNotes","appRelativePath","scaffoldUrls","kebabCase","scaffoldFilePaths","isProtectedRoute","parseRoute","resolveUi","_taggedTemplateLiteral","getLogger","generate$109","PROVIDERS$2","META$2","envEditsFor","generate$110","PROVIDERS$3","envEditsFor$1","META$3","_page_default$62","_page_server_default$21","server_test_default$28","_page_server_default$26","_page_default$67","_page_server_default$24","server_test_default$30","server_test_default$22","_page_server_default$33","server_test_default$21","_page_default$71","_page_server_default$27","server_test_default$27","server_test_default$19","_page_default$65","_page_default$48","server_test_default$25","_server_default$2","_server_default$4","_server_default$3","_page_default$64","_page_default$47","_page_server_default$30","_page_server_default$23","server_test_default$26","server_test_default$18","_page_default$70","_page_default$53","_page_default$69","_page_default$52","server_test_default$29","_page_default$55","_page_server_default$32","_page_server_default$25","server_test_default$24","_page_default$44","form_remote_default$4","_page_default$51","_page_server_default$34","_page_server_default$28","_page_default$72","_page_default$56","form_remote_default$3","server_test_default$16","_page_server_default$31","server_test_default$17","_page_default$66","_page_default$49","_page_server_default$29","_page_server_default$22","_page_default$63","_page_default$46","_layout_server_default$10","_page_default$45","_page_server_default$35","nav_user_default$2","_page_default$61","signup_default$2","user_default","reset_default$1","_page_default$74","_page_default$59","next_url_default","reset_default","login_default$1","_page_default$77","login_default","changePassword_default$1","_layout_server_default$8","_layout_default$10","_page_server_default$36","changeEmail_default$1","_page_default$75","user_avatar_default","app_sidebar_default$2","_page_default$76","changeEmail_default","nav_main_default$1","_page_server_default$37","_layout_server_default$7","signup_default$1","form_remote_default$5","server_test_default$20","_server_default$5","_page_default$54","form_remote_default$9","profile_default","confirmReset_default$1","form_remote_default$8","changePassword_default","nav_user_default$3","_page_server_default$38","_page_default$43","user_default$1","login_default$2","welcome_default","profile_default$1","server_test_default$32","confirmEmailChange_default","user_avatar_default$1","form_remote_default$2","server_test_default$15","_page_default$79","_layout_default$9","welcome_default$1","server_test_default$33","signup_default","otp_default$1","_page_default$80","server_test_default$14","_layout_server_default$9","_page_default$78","otp_default","confirmEmailChange_default$1","server_test_default$31","nav_main_default","_page_default$60","form_remote_default$6","_page_default$57","_page_default$73","_page_default$58","form_remote_default$7","app_sidebar_default$1","server_test_default$23","_page_default$68","_page_default$50","BACKEND_ENV_VARS","generate$111","NOTIFICATION_RULE_PATCHES","envEditsFor$2","PROVIDERS$4","generate$112","META$4","buyPageSnippet","PAYMENTS_BASE_COLLECTIONS","PAYMENTS_APP_MODE_COLLECTIONS","siteModule","_page_default$83","_page_server_default$40","completed_default","async_payment_default","shared_default$2","shared_default$1","_page_server_default$39","generate$113","_page_server_default$41","_page_default$81","completed_default$1","_page_default$82","server_test_default$34","_layout_server_default$11","_layout_default$11","_page_default$84","nav_user_default$4","_page_server_default$42","app_sidebar_default$3","dispatch_default$1","_page_server_default$43","_page_default$85","teamInviteFields","TEAM_MEMBERSHIPS_INDEX","TEAM_RULE_PATCHES","TEAM_INVITES_INDEX","WORKFLOWS_ENV_VARS","toDeleteEntry","planDropsForCollections","generate$114","generate$115","providersToRemove","generate$116","package_default","\"private\"","\"type\"","\"url\"","\"node\"","\"build\"","\"dev\"","\"clean\"","\"demo\"","\"format\"","\"lint\"","\"test\"","\"prepare\"","\"prettier\"","\"pocketbase\"","\"stripe\"","\"svelte\"","\"optional\"","\"dedent\"","\"pluralize\"","\"semver\"","\"typescript\"","\"vite\"","\"vitest\"","blockingFeatures","pattern","features","flag","unmetRequirements","context","providerId","detected","provider","candidate","requires","mergeRequires","unmet","missingFeatures","key","value","wanted","entry","reported","capability","want","have","referenced","extra","merged","FIELD_COMPONENTS","FIELD_IMPORTS","fieldValueBinding","field","renderInputProps","renderLabel","renderInputField","required","type","renderTextareaField","renderBoolField","renderGeoPointField","renderFileField","fileMode","renderSelectField","multiType","placeholder","options","option","renderRelationField","searchPlaceholder","emptyText","modelName","listName","renderAutodateField","renderField","selectFieldLabelMap","labels","getFieldComponents","components","fields","getFieldImports","component","displayDataPath","model","renderDisplaySimple","valueExpression","renderDisplayDateField","dataPath","dateLine","body","renderDisplayUrlField","anchor","renderDisplaySelectField","badge","renderDisplayFileField","relationListUrl","renderDisplayRelationField","relationPath","listUrl","renderDisplayGeoPointField","content","renderDisplayField","SHADCN_STYLE","layout","NATIVE_STYLE","binding","isMultiple","on","attr","REMOTE_INPUT_TYPES","remoteFormSupports","isWriteOnly","remoteBinding","as","formVar","tail","kind","asType","htmlType","multiple","errorAttrs","remoteSeedExpression","record","superformsErrors","CONSTRAINED","usesConstraints","superformsBinding","errors","aria","plainRenderer","label","htmlFor","style","input","textarea","tag","control","element","checkbox","select","relation","file","autodate","geoPoint","point","geoPointState","REMOTE_FIELD_COMPONENTS","REMOTE_FIELD_IMPORTS","getRemoteFieldComponents","getRemoteFieldImports","renderRemoteField","REQUIRE_USER_IMPORT","requireUserLines","guard","usesUser","GENERATED_DATE","RawExpression","expression","fixtureToCode","fixtureObjectToCode","data","fieldTypeFromCollectionField","rawType","relationUrl","url","idExpression","testizeUrl","dynamicParams","name","match","dynamicParamsTodo","mockValueForField","suffix","relationId","relationIdsByCollectionId","fixtureDataFromFields","fixtureDataFromCollectionFields","firstValue","ensureAuthCollectionFixture","orderedDependencyCollections","collection","byId","collections","visited","visiting","ordered","walk","collectionId","uniqueVarName","used","base","index","fallbackCollectionFromFields","relationDependencyContext","dependencies","users","dependencyVars","usedVarNames","dependency","varName","declarations","setupLines","payload","cleanupLines","requestAgent","authSetup","hasBeforeEach","hasAfterEach","setupSection","generateScaffoldServerTestSnippet","list","urls","newUrl","show","edit","todo","vitestImport","modelFormData","modelDbData","generateScaffoldRemoteServerTestSnippet","generateFormServerTestSnippet","formUrl","generateFormRemoteServerTestSnippet","_templateObject$5","_templateObject2$5","parsePatternArgs$6","modelPath","argv","hasFiles$3","findInjectables$3","injectableHiddenInputs$1","sentinels","injectables","pbInstance$3","relationLoad","vars","pb","pageImports$1","imports","pageScriptSnippet","labelMaps","pageSnippet$1","scriptSnippet","fieldSnippet","hiddenInputs","enctype","plainPageSnippet$1","renderer","stores","flash","status","genericServerSnippet","withFiles","relations","success","createServerSnippet","injections","authMode","currentUserField","currentTeamField","createPayload","toFile$6","path","generate$108","fieldDefs","route","ui","serverTests","createMode","shouldCreateCollection","uiFields","serverContent","SLUG$49","VERSION$49","SOURCE$49","DOCS$49","generate$107","baseRes","n","writeResult","form_default$1","_templateObject$4","_templateObject2$4","parsePatternArgs$5","hasFiles$2","submitFormIdentifier","findInjectables$2","injectableHiddenInputs","pbInstance$2","pageImports","pageSnippet","plainPageSnippet","genericRemoteSnippet","createRemoteSnippet","toFile$5","generate$106","remoteContent","creates","previewRaw$20","PREVIEW_PREFIX$16","generate$105","a","b","SLUG$48","VERSION$48","SOURCE$48","DOCS$48","generate$104","previewRes","remote","modifySvelteConfigRemote","svelteConfigFile","modifyOutcomeToFile","runtimeRes","form_remote_default$1","import_pluralize","VALID_OPS","parsePatternArgs$4","collectionName","op","rest","resolveMigration","c","parent","existingNames","f","changes","indexes","added","referencesFieldDef","requireNonEmpty","fieldNames","fieldName","from","to","ref","message","SLUG$47","VERSION$47","SOURCE$47","DOCS$47","generate$103","migration","logger","migrationCreates","withPocketbase","applyCollectionFieldsPatches","schemaFile","modifySchemaForMigration","migration_default","parsePatternArgs$3","toFile$4","generate$102","rules","auth","SLUG$46","VERSION$46","SOURCE$46","DOCS$46","generate$101","createCollections","resource_default$1","renderPlainValue","expanded","href","filename","DYNAMIC_PARAM_RE","interpolateParams","template","paramSource","urlJsExpr","urlJsExprWithSuffix","urlSvelteAttrValue","svelteSuffix","jsSuffix","_templateObject$3","_templateObject2$3","selectFields","propsLine$2","searchField","filterFnName","search","cellSnippet","listPageSnippet","selects","hasFilters","filterFns","newHref","rowPath","columnDefs","filterFn","tableCoreImports","facetingSlots","filterFnsSlot","searchInput","facets","toolbar","plainListPageSnippet","recordHref","headers","cells","_templateObject$2","_templateObject2$2","_templateObject3$1","_templateObject4","_templateObject5","parsePatternArgs$2","toFile$3","hasFiles$1","uniqueImports","selectLabelMaps$1","pbInstance$1","scaffoldNotes$1","findInjectables$1","newHiddenInputs$1","editHiddenInputs$1","propsLine$1","withParams","formScript","includeParams","newPageSnippet$1","fieldContent","listHref","editPageSnippet$1","cancelHref","listServerSnippet$1","expand","getFullListArgs","newServerSnippet$1","relationLoads","relationVars","relationReturn","showServerSnippet$1","getOneArgs","showPageSnippet$1","hasSelectFields","hasRelationFields","hasFileFields","displays","editHref","plainFormPageSnippet","plainNewPageSnippet","plainEditPageSnippet","plainShowPageSnippet","details","editServerSnippet$1","preservations","updatePayload","generate$100","paths","pages","SLUG$45","VERSION$45","SOURCE$45","DOCS$45","generate$99","assertTableCoreV9","assertRegistryPagination","assertComponentsAvailable","scaffold_default$1","_templateObject$1","_templateObject2$1","_templateObject3","parsePatternArgs$1","toFile$2","hasFiles","selectLabelMaps","pbInstance","scaffoldNotes","createFormIdentifier","updateFormIdentifier","hasRelations","findInjectables","newHiddenInputs","editHiddenInputs","propsLine","names","withData","newPageSnippet","editSeedSnippet","seeds","comment","editPageSnippet","seed","listServerSnippet","newServerSnippet","newRemoteSnippet","showServerSnippet","showPageSnippet","editServerSnippet","editRemoteSnippet","rendered","writeOnly","bools","jsons","overrides","preserved","taken","existing","update","optionalOnEdit","updateSchema","schemaDeclaration","schema","generate$98","newServerContent","previewRaw$19","PREVIEW_PREFIX$15","generate$97","SLUG$44","VERSION$44","SOURCE$44","DOCS$44","generate$96","scaffold_remote_default","parsePatternArgs","toFile$1","generate$95","SLUG$43","VERSION$43","SOURCE$43","DOCS$43","generate$94","schema_default$1","_page_default$42","_page_default$41","_page_default$40","_page_default$39","_page_server_default$20","_page_default$38","_page_server_default$19","_page_default$37","catalog_default","_page_default$36","_page_default$35","_page_default$34","_page_default$33","_page_default$32","_page_default$31","PROVIDERS$1","META$1","providersRaw$2","providersCmsRaw","shopFiles","files","cms","generate$93","SLUG$42","VERSION$42","SOURCE$42","DOCS$42","generate$92","shop_default$1","NAME_RE","CRON_RE","toKebabCase","toCamelCase","kebab","parseWorkflowArgs","raw","cron","arg","workflowSnippet","exportName","cronWorkflowSnippet","testSnippet","run","toFile","generate$91","args","dir","SLUG$41","VERSION$41","SOURCE$41","DOCS$41","generate$90","workflow_default","generate$89","envLines","SLUG$40","VERSION$40","SOURCE$40","DOCS$40","generate$88","generateRuntime","ai_default$1","previewRaw$18","PREVIEW_PREFIX$14","generate$87","modifies","SLUG$39","VERSION$39","SOURCE$39","DOCS$39","generate$86","analytics_default$1","createsRaw$25","confirmReset_default","variantsRaw$1","CREATES_PREFIX$20","generate$85","variant","previewRaw$17","PREVIEW_PREFIX$13","generate$84","SLUG$38","VERSION$38","SOURCE$38","DOCS$38","generate$83","writtenBase","writtenRuntime","auth_default$1","createsRaw$24","CREATES_PREFIX$19","createdPaths","generate$82","previewRaw$16","PREVIEW_PREFIX$12","generate$81","SLUG$37","VERSION$37","SOURCE$37","DOCS$37","generate$80","og_default$1","createsRaw$23","CREATES_PREFIX$18","generate$79","previewRaw$15","PREVIEW_PREFIX$11","generate$78","SLUG$36","VERSION$36","SOURCE$36","DOCS$36","generate$77","written","localized","localizeAuthPages","writtenLocalized","auth_remote_default","server_test_default$13","createsRaw$22","CREATES_PREFIX$17","generate$76","previewRaw$14","PREVIEW_PREFIX$10","generate$75","SLUG$35","VERSION$35","SOURCE$35","DOCS$35","generate$74","api_default$1","apiKey_default","_layout_server_default$4","_layout_default$6","_page_default$30","_page_server_default$18","_page_server_default$17","_page_default$29","_page_default$28","create_api_key_default","server_test_default$12","server_test_default$11","createsRaw$21","CREATES_PREFIX$16","apiKeysCollection","generate$73","previewRaw$13","PREVIEW_PREFIX$9","generate$72","SLUG$34","VERSION$34","SOURCE$34","DOCS$34","generate$71","api_keys_default$1","README_default$3","README_default$2","README_default$1","hooks_server_default$3","createsRaw$20","CREATES_PREFIX$15","generate$70","previewRaw$12","PREVIEW_PREFIX$8","generate$69","SLUG$33","VERSION$33","SOURCE$33","DOCS$33","generate$68","keepMissing","backend_default$1","twinkleplop_vsc_dark_plus_default","AuthorChip_default","PostCard_default","design_system_notes_default","getting_started_with_sveltekit_default","performance_checklist_default","welcome_to_the_blog_default","why_we_chose_tailwind_v4_default","writing_posts_with_mdsvex_default","content_default","date_default","_layout_default$5","_page_default$27","_page_default$26","_page_default$25","_page_default$24","_server_default","_page_default$23","_page_default$22","_page_default$21","_page_default$20","_page_server_default$16","createsRaw$19","createsWithNegotiationRaw","CREATES_PREFIX$14","CREATES_WITH_NEGOTIATION_PREFIX","filesFromGlob$1","prefix","generate$67","withNegotiation","previewRaw$11","PREVIEW_PREFIX$7","generate$66","SLUG$32","VERSION$32","SOURCE$32","DOCS$32","generate$65","blog_default","previewRaw$10","PREVIEW_PREFIX$6","generate$64","SLUG$31","VERSION$31","SOURCE$31","DOCS$31","generate$63","cms_default","negotiate_default","_page_server_default$15","_page_default$19","_page_default$18","_page_server_default$14","createsRaw$18","createsWithBlogRaw$1","CREATES_PREFIX$13","CREATES_WITH_BLOG_PREFIX$1","STORED_PUBLIC_DIR","inPublicGroup","routeGroups","filePath","META_TAGS_LOADER","filesFromGlob","generate$62","withBlog","metaTags","previewRaw$9","PREVIEW_PREFIX$5","generate$61","SLUG$30","VERSION$30","SOURCE$30","DOCS$30","generate$60","content_negotiation_default$1","language_select_default$1","locale_default","url_default","wuchale_config_default","language_select_default","createsRaw$17","variantsRaw","CREATES_PREFIX$12","generate$59","previewRaw$8","PREVIEW_PREFIX$4","generate$58","SLUG$29","VERSION$29","SOURCE$29","DOCS$29","generate$57","withLibraryTexts","i18n_default$1","notifications_bell_default","notifications_default$2","_page_server_default$13","_page_default$17","createsRaw$16","CREATES_PREFIX$11","generate$56","utils_default","users$1","rulesFor$1","p","x","NOTIFICATIONS_PREVIEW_COLLECTIONS","previewRaw$7","PREVIEW_PREFIX$3","generate$55","SLUG$28","VERSION$28","SOURCE$28","DOCS$28","generate$54","notifications_default$1","env_default$2","env_default$1","nav_user_default$1","_page_server_default$12","env_default","_templateObject","_templateObject2","previewRaw$6","PREVIEW_PRICE_ID","PREVIEW_VARIANT_ID","orderPageSnippet","paymentPageSnippet","priceId","generate$53","isStripe","isAppMode","paymentPage","SLUG$27","VERSION$27","SOURCE$27","DOCS$27","generate$52","hasVitest","payments_default$1","cart_button_default","cart_svelte_default$2","add_to_cart_default$2","cart_sheet_default$2","cart_svelte_default$1","add_to_cart_default$1","cart_items_default","cart_sheet_default$1","_page_server_default$11","_page_default$16","server_test_default$10","cart_svelte_default","add_to_cart_default","cart_sheet_default","_page_server_default$10","PROVIDERS","META","createsRaw$15","providersRaw$1","providersAppModeRaw","generate$51","add","stripeCustomer","previewRaw$5","generate$50","SLUG$26","VERSION$26","SOURCE$26","DOCS$26","generate$49","hasStripeCustomer","ecommerce_default$1","sync_stripe_subscriptions_default","created_default","deleted_default","shared_default","updated_default","createsRaw$14","CREATES_PREFIX$10","stripeSubscriptions","generate$48","previewRaw$4","PREVIEW_PREFIX$2","generate$47","SLUG$25","VERSION$25","SOURCE$25","DOCS$25","generate$46","subscriptions_default$1","previewRaw$3","generate$45","SLUG$24","VERSION$24","SOURCE$24","DOCS$24","generate$44","orders_default$1","team_switcher_default","team_default","teamInvite_default","teamRole_default","team_invites_default","_layout__default$1","_page_server_default$9","_page_default$15","_page_default$14","server_test_default$9","_layout__default","_page_server_default$8","_page_default$13","_page_default$12","server_test_default$8","_layout_server_default$2","_layout_default$1","_page_server_default$7","_page_default$11","_layout_server_default$1","_layout__app__default","_page_server_default$6","_page_default$10","authorization_default","_page_server_default$5","_page_default$9","_page_default$8","server_test_default$7","_page_server_default$4","_page_default$7","_page_default$6","server_test_default$6","server_test_default$5","_page_server_default$3","_page_default$5","_page_default$4","server_test_default$4","server_test_default$3","_page_server_default$2","server_test_default$2","createsRaw$13","CREATES_PREFIX$9","generate$43","app_sidebar_default","nav_user_default","_layout_server_default","_layout_default","teams","teamMemberships","rulesFor","TEAMS_PREVIEW_COLLECTIONS","previewRaw$2","PREVIEW_PREFIX$1","generate$42","SLUG$23","VERSION$23","SOURCE$23","DOCS$23","generate$41","teams_default$1","whatsapp_default$2","_page_server_default$1","_page_default$3","_page_default$2","server_test_default$1","_page_server_default","_page_default$1","_page_default","form_remote_default","server_test_default","createsRaw$12","createsSuperformsRaw","createsRemoteRaw","generate$40","mode","previewRaw$1","generate$39","SLUG$22","VERSION$22","SOURCE$22","DOCS$22","generate$38","detectMode","whatsapp_default$1","createsRaw$11","CREATES_PREFIX$8","WORKFLOW_PACKAGES","generate$37","previewRaw","PREVIEW_PREFIX","generate$36","SLUG$21","VERSION$21","SOURCE$21","DOCS$21","generate$35","workflows_default","generate$34","schemaPath","SLUG$20","VERSION$20","SOURCE$20","DOCS$20","generate$33","formatted","schema_default","SLUG$19","VERSION$19","SOURCE$19","DOCS$19","generate$32","routeDir","result","form_default","SLUG$18","VERSION$18","SOURCE$18","DOCS$18","generate$31","collectionDrops","resource_default","SLUG$17","VERSION$17","SOURCE$17","DOCS$17","generate$30","scaffold_default","SLUG$16","VERSION$16","SOURCE$16","DOCS$16","shopRaw","SHOP_PATHS","generate$29","shop_default","SLUG$15","VERSION$15","SOURCE$15","DOCS$15","generate$28","ai_default","SLUG$14","VERSION$14","SOURCE$14","DOCS$14","generate$27","analytics_default","generate$26","SLUG$13","VERSION$13","SOURCE$13","DOCS$13","generate$25","og_default","createsRaw$10","CREATES_PREFIX$7","generate$24","SLUG$12","VERSION$12","SOURCE$12","DOCS$12","generate$23","api_default","createsRaw$9","CREATES_PREFIX$6","generate$22","SLUG$11","VERSION$11","SOURCE$11","DOCS$11","generate$21","api_keys_default","authCreatesRaw","authRemoteCreatesRaw","whatsappCreatesRaw","AUTH_CREATES_PREFIX","AUTH_REMOTE_CREATES_PREFIX","WHATSAPP_CREATES_PREFIX","generate$20","SLUG$10","VERSION$10","SOURCE$10","DOCS$10","generate$19","auth_default","createsRaw$8","CREATES_PREFIX$5","WORKFLOW_PATHS","packageName","at","generate$18","SLUG$9","VERSION$9","SOURCE$9","DOCS$9","generate$17","backend_default","createsRaw$7","createsWithBlogRaw","CREATES_PREFIX$4","CREATES_WITH_BLOG_PREFIX","generate$16","SLUG$8","VERSION$8","SOURCE$8","DOCS$8","generate$15","content_negotiation_default","createsRaw$6","CREATES_PREFIX$3","WUCHALE_CACHE","generate$14","SLUG$7","VERSION$7","SOURCE$7","DOCS$7","generate$13","i18n_default","createsRaw$5","CREATES_PREFIX$2","generate$12","SLUG$6","VERSION$6","SOURCE$6","DOCS$6","generate$11","notifications_default","createsRaw$4","CREATES_PREFIX$1","generate$10","SLUG$5","VERSION$5","SOURCE$5","DOCS$5","generate$9","teams_default","SLUG$4","VERSION$4","SOURCE$4","DOCS$4","generate$8","patchCreates","unlinkStripePaymentMethodsCustomer","finalResult","error","payments_default","createsRaw$3","providersRaw","generate$7","providers","id","SLUG$3","VERSION$3","SOURCE$3","DOCS$3","generate$6","ecommerce_default","createsRaw$2","CREATES_PREFIX","generate$5","SLUG$2","VERSION$2","SOURCE$2","DOCS$2","generate$4","subscriptions_default","createsRaw$1","createsAppModeRaw","createsNotificationsRaw","generate$3","SLUG$1","VERSION$1","SOURCE$1","DOCS$1","generate$2","orders_default","createsRaw","PREFIX","generate$1","SLUG","VERSION","SOURCE","DOCS","generate","whatsapp_default","version","patterns","bySlug","byCategory","category","acc","installComponents","runtime","root","listComponents","switchStyle","applyBaseColor","applyTheme","detectProviders","modifyEnvVars","specs","unmodifyEnvVars","ensurePackageImports","entries","removePackageImports","keys","expected","ensurePackageOverrides","libSpecifier"],"sources":["../src/core/requires.ts","../src/core/field/index.ts","../src/core/field/plain.ts","../src/core/field/remote.ts","../src/core/tests.ts","../src/patterns/generate/form/generate.ts","../src/patterns/generate/form/index.ts","../src/patterns/generate/form-remote/generate.ts","../src/patterns/generate/form-remote/generate.preview.ts","../src/patterns/generate/form-remote/index.ts","../src/patterns/generate/migration/generate.ts","../src/patterns/generate/migration/index.ts","../src/patterns/generate/resource/generate.ts","../src/patterns/generate/resource/index.ts","../src/core/field/plain-display.ts","../src/core/url.ts","../src/core/scaffold-list.ts","../src/patterns/generate/scaffold/generate.ts","../src/patterns/generate/scaffold/index.ts","../src/patterns/generate/scaffold-remote/generate.ts","../src/patterns/generate/scaffold-remote/generate.preview.ts","../src/patterns/generate/scaffold-remote/index.ts","../src/patterns/generate/schema/generate.ts","../src/patterns/generate/schema/index.ts","../src/patterns/generate/shop/generate.ts","../src/patterns/generate/shop/index.ts","../src/patterns/generate/workflow/generate.ts","../src/patterns/generate/workflow/index.ts","../src/patterns/enable/ai/generate.preview.ts","../src/patterns/enable/ai/index.ts","../src/patterns/enable/analytics/generate.preview.ts","../src/patterns/enable/analytics/index.ts","../src/patterns/enable/auth/generate.ts","../src/patterns/enable/auth/generate.preview.ts","../src/patterns/enable/auth/index.ts","../src/patterns/enable/og/generate.ts","../src/patterns/enable/og/generate.preview.ts","../src/patterns/enable/og/index.ts","../src/patterns/enable/auth-remote/generate.ts","../src/patterns/enable/auth-remote/generate.preview.ts","../src/patterns/enable/auth-remote/index.ts","../src/patterns/enable/api/generate.ts","../src/patterns/enable/api/generate.preview.ts","../src/patterns/enable/api/index.ts","../src/patterns/enable/api-keys/generate.ts","../src/patterns/enable/api-keys/generate.preview.ts","../src/patterns/enable/api-keys/index.ts","../src/patterns/enable/backend/generate.ts","../src/patterns/enable/backend/generate.preview.ts","../src/patterns/enable/backend/index.ts","../src/patterns/enable/blog/generate.ts","../src/patterns/enable/blog/generate.preview.ts","../src/patterns/enable/blog/index.ts","../src/patterns/enable/cms/generate.preview.ts","../src/patterns/enable/cms/index.ts","../src/patterns/enable/content-negotiation/generate.ts","../src/patterns/enable/content-negotiation/generate.preview.ts","../src/patterns/enable/content-negotiation/index.ts","../src/patterns/enable/i18n/generate.ts","../src/patterns/enable/i18n/generate.preview.ts","../src/patterns/enable/i18n/index.ts","../src/patterns/enable/notifications/generate.ts","../src/patterns/enable/notifications/runtime/collections.ts","../src/patterns/enable/notifications/generate.preview.ts","../src/patterns/enable/notifications/index.ts","../src/patterns/enable/payments/generate.preview.ts","../src/patterns/enable/payments/index.ts","../src/patterns/enable/ecommerce/generate.ts","../src/patterns/enable/ecommerce/generate.preview.ts","../src/patterns/enable/ecommerce/index.ts","../src/patterns/enable/subscriptions/generate.ts","../src/patterns/enable/subscriptions/generate.preview.ts","../src/patterns/enable/subscriptions/index.ts","../src/patterns/enable/orders/generate.preview.ts","../src/patterns/enable/orders/index.ts","../src/patterns/enable/teams/generate.ts","../src/patterns/enable/teams/runtime/collections.ts","../src/patterns/enable/teams/generate.preview.ts","../src/patterns/enable/teams/index.ts","../src/patterns/enable/whatsapp/generate.ts","../src/patterns/enable/whatsapp/generate.preview.ts","../src/patterns/enable/whatsapp/index.ts","../src/patterns/enable/workflows/generate.ts","../src/patterns/enable/workflows/generate.preview.ts","../src/patterns/enable/workflows/index.ts","../src/patterns/destroy/schema/generate.ts","../src/patterns/destroy/schema/index.ts","../src/patterns/destroy/form/index.ts","../src/patterns/destroy/resource/index.ts","../src/patterns/destroy/scaffold/index.ts","../src/patterns/destroy/shop/index.ts","../src/patterns/disable/ai/index.ts","../src/patterns/disable/analytics/index.ts","../src/patterns/disable/og/generate.ts","../src/patterns/disable/og/index.ts","../src/patterns/disable/api/generate.ts","../src/patterns/disable/api/index.ts","../src/patterns/disable/api-keys/generate.ts","../src/patterns/disable/api-keys/index.ts","../src/patterns/disable/auth/generate.ts","../src/patterns/disable/auth/index.ts","../src/patterns/disable/backend/generate.ts","../src/patterns/disable/backend/index.ts","../src/patterns/disable/content-negotiation/generate.ts","../src/patterns/disable/content-negotiation/index.ts","../src/patterns/disable/i18n/generate.ts","../src/patterns/disable/i18n/index.ts","../src/patterns/disable/notifications/generate.ts","../src/patterns/disable/notifications/index.ts","../src/patterns/disable/teams/generate.ts","../src/patterns/disable/teams/index.ts","../src/patterns/disable/payments/index.ts","../src/patterns/disable/ecommerce/generate.ts","../src/patterns/disable/ecommerce/index.ts","../src/patterns/disable/subscriptions/generate.ts","../src/patterns/disable/subscriptions/index.ts","../src/patterns/disable/orders/generate.ts","../src/patterns/disable/orders/index.ts","../src/patterns/disable/whatsapp/generate.ts","../src/patterns/disable/whatsapp/index.ts","../src/index.ts"],"sourcesContent":["import type {\n DetectedProviders,\n FeatureFlag,\n Features,\n Pattern,\n Provider,\n Requires,\n} from \"./types\";\n\n/**\n * The features in `pattern.blockedBy` that the project has on, in the\n * pattern's order. Empty means nothing stands in the way. A disable pattern\n * names the features whose code imports what it removes, so that\n * `disable-payments` refuses while the cart still imports the Stripe client.\n */\nexport function blockingFeatures(\n pattern: Pick<Pattern, \"blockedBy\">,\n features: Features,\n): FeatureFlag[] {\n return (pattern.blockedBy ?? []).filter((flag) => features[flag] === true);\n}\n\n/** One prerequisite a project is missing for a pattern. */\nexport type Unmet =\n | { kind: \"feature\"; feature: keyof Features }\n | {\n kind: \"provider\";\n capability: string;\n /** Provider ids that would satisfy the pattern. */\n want: string[];\n /** What the project has, `null` for none. */\n have: string | null;\n }\n | { kind: \"ambiguous\"; capability: string; ids: string[] };\n\ntype RequiresPattern = Pick<\n Pattern,\n \"requires\" | \"providers\" | \"inheritsProvider\"\n>;\n\nexport interface RequirementsContext {\n features: Features;\n detected: DetectedProviders;\n /** The provider chosen for this run, when the caller already knows it. */\n provider?: string;\n}\n\n/**\n * What `pattern` needs that the project doesn't have, in a stable order:\n * missing features, then providers, then ambiguous detections. Empty means\n * the pattern can run.\n *\n * Only `true` flags are requirements. `false` means \"not required\", never\n * \"must be absent\", and `ui` is left to its own check, since it is a value\n * rather than a flag. The chosen provider's own `requires` is added to the\n * pattern's; for a pattern with `inheritsProvider`, the chosen provider is the\n * detected one.\n */\nexport function unmetRequirements(\n pattern: RequiresPattern,\n context: RequirementsContext,\n): Unmet[] {\n const { features, detected } = context;\n const providerId =\n context.provider ??\n (pattern.inheritsProvider\n ? detected.providers[pattern.inheritsProvider]\n : undefined);\n const provider = pattern.providers?.find(\n (candidate) => candidate.id === providerId,\n );\n const requires = mergeRequires(pattern.requires, provider);\n\n const unmet: Unmet[] = [];\n const missingFeatures = new Set<string>();\n\n for (const [key, value] of Object.entries(requires)) {\n if (key === \"ui\" || key === \"providers\" || value !== true) continue;\n if (!features[key as keyof Features]) {\n missingFeatures.add(key);\n unmet.push({ kind: \"feature\", feature: key as keyof Features });\n }\n }\n\n const wanted: [string, string[]][] = Object.entries(\n requires.providers ?? {},\n ).filter((entry): entry is [string, string[]] => entry[1] !== undefined);\n if (pattern.inheritsProvider && pattern.providers) {\n wanted.push([\n pattern.inheritsProvider,\n pattern.providers.map((candidate) => candidate.id),\n ]);\n }\n\n const reported = new Set<string>();\n for (const [capability, want] of wanted) {\n if (reported.has(capability)) continue;\n const have = detected.providers[capability] ?? null;\n if (have !== null && want.includes(have)) continue;\n // A capability that is also a missing feature is already reported.\n if (have === null && missingFeatures.has(capability)) continue;\n if (detected.ambiguous.some((entry) => entry.capability === capability)) {\n continue;\n }\n reported.add(capability);\n unmet.push({ kind: \"provider\", capability, want, have });\n }\n\n const referenced = new Set(wanted.map(([capability]) => capability));\n for (const entry of detected.ambiguous) {\n if (referenced.has(entry.capability)) {\n unmet.push({\n kind: \"ambiguous\",\n capability: entry.capability,\n ids: entry.ids,\n });\n }\n }\n\n return unmet;\n}\n\n/**\n * The pattern's requirements with the provider's on top. A flag is required\n * when either says so; a provider's list for a capability replaces the\n * pattern's.\n */\nfunction mergeRequires(requires: Requires, provider?: Provider): Requires {\n const extra = provider?.requires;\n if (!extra) return requires;\n\n const merged: Requires = { ...requires };\n for (const key of Object.keys(extra) as (keyof Requires)[]) {\n if (key === \"providers\" || key === \"ui\") continue;\n if (extra[key] === true) merged[key] = true;\n }\n if (extra.ui) merged.ui = extra.ui;\n if (extra.providers) {\n merged.providers = { ...requires.providers, ...extra.providers };\n }\n return merged;\n}\n","import * as changeCase from \"change-case\";\nimport dedent from \"dedent\";\nimport type { Field, Model } from \"../../parse\";\n\ntype InputPropValue = string | number | boolean | null | undefined;\n\ninterface FieldRenderExtensions {\n inputProps?: Record<string, InputPropValue>;\n labelAside?: string;\n}\n\nexport type RenderableField = Field & FieldRenderExtensions;\n\nexport type FieldComponent =\n | \"form\"\n | \"file-form\"\n | \"multiselect\"\n | \"input\"\n | \"checkbox\"\n | \"textarea\"\n | \"select\"\n | \"geopoint\"\n | \"button\";\n\nconst FIELD_COMPONENTS: Record<Field[\"type\"], FieldComponent[]> = {\n text: [\"form\", \"input\"],\n number: [\"form\", \"input\"],\n email: [\"form\", \"input\"],\n password: [\"form\", \"input\"],\n bool: [\"form\", \"checkbox\"],\n date: [\"form\", \"input\"],\n select: [\"form\", \"multiselect\"],\n file: [\"form\", \"input\", \"file-form\", \"button\"],\n json: [\"form\", \"textarea\"],\n geoPoint: [\"form\", \"geopoint\"],\n relation: [\"form\", \"multiselect\"],\n url: [\"form\", \"input\"],\n editor: [\"form\", \"textarea\"],\n autodate: [\"form\", \"input\"],\n};\n\nconst FIELD_IMPORTS: Record<FieldComponent, string[]> = {\n form: ['import * as Form from \"#lib/components/ui/form/index.js\";'],\n \"file-form\": [\n 'import * as FileForm from \"#lib/components/ui/file-form/index.js\";',\n ],\n multiselect: [\n 'import * as MultiSelect from \"#lib/components/ui/multiselect/index.js\";',\n 'import * as Command from \"#lib/components/ui/command/index.js\";',\n ],\n input: ['import { Input } from \"#lib/components/ui/input/index.js\";'],\n checkbox: [\n 'import { Checkbox } from \"#lib/components/ui/checkbox/index.js\";',\n ],\n textarea: [\n 'import { Textarea } from \"#lib/components/ui/textarea/index.js\";',\n ],\n select: ['import * as Select from \"#lib/components/ui/select/index.js\";'],\n geopoint: [\n 'import { GeopointInput } from \"#lib/components/ui/geopoint/index.js\";',\n ],\n button: ['import { Button } from \"#lib/components/ui/button/index.js\";'],\n};\n\nexport function fieldValueBinding(field: Pick<Field, \"name\">): string {\n return `$formData.${field.name}`;\n}\n\nfunction renderInputProps(field: RenderableField): string {\n if (!field.inputProps) {\n return \"\";\n }\n\n return Object.entries(field.inputProps)\n .flatMap(([key, value]) => {\n if (value === undefined || value === null || value === false) {\n return [];\n }\n\n if (value === true) {\n return [` ${key}`];\n }\n\n return [` ${key}=${JSON.stringify(String(value))}`];\n })\n .join(\"\");\n}\n\nfunction renderLabel(field: RenderableField): string {\n if (!field.labelAside) {\n return `<Form.Label>${field.title}</Form.Label>`;\n }\n\n return dedent`\n <div class=\"flex justify-between\">\n <Form.Label>${field.title}</Form.Label>\n ${field.labelAside}\n </div>\n `;\n}\n\nfunction renderInputField(field: RenderableField, type: string): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Input {...props} type=\"${type}\" bind:value={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderTextareaField(field: RenderableField): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-2\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Textarea {...props} bind:value={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderBoolField(field: RenderableField): string {\n const required = field.required ? \" required\" : \"\";\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1 flex items-start space-x-2\">\n <Form.Control>\n {#snippet children({ props })}\n <Checkbox {...props} bind:checked={${fieldValueBinding(field)}}${required}${renderInputProps(field)} />\n ${renderLabel(field)}\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderGeoPointField(field: RenderableField): string {\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <GeopointInput {...props} bind:value={${fieldValueBinding(field)}} />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nfunction renderFileField(\n field: Extract<RenderableField, { type: \"file\" }>,\n): string {\n const required = field.required ? \" required\" : \"\";\n const fileMode = field.maxSelect > 1 ? \"Multiple\" : \"Single\";\n\n return dedent`\n <FileForm.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <FileForm.${fileMode}>\n {#snippet display({ file, filename, onremove })}\n <div class=\"flex gap-2 justify-between items-center\">\n <div class=\"flex gap-2 items-center\">\n <FileForm.Thumb {file} {filename} class=\"w-16 h-16 rounded-md object-cover\" />\n <p class=\"text-sm text-muted-foreground\">{filename}</p>\n </div>\n <Button variant=\"outline\" onclick={() => onremove(file)}>Remove</Button>\n </div>\n {/snippet}\n {#snippet input()}\n <FileForm.Input {...props}${required}${renderInputProps(field)} />\n {/snippet}\n </FileForm.${fileMode}>\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </FileForm.Field>\n `;\n}\n\nfunction renderSelectField(\n field: Extract<RenderableField, { type: \"select\" }>,\n): string {\n const multiType = field.maxSelect > 1 ? \"multiple\" : \"single\";\n const required = field.required ? \" required\" : \"\";\n const placeholder =\n field.maxSelect > 1 ? \"Select options\" : \"Select an option\";\n\n const options = field.options\n .map(\n (option) =>\n `<MultiSelect.Item value=${JSON.stringify(option.value)} label={${field.name}Labels[${JSON.stringify(option.value)}].label} />`,\n )\n .join(\"\\n \");\n\n return dedent`\n <MultiSelect.Field {form} type=\"${multiType}\" name=\"${field.name}\"${required} class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <MultiSelect.Trigger class=\"w-full justify-between\">\n <MultiSelect.Input bind:value={${fieldValueBinding(field)}} placeholder=\"${placeholder}\" {...props}>\n {#snippet children({ selected })}\n <div class=\"flex flex-wrap gap-1\">\n {#each selected as value}\n <MultiSelect.Chip>{${field.name}Labels[value].label}</MultiSelect.Chip>\n {/each}\n </div>\n {/snippet}\n </MultiSelect.Input>\n </MultiSelect.Trigger>\n {/snippet}\n </Form.Control>\n\n <MultiSelect.Content class=\"p-0\">\n <Command.Root>\n <Command.Input autofocus placeholder=\"Search...\" />\n <Command.Empty>No options found</Command.Empty>\n <Command.Group>\n ${options}\n </Command.Group>\n </Command.Root>\n </MultiSelect.Content>\n\n <Form.FieldErrors class=\"contents text-destructive\" />\n </MultiSelect.Field>\n `;\n}\n\nfunction renderRelationField(\n field: Extract<RenderableField, { type: \"relation\" }>,\n): string {\n const multiType = field.maxSelect > 1 ? \"multiple\" : \"single\";\n const placeholder =\n field.maxSelect > 1\n ? `Select ${field.relatedModel.pluralDisplayName.toLowerCase()}`\n : `Select ${field.relatedModel.displayName.toLowerCase()}`;\n const searchPlaceholder = `Search ${field.relatedModel.pluralDisplayName.toLowerCase()}...`;\n const emptyText = `No ${field.relatedModel.pluralDisplayName.toLowerCase()} found`;\n const modelName = field.relatedModel.name;\n const listName = field.relatedModel.pluralName;\n\n return dedent`\n <MultiSelect.Field {form} type=\"${multiType}\" name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n <Form.Label>${field.title}</Form.Label>\n <MultiSelect.Trigger class=\"w-full justify-between\">\n <MultiSelect.Input bind:value={${fieldValueBinding(field)}} placeholder=\"${placeholder}\" {...props}>\n {#snippet children({ selected })}\n <div class=\"flex flex-wrap gap-1\">\n {#each selected as value}\n {@const ${modelName} = data.${listName}.find((${modelName}) => ${modelName}.id === value)!}\n <MultiSelect.Chip>{${modelName}.${field.displayField}}</MultiSelect.Chip>\n {/each}\n </div>\n {/snippet}\n </MultiSelect.Input>\n </MultiSelect.Trigger>\n {/snippet}\n </Form.Control>\n\n <MultiSelect.Content class=\"p-0\">\n <Command.Root>\n <Command.Input autofocus placeholder=\"${searchPlaceholder}\" />\n <Command.Empty>${emptyText}</Command.Empty>\n <Command.Group>\n {#each data.${listName} as ${modelName}}\n <MultiSelect.Item value={${modelName}.id} label={${modelName}.${field.displayField}} />\n {/each}\n </Command.Group>\n </Command.Root>\n </MultiSelect.Content>\n\n <Form.FieldErrors class=\"contents text-destructive\" />\n </MultiSelect.Field>\n `;\n}\n\nfunction renderAutodateField(field: RenderableField): string {\n return dedent`\n <Form.Field {form} name=\"${field.name}\" class=\"col-span-1\">\n <Form.Control>\n {#snippet children({ props })}\n ${renderLabel(field)}\n <Input {...props} type=\"text\" value={${fieldValueBinding(field)}}${renderInputProps(field)} readonly />\n {/snippet}\n </Form.Control>\n <Form.FieldErrors class=\"contents text-destructive\" />\n </Form.Field>\n `;\n}\n\nexport function renderField(field: RenderableField): string {\n switch (field.type) {\n case \"text\":\n return renderInputField(field, \"text\");\n case \"number\":\n return renderInputField(field, \"number\");\n case \"date\":\n return renderInputField(field, \"date\");\n case \"email\":\n return renderInputField(field, \"email\");\n case \"password\":\n return renderInputField(field, \"password\");\n case \"url\":\n return renderInputField(field, \"url\");\n case \"autodate\":\n return renderAutodateField(field);\n case \"editor\":\n case \"json\":\n return renderTextareaField(field);\n case \"bool\":\n return renderBoolField(field);\n case \"geoPoint\":\n return renderGeoPointField(field);\n case \"file\":\n return renderFileField(field);\n case \"select\":\n return renderSelectField(field);\n case \"relation\":\n return renderRelationField(field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n\nexport function selectFieldLabelMap(\n field: Extract<Field, { type: \"select\" }>,\n): string {\n const labels = field.options\n .map(\n (option) => dedent`\n ${JSON.stringify(option.value)}: {\n label: ${JSON.stringify(option.label)},\n value: ${JSON.stringify(option.value)}\n }\n `,\n )\n .join(\",\\n\");\n\n return dedent`\n const ${field.name}Labels = {\n ${labels}\n } as const;\n `;\n}\n\nexport function getFieldComponents(fields: Field[]): FieldComponent[] {\n const components = fields.flatMap((field) => FIELD_COMPONENTS[field.type]);\n return [...new Set(components)];\n}\n\nexport function getFieldImports(components: FieldComponent[]): string[] {\n return [\n ...new Set(components.flatMap((component) => FIELD_IMPORTS[component])),\n ];\n}\n\nfunction displayDataPath(model: Model, field: Pick<Field, \"name\">): string {\n return `data.${model.name}.${field.name}`;\n}\n\nfunction renderDisplaySimple(\n model: Model,\n field: Pick<Field, \"name\" | \"title\">,\n valueExpression: string,\n): string {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">${valueExpression}</p>\n </div>\n `;\n}\n\nfunction renderDisplayDateField(\n model: Model,\n field: Field & { type: \"date\" | \"autodate\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const dateLine = `<p class=\"text-muted-foreground\">{new Date(${dataPath}).toLocaleDateString()}</p>`;\n const body = field.required\n ? dateLine\n : dedent`\n {#if ${dataPath}}\n ${dateLine}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nfunction renderDisplayUrlField(\n model: Model,\n field: Field & { type: \"url\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const anchor = dedent`\n <a href={${dataPath}} target=\"_blank\" rel=\"noopener noreferrer\">\n {${dataPath}}\n </a>\n `;\n const body = field.required\n ? anchor\n : dedent`\n {#if ${dataPath}}\n ${anchor}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">\n ${body}\n </p>\n </div>\n `;\n}\n\nfunction renderDisplaySelectField(\n model: Model,\n field: Extract<Field, { type: \"select\" }>,\n): string {\n const dataPath = displayDataPath(model, field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#each ${dataPath} as ${field.name}}\n <Badge variant=\"outline\" class=\"mr-1\">{${field.name}Labels[${field.name}].label}</Badge>\n {/each}\n </div>\n `;\n }\n\n const badge = `<Badge variant=\"outline\" class=\"mr-1\">{${field.name}Labels[${dataPath}].label}</Badge>`;\n const body = field.required\n ? badge\n : dedent`\n {#if ${dataPath}}\n ${badge}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nfunction renderDisplayFileField(\n model: Model,\n field: Extract<Field, { type: \"file\" }>,\n): string {\n const dataPath = displayDataPath(model, field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${dataPath}}\n {#each ${dataPath} as filename}\n <div class=\"flex gap-2 items-center\">\n {#if [\".jpg\", \".png\", \".jpeg\", \".webp\", \".gif\"].some((ext) => filename.endsWith(ext))}\n <img\n src=\"/api/files/{data.${model.name}.collectionId}/{data.${model.name}.id}/{filename}\"\n alt={filename}\n class=\"w-16 h-16 rounded-md object-cover\"\n />\n {:else}\n <div class=\"flex items-center justify-center w-16 h-16 bg-muted rounded-md\">\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n <p class=\"text-sm text-muted-foreground\">{filename}</p>\n </div>\n {/each}\n {/if}\n </div>\n `;\n }\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${dataPath}}\n <div class=\"flex gap-2 items-center\">\n {#if [\".jpg\", \".png\", \".jpeg\", \".webp\", \".gif\"].some((ext) => ${dataPath}?.endsWith(ext))}\n <img\n src=\"/api/files/{data.${model.name}.collectionId}/{data.${model.name}.id}/{${dataPath}}\"\n alt={${dataPath}}\n class=\"w-16 h-16 rounded-md object-cover\"\n />\n {:else}\n <div class=\"flex items-center justify-center w-16 h-16 bg-muted rounded-md\">\n <FileIcon class=\"w-4 h-4\" />\n </div>\n {/if}\n <p class=\"text-sm text-muted-foreground\">{${dataPath}}</p>\n </div>\n {/if}\n </div>\n `;\n}\n\nfunction relationListUrl(field: Extract<Field, { type: \"relation\" }>): string {\n return `/${changeCase.kebabCase(field.relatedModel.pluralDisplayName)}`;\n}\n\nfunction renderDisplayRelationField(\n model: Model,\n field: Extract<Field, { type: \"relation\" }>,\n): string {\n const relationPath = `data.${model.name}.expand?.${field.name}`;\n const listUrl = relationListUrl(field);\n if (field.maxSelect > 1) {\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#each ${relationPath} ?? [] as ${field.singularRelationName}}\n <a href=\"${listUrl}/{${field.singularRelationName}.id}\">\n <Badge variant=\"outline\" class=\"text-muted-foreground\">\n {${field.singularRelationName}.${field.displayField}}\n <CircleArrowRightIcon class=\"w-4 h-4\" />\n </Badge>\n </a>\n {/each}\n </div>\n `;\n }\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n {#if ${relationPath}}\n <a href=\"${listUrl}/{${relationPath}.id}\">\n <Badge variant=\"outline\" class=\"text-muted-foreground\">\n {${relationPath}.${field.displayField}}\n <CircleArrowRightIcon class=\"w-4 h-4\" />\n </Badge>\n </a>\n {/if}\n </div>\n `;\n}\n\nfunction renderDisplayGeoPointField(\n model: Model,\n field: Field & { type: \"geoPoint\" },\n): string {\n const dataPath = displayDataPath(model, field);\n const content = dedent`\n {#await import(\"#lib/components/ui/leaflet/leaflet.svelte\")}\n <div class=\"h-56.25 w-full bg-input rounded-md\"></div>\n {:then { default: Leaflet }}\n <Leaflet point={${dataPath}} readonly class=\"rounded-md overflow-hidden\" />\n {/await}\n <p class=\"text-muted-foreground\">\n {${dataPath}?.lat.toFixed(6)}, {${dataPath}?.lon.toFixed(6)}\n </p>\n `;\n const body = field.required\n ? content\n : dedent`\n {#if ${dataPath}}\n ${content}\n {/if}\n `;\n\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n ${body}\n </div>\n `;\n}\n\nexport function renderDisplayField(model: Model, field: Field): string {\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"editor\":\n return renderDisplaySimple(\n model,\n field,\n `{${displayDataPath(model, field)}}`,\n );\n case \"password\":\n return dedent`\n <div class=\"space-y-2\">\n <h3 class=\"font-medium leading-none\">${field.title}</h3>\n <p class=\"text-muted-foreground\">\n <code class=\"text-xs font-mono bg-muted rounded-md px-1 py-0.5\">********</code>\n </p>\n </div>\n `;\n case \"bool\":\n return renderDisplaySimple(\n model,\n field,\n `{${displayDataPath(model, field)} ? \"Yes\" : \"No\"}`,\n );\n case \"date\":\n case \"autodate\":\n return renderDisplayDateField(\n model,\n field as Field & { type: \"date\" | \"autodate\" },\n );\n case \"url\":\n return renderDisplayUrlField(model, field as Field & { type: \"url\" });\n case \"select\":\n return renderDisplaySelectField(model, field);\n case \"file\":\n return renderDisplayFileField(model, field);\n case \"json\":\n return renderDisplaySimple(\n model,\n field,\n `{JSON.stringify(${displayDataPath(model, field)})}`,\n );\n case \"geoPoint\":\n return renderDisplayGeoPointField(\n model,\n field as Field & { type: \"geoPoint\" },\n );\n case \"relation\":\n return renderDisplayRelationField(model, field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n","import dedent from \"dedent\";\nimport type { Field } from \"../../parse\";\n\n/**\n * Native-element field markup, shared by every form flavour that does not go\n * through formsnap. Two things vary independently:\n *\n * - the **binding**: how a control is tied to the form library (superforms\n * stores, or a SvelteKit remote form's `.as()` / `.issues()`), and\n * - the **style**: shadcn's `Input`/`Textarea` plus tailwind classes, or bare\n * elements with `data-*` hooks for projects that have neither.\n */\n\nexport type ControlKind =\n \"input\" | \"textarea\" | \"checkbox\" | \"select\" | \"file\" | \"readonly\";\n\nexport interface ControlOptions {\n /** The `type` attribute of an `<input>`. */\n htmlType?: string;\n multiple?: boolean;\n required?: boolean;\n}\n\nexport interface PlainBinding {\n /** Attributes tying a control to its field, emitted right after `id`. */\n control(field: Field, kind: ControlKind, options: ControlOptions): string;\n /** Markup listing the field's validation errors. */\n errors(field: Field, errorAttrs: string): string;\n /** Expression that is truthy while the field has errors. */\n invalid(field: Field): string;\n /** Field types the binding has no markup for; they render as a TODO comment. */\n unsupported: Field[\"type\"][];\n /** Further fields the binding has no markup for, rendered the same way. */\n unsupportedField?(field: Field): boolean;\n /** Name used in the TODO comment of an unsupported field. */\n label: string;\n}\n\ntype Layout = \"default\" | \"wide\" | \"inline\";\n\nexport interface PlainStyle {\n input: string;\n textarea: string;\n wrapper(field: Field, layout: Layout, binding: PlainBinding): string;\n labelAttrs: string;\n selectAttrs: string;\n fileAttrs: string;\n errorAttrs: string;\n}\n\n/** shadcn `Input`/`Textarea` and tailwind classes: what the remote generators emit. */\nexport const SHADCN_STYLE: PlainStyle = {\n input: \"Input\",\n textarea: \"Textarea\",\n wrapper(_field, layout) {\n const classes: Record<Layout, string> = {\n default: \"space-y-2 col-span-1\",\n wide: \"space-y-2 col-span-2\",\n inline: \"col-span-1 flex items-start space-x-2\",\n };\n return ` class=\"${classes[layout]}\"`;\n },\n labelAttrs: ' class=\"text-sm font-medium\"',\n selectAttrs:\n ' class=\"border-input bg-background flex h-9 w-full rounded-md border px-3 py-1 text-sm\"',\n fileAttrs: ' class=\"text-sm\"',\n errorAttrs: ' class=\"text-destructive text-sm\"',\n};\n\n/**\n * No components and no classes. `data-field` / `data-invalid` / `data-error`\n * let a project style every generated form from one stylesheet.\n */\nexport const NATIVE_STYLE: PlainStyle = {\n input: \"input\",\n textarea: \"textarea\",\n wrapper(field, _layout, binding) {\n return ` data-field=\"${field.name}\" data-invalid={${binding.invalid(field)} ? \"\" : undefined}`;\n },\n labelAttrs: \"\",\n selectAttrs: \"\",\n fileAttrs: \"\",\n errorAttrs: \" data-error\",\n};\n\nexport function isMultiple(field: Field): boolean {\n return (\n (field.type === \"select\" ||\n field.type === \"relation\" ||\n field.type === \"file\") &&\n field.maxSelect > 1\n );\n}\n\nconst flag = (on: boolean | undefined, attr: string) => (on ? ` ${attr}` : \"\");\n\n/** `<input>` types a remote form field's `.as()` takes as they are. */\nconst REMOTE_INPUT_TYPES = [\n \"text\",\n \"number\",\n \"email\",\n \"password\",\n \"url\",\n \"date\",\n];\n\n/**\n * Fields a remote form has a control for. A relation needs the related\n * records and a geoPoint its own two inputs, neither of which this renderer\n * writes yet. A multi-file field uploads through PocketBase's `name+` key,\n * which is not a valid remote form field path, and its own key holds the\n * kept filenames, so neither takes `.as(\"file multiple\")`.\n */\nexport function remoteFormSupports(field: Field): boolean {\n return (\n field.type !== \"geoPoint\" &&\n field.type !== \"relation\" &&\n !(field.type === \"file\" && isMultiple(field))\n );\n}\n\n/**\n * Fields a form cannot show the stored value of. On a form that edits a\n * record they start empty, are never `required`, and leave the stored value\n * alone when posted empty.\n */\nexport function isWriteOnly(field: Field): boolean {\n return field.type === \"file\" || field.type === \"password\";\n}\n\nexport interface RemoteBindingOptions {\n /**\n * The form edits an existing record, so a write-only field may be left\n * empty to keep what is stored.\n */\n edit?: boolean;\n}\n\n/**\n * A remote form posts each control under the name `.as()` generates (the\n * field path plus a type prefix, an array marker and the form id), and\n * SvelteKit 3 rejects any other name. So every control spreads `.as()` and\n * none writes `name`, `type` or `multiple` by hand: `.as()` sets `type` for\n * everything but text and selects, and `multiple` for `select multiple`,\n * whose `[]` name marker is what lets several values through.\n */\nexport function remoteBinding(\n formVar: string,\n options: RemoteBindingOptions = {},\n): PlainBinding {\n const as = (field: Field, type: string) =>\n `{...${formVar}.fields.${field.name}.as(${JSON.stringify(type)})}`;\n\n return {\n label: \"remote form variant\",\n unsupported: [],\n unsupportedField: (field) => !remoteFormSupports(field),\n control(field, kind, { htmlType, multiple, required }) {\n const tail = flag(\n required && !(options.edit && isWriteOnly(field)),\n \"required\",\n );\n switch (kind) {\n case \"input\": {\n const asType =\n htmlType && REMOTE_INPUT_TYPES.includes(htmlType)\n ? htmlType\n : \"text\";\n return `${as(field, asType)}${tail}`;\n }\n case \"textarea\":\n return `${as(field, \"text\")}${tail}`;\n case \"checkbox\":\n return `${as(field, \"checkbox\")}${tail}`;\n case \"select\":\n return `${as(field, multiple ? \"select multiple\" : \"select\")}${tail}`;\n case \"file\":\n return `${as(field, \"file\")}${tail}`;\n case \"readonly\":\n return `${as(field, \"text\")} readonly`;\n }\n },\n errors(field, errorAttrs) {\n return dedent`\n {#each ${formVar}.fields.${field.name}.issues() as issue}\n <p${errorAttrs}>{issue.message}</p>\n {/each}\n `;\n },\n invalid(field) {\n return `${formVar}.fields.${field.name}.issues()?.length`;\n },\n };\n}\n\n/**\n * The value a remote form control starts from when the form edits `record`\n * (an expression, `data.post`), or `undefined` for a field with no control\n * or nothing to show. What PocketBase returns is not always what the control\n * takes: `<input type=\"date\">` wants `YYYY-MM-DD`, not a timestamp, and a\n * json field is edited as text.\n */\nexport function remoteSeedExpression(\n field: Field,\n record: string,\n): string | undefined {\n if (!remoteFormSupports(field) || isWriteOnly(field)) return undefined;\n const value = `${record}.${field.name}`;\n switch (field.type) {\n case \"date\":\n return `${value}?.slice(0, 10)`;\n case \"json\":\n return `${value} == null ? \"\" : JSON.stringify(${value}, null, 2)`;\n default:\n return value;\n }\n}\n\n/** Array-valued fields report their own errors under `_errors`. */\nfunction superformsErrors(field: Field): string {\n return isMultiple(field)\n ? `$errors.${field.name}?._errors`\n : `$errors.${field.name}`;\n}\n\n/** Controls that take superforms' `$constraints` instead of a literal `required`. */\nconst CONSTRAINED: ControlKind[] = [\"input\", \"textarea\"];\n\nexport function usesConstraints(fields: Field[]): boolean {\n return fields.some((field) =>\n [\n \"text\",\n \"number\",\n \"email\",\n \"password\",\n \"url\",\n \"date\",\n \"editor\",\n \"json\",\n ].includes(field.type),\n );\n}\n\nexport function superformsBinding(): PlainBinding {\n return {\n label: \"plain form variant\",\n unsupported: [],\n control(field, kind, { htmlType, multiple, required }) {\n const value = `$formData.${field.name}`;\n const errors = superformsErrors(field);\n const aria = ` aria-invalid={${errors} ? \"true\" : undefined} aria-describedby={${errors} ? \"${field.name}-error\" : undefined}`;\n const tail = CONSTRAINED.includes(kind)\n ? ` {...$constraints.${field.name}}`\n : `${flag(multiple, \"multiple\")}${flag(required, \"required\")}`;\n\n switch (kind) {\n case \"input\":\n return `name=\"${field.name}\" type=\"${htmlType ?? \"text\"}\" bind:value={${value}}${aria}${tail}`;\n case \"textarea\":\n case \"select\":\n return `name=\"${field.name}\" bind:value={${value}}${aria}${tail}`;\n case \"checkbox\":\n return `name=\"${field.name}\" type=\"checkbox\" bind:checked={${value}}${aria}${tail}`;\n case \"file\":\n // Multi-file fields follow PocketBase's `name+` (append) convention;\n // the schema carries a matching `name+` key.\n return multiple\n ? `name=\"${field.name}+\" type=\"file\" oninput={(e) => ($formData[\"${field.name}+\"] = Array.from(e.currentTarget.files ?? []))}${aria}${tail}`\n : `name=\"${field.name}\" type=\"file\" oninput={(e) => (${value} = e.currentTarget.files?.[0] ?? \"\")}${aria}${tail}`;\n case \"readonly\":\n return `name=\"${field.name}\" type=\"text\" value={${value}} readonly`;\n }\n },\n errors(field, errorAttrs) {\n const errors = superformsErrors(field);\n return dedent`\n {#if ${errors}}\n <p id=\"${field.name}-error\"${errorAttrs}>{${errors}}</p>\n {/if}\n `;\n },\n invalid: superformsErrors,\n };\n}\n\nexport interface PlainRenderer {\n render(field: Field): string;\n}\n\nexport function plainRenderer(\n binding: PlainBinding,\n style: PlainStyle,\n): PlainRenderer {\n const label = (field: Field, htmlFor = field.name) =>\n `<label for=\"${htmlFor}\"${style.labelAttrs}>${field.title}</label>`;\n\n function input(field: Field, htmlType: string): string {\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <${style.input} id=\"${field.name}\" ${binding.control(field, \"input\", { htmlType, required: field.required })} />\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function textarea(field: Field): string {\n const tag = style.textarea;\n const control = binding.control(field, \"textarea\", {\n required: field.required,\n });\n const element =\n tag === \"textarea\"\n ? `<textarea id=\"${field.name}\" ${control}></textarea>`\n : `<${tag} id=\"${field.name}\" ${control} />`;\n return dedent`\n <div${style.wrapper(field, \"wide\", binding)}>\n ${label(field)}\n ${element}\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function checkbox(field: Field): string {\n return dedent`\n <div${style.wrapper(field, \"inline\", binding)}>\n <input id=\"${field.name}\" ${binding.control(field, \"checkbox\", { required: field.required })} />\n ${label(field)}\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function select(field: Extract<Field, { type: \"select\" }>): string {\n const options = field.options\n .map(\n (option) =>\n `<option value=${JSON.stringify(option.value)}>${option.label}</option>`,\n )\n .join(\"\\n \");\n\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <select id=\"${field.name}\" ${binding.control(field, \"select\", { multiple: isMultiple(field), required: field.required })}${style.selectAttrs}>\n ${options}\n </select>\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function relation(field: Extract<Field, { type: \"relation\" }>): string {\n const multiple = isMultiple(field);\n const modelName = field.relatedModel.name;\n const placeholder = multiple\n ? \"\"\n : `<option value=\"\">Select ${field.relatedModel.displayName.toLowerCase()}</option>`;\n\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <select id=\"${field.name}\" ${binding.control(field, \"select\", { multiple, required: field.required })}${style.selectAttrs}>\n ${placeholder}\n {#each data.${field.relatedModel.pluralName} as ${modelName}}\n <option value={${modelName}.id}>{${modelName}.${field.displayField}}</option>\n {/each}\n </select>\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function file(field: Extract<Field, { type: \"file\" }>): string {\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <input id=\"${field.name}\" ${binding.control(field, \"file\", { multiple: isMultiple(field), required: field.required })}${style.fileAttrs} />\n ${binding.errors(field, style.errorAttrs)}\n </div>\n `;\n }\n\n function autodate(field: Field): string {\n return dedent`\n <div${style.wrapper(field, \"default\", binding)}>\n ${label(field)}\n <${style.input} id=\"${field.name}\" ${binding.control(field, \"readonly\", {})} />\n </div>\n `;\n }\n\n /**\n * PocketBase takes a geoPoint as `{ lat, lon }`; the form schema carries it\n * as a JSON string, kept in sync from `<name>Point` (see `geoPointState`).\n */\n function geoPoint(field: Field): string {\n const point = `${field.name}Point`;\n return dedent`\n <fieldset${style.wrapper(field, \"default\", binding)}>\n <legend>${field.title}</legend>\n <label for=\"${field.name}-lat\"${style.labelAttrs}>Latitude</label>\n <${style.input} id=\"${field.name}-lat\" type=\"number\" step=\"any\" min=\"-90\" max=\"90\" bind:value={${point}.lat} />\n <label for=\"${field.name}-lon\"${style.labelAttrs}>Longitude</label>\n <${style.input} id=\"${field.name}-lon\" type=\"number\" step=\"any\" min=\"-180\" max=\"180\" bind:value={${point}.lon} />\n <input type=\"hidden\" name=\"${field.name}\" value={$formData.${field.name}} />\n ${binding.errors(field, style.errorAttrs)}\n </fieldset>\n `;\n }\n\n return {\n render(field) {\n if (\n binding.unsupported.includes(field.type) ||\n binding.unsupportedField?.(field)\n ) {\n return `<!-- TODO: ${field.type} field \"${field.name}\" is not yet supported by the ${binding.label} -->`;\n }\n\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"password\":\n case \"url\":\n case \"date\":\n return input(field, field.type);\n case \"editor\":\n case \"json\":\n return textarea(field);\n case \"bool\":\n return checkbox(field);\n case \"select\":\n return select(field);\n case \"relation\":\n return relation(field);\n case \"file\":\n return file(field);\n case \"autodate\":\n return autodate(field);\n case \"geoPoint\":\n return geoPoint(field);\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n },\n };\n}\n\n/** Script-side state backing the lat/lon inputs of each geoPoint field. */\nexport function geoPointState(fields: Field[]): string {\n return fields\n .filter((field) => field.type === \"geoPoint\")\n .map(\n (field) => dedent`\n let ${field.name}Point = $state<{ lat: number; lon: number }>(\n JSON.parse($formData.${field.name} || '{\"lat\":0,\"lon\":0}'),\n );\n $effect(() => {\n $formData.${field.name} = JSON.stringify(${field.name}Point);\n });\n `,\n )\n .join(\"\\n\\n\");\n}\n","import type { Field } from \"../../parse\";\nimport {\n NATIVE_STYLE,\n SHADCN_STYLE,\n plainRenderer,\n remoteBinding,\n} from \"./plain\";\n\nexport type RemoteFieldComponent = \"input\" | \"textarea\" | \"button\";\n\nconst REMOTE_FIELD_COMPONENTS: Record<Field[\"type\"], RemoteFieldComponent[]> = {\n text: [\"input\"],\n number: [\"input\"],\n email: [\"input\"],\n password: [\"input\"],\n url: [\"input\"],\n date: [\"input\"],\n bool: [],\n editor: [\"textarea\"],\n json: [\"textarea\"],\n select: [],\n file: [],\n autodate: [\"input\"],\n geoPoint: [],\n relation: [],\n};\n\nconst REMOTE_FIELD_IMPORTS: Record<RemoteFieldComponent, string> = {\n input: 'import { Input } from \"#lib/components/ui/input/index.js\";',\n textarea: 'import { Textarea } from \"#lib/components/ui/textarea/index.js\";',\n button: 'import { Button } from \"#lib/components/ui/button/index.js\";',\n};\n\nexport function getRemoteFieldComponents(\n fields: Field[],\n): RemoteFieldComponent[] {\n const components = fields.flatMap(\n (field) => REMOTE_FIELD_COMPONENTS[field.type],\n );\n return [...new Set(components)];\n}\n\nexport function getRemoteFieldImports(\n components: RemoteFieldComponent[],\n): string[] {\n return components.map((component) => REMOTE_FIELD_IMPORTS[component]);\n}\n\ninterface RemoteRenderOptions {\n formVar: string;\n /** Bare elements instead of shadcn's `Input`/`Textarea`; see `PlainStyle`. */\n native?: boolean;\n /** The form edits an existing record; see `RemoteBindingOptions`. */\n edit?: boolean;\n}\n\nexport function renderRemoteField(\n field: Field,\n options: RemoteRenderOptions,\n): string {\n return plainRenderer(\n remoteBinding(options.formVar, { edit: options.edit }),\n options.native ? NATIVE_STYLE : SHADCN_STYLE,\n ).render(field);\n}\n\n/** The import a generated remote function needs to call `requireUser()`. */\nexport const REQUIRE_USER_IMPORT =\n 'import { requireUser } from \"@velastack/pocketbase/auth\";';\n\n/**\n * The first lines of a generated remote function in a protected route: the\n * session check, kept in `user` when the function goes on to use it. Empty\n * when the route is public.\n */\nexport function requireUserLines(guard: boolean, usesUser: boolean): string {\n if (!guard) return \"\";\n return [\n \"// The folder this file is in protects its pages, not this function: a\",\n \"// remote function is an endpoint of its own, so it checks the session.\",\n usesUser ? \"const user = requireUser();\" : \"requireUser();\",\n ].join(\"\\n\");\n}\n","import dedent from \"dedent\";\nimport type { Options } from \"./types\";\nimport { parseModel, type Collection, type Field, type Model } from \"../parse\";\n\nconst GENERATED_DATE = \"2024-01-01T00:00:00.000Z\";\n\nclass RawExpression {\n constructor(public readonly expression: string) {}\n}\n\ntype FixtureValue =\n | string\n | number\n | boolean\n | null\n | FixtureValue[]\n | { [key: string]: FixtureValue }\n | RawExpression;\n\ntype RuntimeCollectionField = Collection[\"fields\"][number] & {\n values?: string[];\n system?: boolean;\n};\n\ntype ScaffoldUrls = {\n list: string;\n new: string;\n show: string;\n edit: string;\n};\n\nfunction fixtureToCode(value: FixtureValue): string {\n if (value instanceof RawExpression) {\n return value.expression;\n }\n\n if (Array.isArray(value)) {\n return `[${value.map((entry) => fixtureToCode(entry)).join(\", \")}]`;\n }\n\n if (value && typeof value === \"object\") {\n const entries = Object.entries(value)\n .map(([key, entry]) => `${JSON.stringify(key)}: ${fixtureToCode(entry)}`)\n .join(\", \");\n return `{ ${entries} }`;\n }\n\n return JSON.stringify(value);\n}\n\nfunction fixtureObjectToCode(data: Record<string, FixtureValue>): string {\n const entries = Object.entries(data).map(\n ([key, value]) => `${JSON.stringify(key)}: ${fixtureToCode(value)}`,\n );\n return `{ ${entries.join(\", \")} }`;\n}\n\nfunction fieldTypeFromCollectionField(\n rawType: string,\n): Field[\"type\"] | undefined {\n switch (rawType) {\n case \"text\":\n case \"number\":\n case \"bool\":\n case \"date\":\n case \"email\":\n case \"password\":\n case \"url\":\n case \"editor\":\n case \"autodate\":\n case \"select\":\n case \"file\":\n case \"json\":\n case \"geoPoint\":\n case \"relation\":\n return rawType;\n case \"string\":\n return \"text\";\n case \"boolean\":\n return \"bool\";\n case \"datetime\":\n case \"timestamp\":\n return \"date\";\n case \"references\":\n return \"relation\";\n case \"float\":\n case \"integer\":\n case \"int\":\n case \"decimal\":\n case \"double\":\n return \"number\";\n default:\n return undefined;\n }\n}\n\nfunction relationUrl(url: string, idExpression: string): string {\n return url.replace(\"[id]\", `\\${${idExpression}}`);\n}\n\nfunction testizeUrl(url: string, dynamicParams: string[]): string {\n if (dynamicParams.length === 0) return url;\n return url.replace(/\\[([^\\]]+)\\]/g, (match, name) =>\n dynamicParams.includes(name) ? `test_${name}` : match,\n );\n}\n\nfunction dynamicParamsTodo(dynamicParams: string[]): string {\n if (dynamicParams.length === 0) return \"\";\n return `// TODO: customize test fixture values for dynamic route params: ${dynamicParams.join(\", \")}\\n`;\n}\n\nfunction mockValueForField(\n field: Pick<Field, \"name\" | \"type\"> & Partial<Field>,\n relationIdsByCollectionId: Record<string, string>,\n options: { forForm: boolean; authEnabled: boolean },\n): FixtureValue | undefined {\n // A unique field cannot hold the same sample in two records, and the tests\n // create several. `crypto` is a global in the Node versions vitest runs on.\n if (field.unique) {\n const suffix = \"${crypto.randomUUID().slice(0, 8)}\";\n switch (field.type) {\n case \"text\":\n case \"editor\":\n return new RawExpression(`\\`${field.name}-${suffix}\\``);\n case \"email\":\n return new RawExpression(`\\`test-${suffix}@example.com\\``);\n case \"url\":\n return new RawExpression(`\\`https://example.com/${suffix}\\``);\n case \"number\":\n return new RawExpression(\"Math.floor(Math.random() * 1e9)\");\n }\n }\n switch (field.type) {\n case \"text\":\n case \"editor\":\n return `${field.name} value`;\n case \"number\":\n return 42;\n case \"bool\":\n return true;\n case \"date\":\n return GENERATED_DATE;\n case \"email\":\n return `test-${field.name}@example.com`;\n case \"password\":\n return \"password\";\n case \"url\":\n return \"https://example.com\";\n case \"json\":\n return options.forForm\n ? JSON.stringify({ [field.name]: \"value\" })\n : { [field.name]: \"value\" };\n case \"geoPoint\":\n return options.forForm\n ? JSON.stringify({ lat: 40.7128, lon: -74.006 })\n : { lat: 40.7128, lon: -74.006 };\n case \"select\": {\n const value = field.options?.[0]?.value ?? \"default\";\n return field.maxSelect && field.maxSelect > 1 ? [value] : value;\n }\n case \"relation\": {\n if (\n options.authEnabled &&\n (field.isCurrentUser || field.relatedModel?.tableName === \"users\")\n ) {\n return new RawExpression(\"context.user.id\");\n }\n\n const relationId = field.collectionId\n ? relationIdsByCollectionId[field.collectionId]\n : undefined;\n if (relationId) {\n return new RawExpression(relationId);\n }\n return \"missing-relation-id\";\n }\n case \"file\":\n case \"autodate\":\n return undefined;\n default:\n return undefined;\n }\n}\n\nfunction fixtureDataFromFields(\n fields: Field[],\n relationIdsByCollectionId: Record<string, string>,\n options: { forForm: boolean; authEnabled: boolean },\n): Record<string, FixtureValue> {\n const data: Record<string, FixtureValue> = {};\n\n for (const field of fields) {\n if (field.type === \"file\" || field.type === \"autodate\") {\n continue;\n }\n\n if (\n options.authEnabled &&\n field.type === \"relation\" &&\n field.isCurrentUser\n ) {\n if (!options.forForm) {\n data[field.name] = new RawExpression(\"context.user.id\");\n }\n continue;\n }\n\n const value = mockValueForField(field, relationIdsByCollectionId, options);\n if (value !== undefined) {\n data[field.name] = value;\n }\n }\n\n return data;\n}\n\nfunction fixtureDataFromCollectionFields(\n fields: RuntimeCollectionField[],\n relationIdsByCollectionId: Record<string, string>,\n options: Pick<Options, \"features\">,\n): Record<string, FixtureValue> {\n const data: Record<string, FixtureValue> = {};\n\n for (const field of fields) {\n if (field.system || field.name === \"id\") {\n continue;\n }\n\n const type = fieldTypeFromCollectionField(field.type);\n if (!type || type === \"file\" || type === \"autodate\") {\n continue;\n }\n\n if (type === \"relation\" && !field.collectionId) {\n continue;\n }\n\n let value: FixtureValue | undefined;\n if (type === \"relation\") {\n value = field.collectionId\n ? new RawExpression(\n relationIdsByCollectionId[field.collectionId] ??\n '\"missing-relation-id\"',\n )\n : undefined;\n } else if (type === \"select\") {\n const firstValue = field.values?.[0] ?? \"default\";\n value = (field.maxSelect ?? 1) > 1 ? [firstValue] : firstValue;\n } else {\n value = mockValueForField(\n { name: field.name, type },\n relationIdsByCollectionId,\n { forForm: false, authEnabled: options.features.auth },\n );\n }\n\n if (value !== undefined) {\n data[field.name] = value;\n }\n }\n\n return data;\n}\n\nfunction ensureAuthCollectionFixture(data: Record<string, FixtureValue>) {\n data.email = new RawExpression(\n \"`test-${Math.random().toString(36).slice(2)}@example.com`\",\n );\n data.password = \"password\";\n data.passwordConfirm = \"password\";\n}\n\nfunction orderedDependencyCollections(\n collection: Collection | undefined,\n collections: Collection[],\n): Collection[] {\n if (!collection) {\n return [];\n }\n\n const byId = new Map(collections.map((entry) => [entry.id, entry]));\n const visited = new Set<string>();\n const visiting = new Set<string>();\n const ordered: Collection[] = [];\n\n const walk = (collectionId: string) => {\n if (visited.has(collectionId) || visiting.has(collectionId)) {\n return;\n }\n\n const candidate = byId.get(collectionId);\n if (!candidate) {\n return;\n }\n\n visiting.add(collectionId);\n for (const field of candidate.fields as RuntimeCollectionField[]) {\n if (field.type !== \"relation\" || !field.collectionId) {\n continue;\n }\n walk(field.collectionId);\n }\n visiting.delete(collectionId);\n visited.add(collectionId);\n ordered.push(candidate);\n };\n\n for (const field of collection.fields as RuntimeCollectionField[]) {\n if (field.type !== \"relation\" || !field.collectionId) {\n continue;\n }\n walk(field.collectionId);\n }\n\n return ordered;\n}\n\nfunction uniqueVarName(base: string, used: Set<string>): string {\n if (!used.has(base)) {\n used.add(base);\n return base;\n }\n\n let index = 2;\n while (used.has(`${base}${index}`)) {\n index += 1;\n }\n\n const name = `${base}${index}`;\n used.add(name);\n return name;\n}\n\nfunction fallbackCollectionFromFields(\n model: Model,\n fields: Field[],\n): Collection {\n return {\n id: `generated-${model.tableName}`,\n name: model.tableName,\n type: \"base\",\n fields: fields.map((field) => {\n if (field.type === \"relation\") {\n return {\n name: field.name,\n type: field.type,\n collectionId: field.collectionId,\n maxSelect: field.maxSelect,\n };\n }\n\n if (field.type === \"select\") {\n return {\n name: field.name,\n type: field.type,\n maxSelect: field.maxSelect,\n values: field.options.map((option) => option.value),\n };\n }\n\n if (field.type === \"file\" || field.type === \"autodate\") {\n return {\n name: field.name,\n type: field.type,\n maxSelect: field.type === \"file\" ? field.maxSelect : undefined,\n };\n }\n\n return { name: field.name, type: field.type };\n }),\n };\n}\n\nfunction relationDependencyContext(\n model: Model,\n fields: Field[],\n options: Options,\n collections: Collection[],\n) {\n const collection =\n collections.find((entry) => entry.name === model.tableName) ??\n fallbackCollectionFromFields(model, fields);\n\n const dependencies = orderedDependencyCollections(\n collection,\n collections,\n ).filter((entry) => !(options.features.auth && entry.name === \"users\"));\n\n const relationIdsByCollectionId: Record<string, string> = {};\n // The authenticated user stands in for `users`, also where a dependency\n // points at it (`teams.owner`).\n const users = collections.find((entry) => entry.name === \"users\");\n if (options.features.auth && users) {\n relationIdsByCollectionId[users.id] = \"context.user.id\";\n }\n const dependencyVars: Array<{ varName: string; collection: Collection }> = [];\n const usedVarNames = new Set<string>();\n\n for (const dependency of dependencies) {\n const varName = uniqueVarName(\n parseModel(dependency.name).name,\n usedVarNames,\n );\n dependencyVars.push({ varName, collection: dependency });\n relationIdsByCollectionId[dependency.id] = `${varName}.id`;\n }\n\n const declarations = dependencyVars.length\n ? `${dependencyVars.map((dependency) => `let ${dependency.varName}: { id: string };`).join(\"\\n\")}\\n\\n`\n : \"\";\n\n const setupLines = dependencyVars.map(\n ({ varName, collection: dependency }) => {\n const payload = fixtureDataFromCollectionFields(\n dependency.fields as RuntimeCollectionField[],\n relationIdsByCollectionId,\n options,\n );\n if (dependency.type === \"auth\") {\n ensureAuthCollectionFixture(payload);\n }\n return `${varName} = await context.admin.collection(\"${dependency.name}\").create(${fixtureObjectToCode(payload)});`;\n },\n );\n\n const cleanupLines = dependencyVars\n .slice()\n .reverse()\n .map(\n ({ varName, collection: dependency }) =>\n `await context.admin.collection(\"${dependency.name}\").delete(${varName}.id);`,\n );\n\n const requestAgent = options.features.auth\n ? \"context.agent\"\n : \"context.request\";\n const authSetup = options.features.auth\n ? \"await context.agent.authenticateUser();\\n \"\n : \"\";\n\n const hasBeforeEach = setupLines.length > 0 || options.features.auth;\n const hasAfterEach = cleanupLines.length > 0;\n\n let setupSection = \"\";\n if (hasBeforeEach) {\n setupSection += dedent`\n beforeEach(async (context) => {\n ${authSetup}${setupLines.join(\"\\n \")}\n });\n `;\n }\n\n if (hasAfterEach) {\n setupSection +=\n \"\\n\\n\" +\n dedent`\n afterEach(async (context) => {\n ${cleanupLines.join(\"\\n \")}\n });\n `;\n }\n\n // Only the hooks that are used: the projects type-check with noUnusedLocals.\n const vitestImport = `import { ${[\n ...(hasAfterEach ? [\"afterEach\"] : []),\n ...(hasBeforeEach ? [\"beforeEach\"] : []),\n \"describe\",\n \"expect\",\n \"it\",\n ].join(\", \")} } from \"vitest\";`;\n\n return {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelDbData: fixtureObjectToCode(\n fixtureDataFromFields(fields, relationIdsByCollectionId, {\n forForm: false,\n authEnabled: options.features.auth,\n }),\n ),\n modelFormData: fixtureObjectToCode(\n fixtureDataFromFields(fields, relationIdsByCollectionId, {\n forForm: true,\n authEnabled: options.features.auth,\n }),\n ),\n };\n}\n\nexport function generateScaffoldServerTestSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelDbData,\n modelFormData,\n } = relationDependencyContext(model, fields, options, collections);\n\n const list = testizeUrl(urls.list, dynamicParams);\n const newUrl = testizeUrl(urls.new, dynamicParams);\n const show = testizeUrl(urls.show, dynamicParams);\n const edit = testizeUrl(urls.edit, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${model.pluralName}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${list}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${list}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${newUrl}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${newUrl}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${newUrl}\", () => {\n it(\"should create a new ${model.displayName.toLowerCase()}\", async (context) => {\n const response = await ${requestAgent}.post(\"${newUrl}\").type(\"form\").send(${modelFormData});\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(response.body.location);\n expect(response2.status).toBe(200);\n });\n });\n\n describe(\"GET ${show}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n\n it(\"should return a 404 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${show.replace(\"[id]\", \"non-existent\")}\");\n expect(response.status).toBe(404);\n });\n });\n\n describe(\"POST ${show}\", () => {\n it(\"should delete a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.post(\\`${relationUrl(show, \"id\")}\\`).type(\"form\");\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response2.status).toBe(404);\n });\n });\n\n describe(\"GET ${edit}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(edit, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${edit}\", () => {\n it(\"should update a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}\n .post(\\`${relationUrl(edit, \"id\")}\\`)\n .type(\"form\")\n .send(${modelFormData});\n expect(response.body.status).toBe(303);\n expect(response.body.location).toBe(\\`${relationUrl(show, \"id\")}\\`);\n });\n });\n });\n `;\n}\n\nexport function generateScaffoldRemoteServerTestSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelDbData,\n } = relationDependencyContext(model, fields, options, collections);\n\n const list = testizeUrl(urls.list, dynamicParams);\n const newUrl = testizeUrl(urls.new, dynamicParams);\n const show = testizeUrl(urls.show, dynamicParams);\n const edit = testizeUrl(urls.edit, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${model.pluralName}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${list}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${list}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${newUrl}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${newUrl}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"GET ${show}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n\n it(\"should return a 404 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${show.replace(\"[id]\", \"non-existent\")}\");\n expect(response.status).toBe(404);\n });\n });\n\n describe(\"POST ${show}\", () => {\n it(\"should delete a ${model.displayName.toLowerCase()}\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.post(\\`${relationUrl(show, \"id\")}\\`).type(\"form\");\n expect(response.body.status).toBe(303);\n\n const response2 = await ${requestAgent}.get(\\`${relationUrl(show, \"id\")}\\`);\n expect(response2.status).toBe(404);\n });\n });\n\n describe(\"GET ${edit}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const { id } = await context.admin.collection(\"${model.tableName}\").create(${modelDbData});\n const response = await ${requestAgent}.get(\\`${relationUrl(edit, \"id\")}\\`);\n expect(response.status).toBe(200);\n });\n });\n });\n `;\n}\n\nexport function generateFormServerTestSnippet(\n model: Model,\n formUrl: string,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const {\n declarations,\n vitestImport,\n setupSection,\n requestAgent,\n modelFormData,\n } = relationDependencyContext(model, fields, options, collections);\n\n const url = testizeUrl(formUrl, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${url}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${url}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${url}\");\n expect(response.status).toBe(200);\n });\n });\n\n describe(\"POST ${url}\", () => {\n it(\"should submit the form successfully\", async (context) => {\n const response = await ${requestAgent}.post(\"${url}\").type(\"form\").send(${modelFormData});\n expect(response.body.status).toBe(200);\n });\n });\n });\n `;\n}\n\nexport function generateFormRemoteServerTestSnippet(\n model: Model,\n formUrl: string,\n fields: Field[],\n options: Options,\n collections: Collection[],\n dynamicParams: string[] = [],\n): string {\n const { declarations, vitestImport, setupSection, requestAgent } =\n relationDependencyContext(model, fields, options, collections);\n\n const url = testizeUrl(formUrl, dynamicParams);\n const todo = dynamicParamsTodo(dynamicParams);\n\n return dedent`\n ${vitestImport}\n\n ${todo}describe(\"${url}\", () => {\n ${declarations}${setupSection}\n\n describe(\"GET ${url}\", () => {\n it(\"should return a 200 status code\", async (context) => {\n const response = await ${requestAgent}.get(\"${url}\");\n expect(response.status).toBe(200);\n });\n });\n });\n `;\n}\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n getFieldComponents,\n getFieldImports,\n renderField,\n selectFieldLabelMap,\n} from \"../../../core/field\";\nimport {\n NATIVE_STYLE,\n geoPointState,\n plainRenderer,\n superformsBinding,\n usesConstraints,\n} from \"../../../core/field/plain\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport { SUPERFORMS, VELASTACK_POCKETBASE, ZOD } from \"../../../core/constants\";\nimport { REQUIRE_USER_IMPORT } from \"../../../core/field/remote\";\nimport {\n isProtectedRoute,\n parseRoute,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport { generateFormServerTestSnippet } from \"../../../core/tests\";\nimport {\n generateSchemaSnippet,\n relationLoadLines,\n relationLoadReturnVars,\n resolveInputFields,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fieldDefs: fields };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\nfunction injectableHiddenInputs(injectables: Injectables): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input type=\"hidden\" name=\"${field.name}\" value=\"${value}\" />`,\n )\n .join(\"\\n\");\n}\n\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth ? \"locals.pb\" : \"locals.admin\";\n}\n\n/**\n * The relation field renderers read the related records from\n * `data.<pluralName>`, so `load` has to fetch them.\n */\nfunction relationLoad(fields: Field[], pb: string) {\n const vars = relationLoadReturnVars(fields);\n return {\n args: vars ? \"{ locals }\" : \"\",\n lines: relationLoadLines(fields, pb),\n returns: vars ? `, ${vars}` : \"\",\n };\n}\n\nfunction pageImports(model: Model, fields: Field[]): string[] {\n const components = getFieldComponents(fields);\n const imports = [\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zod4Client } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";`,\n ...getFieldImports(components),\n ];\n\n return [...new Set(imports)];\n}\n\nfunction pageScriptSnippet(model: Model, fields: Field[]): string {\n const selectFields = fields.filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n );\n const labelMaps = selectFields\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n\n return dedent`\n ${labelMaps}\n\n const form = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n const { form: formData } = form;\n `;\n}\n\nfunction pageSnippet(\n model: Model,\n fields: Field[],\n injectables: Injectables,\n): string {\n const imports = pageImports(model, fields).join(\"\\n\");\n const scriptSnippet = pageScriptSnippet(model, fields);\n const fieldSnippet = fields.map((field) => renderField(field)).join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n let { data } = $props();\n ${scriptSnippet}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName}</h1>\n </div>\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldSnippet}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button>Submit</Form.Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\n/**\n * The same page without shadcn-svelte, formsnap or tailwind: native elements\n * bound to the superforms stores. Without flash messages the action's\n * `message()` is shown inline.\n */\nfunction plainPageSnippet(\n model: Model,\n fields: Field[],\n injectables: Injectables,\n flash: boolean,\n): string {\n const renderer = plainRenderer(superformsBinding(), NATIVE_STYLE);\n const fieldSnippet = fields.map((field) => renderer.render(field)).join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const stores = [\n \"form: formData\",\n \"errors\",\n ...(usesConstraints(fields) ? [\"constraints\"] : []),\n ...(flash ? [] : [\"message\"]),\n \"enhance\",\n ].join(\", \");\n const status = flash\n ? \"\"\n : dedent`\n {#if $message}\n <p role=\"status\">{$message}</p>\n {/if}\n `;\n\n return dedent`\n <script lang=\"ts\">\n import { untrack } from \"svelte\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n let { data } = $props();\n\n const { ${stores} } = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n ${geoPointState(fields)}\n </script>\n\n <h1>${model.displayName}</h1>\n\n ${status}\n\n <form method=\"POST\"${enctype} use:enhance>\n ${fieldSnippet}\n ${hiddenInputs}\n <button type=\"submit\">Submit</button>\n </form>\n `;\n}\n\nfunction genericServerSnippet(\n model: Model,\n fields: Field[],\n pb: string,\n flash: boolean,\n): string {\n const withFiles = hasFiles(fields) && flash;\n const relations = relationLoad(fields, pb);\n const imports = dedent`\n import { fail, ${flash ? \"\" : \"message, \"}superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n ${flash ? 'import { setFlash } from \"sveltekit-flash-message/server\";' : \"\"}\n `;\n // `message()` strips files from the returned form itself.\n const success = flash\n ? dedent`\n setFlash({ type: \"toast\", message: \"Form posted successfully\" }, cookies);\n\n return ${withFiles ? \"withFiles({ form })\" : \"{ form }\"};\n `\n : 'return message(form, \"Form posted successfully\");';\n\n return dedent`\n ${imports}\n\n export const load = async (${relations.args}) => {\n ${relations.lines}\n const form = await superValidate(zod4(${model.schemaName}));\n return { form${relations.returns} };\n };\n\n export const actions = {\n default: async ({ request${flash ? \", cookies\" : \"\"} }) => {\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, { form });\n }\n\n ${success}\n }\n };\n `;\n}\n\nfunction createServerSnippet(\n model: Model,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n authMode: boolean,\n flash: boolean,\n guard: boolean,\n): string {\n const withFiles = hasFiles(fields);\n const relations = relationLoad(fields, pb);\n const success = flash\n ? dedent`\n setFlash({ type: \"toast\", message: \"${model.displayName} created\" }, cookies);\n\n return ${withFiles ? \"withFiles({ form })\" : \"{ form }\"};\n `\n : `return message(form, \"${model.displayName} created\");`;\n const { currentUserField, currentTeamField } = injectables;\n const injections: string[] = [];\n // The record's owner is the signed-in user. In the protected group there\n // is one, and `requireUser()` says so; a public form may have none.\n const usesUser = guard && authMode && Boolean(currentUserField);\n if (authMode && currentUserField) {\n injections.push(\n `${currentUserField.name}: ${usesUser ? \"user.id\" : \"locals.pb.authStore.record?.id\"}`,\n );\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...form.data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"form.data\";\n\n return dedent`\n import { fail } from \"@sveltejs/kit\";\n import { ${flash ? \"\" : \"message, \"}superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\n ${flash ? 'import { setFlash } from \"sveltekit-flash-message/server\";' : \"\"}\n ${usesUser ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const load = async (${relations.args}) => {\n ${relations.lines}\n return { form: await superValidate(zod4(${model.schemaName}))${relations.returns} };\n };\n\n export const actions = {\n default: async ({ locals, request${flash ? \", cookies\" : \"\"} }) => {\n ${usesUser ? \"const user = requireUser();\" : \"\"}\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n try {\n await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n ${success}\n }\n };\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const route = parseRoute(options.input.route, model, options, \"form\");\n const guard = isProtectedRoute(route, options);\n const ui = resolveUi(options);\n const flash = options.input.flash ?? true;\n const serverTests = options.input.serverTests ?? true;\n\n // When fields were derived from an existing collection (no fieldDefs given),\n // generate a server action that creates a record in that collection. When\n // fields were explicitly provided, keep generic-form behavior (validate +\n // flash, no DB write) — the user has signaled custom field shape.\n const createMode = !shouldCreateCollection;\n const injectables = createMode ? findInjectables(fields) : {};\n const uiFields = createMode\n ? fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n )\n : fields;\n\n const serverContent = createMode\n ? createServerSnippet(\n model,\n uiFields,\n injectables,\n pbInstance(options),\n options.features.auth,\n flash,\n guard,\n )\n : genericServerSnippet(model, uiFields, pbInstance(options), flash);\n\n const creates = [\n toFile(\n `${route.fileBase}/+page.svelte`,\n ui === \"plain\"\n ? plainPageSnippet(model, uiFields, injectables, flash)\n : pageSnippet(model, uiFields, injectables),\n ),\n toFile(`${route.fileBase}/+page.server.ts`, serverContent),\n ...(serverTests\n ? [\n toFile(\n `${route.fileBase}/server.test.ts`,\n generateFormServerTestSnippet(\n model,\n route.urlBase,\n fields,\n options,\n collections,\n route.dynamicParams,\n ),\n ),\n ]\n : []),\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: false,\n forForm: true,\n }),\n ),\n ];\n\n // Plain markup needs nothing from the shadcn-svelte registry.\n const components =\n ui === \"plain\" ? [] : (getFieldComponents(uiFields) as Component[]);\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n packages: [\n SUPERFORMS,\n ZOD,\n // `requireUser` in the action\n ...(createMode &&\n guard &&\n options.features.auth &&\n injectables.currentUserField\n ? [VELASTACK_POCKETBASE]\n : []),\n ],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-form\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/generate/form\";\nconst DOCS = \"/generate/form\";\n\n// Generate entrypoint for the pattern. This function is roughly the same for all patterns.\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a form\",\n summary: \"Generates a form.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"sveltekit\", \"superforms\", \"validation\", \"zod\"],\n\n command: {\n raw: \"vela generate form contact name:text email:email message:editor\",\n base: \"vela generate form\",\n argv: [\"contact\", \"name:text\", \"email:email\", \"message:editor\"],\n },\n\n examples: [\n {\n command: \"contact name:text! email:email! message:editor\",\n description: \"Contact form with required text fields and a rich editor.\",\n },\n {\n command: \"profile avatar:file bio:editor website:url\",\n description: \"File upload, editor, and URL validation.\",\n },\n {\n command: \"feedback rating:select(1,2,3,4,5) comment:editor\",\n description: \"Select enum with a long-form comment.\",\n },\n {\n command:\n 'project name:text! description:editor --route \"(app)/[team_id]/projects/new\"',\n description:\n \"Team-scoped create form. Schema lives at /lib/schemas/project.ts; the form lives under the dynamic team route.\",\n },\n ],\n\n tests: 2,\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n getRemoteFieldComponents,\n getRemoteFieldImports,\n renderRemoteField,\n REQUIRE_USER_IMPORT,\n requireUserLines,\n} from \"../../../core/field/remote\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport { VELASTACK_POCKETBASE, ZOD } from \"../../../core/constants\";\nimport {\n isProtectedRoute,\n parseRoute,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport { generateFormRemoteServerTestSnippet } from \"../../../core/tests\";\nimport {\n generateSchemaSnippet,\n resolveInputFields,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fieldDefs: fields };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction submitFormIdentifier(model: Model): string {\n return `submit${model.typeName}Form`;\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\nfunction injectableHiddenInputs(\n injectables: Injectables,\n formVar: string,\n): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input {...${formVar}.fields.${field.name}.as(\"hidden\", \"${value}\")} />`,\n )\n .join(\"\\n\");\n}\n\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth ? \"locals.pb\" : \"locals.admin\";\n}\n\nfunction pageImports(fields: Field[], formVar: string): string[] {\n const components = getRemoteFieldComponents(fields);\n const imports = [\n `import { ${formVar} } from \"./form.remote\";`,\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n ...getRemoteFieldImports(components),\n ];\n\n return [...new Set(imports)];\n}\n\nfunction pageSnippet(\n model: Model,\n fields: Field[],\n formVar: string,\n injectables: Injectables,\n): string {\n const imports = pageImports(fields, formVar).join(\"\\n\");\n const fieldSnippet = fields\n .map((field) => renderRemoteField(field, { formVar }))\n .join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName}</h1>\n </div>\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form {...${formVar}}${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldSnippet}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Button type=\"submit\">Submit</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\n/** The same page with native elements only; see `NATIVE_STYLE`. */\nfunction plainPageSnippet(\n model: Model,\n fields: Field[],\n formVar: string,\n injectables: Injectables,\n flash: boolean,\n): string {\n const fieldSnippet = fields\n .map((field) => renderRemoteField(field, { formVar, native: true }))\n .join(\"\\n\");\n const hiddenInputs = injectableHiddenInputs(injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const status = flash\n ? \"\"\n : dedent`\n {#if ${formVar}.result?.success}\n <p role=\"status\">Form posted successfully</p>\n {/if}\n `;\n\n return dedent`\n <script lang=\"ts\">\n import { ${formVar} } from \"./form.remote\";\n </script>\n\n <h1>${model.displayName}</h1>\n\n ${status}\n\n <form {...${formVar}}${enctype}>\n ${fieldSnippet}\n ${hiddenInputs}\n <button type=\"submit\">Submit</button>\n </form>\n `;\n}\n\nfunction genericRemoteSnippet(\n model: Model,\n formVar: string,\n flash: boolean,\n guard: boolean,\n): string {\n if (!flash) {\n return dedent`\n import { form } from \"$app/server\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async () => {\n ${requireUserLines(guard, false)}\n return { success: true };\n });\n `;\n }\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n import { setFlash } from \"sveltekit-flash-message/server\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async (data) => {\n ${requireUserLines(guard, false)}\n const { cookies } = getRequestEvent();\n setFlash({ type: \"toast\", message: \"Form posted successfully\" }, cookies);\n return { success: true };\n });\n `;\n}\n\nfunction createRemoteSnippet(\n model: Model,\n formVar: string,\n injectables: Injectables,\n pb: string,\n authMode: boolean,\n flash: boolean,\n guard: boolean,\n): string {\n const { currentUserField, currentTeamField } = injectables;\n const injections: string[] = [];\n const usesUser = authMode && Boolean(currentUserField);\n if (authMode && currentUserField) {\n injections.push(\n `${currentUserField.name}: ${guard ? \"user.id\" : \"locals.pb.authStore.record?.id\"}`,\n );\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"data\";\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n ${flash ? 'import { setFlash } from \"sveltekit-flash-message/server\";' : \"\"}\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async (data) => {\n ${requireUserLines(guard, usesUser)}\n const { locals${flash ? \", cookies\" : \"\"} } = getRequestEvent();\n await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n ${flash ? `setFlash({ type: \"toast\", message: \"${model.displayName} created\" }, cookies);` : \"\"}\n return { success: true };\n });\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const route = parseRoute(options.input.route, model, options, \"form\");\n const formVar = submitFormIdentifier(model);\n const guard = isProtectedRoute(route, options);\n const ui = resolveUi(options);\n const flash = options.input.flash ?? true;\n const serverTests = options.input.serverTests ?? true;\n\n // When fields were derived from an existing collection (no fieldDefs given),\n // generate a remote form that creates a record. When fields were explicitly\n // provided, keep generic-form behavior (validate + flash, no DB write).\n const createMode = !shouldCreateCollection;\n const injectables = createMode ? findInjectables(fields) : {};\n const uiFields = createMode\n ? fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n )\n : fields;\n\n const remoteContent = createMode\n ? createRemoteSnippet(\n model,\n formVar,\n injectables,\n pbInstance(options),\n options.features.auth,\n flash,\n guard,\n )\n : genericRemoteSnippet(model, formVar, flash, guard);\n\n const creates = [\n toFile(\n `${route.fileBase}/+page.svelte`,\n ui === \"plain\"\n ? plainPageSnippet(model, uiFields, formVar, injectables, flash)\n : pageSnippet(model, uiFields, formVar, injectables),\n ),\n toFile(`${route.fileBase}/form.remote.ts`, remoteContent),\n ...(serverTests\n ? [\n toFile(\n `${route.fileBase}/server.test.ts`,\n generateFormRemoteServerTestSnippet(\n model,\n route.urlBase,\n fields,\n options,\n collections,\n route.dynamicParams,\n ),\n ),\n ]\n : []),\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: false,\n forForm: true,\n remote: true,\n }),\n ),\n ];\n\n // Plain markup needs nothing from the shadcn-svelte registry.\n const components =\n ui === \"plain\" ? [] : (getRemoteFieldComponents(uiFields) as Component[]);\n if (ui !== \"plain\" && !components.includes(\"button\")) {\n components.push(\"button\");\n }\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n packages: [ZOD, ...(guard ? [VELASTACK_POCKETBASE] : [])],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"generate-form-remote\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/generate/form-remote\";\nconst DOCS = \"/generate/form\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { modifyOutcomeToFile } = await import(\"../../../runtime/modify-file\");\n const { modifySvelteConfigRemote } =\n await import(\"../../../runtime/modify-svelte-config-remote\");\n const logger = getLogger(options);\n logger.info(\"Modifying config for remote functions\");\n const remote = modifySvelteConfigRemote(options.root);\n const svelteConfigFile = modifyOutcomeToFile(remote.filePath, remote.outcome);\n\n const runtimeRes = {\n ...baseRes,\n modifies: [\n ...baseRes.modifies,\n ...(svelteConfigFile ? [svelteConfigFile] : []),\n ],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(runtimeRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a form (remote functions)\",\n summary:\n \"Generates a form using SvelteKit remote functions instead of sveltekit-superforms.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"sveltekit\", \"remote-functions\", \"validation\", \"zod\"],\n\n command: {\n raw: \"vela generate form --remote contact name:text email:email message:editor\",\n base: \"vela generate form --remote\",\n argv: [\"contact\", \"name:text\", \"email:email\", \"message:editor\"],\n },\n\n examples: [\n {\n command: \"contact name:text! email:email! message:editor\",\n description: \"Contact form using remote functions.\",\n },\n {\n command: \"profile avatar:file bio:editor website:url\",\n description: \"File upload (multipart) + editor + URL validation.\",\n },\n {\n command: \"feedback rating:select(1,2,3,4,5) comment:editor\",\n description: \"Select enum with a long-form comment.\",\n },\n {\n command:\n 'project name:text! description:editor --route \"(app)/[team_id]/projects/new\"',\n description:\n \"Team-scoped create form using remote functions and a dynamic route param.\",\n },\n ],\n\n tests: 1,\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import pluralize from \"pluralize\";\nimport type { FieldChange, Options, Result } from \"../../../core/types\";\nimport type { Field, Model } from \"../../../parse\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport {\n loadCollections,\n toCollectionFieldSpec,\n uniqueIndexes,\n} from \"../../../core/shared\";\nimport { parseModel, resolveFields, validateModelName } from \"../../../parse\";\n\ntype Op = \"add\" | \"remove\" | \"rename\" | \"references\";\nconst VALID_OPS: ReadonlySet<Op> = new Set<Op>([\n \"add\",\n \"remove\",\n \"rename\",\n \"references\",\n]);\n\nfunction parsePatternArgs(argv: string[]): {\n collectionName: string;\n op: Op;\n rest: string[];\n} {\n const [collectionName, op, ...rest] = argv;\n if (!collectionName || !op) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <collection> <add|remove|rename|references> <args...>\",\n );\n }\n if (!VALID_OPS.has(op as Op)) {\n throw new InvalidArgumentError(\n `Invalid op: \"${op}\". Expected one of: add, remove, rename, references`,\n );\n }\n return { collectionName, op: op as Op, rest };\n}\n\n/**\n * A migration as the collection sees it (`result`) and as the parsed fields\n * it was made from, which is what the zod schema is patched with.\n */\nexport interface ResolvedMigration {\n result: Result;\n model: Model;\n /** The fields an `add` or `references` adds, as parsed. */\n added: Field[];\n changes: FieldChange[];\n}\n\nexport async function generate(options: Options): Promise<Result> {\n return (await resolveMigration(options)).result;\n}\n\nexport async function resolveMigration(\n options: Options,\n): Promise<ResolvedMigration> {\n const { collectionName, op, rest } = parsePatternArgs(options.argv);\n validateModelName(collectionName);\n\n const collections = await loadCollections(options);\n const collection = collections.find((c) => c.name === collectionName);\n if (!collection) {\n throw new InvalidArgumentError(`Collection \"${collectionName}\" not found`);\n }\n\n const parent = parseModel(collectionName);\n const existingNames = new Set(collection.fields.map((f) => f.name));\n const changes: FieldChange[] = [];\n let indexes: string[] = [];\n let added: Field[] = [];\n\n if (op === \"add\" || op === \"references\") {\n const fieldDefs =\n op === \"references\"\n ? [referencesFieldDef(rest)]\n : requireNonEmpty(\n rest,\n \"Expected at least one field definition for add\",\n );\n\n const { fields } = resolveFields(fieldDefs, parent, collections, options);\n for (const field of fields) {\n if (existingNames.has(field.name)) {\n throw new InvalidArgumentError(\n `Field \"${field.name}\" already exists on collection \"${collectionName}\"`,\n );\n }\n changes.push({ op: \"add\", field: toCollectionFieldSpec(field) });\n }\n indexes = uniqueIndexes({ tableName: collectionName }, fields);\n added = fields;\n } else if (op === \"remove\") {\n const fieldNames = requireNonEmpty(\n rest,\n \"Expected at least one field name for remove\",\n );\n for (const fieldName of fieldNames) {\n if (!existingNames.has(fieldName)) {\n throw new InvalidArgumentError(\n `Field \"${fieldName}\" does not exist on collection \"${collectionName}\"`,\n );\n }\n changes.push({ op: \"remove\", fieldName });\n }\n } else {\n if (rest.length !== 2) {\n throw new InvalidArgumentError(\n `Expected exactly two arguments for rename (old and new), got ${rest.length}`,\n );\n }\n const [from, to] = rest;\n if (!existingNames.has(from)) {\n throw new InvalidArgumentError(\n `Field \"${from}\" does not exist on collection \"${collectionName}\"`,\n );\n }\n if (existingNames.has(to)) {\n throw new InvalidArgumentError(\n `Field \"${to}\" already exists on collection \"${collectionName}\"`,\n );\n }\n changes.push({ op: \"rename\", from, to });\n }\n\n const result = {\n creates: [],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [\n { collectionName, changes, ...(indexes.length > 0 ? { indexes } : {}) },\n ],\n collectionDrops: [],\n } satisfies Result;\n\n return { result, model: parent, added, changes };\n}\n\nfunction referencesFieldDef(rest: string[]): string {\n if (rest.length !== 1) {\n throw new InvalidArgumentError(\n `Expected exactly one argument for references, got ${rest.length}`,\n );\n }\n const ref = rest[0];\n const target = pluralize.plural(pluralize.singular(ref));\n return `${ref}:${target}`;\n}\n\nfunction requireNonEmpty(rest: string[], message: string): string[] {\n if (rest.length === 0) {\n throw new InvalidArgumentError(message);\n }\n return rest;\n}\n","import type { File, Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { resolveMigration } from \"./generate\";\n\nconst SLUG = \"generate-migration\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/generate/migration\";\nconst DOCS = \"/generate/migration\";\n\nexport async function generate(options: Options) {\n const migration = await resolveMigration(options);\n const baseRes = migration.result;\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { applyCollectionFieldsPatches } =\n await import(\"../../../runtime/collections\");\n const { withPocketbase } = await import(\"../../../runtime/pocketbase\");\n\n const logger = getLogger(options);\n let migrationCreates: File[] = [];\n await withPocketbase(options.root, async (pb) => {\n migrationCreates = await applyCollectionFieldsPatches(\n pb,\n baseRes.collectionPatches,\n options,\n logger,\n );\n });\n\n // After the collection changed, so the schema never runs ahead of it.\n // `generate resource` and the scaffolds wrote this file; one that is not\n // there is nobody's to patch.\n const { modifySchemaForMigration } = await import(\"./modifies/schema\");\n logger.info(\"Updating the zod schema\");\n const schemaFile = modifySchemaForMigration(options.root, migration);\n\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n modifies: [...baseRes.modifies, ...(schemaFile ? [schemaFile] : [])],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(runtimeRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a migration\",\n summary:\n \"Adds, removes, renames, or references fields on an existing collection.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"pocketbase\", \"migration\", \"schema\"],\n\n command: {\n raw: \"vela generate migration users add birthday:date\",\n base: \"vela generate migration\",\n argv: [\"users\", \"add\", \"birthday:date\"],\n },\n\n examples: [\n {\n command: \"posts add title:text! body:editor\",\n description: \"Add two fields to the posts collection.\",\n },\n {\n command: \"posts remove legacy_flag\",\n description: \"Drop a deprecated field from the posts collection.\",\n },\n {\n command: \"posts rename title heading\",\n description: \"Rename a field on the posts collection.\",\n },\n {\n command: \"posts references users\",\n description: \"Add a multi-relation field named users (maxSelect: 999).\",\n },\n {\n command: \"posts references user\",\n description: \"Add a single-relation field named user (maxSelect: 1).\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n collectionSpecFromModelFields,\n generateSchemaSnippet,\n resolveInputFields,\n rulesModeForCreate,\n rulesNotes,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n\n if (collections.some((collection) => collection.name === model.tableName)) {\n throw new InvalidArgumentError(\n `Collection \"${model.tableName}\" already exists. To update the schema to the latest definition, run vela generate schema ${model.tableName}`,\n );\n }\n\n const rules = rulesModeForCreate(options, model, shouldCreateCollection);\n\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const schema = generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n });\n\n return {\n creates: [toFile(schemaPath, schema)],\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth, rules)]\n : [],\n collectionPatches: [],\n collectionDrops: [],\n notes: rulesNotes(model, rules),\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { withNotes } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-resource\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/generate/resource\";\nconst DOCS = \"/generate/resource\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return withNotes(\n await writeResult(await formatResult(runtimeRes, options), options),\n baseRes,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a resource\",\n summary: \"Generates model schema resources.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"pocketbase\", \"resource\", \"schema\"],\n\n command: {\n raw: \"vela generate resource contact name:text email:email\",\n base: \"vela generate resource\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"articles title:text! body:editor author:current_user\",\n description: \"Content model with an auth-bound author relation.\",\n },\n {\n command: \"projects name:text! status:select(active:Active,done:Done)\",\n description: \"Resource with an enum status field.\",\n },\n {\n command: \"comment body:editor! author:current_user\",\n description: \"Auth-bound comment with rich-text body.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { Field } from \"../../parse\";\n\n/**\n * Native markup showing one field of a record, for pages without\n * shadcn-svelte: a list page's table cell and a detail page's `<dd>`.\n * `record` is the expression the record is in (`contact`, `data.contact`).\n *\n * Select fields read the `<name>Labels` map the page declares (see\n * `selectFieldLabelMap`); relations read the record's `expand`, so the load\n * has to expand them.\n */\nexport function renderPlainValue(field: Field, record: string): string {\n const value = `${record}.${field.name}`;\n\n switch (field.type) {\n case \"text\":\n case \"number\":\n case \"email\":\n case \"editor\":\n return `{${value}}`;\n case \"password\":\n return \"********\";\n case \"bool\":\n return `{${value} ? \"Yes\" : \"No\"}`;\n case \"date\":\n case \"autodate\":\n return `{${value} ? new Date(${value}).toLocaleDateString() : \"\"}`;\n case \"url\":\n return dedent`\n {#if ${value}}\n <a href={${value}}>{${value}}</a>\n {/if}\n `;\n case \"json\":\n return `{JSON.stringify(${value})}`;\n case \"geoPoint\":\n return dedent`\n {#if ${value}}\n {${value}.lat.toFixed(6)}, {${value}.lon.toFixed(6)}\n {/if}\n `;\n case \"select\":\n return field.maxSelect > 1\n ? `{${value}?.map((option) => ${field.name}Labels[option].label).join(\", \")}`\n : `{${value} ? ${field.name}Labels[${value}].label : \"\"}`;\n case \"relation\": {\n const expanded = `${record}.expand?.${field.name}`;\n return field.maxSelect > 1\n ? `{${expanded}?.map((${field.singularRelationName}) => ${field.singularRelationName}.${field.displayField}).join(\", \")}`\n : `{${expanded}?.${field.displayField}}`;\n }\n case \"file\": {\n const href = (filename: string) =>\n `/api/files/{${record}.collectionId}/{${record}.id}/{${filename}}`;\n return field.maxSelect > 1\n ? dedent`\n {#each ${value} ?? [] as filename (filename)}\n <a href=\"${href(\"filename\")}\">{filename}</a>\n {/each}\n `\n : dedent`\n {#if ${value}}\n <a href=\"${href(value)}\">{${value}}</a>\n {/if}\n `;\n }\n default: {\n const exhaustiveType: never = field;\n return exhaustiveType;\n }\n }\n}\n","const DYNAMIC_PARAM_RE = /\\[([^\\]]+)\\]/g;\n\nfunction interpolateParams(template: string, paramSource: string): string {\n return template.replace(\n DYNAMIC_PARAM_RE,\n (_, name) => `\\${${paramSource}.${name}}`,\n );\n}\n\n/**\n * JS source for a URL value: a quoted string when the URL has no dynamic\n * params, otherwise a template literal that interpolates them via\n * `${paramSource.<name>}`.\n *\n * urlJsExpr(\"/projects\", []) => '\"/projects\"'\n * urlJsExpr(\"/[team_id]/projects\", [\"team_id\"])\n * => '`/${params.team_id}/projects`'\n */\nexport function urlJsExpr(\n template: string,\n dynamicParams: string[],\n paramSource = \"params\",\n): string {\n if (dynamicParams.length === 0) {\n return JSON.stringify(template);\n }\n return `\\`${interpolateParams(template, paramSource)}\\``;\n}\n\n/**\n * JS template-literal source for a URL value followed by a JS-template-literal\n * suffix (already containing any `${...}` interpolations the caller wants).\n * Always returns a template literal — even with no dynamic params — because\n * the suffix usually carries one.\n *\n * urlJsExprWithSuffix(\"/projects\", [], \"/${id}\")\n * => '`/projects/${id}`'\n * urlJsExprWithSuffix(\"/[team_id]/projects\", [\"team_id\"], \"/${id}\")\n * => '`/${params.team_id}/projects/${id}`'\n */\nexport function urlJsExprWithSuffix(\n template: string,\n dynamicParams: string[],\n suffix: string,\n paramSource = \"params\",\n): string {\n const head =\n dynamicParams.length === 0\n ? template\n : interpolateParams(template, paramSource);\n return `\\`${head}${suffix}\\``;\n}\n\n/**\n * Svelte attribute source for a URL — the `=` sign and value together, so the\n * caller writes the attribute name then drops this in:\n *\n * `<Button href${urlSvelteAttrValue(url, params)}>`\n *\n * Result:\n * urlSvelteAttrValue(\"/projects\", []) => '=\"/projects\"'\n * urlSvelteAttrValue(\"/[team_id]/projects\", [\"team_id\"])\n * => '={`/${params.team_id}/projects`}'\n *\n * `svelteSuffix` lets the caller append additional path segments that may\n * themselves contain Svelte mustache interpolations like `/{data.x.id}`. In\n * the dynamic case those `{var}` segments are converted to JS `${var}` so the\n * whole expression becomes a single template literal.\n *\n * urlSvelteAttrValue(\"/projects\", [], \"/{data.x.id}/edit\")\n * => '=\"/projects/{data.x.id}/edit\"'\n * urlSvelteAttrValue(\"/[team_id]/projects\", [\"team_id\"], \"/{data.x.id}/edit\")\n * => '={`/${params.team_id}/projects/${data.x.id}/edit`}'\n */\nexport function urlSvelteAttrValue(\n template: string,\n dynamicParams: string[],\n svelteSuffix = \"\",\n paramSource = \"params\",\n): string {\n if (dynamicParams.length === 0) {\n return `=\"${template}${svelteSuffix}\"`;\n }\n // Convert Svelte mustache `{var}` to JS `${var}`, but leave any preexisting\n // `${var}` alone (negative lookbehind on `$`).\n const jsSuffix = svelteSuffix.replace(/(?<!\\$)\\{([^}]+)\\}/g, \"${$1}\");\n return `={\\`${interpolateParams(template, paramSource)}${jsSuffix}\\`}`;\n}\n\n/**\n * Substitute dynamic params with `test_<name>` placeholders. Used in generated\n * test fixtures where param values must be supplied as literals.\n */\nexport function testFixtureUrl(template: string): string {\n return template.replace(DYNAMIC_PARAM_RE, (_, name) => `test_${name}`);\n}\n","import dedent from \"dedent\";\nimport type { Field, Model, ScaffoldUrls, SelectField } from \"../parse\";\nimport { selectFieldLabelMap } from \"./field\";\nimport { renderPlainValue } from \"./field/plain-display\";\nimport { urlJsExprWithSuffix, urlSvelteAttrValue } from \"./url\";\n\n/**\n * The list page of the scaffold generators (`generate-scaffold` and\n * `generate-scaffold-remote` share it): a TanStack Table v9 data table built\n * from the helpers under `src/ui/components`, or a native `<table>` without\n * shadcn-svelte.\n */\n\nfunction selectFields(fields: Field[]): SelectField[] {\n return fields.filter(\n (field): field is SelectField => field.type === \"select\",\n );\n}\n\nfunction labelMaps(fields: Field[]): string {\n return selectFields(fields)\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\n/** `params` is declared only where a URL interpolates a dynamic segment (noUnusedLocals). */\nfunction propsLine(dynamicParams: string[]): string {\n return dynamicParams.length > 0\n ? \"let { data, params } = $props();\"\n : \"let { data } = $props();\";\n}\n\n/** The column the search box filters: the first free-text one, if any. */\nfunction searchField(fields: Field[]): Field | undefined {\n return fields.find((field) => [\"text\", \"email\", \"url\"].includes(field.type));\n}\n\n/**\n * The filter each filterable column registers. A facet sets an array of\n * option values: a single select matches one of them exactly (`arrHas`), a\n * multi select any of its own (`arrIncludesSome`).\n */\nfunction filterFnName(field: Field, search: Field | undefined): string | null {\n if (field === search) return \"includesString\";\n if (field.type === \"select\") {\n return field.maxSelect > 1 ? \"arrIncludesSome\" : \"arrHas\";\n }\n return null;\n}\n\nfunction cellSnippet(field: Field): string {\n const component = `Cells.${field.type.charAt(0).toUpperCase() + field.type.slice(1)}Cell`;\n switch (field.type) {\n case \"relation\":\n return `({ getValue, row }) => renderComponent(${component}, { value: getValue(), expanded: row.original.expand?.${field.name}, displayField: \"${field.displayField}\" })`;\n case \"select\":\n return `({ getValue }) => renderComponent(${component}, { value: getValue(), options: ${field.name}Labels })`;\n case \"file\":\n return `({ getValue, row }) => renderComponent(${component}, { value: getValue(), collectionId: row.original.collectionId, id: row.original.id })`;\n default:\n return `({ getValue }) => renderComponent(${component}, { value: getValue() })`;\n }\n}\n\nexport function listPageSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const selects = selectFields(fields);\n const search = searchField(fields);\n const hasFilters = Boolean(search) || selects.length > 0;\n const filterFns = [\n ...new Set(\n fields\n .map((field) => filterFnName(field, search))\n .filter((name): name is string => name !== null),\n ),\n ];\n\n const newHref = urlSvelteAttrValue(urls.new, dynamicParams);\n const rowPath = (suffix: string) =>\n urlJsExprWithSuffix(\n urls.list,\n dynamicParams,\n `/\\${row.original.id}${suffix}`,\n );\n\n const columnDefs = fields\n .map((field) => {\n const filterFn = filterFnName(field, search);\n return dedent`\n columnHelper.accessor(\"${field.name}\", {\n header: ({ column }) => renderComponent(ColumnHeader, { column, title: \"${field.title}\" }),\n cell: ${cellSnippet(field)},${filterFn ? `\\nfilterFn: \"${filterFn}\",` : \"\"}\n })\n `;\n })\n .join(\",\\n\");\n\n const tableCoreImports = [\n \"columnFilteringFeature\",\n \"createColumnHelper\",\n \"createFilteredRowModel\",\n \"createPaginatedRowModel\",\n \"createSortedRowModel\",\n \"rowPaginationFeature\",\n \"rowSelectionFeature\",\n \"rowSortingFeature\",\n \"sortFn_alphanumeric\",\n \"sortFn_text\",\n \"tableFeatures\",\n ...(selects.length > 0\n ? [\n \"columnFacetingFeature\",\n \"createFacetedRowModel\",\n \"createFacetedUniqueValues\",\n ]\n : []),\n ...filterFns.map((name) => `filterFn_${name}`),\n ].sort();\n\n const facetingSlots =\n selects.length > 0\n ? dedent`\n columnFacetingFeature,\n facetedRowModel: createFacetedRowModel(),\n facetedUniqueValues: createFacetedUniqueValues(),\n `\n : \"\";\n const filterFnsSlot =\n filterFns.length > 0\n ? `filterFns: { ${filterFns.map((name) => `${name}: filterFn_${name}`).join(\", \")} },`\n : \"\";\n\n const searchInput = search\n ? dedent`\n <Input\n placeholder=\"Filter ${model.pluralDisplayName.toLowerCase()}...\"\n value={(table.getColumn(\"${search.name}\")?.getFilterValue() as string) ?? \"\"}\n oninput={(e) => {\n table.getColumn(\"${search.name}\")?.setFilterValue(e.currentTarget.value);\n }}\n class=\"h-8 w-[150px] lg:w-[250px]\"\n />\n `\n : \"\";\n const facets = selects\n .map(\n (field) =>\n `<FacetedFilter column={table.getColumn(\"${field.name}\")!} title=\"${field.title}\" options={Object.values(${field.name}Labels)} />`,\n )\n .join(\"\\n\");\n const toolbar = hasFilters\n ? dedent`\n <div class=\"flex flex-1 items-center space-x-2\">\n ${searchInput}\n ${facets}\n {#if table.atoms.columnFilters.get().length > 0}\n <Button variant=\"ghost\" onclick={() => table.resetColumnFilters()} class=\"h-8 px-2 lg:px-3\">\n Reset\n <XIcon />\n </Button>\n {/if}\n </div>\n `\n : '<div class=\"flex-1\"></div>';\n\n const imports = [\n `import {\\n${tableCoreImports.join(\",\\n\")}\\n} from \"@tanstack/table-core\";`,\n 'import { createTable, FlexRender, renderComponent } from \"#lib/components/ui/data-table/index.js\";',\n 'import * as Table from \"#lib/components/ui/table/index.js\";',\n 'import { Checkbox } from \"#lib/components/ui/checkbox/index.js\";',\n 'import { ColumnHeader } from \"#lib/components/ui/column-header/index.js\";',\n 'import { DataTablePagination } from \"#lib/components/ui/data-table-pagination/index.js\";',\n 'import { RowActions } from \"#lib/components/ui/row-actions/index.js\";',\n 'import * as Cells from \"#lib/components/ui/cells/index.js\";',\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n search ? 'import { Input } from \"#lib/components/ui/input/index.js\";' : \"\",\n selects.length > 0\n ? 'import { FacetedFilter } from \"#lib/components/ui/faceted-filter/index.js\";'\n : \"\",\n hasFilters ? 'import XIcon from \"@lucide/svelte/icons/x\";' : \"\",\n 'import PlusIcon from \"@lucide/svelte/icons/plus\";',\n 'import type { Models } from \"@velastack/pocketbase\";',\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n ${propsLine(dynamicParams)}\n\n ${labelMaps(fields)}\n\n const features = tableFeatures({\n rowSelectionFeature,\n rowSortingFeature,\n columnFilteringFeature,\n rowPaginationFeature,\n ${facetingSlots}\n sortedRowModel: createSortedRowModel(),\n filteredRowModel: createFilteredRowModel(),\n paginatedRowModel: createPaginatedRowModel(),\n sortFns: { alphanumeric: sortFn_alphanumeric, text: sortFn_text },\n ${filterFnsSlot}\n });\n\n const columnHelper = createColumnHelper<typeof features, Models[\"${model.tableName}\"]>();\n const columns = columnHelper.columns([\n columnHelper.display({\n id: \"select\",\n header: ({ table }) =>\n renderComponent(Checkbox, {\n checked: table.getIsAllPageRowsSelected(),\n onCheckedChange: (value) => table.toggleAllPageRowsSelected(value),\n indeterminate: table.getIsSomePageRowsSelected() && !table.getIsAllPageRowsSelected(),\n \"aria-label\": \"Select all\"\n }),\n cell: ({ row }) =>\n renderComponent(Checkbox, {\n checked: row.getIsSelected(),\n onCheckedChange: (value) => row.toggleSelected(value),\n \"aria-label\": \"Select row\"\n }),\n enableSorting: false,\n meta: { class: \"w-0\" },\n }),\n ${columnDefs}${fields.length > 0 ? \",\" : \"\"}\n columnHelper.display({\n id: \"actions\",\n cell: ({ row }) =>\n renderComponent(RowActions, {\n viewPath: ${rowPath(\"\")},\n editPath: ${rowPath(\"/edit\")},\n deletePath: ${rowPath(\"\")}\n }),\n meta: { class: \"w-0 text-right\" },\n })\n ]);\n\n const table = createTable({\n features,\n columns,\n get data() {\n return data.${model.pluralName};\n },\n enableRowSelection: true,\n });\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.pluralDisplayName}</h1>\n </div>\n\n <div class=\"space-y-4\">\n <div class=\"flex items-center justify-between\">\n ${toolbar}\n\n <Button href${newHref} variant=\"outline\" size=\"sm\">\n <PlusIcon class=\"w-4 h-4\" />\n New ${model.displayName.toLowerCase()}\n </Button>\n </div>\n\n <div class=\"rounded-md border overflow-hidden\">\n <Table.Root>\n <Table.Header>\n {#each table.getHeaderGroups() as headerGroup (headerGroup.id)}\n <Table.Row>\n {#each headerGroup.headers as header (header.id)}\n <Table.Head colspan={header.colSpan} class={header.column.columnDef.meta?.class}>\n {#if !header.isPlaceholder}\n <FlexRender {header} />\n {/if}\n </Table.Head>\n {/each}\n </Table.Row>\n {/each}\n </Table.Header>\n <Table.Body>\n {#each table.getRowModel().rows as row (row.id)}\n <Table.Row data-state={row.getIsSelected() && \"selected\"}>\n {#each row.getAllCells() as cell (cell.id)}\n <Table.Cell class={cell.column.columnDef.meta?.class}>\n <FlexRender {cell} />\n </Table.Cell>\n {/each}\n </Table.Row>\n {:else}\n <Table.Row>\n <Table.Cell colspan={columns.length} class=\"h-24 text-center\">No results.</Table.Cell>\n </Table.Row>\n {/each}\n </Table.Body>\n </Table.Root>\n </div>\n\n <DataTablePagination {table} />\n </div>\n </section>\n `;\n}\n\n/**\n * The list page without shadcn-svelte, TanStack Table or tailwind: a native\n * `<table>` of every record, each row linking to its detail and edit pages\n * and carrying a delete form that posts to the detail page's action.\n */\nexport function plainListPageSnippet(\n model: Model,\n urls: ScaffoldUrls,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const record = model.name;\n const recordHref = (suffix = \"\") =>\n urlSvelteAttrValue(urls.list, dynamicParams, `/{${record}.id}${suffix}`);\n const headers = fields\n .map((field) => `<th scope=\"col\">${field.title}</th>`)\n .join(\"\\n\");\n const cells = fields\n .map((field) => `<td>${renderPlainValue(field, record)}</td>`)\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${propsLine(dynamicParams)}\n\n ${labelMaps(fields)}\n </script>\n\n <h1>${model.pluralDisplayName}</h1>\n\n <p><a href${urlSvelteAttrValue(urls.new, dynamicParams)}>New ${model.displayName.toLowerCase()}</a></p>\n\n <table>\n <thead>\n <tr>\n ${headers}\n <th scope=\"col\">Actions</th>\n </tr>\n </thead>\n <tbody>\n {#each data.${model.pluralName} as ${record} (${record}.id)}\n <tr>\n ${cells}\n <td>\n <a href${recordHref()}>View</a>\n <a href${recordHref(\"/edit\")}>Edit</a>\n <form method=\"POST\" action${recordHref()}>\n <button type=\"submit\">Delete</button>\n </form>\n </td>\n </tr>\n {:else}\n <tr>\n <td colspan=\"${fields.length + 1}\">No ${model.pluralDisplayName.toLowerCase()} yet.</td>\n </tr>\n {/each}\n </tbody>\n </table>\n `;\n}\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport {\n SUPERFORMS,\n TANSTACK_TABLE_CORE,\n VELASTACK_POCKETBASE,\n ZOD,\n} from \"../../../core/constants\";\nimport { REQUIRE_USER_IMPORT } from \"../../../core/field/remote\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n isProtectedRoute,\n parseRoute,\n scaffoldFilePaths,\n scaffoldUrls,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport {\n getFieldComponents,\n getFieldImports,\n renderDisplayField,\n renderField,\n selectFieldLabelMap,\n} from \"../../../core/field\";\nimport {\n collectionSpecFromModelFields,\n generateSchemaSnippet,\n relationExpandParam,\n relationLoadLines,\n relationLoadReturnVars,\n resolveInputFields,\n rulesModeForCreate,\n rulesNotes,\n type RulesMode,\n} from \"../../../core/shared\";\nimport {\n NATIVE_STYLE,\n geoPointState,\n plainRenderer,\n superformsBinding,\n usesConstraints,\n} from \"../../../core/field/plain\";\nimport { renderPlainValue } from \"../../../core/field/plain-display\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport {\n listPageSnippet,\n plainListPageSnippet,\n} from \"../../../core/scaffold-list\";\nimport { generateScaffoldServerTestSnippet } from \"../../../core/tests\";\nimport {\n urlJsExpr,\n urlJsExprWithSuffix,\n urlSvelteAttrValue,\n} from \"../../../core/url\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction uniqueImports(imports: string[]): string[] {\n return [...new Set(imports.filter(Boolean))];\n}\n\nfunction selectLabelMaps(fields: Field[]): string {\n return fields\n .filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n )\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\n/**\n * The client the pages talk to PocketBase with: the signed-in user's, unless\n * the project has no auth or the collection is kept to the superuser.\n */\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n rules?: RulesMode,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth && rules !== \"superuser\"\n ? \"locals.pb\"\n : \"locals.admin\";\n}\n\nfunction scaffoldNotes(model: Model, rules: RulesMode | undefined): string[] {\n if (rules !== \"superuser\") return [];\n return [\n ...rulesNotes(model, rules),\n `The generated ${model.pluralDisplayName.toLowerCase()} pages use \\`locals.admin\\`, so everyone who can open them can read and write every record. Check who is asking in their load functions and actions.`,\n ];\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\nfunction newHiddenInputs(injectables: Injectables): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input type=\"hidden\" name=\"${field.name}\" value=\"${value}\" />`,\n )\n .join(\"\\n\");\n}\n\nfunction editHiddenInputs(injectables: Injectables): string {\n const fields = [\n injectables.currentUserField,\n injectables.currentTeamField,\n ].filter((field): field is InjectableField => Boolean(field));\n return fields\n .map(\n (field) =>\n `<input type=\"hidden\" name=\"${field.name}\" bind:value={$formData.${field.name}} />`,\n )\n .join(\"\\n\");\n}\n\n/**\n * SvelteKit hands every page `params`; it is declared only where a link or\n * redirect interpolates a dynamic route segment, since the projects\n * type-check with noUnusedLocals.\n */\nfunction propsLine(withParams: boolean): string {\n return withParams\n ? \"let { data, params } = $props();\"\n : \"let { data } = $props();\";\n}\n\nfunction formScript(\n model: Model,\n fields: Field[],\n includeParams = false,\n): string {\n const labels = selectLabelMaps(fields);\n\n return dedent`\n ${labels}\n ${propsLine(includeParams)}\n\n const form = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n const { form: formData } = form;\n `;\n}\n\nfunction newPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const imports = uniqueImports([\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zod4Client } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";`,\n ...getFieldImports(getFieldComponents(fields)),\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n 'import * as Form from \"#lib/components/ui/form/index.js\";',\n ]).join(\"\\n\");\n const fieldContent = fields.map((field) => renderField(field)).join(\"\\n\");\n const hiddenInputs = newHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${formScript(model, fields, dynamicParams.length > 0)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">New ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button size=\"sm\">Save</Form.Button>\n <Button href${listHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction editPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const imports = uniqueImports([\n 'import { untrack } from \"svelte\";',\n 'import { superForm } from \"sveltekit-superforms\";',\n 'import { zod4Client } from \"sveltekit-superforms/adapters\";',\n `import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";`,\n ...getFieldImports(getFieldComponents(fields)),\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n 'import * as Form from \"#lib/components/ui/form/index.js\";',\n ]).join(\"\\n\");\n const fieldContent = fields.map((field) => renderField(field)).join(\"\\n\");\n const hiddenInputs = editHiddenInputs(injectables);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const cancelHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n \"/{params.id}\",\n );\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${formScript(model, fields, true)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">Edit ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form method=\"POST\"${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Form.Button size=\"sm\">Save changes</Form.Button>\n <Button href${cancelHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction listServerSnippet(model: Model, fields: Field[], pb: string): string {\n const expand = relationExpandParam(fields);\n const getFullListArgs = expand ? `{ expand: \"${expand}\" }` : \"\";\n\n return dedent`\n export const load = async ({ locals }) => {\n const ${model.pluralName} = await ${pb}.collection(\"${model.tableName}\").getFullList(${getFullListArgs});\n return { ${model.pluralName} };\n };\n `;\n}\n\nfunction newServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n authMode: boolean,\n dynamicParams: string[],\n guard: boolean,\n): string {\n const withFiles = hasFiles(fields);\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n const { currentUserField, currentTeamField } = injectables;\n const injections: string[] = [];\n // The record's owner is the signed-in user. In the protected group there\n // is one, and `requireUser()` says so; a public form may have none.\n const usesUser = guard && authMode && Boolean(currentUserField);\n if (authMode && currentUserField) {\n injections.push(\n `${currentUserField.name}: ${usesUser ? \"user.id\" : \"locals.pb.authStore.record?.id\"}`,\n );\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...form.data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"form.data\";\n\n return dedent`\n import { fail, redirect } from \"@sveltejs/kit\";\n import { superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { setPocketbaseErrors } from \"@velastack/pocketbase/form\";\n ${usesUser ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const load = async ({ locals }) => {\n ${relationLoads}\n return { form: await superValidate(zod4(${model.schemaName}))${relationReturn} };\n };\n\n export const actions = {\n default: async ({ locals, request${dynamicParams.length > 0 ? \", params\" : \"\"} }) => {\n ${usesUser ? \"const user = requireUser();\" : \"\"}\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n let ${model.name};\n\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n } catch (error) {\n setPocketbaseErrors(form, error);\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, `/\\${${model.name}.id}`)});\n },\n };\n `;\n}\n\nfunction showServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n pb: string,\n dynamicParams: string[],\n): string {\n const expand = relationExpandParam(fields);\n const getOneArgs = expand ? `, { expand: \"${expand}\" }` : \"\";\n return dedent`\n import { error, redirect } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n try {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id${getOneArgs});\n return { ${model.name} };\n } catch {\n error(404, \"Not found\");\n }\n };\n\n export const actions = {\n default: async ({ locals, params }) => {\n await ${pb}.collection(\"${model.tableName}\").delete(params.id);\n redirect(303, ${urlJsExpr(urls.list, dynamicParams)});\n },\n };\n `;\n}\n\nfunction showPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const hasRelationFields = fields.some((field) => field.type === \"relation\");\n const hasFileFields = fields.some((field) => field.type === \"file\");\n\n const imports = [\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n hasSelectFields || hasRelationFields\n ? 'import { Badge } from \"#lib/components/ui/badge/index.js\";'\n : \"\",\n hasRelationFields\n ? 'import CircleArrowRightIcon from \"@lucide/svelte/icons/circle-arrow-right\";'\n : \"\",\n hasFileFields ? 'import FileIcon from \"@lucide/svelte/icons/file\";' : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n const labels = selectLabelMaps(fields);\n const displays = fields\n .map((field) => renderDisplayField(model, field))\n .join(\"\\n\");\n\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const editHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n `/{data.${model.name}.id}/edit`,\n );\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${labels}\n\n ${propsLine(dynamicParams.length > 0)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName} details</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm\">\n ${displays}\n </div>\n\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4 justify-between\">\n <Button href${editHref} variant=\"outline\" size=\"sm\">\n Edit\n </Button>\n <form method=\"POST\">\n <Button type=\"submit\" variant=\"destructive\" size=\"sm\">Delete</Button>\n </form>\n </div>\n </div>\n </section>\n `;\n}\n\n/**\n * The new/edit page without shadcn-svelte, formsnap or tailwind: native\n * elements bound to the superforms stores, as generate-form's plain page.\n */\nfunction plainFormPageSnippet(\n model: Model,\n fields: Field[],\n options: {\n title: string;\n submit: string;\n cancelHref: string;\n hiddenInputs: string;\n withParams: boolean;\n },\n): string {\n const renderer = plainRenderer(superformsBinding(), NATIVE_STYLE);\n const fieldContent = fields.map((field) => renderer.render(field)).join(\"\\n\");\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const stores = [\n \"form: formData\",\n \"errors\",\n ...(usesConstraints(fields) ? [\"constraints\"] : []),\n \"enhance\",\n ].join(\", \");\n\n return dedent`\n <script lang=\"ts\">\n import { untrack } from \"svelte\";\n import { superForm } from \"sveltekit-superforms\";\n import { zod4Client } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n ${propsLine(options.withParams)}\n\n const { ${stores} } = superForm(untrack(() => data.form), {\n validators: zod4Client(${model.schemaName}),\n });\n\n ${geoPointState(fields)}\n </script>\n\n <h1>${options.title}</h1>\n\n <form method=\"POST\"${enctype} use:enhance>\n ${fieldContent}\n ${options.hiddenInputs}\n <button type=\"submit\">${options.submit}</button>\n <a href${options.cancelHref}>Cancel</a>\n </form>\n `;\n}\n\nfunction plainNewPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n return plainFormPageSnippet(model, fields, {\n title: `New ${model.displayName.toLowerCase()}`,\n submit: \"Save\",\n cancelHref: urlSvelteAttrValue(urls.list, dynamicParams),\n hiddenInputs: newHiddenInputs(injectables),\n withParams: dynamicParams.length > 0,\n });\n}\n\nfunction plainEditPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n return plainFormPageSnippet(model, fields, {\n title: `Edit ${model.displayName.toLowerCase()}`,\n submit: \"Save changes\",\n cancelHref: urlSvelteAttrValue(urls.list, dynamicParams, \"/{params.id}\"),\n hiddenInputs: editHiddenInputs(injectables),\n withParams: true,\n });\n}\n\n/** The detail page as a `<dl>`, with the edit link and the delete form. */\nfunction plainShowPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const record = `data.${model.name}`;\n const details = fields\n .map(\n (field) => dedent`\n <dt>${field.title}</dt>\n <dd>${renderPlainValue(field, record)}</dd>\n `,\n )\n .join(\"\\n\");\n\n return dedent`\n <script lang=\"ts\">\n ${selectLabelMaps(fields)}\n\n ${propsLine(dynamicParams.length > 0)}\n </script>\n\n <h1>${model.displayName} details</h1>\n\n <dl>\n ${details}\n </dl>\n\n <p><a href${urlSvelteAttrValue(urls.list, dynamicParams, `/{${record}.id}/edit`)}>Edit</a></p>\n <form method=\"POST\">\n <button type=\"submit\">Delete</button>\n </form>\n <p><a href${urlSvelteAttrValue(urls.list, dynamicParams)}>Back to list</a></p>\n `;\n}\n\nfunction editServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n dynamicParams: string[],\n): string {\n const withFiles = hasFiles(fields);\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n const { currentUserField, currentTeamField } = injectables;\n const preservations: string[] = [];\n if (currentUserField) {\n preservations.push(\n `${currentUserField.name}: ${model.name}.${currentUserField.name}`,\n );\n }\n if (currentTeamField) {\n preservations.push(\n `${currentTeamField.name}: ${model.name}.${currentTeamField.name}`,\n );\n }\n const updatePayload =\n preservations.length > 0\n ? dedent`\n {\n ...form.data,\n ${preservations.join(\",\\n \")}\n }\n `\n : \"form.data\";\n\n return dedent`\n import { error, fail, redirect } from \"@sveltejs/kit\";\n import { setPocketbaseErrors, setDefaultData } from \"@velastack/pocketbase/form\";\n import { superValidate${withFiles ? \", withFiles\" : \"\"} } from \"sveltekit-superforms\";\n import { zod4 } from \"sveltekit-superforms/adapters\";\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const load = async ({ locals, params }) => {\n let ${model.name};\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n } catch {\n error(404, \"Not found\");\n }\n ${relationLoads}\n return { form: await superValidate(${model.name}, zod4(${model.schemaName}))${relationReturn} };\n };\n\n export const actions = {\n default: async ({ locals, params, request }) => {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n const form = await superValidate(request, zod4(${model.schemaName}));\n\n if (!form.valid) {\n setDefaultData(form, ${model.name});\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n try {\n await ${pb}.collection(\"${model.tableName}\").update(params.id, ${updatePayload});\n } catch (error) {\n setPocketbaseErrors(form, error);\n setDefaultData(form, ${model.name});\n return fail(400, ${withFiles ? \"withFiles({ form })\" : \"{ form }\"});\n }\n\n // Outside the try: redirect() throws, and the catch would swallow it.\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, \"/${params.id}\")});\n },\n };\n `;\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n\n if (\n fieldDefs.length > 0 &&\n collections.some((collection) => collection.name === model.tableName)\n ) {\n throw new InvalidArgumentError(\n `Collection \"${model.tableName}\" already exists. To run scaffold with an existing collection, omit the field definitions.`,\n );\n }\n\n const route = parseRoute(options.input.route, model, options, \"scaffold\");\n const guard = isProtectedRoute(route, options);\n const paths = scaffoldFilePaths(route);\n const urls = scaffoldUrls(route);\n const dynamicParams = route.dynamicParams;\n const rules = rulesModeForCreate(options, model, shouldCreateCollection);\n const pb = pbInstance(options, rules);\n const uiFields = fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n );\n const injectables = findInjectables(fields);\n const ui = resolveUi(options);\n const serverTests = options.input.serverTests ?? true;\n const pages =\n ui === \"plain\"\n ? {\n list: plainListPageSnippet(model, urls, uiFields, dynamicParams),\n new: plainNewPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n show: plainShowPageSnippet(model, urls, uiFields, dynamicParams),\n edit: plainEditPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n }\n : {\n list: listPageSnippet(model, urls, uiFields, dynamicParams),\n new: newPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n show: showPageSnippet(model, urls, uiFields, dynamicParams),\n edit: editPageSnippet(\n model,\n urls,\n uiFields,\n injectables,\n dynamicParams,\n ),\n };\n\n const creates: File[] = [\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n }),\n ),\n toFile(\n `${paths.list}/+page.server.ts`,\n listServerSnippet(model, uiFields, pb),\n ),\n toFile(`${paths.list}/+page.svelte`, pages.list),\n toFile(\n `${paths.new}/+page.server.ts`,\n newServerSnippet(\n model,\n urls,\n uiFields,\n injectables,\n pb,\n options.features.auth,\n dynamicParams,\n guard,\n ),\n ),\n toFile(`${paths.new}/+page.svelte`, pages.new),\n toFile(\n `${paths.show}/+page.server.ts`,\n showServerSnippet(model, urls, uiFields, pb, dynamicParams),\n ),\n toFile(`${paths.show}/+page.svelte`, pages.show),\n toFile(\n `${paths.edit}/+page.server.ts`,\n editServerSnippet(model, urls, uiFields, injectables, pb, dynamicParams),\n ),\n toFile(`${paths.edit}/+page.svelte`, pages.edit),\n ...(serverTests\n ? [\n toFile(\n `${paths.list}/server.test.ts`,\n generateScaffoldServerTestSnippet(\n model,\n urls,\n fields,\n options,\n collections,\n dynamicParams,\n ),\n ),\n ]\n : []),\n ];\n\n // Plain markup needs nothing from the registry, and no TanStack Table.\n const components =\n ui === \"plain\"\n ? []\n : ([\n ...getFieldComponents(uiFields),\n \"button\",\n \"table\",\n \"data-table\",\n \"command\",\n \"popover\",\n \"separator\",\n \"badge\",\n \"dropdown-menu\",\n \"checkbox\",\n \"select\",\n \"cells\",\n \"column-header\",\n \"faceted-filter\",\n \"data-table-pagination\",\n \"row-actions\",\n ] as Component[]);\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [...new Set(components)],\n packages: [\n SUPERFORMS,\n ZOD,\n ...(ui === \"plain\" ? [] : [TANSTACK_TABLE_CORE]),\n // `requireUser` in the new page's action\n ...(guard && options.features.auth && injectables.currentUserField\n ? [VELASTACK_POCKETBASE]\n : []),\n ],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth, rules)]\n : [],\n collectionPatches: [],\n collectionDrops: [],\n notes: scaffoldNotes(model, rules),\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { withNotes } from \"../../../core/util\";\nimport { resolveUi } from \"../../../core/field/ui\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-scaffold\" as const;\nconst VERSION = \"1.3.0\";\nconst SOURCE = \"src/patterns/generate/scaffold\";\nconst DOCS = \"/generate/scaffold\";\n\nexport async function generate(options: Options) {\n if (options.env === \"runtime\" && resolveUi(options) === \"shadcn\") {\n // Before the collection is created: nothing is written for a v8 project.\n const { assertRegistryPagination, assertTableCoreV9 } =\n await import(\"../../../runtime/table-core\");\n assertTableCoreV9(options.root);\n assertRegistryPagination(options.root);\n }\n\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return withNotes(\n await writeResult(await formatResult(runtimeRes, options), options),\n baseRes,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a scaffold\",\n summary: \"Generates CRUD routes and schema.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\"],\n\n command: {\n raw: \"vela generate scaffold contact name:text email:email\",\n base: \"vela generate scaffold\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"todos title:text! done:bool\",\n description: \"Todos with required title and boolean flag.\",\n },\n {\n command: \"pets type:select(dog:Dog,cat:Cat) owner:user\",\n description: \"Enum field and a one-to-many relation to user.\",\n },\n {\n command: \"pet name:text! breed:text! owner:current_user\",\n description: \"Auth-bound owner relation.\",\n },\n {\n command:\n 'project name:text! status:select(active,done) --route \"(app)/[team_id]/projects\"',\n description:\n \"Team-scoped CRUD via dynamic route param. Generated hrefs and redirects interpolate params.team_id.\",\n },\n ],\n\n tests: 8,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { Component, File, Options, Result } from \"../../../core/types\";\nimport {\n TANSTACK_TABLE_CORE,\n VELASTACK_POCKETBASE,\n} from \"../../../core/constants\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n isProtectedRoute,\n parseRoute,\n scaffoldFilePaths,\n scaffoldUrls,\n type Field,\n type Model,\n} from \"../../../parse\";\nimport { renderDisplayField, selectFieldLabelMap } from \"../../../core/field\";\nimport {\n getRemoteFieldComponents,\n getRemoteFieldImports,\n renderRemoteField,\n REQUIRE_USER_IMPORT,\n requireUserLines,\n} from \"../../../core/field/remote\";\nimport {\n isWriteOnly,\n remoteFormSupports,\n remoteSeedExpression,\n} from \"../../../core/field/plain\";\nimport {\n collectionSpecFromModelFields,\n generateSchemaSnippet,\n relationExpandParam,\n relationLoadLines,\n relationLoadReturnVars,\n resolveInputFields,\n rulesModeForCreate,\n rulesNotes,\n type RulesMode,\n uniqueRelationCollections,\n} from \"../../../core/shared\";\nimport { listPageSnippet } from \"../../../core/scaffold-list\";\nimport { generateScaffoldRemoteServerTestSnippet } from \"../../../core/tests\";\nimport {\n urlJsExpr,\n urlJsExprWithSuffix,\n urlSvelteAttrValue,\n} from \"../../../core/url\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nfunction hasFiles(fields: Field[]): boolean {\n return fields.some((field) => field.type === \"file\");\n}\n\nfunction selectLabelMaps(fields: Field[]): string {\n return fields\n .filter(\n (field): field is Extract<Field, { type: \"select\" }> =>\n field.type === \"select\",\n )\n .map((field) => selectFieldLabelMap(field))\n .join(\"\\n\\n\");\n}\n\n/**\n * The client the pages talk to PocketBase with: the signed-in user's, unless\n * the project has no auth or the collection is kept to the superuser.\n */\nfunction pbInstance(\n options: Pick<Options, \"features\">,\n rules?: RulesMode,\n): \"locals.pb\" | \"locals.admin\" {\n return options.features.auth && rules !== \"superuser\"\n ? \"locals.pb\"\n : \"locals.admin\";\n}\n\nfunction scaffoldNotes(model: Model, rules: RulesMode | undefined): string[] {\n if (rules !== \"superuser\") return [];\n return [\n ...rulesNotes(model, rules),\n `The generated ${model.pluralDisplayName.toLowerCase()} pages use \\`locals.admin\\`, so everyone who can open them can read and write every record. Check who is asking in their load functions and actions.`,\n ];\n}\n\nfunction createFormIdentifier(model: Model): string {\n return `create${model.typeName}Form`;\n}\n\nfunction updateFormIdentifier(model: Model): string {\n return `update${model.typeName}Form`;\n}\n\nfunction hasRelations(fields: Field[]): boolean {\n return uniqueRelationCollections(fields).length > 0;\n}\n\ntype InjectableField = Extract<Field, { type: \"relation\" }>;\n\ninterface Injectables {\n currentUserField?: InjectableField;\n currentTeamField?: InjectableField;\n}\n\nfunction findInjectables(fields: Field[]): Injectables {\n return {\n currentUserField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentUser,\n ),\n currentTeamField: fields.find(\n (field): field is InjectableField =>\n field.type === \"relation\" && field.isCurrentTeam,\n ),\n };\n}\n\n/**\n * SvelteKit 3 rejects a remote form input whose `name` was written by hand:\n * hidden inputs spread `.as(\"hidden\", value)` like every other control.\n */\nfunction newHiddenInputs(injectables: Injectables, formVar: string): string {\n const sentinels: Array<[InjectableField, string]> = [];\n if (injectables.currentUserField) {\n sentinels.push([injectables.currentUserField, \"current_user\"]);\n }\n if (injectables.currentTeamField) {\n sentinels.push([injectables.currentTeamField, \"current_team\"]);\n }\n return sentinels\n .map(\n ([field, value]) =>\n `<input {...${formVar}.fields.${field.name}.as(\"hidden\", \"${value}\")} />`,\n )\n .join(\"\\n\");\n}\n\nfunction editHiddenInputs(\n model: Model,\n injectables: Injectables,\n formVar: string,\n): string {\n const fields = [\n injectables.currentUserField,\n injectables.currentTeamField,\n ].filter((field): field is InjectableField => Boolean(field));\n return fields\n .map(\n (field) =>\n `<input {...${formVar}.fields.${field.name}.as(\"hidden\", data.${model.name}.${field.name})} />`,\n )\n .join(\"\\n\");\n}\n\n/**\n * SvelteKit hands every page `params`; it is declared only where a link\n * interpolates a dynamic route segment, since the projects type-check with\n * noUnusedLocals.\n */\nfunction propsLine(dynamicParams: string[], withData = true): string {\n const names = [\n ...(withData ? [\"data\"] : []),\n ...(dynamicParams.length > 0 ? [\"params\"] : []),\n ];\n return names.length > 0 ? `let { ${names.join(\", \")} } = $props();` : \"\";\n}\n\nfunction newPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const formVar = createFormIdentifier(model);\n const components = getRemoteFieldComponents(fields);\n const imports = [\n `import { ${formVar} } from \"./form.remote\";`,\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n ...getRemoteFieldImports(components),\n ].join(\"\\n\");\n const fieldContent = fields\n .map((field) => renderRemoteField(field, { formVar }))\n .join(\"\\n\");\n const hiddenInputs = newHiddenInputs(injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${propsLine(dynamicParams, false)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">New ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form {...${formVar}}${enctype}>\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n ${hiddenInputs}\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Button type=\"submit\" size=\"sm\">Save</Button>\n <Button href${listHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\n/**\n * Script statement that starts the edit form from the saved record.\n *\n * A remote form's controls hold what the form's own state says, which is\n * empty until someone types: left that way, the page shows a blank form and\n * saving it writes a blank over every field. The state is module-level and\n * outlives the page, so it is set afresh each time the page is created; that\n * also clears what an earlier record's edit left in it.\n */\nfunction editSeedSnippet(\n model: Model,\n fields: Field[],\n formVar: string,\n): string {\n const record = `data.${model.name}`;\n const seeds = fields.flatMap((field) => {\n const value = remoteSeedExpression(field, record);\n return value === undefined ? [] : [`${field.name}: ${value},`];\n });\n if (seeds.length === 0) return \"\";\n\n const writeOnly = fields.some(\n (field) => remoteFormSupports(field) && isWriteOnly(field),\n );\n const comment = [\n \"// The form starts from the saved record, so a field left alone is saved\",\n \"// as it was.\",\n ...(writeOnly\n ? [\n \"// Files and passwords cannot be shown: left empty, they keep what is\",\n \"// stored (see form.remote.ts).\",\n ]\n : []),\n ].join(\"\\n\");\n\n return dedent`\n ${comment}\n ${formVar}.fields.set(\n untrack(() => ({\n ${seeds.join(\"\\n\")}\n })),\n );\n `;\n}\n\nfunction editPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n dynamicParams: string[],\n): string {\n const formVar = updateFormIdentifier(model);\n const components = getRemoteFieldComponents(fields);\n const seed = editSeedSnippet(model, fields, formVar);\n const imports = [\n ...(seed ? ['import { untrack } from \"svelte\";'] : []),\n `import { ${formVar} } from \"./form.remote\";`,\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n ...getRemoteFieldImports(components),\n ].join(\"\\n\");\n const fieldContent = fields\n .map((field) => renderRemoteField(field, { formVar, edit: true }))\n .join(\"\\n\");\n const hiddenInputs = editHiddenInputs(model, injectables, formVar);\n const enctype = hasFiles(fields) ? ' enctype=\"multipart/form-data\"' : \"\";\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const cancelHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n \"/{params.id}\",\n );\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n\n let { data, params } = $props();\n\n ${seed}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">Edit ${model.displayName.toLowerCase()}</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <form {...${formVar}}${enctype}>\n <input {...${formVar}.fields.id.as(\"hidden\", data.${model.name}.id)} />\n ${hiddenInputs}\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4\">\n ${fieldContent}\n </div>\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4\">\n <Button type=\"submit\" size=\"sm\">Save changes</Button>\n <Button href${cancelHref} variant=\"outline\" size=\"sm\">Cancel</Button>\n </div>\n </form>\n </div>\n </section>\n `;\n}\n\nfunction listServerSnippet(model: Model, fields: Field[], pb: string): string {\n const expand = relationExpandParam(fields);\n const getFullListArgs = expand ? `{ expand: \"${expand}\" }` : \"\";\n\n return dedent`\n export const load = async ({ locals }) => {\n const ${model.pluralName} = await ${pb}.collection(\"${model.tableName}\").getFullList(${getFullListArgs});\n return { ${model.pluralName} };\n };\n `;\n}\n\nfunction newServerSnippet(model: Model, fields: Field[], pb: string): string {\n if (!hasRelations(fields)) {\n return \"\";\n }\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n return dedent`\n export const load = async ({ locals }) => {\n ${relationLoads}\n return { ${relationVars} };\n };\n `;\n}\n\nfunction newRemoteSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n pb: string,\n authMode: boolean,\n dynamicParams: string[],\n guard: boolean,\n): string {\n const formVar = createFormIdentifier(model);\n const currentUserField = fields.find(\n (field): field is Extract<Field, { type: \"relation\" }> =>\n field.type === \"relation\" && field.isCurrentUser,\n );\n const currentTeamField = fields.find(\n (field): field is Extract<Field, { type: \"relation\" }> =>\n field.type === \"relation\" && field.isCurrentTeam,\n );\n const injections: string[] = [];\n const usesUser = authMode && Boolean(currentUserField);\n if (authMode && currentUserField) {\n injections.push(\n `${currentUserField.name}: ${guard ? \"user.id\" : \"locals.pb.authStore.record?.id\"}`,\n );\n }\n if (currentTeamField) {\n injections.push(`${currentTeamField.name}: locals.team`);\n }\n const createPayload =\n injections.length > 0\n ? dedent`\n {\n ...data,\n ${injections.join(\",\\n \")}\n }\n `\n : \"data\";\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n import { redirect } from \"@sveltejs/kit\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n export const ${formVar} = form(${model.schemaName}, async (data) => {\n ${requireUserLines(guard, usesUser)}\n const { locals${dynamicParams.length > 0 ? \", params\" : \"\"} } = getRequestEvent();\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").create(\n ${createPayload}\n );\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, `/\\${${model.name}.id}`)});\n });\n `;\n}\n\nfunction showServerSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n pb: string,\n dynamicParams: string[],\n): string {\n const expand = relationExpandParam(fields);\n const getOneArgs = expand ? `, { expand: \"${expand}\" }` : \"\";\n return dedent`\n import { error, redirect } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n try {\n const ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id${getOneArgs});\n return { ${model.name} };\n } catch {\n error(404, \"Not found\");\n }\n };\n\n export const actions = {\n default: async ({ locals, params }) => {\n await ${pb}.collection(\"${model.tableName}\").delete(params.id);\n redirect(303, ${urlJsExpr(urls.list, dynamicParams)});\n },\n };\n `;\n}\n\nfunction showPageSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n dynamicParams: string[],\n): string {\n const hasSelectFields = fields.some((field) => field.type === \"select\");\n const hasRelationFields = fields.some((field) => field.type === \"relation\");\n const hasFileFields = fields.some((field) => field.type === \"file\");\n\n const imports = [\n 'import { Button } from \"#lib/components/ui/button/index.js\";',\n 'import ArrowLeftIcon from \"@lucide/svelte/icons/arrow-left\";',\n hasSelectFields || hasRelationFields\n ? 'import { Badge } from \"#lib/components/ui/badge/index.js\";'\n : \"\",\n hasRelationFields\n ? 'import CircleArrowRightIcon from \"@lucide/svelte/icons/circle-arrow-right\";'\n : \"\",\n hasFileFields ? 'import FileIcon from \"@lucide/svelte/icons/file\";' : \"\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n const labels = selectLabelMaps(fields);\n const displays = fields\n .map((field) => renderDisplayField(model, field))\n .join(\"\\n\");\n\n const listHref = urlSvelteAttrValue(urls.list, dynamicParams);\n const editHref = urlSvelteAttrValue(\n urls.list,\n dynamicParams,\n `/{data.${model.name}.id}/edit`,\n );\n\n return dedent`\n <script lang=\"ts\">\n ${imports}\n ${labels}\n\n ${propsLine(dynamicParams)}\n </script>\n\n <section data-role=\"content\">\n <div class=\"flex justify-between items-center mb-4\">\n <h1 class=\"text-3xl font-bold tracking-tight\">${model.displayName} details</h1>\n <Button href${listHref} variant=\"outline\" size=\"sm\">\n <ArrowLeftIcon class=\"w-4 h-4\" />\n Back to list\n </Button>\n </div>\n\n <div class=\"bg-card rounded-lg shadow-sm border p-4\">\n <div class=\"grid grid-cols-1 md:grid-cols-2 gap-4 text-sm\">\n ${displays}\n </div>\n\n <div class=\"mt-4 flex gap-2 border-t pt-4 -mx-4 px-4 justify-between\">\n <Button href${editHref} variant=\"outline\" size=\"sm\">\n Edit\n </Button>\n <form method=\"POST\">\n <Button type=\"submit\" variant=\"destructive\" size=\"sm\">Delete</Button>\n </form>\n </div>\n </div>\n </section>\n `;\n}\n\nfunction editServerSnippet(model: Model, fields: Field[], pb: string): string {\n const relationLoads = relationLoadLines(fields, pb);\n const relationVars = relationLoadReturnVars(fields);\n const relationReturn = relationVars ? `, ${relationVars}` : \"\";\n return dedent`\n import { error } from \"@sveltejs/kit\";\n\n export const load = async ({ locals, params }) => {\n let ${model.name};\n try {\n ${model.name} = await ${pb}.collection(\"${model.tableName}\").getOne(params.id);\n } catch {\n error(404, \"Not found\");\n }\n ${relationLoads}\n return { ${model.name}${relationReturn} };\n };\n `;\n}\n\nfunction editRemoteSnippet(\n model: Model,\n urls: ReturnType<typeof scaffoldUrls>,\n fields: Field[],\n injectables: Injectables,\n pb: string,\n dynamicParams: string[],\n guard: boolean,\n): string {\n const formVar = updateFormIdentifier(model);\n const { currentUserField, currentTeamField } = injectables;\n const rendered = fields.filter(remoteFormSupports);\n const writeOnly = rendered.filter(isWriteOnly);\n const bools = rendered.filter((field) => field.type === \"bool\");\n const jsons = rendered.filter((field) => field.type === \"json\");\n\n // What the form posts is not always what should be written.\n const overrides: string[] = [];\n if (bools.length > 0) {\n overrides.push(\n \"// An unticked checkbox posts nothing at all, so absent means off.\",\n ...bools.map((field) => `${field.name}: rest.${field.name} ?? false,`),\n );\n }\n if (jsons.length > 0) {\n overrides.push(\n \"// An empty textarea is no value. Posted as it is, PocketBase would store\",\n '// the string \"\".',\n ...jsons.map((field) => `${field.name}: rest.${field.name} || null,`),\n );\n }\n if (writeOnly.length > 0) {\n overrides.push(\n \"// Left empty, these keep what is stored: an empty value would delete it.\",\n ...writeOnly.map((field) =>\n field.type === \"file\"\n ? `...(${field.name} instanceof File ? { ${field.name} } : {}),`\n : `...(${field.name} ? { ${field.name} } : {}),`,\n ),\n );\n }\n const preserved = [currentUserField, currentTeamField].filter(\n (field): field is InjectableField => Boolean(field),\n );\n if (preserved.length > 0) {\n overrides.push(\n ...preserved.map((field) => `${field.name}: existing.${field.name},`),\n );\n }\n\n const taken = [\"id\", \"collectionId\", ...writeOnly.map((field) => field.name)];\n const existing =\n preserved.length > 0\n ? `const existing = await ${pb}.collection(\"${model.tableName}\").getOne(id);`\n : \"\";\n const update =\n overrides.length > 0\n ? dedent`\n await ${pb}.collection(\"${model.tableName}\").update(id, {\n ...rest,\n ${overrides.join(\"\\n\")}\n });\n `\n : `await ${pb}.collection(\"${model.tableName}\").update(id, rest);`;\n\n // The create form requires these; here an empty one means \"no change\".\n const optionalOnEdit = writeOnly.filter(\n (field) => field.type === \"file\" && field.required,\n );\n const updateSchema = `update${model.typeName}Schema`;\n const schemaDeclaration =\n optionalOnEdit.length > 0\n ? dedent`\n // A stored file stays unless a new one is chosen, so the edit form does\n // not ask for it again.\n const ${updateSchema} = ${model.schemaName}.extend({\n ${optionalOnEdit.map((field) => `${field.name}: ${model.schemaName}.shape.${field.name}.optional(),`).join(\"\\n\")}\n });\n `\n : \"\";\n const schema = optionalOnEdit.length > 0 ? updateSchema : model.schemaName;\n\n return dedent`\n import { form, getRequestEvent } from \"$app/server\";\n import { error, redirect } from \"@sveltejs/kit\";\n ${guard ? REQUIRE_USER_IMPORT : \"\"}\n import { ${model.schemaName} } from \"#lib/schemas/${model.name}.js\";\n\n ${schemaDeclaration}\n\n export const ${formVar} = form(${schema}, async (data) => {\n ${requireUserLines(guard, false)}\n const { locals${dynamicParams.length > 0 ? \", params\" : \"\"} } = getRequestEvent();\n const { ${taken.join(\", \")}, ...rest } = data;\n if (!id) error(400, \"id is required\");\n ${[existing, update].filter(Boolean).join(\"\\n\")}\n redirect(303, ${urlJsExprWithSuffix(urls.list, dynamicParams, \"/${id}\")});\n });\n `;\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, auth, shouldCreateCollection, collections } =\n await resolveInputFields(options, modelPath, fieldDefs);\n const route = parseRoute(options.input.route, model, options, \"scaffold\");\n const paths = scaffoldFilePaths(route);\n const urls = scaffoldUrls(route);\n const dynamicParams = route.dynamicParams;\n const rules = rulesModeForCreate(options, model, shouldCreateCollection);\n const pb = pbInstance(options, rules);\n const guard = isProtectedRoute(route, options);\n const uiFields = fields.filter(\n (field) =>\n !(\n field.type === \"relation\" &&\n (field.isCurrentUser || field.isCurrentTeam)\n ),\n );\n const injectables = findInjectables(fields);\n\n const creates: File[] = [\n toFile(\n `src/lib/schemas/${model.name}.ts`,\n generateSchemaSnippet(model, fields, {\n includeModelFields: true,\n forForm: true,\n remote: true,\n }),\n ),\n toFile(\n `${paths.list}/+page.server.ts`,\n listServerSnippet(model, uiFields, pb),\n ),\n toFile(\n `${paths.list}/+page.svelte`,\n listPageSnippet(model, urls, uiFields, dynamicParams),\n ),\n ];\n\n const newServerContent = newServerSnippet(model, uiFields, pb);\n if (newServerContent) {\n creates.push(toFile(`${paths.new}/+page.server.ts`, newServerContent));\n }\n creates.push(\n toFile(\n `${paths.new}/form.remote.ts`,\n newRemoteSnippet(\n model,\n urls,\n fields,\n pb,\n options.features.auth,\n dynamicParams,\n guard,\n ),\n ),\n toFile(\n `${paths.new}/+page.svelte`,\n newPageSnippet(model, urls, uiFields, injectables, dynamicParams),\n ),\n toFile(\n `${paths.show}/+page.server.ts`,\n showServerSnippet(model, urls, uiFields, pb, dynamicParams),\n ),\n toFile(\n `${paths.show}/+page.svelte`,\n showPageSnippet(model, urls, uiFields, dynamicParams),\n ),\n toFile(\n `${paths.edit}/+page.server.ts`,\n editServerSnippet(model, uiFields, pb),\n ),\n toFile(\n `${paths.edit}/form.remote.ts`,\n editRemoteSnippet(\n model,\n urls,\n uiFields,\n injectables,\n pb,\n dynamicParams,\n guard,\n ),\n ),\n toFile(\n `${paths.edit}/+page.svelte`,\n editPageSnippet(model, urls, uiFields, injectables, dynamicParams),\n ),\n toFile(\n `${paths.list}/server.test.ts`,\n generateScaffoldRemoteServerTestSnippet(\n model,\n urls,\n fields,\n options,\n collections,\n dynamicParams,\n ),\n ),\n );\n\n const components = [\n ...getRemoteFieldComponents(uiFields),\n \"button\",\n \"table\",\n \"data-table\",\n \"popover\",\n \"separator\",\n \"badge\",\n \"dropdown-menu\",\n \"checkbox\",\n \"select\",\n \"cells\",\n \"column-header\",\n \"faceted-filter\",\n \"data-table-pagination\",\n \"row-actions\",\n ] as Component[];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [...new Set(components)],\n packages: [TANSTACK_TABLE_CORE, ...(guard ? [VELASTACK_POCKETBASE] : [])],\n collections: shouldCreateCollection\n ? [collectionSpecFromModelFields(model, fields, auth, rules)]\n : [],\n collectionPatches: [],\n collectionDrops: [],\n notes: scaffoldNotes(model, rules),\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { mergeResults, withNotes } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"generate-scaffold-remote\" as const;\nconst VERSION = \"1.3.0\";\nconst SOURCE = \"src/patterns/generate/scaffold-remote\";\nconst DOCS = \"/generate/scaffold\";\n\nexport async function generate(options: Options) {\n if (options.env === \"runtime\") {\n // Before the collection is created: nothing is written for a v8 project.\n const { assertRegistryPagination, assertTableCoreV9 } =\n await import(\"../../../runtime/table-core\");\n assertTableCoreV9(options.root);\n assertRegistryPagination(options.root);\n }\n\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(\n withNotes(mergeResults([baseRes, previewRes]), baseRes),\n options,\n );\n }\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { modifyOutcomeToFile } = await import(\"../../../runtime/modify-file\");\n const { modifySvelteConfigRemote } =\n await import(\"../../../runtime/modify-svelte-config-remote\");\n const logger = getLogger(options);\n logger.info(\"Modifying config for remote functions\");\n const remote = modifySvelteConfigRemote(options.root);\n const svelteConfigFile = modifyOutcomeToFile(remote.filePath, remote.outcome);\n\n const runtimeRes = {\n ...baseRes,\n creates: [...baseRes.creates, ...migrationCreates],\n modifies: [\n ...baseRes.modifies,\n ...(svelteConfigFile ? [svelteConfigFile] : []),\n ],\n };\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return withNotes(\n await writeResult(await formatResult(runtimeRes, options), options),\n baseRes,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a scaffold (remote functions)\",\n summary:\n \"Generates CRUD routes and schema using SvelteKit remote functions for create/update forms.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"generators\" as const,\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\", \"remote-functions\"],\n\n command: {\n raw: \"vela generate scaffold --remote contact name:text email:email\",\n base: \"vela generate scaffold --remote\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"todos title:text! done:bool\",\n description: \"Todos with required title and boolean flag.\",\n },\n {\n command: \"pets type:select(dog:Dog,cat:Cat) owner:user\",\n description: \"Enum field and a one-to-many relation to user.\",\n },\n {\n command: \"pet name:text! breed:text! owner:current_user\",\n description: \"Auth-bound owner relation.\",\n },\n {\n command:\n 'project name:text! status:select(active,done) --route \"(app)/[team_id]/projects\"',\n description:\n \"Team-scoped CRUD via dynamic route param. Generated hrefs and redirects interpolate params.team_id.\",\n },\n ],\n\n tests: 6,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { ZOD } from \"../../../core/constants\";\nimport { languageFromPath } from \"../../../core/util\";\nimport {\n generateSchemaSnippet,\n resolveInputFields,\n} from \"../../../core/shared\";\n\nfunction parsePatternArgs(argv: string[]) {\n const [modelPath, ...fields] = argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model> [fields...]\",\n );\n }\n\n return { modelPath, fields };\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options) {\n const { modelPath, fields: fieldDefs } = parsePatternArgs(options.argv);\n const { model, fields, shouldCreateCollection } = await resolveInputFields(\n options,\n modelPath,\n fieldDefs,\n );\n\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const schema = generateSchemaSnippet(model, fields, {\n includeModelFields: !shouldCreateCollection,\n forForm: true,\n });\n\n return {\n creates: [toFile(schemaPath, schema)],\n modifies: [],\n deletes: [],\n components: [],\n // vela's templates already have zod; a project vela did not create may not.\n packages: [ZOD],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-schema\" as const;\nconst VERSION = \"1.0.8\";\nconst SOURCE = \"src/patterns/generate/schema\";\nconst DOCS = \"/generate/schema\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a schema\",\n summary: \"Generates a zod schema.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"zod\", \"schema\", \"pocketbase\"],\n\n command: {\n raw: \"vela generate schema contact name:text email:email\",\n base: \"vela generate schema\",\n argv: [\"contact\", \"name:text\", \"email:email\"],\n },\n\n examples: [\n {\n command: \"login email:email! password:text!\",\n description: \"Validation schema for a login form.\",\n },\n {\n command:\n \"settings theme:select(light:Light,dark:Dark) notifications:bool\",\n description: \"Schema with an enum and a boolean flag.\",\n },\n {\n command: \"address street:text! city:text! postal:text!\",\n description: \"Schema with all required text fields.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Provider, Result } from \"../../../core/types\";\nimport { providerCreates, resolveProvider } from \"../../../core/providers\";\n\n/**\n * The payments providers a shop can be generated for. The pages are each\n * provider's own: Stripe's read the synced catalog on the server, Shopify's\n * query the Storefront API, WhatsApp's read a module the developer edits (or\n * the CMS, when the project has one). Nothing is shared between them.\n */\nexport const PROVIDERS: Provider[] = [\n // The listing and product pages read PocketBase on the server.\n { id: \"stripe\", label: \"Stripe\", requires: { backend: true } },\n { id: \"shopify\", label: \"Shopify\" },\n { id: \"whatsapp\", label: \"WhatsApp\" },\n];\n\nexport const META = {\n slug: \"generate-shop\",\n providers: PROVIDERS,\n inheritsProvider: \"payments\",\n};\n\nconst providersRaw = import.meta.glob<string>(\"./providers/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n// With the CMS, the catalog is content edited in place rather than a module.\nconst providersCmsRaw = import.meta.glob<string>(\"./providers-cms/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/** The files `generate-shop` writes for `provider`, as app-relative paths. */\nexport function shopFiles(options: Options): File[] {\n const provider = resolveProvider(META, options);\n const files = new Map<string, File>();\n for (const file of providerCreates(providersRaw, provider.id)) {\n files.set(file.path, file);\n }\n if (options.features.cms) {\n const cms = providerCreates(\n providersCmsRaw,\n provider.id,\n \"./providers-cms/\",\n );\n if (cms.length > 0) {\n // The CMS pages replace the module and its pages wholesale.\n files.clear();\n for (const file of cms) files.set(file.path, file);\n }\n }\n return [...files.values()].sort((a, b) => a.path.localeCompare(b.path));\n}\n\nexport async function generate(options: Options) {\n return {\n creates: shopFiles(options),\n modifies: [],\n deletes: [],\n components: [\"button\"],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase, META, PROVIDERS } from \"./generate\";\n\nconst SLUG = \"generate-shop\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/generate/shop\";\nconst DOCS = \"/generate/shop\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { assertNoneExist } = await import(\"./generate.runtime\");\n assertNoneExist(options.root, baseRes.creates);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Generate a shop\",\n summary:\n \"Generates a product listing and product pages for the project's cart, in its payments provider's own terms: Stripe's synced catalog read on the server, Shopify's Storefront API, or a catalog module (or the CMS) for WhatsApp. The pages are yours to edit; the generator never writes over them.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n ecommerce: true,\n // The pages are shadcn-svelte markup, like the cart they add to.\n ui: \"shadcn\",\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"ecommerce\",\n \"shop\",\n \"catalog\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela generate shop\",\n base: \"vela generate shop\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n inheritsProvider: META.inheritsProvider,\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\n\nexport interface WorkflowArgs {\n /** Kebab-case: the workflow's registered name and its file name. */\n name: string;\n /** camelCase: the exported binding. */\n exportName: string;\n cron?: string;\n}\n\nconst NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nconst CRON_RE = /^\\S+(?:\\s+\\S+){4,5}$/;\n\nexport function toKebabCase(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[_\\s]+/g, \"-\")\n .toLowerCase();\n}\n\nexport function toCamelCase(kebab: string): string {\n return kebab.replace(/-([a-z0-9])/g, (_, c: string) => c.toUpperCase());\n}\n\n/** `<name> [--cron <expr>]`, in either order; `--cron=<expr>` works too. */\nexport function parseWorkflowArgs(argv: string[]): WorkflowArgs {\n let raw: string | undefined;\n let cron: string | undefined;\n\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n if (arg === \"--cron\") {\n cron = argv[++i];\n if (cron === undefined) {\n throw new InvalidArgumentError(\n \"--cron needs a schedule, e.g. --cron '*/5 * * * *'\",\n );\n }\n } else if (arg.startsWith(\"--cron=\")) {\n cron = arg.slice(\"--cron=\".length);\n } else if (arg.startsWith(\"-\")) {\n throw new InvalidArgumentError(`Unknown option: ${arg}`);\n } else if (raw === undefined) {\n raw = arg;\n } else {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <name> [--cron <schedule>]\",\n );\n }\n }\n\n if (!raw) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <name> [--cron <schedule>]\",\n );\n }\n\n const name = toKebabCase(raw);\n if (!NAME_RE.test(name)) {\n throw new InvalidArgumentError(\n `Invalid workflow name: \"${raw}\". Use letters, numbers and dashes, e.g. send-welcome-email.`,\n );\n }\n if (cron !== undefined && !CRON_RE.test(cron.trim())) {\n throw new InvalidArgumentError(\n `Invalid cron schedule: \"${cron}\". Expected five fields, e.g. '*/5 * * * *'.`,\n );\n }\n\n return { name, exportName: toCamelCase(name), cron: cron?.trim() };\n}\n\nfunction workflowSnippet({ name, exportName }: WorkflowArgs): string {\n return dedent`\n import { z } from 'zod';\n import { ow } from '#lib/server/workflows.js';\n\n /**\n * Start a run from any server code with \\`${exportName}.run(input)\\`. Runs\n * are listed under Workflows in the PocketBase dashboard.\n */\n export const ${exportName} = ow.defineWorkflow(\n {\n name: '${name}',\n // What \\`run()\\` takes, checked before the run is queued.\n schema: z.object({}),\n retryPolicy: { maximumAttempts: 3 }\n },\n async ({ input, step }) => {\n // Each step's return value is saved, so a retry or a restart carries on\n // after the last step that finished. Keep every step safe to repeat.\n const result = await step.run({ name: 'first-step' }, async () => {\n return input;\n });\n return result;\n }\n );\n `;\n}\n\nfunction cronWorkflowSnippet({ name, exportName, cron }: WorkflowArgs): string {\n return dedent`\n import { ow } from '#lib/server/workflows.js';\n\n /**\n * Runs on the schedule below; \\`${exportName}.run()\\` starts an extra run.\n * Runs are listed under Workflows in the PocketBase dashboard.\n */\n export const ${exportName} = ow.defineWorkflow(\n { name: '${name}', retryPolicy: { maximumAttempts: 3 } },\n async ({ step }) => {\n // Each step's return value is saved, so a retry or a restart carries on\n // after the last step that finished. Keep every step safe to repeat.\n await step.run({ name: 'first-step' }, async () => {\n // ...\n });\n }\n );\n\n /** Every workflow in this file starts on this schedule, once per minute across all servers. */\n export const cron = '${cron}';\n `;\n}\n\nfunction testSnippet({ name, exportName, cron }: WorkflowArgs): string {\n const run = cron ? `${exportName}.run()` : `${exportName}.run({})`;\n // A workflow that returns nothing completes with a null output.\n const expectation = cron ? \"resolves.toBeNull()\" : \"resolves.toEqual({})\";\n return dedent`\n import { afterAll, beforeAll, describe, expect, it } from 'vitest';\n import { startWorker, stopWorker } from '#lib/server/workflows.js';\n import { ${exportName} } from './${name}';\n\n describe('${name}', () => {\n // The test process runs a worker of its own, so a run completes here\n // without going through the dev server.\n beforeAll(() => startWorker());\n afterAll(() => stopWorker());\n\n it('completes', async () => {\n const handle = await ${run};\n await expect(handle.result({ timeoutMs: 15_000 })).${expectation};\n });\n });\n `;\n}\n\nfunction toFile(path: string, content: string): File {\n return {\n path,\n language: languageFromPath(path),\n content: `${content}\\n`,\n status: \"success\",\n };\n}\n\nexport async function generate(options: Options): Promise<Result> {\n const args = parseWorkflowArgs(options.argv);\n const dir = `src/lib/workflows`;\n\n const creates = [\n toFile(\n `${dir}/${args.name}.ts`,\n args.cron ? cronWorkflowSnippet(args) : workflowSnippet(args),\n ),\n // Named to match the `server` filter `vela test:server` runs by default.\n toFile(`${dir}/${args.name}.server.test.ts`, testSnippet(args)),\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","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"generate-workflow\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/generate/workflow\";\nconst DOCS = \"/generate/workflow\";\n\nexport async function generate(options: Options) {\n // The worker and client the generated file imports come with the base\n // template; a project from before then gets them from `enable workflows`.\n if (options.env === \"runtime\" && !options.features.workflows) {\n throw new InvalidArgumentError(\n \"This project has no workflow runtime yet. Run `vela enable workflows` first.\",\n );\n }\n\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(await formatResult(baseRes, options), options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Generate a workflow\",\n summary:\n \"Adds a durable background workflow to src/lib/workflows, with a server test; --cron makes it recurring.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n workflows: true,\n },\n category: \"generators\" as const,\n tags: [\"openworkflow\", \"workflows\", \"background jobs\", \"cron\", \"pocketbase\"],\n\n command: {\n raw: \"vela generate workflow send-welcome-email\",\n base: \"vela generate workflow\",\n argv: [\"send-welcome-email\"],\n },\n\n examples: [\n {\n command: \"send-welcome-email\",\n description:\n \"A workflow started from server code with sendWelcomeEmail.run(input).\",\n },\n {\n command: \"sync-prices --cron '*/5 * * * *'\",\n description: \"A recurring workflow that runs every five minutes.\",\n },\n ],\n\n tests: 1,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { providerEnvVars, resolveProvider } from \"../../../core/providers\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { envEditsFor, META } from \"./generate\";\n\nexport async function generate(options: Options) {\n const provider = resolveProvider(META, options);\n\n // Same shape `applyEnvEdits` appends at runtime.\n const envLines = envEditsFor(provider).map((edit) =>\n edit.type === \"comment\" ? `# ${edit.key}` : `${edit.key}=${edit.value}`,\n );\n\n return {\n creates: [],\n modifies: [\n {\n // The declaration `$app/env/private` needs, for this provider's key.\n path: \"src/env.ts\",\n language: \"ts\",\n content: envVarsFile(providerEnvVars(provider)),\n status: \"success\" as const,\n },\n {\n path: \".env\",\n language: \"text\",\n content: envLines.join(\"\\n\") + \"\\n\",\n status: \"success\" as const,\n },\n ],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-ai\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/ai\";\nconst DOCS = \"/enable/ai\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable AI\",\n summary:\n \"Adds the Vercel AI SDK (through Vercel AI Gateway, OpenAI or Anthropic): a streaming /api/chat endpoint and an /ai chat page built on @ai-sdk/svelte.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"ai\" as const,\n tags: [\n \"sveltekit\",\n \"ai\",\n \"ai-sdk\",\n \"chat\",\n \"vercel-ai-gateway\",\n \"openai\",\n \"anthropic\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable ai --provider gateway\",\n base: \"vela enable ai\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--provider gateway\",\n description:\n \"Reach hundreds of models with one AI_GATEWAY_API_KEY through Vercel AI Gateway.\",\n },\n {\n command: \"--provider openai\",\n description:\n \"Call OpenAI directly with OPENAI_API_KEY via @ai-sdk/openai.\",\n },\n {\n command: \"--provider anthropic\",\n description:\n \"Call Anthropic directly with ANTHROPIC_API_KEY via @ai-sdk/anthropic.\",\n },\n ],\n\n tests: 3,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { providerEnvVars, resolveProvider } from \"../../../core/providers\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { envEditsFor, META } from \"./generate\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(options: Options) {\n const provider = resolveProvider(META, options);\n\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n // The declarations and `.env` lines depend on the provider, so they are\n // built rather than stored as fixtures. Same shapes the runtime writes.\n modifies.push({\n path: \"src/env.ts\",\n language: \"ts\",\n content: envVarsFile(providerEnvVars(provider)),\n status: \"success\" as const,\n });\n const envLines = envEditsFor(provider).map((edit) =>\n edit.type === \"comment\" ? `# ${edit.key}` : `${edit.key}=${edit.value}`,\n );\n modifies.push({\n path: \".env\",\n language: \"text\",\n content: envLines.join(\"\\n\") + \"\\n\",\n status: \"success\" as const,\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","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-analytics\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/analytics\";\nconst DOCS = \"/enable/analytics\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable analytics\",\n summary:\n \"Adds a web analytics component (Plausible, Google Analytics or PostHog) mounted in the root layout and configured from .env.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"analytics\" as const,\n tags: [\n \"sveltekit\",\n \"analytics\",\n \"plausible\",\n \"google-analytics\",\n \"posthog\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable analytics --provider plausible\",\n base: \"vela enable analytics\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--provider plausible\",\n description:\n \"Load the Plausible script for the site named by PUBLIC_PLAUSIBLE_DOMAIN.\",\n },\n {\n command: \"--provider google\",\n description:\n \"Load gtag.js for PUBLIC_GA_MEASUREMENT_ID and send a page_view on every navigation.\",\n },\n {\n command: \"--provider posthog\",\n description:\n \"Initialise posthog-js with PUBLIC_POSTHOG_KEY and PUBLIC_POSTHOG_HOST.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n\n generate,\n} satisfies Pattern;\n","import { Options, Result } from \"../../../core/types\";\nimport { composeCreates } from \"../../../core/util\";\nimport {\n FLASH,\n FORMSNAP,\n SUPERFORMS,\n VELASTACK_POCKETBASE,\n ZOD,\n} from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst variantsRaw = import.meta.glob<string>(\"./variants/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const variant =\n typeof options.input?.variant === \"string\"\n ? options.input.variant\n : undefined;\n\n const creates = composeCreates(\n createsRaw,\n CREATES_PREFIX,\n variantsRaw,\n variant,\n );\n\n const components = [\n \"sidebar\",\n \"breadcrumb\",\n \"separator\",\n \"form\",\n \"collapsible\",\n \"avatar\",\n \"dropdown-menu\",\n \"card\",\n \"input\",\n \"label\",\n \"button\",\n \"badge\",\n \"dialog\",\n \"checkbox\",\n \"file-form\",\n \"auth-menu\",\n ];\n\n if (options.features.payments) {\n components.push(\"alert-dialog\");\n }\n\n const collections = [\n {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n name: \"oauth_accounts\",\n type: \"base\" as const,\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n name: \"user\",\n type: \"relation\",\n required: true,\n maxSelect: 1,\n },\n {\n name: \"providerId\",\n required: true,\n type: \"text\",\n },\n {\n name: \"provider\",\n required: true,\n type: \"text\",\n },\n {\n name: \"accessToken\",\n type: \"text\",\n },\n {\n name: \"refreshToken\",\n type: \"text\",\n },\n {\n name: \"avatarURL\",\n type: \"text\",\n },\n {\n name: \"expiry\",\n type: \"date\",\n },\n {\n name: \"email\",\n type: \"text\",\n },\n {\n name: \"name\",\n type: \"text\",\n },\n {\n name: \"username\",\n type: \"text\",\n },\n {\n name: \"rawUser\",\n type: \"json\",\n },\n ],\n },\n ];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n // The minimal template ships these; a static project turned backend\n // does not. Pinned to the template's versions.\n // `requireUser` in the generated code is new in this floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [FORMSNAP, FLASH, SUPERFORMS, ZOD, VELASTACK_POCKETBASE],\n collections,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-auth\" as const;\nconst VERSION = \"1.5.1\";\nconst SOURCE = \"src/patterns/enable/auth\";\nconst DOCS = \"/enable/auth\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n\n // Install components and write creates first so runtime modifies that\n // read from disk (e.g. the shadcn-installed sidebar) see the post-install\n // state. Without this, modifies targeting installed components run against\n // a non-existent file, return `not-found`, and are silently dropped.\n const writtenBase = await writeResult(\n await formatResult(\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n options,\n ),\n options,\n );\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const writtenRuntime = await writeResult(\n await formatResult(runtimeRes, options),\n options,\n );\n\n return mergeResults([writtenBase, writtenRuntime]);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable authentication\",\n summary: \"Enables authentication.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"velastack\",\n \"oauth\",\n \"pocketbase\",\n ],\n\n command: {\n raw: \"vela enable auth\",\n base: \"vela enable auth\",\n argv: [],\n },\n\n examples: [],\n\n tests: 27,\n\n baseline: \"velastack\",\n\n variants: [\"split\"],\n\n generate: generate,\n} satisfies Pattern;\n","import { TAKUMI } from \"../../../core/constants\";\nimport type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\n/** The paths this pattern writes; disable-og deletes the same ones. */\nexport function createdPaths(): string[] {\n return Object.keys(filesFromGlob(createsRaw, CREATES_PREFIX)).sort();\n}\n\nexport async function generate(_options: Options) {\n const creates = Object.values(filesFromGlob(createsRaw, CREATES_PREFIX)).sort(\n (a, b) => a.path.localeCompare(b.path),\n );\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [TAKUMI],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-og\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/enable/og\";\nconst DOCS = \"/enable/og\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable Open Graph images\",\n summary:\n \"Generates a share card for every page from a Svelte component: files at build time for prerendered pages, on request for the rest.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"content\" as const,\n tags: [\"sveltekit\", \"open-graph\", \"og-image\", \"seo\", \"takumi\", \"velastack\"],\n\n command: {\n raw: \"vela enable og\",\n base: \"vela enable og\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { FLASH, VELASTACK_POCKETBASE, ZOD } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n const components = [\n \"sidebar\",\n \"breadcrumb\",\n \"separator\",\n \"collapsible\",\n \"avatar\",\n \"dropdown-menu\",\n \"card\",\n \"input\",\n \"label\",\n \"button\",\n \"badge\",\n \"dialog\",\n \"checkbox\",\n \"auth-menu\",\n ];\n\n if (options.features.payments) {\n components.push(\"alert-dialog\");\n }\n\n const collections = [\n {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n name: \"oauth_accounts\",\n type: \"base\" as const,\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n name: \"user\",\n type: \"relation\",\n required: true,\n maxSelect: 1,\n },\n {\n name: \"providerId\",\n required: true,\n type: \"text\",\n },\n {\n name: \"provider\",\n required: true,\n type: \"text\",\n },\n {\n name: \"accessToken\",\n type: \"text\",\n },\n {\n name: \"refreshToken\",\n type: \"text\",\n },\n {\n name: \"avatarURL\",\n type: \"text\",\n },\n {\n name: \"expiry\",\n type: \"date\",\n },\n {\n name: \"email\",\n type: \"text\",\n },\n {\n name: \"name\",\n type: \"text\",\n },\n {\n name: \"username\",\n type: \"text\",\n },\n {\n name: \"rawUser\",\n type: \"json\",\n },\n ],\n },\n ];\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components,\n // The minimal template ships these; a static project turned backend\n // does not. Pinned to the template's versions.\n // `requireUser` in the settings functions is new in the floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [FLASH, ZOD, VELASTACK_POCKETBASE],\n collections,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-auth-remote\" as const;\nconst VERSION = \"1.6.1\";\nconst SOURCE = \"src/patterns/enable/auth-remote\";\nconst DOCS = \"/enable/auth-remote\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n const written = await writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n\n // In a project that already has i18n: the language select and the Spanish\n // enable-i18n would have added had these pages been there when it ran.\n // After the write, because both read the pages from disk.\n const { localizeAuthPages } = await import(\"../auth/i18n\");\n const localized = localizeAuthPages(options);\n if (localized.creates.length === 0 && localized.modifies.length === 0) {\n return written;\n }\n const writtenLocalized = await writeResult(\n await formatResult(\n {\n creates: localized.creates,\n modifies: localized.modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n },\n options,\n ),\n options,\n );\n return mergeResults([written, writtenLocalized]);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable authentication (remote functions)\",\n summary:\n \"Enables authentication using SvelteKit remote functions for login, signup, reset, and settings forms.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"velastack\",\n \"oauth\",\n \"pocketbase\",\n \"remote-functions\",\n ],\n\n command: {\n raw: \"vela enable auth --remote\",\n base: \"vela enable auth --remote\",\n argv: [],\n },\n\n examples: [],\n\n tests: 21,\n\n baseline: \"velastack\",\n\n generate: generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-api\" as const;\nconst VERSION = \"1.0.7\";\nconst SOURCE = \"src/patterns/enable/api\";\nconst DOCS = \"/enable/api\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable API\",\n summary: \"Enables the PocketBase API.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"api\", \"rest\", \"backend\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela enable api\",\n base: \"vela enable api\",\n argv: [],\n },\n\n examples: [],\n\n tests: 1,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { CollectionSpec, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\nimport { VELASTACK_POCKETBASE } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nconst apiKeysCollection: CollectionSpec = {\n listRule: \"@request.auth.id = user.id\",\n viewRule: \"@request.auth.id = user.id\",\n createRule: \"@request.auth.id = user.id\",\n updateRule: \"@request.auth.id = user.id\",\n deleteRule: \"@request.auth.id = user.id\",\n name: \"api_keys\",\n type: \"base\",\n fields: [\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n name: \"user\",\n type: \"relation\",\n },\n {\n name: \"key_hash\",\n type: \"text\",\n },\n {\n name: \"label\",\n type: \"text\",\n required: true,\n },\n {\n name: \"last_used\",\n type: \"date\",\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n};\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n // `form`: the new-key page is a superforms page. Auth's own pages bring\n // the component in, but `enable auth --remote` has none.\n components: [\"alert-dialog\", \"button\", \"badge\", \"form\"],\n // `requireUser` in the generated code is new in this floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [spec(\"@types/node\"), VELASTACK_POCKETBASE],\n collections: [apiKeysCollection],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-api-keys\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/enable/api-keys\";\nconst DOCS = \"/enable/api-keys\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable API keys\",\n summary:\n \"Adds API key management for authenticated users and PocketBase API access.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"api\" as const,\n tags: [\n \"sveltekit\",\n \"api\",\n \"api-keys\",\n \"pocketbase\",\n \"velastack\",\n \"authentication\",\n ],\n\n command: {\n raw: \"vela enable api-keys\",\n base: \"vela enable api-keys\",\n argv: [],\n },\n\n examples: [],\n\n tests: 6,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport {\n ADAPTER_NODE,\n VELASTACK_KIT,\n VELASTACK_POCKETBASE,\n} from \"../../../core/constants\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [\n VELASTACK_POCKETBASE,\n VELASTACK_KIT,\n spec(\"pocketbase-sveltekit\"),\n // The adapter the config is switched to has to be installed with it,\n // or the config fails to load and takes every .svelte file with it.\n ADAPTER_NODE,\n // test/setup.ts and the server tests other patterns add need these; the\n // minimal template ships them, the static one does not. The same\n // ranges as the template's, so both kinds of project end up alike.\n spec(\"vitest\"),\n spec(\"supertest\"),\n spec(\"@types/supertest\"),\n ],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { BACKEND_ENV_VARS } from \"./env-vars\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .concat({\n // Built from the same declarations the runtime writes.\n path: \"src/env.ts\",\n language: languageFromPath(\"src/env.ts\"),\n content: envVarsFile(BACKEND_ENV_VARS),\n status: \"success\" as const,\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-backend\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/enable/backend\";\nconst DOCS = \"/enable/backend\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n // An existing hooks.server.ts is composed into by the runtime instead.\n const { keepMissing } = await import(\"../../../runtime/modify-file\");\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: keepMissing(baseRes.creates, options.root) },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable Backend\",\n summary:\n \"Adds the PocketBase backend: installs @velastack/pocketbase and pocketbase-sveltekit, wires up hooks.server.ts, scaffolds the data/ directory, and switches the SvelteKit adapter to adapter-node.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"backend\" as const,\n tags: [\"sveltekit\", \"pocketbase\", \"backend\", \"velastack\"],\n\n command: {\n raw: \"vela enable backend\",\n base: \"vela enable backend\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsWithNegotiationRaw = import.meta.glob<string>(\n \"./creates-with-negotiation/**\",\n {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n },\n);\n\nconst CREATES_PREFIX = \"./creates/\";\nconst CREATES_WITH_NEGOTIATION_PREFIX = \"./creates-with-negotiation/\";\n\nfunction filesFromGlob(\n raw: Record<string, string>,\n prefix: string,\n): Record<string, File> {\n const files: Record<string, File> = {};\n for (const [key, content] of Object.entries(raw)) {\n const path = appRelativePath(key, prefix);\n files[path] = {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n }\n return files;\n}\n\nexport async function generate(options: Options) {\n const base = filesFromGlob(createsRaw, CREATES_PREFIX);\n const creates: Record<string, File> = { ...base };\n\n if (options.features.contentNegotiation) {\n const withNegotiation = filesFromGlob(\n createsWithNegotiationRaw,\n CREATES_WITH_NEGOTIATION_PREFIX,\n );\n Object.assign(creates, withNegotiation);\n }\n\n const sortedCreates = Object.values(creates).sort((a, b) =>\n a.path.localeCompare(b.path),\n );\n\n return {\n creates: sortedCreates,\n modifies: [],\n deletes: [],\n components: [\"avatar\", \"badge\", \"breadcrumb\", \"card\", \"separator\"],\n packages: [spec(\"mdsvex\")],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-blog\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/blog\";\nconst DOCS = \"/enable/blog\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable blog\",\n summary:\n \"Adds an mdsvex-powered blog with post list, tags, RSS feed, and example posts.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"content\" as const,\n tags: [\"sveltekit\", \"blog\", \"mdsvex\", \"markdown\", \"content\", \"rss\"],\n\n command: {\n raw: \"vela enable blog\",\n base: \"vela enable blog\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-cms\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/enable/cms\";\nconst DOCS = \"/enable/cms\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs or ts-morph into SSR.\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const { keepMissing } = await import(\"../../../runtime/modify-file\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: keepMissing(baseRes.creates, options.root) },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable CMS\",\n summary:\n \"Adds an inline-editing CMS with an admin bar, served from the app's own backend or a hosted one.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n // An app with a server hosts the backend itself; a static site reads from\n // a hosted CMS via --endpoint. Neither needs PocketBase.\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"content\" as const,\n tags: [\n \"sveltekit\",\n \"cms\",\n \"content\",\n \"inline-editing\",\n \"sqlite\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable cms\",\n base: \"vela enable cms\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--endpoint https://velastack.dev/v1/projects/<project>/cms\",\n description:\n \"Read from a hosted CMS instead of running the backend in the app — the only shape a static site can use.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import { NEGOTIATE, PUBLIC_DIR } from \"../../../core/constants\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsWithBlogRaw = import.meta.glob<string>(\"./creates-with-blog/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\nconst CREATES_WITH_BLOG_PREFIX = \"./creates-with-blog/\";\n\n/** Where the routes are stored; `inPublicGroup` moves them to the project's own group. */\nconst STORED_PUBLIC_DIR = `src/routes/${PUBLIC_DIR}/`;\n\n/**\n * A stored route path in the project's public group, or straight under\n * `src/routes` in a project without one (a SvelteKit project vela did not\n * create). Shared with disable-content-negotiation so it deletes what this\n * wrote.\n */\nexport function inPublicGroup(\n filePath: string,\n { routeGroups }: Pick<Options, \"routeGroups\">,\n): string {\n if (!routeGroups || !filePath.startsWith(STORED_PUBLIC_DIR)) return filePath;\n const group = routeGroups.public ? `${routeGroups.public}/` : \"\";\n return `src/routes/${group}${filePath.slice(STORED_PUBLIC_DIR.length)}`;\n}\n\n/** The demo page's meta tags loader, which imports `svelte-meta-tags`. */\nconst META_TAGS_LOADER = /\\/negotiate\\/\\+page\\.ts$/;\n\nfunction filesFromGlob(\n raw: Record<string, string>,\n prefix: string,\n): Record<string, File> {\n const files: Record<string, File> = {};\n for (const [key, content] of Object.entries(raw)) {\n const path = appRelativePath(key, prefix);\n files[path] = {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\",\n };\n }\n return files;\n}\n\nexport async function generate(options: Options) {\n const base = filesFromGlob(createsRaw, CREATES_PREFIX);\n const creates: Record<string, File> = { ...base };\n\n if (options.features.blog) {\n const withBlog = filesFromGlob(\n createsWithBlogRaw,\n CREATES_WITH_BLOG_PREFIX,\n );\n Object.assign(creates, withBlog);\n }\n\n // `svelte-meta-tags` is part of vela's templates, where the root layout\n // renders what the loader returns. A project without it has nothing to\n // render them with, so the loader is left out rather than the package added.\n const metaTags = options.input.metaTags ?? true;\n\n const sortedCreates = Object.values(creates)\n .filter((file) => metaTags || !META_TAGS_LOADER.test(file.path))\n .map((file) => ({ ...file, path: inPublicGroup(file.path, options) }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: sortedCreates,\n modifies: [],\n deletes: [],\n components: [],\n packages: [NEGOTIATE],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-content-negotiation\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/content-negotiation\";\nconst DOCS = \"/enable/content-negotiation\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable content negotiation\",\n summary:\n \"Serves the same route as HTML, Markdown, or JSON using sveltekit-negotiate.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"content-negotiation\", \"markdown\", \"json\", \"api\"],\n\n command: {\n raw: \"vela enable content-negotiation\",\n base: \"vela enable content-negotiation\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { WUCHALE, WUCHALE_SVELTE } from \"../../../core/constants\";\nimport { composeCreates } from \"../../../core/util\";\nimport { resolveUi } from \"../../../core/field/ui\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n// A plain project gets a native <select> in place of the shadcn one, at the\n// same path, so the root layout import and disable-i18n cover both.\nconst variantsRaw = import.meta.glob<string>(\"./variants/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(options: Options) {\n const ui = resolveUi(options);\n const creates = composeCreates(\n createsRaw,\n CREATES_PREFIX,\n variantsRaw,\n ui === \"plain\" ? \"plain\" : undefined,\n );\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: ui === \"plain\" ? [] : [\"select\"],\n packages: [WUCHALE, WUCHALE_SVELTE],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-i18n\" as const;\nconst VERSION = \"1.3.0\";\nconst SOURCE = \"src/patterns/enable/i18n\";\nconst DOCS = \"/enable/i18n\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime, withLibraryTexts } =\n await import(\"./generate.runtime\");\n baseRes.creates = withLibraryTexts(options.root, baseRes.creates);\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable i18n\",\n summary: \"Enables i18n with Wuchale and locale-aware routing.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"i18n\" as const,\n tags: [\"sveltekit\", \"i18n\", \"localization\", \"wuchale\", \"velastack\"],\n\n command: {\n raw: \"vela enable i18n\",\n base: \"vela enable i18n\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { VELASTACK_POCKETBASE } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n // `requireUser` in the generated code is new in this floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [VELASTACK_POCKETBASE],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { CollectionSpec } from \"../../../../core/types\";\nimport { NOTIFICATION_RULE_PATCHES } from \"./pocketbase\";\n\nconst users = \"users\";\n\nfunction rulesFor(collectionName: string) {\n const p = NOTIFICATION_RULE_PATCHES.find(\n (x) => x.collectionName === collectionName,\n );\n if (!p) {\n throw new Error(\n `notifications: missing NOTIFICATION_RULE_PATCHES entry for \"${collectionName}\"`,\n );\n }\n return {\n listRule: p.listRule,\n viewRule: p.viewRule,\n createRule: p.createRule,\n updateRule: p.updateRule,\n deleteRule: p.deleteRule,\n };\n}\n\nexport const NOTIFICATIONS_PREVIEW_COLLECTIONS: CollectionSpec[] = [\n {\n name: \"notifications\",\n type: \"base\",\n ...rulesFor(\"notifications\"),\n indexes: [\n \"CREATE INDEX `idx_notifications_user_read_created` ON `notifications` (`user`, `read`, `created` DESC)\",\n ],\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"user\",\n type: \"relation\",\n cascadeDelete: true,\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"title\",\n type: \"text\",\n required: true,\n },\n {\n name: \"body\",\n type: \"text\",\n },\n {\n name: \"read\",\n type: \"bool\",\n },\n {\n name: \"created\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: false,\n },\n {\n name: \"updated\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: true,\n },\n ],\n },\n];\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { NOTIFICATIONS_PREVIEW_COLLECTIONS } from \"./runtime/collections\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: NOTIFICATIONS_PREVIEW_COLLECTIONS,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-notifications\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/enable/notifications\";\nconst DOCS = \"/enable/notifications\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable notifications\",\n summary:\n \"Adds an in-app notifications collection, a bell dropdown with 30s polling, and a /notifications page for managing read state.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"notifications\",\n \"pocketbase\",\n \"velastack\",\n \"in-app\",\n \"polling\",\n ],\n\n command: {\n raw: \"vela enable notifications\",\n base: \"vela enable notifications\",\n argv: [],\n },\n\n examples: [],\n\n tests: 6,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import dedent from \"dedent\";\nimport type { File, Options, Result } from \"../../../core/types\";\nimport { resolveProvider } from \"../../../core/providers\";\nimport { filesUnderPrefix } from \"../../../core/util\";\nimport { envEditsFor, META } from \"./generate\";\nimport { buyPageSnippet } from \"./shopify-page\";\nimport { siteModule } from \"../../../runtime/site\";\nimport {\n PAYMENTS_APP_MODE_COLLECTIONS,\n PAYMENTS_BASE_COLLECTIONS,\n} from \"./runtime/collections\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PRICE_ID = \"price_preview_placeholder\";\nconst PREVIEW_VARIANT_ID = \"gid://shopify/ProductVariant/preview\";\n\nfunction orderPageSnippet(): string {\n return dedent`\n <script lang=\"ts\">\n import OrderButton from '#lib/components/payments/order-button.svelte';\n </script>\n\n <section data-role=\"content\">\n <OrderButton name=\"Sourdough loaf\" price={4.5} />\n </section>\n `;\n}\n\nfunction paymentPageSnippet(priceId: string): string {\n return dedent`\n <script lang=\"ts\">\n import PaymentButton from '#lib/components/payments/payment-button.svelte';\n </script>\n\n <section data-role=\"content\">\n <PaymentButton priceId=\"${priceId}\" />\n </section>\n `;\n}\n\nexport async function generate(options: Options) {\n const provider = resolveProvider(META, options);\n const isStripe = provider.id === \"stripe\";\n const isAppMode = options.features.auth;\n\n const modifies = Object.values(\n filesUnderPrefix(previewRaw, `./preview-modifies/${provider.id}/`),\n );\n // Built, not stored: Vite will not serve a file named `.env`, and these are\n // the lines the runtime writes.\n modifies.push({\n path: \".env\",\n language: \"text\",\n content:\n envEditsFor(provider)\n .map((edit) =>\n edit.type === \"comment\"\n ? `# ${edit.key}`\n : `${edit.key}=${edit.value}`,\n )\n .join(\"\\n\") + \"\\n\",\n status: \"success\",\n });\n // What the business declares: its currency and country, and the other\n // currencies it shows prices in.\n modifies.push({\n path: \"src/lib/site.ts\",\n language: \"typescript\",\n content: siteModule(\"My App\", undefined, {\n currency: \"MXN\",\n country: \"MX\",\n currencies: [\"USD\"],\n }),\n status: \"success\",\n });\n modifies.sort((a, b) => a.path.localeCompare(b.path));\n\n const paymentPage: File = {\n path: \"src/routes/(public)/payment/+page.svelte\",\n language: \"svelte\",\n content:\n provider.id === \"stripe\"\n ? paymentPageSnippet(PREVIEW_PRICE_ID)\n : provider.id === \"shopify\"\n ? buyPageSnippet(PREVIEW_VARIANT_ID)\n : orderPageSnippet(),\n status: \"success\",\n };\n\n const collections = isStripe\n ? [\n ...PAYMENTS_BASE_COLLECTIONS,\n ...(isAppMode ? PAYMENTS_APP_MODE_COLLECTIONS : []),\n ]\n : [];\n\n return {\n creates: [paymentPage],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-payments\" as const;\nconst VERSION = \"2.5.0\";\nconst SOURCE = \"src/patterns/enable/payments\";\nconst DOCS = \"/enable/payments\";\n\nexport async function generate(options: Options) {\n if (options.env === \"preview\") {\n const baseRes = await generateBase(options);\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime, hasVitest } =\n await import(\"./generate.runtime\");\n const baseRes = await generateBase(options, {\n unitTests: hasVitest(options.root),\n });\n // Before the runtime step creates collections: a component that cannot be\n // installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable payments\",\n summary:\n \"Adds payments with Stripe (product/price sync, a checkout dialog, and saved payment methods when auth is enabled), Shopify (a Storefront client and a Buy button that hands off to Shopify's checkout), or WhatsApp (an Order button that opens a prefilled chat with the business and records the order to a hosted VelaStack form).\",\n // Stripe adds backend and workflows; see its provider entry.\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"pocketbase\",\n \"velastack\",\n \"checkout\",\n ],\n\n command: {\n raw: \"vela enable payments --provider stripe\",\n base: \"vela enable payments\",\n argv: [],\n },\n\n examples: [\n {\n command: \"--provider stripe\",\n description:\n \"Stripe keys in .env, products and prices synced into PocketBase, and a /payment page with a checkout dialog.\",\n },\n {\n command: \"--provider shopify\",\n description:\n \"A Storefront API client and a Buy button that sends the buyer to Shopify's checkout. No backend needed.\",\n },\n {\n command: \"--provider whatsapp\",\n description:\n \"An Order on WhatsApp button: the customer's name, phone and order open a chat with the business, and the order is recorded to a hosted VelaStack form. No backend needed.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Provider, Result } from \"../../../core/types\";\nimport { providerCreates, resolveProvider } from \"../../../core/providers\";\nimport { filesFromGlob } from \"../../../core/util\";\n\n/**\n * The payments providers ecommerce supports. It writes no env of its own:\n * the provider is whichever payments uses, and payments wrote the keys.\n */\nexport const PROVIDERS: Provider[] = [\n // The cart page's checkout action and the demo page run on the server.\n { id: \"stripe\", label: \"Stripe\", requires: { backend: true } },\n { id: \"shopify\", label: \"Shopify\" },\n // Checkout opens a WhatsApp chat in the browser; nothing runs on a server.\n { id: \"whatsapp\", label: \"WhatsApp\" },\n];\n\nexport const META = {\n slug: \"enable-ecommerce\",\n providers: PROVIDERS,\n inheritsProvider: \"payments\",\n};\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst providersRaw = import.meta.glob<string>(\"./providers/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst providersAppModeRaw = import.meta.glob<string>(\n \"./providers-app-mode/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nexport interface GenerateContext {\n /**\n * The project has payments' Stripe customer helper, so checkout can attach\n * the signed-in buyer. Only the runtime can look; preview shows the guest\n * version.\n */\n stripeCustomer?: boolean;\n}\n\nexport async function generate(\n options: Options,\n { stripeCustomer = false }: GenerateContext = {},\n) {\n const provider = resolveProvider(META, options);\n\n const creates = new Map<string, File>();\n const add = (files: File[]) => {\n for (const file of files) creates.set(file.path, file);\n };\n add(Object.values(filesFromGlob(createsRaw, \"./creates/\")));\n add(providerCreates(providersRaw, provider.id));\n if (provider.id === \"stripe\" && stripeCustomer) {\n add(\n providerCreates(\n providersAppModeRaw,\n provider.id,\n \"./providers-app-mode/\",\n ),\n );\n }\n\n return {\n creates: [...creates.values()].sort((a, b) => a.path.localeCompare(b.path)),\n modifies: [],\n deletes: [],\n components: [\"sheet\", \"button\", \"badge\", \"separator\"],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { resolveProvider } from \"../../../core/providers\";\nimport { filesFromGlob } from \"../../../core/util\";\nimport { META } from \"./generate\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nexport async function generate(options: Options) {\n // The cart's files come from the base generator; the preview adds the\n // navbar change. A shop page is `generate-shop`'s.\n resolveProvider(META, options);\n\n return {\n creates: [],\n modifies: Object.values(\n filesFromGlob(previewRaw, \"./preview-modifies/\"),\n ).sort((a, b) => a.path.localeCompare(b.path)),\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, META, PROVIDERS } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-ecommerce\" as const;\nconst VERSION = \"2.2.0\";\nconst SOURCE = \"src/patterns/enable/ecommerce\";\nconst DOCS = \"/enable/ecommerce\";\n\nexport async function generate(options: Options) {\n if (options.env === \"preview\") {\n const baseRes = await generateBase(options);\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime, hasStripeCustomer } =\n await import(\"./generate.runtime\");\n const baseRes = await generateBase(options, {\n stripeCustomer: hasStripeCustomer(options.root),\n });\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable ecommerce\",\n summary:\n \"Adds a cart to the navbar and a checkout, on the project's payments provider: a browser cart that checks out through Stripe Checkout, a Shopify Storefront cart that hands off to Shopify's checkout, or a browser cart whose checkout opens a WhatsApp chat with the business and records the order to a hosted VelaStack form.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The cart is shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"ecommerce\",\n \"cart\",\n \"checkout\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable ecommerce\",\n base: \"vela enable ecommerce\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n providers: PROVIDERS,\n inheritsProvider: META.inheritsProvider,\n\n generate,\n} satisfies Pattern;\n","import type { CollectionSpec, Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { VELASTACK_POCKETBASE } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nconst stripeSubscriptions: CollectionSpec = {\n name: \"stripe_subscriptions\",\n type: \"base\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-zA-Z0-9_]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n collectionId: \"_pb_users_auth_\",\n maxSelect: 1,\n minSelect: 0,\n name: \"user\",\n required: true,\n type: \"relation\",\n },\n {\n collectionId: \"stripe_customers\",\n maxSelect: 1,\n minSelect: 0,\n name: \"customer\",\n required: true,\n type: \"relation\",\n cascadeDelete: true,\n },\n {\n collectionId: \"stripe_prices\",\n maxSelect: 1,\n minSelect: 0,\n name: \"price\",\n required: true,\n type: \"relation\",\n },\n { name: \"status\", required: true, type: \"text\" },\n { name: \"current_period_start\", required: false, type: \"date\" },\n { name: \"current_period_end\", required: false, type: \"date\" },\n { name: \"cancel_at_period_end\", required: false, type: \"bool\" },\n { name: \"canceled_at\", required: false, type: \"date\" },\n { name: \"created\", onCreate: true, onUpdate: false, type: \"autodate\" },\n { name: \"updated\", onCreate: true, onUpdate: true, type: \"autodate\" },\n ],\n};\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n // `requireUser` in the generated code is new in this floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [VELASTACK_POCKETBASE],\n collections: [stripeSubscriptions],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-subscriptions\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/enable/subscriptions\";\nconst DOCS = \"/enable/subscriptions\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { assertPaymentsAppMode, generate: generateRuntime } =\n await import(\"./generate.runtime\");\n assertPaymentsAppMode(options.root);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable subscriptions\",\n summary:\n \"Adds Stripe subscription billing with plan selection, cancel/resume, and webhook-synced subscription state. Requires enable-payments.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n workflows: true,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n // Stripe Billing: Shopify sells subscriptions through its own apps.\n providers: { payments: [\"stripe\"] },\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"subscriptions\",\n \"pocketbase\",\n \"velastack\",\n \"billing\",\n ],\n\n command: {\n raw: \"vela enable subscriptions\",\n base: \"vela enable subscriptions\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/** The files enable-orders changes, in their final state, for the preview. */\nexport async function generate(_options: Options) {\n return {\n creates: [],\n modifies: Object.values(\n filesFromGlob(previewRaw, \"./preview-modifies/\"),\n ).sort((a, b) => a.path.localeCompare(b.path)),\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-orders\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/enable/orders\";\nconst DOCS = \"/enable/orders\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the collections: PocketBase writes a migration for each one, and a\n // component that cannot be installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { createCollections } = await import(\"../../../runtime/collections\");\n const migrationCreates = await createCollections(\n baseRes.collections,\n options,\n );\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n { ...baseRes, creates: [...baseRes.creates, ...migrationCreates] },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable orders\",\n summary:\n \"Records what was bought through Stripe Checkout: orders and their lines, written by the webhook so a redelivery updates rather than duplicates. The success page shows the order; with auth, users see their own orders, and a paid order notifies them when notifications are on.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n workflows: true,\n ecommerce: true,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n // Shopify keeps its own orders; WhatsApp orders are hosted-form submissions.\n providers: { payments: [\"stripe\"] },\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"ecommerce\",\n \"orders\",\n \"stripe\",\n \"webhooks\",\n \"pocketbase\",\n \"velastack\",\n ],\n command: {\n raw: \"vela enable orders\",\n base: \"vela enable orders\",\n argv: [],\n },\n examples: [],\n tests: 0,\n baseline: \"velastack\",\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { VELASTACK_POCKETBASE } from \"../../../core/constants\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [\n \"card\",\n \"button\",\n \"avatar\",\n \"badge\",\n \"table\",\n \"alert-dialog\",\n \"form\",\n \"input\",\n \"dialog\",\n \"select\",\n \"dropdown-menu\",\n ],\n // `requireUser` in the generated code is new in this floor of\n // @velastack/pocketbase: a project on an older release is raised to it.\n packages: [VELASTACK_POCKETBASE],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { CollectionSpec } from \"../../../../core/types\";\nimport {\n TEAM_INVITES_INDEX,\n TEAM_MEMBERSHIPS_INDEX,\n TEAM_RULE_PATCHES,\n teamInviteFields,\n} from \"./pocketbase\";\n\n/** Relation targets use collection names as readable stand-ins for PocketBase collection ids in preview. */\nconst users = \"users\";\nconst teams = \"teams\";\nconst teamMemberships = \"team_memberships\";\n\nfunction rulesFor(collectionName: string) {\n const p = TEAM_RULE_PATCHES.find((x) => x.collectionName === collectionName);\n if (!p) {\n throw new Error(\n `teams: missing TEAM_RULE_PATCHES entry for \"${collectionName}\"`,\n );\n }\n return {\n listRule: p.listRule,\n viewRule: p.viewRule,\n createRule: p.createRule,\n updateRule: p.updateRule,\n deleteRule: p.deleteRule,\n };\n}\n\n/**\n * PocketBase collections created at runtime (see `generate.runtime.ts`), with API rules merged.\n * Exposed in preview results for docs and schema previews without running migrations.\n */\nexport const TEAMS_PREVIEW_COLLECTIONS: CollectionSpec[] = [\n {\n name: \"teams\",\n type: \"base\",\n ...rulesFor(\"teams\"),\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"name\",\n type: \"text\",\n required: true,\n },\n {\n name: \"owner\",\n type: \"relation\",\n cascadeDelete: false,\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"created\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: false,\n },\n {\n name: \"updated\",\n type: \"autodate\",\n onCreate: true,\n onUpdate: true,\n },\n ],\n },\n {\n name: \"team_memberships\",\n type: \"base\",\n ...rulesFor(\"team_memberships\"),\n indexes: [TEAM_MEMBERSHIPS_INDEX],\n fields: [\n {\n name: \"id\",\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n name: \"team\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"user\",\n cascadeDelete: true,\n collectionId: users,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"role\",\n maxSelect: 1,\n required: true,\n type: \"select\",\n values: [\"owner\", \"admin\", \"member\"],\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n },\n {\n name: \"team_users\",\n type: \"view\",\n ...rulesFor(\"team_users\"),\n viewQuery:\n \"select users.id, users.email, users.name, team_memberships.id as membership_id, team_memberships.team, team_memberships.role from users join team_memberships on team_memberships.user = users.id;\",\n fields: [\n {\n name: \"id\",\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n name: \"email\",\n exceptDomains: null,\n onlyDomains: null,\n // Accounts made with a phone number may have no email.\n required: false,\n type: \"email\",\n },\n {\n name: \"name\",\n max: 255,\n required: false,\n type: \"text\",\n },\n {\n name: \"membership_id\",\n cascadeDelete: false,\n collectionId: teamMemberships,\n maxSelect: 1,\n minSelect: 0,\n required: false,\n type: \"relation\",\n },\n {\n name: \"team\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"role\",\n maxSelect: 1,\n required: true,\n type: \"select\",\n values: [\"owner\", \"admin\", \"member\"],\n },\n ],\n },\n {\n name: \"team_invites\",\n type: \"base\",\n ...rulesFor(\"team_invites\"),\n indexes: [TEAM_INVITES_INDEX],\n fields: [\n {\n name: \"id\",\n type: \"text\",\n primaryKey: true,\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n required: true,\n },\n {\n name: \"team\",\n type: \"relation\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n },\n {\n name: \"email\",\n type: \"email\",\n required: true,\n },\n ...teamInviteFields(users),\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n },\n {\n name: \"team_invite_links\",\n type: \"base\",\n ...rulesFor(\"team_invite_links\"),\n indexes: [\n \"CREATE UNIQUE INDEX `idx_9y3Oz1KVzz` ON `team_invite_links` (`team`)\",\n ],\n fields: [\n {\n name: \"id\",\n autogeneratePattern: \"[a-z0-9]{15}\",\n max: 15,\n min: 15,\n pattern: \"^[a-z0-9]+$\",\n primaryKey: true,\n required: true,\n type: \"text\",\n },\n {\n name: \"team\",\n cascadeDelete: true,\n collectionId: teams,\n maxSelect: 1,\n minSelect: 0,\n required: true,\n type: \"relation\",\n },\n {\n name: \"created\",\n onCreate: true,\n onUpdate: false,\n type: \"autodate\",\n },\n {\n name: \"updated\",\n onCreate: true,\n onUpdate: true,\n type: \"autodate\",\n },\n ],\n },\n];\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { TEAMS_PREVIEW_COLLECTIONS } from \"./runtime/collections\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: TEAMS_PREVIEW_COLLECTIONS,\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-teams\" as const;\nconst VERSION = \"1.3.0\";\nconst SOURCE = \"src/patterns/enable/teams\";\nconst DOCS = \"/enable/teams\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Before the runtime step creates collections: a component that cannot be\n // installed should leave nothing behind.\n const { assertComponentsAvailable } =\n await import(\"../../../runtime/write-result\");\n await assertComponentsAvailable(options.root, baseRes.components, options);\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Enable teams\",\n summary:\n \"Adds multi-tenant teams with memberships, invites, and a sidebar team switcher.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"teams\",\n \"pocketbase\",\n \"velastack\",\n \"multi-tenant\",\n \"collaboration\",\n ],\n\n command: {\n raw: \"vela enable teams\",\n base: \"vela enable teams\",\n argv: [],\n },\n\n examples: [],\n\n tests: 53,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst createsSuperformsRaw = import.meta.glob<string>(\n \"./creates-superforms/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst createsRemoteRaw = import.meta.glob<string>(\"./creates-remote/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\n/**\n * The WhatsApp client helpers and the code page, in the form style of the\n * project's auth pages: superforms actions, or remote functions (auth-remote).\n */\nexport async function generate(\n _options: Options,\n mode: \"superforms\" | \"remote\" = \"superforms\",\n) {\n const creates: Record<string, File> = {\n ...filesFromGlob(createsRaw, \"./creates/\"),\n ...(mode === \"remote\"\n ? filesFromGlob(createsRemoteRaw, \"./creates-remote/\")\n : filesFromGlob(createsSuperformsRaw, \"./creates-superforms/\")),\n };\n\n return {\n creates: Object.values(creates).sort((a, b) =>\n a.path.localeCompare(b.path),\n ),\n modifies: [],\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob } from \"../../../core/util\";\n\n// The base login and signup pages with WhatsApp, as `enable whatsapp` writes\n// them over the stock enable-auth ones.\nconst previewRaw = import.meta.glob<string>(\"./templates/base/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nexport async function generate(_options: Options) {\n const modifies = Object.values(\n filesFromGlob(previewRaw, \"./templates/base/\"),\n ).sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-whatsapp\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/whatsapp\";\nconst DOCS = \"/enable/whatsapp\";\n\nexport async function generate(options: Options) {\n if (options.env === \"runtime\" && !options.features.auth) {\n throw new InvalidArgumentError(\n \"WhatsApp sign-in goes on the login and signup pages. Run `vela enable auth` first.\",\n );\n }\n\n if (options.env === \"preview\") {\n const baseRes = await generateBase(options);\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n // Runtime-only modules stay behind dynamic imports so the website's preview\n // bundle never pulls node:fs, prettier or ts-morph into SSR.\n const { detectMode } = await import(\"./modifies/auth-pages\");\n const { keepMissing } = await import(\"../../../runtime/modify-file\");\n const baseRes = await generateBase(options, detectMode(options.root));\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(\n mergeResults([\n // A re-run keeps the code page and helpers as the project has them.\n { ...baseRes, creates: keepMissing(baseRes.creates, options.root) },\n runtimeRes,\n ]),\n options,\n ),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable WhatsApp sign-in\",\n summary:\n \"Adds sign-in and signup with a code sent on WhatsApp to the login and signup pages, next to email. Requires enable-auth.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // The pages are shadcn-svelte markup; there is no plain variant.\n ui: \"shadcn\",\n },\n category: \"auth\" as const,\n tags: [\n \"sveltekit\",\n \"authentication\",\n \"auth\",\n \"whatsapp\",\n \"otp\",\n \"pocketbase\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable whatsapp\",\n base: \"vela enable whatsapp\",\n argv: [],\n },\n\n examples: [],\n\n tests: 2,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { spec } from \"../../../core/versions\";\n\nconst createsRaw = import.meta.glob<string>(\"./creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"./creates/\";\n\n/**\n * The same three packages the base template lists. `openworkflow` is the\n * engine's client and worker, `openworkflow-pocketbase` its PocketBase\n * backend, and `croner` matches the cron expressions recurring workflows\n * export; none of them has runtime dependencies of its own.\n */\nexport const WORKFLOW_PACKAGES = [\n spec(\"openworkflow\"),\n spec(\"openworkflow-pocketbase\"),\n spec(\"croner\"),\n];\n\nexport async function generate(_options: Options) {\n const creates = Object.entries(createsRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates,\n modifies: [],\n deletes: [],\n components: [],\n packages: WORKFLOW_PACKAGES,\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { envVarsFile } from \"../../../runtime/env-vars-file\";\nimport { WORKFLOWS_ENV_VARS } from \"./env-vars\";\n\nconst previewRaw = import.meta.glob<string>(\"./preview-modifies/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst PREVIEW_PREFIX = \"./preview-modifies/\";\n\nexport async function generate(_options: Options) {\n const modifies = Object.entries(previewRaw)\n .map(([key, content]) => {\n const path = appRelativePath(key, PREVIEW_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content,\n status: \"success\" as const,\n };\n })\n .concat({\n // Built from the same declarations the runtime writes.\n path: \"src/env.ts\",\n language: languageFromPath(\"src/env.ts\"),\n content: envVarsFile(WORKFLOWS_ENV_VARS),\n status: \"success\" as const,\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies,\n deletes: [],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\nimport { generate as generatePreview } from \"./generate.preview\";\n\nconst SLUG = \"enable-workflows\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/enable/workflows\";\nconst DOCS = \"/enable/workflows\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env === \"preview\") {\n const previewRes = await generatePreview(options);\n return formatResult(mergeResults([baseRes, previewRes]), options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\n/**\n * The upgrade path. Projects created from the base template already carry\n * `src/lib/server/workflows.ts`, `src/lib/workflows/` and the `init` hook;\n * this brings a project created before that up to the same shape. The files\n * it creates are the template's, byte for byte, so on a current project it\n * changes nothing.\n */\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Enable workflows\",\n summary:\n \"Adds durable background workflows on the OpenWorkflow engine built into PocketBase: a worker started from hooks.server.ts, src/lib/workflows/ for workflow modules, and cron support for recurring ones.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"backend\" as const,\n tags: [\n \"sveltekit\",\n \"pocketbase\",\n \"openworkflow\",\n \"workflows\",\n \"background jobs\",\n \"cron\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela enable workflows\",\n base: \"vela enable workflows\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { languageFromPath } from \"../../../core/util\";\nimport { parseModel } from \"../../../parse/model\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n\n const schemaFile: File = {\n path: schemaPath,\n language: languageFromPath(schemaPath),\n content: \"\",\n status: \"success\",\n };\n\n return {\n creates: [],\n modifies: [],\n deletes: [schemaFile],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"destroy-schema\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/schema\";\nconst DOCS = \"/destroy/schema\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n const formatted = await formatResult(baseRes, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a schema\",\n summary: \"Removes the zod schema file created by generate-schema.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"zod\", \"schema\", \"pocketbase\"],\n\n command: {\n raw: \"vela destroy schema contact\",\n base: \"vela destroy schema\",\n argv: [\"contact\"],\n },\n\n examples: [\n {\n command: \"login\",\n description: \"Remove the login validation schema.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { parseModel, parseRoute } from \"../../../parse\";\nimport { toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-form\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/form\";\nconst DOCS = \"/destroy/form\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const route = parseRoute(options.input.route, model, options, \"form\");\n const routeDir = route.fileBase;\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: [toDeleteEntry(routeDir), toDeleteEntry(schemaPath)],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a form\",\n summary:\n \"Removes the route directory and schema file created by generate-form.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"form\", \"sveltekit\", \"pocketbase\"],\n\n command: {\n raw: \"vela destroy form contact\",\n base: \"vela destroy form\",\n argv: [\"contact\"],\n },\n\n examples: [\n {\n command: \"login\",\n description: \"Remove the login form.\",\n },\n {\n command: 'project --route \"(app)/[team_id]/projects/new\"',\n description:\n \"Remove a form generated under a custom route. --route must match the create command.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { parseModel } from \"../../../parse/model\";\nimport { planDropsForCollections, toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-resource\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/resource\";\nconst DOCS = \"/destroy/resource\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const collectionDrops = await planDropsForCollections(\n [model.tableName],\n options,\n );\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: [toDeleteEntry(schemaPath)],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a resource\",\n summary:\n \"Drops the collection and removes the schema file created by generate-resource.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"pocketbase\", \"resource\", \"schema\"],\n\n command: {\n raw: \"vela destroy resource contacts\",\n base: \"vela destroy resource\",\n argv: [\"contacts\"],\n },\n\n examples: [\n {\n command: \"articles\",\n description: \"Remove an articles resource.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { InvalidArgumentError } from \"../../../core/errors\";\nimport { parseModel, parseRoute, scaffoldFilePaths } from \"../../../parse\";\nimport { planDropsForCollections, toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-scaffold\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/scaffold\";\nconst DOCS = \"/destroy/scaffold\";\n\nexport async function generate(options: Options) {\n const [modelPath] = options.argv;\n if (!modelPath) {\n throw new InvalidArgumentError(\n \"Invalid command arguments. Expected: <model>\",\n );\n }\n\n const model = parseModel(modelPath);\n const route = parseRoute(options.input.route, model, options, \"scaffold\");\n const paths = scaffoldFilePaths(route);\n const schemaPath = `src/lib/schemas/${model.name}.ts`;\n const collectionDrops = await planDropsForCollections(\n [model.tableName],\n options,\n );\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: [toDeleteEntry(paths.list), toDeleteEntry(schemaPath)],\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops,\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Destroy a scaffold\",\n summary:\n \"Removes the route directory and schema file created by generate-scaffold and drops the collection. Retains shadcn components.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"generators\" as const,\n tags: [\"crud\", \"scaffold\", \"pocketbase\", \"sveltekit\"],\n\n command: {\n raw: \"vela destroy scaffold contacts\",\n base: \"vela destroy scaffold\",\n argv: [\"contacts\"],\n },\n\n examples: [\n {\n command: \"todos\",\n description: \"Remove a todos scaffold.\",\n },\n {\n command: 'project --route \"(app)/[team_id]/projects\"',\n description:\n \"Remove a scaffold generated under a custom route. --route must match the create command.\",\n },\n ],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern, Result } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { toDeleteEntry } from \"../shared\";\n\nconst SLUG = \"destroy-shop\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/destroy/shop\";\nconst DOCS = \"/destroy/shop\";\n\nconst shopRaw = import.meta.glob<string>(\n [\"../../generate/shop/providers/**\", \"../../generate/shop/providers-cms/**\"],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n/** Every path `generate-shop` can write, whichever provider wrote it. */\nexport const SHOP_PATHS = allProviderPaths(shopRaw);\n\nexport async function generate(options: Options) {\n // The shop follows the payments provider; with none detected (payments\n // already gone) every provider's files are removed, missing ones skipped.\n const detected = options.providers?.payments;\n const paths = detected ? allProviderPaths(shopRaw, detected) : SHOP_PATHS;\n\n const result: Result = {\n creates: [],\n modifies: [],\n deletes: paths.map(toDeleteEntry),\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n };\n const formatted = await formatResult(result, options);\n\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatted;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(formatted, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Destroy a shop\",\n summary:\n \"Removes the shop pages generate-shop wrote (and the catalog module on WhatsApp). The cart, payments and anything in Stripe, Shopify or the CMS stay.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"payments\" as const,\n tags: [\"sveltekit\", \"ecommerce\", \"shop\", \"velastack\"],\n\n command: {\n raw: \"vela destroy shop\",\n base: \"vela destroy shop\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-ai\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/ai\";\nconst DOCS = \"/disable/ai\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable AI\",\n summary:\n \"Removes the AI SDK model module, the /api/chat endpoint and the /ai demo page, strips the provider's API key from .env and uninstalls the AI SDK packages.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"ai\" as const,\n tags: [\n \"sveltekit\",\n \"ai\",\n \"ai-sdk\",\n \"chat\",\n \"vercel-ai-gateway\",\n \"openai\",\n \"anthropic\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela disable ai\",\n base: \"vela disable ai\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-analytics\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/analytics\";\nconst DOCS = \"/disable/analytics\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable analytics\",\n summary:\n \"Removes the analytics component and <Analytics /> from the root layout, strips the provider's variables from .env and uninstalls posthog-js.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"analytics\" as const,\n tags: [\n \"sveltekit\",\n \"analytics\",\n \"plausible\",\n \"google-analytics\",\n \"posthog\",\n \"velastack\",\n ],\n\n command: {\n raw: \"vela disable analytics\",\n base: \"vela disable analytics\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { toDeleteEntry } from \"../../destroy/shared\";\nimport { createdPaths } from \"../../enable/og/generate\";\n\nexport async function generate(_options: Options) {\n return {\n creates: [],\n modifies: [],\n // A card.svelte the project has redesigned goes too; that is what\n // `--destructive` is asked for.\n deletes: createdPaths().map(toDeleteEntry),\n components: [],\n packages: [],\n uninstalls: [\"@takumi-rs/core\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-og\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/og\";\nconst DOCS = \"/disable/og\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable Open Graph images\",\n summary:\n \"Removes the share card, its route and renderer, takes withCard off the root layout and uninstalls @takumi-rs/core.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"content\" as const,\n tags: [\"sveltekit\", \"open-graph\", \"og-image\", \"seo\", \"velastack\"],\n\n command: {\n raw: \"vela disable og\",\n base: \"vela disable og\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/api/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/api/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-api\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/api\";\nconst DOCS = \"/disable/api\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable API\",\n summary: \"Disables the PocketBase API handler.\",\n requires: {\n auth: false,\n api: true,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"api\", \"rest\", \"backend\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable api\",\n base: \"vela disable api\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/api-keys/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/api-keys/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-api-keys\" as const;\nconst VERSION = \"1.0.1\";\nconst SOURCE = \"src/patterns/disable/api-keys\";\nconst DOCS = \"/disable/api-keys\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable API keys\",\n summary:\n \"Removes API key management: drops the api_keys collection, reverts hooks.server and nav-user, deletes generated API key routes.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: true,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\n \"sveltekit\",\n \"api\",\n \"api-keys\",\n \"pocketbase\",\n \"velastack\",\n \"authentication\",\n ],\n\n command: {\n raw: \"vela disable api-keys\",\n base: \"vela disable api-keys\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst authCreatesRaw = import.meta.glob<string>(\n \"../../enable/auth/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\nconst authRemoteCreatesRaw = import.meta.glob<string>(\n \"../../enable/auth-remote/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n// enable-whatsapp's code page and helpers live on the auth pages too.\nconst whatsappCreatesRaw = import.meta.glob<string>(\n [\n \"../../enable/whatsapp/creates/**\",\n \"../../enable/whatsapp/creates-superforms/**\",\n \"../../enable/whatsapp/creates-remote/**\",\n ],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst AUTH_CREATES_PREFIX = \"../../enable/auth/creates/\";\nconst AUTH_REMOTE_CREATES_PREFIX = \"../../enable/auth-remote/creates/\";\nconst WHATSAPP_CREATES_PREFIX =\n /^\\.\\.\\/\\.\\.\\/enable\\/whatsapp\\/creates(-superforms|-remote)?\\//;\n\nexport async function generate(_options: Options) {\n const paths = new Set<string>();\n for (const key of Object.keys(authCreatesRaw)) {\n paths.add(appRelativePath(key, AUTH_CREATES_PREFIX));\n }\n for (const key of Object.keys(authRemoteCreatesRaw)) {\n paths.add(appRelativePath(key, AUTH_REMOTE_CREATES_PREFIX));\n }\n for (const key of Object.keys(whatsappCreatesRaw)) {\n paths.add(key.replace(WHATSAPP_CREATES_PREFIX, \"\"));\n }\n\n const deletes = Array.from(paths)\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-auth\" as const;\nconst VERSION = \"1.1.1\";\nconst SOURCE = \"src/patterns/disable/auth\";\nconst DOCS = \"/disable/auth\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable auth\",\n summary:\n \"Reverts auth integration (including the remote-functions variant): removes auth routes, reverts layout/hooks edits, drops oauth_accounts. Does NOT delete the users collection or user data.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"auth\", \"sveltekit\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable auth\",\n base: \"vela disable auth\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { ADAPTER_STATIC } from \"../../../core/constants\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { WORKFLOW_PACKAGES } from \"../../enable/workflows/generate\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/backend/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/backend/creates/\";\n\n/**\n * Workflows run on PocketBase and their worker starts from hooks.server.ts, so\n * they go with the backend: the runtime, and the workflow modules that import\n * `ow` from it. Left behind they no longer type-check (`App.Locals[\"admin\"]`).\n */\nconst WORKFLOW_PATHS = [\"src/lib/server/workflows.ts\", \"src/lib/workflows\"];\n\n/** `openworkflow@^0.11.0` -> `openworkflow`, `@scope/name@1` -> `@scope/name`. */\nfunction packageName(spec: string): string {\n const at = spec.lastIndexOf(\"@\");\n return at > 0 ? spec.slice(0, at) : spec;\n}\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .concat(\n [\"data\", ...WORKFLOW_PATHS].map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n })),\n )\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n // The adapter the config is switched back to, so the project still builds.\n packages: [ADAPTER_STATIC],\n uninstalls: WORKFLOW_PACKAGES.map(packageName),\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-backend\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/backend\";\nconst DOCS = \"/disable/backend\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n // The runtime reverts hooks.server.ts instead of deleting it, so handles\n // other patterns composed in survive; it reports a delete when nothing did.\n const merged = await formatResult(\n mergeResults([\n {\n ...baseRes,\n deletes: baseRes.deletes.filter(\n (file) => file.path !== \"src/hooks.server.ts\",\n ),\n },\n runtimeRes,\n ]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable Backend\",\n summary:\n \"Removes the PocketBase backend: deletes data/ (the local database, fixtures, hooks and seeds), the background workflows (which run on PocketBase, uninstalling their packages) and every server.test.ts, takes the backend out of hooks.server.ts, removes the PocketBase and workflow variables from src/env.ts, switches the SvelteKit adapter back to static with SPA fallback, and reverts test/setup.ts and .gitignore. An older root layout that read the app name from PocketBase is pointed at src/lib/site.ts. Leaves @velastack/pocketbase and pocketbase-sveltekit installed; uninstall manually.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"backend\" as const,\n tags: [\"sveltekit\", \"pocketbase\", \"backend\", \"velastack\"],\n\n command: {\n raw: \"vela disable backend\",\n base: \"vela disable backend\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\nimport { inPublicGroup } from \"../../enable/content-negotiation/generate\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/content-negotiation/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\n// With blog on, enable-content-negotiation (or enable-blog after it) writes\n// a negotiating blog post loader; it only exists because negotiation did.\nconst createsWithBlogRaw = import.meta.glob<string>(\n \"../../enable/content-negotiation/creates-with-blog/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/content-negotiation/creates/\";\nconst CREATES_WITH_BLOG_PREFIX =\n \"../../enable/content-negotiation/creates-with-blog/\";\n\nexport async function generate(options: Options) {\n const paths = [\n ...Object.keys(createsRaw).map((key) =>\n appRelativePath(key, CREATES_PREFIX),\n ),\n ...Object.keys(createsWithBlogRaw).map((key) =>\n appRelativePath(key, CREATES_WITH_BLOG_PREFIX),\n ),\n ];\n const deletes = [...new Set(paths)]\n .map((path) => inPublicGroup(path, options))\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n // What enable-content-negotiation installed; the CLI detects the feature\n // by this dependency, so disabling has to remove it.\n uninstalls: [\"sveltekit-negotiate\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-content-negotiation\" as const;\nconst VERSION = \"1.1.0\";\nconst SOURCE = \"src/patterns/disable/content-negotiation\";\nconst DOCS = \"/disable/content-negotiation\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable content negotiation\",\n summary:\n \"Removes sveltekit-negotiate wiring: deletes creates, unwraps hooks.server handle, reverts reroute (preserving i18n compose), removes <Negotiate /> from the root layout.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: true,\n cms: false,\n },\n category: \"api\" as const,\n tags: [\"sveltekit\", \"content-negotiation\", \"markdown\", \"json\", \"api\"],\n\n command: {\n raw: \"vela disable content-negotiation\",\n base: \"vela disable content-negotiation\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/i18n/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/i18n/creates/\";\nconst WUCHALE_CACHE = \"src/locales/.wuchale\";\n\nexport async function generate(_options: Options) {\n const deletes = [\n ...Object.keys(createsRaw).map((key) =>\n appRelativePath(key, CREATES_PREFIX),\n ),\n // wuchale's compiled catalogs and proxies: a cache, and git-ignored only\n // while the feature is on.\n WUCHALE_CACHE,\n ]\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n // What enable-i18n installed; the CLI detects the feature by the wuchale\n // dependency, so disabling has to remove it.\n uninstalls: [\"wuchale\", \"@wuchale/svelte\"],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-i18n\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/disable/i18n\";\nconst DOCS = \"/disable/i18n\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable i18n\",\n summary:\n \"Removes i18n: deletes the generated files, uninstalls wuchale, and reverts vite.config, the package.json #locales import, hooks.server, app.html, the root +layout.ts and layout, and the .gitignore and .prettierignore blocks. The wuchale cache (src/locales/.wuchale) and the loaders wuchale wrote in src/locales go; the translation catalogs there stay.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: true,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"i18n\" as const,\n tags: [\"sveltekit\", \"i18n\", \"localization\", \"wuchale\", \"velastack\"],\n\n command: {\n raw: \"vela disable i18n\",\n base: \"vela disable i18n\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/notifications/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/notifications/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-notifications\" as const;\nconst VERSION = \"1.1.2\";\nconst SOURCE = \"src/patterns/disable/notifications\";\nconst DOCS = \"/disable/notifications\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable notifications\",\n summary:\n \"Drops the notifications collection, deletes the bell component, server helpers and /notifications page, and takes the bell and its loader out of the (app) layout.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"sveltekit\", \"notifications\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable notifications\",\n base: \"vela disable notifications\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\"../../enable/teams/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\n\nconst CREATES_PREFIX = \"../../enable/teams/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-teams\" as const;\nconst VERSION = \"1.1.2\";\nconst SOURCE = \"src/patterns/disable/teams\";\nconst DOCS = \"/disable/teams\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable teams\",\n summary:\n \"Removes the teams collections and routes, and reverts the Teams nav item, the team switcher in app-sidebar, the team props in the (app) layout, and the team loader in its +layout.server.ts.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: true,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"teams\", \"pocketbase\", \"velastack\", \"sveltekit\"],\n\n command: {\n raw: \"vela disable teams\",\n base: \"vela disable teams\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { getLogger } from \"../../../core/logger\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase, providersToRemove } from \"./generate\";\n\nconst SLUG = \"disable-payments\" as const;\nconst VERSION = \"2.4.0\";\nconst SOURCE = \"src/patterns/disable/payments\";\nconst DOCS = \"/disable/payments\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n // Stripe's collections live in PocketBase; a Shopify project may have none.\n const isStripe = providersToRemove(options).some(\n (provider) => provider.id === \"stripe\",\n );\n const patchCreates =\n isStripe && options.features.backend\n ? await unlinkStripePaymentMethodsCustomer(options)\n : [];\n // The patch's migration is PocketBase's own writing; format it with the rest.\n const finalResult = await formatResult(\n { ...merged, creates: [...merged.creates, ...patchCreates] },\n options,\n );\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(finalResult, options);\n}\n\nasync function unlinkStripePaymentMethodsCustomer(\n options: Options,\n): Promise<File[]> {\n const { withPocketbase } = await import(\"../../../runtime/pocketbase\");\n const { applyCollectionFieldsPatches } =\n await import(\"../../../runtime/collections\");\n const logger = getLogger(options);\n\n let creates: File[] = [];\n await withPocketbase(options.root, async (pb) => {\n let collection;\n try {\n collection = await pb.collections.getOne(\"stripe_payment_methods\");\n } catch (error) {\n if ((error as { status?: number }).status === 404) return;\n throw error;\n }\n\n if (\n !collection.fields.some((f: { name: string }) => f.name === \"customer\")\n ) {\n return;\n }\n\n creates = await applyCollectionFieldsPatches(\n pb,\n [\n {\n collectionName: \"stripe_payment_methods\",\n changes: [{ op: \"remove\", fieldName: \"customer\" }],\n },\n ],\n options,\n logger,\n );\n });\n return creates;\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable payments\",\n summary:\n \"Removes the detected payment provider's files and env credentials. For Stripe it also drops the Stripe collections and reverts the nav/signup edits. Does NOT touch products in the Stripe dashboard or Shopify admin, orders recorded to a hosted VelaStack form, or uninstall the provider's packages.\",\n // Stripe's collections need the backend, which enable-payments already\n // required for Stripe; Shopify and WhatsApp have none to drop.\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n // The cart imports the payments client, so it has to go first. (Subscriptions\n // would belong here too, but there is no feature flag for it yet.)\n // Each imports the Stripe client or the cart; they come out first.\n blockedBy: [\"ecommerce\", \"subscriptions\", \"orders\"],\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"shopify\",\n \"whatsapp\",\n \"pocketbase\",\n \"velastack\",\n \"checkout\",\n ],\n\n command: {\n raw: \"vela disable payments\",\n base: \"vela disable payments\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { File, Options, Result } from \"../../../core/types\";\nimport { allProviderPaths } from \"../../../core/providers\";\nimport { filesFromGlob, languageFromPath } from \"../../../core/util\";\nimport { PROVIDERS } from \"../../enable/ecommerce/generate\";\nimport { SHOP_PATHS } from \"../../destroy/shop\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/ecommerce/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst providersRaw = import.meta.glob<string>(\n [\n \"../../enable/ecommerce/providers/**\",\n \"../../enable/ecommerce/providers-app-mode/**\",\n ],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nexport async function generate(options: Options) {\n // The cart follows the payments provider; with payments already gone,\n // every provider's files are removed, and the missing ones skipped.\n const detected = options.providers?.payments;\n const providers = PROVIDERS.some((provider) => provider.id === detected)\n ? [detected]\n : PROVIDERS.map((provider) => provider.id);\n\n const paths = new Set([\n ...Object.keys(\n filesFromGlob(createsRaw, \"../../enable/ecommerce/creates/\"),\n ),\n ...providers.flatMap((id) => allProviderPaths(providersRaw, id)),\n // The shop pages import the cart, so they go with it (the demo page an\n // older enable-ecommerce wrote shares the listing's paths). The catalog\n // module is the developer's product list and stays; destroy-shop takes it.\n ...SHOP_PATHS.filter((path) => path !== \"src/lib/catalog.ts\"),\n ]);\n\n const deletes: File[] = [...paths].sort().map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\",\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","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-ecommerce\" as const;\nconst VERSION = \"1.2.0\";\nconst SOURCE = \"src/patterns/disable/ecommerce\";\nconst DOCS = \"/disable/ecommerce\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable ecommerce\",\n summary:\n \"Removes the cart, the checkout pages and the navbar cart button enable-ecommerce added. Payments, and the shadcn components the cart used, stay.\",\n // Its own feature only: requiring payments would strand the cart if payments\n // went first (disable-payments is blocked while the cart exists, but a\n // project may have lost payments another way).\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n ecommerce: true,\n },\n // The order pages and handlers import the cart store.\n blockedBy: [\"orders\"],\n category: \"payments\" as const,\n tags: [\"sveltekit\", \"ecommerce\", \"cart\", \"stripe\", \"shopify\", \"velastack\"],\n\n command: {\n raw: \"vela disable ecommerce\",\n base: \"vela disable ecommerce\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { appRelativePath, languageFromPath } from \"../../../core/util\";\n\nconst createsRaw = import.meta.glob<string>(\n \"../../enable/subscriptions/creates/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst CREATES_PREFIX = \"../../enable/subscriptions/creates/\";\n\nexport async function generate(_options: Options) {\n const deletes = Object.keys(createsRaw)\n .map((key) => {\n const path = appRelativePath(key, CREATES_PREFIX);\n return {\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n };\n })\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-subscriptions\" as const;\nconst VERSION = \"1.0.2\";\nconst SOURCE = \"src/patterns/disable/subscriptions\";\nconst DOCS = \"/disable/subscriptions\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n\n if (options.input.destructive !== true) {\n return merged;\n }\n\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable subscriptions\",\n summary:\n \"Drops the stripe_subscriptions collection, reverts billing / layout / nav edits, and removes subscription webhook handlers and sync endpoint. Leaves the payments pattern intact.\",\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: true,\n blog: false,\n contentNegotiation: false,\n cms: false,\n // Stripe Billing: Shopify sells subscriptions through its own apps.\n providers: { payments: [\"stripe\"] },\n },\n category: \"payments\" as const,\n tags: [\n \"sveltekit\",\n \"payments\",\n \"stripe\",\n \"subscriptions\",\n \"pocketbase\",\n \"velastack\",\n \"billing\",\n ],\n\n command: {\n raw: \"vela disable subscriptions\",\n base: \"vela disable subscriptions\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack\",\n\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { filesFromGlob, languageFromPath } from \"../../../core/util\";\n\n// Every variant goes, whatever auth and notifications are now: either may\n// have changed since orders was enabled.\nconst createsRaw = import.meta.glob<string>(\"../../enable/orders/creates/**\", {\n query: \"?raw\",\n import: \"default\",\n eager: true,\n});\nconst createsAppModeRaw = import.meta.glob<string>(\n \"../../enable/orders/creates-app-mode/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\nconst createsNotificationsRaw = import.meta.glob<string>(\n \"../../enable/orders/creates-notifications/**\",\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nexport async function generate(_options: Options) {\n const paths = new Set([\n ...Object.keys(filesFromGlob(createsRaw, \"../../enable/orders/creates/\")),\n ...Object.keys(\n filesFromGlob(createsAppModeRaw, \"../../enable/orders/creates-app-mode/\"),\n ),\n ...Object.keys(\n filesFromGlob(\n createsNotificationsRaw,\n \"../../enable/orders/creates-notifications/\",\n ),\n ),\n ]);\n\n return {\n creates: [],\n modifies: [],\n deletes: [...paths].sort().map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n })),\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-orders\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/orders\";\nconst DOCS = \"/disable/orders\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n if (options.env !== \"runtime\") {\n return formatResult(baseRes, options);\n }\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const merged = await formatResult(\n mergeResults([baseRes, runtimeRes]),\n options,\n );\n if (options.input.destructive !== true) {\n return merged;\n }\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(merged, options);\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"pro\",\n title: \"Disable orders\",\n summary:\n \"Removes the order handlers, the orders pages and the orders and order_lines collections enable-orders added, and puts the success page back to Stripe's summary. Payments and the cart stay.\",\n // Nothing required: a project may have lost payments or the cart another\n // way, and the order files should still come out.\n requires: {\n auth: false,\n api: false,\n apiKeys: false,\n backend: false,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"payments\" as const,\n tags: [\"sveltekit\", \"ecommerce\", \"orders\", \"stripe\", \"velastack\"],\n command: {\n raw: \"vela disable orders\",\n base: \"vela disable orders\",\n argv: [],\n },\n examples: [],\n tests: 0,\n baseline: \"velastack\",\n generate,\n} satisfies Pattern;\n","import type { Options, Result } from \"../../../core/types\";\nimport { languageFromPath } from \"../../../core/util\";\n\n// Every file enable-whatsapp creates, in either form style.\nconst createsRaw = import.meta.glob<string>(\n [\n \"../../enable/whatsapp/creates/**\",\n \"../../enable/whatsapp/creates-superforms/**\",\n \"../../enable/whatsapp/creates-remote/**\",\n ],\n { query: \"?raw\", import: \"default\", eager: true },\n);\n\nconst PREFIX = /^\\.\\.\\/\\.\\.\\/enable\\/whatsapp\\/creates(-superforms|-remote)?\\//;\n\nexport async function generate(_options: Options) {\n const paths = new Set(\n Object.keys(createsRaw).map((key) => key.replace(PREFIX, \"\")),\n );\n\n const deletes = Array.from(paths)\n .map((path) => ({\n path,\n language: languageFromPath(path),\n content: \"\",\n status: \"success\" as const,\n }))\n .sort((a, b) => a.path.localeCompare(b.path));\n\n return {\n creates: [],\n modifies: [],\n deletes,\n components: [],\n packages: [],\n collections: [],\n collectionPatches: [],\n collectionDrops: [],\n } satisfies Result;\n}\n","import type { Options, Pattern } from \"../../../core/types\";\nimport { formatResult } from \"../../../core/format-result\";\nimport { mergeResults } from \"../../../core/util\";\nimport { generate as generateBase } from \"./generate\";\n\nconst SLUG = \"disable-whatsapp\" as const;\nconst VERSION = \"1.0.0\";\nconst SOURCE = \"src/patterns/disable/whatsapp\";\nconst DOCS = \"/disable/whatsapp\";\n\nexport async function generate(options: Options) {\n const baseRes = await generateBase(options);\n\n // Turning WhatsApp off in PocketBase and rewriting the pages only happens\n // with consent; without it this lists the files that would go.\n if (options.env !== \"runtime\" || options.input.destructive !== true) {\n return formatResult(baseRes, options);\n }\n\n const { generate: generateRuntime } = await import(\"./generate.runtime\");\n const runtimeRes = await generateRuntime(options);\n const { writeResult } = await import(\"../../../runtime/write-result\");\n return writeResult(\n await formatResult(mergeResults([baseRes, runtimeRes]), options),\n options,\n );\n}\n\nexport default {\n version: VERSION,\n slug: SLUG,\n source: SOURCE,\n docs: DOCS,\n plan: \"open\",\n title: \"Disable WhatsApp sign-in\",\n summary:\n \"Takes WhatsApp sign-in off the login and signup pages and turns it off in PocketBase. Keeps the phone fields on users and email optional, since they hold user data.\",\n requires: {\n auth: true,\n api: false,\n apiKeys: false,\n backend: true,\n i18n: false,\n teams: false,\n payments: false,\n blog: false,\n contentNegotiation: false,\n cms: false,\n },\n category: \"auth\" as const,\n tags: [\"auth\", \"whatsapp\", \"sveltekit\", \"pocketbase\", \"velastack\"],\n\n command: {\n raw: \"vela disable whatsapp\",\n base: \"vela disable whatsapp\",\n argv: [],\n },\n\n examples: [],\n\n tests: 0,\n\n baseline: \"velastack-auth\",\n\n generate,\n} satisfies Pattern;\n","import packageJson from \"../package.json\";\nimport type { AssertComponentsAvailableOptions } from \"./runtime/write-result\";\nimport type {\n ApplyBaseColorOptions,\n ApplyColorsResult,\n ApplyThemeOptions,\n Component,\n DetectedProviders,\n InstallComponentsOptions,\n InstallComponentsResult,\n ListComponentsOptions,\n ListComponentsResult,\n SwitchStyleOptions,\n SwitchStyleResult,\n WriteResultRuntime,\n} from \"./core/types\";\nimport type { EnvVarSpec } from \"./runtime/env-vars-file\";\nimport type {\n ModifyEnvVarsResult,\n UnmodifyEnvVarsResult,\n} from \"./runtime/env-vars\";\nimport type {\n OverrideValue,\n PackageJsonEditResult,\n} from \"./runtime/package-imports\";\nexport {\n InvalidArgumentError,\n MissingShadcnError,\n RegistryUnavailableError,\n} from \"./core/errors\";\nexport type {\n ApplyBaseColorOptions,\n ApplyColorsResult,\n ApplyThemeOptions,\n Component,\n DetectedProviders,\n ExecuteCommand,\n FeatureFlag,\n ExecuteCommandOptions,\n File,\n InstallComponentsOptions,\n InstallComponentsResult,\n ListComponentsOptions,\n ListComponentsResult,\n ModifyOutcome,\n Options,\n Package,\n Pattern,\n Provider,\n ProviderEnvVar,\n ProviderMarker,\n RegistryItem,\n Requires,\n SwitchStyleOptions,\n SwitchStyleResult,\n WriteResultRuntime,\n} from \"./core/types\";\nexport {\n isLibSpecifier,\n libAliasPath,\n libModule,\n libSpecifier,\n} from \"./runtime/lib-specifier\";\nexport {\n ENV_DECL_CANDIDATES,\n envVarEntry,\n envVarsFile,\n type EnvVarSpec,\n} from \"./runtime/env-vars-file\";\nexport type { ModifyEnvVarsResult, UnmodifyEnvVarsResult };\nexport type { AssertComponentsAvailableOptions };\nexport type { OverrideValue, PackageJsonEditResult };\nexport {\n ADAPTER_NODE,\n ADAPTER_STATIC,\n FLASH,\n FORMSNAP,\n LEGACY_POCKETBASE_TYPES,\n NEGOTIATE,\n POCKETBASE_BIN_ENV,\n POCKETBASE_TYPES,\n SUPERFORMS,\n SUPERFORMS_VERSION,\n VELASTACK_CMS,\n VELASTACK_KIT,\n VELASTACK_POCKETBASE,\n} from \"./core/constants\";\nexport {\n NODE_FLOOR,\n VERSIONS,\n VERSION_HOLDS,\n VERSION_TRACKS,\n spec,\n} from \"./core/versions\";\nexport {\n capabilityName,\n providerEnvVars,\n providerFromArgv,\n providerMarkers,\n resolveProvider,\n unknownProviderMessage,\n} from \"./core/providers\";\nexport { FIELD_SYNTAX_HELP } from \"./parse/syntax\";\nexport { RULES_MODES, type RulesMode } from \"./core/shared\";\nexport {\n blockingFeatures,\n unmetRequirements,\n type RequirementsContext,\n type Unmet,\n} from \"./core/requires\";\nimport generateForm from \"./patterns/generate/form\";\nimport generateFormRemote from \"./patterns/generate/form-remote\";\nimport generateMigration from \"./patterns/generate/migration\";\nimport generateResource from \"./patterns/generate/resource\";\nimport generateScaffold from \"./patterns/generate/scaffold\";\nimport generateScaffoldRemote from \"./patterns/generate/scaffold-remote\";\nimport generateSchema from \"./patterns/generate/schema\";\nimport generateShop from \"./patterns/generate/shop\";\nimport generateWorkflow from \"./patterns/generate/workflow\";\nimport enableAi from \"./patterns/enable/ai\";\nimport enableAnalytics from \"./patterns/enable/analytics\";\nimport enableAuth from \"./patterns/enable/auth\";\nimport enableOg from \"./patterns/enable/og\";\nimport enableAuthRemote from \"./patterns/enable/auth-remote\";\nimport enableApi from \"./patterns/enable/api\";\nimport enableApiKeys from \"./patterns/enable/api-keys\";\nimport enableBackend from \"./patterns/enable/backend\";\nimport enableBlog from \"./patterns/enable/blog\";\nimport enableCms from \"./patterns/enable/cms\";\nimport enableContentNegotiation from \"./patterns/enable/content-negotiation\";\nimport enableI18n from \"./patterns/enable/i18n\";\nimport enableNotifications from \"./patterns/enable/notifications\";\nimport enablePayments from \"./patterns/enable/payments\";\nimport enableEcommerce from \"./patterns/enable/ecommerce\";\nimport enableSubscriptions from \"./patterns/enable/subscriptions\";\nimport enableOrders from \"./patterns/enable/orders\";\nimport enableTeams from \"./patterns/enable/teams\";\nimport enableWhatsapp from \"./patterns/enable/whatsapp\";\nimport enableWorkflows from \"./patterns/enable/workflows\";\nimport destroySchema from \"./patterns/destroy/schema\";\nimport destroyForm from \"./patterns/destroy/form\";\nimport destroyResource from \"./patterns/destroy/resource\";\nimport destroyScaffold from \"./patterns/destroy/scaffold\";\nimport destroyShop from \"./patterns/destroy/shop\";\nimport disableAi from \"./patterns/disable/ai\";\nimport disableAnalytics from \"./patterns/disable/analytics\";\nimport disableOg from \"./patterns/disable/og\";\nimport disableApi from \"./patterns/disable/api\";\nimport disableApiKeys from \"./patterns/disable/api-keys\";\nimport disableAuth from \"./patterns/disable/auth\";\nimport disableBackend from \"./patterns/disable/backend\";\nimport disableContentNegotiation from \"./patterns/disable/content-negotiation\";\nimport disableI18n from \"./patterns/disable/i18n\";\nimport disableNotifications from \"./patterns/disable/notifications\";\nimport disableTeams from \"./patterns/disable/teams\";\nimport disablePayments from \"./patterns/disable/payments\";\nimport disableEcommerce from \"./patterns/disable/ecommerce\";\nimport disableSubscriptions from \"./patterns/disable/subscriptions\";\nimport disableOrders from \"./patterns/disable/orders\";\nimport disableWhatsapp from \"./patterns/disable/whatsapp\";\n\nexport const version = packageJson.version;\n\nexport const patterns = [\n generateForm,\n generateFormRemote,\n generateMigration,\n generateSchema,\n generateWorkflow,\n generateResource,\n generateScaffold,\n generateScaffoldRemote,\n generateShop,\n enableAi,\n enableAnalytics,\n enableOg,\n enableAuth,\n enableAuthRemote,\n enableApi,\n enableApiKeys,\n enableBackend,\n enableBlog,\n enableCms,\n enableContentNegotiation,\n enableI18n,\n enableNotifications,\n enablePayments,\n enableEcommerce,\n enableSubscriptions,\n enableOrders,\n enableTeams,\n enableWhatsapp,\n enableWorkflows,\n destroySchema,\n destroyForm,\n destroyResource,\n destroyScaffold,\n destroyShop,\n disableAi,\n disableAnalytics,\n disableOg,\n disableApi,\n disableApiKeys,\n disableAuth,\n disableBackend,\n disableContentNegotiation,\n disableI18n,\n disableNotifications,\n disableTeams,\n disablePayments,\n disableEcommerce,\n disableSubscriptions,\n disableOrders,\n disableWhatsapp,\n];\n\ntype PatternEntry = (typeof patterns)[number];\n\nexport type Slug = PatternEntry[\"slug\"];\nexport type Category = PatternEntry[\"category\"];\n\nexport const bySlug = Object.fromEntries(\n patterns.map((pattern) => [pattern.slug, pattern]),\n) as Record<Slug, PatternEntry>;\n\nexport const byCategory = patterns.reduce(\n (acc, pattern) => {\n const category = pattern.category;\n acc[category] ??= [];\n acc[category].push(pattern);\n return acc;\n },\n {} as Record<Category, PatternEntry[]>,\n);\n\n/**\n * Installs shadcn-svelte items and the components this package ships\n * (`data-table`, `multiselect`, `geopoint`, ...) into a project, pulling in\n * the shadcn and npm dependencies they need. Node-only: the runtime is loaded\n * on the first call so this entry stays importable in the browser preview.\n */\nexport async function installComponents(\n options: InstallComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<InstallComponentsResult> {\n const { installComponents: run } = await import(\"./runtime/write-result\");\n return run(options, runtime);\n}\n\n/**\n * The preflight for `installComponents`: throws what it would throw for these\n * components (`MissingShadcnError`, or `InvalidArgumentError` for a name the\n * style's registry does not list) and changes nothing. For a caller with side\n * effects of its own ahead of the install; a pattern that lists components\n * and creates collections runs it first. A registry that cannot be read is not an error\n * here: the names go unchecked and the install reports it. Node-only, loaded\n * on first call like `installComponents`.\n */\nexport async function assertComponentsAvailable(\n root: string,\n components: Component[],\n options: AssertComponentsAvailableOptions = {},\n runtime?: WriteResultRuntime,\n): Promise<void> {\n const { assertComponentsAvailable: run } =\n await import(\"./runtime/write-result\");\n return run(root, components, options, runtime);\n}\n\n/**\n * What a project has installed, what this package can copy in, and what the\n * configured style's registry offers. Node-only, loaded on first call like\n * `installComponents`.\n */\nexport async function listComponents(\n options: ListComponentsOptions,\n runtime?: WriteResultRuntime,\n): Promise<ListComponentsResult> {\n const { listComponents: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/** Moves a project to another shadcn-svelte style, re-adding its registry components. */\nexport async function switchStyle(\n options: SwitchStyleOptions,\n runtime?: WriteResultRuntime,\n): Promise<SwitchStyleResult> {\n const { switchStyle: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/** Sets the base palette through `shadcn-svelte apply`. */\nexport async function applyBaseColor(\n options: ApplyBaseColorOptions,\n runtime?: WriteResultRuntime,\n): Promise<ApplyColorsResult> {\n const { applyBaseColor: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/** Sets the accent color through `shadcn-svelte apply`, keeping the base palette. */\nexport async function applyTheme(\n options: ApplyThemeOptions,\n runtime?: WriteResultRuntime,\n): Promise<ApplyColorsResult> {\n const { applyTheme: run } = await import(\"./runtime/ui\");\n return run(options, runtime);\n}\n\n/**\n * The provider in use for each capability (`{ payments: \"stripe\" }`), read\n * from what each registered provider leaves in the project. Node-only, loaded\n * on first call like `installComponents`.\n */\nexport async function detectProviders(\n root: string,\n): Promise<DetectedProviders> {\n const { detectProviders: run } = await import(\"./runtime/providers\");\n return run(root, patterns);\n}\n\n/*\n * Project-file editors the CLI's `bless` and `migrate sveltekit-3` share with\n * the patterns. Node-only, so each loads its module on first call (like\n * `installComponents`) and the entry stays importable in the browser\n * preview; the module functions themselves are synchronous.\n */\n\n/**\n * Declare `specs` in `src/env.ts` (or `src/env.js`); existing entries are\n * never touched. Without a declaration file, `create` holds a new\n * `src/env.ts` for the caller to write. An edited file is saved in place and\n * reported in `modify`; one that can't be edited safely fails with the\n * entries to paste.\n */\nexport async function modifyEnvVars(\n root: string,\n specs: EnvVarSpec[],\n): Promise<ModifyEnvVarsResult> {\n const { modifyEnvVars: run } = await import(\"./runtime/env-vars\");\n return run(root, specs);\n}\n\n/**\n * Remove the declarations of `names` from `src/env.ts`. `deleted` means only\n * the import and an empty `variables` are left (the emptied file is saved;\n * delete it).\n */\nexport async function unmodifyEnvVars(\n root: string,\n names: string[],\n): Promise<UnmodifyEnvVarsResult> {\n const { unmodifyEnvVars: run } = await import(\"./runtime/env-vars\");\n return run(root, names);\n}\n\n/** Add missing package.json `imports` entries; never overwrites a different value. */\nexport async function ensurePackageImports(\n root: string,\n entries: Record<string, string>,\n): Promise<PackageJsonEditResult> {\n const { ensurePackageImports: run } =\n await import(\"./runtime/package-imports\");\n return run(root, entries);\n}\n\n/**\n * Remove package.json `imports` keys (only those still equal to `expected`,\n * when given), dropping an `imports` left empty.\n */\nexport async function removePackageImports(\n root: string,\n keys: string[],\n expected?: Record<string, string>,\n): Promise<PackageJsonEditResult> {\n const { removePackageImports: run } =\n await import(\"./runtime/package-imports\");\n return run(root, keys, expected);\n}\n\n/** Deep-merge package.json `overrides`; never overwrites a different version. */\nexport async function ensurePackageOverrides(\n root: string,\n overrides: Record<string, OverrideValue>,\n): Promise<PackageJsonEditResult> {\n const { ensurePackageOverrides: run } =\n await import(\"./runtime/package-imports\");\n return run(root, overrides);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,SAAgBo6C,GACd,GACA,GACe;CACf,QAAQC,EAAQ,aAAa,CAAC,EAAA,CAAG,QAAQ,MAASC,EAASC,OAAU,EAAI;AAC3E;AAsCA,SAAgBC,GACd,GACA,GACS;CACT,IAAM,EAAE,aAAU,gBAAaC,GACzBC,IACJD,EAAQ,aACPJ,EAAQ,mBACLM,EAAS,UAAUN,EAAQ,oBAC3B,KAAA,IACAO,IAAWP,EAAQ,WAAW,MACjC,MAAcQ,EAAU,OAAOH,CAClC,GACMI,IAAWC,GAAcV,EA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IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAc1uB;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,WAAW;IACX,UAAU;IACV,MAAM;IACN,QAAQ;KAAC;KAAS;KAAS;IAAQ;GACrC;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,UAAU;IACV,UAAU;IACV,MAAM;GACR;EACF;CACF;CACA;EACE,MAAM;EACN,MAAM;EACN,GAAG4uB,GAAS,YAAY;EACxB,WACE;EACF,QAAQ;GACN;IACE,MAAM;IACN,SAAS;IACT,YAAY;IACZ,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,aAAa;IAEb,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,KAAK;IACL,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAcD;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,eAAe;IACf,cAAcD;IACd,WAAW;IACX,WAAW;IACX,UAAU;IACV,MAAM;GACR;GACA;IACE,MAAM;IACN,WAAW;IACX,UAAU;IACV,MAAM;IACN,QAAQ;KAAC;KAAS;KAAS;IAAQ;GACrC;EACF;CACF;CACA;EACE,MAAM;EACN,MAAM;EACN,GAAGE,GAAS,cAAc;EAC1B,SAAS,CAACv7B,EAAkB;EAC5B,QAAQ;GACN;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,qBAAqB;IACrB,KAAK;IACL,KAAK;IACL,SAAS;IACT,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,eAAe;IACf,cAAcq7B;IACd,WAAW;IACX,WAAW;IACX,UAAU;GACZ;GACA;IACE,MAAM;IACN,MAAM;IACN,UAAU;GACZ;GACA,GAAGx7B,GAAiB8M,EAAK;GACzB;IACE,MAAM;IACN,UAAU;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