@lunora/studio 1.0.0-alpha.113 → 1.0.0-alpha.115
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.js +1 -1
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.js +1 -1
- package/dist/packem_chunks/ApiTab.js +1 -1
- package/dist/packem_chunks/AuditPanel.js +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.js +1 -1
- package/dist/packem_chunks/ExportImportPanel.js +1 -1
- package/dist/packem_chunks/FileBrowser.js +1 -1
- package/dist/packem_chunks/FunctionRunner.js +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -1
- package/dist/packem_chunks/HealthPanel.js +1 -1
- package/dist/packem_chunks/InsightsPanel.js +1 -1
- package/dist/packem_chunks/LogsPanel.js +1 -1
- package/dist/packem_chunks/MailPanel.js +1 -1
- package/dist/packem_chunks/MetricsPanel.js +1 -1
- package/dist/packem_chunks/NotificationsPanel.js +1 -1
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -1
- package/dist/packem_chunks/SettingsPanel.js +1 -1
- package/dist/packem_chunks/SqlEditorPanel.js +1 -1
- package/dist/packem_chunks/TableEditor.js +1 -1
- package/dist/packem_chunks/agents-panel.js +1 -1
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-audit-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +1 -1
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +1 -1
- package/dist/packem_chunks/evals-panel.js +1 -1
- package/dist/packem_chunks/fanout-panel.js +1 -1
- package/dist/packem_chunks/flags-panel.js +1 -1
- package/dist/packem_chunks/issues-panel.js +1 -1
- package/dist/packem_chunks/kv-browser.js +1 -1
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/migrations-route.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +1 -1
- package/dist/packem_chunks/payments-panel.js +1 -1
- package/dist/packem_chunks/permissions-panel.js +1 -1
- package/dist/packem_chunks/queues-panel.js +1 -1
- package/dist/packem_chunks/rls-panel.js +1 -1
- package/dist/packem_chunks/schedule-panel.js +1 -1
- package/dist/packem_chunks/storage-rules-panel.js +1 -1
- package/dist/packem_chunks/subscriptions-panel.js +1 -1
- package/dist/packem_chunks/sync-client-panel.js +1 -1
- package/dist/packem_chunks/traces-panel.js +1 -1
- package/dist/packem_chunks/users-panel.js +1 -1
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +1 -1
- package/dist/packem_shared/{ApiDocsPanel-BL5lMig5.js → ApiDocsPanel-C_dZt4ve.js} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-CkCFMCBb.js → ApiReferencePanel-6W_QfOlv.js} +1 -1
- package/dist/packem_shared/{CommandPalette-B5yLEABs.js → CommandPalette-BAiOc1hT.js} +1 -1
- package/dist/packem_shared/{DataBrowser-BnDIFN-S.js → DataBrowser-CrkvQAMf.js} +1 -1
- package/dist/packem_shared/{GlobalDataBrowser-DusjXzRF.js → GlobalDataBrowser-BHFgEqMl.js} +1 -1
- package/dist/packem_shared/{HomePanel-BcaHVBJh.js → HomePanel-B8U_LJkK.js} +1 -1
- package/dist/packem_shared/{MigrationsPanel-CCOENX4X.js → MigrationsPanel-CW4MNUa4.js} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-21OWMH45.js → OpenRpcReferencePanel-Cx-qwpZW.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-CiO3eXgI.js → ScheduledJobs-DRmOKtDa.js} +1 -1
- package/dist/packem_shared/Studio-k_HuJZYW.js +1 -0
- package/dist/packem_shared/{StudioApp-DCdbsciH.js → StudioApp-CWpwayvp.js} +1 -1
- package/dist/packem_shared/{advisor-view-C1KFTXSH.js → advisor-view-CqCG22DB.js} +1 -1
- package/dist/packem_shared/{data-grid-BFTQnkXq.js → data-grid-pjv4t5Yi.js} +1 -1
- package/dist/packem_shared/{error-alert-TYdKetJd.js → error-alert-CKqB2CiN.js} +1 -1
- package/dist/packem_shared/{grid-features-C_yXlMc_.js → grid-features-3wfN2PeE.js} +4 -4
- package/dist/packem_shared/{home-panel-BiJHXeDC.js → home-panel-DywiFhDs.js} +1 -1
- package/dist/packem_shared/{internal-CwaF9YNk.js → internal-7bgd8inO.js} +1 -1
- package/dist/packem_shared/{log-line-UnE93Ovi.js → log-line-D0XBZaDn.js} +1 -1
- package/dist/packem_shared/{recording-client-CKn4-vUx.js → recording-client-BPY8sYUl.js} +1 -1
- package/dist/packem_shared/{reference-view-CUIDzLf0.js → reference-view-DhxnzBtf.js} +1 -1
- package/dist/packem_shared/{result-chart-Ca3YLzt8.js → result-chart-Q-gVLi4_.js} +1 -1
- package/dist/packem_shared/{schema-diagram-DHD13TjS.js → schema-diagram-CPcjPZj3.js} +1 -1
- package/dist/packem_shared/{studio-B3eEcBK0.js → studio-BFvT56qK.js} +1 -1
- package/dist/packem_shared/{table-list-sidebar-Bluzd1_2.js → table-list-sidebar-BCxqrZ0s.js} +1 -1
- package/dist/packem_shared/{use-admin-query-P0RJrjsD.js → use-admin-query-DV9xmFl8.js} +1 -1
- package/dist/packem_shared/{use-async-submit-DdLd0MdK.js → use-async-submit-C9xXjXWX.js} +1 -1
- package/dist/packem_shared/{use-auth-config-z3KRWAqD.js → use-auth-config-DIAyVsa3.js} +1 -1
- package/dist/packem_shared/{use-open-trace-4tIa0SXZ.js → use-open-trace-IfIlKEWd.js} +1 -1
- package/dist/packem_shared/{use-sql-assistant-CP90nLLh.js → use-sql-assistant-DFO2i-n-.js} +1 -1
- package/dist/standalone/chunk-22WJHOC4.js +11 -0
- package/dist/standalone/{chunk-ZN6KUP3O.js → chunk-2CHFHPR3.js} +1 -1
- package/dist/standalone/{chunk-OG57FC7W.js → chunk-2EJQ7SPV.js} +1 -1
- package/dist/standalone/{chunk-FSWPREH3.js → chunk-2Q7HAFRK.js} +1 -1
- package/dist/standalone/{chunk-44WNSIGQ.js → chunk-2UIT2HC2.js} +1 -1
- package/dist/standalone/{chunk-YUWMB6EV.js → chunk-2UWKGSEA.js} +1 -1
- package/dist/standalone/{chunk-ZQLIKKIY.js → chunk-3IXTF53Q.js} +1 -1
- package/dist/standalone/{chunk-J6MNOKO5.js → chunk-44FJEOAY.js} +1 -1
- package/dist/standalone/{chunk-26VREVWU.js → chunk-5XMZP64Z.js} +1 -1
- package/dist/standalone/{chunk-45YWYMD5.js → chunk-6MRGARL5.js} +1 -1
- package/dist/standalone/{chunk-3F5I435D.js → chunk-6UOC4ZJL.js} +1 -1
- package/dist/standalone/{chunk-FBAZHG35.js → chunk-6ZSAMAYN.js} +1 -1
- package/dist/standalone/{chunk-BORG7WUC.js → chunk-7IQT5M4O.js} +1 -1
- package/dist/standalone/{chunk-KQIHXYE6.js → chunk-7TFEJVX4.js} +1 -1
- package/dist/standalone/{chunk-3QB5JI32.js → chunk-7W6TQTW7.js} +1 -1
- package/dist/standalone/{chunk-4MAJFNON.js → chunk-A7WKYEQ4.js} +1 -1
- package/dist/standalone/chunk-AG265V66.js +1 -0
- package/dist/standalone/{chunk-6SAAMM4S.js → chunk-BE76GAFE.js} +1 -1
- package/dist/standalone/{chunk-6ZPTNC34.js → chunk-BKM6PMSO.js} +1 -1
- package/dist/standalone/{chunk-D7DUQS2Y.js → chunk-CE7WVPLK.js} +1 -1
- package/dist/standalone/{chunk-MSFUDXBA.js → chunk-D4HJ2VM2.js} +1 -1
- package/dist/standalone/{chunk-FLCK2WWQ.js → chunk-DC5AAWSA.js} +1 -1
- package/dist/standalone/{chunk-6NJAHOGO.js → chunk-DEGERMXH.js} +1 -1
- package/dist/standalone/{chunk-JURAVSE7.js → chunk-E6P2ERQV.js} +1 -1
- package/dist/standalone/{chunk-TLPWZ5NI.js → chunk-EQSVW6LZ.js} +1 -1
- package/dist/standalone/{chunk-T2LDA6WP.js → chunk-FCEPVFIJ.js} +1 -1
- package/dist/standalone/chunk-FEEZPSMA.js +1 -0
- package/dist/standalone/{chunk-25OIGX2A.js → chunk-FEW2WNS7.js} +1 -1
- package/dist/standalone/{chunk-KFZ37KQP.js → chunk-FRSTZO5P.js} +1 -1
- package/dist/standalone/{chunk-X6Q5DWLZ.js → chunk-GKHUQDVI.js} +1 -1
- package/dist/standalone/{chunk-SL5R7WBN.js → chunk-H2WBIULE.js} +1 -1
- package/dist/standalone/{chunk-WIG3HCUJ.js → chunk-H3M57MCN.js} +1 -1
- package/dist/standalone/{chunk-UIF57LBO.js → chunk-H4SLAZAN.js} +1 -1
- package/dist/standalone/{chunk-6FWN26RH.js → chunk-HLEXBOCL.js} +1 -1
- package/dist/standalone/{chunk-QZ55OWAB.js → chunk-HLHO5AHK.js} +1 -1
- package/dist/standalone/{chunk-MOUI44OT.js → chunk-INLHZKCS.js} +1 -1
- package/dist/standalone/{chunk-L7CJ5PGH.js → chunk-JACBQWRB.js} +1 -1
- package/dist/standalone/{chunk-YS7HEZC2.js → chunk-KEMHRM53.js} +1 -1
- package/dist/standalone/{chunk-GIRZD3UB.js → chunk-KOH52XKG.js} +1 -1
- package/dist/standalone/{chunk-C5E5PLJT.js → chunk-LDVDE3LE.js} +1 -1
- package/dist/standalone/{chunk-3RYEUXY2.js → chunk-LFEDP3Y6.js} +1 -1
- package/dist/standalone/{chunk-V6QPVFDL.js → chunk-MG7VPUFA.js} +1 -1
- package/dist/standalone/{chunk-OE4KGVJW.js → chunk-MLYZZD5C.js} +1 -1
- package/dist/standalone/{chunk-WHRG6S5P.js → chunk-NSR345ID.js} +1 -1
- package/dist/standalone/{chunk-IWNVQHF7.js → chunk-OAXOITHK.js} +1 -1
- package/dist/standalone/chunk-OQS4HFKC.js +1 -0
- package/dist/standalone/{chunk-XGIG4EDG.js → chunk-OTZRXUHF.js} +1 -1
- package/dist/standalone/{chunk-PJDKRUWT.js → chunk-PNLUMMXO.js} +1 -1
- package/dist/standalone/{chunk-AOE75NAT.js → chunk-Q2G22JHG.js} +1 -1
- package/dist/standalone/{chunk-BELLXCN7.js → chunk-RUIWLLAI.js} +1 -1
- package/dist/standalone/{chunk-S77D4SHR.js → chunk-RVQRXKRJ.js} +1 -1
- package/dist/standalone/{chunk-JVAYDDMK.js → chunk-SCXAZ74Y.js} +1 -1
- package/dist/standalone/{chunk-2DC6F7NH.js → chunk-SLOB2B2T.js} +1 -1
- package/dist/standalone/{chunk-LT4XQDD2.js → chunk-SM764GPA.js} +1 -1
- package/dist/standalone/{chunk-5T7KRUPX.js → chunk-U2KBAKZ6.js} +1 -1
- package/dist/standalone/chunk-U7J3LXJ4.js +6 -0
- package/dist/standalone/{chunk-KEKIGANB.js → chunk-UCA5MYCL.js} +1 -1
- package/dist/standalone/{chunk-GPP4VSUO.js → chunk-UJXKS27L.js} +1 -1
- package/dist/standalone/{chunk-C7E4I7JZ.js → chunk-UKIDHICQ.js} +1 -1
- package/dist/standalone/{chunk-5NRQIDQA.js → chunk-V2KCESII.js} +1 -1
- package/dist/standalone/{chunk-OOBJFXYB.js → chunk-W5CYX66B.js} +1 -1
- package/dist/standalone/{chunk-2BDM6HNL.js → chunk-WSNFV7ZW.js} +1 -1
- package/dist/standalone/{chunk-OLQWBGKT.js → chunk-YYFHDYYT.js} +1 -1
- package/dist/standalone/{chunk-PHHMPYEP.js → chunk-ZHDCWHRT.js} +1 -1
- package/dist/standalone/{chunk-CEPMQS24.js → chunk-ZIHYXKQJ.js} +1 -1
- package/dist/standalone/{chunk-DL3UOEWN.js → chunk-ZIYO55T2.js} +1 -1
- package/dist/standalone/{chunk-6JGXSMKV.js → chunk-ZNNKKJRT.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/Studio-CHmLCjBR.js +0 -1
- package/dist/standalone/chunk-GZMBMNL3.js +0 -6
- package/dist/standalone/chunk-RBUVNO22.js +0 -1
- package/dist/standalone/chunk-SMKRXJUC.js +0 -1
- package/dist/standalone/chunk-T6HLABZW.js +0 -1
- package/dist/standalone/chunk-TBXK3FKP.js +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as me}from"./chunk-ZPGNTTQ3.js";import{a as Lt,b as At,c as Kt,d as Ot}from"./chunk-EYGF6TQS.js";import{a as it}from"./chunk-IWOZGUI2.js";import{a as Ft}from"./chunk-CAOUXOL7.js";import{a as zt}from"./chunk-OAXOITHK.js";import"./chunk-INBA3473.js";import{e as _t}from"./chunk-W2JBKQNU.js";import{a as Ct,b as It,c as Tt,d as Rt,e as Pe}from"./chunk-VR3UJA7B.js";import"./chunk-AFKLFS74.js";import"./chunk-CP4ZFBVW.js";import{a as Mt}from"./chunk-E6P2ERQV.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import{a as Ze,b as et,c as tt,d as vt,e as yt,f as rt,g as at,h as Nt,i as St}from"./chunk-APRVSWBH.js";import"./chunk-JV7KTJPY.js";import"./chunk-DPNEFSEC.js";import{a as $t}from"./chunk-CKTKI4IY.js";import{a as kt}from"./chunk-HLEXBOCL.js";import{a as wt,b as qt}from"./chunk-P52BY657.js";import"./chunk-4YTSKL4R.js";import"./chunk-VNTEQQPP.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{a as Ye}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as Be}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import"./chunk-F7JOSNAT.js";import{a as Ae}from"./chunk-VDW32UET.js";import{c as Ee}from"./chunk-2UWKGSEA.js";import{f as dt}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as ht}from"./chunk-UANVABQG.js";import{a as st,b as lt,c as nt,d as De,e as de,f as U}from"./chunk-L4EZAHCD.js";import{a as fe,b as Ke,c as Oe,d as ut,e as pe}from"./chunk-IYWVSMAY.js";import{d as ge,f as gt,g as ft,h as pt,i as xt,l as We,o as bt}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as o,d as Xe,e as jt,f as Qt,g as Jt,i as mt}from"./chunk-R5ZTCHCE.js";var P=Xe(jt(),1);var xe=Xe(Qt(),1);var t=Xe(Jt(),1);var Ht=o((s,e)=>s<e?-1:s>e?1:0,"Ht"),ct=o(s=>{if(s===void 0)return"null";if(typeof s=="bigint")throw new TypeError("stableStringify: cannot use a bigint in a stable JSON cache key \u2014 pass it as a string, or use stableWireKey");if(typeof s=="number"){if(Number.isNaN(s))return"nan";if(s===1/0)return"inf";if(s===-1/0)return"-inf";if(Object.is(s,-0))return"-0"}if(s===null||typeof s!="object")return JSON.stringify(s);if(Array.isArray(s))return`[${s.map(d=>ct(d)).join(",")}]`;let e=Object.getPrototypeOf(s);if(e!==null&&e!==Object.prototype){let d=s.constructor?.name??"value";throw new TypeError(`stableStringify: cannot use a ${d} in a stable JSON cache key \u2014 only plain objects, arrays, and JSON primitives are supported (wire-typed values key via stableWireKey)`)}let l=s,a=Object.keys(l).toSorted(Ht),r=[];for(let d of a){let i=l[d];i!==void 0&&r.push(`${JSON.stringify(d)}:${ct(i)}`)}return`{${r.join(",")}}`},"Ze"),Dt=o((s,e,l)=>`${s}:${e}:${ct(l??{})}`,"ft"),Pt=o((s,e)=>s==="gauge"?e.last:s==="histogram"?e.sum/Math.max(1,e.count):e.sum,"ht"),Ut=o((s,e)=>Pt(s,e),"Ut"),Bt=o(s=>Pt(s.kind,s),"Jt"),ot=o(s=>Number.isInteger(s)?s.toLocaleString():s.toLocaleString(void 0,{maximumFractionDigits:2}),"We"),Wt=o(s=>Array.isArray(s?.series)?s.series:[],"Vt"),Gt="FUNCTION_NOT_FOUND",Vt=o(s=>{let e=new Map;if(!Array.isArray(s?.series))return e;for(let l of s.series)e.set(Dt(l.kind,l.name,l.attributes),l.points);return e},"Wt"),Xt={counter:"secondary",gauge:"default",histogram:"outline"},Yt=o(s=>{let e=(0,xe.c)(18),{name:l,onOpenTrace:a,traceId:r}=s,d=ge();if(r===void 0){let m;return e[0]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[0]=m):m=e[0],m}let i;e[1]!==r?(i=r.slice(0,8),e[1]=r,e[2]=i):i=e[2];let n=i;if(a===void 0){let m=`mt-instrument-trace-${l}`,g;return e[3]!==n||e[4]!==m||e[5]!==r?(g=(0,t.jsx)("span",{className:"text-muted-foreground","data-testid":m,title:r,children:n}),e[3]=n,e[4]=m,e[5]=r,e[6]=g):g=e[6],g}let S=`mt-instrument-trace-${l}`,v;e[7]!==a||e[8]!==r?(v=o(()=>{a(r)},"y"),e[7]=a,e[8]=r,e[9]=v):v=e[9];let w;e[10]!==d||e[11]!==r?(w=d("Open the exemplar trace {trace}",{trace:r}),e[10]=d,e[11]=r,e[12]=w):w=e[12];let h;return e[13]!==n||e[14]!==S||e[15]!==v||e[16]!==w?(h=(0,t.jsx)("button",{className:"text-primary underline-offset-4 hover:underline","data-testid":S,onClick:v,title:w,type:"button",children:n}),e[13]=n,e[14]=S,e[15]=v,e[16]=w,e[17]=h):h=e[17],h},"Yt"),Zt=o(s=>{let e=(0,xe.c)(105),{onOpenTrace:l,shardKey:a}=s,r=ge(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let i;e[1]!==a?(i={live:!0,shardKey:a},e[1]=a,e[2]=i):i=e[2];let{data:n,error:S,errorSource:v}=Ee(Ae.getMetricSeries,d,i),w;e[3]===Symbol.for("react.memo_cache_sentinel")?(w={},e[3]=w):w=e[3];let h;e[4]!==a?(h={live:!0,shardKey:a},e[4]=a,e[5]=h):h=e[5];let{data:m}=Ee(Ae.getMetricHistory,w,h),g,y,q,M,c,p,f,x,k,_,N,I,C;if(e[6]!==n||e[7]!==S||e[8]!==v||e[9]!==m||e[10]!==l||e[11]!==r){x=Symbol.for("react.early_return_sentinel");e:{let A=Wt(n),O=xt(v)===Gt;if(S!==null&&!O){let u;e[25]!==r?(u=r("Instruments"),e[25]=r,e[26]=u):u=e[26];let D;e[27]!==u?(D=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:u}),e[27]=u,e[28]=D):D=e[28];let Q;e[29]!==S||e[30]!==r?(Q=r("Instruments unavailable: {error}",{error:S}),e[29]=S,e[30]=r,e[31]=Q):Q=e[31];let J;e[32]!==Q?(J=(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"mt-instruments-error",role:"status",children:Q}),e[32]=Q,e[33]=J):J=e[33];let ce;e[34]!==D||e[35]!==J?(ce=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"mt-instruments",children:[D,J]}),e[34]=D,e[35]=J,e[36]=ce):ce=e[36],x=ce;break e}if(A.length===0){x=null;break e}let L=Vt(m),E;e[37]!==r?(E=o(u=>r(u==="counter"?"Counter":u==="gauge"?"Gauge":"Histogram"),"z"),e[37]=r,e[38]=E):E=e[38];let j=E;c="flex flex-col gap-2",p="mt-instruments";let K;e[39]!==r?(K=r("Instruments"),e[39]=r,e[40]=K):K=e[40],e[41]!==K?(f=(0,t.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:K}),e[41]=K,e[42]=f):f=e[42],M=fe,C="overflow-hidden py-0",q=pe,I="px-0",y=st,_="mt-instruments-table";let B;e[43]!==r?(B=r("name"),e[43]=r,e[44]=B):B=e[44];let W;e[45]!==B?(W=(0,t.jsx)(de,{children:B}),e[45]=B,e[46]=W):W=e[46];let G;e[47]!==r?(G=r("kind"),e[47]=r,e[48]=G):G=e[48];let V;e[49]!==G?(V=(0,t.jsx)(de,{children:G}),e[49]=G,e[50]=V):V=e[50];let X;e[51]!==r?(X=r("value"),e[51]=r,e[52]=X):X=e[52];let Y;e[53]!==X?(Y=(0,t.jsx)(de,{className:"text-right",children:X}),e[53]=X,e[54]=Y):Y=e[54];let Z;e[55]!==r?(Z=r("count"),e[55]=r,e[56]=Z):Z=e[56];let ee;e[57]!==Z?(ee=(0,t.jsx)(de,{className:"text-right",children:Z}),e[57]=Z,e[58]=ee):ee=e[58];let te;e[59]!==r?(te=r("range"),e[59]=r,e[60]=te):te=e[60];let re;e[61]!==te?(re=(0,t.jsx)(de,{className:"text-right",children:te}),e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==r?(ae=r("trend"),e[63]=r,e[64]=ae):ae=e[64];let se;e[65]!==ae?(se=(0,t.jsx)(de,{children:ae}),e[65]=ae,e[66]=se):se=e[66];let le;e[67]!==r?(le=r("trace"),e[67]=r,e[68]=le):le=e[68];let ne;e[69]!==le?(ne=(0,t.jsx)(de,{children:le}),e[69]=le,e[70]=ne):ne=e[70];let ie;e[71]!==r?(ie=r("dimensions"),e[71]=r,e[72]=ie):ie=e[72];let oe;e[73]!==ie?(oe=(0,t.jsx)(de,{children:ie}),e[73]=ie,e[74]=oe):oe=e[74],e[75]!==W||e[76]!==V||e[77]!==Y||e[78]!==ee||e[79]!==re||e[80]!==se||e[81]!==ne||e[82]!==oe?(N=(0,t.jsx)(lt,{children:(0,t.jsxs)(De,{children:[W,V,Y,ee,re,se,ne,oe]})}),e[75]=W,e[76]=V,e[77]=Y,e[78]=ee,e[79]=re,e[80]=se,e[81]=ne,e[82]=oe,e[83]=N):N=e[83],g=nt,k=A.map(u=>{let D=Ft(u.attributes),Q=Dt(u.kind,u.name,u.attributes),J=(L.get(Q)??[]).map(ce=>Ut(u.kind,ce));return(0,t.jsxs)(De,{"data-testid":`mt-instrument-${u.name}`,children:[(0,t.jsx)(U,{className:"font-mono text-xs",title:u.functionPath,children:u.name}),(0,t.jsx)(U,{children:(0,t.jsx)(Be,{variant:Xt[u.kind],children:j(u.kind)})}),(0,t.jsx)(U,{className:"text-right font-mono tabular-nums","data-testid":`mt-instrument-value-${u.name}`,children:ot(Bt(u))}),(0,t.jsx)(U,{className:"text-right tabular-nums text-muted-foreground",children:u.count.toLocaleString()}),(0,t.jsx)(U,{className:"text-right font-mono text-xs tabular-nums text-muted-foreground",children:u.min===u.max?"\u2014":`${ot(u.min)}\u2013${ot(u.max)}`}),(0,t.jsx)(U,{children:J.length>=2?(0,t.jsx)(it,{ariaLabel:r("{name} trend",{name:u.name}),className:"h-6 w-24 text-foreground",series:J,testId:`mt-instrument-trend-${u.name}`}):(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:"\u2014"})}),(0,t.jsx)(U,{className:"font-mono text-xs",children:(0,t.jsx)(Yt,{name:u.name,onOpenTrace:l,traceId:u.exemplarTraceId})}),(0,t.jsx)(U,{className:"max-w-64 truncate font-mono text-xs text-muted-foreground",title:D,children:D===""?"\u2014":D})]},Q)})}e[6]=n,e[7]=S,e[8]=v,e[9]=m,e[10]=l,e[11]=r,e[12]=g,e[13]=y,e[14]=q,e[15]=M,e[16]=c,e[17]=p,e[18]=f,e[19]=x,e[20]=k,e[21]=_,e[22]=N,e[23]=I,e[24]=C}else g=e[12],y=e[13],q=e[14],M=e[15],c=e[16],p=e[17],f=e[18],x=e[19],k=e[20],_=e[21],N=e[22],I=e[23],C=e[24];if(x!==Symbol.for("react.early_return_sentinel"))return x;let T;e[84]!==g||e[85]!==k?(T=(0,t.jsx)(g,{children:k}),e[84]=g,e[85]=k,e[86]=T):T=e[86];let $;e[87]!==y||e[88]!==T||e[89]!==_||e[90]!==N?($=(0,t.jsxs)(y,{"data-testid":_,children:[N,T]}),e[87]=y,e[88]=T,e[89]=_,e[90]=N,e[91]=$):$=e[91];let b;e[92]!==q||e[93]!==$||e[94]!==I?(b=(0,t.jsx)(q,{className:I,children:$}),e[92]=q,e[93]=$,e[94]=I,e[95]=b):b=e[95];let R;e[96]!==M||e[97]!==b||e[98]!==C?(R=(0,t.jsx)(M,{className:C,children:b}),e[96]=M,e[97]=b,e[98]=C,e[99]=R):R=e[99];let z;return e[100]!==c||e[101]!==p||e[102]!==f||e[103]!==R?(z=(0,t.jsxs)("section",{className:c,"data-testid":p,children:[f,R]}),e[100]=c,e[101]=p,e[102]=f,e[103]=R,e[104]=z):z=e[104],z},"Zt"),er=o(s=>{let e=(0,xe.c)(74),{aggregate:l,shardResults:a}=s,r=ge(),d;e[0]!==r?(d=r("Shards"),e[0]=r,e[1]=d):d=e[1];let i;e[2]!==l.failed||e[3]!==l.reachable||e[4]!==r?(i=l.failed>0?r("{reachable} reachable, {failed} unreachable",{failed:l.failed,reachable:l.reachable}):r("{reachable} reachable",{reachable:l.reachable}),e[2]=l.failed,e[3]=l.reachable,e[4]=r,e[5]=i):i=e[5];let n;e[6]!==d||e[7]!==i?(n=(0,t.jsx)(me,{label:d,testId:"mt-agg-shards",value:i}),e[6]=d,e[7]=i,e[8]=n):n=e[8];let S;e[9]!==r?(S=r("Total requests"),e[9]=r,e[10]=S):S=e[10];let v;e[11]!==l.totalRequests||e[12]!==S?(v=(0,t.jsx)(me,{label:S,testId:"mt-agg-requests",value:l.totalRequests}),e[11]=l.totalRequests,e[12]=S,e[13]=v):v=e[13];let w;e[14]!==r?(w=r("Total errors"),e[14]=r,e[15]=w):w=e[15];let h;e[16]!==l.totalErrors||e[17]!==w?(h=(0,t.jsx)(me,{label:w,testId:"mt-agg-errors",value:l.totalErrors}),e[16]=l.totalErrors,e[17]=w,e[18]=h):h=e[18];let m;e[19]!==r?(m=r("Total database size"),e[19]=r,e[20]=m):m=e[20];let g;e[21]!==l.totalDatabaseSize?(g=We(l.totalDatabaseSize),e[21]=l.totalDatabaseSize,e[22]=g):g=e[22];let y;e[23]!==m||e[24]!==g?(y=(0,t.jsx)(me,{label:m,testId:"mt-agg-db-size",value:g}),e[23]=m,e[24]=g,e[25]=y):y=e[25];let q;e[26]!==r?(q=r("Combined cache hit rate"),e[26]=r,e[27]=q):q=e[27];let M;e[28]!==l.hitRate||e[29]!==r?(M=l.hitRate===null?r("no cache configured"):`${(l.hitRate*100).toFixed(1)}%`,e[28]=l.hitRate,e[29]=r,e[30]=M):M=e[30];let c;e[31]!==q||e[32]!==M?(c=(0,t.jsx)(me,{label:q,testId:"mt-agg-cache",value:M}),e[31]=q,e[32]=M,e[33]=c):c=e[33];let p;e[34]!==y||e[35]!==c||e[36]!==n||e[37]!==v||e[38]!==h?(p=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"mt-aggregate-stats",children:[n,v,h,y,c]}),e[34]=y,e[35]=c,e[36]=n,e[37]=v,e[38]=h,e[39]=p):p=e[39];let f;e[40]!==r?(f=r("shard"),e[40]=r,e[41]=f):f=e[41];let x;e[42]!==f?(x=(0,t.jsx)(de,{children:f}),e[42]=f,e[43]=x):x=e[43];let k;e[44]!==r?(k=r("requests"),e[44]=r,e[45]=k):k=e[45];let _;e[46]!==k?(_=(0,t.jsx)(de,{children:k}),e[46]=k,e[47]=_):_=e[47];let N;e[48]!==r?(N=r("errors"),e[48]=r,e[49]=N):N=e[49];let I;e[50]!==N?(I=(0,t.jsx)(de,{children:N}),e[50]=N,e[51]=I):I=e[51];let C;e[52]!==r?(C=r("db size"),e[52]=r,e[53]=C):C=e[53];let T;e[54]!==C?(T=(0,t.jsx)(de,{children:C}),e[54]=C,e[55]=T):T=e[55];let $;e[56]!==x||e[57]!==_||e[58]!==I||e[59]!==T?($=(0,t.jsx)(lt,{children:(0,t.jsxs)(De,{children:[x,_,I,T]})}),e[56]=x,e[57]=_,e[58]=I,e[59]=T,e[60]=$):$=e[60];let b;if(e[61]!==a||e[62]!==r){let O;e[64]!==r?(O=o(L=>(0,t.jsxs)(De,{"data-testid":`mt-agg-row-${L.shard}`,children:[(0,t.jsx)(U,{children:L.shard}),L.metrics===null?(0,t.jsx)(U,{className:"text-destructive",colSpan:3,children:L.error??r("unreachable")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(U,{className:"tabular-nums",children:L.metrics.requests}),(0,t.jsx)(U,{className:"tabular-nums",children:L.metrics.errors}),(0,t.jsx)(U,{className:"tabular-nums",children:We(L.metrics.databaseSize)})]})]},L.shard),"L"),e[64]=r,e[65]=O):O=e[65],b=a.map(O),e[61]=a,e[62]=r,e[63]=b}else b=e[63];let R;e[66]!==b?(R=(0,t.jsx)(nt,{children:b}),e[66]=b,e[67]=R):R=e[67];let z;e[68]!==$||e[69]!==R?(z=(0,t.jsx)(fe,{className:"overflow-hidden py-0",children:(0,t.jsx)(pe,{className:"px-0",children:(0,t.jsxs)(st,{"data-testid":"mt-agg-table",children:[$,R]})})}),e[68]=$,e[69]=R,e[70]=z):z=e[70];let A;return e[71]!==p||e[72]!==z?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mt-aggregate-view",children:[p,z]}),e[71]=p,e[72]=z,e[73]=A):A=e[73],A},"er"),tr=o(s=>{let e=Math.floor(s/1e3),l=Math.floor(e/3600),a=Math.floor(e%3600/60),r=e%60;return l>0?`${l.toString()}h ${a.toString()}m`:a>0?`${a.toString()}m ${r.toString()}s`:`${r.toString()}s`},"tr"),rr=o((s,e)=>{let l=s+e;return l===0?"\u2014":`${(s/l*100).toFixed(1)}%`},"rr"),Et=o(s=>s<=0?"\u2014":s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"ot"),ar=o(s=>{let e=(0,xe.c)(75),{currentDelta:l,errorRate:a,history:r,latencyPercentiles:d,metrics:i}=s,n=ge(),S;e[0]!==r||e[1]!==n?(S=r.length>=2?(0,t.jsx)(it,{ariaLabel:n("Requests per interval over time"),className:"h-7 w-24 text-foreground",series:r,testId:"mt-sparkline"}):void 0,e[0]=r,e[1]=n,e[2]=S):S=e[2];let v;e[3]!==l||e[4]!==r.length||e[5]!==n?(v=r.length>=2?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-semibold text-foreground",children:`+${l.toLocaleString()}`})," ",n("last interval")]}):(0,t.jsx)("span",{"data-testid":"mt-sparkline-empty",children:n("collecting samples\u2026")}),e[3]=l,e[4]=r.length,e[5]=n,e[6]=v):v=e[6];let w;e[7]!==n?(w=n("Requests"),e[7]=n,e[8]=w):w=e[8];let h;e[9]!==i.requests||e[10]!==S||e[11]!==v||e[12]!==w?(h=(0,t.jsx)(me,{chart:S,footer:v,label:w,testId:"mt-requests",value:i.requests}),e[9]=i.requests,e[10]=S,e[11]=v,e[12]=w,e[13]=h):h=e[13];let m;e[14]!==a||e[15]!==n?(m=n("{rate} error rate",{rate:a}),e[14]=a,e[15]=n,e[16]=m):m=e[16];let g;e[17]!==n?(g=n("Errors"),e[17]=n,e[18]=g):g=e[18];let y;e[19]!==a||e[20]!==i.errors?(y=(0,t.jsxs)(t.Fragment,{children:[i.errors," (",a,")"]}),e[19]=a,e[20]=i.errors,e[21]=y):y=e[21];let q;e[22]!==m||e[23]!==g||e[24]!==y?(q=(0,t.jsx)(me,{footer:m,label:g,testId:"mt-errors",value:y}),e[22]=m,e[23]=g,e[24]=y,e[25]=q):q=e[25];let M;e[26]!==d.p90?(M=d.p90>0?`P90 ${Et(d.p90)}`:void 0,e[26]=d.p90,e[27]=M):M=e[27];let c;e[28]!==n?(c=n("P95 latency"),e[28]=n,e[29]=c):c=e[29];let p;e[30]!==d.p95?(p=d.p95>0?Et(d.p95):"\u2014",e[30]=d.p95,e[31]=p):p=e[31];let f;e[32]!==c||e[33]!==p||e[34]!==M?(f=(0,t.jsx)(me,{footer:M,label:c,testId:"mt-p95",value:p}),e[32]=c,e[33]=p,e[34]=M,e[35]=f):f=e[35];let x;e[36]!==i.cache||e[37]!==n?(x=i.cache===null?void 0:`${i.cache.entries.toLocaleString()} ${n("cache entries")}`,e[36]=i.cache,e[37]=n,e[38]=x):x=e[38];let k;e[39]!==n?(k=n("Database size"),e[39]=n,e[40]=k):k=e[40];let _;e[41]!==i.databaseSize?(_=We(i.databaseSize),e[41]=i.databaseSize,e[42]=_):_=e[42];let N;e[43]!==x||e[44]!==k||e[45]!==_?(N=(0,t.jsx)(me,{footer:x,label:k,testId:"mt-db-size",value:_}),e[43]=x,e[44]=k,e[45]=_,e[46]=N):N=e[46];let I;e[47]!==n?(I=n("Shard"),e[47]=n,e[48]=I):I=e[48];let C;e[49]!==i.shard||e[50]!==I?(C=(0,t.jsx)(me,{label:I,testId:"mt-shard",value:i.shard}),e[49]=i.shard,e[50]=I,e[51]=C):C=e[51];let T;e[52]!==n?(T=n("Uptime"),e[52]=n,e[53]=T):T=e[53];let $;e[54]!==i.uptimeMs?($=tr(i.uptimeMs),e[54]=i.uptimeMs,e[55]=$):$=e[55];let b;e[56]!==T||e[57]!==$?(b=(0,t.jsx)(me,{label:T,testId:"mt-uptime",value:$}),e[56]=T,e[57]=$,e[58]=b):b=e[58];let R;e[59]!==n?(R=n("Cache hit rate"),e[59]=n,e[60]=R):R=e[60];let z;e[61]!==i.cache||e[62]!==n?(z=i.cache===null?n("no cache configured"):n("{rate} ({count} entries)",{count:i.cache.entries,rate:rr(i.cache.hits,i.cache.misses)}),e[61]=i.cache,e[62]=n,e[63]=z):z=e[63];let A;e[64]!==R||e[65]!==z?(A=(0,t.jsx)(me,{label:R,testId:"mt-cache",value:z}),e[64]=R,e[65]=z,e[66]=A):A=e[66];let O;return e[67]!==f||e[68]!==N||e[69]!==C||e[70]!==b||e[71]!==A||e[72]!==h||e[73]!==q?(O=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4","data-testid":"mt-stats",children:[h,q,f,N,C,b,A]}),e[67]=f,e[68]=N,e[69]=C,e[70]=b,e[71]=A,e[72]=h,e[73]=q,e[74]=O):O=e[74],O},"sr"),Ve=o(s=>s>=100?"critical":s>=50?"warning":"good","Ve"),je=o(s=>s<1?`${(s*1e3).toFixed(0)}\u03BCs`:s<1e3?`${s.toFixed(1)}ms`:`${(s/1e3).toFixed(2)}s`,"Ee"),Ge=o(s=>s>=1e9?`${(s/1e9).toFixed(1)}B`:s>=1e6?`${(s/1e6).toFixed(1)}M`:s>=1e3?`${(s/1e3).toFixed(1)}K`:s.toLocaleString(),"He"),sr=o(s=>{let e=(0,xe.c)(3),{level:l}=s;if(l==="critical"){let r;return e[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(Be,{variant:"destructive",children:"Slow"}),e[0]=r):r=e[0],r}if(l==="warning"){let r;return e[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("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"}),e[1]=r):r=e[1],r}let a;return e[2]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsx)("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"}),e[2]=a):a=e[2],a},"lr"),lr=o((s,e)=>{let l=[...s];return l.sort((a,r)=>{switch(e){case"avgTime":return r.avgDurationMs-a.avgDurationMs;case"execCount":return r.execCount-a.execCount;case"rowsRead":return r.rowsRead-a.rowsRead;default:return r.totalDurationMs-a.totalDurationMs}}),l},"ar"),nr=o(s=>{let e=(0,xe.c)(161),{queryStats:l}=s,a=ge(),[r,d]=(0,P.useState)("totalTime"),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=new Set,e[0]=i):i=e[0];let[n,S]=(0,P.useState)(i),v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=o(C=>{C!==null&&d(C)},"y"),e[1]=v):v=e[1];let w=v,h,m,g,y,q,M,c,p,f,x;if(e[2]!==n||e[3]!==l||e[4]!==r||e[5]!==a){g=Symbol.for("react.early_return_sentinel");e:{let C=lr(l,r),T;e[16]!==l?(T=l.filter(ir),e[16]=l,e[17]=T):T=e[17];let $=T.length,b;e[18]!==l?(b=l.filter(or),e[18]=l,e[19]=b):b=e[19];let R=b.length,z;e[20]!==l?(z=l.filter(cr),e[20]=l,e[21]=z):z=e[21];let A=z.length,O;e[22]===Symbol.for("react.memo_cache_sentinel")?(O=o(F=>{S(ue=>{let H=new Set(ue);return H.has(F)?H.delete(F):H.add(F),H})},"L"),e[22]=O):O=e[22];let L=O;if(l.length===0){let F;e[23]!==a?(F=a("No query insights yet"),e[23]=a,e[24]=F):F=e[24];let ue;e[25]!==F?(ue=(0,t.jsx)("p",{className:"text-lg font-medium","data-testid":"qi-empty",children:F}),e[25]=F,e[26]=ue):ue=e[26];let H;e[27]!==a?(H=a("Query insights appear once statements are executed against this shard."),e[27]=a,e[28]=H):H=e[28];let he;e[29]!==H?(he=(0,t.jsx)("p",{className:"mt-1 text-sm",children:H}),e[29]=H,e[30]=he):he=e[30];let Ue;e[31]!==ue||e[32]!==he?(Ue=(0,t.jsx)(fe,{children:(0,t.jsx)(pe,{className:"py-12",children:(0,t.jsxs)("div",{className:"text-center text-muted-foreground",children:[ue,he]})})}),e[31]=ue,e[32]=he,e[33]=Ue):Ue=e[33],g=Ue;break e}c="space-y-4",p="qi-root";let E;e[34]!==a?(E=a("Critical queries"),e[34]=a,e[35]=E):E=e[35];let j;e[36]!==E?(j=(0,t.jsx)(Ke,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:E})}),e[36]=E,e[37]=j):j=e[37];let K;e[38]!==$?(K=(0,t.jsx)("div",{className:"text-2xl font-bold text-destructive","data-testid":"qi-critical",children:$}),e[38]=$,e[39]=K):K=e[39];let B;e[40]!==a?(B=a(">100ms avg execution"),e[40]=a,e[41]=B):B=e[41];let W;e[42]!==B?(W=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:B}),e[42]=B,e[43]=W):W=e[43];let G;e[44]!==K||e[45]!==W?(G=(0,t.jsxs)(pe,{children:[K,W]}),e[44]=K,e[45]=W,e[46]=G):G=e[46];let V;e[47]!==j||e[48]!==G?(V=(0,t.jsxs)(fe,{children:[j,G]}),e[47]=j,e[48]=G,e[49]=V):V=e[49];let X;e[50]!==a?(X=a("Moderate queries"),e[50]=a,e[51]=X):X=e[51];let Y;e[52]!==X?(Y=(0,t.jsx)(Ke,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:X})}),e[52]=X,e[53]=Y):Y=e[53];let Z;e[54]!==R?(Z=(0,t.jsx)("div",{className:"text-2xl font-bold text-warning","data-testid":"qi-moderate",children:R}),e[54]=R,e[55]=Z):Z=e[55];let ee;e[56]!==a?(ee=a("50\u2013100ms avg execution"),e[56]=a,e[57]=ee):ee=e[57];let te;e[58]!==ee?(te=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ee}),e[58]=ee,e[59]=te):te=e[59];let re;e[60]!==Z||e[61]!==te?(re=(0,t.jsxs)(pe,{children:[Z,te]}),e[60]=Z,e[61]=te,e[62]=re):re=e[62];let ae;e[63]!==Y||e[64]!==re?(ae=(0,t.jsxs)(fe,{children:[Y,re]}),e[63]=Y,e[64]=re,e[65]=ae):ae=e[65];let se;e[66]!==a?(se=a("Fast queries"),e[66]=a,e[67]=se):se=e[67];let le;e[68]!==se?(le=(0,t.jsx)(Ke,{className:"pb-2",children:(0,t.jsx)(Oe,{className:"text-sm font-medium",children:se})}),e[68]=se,e[69]=le):le=e[69];let ne;e[70]!==A?(ne=(0,t.jsx)("div",{className:"text-2xl font-bold text-success","data-testid":"qi-fast",children:A}),e[70]=A,e[71]=ne):ne=e[71];let ie;e[72]!==a?(ie=a("<50ms avg execution"),e[72]=a,e[73]=ie):ie=e[73];let oe;e[74]!==ie?(oe=(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:ie}),e[74]=ie,e[75]=oe):oe=e[75];let u;e[76]!==ne||e[77]!==oe?(u=(0,t.jsxs)(pe,{children:[ne,oe]}),e[76]=ne,e[77]=oe,e[78]=u):u=e[78];let D;e[79]!==le||e[80]!==u?(D=(0,t.jsxs)(fe,{children:[le,u]}),e[79]=le,e[80]=u,e[81]=D):D=e[81],e[82]!==V||e[83]!==ae||e[84]!==D?(f=(0,t.jsxs)("div",{className:"grid gap-4 md:grid-cols-3",children:[V,ae,D]}),e[82]=V,e[83]=ae,e[84]=D,e[85]=f):f=e[85];let Q;e[86]!==a?(Q=a("Query leaderboard"),e[86]=a,e[87]=Q):Q=e[87];let J;e[88]!==Q?(J=(0,t.jsx)("h3",{className:"text-lg font-semibold",children:Q}),e[88]=Q,e[89]=J):J=e[89];let ce;e[90]!==r||e[91]!==a?(ce=a("Slow queries sorted by {sortField}",{sortField:a(r)}),e[90]=r,e[91]=a,e[92]=ce):ce=e[92];let be;e[93]!==ce?(be=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:ce}),e[93]=ce,e[94]=be):be=e[94];let ve;e[95]!==J||e[96]!==be?(ve=(0,t.jsxs)("div",{children:[J,be]}),e[95]=J,e[96]=be,e[97]=ve):ve=e[97];let ye;e[98]!==a?(ye=a("Sort by"),e[98]=a,e[99]=ye):ye=e[99];let Ne;e[100]!==ye?(Ne=(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:ye}),e[100]=ye,e[101]=Ne):Ne=e[101];let Se;e[102]!==a?(Se=a("Sort queries by"),e[102]=a,e[103]=Se):Se=e[103];let Qe;e[104]===Symbol.for("react.memo_cache_sentinel")?(Qe=(0,t.jsx)(It,{}),e[104]=Qe):Qe=e[104];let we;e[105]!==Se?(we=(0,t.jsx)(Tt,{"aria-label":Se,className:"w-[140px]","data-testid":"qi-sort",children:Qe}),e[105]=Se,e[106]=we):we=e[106];let qe;e[107]!==a?(qe=a("Total time"),e[107]=a,e[108]=qe):qe=e[108];let ke;e[109]!==qe?(ke=(0,t.jsx)(Pe,{value:"totalTime",children:qe}),e[109]=qe,e[110]=ke):ke=e[110];let $e;e[111]!==a?($e=a("Avg time"),e[111]=a,e[112]=$e):$e=e[112];let Me;e[113]!==$e?(Me=(0,t.jsx)(Pe,{value:"avgTime",children:$e}),e[113]=$e,e[114]=Me):Me=e[114];let _e;e[115]!==a?(_e=a("Execution count"),e[115]=a,e[116]=_e):_e=e[116];let Ce;e[117]!==_e?(Ce=(0,t.jsx)(Pe,{value:"execCount",children:_e}),e[117]=_e,e[118]=Ce):Ce=e[118];let Ie;e[119]!==a?(Ie=a("Rows read"),e[119]=a,e[120]=Ie):Ie=e[120];let Te;e[121]!==Ie?(Te=(0,t.jsx)(Pe,{value:"rowsRead",children:Ie}),e[121]=Ie,e[122]=Te):Te=e[122];let Re;e[123]!==ke||e[124]!==Me||e[125]!==Ce||e[126]!==Te?(Re=(0,t.jsxs)(Rt,{children:[ke,Me,Ce,Te]}),e[123]=ke,e[124]=Me,e[125]=Ce,e[126]=Te,e[127]=Re):Re=e[127];let Fe;e[128]!==r||e[129]!==we||e[130]!==Re?(Fe=(0,t.jsxs)(Ct,{onValueChange:w,value:r,children:[we,Re]}),e[128]=r,e[129]=we,e[130]=Re,e[131]=Fe):Fe=e[131];let ze;e[132]!==Ne||e[133]!==Fe?(ze=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Ne,Fe]}),e[132]=Ne,e[133]=Fe,e[134]=ze):ze=e[134],e[135]!==ve||e[136]!==ze?(x=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[ve,ze]}),e[135]=ve,e[136]=ze,e[137]=x):x=e[137],m=fe;let Le;e[138]!==a?(Le=a("Statements"),e[138]=a,e[139]=Le):Le=e[139];let Je;e[140]!==Le?(Je=(0,t.jsx)(Oe,{children:Le}),e[140]=Le,e[141]=Je):Je=e[141],M=(0,t.jsxs)(Ke,{children:[Je,(0,t.jsx)(ut,{children:a("{count} tracked statements",{count:C.length})})]}),h=pe,y="space-y-2";let He;e[142]!==n||e[143]!==a?(He=o(F=>{let ue=F.normalizedSql,H=n.has(ue),he=Ve(F.avgDurationMs);return(0,t.jsxs)("div",{className:"overflow-hidden rounded-lg border","data-testid":"qi-row",children:[(0,t.jsxs)("button",{"aria-expanded":H,className:"flex w-full items-center justify-between p-3 text-left transition-colors hover:bg-muted/50",onClick:o(()=>{L(ue)},"onClick"),type:"button",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)(sr,{level:he}),(0,t.jsx)("span",{className:"max-w-[300px] truncate font-mono text-sm lg:max-w-[500px]",children:F.normalizedSql})]}),(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-4",children:[(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(F.totalDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("total")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(F.avgDurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("avg")})]}),F.p95DurationMs!==void 0&&(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:je(F.p95DurationMs)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("p95")})]}),(0,t.jsxs)("div",{className:"text-right",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:Ge(F.execCount)}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:a("calls")})]})]})]}),H&&(0,t.jsxs)("div",{className:"space-y-3 border-t bg-muted/30 p-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"mb-2 text-sm font-medium",children:a("Full statement")}),(0,t.jsx)("pre",{className:"overflow-x-auto rounded-md bg-muted p-3 font-mono text-sm whitespace-pre-wrap break-all",children:F.normalizedSql})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4 text-sm md:grid-cols-4",children:[F.p50DurationMs!==void 0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("p50")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(F.p50DurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Exec count")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(F.execCount)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Total time")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:je(F.totalDurationMs)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows read")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(F.rowsRead)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:a("Rows written")}),(0,t.jsx)("span",{className:"block font-medium tabular-nums",children:Ge(F.rowsWritten)})]})]})]})]},ue)},"Ke"),e[142]=n,e[143]=a,e[144]=He):He=e[144],q=C.map(He)}e[2]=n,e[3]=l,e[4]=r,e[5]=a,e[6]=h,e[7]=m,e[8]=g,e[9]=y,e[10]=q,e[11]=M,e[12]=c,e[13]=p,e[14]=f,e[15]=x}else h=e[6],m=e[7],g=e[8],y=e[9],q=e[10],M=e[11],c=e[12],p=e[13],f=e[14],x=e[15];if(g!==Symbol.for("react.early_return_sentinel"))return g;let k;e[145]!==y||e[146]!==q?(k=(0,t.jsx)("div",{className:y,children:q}),e[145]=y,e[146]=q,e[147]=k):k=e[147];let _;e[148]!==h||e[149]!==k?(_=(0,t.jsx)(h,{children:k}),e[148]=h,e[149]=k,e[150]=_):_=e[150];let N;e[151]!==m||e[152]!==_||e[153]!==M?(N=(0,t.jsxs)(m,{children:[M,_]}),e[151]=m,e[152]=_,e[153]=M,e[154]=N):N=e[154];let I;return e[155]!==N||e[156]!==c||e[157]!==p||e[158]!==f||e[159]!==x?(I=(0,t.jsxs)("div",{className:c,"data-testid":p,children:[f,x,N]}),e[155]=N,e[156]=c,e[157]=p,e[158]=f,e[159]=x,e[160]=I):I=e[160],I},"ir");function ir(s){return Ve(s.avgDurationMs)==="critical"}o(ir,"nr");function or(s){return Ve(s.avgDurationMs)==="warning"}o(or,"or");function cr(s){return Ve(s.avgDurationMs)==="good"}o(cr,"cr");var dr=["1m","5m","15m","1h"],mr=o(s=>new Date(s).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}),"mr"),ur=o(s=>s.map(e=>({avg:Math.round(e.avgDurationMs*100)/100,execs:e.execCount,label:mr(e.bucketMs)})),"ur"),hr=o(({shardKey:s=""})=>{let e=ge(),[l,a]=(0,P.useState)("15m"),r=Ee(Ae.getQueryInsights,{range:l},{live:!0,shardKey:s}).data,d=ur(r?.buckets??[]);return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"qi-range",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:"flex gap-1 rounded-lg border border-border p-0.5","data-testid":"qi-ranges",role:"group",children:dr.map(i=>(0,t.jsx)("button",{"aria-pressed":i===l,className:mt("rounded px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",i===l&&"bg-accent font-medium text-foreground"),"data-testid":`qi-range-${i}`,onClick:o(()=>{a(i)},"onClick"),type:"button",children:i},i))}),r?.capped===!0&&(0,t.jsx)(Be,{"data-testid":"qi-capped",variant:"secondary",children:e("showing a capped set")})]}),d.length===0?(0,t.jsx)(ht,{description:e("Statements executed in the selected window appear here, with throughput and latency over time."),testId:"qi-empty",title:e("No queries in this window.")}):(0,t.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-throughput",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Throughput")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(St,{data:d,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{allowDecimals:!1,fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(yt,{dataKey:"execs",fill:"var(--color-primary)",fillOpacity:.15,stroke:"var(--color-primary)",type:"monotone"})]})})]}),(0,t.jsxs)("figure",{className:"rounded-xl border border-border p-3","data-testid":"qi-latency",children:[(0,t.jsx)("figcaption",{className:"mb-2 text-xs font-medium text-muted-foreground",children:e("Mean latency (ms)")}),(0,t.jsx)(Ze,{height:140,width:"100%",children:(0,t.jsxs)(Nt,{data:d,children:[(0,t.jsx)(tt,{strokeDasharray:"3 3",vertical:!1}),(0,t.jsx)(rt,{dataKey:"label",fontSize:10,tickLine:!1}),(0,t.jsx)(at,{fontSize:10,tickLine:!1,width:32}),(0,t.jsx)(et,{}),(0,t.jsx)(vt,{dataKey:"avg",dot:!1,stroke:"var(--color-destructive)",type:"monotone"})]})})]})]}),(0,t.jsx)(nr,{queryStats:r?.entries??[]})]})},"fr"),gr=gt(Ae.getMetrics),fr=o((s,e)=>s?e:"overview","gr"),Er=o(({initialShardKey:s})=>{let e=dt(),l=ge(),{queryShardKey:a,setShardKey:r,shardKey:d}=$t(s),[i,n]=(0,P.useState)("overview"),[S,v]=(0,P.useState)([]),w=(0,P.useRef)(null),h=(0,P.useRef)(null),m=(0,P.useRef)(!0);(0,P.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]);let g=zt(a),{data:y,error:q,liveError:M}=Ee(Ae.getMetrics,{},{live:!0,shardKey:a}),c=y??null;(0,P.useEffect)(()=>{if(y===void 0)return;qt(a);let L=y,E=w.current,j=h.current!==null&&h.current!==L.shard;if(h.current=L.shard,w.current=L.requests,j){v([]);return}E!==null&&L.requests>=E&&v(K=>[...K,L.requests-E].slice(-30))},[y,a]);let[p,f]=(0,P.useState)(null),[x,k]=(0,P.useState)(!1),_=o(async()=>{k(!0);let L=At(d,wt());try{let E=await Promise.all(L.map(async j=>{try{let K=await e.query(gr,{},ft(j));return{error:null,metrics:K,shard:j===""?K.shard:j}}catch(K){return{error:pt(K),metrics:null,shard:j===""?"__root__":j}}}));m.current&&f(E)}finally{m.current&&k(!1)}},"C"),N=p===null?null:Lt(p),I=c===null||c.requests===0?"\u2014":`${(c.errors/c.requests*100).toFixed(1)}%`,C=S.length>0?S.at(-1):0,T=c?Kt(c):{p90:0,p95:0},$=(0,P.useMemo)(()=>{if(!c||!("queryStats"in c))return;let L=c.queryStats;if(!(!L||!Array.isArray(L)))return Ot(L)},[c]),b=fr($!==void 0,i),R=o(()=>{bt(_())},"I"),z=o(()=>{f(null)},"A"),A=o(()=>{n("overview")},"E"),O=o(()=>{n("query-insights")},"L");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-metrics",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(kt,{onChange:r,testId:"mt-shard-input",value:d}),(0,t.jsx)(Mt,{message:M,prefix:"mt"}),(0,t.jsx)(Ye,{"data-testid":"mt-aggregate",disabled:x,onClick:R,size:"sm",type:"button",variant:"secondary",children:l(x?"Aggregating\u2026":"All shards")}),p!==null&&(0,t.jsx)(Ye,{"data-testid":"mt-aggregate-clear",onClick:z,size:"sm",type:"button",variant:"ghost",children:l("Hide")}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"mt-cf-link",href:_t,rel:"noreferrer",target:"_blank",children:l("Open in Cloudflare")})]}),q!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"mt-error",role:"alert",children:q}),$!==void 0&&(0,t.jsxs)("div",{className:"flex gap-2 border-b","data-testid":"mt-tabs",children:[(0,t.jsx)("button",{className:`pb-2 text-sm font-medium transition-colors ${b==="overview"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-overview",onClick:A,type:"button",children:l("Overview")}),(0,t.jsxs)("button",{className:`pb-2 text-sm font-medium transition-colors ${b==="query-insights"?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"}`,"data-testid":"mt-tab-query-insights",onClick:O,type:"button",children:[l("Query insights"),$.length>0&&(0,t.jsx)("span",{className:"ml-1.5 rounded-full bg-primary/10 px-1.5 py-0.5 text-xs text-primary",children:$.length})]})]}),b==="query-insights"&&$!==void 0&&(0,t.jsx)(hr,{shardKey:a}),b==="overview"&&c!==null&&(0,t.jsx)(ar,{currentDelta:C,errorRate:I,history:S,latencyPercentiles:T,metrics:c}),b==="overview"&&c===null&&null,b==="overview"&&(0,t.jsx)(Zt,{onOpenTrace:g,shardKey:a}),b==="overview"&&N!==null&&p!==null&&(0,t.jsx)(er,{aggregate:N,shardResults:p})]})},"Pr");export{Er as MetricsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as J}from"./chunk-
|
|
1
|
+
import{b as C}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as J}from"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as H}from"./chunk-VDW32UET.js";import{c as z}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as E}from"./chunk-UANVABQG.js";import{a as G,b as M,c as U,d as P,e as d,f as c}from"./chunk-L4EZAHCD.js";import{a as D,e as _}from"./chunk-IYWVSMAY.js";import{d as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as S,d as O,f as Q,g as V}from"./chunk-R5ZTCHCE.js";var L=O(Q(),1);var r=O(V(),1);var K=["read","insert","update","delete"],B=S((e,s)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[s],"z"),W=S(e=>{let s=new Map;for(let a of e){let t=s.get(a.table)??{operations:new Set,procedures:new Set,table:a.table};t.operations.add(a.on),t.procedures.add(a.procedure),s.set(a.table,t)}return[...s.values()].toSorted((a,t)=>a.table.localeCompare(t.table))},"J"),ie=S(()=>{let e=(0,L.c)(49),s=q(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:t,error:R,errorSource:k}=z(H.rlsPolicies,a),p=t!==void 0,m,n,h,l,f,u,x,b,o;if(e[1]!==t||e[2]!==R||e[3]!==k||e[4]!==p||e[5]!==s){let $=W(Array.isArray(t?.policies)?t.policies:[]),j;e[15]!==t?(j=Array.isArray(t?.roles)?t.roles:[],e[15]=t,e[16]=j):j=e[16],n=j,x="flex flex-col gap-6",b="lunora-rls-panel",e[17]!==R||e[18]!==k?(o=R!==null&&(0,r.jsx)(J,{error:k,testId:"rls-error"}),e[17]=R,e[18]=k,e[19]=o):o=e[19],u="flex flex-col gap-2",m=D,h="overflow-hidden py-0";let I;e[20]!==s?(I=s("Policies"),e[20]=s,e[21]=I):I=e[21],e[22]!==I?(l=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:I})}),e[22]=I,e[23]=l):l=e[23],f=p&&$.length===0?(0,r.jsx)(E,{description:s("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:s("No policies defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Table")}),K.map(i=>(0,r.jsx)(d,{children:B(s,i)},i)),(0,r.jsx)(d,{children:s("Guarded by")})]})}),(0,r.jsx)(U,{children:$.map(i=>(0,r.jsxs)(P,{"data-testid":`rls-table-${i.table}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:i.table}),K.map(F=>(0,r.jsx)(c,{children:i.operations.has(F)?(0,r.jsx)(C,{variant:"secondary",children:s("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},F)),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:[...i.procedures].join(", ")})]},i.table))})]})}),e[1]=t,e[2]=R,e[3]=k,e[4]=p,e[5]=s,e[6]=m,e[7]=n,e[8]=h,e[9]=l,e[10]=f,e[11]=u,e[12]=x,e[13]=b,e[14]=o}else m=e[6],n=e[7],h=e[8],l=e[9],f=e[10],u=e[11],x=e[12],b=e[13],o=e[14];let N;e[24]!==m||e[25]!==h||e[26]!==l||e[27]!==f?(N=(0,r.jsxs)(m,{className:h,children:[l,f]}),e[24]=m,e[25]=h,e[26]=l,e[27]=f,e[28]=N):N=e[28];let g;e[29]!==u||e[30]!==N?(g=(0,r.jsx)("section",{className:u,children:N}),e[29]=u,e[30]=N,e[31]=g):g=e[31];let y;e[32]!==s?(y=s("Roles"),e[32]=s,e[33]=y):y=e[33];let w;e[34]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[34]=y,e[35]=w):w=e[35];let v;e[36]!==p||e[37]!==n||e[38]!==s?(v=p&&n.length===0?(0,r.jsx)(E,{description:s("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:s("No roles defined")}):(0,r.jsx)(_,{className:"px-0",children:(0,r.jsxs)(G,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(M,{children:(0,r.jsxs)(P,{children:[(0,r.jsx)(d,{children:s("Role")}),(0,r.jsx)(d,{children:s("Description")}),(0,r.jsx)(d,{children:s("Permissions")})]})}),(0,r.jsx)(U,{children:n.map(Y)})]})}),e[36]=p,e[37]=n,e[38]=s,e[39]=v):v=e[39];let A;e[40]!==w||e[41]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[40]=w,e[41]=v,e[42]=A):A=e[42];let T;return e[43]!==A||e[44]!==x||e[45]!==b||e[46]!==o||e[47]!==g?(T=(0,r.jsxs)("div",{className:x,"data-testid":b,children:[o,g,A]}),e[43]=A,e[44]=x,e[45]=b,e[46]=o,e[47]=g,e[48]=T):T=e[48],T},"oe");function X(e){return(0,r.jsx)(C,{variant:"outline",children:e},e)}S(X,"K");function Y(e){return(0,r.jsxs)(P,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(c,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(c,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(X)})})]},e.name)}S(Y,"V");export{ie as default};
|
|
@@ -16,4 +16,4 @@ ICU features such as interpolation and plurals will not work properly for that m
|
|
|
16
16
|
|
|
17
17
|
Please compile your catalog first.
|
|
18
18
|
`)),B(v)&&Ee.test(v)?Oe(v):B(v)?v:st(v,this._locale,this._locales)(t,s?.formats)}t=this._.bind(this);date(r,t){return le(this._locales||this._locale,r,t)}number(r,t){return se(this._locales||this._locale,r,t)}};function ce(e={}){return new ae(e)}a(ce,"setupI18n");var Nt=ce();var Y=fe(Pe(),1);var it={},$e="en",at={en:it},ot=a((e=$e,r=at)=>{let t=ce();t.setMessagesCompiler(_e);for(let[s,i]of Object.entries(r))t.load(s,i);return t.activate(r[e]===void 0?$e:e),t},"d"),lt=ot(),ct=(0,Y.createContext)(lt),Lt=a(()=>{let e=(0,Y.use)(ct);return(r,t)=>e._(r,t)},"T");var Kt=a((e,r,t,s,i)=>{switch(r){case"action":return e.action(t,s,i);case"mutation":return e.mutation(t,s,i);default:return e.query(t,s,i)}},"a"),Ht=a(e=>({__lunoraRef:e}),"f"),Wt=a(e=>{let r=e.trim();return r===""?{}:{shardKey:r}},"u"),jt=a(e=>e instanceof Error?e.message:String(e),"d"),Zt=a(e=>{if(e===null||typeof e!="object"||!("code"in e))return;let{code:r}=e;return typeof r=="string"?r:void 0},"l"),Jt=a(e=>{if(e===null||typeof e!="object"||!("hint"in e))return;let{hint:r}=e;return typeof r=="string"?r:Array.isArray(r)?r.filter(t=>typeof t=="string").join(`
|
|
19
|
-
`):void 0},"g"),Vt=a(e=>{if(e===null||typeof e!="object"||!("docsUrl"in e))return;let r=e.docsUrl;if(typeof r=="string")try{let{protocol:t}=new URL(r);return t==="http:"||t==="https:"?r:void 0}catch{return}},"y"),ut=a(e=>{if(e==null)return"\u2014";if(e<1024)return`${e.toString()} B`;let r=["KB","MB","GB","TB"],t=e/1024,s=0;for(;t>=1024&&s<r.length-1;)t/=1024,s+=1;return`${t.toFixed(1)} ${r[s]??"TB"}`},"s"),ft=a(e=>{if(e==null)return"";switch(typeof e){case"bigint":case"boolean":case"number":return e.toString();case"string":return e;case"symbol":return e.toString();default:return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?`<bytes: ${ut(e.byteLength)}>`:JSON.stringify(e)}},"e"),Yt=a((e,r)=>typeof r=="bigint"||r instanceof ArrayBuffer||ArrayBuffer.isView(r)?ft(r):r,"h"),dt=a((e,r)=>{e.catch(t=>{})},"c"),Qt=a(e=>{if(e!==void 0&&e!=="")return e;let r=globalThis.location;return r?.origin!==void 0&&r.origin!==""?r.origin:"http://localhost:5173"},"
|
|
19
|
+
`):void 0},"g"),Vt=a(e=>{if(e===null||typeof e!="object"||!("docsUrl"in e))return;let r=e.docsUrl;if(typeof r=="string")try{let{protocol:t}=new URL(r);return t==="http:"||t==="https:"?r:void 0}catch{return}},"y"),ut=a(e=>{if(e==null)return"\u2014";if(e<1024)return`${e.toString()} B`;let r=["KB","MB","GB","TB"],t=e/1024,s=0;for(;t>=1024&&s<r.length-1;)t/=1024,s+=1;return`${t.toFixed(1)} ${r[s]??"TB"}`},"s"),ft=a(e=>{if(e==null)return"";switch(typeof e){case"bigint":case"boolean":case"number":return e.toString();case"string":return e;case"symbol":return e.toString();default:return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?`<bytes: ${ut(e.byteLength)}>`:JSON.stringify(e)}},"e"),Yt=a((e,r)=>typeof r=="bigint"||r instanceof ArrayBuffer||ArrayBuffer.isView(r)?ft(r):r,"h"),dt=a((e,r)=>{e.catch(t=>{})},"c"),Qt=a(e=>{if(e!==void 0&&e!=="")return e;let r=globalThis.location;return r?.origin!==void 0&&r.origin!==""?r.origin:"http://localhost:5173"},"p"),Xt=a(e=>{let r="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return r===void 0?!1:(dt(r.writeText(e)),!0)},"m"),er=a(e=>`"${e.replaceAll('"','""')}"`,"b"),tr=a((e,r="")=>{if(e==null||e==="")return r;let t=new Date(e);return Number.isNaN(t.getTime())?String(e):t.toLocaleString()},"B");export{ot as a,lt as b,ct as c,Lt as d,Kt as e,Ht as f,Wt as g,jt as h,Zt as i,Jt as j,Vt as k,ut as l,ft as m,Yt as n,dt as o,Qt as p,Xt as q,er as r,tr as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as h}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as A}from"./chunk-
|
|
1
|
+
import{b as h}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as A}from"./chunk-2UWKGSEA.js";import{f as k}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as y,e as S}from"./chunk-IYWVSMAY.js";import{d as I}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as u,d as w,f as z,g as P}from"./chunk-R5ZTCHCE.js";var N=w(z(),1);var a=w(P(),1);var j=[{key:"accounts",label:"Accounts"},{key:"admin",label:"Admin"},{key:"organization",label:"Organizations"},{key:"passkey",label:"Passkeys"},{key:"twoFactor",label:"Two-factor"}],v=u(e=>{if(e===void 0)return"\u2014";let i=[[86400,"d"],[3600,"h"],[60,"m"]];for(let[t,d]of i)if(e>=t&&e%t===0)return`${String(e/t)}${d}`;return`${String(e)}s`},"v"),p=u(e=>{let i=(0,N.c)(8),{children:t,heading:d,testId:n}=e,l;i[0]!==d?(l=(0,a.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d})}),i[0]=d,i[1]=l):l=i[1];let s;i[2]!==t?(s=(0,a.jsx)(S,{className:"p-3",children:t}),i[2]=t,i[3]=s):s=i[3];let c;return i[4]!==l||i[5]!==s||i[6]!==n?(c=(0,a.jsxs)(y,{className:"gap-0 py-0","data-testid":n,children:[l,s]}),i[4]=l,i[5]=s,i[6]=n,i[7]=c):c=i[7],c},"h"),o=u(e=>{let i=(0,N.c)(7),{label:t,value:d}=e,n;i[0]!==t?(n=(0,a.jsx)("span",{className:"text-sm",children:t}),i[0]=t,i[1]=n):n=i[1];let l;i[2]!==d?(l=(0,a.jsx)("span",{className:"text-sm text-muted-foreground tabular-nums",children:d}),i[2]=d,i[3]=l):l=i[3];let s;return i[4]!==n||i[5]!==l?(s=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",children:[n,l]}),i[4]=n,i[5]=l,i[6]=s):s=i[6],s},"c"),M=u(()=>{let e=(0,N.c)(20),i=k(),t=I(),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=["lunora-auth-config"],e[0]=d):d=e[0];let n;e[1]!==i?(n=u(()=>i.getAuthConfig(),"r"),e[1]=i,e[2]=n):n=e[2];let{data:l,error:s}=A(d,n),c;e[3]!==t?(c=u(r=>(0,a.jsx)(h,{variant:r?"success":"outline",children:t(r?"Enabled":"Disabled")}),"u"),e[3]=t,e[4]=c):c=e[4];let m=c,g;e[5]!==s?(g=s!==null&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"auth-config-error",role:"alert",children:s}),e[5]=s,e[6]=g):g=e[6];let f;e[7]!==l||e[8]!==s||e[9]!==t?(f=s===null&&l===void 0&&(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"auth-config-loading",children:t("Loading auth configuration\u2026")}),e[7]=l,e[8]=s,e[9]=t,e[10]=f):f=e[10];let x;e[11]!==l||e[12]!==s||e[13]!==m||e[14]!==t?(x=s===null&&l!==void 0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p,{heading:t("Enabled capabilities"),testId:"auth-config-capabilities",children:(0,a.jsx)("ul",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:j.map(r=>{let $=l.capabilities[r.key];return(0,a.jsxs)("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-${r.key}`,children:[(0,a.jsx)("span",{className:"text-sm",children:t(r.label)}),m($)]},r.key)})})}),(0,a.jsx)(p,{heading:t("Plugins"),testId:"auth-config-plugins",children:l.plugins.length===0?(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:t("No plugins enabled.")}):(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:l.plugins.map(C)})}),(0,a.jsx)(p,{heading:t("Sign-in methods"),testId:"auth-config-signin",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Email & password"),value:m(l.emailAndPassword)}),(0,a.jsx)(o,{label:t("Social providers"),value:l.socialProviders.length===0?t("None"):(0,a.jsx)("span",{className:"flex flex-wrap justify-end gap-1",children:l.socialProviders.map(L)})})]})}),l.organization.enabled&&(0,a.jsx)(p,{heading:t("Organizations"),testId:"auth-config-org",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Teams"),value:m(l.organization.teams)}),(0,a.jsx)(o,{label:t("Custom roles"),value:m(l.organization.roles)})]})}),(0,a.jsx)(p,{heading:t("Session policy"),testId:"auth-config-session",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Expires in"),value:v(l.session.expiresIn)}),(0,a.jsx)(o,{label:t("Refresh after"),value:v(l.session.updateAge)}),(0,a.jsx)(o,{label:t("Fresh window"),value:v(l.session.freshAge)}),(0,a.jsx)(o,{label:t("Cookie cache"),value:m(l.session.cookieCache===!0)})]})}),(0,a.jsx)(p,{heading:t("Rate limit"),testId:"auth-config-ratelimit",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)(o,{label:t("Status"),value:m(l.rateLimit.enabled)}),l.rateLimit.enabled&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o,{label:t("Max requests"),value:l.rateLimit.max??"\u2014"}),(0,a.jsx)(o,{label:t("Window"),value:v(l.rateLimit.window)})]})]})}),l.userFields.length>0&&(0,a.jsx)(p,{heading:t("Plugin user fields"),testId:"auth-config-user-fields",children:(0,a.jsx)("ul",{className:"flex flex-col gap-2",children:l.userFields.map(r=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs","data-testid":`auth-config-user-field-${r.name}`,children:[(0,a.jsxs)("span",{className:"flex flex-col",children:[(0,a.jsx)("span",{className:"font-mono text-xs",children:r.name}),r.plugin!==void 0&&(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground",children:r.plugin})]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(h,{variant:"outline",children:r.type}),r.required&&(0,a.jsx)(h,{variant:"secondary",children:t("required")}),r.unique&&(0,a.jsx)(h,{variant:"secondary",children:t("unique")})]})]},r.name))})}),(0,a.jsx)(y,{className:"gap-0 py-0",children:(0,a.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground","data-testid":"auth-config-note",children: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[11]=l,e[12]=s,e[13]=m,e[14]=t,e[15]=x):x=e[15];let b;return e[16]!==g||e[17]!==f||e[18]!==x?(b=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-config",children:[g,f,x]}),e[16]=g,e[17]=f,e[18]=x,e[19]=b):b=e[19],b},"O");function C(e){return(0,a.jsx)(h,{"data-testid":`auth-config-plugin-${e}`,variant:"outline",children:e},e)}u(C,"P");function L(e){return(0,a.jsx)(h,{"data-testid":`auth-config-provider-${e}`,variant:"outline",children:e},e)}u(L,"z");export{M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-METRMDIQ.js";import{a as x}from"./chunk-NXXGISFB.js";import{a as U}from"./chunk-HLEXBOCL.js";import{b as M}from"./chunk-P52BY657.js";import"./chunk-VNTEQQPP.js";import{P as O}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as h}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as w}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as E}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{d as K,e as _,f as z,h as B,o as P,s as q}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as s,d as J,e as ie,g as oe}from"./chunk-R5ZTCHCE.js";var i=J(ie(),1);var e=J(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"oe"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"ie"),ce=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ue=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ce(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(E.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),u=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),g=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[c,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return u.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(B(d))}),()=>{t=!0}},[u,r]);let A=I===""?g[0]?.path??"":I,n=g.find(t=>t.path===A),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=c.trim()===""?{}:{shardKey:c.trim()},j=o?f.trim():"",L=s(l=>{Y(T=>[{argsText:m,at:Date.now(),id:(T[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:c,status:l},...T].slice(0,fe))},"$");p("running"),N(null);try{let l=j===""?await _(u,n.kind,d,t,R):await u.query(me,{args:t,functionPath:n.path,userId:j},R);M(c),y(l),p("success"),L("success")}catch(l){y(void 0),N(l.message),p("error"),L("error")}},"J"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"M"),te=s(t=>{S(t.target.value)},"P"),re=s(t=>{b(t.target.value)},"z"),ae=s(t=>{W(t.target.value)},"q"),se=s(()=>{P(Z())},"H"),ne=s(()=>{b(ue(n?.args))},"V");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(x,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:A,children:g.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(x,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(U,{onChange:F,testId:"shard-input",value:c}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(x,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:q(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ae");export{Fe as FunctionRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-2UWKGSEA.js";import{a as n}from"./chunk-R5ZTCHCE.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as R}from"./chunk-
|
|
1
|
+
import{b as R}from"./chunk-H2WBIULE.js";import"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as p}from"./chunk-VDW32UET.js";import{c as h}from"./chunk-2UWKGSEA.js";import"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import"./chunk-IYWVSMAY.js";import{d as g}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as i,d as m,f as S,g as _}from"./chunk-R5ZTCHCE.js";var f=m(S(),1);var k=m(_(),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],"f"),w=i(e=>Array.isArray(e.findings)?e.findings:[],"k"),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],"S"),T=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],"A"),L=i(()=>{let e=(0,f.c)(8),s=g(),t;e[0]===Symbol.for("react.memo_cache_sentinel")?(t={},e[0]=t):t=e[0];let{data:a,error:d,errorSource:c}=h(p.getSecurityAudit,t),n;if(e[1]!==a||e[2]!==s){let u=a===void 0?null:w(a);n=u===null?null:u.map(r=>({description:T(s,r),entity:E(r),issueType:A(s,r),key:r.kind,level:r.level})),e[1]=a,e[2]=s,e[3]=n}else n=e[3];let l=n,o;return e[4]!==d||e[5]!==c||e[6]!==l?(o=(0,k.jsx)(R,{error:d,errorSource:c,rows:l,testId:"lunora-security-advisor"}),e[4]=d,e[5]=c,e[6]=l,e[7]=o):o=e[7],o},"y");export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as p}from"./chunk-F7JOSNAT.js";import{d as f}from"./chunk-
|
|
1
|
+
import{b as p}from"./chunk-F7JOSNAT.js";import{d as f}from"./chunk-BKM6PMSO.js";import{a as v,d,f as g,g as h}from"./chunk-R5ZTCHCE.js";var x=d(g(),1);var c=d(h(),1);var y=v(b=>{let e=(0,x.c)(14),{message:i,prefix:n}=b,r=f(),t=p(),l;e[0]!==t?(l=v(()=>{t?.openConsole({errorsOnly:!0})},"l"),e[0]=t,e[1]=l):l=e[1];let u=l;if(i===void 0)return null;let m=`${n}-live-error`,o;e[2]!==i||e[3]!==r?(o=r("Live unavailable: {liveError}",{liveError:i}),e[2]=i,e[3]=r,e[4]=o):o=e[4];let s;e[5]!==t||e[6]!==n||e[7]!==u||e[8]!==r?(s=t===void 0?null:(0,c.jsx)("button",{className:"underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":`${n}-live-error-console`,onClick:u,type:"button",children:r("Show in console")}),e[5]=t,e[6]=n,e[7]=u,e[8]=r,e[9]=s):s=e[9];let a;return e[10]!==m||e[11]!==o||e[12]!==s?(a=(0,c.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-destructive","data-testid":m,role:"status",children:[o,s]}),e[10]=m,e[11]=o,e[12]=s,e[13]=a):a=e[13],a},"E");export{y as a};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as ye}from"./chunk-METRMDIQ.js";import{a as we}from"./chunk-
|
|
1
|
+
import{a as ye}from"./chunk-METRMDIQ.js";import{a as we}from"./chunk-2EJQ7SPV.js";import{a as Ne}from"./chunk-HLEXBOCL.js";import{b as pe}from"./chunk-P52BY657.js";import"./chunk-VNTEQQPP.js";import"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as he}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import{a as H}from"./chunk-VDW32UET.js";import{d as ge}from"./chunk-2UWKGSEA.js";import{f as xe}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as ne,e as ie}from"./chunk-IYWVSMAY.js";import{d as be,f as ce,g as de,h as ee,o as me}from"./chunk-BKM6PMSO.js";import{c as ae}from"./chunk-VYW2PAWC.js";import{a,d as se,e as ve,f as je,g as Ce}from"./chunk-R5ZTCHCE.js";var Se=se(je(),1);var g=se(ve(),1);var r=se(Ce(),1);var Ee=ce(H.exportShard),Te=ce(H.importShard),Oe=a(x=>x.map(e=>JSON.stringify(e)).join(`
|
|
2
2
|
`),"je"),Ae=a(x=>{let e=[],te=x.split(`
|
|
3
3
|
`);for(let[n,N]of te.entries()){let t=N.trim();if(t==="")continue;let o=JSON.parse(t);if(typeof o!="object"||o===null)throw new ae("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);let b=o;if(typeof b.table!="string"||typeof b.doc!="object"||b.doc===null||Array.isArray(b.doc))throw new ae("INTERNAL",`line ${(n+1).toString()}: expected a { table, doc } object`);e.push(b)}return e},"ve"),Ue=a(x=>{let e=(0,Se.c)(94),{initialShardKey:te}=x,n=xe(),N=ge(),t=be(),[o,b]=(0,g.useState)(te??""),[l,ue]=(0,g.useState)(""),[d,M]=(0,g.useState)(!1),[Q,U]=(0,g.useState)(null),[i,re]=(0,g.useState)(null),[w,fe]=(0,g.useState)(null),V;e[0]!==n||e[1]!==o?(V=a(async()=>{M(!0),U(null),re(null);try{let c=await n.query(Ee,{},de(o));pe(o),ue(Oe(c.rows)),fe(c.rows.length)}catch(c){U(ee(c))}M(!1)},"Q"),e[0]=n,e[1]=o,e[2]=V):V=e[2];let z=V,W;e[3]!==n||e[4]!==N||e[5]!==l||e[6]!==o||e[7]!==t?(W=a(async()=>{M(!0),U(null),re(null),fe(null);let c;try{c=Ae(l)}catch(s){U(t("Invalid NDJSON: {message}",{message:ee(s)})),M(!1);return}try{let s=await n.query(Te,{rows:c},de(o));pe(o),re(s),N(H.readTablePage),N(H.listTables)}catch(s){U(ee(s))}M(!1)},"V"),e[3]=n,e[4]=N,e[5]=l,e[6]=o,e[7]=t,e[8]=W):W=e[8];let G=W,y,S,I,m,v,p,u,j,C,f,E;if(e[9]!==d||e[10]!==w||e[11]!==z||e[12]!==i||e[13]!==G||e[14]!==l||e[15]!==o||e[16]!==t){let c=i===null?0:Object.values(i.inserted).reduce(Le,0),s;e[28]!==z?(s=a(()=>{me(z())},"o"),e[28]=z,e[29]=s):s=e[29];let oe=s,Y;e[30]!==G?(Y=a(()=>{me(G())},"Y"),e[30]=G,e[31]=Y):Y=e[31];let le=Y,Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=a(h=>{ue(h.target.value)},"Z"),e[32]=Z):Z=e[32];let Ie=Z;E="flex flex-col gap-4",I="lunora-export-import";let L;e[33]!==t?(L=t("Export"),e[33]=t,e[34]=L):L=e[34];let J;e[35]!==L?(J=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:L})}),e[35]=L,e[36]=J):J=e[36];let _;e[37]!==o?(_=(0,r.jsx)(Ne,{onChange:b,testId:"ei-shard-input",value:o}),e[37]=o,e[38]=_):_=e[38];let $;e[39]!==t?($=t("Export"),e[39]=t,e[40]=$):$=e[40];let k;e[41]!==d||e[42]!==oe||e[43]!==$?(k=(0,r.jsx)(he,{"data-testid":"ei-export",disabled:d,onClick:oe,type:"button",children:$}),e[41]=d,e[42]=oe,e[43]=$,e[44]=k):k=e[44];let D;e[45]!==_||e[46]!==k?(D=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[_,k]}),e[45]=_,e[46]=k,e[47]=D):D=e[47];let q;e[48]!==w||e[49]!==t?(q=w!==null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:t("Exported {count} rows.",{count:w})}),e[48]=w,e[49]=t,e[50]=q):q=e[50];let B;e[51]!==D||e[52]!==q?(B=(0,r.jsxs)(ie,{className:"flex flex-col gap-3 p-4",children:[D,q]}),e[51]=D,e[52]=q,e[53]=B):B=e[53],e[54]!==J||e[55]!==B?(m=(0,r.jsxs)(ne,{className:"rounded-xl border border-border bg-card shadow-xs",children:[J,B]}),e[54]=J,e[55]=B,e[56]=m):m=e[56],S=ne,C="rounded-xl border border-border bg-card shadow-xs";let F;e[57]!==t?(F=t("Import"),e[57]=t,e[58]=F):F=e[58],e[59]!==F?(f=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:F})}),e[59]=F,e[60]=f):f=e[60],y=ie,v="flex flex-col gap-3 p-4",e[61]!==l?(p=(0,r.jsx)(ye,{"aria-label":"NDJSON",className:"font-mono text-xs min-h-40 rounded-md","data-testid":"ei-ndjson",onChange:Ie,placeholder:'{"table":"messages","doc":{\u2026}}',value:l}),e[61]=l,e[62]=p):p=e[62];let P;e[63]!==t?(P=t("Import (writes rows)?"),e[63]=t,e[64]=P):P=e[64];let R;e[65]!==d||e[66]!==l?(R=d||l.trim()==="",e[65]=d,e[66]=l,e[67]=R):R=e[67];let K;e[68]!==t?(K=t("Import"),e[68]=t,e[69]=K):K=e[69],e[70]!==le||e[71]!==P||e[72]!==R||e[73]!==K?(u=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,r.jsx)(we,{confirmLabel:P,disabled:R,onConfirm:le,testId:"ei-import",children:K})}),e[70]=le,e[71]=P,e[72]=R,e[73]=K,e[74]=u):u=e[74],j=i!==null&&(0,r.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:t("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:i.conflicts,errors:i.errors.length,inserted:c})}),i.errors.length>0&&(0,r.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:i.errors.map(h=>(0,r.jsx)("li",{className:"text-xs text-destructive",children:t("line {line} ({table}): {message}",{line:h.line,message:h.message,table:h.table})},`${h.table}-${h.line.toString()}`))})]}),e[9]=d,e[10]=w,e[11]=z,e[12]=i,e[13]=G,e[14]=l,e[15]=o,e[16]=t,e[17]=y,e[18]=S,e[19]=I,e[20]=m,e[21]=v,e[22]=p,e[23]=u,e[24]=j,e[25]=C,e[26]=f,e[27]=E}else y=e[17],S=e[18],I=e[19],m=e[20],v=e[21],p=e[22],u=e[23],j=e[24],C=e[25],f=e[26],E=e[27];let T;e[75]!==y||e[76]!==v||e[77]!==p||e[78]!==u||e[79]!==j?(T=(0,r.jsxs)(y,{className:v,children:[p,u,j]}),e[75]=y,e[76]=v,e[77]=p,e[78]=u,e[79]=j,e[80]=T):T=e[80];let O;e[81]!==S||e[82]!==T||e[83]!==C||e[84]!==f?(O=(0,r.jsxs)(S,{className:C,children:[f,T]}),e[81]=S,e[82]=T,e[83]=C,e[84]=f,e[85]=O):O=e[85];let A;e[86]!==Q?(A=Q!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:Q}),e[86]=Q,e[87]=A):A=e[87];let X;return e[88]!==I||e[89]!==m||e[90]!==O||e[91]!==A||e[92]!==E?(X=(0,r.jsxs)("div",{className:E,"data-testid":I,children:[m,O,A]}),e[88]=I,e[89]=m,e[90]=O,e[91]=A,e[92]=E,e[93]=X):X=e[93],X},"Fe");function Le(x,e){return x+e}a(Le,"Ce");export{Ue as ExportImportPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q}from"./chunk-UANVABQG.js";import{a as O,b as v,c as N,d as b,e as _,f as M}from"./chunk-L4EZAHCD.js";import{a as k}from"./chunk-IYWVSMAY.js";import{d as g,h as T,m as w,o as I}from"./chunk-
|
|
1
|
+
import{a as q}from"./chunk-UANVABQG.js";import{a as O,b as v,c as N,d as b,e as _,f as M}from"./chunk-L4EZAHCD.js";import{a as k}from"./chunk-IYWVSMAY.js";import{d as g,h as T,m as w,o as I}from"./chunk-BKM6PMSO.js";import{c as L}from"./chunk-VYW2PAWC.js";import{a as u,d as E,e as $,f as U,g as W}from"./chunk-R5ZTCHCE.js";var B=E(U(),1);var F="https://api.cloudflare.com/client/v4/accounts",S=class extends L{static{u(this,"c")}constructor(t,m){super("ANALYTICS_SQL_ERROR",`Analytics Engine SQL API returned ${String(t)}: ${m}`,{name:"AnalyticsSqlError",status:t})}},C=u(a=>{let t=a.fetch??globalThis.fetch,m=`${F}/${encodeURIComponent(a.accountId)}/analytics_engine/sql`;return{query:u(async p=>{let l=await t(m,{body:p,headers:{Authorization:`Bearer ${a.apiToken}`,"Content-Type":"text/plain"},method:"POST"});if(!l.ok)throw new S(l.status,await l.text());let r;try{r=await l.json()}catch{throw new S(l.status,"Analytics Engine SQL API returned a non-JSON body.")}let e=r,s=e.data??[];return{columns:e.meta??[],rowCount:e.rows??s.length,rows:s}},"query")}},"h");var y=E($(),1);var n=E(W(),1);var H="ANALYTICS",D=[{key:"volume",sql:u(a=>`SELECT blob2 AS fn, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY calls DESC LIMIT 25`,"sql"),title:"Request volume per function"},{key:"latency",sql:u(a=>`SELECT blob2 AS fn, quantileWeighted(0.50)(double1, _sample_interval) AS p50, quantileWeighted(0.95)(double1, _sample_interval) AS p95 FROM ${a} WHERE blob1 = 'function_call' GROUP BY fn ORDER BY p95 DESC LIMIT 25`,"sql"),title:"Latency p50 / p95 per function"},{key:"hotShards",sql:u(a=>`SELECT blob3 AS shard, count() AS calls FROM ${a} WHERE blob1 = 'function_call' GROUP BY shard ORDER BY calls DESC LIMIT 25`,"sql"),title:"Hot shards"}],Q={error:null,loading:!0,result:null},j=u(a=>{let t=(0,B.c)(27),{state:m,title:p}=a,l=g(),{error:r,loading:e,result:s}=m,o=`analytics-panel-${p}`,c;t[0]!==l||t[1]!==p?(c=l(p),t[0]=l,t[1]=p,t[2]=c):c=t[2];let i;t[3]!==c?(i=(0,n.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,n.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c})}),t[3]=c,t[4]=i):i=t[4];let d;t[5]!==e||t[6]!==l?(d=e&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-loading",children:l("Loading\u2026")}),t[5]=e,t[6]=l,t[7]=d):d=t[7];let f;t[8]!==r||t[9]!==e?(f=!e&&r!==null&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"analytics-error",role:"alert",children:r}),t[8]=r,t[9]=e,t[10]=f):f=t[10];let h;t[11]!==r||t[12]!==e||t[13]!==s||t[14]!==l?(h=!e&&r===null&&s!==null&&s.rows.length===0&&(0,n.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"analytics-empty-rows",children:l("No data points yet.")}),t[11]=r,t[12]=e,t[13]=s,t[14]=l,t[15]=h):h=t[15];let A;t[16]!==r||t[17]!==e||t[18]!==s?(A=!e&&r===null&&s!==null&&s.rows.length>0&&(0,n.jsxs)(O,{children:[(0,n.jsx)(v,{children:(0,n.jsx)(b,{children:s.columns.map(G)})}),(0,n.jsx)(N,{children:s.rows.map((P,Y)=>(0,n.jsx)(b,{children:s.columns.map(R=>(0,n.jsx)(M,{className:"font-mono text-xs",children:w(P[R.name])},R.name))},Y))})]}),t[16]=r,t[17]=e,t[18]=s,t[19]=A):A=t[19];let x;return t[20]!==o||t[21]!==i||t[22]!==d||t[23]!==f||t[24]!==h||t[25]!==A?(x=(0,n.jsxs)(k,{className:"gap-0 py-0","data-testid":o,children:[i,d,f,h,A]}),t[20]=o,t[21]=i,t[22]=d,t[23]=f,t[24]=h,t[25]=A,t[26]=x):x=t[26],x},"H"),rt=u(({config:a,dataset:t=H,runQuery:m}={})=>{let p=g(),[l,r]=(0,y.useState)({}),e=(0,y.useMemo)(()=>{if(m!==void 0)return m;if(a===void 0)return null;let o=C({accountId:a.accountId,apiToken:a.apiToken});return c=>o.query(c)},[a,m]),s=(0,y.useCallback)(async o=>{if(e!==null)for(let c of D){if(o.cancelled)return;r(i=>({...i,[c.key]:{error:null,loading:!0,result:null}}));try{let i=await e(c.sql(t));o.cancelled||r(d=>({...d,[c.key]:{error:null,loading:!1,result:i}}))}catch(i){o.cancelled||r(d=>({...d,[c.key]:{error:T(i),loading:!1,result:null}}))}}},[e,t]);return(0,y.useEffect)(()=>{let o={cancelled:!1};return I(s(o)),()=>{o.cancelled=!0}},[s]),e===null?(0,n.jsx)(q,{description:p("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN (Analytics Read) in your .dev.vars to enable usage panels."),icon:(0,n.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,n.jsx)("path",{d:"M5 20V10m6.5 10V4M18 20v-7M3 20h18"})}),testId:"analytics-not-configured",title:p("Analytics is not configured.")}):(0,n.jsx)("div",{className:"flex flex-col gap-4","data-testid":"lunora-analytics-panel",children:D.map(o=>(0,n.jsx)(j,{state:l[o.key]??Q,title:o.title},o.key))})},"Q");function G(a){return(0,n.jsx)(_,{children:a.name},a.name)}u(G,"W");export{rt as AnalyticsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as Z}from"./chunk-2EJQ7SPV.js";import{a as W}from"./chunk-CKTKI4IY.js";import{a as V}from"./chunk-HLEXBOCL.js";import{b as G}from"./chunk-P52BY657.js";import{a as Q}from"./chunk-TNKECJW4.js";import{e as U}from"./chunk-4YTSKL4R.js";import"./chunk-VNTEQQPP.js";import"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import"./chunk-TFMQSCGC.js";import{b as ee,c as te}from"./chunk-OQS4HFKC.js";import{a as q,b as Y}from"./chunk-H2WBIULE.js";import{a as z}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-7PIHTTND.js";import"./chunk-H4SLAZAN.js";import"./chunk-PZ4QDWTI.js";import"./chunk-DC5AAWSA.js";import"./chunk-F7JOSNAT.js";import{a as $}from"./chunk-VDW32UET.js";import{c as C}from"./chunk-2UWKGSEA.js";import{f as P}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import"./chunk-L4EZAHCD.js";import"./chunk-IYWVSMAY.js";import{d as A,f as H,g as K,o as k,r as M}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as l,d as _,e as he,f as me,g as pe}from"./chunk-R5ZTCHCE.js";var F=_(me(),1);var u=_(he(),1);var I=_(pe(),1);var be=l(t=>{let{suggestedIndex:e,table:r}=t;return!(typeof r!="string"||r.length===0||typeof e!="object"||e===null||!Array.isArray(e.fields)||e.fields.length===0)},"xe"),ge=l((t,e,r)=>{let n=M(t),a=M(e),o=r.map(c=>M(c)).join(", ");return`CREATE INDEX IF NOT EXISTS ${a} ON ${n} (${o});`},"ye"),ve=l(t=>{let e=(0,F.c)(19),{fields:r,indexName:n,table:a,testId:o}=t,c=A(),[T,p]=(0,u.useState)(!1),f;e[0]!==r||e[1]!==n||e[2]!==a?(f=l(()=>{let S="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(S===void 0)return;let x=ge(a,n,r);k(S.writeText(x)),p(!0)},"u"),e[0]=r,e[1]=n,e[2]=a,e[3]=f):f=e[3];let v=f;if(T){let S=`${o}-applied`,x;e[4]!==c?(x=c("CREATE INDEX SQL copied to clipboard."),e[4]=c,e[5]=x):x=e[5];let E;return e[6]!==S||e[7]!==x?(E=(0,I.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":S,children:x}),e[6]=S,e[7]=x,e[8]=E):E=e[8],E}let w;e[9]!==c?(w=c("Apply?"),e[9]=c,e[10]=w):w=e[10];let h;e[11]!==c||e[12]!==a?(h=c("Apply index on {table}",{table:a}),e[11]=c,e[12]=a,e[13]=h):h=e[13];let y;return e[14]!==v||e[15]!==w||e[16]!==h||e[17]!==o?(y=(0,I.jsx)(Z,{confirmLabel:w,onConfirm:v,testId:o,children:h}),e[14]=v,e[15]=w,e[16]=h,e[17]=o,e[18]=y):y=e[18],y},"ve"),ye=l((t,e)=>{let r=new Map;for(let n of e){let a=`${n.table} ${n.index}`;r.set(a,(r.get(a)??0)+n.reads)}return t.map(n=>({index:n.index,reads:r.get(`${n.table} ${n.index}`)??0,table:n.table}))},"Se"),xe=l(t=>{let e=new Map;for(let r of t)for(let n of r.scannedTables??[])e.set(n.table,(e.get(n.table)??0)+n.scans);return[...e].map(([r,n])=>({scans:n,table:r}))},"Te"),ne=l((t,e)=>e.map(r=>({index:r.name,table:t})),"X"),we=l(t=>{let e=ye(t.declaredIndexes??[],t.indexHits??[]),r=xe(t.functions??[]),n=t.shardTraffic??[],a=t.analyticsMetrics,o=a&&a.indexHits.length>0?a.indexHits:e,c=a&&a.tableScans.length>0?a.tableScans:r,T=a&&a.shardTraffic.length>0?a.shardTraffic:n,p=te({indexHits:o,schema:{tables:[]},shardTraffic:T,tableScans:c},{lints:ee,source:"runtime"}),f=t.suppressHotScanTables;return(f===void 0?p:p.filter(v=>!(v.metadata.kind==="hot_scan"&&typeof v.metadata.table=="string"&&f.has(v.metadata.table)))).map(v=>q(v))},"ge"),Se=H($.listTables),Te=H($.listTableIndexes),Ie=H($.listTablesIndexes),j=l(t=>`${(t*100).toFixed(1)}%`,"H"),ae=l(t=>`${(t/1e3).toFixed(2)}s`,"P"),$e=l(t=>{if(t.length<=1)return t[0]??"";let e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},"Ee"),Ee=l((t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function")})[e.kind],"$e"),re=l((t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:j(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict \u2014 consider sharding to cut contention.",{rate:j(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:j(e.value)}),"missing-index":t("Slowest call took {duration} \u2014 it full-scanned {tables} with no index.",{duration:ae(e.value),tables:$e(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:ae(e.value)})})[e.kind],"V"),Ne=l(t=>{let e=(0,F.c)(10),{onJump:r,table:n}=t,a=A(),o;e[0]!==r||e[1]!==n?(o=l(()=>{r(n)},"i"),e[0]=r,e[1]=n,e[2]=o):o=e[2];let c=o,T=`in-add-index-${n}`,p;e[3]!==a||e[4]!==n?(p=a("Add index on {table}",{table:n}),e[3]=a,e[4]=n,e[5]=p):p=e[5];let f;return e[6]!==c||e[7]!==T||e[8]!==p?(f=(0,I.jsx)(z,{"data-testid":T,onClick:c,size:"sm",type:"button",variant:"outline",children:p}),e[6]=c,e[7]=T,e[8]=p,e[9]=f):f=e[9],f},"Ne"),De=l(({initialShardKey:t,loadShardTraffic:e})=>{let r=P(),n=U(),a=A(),{queryShardKey:o,setShardKey:c,shardKey:T}=W(t),[p,f]=(0,u.useState)(null),[v,w]=(0,u.useState)(null),h=(0,u.useRef)(""),y=C($.getMetrics,{},{live:!0,shardKey:o}),S=C($.getFunctionStats,{},{live:!0,shardKey:o}),x=C($.getAdvisories,{},{live:!0,shardKey:o}),E=y.data??null,O=S.data?.functions??null,R=x.data?.advisories??null,se=y.data?.indexHits??null,B=y.error!==null&&S.error!==null?y.error:null,ie=e??(s=>r.shardTraffic(s)),oe=l(async(s,b)=>{let i=s[0];if(i===void 0||i===""){h.current===b&&w(null);return}try{let m=await ie(i);if(h.current!==b)return;let d=new Map;for(let g of m.shards)d.has(g.shardKey)||d.set(g.shardKey,{requests:g.requests,shardKey:g.shardKey});w([...d.values()])}catch{h.current===b&&w(null)}},"W"),le=l(async(s,b)=>{let i=await Promise.allSettled(s.map(async d=>[d,await r.query(Te,{table:d},K(b))])),m=[];for(let d of i)if(d.status==="fulfilled"){let[g,N]=d.value;m.push(...ne(g,N.indexes))}return m},"Y"),D=(0,u.useEffectEvent)(async s=>{h.current=s;let b=[];try{let i=await r.query(Se,{},K(s));if(h.current!==s)return;G(s),b=i.map(d=>d.name);let m=[];if(b.length>0)try{let d=await r.query(Ie,{tables:b},K(s));if(h.current!==s)return;for(let[g,N]of Object.entries(d.indexesByTable))m.push(...ne(g,N))}catch{if(m=await le(b,s),h.current!==s)return}f(m)}catch{h.current===s&&f(null)}await oe(b,s)});(0,u.useEffect)(()=>{k(D(o))},[o]);let ce=(0,u.useEffectEvent)(()=>{y.refetch(),S.refetch(),x.refetch(),k(D(o))});(0,u.useEffect)(()=>{let s=l(()=>{document.visibilityState==="visible"&&ce()},"a");return document.addEventListener("visibilitychange",s),()=>{document.removeEventListener("visibilitychange",s)}},[]);let J=(0,u.useCallback)(s=>{k(n({search:{table:s},to:"/schema"}))},[n]),L=Q(E,O),de=new Set(L.filter(s=>s.kind==="missing-index").flatMap(s=>s.tables??[])),X=we({declaredIndexes:p??[],functions:O,indexHits:se,shardTraffic:v,suppressHotScanTables:de}),ue=(0,u.useMemo)(()=>{let s=L.map(i=>{let m=i.kind==="missing-index"?i.tables??[]:[];return{action:m.length>0?m.map(d=>(0,I.jsx)(Ne,{onJump:J,table:d},d)):void 0,description:i.message===void 0?re(a,i):`${re(a,i)} \u2014 ${i.message}`,entity:i.fn,issueType:Ee(a,i),key:`${i.kind}:${i.fn??""}`,level:i.severity}}),b=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(R??[]).map(i=>{let m=q(i);if(b.has(i.name)&&be(i.metadata)){let{table:d,suggestedIndex:g}=i.metadata,N=`in-apply-index-${d}-${g.name}`;return{...m,action:(0,I.jsx)(ve,{fields:g.fields,indexName:g.name,table:d,testId:N})}}return m}),...X,...s]},[R,L,J,X,a]),fe=(0,I.jsx)(V,{onChange:c,testId:"in-shard-input",value:T});return(0,I.jsx)(Y,{error:B,errorSource:B===null?void 0:y.errorSource,rows:ue,testId:"lunora-insights",toolbar:fe})},"Je");export{De as InsightsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-WUW4ZHRL.js";import{a as H}from"./chunk-OG57FC7W.js";import{a as ee}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as Z}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as E}from"./chunk-YUWMB6EV.js";import{f as R}from"./chunk-TBXK3FKP.js";import"./chunk-RCZTUWG3.js";import{a as _}from"./chunk-UANVABQG.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-L4EZAHCD.js";import{a as A,e as T}from"./chunk-IYWVSMAY.js";import{d as M,h as G,o as W,r as X}from"./chunk-6ZPTNC34.js";import"./chunk-VYW2PAWC.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-R5ZTCHCE.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"j"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>f.listScheduledJobs()))();return le(g)}),[v,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let x;e[5]!==N?(x=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=x):x=e[6],O(x,!l);let C=ce(f,i,d),b=v??N.data,j=s??N.error,I=c(async g=>{if(C!==void 0){m(void 0);try{await C(g),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",J;e[7]!==j?(J=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=J):J=e[8];let S;e[9]!==b?.length||e[10]!==r?(S=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=S):S=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),C!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(g=>(0,h.jsxs)(F,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(p,{children:g.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.id}),C!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),w;return e[12]!==$||e[13]!==J||e[14]!==S?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[J,S,$]}),e[12]=$,e[13]=J,e[14]=S,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,v=me(i,a,e),n=c(async s=>{if(v!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await v(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),v!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),v!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==l||e[4]!==d?(v=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=v):v=e[5];let n=E(N,v),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,x=d===void 0,C;e[6]!==l||e[7]!==x||e[8]!==r?(C=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=C):C=e[9];let b=C,j;e[10]!==l||e[11]!==x||e[12]!==f?(j=f??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async L=>{y(void 0);try{await L,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let J=B,S=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let g;e[23]!==J||e[24]!==S||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(L.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(p,{children:L.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{W(J(b(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(J(I(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=J,e[24]=S,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=g):g=e[29];let D;return e[30]!==g||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,g]}),e[30]=g,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let v=E(o,N),{data:n,error:s}=v,m;e[7]!==v?(m=c(()=>{v.refetch()},"d"),e[7]=v,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let C;e[17]!==n||e[18]!==r?(C=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=C):C=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==x||e[23]!==C?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,x,C]}),e[20]=y,e[21]=k,e[22]=x,e[23]=C,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),v;e[2]!==l?(v=l("Cron triggers"),e[2]=l,e[3]=v):v=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==v||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:v,dead:n,jobs:s,pools:m},e[10]=v,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=x):x=e[15];let C=x,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:C,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let J;e[30]!==o?(J=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=J):J=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==J||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,J,S]}),e[35]=I,e[36]=q,e[37]=B,e[38]=J,e[39]=S,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
|
|
1
|
+
import{a as O}from"./chunk-WUW4ZHRL.js";import{a as H}from"./chunk-2EJQ7SPV.js";import{a as ee}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as Z}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as E}from"./chunk-2UWKGSEA.js";import{f as R}from"./chunk-22WJHOC4.js";import"./chunk-RCZTUWG3.js";import{a as _}from"./chunk-UANVABQG.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-L4EZAHCD.js";import{a as A,e as T}from"./chunk-IYWVSMAY.js";import{d as M,h as G,o as W,s as X}from"./chunk-BKM6PMSO.js";import"./chunk-VYW2PAWC.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-R5ZTCHCE.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"j"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>f.listScheduledJobs()))();return le(g)}),[v,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let x;e[5]!==N?(x=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=x):x=e[6],O(x,!l);let C=ce(f,i,d),b=v??N.data,j=s??N.error,I=c(async g=>{if(C!==void 0){m(void 0);try{await C(g),l||N.refetch()}catch(D){m(G(D))}}},"E"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",J;e[7]!==j?(J=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=J):J=e[8];let S;e[9]!==b?.length||e[10]!==r?(S=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=S):S=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),C!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(g=>(0,h.jsxs)(F,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(p,{children:g.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:g.id}),C!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),w;return e[12]!==$||e[13]!==J||e[14]!==S?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[J,S,$]}),e[12]=$,e[13]=J,e[14]=S,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,v=me(i,a,e),n=c(async s=>{if(v!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await v(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),v!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),v!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==l||e[4]!==d?(v=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=v):v=e[5];let n=E(N,v),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,x=d===void 0,C;e[6]!==l||e[7]!==x||e[8]!==r?(C=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=C):C=e[9];let b=C,j;e[10]!==l||e[11]!==x||e[12]!==f?(j=f??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async L=>{y(void 0);try{await L,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let J=B,S=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let g;e[23]!==J||e[24]!==S||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(L.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(p,{children:L.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{W(J(b(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(J(I(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=J,e[24]=S,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=g):g=e[29];let D;return e[30]!==g||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,g]}),e[30]=g,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let v=E(o,N),{data:n,error:s}=v,m;e[7]!==v?(m=c(()=>{v.refetch()},"d"),e[7]=v,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let C;e[17]!==n||e[18]!==r?(C=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=C):C=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==x||e[23]!==C?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,x,C]}),e[20]=y,e[21]=k,e[22]=x,e[23]=C,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),v;e[2]!==l?(v=l("Cron triggers"),e[2]=l,e[3]=v):v=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==v||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:v,dead:n,jobs:s,pools:m},e[10]=v,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=x):x=e[15];let C=x,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:C,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let J;e[30]!==o?(J=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=J):J=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==J||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,J,S]}),e[35]=I,e[36]=q,e[37]=B,e[38]=J,e[39]=S,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
|