@lunora/studio 1.0.0-alpha.164 → 1.0.0-alpha.166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/{chunk-25NFR6EB.js → chunk-225VJ77I.js} +1 -1
- package/dist/standalone/{chunk-IABM4BFJ.js → chunk-2DX5MROH.js} +1 -1
- package/dist/standalone/chunk-2URQKGWU.js +1 -0
- package/dist/standalone/chunk-3FBLWUXD.js +1 -0
- package/dist/standalone/{chunk-LEE5CUZT.js → chunk-3LGVSZ4D.js} +1 -1
- package/dist/standalone/{chunk-WQNXLF5G.js → chunk-3UOVQ3YN.js} +1 -1
- package/dist/standalone/{chunk-EN47FSLD.js → chunk-4G7WDTSC.js} +1 -1
- package/dist/standalone/{chunk-7YLJ5KLR.js → chunk-4OGX6UIE.js} +1 -1
- package/dist/standalone/chunk-52Y5BCFW.js +8 -0
- package/dist/standalone/{chunk-EBWXFG4H.js → chunk-55754F6H.js} +1 -1
- package/dist/standalone/{chunk-RINMBBKH.js → chunk-5JHPL7FH.js} +1 -1
- package/dist/standalone/chunk-6D6Z2KXU.js +1 -0
- package/dist/standalone/{chunk-V4JC6W6G.js → chunk-7PEQ4RPL.js} +1 -1
- package/dist/standalone/{chunk-5GFSKIB2.js → chunk-AAVLPU5Q.js} +1 -1
- package/dist/standalone/chunk-AWHXPIXU.js +1 -0
- package/dist/standalone/{chunk-2XLW4JQW.js → chunk-B62IS74K.js} +1 -1
- package/dist/standalone/chunk-CMA4PTV7.js +1 -0
- package/dist/standalone/{chunk-2SGL4FWA.js → chunk-CO7D5QQA.js} +1 -1
- package/dist/standalone/{chunk-SPNZDIJ6.js → chunk-CQ4VSTAW.js} +1 -1
- package/dist/standalone/{chunk-VFUIZXI2.js → chunk-CQO3Z2AB.js} +1 -1
- package/dist/standalone/{chunk-V3KCWCAW.js → chunk-E67LBUZU.js} +1 -1
- package/dist/standalone/{chunk-ZLPC3XZF.js → chunk-E7TOMONS.js} +1 -1
- package/dist/standalone/{chunk-6D5ZAOXC.js → chunk-EFMYOSXQ.js} +1 -1
- package/dist/standalone/{chunk-LWM2KLIY.js → chunk-ERLNG3BC.js} +1 -1
- package/dist/standalone/chunk-EVTM6Q43.js +1 -0
- package/dist/standalone/{chunk-J35RH2FI.js → chunk-F4W5DVWA.js} +1 -1
- package/dist/standalone/{chunk-NCCAMFB6.js → chunk-FEWMAPNI.js} +1 -1
- package/dist/standalone/chunk-G37I6O7H.js +1 -0
- package/dist/standalone/{chunk-2ES4GR4C.js → chunk-GGPSI4ZR.js} +1 -1
- package/dist/standalone/chunk-GMS77BZD.js +1 -0
- package/dist/standalone/{chunk-2CNAVNV2.js → chunk-HKPAFIMB.js} +1 -1
- package/dist/standalone/{chunk-3Q2D36DA.js → chunk-I3PD3ZML.js} +1 -1
- package/dist/standalone/{chunk-EEZPJKMT.js → chunk-IBOPW37U.js} +1 -1
- package/dist/standalone/chunk-IHMGCHAA.js +1 -0
- package/dist/standalone/{chunk-SY4TXJZL.js → chunk-IMLGMLYE.js} +1 -1
- package/dist/standalone/{chunk-TGHH7ZFA.js → chunk-IS6LVJ6L.js} +1 -1
- package/dist/standalone/{chunk-V26KN3MP.js → chunk-IUHGODQV.js} +1 -1
- package/dist/standalone/{chunk-BL6QMVLF.js → chunk-JWJFB4ZB.js} +1 -1
- package/dist/standalone/{chunk-UC4Q7VXT.js → chunk-JXJZMINI.js} +1 -1
- package/dist/standalone/{chunk-2LIPLDNH.js → chunk-KF2YSK5Z.js} +1 -1
- package/dist/standalone/{chunk-MAZTCEWI.js → chunk-KMLTYAJF.js} +1 -1
- package/dist/standalone/{chunk-GFTXGON3.js → chunk-KPISDHKV.js} +1 -1
- package/dist/standalone/{chunk-U6PQT7NE.js → chunk-KRXDSPZ4.js} +1 -1
- package/dist/standalone/{chunk-QP3FHCVL.js → chunk-KSRQTLE3.js} +1 -1
- package/dist/standalone/{chunk-AMCDRK5X.js → chunk-KY7U3EOR.js} +1 -1
- package/dist/standalone/{chunk-7T2VCEMC.js → chunk-L6W4QXGJ.js} +1 -1
- package/dist/standalone/{chunk-EHSU2WDS.js → chunk-LBMSRD6N.js} +1 -1
- package/dist/standalone/{chunk-OYLP7ON7.js → chunk-MKRHFCPJ.js} +1 -1
- package/dist/standalone/{chunk-WQYWA7U6.js → chunk-MU3P2FI7.js} +1 -1
- package/dist/standalone/{chunk-NPERN4YF.js → chunk-MXLAOCAN.js} +1 -1
- package/dist/standalone/{chunk-D4P5T22H.js → chunk-N3MMJZQW.js} +1 -1
- package/dist/standalone/{chunk-MJJFRQE5.js → chunk-NXZGWCUN.js} +1 -1
- package/dist/standalone/{chunk-46Y3PCC5.js → chunk-NZDNC4KZ.js} +1 -1
- package/dist/standalone/{chunk-TX6LX7P4.js → chunk-O7D7DJVB.js} +1 -1
- package/dist/standalone/{chunk-URS4NC3B.js → chunk-OBSMXNVJ.js} +1 -1
- package/dist/standalone/{chunk-3HQRIHXM.js → chunk-OS6CZ56E.js} +1 -1
- package/dist/standalone/{chunk-SU737V7V.js → chunk-PD6WIDY6.js} +1 -1
- package/dist/standalone/chunk-PLHA3OWK.js +3 -0
- package/dist/standalone/{chunk-INWAISDG.js → chunk-QY4V5UOY.js} +1 -1
- package/dist/standalone/chunk-RFNGDE33.js +1 -0
- package/dist/standalone/{chunk-QAARTUOI.js → chunk-RH2G72SL.js} +1 -1
- package/dist/standalone/{chunk-2IIK5TFU.js → chunk-RQPSYNGU.js} +1 -1
- package/dist/standalone/{chunk-DBDMRCYH.js → chunk-SPERI4DG.js} +1 -1
- package/dist/standalone/chunk-SZUW2MXD.js +1 -0
- package/dist/standalone/{chunk-U6SAHQH5.js → chunk-T6X7NXEE.js} +1 -1
- package/dist/standalone/{chunk-ZTEUO2JE.js → chunk-TPVTZE6M.js} +1 -1
- package/dist/standalone/chunk-V3CZW3JB.js +1 -0
- package/dist/standalone/chunk-V3VJAA4D.js +1 -0
- package/dist/standalone/{chunk-66E6VAZO.js → chunk-V5PJJYCF.js} +1 -1
- package/dist/standalone/{chunk-KTCQA7J7.js → chunk-WDYULSDM.js} +2 -2
- package/dist/standalone/{chunk-TMRPWGMC.js → chunk-WRNNZJ34.js} +1 -1
- package/dist/standalone/{chunk-YMNWFAZD.js → chunk-WWHDFIP5.js} +1 -1
- package/dist/standalone/{chunk-IYFO726L.js → chunk-X5AXABWH.js} +1 -1
- package/dist/standalone/{chunk-DSWX2XAB.js → chunk-XAGNBUL3.js} +1 -1
- package/dist/standalone/{chunk-5BUNUDXO.js → chunk-XTC4KFYF.js} +1 -1
- package/dist/standalone/chunk-YPRQLCKF.js +1 -0
- package/dist/standalone/{chunk-VDLESMT6.js → chunk-YYR4P344.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +12 -12
- package/dist/standalone/chunk-46ZJ3TM4.js +0 -2
- package/dist/standalone/chunk-7RIRJD2P.js +0 -1
- package/dist/standalone/chunk-C3TOZ4LG.js +0 -1
- package/dist/standalone/chunk-EEA5SMPT.js +0 -1
- package/dist/standalone/chunk-FO26ZU7E.js +0 -1
- package/dist/standalone/chunk-JVUZEYKQ.js +0 -1
- package/dist/standalone/chunk-MNAASONZ.js +0 -1
- package/dist/standalone/chunk-PYT4RZJH.js +0 -1
- package/dist/standalone/chunk-SB35BJ7A.js +0 -1
- package/dist/standalone/chunk-TJRQUJFS.js +0 -1
- package/dist/standalone/chunk-TWTNWOJU.js +0 -1
- package/dist/standalone/chunk-TYYQFPAP.js +0 -8
- package/dist/standalone/chunk-U5JDESCI.js +0 -1
- package/dist/standalone/chunk-UDCVU3Z5.js +0 -1
- package/dist/standalone/chunk-VILR66AG.js +0 -1
- package/dist/standalone/chunk-VVOVVU53.js +0 -1
- /package/dist/standalone/{chunk-D27D4UUI.js → chunk-3Q2P62UR.js} +0 -0
- /package/dist/standalone/{chunk-I52I2DJG.js → chunk-4JLGLPWV.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as k}from"./chunk-YOB2X3FZ.js";import{a as j}from"./chunk-66UGPQVC.js";import{a as _}from"./chunk-WDYULSDM.js";import"./chunk-K7AJEMKE.js";import"./chunk-6D6Z2KXU.js";import"./chunk-Y6CXU7T4.js";import"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as g}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as E}from"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as y}from"./chunk-4ZEL6BYL.js";import{c as b}from"./chunk-D6UKRXIS.js";import"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as w}from"./chunk-FKVZRPV5.js";import{a as I,b as R,c as A,d as v,e as l,f as n}from"./chunk-HEAQVSNS.js";import{a as f,e as N}from"./chunk-WUWBZPUK.js";import{d as T,r as S}from"./chunk-FODLDLE2.js";import{a as c,d as G,g as H}from"./chunk-YKXDMIHQ.js";var e=G(H(),1);var Q=["subscriptions","events"],U={},B=new Set(["active","trialing"]),V=new Set(["past_due","unpaid"]),s=c((a,t)=>{if(a[t]!==void 0)return a[t];let m=a.__doc__;return typeof m=="string"?k(m)?.[t]:void 0},"n"),i=c(a=>typeof a=="string"?a:typeof a=="number"||typeof a=="bigint"||typeof a=="boolean"?String(a):"","a"),q=c(a=>B.has(a)?"default":V.has(a)?"destructive":"outline","G"),se=c(({limit:a=100})=>{let t=T(),m=_(),{data:x}=b(y.listTables,U,{live:!0}),D=x!==void 0,C=Array.isArray(x)&&Q.every(r=>x.some(d=>d.name===r)),p=m.payments&&C,o=b(y.readTablePage,{filters:[],limit:a,offset:0,orderBy:[],search:"",table:"subscriptions"},{enabled:p}),h=b(y.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"},{enabled:p});j(()=>{p&&(o.refetch(),h.refetch())},!0);let u=o.data?.rows??[],O=h.data?.rows??[],F=o.error??h.error,L=o.error===null?h.errorSource:o.errorSource,P=u.filter(r=>B.has(i(s(r,"state")))).length,M=O.toSorted((r,d)=>Number(s(d,"processedAt")??0)-Number(s(r,"processedAt")??0));return D&&!p?(0,e.jsx)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:(0,e.jsx)(w,{description:t("No @lunora/payment tables found in this deployment. Declare the store tables (subscriptions, events, \u2026) in lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:t("No payments configured")})}):(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsx)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxs)(f,{className:"justify-between gap-0 py-0",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Subscriptions")}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:P}),(0,e.jsx)(g,{variant:"default",children:t("{count} active",{count:P})})]})]}),(0,e.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:t("{total} total",{total:u.length})})]})}),F===null?void 0:(0,e.jsx)(E,{error:L}),u.length===0&&!o.isLoading?(0,e.jsx)(w,{testId:"payments-empty",title:t("No subscriptions yet")}):(0,e.jsx)(f,{className:"overflow-hidden py-0",children:(0,e.jsx)(N,{className:"px-0",children:(0,e.jsxs)(I,{children:[(0,e.jsx)(R,{children:(0,e.jsxs)(v,{children:[(0,e.jsx)(l,{children:t("Provider")}),(0,e.jsx)(l,{children:t("Reference")}),(0,e.jsx)(l,{children:t("Plan")}),(0,e.jsx)(l,{children:t("State")}),(0,e.jsx)(l,{children:t("Renews")})]})}),(0,e.jsx)(A,{children:u.map(r=>{let d=i(s(r,"state"));return(0,e.jsxs)(v,{"data-testid":"payment-subscription-row",children:[(0,e.jsx)(n,{children:i(s(r,"provider"))}),(0,e.jsx)(n,{children:i(s(r,"referenceId"))}),(0,e.jsx)(n,{children:i(s(r,"priceId"))}),(0,e.jsx)(n,{children:(0,e.jsx)(g,{variant:q(d),children:d})}),(0,e.jsx)(n,{children:S(s(r,"currentPeriodEnd"))})]},i(s(r,"providerSubscriptionId")))})})]})})}),(0,e.jsxs)(f,{className:"overflow-hidden py-0",children:[(0,e.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:t("Recent webhook events")})}),(0,e.jsx)(N,{className:"px-0",children:(0,e.jsx)(I,{children:(0,e.jsx)(A,{children:M.map(r=>(0,e.jsxs)(v,{"data-testid":"payment-event-row",children:[(0,e.jsx)(n,{children:i(s(r,"provider"))}),(0,e.jsx)(n,{className:"font-medium",children:i(s(r,"type"))}),(0,e.jsx)(n,{className:"text-muted-foreground",children:i(s(r,"providerEventId"))}),(0,e.jsx)(n,{children:S(s(r,"processedAt"))})]},i(s(r,"providerEventId"))))})})})]})]})},"se");export{se as PaymentsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as it}from"./chunk-TYYQFPAP.js";import"./chunk-CSUROWL2.js";import"./chunk-TJRQUJFS.js";import"./chunk-TWTNWOJU.js";import"./chunk-WQYWA7U6.js";import{a as Me}from"./chunk-IMOHEGMV.js";import{a as rt}from"./chunk-BOTGXX4H.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5JDWLCSH.js";import{a as at}from"./chunk-SU737V7V.js";import{a as Ye}from"./chunk-S3CRZLGS.js";import{a as Xe}from"./chunk-IABM4BFJ.js";import{b as Ge}from"./chunk-OGUKYRFM.js";import{d as Je,e as Ae}from"./chunk-JVUZEYKQ.js";import"./chunk-OKG3HWSJ.js";import{P as Pe}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ue}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as Be}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Se}from"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as le}from"./chunk-D6UKRXIS.js";import{f as Ee}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as we}from"./chunk-FKVZRPV5.js";import{a as Ze,b as et,c as tt,d as Fe,e as C,f as q}from"./chunk-HEAQVSNS.js";import{a as We,e as ze}from"./chunk-WUWBZPUK.js";import{d as de,f as He,g as Qe,h as Ve,o as $e,r as Ne}from"./chunk-FODLDLE2.js";import{a as o,d as oe,e as De,f as Le,g as _e,i as se}from"./chunk-YKXDMIHQ.js";var he=oe(Le(),1),me=oe(De(),1);var nt=oe(Le(),1);var S=oe(De(),1);var l=oe(_e(),1);var xt=He(R.runMigration),ot=o(t=>{let e=(0,nt.c)(98),{initialShardKey:i}=t,r=Ee(),a=de(),{queryShardKey:c,setShardKey:n,shardKey:s}=Ye(i),[u,b]=(0,S.useState)(""),[h,v]=(0,S.useState)("up"),[p,g]=(0,S.useState)(!0),[f,y]=(0,S.useState)(!1),[x,m]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),K;e[0]!==s?(K=s.trim(),e[0]=s,e[1]=K):K=e[1];let I=K===c,O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={},e[2]=O):O=e[2];let F;e[3]!==c?(F={live:!0,shardKey:c},e[3]=c,e[4]=F):F=e[4];let $=le(R.migrationStatus,O,F),N=$.data?.migrations??null,Oe=$.error,{errorSource:Ce,liveError:qe}=$,pe,fe;e[5]!==c||e[6]!==$.data?(pe=o(()=>{$.data!==void 0&&Ge(c)},"W"),fe=[$.data,c],e[5]=c,e[6]=$.data,e[7]=pe,e[8]=fe):(pe=e[7],fe=e[8]),(0,S.useEffect)(pe,fe);let ge;if(e[9]!==r||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==s||e[14]!==$||e[15]!==a){let M=o(async()=>{let Te=u.trim();if(Te===""){k(a("Enter a migration id")),m(null);return}y(!0),k(null);try{let Ie=await r.query(xt,{direction:h,dryRun:p,id:Te},Qe(s));m(Ie),$.refetch()}catch(Ie){let vt=Ie;m(null),k(Ve(vt))}y(!1)},"m");ge=o(()=>{$e(M())},"V"),e[9]=r,e[10]=h,e[11]=p,e[12]=u,e[13]=s,e[14]=$,e[15]=a,e[16]=ge}else ge=e[16];let be=ge,ve;e[17]===Symbol.for("react.memo_cache_sentinel")?(ve=o(M=>{b(M.target.value)},"Y"),e[17]=ve):ve=e[17];let ft=ve,xe;e[18]===Symbol.for("react.memo_cache_sentinel")?(xe=o(M=>{v(M.target.value==="down"?"down":"up")},"Z"),e[18]=xe):xe=e[18];let gt=xe,ye;e[19]===Symbol.for("react.memo_cache_sentinel")?(ye=o(M=>{g(M.target.checked)},"ee"),e[19]=ye):ye=e[19];let bt=ye,T;e[20]!==n||e[21]!==s?(T=(0,l.jsx)(Xe,{onChange:n,testId:"mg-shard-input",value:s}),e[20]=n,e[21]=s,e[22]=T):T=e[22];let D;e[23]!==qe?(D=(0,l.jsx)(rt,{message:qe,prefix:"mg"}),e[23]=qe,e[24]=D):D=e[24];let L;e[25]!==T||e[26]!==D?(L=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=L):L=e[27];let _;e[28]!==Oe||e[29]!==Ce?(_=Oe!==null&&(0,l.jsx)(Se,{error:Ce,testId:"mg-status-error"}),e[28]=Oe,e[29]=Ce,e[30]=_):_=e[30];let E;e[31]!==N||e[32]!==a?(E=N!==null&&N.length===0&&(0,l.jsx)(we,{description:a("Data migrations you run against this shard will be tracked here."),icon:(0,l.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=E):E=e[33];let J;e[34]!==N||e[35]!==a?(J=N!==null&&N.length>0&&(0,l.jsx)(We,{className:"overflow-hidden py-0",children:(0,l.jsx)(ze,{className:"px-0",children:(0,l.jsxs)(Ze,{"data-testid":"mg-table",children:[(0,l.jsx)(et,{children:(0,l.jsxs)(Fe,{children:[(0,l.jsx)(C,{children:a("id")}),(0,l.jsx)(C,{children:a("direction")}),(0,l.jsx)(C,{children:a("status")}),(0,l.jsx)(C,{children:a("processed")}),(0,l.jsx)(C,{children:a("changed")}),(0,l.jsx)(C,{children:a("updated")}),(0,l.jsx)(C,{children:a("error")})]})}),(0,l.jsx)(tt,{children:N.map(yt)})]})})}),e[34]=N,e[35]=a,e[36]=J):J=e[36];let A;e[37]!==a?(A=a("Run migration"),e[37]=a,e[38]=A):A=e[38];let B;e[39]!==A?(B=(0,l.jsx)(Me,{children:A}),e[39]=A,e[40]=B):B=e[40];let P;e[41]!==a?(P=a("Migration id"),e[41]=a,e[42]=P):P=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let W;e[45]!==u||e[46]!==P||e[47]!==U?(W=(0,l.jsx)(Pe,{"aria-label":P,className:"w-auto","data-testid":"mg-id-input",onChange:ft,placeholder:U,value:u}),e[45]=u,e[46]=P,e[47]=U,e[48]=W):W=e[48];let z;e[49]!==a?(z=a("Direction"),e[49]=a,e[50]=z):z=e[50];let H;e[51]!==a?(H=a("up"),e[51]=a,e[52]=H):H=e[52];let Q;e[53]!==H?(Q=(0,l.jsx)("option",{value:"up",children:H}),e[53]=H,e[54]=Q):Q=e[54];let V;e[55]!==a?(V=a("down"),e[55]=a,e[56]=V):V=e[56];let G;e[57]!==V?(G=(0,l.jsx)("option",{value:"down",children:V}),e[57]=V,e[58]=G):G=e[58];let X;e[59]!==h||e[60]!==z||e[61]!==Q||e[62]!==G?(X=(0,l.jsxs)("select",{"aria-label":z,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:gt,value:h,children:[Q,G]}),e[59]=h,e[60]=z,e[61]=Q,e[62]=G,e[63]=X):X=e[63];let Y;e[64]!==p?(Y=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:bt,type:"checkbox"}),e[64]=p,e[65]=Y):Y=e[65];let Z;e[66]!==a?(Z=a("Dry run"),e[66]=a,e[67]=Z):Z=e[67];let ee;e[68]!==Y||e[69]!==Z?(ee=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Y,Z]}),e[68]=Y,e[69]=Z,e[70]=ee):ee=e[70];let te;e[71]!==p||e[72]!==be||e[73]!==f||e[74]!==I||e[75]!==a?(te=p?(0,l.jsx)(Ue,{"data-testid":"mg-run",disabled:f||!I,onClick:be,type:"button",children:a(f?"Running\u2026":"Run")}):(0,l.jsx)(at,{confirmLabel:a(f?"Running\u2026":"Run migration?"),disabled:f||!I,onConfirm:be,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=be,e[73]=f,e[74]=I,e[75]=a,e[76]=te):te=e[76];let ae;e[77]!==W||e[78]!==X||e[79]!==ee||e[80]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[W,X,ee,te]}),e[77]=W,e[78]=X,e[79]=ee,e[80]=te,e[81]=ae):ae=e[81];let re;e[82]!==B||e[83]!==ae?(re=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,ae]}),e[82]=B,e[83]=ae,e[84]=re):re=e[84];let ie;e[85]!==w?(ie=w!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ie):ie=e[86];let ne;e[87]!==x||e[88]!==a?(ne=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:x.status}),x.processed,a(", changed"),x.changed]}),e[87]=x,e[88]=a,e[89]=ne):ne=e[89];let ke;return e[90]!==L||e[91]!==_||e[92]!==E||e[93]!==J||e[94]!==re||e[95]!==ie||e[96]!==ne?(ke=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[L,_,E,J,re,ie,ne]}),e[90]=L,e[91]=_,e[92]=E,e[93]=J,e[94]=re,e[95]=ie,e[96]=ne,e[97]=ke):ke=e[97],ke},"yt");function yt(t){return(0,l.jsxs)(Fe,{"data-testid":`mg-row-${t.id}`,children:[(0,l.jsx)(q,{children:t.id}),(0,l.jsx)(q,{children:t.direction}),(0,l.jsx)(q,{children:(0,l.jsx)(Be,{variant:"secondary",children:t.status})}),(0,l.jsx)(q,{children:t.processed}),(0,l.jsx)(q,{children:t.changed}),(0,l.jsx)(q,{children:Ne(t.updatedAt)}),(0,l.jsx)(q,{children:t.error??""})]},t.id)}o(yt,"Je");var d=oe(_e(),1);var Re=1;function kt(t){let e={},i=Object.keys(t);i.sort();for(let r of i)e[r]=t[r];return e}o(kt,"ne");var ce=o(t=>typeof t=="object"&&t!==null,"w"),wt=o(t=>ce(t)&&ce(t.fields)&&ce(t.indexes)&&ce(t.relations)&&typeof t.shardMode=="string","se"),$t=o(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(i){return{error:`baseline is not valid JSON: ${i instanceof Error?i.message:String(i)}`,status:"invalid"}}if(!ce(e)||e.version!==Re||!ce(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Re)})`,status:"invalid"};for(let[i,r]of Object.entries(e.tables))if(!wt(r))return{error:`baseline table "${i}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:Re},status:"ok"}},"ie"),Nt=o((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((i,r)=>i===e.fields[r]),"ae"),st=o(t=>t.unique!==void 0,"J"),Ke=o(({nullable:t,optional:e,refined:i,unique:r,...a})=>JSON.stringify(kt(a)),"A"),dt=o(t=>({form:JSON.stringify([Ke(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"P"),lt=o(t=>t.kind==="union"&&t.members?t.members.map(e=>dt(e)):[dt({...t,nullable:!1,optional:!1})],"V"),St=o((t,e)=>{if(e.kind!=="union")return!1;let i=lt(e);return lt(t).every(r=>i.some(a=>a.form===r.form&&(r.refined||!a.refined)))},"oe"),j=o(t=>{switch(t.kind){case"array":return`array(${t.of?j(t.of):"?"})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?j(t.key):"?"}, ${t.of?j(t.of):"?"})`;case"union":return(t.members??[]).map(e=>j(e)).join(" | ");default:return t.kind}},"y"),ue=o((t,e,i)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:i,table:t,type:e}),"O"),je=o((t,e,i)=>({remediation:"none",scope:"table",severity:"safe",summary:i,table:t,type:e}),"F"),jt=o((t,e,i,r,a)=>{if(!(i.kind===r.kind&&(!a||Ke(i)===Ke(r))))return a&&St(i,r)?je(t,"widenedFieldShape",`field ${t}.${e} widened: ${j(i)} \u2192 ${j(r)} \u2014 every stored value stays valid`):i.kind!==r.kind?ue(t,"changedFieldKind",`field ${t}.${e} changed type: ${i.kind} \u2192 ${r.kind} \u2014 add a data migration to convert existing values`):ue(t,"changedFieldShape",`field ${t}.${e} changed shape: ${j(i)} \u2192 ${j(r)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"re"),Ot=o((t,e,i,r)=>{let a=[];return i.unique!==r.unique&&a.push(r.unique===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`):je(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),i.nullable!==r.nullable&&a.push(r.nullable===!0?je(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):ue(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),i.refined!==r.refined&&a.push(r.refined===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):je(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),a},"de"),ht=o((t,e,i,r)=>{let a=[],c=st(i)&&st(r),n=jt(t,e,i,r,c);return n&&a.push(n),c&&a.push(...Ot(t,e,i,r)),i.optional&&!r.optional?a.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!i.optional&&r.optional&&a.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),a},"K"),Ct=o((t,e,i)=>i.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"le"),qt=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.fields)){let n=e.fields[a];n===void 0?r.push(Ct(t,a,c)):r.push(...ht(t,a,n,c))}for(let a of Object.keys(e.fields))i.fields[a]===void 0&&r.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"ce"),It=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.indexes)){let n=e.indexes[a];if(n===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Nt(n,c)||r.push({remediation:"code",severity:"breaking",summary:`index ${a} on ${t} changed shape \u2014 a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(let a of Object.keys(e.indexes))i.indexes[a]===void 0&&r.push({remediation:"code",severity:"breaking",summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` would break`,table:t,scope:"table",type:"removedIndex"})},"ue"),Ft=o((t,e,i,r)=>{for(let a of Object.keys(i.relations))e.relations[a]===void 0&&r.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))i.relations[a]===void 0&&r.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${a}`,table:t,type:"removedRelation"})},"me"),Mt=o((t,e,i,r)=>{e.shardMode!==i.shardMode&&r.push({remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e.shardMode} \u2192 ${i.shardMode} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}),qt(t,e,i,r),It(t,e,i,r),Ft(t,e,i,r)},"fe"),Rt=o((t,e)=>{let i=[],r=t?.tables??{};for(let[a,c]of Object.entries(e.tables)){let n=r[a];if(n===void 0){i.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}Mt(a,n,c,i)}for(let a of Object.keys(r))e.tables[a]===void 0&&i.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${a} \u2014 its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:a,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",c=e.jurisdiction??"(none)";i.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${c} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:i}},"he"),ct=o(t=>Object.entries(t.fields).map(([e,i])=>({name:e,optional:i.optional,ref:Object.values(t.relations).find(r=>r.field===e&&r.kind==="one")?.table,type:j(i)})),"H"),mt=o((t,e,i)=>{let r={},a=e?.fields??{},c=i?.fields??{};for(let[n,s]of Object.entries(c)){let u=a[n];u===void 0?r[n]=e===void 0?"unchanged":"added":r[n]=ht(t,n,u,s).length===0?"unchanged":"changed"}for(let n of Object.keys(a))c[n]===void 0&&(r[n]="removed");return r},"Q"),Kt=o((t,e)=>{let{changes:i}=Rt(t,e),r=new Set(i.filter(n=>n.scope==="table"&&n.table!==void 0).map(n=>n.table)),a=[],c=o((n,s)=>n?"added":r.has(s)?"changed":"context","o");for(let[n,s]of Object.entries(e.tables)){let u=t?.tables[n],b=c(u===void 0,n);a.push({columns:ct(s),fieldStatus:mt(n,u,s),name:n,shardMode:s.shardMode,status:b})}for(let[n,s]of Object.entries(t?.tables??{}))e.tables[n]===void 0&&a.push({columns:ct(s),fieldStatus:mt(n,s,void 0),name:n,shardMode:s.shardMode,status:"removed"});return a.sort((n,s)=>n.name.localeCompare(s.name)),{breakingCount:i.filter(n=>n.severity==="breaking").length,changes:i,tables:a}},"pe"),ut=o(t=>{let e=$t(t);return e.status==="ok"?e.snapshot:void 0},"L"),Tt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Dt=o(t=>t==="global"?"global":"shard","be"),Lt=o(t=>{let e=(0,he.c)(24),{appliedAt:i,hash:r,onSelect:a,selected:c,seq:n}=t,s=c?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==s?(u=se("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",s),e[0]=s,e[1]=u):u=e[1];let b=`sh-version-${r}`,h;e[2]!==r||e[3]!==a?(h=o(()=>{a(r)},"h"),e[2]=r,e[3]=a,e[4]=h):h=e[4];let v;e[5]!==n?(v=(0,d.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",n]}),e[5]=n,e[6]=v):v=e[6];let p;e[7]!==r?(p=r.slice(0,7),e[7]=r,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,d.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=g):g=e[10];let f;e[11]!==v||e[12]!==g?(f=(0,d.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[v,g]}),e[11]=v,e[12]=g,e[13]=f):f=e[13];let y;e[14]!==i?(y=Ne(i),e[14]=i,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:y}),e[16]=y,e[17]=x):x=e[17];let m;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(m=(0,d.jsx)("li",{children:(0,d.jsxs)("button",{className:u,"data-testid":b,onClick:h,type:"button",children:[f,x]})}),e[18]=x,e[19]=u,e[20]=b,e[21]=h,e[22]=f,e[23]=m):m=e[23],m},"ve"),_t=o(t=>{let e=(0,he.c)(26),{breaking:i,count:r,first:a}=t,c=de();if(a){let g;e[0]!==r?(g=(0,d.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:r}),e[0]=r,e[1]=g):g=e[1];let f;e[2]!==c?(f=c("tables"),e[2]=c,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[4]=f,e[5]=y):y=e[5];let x;return e[6]!==g||e[7]!==y?(x=(0,d.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[g,y]}),e[6]=g,e[7]=y,e[8]=x):x=e[8],x}let n=i>0&&"text-destructive",s;e[9]!==n?(s=se("text-3xl leading-none font-light tracking-tight tabular-nums",n),e[9]=n,e[10]=s):s=e[10];let u;e[11]!==r||e[12]!==s?(u=(0,d.jsx)("span",{className:s,children:r}),e[11]=r,e[12]=s,e[13]=u):u=e[13];let b;e[14]!==r||e[15]!==c?(b=c(r===1?"change":"changes"),e[14]=r,e[15]=c,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:b}),e[17]=b,e[18]=h):h=e[18];let v;e[19]!==i||e[20]!==c?(v=i>0&&(0,d.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",c("{count} breaking",{count:i})]}),e[19]=i,e[20]=c,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,d.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[u,h,v]}),e[22]=u,e[23]=h,e[24]=v,e[25]=p):p=e[25],p},"xe"),pt={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedShardMode:{action:"changed",kind:"shard mode"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},Et=o((t,e)=>{let i=`${pt[t.type].action} ${e} `;return t.summary.startsWith(i)?t.summary.slice(i.length):t.summary},"ye"),Jt=o(t=>{let e=new Map;for(let r of t){let a=r.table??"",c=e.get(a);c===void 0?e.set(a,[r]):c.push(r)}let i=[...e].map(([r,a])=>({changes:a,table:r}));return[...i.filter(r=>r.table!==""),...i.filter(r=>r.table==="")]},"ke"),At=o(t=>{let e=(0,he.c)(2),{children:i}=t,r;return e[0]!==i?(r=(0,d.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:i}),e[0]=i,e[1]=r):r=e[1],r},"$e"),Bt=o(({pane:t,shardKey:e=""})=>{let i=de(),r=Ae(),a=Je({strict:!1}).version,c=o(m=>{$e(r({search:{version:m},to:"/migrations"}))},"a"),n=le(R.schemaHistory,{},{shardKey:e}),s=n.data?.versions??[],u=a!==void 0&&s.some(m=>m.hash===a)?a:s[0]?.hash,b=s.findIndex(m=>m.hash===u),h=b===-1?void 0:s[b+1]?.hash,v=le(R.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=le(R.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,me.useMemo)(()=>{let m=ut(v.data?.version?.snapshotJson);if(m!==void 0)return Kt(ut(p.data?.version?.snapshotJson),m)},[v.data,p.data]),f=(0,me.useMemo)(()=>(g?.tables??[]).map(m=>({columns:m.columns,name:m.name,tier:Dt(m.shardMode)})),[g]),y=(0,me.useMemo)(()=>{let m={};for(let w of g?.tables??[])m[w.name]=Tt[w.status];return m},[g]);if(n.error!==null)return(0,d.jsx)(Se,{error:n.errorSource,testId:"sh-error"});if(s.length===0)return(0,d.jsx)(we,{description:i("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:i("No schema versions recorded yet.")});let x=g?.changes??[];return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,d.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,d.jsx)(At,{children:i("Schema versions")}),(0,d.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:s.map(m=>(0,d.jsx)(Lt,{appliedAt:m.appliedAt,hash:m.hash,onSelect:c,selected:m.hash===u,seq:m.seq},m.hash))})]}),(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,d.jsx)(_t,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),t==="diagram"?(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,d.jsx)(it,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:Jt(x).map(m=>{let w=(g?.tables??[]).find(k=>k.name===m.table);return(0,d.jsxs)("section",{className:"mb-6",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:m.table===""?i("schema"):m.table}),w!==void 0&&(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:i("{count} columns",{count:w.columns.length})}),m.changes.length>1&&(0,d.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:m.changes.length})]}),(0,d.jsx)("ul",{children:m.changes.map(k=>{let{action:K,kind:I}=pt[k.type],O=k.severity==="breaking",F=Et(k,I);return(0,d.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:se("-ms-3 h-3 w-0.5 shrink-0 self-center",O?"bg-destructive":"bg-transparent")}),(0,d.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[i(K)," ",I]}),F!==m.table&&(0,d.jsx)("span",{className:se("min-w-0 font-mono text-[13px]",O?"text-destructive":"text-foreground"),children:F}),O&&(0,d.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:i("breaking")})]},`${k.type}-${k.summary}`)})})]},m.table)})})]})]})},"we"),Pt=o(t=>se("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Se"),ya=o(t=>{let e=(0,he.c)(11),{initialShardKey:i}=t,r=de(),[a,c]=(0,me.useState)("diagram"),n;e[0]!==a?(n=o((v,p,g,f)=>(0,d.jsxs)("button",{"aria-selected":a===v,className:Pt(a===v),"data-testid":g,onClick:o(()=>{c(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,d.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"a"),e[0]=a,e[1]=n):n=e[1];let s=n,u;e[2]!==r||e[3]!==s?(u=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[s("diagram",r("Diagram"),"mg-pane-diagram"),s("changes",r("Changes"),"mg-pane-changes"),s("data",r("Data migrations"),"mg-pane-data")]}),e[2]=r,e[3]=s,e[4]=u):u=e[4];let b;e[5]!==i||e[6]!==a?(b=(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,d.jsx)(ot,{initialShardKey:i})}):(0,d.jsx)(Bt,{pane:a,shardKey:i})}),e[5]=i,e[6]=a,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[u,b]}),e[8]=u,e[9]=b,e[10]=h):h=e[10],h},"Je");export{ya as default};
|
|
1
|
+
import{a as it}from"./chunk-52Y5BCFW.js";import"./chunk-CSUROWL2.js";import"./chunk-RFNGDE33.js";import"./chunk-V3CZW3JB.js";import"./chunk-MU3P2FI7.js";import{a as Me}from"./chunk-IMOHEGMV.js";import{a as rt}from"./chunk-BOTGXX4H.js";import"./chunk-YPRQLCKF.js";import"./chunk-GMS77BZD.js";import"./chunk-3Q2P62UR.js";import"./chunk-AWHXPIXU.js";import"./chunk-V3VJAA4D.js";import"./chunk-5JDWLCSH.js";import{a as at}from"./chunk-PD6WIDY6.js";import{a as Ye}from"./chunk-S3CRZLGS.js";import{a as Xe}from"./chunk-2DX5MROH.js";import{b as Ge}from"./chunk-OGUKYRFM.js";import{d as Je,e as Ae}from"./chunk-6D6Z2KXU.js";import"./chunk-OKG3HWSJ.js";import{W as Pe}from"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{a as Ue}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as Be}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as Se}from"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as R}from"./chunk-4ZEL6BYL.js";import{c as le}from"./chunk-D6UKRXIS.js";import{f as Ee}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as we}from"./chunk-FKVZRPV5.js";import{a as Ze,b as et,c as tt,d as Fe,e as C,f as q}from"./chunk-HEAQVSNS.js";import{a as We,e as ze}from"./chunk-WUWBZPUK.js";import{d as de,f as He,g as Qe,h as Ve,o as $e,r as Ne}from"./chunk-FODLDLE2.js";import{a as o,d as oe,e as De,f as Le,g as _e,i as se}from"./chunk-YKXDMIHQ.js";var he=oe(Le(),1),me=oe(De(),1);var nt=oe(Le(),1);var S=oe(De(),1);var l=oe(_e(),1);var xt=He(R.runMigration),ot=o(t=>{let e=(0,nt.c)(98),{initialShardKey:i}=t,r=Ee(),a=de(),{queryShardKey:c,setShardKey:n,shardKey:s}=Ye(i),[u,b]=(0,S.useState)(""),[h,v]=(0,S.useState)("up"),[p,g]=(0,S.useState)(!0),[f,y]=(0,S.useState)(!1),[x,m]=(0,S.useState)(null),[w,k]=(0,S.useState)(null),K;e[0]!==s?(K=s.trim(),e[0]=s,e[1]=K):K=e[1];let I=K===c,O;e[2]===Symbol.for("react.memo_cache_sentinel")?(O={},e[2]=O):O=e[2];let F;e[3]!==c?(F={live:!0,shardKey:c},e[3]=c,e[4]=F):F=e[4];let $=le(R.migrationStatus,O,F),N=$.data?.migrations??null,Oe=$.error,{errorSource:Ce,liveError:qe}=$,pe,fe;e[5]!==c||e[6]!==$.data?(pe=o(()=>{$.data!==void 0&&Ge(c)},"W"),fe=[$.data,c],e[5]=c,e[6]=$.data,e[7]=pe,e[8]=fe):(pe=e[7],fe=e[8]),(0,S.useEffect)(pe,fe);let ge;if(e[9]!==r||e[10]!==h||e[11]!==p||e[12]!==u||e[13]!==s||e[14]!==$||e[15]!==a){let M=o(async()=>{let Te=u.trim();if(Te===""){k(a("Enter a migration id")),m(null);return}y(!0),k(null);try{let Ie=await r.query(xt,{direction:h,dryRun:p,id:Te},Qe(s));m(Ie),$.refetch()}catch(Ie){let vt=Ie;m(null),k(Ve(vt))}y(!1)},"m");ge=o(()=>{$e(M())},"V"),e[9]=r,e[10]=h,e[11]=p,e[12]=u,e[13]=s,e[14]=$,e[15]=a,e[16]=ge}else ge=e[16];let be=ge,ve;e[17]===Symbol.for("react.memo_cache_sentinel")?(ve=o(M=>{b(M.target.value)},"Y"),e[17]=ve):ve=e[17];let ft=ve,xe;e[18]===Symbol.for("react.memo_cache_sentinel")?(xe=o(M=>{v(M.target.value==="down"?"down":"up")},"Z"),e[18]=xe):xe=e[18];let gt=xe,ye;e[19]===Symbol.for("react.memo_cache_sentinel")?(ye=o(M=>{g(M.target.checked)},"ee"),e[19]=ye):ye=e[19];let bt=ye,T;e[20]!==n||e[21]!==s?(T=(0,l.jsx)(Xe,{onChange:n,testId:"mg-shard-input",value:s}),e[20]=n,e[21]=s,e[22]=T):T=e[22];let D;e[23]!==qe?(D=(0,l.jsx)(rt,{message:qe,prefix:"mg"}),e[23]=qe,e[24]=D):D=e[24];let L;e[25]!==T||e[26]!==D?(L=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[T,D]}),e[25]=T,e[26]=D,e[27]=L):L=e[27];let _;e[28]!==Oe||e[29]!==Ce?(_=Oe!==null&&(0,l.jsx)(Se,{error:Ce,testId:"mg-status-error"}),e[28]=Oe,e[29]=Ce,e[30]=_):_=e[30];let E;e[31]!==N||e[32]!==a?(E=N!==null&&N.length===0&&(0,l.jsx)(we,{description:a("Data migrations you run against this shard will be tracked here."),icon:(0,l.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,l.jsx)("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:a("No migrations have run on this shard.")}),e[31]=N,e[32]=a,e[33]=E):E=e[33];let J;e[34]!==N||e[35]!==a?(J=N!==null&&N.length>0&&(0,l.jsx)(We,{className:"overflow-hidden py-0",children:(0,l.jsx)(ze,{className:"px-0",children:(0,l.jsxs)(Ze,{"data-testid":"mg-table",children:[(0,l.jsx)(et,{children:(0,l.jsxs)(Fe,{children:[(0,l.jsx)(C,{children:a("id")}),(0,l.jsx)(C,{children:a("direction")}),(0,l.jsx)(C,{children:a("status")}),(0,l.jsx)(C,{children:a("processed")}),(0,l.jsx)(C,{children:a("changed")}),(0,l.jsx)(C,{children:a("updated")}),(0,l.jsx)(C,{children:a("error")})]})}),(0,l.jsx)(tt,{children:N.map(yt)})]})})}),e[34]=N,e[35]=a,e[36]=J):J=e[36];let A;e[37]!==a?(A=a("Run migration"),e[37]=a,e[38]=A):A=e[38];let B;e[39]!==A?(B=(0,l.jsx)(Me,{children:A}),e[39]=A,e[40]=B):B=e[40];let P;e[41]!==a?(P=a("Migration id"),e[41]=a,e[42]=P):P=e[42];let U;e[43]!==a?(U=a("migration id"),e[43]=a,e[44]=U):U=e[44];let W;e[45]!==u||e[46]!==P||e[47]!==U?(W=(0,l.jsx)(Pe,{"aria-label":P,className:"w-auto","data-testid":"mg-id-input",onChange:ft,placeholder:U,value:u}),e[45]=u,e[46]=P,e[47]=U,e[48]=W):W=e[48];let z;e[49]!==a?(z=a("Direction"),e[49]=a,e[50]=z):z=e[50];let H;e[51]!==a?(H=a("up"),e[51]=a,e[52]=H):H=e[52];let Q;e[53]!==H?(Q=(0,l.jsx)("option",{value:"up",children:H}),e[53]=H,e[54]=Q):Q=e[54];let V;e[55]!==a?(V=a("down"),e[55]=a,e[56]=V):V=e[56];let G;e[57]!==V?(G=(0,l.jsx)("option",{value:"down",children:V}),e[57]=V,e[58]=G):G=e[58];let X;e[59]!==h||e[60]!==z||e[61]!==Q||e[62]!==G?(X=(0,l.jsxs)("select",{"aria-label":z,className:"flex h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs transition-colors outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50 dark:bg-input/30","data-testid":"mg-direction",onChange:gt,value:h,children:[Q,G]}),e[59]=h,e[60]=z,e[61]=Q,e[62]=G,e[63]=X):X=e[63];let Y;e[64]!==p?(Y=(0,l.jsx)("input",{checked:p,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:bt,type:"checkbox"}),e[64]=p,e[65]=Y):Y=e[65];let Z;e[66]!==a?(Z=a("Dry run"),e[66]=a,e[67]=Z):Z=e[67];let ee;e[68]!==Y||e[69]!==Z?(ee=(0,l.jsxs)(Me,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[Y,Z]}),e[68]=Y,e[69]=Z,e[70]=ee):ee=e[70];let te;e[71]!==p||e[72]!==be||e[73]!==f||e[74]!==I||e[75]!==a?(te=p?(0,l.jsx)(Ue,{"data-testid":"mg-run",disabled:f||!I,onClick:be,type:"button",children:a(f?"Running\u2026":"Run")}):(0,l.jsx)(at,{confirmLabel:a(f?"Running\u2026":"Run migration?"),disabled:f||!I,onConfirm:be,testId:"mg-run",children:a("Run")}),e[71]=p,e[72]=be,e[73]=f,e[74]=I,e[75]=a,e[76]=te):te=e[76];let ae;e[77]!==W||e[78]!==X||e[79]!==ee||e[80]!==te?(ae=(0,l.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[W,X,ee,te]}),e[77]=W,e[78]=X,e[79]=ee,e[80]=te,e[81]=ae):ae=e[81];let re;e[82]!==B||e[83]!==ae?(re=(0,l.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[B,ae]}),e[82]=B,e[83]=ae,e[84]=re):re=e[84];let ie;e[85]!==w?(ie=w!==null&&(0,l.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:w}),e[85]=w,e[86]=ie):ie=e[86];let ne;e[87]!==x||e[88]!==a?(ne=x!==null&&(0,l.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[x.dryRun?a("Dry run: "):"",a("{status} \u2014 processed",{status:x.status}),x.processed,a(", changed"),x.changed]}),e[87]=x,e[88]=a,e[89]=ne):ne=e[89];let ke;return e[90]!==L||e[91]!==_||e[92]!==E||e[93]!==J||e[94]!==re||e[95]!==ie||e[96]!==ne?(ke=(0,l.jsxs)("div",{className:"flex flex-col gap-3 pt-4","data-testid":"lunora-migrations",children:[L,_,E,J,re,ie,ne]}),e[90]=L,e[91]=_,e[92]=E,e[93]=J,e[94]=re,e[95]=ie,e[96]=ne,e[97]=ke):ke=e[97],ke},"yt");function yt(t){return(0,l.jsxs)(Fe,{"data-testid":`mg-row-${t.id}`,children:[(0,l.jsx)(q,{children:t.id}),(0,l.jsx)(q,{children:t.direction}),(0,l.jsx)(q,{children:(0,l.jsx)(Be,{variant:"secondary",children:t.status})}),(0,l.jsx)(q,{children:t.processed}),(0,l.jsx)(q,{children:t.changed}),(0,l.jsx)(q,{children:Ne(t.updatedAt)}),(0,l.jsx)(q,{children:t.error??""})]},t.id)}o(yt,"Je");var d=oe(_e(),1);var Re=1;function kt(t){let e={},i=Object.keys(t);i.sort();for(let r of i)e[r]=t[r];return e}o(kt,"ne");var ce=o(t=>typeof t=="object"&&t!==null,"w"),wt=o(t=>ce(t)&&ce(t.fields)&&ce(t.indexes)&&ce(t.relations)&&typeof t.shardMode=="string","se"),$t=o(t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(i){return{error:`baseline is not valid JSON: ${i instanceof Error?i.message:String(i)}`,status:"invalid"}}if(!ce(e)||e.version!==Re||!ce(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(Re)})`,status:"invalid"};for(let[i,r]of Object.entries(e.tables))if(!wt(r))return{error:`baseline table "${i}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:Re},status:"ok"}},"ie"),Nt=o((t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((i,r)=>i===e.fields[r]),"ae"),st=o(t=>t.unique!==void 0,"J"),Ke=o(({nullable:t,optional:e,refined:i,unique:r,...a})=>JSON.stringify(kt(a)),"A"),dt=o(t=>({form:JSON.stringify([Ke(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),"P"),lt=o(t=>t.kind==="union"&&t.members?t.members.map(e=>dt(e)):[dt({...t,nullable:!1,optional:!1})],"V"),St=o((t,e)=>{if(e.kind!=="union")return!1;let i=lt(e);return lt(t).every(r=>i.some(a=>a.form===r.form&&(r.refined||!a.refined)))},"oe"),j=o(t=>{switch(t.kind){case"array":return`array(${t.of?j(t.of):"?"})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?j(t.key):"?"}, ${t.of?j(t.of):"?"})`;case"union":return(t.members??[]).map(e=>j(e)).join(" | ");default:return t.kind}},"y"),ue=o((t,e,i)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:i,table:t,type:e}),"O"),je=o((t,e,i)=>({remediation:"none",scope:"table",severity:"safe",summary:i,table:t,type:e}),"F"),jt=o((t,e,i,r,a)=>{if(!(i.kind===r.kind&&(!a||Ke(i)===Ke(r))))return a&&St(i,r)?je(t,"widenedFieldShape",`field ${t}.${e} widened: ${j(i)} \u2192 ${j(r)} \u2014 every stored value stays valid`):i.kind!==r.kind?ue(t,"changedFieldKind",`field ${t}.${e} changed type: ${i.kind} \u2192 ${r.kind} \u2014 add a data migration to convert existing values`):ue(t,"changedFieldShape",`field ${t}.${e} changed shape: ${j(i)} \u2192 ${j(r)} \u2014 stored values were written against the old shape; add a data migration to convert them`)},"re"),Ot=o((t,e,i,r)=>{let a=[];return i.unique!==r.unique&&a.push(r.unique===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} became unique \u2014 existing duplicates would violate it; add a data migration to de-duplicate first`):je(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),i.nullable!==r.nullable&&a.push(r.nullable===!0?je(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):ue(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable \u2014 rows holding NULL would be invalid; add a data migration to backfill them`)),i.refined!==r.refined&&a.push(r.refined===!0?ue(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement \u2014 stored values were never checked against it; add a data migration if any could fail`):je(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),a},"de"),ht=o((t,e,i,r)=>{let a=[],c=st(i)&&st(r),n=jt(t,e,i,r,c);return n&&a.push(n),c&&a.push(...Ot(t,e,i,r)),i.optional&&!r.optional?a.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required \u2014 rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!i.optional&&r.optional&&a.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),a},"K"),Ct=o((t,e,i)=>i.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} \u2014 existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},"le"),qt=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.fields)){let n=e.fields[a];n===void 0?r.push(Ct(t,a,c)):r.push(...ht(t,a,n,c))}for(let a of Object.keys(e.fields))i.fields[a]===void 0&&r.push({remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${a} \u2014 add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},"ce"),It=o((t,e,i,r)=>{for(let[a,c]of Object.entries(i.indexes)){let n=e.indexes[a];if(n===void 0){r.push({remediation:"none",scope:"table",severity:"safe",summary:`added index ${a} on ${t}`,table:t,type:"addedIndex"});continue}Nt(n,c)||r.push({remediation:"code",severity:"breaking",summary:`index ${a} on ${t} changed shape \u2014 a query may have relied on the old index`,table:t,scope:"table",type:"changedIndex"})}for(let a of Object.keys(e.indexes))i.indexes[a]===void 0&&r.push({remediation:"code",severity:"breaking",summary:`removed index ${a} on ${t} \u2014 a query that used \`.withIndex("${a}")\` would break`,table:t,scope:"table",type:"removedIndex"})},"ue"),Ft=o((t,e,i,r)=>{for(let a of Object.keys(i.relations))e.relations[a]===void 0&&r.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${a}`,table:t,type:"addedRelation"});for(let a of Object.keys(e.relations))i.relations[a]===void 0&&r.push({remediation:"code",scope:"schema",severity:"breaking",summary:`removed relation ${t}.${a}`,table:t,type:"removedRelation"})},"me"),Mt=o((t,e,i,r)=>{e.shardMode!==i.shardMode&&r.push({remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e.shardMode} \u2192 ${i.shardMode} \u2014 its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode"}),qt(t,e,i,r),It(t,e,i,r),Ft(t,e,i,r)},"fe"),Rt=o((t,e)=>{let i=[],r=t?.tables??{};for(let[a,c]of Object.entries(e.tables)){let n=r[a];if(n===void 0){i.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${a}`,table:a,type:"addedTable"});continue}Mt(a,n,c,i)}for(let a of Object.keys(r))e.tables[a]===void 0&&i.push({remediation:"rehome",scope:"table",severity:"breaking",summary:`removed table ${a} \u2014 its rows stay in each shard's SQLite, unreachable through the schema; export the shard first if the data must be kept`,table:a,type:"removedTable"});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){let a=t.jurisdiction??"(none)",c=e.jurisdiction??"(none)";i.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${a} to ${c} \u2014 this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (no in-place migration; export then import to move it). Revert the change, or override the gate to proceed intentionally.`,type:"changedJurisdiction"})}return{changes:i}},"he"),ct=o(t=>Object.entries(t.fields).map(([e,i])=>({name:e,optional:i.optional,ref:Object.values(t.relations).find(r=>r.field===e&&r.kind==="one")?.table,type:j(i)})),"H"),mt=o((t,e,i)=>{let r={},a=e?.fields??{},c=i?.fields??{};for(let[n,s]of Object.entries(c)){let u=a[n];u===void 0?r[n]=e===void 0?"unchanged":"added":r[n]=ht(t,n,u,s).length===0?"unchanged":"changed"}for(let n of Object.keys(a))c[n]===void 0&&(r[n]="removed");return r},"Q"),Kt=o((t,e)=>{let{changes:i}=Rt(t,e),r=new Set(i.filter(n=>n.scope==="table"&&n.table!==void 0).map(n=>n.table)),a=[],c=o((n,s)=>n?"added":r.has(s)?"changed":"context","o");for(let[n,s]of Object.entries(e.tables)){let u=t?.tables[n],b=c(u===void 0,n);a.push({columns:ct(s),fieldStatus:mt(n,u,s),name:n,shardMode:s.shardMode,status:b})}for(let[n,s]of Object.entries(t?.tables??{}))e.tables[n]===void 0&&a.push({columns:ct(s),fieldStatus:mt(n,s,void 0),name:n,shardMode:s.shardMode,status:"removed"});return a.sort((n,s)=>n.name.localeCompare(s.name)),{breakingCount:i.filter(n=>n.severity==="breaking").length,changes:i,tables:a}},"pe"),ut=o(t=>{let e=$t(t);return e.status==="ok"?e.snapshot:void 0},"L"),Tt={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Dt=o(t=>t==="global"?"global":"shard","be"),Lt=o(t=>{let e=(0,he.c)(24),{appliedAt:i,hash:r,onSelect:a,selected:c,seq:n}=t,s=c?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground",u;e[0]!==s?(u=se("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",s),e[0]=s,e[1]=u):u=e[1];let b=`sh-version-${r}`,h;e[2]!==r||e[3]!==a?(h=o(()=>{a(r)},"h"),e[2]=r,e[3]=a,e[4]=h):h=e[4];let v;e[5]!==n?(v=(0,d.jsxs)("span",{className:"font-mono text-[13px] tabular-nums",children:["v",n]}),e[5]=n,e[6]=v):v=e[6];let p;e[7]!==r?(p=r.slice(0,7),e[7]=r,e[8]=p):p=e[8];let g;e[9]!==p?(g=(0,d.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:p}),e[9]=p,e[10]=g):g=e[10];let f;e[11]!==v||e[12]!==g?(f=(0,d.jsxs)("span",{className:"flex w-full items-baseline gap-2",children:[v,g]}),e[11]=v,e[12]=g,e[13]=f):f=e[13];let y;e[14]!==i?(y=Ne(i),e[14]=i,e[15]=y):y=e[15];let x;e[16]!==y?(x=(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:y}),e[16]=y,e[17]=x):x=e[17];let m;return e[18]!==x||e[19]!==u||e[20]!==b||e[21]!==h||e[22]!==f?(m=(0,d.jsx)("li",{children:(0,d.jsxs)("button",{className:u,"data-testid":b,onClick:h,type:"button",children:[f,x]})}),e[18]=x,e[19]=u,e[20]=b,e[21]=h,e[22]=f,e[23]=m):m=e[23],m},"ve"),_t=o(t=>{let e=(0,he.c)(26),{breaking:i,count:r,first:a}=t,c=de();if(a){let g;e[0]!==r?(g=(0,d.jsx)("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:r}),e[0]=r,e[1]=g):g=e[1];let f;e[2]!==c?(f=c("tables"),e[2]=c,e[3]=f):f=e[3];let y;e[4]!==f?(y=(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[4]=f,e[5]=y):y=e[5];let x;return e[6]!==g||e[7]!==y?(x=(0,d.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[g,y]}),e[6]=g,e[7]=y,e[8]=x):x=e[8],x}let n=i>0&&"text-destructive",s;e[9]!==n?(s=se("text-3xl leading-none font-light tracking-tight tabular-nums",n),e[9]=n,e[10]=s):s=e[10];let u;e[11]!==r||e[12]!==s?(u=(0,d.jsx)("span",{className:s,children:r}),e[11]=r,e[12]=s,e[13]=u):u=e[13];let b;e[14]!==r||e[15]!==c?(b=c(r===1?"change":"changes"),e[14]=r,e[15]=c,e[16]=b):b=e[16];let h;e[17]!==b?(h=(0,d.jsx)("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:b}),e[17]=b,e[18]=h):h=e[18];let v;e[19]!==i||e[20]!==c?(v=i>0&&(0,d.jsxs)("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["\xB7 ",c("{count} breaking",{count:i})]}),e[19]=i,e[20]=c,e[21]=v):v=e[21];let p;return e[22]!==u||e[23]!==h||e[24]!==v?(p=(0,d.jsxs)("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[u,h,v]}),e[22]=u,e[23]=h,e[24]=v,e[25]=p):p=e[25],p},"xe"),pt={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedShardMode:{action:"changed",kind:"shard mode"},fieldOptionalToRequired:{action:"changed",kind:"field \u2192 required"},fieldRequiredToOptional:{action:"changed",kind:"field \u2192 optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field \u2192 wider"}},Et=o((t,e)=>{let i=`${pt[t.type].action} ${e} `;return t.summary.startsWith(i)?t.summary.slice(i.length):t.summary},"ye"),Jt=o(t=>{let e=new Map;for(let r of t){let a=r.table??"",c=e.get(a);c===void 0?e.set(a,[r]):c.push(r)}let i=[...e].map(([r,a])=>({changes:a,table:r}));return[...i.filter(r=>r.table!==""),...i.filter(r=>r.table==="")]},"ke"),At=o(t=>{let e=(0,he.c)(2),{children:i}=t,r;return e[0]!==i?(r=(0,d.jsx)("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:i}),e[0]=i,e[1]=r):r=e[1],r},"$e"),Bt=o(({pane:t,shardKey:e=""})=>{let i=de(),r=Ae(),a=Je({strict:!1}).version,c=o(m=>{$e(r({search:{version:m},to:"/migrations"}))},"a"),n=le(R.schemaHistory,{},{shardKey:e}),s=n.data?.versions??[],u=a!==void 0&&s.some(m=>m.hash===a)?a:s[0]?.hash,b=s.findIndex(m=>m.hash===u),h=b===-1?void 0:s[b+1]?.hash,v=le(R.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),p=le(R.schemaVersion,{hash:h??""},{enabled:h!==void 0,shardKey:e}),g=(0,me.useMemo)(()=>{let m=ut(v.data?.version?.snapshotJson);if(m!==void 0)return Kt(ut(p.data?.version?.snapshotJson),m)},[v.data,p.data]),f=(0,me.useMemo)(()=>(g?.tables??[]).map(m=>({columns:m.columns,name:m.name,tier:Dt(m.shardMode)})),[g]),y=(0,me.useMemo)(()=>{let m={};for(let w of g?.tables??[])m[w.name]=Tt[w.status];return m},[g]);if(n.error!==null)return(0,d.jsx)(Se,{error:n.errorSource,testId:"sh-error"});if(s.length===0)return(0,d.jsx)(we,{description:i("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:i("No schema versions recorded yet.")});let x=g?.changes??[];return(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[(0,d.jsxs)("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[(0,d.jsx)(At,{children:i("Schema versions")}),(0,d.jsx)("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:s.map(m=>(0,d.jsx)(Lt,{appliedAt:m.appliedAt,hash:m.hash,onSelect:c,selected:m.hash===u,seq:m.seq},m.hash))})]}),(0,d.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[(0,d.jsx)(_t,{breaking:g?.breakingCount??0,count:h===void 0?f.length:x.length,first:h===void 0}),t==="diagram"?(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:(0,d.jsx)(it,{fill:!0,nodeClasses:y,tables:f,testIdPrefix:"sh"})}):(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:Jt(x).map(m=>{let w=(g?.tables??[]).find(k=>k.name===m.table);return(0,d.jsxs)("section",{className:"mb-6",children:[(0,d.jsxs)("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[(0,d.jsx)("span",{className:"font-mono text-[13px] text-foreground",children:m.table===""?i("schema"):m.table}),w!==void 0&&(0,d.jsx)("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:i("{count} columns",{count:w.columns.length})}),m.changes.length>1&&(0,d.jsx)("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:m.changes.length})]}),(0,d.jsx)("ul",{children:m.changes.map(k=>{let{action:K,kind:I}=pt[k.type],O=k.severity==="breaking",F=Et(k,I);return(0,d.jsxs)("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[(0,d.jsx)("span",{"aria-hidden":"true",className:se("-ms-3 h-3 w-0.5 shrink-0 self-center",O?"bg-destructive":"bg-transparent")}),(0,d.jsxs)("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[i(K)," ",I]}),F!==m.table&&(0,d.jsx)("span",{className:se("min-w-0 font-mono text-[13px]",O?"text-destructive":"text-foreground"),children:F}),O&&(0,d.jsx)("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:i("breaking")})]},`${k.type}-${k.summary}`)})})]},m.table)})})]})]})},"we"),Pt=o(t=>se("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),"Se"),ya=o(t=>{let e=(0,he.c)(11),{initialShardKey:i}=t,r=de(),[a,c]=(0,me.useState)("diagram"),n;e[0]!==a?(n=o((v,p,g,f)=>(0,d.jsxs)("button",{"aria-selected":a===v,className:Pt(a===v),"data-testid":g,onClick:o(()=>{c(v)},"onClick"),role:"tab",type:"button",children:[p,f!==void 0&&(0,d.jsx)("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:f})]}),"a"),e[0]=a,e[1]=n):n=e[1];let s=n,u;e[2]!==r||e[3]!==s?(u=(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[s("diagram",r("Diagram"),"mg-pane-diagram"),s("changes",r("Changes"),"mg-pane-changes"),s("data",r("Data migrations"),"mg-pane-data")]}),e[2]=r,e[3]=s,e[4]=u):u=e[4];let b;e[5]!==i||e[6]!==a?(b=(0,d.jsx)("div",{className:"flex min-h-0 flex-1 flex-col",children:a==="data"?(0,d.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:(0,d.jsx)(ot,{initialShardKey:i})}):(0,d.jsx)(Bt,{pane:a,shardKey:i})}),e[5]=i,e[6]=a,e[7]=b):b=e[7];let h;return e[8]!==u||e[9]!==b?(h=(0,d.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[u,b]}),e[8]=u,e[9]=b,e[10]=h):h=e[10],h},"Je");export{ya as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ve}from"./chunk-UDCVU3Z5.js";import"./chunk-I52I2DJG.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-D27D4UUI.js";import{a as Ge}from"./chunk-SU737V7V.js";import{P as je}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as de}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as Pe}from"./chunk-F7UZBTKS.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-D6UKRXIS.js";import{f as We}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as ue}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ie,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,ut=ie(F.sendQueueMessage),it=ie(F.replayQueueMessage),ct=ie(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ue,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,u,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=u,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],u=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==u||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,u,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=u,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let u;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=u):u=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==u||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,m]}),e[17]=c,e[18]=u,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,u=$(),m;e[0]!==u?(m=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==u?(g=x.length===0?(0,t.jsx)(ue,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:u("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:u(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=u,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:u}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:u,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await d.query(ut,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async i=>{c(null),Re(i);try{await d.query(it,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(i){c(me(i))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{z(i.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{D(i.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{M(i.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{Ye(i.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(le,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:gt(i,s)},i))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
|
|
1
|
+
import{a as Ve}from"./chunk-2URQKGWU.js";import"./chunk-4JLGLPWV.js";import{a as He}from"./chunk-EA2JKR5D.js";import{a as Ke}from"./chunk-66UGPQVC.js";import"./chunk-3Q2P62UR.js";import{a as Ge}from"./chunk-PD6WIDY6.js";import{W as je}from"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import{a as le}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import{b as de}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as Pe}from"./chunk-F7UZBTKS.js";import{a as Ue}from"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as F}from"./chunk-4ZEL6BYL.js";import{c as Me}from"./chunk-D6UKRXIS.js";import{f as We}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as ue}from"./chunk-FKVZRPV5.js";import{a as _e,b as Be,c as ke,d as G,e as C,f as w}from"./chunk-HEAQVSNS.js";import{a as Te,e as De}from"./chunk-WUWBZPUK.js";import{d as $,f as ie,g as ce,h as me,o as he,r as ze}from"./chunk-FODLDLE2.js";import{a as h,d as Ee,e as rt,f as nt,g as ot}from"./chunk-YKXDMIHQ.js";var W=Ee(nt(),1);var A=Ee(rt(),1);var t=Ee(ot(),1);var dt=h((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),l=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),d=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:d,queuesWithoutDlq:l,showReliabilityWarning:l.length>0||d>0}},"rt"),lt=200,ut=ie(F.sendQueueMessage),it=ie(F.replayQueueMessage),ct=ie(F.clearQueueMessages),Xe=96,mt=h(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n)}catch{return"[unserializable]"}},"it"),ht=h(n=>n.length>Xe?`${n.slice(0,Xe)}\u2026`:n,"ct"),pt=h(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","ut"),gt=h((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"mt"),ft=h(n=>{let e=(0,W.c)(11),{loaded:a,queues:l}=n,d=$(),s;e[0]!==d?(s=d("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[0]=d,e[1]=s):s=e[1];let o;e[2]!==s?(o=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let r;e[4]!==a||e[5]!==l||e[6]!==d?(r=a&&l.length===0?(0,t.jsx)(ue,{description:d("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:d("No queues defined")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsxs)(_e,{"data-testid":"queues-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:d("Export")}),(0,t.jsx)(C,{children:d("Queue")}),(0,t.jsx)(C,{children:d("Mode")}),(0,t.jsx)(C,{children:d("Binding")}),(0,t.jsx)(C,{children:d("Dead-letter")})]})}),(0,t.jsx)(ke,{children:l.map(bt)})]})})}),e[4]=a,e[5]=l,e[6]=d,e[7]=r):r=e[7];let p;return e[8]!==o||e[9]!==r?(p=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[o,r]}),e[8]=o,e[9]=r,e[10]=p):p=e[10],p},"ft"),xt=h(n=>{let e=(0,W.c)(67),{message:a,onReplay:l,replayingId:d}=n,s=$(),o,r,p,c,x,N,y,u,m,f;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let j=mt(a.body);r=G,N=`queues-message-${a.id}`;let z=a.exportName??a.queue;e[19]!==z?(y=(0,t.jsx)(w,{className:"font-mono text-xs",children:z}),e[19]=z,e[20]=y):y=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(m=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=m):m=e[24];let T=`queues-outcome-${a.id}`,D;e[25]!==a.outcome?(D=pt(a.outcome),e[25]=a.outcome,e[26]=D):D=e[26];let I;e[27]!==a.outcome||e[28]!==T||e[29]!==D?(I=(0,t.jsx)(de,{"data-testid":T,variant:D,children:a.outcome}),e[27]=a.outcome,e[28]=T,e[29]=D,e[30]=I):I=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==I||e[36]!==M?(f=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,M]})}),e[35]=I,e[36]=M,e[37]=f):f=e[37],o=w,p="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=j,x=ht(j),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=o,e[10]=r,e[11]=p,e[12]=c,e[13]=x,e[14]=N,e[15]=y,e[16]=u,e[17]=m,e[18]=f}else o=e[9],r=e[10],p=e[11],c=e[12],x=e[13],N=e[14],y=e[15],u=e[16],m=e[17],f=e[18];let g;e[38]!==o||e[39]!==p||e[40]!==c||e[41]!==x?(g=(0,t.jsx)(o,{className:p,title:c,children:x}),e[38]=o,e[39]=p,e[40]=c,e[41]=x,e[42]=g):g=e[42];let q;e[43]!==a.capturedAt?(q=ze(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let S=`queues-replay-${a.id}`,E=d!==null,Q;e[47]!==a.id||e[48]!==d||e[49]!==s?(Q=d===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=d,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==l||e[53]!==S||e[54]!==E||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":S,disabled:E,onClick:l,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=l,e[53]=S,e[54]=E,e[55]=Q,e[56]=L):L=e[56];let _;return e[57]!==r||e[58]!==b||e[59]!==L||e[60]!==N||e[61]!==y||e[62]!==u||e[63]!==m||e[64]!==f||e[65]!==g?(_=(0,t.jsxs)(r,{"data-testid":N,children:[y,u,m,f,g,b,L]}),e[57]=r,e[58]=b,e[59]=L,e[60]=N,e[61]=y,e[62]=u,e[63]=m,e[64]=f,e[65]=g,e[66]=_):_=e[66],_},"ht"),yt=h(n=>{let e=(0,W.c)(30),{hasError:a,messages:l,onClear:d,onReplay:s,replayingId:o}=n,r=$(),p;e[0]!==r?(p=r("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=r,e[1]=p):p=e[1];let c;e[2]!==p?(c=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=c):c=e[3];let x;e[4]!==l.length||e[5]!==r?(x=r("Clear {count} messages?",{count:l.length}),e[4]=l.length,e[5]=r,e[6]=x):x=e[6];let N=l.length===0,y;e[7]!==r?(y=r("Clear log"),e[7]=r,e[8]=y):y=e[8];let u;e[9]!==d||e[10]!==x||e[11]!==N||e[12]!==y?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ge,{confirmLabel:x,disabled:N,onConfirm:d,testId:"queues-clear",children:y})}),e[9]=d,e[10]=x,e[11]=N,e[12]=y,e[13]=u):u=e[13];let m;e[14]!==l.length||e[15]!==r?(m=l.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:r("{count} messages",{count:l.length})}),e[14]=l.length,e[15]=r,e[16]=m):m=e[16];let f;e[17]!==c||e[18]!==u||e[19]!==m?(f=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,m]}),e[17]=c,e[18]=u,e[19]=m,e[20]=f):f=e[20];let g;e[21]!==a||e[22]!==l||e[23]!==s||e[24]!==o||e[25]!==r?(g=!a&&l.length===0?(0,t.jsx)(ue,{description:r("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:r("No consumed messages yet.")}):(0,t.jsx)(Te,{className:"overflow-hidden py-0",children:(0,t.jsx)(De,{className:"px-0",children:(0,t.jsx)(Ve,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(_e,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Be,{children:(0,t.jsxs)(G,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Message")}),(0,t.jsx)(C,{children:r("Attempts")}),(0,t.jsx)(C,{children:r("Outcome")}),(0,t.jsx)(C,{children:r("Body")}),(0,t.jsx)(C,{children:r("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(ke,{children:l.map(b=>(0,t.jsx)(xt,{message:b,onReplay:s,replayingId:o},b.id))})]})})})}),e[21]=a,e[22]=l,e[23]=s,e[24]=o,e[25]=r,e[26]=g):g=e[26];let q;return e[27]!==f||e[28]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[f,g]}),e[27]=f,e[28]=g,e[29]=q):q=e[29],q},"pt"),Nt=h(n=>{let e=(0,W.c)(20),{batchMode:a,bodyText:l,delayText:d,onBatchModeChange:s,onBodyChange:o,onDelayChange:r,onSelectExport:p,onSend:c,queues:x,selectedExportName:N,sending:y}=n,u=$(),m;e[0]!==u?(m=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=m):m=e[1];let f;e[2]!==m?(f=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=f):f=e[3];let g;e[4]!==a||e[5]!==l||e[6]!==d||e[7]!==s||e[8]!==o||e[9]!==r||e[10]!==p||e[11]!==c||e[12]!==x||e[13]!==N||e[14]!==y||e[15]!==u?(g=x.length===0?(0,t.jsx)(ue,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:p,value:N,children:x.map(qt)}),(0,t.jsx)(je,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:r,placeholder:u("Delay (s)"),type:"number",value:d}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:y||N==="",onClick:c,type:"button",children:u(y?"Sending\u2026":"Send message")})]}),(0,t.jsx)(He,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:l})]}),e[4]=a,e[5]=l,e[6]=d,e[7]=s,e[8]=o,e[9]=r,e[10]=p,e[11]=c,e[12]=x,e[13]=N,e[14]=y,e[15]=u,e[16]=g):g=e[16];let q;return e[17]!==f||e[18]!==g?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[f,g]}),e[17]=f,e[18]=g,e[19]=q):q=e[19],q},"gt"),Ft=h(n=>{let e=(0,W.c)(59),{limit:a}=n,l=a??lt,d=We(),s=$(),[o,r]=(0,A.useState)("declared"),[p,c]=(0,A.useState)(null),x;e[0]===Symbol.for("react.memo_cache_sentinel")?(x={},e[0]=x):x=e[0];let{data:N,error:y,errorSource:u}=Me(F.listQueues,x),m;e[1]!==l?(m={limit:l},e[1]=l,e[2]=m):m=e[2];let{data:f,error:g,errorSource:q,refetch:b}=Me(F.getQueueMessages,m),S=Array.isArray(N?.queues)?[...N.queues].toSorted(vt):[],E=f?.entries??[],{deadLetteredCount:Q,queuesWithoutDlq:L,showReliabilityWarning:_}=dt(S,E),[j,z]=(0,A.useState)(""),[T,D]=(0,A.useState)(""),[I,M]=(0,A.useState)(""),[U,Ye]=(0,A.useState)(!1),[pe,Oe]=(0,A.useState)(!1),[ge,Re]=(0,A.useState)(null),H=S.some(i=>i.exportName===j)?j:S[0]?.exportName??"",Je=o==="messages"?g:y,Ze=o==="messages"?q:u,fe=Je??p,xe=Je===null?p:Ze,K;e[3]!==b?(K=h(()=>{b()},"H"),e[3]=b,e[4]=K):K=e[4],Ke(K,o==="messages");let ye=h(async()=>{c(null);let i=H;if(i==="")return;let v=null,$e=T.trim();if($e!=="")try{v=JSON.parse($e)}catch{c(s("Body must be valid JSON."));return}let Ae,Fe=I.trim();if(Fe!==""){let P=Number(Fe);if(!Number.isFinite(P)||P<0){c(s("Delay must be a non-negative number of seconds."));return}Ae=P}if(U&&!Array.isArray(v)){c(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}Oe(!0);let st=U?{batch:v,delaySeconds:Ae,exportName:i}:{body:v,delaySeconds:Ae,exportName:i};try{await d.query(ut,st,ce("")),b()}catch(P){c(me(P))}Oe(!1)},"ue"),V;e[5]!==d||e[6]!==b?(V=h(async i=>{c(null),Re(i);try{await d.query(it,{id:i},ce("")),b()}catch(v){c(me(v))}Re(null)},"V"),e[5]=d,e[6]=b,e[7]=V):V=e[7];let Ne=V,X;e[8]!==d||e[9]!==b?(X=h(async()=>{c(null);try{await d.query(ct,{},ce("")),b()}catch(i){c(me(i))}},"Y"),e[8]=d,e[9]=b,e[10]=X):X=e[10];let be=X,Y;e[11]===Symbol.for("react.memo_cache_sentinel")?(Y=h(i=>{let v=i.currentTarget.dataset.tab;(v==="declared"||v==="messages"||v==="send")&&r(v)},"X"),e[11]=Y):Y=e[11];let et=Y,Z;e[12]===Symbol.for("react.memo_cache_sentinel")?(Z=h(i=>{z(i.currentTarget.value)},"K"),e[12]=Z):Z=e[12];let qe=Z,ee;e[13]===Symbol.for("react.memo_cache_sentinel")?(ee=h(i=>{D(i.currentTarget.value)},"Z"),e[13]=ee):ee=e[13];let ve=ee,te;e[14]===Symbol.for("react.memo_cache_sentinel")?(te=h(i=>{M(i.currentTarget.value)},"ee"),e[14]=te):te=e[14];let Se=te,ae;e[15]===Symbol.for("react.memo_cache_sentinel")?(ae=h(i=>{Ye(i.currentTarget.checked)},"te"),e[15]=ae):ae=e[15];let Ce=ae,se;e[16]!==ye?(se=h(()=>{he(ye())},"se"),e[16]=ye,e[17]=se):se=e[17];let we=se,re;e[18]!==Ne?(re=h(i=>{let{id:v}=i.currentTarget.dataset;v!==void 0&&he(Ne(v))},"ae"),e[18]=Ne,e[19]=re):re=e[19];let Ie=re,ne;e[20]!==be?(ne=h(()=>{he(be())},"re"),e[20]=be,e[21]=ne):ne=e[21];let Qe=ne,tt="flex flex-col gap-6",at="lunora-queues-panel",B;e[22]!==s||e[23]!==o?(B=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(i=>(0,t.jsx)(le,{"aria-selected":o===i,"data-tab":i,"data-testid":`queues-tab-${i}`,onClick:et,role:"tab",size:"sm",type:"button",variant:o===i?"secondary":"ghost",children:gt(i,s)},i))}),e[22]=s,e[23]=o,e[24]=B):B=e[24];let k;e[25]!==fe||e[26]!==xe?(k=fe!==null&&(0,t.jsx)(Pe,{error:xe,testId:"queues-error"}),e[25]=fe,e[26]=xe,e[27]=k):k=e[27];let Le=_&&(0,t.jsx)(Ue,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[L.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:L.map(St).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),Q>0&&(0,t.jsx)("p",{className:L.length>0?"text-muted-foreground":"font-medium",children:Q===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:Q})})]})}),O;e[28]!==S||e[29]!==N||e[30]!==o?(O=o==="declared"&&(0,t.jsx)(ft,{loaded:N!==void 0,queues:S}),e[28]=S,e[29]=N,e[30]=o,e[31]=O):O=e[31];let R;e[32]!==E||e[33]!==g||e[34]!==Qe||e[35]!==Ie||e[36]!==ge||e[37]!==o?(R=o==="messages"&&(0,t.jsx)(yt,{hasError:g!==null,messages:E,onClear:Qe,onReplay:Ie,replayingId:ge}),e[32]=E,e[33]=g,e[34]=Qe,e[35]=Ie,e[36]=ge,e[37]=o,e[38]=R):R=e[38];let J;e[39]!==U||e[40]!==T||e[41]!==I||e[42]!==Ce||e[43]!==ve||e[44]!==Se||e[45]!==qe||e[46]!==we||e[47]!==S||e[48]!==H||e[49]!==pe||e[50]!==o?(J=o==="send"&&(0,t.jsx)(Nt,{batchMode:U,bodyText:T,delayText:I,onBatchModeChange:Ce,onBodyChange:ve,onDelayChange:Se,onSelectExport:qe,onSend:we,queues:S,selectedExportName:H,sending:pe}),e[39]=U,e[40]=T,e[41]=I,e[42]=Ce,e[43]=ve,e[44]=Se,e[45]=qe,e[46]=we,e[47]=S,e[48]=H,e[49]=pe,e[50]=o,e[51]=J):J=e[51];let oe;return e[52]!==B||e[53]!==k||e[54]!==Le||e[55]!==O||e[56]!==R||e[57]!==J?(oe=(0,t.jsxs)("div",{className:tt,"data-testid":at,children:[B,k,Le,O,R,J]}),e[52]=B,e[53]=k,e[54]=Le,e[55]=O,e[56]=R,e[57]=J,e[58]=oe):oe=e[58],oe},"Ft");function bt(n){return(0,t.jsxs)(G,{"data-testid":`queues-row-${n.exportName}`,children:[(0,t.jsx)(w,{className:"font-mono text-xs",children:n.exportName}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.name}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.mode}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.binding}),(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:n.deadLetterQueue??"\u2014"})]},n.exportName)}h(bt,"xt");function qt(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}h(qt,"yt");function vt(n,e){return n.exportName.localeCompare(e.exportName)}h(vt,"bt");function St(n){return n.name}h(St,"Nt");export{Ft as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as T}from"./chunk-PLHA3OWK.js";import{a as S,c as w,e as _}from"./chunk-AAVLPU5Q.js";import{d as W}from"./chunk-225VJ77I.js";import{a as s,d as N,e as F,g as X}from"./chunk-YKXDMIHQ.js";var L=N(F(),1);var D=N(F(),1);var A=D.createContext({register:s(()=>{},"register"),unregister:s(()=>{},"unregister"),subscribeMapChange:s(()=>()=>{},"subscribeMapChange"),nextIndexRef:{current:0}});function j(){return D.useContext(A)}s(j,"useCompositeListContext");function ne(n={}){let{guess:t,label:e,metadata:i,textRef:u,index:r}=n,{register:a,unregister:f,subscribeMapChange:m,nextIndexRef:C}=j(),l=L.useRef(-1),[b,g]=L.useState(r==null&&t?()=>{if(l.current===-1){let p=C.current;C.current+=1,l.current=p}return l.current}:-1),M=r??b,E=L.useRef(null),y=L.useCallback(p=>{let v=E.current;v&&f(v),E.current=p,p&&a(p,{metadata:i??null,index:r??null,label:e,textRef:u})},[r,a,f,i,e,u]);return S(()=>{if(r==null)return m(p=>{let v=E.current?p.get(E.current)?.index:null;v!=null&&g(v)})},[r,m]),{ref:y,index:M}}s(ne,"useCompositeListItem");var R=N(F(),1);var k=N(X(),1);function ae(n){let{children:t,elementsRef:e,labelsRef:i,onMapChange:u}=n,r=w(u),[,a]=R.useState(!1),f=W(G).current,m=W(z).current,C=R.useRef(0),l=R.useRef(!0),b=R.useRef(null),g=R.useRef(null),M=w(()=>{l.current||(l.current=!0,a(o=>!o))}),E=w((o,h)=>{m.set(o,h),M()}),y=w(o=>{m.delete(o),M()}),p=w(o=>{let h=new Map;return e.current.length=0,i&&(i.current.length=0),o.forEach(c=>{h.set(c.element,{...c.registration.metadata??{},index:c.index}),e.current[c.index]=c.element,i&&(i.current[c.index]=c.registration.label!==void 0?c.registration.label:c.registration.textRef?.current?.textContent??c.element.textContent)}),C.current=e.current.length,h});function v(o){if(g.current?.disconnect(),g.current=null,typeof MutationObserver!="function"||o.length<2)return;let h=new MutationObserver(d=>{if(!K(d))return;let I=null;for(let x of o)if(x.isConnected){if(I&&H(I,x)>0){h.disconnect(),M();return}I=x}});g.current=h;let c=new Set;for(let d=1;d<o.length;d+=1){let I=J(o[d-1],o[d]);I&&c.add(I)}c.forEach(d=>h.observe(d,{childList:!0}))}s(v,"observe");let U=w(()=>{let[o,h]=q(m),c=p(o),d=b.current,I=!d||d.length!==o.length||o.some((x,V)=>{let O=d[V];return x.index!==O.index||x.element!==O.element||x.registration.index!==O.registration.index||x.registration.metadata!==O.registration.metadata});v(h),b.current=o,l.current=!1,I&&(f.forEach(x=>x(c)),r(c))});S(()=>(!l.current&&b.current&&p(b.current),()=>{e.current=[],i&&(i.current=[])}),[e,i,p]),S(()=>{l.current&&U()}),S(()=>()=>{g.current?.disconnect(),l.current=!0},[]);let B=w(o=>(f.add(o),()=>{f.delete(o)})),Y=R.useMemo(()=>({register:E,unregister:y,subscribeMapChange:B,nextIndexRef:C}),[E,y,B,C]);return(0,k.jsx)(A.Provider,{value:Y,children:t})}s(ae,"CompositeList");function z(){return new Map}s(z,"createMap");function G(){return new Set}s(G,"createListeners");function q(n){let t=new Set,e=[],i=[];n.forEach((r,a)=>{if(!a.isConnected)return;let f=r.index,m={index:f??-1,element:a,registration:r};f===null?i.push(m):f>=0&&(t.add(f),e.push(m))});let u=0;return i.sort((r,a)=>H(r.element,a.element)),i.forEach(r=>{for(;t.has(u);)u+=1;r.index=u,e.push(r),u+=1}),t.size>0&&e.sort((r,a)=>r.index-a.index),[e,i.map(r=>r.element)]}s(q,"getCompositeListSnapshot");function J(n,t){let e=n.parentElement;for(;e&&!e.contains(t);)e=e.parentElement;return e}s(J,"getCommonAncestor");function K(n){for(let t of n)for(let e=0;e<t.removedNodes.length;e+=1)if(t.removedNodes[e].isConnected)return!0;return!1}s(K,"hasMovedNode");function H(n,t){return n.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}s(H,"sortByDocumentPosition");var P=5;function pe(n,t){let e=Q(t);return n.clientX>=e.left-P&&n.clientX<=e.right+P&&n.clientY>=e.top-P&&n.clientY<=e.bottom+P}s(pe,"isMouseWithinBounds");function Q(n){let t=n.getBoundingClientRect(),e=_(n);if(T.env.jsdom)return t;let i=e.getComputedStyle(n,"::before"),u=e.getComputedStyle(n,"::after");if(!(i.content!=="none"||u.content!=="none"))return t;let a=parseFloat(i.width)||0,f=parseFloat(i.height)||0,m=parseFloat(u.width)||0,C=parseFloat(u.height)||0,l=Math.max(t.width,a,m),b=Math.max(t.height,f,C),g=l-t.width,M=b-t.height;return{left:t.left-g/2,right:t.right+g/2,top:t.top-M/2,bottom:t.bottom+M/2}}s(Q,"getPseudoElementBounds");function ge(n){return n==null||n.hasAttribute("disabled")||n.getAttribute("aria-disabled")==="true"}s(ge,"isElementDisabled");export{ne as a,ae as b,pe as c,ge as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as v,e as U}from"./chunk-YKXDMIHQ.js";var q=[["path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],a=q;var H=[["path",{d:"M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],o=H;var W=[["path",{d:"M18 6L6.00081 17.9992M17.9992 18L6 6.00085",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],r=W;var O=[["path",{d:"M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],s=O;var E=[["path",{d:"M2 12C2 8.31087 2 6.4663 2.81382 5.15877C3.1149 4.67502 3.48891 4.25427 3.91891 3.91554C5.08116 3 6.72077 3 10 3H14C17.2792 3 18.9188 3 20.0811 3.91554C20.5111 4.25427 20.8851 4.67502 21.1862 5.15877C22 6.4663 22 8.31087 22 12C22 15.6891 22 17.5337 21.1862 18.8412C20.8851 19.325 20.5111 19.7457 20.0811 20.0845C18.9188 21 17.2792 21 14 21H10C6.72077 21 5.08116 21 3.91891 20.0845C3.48891 19.7457 3.1149 19.325 2.81382 18.8412C2 17.5337 2 15.6891 2 12Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M9.5 3L9.5 21",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M5 7H6M5 10H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}]],m=E;var G=[["path",{d:"M5 14L8.5 17.5L19 6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]],S=G;var V=[["path",{d:"M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],h=V;var N=[["path",{d:"M7.5 14.5C7.5 11.2002 7.5 9.55025 8.52513 8.52513C9.55025 7.5 11.2002 7.5 14.5 7.5C17.7998 7.5 19.4497 7.5 20.4749 8.52513C21.5 9.55025 21.5 11.2002 21.5 14.5C21.5 17.7998 21.5 19.4497 20.4749 20.4749C19.4497 21.5 17.7998 21.5 14.5 21.5C11.2002 21.5 9.55025 21.5 8.52513 20.4749C7.5 19.4497 7.5 17.7998 7.5 14.5Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M7.5 16.5C6.10355 16.5 5.40533 16.5 4.84402 16.3036C3.83866 15.9518 3.0482 15.1613 2.69641 14.156C2.5 13.5947 2.5 12.8964 2.5 11.5V9.5C2.5 6.20017 2.5 4.55025 3.52513 3.52513C4.55025 2.5 6.20017 2.5 9.5 2.5H11.5C12.8964 2.5 13.5947 2.5 14.156 2.69641C15.1613 3.0482 15.9518 3.83866 16.3036 4.84402C16.5 5.40533 16.5 6.10355 16.5 7.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],e=N;var z=[["path",{d:"M17 17L21 21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],f=z;var K=[["path",{d:"M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M11.4999 12.5L14.9999 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]],k=K;var n=v(U(),1),Z={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none"},A=(0,n.forwardRef)(({color:u="currentColor",size:d=24,strokeWidth:c,absoluteStrokeWidth:M=!1,className:w="",altIcon:F,showAlt:B=!1,icon:P,primaryColor:I,secondaryColor:i,disableSecondaryOpacity:L=!1,...T},D)=>{let x=c!==void 0?M?Number(c)*24/Number(d):c:void 0,C=x!==void 0?{strokeWidth:x,stroke:"currentColor"}:{},R={ref:D,...Z,width:d,height:d,color:I||u,className:w,...C,...T},y=[...B&&F?F:P].sort(([,p],[,t])=>{let l=p.opacity!==void 0;return t.opacity!==void 0?1:l?-1:0}).map(([p,t])=>{let l=t.opacity!==void 0,g=l&&!L?t.opacity:void 0,b=i?{...t.stroke!==void 0?{stroke:l?i:I||u}:{fill:l?i:I||u}}:{};return(0,n.createElement)(p,{...t,...C,...b,opacity:g,key:t.key})});return(0,n.createElement)("svg",R,y)});A.displayName="HugeiconsIcon";export{a,o as b,r as c,e as d,s as e,f,k as g,m as h,S as i,h as j,A as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as J}from"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as z}from"./chunk-D6UKRXIS.js";import"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as E}from"./chunk-FKVZRPV5.js";import{a as G,b as M,c as U,d as P,e as d,f as c}from"./chunk-HEAQVSNS.js";import{a as D,e as _}from"./chunk-WUWBZPUK.js";import{d as q}from"./chunk-FODLDLE2.js";import{a as S,d as O,f as Q,g as V}from"./chunk-YKXDMIHQ.js";var L=O(Q(),1);var r=O(V(),1);var K=["read","insert","update","delete"],B=S((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"z"),W=S(e=>{let s=new Map;for(let a of e){let t=s.get(a.table)??{operations:new Set,procedures:new Set,table:a.table};t.operations.add(a.on),t.procedures.add(a.procedure),s.set(a.table,t)}return[...s.values()].toSorted((a,t)=>a.table.localeCompare(t.table))},"J"),ie=S(()=>{let e=(0,L.c)(49),s=q(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:t,error:R,errorSource:k}=z(H.rlsPolicies,a),p=t!==void 0,m,n,h,l,f,u,x,b,o;if(e[1]!==t||e[2]!==R||e[3]!==k||e[4]!==p||e[5]!==s){let $=W(Array.isArray(t?.policies)?t.policies:[]),j;e[15]!==t?(j=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=j):j=e[16],n=j,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==R||e[18]!==k?(o=R!==null&&(0,r.jsx)(J,{error:k,testId:"rls-error"}),e[17]=R,e[18]=k,e[19]=o):o=e[19],u="flex flex-col gap-2",m=D,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(l=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=l):l=e[23],f=p&&$.length===0?(0,r.jsx)(E,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),K.map(i=>(0,r.jsx)(d,{children:B(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)(U,{children:$.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),K.map(F=>(0,r.jsx)(c,{children:i.operations.has(F)?(0,r.jsx)(C,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},F)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:[...i.procedures].join(", ")})]},i.table))})]})}),e[1]=t,e[2]=R,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=l,e[10]=f,e[11]=u,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],l=e[9],f=e[10],u=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==l||e[27]!==f?(N=(0,r.jsxs)(m,{className:h,children:[l,f]}),e[24]=m,e[25]=h,e[26]=l,e[27]=f,e[28]=N):N=e[28];let g;e[29]!==u||e[30]!==N?(g=(0,r.jsx)("section",{className:u,children:N}),e[29]=u,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(E,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)(U,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let T;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(T=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=T):T=e[48],T},"oe");function X(e){return(0,r.jsx)(C,{variant:"outline",children:e},e)}S(X,"K");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}S(Y,"V");export{ie as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as tt}from"./chunk-K7AJEMKE.js";import{e as Be}from"./chunk-
|
|
1
|
+
import{a as tt}from"./chunk-K7AJEMKE.js";import{e as Be}from"./chunk-6D6Z2KXU.js";import{a as We}from"./chunk-55754F6H.js";import{b as Ve}from"./chunk-FEWMAPNI.js";import{a as z}from"./chunk-4ZEL6BYL.js";import{c as _e}from"./chunk-D6UKRXIS.js";import{f as Pe}from"./chunk-VWWJIICI.js";import{a as Ye}from"./chunk-FKVZRPV5.js";import{a as T,e as Fe}from"./chunk-WUWBZPUK.js";import{d as $,f as Ge,g as Ze,l as Qe,o as Ne,p as Xe,q as et}from"./chunk-FODLDLE2.js";import{a as m,d as De,e as lt,f as it,g as ct,i as Ee}from"./chunk-YKXDMIHQ.js";var _=De(it(),1);var I=De(lt(),1);var n=De(ct(),1);var dt=Ge(z.studioFeatures),ot={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},mt=m(t=>{if(t===null||typeof t!="object")return ot;let e=t,s=m(a=>typeof e[a]=="boolean"?e[a]:!0,"n");return{analytics:s("analytics"),auth:s("auth"),containers:s("containers"),flags:s("flags"),kv:s("kv"),mail:s("mail"),notifications:s("notifications"),payments:s("payments"),queues:s("queues"),scheduler:s("scheduler"),storage:s("storage"),vectors:s("vectors"),workflows:s("workflows")}},"dt"),ut=m(()=>{let t=(0,_.c)(3),e=Pe(),[s,a]=(0,I.useState)(ot),r,o;return t[0]!==e?(r=m(()=>{Ne((async()=>{try{a(mt(await e.query(dt,{},Ze(""))))}catch{}})())},"a"),o=[e],t[0]=e,t[1]=r,t[2]=o):(r=t[1],o=t[2]),(0,I.useEffect)(r,o),s},"ut"),pt=m(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"mt"),ft=m(t=>{let e=(0,_.c)(24),{group:s}=t,a=$(),r=Be(),o;e[0]!==s.tab||e[1]!==r?(o=m(()=>{Ne(r({to:`/${s.tab}`}))},"o"),e[0]=s.tab,e[1]=r,e[2]=o):o=e[2];let l=o,i=s.bindings.length,c;e[3]!==s.label?(c=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:s.label}),e[3]=s.label,e[4]=c):c=e[4];let p;e[5]===Symbol.for("react.memo_cache_sentinel")?(p=(0,n.jsx)(pt,{}),e[5]=p):p=e[5];let d;e[6]!==c?(d=(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[c,p]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==a?(f=i===1?a("1 binding"):a("{count} bindings",{count:i}),e[8]=i,e[9]=a,e[10]=f):f=e[10];let u;e[11]!==f?(u=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let h;e[13]!==i||e[14]!==s.bindings?(h=i>0&&(0,n.jsx)("div",{className:"flex flex-wrap gap-1.5",children:s.bindings.map(xt)}),e[13]=i,e[14]=s.bindings,e[15]=h):h=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==h?(g=(0,n.jsxs)(Fe,{className:"flex flex-col gap-2 py-4",children:[d,u,h]}),e[16]=d,e[17]=u,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==s.testId||e[21]!==l||e[22]!==g?(x=(0,n.jsx)(T,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":s.testId,onClick:l,children:g}),e[20]=s.testId,e[21]=l,e[22]=g,e[23]=x):x=e[23],x},"ft"),at=["kv","files","vectors"],ht=m((t,e)=>[...t.filter(s=>s.tab!==e.tab),e].toSorted((s,a)=>at.indexOf(s.tab)-at.indexOf(a.tab)),"pt"),gt=m(()=>{let t=(0,_.c)(19),e=Pe(),s=ut(),a=$(),r;t[0]===Symbol.for("react.memo_cache_sentinel")?(r=[],t[0]=r):r=t[0];let[o,l]=(0,I.useState)(r),i,c;if(t[1]!==e||t[2]!==s.kv||t[3]!==s.storage||t[4]!==s.vectors||t[5]!==a?(i=m(()=>{let g={cancelled:!1},x=[{enabled:s.kv,label:a("KV Namespaces"),load:m(async()=>(await e.listKvNamespaces()).map(bt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:s.storage,label:a("R2 Buckets"),load:m(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:s.vectors,label:a("Vectorize Indexes"),load:m(async()=>(await e.listVectorIndexes()).map(yt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Ne((async()=>{try{let v=await b.load();if(!g.cancelled){let S={bindings:v,label:b.label,tab:b.tab,testId:b.testId};l(M=>ht(M,S))}}catch{}})());return()=>{g.cancelled=!0}},"i"),c=[e,s.kv,s.storage,s.vectors,a],t[1]=e,t[2]=s.kv,t[3]=s.storage,t[4]=s.vectors,t[5]=a,t[6]=i,t[7]=c):(i=t[6],c=t[7]),(0,I.useEffect)(i,c),o.length===0)return null;let p;t[8]!==a?(p=a("Bindings"),t[8]=a,t[9]=p):p=t[9];let d;t[10]!==p?(d=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:p}),t[10]=p,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(vt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=(0,n.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let h;return t[16]!==d||t[17]!==u?(h=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=h):h=t[18],h},"ht");function xt(t){return(0,n.jsx)(Ve,{variant:"secondary",children:t},t)}m(xt,"gt");function bt(t){return t.binding}m(bt,"xt");function yt(t){return t.name}m(yt,"bt");function vt(t){return(0,n.jsx)(ft,{group:t},t.tab)}m(vt,"yt");var Nt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],_t=m(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"Nt"),St=m(t=>{let e=Nt.map(s=>`- ${s.name} \u2014 ${s.summary}`).join(`
|
|
2
2
|
`);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
|
|
3
|
-
`)},"_t"),kt=1500,wt=m(()=>{let t=(0,_.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=Xe(),t[0]=s):s=t[0];let a=s,[r,o]=(0,I.useState)(null),l,i;t[1]!==r?(l=m(()=>{if(r===null)return;let A=globalThis.setTimeout(()=>{o(null)},kt);return()=>{globalThis.clearTimeout(A)}},"r"),i=[r],t[1]=r,t[2]=l,t[3]=i):(l=t[2],i=t[3]),(0,I.useEffect)(l,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((A,j)=>{et(j)&&o(A)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",_t(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",St(a))},"u"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let v;t[13]!==b?(v=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=v):v=t[14];let S;t[15]!==x||t[16]!==v?(S=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,v]}),t[15]=x,t[16]=v,t[17]=S):S=t[17];let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=M):M=t[18];let k;t[19]!==r||t[20]!==e?(k=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=k):k=t[21];let y;t[22]!==k?(y=(0,n.jsx)(We,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:k}),t[22]=k,t[23]=y):y=t[23];let w;t[24]!==r||t[25]!==e?(w=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=w):w=t[26];let L;t[27]!==w?(L=(0,n.jsx)(We,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:w}),t[27]=w,t[28]=L):L=t[28];let C;t[29]!==y||t[30]!==L?(C=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[M,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[y,L]})]}),t[29]=y,t[30]=L,t[31]=C):C=t[31];let N;return t[32]!==S||t[33]!==C?(N=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,C]}),t[32]=S,t[33]=C,t[34]=N):N=t[34],N},"kt"),Lt=(0,I.lazy)(()=>import("./chunk-2CNAVNV2.js")),Ct=m((t,e)=>{if(e==null)return t("cache not enabled");let s=e.hits+e.misses;return s===0?t("no cache traffic yet"):`${Math.round(e.hits/s*100).toString()}% ${t("cache hit")}`},"wt"),He=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"De"),It=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"$t"),nt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"Ve"),st=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((l,i)=>l+i,0),r=t.slice(s).reduce((l,i)=>l+i,0);if(a===0)return null;let o=(r-a)/a*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},"We"),Te=m(t=>{let e=(0,_.c)(24),{delta:s,footer:a,label:r,trend:o,unit:l,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==l?(f=l!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==o?(h=o!==void 0&&(0,n.jsx)(I.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(Lt,{data:o})}),e[9]=o,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:Ee("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Te"),Mt=m(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"At"),Ue=m(t=>{let e=(0,_.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let o;e[2]!==s?(o=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==r||e[5]!==o?(l=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,o]}),e[4]=r,e[5]=o,e[6]=l):l=e[6],l},"Be"),rt=m(t=>{let e=(0,_.c)(18),{count:s,onView:a,testId:r,title:o}=t,l=$(),i;e[0]!==o?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==l?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:l("No data yet")}):(0,n.jsx)(Ve,{variant:s>0?"destructive":"success",children:s>0?s:l("All clear")}),e[2]=s,e[3]=l,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==l?(d=l("View"),e[8]=l,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(Mt,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Qe"),At=m(t=>{let e=(0,_.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let o=[...s].toSorted(Ot).slice(0,5),l;e[3]!==a?(l=a("Top functions"),e[3]=a,e[4]=l):l=e[4];let i;e[5]!==l?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l})}),e[5]=l,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),o.map(Rt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Lt"),$t=m(t=>{let e=(0,_.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let o;e[2]!==r?(o=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=o):o=e[3];let l=s?.totalConnections??0,i;e[4]!==l?(i=l.toLocaleString(),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(Fe,{className:"flex flex-col gap-2.5 py-4",children:[o,f,x]})}),e[22]=x,e[23]=o,e[24]=f,e[25]=b):b=e[25],b},"Mt"),jt=m(t=>{let e=(0,_.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let o=Date.now(),l;e[3]!==a?(l=a("Recent activity"),e[3]=a,e[4]=l):l=e[4];let i;e[5]!==l?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l})}),e[5]=l,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:It(c.ts,o)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"It"),Tt=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Tt"),Yt=m(t=>{let e=(0,_.c)(149),{initialShardKey:s}=t,a=$(),r=Be(),o=s??"",l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];let c=_e(z.getMetrics,l,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];let f=_e(z.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=_e(z.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];let v=_e(z.listSubscriptions,x,b),S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let M;e[12]!==o?(M={shardKey:o},e[12]=o,e[13]=M):M=e[13];let k=_e(z.getAuditLog,S,M),y=c.data??null,w,L,C,N,A,j,D,O,R,P,B,E,q,K,V,W,F,U;if(e[14]!==k.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==v.data||e[21]!==a){N=Array.isArray(f.data?.functions)?f.data.functions:[],D=v.data??null;let Le;e[40]!==k.data?(Le=Array.isArray(k.data?.entries)?k.data.entries:[],e[40]=k.data,e[41]=Le):Le=e[41],L=Le,A=c.data===void 0||f.data===void 0?null:tt(y,N).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==r?(Ce=m(()=>{Ne(r({to:"/security"}))},"we"),e[42]=r,e[43]=Ce):Ce=e[43],U=Ce;let Ie;e[44]!==r?(Ie=m(()=>{Ne(r({to:"/insights"}))},"$e"),e[44]=r,e[45]=Ie):Ie=e[45],F=Ie;let Me=nt(y?.history,"calls"),Ae=nt(y?.history,"errors"),Je=Tt(N),$e=Math.max(0,...N.map(qt)),je;e[46]!==y||e[47]!==a?(je=y===null?void 0:Ct(a,y.cache),e[46]=y,e[47]=a,e[48]=je):je=e[48],C=je,V="flex flex-col gap-6",W="lunora-home",B="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let Re=st(Me),xe;e[49]!==a?(xe=a("Requests"),e[49]=a,e[50]=xe):xe=e[50];let qe=y?.requests??0,be;e[51]!==qe?(be=qe.toLocaleString(),e[51]=qe,e[52]=be):be=e[52],e[53]!==Me||e[54]!==Re||e[55]!==xe||e[56]!==be?(q=(0,n.jsx)(Te,{delta:Re,label:xe,trend:Me,value:be}),e[53]=Me,e[54]=Re,e[55]=xe,e[56]=be,e[57]=q):q=e[57];let Ke=st(Ae,!1),ye;e[58]!==a?(ye=a("Errors"),e[58]=a,e[59]=ye):ye=e[59];let ze=y?.errors??0,ve;e[60]!==ze?(ve=ze.toLocaleString(),e[60]=ze,e[61]=ve):ve=e[61],e[62]!==Ae||e[63]!==Ke||e[64]!==ye||e[65]!==ve?(K=(0,n.jsx)(Te,{delta:Ke,label:ye,trend:Ae,value:ve}),e[62]=Ae,e[63]=Ke,e[64]=ye,e[65]=ve,e[66]=K):K=e[66],w=Te,e[67]!==$e||e[68]!==a?(O=$e>0?`${a("max")} ${He($e)}`:void 0,e[67]=$e,e[68]=a,e[69]=O):O=e[69],e[70]!==a?(R=a("Avg latency"),e[70]=a,e[71]=R):R=e[71],P=Je===null?"\u2014":He(Je),e[14]=k.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=v.data,e[21]=a,e[22]=w,e[23]=L,e[24]=C,e[25]=N,e[26]=A,e[27]=j,e[28]=D,e[29]=O,e[30]=R,e[31]=P,e[32]=B,e[33]=E,e[34]=q,e[35]=K,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else w=e[22],L=e[23],C=e[24],N=e[25],A=e[26],j=e[27],D=e[28],O=e[29],R=e[30],P=e[31],B=e[32],E=e[33],q=e[34],K=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==w||e[73]!==O||e[74]!==R||e[75]!==P?(H=(0,n.jsx)(w,{footer:O,label:R,value:P}),e[72]=w,e[73]=O,e[74]=R,e[75]=P,e[76]=H):H=e[76];let J;e[77]!==a?(J=a("Database size"),e[77]=a,e[78]=J):J=e[78];let Oe=y?.databaseSize??null,Y;e[79]!==Oe?(Y=Qe(Oe),e[79]=Oe,e[80]=Y):Y=e[80];let G;e[81]!==C||e[82]!==J||e[83]!==Y?(G=(0,n.jsx)(Te,{footer:C,label:J,value:Y}),e[81]=C,e[82]=J,e[83]=Y,e[84]=G):G=e[84];let Z;e[85]!==B||e[86]!==E||e[87]!==q||e[88]!==K||e[89]!==H||e[90]!==G?(Z=(0,n.jsxs)("div",{className:B,"data-testid":E,children:[q,K,H,G]}),e[85]=B,e[86]=E,e[87]=q,e[88]=K,e[89]=H,e[90]=G,e[91]=Z):Z=e[91];let Se;e[92]===Symbol.for("react.memo_cache_sentinel")?(Se=(0,n.jsx)(gt,{}),e[92]=Se):Se=e[92];let Q;e[93]!==N?(Q=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)(At,{functions:N})}),e[93]=N,e[94]=Q):Q=e[94];let X;e[95]!==D?(X=(0,n.jsx)($t,{subs:D}),e[95]=D,e[96]=X):X=e[96];let ee;e[97]!==L?(ee=(0,n.jsx)(jt,{entries:L}),e[97]=L,e[98]=ee):ee=e[98];let te;e[99]!==X||e[100]!==ee?(te=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[99]=X,e[100]=ee,e[101]=te):te=e[101];let ae;e[102]!==Q||e[103]!==te?(ae=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Q,te]}),e[102]=Q,e[103]=te,e[104]=ae):ae=e[104];let ne;e[105]!==a?(ne=a("Advisors"),e[105]=a,e[106]=ne):ne=e[106];let se;e[107]!==ne?(se=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ne}),e[107]=ne,e[108]=se):se=e[108];let re;e[109]!==A||e[110]!==j||e[111]!==a||e[112]!==F||e[113]!==U?(re=j===0&&A===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(rt,{count:j,onView:U,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(rt,{count:A,onView:F,testId:"home-performance",title:a("Performance issues")})]}),e[109]=A,e[110]=j,e[111]=a,e[112]=F,e[113]=U,e[114]=re):re=e[114];let oe;e[115]!==se||e[116]!==re?(oe=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,re]}),e[115]=se,e[116]=re,e[117]=oe):oe=e[117];let le;e[118]!==a?(le=a("Get connected"),e[118]=a,e[119]=le):le=e[119];let ie;e[120]!==le?(ie=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:le}),e[120]=le,e[121]=ie):ie=e[121];let ce;e[122]!==a?(ce=a("Client SDK"),e[122]=a,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,n.jsx)(Ue,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==a?(me=a("React"),e[126]=a,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,n.jsx)(Ue,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==a?(pe=a("CLI"),e[130]=a,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,n.jsx)(Ue,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let ke;e[138]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,n.jsx)(wt,{}),e[138]=ke):ke=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,ke]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let we;return e[142]!==V||e[143]!==W||e[144]!==Z||e[145]!==ae||e[146]!==oe||e[147]!==ge?(we=(0,n.jsxs)("div",{className:V,"data-testid":W,children:[Z,Se,ae,oe,ge]}),e[142]=V,e[143]=W,e[144]=Z,e[145]=ae,e[146]=oe,e[147]=ge,e[148]=we):we=e[148],we},"Yt");function Ot(t,e){return e.calls-t.calls}m(Ot,"Ot");function Rt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:He(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:Ee("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(Rt,"Rt");function qt(t){return t.maxDurationMs}m(qt,"Et");export{ut as a,Yt as b};
|
|
3
|
+
`)},"_t"),kt=1500,wt=m(()=>{let t=(0,_.c)(35),e=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=Xe(),t[0]=s):s=t[0];let a=s,[r,o]=(0,I.useState)(null),l,i;t[1]!==r?(l=m(()=>{if(r===null)return;let A=globalThis.setTimeout(()=>{o(null)},kt);return()=>{globalThis.clearTimeout(A)}},"r"),i=[r],t[1]=r,t[2]=l,t[3]=i):(l=t[2],i=t[3]),(0,I.useEffect)(l,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=m((A,j)=>{et(j)&&o(A)},"c"),t[4]=c):c=t[4];let p=c,d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=m(()=>{p("config",_t(a))},"d"),t[5]=d):d=t[5];let f=d,u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=m(()=>{p("prompt",St(a))},"u"),t[6]=u):u=t[6];let h=u,g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[11]=e,t[12]=b):b=t[12];let v;t[13]!==b?(v=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=v):v=t[14];let S;t[15]!==x||t[16]!==v?(S=(0,n.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[x,v]}),t[15]=x,t[16]=v,t[17]=S):S=t[17];let M;t[18]===Symbol.for("react.memo_cache_sentinel")?(M=(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=M):M=t[18];let k;t[19]!==r||t[20]!==e?(k=e(r==="config"?"Copied":"Copy MCP config"),t[19]=r,t[20]=e,t[21]=k):k=t[21];let y;t[22]!==k?(y=(0,n.jsx)(We,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:k}),t[22]=k,t[23]=y):y=t[23];let w;t[24]!==r||t[25]!==e?(w=e(r==="prompt"?"Copied":"Copy agent prompt"),t[24]=r,t[25]=e,t[26]=w):w=t[26];let L;t[27]!==w?(L=(0,n.jsx)(We,{"data-testid":"home-connect-agent-copy-prompt",onClick:h,size:"xs",variant:"outline",children:w}),t[27]=w,t[28]=L):L=t[28];let C;t[29]!==y||t[30]!==L?(C=(0,n.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[M,(0,n.jsxs)("div",{className:"flex flex-wrap gap-2",children:[y,L]})]}),t[29]=y,t[30]=L,t[31]=C):C=t[31];let N;return t[32]!==S||t[33]!==C?(N=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,C]}),t[32]=S,t[33]=C,t[34]=N):N=t[34],N},"kt"),Lt=(0,I.lazy)(()=>import("./chunk-HKPAFIMB.js")),Ct=m((t,e)=>{if(e==null)return t("cache not enabled");let s=e.hits+e.misses;return s===0?t("no cache traffic yet"):`${Math.round(e.hits/s*100).toString()}% ${t("cache hit")}`},"wt"),He=m(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"De"),It=m((t,e)=>{let s=Math.max(0,Math.round((e-t)/1e3));if(s<60)return`${String(s)}s ago`;let a=Math.round(s/60);if(a<60)return`${String(a)}m ago`;let r=Math.round(a/60);return r<24?`${String(r)}h ago`:`${String(Math.round(r/24))}d ago`},"$t"),nt=m((t,e)=>{if(t===void 0||t.length===0)return[];let s=new Map;for(let a of t)s.set(a.bucketMs,(s.get(a.bucketMs)??0)+a[e]);return[...s.entries()].toSorted(([a],[r])=>a-r).map(([,a])=>a)},"Ve"),st=m((t,e=!0)=>{if(t.length<4)return null;let s=Math.floor(t.length/2),a=t.slice(0,s).reduce((l,i)=>l+i,0),r=t.slice(s).reduce((l,i)=>l+i,0);if(a===0)return null;let o=(r-a)/a*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},"We"),Te=m(t=>{let e=(0,_.c)(24),{delta:s,footer:a,label:r,trend:o,unit:l,value:i}=t,c=$(),p;e[0]!==r?(p=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=p):p=e[1];let d;e[2]!==i?(d=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==l?(f=l!==void 0&&(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:l}),e[4]=l,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let h;e[9]!==o?(h=o!==void 0&&(0,n.jsx)(I.Suspense,{fallback:(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:(0,n.jsx)(Lt,{data:o})}),e[9]=o,e[10]=h):h=e[10];let g;e[11]!==u||e[12]!==h?(g=(0,n.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,h]}),e[11]=u,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==p||e[15]!==g?(x=(0,n.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]}),e[14]=p,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==s||e[18]!==a||e[19]!==c?(b=s==null?a!=null&&(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:a}):(0,n.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,n.jsx)("span",{className:Ee("font-semibold",s.positive?"text-success":"text-destructive"),children:s.text})," ",(0,n.jsx)("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=s,e[18]=a,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Te"),Mt=m(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,n.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"At"),Ue=m(t=>{let e=(0,_.c)(7),{command:s,label:a}=t,r;e[0]!==a?(r=(0,n.jsx)("div",{className:"p-4",children:(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:a})}),e[0]=a,e[1]=r):r=e[1];let o;e[2]!==s?(o=(0,n.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,n.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:s})}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==r||e[5]!==o?(l=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0",children:[r,o]}),e[4]=r,e[5]=o,e[6]=l):l=e[6],l},"Be"),rt=m(t=>{let e=(0,_.c)(18),{count:s,onView:a,testId:r,title:o}=t,l=$(),i;e[0]!==o?(i=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==s||e[3]!==l?(c=s===null?(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:l("No data yet")}):(0,n.jsx)(Ve,{variant:s>0?"destructive":"success",children:s>0?s:l("All clear")}),e[2]=s,e[3]=l,e[4]=c):c=e[4];let p;e[5]!==i||e[6]!==c?(p=(0,n.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=p):p=e[7];let d;e[8]!==l?(d=l("View"),e[8]=l,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=(0,n.jsx)(Mt,{}),e[10]=f):f=e[10];let u;e[11]!==a||e[12]!==d?(u=(0,n.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:a,type:"button",children:[d,f]}),e[11]=a,e[12]=d,e[13]=u):u=e[13];let h;return e[14]!==p||e[15]!==u||e[16]!==r?(h=(0,n.jsxs)(T,{className:"justify-between gap-0 py-0","data-testid":r,children:[p,u]}),e[14]=p,e[15]=u,e[16]=r,e[17]=h):h=e[17],h},"Qe"),At=m(t=>{let e=(0,_.c)(7),{functions:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let o=[...s].toSorted(Ot).slice(0,5),l;e[3]!==a?(l=a("Top functions"),e[3]=a,e[4]=l):l=e[4];let i;e[5]!==l?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l})}),e[5]=l,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No functions called yet.")}):(0,n.jsxs)("div",{className:"divide-y divide-border",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,n.jsx)("span",{children:a("Function")}),(0,n.jsx)("span",{className:"text-end",children:a("Calls")}),(0,n.jsx)("span",{className:"w-12 text-end",children:a("Avg")}),(0,n.jsx)("span",{className:"w-8 text-end",children:a("Err")})]}),o.map(Rt)]})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"Lt"),$t=m(t=>{let e=(0,_.c)(26),{subs:s}=t,a=$(),r;e[0]!==a?(r=a("Live connections"),e[0]=a,e[1]=r):r=e[1];let o;e[2]!==r?(o=(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[2]=r,e[3]=o):o=e[3];let l=s?.totalConnections??0,i;e[4]!==l?(i=l.toLocaleString(),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,n.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let p;e[8]!==a?(p=a("sockets"),e[8]=a,e[9]=p):p=e[9];let d;e[10]!==p?(d=(0,n.jsx)("span",{className:"text-xs text-muted-foreground",children:p}),e[10]=p,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=(0,n.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];let u=s?.totalSubscriptions??0,h;e[15]!==u?(h=u.toLocaleString(),e[15]=u,e[16]=h):h=e[16];let g;e[17]!==a?(g=a("active subscriptions"),e[17]=a,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,n.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==o||e[24]!==f?(b=(0,n.jsx)(T,{"data-testid":"home-live-connections",children:(0,n.jsxs)(Fe,{className:"flex flex-col gap-2.5 py-4",children:[o,f,x]})}),e[22]=x,e[23]=o,e[24]=f,e[25]=b):b=e[25],b},"Mt"),jt=m(t=>{let e=(0,_.c)(7),{entries:s}=t,a=$(),r;if(e[0]!==s||e[1]!==a){let o=Date.now(),l;e[3]!==a?(l=a("Recent activity"),e[3]=a,e[4]=l):l=e[4];let i;e[5]!==l?(i=(0,n.jsx)("div",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l})}),e[5]=l,e[6]=i):i=e[6],r=(0,n.jsxs)(T,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,s.length===0?(0,n.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:a("No recent activity.")}):(0,n.jsx)("ul",{className:"divide-y divide-border",children:s.slice(0,5).map(c=>(0,n.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,n.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,n.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,n.jsxs)("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&(0,n.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),(0,n.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:It(c.ts,o)})]},c.seq))})]}),e[0]=s,e[1]=a,e[2]=r}else r=e[2];return r},"It"),Tt=m(t=>{let e=t.reduce((s,a)=>s+a.calls,0);return e===0?null:t.reduce((s,a)=>s+a.totalDurationMs,0)/e},"Tt"),Yt=m(t=>{let e=(0,_.c)(149),{initialShardKey:s}=t,a=$(),r=Be(),o=s??"",l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={},e[0]=l):l=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];let c=_e(z.getMetrics,l,i),p;e[3]===Symbol.for("react.memo_cache_sentinel")?(p={},e[3]=p):p=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];let f=_e(z.getFunctionStats,p,d),u,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},h={shardKey:""},e[6]=u,e[7]=h):(u=e[6],h=e[7]);let g=_e(z.getSecurityAudit,u,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,e[10]=b):b=e[10];let v=_e(z.listSubscriptions,x,b),S;e[11]===Symbol.for("react.memo_cache_sentinel")?(S={},e[11]=S):S=e[11];let M;e[12]!==o?(M={shardKey:o},e[12]=o,e[13]=M):M=e[13];let k=_e(z.getAuditLog,S,M),y=c.data??null,w,L,C,N,A,j,D,O,R,P,B,E,q,K,V,W,F,U;if(e[14]!==k.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==r||e[19]!==f.data||e[20]!==v.data||e[21]!==a){N=Array.isArray(f.data?.functions)?f.data.functions:[],D=v.data??null;let Le;e[40]!==k.data?(Le=Array.isArray(k.data?.entries)?k.data.entries:[],e[40]=k.data,e[41]=Le):Le=e[41],L=Le,A=c.data===void 0||f.data===void 0?null:tt(y,N).length,j=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==r?(Ce=m(()=>{Ne(r({to:"/security"}))},"we"),e[42]=r,e[43]=Ce):Ce=e[43],U=Ce;let Ie;e[44]!==r?(Ie=m(()=>{Ne(r({to:"/insights"}))},"$e"),e[44]=r,e[45]=Ie):Ie=e[45],F=Ie;let Me=nt(y?.history,"calls"),Ae=nt(y?.history,"errors"),Je=Tt(N),$e=Math.max(0,...N.map(qt)),je;e[46]!==y||e[47]!==a?(je=y===null?void 0:Ct(a,y.cache),e[46]=y,e[47]=a,e[48]=je):je=e[48],C=je,V="flex flex-col gap-6",W="lunora-home",B="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let Re=st(Me),xe;e[49]!==a?(xe=a("Requests"),e[49]=a,e[50]=xe):xe=e[50];let qe=y?.requests??0,be;e[51]!==qe?(be=qe.toLocaleString(),e[51]=qe,e[52]=be):be=e[52],e[53]!==Me||e[54]!==Re||e[55]!==xe||e[56]!==be?(q=(0,n.jsx)(Te,{delta:Re,label:xe,trend:Me,value:be}),e[53]=Me,e[54]=Re,e[55]=xe,e[56]=be,e[57]=q):q=e[57];let Ke=st(Ae,!1),ye;e[58]!==a?(ye=a("Errors"),e[58]=a,e[59]=ye):ye=e[59];let ze=y?.errors??0,ve;e[60]!==ze?(ve=ze.toLocaleString(),e[60]=ze,e[61]=ve):ve=e[61],e[62]!==Ae||e[63]!==Ke||e[64]!==ye||e[65]!==ve?(K=(0,n.jsx)(Te,{delta:Ke,label:ye,trend:Ae,value:ve}),e[62]=Ae,e[63]=Ke,e[64]=ye,e[65]=ve,e[66]=K):K=e[66],w=Te,e[67]!==$e||e[68]!==a?(O=$e>0?`${a("max")} ${He($e)}`:void 0,e[67]=$e,e[68]=a,e[69]=O):O=e[69],e[70]!==a?(R=a("Avg latency"),e[70]=a,e[71]=R):R=e[71],P=Je===null?"\u2014":He(Je),e[14]=k.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=r,e[19]=f.data,e[20]=v.data,e[21]=a,e[22]=w,e[23]=L,e[24]=C,e[25]=N,e[26]=A,e[27]=j,e[28]=D,e[29]=O,e[30]=R,e[31]=P,e[32]=B,e[33]=E,e[34]=q,e[35]=K,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else w=e[22],L=e[23],C=e[24],N=e[25],A=e[26],j=e[27],D=e[28],O=e[29],R=e[30],P=e[31],B=e[32],E=e[33],q=e[34],K=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==w||e[73]!==O||e[74]!==R||e[75]!==P?(H=(0,n.jsx)(w,{footer:O,label:R,value:P}),e[72]=w,e[73]=O,e[74]=R,e[75]=P,e[76]=H):H=e[76];let J;e[77]!==a?(J=a("Database size"),e[77]=a,e[78]=J):J=e[78];let Oe=y?.databaseSize??null,Y;e[79]!==Oe?(Y=Qe(Oe),e[79]=Oe,e[80]=Y):Y=e[80];let G;e[81]!==C||e[82]!==J||e[83]!==Y?(G=(0,n.jsx)(Te,{footer:C,label:J,value:Y}),e[81]=C,e[82]=J,e[83]=Y,e[84]=G):G=e[84];let Z;e[85]!==B||e[86]!==E||e[87]!==q||e[88]!==K||e[89]!==H||e[90]!==G?(Z=(0,n.jsxs)("div",{className:B,"data-testid":E,children:[q,K,H,G]}),e[85]=B,e[86]=E,e[87]=q,e[88]=K,e[89]=H,e[90]=G,e[91]=Z):Z=e[91];let Se;e[92]===Symbol.for("react.memo_cache_sentinel")?(Se=(0,n.jsx)(gt,{}),e[92]=Se):Se=e[92];let Q;e[93]!==N?(Q=(0,n.jsx)("div",{className:"lg:col-span-2",children:(0,n.jsx)(At,{functions:N})}),e[93]=N,e[94]=Q):Q=e[94];let X;e[95]!==D?(X=(0,n.jsx)($t,{subs:D}),e[95]=D,e[96]=X):X=e[96];let ee;e[97]!==L?(ee=(0,n.jsx)(jt,{entries:L}),e[97]=L,e[98]=ee):ee=e[98];let te;e[99]!==X||e[100]!==ee?(te=(0,n.jsxs)("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[99]=X,e[100]=ee,e[101]=te):te=e[101];let ae;e[102]!==Q||e[103]!==te?(ae=(0,n.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Q,te]}),e[102]=Q,e[103]=te,e[104]=ae):ae=e[104];let ne;e[105]!==a?(ne=a("Advisors"),e[105]=a,e[106]=ne):ne=e[106];let se;e[107]!==ne?(se=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ne}),e[107]=ne,e[108]=se):se=e[108];let re;e[109]!==A||e[110]!==j||e[111]!==a||e[112]!==F||e[113]!==U?(re=j===0&&A===0?(0,n.jsx)(Ye,{description:a("No security or performance issues detected."),icon:(0,n.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,n.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,n.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:a("No issues found")}):(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,n.jsx)(rt,{count:j,onView:U,testId:"home-security",title:a("Security findings")}),(0,n.jsx)(rt,{count:A,onView:F,testId:"home-performance",title:a("Performance issues")})]}),e[109]=A,e[110]=j,e[111]=a,e[112]=F,e[113]=U,e[114]=re):re=e[114];let oe;e[115]!==se||e[116]!==re?(oe=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,re]}),e[115]=se,e[116]=re,e[117]=oe):oe=e[117];let le;e[118]!==a?(le=a("Get connected"),e[118]=a,e[119]=le):le=e[119];let ie;e[120]!==le?(ie=(0,n.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:le}),e[120]=le,e[121]=ie):ie=e[121];let ce;e[122]!==a?(ce=a("Client SDK"),e[122]=a,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,n.jsx)(Ue,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==a?(me=a("React"),e[126]=a,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,n.jsx)(Ue,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==a?(pe=a("CLI"),e[130]=a,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,n.jsx)(Ue,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,n.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let ke;e[138]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,n.jsx)(wt,{}),e[138]=ke):ke=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,n.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,ke]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let we;return e[142]!==V||e[143]!==W||e[144]!==Z||e[145]!==ae||e[146]!==oe||e[147]!==ge?(we=(0,n.jsxs)("div",{className:V,"data-testid":W,children:[Z,Se,ae,oe,ge]}),e[142]=V,e[143]=W,e[144]=Z,e[145]=ae,e[146]=oe,e[147]=ge,e[148]=we):we=e[148],we},"Yt");function Ot(t,e){return e.calls-t.calls}m(Ot,"Ot");function Rt(t){return(0,n.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,n.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,n.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,n.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:He(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,n.jsx)("span",{className:Ee("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}m(Rt,"Rt");function qt(t){return t.maxDurationMs}m(qt,"Et");export{ut as a,Yt as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as te}from"./chunk-
|
|
1
|
+
import{a as te}from"./chunk-PD6WIDY6.js";import{a as Z}from"./chunk-S3CRZLGS.js";import{a as Y}from"./chunk-2DX5MROH.js";import{b as X}from"./chunk-OGUKYRFM.js";import{a as W}from"./chunk-K7AJEMKE.js";import{e as G}from"./chunk-6D6Z2KXU.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-Y6CXU7T4.js";import"./chunk-4L4WTGN5.js";import{b as ae,c as ne}from"./chunk-2LVK7QRD.js";import{a as q,b as ee}from"./chunk-JMXDVWZG.js";import{a as Q}from"./chunk-55754F6H.js";import"./chunk-IS6LVJ6L.js";import"./chunk-AAVLPU5Q.js";import"./chunk-225VJ77I.js";import"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as I}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-D6UKRXIS.js";import{f as D}from"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import"./chunk-HEAQVSNS.js";import"./chunk-WUWBZPUK.js";import{d as M,f as C,g as A,l as V,o as N}from"./chunk-FODLDLE2.js";import{a as l,d as j,e as he,f as me,g as pe}from"./chunk-YKXDMIHQ.js";var E=j(me(),1);var c=j(he(),1);var S=j(pe(),1);var ge=l(t=>{let{suggestedIndex:e,table:i}=t;if(typeof i!="string"||i.length===0||typeof e!="object"||e===null)return!1;let{fields:a,name:n}=e;return!Array.isArray(a)||a.length===0||a.some(s=>typeof s!="string"||s.length===0)?!1:typeof n=="string"&&n.length>0},"ye"),be=l((t,e)=>`.index(${JSON.stringify(t)}, [${e.map(i=>JSON.stringify(i)).join(", ")}])`,"ge"),ye=l(t=>{let e=(0,E.c)(19),{fields:i,indexName:a,table:n,testId:s}=t,u=M(),[h,f]=(0,c.useState)(null),m;e[0]!==i||e[1]!==a?(m=l(()=>{let b=be(a,i),$="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if($===void 0){f({copied:!1,declaration:b});return}N($.writeText(b).then(()=>(f({copied:!0,declaration:b}),!0)),()=>{f({copied:!1,declaration:b})})},"m"),e[0]=i,e[1]=a,e[2]=m):m=e[2];let x=m;if(h!==null){let b;return e[3]!==h.copied||e[4]!==h.declaration||e[5]!==u||e[6]!==n||e[7]!==s?(b=h.copied?(0,S.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`${s}-applied`,children:u("Index declaration copied \u2014 add it to {table} in lunora/schema.ts.",{table:n})}):(0,S.jsxs)("span",{className:"flex flex-col gap-1 text-xs text-muted-foreground","data-testid":`${s}-manual`,children:[u("Could not reach the clipboard \u2014 add this to {table} in lunora/schema.ts:",{table:n}),(0,S.jsx)("code",{className:"font-mono break-all select-all",children:h.declaration})]}),e[3]=h.copied,e[4]=h.declaration,e[5]=u,e[6]=n,e[7]=s,e[8]=b):b=e[8],b}let T;e[9]!==u?(T=u("Copy?"),e[9]=u,e[10]=T):T=e[10];let p;e[11]!==u||e[12]!==n?(p=u("Copy index declaration for {table}",{table:n}),e[11]=u,e[12]=n,e[13]=p):p=e[13];let w;return e[14]!==x||e[15]!==T||e[16]!==p||e[17]!==s?(w=(0,S.jsx)(te,{confirmLabel:T,onConfirm:x,testId:s,children:p}),e[14]=x,e[15]=T,e[16]=p,e[17]=s,e[18]=w):w=e[18],w},"ve"),xe=l((t,e)=>{let i=new Map;for(let a of e){let n=`${a.table} ${a.index}`;i.set(n,(i.get(n)??0)+a.reads)}return t.map(a=>({index:a.index,reads:i.get(`${a.table} ${a.index}`)??0,table:a.table}))},"Se"),ve=l(t=>{let e=new Map;for(let i of t)for(let a of i.scannedTables??[])e.set(a.table,(e.get(a.table)??0)+a.scans);return[...e].map(([i,a])=>({scans:a,table:i}))},"Te"),ie=l((t,e)=>e.map(i=>({index:i.name,table:t})),"P"),we=l(t=>{let e=xe(t.declaredIndexes??[],t.indexHits??[]),i=ve(t.functions??[]),a=t.shardTraffic??[],n=t.analyticsMetrics,s=n&&n.indexHits.length>0?n.indexHits:e,u=n&&n.tableScans.length>0?n.tableScans:i,h=n&&n.shardTraffic.length>0?n.shardTraffic:a,f=ne({indexHits:s,schema:{tables:[]},shardTraffic:h,tableScans:u},{lints:ae,source:"runtime"}),m=t.suppressHotScanTables;return(m===void 0?f:f.filter(x=>!(x.metadata.kind==="hot_scan"&&typeof x.metadata.table=="string"&&m.has(x.metadata.table)))).map(x=>q(x))},"we"),Se=C(I.listTables),Te=C(I.listTableIndexes),Ie=C(I.listTablesIndexes),B=l(t=>`${(t*100).toFixed(1)}%`,"L"),re=l(t=>`${(t/1e3).toFixed(2)}s`,"V"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ne"),ke=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function"),"storage-headroom":t("Storage headroom")})[e.kind],"ke"),se=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:B(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:B(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:B(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:re(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:re(e.value)}),"storage-headroom":t("{size} of the 10 GiB per-shard ceiling \u2014 plan a .shardBy() migration while it still has runway.",{size:V(e.value)})})[e.kind],"U"),Ne=l(t=>{let e=(0,E.c)(10),{onJump:i,table:a}=t,n=M(),s;e[0]!==i||e[1]!==a?(s=l(()=>{i(a)},"i"),e[0]=i,e[1]=a,e[2]=s):s=e[2];let u=s,h=`in-add-index-${a}`,f;e[3]!==n||e[4]!==a?(f=n("Add index on {table}",{table:a}),e[3]=n,e[4]=a,e[5]=f):f=e[5];let m;return e[6]!==u||e[7]!==h||e[8]!==f?(m=(0,S.jsx)(Q,{"data-testid":h,onClick:u,size:"sm",type:"button",variant:"outline",children:f}),e[6]=u,e[7]=h,e[8]=f,e[9]=m):m=e[9],m},"Be"),ze=l(({initialShardKey:t,loadShardTraffic:e})=>{let i=D(),a=G(),n=M(),{queryShardKey:s,setShardKey:u,shardKey:h}=Z(t),[f,m]=(0,c.useState)(null),[x,T]=(0,c.useState)(null),p=(0,c.useRef)(""),w=_(I.getMetrics,{},{live:!0,shardKey:s}),b=_(I.getFunctionStats,{},{live:!0,shardKey:s}),$=_(I.getAdvisories,{},{live:!0,shardKey:s}),L=w.data??null,H=b.data?.functions??null,F=$.data?.advisories??null,J=w.data?.indexHits??null,O=w.error!==null&&b.error!==null?w.error:null,oe=e??(r=>i.shardTraffic(r)),le=l(async(r,y)=>{let o=r[0];if(o===void 0||o===""){p.current===y&&T(null);return}try{let g=await oe(o);if(p.current!==y)return;let d=new Map;for(let v of g.shards)d.has(v.shardKey)||d.set(v.shardKey,{requests:v.requests,shardKey:v.shardKey});T([...d.values()])}catch{p.current===y&&T(null)}},"Y"),de=l(async(r,y)=>{let o=await Promise.allSettled(r.map(async d=>[d,await i.query(Te,{table:d},A(y))])),g=[];for(let d of o)if(d.status==="fulfilled"){let[v,k]=d.value;g.push(...ie(v,k.indexes))}return g},"Z"),z=(0,c.useEffectEvent)(async r=>{p.current=r;let y=[];try{let o=await i.query(Se,{},A(r));if(p.current!==r)return;X(r),y=o.map(d=>d.name);let g=[];if(y.length>0)try{let d=await i.query(Ie,{tables:y},A(r));if(p.current!==r)return;for(let[v,k]of Object.entries(d.indexesByTable))g.push(...ie(v,k))}catch{if(g=await de(y,r),p.current!==r)return}m(g)}catch{p.current===r&&m(null)}await le(y,r)});(0,c.useEffect)(()=>{N(z(s))},[s]);let ce=(0,c.useEffectEvent)(()=>{w.refetch(),b.refetch(),$.refetch(),N(z(s))});(0,c.useEffect)(()=>{let r=l(()=>{document.visibilityState==="visible"&&ce()},"r");return document.addEventListener("visibilitychange",r),()=>{document.removeEventListener("visibilitychange",r)}},[]);let U=(0,c.useCallback)(r=>{N(a({search:{table:r},to:"/schema"}))},[a]),K=(0,c.useMemo)(()=>W(L,H),[H,L]),P=(0,c.useMemo)(()=>new Set(K.filter(r=>r.kind==="missing-index").flatMap(r=>r.tables??[])),[K]),R=(0,c.useMemo)(()=>we({declaredIndexes:f??[],functions:H,indexHits:J,shardTraffic:x,suppressHotScanTables:P}),[f,H,J,P,x]),ue=(0,c.useMemo)(()=>{let r=K.map(o=>{let g=o.kind==="missing-index"?o.tables??[]:[];return{action:g.length>0?g.map(d=>(0,S.jsx)(Ne,{onJump:U,table:d},d)):void 0,description:o.message===void 0?se(n,o):`${se(n,o)} \u2014 ${o.message}`,entity:o.fn,issueType:ke(n,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),y=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(F??[]).map(o=>{let g=q(o);if(y.has(o.name)&&ge(o.metadata)){let{table:d,suggestedIndex:v}=o.metadata,k=`in-apply-index-${d}-${v.name}`;return{...g,action:(0,S.jsx)(ye,{fields:v.fields,indexName:v.name,table:d,testId:k})}}return g}),...R,...r]},[F,K,U,R,n]),fe=(0,S.jsx)(Y,{onChange:u,testId:"in-shard-input",value:h});return(0,S.jsx)(ee,{error:O,errorSource:O===null?void 0:w.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Ue");export{ze as InsightsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./chunk-F7UC63UN.js";import{a as Q}from"./chunk-66UGPQVC.js";import{a as L}from"./chunk-S3CRZLGS.js";import{a as G}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-F7UC63UN.js";import{a as Q}from"./chunk-66UGPQVC.js";import{a as L}from"./chunk-S3CRZLGS.js";import{a as G}from"./chunk-2DX5MROH.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import"./chunk-PLHA3OWK.js";import"./chunk-4L4WTGN5.js";import"./chunk-AAVLPU5Q.js";import{b as $}from"./chunk-FEWMAPNI.js";import"./chunk-225VJ77I.js";import{a as W}from"./chunk-F7UZBTKS.js";import"./chunk-ULIQFBZU.js";import"./chunk-Y3G2ZPOD.js";import"./chunk-35DM4JJG.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as B}from"./chunk-D6UKRXIS.js";import"./chunk-VWWJIICI.js";import"./chunk-FSRSK4LY.js";import"./chunk-KSYIH3NO.js";import{a as A}from"./chunk-FKVZRPV5.js";import{a as q,b as H,c as O,d as K,e as T,f as D}from"./chunk-HEAQVSNS.js";import{a as _}from"./chunk-WUWBZPUK.js";import{d as j}from"./chunk-FODLDLE2.js";import{a as S,d as F,f as J,g as V}from"./chunk-YKXDMIHQ.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(31),{initialShardKey:o}=c,a=j(),{queryShardKey:r,setShardKey:l,shardKey:u}=L(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,refetch:I}=B(E.getFanoutMetrics,d,n);Q(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(G,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m?(h=i!==null&&(0,t.jsx)(W,{error:m,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=h):h=e[16];let x;e[17]!==i||e[18]!==k||e[19]!==a?(x=i===null&&k&&(0,t.jsx)(A,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[17]=i,e[18]=k,e[19]=a,e[20]=x):x=e[20];let N;e[21]!==i||e[22]!==k||e[23]!==s||e[24]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(q,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(O,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[21]=i,e[22]=k,e[23]=s,e[24]=a,e[25]=N):N=e[25];let b;return e[26]!==y||e[27]!==h||e[28]!==x||e[29]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[26]=y,e[27]=h,e[28]=x,e[29]=N,e[30]=b):b=e[30],b},"me");function ee(c){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(D,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};
|