@selvajs/selva 4.21.0-beta.28 → 4.21.0-beta.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/build/adapter-node.js +1 -1
  2. package/build/client/_app/immutable/chunks/{CeO0Jze6.js → D84pURUQ.js} +4 -4
  3. package/build/client/_app/immutable/chunks/D84pURUQ.js.br +0 -0
  4. package/build/client/_app/immutable/chunks/{CeO0Jze6.js.gz → D84pURUQ.js.gz} +0 -0
  5. package/build/client/_app/immutable/chunks/X50T9_JI.js +1 -0
  6. package/build/client/_app/immutable/chunks/X50T9_JI.js.br +1 -0
  7. package/build/client/_app/immutable/chunks/X50T9_JI.js.gz +0 -0
  8. package/build/client/_app/immutable/entry/{app.7dNWr3b0.js → app.BRh-p7zn.js} +2 -2
  9. package/build/client/_app/immutable/entry/app.BRh-p7zn.js.br +0 -0
  10. package/build/client/_app/immutable/entry/app.BRh-p7zn.js.gz +0 -0
  11. package/build/client/_app/immutable/nodes/{15.CEROqZ8B.js → 15.DYrqOXo_.js} +1 -1
  12. package/build/client/_app/immutable/nodes/15.DYrqOXo_.js.br +0 -0
  13. package/build/client/_app/immutable/nodes/15.DYrqOXo_.js.gz +0 -0
  14. package/build/client/_app/immutable/nodes/21.GfKFOpXV.js +1 -0
  15. package/build/client/_app/immutable/nodes/21.GfKFOpXV.js.br +1 -0
  16. package/build/client/_app/immutable/nodes/21.GfKFOpXV.js.gz +0 -0
  17. package/build/client/_app/version.json +1 -1
  18. package/build/client/_app/version.json.br +0 -0
  19. package/build/client/_app/version.json.gz +0 -0
  20. package/build/server/chunks/instance.js +3 -3
  21. package/build/server/chunks/internal.js +1 -1
  22. package/build/server/chunks/package.js +1 -1
  23. package/build/server/chunks/package.js.map +1 -1
  24. package/build/server/chunks/update-outcome.js +7 -0
  25. package/build/server/chunks/update-outcome.js.map +1 -1
  26. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js +24 -0
  27. package/build/server/entries/endpoints/api/admin/system/update/_server.ts.js.map +1 -1
  28. package/build/server/entries/pages/library/_guid_/_page.svelte.js +24 -29
  29. package/build/server/entries/pages/library/_guid_/_page.svelte.js.map +1 -1
  30. package/build/server/manifest-full.js +1 -1
  31. package/build/server/manifest.js +1 -1
  32. package/build/server/nodes/15.js +1 -1
  33. package/build/server/nodes/21.js +1 -1
  34. package/build/server/server.js +1 -1
  35. package/package.json +6 -6
  36. package/build/client/_app/immutable/chunks/CeO0Jze6.js.br +0 -0
  37. package/build/client/_app/immutable/chunks/DCs5X1_K.js +0 -1
  38. package/build/client/_app/immutable/chunks/DCs5X1_K.js.br +0 -1
  39. package/build/client/_app/immutable/chunks/DCs5X1_K.js.gz +0 -0
  40. package/build/client/_app/immutable/entry/app.7dNWr3b0.js.br +0 -0
  41. package/build/client/_app/immutable/entry/app.7dNWr3b0.js.gz +0 -0
  42. package/build/client/_app/immutable/nodes/15.CEROqZ8B.js.br +0 -0
  43. package/build/client/_app/immutable/nodes/15.CEROqZ8B.js.gz +0 -0
  44. package/build/client/_app/immutable/nodes/21.B8_gfy6F.js +0 -1
  45. package/build/client/_app/immutable/nodes/21.B8_gfy6F.js.br +0 -0
  46. package/build/client/_app/immutable/nodes/21.B8_gfy6F.js.gz +0 -0
@@ -0,0 +1 @@
1
+ export{o as strToU8,s as zip}from"./D84pURUQ.js";
@@ -0,0 +1 @@
1
+ �export{o as strToU8,s as zip}from"./D84pURUQ.js";
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.0aLY-peC.js","../chunks/sphvlIzg.js","../chunks/C1xbQMZF.js","../chunks/BJGlbpZ0.js","../chunks/BFJ8iwO4.js","./payload.DSmR2FwN.js","../chunks/Cyt8LZpN.js","../chunks/BHnRUwtv.js","../chunks/BQmUk61d.js","../assets/0.K3A9pxsi.css","../nodes/1.D8PGvwGl.js","../chunks/NZEnWod8.js","../chunks/Ca-1xMUo.js","../chunks/BbFMtSJ8.js","../chunks/DkJ8E57s.js","../chunks/CivEAG-M.js","../chunks/B8LXiPqe.js","../chunks/Bx2qumU5.js","../chunks/DIYaLgLs.js","../nodes/2.BIMWgs8C.js","../chunks/85w20NVU.js","../chunks/CoLPPvYz.js","../chunks/rIQJtl5L.js","../chunks/Bb1oceVC.js","../chunks/B1rj67tr.js","../chunks/CoRMsLUN.js","../chunks/DNFu5yLd.js","../chunks/OznVWGiS.js","../chunks/C9yuuH4J.js","../chunks/Jlr_WNWs.js","../chunks/CXFC38jr.js","../chunks/D_-42ATH.js","../chunks/BuCeXb-q.js","../chunks/Rbl3OsBf.js","../chunks/BiZjzEFQ.js","../chunks/DtmJiR65.js","../chunks/DIOXhUNn.js","../chunks/CSy_25b1.js","../chunks/CBf5ToEX.js","../chunks/BUENW6k7.js","../chunks/B3e8ZKjr.js","../chunks/34Sd6e9o.js","../chunks/1VJx1aVI.js","../chunks/BkTC9VdY.js","../chunks/BkNEmllz.js","../chunks/BmbAoXqr.js","../nodes/3.B2ccxsh5.js","../nodes/4.DPB_nXDo.js","../nodes/5.B293bMJb.js","../nodes/6.CE7P3U7c.js","../chunks/C0bsOHz0.js","../chunks/DqBxcKN2.js","../chunks/D-1_v2Lf.js","../chunks/ChEklEBB.js","../chunks/DBMBAz5L.js","../nodes/7.DhehW04u.js","../chunks/lMQbJOeE.js","../assets/7.T1zeJ20D.css","../nodes/8.CeF7Yj23.js","../chunks/BCgmDXNw.js","../chunks/CUaHcctM.js","../nodes/9.Bk5Lntvs.js","../chunks/BPWrsj_h.js","../chunks/1AvDtYi1.js","../chunks/ByPYmSUR.js","../chunks/fJvE1weH.js","../chunks/Uzaejkud.js","../chunks/CdTxvcQ4.js","../chunks/CNij7yXO.js","../chunks/ag4k__EW.js","../nodes/10.B3aBLsAq.js","../chunks/B9-uqzXO.js","../chunks/B187F-XR.js","../chunks/Djv8qD_2.js","../chunks/CVl4suwo.js","../chunks/Dqc45la5.js","../chunks/DcS7V4T3.js","../chunks/BLG35vEW.js","../assets/select.CV-KWLNP.css","../chunks/ZGbF6Eux.js","../nodes/11.CnQVPSaL.js","../chunks/B7VqKSCZ.js","../chunks/DmlEI0uK.js","../chunks/CNkLk5_8.js","../chunks/CoB4qHba.js","../chunks/D6cAtf8B.js","../chunks/DqR8kuM6.js","../nodes/12.B7-VLcK9.js","../chunks/-MlIqmcL.js","../assets/DataTable.BjgXtTHK.css","../nodes/13.TEbI6lFx.js","../chunks/TZzCN567.js","../chunks/Cms9vBTq.js","../nodes/14.Dx84-S7G.js","../chunks/D6SQx3MR.js","../chunks/CK2nnbJa.js","../chunks/Cj9-pF71.js","../chunks/BVVRTJCQ.js","../nodes/15.CEROqZ8B.js","../chunks/gNgZDPHs.js","../chunks/nJUe9gXb.js","../chunks/DR4HRB4w.js","../nodes/16.C7nA7TCy.js","../chunks/Cv8bPnPc.js","../chunks/BvRGv1MX.js","../chunks/BFtd89gK.js","../nodes/17.0cv7e5IP.js","../chunks/hvudoNyJ.js","../nodes/18.PJQUQ85Q.js","../nodes/19.DRxrJE9N.js","../nodes/20.CyD18Rlt.js","../chunks/a5NclWb-.js","../chunks/DG4fF26P.js","../nodes/21.B8_gfy6F.js","../chunks/CeO0Jze6.js","../chunks/CRzLMJPS.js","../chunks/BSN2qO1R.js","../chunks/Bct5vmEM.js","../chunks/DnJObvmm.js","../assets/21.VfhYpgTQ.css","../nodes/22.q4pJo1Ec.js","../nodes/24.DkL5kHzA.js","../nodes/25.C9PK5T2d.js","../chunks/v0PYjZZ5.js","../nodes/26.7nAJpm5P.js","../nodes/27.BZljPb4_.js","../nodes/28.BUnWplt-.js","../nodes/29.DWokJWH0.js","../nodes/30.ForK2knd.js","../nodes/31.DEYw8Upz.js","../chunks/BrpXEGl0.js","../nodes/32.Bi8d2lf7.js","../nodes/33.CswdDR11.js","../nodes/34.DUW5te4K.js","../nodes/35.Dpj9Kp45.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"../chunks/CRzLMJPS.js";var t={},n=[()=>e(()=>import(`../nodes/0.0aLY-peC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url),()=>e(()=>import(`../nodes/1.D8PGvwGl.js`),__vite__mapDeps([10,1,4,5,6,7,11,12,13,14,15,16,17,18]),import.meta.url),()=>e(()=>import(`../nodes/2.BIMWgs8C.js`),__vite__mapDeps([19,1,20,12,21,22,23,2,3,4,5,6,7,24,25,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url),()=>e(()=>import(`../nodes/3.B2ccxsh5.js`),__vite__mapDeps([46,1,4,5,6,7,11,12,13,14,15,16,17,18]),import.meta.url),()=>e(()=>import(`../nodes/4.DPB_nXDo.js`),__vite__mapDeps([47,1]),import.meta.url),()=>e(()=>import(`../nodes/5.B293bMJb.js`),__vite__mapDeps([48,1,23,2,3,4,5,6,7,12,24,25,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40]),import.meta.url),()=>e(()=>import(`../nodes/6.CE7P3U7c.js`),__vite__mapDeps([49,1,4,5,6,7,12,50,51,22,52,53,23,2,3,24,25,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40,54,42,43,44,45]),import.meta.url),()=>e(()=>import(`../nodes/7.DhehW04u.js`),__vite__mapDeps([55,1,4,5,6,7,13,12,56,23,2,3,24,25,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40,57]),import.meta.url),()=>e(()=>import(`../nodes/8.CeF7Yj23.js`),__vite__mapDeps([58,1,4,5,6,7,13,12,59,25,60,18,15]),import.meta.url),()=>e(()=>import(`../nodes/9.Bk5Lntvs.js`),__vite__mapDeps([61,1,40,5,6,4,7,12,13,20,42,62,30,63,16,64,17,65,8,66,67,25,27,3,68,32,69,56]),import.meta.url),()=>e(()=>import(`../nodes/10.B3aBLsAq.js`),__vite__mapDeps([70,1,13,12,71,72,41,73,35,74,3,25,26,27,75,33,76,77,78,59,63,79,60,16,17,65]),import.meta.url),()=>e(()=>import(`../nodes/11.CnQVPSaL.js`),__vite__mapDeps([80,1,3,40,5,6,4,12,13,71,75,81,82,83,42,84,62,63,85,60,16,8,66,67,25,27,68,32,86]),import.meta.url),()=>e(()=>import(`../nodes/12.B7-VLcK9.js`),__vite__mapDeps([87,1,20,12,63,85,16,88,89]),import.meta.url),()=>e(()=>import(`../nodes/13.TEbI6lFx.js`),__vite__mapDeps([90,1,40,5,6,4,13,12,21,82,91,25,26,27,3,71,92,60,77,68,59,63,85,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/14.Dx84-S7G.js`),__vite__mapDeps([93,1,40,5,6,4,12,13,94,82,28,29,62,35,91,25,26,27,3,71,92,60,77,68,59,95,31,63,85,96,16,8,88,89,66,67,32,97]),import.meta.url),()=>e(()=>import(`../nodes/15.CEROqZ8B.js`),__vite__mapDeps([98,1,25,40,5,6,4,7,12,13,26,27,3,72,15,99,22,100,83,73,67,68,32,76,77,91,71,92,60,95,31,63,101,35,16,64,17,65,18,39]),import.meta.url),()=>e(()=>import(`../nodes/16.C7nA7TCy.js`),__vite__mapDeps([102,1,40,5,6,4,12,13,71,72,82,92,3,25,26,27,60,73,62,30,35,91,77,68,63,85,16,8,18,15,66,67,32,103,104,97,105,38,37]),import.meta.url),()=>e(()=>import(`../nodes/17.0cv7e5IP.js`),__vite__mapDeps([106,1,4,5,6,7,107,12,18,15]),import.meta.url),()=>e(()=>import(`../nodes/18.PJQUQ85Q.js`),__vite__mapDeps([108,1]),import.meta.url),()=>e(()=>import(`../nodes/19.DRxrJE9N.js`),__vite__mapDeps([109,1,6,5,43]),import.meta.url),()=>e(()=>import(`../nodes/20.CyD18Rlt.js`),__vite__mapDeps([110,1,40,5,6,4,12,56,111,42,84,112,25,31,27,3,23,2,7,24,13,14,26,15,28,29,30,32,33,34,35,36,37,38,39,91,71,92,60,77,68,43,63,85,101,8]),import.meta.url),()=>e(()=>import(`../nodes/21.B8_gfy6F.js`),__vite__mapDeps([113,114,115,1,2,3,25,40,5,6,4,7,12,24,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,71,104,75,72,45,116,117,100,92,60,42,74,76,77,78,59,95,112,96,8,18,118,86,119]),import.meta.url),()=>e(()=>import(`../nodes/22.q4pJo1Ec.js`),__vite__mapDeps([120,1,4,5,6,7,13,12,59,25,60,18,15,118]),import.meta.url),()=>e(()=>import(`../chunks/BvRk9kiK.js`),[],import.meta.url),()=>e(()=>import(`../nodes/24.DkL5kHzA.js`),__vite__mapDeps([121,1,4,5,6,7,13,12,91,25,26,27,3,71,92,60,77,68,79,18,15]),import.meta.url),()=>e(()=>import(`../nodes/25.C9PK5T2d.js`),__vite__mapDeps([122,1,3,40,5,6,4,7,12,13,94,26,25,27,71,15,81,99,116,117,111,56,42,84,112,31,53,100,82,92,60,28,62,123,30,35,67,68,32,91,77,34,14,59,95,43,63,85,79,101,96,8,18,66,37,97,105]),import.meta.url),()=>e(()=>import(`../nodes/26.7nAJpm5P.js`),__vite__mapDeps([124,1,4,5,6,7,13,12,59,25,60,18,15]),import.meta.url),()=>e(()=>import(`../nodes/27.BZljPb4_.js`),__vite__mapDeps([125,1,20,12,51,30,63,16,17,65,69,56]),import.meta.url),()=>e(()=>import(`../nodes/28.BUnWplt-.js`),__vite__mapDeps([126,1,50,12,73,63,16,17,65]),import.meta.url),()=>e(()=>import(`../nodes/29.DWokJWH0.js`),__vite__mapDeps([127,1,40,5,6,4,7,13,12,82,42,84,62,91,25,26,27,3,71,92,60,77,68,63,85,79,16,64,17,65,8,66,67,32,86]),import.meta.url),()=>e(()=>import(`../nodes/30.ForK2knd.js`),__vite__mapDeps([128,1,40,5,6,4,12,13,99,107,92,3,25,26,27,60,62,123,35,91,71,77,68,63,85,16,64,17,65,8,66,67,32,103,104,72,97,105,36,37]),import.meta.url),()=>e(()=>import(`../nodes/31.DEYw8Upz.js`),__vite__mapDeps([129,1,40,5,6,4,13,12,130,51,82,62,67,25,27,3,68,32,91,26,71,92,60,77,63,85,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/32.Bi8d2lf7.js`),__vite__mapDeps([131,1,40,5,6,4,13,12,117,54,67,25,27,3,68,32,63,85,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/33.CswdDR11.js`),__vite__mapDeps([132,1,12,62,63,16,64,17,65]),import.meta.url),()=>e(()=>import(`../nodes/34.DUW5te4K.js`),__vite__mapDeps([133,1,40,5,6,4,13,12,130,53,62,67,25,27,3,68,32,63,85,60,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/35.Dpj9Kp45.js`),__vite__mapDeps([134,1,40,5,6,4,7,13,12,26,25,27,3,99,52,62,74,71,75,33,76,77,78,67,68,32,59,95,31,63,85,79,60,16,64,17,65,8,18,15,88,89,37]),import.meta.url)],r=[0,2,5,6],i={"/":[-8],"/accept-invite":[-9],"/admin":[-10,[2],[3]],"/admin/audit":[-11,[2],[3]],"/admin/compute":[-12,[2],[3]],"/admin/organizations":[-13,[2],[3]],"/admin/projects":[-14,[2],[3]],"/admin/projects/[id]":[-15,[2],[3]],"/admin/system":[-16,[2],[3]],"/admin/users":[-17,[2],[3]],"/auth/email/sent":[17],"/auth/email/start":[-19],"/docs/api":[-20],"/library":[-21,[4]],"/library/[guid]":[-22,[4]],"/login":[-23],"/logout":[23],"/oauth/authorize":[-25],"/projects":[-26,[5]],"/setup":[-27],"/team":[-28,[6]],"/team/activity":[28,[6]],"/team/compute":[-30,[6]],"/team/members":[-31,[6]],"/team/projects":[-32,[6]],"/team/reclaim":[-33,[6]],"/team/settings":[-34,[6]],"/team/shares":[-35,[6]],"/team/tokens":[-36,[6]]},a={handleError:(({kind:e,error:t})=>{e===`unknown`&&console.error(t)}),reroute:(()=>{}),transport:{}},o=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.decode])),s=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.encode])),c=!1,l=(e,t)=>o[e](t),u=()=>e(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{l as decode,o as decoders,i as dictionary,s as encoders,u as get_error_template,c as hash,a as hooks,t as matchers,n as nodes,r as server_loads};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.0aLY-peC.js","../chunks/sphvlIzg.js","../chunks/C1xbQMZF.js","../chunks/BJGlbpZ0.js","../chunks/BFJ8iwO4.js","./payload.DSmR2FwN.js","../chunks/Cyt8LZpN.js","../chunks/BHnRUwtv.js","../chunks/BQmUk61d.js","../assets/0.K3A9pxsi.css","../nodes/1.D8PGvwGl.js","../chunks/NZEnWod8.js","../chunks/Ca-1xMUo.js","../chunks/BbFMtSJ8.js","../chunks/DkJ8E57s.js","../chunks/CivEAG-M.js","../chunks/B8LXiPqe.js","../chunks/Bx2qumU5.js","../chunks/DIYaLgLs.js","../nodes/2.BIMWgs8C.js","../chunks/85w20NVU.js","../chunks/CoLPPvYz.js","../chunks/rIQJtl5L.js","../chunks/Bb1oceVC.js","../chunks/B1rj67tr.js","../chunks/CoRMsLUN.js","../chunks/DNFu5yLd.js","../chunks/OznVWGiS.js","../chunks/C9yuuH4J.js","../chunks/Jlr_WNWs.js","../chunks/CXFC38jr.js","../chunks/D_-42ATH.js","../chunks/BuCeXb-q.js","../chunks/Rbl3OsBf.js","../chunks/BiZjzEFQ.js","../chunks/DtmJiR65.js","../chunks/DIOXhUNn.js","../chunks/CSy_25b1.js","../chunks/CBf5ToEX.js","../chunks/BUENW6k7.js","../chunks/B3e8ZKjr.js","../chunks/34Sd6e9o.js","../chunks/1VJx1aVI.js","../chunks/BkTC9VdY.js","../chunks/BkNEmllz.js","../chunks/BmbAoXqr.js","../nodes/3.B2ccxsh5.js","../nodes/4.DPB_nXDo.js","../nodes/5.B293bMJb.js","../nodes/6.CE7P3U7c.js","../chunks/C0bsOHz0.js","../chunks/DqBxcKN2.js","../chunks/D-1_v2Lf.js","../chunks/ChEklEBB.js","../chunks/DBMBAz5L.js","../nodes/7.DhehW04u.js","../chunks/lMQbJOeE.js","../assets/7.T1zeJ20D.css","../nodes/8.CeF7Yj23.js","../chunks/BCgmDXNw.js","../chunks/CUaHcctM.js","../nodes/9.Bk5Lntvs.js","../chunks/BPWrsj_h.js","../chunks/1AvDtYi1.js","../chunks/ByPYmSUR.js","../chunks/fJvE1weH.js","../chunks/Uzaejkud.js","../chunks/CdTxvcQ4.js","../chunks/CNij7yXO.js","../chunks/ag4k__EW.js","../nodes/10.B3aBLsAq.js","../chunks/B9-uqzXO.js","../chunks/B187F-XR.js","../chunks/Djv8qD_2.js","../chunks/CVl4suwo.js","../chunks/Dqc45la5.js","../chunks/DcS7V4T3.js","../chunks/BLG35vEW.js","../assets/select.CV-KWLNP.css","../chunks/ZGbF6Eux.js","../nodes/11.CnQVPSaL.js","../chunks/B7VqKSCZ.js","../chunks/DmlEI0uK.js","../chunks/CNkLk5_8.js","../chunks/CoB4qHba.js","../chunks/D6cAtf8B.js","../chunks/DqR8kuM6.js","../nodes/12.B7-VLcK9.js","../chunks/-MlIqmcL.js","../assets/DataTable.BjgXtTHK.css","../nodes/13.TEbI6lFx.js","../chunks/TZzCN567.js","../chunks/Cms9vBTq.js","../nodes/14.Dx84-S7G.js","../chunks/D6SQx3MR.js","../chunks/CK2nnbJa.js","../chunks/Cj9-pF71.js","../chunks/BVVRTJCQ.js","../nodes/15.DYrqOXo_.js","../chunks/gNgZDPHs.js","../chunks/nJUe9gXb.js","../chunks/DR4HRB4w.js","../nodes/16.C7nA7TCy.js","../chunks/Cv8bPnPc.js","../chunks/BvRGv1MX.js","../chunks/BFtd89gK.js","../nodes/17.0cv7e5IP.js","../chunks/hvudoNyJ.js","../nodes/18.PJQUQ85Q.js","../nodes/19.DRxrJE9N.js","../nodes/20.CyD18Rlt.js","../chunks/a5NclWb-.js","../chunks/DG4fF26P.js","../nodes/21.GfKFOpXV.js","../chunks/D84pURUQ.js","../chunks/CRzLMJPS.js","../chunks/BSN2qO1R.js","../chunks/Bct5vmEM.js","../chunks/DnJObvmm.js","../assets/21.VfhYpgTQ.css","../nodes/22.q4pJo1Ec.js","../nodes/24.DkL5kHzA.js","../nodes/25.C9PK5T2d.js","../chunks/v0PYjZZ5.js","../nodes/26.7nAJpm5P.js","../nodes/27.BZljPb4_.js","../nodes/28.BUnWplt-.js","../nodes/29.DWokJWH0.js","../nodes/30.ForK2knd.js","../nodes/31.DEYw8Upz.js","../chunks/BrpXEGl0.js","../nodes/32.Bi8d2lf7.js","../nodes/33.CswdDR11.js","../nodes/34.DUW5te4K.js","../nodes/35.Dpj9Kp45.js"])))=>i.map(i=>d[i]);
2
+ import{t as e}from"../chunks/CRzLMJPS.js";var t={},n=[()=>e(()=>import(`../nodes/0.0aLY-peC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url),()=>e(()=>import(`../nodes/1.D8PGvwGl.js`),__vite__mapDeps([10,1,4,5,6,7,11,12,13,14,15,16,17,18]),import.meta.url),()=>e(()=>import(`../nodes/2.BIMWgs8C.js`),__vite__mapDeps([19,1,20,12,21,22,23,2,3,4,5,6,7,24,25,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]),import.meta.url),()=>e(()=>import(`../nodes/3.B2ccxsh5.js`),__vite__mapDeps([46,1,4,5,6,7,11,12,13,14,15,16,17,18]),import.meta.url),()=>e(()=>import(`../nodes/4.DPB_nXDo.js`),__vite__mapDeps([47,1]),import.meta.url),()=>e(()=>import(`../nodes/5.B293bMJb.js`),__vite__mapDeps([48,1,23,2,3,4,5,6,7,12,24,25,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40]),import.meta.url),()=>e(()=>import(`../nodes/6.CE7P3U7c.js`),__vite__mapDeps([49,1,4,5,6,7,12,50,51,22,52,53,23,2,3,24,25,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40,54,42,43,44,45]),import.meta.url),()=>e(()=>import(`../nodes/7.DhehW04u.js`),__vite__mapDeps([55,1,4,5,6,7,13,12,56,23,2,3,24,25,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,40,57]),import.meta.url),()=>e(()=>import(`../nodes/8.CeF7Yj23.js`),__vite__mapDeps([58,1,4,5,6,7,13,12,59,25,60,18,15]),import.meta.url),()=>e(()=>import(`../nodes/9.Bk5Lntvs.js`),__vite__mapDeps([61,1,40,5,6,4,7,12,13,20,42,62,30,63,16,64,17,65,8,66,67,25,27,3,68,32,69,56]),import.meta.url),()=>e(()=>import(`../nodes/10.B3aBLsAq.js`),__vite__mapDeps([70,1,13,12,71,72,41,73,35,74,3,25,26,27,75,33,76,77,78,59,63,79,60,16,17,65]),import.meta.url),()=>e(()=>import(`../nodes/11.CnQVPSaL.js`),__vite__mapDeps([80,1,3,40,5,6,4,12,13,71,75,81,82,83,42,84,62,63,85,60,16,8,66,67,25,27,68,32,86]),import.meta.url),()=>e(()=>import(`../nodes/12.B7-VLcK9.js`),__vite__mapDeps([87,1,20,12,63,85,16,88,89]),import.meta.url),()=>e(()=>import(`../nodes/13.TEbI6lFx.js`),__vite__mapDeps([90,1,40,5,6,4,13,12,21,82,91,25,26,27,3,71,92,60,77,68,59,63,85,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/14.Dx84-S7G.js`),__vite__mapDeps([93,1,40,5,6,4,12,13,94,82,28,29,62,35,91,25,26,27,3,71,92,60,77,68,59,95,31,63,85,96,16,8,88,89,66,67,32,97]),import.meta.url),()=>e(()=>import(`../nodes/15.DYrqOXo_.js`),__vite__mapDeps([98,1,25,40,5,6,4,7,12,13,26,27,3,72,15,99,22,100,83,73,67,68,32,76,77,91,71,92,60,95,31,63,101,35,16,64,17,65,18,39]),import.meta.url),()=>e(()=>import(`../nodes/16.C7nA7TCy.js`),__vite__mapDeps([102,1,40,5,6,4,12,13,71,72,82,92,3,25,26,27,60,73,62,30,35,91,77,68,63,85,16,8,18,15,66,67,32,103,104,97,105,38,37]),import.meta.url),()=>e(()=>import(`../nodes/17.0cv7e5IP.js`),__vite__mapDeps([106,1,4,5,6,7,107,12,18,15]),import.meta.url),()=>e(()=>import(`../nodes/18.PJQUQ85Q.js`),__vite__mapDeps([108,1]),import.meta.url),()=>e(()=>import(`../nodes/19.DRxrJE9N.js`),__vite__mapDeps([109,1,6,5,43]),import.meta.url),()=>e(()=>import(`../nodes/20.CyD18Rlt.js`),__vite__mapDeps([110,1,40,5,6,4,12,56,111,42,84,112,25,31,27,3,23,2,7,24,13,14,26,15,28,29,30,32,33,34,35,36,37,38,39,91,71,92,60,77,68,43,63,85,101,8]),import.meta.url),()=>e(()=>import(`../nodes/21.GfKFOpXV.js`),__vite__mapDeps([113,114,115,1,2,3,25,40,5,6,4,7,12,24,13,14,26,27,15,28,29,30,31,32,33,34,35,36,37,38,39,71,104,75,72,45,116,117,100,92,60,42,74,76,77,78,59,95,112,96,8,18,118,86,119]),import.meta.url),()=>e(()=>import(`../nodes/22.q4pJo1Ec.js`),__vite__mapDeps([120,1,4,5,6,7,13,12,59,25,60,18,15,118]),import.meta.url),()=>e(()=>import(`../chunks/BvRk9kiK.js`),[],import.meta.url),()=>e(()=>import(`../nodes/24.DkL5kHzA.js`),__vite__mapDeps([121,1,4,5,6,7,13,12,91,25,26,27,3,71,92,60,77,68,79,18,15]),import.meta.url),()=>e(()=>import(`../nodes/25.C9PK5T2d.js`),__vite__mapDeps([122,1,3,40,5,6,4,7,12,13,94,26,25,27,71,15,81,99,116,117,111,56,42,84,112,31,53,100,82,92,60,28,62,123,30,35,67,68,32,91,77,34,14,59,95,43,63,85,79,101,96,8,18,66,37,97,105]),import.meta.url),()=>e(()=>import(`../nodes/26.7nAJpm5P.js`),__vite__mapDeps([124,1,4,5,6,7,13,12,59,25,60,18,15]),import.meta.url),()=>e(()=>import(`../nodes/27.BZljPb4_.js`),__vite__mapDeps([125,1,20,12,51,30,63,16,17,65,69,56]),import.meta.url),()=>e(()=>import(`../nodes/28.BUnWplt-.js`),__vite__mapDeps([126,1,50,12,73,63,16,17,65]),import.meta.url),()=>e(()=>import(`../nodes/29.DWokJWH0.js`),__vite__mapDeps([127,1,40,5,6,4,7,13,12,82,42,84,62,91,25,26,27,3,71,92,60,77,68,63,85,79,16,64,17,65,8,66,67,32,86]),import.meta.url),()=>e(()=>import(`../nodes/30.ForK2knd.js`),__vite__mapDeps([128,1,40,5,6,4,12,13,99,107,92,3,25,26,27,60,62,123,35,91,71,77,68,63,85,16,64,17,65,8,66,67,32,103,104,72,97,105,36,37]),import.meta.url),()=>e(()=>import(`../nodes/31.DEYw8Upz.js`),__vite__mapDeps([129,1,40,5,6,4,13,12,130,51,82,62,67,25,27,3,68,32,91,26,71,92,60,77,63,85,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/32.Bi8d2lf7.js`),__vite__mapDeps([131,1,40,5,6,4,13,12,117,54,67,25,27,3,68,32,63,85,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/33.CswdDR11.js`),__vite__mapDeps([132,1,12,62,63,16,64,17,65]),import.meta.url),()=>e(()=>import(`../nodes/34.DUW5te4K.js`),__vite__mapDeps([133,1,40,5,6,4,13,12,130,53,62,67,25,27,3,68,32,63,85,60,16,8,88,89]),import.meta.url),()=>e(()=>import(`../nodes/35.Dpj9Kp45.js`),__vite__mapDeps([134,1,40,5,6,4,7,13,12,26,25,27,3,99,52,62,74,71,75,33,76,77,78,67,68,32,59,95,31,63,85,79,60,16,64,17,65,8,18,15,88,89,37]),import.meta.url)],r=[0,2,5,6],i={"/":[-8],"/accept-invite":[-9],"/admin":[-10,[2],[3]],"/admin/audit":[-11,[2],[3]],"/admin/compute":[-12,[2],[3]],"/admin/organizations":[-13,[2],[3]],"/admin/projects":[-14,[2],[3]],"/admin/projects/[id]":[-15,[2],[3]],"/admin/system":[-16,[2],[3]],"/admin/users":[-17,[2],[3]],"/auth/email/sent":[17],"/auth/email/start":[-19],"/docs/api":[-20],"/library":[-21,[4]],"/library/[guid]":[-22,[4]],"/login":[-23],"/logout":[23],"/oauth/authorize":[-25],"/projects":[-26,[5]],"/setup":[-27],"/team":[-28,[6]],"/team/activity":[28,[6]],"/team/compute":[-30,[6]],"/team/members":[-31,[6]],"/team/projects":[-32,[6]],"/team/reclaim":[-33,[6]],"/team/settings":[-34,[6]],"/team/shares":[-35,[6]],"/team/tokens":[-36,[6]]},a={handleError:(({kind:e,error:t})=>{e===`unknown`&&console.error(t)}),reroute:(()=>{}),transport:{}},o=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.decode])),s=Object.fromEntries(Object.entries(a.transport).map(([e,t])=>[e,t.encode])),c=!1,l=(e,t)=>o[e](t),u=()=>e(()=>import(`../chunks/Bjy-W4x2.js`).then(e=>e.default),[],import.meta.url);export{l as decode,o as decoders,i as dictionary,s as encoders,u as get_error_template,c as hash,a as hooks,t as matchers,n as nodes,r as server_loads};
@@ -1,4 +1,4 @@
1
- import{A as e,D as t,Ft as n,G as r,H as i,J as a,K as o,L as s,Lt as c,Ot as l,P as u,Pt as d,Q as f,Rt as p,S as m,St as h,T as g,U as _,V as v,_t as y,a as b,dt as x,f as S,ft as C,ht as w,i as T,it as E,k as D,kt as O,l as k,lt as A,m as j,mt as M,n as N,ot as P,p as F,pt as I,q as L,r as R,st as z,t as B,tt as ee,u as te,v as V,x as H,yt as U}from"../chunks/sphvlIzg.js";import{a as W,c as G,d as K,f as q,n as ne,o as re,r as ie,s as J,t as Y,y as X}from"../chunks/CoRMsLUN.js";import{c as ae}from"../chunks/B3e8ZKjr.js";import{n as oe}from"../chunks/BFJ8iwO4.js";import"../chunks/BHnRUwtv.js";import{n as se,r as Z}from"../chunks/Ca-1xMUo.js";import{t as ce}from"../chunks/BbFMtSJ8.js";import{o as le}from"../chunks/DNFu5yLd.js";import{t as ue}from"../chunks/B187F-XR.js";import{a as de,i as fe,r as pe}from"../chunks/CivEAG-M.js";import{t as me}from"../chunks/gNgZDPHs.js";import{t as he}from"../chunks/rIQJtl5L.js";import{t as ge}from"../chunks/nJUe9gXb.js";import{t as _e}from"../chunks/CNkLk5_8.js";import{t as ve}from"../chunks/Djv8qD_2.js";import{p as ye,q as be}from"../chunks/OznVWGiS.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De,t as Oe}from"../chunks/CdTxvcQ4.js";import{t as ke}from"../chunks/DcS7V4T3.js";import{t as Ae}from"../chunks/TZzCN567.js";import{i as je,n as Me,r as Ne,t as Pe}from"../chunks/CK2nnbJa.js";import{t as Fe}from"../chunks/1AvDtYi1.js";import{t as Ie}from"../chunks/DR4HRB4w.js";import{n as Le,t as Re}from"../chunks/B8LXiPqe.js";import{t as ze}from"../chunks/ByPYmSUR.js";import{t as Be}from"../chunks/Bx2qumU5.js";import{t as Ve}from"../chunks/fJvE1weH.js";import{t as He}from"../chunks/DIYaLgLs.js";import{t as Ue}from"../chunks/BUENW6k7.js";var We={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]]};We.node;var Ge=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ke(e,t){let n=N(t,Ge);Z(e,R(()=>n,{get icon(){return We}}))}var qe={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]]};qe.node;var Je=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ye(e,t){let n=N(t,Je);Z(e,R(()=>n,{get icon(){return qe}}))}var Xe={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m16 12-4-4-4 4`}],[`path`,{d:`M12 16V8`}]],aliases:[`arrow-up-circle`]};Xe.node;var Ze=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qe(e,t){let n=N(t,Ze);Z(e,R(()=>n,{get icon(){return Xe}}))}var $e={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m15 9-6 6`}],[`path`,{d:`m9 9 6 6`}]],aliases:[`x-circle`]};$e.node;var et=new Set([`$$slots`,`$$events`,`$$legacy`]);function tt(e,t){let n=N(t,et);Z(e,R(()=>n,{get icon(){return $e}}))}var nt={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`}],[`path`,{d:`M6.453 15h11.094`}],[`path`,{d:`M8.5 2h7`}]]};nt.node;var rt=new Set([`$$slots`,`$$events`,`$$legacy`]);function it(e,t){let n=N(t,rt);Z(e,R(()=>n,{get icon(){return nt}}))}var at={name:`stethoscope`,size:24,node:[[`path`,{d:`M11 2v2`}],[`path`,{d:`M5 2v2`}],[`path`,{d:`M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1`}],[`path`,{d:`M8 15a6 6 0 0 0 12 0v-3`}],[`circle`,{cx:`20`,cy:`10`,r:`2`}]]};at.node;var ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function st(e,t){let n=N(t,ot);Z(e,R(()=>n,{get icon(){return at}}))}var ct=re({component:`switch`,parts:[`root`,`thumb`]}),lt=new be(`Switch.Root`),ut=class e{static create(t){return lt.set(new e(t))}opts;attachment;constructor(e){this.opts=e,this.attachment=K(e.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this)}#e(){this.opts.checked.current=!this.opts.checked.current}onkeydown(e){e.key!==`Enter`&&e.key!==` `||this.opts.disabled.current||(e.preventDefault(),this.#e())}onclick(e){this.opts.disabled.current||this.#e()}#t=h(()=>({"data-disabled":ne(this.opts.disabled.current),"data-state":G(this.opts.checked.current),"data-required":ne(this.opts.required.current)}));get sharedProps(){return f(this.#t)}set sharedProps(e){y(this.#t,e)}#n=h(()=>({checked:this.opts.checked.current}));get snippetProps(){return f(this.#n)}set snippetProps(e){y(this.#n,e)}#r=h(()=>({...this.sharedProps,id:this.opts.id.current,role:`switch`,disabled:W(this.opts.disabled.current),"aria-checked":J(this.opts.checked.current,!1),"aria-required":ie(this.opts.required.current),[ct.root]:``,onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return f(this.#r)}set props(e){y(this.#r,e)}},dt=class e{static create(){return new e(lt.get())}root;#e=h(()=>this.root.opts.name.current!==void 0);get shouldRender(){return f(this.#e)}set shouldRender(e){y(this.#e,e)}constructor(e){this.root=e}#t=h(()=>({type:`checkbox`,name:this.root.opts.name.current,value:this.root.opts.value.current,checked:this.root.opts.checked.current,disabled:this.root.opts.disabled.current,required:this.root.opts.required.current}));get props(){return f(this.#t)}set props(e){y(this.#t,e)}},ft=class e{static create(t){return new e(t,lt.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=K(e.ref)}#e=h(()=>({checked:this.root.opts.checked.current}));get snippetProps(){return f(this.#e)}set snippetProps(e){y(this.#e,e)}#t=h(()=>({...this.root.sharedProps,id:this.opts.id.current,[ct.thumb]:``,...this.attachment}));get props(){return f(this.#t)}set props(e){y(this.#t,e)}};function pt(t,n){O(n,!0);let r=dt.create();var a=i(),o=C(a),s=e=>{ke(e,R(()=>r.props))};e(o,e=>{r.shouldRender&&e(s)}),v(t,a),l()}var mt=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`required`,`checked`,`value`,`name`,`type`,`onCheckedChange`]),ht=_(`<button><!></button>`),gt=_(`<!> <!>`,1);function _t(t,a){let o=r();O(a,!0);let s=B(a,`ref`,15,null),d=B(a,`id`,19,()=>Y(o)),p=B(a,`disabled`,3,!1),m=B(a,`required`,3,!1),g=B(a,`checked`,15,!1),_=B(a,`value`,3,`on`),y=B(a,`name`,3,void 0),b=B(a,`type`,3,`button`),w=B(a,`onCheckedChange`,3,ye),T=N(a,mt),E=ut.create({checked:X(()=>g(),e=>{g(e),w()?.(e)}),disabled:X(()=>p()??!1),required:X(()=>m()),value:X(()=>_()),name:X(()=>y()),id:X(()=>d()),ref:X(()=>s(),e=>s(e))}),D=h(()=>q(T,E.props,{type:b()}));var k=gt(),A=C(k),j=e=>{var t=i(),n=C(t);{let e=h(()=>({props:f(D),...E.snippetProps}));u(n,()=>a.child,()=>f(e))}v(e,t)},P=e=>{var t=ht();S(t,()=>({...f(D)}));var r=x(t);u(r,()=>a.children??c,()=>E.snippetProps),n(t),v(e,t)};e(A,e=>{a.child?e(j):e(P,-1)}),pt(M(A,2),{}),v(t,k),l()}var vt=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`]),yt=_(`<span><!></span>`);function bt(t,a){let o=r();O(a,!0);let s=B(a,`ref`,15,null),d=B(a,`id`,19,()=>Y(o)),p=N(a,vt),m=ft.create({id:X(()=>d()),ref:X(()=>s(),e=>s(e))}),g=h(()=>q(p,m.props));var _=i(),y=C(_),b=e=>{var t=i(),n=C(t);{let e=h(()=>({props:f(g),...m.snippetProps}));u(n,()=>a.child,()=>f(e))}v(e,t)},w=e=>{var t=yt();S(t,()=>({...f(g)}));var r=x(t);u(r,()=>a.children??c,()=>m.snippetProps),n(t),v(e,t)};e(y,e=>{a.child?e(b):e(w,-1)}),v(t,_),l()}var xt=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`checked`]);function St(e,t){O(t,!0);let n=B(t,`ref`,15,null),r=B(t,`checked`,15,!1),a=N(t,xt);var o=i(),s=C(o);{let e=h(()=>se(`peer w-8 shadow-xs h-4.5 inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,t.class));g(s,()=>_t,(t,o)=>{o(t,R({"data-slot":`switch`,get class(){return f(e)}},()=>a,{get ref(){return n()},set ref(e){n(e)},get checked(){return r()},set checked(e){r(e)},children:(e,t)=>{var n=i(),r=C(n);{let e=h(()=>se(`size-4 data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-3.5 pointer-events-none block rounded-full bg-background ring-0 transition-transform dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground`));g(r,()=>bt,(t,n)=>{n(t,{"data-slot":`switch-thumb`,get class(){return f(e)}})})}v(e,n)},$$slots:{default:!0}}))})}v(e,o),l()}function Q(e,t){let n=t.exec(e);return n?n[1]:void 0}function Ct(e){let t=String.raw`\d+\.\d+\.\d+[^\s]*`,n=new RegExp(String.raw`(?:Target \([^)]*\)|Available):\s*(${t})\s*(?:→|->)\s*(${t})`).exec(e);return{from:Q(e,/Current @selvajs\/selva:\s*v?(\d+\.\d+\.\d+[^\s]*)/)??n?.[1],to:Q(e,/New @selvajs\/selva:\s*v?(\d+\.\d+\.\d+[^\s]*)/)??n?.[2]}}function $(e,t){return e.includes(t)}function wt(e,t){let{from:n,to:r}=Ct(t);if(e===null)return{severity:`pending`,title:`Update in progress…`};if(e===6||$(t,`Manual recovery required`)||$(t,`manual intervention required`))return{severity:`critical`,title:`Update failed AND rollback failed — the app may be OFFLINE`,detail:"Both the new version and the rollback failed their health check. SSH into the server and run: `npx selva logs`, then `pm2 start ecosystem.config.cjs` from the deployment directory.",from:n,to:r};if(e===-2)return{severity:`critical`,title:`App did not come back online within 15 minutes`,detail:"The update may still be finishing in the background, or the new process is crash-looping. Check `npx selva logs`. Do not re-run the update until you have confirmed the current state.",from:n,to:r};if(e===4)return{severity:`critical`,title:`Update failed and the rollback could not reinstall — the app may be OFFLINE`,detail:"The previous version could not be restored from npm. SSH into the server and run `npx selva logs`; if the app is down, reinstall explicitly with `npm install --prefer-online @selvajs/cli@<version> @selvajs/selva@<version>` from the deployment directory.",from:n,to:r};if(e===3)return{severity:`critical`,title:`Update failed its health check and could not be rolled back automatically`,detail:"No prior version was recorded, so the previous build could not be restored. Check `npx selva logs` to confirm whether the app came back online.",from:n,to:r};if(e===143||e===130||e===129||$(t,`KILLED`))return{severity:`critical`,title:`Update was killed before it finished — nothing was installed`,detail:"The runner was terminated mid-update, most often by a systemd-supervised PM2 restarting its whole control group. The version on disk is unchanged. Check `npx selva logs` and confirm the app is online before retrying; if a global pm2 owns the daemon, reconcile that first.",from:n,to:r};if(e===9||$(t,`SYSTEMD_PM2`))return{severity:`warning`,title:`Update cancelled — PM2 needs a resync that only a shell can do safely. The app is untouched.`,detail:"This deployment's PM2 runs under systemd, where `pm2 update` restarts the unit and kills the update mid-run. Nothing was installed and the app is still serving. SSH in and run `./node_modules/.bin/pm2 update` from the deployment directory, then retry the update here.",from:n,to:r};if(e===11||$(t,`PM2_NAME_TAKEN`)){let e=Q(t,/PM2_NAME_TAKEN: pm2's '[^']*' runs from (\S+),/);return{severity:`warning`,title:`Update cancelled — another Selva install${e?` (${e})`:``} uses this install's PM2 app name. The app is untouched.`,detail:"PM2 finds an app by name, so this update would have stopped the other install and left this one running on replaced files. Nothing was installed. On the server, give this install its own `name` in its ecosystem.config.cjs, run `npx selva start` from its directory, then retry the update here.",from:n,to:r}}if(e===12||$(t,`NOT_STOPPED`))return{severity:`warning`,title:`Update cancelled — the app kept answering after PM2 stopped it. Nothing was installed.`,detail:"Either this install's PM2 does not run the process that is serving (another PM2 daemon, a systemd unit or a shell started it), or it did not exit. Updating would have replaced its files without restarting it. On the server, find what holds the port (`ss -ltnp`), stop it there, run `npx selva start` from the deployment directory, then retry.",from:n,to:r};if(e===10||$(t,`DATA_FORMAT:`)){let e=Q(t,/reads data format (\d+),/),i=Q(t,/this deployment is on format (\d+)\./);return{severity:`warning`,title:`Update cancelled — ${r??`the target version`} cannot read this deployment's data. The app is untouched.`,detail:(e&&i?`It reads data format ${e}; this deployment is on format ${i}. `:``)+`Installing it would leave stored data, such as Compute API keys, unreadable. Switch the release channel back to stay on the installed version. To go back anyway, follow "Going back to an older release" in the admin guide.`,from:n,to:r}}if(e===8||$(t,`PM2_SKEW`)){let e=Q(t,/daemon \(v(\d+\.\d+\.\d+)\)/),i=Q(t,/deployment's pm2 \(v(\d+\.\d+\.\d+)\)/);return{severity:`warning`,title:e&&i?`Update cancelled — a global PM2 (v${e}) owns the daemon, not this deployment's (v${i}). The app is untouched.`:`Update cancelled — a conflicting global PM2 owns the daemon. The app is untouched.`,detail:"Resyncing would have downgraded the daemon and dropped its process table, so the update stopped before taking the app down. On the server: `which -a pm2`, `pm2 -v`, `pm2 ping` — remove or align the global pm2, then retry.",from:n,to:r}}if($(t,`SCHEMA_SKEW`)){let e=Q(t,/expects database migration head (\S+?),/),i=Q(t,/this database is at (\S+?)\./),a=e&&i?` The database is at ${i}; ${r??`it`} needs ${e}.`:``,o=Q(t,/@selvajs\/supabase-provider@([\w.-]+)/)??($(t,`channel: beta`)?`beta`:`latest`);return{severity:`warning`,title:`Update rolled back — the database migrations for ${r??`the new version`} have not been applied.${a} The app is online${n?` on ${n}`:``}.`,detail:`Nothing is wrong with the new version. Selva does not apply migrations during an update, because they cannot be rolled back — auto-migrating and then rolling the code back would leave the app and database on different heads. Apply them on the server, then re-run this update: \`npm install --prefer-online @selvajs/supabase-provider@${o}\`, then \`npx selva-supabase\`, then \`npx supabase db push\`. The provider install is not optional — the migration SQL ships inside that package, and the update only moves @selvajs/cli and @selvajs/selva, so a sync without it copies nothing and the push reports "up to date" having done nothing. Retrying without this will fail in exactly the same way.`,from:n,to:r}}if($(t,`AT_REST_SECRETS`))return{severity:`warning`,title:`Update rolled back — stored compute server keys do not decrypt under this host's SELVA_AT_REST_KEY. The app is online${n?` on ${n}`:``}.`,detail:`This is a configuration problem on the server, not a fault in the new version, so retrying alone will fail identically. Re-enter the affected keys at /admin/compute, or restore the SELVA_AT_REST_KEY the values were encrypted with, then re-run the update.`,from:n,to:r};if(e===5||$(t,`Rolled back`))return{severity:`warning`,title:`Update failed — safely rolled back${n?` to ${n}`:``}. The app is online.`,detail:`The new version failed its health check, so the previous version was restored and is serving normally. Review the log below for why the new version failed before retrying.`,from:n,to:r};if($(t,`ENGINE_MISMATCH`)||$(t,`EBADENGINE`)){let e=Q(t,/requires Node ([^\s]+(?:\s*[<>=]+\s*[\d.]+)*)/),i=Q(t,/this host runs v?(\d+\.\d+\.\d+)/);return{severity:`warning`,title:i?`Updated${r?` to ${r}`:``}, but this release needs Node ${e??`(newer)`} — the host runs v${i}. Expect runtime failures.`:`Updated${r?` to ${r}`:``}, but this release requires a newer Node than the host provides. Expect runtime failures.`,detail:`npm installed it anyway (engine-strict is off) and the health check passed, but it does not exercise the newer APIs — routes that do will throw at request time. Upgrade Node on the server, then re-run the update.`,from:n,to:r}}return $(t,`PM2_RESYNC_NEEDED`)?{severity:`warning`,title:`Updated${r?` to ${r}`:``}, but the pm2 daemon still runs the old pm2.`,detail:"The app is online. On the server, run `npx pm2 update` in the deployment directory, let it finish, then check `npx pm2 list` shows the app online.",from:n,to:r}:$(t,`PM2_PIN_FAILED`)?{severity:`warning`,title:`Updated${r?` to ${r}`:``}, but pm2 stayed on the previous version.`,detail:"The app is online on the old pm2. On the server, run `npx selva migrate` in the deployment directory to move it to the pinned version.",from:n,to:r}:$(t,`npm cache may be stale`)||$(t,`No version change`)?{severity:`warning`,title:`No version change — npm installed the same version.`,detail:"Your npm cache may be stale. On the server: `npm cache clean --force`, remove node_modules + package-lock.json, then `npm install --prefer-online`.",from:n,to:r}:e===0?$(t,`Already on the`)||$(t,`Nothing to do`)?{severity:`info`,title:`Already up to date${n?` (${n})`:``} — nothing to install.`,detail:`No changes were made and the app was not restarted.`,from:n,to:r}:n&&r&&n!==r?{severity:`success`,title:`Updated ${n} → ${r}. The app is back online.`,from:n,to:r}:r?{severity:`success`,title:`Update complete — now on ${r}. The app is back online.`,from:n,to:r}:{severity:`success`,title:`Update completed and the app is back online.`,from:n,to:r}:{severity:`critical`,title:`Update failed (exit code ${e}).`,detail:"The update did not complete cleanly. Review the log below, and check `npx selva logs` to confirm whether the app is currently online.",from:n,to:r}}var Tt=_(`<span title="Currently installed @selvajs/selva version"> </span>`),Et=_(`Update @selvajs/* to the latest <span class="font-medium"> </span> release and restart`,1),Dt=_(`<div class="flex items-start justify-between gap-3"><!> <!></div> <!>`,1),Ot=_(`<div class="border-warning/40 bg-warning/10 text-warning flex items-center gap-2 rounded-md border px-3 py-2 text-sm" role="status"><!> <span> <span class="font-mono"> </span> → <span class="font-mono"> </span></span></div>`),kt=_(`<p class="text-muted-foreground text-sm"> <span class="font-mono"> </span>).</p>`),At=_(`<div class="border-destructive/40 bg-destructive/10 text-destructive flex items-start gap-2 rounded-md border px-3 py-3 text-sm" role="alert"><!> <div class="space-y-1"><p class="font-medium">Update blocked — <span class="font-mono"> </span> cannot read this deployment's
1
+ import{A as e,D as t,Ft as n,G as r,H as i,J as a,K as o,L as s,Lt as c,Ot as l,P as u,Pt as d,Q as f,Rt as p,S as m,St as h,T as g,U as _,V as v,_t as y,a as b,dt as x,f as S,ft as C,ht as w,i as T,it as E,k as D,kt as O,l as k,lt as A,m as j,mt as M,n as N,ot as P,p as F,pt as I,q as L,r as R,st as z,t as B,tt as ee,u as te,v as V,x as H,yt as U}from"../chunks/sphvlIzg.js";import{a as W,c as G,d as K,f as q,n as ne,o as re,r as ie,s as J,t as Y,y as X}from"../chunks/CoRMsLUN.js";import{c as ae}from"../chunks/B3e8ZKjr.js";import{n as oe}from"../chunks/BFJ8iwO4.js";import"../chunks/BHnRUwtv.js";import{n as se,r as Z}from"../chunks/Ca-1xMUo.js";import{t as ce}from"../chunks/BbFMtSJ8.js";import{o as le}from"../chunks/DNFu5yLd.js";import{t as ue}from"../chunks/B187F-XR.js";import{a as de,i as fe,r as pe}from"../chunks/CivEAG-M.js";import{t as me}from"../chunks/gNgZDPHs.js";import{t as he}from"../chunks/rIQJtl5L.js";import{t as ge}from"../chunks/nJUe9gXb.js";import{t as _e}from"../chunks/CNkLk5_8.js";import{t as ve}from"../chunks/Djv8qD_2.js";import{p as ye,q as be}from"../chunks/OznVWGiS.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De,t as Oe}from"../chunks/CdTxvcQ4.js";import{t as ke}from"../chunks/DcS7V4T3.js";import{t as Ae}from"../chunks/TZzCN567.js";import{i as je,n as Me,r as Ne,t as Pe}from"../chunks/CK2nnbJa.js";import{t as Fe}from"../chunks/1AvDtYi1.js";import{t as Ie}from"../chunks/DR4HRB4w.js";import{n as Le,t as Re}from"../chunks/B8LXiPqe.js";import{t as ze}from"../chunks/ByPYmSUR.js";import{t as Be}from"../chunks/Bx2qumU5.js";import{t as Ve}from"../chunks/fJvE1weH.js";import{t as He}from"../chunks/DIYaLgLs.js";import{t as Ue}from"../chunks/BUENW6k7.js";var We={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`}],[`path`,{d:`m19 12-7 7-7-7`}]]};We.node;var Ge=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ke(e,t){let n=N(t,Ge);Z(e,R(()=>n,{get icon(){return We}}))}var qe={name:`arrow-up`,size:24,node:[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]]};qe.node;var Je=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ye(e,t){let n=N(t,Je);Z(e,R(()=>n,{get icon(){return qe}}))}var Xe={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m16 12-4-4-4 4`}],[`path`,{d:`M12 16V8`}]],aliases:[`arrow-up-circle`]};Xe.node;var Ze=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qe(e,t){let n=N(t,Ze);Z(e,R(()=>n,{get icon(){return Xe}}))}var $e={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`m15 9-6 6`}],[`path`,{d:`m9 9 6 6`}]],aliases:[`x-circle`]};$e.node;var et=new Set([`$$slots`,`$$events`,`$$legacy`]);function tt(e,t){let n=N(t,et);Z(e,R(()=>n,{get icon(){return $e}}))}var nt={name:`flask-conical`,size:24,node:[[`path`,{d:`M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2`}],[`path`,{d:`M6.453 15h11.094`}],[`path`,{d:`M8.5 2h7`}]]};nt.node;var rt=new Set([`$$slots`,`$$events`,`$$legacy`]);function it(e,t){let n=N(t,rt);Z(e,R(()=>n,{get icon(){return nt}}))}var at={name:`stethoscope`,size:24,node:[[`path`,{d:`M11 2v2`}],[`path`,{d:`M5 2v2`}],[`path`,{d:`M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1`}],[`path`,{d:`M8 15a6 6 0 0 0 12 0v-3`}],[`circle`,{cx:`20`,cy:`10`,r:`2`}]]};at.node;var ot=new Set([`$$slots`,`$$events`,`$$legacy`]);function st(e,t){let n=N(t,ot);Z(e,R(()=>n,{get icon(){return at}}))}var ct=re({component:`switch`,parts:[`root`,`thumb`]}),lt=new be(`Switch.Root`),ut=class e{static create(t){return lt.set(new e(t))}opts;attachment;constructor(e){this.opts=e,this.attachment=K(e.ref),this.onkeydown=this.onkeydown.bind(this),this.onclick=this.onclick.bind(this)}#e(){this.opts.checked.current=!this.opts.checked.current}onkeydown(e){e.key!==`Enter`&&e.key!==` `||this.opts.disabled.current||(e.preventDefault(),this.#e())}onclick(e){this.opts.disabled.current||this.#e()}#t=h(()=>({"data-disabled":ne(this.opts.disabled.current),"data-state":G(this.opts.checked.current),"data-required":ne(this.opts.required.current)}));get sharedProps(){return f(this.#t)}set sharedProps(e){y(this.#t,e)}#n=h(()=>({checked:this.opts.checked.current}));get snippetProps(){return f(this.#n)}set snippetProps(e){y(this.#n,e)}#r=h(()=>({...this.sharedProps,id:this.opts.id.current,role:`switch`,disabled:W(this.opts.disabled.current),"aria-checked":J(this.opts.checked.current,!1),"aria-required":ie(this.opts.required.current),[ct.root]:``,onclick:this.onclick,onkeydown:this.onkeydown,...this.attachment}));get props(){return f(this.#r)}set props(e){y(this.#r,e)}},dt=class e{static create(){return new e(lt.get())}root;#e=h(()=>this.root.opts.name.current!==void 0);get shouldRender(){return f(this.#e)}set shouldRender(e){y(this.#e,e)}constructor(e){this.root=e}#t=h(()=>({type:`checkbox`,name:this.root.opts.name.current,value:this.root.opts.value.current,checked:this.root.opts.checked.current,disabled:this.root.opts.disabled.current,required:this.root.opts.required.current}));get props(){return f(this.#t)}set props(e){y(this.#t,e)}},ft=class e{static create(t){return new e(t,lt.get())}opts;root;attachment;constructor(e,t){this.opts=e,this.root=t,this.attachment=K(e.ref)}#e=h(()=>({checked:this.root.opts.checked.current}));get snippetProps(){return f(this.#e)}set snippetProps(e){y(this.#e,e)}#t=h(()=>({...this.root.sharedProps,id:this.opts.id.current,[ct.thumb]:``,...this.attachment}));get props(){return f(this.#t)}set props(e){y(this.#t,e)}};function pt(t,n){O(n,!0);let r=dt.create();var a=i(),o=C(a),s=e=>{ke(e,R(()=>r.props))};e(o,e=>{r.shouldRender&&e(s)}),v(t,a),l()}var mt=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`,`disabled`,`required`,`checked`,`value`,`name`,`type`,`onCheckedChange`]),ht=_(`<button><!></button>`),gt=_(`<!> <!>`,1);function _t(t,a){let o=r();O(a,!0);let s=B(a,`ref`,15,null),d=B(a,`id`,19,()=>Y(o)),p=B(a,`disabled`,3,!1),m=B(a,`required`,3,!1),g=B(a,`checked`,15,!1),_=B(a,`value`,3,`on`),y=B(a,`name`,3,void 0),b=B(a,`type`,3,`button`),w=B(a,`onCheckedChange`,3,ye),T=N(a,mt),E=ut.create({checked:X(()=>g(),e=>{g(e),w()?.(e)}),disabled:X(()=>p()??!1),required:X(()=>m()),value:X(()=>_()),name:X(()=>y()),id:X(()=>d()),ref:X(()=>s(),e=>s(e))}),D=h(()=>q(T,E.props,{type:b()}));var k=gt(),A=C(k),j=e=>{var t=i(),n=C(t);{let e=h(()=>({props:f(D),...E.snippetProps}));u(n,()=>a.child,()=>f(e))}v(e,t)},P=e=>{var t=ht();S(t,()=>({...f(D)}));var r=x(t);u(r,()=>a.children??c,()=>E.snippetProps),n(t),v(e,t)};e(A,e=>{a.child?e(j):e(P,-1)}),pt(M(A,2),{}),v(t,k),l()}var vt=new Set([`$$slots`,`$$events`,`$$legacy`,`child`,`children`,`ref`,`id`]),yt=_(`<span><!></span>`);function bt(t,a){let o=r();O(a,!0);let s=B(a,`ref`,15,null),d=B(a,`id`,19,()=>Y(o)),p=N(a,vt),m=ft.create({id:X(()=>d()),ref:X(()=>s(),e=>s(e))}),g=h(()=>q(p,m.props));var _=i(),y=C(_),b=e=>{var t=i(),n=C(t);{let e=h(()=>({props:f(g),...m.snippetProps}));u(n,()=>a.child,()=>f(e))}v(e,t)},w=e=>{var t=yt();S(t,()=>({...f(g)}));var r=x(t);u(r,()=>a.children??c,()=>m.snippetProps),n(t),v(e,t)};e(y,e=>{a.child?e(b):e(w,-1)}),v(t,_),l()}var xt=new Set([`$$slots`,`$$events`,`$$legacy`,`ref`,`class`,`checked`]);function St(e,t){O(t,!0);let n=B(t,`ref`,15,null),r=B(t,`checked`,15,!1),a=N(t,xt);var o=i(),s=C(o);{let e=h(()=>se(`peer w-8 shadow-xs h-4.5 inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,t.class));g(s,()=>_t,(t,o)=>{o(t,R({"data-slot":`switch`,get class(){return f(e)}},()=>a,{get ref(){return n()},set ref(e){n(e)},get checked(){return r()},set checked(e){r(e)},children:(e,t)=>{var n=i(),r=C(n);{let e=h(()=>se(`size-4 data-[state=unchecked]:translate-x-0 data-[state=checked]:translate-x-3.5 pointer-events-none block rounded-full bg-background ring-0 transition-transform dark:data-[state=checked]:bg-primary-foreground dark:data-[state=unchecked]:bg-foreground`));g(r,()=>bt,(t,n)=>{n(t,{"data-slot":`switch-thumb`,get class(){return f(e)}})})}v(e,n)},$$slots:{default:!0}}))})}v(e,o),l()}function Q(e,t){let n=t.exec(e);return n?n[1]:void 0}function Ct(e){let t=String.raw`\d+\.\d+\.\d+[^\s]*`,n=new RegExp(String.raw`(?:Target \([^)]*\)|Available):\s*(${t})\s*(?:→|->)\s*(${t})`).exec(e);return{from:Q(e,/Current @selvajs\/selva:\s*v?(\d+\.\d+\.\d+[^\s]*)/)??n?.[1],to:Q(e,/New @selvajs\/selva:\s*v?(\d+\.\d+\.\d+[^\s]*)/)??n?.[2]}}function $(e,t){return e.includes(t)}function wt(e,t){let{from:n,to:r}=Ct(t);if(e===null)return{severity:`pending`,title:`Update in progress…`};if(e===6||$(t,`Manual recovery required`)||$(t,`manual intervention required`))return{severity:`critical`,title:`Update failed AND rollback failed — the app may be OFFLINE`,detail:"Both the new version and the rollback failed their health check. SSH into the server and run: `npx selva logs`, then `pm2 start ecosystem.config.cjs` from the deployment directory.",from:n,to:r};if(e===-2)return{severity:`critical`,title:`App did not come back online within 15 minutes`,detail:"The update may still be finishing in the background, or the new process is crash-looping. Check `npx selva logs`. Do not re-run the update until you have confirmed the current state.",from:n,to:r};if(e===4)return{severity:`critical`,title:`Update failed and the rollback could not reinstall — the app may be OFFLINE`,detail:"The previous version could not be restored from npm. SSH into the server and run `npx selva logs`; if the app is down, reinstall explicitly with `npm install --prefer-online @selvajs/cli@<version> @selvajs/selva@<version>` from the deployment directory.",from:n,to:r};if(e===3)return{severity:`critical`,title:`Update failed its health check and could not be rolled back automatically`,detail:"No prior version was recorded, so the previous build could not be restored. Check `npx selva logs` to confirm whether the app came back online.",from:n,to:r};if(e===143||e===130||e===129||$(t,`KILLED`))return{severity:`critical`,title:`Update was killed before it finished — nothing was installed`,detail:"The runner was terminated mid-update, most often by a systemd-supervised PM2 restarting its whole control group. The version on disk is unchanged. Check `npx selva logs` and confirm the app is online before retrying; if a global pm2 owns the daemon, reconcile that first.",from:n,to:r};if(e===9||$(t,`SYSTEMD_PM2`))return{severity:`warning`,title:`Update cancelled — PM2 needs a resync that only a shell can do safely. The app is untouched.`,detail:"This deployment's PM2 runs under systemd, where `pm2 update` restarts the unit and kills the update mid-run. Nothing was installed and the app is still serving. SSH in and run `./node_modules/.bin/pm2 update` from the deployment directory, then retry the update here.",from:n,to:r};if(e===11||$(t,`PM2_NAME_TAKEN`)){let e=Q(t,/PM2_NAME_TAKEN: pm2's '[^']*' runs from (\S+),/);return{severity:`warning`,title:`Update cancelled — another Selva install${e?` (${e})`:``} uses this install's PM2 app name. The app is untouched.`,detail:"PM2 finds an app by name, so this update would have stopped the other install and left this one running on replaced files. Nothing was installed. On the server, give this install its own `name` in its ecosystem.config.cjs, run `npx selva start` from its directory, then retry the update here.",from:n,to:r}}if(e===13||$(t,`NOT_DOWNLOADABLE`))return{severity:`warning`,title:`Update cancelled — npm does not serve ${r??`the new version`} yet. The app is untouched.`,detail:`A release just published is listed on npm a few minutes before its files can be downloaded. Nothing was stopped or installed. Retry the update in a few minutes.`,from:n,to:r};if(e===12||$(t,`NOT_STOPPED`))return{severity:`warning`,title:`Update cancelled — the app kept answering after PM2 stopped it. Nothing was installed.`,detail:"Either this install's PM2 does not run the process that is serving (another PM2 daemon, a systemd unit or a shell started it), or it did not exit. Updating would have replaced its files without restarting it. On the server, find what holds the port (`ss -ltnp`), stop it there, run `npx selva start` from the deployment directory, then retry.",from:n,to:r};if(e===10||$(t,`DATA_FORMAT:`)){let e=Q(t,/reads data format (\d+),/),i=Q(t,/this deployment is on format (\d+)\./);return{severity:`warning`,title:`Update cancelled — ${r??`the target version`} cannot read this deployment's data. The app is untouched.`,detail:(e&&i?`It reads data format ${e}; this deployment is on format ${i}. `:``)+`Installing it would leave stored data, such as Compute API keys, unreadable. Switch the release channel back to stay on the installed version. To go back anyway, follow "Going back to an older release" in the admin guide.`,from:n,to:r}}if(e===8||$(t,`PM2_SKEW`)){let e=Q(t,/daemon \(v(\d+\.\d+\.\d+)\)/),i=Q(t,/deployment's pm2 \(v(\d+\.\d+\.\d+)\)/);return{severity:`warning`,title:e&&i?`Update cancelled — a global PM2 (v${e}) owns the daemon, not this deployment's (v${i}). The app is untouched.`:`Update cancelled — a conflicting global PM2 owns the daemon. The app is untouched.`,detail:"Resyncing would have downgraded the daemon and dropped its process table, so the update stopped before taking the app down. On the server: `which -a pm2`, `pm2 -v`, `pm2 ping` — remove or align the global pm2, then retry.",from:n,to:r}}if($(t,`SCHEMA_SKEW`)){let e=Q(t,/expects database migration head (\S+?),/),i=Q(t,/this database is at (\S+?)\./),a=e&&i?` The database is at ${i}; ${r??`it`} needs ${e}.`:``,o=Q(t,/@selvajs\/supabase-provider@([\w.-]+)/)??($(t,`channel: beta`)?`beta`:`latest`);return{severity:`warning`,title:`Update rolled back — the database migrations for ${r??`the new version`} have not been applied.${a} The app is online${n?` on ${n}`:``}.`,detail:`Nothing is wrong with the new version. Selva does not apply migrations during an update, because they cannot be rolled back — auto-migrating and then rolling the code back would leave the app and database on different heads. Apply them on the server, then re-run this update: \`npm install --prefer-online @selvajs/supabase-provider@${o}\`, then \`npx selva-supabase\`, then \`npx supabase db push\`. The provider install is not optional — the migration SQL ships inside that package, and the update only moves @selvajs/cli and @selvajs/selva, so a sync without it copies nothing and the push reports "up to date" having done nothing. Retrying without this will fail in exactly the same way.`,from:n,to:r}}if($(t,`AT_REST_SECRETS`))return{severity:`warning`,title:`Update rolled back — stored compute server keys do not decrypt under this host's SELVA_AT_REST_KEY. The app is online${n?` on ${n}`:``}.`,detail:`This is a configuration problem on the server, not a fault in the new version, so retrying alone will fail identically. Re-enter the affected keys at /admin/compute, or restore the SELVA_AT_REST_KEY the values were encrypted with, then re-run the update.`,from:n,to:r};if(e===5||$(t,`Rolled back`))return{severity:`warning`,title:`Update failed — safely rolled back${n?` to ${n}`:``}. The app is online.`,detail:`The new version failed its health check, so the previous version was restored and is serving normally. Review the log below for why the new version failed before retrying.`,from:n,to:r};if($(t,`ENGINE_MISMATCH`)||$(t,`EBADENGINE`)){let e=Q(t,/requires Node ([^\s]+(?:\s*[<>=]+\s*[\d.]+)*)/),i=Q(t,/this host runs v?(\d+\.\d+\.\d+)/);return{severity:`warning`,title:i?`Updated${r?` to ${r}`:``}, but this release needs Node ${e??`(newer)`} — the host runs v${i}. Expect runtime failures.`:`Updated${r?` to ${r}`:``}, but this release requires a newer Node than the host provides. Expect runtime failures.`,detail:`npm installed it anyway (engine-strict is off) and the health check passed, but it does not exercise the newer APIs — routes that do will throw at request time. Upgrade Node on the server, then re-run the update.`,from:n,to:r}}return $(t,`PM2_RESYNC_NEEDED`)?{severity:`warning`,title:`Updated${r?` to ${r}`:``}, but the pm2 daemon still runs the old pm2.`,detail:"The app is online. On the server, run `npx pm2 update` in the deployment directory, let it finish, then check `npx pm2 list` shows the app online.",from:n,to:r}:$(t,`PM2_PIN_FAILED`)?{severity:`warning`,title:`Updated${r?` to ${r}`:``}, but pm2 stayed on the previous version.`,detail:"The app is online on the old pm2. On the server, run `npx selva migrate` in the deployment directory to move it to the pinned version.",from:n,to:r}:$(t,`npm cache may be stale`)||$(t,`No version change`)?{severity:`warning`,title:`No version change — npm installed the same version.`,detail:"Your npm cache may be stale. On the server: `npm cache clean --force`, remove node_modules + package-lock.json, then `npm install --prefer-online`.",from:n,to:r}:e===0?$(t,`Already on the`)||$(t,`Nothing to do`)?{severity:`info`,title:`Already up to date${n?` (${n})`:``} — nothing to install.`,detail:`No changes were made and the app was not restarted.`,from:n,to:r}:n&&r&&n!==r?{severity:`success`,title:`Updated ${n} → ${r}. The app is back online.`,from:n,to:r}:r?{severity:`success`,title:`Update complete — now on ${r}. The app is back online.`,from:n,to:r}:{severity:`success`,title:`Update completed and the app is back online.`,from:n,to:r}:{severity:`critical`,title:`Update failed (exit code ${e}).`,detail:"The update did not complete cleanly. Review the log below, and check `npx selva logs` to confirm whether the app is currently online.",from:n,to:r}}var Tt=_(`<span title="Currently installed @selvajs/selva version"> </span>`),Et=_(`Update @selvajs/* to the latest <span class="font-medium"> </span> release and restart`,1),Dt=_(`<div class="flex items-start justify-between gap-3"><!> <!></div> <!>`,1),Ot=_(`<div class="border-warning/40 bg-warning/10 text-warning flex items-center gap-2 rounded-md border px-3 py-2 text-sm" role="status"><!> <span> <span class="font-mono"> </span> → <span class="font-mono"> </span></span></div>`),kt=_(`<p class="text-muted-foreground text-sm"> <span class="font-mono"> </span>).</p>`),At=_(`<div class="border-destructive/40 bg-destructive/10 text-destructive flex items-start gap-2 rounded-md border px-3 py-3 text-sm" role="alert"><!> <div class="space-y-1"><p class="font-medium">Update blocked — <span class="font-mono"> </span> cannot read this deployment's
2
2
  data</p> <p class="text-muted-foreground text-xs"> </p></div></div>`),jt=_(`<button type="button" class="text-muted-foreground hover:text-foreground text-xs underline underline-offset-2">Override anyway (advanced)</button>`),Mt=_(`<div class="space-y-2"><label class="text-muted-foreground block text-xs" for="node-override">Type <span class="text-foreground font-mono"> </span> to confirm you accept
3
3
  a deployment that may fail under real traffic:</label> <input id="node-override" class="border-input bg-background w-full rounded-md border px-2 py-1 font-mono text-xs" autocomplete="off" spellcheck="false"/></div>`),Nt=_(`<div class="border-destructive/40 bg-destructive/10 space-y-3 rounded-md border px-3 py-3 text-sm" role="alert"><div class="text-destructive flex items-start gap-2"><!> <div class="space-y-1"><p class="font-medium">Update blocked — this release needs a newer Node</p> <p class="text-muted-foreground text-xs"><span class="font-mono"> </span> requires Node <span class="font-mono"> </span>, but this host runs <span class="font-mono"> </span>. npm installs it anyway
4
4
  and the health check still passes, so a failed update would <span class="font-medium">not</span> roll back automatically. Upgrade Node on the server
@@ -0,0 +1 @@
1
+ export{t as component}from"../chunks/D84pURUQ.js";
@@ -0,0 +1 @@
1
+ ��export{t as component}from"../chunks/D84pURUQ.js";
@@ -1 +1 @@
1
- {"version":"1795258339633"}
1
+ {"version":"1795259991020"}
Binary file
Binary file
@@ -213,7 +213,7 @@ function server_data_serializer(event, state) {
213
213
  let promise_id = 1;
214
214
  let max_nodes = -1;
215
215
  const iterator = create_async_iterator();
216
- const global = "__sveltekit_ys109r";
216
+ const global = "__sveltekit_r3s33m";
217
217
  /** @param {number} index */
218
218
  function get_replacer(index) {
219
219
  /** @param {any} thing */
@@ -1443,7 +1443,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1443
1443
  "crossorigin"
1444
1444
  ]);
1445
1445
  }
1446
- const global = "__sveltekit_ys109r";
1446
+ const global = "__sveltekit_r3s33m";
1447
1447
  const { data, chunks } = data_serializer.get_data(csp);
1448
1448
  if (page_config.ssr && page_config.csr) body += `\n\t\t\t${fetched.map((item) => serialize_data(item, resolve_opts.filterSerializedResponseHeaders, !!(state.prerendering || state.prerender_default === true))).join("\n ")}`;
1449
1449
  if (page_config.csr && client) {
@@ -1467,7 +1467,7 @@ async function render_response({ branch, fetched, page_config, status, error = n
1467
1467
  }
1468
1468
  }
1469
1469
  const blocks = [];
1470
- const properties = [`base: ${base_expression}`, `version: ${s("1795258339633")}`];
1470
+ const properties = [`base: ${base_expression}`, `version: ${s("1795259991020")}`];
1471
1471
  if (assets) properties.push(`assets: ${s(assets)}`);
1472
1472
  if (client.uses_env_dynamic_public) properties.push(`env: ${load_env_eagerly ? "null" : uneval$1(rendered_env)}`);
1473
1473
  if (chunks) {
@@ -2363,7 +2363,7 @@ function redirect_response(status, location) {
2363
2363
  * @param {Response} response
2364
2364
  */
2365
2365
  function with_version_header(response) {
2366
- response.headers.set("x-sveltekit-version", "1795258339633");
2366
+ response.headers.set("x-sveltekit-version", "1795259991020");
2367
2367
  return response;
2368
2368
  }
2369
2369
  /**
@@ -1,6 +1,6 @@
1
1
  var package_default = {
2
2
  name: "@selvajs/selva",
3
- version: "4.21.0-beta.28",
3
+ version: "4.21.0-beta.29",
4
4
  description: "Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.",
5
5
  license: "MIT",
6
6
  author: "VektorNode",
@@ -1 +1 @@
1
- {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.28\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
1
+ {"version":3,"file":"package.js","names":[],"sources":["../../../package.json"],"sourcesContent":["{\n\t\"name\": \"@selvajs/selva\",\n\t\"version\": \"4.21.0-beta.29\",\n\t\"description\": \"Selva — self-contained Grasshopper-driven web app. Install, configure via .env, deploy.\",\n\t\"license\": \"MIT\",\n\t\"author\": \"VektorNode\",\n\t\"homepage\": \"https://selva.dev\",\n\t\"bugs\": \"https://github.com/VektorNode/selva/issues\",\n\t\"keywords\": [\n\t\t\"grasshopper\",\n\t\t\"rhino\",\n\t\t\"rhino-compute\",\n\t\t\"parametric-design\",\n\t\t\"web-app\",\n\t\t\"sveltekit\"\n\t],\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/VektorNode/selva.git\",\n\t\t\"directory\": \"packages/selva\"\n\t},\n\t\"type\": \"module\",\n\t\"main\": \"./build/index.js\",\n\t\"files\": [\n\t\t\"build\",\n\t\t\"templates\"\n\t],\n\t\"engines\": {\n\t\t\"node\": \">=24.0.0\"\n\t},\n\t\"selva\": {\n\t\t\"dataFormat\": 3\n\t},\n\t\"scripts\": {\n\t\t\"dev\": \"vite dev\",\n\t\t\"dev:lan\": \"vite dev --host\",\n\t\t\"build\": \"rimraf build && vite build && node ./scripts/generate-templates.js && node ./scripts/write-runtime-meta.js && node ./scripts/check-build-assets.js\",\n\t\t\"preview\": \"vite preview\",\n\t\t\"start\": \"node build/index.js\",\n\t\t\"clean\": \"rimraf build templates\",\n\t\t\"prepare\": \"svelte-kit sync || echo ''\",\n\t\t\"check\": \"svelte-kit sync && svelte-check --tsconfig ./tsconfig.json\",\n\t\t\"test\": \"vitest run\",\n\t\t\"test:watch\": \"vitest\",\n\t\t\"openapi:generate\": \"node scripts/generate-openapi.js\",\n\t\t\"test:e2e\": \"playwright test\",\n\t\t\"lint\": \"eslint .\",\n\t\t\"lint:types\": \"eslint . --config eslint.typed.config.js\",\n\t\t\"generate:cli-config\": \"node scripts/generate-cli-config.js\"\n\t},\n\t\"dependencies\": {\n\t\t\"@lucide/svelte\": \"catalog:\",\n\t\t\"@supabase/supabase-js\": \"catalog:\",\n\t\t\"@sveltejs/kit\": \"catalog:\",\n\t\t\"bits-ui\": \"catalog:\",\n\t\t\"clsx\": \"catalog:\",\n\t\t\"mode-watcher\": \"catalog:\",\n\t\t\"nodemailer\": \"catalog:\",\n\t\t\"pino\": \"^10.4.0\",\n\t\t\"playwright-core\": \"catalog:\",\n\t\t\"rhino3dm\": \"catalog:\",\n\t\t\"sharp\": \"catalog:\",\n\t\t\"tailwind-merge\": \"catalog:\",\n\t\t\"tailwind-variants\": \"catalog:\",\n\t\t\"three\": \"catalog:\",\n\t\t\"zod\": \"catalog:\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"@sentry/node\": \"^11.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@playwright/test\": \"catalog:\",\n\t\t\"@selvajs/compute\": \"workspace:*\",\n\t\t\"@selvajs/config\": \"workspace:*\",\n\t\t\"@selvajs/header-auth-provider\": \"workspace:*\",\n\t\t\"@selvajs/local-provider\": \"workspace:*\",\n\t\t\"@selvajs/mcp\": \"workspace:*\",\n\t\t\"@selvajs/notifications\": \"workspace:*\",\n\t\t\"@selvajs/platform\": \"workspace:*\",\n\t\t\"@selvajs/schemas\": \"workspace:*\",\n\t\t\"@selvajs/server\": \"workspace:*\",\n\t\t\"@selvajs/solve\": \"workspace:*\",\n\t\t\"@selvajs/supabase-provider\": \"workspace:*\",\n\t\t\"@selvajs/ui\": \"workspace:*\",\n\t\t\"@selvajs/visualization\": \"workspace:*\",\n\t\t\"@sveltejs/adapter-node\": \"catalog:\",\n\t\t\"@types/nodemailer\": \"catalog:\",\n\t\t\"@types/three\": \"catalog:\",\n\t\t\"rimraf\": \"catalog:\",\n\t\t\"tw-animate-css\": \"catalog:\",\n\t\t\"vitest\": \"catalog:\"\n\t},\n\t\"imports\": {\n\t\t\"#lib/*\": \"./src/lib/*\"\n\t}\n}\n"],"mappings":""}
@@ -71,6 +71,13 @@ function deriveOutcome(exitCode, logs) {
71
71
  to
72
72
  };
73
73
  }
74
+ if (exitCode === 13 || has(logs, "NOT_DOWNLOADABLE")) return {
75
+ severity: "warning",
76
+ title: `Update cancelled — npm does not serve ${to ?? "the new version"} yet. The app is untouched.`,
77
+ detail: "A release just published is listed on npm a few minutes before its files can be downloaded. Nothing was stopped or installed. Retry the update in a few minutes.",
78
+ from,
79
+ to
80
+ };
74
81
  if (exitCode === 12 || has(logs, "NOT_STOPPED")) return {
75
82
  severity: "warning",
76
83
  title: "Update cancelled — the app kept answering after PM2 stopped it. Nothing was installed.",
@@ -1 +1 @@
1
- {"version":3,"file":"update-outcome.js","names":[],"sources":["../../../src/lib/update-outcome.ts"],"sourcesContent":["// ============================================================================\n// Update-outcome derivation\n// ============================================================================\n//\n// The update runner (admin/api/system/update/+server.ts) emits structured log\n// lines and a small set of meaningful exit codes; `deriveOutcome` turns those\n// into a severity an operator can act on without reading the log. Ranking:\n// anything that leaves the app DOWN is `critical`; a safe rollback is\n// `warning`, not an error, because the site is still serving.\n\nexport type OutcomeSeverity = 'success' | 'info' | 'warning' | 'critical' | 'pending';\n\n/**\n * Synthetic exit code for a run that never reported one — the SSE handler's\n * 15-minute group-kill, or the reconciler giving up on a missing [EXIT] marker.\n * Outside the 0-255 range a real process can produce, so it can't collide.\n */\nexport const TIMED_OUT = -2;\n\nexport interface UpdateOutcome {\n\tseverity: OutcomeSeverity;\n\t/** Must be unambiguous about app up/down state. */\n\ttitle: string;\n\t/** What to do next when something is off. */\n\tdetail?: string;\n\tfrom?: string;\n\tto?: string;\n}\n\nfunction firstMatch(logs: string, re: RegExp): string | undefined {\n\tconst m = re.exec(logs);\n\treturn m ? m[1] : undefined;\n}\n\nfunction parseVersions(logs: string): { from?: string; to?: string } {\n\t// Pre-flight transition line, printed before npm runs — the only source of a\n\t// target version when the update fails early or is a no-op, e.g.\n\t// \"[INFO] Target (beta): 4.2.0 → 4.2.1-beta.1\". `Available:` is the\n\t// pre-channel spelling, kept so logs from an older runner still parse.\n\tconst version = String.raw`\\d+\\.\\d+\\.\\d+[^\\s]*`;\n\tconst transition = new RegExp(\n\t\tString.raw`(?:Target \\([^)]*\\)|Available):\\s*(${version})\\s*(?:→|->)\\s*(${version})`\n\t);\n\tconst arrow = transition.exec(logs);\n\n\t// The post-install lines are authoritative for what actually landed — prefer\n\t// them over the pre-flight target, which is only ever an intent.\n\tconst from = firstMatch(logs, /Current @selvajs\\/selva:\\s*v?(\\d+\\.\\d+\\.\\d+[^\\s]*)/) ?? arrow?.[1];\n\tconst to = firstMatch(logs, /New @selvajs\\/selva:\\s*v?(\\d+\\.\\d+\\.\\d+[^\\s]*)/) ?? arrow?.[2];\n\treturn { from, to };\n}\n\nfunction has(logs: string, needle: string): boolean {\n\treturn logs.includes(needle);\n}\n\nexport function deriveOutcome(exitCode: number | null, logs: string): UpdateOutcome {\n\tconst { from, to } = parseVersions(logs);\n\n\tif (exitCode === null) {\n\t\treturn { severity: 'pending', title: 'Update in progress…' };\n\t}\n\n\t// --- Critical: app is or may be DOWN. Rank these first. -------------------\n\tif (\n\t\texitCode === 6 ||\n\t\thas(logs, 'Manual recovery required') ||\n\t\thas(logs, 'manual intervention required')\n\t) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update failed AND rollback failed — the app may be OFFLINE',\n\t\t\tdetail:\n\t\t\t\t'Both the new version and the rollback failed their health check. ' +\n\t\t\t\t'SSH into the server and run: `npx selva logs`, then ' +\n\t\t\t\t'`pm2 start ecosystem.config.cjs` from the deployment directory.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// The SSE handler's 15-minute group-kill, and the reconciler's own poll cap.\n\t// Neither is an exit code the runner chose, so they carry no [EXIT] marker.\n\tif (exitCode === TIMED_OUT) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'App did not come back online within 15 minutes',\n\t\t\tdetail:\n\t\t\t\t'The update may still be finishing in the background, or the new ' +\n\t\t\t\t'process is crash-looping. Check `npx selva logs`. Do not ' +\n\t\t\t\t're-run the update until you have confirmed the current state.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Exit 4: the rollback's own npm install failed, so node_modules is\n\t// half-written and the EXIT trap's restart is the only thing that may have\n\t// brought the app back. Same urgency as a failed rollback restart.\n\tif (exitCode === 4) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update failed and the rollback could not reinstall — the app may be OFFLINE',\n\t\t\tdetail:\n\t\t\t\t'The previous version could not be restored from npm. SSH into the ' +\n\t\t\t\t'server and run `npx selva logs`; if the app is down, reinstall ' +\n\t\t\t\t'explicitly with `npm install --prefer-online @selvajs/cli@<version> ' +\n\t\t\t\t'@selvajs/selva@<version>` from the deployment directory.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Exit 3: unhealthy with no recorded prior version, so no rollback was even\n\t// attempted. The EXIT trap tried to restart whatever is on disk.\n\tif (exitCode === 3) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update failed its health check and could not be rolled back automatically',\n\t\t\tdetail:\n\t\t\t\t'No prior version was recorded, so the previous build could not be ' +\n\t\t\t\t'restored. Check `npx selva logs` to confirm whether the app ' +\n\t\t\t\t'came back online.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// Killed mid-run (128+signal). Nothing was installed, and whether the app\n\t// came back depends on how far the EXIT trap got before it died too. Rank\n\t// with the criticals: an unattended half-update is worse than a clean\n\t// failure.\n\tif (exitCode === 143 || exitCode === 130 || exitCode === 129 || has(logs, 'KILLED')) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update was killed before it finished — nothing was installed',\n\t\t\tdetail:\n\t\t\t\t'The runner was terminated mid-update, most often by a systemd-supervised ' +\n\t\t\t\t'PM2 restarting its whole control group. The version on disk is unchanged. ' +\n\t\t\t\t'Check `npx selva logs` and confirm the app is online before retrying; ' +\n\t\t\t\t'if a global pm2 owns the daemon, reconcile that first.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// --- Warning: update did not fully succeed, but the app IS up. ------------\n\t// Aborted at the systemd guard, before `pm2 update` could recycle the\n\t// daemon and take this runner down with it.\n\tif (exitCode === 9 || has(logs, 'SYSTEMD_PM2')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle:\n\t\t\t\t'Update cancelled — PM2 needs a resync that only a shell can do safely. The app is untouched.',\n\t\t\tdetail:\n\t\t\t\t\"This deployment's PM2 runs under systemd, where `pm2 update` restarts the \" +\n\t\t\t\t'unit and kills the update mid-run. Nothing was installed and the app is ' +\n\t\t\t\t'still serving. SSH in and run `./node_modules/.bin/pm2 update` from the ' +\n\t\t\t\t'deployment directory, then retry the update here.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted at the ownership check, before anything was stopped: pm2's app of this\n\t// name belongs to another install on the same machine.\n\tif (exitCode === 11 || has(logs, 'PM2_NAME_TAKEN')) {\n\t\tconst owner = firstMatch(logs, /PM2_NAME_TAKEN: pm2's '[^']*' runs from (\\S+),/);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update cancelled — another Selva install${owner ? ` (${owner})` : ''} uses this install's PM2 app name. The app is untouched.`,\n\t\t\tdetail:\n\t\t\t\t'PM2 finds an app by name, so this update would have stopped the other install ' +\n\t\t\t\t'and left this one running on replaced files. Nothing was installed. On the ' +\n\t\t\t\t'server, give this install its own `name` in its ecosystem.config.cjs, run ' +\n\t\t\t\t'`npx selva start` from its directory, then retry the update here.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted after the stop, before npm ran: something still answered this\n\t// install's port, so the update could not have replaced it.\n\tif (exitCode === 12 || has(logs, 'NOT_STOPPED')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle:\n\t\t\t\t'Update cancelled — the app kept answering after PM2 stopped it. Nothing was installed.',\n\t\t\tdetail:\n\t\t\t\t\"Either this install's PM2 does not run the process that is serving (another \" +\n\t\t\t\t'PM2 daemon, a systemd unit or a shell started it), or it did not exit. Updating ' +\n\t\t\t\t'would have replaced its files without restarting it. On the server, find what ' +\n\t\t\t\t'holds the port (`ss -ltnp`), stop it there, run `npx selva start` from the ' +\n\t\t\t\t'deployment directory, then retry.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted at the data format check, before anything was stopped.\n\tif (exitCode === 10 || has(logs, 'DATA_FORMAT:')) {\n\t\tconst target = firstMatch(logs, /reads data format (\\d+),/);\n\t\tconst installed = firstMatch(logs, /this deployment is on format (\\d+)\\./);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update cancelled — ${to ?? 'the target version'} cannot read this deployment's data. The app is untouched.`,\n\t\t\tdetail:\n\t\t\t\t(target && installed\n\t\t\t\t\t? `It reads data format ${target}; this deployment is on format ${installed}. `\n\t\t\t\t\t: '') +\n\t\t\t\t'Installing it would leave stored data, such as Compute API keys, unreadable. ' +\n\t\t\t\t'Switch the release channel back to stay on the installed version. To go back ' +\n\t\t\t\t'anyway, follow \"Going back to an older release\" in the admin guide.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted at the pm2 skew check, before anything was stopped — nothing was\n\t// installed and the app never went down.\n\tif (exitCode === 8 || has(logs, 'PM2_SKEW')) {\n\t\tconst daemon = firstMatch(logs, /daemon \\(v(\\d+\\.\\d+\\.\\d+)\\)/);\n\t\tconst local = firstMatch(logs, /deployment's pm2 \\(v(\\d+\\.\\d+\\.\\d+)\\)/);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle:\n\t\t\t\tdaemon && local\n\t\t\t\t\t? `Update cancelled — a global PM2 (v${daemon}) owns the daemon, not this deployment's (v${local}). The app is untouched.`\n\t\t\t\t\t: 'Update cancelled — a conflicting global PM2 owns the daemon. The app is untouched.',\n\t\t\tdetail:\n\t\t\t\t'Resyncing would have downgraded the daemon and dropped its process ' +\n\t\t\t\t'table, so the update stopped before taking the app down. On the server: ' +\n\t\t\t\t'`which -a pm2`, `pm2 -v`, `pm2 ping` — remove or align the global pm2, then retry.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// A rollback whose cause is the DATABASE, not the release. Ranked ahead of\n\t// the generic rollback case: \"review the log before retrying\" is actively\n\t// misleading here, because the log holds nothing about the new version —\n\t// it is fine, and retrying without touching the database repeats verbatim.\n\tif (has(logs, 'SCHEMA_SKEW')) {\n\t\tconst expected = firstMatch(logs, /expects database migration head (\\S+?),/);\n\t\tconst actual = firstMatch(logs, /this database is at (\\S+?)\\./);\n\t\tconst skew =\n\t\t\texpected && actual ? ` The database is at ${actual}; ${to ?? 'it'} needs ${expected}.` : '';\n\t\t// `latest` is the stable line, which ships none of a beta's migrations.\n\t\tconst providerTag =\n\t\t\tfirstMatch(logs, /@selvajs\\/supabase-provider@([\\w.-]+)/) ??\n\t\t\t(has(logs, 'channel: beta') ? 'beta' : 'latest');\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update rolled back — the database migrations for ${to ?? 'the new version'} have not been applied.${skew} The app is online${from ? ` on ${from}` : ''}.`,\n\t\t\tdetail:\n\t\t\t\t'Nothing is wrong with the new version. Selva does not apply migrations ' +\n\t\t\t\t'during an update, because they cannot be rolled back — auto-migrating ' +\n\t\t\t\t'and then rolling the code back would leave the app and database on ' +\n\t\t\t\t'different heads. Apply them on the server, then re-run this update: ' +\n\t\t\t\t`\\`npm install --prefer-online @selvajs/supabase-provider@${providerTag}\\`, then ` +\n\t\t\t\t'`npx selva-supabase`, then `npx supabase db push`. The provider install ' +\n\t\t\t\t'is not optional — the migration SQL ships inside that package, and the ' +\n\t\t\t\t'update only moves @selvajs/cli and @selvajs/selva, so a sync without it ' +\n\t\t\t\t'copies nothing and the push reports \"up to date\" having done nothing. ' +\n\t\t\t\t'Retrying without this will fail in exactly the same way.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Same shape: the rollback was caused by host configuration, not the release.\n\tif (has(logs, 'AT_REST_SECRETS')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update rolled back — stored compute server keys do not decrypt under this host's SELVA_AT_REST_KEY. The app is online${from ? ` on ${from}` : ''}.`,\n\t\t\tdetail:\n\t\t\t\t'This is a configuration problem on the server, not a fault in the new ' +\n\t\t\t\t'version, so retrying alone will fail identically. Re-enter the affected ' +\n\t\t\t\t'keys at /admin/compute, or restore the SELVA_AT_REST_KEY the values were ' +\n\t\t\t\t'encrypted with, then re-run the update.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\tif (exitCode === 5 || has(logs, 'Rolled back')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update failed — safely rolled back${from ? ` to ${from}` : ''}. The app is online.`,\n\t\t\tdetail:\n\t\t\t\t'The new version failed its health check, so the previous version ' +\n\t\t\t\t'was restored and is serving normally. Review the log below for why ' +\n\t\t\t\t'the new version failed before retrying.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// The install completed and the app is up, but on a Node the release doesn't\n\t// support. The health probe passes (it exercises nothing version-specific),\n\t// so this would otherwise read as a clean success right up until a real\n\t// request hits a newer API and throws (issue #176).\n\tif (has(logs, 'ENGINE_MISMATCH') || has(logs, 'EBADENGINE')) {\n\t\tconst required = firstMatch(logs, /requires Node ([^\\s]+(?:\\s*[<>=]+\\s*[\\d.]+)*)/);\n\t\tconst running = firstMatch(logs, /this host runs v?(\\d+\\.\\d+\\.\\d+)/);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: running\n\t\t\t\t? `Updated${to ? ` to ${to}` : ''}, but this release needs Node ${required ?? '(newer)'} — the host runs v${running}. Expect runtime failures.`\n\t\t\t\t: `Updated${to ? ` to ${to}` : ''}, but this release requires a newer Node than the host provides. Expect runtime failures.`,\n\t\t\tdetail:\n\t\t\t\t'npm installed it anyway (engine-strict is off) and the health check ' +\n\t\t\t\t'passed, but it does not exercise the newer APIs — routes that do will ' +\n\t\t\t\t'throw at request time. Upgrade Node on the server, then re-run the update.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// The runner moved pm2 to the release's pin but could not swap the daemon\n\t// (refused under systemd, or `pm2 update` failed). The app runs; the next\n\t// pm2 command warns about the skew until someone runs the swap by hand.\n\tif (has(logs, 'PM2_RESYNC_NEEDED')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Updated${to ? ` to ${to}` : ''}, but the pm2 daemon still runs the old pm2.`,\n\t\t\tdetail:\n\t\t\t\t'The app is online. On the server, run `npx pm2 update` in the deployment ' +\n\t\t\t\t'directory, let it finish, then check `npx pm2 list` shows the app online.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\tif (has(logs, 'PM2_PIN_FAILED')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Updated${to ? ` to ${to}` : ''}, but pm2 stayed on the previous version.`,\n\t\t\tdetail:\n\t\t\t\t'The app is online on the old pm2. On the server, run `npx selva migrate` in ' +\n\t\t\t\t'the deployment directory to move it to the pinned version.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\tif (has(logs, 'npm cache may be stale') || has(logs, 'No version change')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: 'No version change — npm installed the same version.',\n\t\t\tdetail:\n\t\t\t\t'Your npm cache may be stale. On the server: `npm cache clean --force`, ' +\n\t\t\t\t'remove node_modules + package-lock.json, then `npm install --prefer-online`.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// --- Success variants -----------------------------------------------------\n\tif (exitCode === 0) {\n\t\t// \"Already on the 'beta' channel version (4.2.0)\" — the channel name is\n\t\t// interpolated, so match the stable prefix rather than a whole line.\n\t\tif (has(logs, 'Already on the') || has(logs, 'Nothing to do')) {\n\t\t\treturn {\n\t\t\t\tseverity: 'info',\n\t\t\t\ttitle: `Already up to date${from ? ` (${from})` : ''} — nothing to install.`,\n\t\t\t\tdetail: 'No changes were made and the app was not restarted.',\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t};\n\t\t}\n\t\tif (from && to && from !== to) {\n\t\t\treturn {\n\t\t\t\tseverity: 'success',\n\t\t\t\ttitle: `Updated ${from} → ${to}. The app is back online.`,\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t};\n\t\t}\n\t\tif (to) {\n\t\t\treturn {\n\t\t\t\tseverity: 'success',\n\t\t\t\ttitle: `Update complete — now on ${to}. The app is back online.`,\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tseverity: 'success',\n\t\t\ttitle: 'Update completed and the app is back online.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// --- Anything else: a non-zero exit we don't have a named case for. -------\n\t// Be explicit that we couldn't classify it rather than implying success.\n\treturn {\n\t\tseverity: 'critical',\n\t\ttitle: `Update failed (exit code ${exitCode}).`,\n\t\tdetail:\n\t\t\t'The update did not complete cleanly. Review the log below, and check ' +\n\t\t\t'`npx selva logs` to confirm whether the app is currently online.',\n\t\tfrom,\n\t\tto\n\t};\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"update-outcome.js","names":[],"sources":["../../../src/lib/update-outcome.ts"],"sourcesContent":["// ============================================================================\n// Update-outcome derivation\n// ============================================================================\n//\n// The update runner (admin/api/system/update/+server.ts) emits structured log\n// lines and a small set of meaningful exit codes; `deriveOutcome` turns those\n// into a severity an operator can act on without reading the log. Ranking:\n// anything that leaves the app DOWN is `critical`; a safe rollback is\n// `warning`, not an error, because the site is still serving.\n\nexport type OutcomeSeverity = 'success' | 'info' | 'warning' | 'critical' | 'pending';\n\n/**\n * Synthetic exit code for a run that never reported one — the SSE handler's\n * 15-minute group-kill, or the reconciler giving up on a missing [EXIT] marker.\n * Outside the 0-255 range a real process can produce, so it can't collide.\n */\nexport const TIMED_OUT = -2;\n\nexport interface UpdateOutcome {\n\tseverity: OutcomeSeverity;\n\t/** Must be unambiguous about app up/down state. */\n\ttitle: string;\n\t/** What to do next when something is off. */\n\tdetail?: string;\n\tfrom?: string;\n\tto?: string;\n}\n\nfunction firstMatch(logs: string, re: RegExp): string | undefined {\n\tconst m = re.exec(logs);\n\treturn m ? m[1] : undefined;\n}\n\nfunction parseVersions(logs: string): { from?: string; to?: string } {\n\t// Pre-flight transition line, printed before npm runs — the only source of a\n\t// target version when the update fails early or is a no-op, e.g.\n\t// \"[INFO] Target (beta): 4.2.0 → 4.2.1-beta.1\". `Available:` is the\n\t// pre-channel spelling, kept so logs from an older runner still parse.\n\tconst version = String.raw`\\d+\\.\\d+\\.\\d+[^\\s]*`;\n\tconst transition = new RegExp(\n\t\tString.raw`(?:Target \\([^)]*\\)|Available):\\s*(${version})\\s*(?:→|->)\\s*(${version})`\n\t);\n\tconst arrow = transition.exec(logs);\n\n\t// The post-install lines are authoritative for what actually landed — prefer\n\t// them over the pre-flight target, which is only ever an intent.\n\tconst from = firstMatch(logs, /Current @selvajs\\/selva:\\s*v?(\\d+\\.\\d+\\.\\d+[^\\s]*)/) ?? arrow?.[1];\n\tconst to = firstMatch(logs, /New @selvajs\\/selva:\\s*v?(\\d+\\.\\d+\\.\\d+[^\\s]*)/) ?? arrow?.[2];\n\treturn { from, to };\n}\n\nfunction has(logs: string, needle: string): boolean {\n\treturn logs.includes(needle);\n}\n\nexport function deriveOutcome(exitCode: number | null, logs: string): UpdateOutcome {\n\tconst { from, to } = parseVersions(logs);\n\n\tif (exitCode === null) {\n\t\treturn { severity: 'pending', title: 'Update in progress…' };\n\t}\n\n\t// --- Critical: app is or may be DOWN. Rank these first. -------------------\n\tif (\n\t\texitCode === 6 ||\n\t\thas(logs, 'Manual recovery required') ||\n\t\thas(logs, 'manual intervention required')\n\t) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update failed AND rollback failed — the app may be OFFLINE',\n\t\t\tdetail:\n\t\t\t\t'Both the new version and the rollback failed their health check. ' +\n\t\t\t\t'SSH into the server and run: `npx selva logs`, then ' +\n\t\t\t\t'`pm2 start ecosystem.config.cjs` from the deployment directory.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// The SSE handler's 15-minute group-kill, and the reconciler's own poll cap.\n\t// Neither is an exit code the runner chose, so they carry no [EXIT] marker.\n\tif (exitCode === TIMED_OUT) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'App did not come back online within 15 minutes',\n\t\t\tdetail:\n\t\t\t\t'The update may still be finishing in the background, or the new ' +\n\t\t\t\t'process is crash-looping. Check `npx selva logs`. Do not ' +\n\t\t\t\t're-run the update until you have confirmed the current state.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Exit 4: the rollback's own npm install failed, so node_modules is\n\t// half-written and the EXIT trap's restart is the only thing that may have\n\t// brought the app back. Same urgency as a failed rollback restart.\n\tif (exitCode === 4) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update failed and the rollback could not reinstall — the app may be OFFLINE',\n\t\t\tdetail:\n\t\t\t\t'The previous version could not be restored from npm. SSH into the ' +\n\t\t\t\t'server and run `npx selva logs`; if the app is down, reinstall ' +\n\t\t\t\t'explicitly with `npm install --prefer-online @selvajs/cli@<version> ' +\n\t\t\t\t'@selvajs/selva@<version>` from the deployment directory.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Exit 3: unhealthy with no recorded prior version, so no rollback was even\n\t// attempted. The EXIT trap tried to restart whatever is on disk.\n\tif (exitCode === 3) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update failed its health check and could not be rolled back automatically',\n\t\t\tdetail:\n\t\t\t\t'No prior version was recorded, so the previous build could not be ' +\n\t\t\t\t'restored. Check `npx selva logs` to confirm whether the app ' +\n\t\t\t\t'came back online.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// Killed mid-run (128+signal). Nothing was installed, and whether the app\n\t// came back depends on how far the EXIT trap got before it died too. Rank\n\t// with the criticals: an unattended half-update is worse than a clean\n\t// failure.\n\tif (exitCode === 143 || exitCode === 130 || exitCode === 129 || has(logs, 'KILLED')) {\n\t\treturn {\n\t\t\tseverity: 'critical',\n\t\t\ttitle: 'Update was killed before it finished — nothing was installed',\n\t\t\tdetail:\n\t\t\t\t'The runner was terminated mid-update, most often by a systemd-supervised ' +\n\t\t\t\t'PM2 restarting its whole control group. The version on disk is unchanged. ' +\n\t\t\t\t'Check `npx selva logs` and confirm the app is online before retrying; ' +\n\t\t\t\t'if a global pm2 owns the daemon, reconcile that first.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// --- Warning: update did not fully succeed, but the app IS up. ------------\n\t// Aborted at the systemd guard, before `pm2 update` could recycle the\n\t// daemon and take this runner down with it.\n\tif (exitCode === 9 || has(logs, 'SYSTEMD_PM2')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle:\n\t\t\t\t'Update cancelled — PM2 needs a resync that only a shell can do safely. The app is untouched.',\n\t\t\tdetail:\n\t\t\t\t\"This deployment's PM2 runs under systemd, where `pm2 update` restarts the \" +\n\t\t\t\t'unit and kills the update mid-run. Nothing was installed and the app is ' +\n\t\t\t\t'still serving. SSH in and run `./node_modules/.bin/pm2 update` from the ' +\n\t\t\t\t'deployment directory, then retry the update here.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted at the ownership check, before anything was stopped: pm2's app of this\n\t// name belongs to another install on the same machine.\n\tif (exitCode === 11 || has(logs, 'PM2_NAME_TAKEN')) {\n\t\tconst owner = firstMatch(logs, /PM2_NAME_TAKEN: pm2's '[^']*' runs from (\\S+),/);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update cancelled — another Selva install${owner ? ` (${owner})` : ''} uses this install's PM2 app name. The app is untouched.`,\n\t\t\tdetail:\n\t\t\t\t'PM2 finds an app by name, so this update would have stopped the other install ' +\n\t\t\t\t'and left this one running on replaced files. Nothing was installed. On the ' +\n\t\t\t\t'server, give this install its own `name` in its ecosystem.config.cjs, run ' +\n\t\t\t\t'`npx selva start` from its directory, then retry the update here.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted before the stop: npm listed the release but never served its tarball.\n\tif (exitCode === 13 || has(logs, 'NOT_DOWNLOADABLE')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update cancelled — npm does not serve ${to ?? 'the new version'} yet. The app is untouched.`,\n\t\t\tdetail:\n\t\t\t\t'A release just published is listed on npm a few minutes before its files can be ' +\n\t\t\t\t'downloaded. Nothing was stopped or installed. Retry the update in a few minutes.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted after the stop, before npm ran: something still answered this\n\t// install's port, so the update could not have replaced it.\n\tif (exitCode === 12 || has(logs, 'NOT_STOPPED')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle:\n\t\t\t\t'Update cancelled — the app kept answering after PM2 stopped it. Nothing was installed.',\n\t\t\tdetail:\n\t\t\t\t\"Either this install's PM2 does not run the process that is serving (another \" +\n\t\t\t\t'PM2 daemon, a systemd unit or a shell started it), or it did not exit. Updating ' +\n\t\t\t\t'would have replaced its files without restarting it. On the server, find what ' +\n\t\t\t\t'holds the port (`ss -ltnp`), stop it there, run `npx selva start` from the ' +\n\t\t\t\t'deployment directory, then retry.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted at the data format check, before anything was stopped.\n\tif (exitCode === 10 || has(logs, 'DATA_FORMAT:')) {\n\t\tconst target = firstMatch(logs, /reads data format (\\d+),/);\n\t\tconst installed = firstMatch(logs, /this deployment is on format (\\d+)\\./);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update cancelled — ${to ?? 'the target version'} cannot read this deployment's data. The app is untouched.`,\n\t\t\tdetail:\n\t\t\t\t(target && installed\n\t\t\t\t\t? `It reads data format ${target}; this deployment is on format ${installed}. `\n\t\t\t\t\t: '') +\n\t\t\t\t'Installing it would leave stored data, such as Compute API keys, unreadable. ' +\n\t\t\t\t'Switch the release channel back to stay on the installed version. To go back ' +\n\t\t\t\t'anyway, follow \"Going back to an older release\" in the admin guide.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Aborted at the pm2 skew check, before anything was stopped — nothing was\n\t// installed and the app never went down.\n\tif (exitCode === 8 || has(logs, 'PM2_SKEW')) {\n\t\tconst daemon = firstMatch(logs, /daemon \\(v(\\d+\\.\\d+\\.\\d+)\\)/);\n\t\tconst local = firstMatch(logs, /deployment's pm2 \\(v(\\d+\\.\\d+\\.\\d+)\\)/);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle:\n\t\t\t\tdaemon && local\n\t\t\t\t\t? `Update cancelled — a global PM2 (v${daemon}) owns the daemon, not this deployment's (v${local}). The app is untouched.`\n\t\t\t\t\t: 'Update cancelled — a conflicting global PM2 owns the daemon. The app is untouched.',\n\t\t\tdetail:\n\t\t\t\t'Resyncing would have downgraded the daemon and dropped its process ' +\n\t\t\t\t'table, so the update stopped before taking the app down. On the server: ' +\n\t\t\t\t'`which -a pm2`, `pm2 -v`, `pm2 ping` — remove or align the global pm2, then retry.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// A rollback whose cause is the DATABASE, not the release. Ranked ahead of\n\t// the generic rollback case: \"review the log before retrying\" is actively\n\t// misleading here, because the log holds nothing about the new version —\n\t// it is fine, and retrying without touching the database repeats verbatim.\n\tif (has(logs, 'SCHEMA_SKEW')) {\n\t\tconst expected = firstMatch(logs, /expects database migration head (\\S+?),/);\n\t\tconst actual = firstMatch(logs, /this database is at (\\S+?)\\./);\n\t\tconst skew =\n\t\t\texpected && actual ? ` The database is at ${actual}; ${to ?? 'it'} needs ${expected}.` : '';\n\t\t// `latest` is the stable line, which ships none of a beta's migrations.\n\t\tconst providerTag =\n\t\t\tfirstMatch(logs, /@selvajs\\/supabase-provider@([\\w.-]+)/) ??\n\t\t\t(has(logs, 'channel: beta') ? 'beta' : 'latest');\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update rolled back — the database migrations for ${to ?? 'the new version'} have not been applied.${skew} The app is online${from ? ` on ${from}` : ''}.`,\n\t\t\tdetail:\n\t\t\t\t'Nothing is wrong with the new version. Selva does not apply migrations ' +\n\t\t\t\t'during an update, because they cannot be rolled back — auto-migrating ' +\n\t\t\t\t'and then rolling the code back would leave the app and database on ' +\n\t\t\t\t'different heads. Apply them on the server, then re-run this update: ' +\n\t\t\t\t`\\`npm install --prefer-online @selvajs/supabase-provider@${providerTag}\\`, then ` +\n\t\t\t\t'`npx selva-supabase`, then `npx supabase db push`. The provider install ' +\n\t\t\t\t'is not optional — the migration SQL ships inside that package, and the ' +\n\t\t\t\t'update only moves @selvajs/cli and @selvajs/selva, so a sync without it ' +\n\t\t\t\t'copies nothing and the push reports \"up to date\" having done nothing. ' +\n\t\t\t\t'Retrying without this will fail in exactly the same way.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// Same shape: the rollback was caused by host configuration, not the release.\n\tif (has(logs, 'AT_REST_SECRETS')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update rolled back — stored compute server keys do not decrypt under this host's SELVA_AT_REST_KEY. The app is online${from ? ` on ${from}` : ''}.`,\n\t\t\tdetail:\n\t\t\t\t'This is a configuration problem on the server, not a fault in the new ' +\n\t\t\t\t'version, so retrying alone will fail identically. Re-enter the affected ' +\n\t\t\t\t'keys at /admin/compute, or restore the SELVA_AT_REST_KEY the values were ' +\n\t\t\t\t'encrypted with, then re-run the update.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\tif (exitCode === 5 || has(logs, 'Rolled back')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Update failed — safely rolled back${from ? ` to ${from}` : ''}. The app is online.`,\n\t\t\tdetail:\n\t\t\t\t'The new version failed its health check, so the previous version ' +\n\t\t\t\t'was restored and is serving normally. Review the log below for why ' +\n\t\t\t\t'the new version failed before retrying.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// The install completed and the app is up, but on a Node the release doesn't\n\t// support. The health probe passes (it exercises nothing version-specific),\n\t// so this would otherwise read as a clean success right up until a real\n\t// request hits a newer API and throws (issue #176).\n\tif (has(logs, 'ENGINE_MISMATCH') || has(logs, 'EBADENGINE')) {\n\t\tconst required = firstMatch(logs, /requires Node ([^\\s]+(?:\\s*[<>=]+\\s*[\\d.]+)*)/);\n\t\tconst running = firstMatch(logs, /this host runs v?(\\d+\\.\\d+\\.\\d+)/);\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: running\n\t\t\t\t? `Updated${to ? ` to ${to}` : ''}, but this release needs Node ${required ?? '(newer)'} — the host runs v${running}. Expect runtime failures.`\n\t\t\t\t: `Updated${to ? ` to ${to}` : ''}, but this release requires a newer Node than the host provides. Expect runtime failures.`,\n\t\t\tdetail:\n\t\t\t\t'npm installed it anyway (engine-strict is off) and the health check ' +\n\t\t\t\t'passed, but it does not exercise the newer APIs — routes that do will ' +\n\t\t\t\t'throw at request time. Upgrade Node on the server, then re-run the update.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\t// The runner moved pm2 to the release's pin but could not swap the daemon\n\t// (refused under systemd, or `pm2 update` failed). The app runs; the next\n\t// pm2 command warns about the skew until someone runs the swap by hand.\n\tif (has(logs, 'PM2_RESYNC_NEEDED')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Updated${to ? ` to ${to}` : ''}, but the pm2 daemon still runs the old pm2.`,\n\t\t\tdetail:\n\t\t\t\t'The app is online. On the server, run `npx pm2 update` in the deployment ' +\n\t\t\t\t'directory, let it finish, then check `npx pm2 list` shows the app online.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\tif (has(logs, 'PM2_PIN_FAILED')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: `Updated${to ? ` to ${to}` : ''}, but pm2 stayed on the previous version.`,\n\t\t\tdetail:\n\t\t\t\t'The app is online on the old pm2. On the server, run `npx selva migrate` in ' +\n\t\t\t\t'the deployment directory to move it to the pinned version.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\tif (has(logs, 'npm cache may be stale') || has(logs, 'No version change')) {\n\t\treturn {\n\t\t\tseverity: 'warning',\n\t\t\ttitle: 'No version change — npm installed the same version.',\n\t\t\tdetail:\n\t\t\t\t'Your npm cache may be stale. On the server: `npm cache clean --force`, ' +\n\t\t\t\t'remove node_modules + package-lock.json, then `npm install --prefer-online`.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// --- Success variants -----------------------------------------------------\n\tif (exitCode === 0) {\n\t\t// \"Already on the 'beta' channel version (4.2.0)\" — the channel name is\n\t\t// interpolated, so match the stable prefix rather than a whole line.\n\t\tif (has(logs, 'Already on the') || has(logs, 'Nothing to do')) {\n\t\t\treturn {\n\t\t\t\tseverity: 'info',\n\t\t\t\ttitle: `Already up to date${from ? ` (${from})` : ''} — nothing to install.`,\n\t\t\t\tdetail: 'No changes were made and the app was not restarted.',\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t};\n\t\t}\n\t\tif (from && to && from !== to) {\n\t\t\treturn {\n\t\t\t\tseverity: 'success',\n\t\t\t\ttitle: `Updated ${from} → ${to}. The app is back online.`,\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t};\n\t\t}\n\t\tif (to) {\n\t\t\treturn {\n\t\t\t\tseverity: 'success',\n\t\t\t\ttitle: `Update complete — now on ${to}. The app is back online.`,\n\t\t\t\tfrom,\n\t\t\t\tto\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\tseverity: 'success',\n\t\t\ttitle: 'Update completed and the app is back online.',\n\t\t\tfrom,\n\t\t\tto\n\t\t};\n\t}\n\n\t// --- Anything else: a non-zero exit we don't have a named case for. -------\n\t// Be explicit that we couldn't classify it rather than implying success.\n\treturn {\n\t\tseverity: 'critical',\n\t\ttitle: `Update failed (exit code ${exitCode}).`,\n\t\tdetail:\n\t\t\t'The update did not complete cleanly. Review the log below, and check ' +\n\t\t\t'`npx selva logs` to confirm whether the app is currently online.',\n\t\tfrom,\n\t\tto\n\t};\n}\n"],"mappings":"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"}
@@ -369,6 +369,30 @@ if [ -n "$OWNER" ] && [ -n "$HERE" ] && [ "\${OWNER_REAL:-$OWNER}" != "$HERE" ];
369
369
  exit 11
370
370
  fi
371
371
 
372
+ # ---------------------------------------------------------------------------
373
+ # 2c. The release must be downloadable — BEFORE any downtime.
374
+ # ---------------------------------------------------------------------------
375
+ # npm lists a fresh version, dist-tag included, minutes before it serves the
376
+ # tarball, which 404s until then. Fetching both tarballs into the npm cache here
377
+ # waits that out with the app still running, and the install below reuses them.
378
+ if [ -n "$LATEST" ]; then
379
+ echo "[STEP] Waiting for npm to serve the '$TAG' release files"
380
+ FETCHED=
381
+ for i in $(seq 1 10); do
382
+ if npm cache add "@selvajs/cli@$TAG" "@selvajs/selva@$TAG" >/dev/null 2>&1; then
383
+ FETCHED=1
384
+ break
385
+ fi
386
+ sleep 30
387
+ done
388
+ if [ -z "$FETCHED" ]; then
389
+ echo "[FATAL] NOT_DOWNLOADABLE: npm lists @selvajs/selva@$LATEST but has not served its files after 5 minutes."
390
+ echo "[FATAL] A release just published can take a few minutes to become downloadable. Retry the update shortly."
391
+ echo "[FATAL] Aborting WITHOUT stopping the app — it is still running."
392
+ exit 13
393
+ fi
394
+ fi
395
+
372
396
  # ---------------------------------------------------------------------------
373
397
  # 3. Stop the app BEFORE npm rewrites build/.
374
398
  # ---------------------------------------------------------------------------