@lunora/studio 1.0.0-alpha.30 → 1.0.0-alpha.32
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/index.d.ts +3 -3
- package/dist/index.js +10 -10
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +3 -2
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +7 -7
- package/dist/packem_chunks/ExportImportPanel.js +5 -4
- package/dist/packem_chunks/FileBrowser.js +2 -2
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +72 -70
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +4 -3
- package/dist/packem_chunks/LogsPanel.js +6 -6
- package/dist/packem_chunks/MailPanel.js +8 -7
- package/dist/packem_chunks/MetricsPanel.js +3 -3
- package/dist/packem_chunks/MigrationsPanel.js +7 -7
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +3 -2
- package/dist/packem_chunks/SecurityAdvisorPanel.js +11 -8
- package/dist/packem_chunks/SettingsPanel.js +50 -49
- package/dist/packem_chunks/SqlEditorPanel.js +5 -4
- package/dist/packem_chunks/TableEditor.js +3 -3
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +2 -2
- package/dist/packem_chunks/containers-panel.js +247 -0
- package/dist/packem_chunks/dashboards-panel.js +3 -2
- package/dist/packem_chunks/fanout-panel.js +31 -30
- package/dist/packem_chunks/flags-panel.js +6 -6
- package/dist/packem_chunks/kv-browser.js +2 -2
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +3 -3
- package/dist/packem_chunks/payments-panel.js +6 -5
- package/dist/packem_chunks/permissions-panel.js +12 -11
- package/dist/packem_chunks/queues-panel.js +32 -31
- package/dist/packem_chunks/rls-panel.js +86 -84
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/sparkline.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +27 -25
- package/dist/packem_chunks/subscriptions-panel.js +33 -31
- package/dist/packem_chunks/users-panel.js +3 -3
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +2 -2
- package/dist/packem_shared/{ApiDocsPanel-B6u_wnz-.js → ApiDocsPanel-Cu6mD4u7.js} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-Drz4UO0a.js → ApiReferencePanel-Co_wpRF2.js} +1 -1
- package/dist/packem_shared/{CommandPalette-B5BertvU.js → CommandPalette-BUPpbpMc.js} +1 -1
- package/dist/packem_shared/{DataBrowser-ANTHLWWh.js → DataBrowser-DSNK1tPg.js} +5 -5
- package/dist/packem_shared/{GlobalDataBrowser-CjgTG_wa.js → GlobalDataBrowser-ErfvIs1S.js} +3 -3
- package/dist/packem_shared/{HomePanel-c2FodE9t.js → HomePanel-DQk3P8xX.js} +3 -3
- package/dist/packem_shared/{OpenRpcReferencePanel-CspFdbUT.js → OpenRpcReferencePanel-DLWzrIx9.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-BEJXtsBn.js → ScheduledJobs-ClaNpZsg.js} +2 -2
- package/dist/packem_shared/{Studio-CVTtA_sB.js → Studio-CFTYGEUt.js} +4 -4
- package/dist/packem_shared/{StudioApp-BSYV2fz6.js → StudioApp-Cy9vUwVl.js} +1 -1
- package/dist/packem_shared/{advisor-view-DzqyvUU3.js → advisor-view-D3-U4kRR.js} +5 -5
- package/dist/packem_shared/alert-CdAET2K_.js +68 -0
- package/dist/packem_shared/{app.d-B6MyY_al.d.ts → app.d-CNLRTrWw.d.ts} +1 -1
- package/dist/packem_shared/{bar-chart-Bb__F5-u.js → bar-chart-DSwcWIRy.js} +4 -3
- package/dist/packem_shared/{browser-storage-d03UsV7v.js → browser-storage-tLOxkIHd.js} +3 -67
- package/dist/packem_shared/{data-grid-Dsg6nRjo.js → data-grid-Jz8FqQ2C.js} +1 -1
- package/dist/packem_shared/error-alert-BBT6D22d.js +114 -0
- package/dist/packem_shared/{grid-features-D7nNzBYm.js → grid-features-CUr8Z1_O.js} +1 -1
- package/dist/packem_shared/{home-panel-aOR_drVv.js → home-panel-Bo-Mgrkn.js} +4 -2
- package/dist/packem_shared/{internal-FcNZ3beb.js → internal-DTsYVn-g.js} +30 -1
- package/dist/packem_shared/{reference-view-Doy1XlQq.js → reference-view-CSKyUyPl.js} +3 -2
- package/dist/packem_shared/{sparkline-KgMPHS4u.js → sparkline-BnA1kC9X.js} +1 -1
- package/dist/packem_shared/{studio-dMTJ-kRR.js → studio-Dg2e-dsR.js} +587 -560
- package/dist/packem_shared/{table-list-sidebar-VMo0ftxD.js → table-list-sidebar-B5psdSV1.js} +1 -1
- package/dist/packem_shared/{use-admin-query-BViPA3US.js → use-admin-query-BHPKmPuj.js} +2 -1
- package/dist/packem_shared/{use-auth-capabilities-BHkoBnbZ.js → use-auth-capabilities-C-VH0oJJ.js} +1 -1
- package/dist/standalone/{chunk-N4JI6VQD.js → chunk-25VHPD2I.js} +1 -1
- package/dist/standalone/chunk-2GGMGPEP.js +1 -0
- package/dist/standalone/{chunk-BHTPZS7L.js → chunk-3CJW6NWG.js} +1 -1
- package/dist/standalone/chunk-4H2OJBXO.js +1 -0
- package/dist/standalone/chunk-4MLAVZP4.js +1 -0
- package/dist/standalone/chunk-55YA7ZZI.js +76 -0
- package/dist/standalone/chunk-5OH3VPZF.js +1 -0
- package/dist/standalone/chunk-6GFEVKJP.js +1 -0
- package/dist/standalone/{chunk-ITLLHEVG.js → chunk-764T6X6X.js} +1 -1
- package/dist/standalone/chunk-7M3F6U4L.js +1 -0
- package/dist/standalone/{chunk-KGS7KM4A.js → chunk-7VF3IAAW.js} +1 -1
- package/dist/standalone/chunk-AJIUI7DD.js +1 -0
- package/dist/standalone/{chunk-5NSZVXCS.js → chunk-BACPICH6.js} +1 -1
- package/dist/standalone/chunk-BET2625I.js +1 -0
- package/dist/standalone/chunk-BQUQS7QN.js +1 -0
- package/dist/standalone/chunk-CKSHCYGC.js +2 -0
- package/dist/standalone/chunk-DCECRP45.js +1 -0
- package/dist/standalone/chunk-DFP2DADO.js +1 -0
- package/dist/standalone/chunk-DORBUITF.js +1 -0
- package/dist/standalone/chunk-DVKPRFIJ.js +1 -0
- package/dist/standalone/chunk-E6WUCLSI.js +1 -0
- package/dist/standalone/chunk-E7WLF6IU.js +1 -0
- package/dist/standalone/chunk-EVPLBWUT.js +8 -0
- package/dist/standalone/chunk-FCSPAJW4.js +1 -0
- package/dist/standalone/chunk-G2ICR3DL.js +1 -0
- package/dist/standalone/{chunk-2DS7JLWL.js → chunk-GJ6PGSES.js} +5 -5
- package/dist/standalone/chunk-GMSGZDDH.js +13 -0
- package/dist/standalone/chunk-GVRM4U6W.js +2 -0
- package/dist/standalone/chunk-GZDWDDXN.js +1 -0
- package/dist/standalone/chunk-ISJAJWYI.js +1 -0
- package/dist/standalone/{chunk-G2TFEWEQ.js → chunk-JIDZFLTB.js} +1 -1
- package/dist/standalone/{chunk-RMYA7NAH.js → chunk-K3GNLVYK.js} +1 -1
- package/dist/standalone/chunk-K4ZDRTQM.js +1 -0
- package/dist/standalone/{chunk-ASLGNHAX.js → chunk-LI43EKM6.js} +1 -1
- package/dist/standalone/chunk-MFPTVCJ6.js +1 -0
- package/dist/standalone/chunk-MPYFGAOW.js +1 -0
- package/dist/standalone/{chunk-TICVNLPM.js → chunk-O3NAGRTR.js} +1 -1
- package/dist/standalone/chunk-OV2WFAJX.js +1 -0
- package/dist/standalone/chunk-PA3LN4XJ.js +1 -0
- package/dist/standalone/chunk-PD6WPVYU.js +1 -0
- package/dist/standalone/{chunk-7PBZKXYA.js → chunk-PN5NCZDX.js} +1 -1
- package/dist/standalone/{chunk-YJGANMU7.js → chunk-PVZI3CXP.js} +10 -9
- package/dist/standalone/chunk-PZ7HD5T2.js +1 -0
- package/dist/standalone/{chunk-UGMRUEBU.js → chunk-QAFAJBAW.js} +1 -1
- package/dist/standalone/{chunk-6VTGE3WJ.js → chunk-QBAT52GB.js} +1 -1
- package/dist/standalone/chunk-QHIIRFG7.js +1 -0
- package/dist/standalone/chunk-RSEEHNFI.js +1 -0
- package/dist/standalone/chunk-SFJ5F4DX.js +1 -0
- package/dist/standalone/{chunk-3BP4BTLR.js → chunk-SGDQIWAR.js} +3 -3
- package/dist/standalone/chunk-SYEIXTEU.js +1 -0
- package/dist/standalone/chunk-T5HRXUSY.js +1 -0
- package/dist/standalone/{chunk-OD2POGPJ.js → chunk-TDL7NEWA.js} +1 -1
- package/dist/standalone/chunk-TM7CMA7X.js +1 -0
- package/dist/standalone/chunk-U4OAQPBT.js +1 -0
- package/dist/standalone/chunk-UDSVXA42.js +1 -0
- package/dist/standalone/chunk-UK64ZSUW.js +1 -0
- package/dist/standalone/chunk-VEZO7G5Q.js +3 -0
- package/dist/standalone/chunk-VSHUSN6T.js +1 -0
- package/dist/standalone/chunk-VYMCCC6O.js +1 -0
- package/dist/standalone/{chunk-7RYIQKZA.js → chunk-WXPWVBIY.js} +1 -1
- package/dist/standalone/chunk-X72PYOEW.js +1 -0
- package/dist/standalone/chunk-X7MMBSNW.js +1 -0
- package/dist/standalone/{chunk-6RC6L33K.js → chunk-XIGIWZLO.js} +3 -3
- package/dist/standalone/chunk-XNJNSCLM.js +1 -0
- package/dist/standalone/{chunk-NNISYDNI.js → chunk-XUGSA2NG.js} +1 -1
- package/dist/standalone/{chunk-VXBZQIGY.js → chunk-Y2ZPNDL7.js} +1 -1
- package/dist/standalone/chunk-YM6BBZDN.js +1 -0
- package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
- package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
- package/dist/standalone/studio.js +30 -30
- package/dist/styles.css +1 -1
- package/package.json +6 -5
- package/dist/standalone/chunk-2PDQ4KZ6.js +0 -1
- package/dist/standalone/chunk-57LYXHXH.js +0 -1
- package/dist/standalone/chunk-63XKJQTQ.js +0 -1
- package/dist/standalone/chunk-7POIIWC5.js +0 -3
- package/dist/standalone/chunk-AB6QGMBF.js +0 -1
- package/dist/standalone/chunk-D7HKX4DI.js +0 -1
- package/dist/standalone/chunk-DGWTR4G7.js +0 -1
- package/dist/standalone/chunk-DSX53PBM.js +0 -1
- package/dist/standalone/chunk-DV2MNASX.js +0 -1
- package/dist/standalone/chunk-E7AVZZKO.js +0 -1
- package/dist/standalone/chunk-EGJX34WM.js +0 -1
- package/dist/standalone/chunk-FCR3HKFV.js +0 -1
- package/dist/standalone/chunk-FQKNJSRA.js +0 -76
- package/dist/standalone/chunk-GABMIICA.js +0 -1
- package/dist/standalone/chunk-GZXPPJVK.js +0 -1
- package/dist/standalone/chunk-HFBRE65A.js +0 -1
- package/dist/standalone/chunk-HFMQNUBC.js +0 -1
- package/dist/standalone/chunk-HG7Q5B3H.js +0 -1
- package/dist/standalone/chunk-HTQL7AXU.js +0 -1
- package/dist/standalone/chunk-KG3QTFWE.js +0 -1
- package/dist/standalone/chunk-KODWGUAB.js +0 -1
- package/dist/standalone/chunk-MGFEVTRI.js +0 -1
- package/dist/standalone/chunk-N2QDG3MW.js +0 -1
- package/dist/standalone/chunk-O4PXDNR3.js +0 -1
- package/dist/standalone/chunk-OXCK3ZUG.js +0 -1
- package/dist/standalone/chunk-P7DSVO4U.js +0 -1
- package/dist/standalone/chunk-PKAM3N5C.js +0 -1
- package/dist/standalone/chunk-QGXGBHQO.js +0 -1
- package/dist/standalone/chunk-QHA3TAEJ.js +0 -1
- package/dist/standalone/chunk-QQWC62X7.js +0 -1
- package/dist/standalone/chunk-S53RUBW5.js +0 -1
- package/dist/standalone/chunk-SB4GT6PK.js +0 -1
- package/dist/standalone/chunk-SHIOUDOT.js +0 -1
- package/dist/standalone/chunk-SIDRSX7Y.js +0 -1
- package/dist/standalone/chunk-VJPQUBN6.js +0 -8
- package/dist/standalone/chunk-VMJKJWG6.js +0 -1
- package/dist/standalone/chunk-VPDPN5RR.js +0 -2
- package/dist/standalone/chunk-VSEGZA3J.js +0 -1
- package/dist/standalone/chunk-W7PCVQTE.js +0 -1
- package/dist/standalone/chunk-XLILSHPE.js +0 -1
- package/dist/standalone/chunk-XURNGQSS.js +0 -1
- package/dist/standalone/chunk-YQQJ4N6U.js +0 -1
- package/dist/standalone/chunk-ZH7UES4T.js +0 -2
- package/dist/standalone/chunk-ZQCVDXDL.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{R as $}from"./chunk-BHTPZS7L.js";import{c as A}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-TAD43CG5.js";import{a as S,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-ZH7UES4T.js";import{f as F}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as Q,g as E,h as K,i as I}from"./chunk-YJGANMU7.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as R}from"./chunk-AB6QGMBF.js";import"./chunk-GTM65MVX.js";import{a as p}from"./chunk-AQGOX5DK.js";import{b as h}from"./chunk-FCR3HKFV.js";import"./chunk-SEU5V7I6.js";import"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as m}from"./chunk-YJGANMU7.js";import{a as i,e as u,g as k,h as S}from"./chunk-RRCPZMC2.js";var f=u(k(),1);var g=u(S(),1);var A=i((e,s)=>({"admin-token-weak":e("Weak admin token"),"auth-secret-weak":e("Weak auth secret"),"cookies-insecure":e("Session cookies are not Secure"),"cors-wildcard-credentials":e("Wildcard CORS with credentials"),"csrf-disabled":e("CSRF/origin guard is off"),"dev-args-unredacted":e("Request log keeps un-redacted args"),"security-headers-disabled":e("Security headers are off"),"ws-gate-open":e("Live admin subscriptions are ungated")})[s.kind],"findingTitle"),_=i(e=>Array.isArray(e.findings)?e.findings:[],"toFindings"),E=i(e=>({"admin-token-weak":"LUNORA_ADMIN_TOKEN","auth-secret-weak":"AUTH_SECRET","cookies-insecure":"BETTER_AUTH_URL","cors-wildcard-credentials":"LUNORA_ALLOWED_ORIGINS","csrf-disabled":"LUNORA_SECURITY_CSRF","dev-args-unredacted":"request log","security-headers-disabled":"LUNORA_SECURITY_HEADERS","ws-gate-open":"LUNORA_WS_BEARER"})[e.kind],"findingEntity"),w=i((e,s)=>({"admin-token-weak":e("Your admin token is {length} characters \u2014 use at least {min} for a brute-force-resistant secret.",{length:s.detail?.length,min:s.detail?.min}),"auth-secret-weak":e("Your auth secret is {length} characters \u2014 use at least {min} (e.g. `openssl rand -hex 32`) to sign sessions safely.",{length:s.detail?.length,min:s.detail?.min}),"cookies-insecure":e("BETTER_AUTH_URL is a plaintext http:// origin, so session cookies cannot be Secure and ride in cleartext. Serve auth over https:// in production."),"cors-wildcard-credentials":e("LUNORA_ALLOWED_ORIGINS includes a wildcard while credentials are allowed \u2014 browsers reject this and it defeats the allowlist. Name explicit origins instead of *."),"csrf-disabled":e("LUNORA_SECURITY_CSRF is off, so cross-origin state-changing cookie requests are not blocked. Re-enable it in production to keep mutations un-forgeable."),"dev-args-unredacted":e("This worker reports a development environment, so the request log stores raw args and identity. Confirm it isn't a mislabeled production deploy."),"security-headers-disabled":e("LUNORA_SECURITY_HEADERS is off, so HSTS, CSP, nosniff, and frame-options are not applied. Re-enable the baseline headers in production."),"ws-gate-open":e("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")})[s.kind],"findingDetail"),N=i(()=>{let e=(0,f.c)(7),s=m(),r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let{data:a,error:d}=h(p.getSecurityAudit,r),o;if(e[1]!==a||e[2]!==s){let l=a===void 0?null:_(a);o=l===null?null:l.map(t=>({description:w(s,t),entity:E(t),issueType:A(s,t),key:t.kind,level:t.level})),e[1]=a,e[2]=s,e[3]=o}else o=e[3];let c=o,n;return e[4]!==d||e[5]!==c?(n=(0,g.jsxDEV)(R,{error:d,rows:c,testId:"lunora-security-advisor"},void 0,!1),e[4]=d,e[5]=c,e[6]=n):n=e[6],n},"SecurityAdvisorPanel");export{N as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as $,b as F,c as D,d as p,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as se}from"./chunk-VLXV72QE.js";import{R as te}from"./chunk-BHTPZS7L.js";import{c as T}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-AQGOX5DK.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as ae}from"./chunk-FCR3HKFV.js";import{a as R,e as _}from"./chunk-SEU5V7I6.js";import"./chunk-ZH7UES4T.js";import{f as Q}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as V,e as X,f as Y,g as E,i as W}from"./chunk-YJGANMU7.js";import{a as r,e as ee,f as re,h as le}from"./chunk-RRCPZMC2.js";var n=ee(re(),1);var e=ee(le(),1);var ie=["queued","running","paused","waiting","complete","errored","terminated"],ne=["pause","resume","terminate"],de="WORKFLOWS_NOT_CONFIGURED",ce=r(c=>typeof c=="object"&&c!==null&&c.code===de,"isNotConfigured"),fe=r(c=>{let s=c.error??c.output;if(s===void 0)return"\u2014";try{return JSON.stringify(s)}catch{return"(unserializable)"}},"formatStepPayload"),ue=r(({loadDetail:c,loadInstances:s,readOnly:y,runAction:L,workflowName:v})=>{let A=Q(),o=V(),[x,N]=(0,n.useState)(null),[k,I]=(0,n.useState)(null),[w,P]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[U,S]=(0,n.useState)(!1),[z,J]=(0,n.useState)(null),m=c??(a=>A.getWorkflowInstance(a)),O=y?void 0:L??(s===void 0?a=>A.setWorkflowInstanceStatus(a):void 0),j=r(async()=>{h(null),S(!1);let a=w===""?void 0:w;try{if(s===void 0){let d=await A.listWorkflowInstances({name:v,status:a});if(d.configured===!1){N(null),S(!0);return}N(d.instances);return}N(await s({name:v,status:a}))}catch(d){N(null),ce(d)?S(!0):h(E(d))}},"load");(0,n.useEffect)(()=>{I(null),W(j())},[v,w]);let G=r(async a=>{h(null);try{I(await m({id:a,name:v}))}catch(d){h(E(d))}},"openDetail"),H=r(async(a,d)=>{if(O!==void 0){J(a),h(null);try{await O({action:d,id:a,name:v}),await j()}catch(M){h(E(M))}finally{J(null)}}},"act");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:o("Instance history")},void 0,!1),(0,e.jsxDEV)("select",{"aria-label":o("Filter by status"),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":"workflow-instances-filter",onChange:r(a=>{P(a.target.value)},"onChange"),value:w,children:[(0,e.jsxDEV)("option",{value:"",children:o("All statuses")},void 0,!1),ie.map(a=>(0,e.jsxDEV)("option",{value:a,children:a},a,!1))]},void 0,!0)]},void 0,!0),g!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:g},void 0,!1),U&&(0,e.jsxDEV)(B,{description:o("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:o("Workflow inspection not configured")},void 0,!1),!U&&x!==null&&x.length===0&&(0,e.jsxDEV)(B,{description:o("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:o("No instances")},void 0,!1),x!==null&&x.length>0&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflow-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Created")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Ended")},void 0,!1),(0,e.jsxDEV)(l,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:x.map(a=>(0,e.jsxDEV)(p,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.status},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-right",children:(0,e.jsxDEV)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:r(()=>{W(G(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Steps")},void 0,!1),O!==void 0&&ne.map(d=>(0,e.jsxDEV)(T,{"data-testid":`workflow-instance-${d}-${a.id}`,disabled:z===a.id,onClick:r(()=>{W(H(a.id,d))},"onClick"),size:"sm",type:"button",variant:"ghost",children:o(d)},d,!1))]},void 0,!0)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),k!==null&&(0,e.jsxDEV)(R,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxDEV)(_,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxDEV)("div",{className:"flex items-center justify-between",children:[(0,e.jsxDEV)("span",{className:"font-mono text-xs",children:[o("Steps")," \xB7 ",k.id]},void 0,!0),(0,e.jsxDEV)(T,{"data-testid":"workflow-instance-detail-close",onClick:r(()=>{I(null)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Close")},void 0,!1)]},void 0,!0),k.steps.length===0?(0,e.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:o("This instance has no recorded steps yet.")},void 0,!1):(0,e.jsxDEV)($,{"data-testid":"workflow-instance-steps",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:o("Step")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Type")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Attempts")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Started")},void 0,!1),(0,e.jsxDEV)(l,{children:o("Output")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:k.steps.map((a,d)=>(0,e.jsxDEV)(p,{"data-testid":`workflow-step-${String(d)}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:a.name},void 0,!1),(0,e.jsxDEV)(i,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"tabular-nums",children:a.attempts??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:fe(a)},void 0,!1)]},`${a.name}:${String(d)}`,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},void 0,!1)]},void 0,!0)},"WorkflowInstanceHistory"),me=X(K.createWorkflowInstance),ve=X(K.getWorkflowInstanceStatus),he=r(c=>{if(c.error)return`${c.error.name}: ${c.error.message}`;if(c.output===void 0)return"\u2014";try{return JSON.stringify(c.output)}catch{return"(unserializable)"}},"formatPayload"),Oe=r(()=>{let c=Q(),s=V(),{data:y,error:L}=ae(K.listWorkflows,{}),[v,A]=(0,n.useState)(""),[o,x]=(0,n.useState)(""),[N,k]=(0,n.useState)(""),[I,w]=(0,n.useState)(!1),[P,g]=(0,n.useState)(null),[h,U]=(0,n.useState)([]),[S,z]=(0,n.useState)(null),J=y!==void 0,m=(0,n.useMemo)(()=>Array.isArray(y?.workflows)?[...y.workflows].toSorted((t,u)=>t.exportName.localeCompare(u.exportName)):[],[y]),C=(0,n.useMemo)(()=>m.some(t=>t.exportName===v)?v:m[0]?.exportName??"",[m,v]),q=(0,n.useMemo)(()=>m.find(t=>t.exportName===C),[m,C]),O=r(t=>{U(u=>{let f=u.filter(b=>!(b.exportName===t.exportName&&b.id===t.id));return[t,...f]})},"upsertInstance"),j=r(async()=>{let t=C;if(t==="")return;let u,f=N.trim();if(f!=="")try{u=JSON.parse(f)}catch{g(s("Params must be valid JSON"));return}w(!0),g(null);try{let b=o.trim(),Z=await c.query(me,{exportName:t,id:b===""?void 0:b,params:u},Y(""));O({exportName:t,id:Z.id,status:Z.status}),x("")}catch(b){g(E(b))}finally{w(!1)}},"start"),G=r(()=>{W(j())},"startInstance"),H=r(async(t,u)=>{z(u);try{let f=await c.query(ve,{exportName:t,id:u},Y(""));O({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){g(E(f))}finally{z(null)}},"refreshInstance"),a=r(t=>{A(t.target.value)},"onSelectedExportChange"),d=r(t=>{x(t.target.value)},"onInstanceIdChange"),M=r(t=>{k(t.target.value)},"onParamsChange"),oe=r(t=>{let{export:u,id:f}=t.currentTarget.dataset;u!==void 0&&f!==void 0&&W(H(u,f))},"onRefreshClick");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[L!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:L},void 0,!1),(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:s("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")},void 0,!1),J&&m.length===0?(0,e.jsxDEV)(B,{description:s("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:s("No workflows defined")},void 0,!1):(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Export")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Name")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Class")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Binding")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:m.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.name},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.className},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.binding},void 0,!1)]},t.exportName,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),m.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Start instance")},void 0,!1),P!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:P},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)("select",{"aria-label":s("Workflow"),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":"workflows-start-select",onChange:a,value:C,children:m.map(t=>(0,e.jsxDEV)("option",{value:t.exportName,children:t.exportName},t.exportName,!1))},void 0,!1),(0,e.jsxDEV)(te,{"aria-label":s("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:d,placeholder:s("Instance id (optional)"),value:o},void 0,!1),(0,e.jsxDEV)(T,{"data-testid":"workflows-start-button",disabled:I||C==="",onClick:G,children:s(I?"Starting\u2026":"Start instance")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)(se,{"aria-label":s("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:M,placeholder:s("Params (JSON, optional)"),value:N},void 0,!1)]},void 0,!0),h.length>0&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsxDEV)("h3",{className:"text-sm font-medium",children:s("Instances")},void 0,!1),(0,e.jsxDEV)(R,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(_,{className:"px-0",children:(0,e.jsxDEV)($,{"data-testid":"workflows-instances-table",children:[(0,e.jsxDEV)(F,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(l,{children:s("Workflow")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Instance id")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Status")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Output")},void 0,!1),(0,e.jsxDEV)(l,{},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(D,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.exportName},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:t.id},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs",children:t.status},void 0,!1),(0,e.jsxDEV)(i,{className:"font-mono text-xs text-muted-foreground",children:he(t)},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(T,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:S===t.id,onClick:oe,size:"xs",variant:"outline",children:S===t.id?s("Refreshing\u2026"):s("Refresh")},void 0,!1)},void 0,!1)]},`${t.exportName}:${t.id}`,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),q!==void 0&&(0,e.jsxDEV)(ue,{workflowName:q.name},void 0,!1)]},void 0,!0)},"WorkflowsPanel");export{Oe as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as J}from"./chunk-OD2POGPJ.js";import{a as P}from"./chunk-VLXV72QE.js";import{a as B}from"./chunk-RMYA7NAH.js";import{b as I}from"./chunk-TBMYIZIO.js";import"./chunk-BHTPZS7L.js";import{c as R}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as f}from"./chunk-AQGOX5DK.js";import{c as D}from"./chunk-FCR3HKFV.js";import{a as v,e as N}from"./chunk-SEU5V7I6.js";import"./chunk-ZH7UES4T.js";import{f as A}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as E,e as y,f as S,g as b,i as w}from"./chunk-YJGANMU7.js";import{a as o,e as _,f as H,h as K}from"./chunk-RRCPZMC2.js";var c=_(H(),1);var e=_(K(),1);var U=y(f.exportShard),V=y(f.importShard),X=o(m=>m.map(a=>JSON.stringify(a)).join(`
|
|
2
|
-
`),"toNdjson"),z=o(m=>{let a=[],x=m.split(`
|
|
3
|
-
`);for(let[r,l]of x.entries()){let h=l.trim();if(h==="")continue;let n=JSON.parse(h);if(typeof n!="object"||n===null)throw new Error(`line ${(r+1).toString()}: expected a { table, doc } object`);let s=n;if(typeof s.table!="string"||typeof s.doc!="object"||s.doc===null||Array.isArray(s.doc))throw new Error(`line ${(r+1).toString()}: expected a { table, doc } object`);a.push(s)}return a},"parseNdjson"),le=o(({initialShardKey:m})=>{let a=A(),x=D(),r=E(),[l,h]=(0,c.useState)(m??""),[n,s]=(0,c.useState)(""),[j,p]=(0,c.useState)(!1),[C,u]=(0,c.useState)(null),[i,g]=(0,c.useState)(null),[O,T]=(0,c.useState)(null),$=o(async()=>{p(!0),u(null),g(null);try{let t=await a.query(U,{},S(l));I(l),s(X(t.rows)),T(t.rows.length)}catch(t){u(b(t))}finally{p(!1)}},"exportShard"),k=o(async()=>{p(!0),u(null),g(null),T(null);let t;try{t=z(n)}catch(d){u(r("Invalid NDJSON: {message}",{message:b(d)})),p(!1);return}try{let d=await a.query(V,{rows:t},S(l));I(l),g(d),x(f.readTablePage),x(f.listTables)}catch(d){u(b(d))}finally{p(!1)}},"importShard"),L=i===null?0:Object.values(i.inserted).reduce((t,d)=>t+d,0),M=o(()=>{w($())},"runExport"),q=o(()=>{w(k())},"runImport"),F=o(t=>{s(t.target.value)},"onNdjsonChange");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Export")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(N,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)(B,{onChange:h,testId:"ei-shard-input",value:l},void 0,!1),(0,e.jsxDEV)(R,{"data-testid":"ei-export",disabled:j,onClick:M,type:"button",children:r("Export")},void 0,!1)]},void 0,!0),O!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:r("Exported {count} rows.",{count:O})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)(v,{className:"rounded-xl border border-border bg-card shadow-xs",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Import")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(N,{className:"flex flex-col gap-3 p-4",children:[(0,e.jsxDEV)(P,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:F,placeholder:'{"table":"messages","doc":{\u2026}}',value:n},void 0,!1),(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:(0,e.jsxDEV)(J,{confirmLabel:r("Import (writes rows)?"),disabled:j||n.trim()==="",onConfirm:q,testId:"ei-import",children:r("Import")},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,e.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:r("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:L})},void 0,!1),i.errors.length>0&&(0,e.jsxDEV)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(t=>(0,e.jsxDEV)("li",{className:"text-xs text-destructive",children:r("line {line} ({table}): {message}",{line:t.line,message:t.message,table:t.table})},`${t.table}-${t.line.toString()}`,!1))},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),C!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:C},void 0,!1)]},void 0,!0)},"ExportImportPanel");export{le as ExportImportPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as x,b as N,c as y,d as l,e as d,f as n}from"./chunk-GTM65MVX.js";import{a as b,e as g}from"./chunk-SEU5V7I6.js";import{d as h}from"./chunk-YJGANMU7.js";import{a as i,e as p,f as L,h as R,j as v}from"./chunk-RRCPZMC2.js";var c=p(L(),1);var e=p(R(),1);var V={ERROR:"error",INFO:"info",WARN:"warning"},z=i(t=>{let a=typeof t.metadata.table=="string"?t.metadata.table:void 0;return{description:`${t.detail} ${t.remediation}`,entity:a,issueType:t.title,key:t.cacheKey,level:V[t.level]}},"advisoryRow"),$=["error","warning","info"],k={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},A=i((t,a)=>({error:t("Errors"),info:t("Info"),warning:t("Warnings")})[a],"levelLabel"),D=i((t,a,o)=>({error:t("{count} errors",{count:o}),info:t("{count} suggestions",{count:o}),warning:t("{count} warnings",{count:o})})[a],"levelCount"),O=i((t,a)=>({error:t("No errors detected"),info:t("No suggestions"),warning:t("No warnings detected")})[a],"emptyTitle"),B=i(({error:t=null,rows:a,testId:o,toolbar:f})=>{let s=h(),[m,T]=(0,c.useState)("error"),w=(0,c.useMemo)(()=>{let r={error:0,info:0,warning:0};for(let C of a??[])r[C.level]+=1;return r},[a]),u=(a??[]).filter(r=>r.level===m),E=i(r=>{T(r.currentTarget.dataset.level)},"selectTab");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-3","data-testid":o,children:[(0,e.jsxDEV)("div",{className:"flex border-b border-border",role:"tablist",children:$.map(r=>(0,e.jsxDEV)("button",{"aria-selected":m===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${o}-tab-${r}`,onClick:E,role:"tab",type:"button",children:[(0,e.jsxDEV)("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[(0,e.jsxDEV)("span",{"aria-hidden":"true",className:v("size-2 rounded-sm",k[r])},void 0,!1),A(s,r)]},void 0,!0),(0,e.jsxDEV)("span",{className:"ps-4 text-xs text-muted-foreground",children:D(s,r,w[r])},void 0,!1)]},r,!0))},void 0,!1),f!==void 0&&(0,e.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:f},void 0,!1),t!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":`${o}-error`,role:"alert",children:t},void 0,!1),(0,e.jsxDEV)(b,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(g,{className:"px-0",children:(0,e.jsxDEV)(x,{children:[(0,e.jsxDEV)(N,{children:(0,e.jsxDEV)(l,{children:[(0,e.jsxDEV)(d,{children:s("Issue type")},void 0,!1),(0,e.jsxDEV)(d,{children:s("Entity/item")},void 0,!1),(0,e.jsxDEV)(d,{children:s("Description")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(y,{children:u.length===0?(0,e.jsxDEV)(l,{children:(0,e.jsxDEV)(n,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${o}-empty`,children:[(0,e.jsxDEV)("span",{className:"block text-sm font-medium text-foreground",children:O(s,m)},void 0,!1),(0,e.jsxDEV)("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")},void 0,!1)]},void 0,!0)},void 0,!1):u.map(r=>(0,e.jsxDEV)(l,{children:[(0,e.jsxDEV)(n,{className:"font-medium text-foreground",children:r.issueType},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"text-muted-foreground",children:[(0,e.jsxDEV)("span",{children:r.description},void 0,!1),r.action!==void 0&&(0,e.jsxDEV)("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action},void 0,!1)]},void 0,!0)]},r.key,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"AdvisorView");export{z as a,B as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as oe}from"./chunk-O77VNUFD.js";import{b as se}from"./chunk-FKO3HO6I.js";import{a as ae}from"./chunk-TQ36RWOP.js";import{a as le}from"./chunk-7RYIQKZA.js";import{a as re}from"./chunk-2K47A3P6.js";import{a as te}from"./chunk-RMYA7NAH.js";import{b as ee}from"./chunk-TBMYIZIO.js";import{R as E}from"./chunk-BHTPZS7L.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as Y}from"./chunk-AQGOX5DK.js";import{a as Z}from"./chunk-TAD43CG5.js";import{b as U}from"./chunk-FCR3HKFV.js";import{b as K}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as X}from"./chunk-YJGANMU7.js";import{a as i,e as D,f as Re,g as Te,h as Ie,j as T}from"./chunk-RRCPZMC2.js";var I=D(Te(),1);var m=D(Re(),1);var r=D(Ie(),1);var Q=400,qe=36,Pe={height:Q,overflow:"auto"},ce={left:0,position:"absolute",top:0,width:"100%"},Me={debug:"secondary",error:"destructive",info:"outline",warn:"secondary"},Oe={error:"destructive",ok:"secondary"},Fe=i(a=>{let e=(0,I.c)(21),{entry:t,index:l,measureRef:n,start:o}=a,d=`translateY(${String(o)}px)`,v;e[0]!==d?(v={...ce,transform:d},e[0]=d,e[1]=v):v=e[1];let f=v,u;e[2]!==t.timestamp?(u=new Date(t.timestamp).toLocaleString(),e[2]=t.timestamp,e[3]=u):u=e[3];let c;e[4]!==u?(c=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u},void 0,!1),e[4]=u,e[5]=c):c=e[5];let y=Me[t.level],g;e[6]!==t.level||e[7]!==y?(g=(0,r.jsxDEV)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(K,{variant:y,children:t.level},void 0,!1)},void 0,!1),e[6]=t.level,e[7]=y,e[8]=g):g=e[8];let b=t.functionPath??"\u2014",p;e[9]!==b?(p=(0,r.jsxDEV)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b},void 0,!1),e[9]=b,e[10]=p):p=e[10];let h;e[11]!==t.message?(h=(0,r.jsxDEV)("span",{className:"flex-1 truncate",role:"gridcell",children:t.message},void 0,!1),e[11]=t.message,e[12]=h):h=e[12];let x;return e[13]!==l||e[14]!==n||e[15]!==f||e[16]!==c||e[17]!==g||e[18]!==p||e[19]!==h?(x=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-row",ref:n,role:"row",style:f,children:[c,g,p,h]},void 0,!0),e[13]=l,e[14]=n,e[15]=f,e[16]=c,e[17]=g,e[18]=p,e[19]=h,e[20]=x):x=e[20],x},"LogRow"),ne=i(a=>a.length===0?"\u2014":a.join(", "),"tablesLabel"),Ae=i(a=>{let e=(0,I.c)(37),{entry:t,index:l,measureRef:n,start:o}=a,d=`translateY(${String(o)}px)`,v;e[0]!==d?(v={...ce,transform:d},e[0]=d,e[1]=v):v=e[1];let f=v,u;e[2]!==t.ts?(u=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=u):u=e[3];let c;e[4]!==u?(c=(0,r.jsxDEV)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u},void 0,!1),e[4]=u,e[5]=c):c=e[5];let y=Oe[t.outcome],g;e[6]!==t.outcome||e[7]!==y?(g=(0,r.jsxDEV)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsxDEV)(K,{variant:y,children:t.outcome},void 0,!1)},void 0,!1),e[6]=t.outcome,e[7]=y,e[8]=g):g=e[8];let b;e[9]!==t.functionPath?(b=(0,r.jsxDEV)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath},void 0,!1),e[9]=t.functionPath,e[10]=b):b=e[10];let p=t.shardKey??"\u2014",h;e[11]!==p?(h=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:p},void 0,!1),e[11]=p,e[12]=h):h=e[12];let x=t.userId??"\u2014",L;e[13]!==x?(L=(0,r.jsxDEV)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:x},void 0,!1),e[13]=x,e[14]=L):L=e[14];let k;e[15]!==t.durationMs?(k=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=k):k=e[16];let R=`${String(k)}ms`,w;e[17]!==R?(w=(0,r.jsxDEV)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:R},void 0,!1),e[17]=R,e[18]=w):w=e[18];let S;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(S=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ne(t.tablesRead)} \xB7 w:${ne(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=S):S=e[23];let N;e[24]!==S?(N=(0,r.jsxDEV)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:S},void 0,!1),e[24]=S,e[25]=N):N=e[25];let C;return e[26]!==l||e[27]!==n||e[28]!==f||e[29]!==L||e[30]!==w||e[31]!==N||e[32]!==c||e[33]!==g||e[34]!==b||e[35]!==h?(C=(0,r.jsxDEV)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":l,"data-testid":"lg-req-row",ref:n,role:"row",style:f,children:[c,g,b,h,L,w,N]},void 0,!0),e[26]=l,e[27]=n,e[28]=f,e[29]=L,e[30]=w,e[31]=N,e[32]=c,e[33]=g,e[34]=b,e[35]=h,e[36]=C):C=e[36],C},"RequestRow"),ie=i(a=>{let{entries:e}=a??{};return Array.isArray(e)?e:[]},"entriesOf"),_e=i(a=>{let e={};return a.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=a.functionPathPrefix.trim()),a.userId.trim()!==""&&(e.userId=a.userId.trim()),a.tableTouched.trim()!==""&&(e.tableTouched=a.tableTouched.trim()),(a.outcome==="ok"||a.outcome==="error")&&(e.outcome=a.outcome),e},"buildRequestQuery"),ue=["debug","info","warn","error"],Ve={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},$e=i((a,e)=>{let t=e.search.trim().toLowerCase(),l=e.path.trim().toLowerCase(),n=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-Ve[e.range];return a.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<n||l!==""&&!(o.functionPath??"").toLowerCase().includes(l)?!1:t===""||o.message.toLowerCase().includes(t))},"filterLogs"),Be="\u2014",ze=i(a=>{let e=new Map,t=new Map;for(let o of a){e.set(o.level,(e.get(o.level)??0)+1);let d=o.functionPath??Be;t.set(d,(t.get(d)??0)+1)}let l=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),n=[...t.entries()].map(([o,d])=>({count:d,key:o})).toSorted((o,d)=>d.count===o.count?o.key.localeCompare(d.key):d.count-o.count);return{byLevel:l,byPath:n,total:a.length}},"summarizeLogs"),De=i(a=>{let e=(0,I.c)(11),{level:t,onToggle:l,selected:n}=a,o;e[0]!==t||e[1]!==l?(o=i(()=>{l(t)},"t1"),e[0]=t,e[1]=l,e[2]=o):o=e[2];let d=o,v=n?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==v?(f=T("rounded-md border px-2 py-1 text-xs",v),e[3]=v,e[4]=f):f=e[4];let u=`logs-level-${t}`,c;return e[5]!==t||e[6]!==d||e[7]!==n||e[8]!==f||e[9]!==u?(c=(0,r.jsxDEV)("button",{"aria-pressed":n,className:f,"data-testid":u,onClick:d,type:"button",children:t},void 0,!1),e[5]=t,e[6]=d,e[7]=n,e[8]=f,e[9]=u,e[10]=c):c=e[10],c},"LevelToggle"),de=i(a=>{let e=(0,I.c)(7),{bucket:t}=a,l;e[0]!==t.key?(l=(0,r.jsxDEV)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key},void 0,!1),e[0]=t.key,e[1]=l):l=e[1];let n;e[2]!==t.count?(n=(0,r.jsxDEV)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count},void 0,!1),e[2]=t.count,e[3]=n):n=e[3];let o;return e[4]!==l||e[5]!==n?(o=(0,r.jsxDEV)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[l,n]},void 0,!0),e[4]=l,e[5]=n,e[6]=o):o=e[6],o},"SummaryBucketRow"),ot=i(({initialShardKey:a})=>{let e=X(),[t,l]=(0,m.useState)("requests"),[n,o]=(0,m.useState)(a??""),[d,v]=(0,m.useState)(""),[f,u]=(0,m.useState)(()=>new Set),[c,y]=(0,m.useState)(""),[g,b]=(0,m.useState)("all"),[p,h]=(0,m.useState)(!1),[x,L]=(0,m.useState)(""),[k,R]=(0,m.useState)(""),[w,S]=(0,m.useState)(""),[N,C]=(0,m.useState)("all"),q=re(n.trim(),400),me=_e({functionPathPrefix:x,outcome:N,tableTouched:w,userId:k}),W=U(Y.getRequestLog,me,{enabled:t==="requests",live:!0,shardKey:q}),G=U(Y.getLogs,{},{enabled:t==="errors",live:!0,shardKey:q}),F=t==="requests"?W:G,{error:A,isLoading:H,liveError:fe}=F,he=ie(G.data),j=ie(W.data);(0,m.useEffect)(()=>{F.data!==void 0&&ee(q)},[F.data,q]);let _=$e(he,{levels:f,now:Date.now(),path:c,range:g,search:d}),V=ze(_),$=t==="requests"?j.length:_.length,B=t==="errors"&&p,P=(0,m.useMemo)(()=>A!==null?"error":$===0?H?B?"summary":"list":"empty":B?"summary":"list",[$,H,A,B]),J=(0,m.useRef)(null),M=se({count:$,estimateSize:i(()=>qe,"estimateSize"),getScrollElement:i(()=>J.current,"getScrollElement"),initialRect:{height:Q,width:800},observeElementRect:i((s,z)=>oe(s,z,Q),"observeElementRect"),overscan:8}),ge=M.getVirtualItems(),ve={height:M.getTotalSize(),position:"relative",width:"100%"},pe=i(s=>{v(s.target.value)},"onSearchChange"),be=i(s=>{u(z=>{let O=new Set(z);return O.has(s)?O.delete(s):O.add(s),O})},"toggleLevel"),xe=i(s=>{y(s.target.value)},"onLogPathChange"),ye=i(s=>{b(s.target.value)},"onTimeRangeChange"),we=i(()=>{h(s=>!s)},"toggleSummary"),Ne=i(s=>{L(s.target.value)},"onPathChange"),Le=i(s=>{R(s.target.value)},"onUserChange"),Se=i(s=>{S(s.target.value)},"onTableChange"),ke=i(s=>{C(s.target.value)},"onOutcomeChange"),Ce=i(()=>{l("requests"),h(!1)},"showRequests"),Ee=i(()=>{l("errors"),h(!1)},"showErrors");return(0,r.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[(0,r.jsxDEV)("button",{"aria-selected":t==="requests",className:T("px-3 py-1 text-sm",t==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:Ce,role:"tab",type:"button",children:e("Requests")},void 0,!1),(0,r.jsxDEV)("button",{"aria-selected":t==="errors",className:T("px-3 py-1 text-sm",t==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:Ee,role:"tab",type:"button",children:e("Errors")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)(te,{onChange:o,testId:"lg-shard-input",value:n},void 0,!1),(0,r.jsxDEV)(le,{message:fe,prefix:"lg"},void 0,!1),(0,r.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:ae,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")},void 0,!1)]},void 0,!0),t==="errors"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:pe,placeholder:e("search message"),value:d},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:xe,placeholder:e("filter path"),value:c},void 0,!1),(0,r.jsxDEV)("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:ue.map(s=>(0,r.jsxDEV)(De,{level:s,onToggle:be,selected:f.has(s)},s,!1))},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Time range"),className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:ye,value:g,children:[(0,r.jsxDEV)("option",{value:"all",children:e("All time")},void 0,!1),(0,r.jsxDEV)("option",{value:"5m",children:e("Last 5m")},void 0,!1),(0,r.jsxDEV)("option",{value:"15m",children:e("Last 15m")},void 0,!1),(0,r.jsxDEV)("option",{value:"1h",children:e("Last hour")},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("button",{"aria-pressed":p,className:T("h-8 rounded-md border px-3 text-sm",p?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:we,type:"button",children:e(p?"List":"Summary")},void 0,!1)]},void 0,!0),t==="requests"&&(0,r.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxDEV)(E,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:Ne,placeholder:e("file:function"),value:x},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:Le,placeholder:e("userId"),value:k},void 0,!1),(0,r.jsxDEV)(E,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:Se,placeholder:e("table"),value:w},void 0,!1),(0,r.jsxDEV)("select",{"aria-label":e("Outcome filter"),className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:ke,value:N,children:[(0,r.jsxDEV)("option",{value:"all",children:e("all")},void 0,!1),(0,r.jsxDEV)("option",{value:"ok",children:e("ok")},void 0,!1),(0,r.jsxDEV)("option",{value:"error",children:e("error")},void 0,!1)]},void 0,!0)]},void 0,!0),P==="error"&&(0,r.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"lg-error",role:"alert",children:A},void 0,!1),P==="empty"&&(0,r.jsxDEV)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsxDEV)("path",{d:"M4 5h16M4 12h16M4 19h10"},void 0,!1)},void 0,!1),testId:"lg-empty",title:e("No logs.")},void 0,!1),P==="summary"&&(0,r.jsxDEV)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[(0,r.jsxDEV)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:V.total})},void 0,!1),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:V.byLevel.map(s=>(0,r.jsxDEV)(de,{bucket:s},s.key,!1))},void 0,!1)]},void 0,!0),(0,r.jsxDEV)("div",{children:[(0,r.jsxDEV)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")},void 0,!1),(0,r.jsxDEV)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:V.byPath.map(s=>(0,r.jsxDEV)(de,{bucket:s},s.key,!1))},void 0,!1)]},void 0,!0)]},void 0,!0),P==="list"&&(0,r.jsxDEV)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:J,style:Pe,children:(0,r.jsxDEV)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:ve,children:ge.map(s=>t==="requests"?(0,r.jsxDEV)(Ae,{entry:j[s.index],index:s.index,measureRef:M.measureElement,start:s.start},s.key,!1):(0,r.jsxDEV)(Fe,{entry:_[s.index],index:s.index,measureRef:M.measureElement,start:s.start},s.key,!1))},void 0,!1)},void 0,!1)]},void 0,!0)},"LogsPanel");export{ot as LogsPanel,$e as filterLogs,ze as summarizeLogs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as E}from"./chunk-FCR3HKFV.js";import{a as y,e as B}from"./chunk-SEU5V7I6.js";import{b as A}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import{f as k}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as C}from"./chunk-YJGANMU7.js";import{a as x,e as N,g as O,h as P}from"./chunk-RRCPZMC2.js";var L=N(O(),1);var a=N(P(),1);var S=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],D=x(()=>{let e=(0,L.c)(29),g=k(),t=C(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=["lunora-auth-capabilities"],e[0]=p):p=e[0];let u;e[1]!==g?(u=x(()=>g.getAuthCapabilities(),"t1"),e[1]=g,e[2]=u):u=e[2];let{data:i,error:l}=E(p,u),s;e[3]!==t?(s=t("Enabled capabilities"),e[3]=t,e[4]=s):s=e[4];let r;e[5]!==s?(r=(0,a.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s},void 0,!1)},void 0,!1),e[5]=s,e[6]=r):r=e[6];let o;e[7]!==l?(o=l!==null&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:l},void 0,!1),e[7]=l,e[8]=o):o=e[8];let d;e[9]!==i||e[10]!==l||e[11]!==t?(d=l===null&&i===void 0&&(0,a.jsxDEV)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")},void 0,!1),e[9]=i,e[10]=l,e[11]=t,e[12]=d):d=e[12];let n;e[13]!==i||e[14]!==l||e[15]!==t?(n=l===null&&i!==void 0&&(0,a.jsxDEV)(B,{className:"p-3",children:(0,a.jsxDEV)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:S.map(b=>{let v=i[b.key];return(0,a.jsxDEV)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-cap-${b.key}`,children:[(0,a.jsxDEV)("span",{className:"text-sm",children:t(b.label)},void 0,!1),(0,a.jsxDEV)(A,{variant:v?"success":"outline",children:t(v?"Enabled":"Disabled")},void 0,!1)]},b.key,!0)})},void 0,!1)},void 0,!1),e[13]=i,e[14]=l,e[15]=t,e[16]=n):n=e[16];let c;e[17]!==r||e[18]!==o||e[19]!==d||e[20]!==n?(c=(0,a.jsxDEV)(y,{className:"gap-0 py-0",children:[r,o,d,n]},void 0,!0),e[17]=r,e[18]=o,e[19]=d,e[20]=n,e[21]=c):c=e[21];let f;e[22]!==t?(f=t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output."),e[22]=t,e[23]=f):f=e[23];let m;e[24]!==f?(m=(0,a.jsxDEV)(y,{className:"gap-0 py-0",children:(0,a.jsxDEV)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children:f},void 0,!1)},void 0,!1),e[24]=f,e[25]=m):m=e[25];let h;return e[26]!==c||e[27]!==m?(h=(0,a.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[c,m]},void 0,!0),e[26]=c,e[27]=m,e[28]=h):h=e[28],h},"AuthConfigPanel");export{D as AuthConfigPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as F}from"./chunk-J6J54MBP.js";import{a as _}from"./chunk-2K47A3P6.js";import{a as j,b as H,c as P,d as A,e as c,f as u}from"./chunk-GTM65MVX.js";import{a as R}from"./chunk-RMYA7NAH.js";import"./chunk-TBMYIZIO.js";import"./chunk-BHTPZS7L.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as K}from"./chunk-AQGOX5DK.js";import{a as B}from"./chunk-TAD43CG5.js";import{b as E}from"./chunk-FCR3HKFV.js";import{a as M,e as $}from"./chunk-SEU5V7I6.js";import{b as S}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as D}from"./chunk-YJGANMU7.js";import{a as g,e as k,f as J,g as Q,h as U}from"./chunk-RRCPZMC2.js";var O=k(Q(),1),W=k(J(),1);var t=k(U(),1);var L=80,V=g(a=>{if(a===void 0)return"";let e=JSON.stringify(a);return e.length>L?`${e.slice(0,L)}\u2026`:e},"formatArguments"),X=g(a=>{let e=[];for(let n of a){let s=n.id.toString();if(n.subscriptions.length===0){e.push({admin:n.admin,connectionId:n.id,key:`c${s}`,subscription:null});continue}n.subscriptions.forEach((o,y)=>{e.push({admin:n.admin,connectionId:n.id,key:`c${s}-s${y.toString()}`,subscription:o})})}return e},"toRows"),I=(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:"\u2014"},void 0,!1),re=g(a=>{let e=(0,O.c)(20),{initialShardKey:n}=a,s=D(),[o,y]=(0,W.useState)(n??""),m;e[0]!==o?(m=o.trim(),e[0]=o,e[1]=m):m=e[1];let N=_(m,400),f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f={},e[2]=f):f=e[2];let h;e[3]!==N?(h={keepPreviousData:!0,shardKey:N},e[3]=N,e[4]=h):h=e[4];let{data:i,error:r,refetch:G}=E(K.listSubscriptions,f,h);F(G,!0);let p;if(e[5]!==r||e[6]!==i||e[7]!==o||e[8]!==s){let C=i===void 0?[]:X(i.connections),l;e[10]!==o?(l=(0,t.jsxDEV)(R,{onChange:y,testId:"subs-shard-input",value:o},void 0,!1),e[10]=o,e[11]=l):l=e[11];let d;e[12]!==i||e[13]!==s?(d=i!==void 0&&(0,t.jsxDEV)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsxDEV)(S,{variant:"secondary",children:s("{count} connections",{count:i.totalConnections})},void 0,!1),(0,t.jsxDEV)(S,{variant:"secondary",children:s("{count} subscriptions",{count:i.totalSubscriptions})},void 0,!1)]},void 0,!0),e[12]=i,e[13]=s,e[14]=d):d=e[14];let v;e[15]!==l||e[16]!==d?(v=(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[l,d]},void 0,!0),e[15]=l,e[16]=d,e[17]=v):v=e[17];let b;e[18]!==r?(b=r!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"subs-error",role:"alert",children:r},void 0,!1),e[18]=r,e[19]=b):b=e[19],p=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[v,b,r===null&&i!==void 0&&C.length===0&&(0,t.jsxDEV)(B,{description:s("Active WebSocket subscriptions on this shard."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"},void 0,!1)},void 0,!1),testId:"subs-empty",title:s("No active subscriptions.")},void 0,!1),r===null&&C.length>0&&(0,t.jsxDEV)(M,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)($,{className:"px-0",children:(0,t.jsxDEV)(j,{"data-testid":"subs-table",children:[(0,t.jsxDEV)(H,{children:(0,t.jsxDEV)(A,{children:[(0,t.jsxDEV)(c,{children:s("Connection")},void 0,!1),(0,t.jsxDEV)(c,{children:s("Function path")},void 0,!1),(0,t.jsxDEV)(c,{children:s("Table")},void 0,!1),(0,t.jsxDEV)(c,{children:s("Arguments")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(P,{children:C.map(x=>{let{subscription:T}=x,w=V(T?.args);return(0,t.jsxDEV)(A,{"data-testid":"subs-row",children:[(0,t.jsxDEV)(u,{className:"font-medium tabular-nums",children:(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1.5",children:["#",x.connectionId,x.admin&&(0,t.jsxDEV)(S,{variant:"outline",children:s("admin")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(u,{className:"font-mono text-xs",children:T?.functionPath??I},void 0,!1),(0,t.jsxDEV)(u,{children:T?.table??I},void 0,!1),(0,t.jsxDEV)(u,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:w||void 0,children:w||I},void 0,!1)]},x.key,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0),e[5]=r,e[6]=i,e[7]=o,e[8]=s,e[9]=p}else p=e[9];return p},"SubscriptionsPanel");export{re as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as le}from"./chunk-P7DSVO4U.js";import{a as X}from"./chunk-AHILM3ZP.js";import{a as ae}from"./chunk-J6J54MBP.js";import{a as se}from"./chunk-2K47A3P6.js";import{a as G,b as W,c as Y,d as B,e as F,f as U}from"./chunk-GTM65MVX.js";import{a as z}from"./chunk-JSEXCW5Q.js";import{R as D}from"./chunk-BHTPZS7L.js";import{c as S}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as ee}from"./chunk-TAD43CG5.js";import{a as te}from"./chunk-FCR3HKFV.js";import{a as V,e as j}from"./chunk-SEU5V7I6.js";import{b as E}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import{f as $}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as M,g as Z,h as H,i as O,l as Q}from"./chunk-YJGANMU7.js";import{a,e as K,f as ge,g as Ne,h as we}from"./chunk-RRCPZMC2.js";var m=K(ge(),1);var t=K(we(),1),q=K(Ne(),1);var ke=a(({onClose:w,onCreated:e})=>{let i=$(),s=M(),[c,d]=(0,m.useState)(""),[u,l]=(0,m.useState)(""),[o,f]=(0,m.useState)(""),[k,I]=(0,m.useState)(""),[C,b]=(0,m.useState)(!1),[N,y]=(0,m.useState)(null),h=a(r=>{d(r.target.value)},"onEmailChange"),p=a(r=>{l(r.target.value)},"onNameChange"),x=a(r=>{f(r.target.value)},"onPasswordChange"),v=a(r=>{I(r.target.value)},"onRoleChange"),n=a(async()=>{b(!0),y(null);try{await i.createAuthUser({email:c.trim(),name:u.trim(),password:o===""?void 0:o,role:k.trim()===""?void 0:k.trim()}),e(),w()}catch(r){y(Z(r))}finally{b(!1)}},"submit"),A=a(()=>{O(n())},"onSubmit");return(0,t.jsxDEV)(X,{label:s("Create user"),onClose:w,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:s("Create user")},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-email",children:s("email")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-email",id:"uc-email",onChange:h,type:"email",value:c},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-name",children:s("name")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-name",id:"uc-name",onChange:p,value:u},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-password",children:s("Password (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-password",id:"uc-password",onChange:x,type:"password",value:o},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"uc-role",children:s("Role (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"uc-role",id:"uc-role",onChange:v,value:k},void 0,!1)]},void 0,!0),N!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:N},void 0,!1),(0,t.jsxDEV)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsxDEV)(S,{"data-testid":"uc-cancel",onClick:w,size:"sm",type:"button",variant:"outline",children:s("Cancel")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"uc-submit",disabled:C||c.trim()===""||u.trim()==="",onClick:A,size:"sm",type:"button",children:s(C?"Creating\u2026":"Create")},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserCreateDialog"),_=a(w=>{let e=(0,q.c)(2),{children:i}=w,s;return e[0]!==i?(s=(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1),e[0]=i,e[1]=s):s=e[1],s},"SectionHeading"),Ce=a(w=>{let e=(0,q.c)(29),{busy:i,runAction:s,userId:c,version:d}=w,u=$(),l=M(),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(null),C;e[0]!==u||e[1]!==c?(C=a(()=>{O((async()=>{I(null);try{let r=await u.listAuthSessions({limit:50,userId:c});f(r.rows)}catch(r){let R=r;f(null),I(Z(R))}})())},"t1"),e[0]=u,e[1]=c,e[2]=C):C=e[2];let b;e[3]!==u||e[4]!==c||e[5]!==d?(b=[u,c,d],e[3]=u,e[4]=c,e[5]=d,e[6]=b):b=e[6],(0,m.useEffect)(C,b);let N;e[7]!==u||e[8]!==s?(N=a(r=>{s(()=>u.revokeAuthSession({sessionId:r}))},"t3"),e[7]=u,e[8]=s,e[9]=N):N=e[9];let y=N,h;e[10]!==l?(h=l("Sessions"),e[10]=l,e[11]=h):h=e[11];let p;e[12]!==h?(p=(0,t.jsxDEV)(_,{children:h},void 0,!1),e[12]=h,e[13]=p):p=e[13];let x;e[14]!==k?(x=k!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:k},void 0,!1),e[14]=k,e[15]=x):x=e[15];let v;e[16]!==o||e[17]!==l?(v=o!==null&&o.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:l("No active sessions.")},void 0,!1),e[16]=o,e[17]=l,e[18]=v):v=e[18];let n;e[19]!==i||e[20]!==y||e[21]!==o||e[22]!==l?(n=o!==null&&o.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-sessions-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:l("expires")},void 0,!1),(0,t.jsxDEV)(F,{children:l("ip")},void 0,!1),(0,t.jsxDEV)(F,{children:l("user agent")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:o.map(r=>(0,t.jsxDEV)(B,{"data-testid":`ud-session-${r.id}`,children:[(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(r.expiresAt)},void 0,!1),(0,t.jsxDEV)(U,{children:r.ipAddress??""},void 0,!1),(0,t.jsxDEV)(U,{className:"max-w-40 truncate",children:r.userAgent??""},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-revoke-${r.id}`,disabled:i,onClick:a(()=>{y(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Revoke")},void 0,!1)},void 0,!1)]},r.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[19]=i,e[20]=y,e[21]=o,e[22]=l,e[23]=n):n=e[23];let A;return e[24]!==p||e[25]!==x||e[26]!==v||e[27]!==n?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[p,x,v,n]},void 0,!0),e[24]=p,e[25]=x,e[26]=v,e[27]=n,e[28]=A):A=e[28],A},"UserSessionsPanel"),Ae=a(w=>{let e=(0,q.c)(30),{busy:i,runAction:s,userId:c,version:d}=w,u=$(),l=M(),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(null),C;e[0]!==u||e[1]!==c?(C=a(()=>{O((async()=>{I(null);try{f(await u.listAuthAccounts({userId:c}))}catch(r){let R=r;f(null),I(Z(R))}})())},"t1"),e[0]=u,e[1]=c,e[2]=C):C=e[2];let b;e[3]!==u||e[4]!==c||e[5]!==d?(b=[u,c,d],e[3]=u,e[4]=c,e[5]=d,e[6]=b):b=e[6],(0,m.useEffect)(C,b);let N;e[7]!==u||e[8]!==s||e[9]!==c?(N=a(r=>{s(()=>u.unlinkAuthAccount({accountId:r,userId:c}))},"t3"),e[7]=u,e[8]=s,e[9]=c,e[10]=N):N=e[10];let y=N,h;e[11]!==l?(h=l("Linked accounts"),e[11]=l,e[12]=h):h=e[12];let p;e[13]!==h?(p=(0,t.jsxDEV)(_,{children:h},void 0,!1),e[13]=h,e[14]=p):p=e[14];let x;e[15]!==k?(x=k!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive",role:"alert",children:k},void 0,!1),e[15]=k,e[16]=x):x=e[16];let v;e[17]!==o||e[18]!==l?(v=o!==null&&o.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:l("No linked accounts.")},void 0,!1),e[17]=o,e[18]=l,e[19]=v):v=e[19];let n;e[20]!==o||e[21]!==i||e[22]!==y||e[23]!==l?(n=o!==null&&o.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-accounts-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:l("provider")},void 0,!1),(0,t.jsxDEV)(F,{children:l("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":l("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:o.map(r=>{let R=H(r.id);return(0,t.jsxDEV)(B,{"data-testid":`ud-account-${R}`,children:[(0,t.jsxDEV)(U,{children:H(r.providerId)},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(r.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-unlink-${R}`,disabled:i,onClick:a(()=>{y(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Unlink")},void 0,!1)},void 0,!1)]},R,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[20]=o,e[21]=i,e[22]=y,e[23]=l,e[24]=n):n=e[24];let A;return e[25]!==p||e[26]!==x||e[27]!==v||e[28]!==n?(A=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[p,x,v,n]},void 0,!0),e[25]=p,e[26]=x,e[27]=v,e[28]=n,e[29]=A):A=e[29],A},"UserAccountsPanel"),Ie=a(w=>{let e=(0,q.c)(40),{busy:i,capabilities:s,runAction:c,userId:d,version:u}=w,l=$(),o=M(),[f,k]=(0,m.useState)(null),I;e[0]!==s.passkey||e[1]!==l||e[2]!==d?(I=a(()=>{s.passkey&&O((async()=>{try{k(await l.listAuthPasskeys({userId:d}))}catch{k(null)}})())},"t1"),e[0]=s.passkey,e[1]=l,e[2]=d,e[3]=I):I=e[3];let C;e[4]!==s.passkey||e[5]!==l||e[6]!==d||e[7]!==u?(C=[s.passkey,l,d,u],e[4]=s.passkey,e[5]=l,e[6]=d,e[7]=u,e[8]=C):C=e[8],(0,m.useEffect)(I,C);let b;e[9]!==l||e[10]!==c||e[11]!==d?(b=a(()=>{c(()=>l.disableAuthTwoFactor({userId:d}))},"t3"),e[9]=l,e[10]=c,e[11]=d,e[12]=b):b=e[12];let N=b,y;e[13]!==l||e[14]!==c?(y=a(R=>{c(()=>l.deleteAuthPasskey({passkeyId:R}))},"t4"),e[13]=l,e[14]=c,e[15]=y):y=e[15];let h=y,p;e[16]!==o?(p=o("Security"),e[16]=o,e[17]=p):p=e[17];let x;e[18]!==p?(x=(0,t.jsxDEV)(_,{children:p},void 0,!1),e[18]=p,e[19]=x):x=e[19];let v;e[20]!==i||e[21]!==s.twoFactor||e[22]!==N||e[23]!==o?(v=s.twoFactor&&(0,t.jsxDEV)(S,{"data-testid":"ud-disable-2fa",disabled:i,onClick:N,size:"sm",type:"button",variant:"outline",children:o("Disable two-factor")},void 0,!1),e[20]=i,e[21]=s.twoFactor,e[22]=N,e[23]=o,e[24]=v):v=e[24];let n;e[25]!==s.passkey||e[26]!==f||e[27]!==o?(n=s.passkey&&f!==null&&f.length===0&&(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o("No passkeys.")},void 0,!1),e[25]=s.passkey,e[26]=f,e[27]=o,e[28]=n):n=e[28];let A;e[29]!==i||e[30]!==s.passkey||e[31]!==h||e[32]!==f||e[33]!==o?(A=s.passkey&&f!==null&&f.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"ud-passkeys-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:o("name")},void 0,!1),(0,t.jsxDEV)(F,{children:o("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":o("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:f.map(R=>{let T=H(R.id);return(0,t.jsxDEV)(B,{"data-testid":`ud-passkey-${T}`,children:[(0,t.jsxDEV)(U,{children:H(R.name)||T},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(R.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`ud-delete-passkey-${T}`,disabled:i,onClick:a(()=>{h(T)},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")},void 0,!1)},void 0,!1)]},T,!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[29]=i,e[30]=s.passkey,e[31]=h,e[32]=f,e[33]=o,e[34]=A):A=e[34];let r;return e[35]!==x||e[36]!==v||e[37]!==n||e[38]!==A?(r=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[x,v,n,A]},void 0,!0),e[35]=x,e[36]=v,e[37]=n,e[38]=A,e[39]=r):r=e[39],r},"UserSecurityPanel"),Se=/(?:at|expires)$/iu,Fe=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),Ue=a((w,e)=>typeof e=="number"&&Se.test(w)?Q(e):H(e),"formatField"),Re=a(({capabilities:w,onChanged:e,onClose:i,user:s})=>{let c=$(),d=M(),u=s.banned===!0,[l,o]=(0,m.useState)(null),[f,k]=(0,m.useState)(!1),[I,C]=(0,m.useState)(0),[b,N]=(0,m.useState)(typeof s.role=="string"?s.role:""),[y,h]=(0,m.useState)(""),[p,x]=(0,m.useState)(""),[v,n]=(0,m.useState)(""),[A,r]=(0,m.useState)(null),[R,T]=(0,m.useState)(!1),P=a((g,L)=>{O((async()=>{k(!0),o(null);try{let J=await g();L?.refresh!==!1&&(C(ye=>ye+1),e()),L?.onResult?.(J)}catch(J){o(Z(J))}finally{k(!1)}})())},"runAction"),ie=a(g=>{N(g.target.value)},"onRoleInputChange"),de=a(g=>{h(g.target.value)},"onBanReasonChange"),oe=a(g=>{x(g.target.value)},"onBanDaysChange"),ne=a(g=>{n(g.target.value)},"onNewPasswordChange"),re=a(()=>{let g=b.trim();g!==""&&P(async()=>{await c.setAuthUserRole({role:g,userId:s.id})})},"onSetRole"),ce=a(()=>{let g=Number.parseInt(p,10),L=Number.isFinite(g)&&g>0?g*86400:void 0;P(async()=>{await c.banAuthUser({expiresInSeconds:L,reason:y.trim()===""?void 0:y.trim(),userId:s.id})})},"onBan"),ue=a(()=>{P(async()=>{await c.unbanAuthUser({userId:s.id})})},"onUnban"),fe=a(()=>{P(async()=>{await c.setAuthUserPassword({newPassword:v,userId:s.id}),n("")})},"onSetPassword"),ve=a(()=>{P(()=>c.impersonateAuthUser({userId:s.id}),{onResult:a(g=>{r(g.token)},"onResult"),refresh:!1})},"onImpersonate"),me=a(()=>{P(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"onRevokeAll"),he=a(()=>{P(async()=>{await c.removeAuthUser({userId:s.id}),i()})},"onDelete"),pe=a(()=>{T(!0)},"onConfirmDelete"),xe=a(()=>{T(!1)},"onCancelDelete"),be=Object.entries(s).filter(([g])=>!Fe.has(g));return(0,t.jsxDEV)(X,{label:d("User details"),onClose:i,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxDEV)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id},void 0,!1),(0,t.jsxDEV)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsxDEV)(E,{variant:"secondary",children:s.role},void 0,!1),u?(0,t.jsxDEV)(E,{variant:"destructive",children:d("Banned")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:d("Active")},void 0,!1),s.emailVerified===!0?(0,t.jsxDEV)(E,{variant:"secondary",children:d("verified")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:d("unverified")},void 0,!1)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-close",onClick:i,size:"sm",type:"button",variant:"ghost",children:d("Close")},void 0,!1)]},void 0,!0),l!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:l},void 0,!1),w.admin&&(0,t.jsxDEV)(V,{className:"gap-0 py-0",children:[(0,t.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Actions")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(j,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-role",children:d("Role")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-role-input",id:"ud-role",onChange:ie,value:b},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-set-role",disabled:f||b.trim()==="",onClick:re,size:"sm",type:"button",variant:"outline",children:d("Set role")},void 0,!1)]},void 0,!0),u?(0,t.jsxDEV)(S,{"data-testid":"ud-unban",disabled:f,onClick:ue,size:"sm",type:"button",variant:"outline",children:d("Unban")},void 0,!1):(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-ban-reason",children:d("Ban reason (optional)")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:de,value:y},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-ban-days",children:d("Days")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:oe,type:"number",value:p},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-ban",disabled:f,onClick:ce,size:"sm",type:"button",variant:"destructive",children:d("Ban user")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex items-end gap-2",children:[(0,t.jsxDEV)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-password",children:d("New password")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-password",id:"ud-password",onChange:ne,type:"password",value:v},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(S,{"data-testid":"ud-set-password",disabled:f||v==="",onClick:fe,size:"sm",type:"button",variant:"outline",children:d("Set password")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxDEV)(S,{"data-testid":"ud-impersonate",disabled:f,onClick:ve,size:"sm",type:"button",variant:"outline",children:d("Impersonate")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"ud-revoke-all",disabled:f,onClick:me,size:"sm",type:"button",variant:"outline",children:d("Revoke all sessions")},void 0,!1),R?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(S,{"data-testid":"ud-delete-confirm",disabled:f,onClick:he,size:"sm",type:"button",variant:"destructive",children:d("Confirm delete")},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"ud-delete-cancel",onClick:xe,size:"sm",type:"button",variant:"ghost",children:d("Cancel")},void 0,!1)]},void 0,!0):(0,t.jsxDEV)(S,{"data-testid":"ud-delete",disabled:f,onClick:pe,size:"sm",type:"button",variant:"destructive",children:d("Delete user")},void 0,!1)]},void 0,!0),A!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsxDEV)(z,{htmlFor:"ud-token",children:d("Impersonation token")},void 0,!1),(0,t.jsxDEV)(D,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),(0,t.jsxDEV)(Ce,{busy:f,runAction:P,userId:s.id,version:I},void 0,!1),w.accounts&&(0,t.jsxDEV)(Ae,{busy:f,runAction:P,userId:s.id,version:I},void 0,!1),(w.twoFactor||w.passkey)&&(0,t.jsxDEV)(Ie,{busy:f,capabilities:w,runAction:P,userId:s.id,version:I},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Fields")},void 0,!1),(0,t.jsxDEV)("dl",{className:"flex flex-col",children:be.map(([g,L])=>(0,t.jsxDEV)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsxDEV)("dt",{className:"text-xs font-semibold text-muted-foreground",children:g},void 0,!1),(0,t.jsxDEV)("dd",{className:"m-0 font-mono text-xs break-words",children:Ue(g,L)},void 0,!1)]},g,!0))},void 0,!1)]},void 0,!0)]},void 0,!0)},"UserDetailDrawer"),De=50,We=a(({pageSize:w=De}={})=>{let e=$(),i=M(),[s,c]=(0,m.useState)(""),[d,u]=(0,m.useState)(""),l=se(s),[o,f]=(0,m.useState)(null),[k,I]=(0,m.useState)(!1),{capabilities:C}=le(),b=l.trim(),N=d.trim(),y=te(["lunora-auth-users",b,N,w],()=>e.listAuthUsers({filterField:N===""?void 0:"role",filterValue:N===""?void 0:N,limit:w,search:b===""?void 0:b}),{keepPreviousData:!0}),h=y.data?.rows??null,p=y.error,x=a(()=>{y.refetch()},"reloadUsers");ae(()=>{y.refetch()},!0);let v=o===null?null:h?.find(n=>n.id===o)??null;return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(D,{"aria-label":i("Search users"),className:"w-56","data-testid":"us-search",onChange:a(n=>{c(n.target.value)},"onChange"),placeholder:i("Search by email or name\u2026"),value:s},void 0,!1),(0,t.jsxDEV)(D,{"aria-label":i("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:a(n=>{u(n.target.value)},"onChange"),placeholder:i("Filter by role"),value:d},void 0,!1),(0,t.jsxDEV)(S,{"data-testid":"us-new",onClick:a(()=>{I(!0)},"onClick"),size:"sm",type:"button",children:i("New user")},void 0,!1)]},void 0,!0),p!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:p},void 0,!1),h!==null&&h.length===0&&(0,t.jsxDEV)(ee,{description:i("Users who sign up to your app will appear here."),icon:(0,t.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsxDEV)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"},void 0,!1)},void 0,!1),testId:"us-empty",title:i("No users.")},void 0,!1),h!==null&&h.length>0&&(0,t.jsxDEV)(V,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(j,{className:"px-0",children:(0,t.jsxDEV)(G,{"data-testid":"us-table",children:[(0,t.jsxDEV)(W,{children:(0,t.jsxDEV)(B,{children:[(0,t.jsxDEV)(F,{children:i("id")},void 0,!1),(0,t.jsxDEV)(F,{children:i("email")},void 0,!1),(0,t.jsxDEV)(F,{children:i("name")},void 0,!1),(0,t.jsxDEV)(F,{children:i("role")},void 0,!1),(0,t.jsxDEV)(F,{children:i("status")},void 0,!1),(0,t.jsxDEV)(F,{children:i("verified")},void 0,!1),(0,t.jsxDEV)(F,{children:i("created")},void 0,!1),(0,t.jsxDEV)(F,{"aria-label":i("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(Y,{children:h.map(n=>(0,t.jsxDEV)(B,{"data-testid":`us-row-${n.id}`,children:[(0,t.jsxDEV)(U,{className:"font-mono text-xs",children:n.id},void 0,!1),(0,t.jsxDEV)(U,{children:n.email??""},void 0,!1),(0,t.jsxDEV)(U,{children:n.name??""},void 0,!1),(0,t.jsxDEV)(U,{children:typeof n.role=="string"&&n.role!==""?(0,t.jsxDEV)(E,{variant:"secondary",children:n.role},void 0,!1):""},void 0,!1),(0,t.jsxDEV)(U,{children:n.banned===!0?(0,t.jsxDEV)(E,{variant:"destructive",children:i("Banned")},void 0,!1):(0,t.jsxDEV)(E,{variant:"success",children:i("Active")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(U,{children:n.emailVerified===!0?(0,t.jsxDEV)(E,{variant:"success",children:i("yes")},void 0,!1):(0,t.jsxDEV)(E,{variant:"outline",children:i("no")},void 0,!1)},void 0,!1),(0,t.jsxDEV)(U,{className:"text-muted-foreground tabular-nums",children:Q(n.createdAt)},void 0,!1),(0,t.jsxDEV)(U,{children:(0,t.jsxDEV)(S,{"data-testid":`us-manage-${n.id}`,onClick:a(()=>{f(n.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Manage")},void 0,!1)},void 0,!1)]},n.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),v!==null&&(0,t.jsxDEV)(Re,{capabilities:C,onChanged:x,onClose:a(()=>{f(null)},"onClose"),user:v},void 0,!1),k&&(0,t.jsxDEV)(ke,{onClose:a(()=>{I(!1)},"onClose"),onCreated:x},void 0,!1)]},void 0,!0)},"UsersPanel");export{We as UsersPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as dt,b as nt,c as ct,d as ut,e as Me}from"./chunk-ASLGNHAX.js";import{a as ft,b as mt,c as vt,d as ht,e as gt}from"./chunk-N4JI6VQD.js";import"./chunk-DWDILV2E.js";import"./chunk-6VTGE3WJ.js";import{e as it}from"./chunk-TQ36RWOP.js";import"./chunk-UGMRUEBU.js";import{a as ot}from"./chunk-7RYIQKZA.js";import"./chunk-NNISYDNI.js";import"./chunk-5OIBXYZM.js";import"./chunk-FQKNJSRA.js";import"./chunk-BJGBHGK3.js";import"./chunk-UII66UVF.js";import{a as rt}from"./chunk-2K47A3P6.js";import"./chunk-KEGAWN6Y.js";import{a as st,b as lt,c as at,d as je,e as $e,f as Te}from"./chunk-GTM65MVX.js";import"./chunk-4QHKBC77.js";import{a as tt}from"./chunk-RMYA7NAH.js";import{a as Ze,b as et}from"./chunk-TBMYIZIO.js";import"./chunk-BHTPZS7L.js";import{c as Oe}from"./chunk-YQQJ4N6U.js";import"./chunk-TICVNLPM.js";import"./chunk-HV7G6DFP.js";import{a as Pe}from"./chunk-AQGOX5DK.js";import{b as Ye}from"./chunk-FCR3HKFV.js";import{a as B,b as Re,c as _e,d as Ve,e as P}from"./chunk-SEU5V7I6.js";import{b as Ke}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import{f as Ue}from"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as Qe,e as Ge,f as Je,g as We,i as Xe,k as Ae}from"./chunk-YJGANMU7.js";import{a as n,e as Be,f as pt,g as xt,h as bt}from"./chunk-RRCPZMC2.js";var Le=Be(xt(),1);var v=Be(pt(),1);var t=Be(bt(),1);var ze=n(l=>l>=100?"critical":l>=50?"warning":"good","performanceLevel"),He=n(l=>l<1?`${(l*1e3).toFixed(0)}\u03BCs`:l<1e3?`${l.toFixed(1)}ms`:`${(l/1e3).toFixed(2)}s`,"formatLatency"),Ee=n(l=>l>=1e9?`${(l/1e9).toFixed(1)}B`:l>=1e6?`${(l/1e6).toFixed(1)}M`:l>=1e3?`${(l/1e3).toFixed(1)}K`:l.toLocaleString(),"formatCount"),Nt=n(l=>{let e=(0,Le.c)(3),{level:s}=l;if(s==="critical"){let i;return e[0]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxDEV)(Ke,{variant:"destructive",children:"Slow"},void 0,!1),e[0]=i):i=e[0],i}if(s==="warning"){let i;return e[1]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:"Moderate"},void 0,!1),e[1]=i):i=e[1],i}let r;return e[2]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxDEV)("span",{className:"inline-flex items-center gap-1 rounded-md border border-transparent bg-success/10 px-2 py-0.5 text-xs font-medium text-success",children:"Fast"},void 0,!1),e[2]=r):r=e[2],r},"PerformanceBadge"),yt=n(l=>{let e=(0,Le.c)(152),{queryStats:s}=l,r=Qe(),[i,Q]=(0,v.useState)("totalTime"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C=new Set,e[0]=C):C=e[0];let[h,T]=(0,v.useState)(C),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=n(o=>{o!==null&&Q(o)},"t2"),e[1]=p):p=e[1];let S=p,u;if(e[2]!==s||e[3]!==i){u=[...s];let o;e[5]!==i?(o=n((m,c)=>{switch(i){case"avgTime":return c.avgDurationMs-m.avgDurationMs;case"execCount":return c.execCount-m.execCount;case"rowsRead":return c.rowsRead-m.rowsRead;default:return c.totalDurationMs-m.totalDurationMs}},"t310"),e[5]=i,e[6]=o):o=e[6],u.sort(o),e[2]=s,e[3]=i,e[4]=u}else u=e[4];let g=u,$;e[7]!==s?($=s.filter(St),e[7]=s,e[8]=$):$=e[8];let j=$.length,H;e[9]!==s?(H=s.filter(wt),e[9]=s,e[10]=H):H=e[10];let d=H.length,_;e[11]!==s?(_=s.filter(qt),e[11]=s,e[12]=_):_=e[12];let U=_.length,O;e[13]===Symbol.for("react.memo_cache_sentinel")?(O=n(o=>{T(m=>{let c=new Set(m);return c.has(o)?c.delete(o):c.add(o),c})},"t6"),e[13]=O):O=e[13];let Fe=O;if(s.length===0){let o;e[14]!==r?(o=r("No query insights yet"),e[14]=r,e[15]=o):o=e[15];let m;e[16]!==o?(m=(0,t.jsxDEV)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:o},void 0,!1),e[16]=o,e[17]=m):m=e[17];let c;e[18]!==r?(c=r("Query insights appear once statements are executed against this shard."),e[18]=r,e[19]=c):c=e[19];let z;e[20]!==c?(z=(0,t.jsxDEV)("p",{className:"mt-1 text-sm",children:c},void 0,!1),e[20]=c,e[21]=z):z=e[21];let ke;return e[22]!==z||e[23]!==m?(ke=(0,t.jsxDEV)(B,{children:(0,t.jsxDEV)(P,{className:"py-12",children:(0,t.jsxDEV)("div",{className:"text-center text-muted-foreground",children:[m,z]},void 0,!0)},void 0,!1)},void 0,!1),e[22]=z,e[23]=m,e[24]=ke):ke=e[24],ke}let I;e[25]!==r?(I=r("Critical queries"),e[25]=r,e[26]=I):I=e[26];let f;e[27]!==I?(f=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:I},void 0,!1)},void 0,!1),e[27]=I,e[28]=f):f=e[28];let M;e[29]!==j?(M=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:j},void 0,!1),e[29]=j,e[30]=M):M=e[30];let D;e[31]!==r?(D=r(">100ms avg execution"),e[31]=r,e[32]=D):D=e[32];let R;e[33]!==D?(R=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:D},void 0,!1),e[33]=D,e[34]=R):R=e[34];let F;e[35]!==R||e[36]!==M?(F=(0,t.jsxDEV)(P,{children:[M,R]},void 0,!0),e[35]=R,e[36]=M,e[37]=F):F=e[37];let b;e[38]!==F||e[39]!==f?(b=(0,t.jsxDEV)(B,{children:[f,F]},void 0,!0),e[38]=F,e[39]=f,e[40]=b):b=e[40];let N;e[41]!==r?(N=r("Moderate queries"),e[41]=r,e[42]=N):N=e[42];let k;e[43]!==N?(k=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:N},void 0,!1)},void 0,!1),e[43]=N,e[44]=k):k=e[44];let A;e[45]!==d?(A=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:d},void 0,!1),e[45]=d,e[46]=A):A=e[46];let E;e[47]!==r?(E=r("50\u2013100ms avg execution"),e[47]=r,e[48]=E):E=e[48];let L;e[49]!==E?(L=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:E},void 0,!1),e[49]=E,e[50]=L):L=e[50];let a;e[51]!==A||e[52]!==L?(a=(0,t.jsxDEV)(P,{children:[A,L]},void 0,!0),e[51]=A,e[52]=L,e[53]=a):a=e[53];let w;e[54]!==k||e[55]!==a?(w=(0,t.jsxDEV)(B,{children:[k,a]},void 0,!0),e[54]=k,e[55]=a,e[56]=w):w=e[56];let x;e[57]!==r?(x=r("Fast queries"),e[57]=r,e[58]=x):x=e[58];let y;e[59]!==x?(y=(0,t.jsxDEV)(Re,{className:"pb-2",children:(0,t.jsxDEV)(_e,{className:"text-sm font-medium",children:x},void 0,!1)},void 0,!1),e[59]=x,e[60]=y):y=e[60];let K;e[61]!==U?(K=(0,t.jsxDEV)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:U},void 0,!1),e[61]=U,e[62]=K):K=e[62];let V;e[63]!==r?(V=r("<50ms avg execution"),e[63]=r,e[64]=V):V=e[64];let G;e[65]!==V?(G=(0,t.jsxDEV)("p",{className:"text-xs text-muted-foreground",children:V},void 0,!1),e[65]=V,e[66]=G):G=e[66];let J;e[67]!==K||e[68]!==G?(J=(0,t.jsxDEV)(P,{children:[K,G]},void 0,!0),e[67]=K,e[68]=G,e[69]=J):J=e[69];let W;e[70]!==y||e[71]!==J?(W=(0,t.jsxDEV)(B,{children:[y,J]},void 0,!0),e[70]=y,e[71]=J,e[72]=W):W=e[72];let X;e[73]!==b||e[74]!==w||e[75]!==W?(X=(0,t.jsxDEV)("div",{className:"grid gap-4 md:grid-cols-3",children:[b,w,W]},void 0,!0),e[73]=b,e[74]=w,e[75]=W,e[76]=X):X=e[76];let Y;e[77]!==r?(Y=r("Query leaderboard"),e[77]=r,e[78]=Y):Y=e[78];let Z;e[79]!==Y?(Z=(0,t.jsxDEV)("h3",{className:"text-lg font-semibold",children:Y},void 0,!1),e[79]=Y,e[80]=Z):Z=e[80];let ee;e[81]!==i||e[82]!==r?(ee=r("Slow queries sorted by {sortField}",{sortField:r(i)}),e[81]=i,e[82]=r,e[83]=ee):ee=e[83];let te;e[84]!==ee?(te=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:ee},void 0,!1),e[84]=ee,e[85]=te):te=e[85];let re;e[86]!==Z||e[87]!==te?(re=(0,t.jsxDEV)("div",{children:[Z,te]},void 0,!0),e[86]=Z,e[87]=te,e[88]=re):re=e[88];let se;e[89]!==r?(se=r("Sort by"),e[89]=r,e[90]=se):se=e[90];let le;e[91]!==se?(le=(0,t.jsxDEV)("span",{className:"text-sm text-muted-foreground",children:se},void 0,!1),e[91]=se,e[92]=le):le=e[92];let ae;e[93]!==r?(ae=r("Sort queries by"),e[93]=r,e[94]=ae):ae=e[94];let Ie;e[95]===Symbol.for("react.memo_cache_sentinel")?(Ie=(0,t.jsxDEV)(nt,{},void 0,!1),e[95]=Ie):Ie=e[95];let ie;e[96]!==ae?(ie=(0,t.jsxDEV)(ct,{"aria-label":ae,className:"w-[140px]","data-testid":"qi-sort",children:Ie},void 0,!1),e[96]=ae,e[97]=ie):ie=e[97];let oe;e[98]!==r?(oe=r("Total time"),e[98]=r,e[99]=oe):oe=e[99];let de;e[100]!==oe?(de=(0,t.jsxDEV)(Me,{value:"totalTime",children:oe},void 0,!1),e[100]=oe,e[101]=de):de=e[101];let ne;e[102]!==r?(ne=r("Avg time"),e[102]=r,e[103]=ne):ne=e[103];let ce;e[104]!==ne?(ce=(0,t.jsxDEV)(Me,{value:"avgTime",children:ne},void 0,!1),e[104]=ne,e[105]=ce):ce=e[105];let ue;e[106]!==r?(ue=r("Execution count"),e[106]=r,e[107]=ue):ue=e[107];let fe;e[108]!==ue?(fe=(0,t.jsxDEV)(Me,{value:"execCount",children:ue},void 0,!1),e[108]=ue,e[109]=fe):fe=e[109];let me;e[110]!==r?(me=r("Rows read"),e[110]=r,e[111]=me):me=e[111];let ve;e[112]!==me?(ve=(0,t.jsxDEV)(Me,{value:"rowsRead",children:me},void 0,!1),e[112]=me,e[113]=ve):ve=e[113];let he;e[114]!==de||e[115]!==ce||e[116]!==fe||e[117]!==ve?(he=(0,t.jsxDEV)(ut,{children:[de,ce,fe,ve]},void 0,!0),e[114]=de,e[115]=ce,e[116]=fe,e[117]=ve,e[118]=he):he=e[118];let ge;e[119]!==i||e[120]!==ie||e[121]!==he?(ge=(0,t.jsxDEV)(dt,{onValueChange:S,value:i,children:[ie,he]},void 0,!0),e[119]=i,e[120]=ie,e[121]=he,e[122]=ge):ge=e[122];let pe;e[123]!==le||e[124]!==ge?(pe=(0,t.jsxDEV)("div",{className:"flex items-center gap-2",children:[le,ge]},void 0,!0),e[123]=le,e[124]=ge,e[125]=pe):pe=e[125];let xe;e[126]!==re||e[127]!==pe?(xe=(0,t.jsxDEV)("div",{className:"flex items-center justify-between",children:[re,pe]},void 0,!0),e[126]=re,e[127]=pe,e[128]=xe):xe=e[128];let be;e[129]!==r?(be=r("Statements"),e[129]=r,e[130]=be):be=e[130];let Ne;e[131]!==be?(Ne=(0,t.jsxDEV)(_e,{children:be},void 0,!1),e[131]=be,e[132]=Ne):Ne=e[132];let ye;e[133]!==g.length||e[134]!==r?(ye=r("{count} tracked statements",{count:g.length}),e[133]=g.length,e[134]=r,e[135]=ye):ye=e[135];let Se;e[136]!==ye?(Se=(0,t.jsxDEV)(Ve,{children:ye},void 0,!1),e[136]=ye,e[137]=Se):Se=e[137];let we;e[138]!==Ne||e[139]!==Se?(we=(0,t.jsxDEV)(Re,{children:[Ne,Se]},void 0,!0),e[138]=Ne,e[139]=Se,e[140]=we):we=e[140];let qe;e[141]!==h||e[142]!==g||e[143]!==r?(qe=(0,t.jsxDEV)(P,{children:(0,t.jsxDEV)("div",{className:"space-y-2",children:g.map(o=>{let m=o.normalizedSql,c=h.has(m),z=ze(o.avgDurationMs);return(0,t.jsxDEV)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxDEV)("button",{"aria-expanded":c,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:n(()=>{Fe(m)},"onClick"),type:"button",children:[(0,t.jsxDEV)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsxDEV)(Nt,{level:z},void 0,!1),(0,t.jsxDEV)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:o.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:He(o.totalDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("total")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:He(o.avgDurationMs)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("avg")},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"text-right",children:[(0,t.jsxDEV)("div",{className:"text-sm font-medium",children:Ee(o.execCount)},void 0,!1),(0,t.jsxDEV)("div",{className:"text-xs text-muted-foreground",children:r("calls")},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0),c&&(0,t.jsxDEV)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("p",{className:"mb-2 text-sm font-medium",children:r("Full statement")},void 0,!1),(0,t.jsxDEV)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:o.normalizedSql},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Exec count")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Ee(o.execCount)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Total time")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:He(o.totalDurationMs)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows read")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Ee(o.rowsRead)},void 0,!1)]},void 0,!0),(0,t.jsxDEV)("div",{children:[(0,t.jsxDEV)("span",{className:"text-muted-foreground",children:r("Rows written")},void 0,!1),(0,t.jsxDEV)("span",{className:"block font-medium tabular-nums",children:Ee(o.rowsWritten)},void 0,!1)]},void 0,!0)]},void 0,!0)]},void 0,!0)]},m,!0)})},void 0,!1)},void 0,!1),e[141]=h,e[142]=g,e[143]=r,e[144]=qe):qe=e[144];let Ce;e[145]!==we||e[146]!==qe?(Ce=(0,t.jsxDEV)(B,{children:[we,qe]},void 0,!0),e[145]=we,e[146]=qe,e[147]=Ce):Ce=e[147];let De;return e[148]!==X||e[149]!==xe||e[150]!==Ce?(De=(0,t.jsxDEV)("div",{className:"space-y-4","data-testid":"qi-root",children:[X,xe,Ce]},void 0,!0),e[148]=X,e[149]=xe,e[150]=Ce,e[151]=De):De=e[151],De},"QueryInsights");function St(l){return ze(l.avgDurationMs)==="critical"}n(St,"_temp");function wt(l){return ze(l.avgDurationMs)==="warning"}n(wt,"_temp2");function qt(l){return ze(l.avgDurationMs)==="good"}n(qt,"_temp3");var Ct=Ge(Pe.getMetrics),Tt=n(l=>{let e=Math.floor(l/1e3),s=Math.floor(e/3600),r=Math.floor(e%3600/60),i=e%60;return s>0?`${s.toString()}h ${r.toString()}m`:r>0?`${r.toString()}m ${i.toString()}s`:`${i.toString()}s`},"formatDuration"),Rt=n((l,e)=>l?e:"overview","resolveTab"),_t=n((l,e)=>{let s=l+e;return s===0?"\u2014":`${(l/s*100).toFixed(1)}%`},"hitRate"),q=n(l=>{let e=(0,Le.c)(16),{chart:s,footer:r,label:i,testId:Q,value:C}=l,h;e[0]!==i?(h=(0,t.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i},void 0,!1),e[0]=i,e[1]=h):h=e[1];let T;e[2]!==Q||e[3]!==C?(T=(0,t.jsxDEV)("span",{className:"truncate text-2xl font-semibold tabular-nums text-foreground","data-testid":Q,children:C},void 0,!1),e[2]=Q,e[3]=C,e[4]=T):T=e[4];let p;e[5]!==s||e[6]!==T?(p=(0,t.jsxDEV)("div",{className:"flex items-center justify-between gap-3",children:[T,s]},void 0,!0),e[5]=s,e[6]=T,e[7]=p):p=e[7];let S;e[8]!==h||e[9]!==p?(S=(0,t.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[h,p]},void 0,!0),e[8]=h,e[9]=p,e[10]=S):S=e[10];let u;e[11]!==r?(u=r!=null&&(0,t.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r},void 0,!1),e[11]=r,e[12]=u):u=e[12];let g;return e[13]!==S||e[14]!==u?(g=(0,t.jsxDEV)(B,{className:"justify-between gap-0 py-0",children:[S,u]},void 0,!0),e[13]=S,e[14]=u,e[15]=g):g=e[15],g},"StatCard"),Kt=n(({initialShardKey:l})=>{let e=Ue(),s=Qe(),[r,i]=(0,v.useState)(l??""),[Q,C]=(0,v.useState)("overview"),[h,T]=(0,v.useState)([]),p=(0,v.useRef)(null),S=(0,v.useRef)(null),u=(0,v.useRef)(!0);(0,v.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let g=rt(r.trim(),400),{data:$,error:j,liveError:H}=Ye(Pe.getMetrics,{},{live:!0,shardKey:g}),d=$??null;(0,v.useEffect)(()=>{if($===void 0)return;et(g);let a=$,w=p.current,x=S.current!==null&&S.current!==a.shard;if(S.current=a.shard,p.current=a.requests,x){T([]);return}w!==null&&a.requests>=w&&T(y=>[...y,a.requests-w].slice(-30))},[$,g]);let[_,U]=(0,v.useState)(null),[O,Fe]=(0,v.useState)(!1),I=n(async()=>{Fe(!0);let a=mt(r,Ze());try{let w=await Promise.all(a.map(async x=>{try{let y=await e.query(Ct,{},Je(x));return{error:null,metrics:y,shard:x===""?y.shard:x}}catch(y){return{error:We(y),metrics:null,shard:x===""?"__root__":x}}}));u.current&&U(w)}finally{u.current&&Fe(!1)}},"aggregateAll"),f=_===null?null:ft(_),M=d===null||d.requests===0?"\u2014":`${(d.errors/d.requests*100).toFixed(1)}%`,D=h.length>0?h.at(-1):0,R=d?vt(d):{p90:0,p95:0},F=n(a=>a<=0?"\u2014":a<1?`${(a*1e3).toFixed(0)}\u03BCs`:a<1e3?`${a.toFixed(1)}ms`:`${(a/1e3).toFixed(2)}s`,"formatMs"),b=(0,v.useMemo)(()=>{if(!d||!("queryStats"in d))return;let a=d.queryStats;if(!(!a||!Array.isArray(a)))return ht(a)},[d]),N=Rt(b!==void 0,Q),k=n(()=>{Xe(I())},"runAggregate"),A=n(()=>{U(null)},"clearAggregate"),E=n(()=>{C("overview")},"switchToOverview"),L=n(()=>{C("query-insights")},"switchToQueryInsights");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(tt,{onChange:i,testId:"mt-shard-input",value:r},void 0,!1),(0,t.jsxDEV)(ot,{message:H,prefix:"mt"},void 0,!1),(0,t.jsxDEV)(Oe,{"data-testid":"mt-aggregate",disabled:O,onClick:k,size:"sm",type:"button",variant:"secondary",children:s(O?"Aggregating\u2026":"All shards")},void 0,!1),_!==null&&(0,t.jsxDEV)(Oe,{"data-testid":"mt-aggregate-clear",onClick:A,size:"sm",type:"button",variant:"ghost",children:s("Hide")},void 0,!1),(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:it,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")},void 0,!1)]},void 0,!0),j!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:j},void 0,!1),b!==void 0&&(0,t.jsxDEV)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:E,type:"button",children:s("Overview")},void 0,!1),(0,t.jsxDEV)("button",{className:`pb-2 text-sm font-medium transition-colors ${N==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:L,type:"button",children:[s("Query insights"),b.length>0&&(0,t.jsxDEV)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:b.length},void 0,!1)]},void 0,!0)]},void 0,!0),N==="query-insights"&&b!==void 0&&(0,t.jsxDEV)(yt,{queryStats:b},void 0,!1),N==="overview"&&d!==null&&(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[(0,t.jsxDEV)(q,{chart:h.length>=2?(0,t.jsxDEV)(gt,{ariaLabel:s("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:h,testId:"mt-sparkline"},void 0,!1):void 0,footer:h.length>=2?(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)("span",{className:"font-semibold text-foreground",children:`+${D.toLocaleString()}`},void 0,!1)," ",s("last interval")]},void 0,!0):(0,t.jsxDEV)("span",{"data-testid":"mt-sparkline-empty",children:s("collecting samples\u2026")},void 0,!1),label:s("Requests"),testId:"mt-requests",value:d.requests},void 0,!1),(0,t.jsxDEV)(q,{footer:s("{rate} error rate",{rate:M}),label:s("Errors"),testId:"mt-errors",value:(0,t.jsxDEV)(t.Fragment,{children:[d.errors," (",M,")"]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(q,{footer:R.p90>0?`P90 ${F(R.p90)}`:void 0,label:s("P95 latency"),testId:"mt-p95",value:R.p95>0?F(R.p95):"\u2014"},void 0,!1),(0,t.jsxDEV)(q,{footer:d.cache===null?void 0:`${d.cache.entries.toLocaleString()} ${s("cache entries")}`,label:s("Database size"),testId:"mt-db-size",value:Ae(d.databaseSize)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Shard"),testId:"mt-shard",value:d.shard},void 0,!1),(0,t.jsxDEV)(q,{label:s("Uptime"),testId:"mt-uptime",value:Tt(d.uptimeMs)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Cache hit rate"),testId:"mt-cache",value:d.cache===null?s("no cache configured"):s("{rate} ({count} entries)",{count:d.cache.entries,rate:_t(d.cache.hits,d.cache.misses)})},void 0,!1)]},void 0,!0),N==="overview"&&d===null&&null,N==="overview"&&f!==null&&_!==null&&(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[(0,t.jsxDEV)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[(0,t.jsxDEV)(q,{label:s("Shards"),testId:"mt-agg-shards",value:f.failed>0?s("{reachable} reachable, {failed} unreachable",{failed:f.failed,reachable:f.reachable}):s("{reachable} reachable",{reachable:f.reachable})},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total requests"),testId:"mt-agg-requests",value:f.totalRequests},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total errors"),testId:"mt-agg-errors",value:f.totalErrors},void 0,!1),(0,t.jsxDEV)(q,{label:s("Total database size"),testId:"mt-agg-db-size",value:Ae(f.totalDatabaseSize)},void 0,!1),(0,t.jsxDEV)(q,{label:s("Combined cache hit rate"),testId:"mt-agg-cache",value:f.hitRate===null?s("no cache configured"):`${(f.hitRate*100).toFixed(1)}%`},void 0,!1)]},void 0,!0),(0,t.jsxDEV)(B,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(P,{className:"px-0",children:(0,t.jsxDEV)(st,{"data-testid":"mt-agg-table",children:[(0,t.jsxDEV)(lt,{children:(0,t.jsxDEV)(je,{children:[(0,t.jsxDEV)($e,{children:s("shard")},void 0,!1),(0,t.jsxDEV)($e,{children:s("requests")},void 0,!1),(0,t.jsxDEV)($e,{children:s("errors")},void 0,!1),(0,t.jsxDEV)($e,{children:s("db size")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)(at,{children:_.map(a=>(0,t.jsxDEV)(je,{"data-testid":`mt-agg-row-${a.shard}`,children:[(0,t.jsxDEV)(Te,{children:a.shard},void 0,!1),a.metrics===null?(0,t.jsxDEV)(Te,{className:"text-destructive",colSpan:3,children:a.error??s("unreachable")},void 0,!1):(0,t.jsxDEV)(t.Fragment,{children:[(0,t.jsxDEV)(Te,{className:"tabular-nums",children:a.metrics.requests},void 0,!1),(0,t.jsxDEV)(Te,{className:"tabular-nums",children:a.metrics.errors},void 0,!1),(0,t.jsxDEV)(Te,{className:"tabular-nums",children:Ae(a.metrics.databaseSize)},void 0,!1)]},void 0,!0)]},a.shard,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"MetricsPanel");export{Kt as MetricsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as C}from"./chunk-J6J54MBP.js";import{a as g,b as I,c as N,d as v,e as l,f as i}from"./chunk-GTM65MVX.js";import{a as x}from"./chunk-AQGOX5DK.js";import{a as E}from"./chunk-TAD43CG5.js";import{b as y}from"./chunk-FCR3HKFV.js";import{a as m,e as h}from"./chunk-SEU5V7I6.js";import{b as u}from"./chunk-O4PXDNR3.js";import"./chunk-ZH7UES4T.js";import"./chunk-KODWGUAB.js";import"./chunk-3OA7PECS.js";import{d as A,l as b}from"./chunk-YJGANMU7.js";import{a as c,e as w,h as j}from"./chunk-RRCPZMC2.js";var e=w(j(),1);var P=new Set(["active","trialing"]),Q=new Set(["past_due","unpaid"]),a=c((r,s)=>{if(r[s]!==void 0)return r[s];let n=r.__doc__;if(typeof n=="string")try{let o=JSON.parse(n);if(o!==null&&typeof o=="object"&&!Array.isArray(o))return o[s]}catch{}},"readField"),d=c(r=>typeof r=="string"?r:typeof r=="number"||typeof r=="bigint"||typeof r=="boolean"?String(r):"","text"),V=c(r=>P.has(r)?"default":Q.has(r)?"destructive":"outline","badgeVariant"),q=c(({limit:r=100})=>{let s=A(),n=y(x.readTablePage,{filters:[],limit:r,offset:0,orderBy:[],search:"",table:"subscriptions"}),o=y(x.readTablePage,{filters:[],limit:25,offset:0,orderBy:[],search:"",table:"events"});C(()=>{n.refetch(),o.refetch()},!0);let f=n.data?.rows??[],R=o.data?.rows??[],T=n.error??o.error,S=f.filter(t=>P.has(d(a(t,"state")))).length,B=R.toSorted((t,p)=>Number(a(p,"processedAt")??0)-Number(a(t,"processedAt")??0));return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[(0,e.jsxDEV)("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:(0,e.jsxDEV)(m,{className:"justify-between gap-0 py-0",children:[(0,e.jsxDEV)("div",{className:"flex flex-col gap-2.5 p-4",children:[(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Subscriptions")},void 0,!1),(0,e.jsxDEV)("div",{className:"flex items-center gap-2",children:[(0,e.jsxDEV)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:S},void 0,!1),(0,e.jsxDEV)(u,{variant:"default",children:s("{count} active",{count:S})},void 0,!1)]},void 0,!0)]},void 0,!0),(0,e.jsxDEV)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s("{total} total",{total:f.length})},void 0,!1)]},void 0,!0)},void 0,!1),T===null?void 0:(0,e.jsxDEV)("p",{className:"text-sm text-destructive",children:T},void 0,!1),f.length===0&&!n.isLoading?(0,e.jsxDEV)(E,{testId:"payments-empty",title:s("No subscriptions yet")},void 0,!1):(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(g,{children:[(0,e.jsxDEV)(I,{children:(0,e.jsxDEV)(v,{children:[(0,e.jsxDEV)(l,{children:s("Provider")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Reference")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Plan")},void 0,!1),(0,e.jsxDEV)(l,{children:s("State")},void 0,!1),(0,e.jsxDEV)(l,{children:s("Renews")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(N,{children:f.map(t=>{let p=d(a(t,"state"));return(0,e.jsxDEV)(v,{"data-testid":"payment-subscription-row",children:[(0,e.jsxDEV)(i,{children:d(a(t,"provider"))},void 0,!1),(0,e.jsxDEV)(i,{children:d(a(t,"referenceId"))},void 0,!1),(0,e.jsxDEV)(i,{children:d(a(t,"priceId"))},void 0,!1),(0,e.jsxDEV)(i,{children:(0,e.jsxDEV)(u,{variant:V(p),children:p},void 0,!1)},void 0,!1),(0,e.jsxDEV)(i,{children:b(a(t,"currentPeriodEnd"))},void 0,!1)]},d(a(t,"providerSubscriptionId")),!0)})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),(0,e.jsxDEV)(m,{className:"overflow-hidden py-0",children:[(0,e.jsxDEV)("header",{className:"border-b border-border px-4 py-3",children:(0,e.jsxDEV)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Recent webhook events")},void 0,!1)},void 0,!1),(0,e.jsxDEV)(h,{className:"px-0",children:(0,e.jsxDEV)(g,{children:(0,e.jsxDEV)(N,{children:B.map(t=>(0,e.jsxDEV)(v,{"data-testid":"payment-event-row",children:[(0,e.jsxDEV)(i,{children:d(a(t,"provider"))},void 0,!1),(0,e.jsxDEV)(i,{className:"font-medium",children:d(a(t,"type"))},void 0,!1),(0,e.jsxDEV)(i,{className:"text-muted-foreground",children:d(a(t,"providerEventId"))},void 0,!1),(0,e.jsxDEV)(i,{children:b(a(t,"processedAt"))},void 0,!1)]},d(a(t,"providerEventId")),!0))},void 0,!1)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"PaymentsPanel");export{q as PaymentsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b,c as v,d as g,f as D}from"./chunk-KODWGUAB.js";import{e as y,f as p,g as P,i as O}from"./chunk-YJGANMU7.js";import{a as n,e as Q,f as N,g as _}from"./chunk-RRCPZMC2.js";var S=Q(_(),1);var c=Q(N(),1);var C=n((e,r,t)=>["lunora-admin",e,r,t.trim()],"adminQueryKey"),h=1e3,q=25,E=new Map,k=n(e=>{let r=Date.now(),t=(E.get(e)??[]).filter(s=>r-s<h);t.push(r),E.set(e,t),t.length===q&&(console.error(`[lunora-studio] possible request loop: ${e} fired ${String(q)}\xD7 in <1s \u2014 a render/effect is re-issuing this read unbounded.`),console.trace("[lunora-studio] request-loop call site"))},"noteQueryFetch");function R(e,r,t={}){let{enabled:s=!0,keepPreviousData:a=!1,staleTime:i=0}=t,o=g({enabled:s,queryFn:n(()=>(k(JSON.stringify(e)),r()),"trackedQueryFunction"),placeholderData:a?b:void 0,queryKey:e,staleTime:i});return{data:o.data,error:o.error?P(o.error):o.error,isLoading:o.isLoading,liveError:void 0,refetch:n(()=>{O(o.refetch())},"refetch")}}n(R,"useClientQuery");function K(e,r,t={}){let s=D(),a=v(),{enabled:i=!0,keepPreviousData:u=!1,live:o=!1,shardKey:l="",staleTime:I}=t,d=C(e,r,l),L=R(d,()=>s.query(y(e),r,p(l)),{enabled:i,keepPreviousData:u,staleTime:I??(o?Number.POSITIVE_INFINITY:0)}),[T,f]=(0,c.useState)(void 0),F=JSON.stringify(d);return(0,c.useEffect)(()=>{if(!(!i||!o))return f(void 0),s.subscribe(y(e),r,m=>{f(void 0),a.setQueryData(d,m)},{...p(l),onError:n(m=>{f(m.message)},"onError")})},[F,i,o]),{...L,liveError:i&&o?T:void 0}}n(K,"useAdminQuery");var M=n(()=>{let e=(0,S.c)(2),r=v(),t;return e[0]!==r?(t=n((s,a,i)=>{let u=a===void 0?["lunora-admin",s]:C(s,a,i??"");O(r.invalidateQueries({queryKey:u}))},"t0"),e[0]=r,e[1]=t):t=e[1],t},"useInvalidateAdmin");export{R as a,K as b,M as c};
|