@lunora/studio 1.0.0-alpha.95 → 1.0.0-alpha.96
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/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/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/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 +6 -6
- 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/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 +2 -2
- 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/sparkline.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/{DataBrowser-H4oUFkPJ.js → DataBrowser-CPNKM0KZ.js} +1 -1
- package/dist/packem_shared/{GlobalDataBrowser-CeA8bDjX.js → GlobalDataBrowser-BSmyOO0n.js} +1 -1
- package/dist/packem_shared/{HomePanel-DLP1nQdC.js → HomePanel-BUO6BcYQ.js} +1 -1
- package/dist/packem_shared/{MigrationsPanel-dm_M75mR.js → MigrationsPanel-BAnvY79E.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-DDJG9Je7.js → ScheduledJobs-pHVlh2xU.js} +1 -1
- package/dist/packem_shared/{Studio-BYg65qWq.js → Studio-DG_n-8Pc.js} +1 -1
- package/dist/packem_shared/{StudioApp-D0UOg0a_.js → StudioApp-bavavhpe.js} +1 -1
- package/dist/packem_shared/advisor-view-CGcwvlMo.js +1 -0
- package/dist/packem_shared/bar-chart-B8oDHgnw.js +6 -0
- package/dist/packem_shared/{card-CIDGUN6K.js → card-BMKx5UdA.js} +1 -1
- package/dist/packem_shared/{dropdown-menu-C3RQ_HlW.js → dropdown-menu-BgS2zw1i.js} +1 -1
- package/dist/packem_shared/error-alert-_2q2VtVG.js +1 -0
- package/dist/packem_shared/{grid-features-Db_BNYRo.js → grid-features-Y2YSjhCf.js} +2 -2
- package/dist/packem_shared/home-panel-Ir3YHReO.js +3 -0
- package/dist/packem_shared/result-chart-0VgP_3FP.js +1 -0
- package/dist/packem_shared/schema-diagram-GVgnLWTf.js +2 -0
- package/dist/packem_shared/{select-Bul-DeII.js → select-BssZMiFY.js} +1 -1
- package/dist/packem_shared/{sparkline-CgjeUU2I.js → sparkline-BNvxiJj_.js} +1 -1
- package/dist/packem_shared/{stat-card-fm_TF1mo.js → stat-card-BGJdhfm6.js} +1 -1
- package/dist/packem_shared/studio-C9Qvg13j.js +2 -0
- package/dist/packem_shared/{table-DdJBrClo.js → table-DZAB8cs3.js} +1 -1
- package/dist/packem_shared/{trace-handoff-Dw7mwjxu.js → trace-handoff-CuZ6WGgo.js} +1 -1
- package/dist/packem_shared/use-async-submit-B32whHJO.js +1 -0
- package/dist/standalone/{chunk-TITX6XEA.js → chunk-2FRLB5SB.js} +1 -1
- package/dist/standalone/chunk-2IFGRS6R.js +1 -0
- package/dist/standalone/{chunk-DBMFI2HC.js → chunk-2NO45MRI.js} +1 -1
- package/dist/standalone/{chunk-D62SDRMM.js → chunk-2YGNOZPZ.js} +1 -1
- package/dist/standalone/{chunk-UIGAA3GV.js → chunk-34WN3PEC.js} +1 -1
- package/dist/standalone/{chunk-ZVAGD3FT.js → chunk-3PXUIMP2.js} +1 -1
- package/dist/standalone/chunk-3SCGCJYS.js +1 -0
- package/dist/standalone/{chunk-465RIA2L.js → chunk-3WISGFZ7.js} +1 -1
- package/dist/standalone/{chunk-2OUIHY7G.js → chunk-44T6NSYY.js} +1 -1
- package/dist/standalone/{chunk-IBVBIKUI.js → chunk-57BUSXRD.js} +1 -1
- package/dist/standalone/{chunk-3FIN5PH4.js → chunk-6V27P65N.js} +2 -2
- package/dist/standalone/{chunk-OM36OEHZ.js → chunk-7KU3LR7G.js} +1 -1
- package/dist/standalone/{chunk-G6GX5TVB.js → chunk-7URLLMST.js} +1 -1
- package/dist/standalone/{chunk-RNOSWEMO.js → chunk-AB5WGAX6.js} +2 -2
- package/dist/standalone/{chunk-M7AWSDGY.js → chunk-AQZMKZMP.js} +1 -1
- package/dist/standalone/{chunk-VVNQP4CI.js → chunk-AUXEGD24.js} +1 -1
- package/dist/standalone/{chunk-JYLYJT27.js → chunk-BAJXBWFJ.js} +5 -5
- package/dist/standalone/{chunk-SCKKQIAE.js → chunk-BLJANR7J.js} +1 -1
- package/dist/standalone/{chunk-5TDGHWYU.js → chunk-BMYWOK5Q.js} +1 -1
- package/dist/standalone/{chunk-SKYFKPJC.js → chunk-CFXL7MQK.js} +1 -1
- package/dist/standalone/chunk-CZZWYUTR.js +1 -0
- package/dist/standalone/{chunk-QNHU4SKL.js → chunk-D7B2KFWM.js} +1 -1
- package/dist/standalone/{chunk-O3UMJLO3.js → chunk-DGO2XJOT.js} +1 -1
- package/dist/standalone/{chunk-2T22UR7E.js → chunk-DXJWFZFI.js} +1 -1
- package/dist/standalone/{chunk-QXECM52Z.js → chunk-E2C6CK7F.js} +1 -1
- package/dist/standalone/{chunk-PGVJE5F5.js → chunk-ECF57FQF.js} +1 -1
- package/dist/standalone/{chunk-BN4CIAXU.js → chunk-ESIEIGR3.js} +1 -1
- package/dist/standalone/chunk-ETU7KIO4.js +11 -0
- package/dist/standalone/{chunk-6K46XGR5.js → chunk-EYIEO5QZ.js} +1 -1
- package/dist/standalone/chunk-FA6AR5QU.js +1 -0
- package/dist/standalone/chunk-GL7YL3VF.js +1 -0
- package/dist/standalone/{chunk-LZKU262J.js → chunk-HJC67CE4.js} +1 -1
- package/dist/standalone/{chunk-WI4XINU2.js → chunk-I7FF5IIJ.js} +1 -1
- package/dist/standalone/{chunk-PE7TI4TQ.js → chunk-IGBUUFPN.js} +1 -1
- package/dist/standalone/{chunk-Z4AX76YZ.js → chunk-J4POSI6T.js} +1 -1
- package/dist/standalone/{chunk-A3DBEJLO.js → chunk-JRAUQ4L2.js} +1 -1
- package/dist/standalone/{chunk-3KXDX76D.js → chunk-KGPNIBOV.js} +1 -1
- package/dist/standalone/{chunk-4LCY5XUR.js → chunk-LT236J7E.js} +1 -1
- package/dist/standalone/{chunk-AQ4JNJF3.js → chunk-LV5UVTHL.js} +1 -1
- package/dist/standalone/{chunk-KEVIGWKP.js → chunk-LZ2RREQV.js} +1 -1
- package/dist/standalone/{chunk-ZNAGZU6H.js → chunk-LZGOETI3.js} +1 -1
- package/dist/standalone/{chunk-JEZDJ7D6.js → chunk-MVJMAEP4.js} +1 -1
- package/dist/standalone/{chunk-2O65JEMI.js → chunk-NQ4FA65F.js} +1 -1
- package/dist/standalone/{chunk-IUUSMC2R.js → chunk-NSUBZT43.js} +1 -1
- package/dist/standalone/{chunk-ZA5YIHZM.js → chunk-OZK52CH2.js} +1 -1
- package/dist/standalone/{chunk-7ONX5YGW.js → chunk-Q2QILUP4.js} +1 -1
- package/dist/standalone/{chunk-DMJDUC4L.js → chunk-QNQTMABQ.js} +1 -1
- package/dist/standalone/{chunk-VNQB6HY4.js → chunk-QVPKPH2T.js} +1 -1
- package/dist/standalone/{chunk-ABYJC3LS.js → chunk-SFQX7RUJ.js} +1 -1
- package/dist/standalone/{chunk-DYMO6MDG.js → chunk-TAWXVVAZ.js} +1 -1
- package/dist/standalone/{chunk-YTWBHPAT.js → chunk-TGQH54CS.js} +1 -1
- package/dist/standalone/{chunk-U6KDYJJC.js → chunk-TKFI6XYV.js} +1 -1
- package/dist/standalone/{chunk-EQZTSISX.js → chunk-TMGHRD6W.js} +1 -1
- package/dist/standalone/{chunk-JWXKUXYA.js → chunk-TVRCPIAV.js} +1 -1
- package/dist/standalone/{chunk-3DJ3IUUG.js → chunk-U5MIBWJD.js} +1 -1
- package/dist/standalone/chunk-U7ILDM43.js +59 -0
- package/dist/standalone/{chunk-UGU5GYDV.js → chunk-UE6A3CRB.js} +1 -1
- package/dist/standalone/{chunk-BNAMPDZ2.js → chunk-UZHRBXA7.js} +1 -1
- package/dist/standalone/chunk-VWKQ6X2S.js +1 -0
- package/dist/standalone/{chunk-TMNKNTC4.js → chunk-WOBRLIBX.js} +1 -1
- package/dist/standalone/{chunk-7YJNH3RB.js → chunk-WPERYUTG.js} +1 -1
- package/dist/standalone/{chunk-UZERI5YC.js → chunk-WQH3LT2P.js} +1 -1
- package/dist/standalone/chunk-WQJOV6L5.js +3 -0
- package/dist/standalone/{chunk-XNGYYOLS.js → chunk-YEGFNH56.js} +4 -4
- package/dist/standalone/{chunk-NNKN2XEZ.js → chunk-YOKL7XDT.js} +1 -1
- package/dist/standalone/{chunk-YD5O2NWK.js → chunk-ZCPQGIQW.js} +1 -1
- package/dist/standalone/{chunk-QM4EXWKF.js → chunk-ZURV2PEP.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -6
- package/dist/packem_shared/advisor-view-Coipc04R.js +0 -1
- package/dist/packem_shared/bar-chart-DraN_srt.js +0 -9
- package/dist/packem_shared/error-alert--Ie7ofJ0.js +0 -1
- package/dist/packem_shared/home-panel-BtxdqXDe.js +0 -3
- package/dist/packem_shared/result-chart-Gywg9DOk.js +0 -1
- package/dist/packem_shared/schema-diagram-DTRaCp6Y.js +0 -2
- package/dist/packem_shared/studio-Drf4en3j.js +0 -2
- package/dist/packem_shared/use-async-submit-BFIMhRqh.js +0 -1
- package/dist/standalone/chunk-5KCULF7S.js +0 -11
- package/dist/standalone/chunk-GZMKPBTJ.js +0 -1
- package/dist/standalone/chunk-ILNELDFC.js +0 -1
- package/dist/standalone/chunk-MV4A2PAK.js +0 -1
- package/dist/standalone/chunk-Q2Q7FR3R.js +0 -1
- package/dist/standalone/chunk-S3DWUXGY.js +0 -62
- package/dist/standalone/chunk-UBIPFCOZ.js +0 -1
- package/dist/standalone/chunk-ZQPWVALL.js +0 -3
- package/dist/standalone/chunk-ZZJ7VUVZ.js +0 -1
- /package/dist/standalone/{chunk-7H7LZRLP.js → chunk-4KIQ5RLS.js} +0 -0
- /package/dist/standalone/{chunk-UU2QJMGJ.js → chunk-MKYEFQCA.js} +0 -0
- /package/dist/standalone/{chunk-KUVMORDQ.js → chunk-PKSAWP56.js} +0 -0
- /package/dist/standalone/{chunk-MIQTKZAR.js → chunk-WJQLNYGX.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./chunk-QWGT25SE.js";import{a as Le}from"./chunk-ZJGP6EKR.js";import{b as Se}from"./chunk-AVAC26HJ.js";import{a as de}from"./chunk-XF2B7P5A.js";import{a as Ce}from"./chunk-IGCNMZSB.js";import{a as ie}from"./chunk-FURI47Z2.js";import{a as be}from"./chunk-3CWGJYBB.js";import{a as ve}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as D}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as J}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as xe}from"./chunk-465RIA2L.js";import"./chunk-XXQUMVWH.js";import"./chunk-O3UMJLO3.js";import"./chunk-QLQADHFE.js";import{a as se}from"./chunk-VDW32UET.js";import{c as oe}from"./chunk-ZNAGZU6H.js";import{f as he}from"./chunk-5KCULF7S.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as ye,b as we,c as Ne,d as ne,e as U,f as z}from"./chunk-MIQTKZAR.js";import{d as B,h as le,i as fe,o as ae}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as N,e as re,f as Ee,g as Ke,h as Me,j as G}from"./chunk-3XIESWL4.js";var _=re(Ke(),1);var T=re(Ee(),1);var r=re(Me(),1);var ue=["trace","debug","log","info","warn","error","fatal"],_e="LOG_ARCHIVE_NOT_CONFIGURED",Re={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},$e={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Ae=N((c,e)=>{switch(e.type){case"append":return{...c,cursor:e.cursor,error:null,loading:!1,rows:[...c.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...c,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...c,error:e.message,loading:!1};default:return c}},"Ke"),Oe=N(c=>{let e=(0,_.c)(33),{row:t}=c,s;e[0]!==t.fields?(s=X(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let i=s,o=`lg-archive-row-${String(t.ts)}`,m;e[2]!==t.ts?(m=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=m):m=e[3];let p;e[4]!==m?(p=(0,r.jsx)(z,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:m}),e[4]=m,e[5]=p):p=e[5];let f=Re[t.level],n;e[6]!==t.level||e[7]!==f?(n=(0,r.jsx)(z,{children:(0,r.jsx)(J,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=n):n=e[8];let l;e[9]!==t.functionPath?(l=(0,r.jsx)(z,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=l):l=e[10];let v;e[11]!==t.message?(v=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=v):v=e[12];let a;e[13]!==i?(a=i!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=a):a=e[14];let d;e[15]!==v||e[16]!==a?(d=(0,r.jsxs)(z,{className:"max-w-md",children:[v,a]}),e[15]=v,e[16]=a,e[17]=d):d=e[17];let u=t.traceId??"\u2014",h;e[18]!==u?(h=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:u}),e[18]=u,e[19]=h):h=e[19];let b=t.shardKey??"\u2014",g;e[20]!==b?(g=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=g):g=e[21];let x=t.userId??"\u2014",y;e[22]!==x?(y=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let S;return e[24]!==d||e[25]!==h||e[26]!==g||e[27]!==y||e[28]!==o||e[29]!==p||e[30]!==n||e[31]!==l?(S=(0,r.jsxs)(ne,{"data-testid":o,children:[p,n,l,d,h,g,y]}),e[24]=d,e[25]=h,e[26]=g,e[27]=y,e[28]=o,e[29]=p,e[30]=n,e[31]=l,e[32]=S):S=e[32],S},"Ue"),De=N(({shardKey:c})=>{let e=he(),t=B(),[s,i]=(0,T.useState)(""),[o,m]=(0,T.useState)(""),[p,f]=(0,T.useState)(""),[{cursor:n,error:l,loading:v,notConfigured:a,rows:d},u]=(0,T.useReducer)(Ae,$e),h=ie(s.trim(),400),b=ie(o.trim(),400),g={...h===""?{}:{functionPathPrefix:h},...p===""?{}:{minLevel:p},...c===""?{}:{shardKey:c},...b===""?{}:{userId:b}},x=JSON.stringify(g),y=(0,T.useRef)(x);(0,T.useEffect)(()=>{let w={cancelled:!1};return y.current=x,ae((async()=>{u({type:"loading"});try{let C=await e.queryLogArchive(g);w.cancelled||u({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){w.cancelled||u(fe(C)===_e?{type:"notConfigured"}:{message:le(C),type:"failed"})}})()),()=>{w.cancelled=!0}},[e,x]);let S=N(async()=>{if(n===void 0)return;let w=x;u({type:"loading"});try{let C=await e.queryLogArchive({...g,cursor:n});y.current===w&&u({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===w&&u({message:le(C),type:"pageFailed"})}},"C"),R=N(w=>{i(w.target.value)},"$"),L=N(w=>{m(w.target.value)},"L"),k=N(w=>{f(w.target.value)},"S"),I=N(()=>{ae(S())},"R");return a?(0,r.jsx)(Z,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:L,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:k,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(w=>(0,r.jsx)("option",{value:w,children:w},w))]})]}),l!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:l}),v&&d===null&&l===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),d!==null&&d.length===0&&(0,r.jsx)(Z,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),d!==null&&d.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(ne,{children:[(0,r.jsx)(U,{children:t("Time")}),(0,r.jsx)(U,{children:t("Level")}),(0,r.jsx)(U,{children:t("Function")}),(0,r.jsx)(U,{children:t("Message")}),(0,r.jsx)(U,{children:t("Trace")}),(0,r.jsx)(U,{children:t("Shard")}),(0,r.jsx)(U,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:d.map((w,C)=>(0,r.jsx)(Oe,{row:w},`${String(w.ts)}-${String(C)}`))})]})}),n!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(ge,{"data-testid":"lg-archive-more",disabled:v,onClick:I,size:"sm",variant:"outline",children:t(v?"Loading\u2026":"Load more")})})]})},"De"),Ue=N(c=>{let e=(0,_.c)(11),{level:t,onToggle:s,selected:i}=c,o;e[0]!==t||e[1]!==s?(o=N(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let m=o,p=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==p?(f=G("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=f):f=e[4];let n=`logs-level-${t}`,l;return e[5]!==t||e[6]!==m||e[7]!==i||e[8]!==f||e[9]!==n?(l=(0,r.jsx)("button",{"aria-pressed":i,className:f,"data-testid":n,onClick:m,type:"button",children:t}),e[5]=t,e[6]=m,e[7]=i,e[8]=f,e[9]=n,e[10]=l):l=e[10],l},"Ve"),ze=N(c=>{let e=(0,_.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:i,onTimeRangeChange:o,onToggleLevel:m,onToggleSummary:p,pathFilter:f,search:n,showSummary:l,timeRange:v}=c,a=B(),d;e[0]!==a?(d=a("Search messages"),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("search message"),e[2]=a,e[3]=u):u=e[3];let h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u?(h=(0,r.jsx)(D,{"aria-label":d,className:"h-8 w-48","data-testid":"lg-search",onChange:i,placeholder:u,value:n}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h):h=e[8];let b;e[9]!==a?(b=a("Function path"),e[9]=a,e[10]=b):b=e[10];let g;e[11]!==a?(g=a("filter path"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==s||e[14]!==f||e[15]!==b||e[16]!==g?(x=(0,r.jsx)(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:g,value:f}),e[13]=s,e[14]=f,e[15]=b,e[16]=g,e[17]=x):x=e[17];let y;e[18]!==a?(y=a("Level filter"),e[18]=a,e[19]=y):y=e[19];let S;e[20]!==t||e[21]!==m?(S=ue.map(j=>(0,r.jsx)(Ue,{level:j,onToggle:m,selected:t.has(j)},j)),e[20]=t,e[21]=m,e[22]=S):S=e[22];let R;e[23]!==y||e[24]!==S?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:S}),e[23]=y,e[24]=S,e[25]=R):R=e[25];let L;e[26]!==a?(L=a("Time range"),e[26]=a,e[27]=L):L=e[27];let k;e[28]!==a?(k=a("All time"),e[28]=a,e[29]=k):k=e[29];let I;e[30]!==k?(I=(0,r.jsx)("option",{value:"all",children:k}),e[30]=k,e[31]=I):I=e[31];let w;e[32]!==a?(w=a("Last 5m"),e[32]=a,e[33]=w):w=e[33];let C;e[34]!==w?(C=(0,r.jsx)("option",{value:"5m",children:w}),e[34]=w,e[35]=C):C=e[35];let q;e[36]!==a?(q=a("Last 15m"),e[36]=a,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let E;e[40]!==a?(E=a("Last hour"),e[40]=a,e[41]=E):E=e[41];let K;e[42]!==E?(K=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=K):K=e[43];let $;e[44]!==o||e[45]!==L||e[46]!==I||e[47]!==C||e[48]!==F||e[49]!==K||e[50]!==v?($=(0,r.jsxs)("select",{"aria-label":L,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:v,children:[I,C,F,K]}),e[44]=o,e[45]=L,e[46]=I,e[47]=C,e[48]=F,e[49]=K,e[50]=v,e[51]=$):$=e[51];let V=l?"border-border bg-muted font-medium":"border-input text-muted-foreground",O;e[52]!==V?(O=G("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=O):O=e[53];let A;e[54]!==l||e[55]!==a?(A=a(l?"List":"Summary"),e[54]=l,e[55]=a,e[56]=A):A=e[56];let M;e[57]!==p||e[58]!==l||e[59]!==O||e[60]!==A?(M=(0,r.jsx)("button",{"aria-pressed":l,className:O,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:A}),e[57]=p,e[58]=l,e[59]=O,e[60]=A,e[61]=M):M=e[61];let W;return e[62]!==$||e[63]!==M||e[64]!==h||e[65]!==x||e[66]!==R?(W=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[h,x,R,$,M]}),e[62]=$,e[63]=M,e[64]=h,e[65]=x,e[66]=R,e[67]=W):W=e[67],W},"je"),je=N(c=>{let e=(0,_.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:i,onUserChange:o,outcomeFilter:m,pathPrefix:p,tableFilter:f,userIdFilter:n}=c,l=B(),v;e[0]!==l?(v=l("Function path"),e[0]=l,e[1]=v):v=e[1];let a;e[2]!==l?(a=l("file:function"),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==s||e[5]!==p||e[6]!==v||e[7]!==a?(d=(0,r.jsx)(D,{"aria-label":v,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:a,value:p}),e[4]=s,e[5]=p,e[6]=v,e[7]=a,e[8]=d):d=e[8];let u;e[9]!==l?(u=l("User id"),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("userId"),e[11]=l,e[12]=h):h=e[12];let b;e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==n?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:h,value:n}),e[13]=o,e[14]=u,e[15]=h,e[16]=n,e[17]=b):b=e[17];let g;e[18]!==l?(g=l("Table touched"),e[18]=l,e[19]=g):g=e[19];let x;e[20]!==l?(x=l("table"),e[20]=l,e[21]=x):x=e[21];let y;e[22]!==i||e[23]!==g||e[24]!==x||e[25]!==f?(y=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-table",onChange:i,placeholder:x,value:f}),e[22]=i,e[23]=g,e[24]=x,e[25]=f,e[26]=y):y=e[26];let S;e[27]!==l?(S=l("Outcome filter"),e[27]=l,e[28]=S):S=e[28];let R;e[29]!==l?(R=l("all"),e[29]=l,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=L):L=e[32];let k;e[33]!==l?(k=l("ok"),e[33]=l,e[34]=k):k=e[34];let I;e[35]!==k?(I=(0,r.jsx)("option",{value:"ok",children:k}),e[35]=k,e[36]=I):I=e[36];let w;e[37]!==l?(w=l("error"),e[37]=l,e[38]=w):w=e[38];let C;e[39]!==w?(C=(0,r.jsx)("option",{value:"error",children:w}),e[39]=w,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==m||e[43]!==S||e[44]!==L||e[45]!==I||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:m,children:[L,I,C]}),e[41]=t,e[42]=m,e[43]=S,e[44]=L,e[45]=I,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==d||e[50]!==b||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d,b,y,q]}),e[48]=q,e[49]=d,e[50]=b,e[51]=y,e[52]=F):F=e[52],F},"Be"),Ie=N(c=>{let e=(0,_.c)(7),{bucket:t}=c,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let i;e[2]!==t.count?(i=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==i?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,i]}),e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"ve"),Be=N(c=>{let e=(0,_.c)(31),{summary:t}=c,s=B(),i;e[0]!==t.total||e[1]!==s?(i=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==i?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:i}),e[3]=i,e[4]=o):o=e[4];let m;e[5]!==s?(m=s("By level"),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==m?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[7]=m,e[8]=p):p=e[8];let f;e[9]!==t.byLevel?(f=t.byLevel.map(We),e[9]=t.byLevel,e[10]=f):f=e[10];let n;e[11]!==f?(n=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:f}),e[11]=f,e[12]=n):n=e[12];let l;e[13]!==p||e[14]!==n?(l=(0,r.jsxs)("div",{children:[p,n]}),e[13]=p,e[14]=n,e[15]=l):l=e[15];let v;e[16]!==s?(v=s("By function"),e[16]=s,e[17]=v):v=e[17];let a;e[18]!==v?(a=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[18]=v,e[19]=a):a=e[19];let d;e[20]!==t.byPath?(d=t.byPath.map(Ge),e[20]=t.byPath,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:d}),e[22]=d,e[23]=u):u=e[23];let h;e[24]!==u||e[25]!==a?(h=(0,r.jsxs)("div",{children:[a,u]}),e[24]=u,e[25]=a,e[26]=h):h=e[26];let b;return e[27]!==h||e[28]!==o||e[29]!==l?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,l,h]}),e[27]=h,e[28]=o,e[29]=l,e[30]=b):b=e[30],b},"ze");function We(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(We,"Ge");function Ge(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(Ge,"We");var Ve=N(c=>{let e=(0,_.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:i,onShowErrors:o,onShowRequests:m,shardKey:p,view:f}=c,n=B(),l=f==="requests",v=f==="requests"?"bg-muted font-medium":"text-muted-foreground",a;e[0]!==v?(a=G("px-3 py-1 text-sm",v),e[0]=v,e[1]=a):a=e[1];let d;e[2]!==n?(d=n("Requests"),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==m||e[5]!==l||e[6]!==a||e[7]!==d?(u=(0,r.jsx)("button",{"aria-selected":l,className:a,"data-testid":"lg-view-requests",onClick:m,role:"tab",type:"button",children:d}),e[4]=m,e[5]=l,e[6]=a,e[7]=d,e[8]=u):u=e[8];let h=f==="errors",b=f==="errors"?"bg-muted font-medium":"text-muted-foreground",g;e[9]!==b?(g=G("px-3 py-1 text-sm",b),e[9]=b,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Errors"),e[11]=n,e[12]=x):x=e[12];let y;e[13]!==o||e[14]!==h||e[15]!==g||e[16]!==x?(y=(0,r.jsx)("button",{"aria-selected":h,className:g,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:x}),e[13]=o,e[14]=h,e[15]=g,e[16]=x,e[17]=y):y=e[17];let S=f==="archive",R=f==="archive"?"bg-muted font-medium":"text-muted-foreground",L;e[18]!==R?(L=G("px-3 py-1 text-sm",R),e[18]=R,e[19]=L):L=e[19];let k;e[20]!==n?(k=n("Archive"),e[20]=n,e[21]=k):k=e[21];let I;e[22]!==i||e[23]!==S||e[24]!==L||e[25]!==k?(I=(0,r.jsx)("button",{"aria-selected":S,className:L,"data-testid":"lg-view-archive",onClick:i,role:"tab",type:"button",children:k}),e[22]=i,e[23]=S,e[24]=L,e[25]=k,e[26]=I):I=e[26];let w;e[27]!==y||e[28]!==I||e[29]!==u?(w=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,y,I]}),e[27]=y,e[28]=I,e[29]=u,e[30]=w):w=e[30];let C;e[31]!==s||e[32]!==p?(C=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==f?(q=f!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=f,e[36]=q):q=e[36];let F;e[37]!==n?(F=n("Open in Cloudflare"),e[37]=n,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let K;return e[41]!==w||e[42]!==C||e[43]!==q||e[44]!==E?(K=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[w,C,q,E]}),e[41]=w,e[42]=C,e[43]=q,e[44]=E,e[45]=K):K=e[45],K},"Qe"),ce=400,Qe=36,Ye={height:ce,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},He={error:"destructive",ok:"secondary"},Je=N(c=>{let e=(0,_.c)(26),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.fields?(n=X(t.fields),e[2]=t.fields,e[3]=n):n=e[3];let l=n,v;e[4]!==t.timestamp?(v=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=v):v=e[5];let a;e[6]!==v?(a=(0,r.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:v}),e[6]=v,e[7]=a):a=e[7];let d=Re[t.level],u;e[8]!==t.level||e[9]!==d?(u=(0,r.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:d,children:t.level})}),e[8]=t.level,e[9]=d,e[10]=u):u=e[10];let h=t.functionPath??"\u2014",b;e[11]!==h?(b=(0,r.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=b):b=e[12];let g;e[13]!==l?(g=l===""?null:(0,r.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:l}),e[13]=l,e[14]=g):g=e[14];let x;e[15]!==t.message||e[16]!==g?(x=(0,r.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]}),e[15]=t.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==i||e[20]!==f||e[21]!==x||e[22]!==a||e[23]!==u||e[24]!==b?(y=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:i,role:"row",style:f,children:[a,u,b,x]}),e[18]=s,e[19]=i,e[20]=f,e[21]=x,e[22]=a,e[23]=u,e[24]=b,e[25]=y):y=e[25],y},"Xe"),ke=N(c=>c.length===0?"\u2014":c.join(", "),"ce"),Ze=N(c=>{let e=(0,_.c)(37),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.ts?(n=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=n):n=e[3];let l;e[4]!==n?(l=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:n}),e[4]=n,e[5]=l):l=e[5];let v=He[t.outcome],a;e[6]!==t.outcome||e[7]!==v?(a=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:v,children:t.outcome})}),e[6]=t.outcome,e[7]=v,e[8]=a):a=e[8];let d;e[9]!==t.functionPath?(d=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=d):d=e[10];let u=t.shardKey??"\u2014",h;e[11]!==u?(h=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[11]=u,e[12]=h):h=e[12];let b=t.userId??"\u2014",g;e[13]!==b?(g=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[13]=b,e[14]=g):g=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let y=`${String(x)}ms`,S;e[17]!==y?(S=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=S):S=e[18];let R;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(R=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ke(t.tablesRead)} \xB7 w:${ke(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=R):R=e[23];let L;e[24]!==R?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=L):L=e[25];let k;return e[26]!==s||e[27]!==i||e[28]!==f||e[29]!==g||e[30]!==S||e[31]!==L||e[32]!==l||e[33]!==a||e[34]!==d||e[35]!==h?(k=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:i,role:"row",style:f,children:[l,a,d,h,g,S,L]}),e[26]=s,e[27]=i,e[28]=f,e[29]=g,e[30]=S,e[31]=L,e[32]=l,e[33]=a,e[34]=d,e[35]=h,e[36]=k):k=e[36],k},"Ze"),Pe=N(c=>{let{entries:e}=c??{};return Array.isArray(e)?e:[]},"ue"),Xe=N(c=>{let e={};return c.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=c.functionPathPrefix.trim()),c.userId.trim()!==""&&(e.userId=c.userId.trim()),c.tableTouched.trim()!==""&&(e.tableTouched=c.tableTouched.trim()),(c.outcome==="ok"||c.outcome==="error")&&(e.outcome=c.outcome),e},"et"),et={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},tt=N((c,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-et[e.range];return c.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||X(o.fields).toLowerCase().includes(t))},"rt"),rt="\u2014",lt=N(c=>{let e=new Map,t=new Map;for(let o of c){e.set(o.level,(e.get(o.level)??0)+1);let m=o.functionPath??rt;t.set(m,(t.get(m)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,m])=>({count:m,key:o})).toSorted((o,m)=>m.count===o.count?o.key.localeCompare(m.key):m.count-o.count);return{byLevel:s,byPath:i,total:c.length}},"at"),Lt=N(({initialShardKey:c})=>{let e=B(),[t,s]=(0,T.useState)("requests"),{queryShardKey:i,setShardKey:o,shardKey:m}=be(c),[p,f]=(0,T.useState)(""),[n,l]=(0,T.useState)(()=>new Set),[v,a]=(0,T.useState)(""),[d,u]=(0,T.useState)("all"),[h,b]=(0,T.useState)(!1),[g,x]=(0,T.useState)(""),[y,S]=(0,T.useState)(""),[R,L]=(0,T.useState)(""),[k,I]=(0,T.useState)("all"),w=Xe({functionPathPrefix:g,outcome:k,tableTouched:R,userId:y}),C=oe(se.getRequestLog,w,{enabled:t==="requests",live:!0,shardKey:i}),q=oe(se.getLogs,{},{enabled:t==="errors",live:!0,shardKey:i}),F=t==="requests"?C:q,{error:E,errorSource:K,isLoading:$,liveError:V}=F,O=Pe(q.data),A=Pe(C.data);(0,T.useEffect)(()=>{F.data!==void 0&&pe(i)},[F.data,i]);let M=tt(O,{levels:n,now:Date.now(),path:v,range:d,search:p}),W=lt(M),j=t==="requests"?A.length:M.length,ee=t==="errors"&&h,Q=(0,T.useMemo)(()=>E!==null?"error":j===0?$?ee?"summary":"list":"empty":ee?"summary":"list",[j,$,E,ee]),me=(0,T.useRef)(null),Y=Se({count:j,estimateSize:N(()=>Qe,"estimateSize"),getScrollElement:N(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:N((P,te)=>Le(P,te,ce),"observeElementRect"),overscan:8}),qe=Y.getVirtualItems(),Fe={height:Y.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ve,{liveError:V,onShardKeyChange:o,onShowArchive:N(()=>{s("archive"),b(!1)},"onShowArchive"),onShowErrors:N(()=>{s("errors"),b(!1)},"onShowErrors"),onShowRequests:N(()=>{s("requests"),b(!1)},"onShowRequests"),shardKey:m,view:t}),t==="errors"&&(0,r.jsx)(ze,{levelFilter:n,onLogPathChange:N(P=>{a(P.target.value)},"onLogPathChange"),onSearchChange:N(P=>{f(P.target.value)},"onSearchChange"),onTimeRangeChange:N(P=>{u(P.target.value)},"onTimeRangeChange"),onToggleLevel:N(P=>{l(te=>{let H=new Set(te);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:N(()=>{b(P=>!P)},"onToggleSummary"),pathFilter:v,search:p,showSummary:h,timeRange:d}),t==="requests"&&(0,r.jsx)(je,{onOutcomeChange:N(P=>{I(P.target.value)},"onOutcomeChange"),onPathChange:N(P=>{x(P.target.value)},"onPathChange"),onTableChange:N(P=>{L(P.target.value)},"onTableChange"),onUserChange:N(P=>{S(P.target.value)},"onUserChange"),outcomeFilter:k,pathPrefix:g,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(De,{shardKey:i}):(0,r.jsxs)(r.Fragment,{children:[Q==="error"&&(0,r.jsx)(xe,{error:K,testId:"lg-error"}),Q==="empty"&&(0,r.jsx)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Q==="summary"&&(0,r.jsx)(Be,{summary:W}),Q==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:Ye,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Fe,children:qe.map(P=>t==="requests"?(0,r.jsx)(Ze,{entry:A[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key):(0,r.jsx)(Je,{entry:M[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key))})})]})]})},"Pt");export{Lt as LogsPanel,tt as filterLogs,lt as summarizeLogs};
|
|
1
|
+
import{a as X}from"./chunk-QWGT25SE.js";import{a as Le}from"./chunk-ZJGP6EKR.js";import{b as Se}from"./chunk-AVAC26HJ.js";import{a as de}from"./chunk-XF2B7P5A.js";import{a as Ce}from"./chunk-IGCNMZSB.js";import{a as ie}from"./chunk-FURI47Z2.js";import{a as be}from"./chunk-3CWGJYBB.js";import{a as ve}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as D}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as J}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as xe}from"./chunk-3WISGFZ7.js";import"./chunk-XXQUMVWH.js";import"./chunk-DGO2XJOT.js";import"./chunk-QLQADHFE.js";import{a as se}from"./chunk-VDW32UET.js";import{c as oe}from"./chunk-LZGOETI3.js";import{f as he}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as ye,b as we,c as Ne,d as ne,e as U,f as z}from"./chunk-WJQLNYGX.js";import{d as B,h as le,i as fe,o as ae}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as N,e as re,f as Ee,g as Ke,h as Me,j as G}from"./chunk-3XIESWL4.js";var _=re(Ke(),1);var T=re(Ee(),1);var r=re(Me(),1);var ue=["trace","debug","log","info","warn","error","fatal"],_e="LOG_ARCHIVE_NOT_CONFIGURED",Re={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},$e={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Ae=N((c,e)=>{switch(e.type){case"append":return{...c,cursor:e.cursor,error:null,loading:!1,rows:[...c.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...c,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...c,error:e.message,loading:!1};default:return c}},"Ke"),Oe=N(c=>{let e=(0,_.c)(33),{row:t}=c,s;e[0]!==t.fields?(s=X(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let i=s,o=`lg-archive-row-${String(t.ts)}`,m;e[2]!==t.ts?(m=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=m):m=e[3];let p;e[4]!==m?(p=(0,r.jsx)(z,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:m}),e[4]=m,e[5]=p):p=e[5];let f=Re[t.level],n;e[6]!==t.level||e[7]!==f?(n=(0,r.jsx)(z,{children:(0,r.jsx)(J,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=n):n=e[8];let l;e[9]!==t.functionPath?(l=(0,r.jsx)(z,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=l):l=e[10];let v;e[11]!==t.message?(v=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=v):v=e[12];let a;e[13]!==i?(a=i!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=a):a=e[14];let d;e[15]!==v||e[16]!==a?(d=(0,r.jsxs)(z,{className:"max-w-md",children:[v,a]}),e[15]=v,e[16]=a,e[17]=d):d=e[17];let u=t.traceId??"\u2014",h;e[18]!==u?(h=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:u}),e[18]=u,e[19]=h):h=e[19];let b=t.shardKey??"\u2014",g;e[20]!==b?(g=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=g):g=e[21];let x=t.userId??"\u2014",y;e[22]!==x?(y=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let S;return e[24]!==d||e[25]!==h||e[26]!==g||e[27]!==y||e[28]!==o||e[29]!==p||e[30]!==n||e[31]!==l?(S=(0,r.jsxs)(ne,{"data-testid":o,children:[p,n,l,d,h,g,y]}),e[24]=d,e[25]=h,e[26]=g,e[27]=y,e[28]=o,e[29]=p,e[30]=n,e[31]=l,e[32]=S):S=e[32],S},"Ue"),De=N(({shardKey:c})=>{let e=he(),t=B(),[s,i]=(0,T.useState)(""),[o,m]=(0,T.useState)(""),[p,f]=(0,T.useState)(""),[{cursor:n,error:l,loading:v,notConfigured:a,rows:d},u]=(0,T.useReducer)(Ae,$e),h=ie(s.trim(),400),b=ie(o.trim(),400),g={...h===""?{}:{functionPathPrefix:h},...p===""?{}:{minLevel:p},...c===""?{}:{shardKey:c},...b===""?{}:{userId:b}},x=JSON.stringify(g),y=(0,T.useRef)(x);(0,T.useEffect)(()=>{let w={cancelled:!1};return y.current=x,ae((async()=>{u({type:"loading"});try{let C=await e.queryLogArchive(g);w.cancelled||u({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){w.cancelled||u(fe(C)===_e?{type:"notConfigured"}:{message:le(C),type:"failed"})}})()),()=>{w.cancelled=!0}},[e,x]);let S=N(async()=>{if(n===void 0)return;let w=x;u({type:"loading"});try{let C=await e.queryLogArchive({...g,cursor:n});y.current===w&&u({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===w&&u({message:le(C),type:"pageFailed"})}},"C"),R=N(w=>{i(w.target.value)},"$"),L=N(w=>{m(w.target.value)},"L"),k=N(w=>{f(w.target.value)},"S"),I=N(()=>{ae(S())},"R");return a?(0,r.jsx)(Z,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:L,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:k,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(w=>(0,r.jsx)("option",{value:w,children:w},w))]})]}),l!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:l}),v&&d===null&&l===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),d!==null&&d.length===0&&(0,r.jsx)(Z,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),d!==null&&d.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(ne,{children:[(0,r.jsx)(U,{children:t("Time")}),(0,r.jsx)(U,{children:t("Level")}),(0,r.jsx)(U,{children:t("Function")}),(0,r.jsx)(U,{children:t("Message")}),(0,r.jsx)(U,{children:t("Trace")}),(0,r.jsx)(U,{children:t("Shard")}),(0,r.jsx)(U,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:d.map((w,C)=>(0,r.jsx)(Oe,{row:w},`${String(w.ts)}-${String(C)}`))})]})}),n!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(ge,{"data-testid":"lg-archive-more",disabled:v,onClick:I,size:"sm",variant:"outline",children:t(v?"Loading\u2026":"Load more")})})]})},"De"),Ue=N(c=>{let e=(0,_.c)(11),{level:t,onToggle:s,selected:i}=c,o;e[0]!==t||e[1]!==s?(o=N(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let m=o,p=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==p?(f=G("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=f):f=e[4];let n=`logs-level-${t}`,l;return e[5]!==t||e[6]!==m||e[7]!==i||e[8]!==f||e[9]!==n?(l=(0,r.jsx)("button",{"aria-pressed":i,className:f,"data-testid":n,onClick:m,type:"button",children:t}),e[5]=t,e[6]=m,e[7]=i,e[8]=f,e[9]=n,e[10]=l):l=e[10],l},"Ve"),ze=N(c=>{let e=(0,_.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:i,onTimeRangeChange:o,onToggleLevel:m,onToggleSummary:p,pathFilter:f,search:n,showSummary:l,timeRange:v}=c,a=B(),d;e[0]!==a?(d=a("Search messages"),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("search message"),e[2]=a,e[3]=u):u=e[3];let h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u?(h=(0,r.jsx)(D,{"aria-label":d,className:"h-8 w-48","data-testid":"lg-search",onChange:i,placeholder:u,value:n}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h):h=e[8];let b;e[9]!==a?(b=a("Function path"),e[9]=a,e[10]=b):b=e[10];let g;e[11]!==a?(g=a("filter path"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==s||e[14]!==f||e[15]!==b||e[16]!==g?(x=(0,r.jsx)(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:g,value:f}),e[13]=s,e[14]=f,e[15]=b,e[16]=g,e[17]=x):x=e[17];let y;e[18]!==a?(y=a("Level filter"),e[18]=a,e[19]=y):y=e[19];let S;e[20]!==t||e[21]!==m?(S=ue.map(j=>(0,r.jsx)(Ue,{level:j,onToggle:m,selected:t.has(j)},j)),e[20]=t,e[21]=m,e[22]=S):S=e[22];let R;e[23]!==y||e[24]!==S?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:S}),e[23]=y,e[24]=S,e[25]=R):R=e[25];let L;e[26]!==a?(L=a("Time range"),e[26]=a,e[27]=L):L=e[27];let k;e[28]!==a?(k=a("All time"),e[28]=a,e[29]=k):k=e[29];let I;e[30]!==k?(I=(0,r.jsx)("option",{value:"all",children:k}),e[30]=k,e[31]=I):I=e[31];let w;e[32]!==a?(w=a("Last 5m"),e[32]=a,e[33]=w):w=e[33];let C;e[34]!==w?(C=(0,r.jsx)("option",{value:"5m",children:w}),e[34]=w,e[35]=C):C=e[35];let q;e[36]!==a?(q=a("Last 15m"),e[36]=a,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let E;e[40]!==a?(E=a("Last hour"),e[40]=a,e[41]=E):E=e[41];let K;e[42]!==E?(K=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=K):K=e[43];let $;e[44]!==o||e[45]!==L||e[46]!==I||e[47]!==C||e[48]!==F||e[49]!==K||e[50]!==v?($=(0,r.jsxs)("select",{"aria-label":L,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:v,children:[I,C,F,K]}),e[44]=o,e[45]=L,e[46]=I,e[47]=C,e[48]=F,e[49]=K,e[50]=v,e[51]=$):$=e[51];let V=l?"border-border bg-muted font-medium":"border-input text-muted-foreground",O;e[52]!==V?(O=G("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=O):O=e[53];let A;e[54]!==l||e[55]!==a?(A=a(l?"List":"Summary"),e[54]=l,e[55]=a,e[56]=A):A=e[56];let M;e[57]!==p||e[58]!==l||e[59]!==O||e[60]!==A?(M=(0,r.jsx)("button",{"aria-pressed":l,className:O,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:A}),e[57]=p,e[58]=l,e[59]=O,e[60]=A,e[61]=M):M=e[61];let W;return e[62]!==$||e[63]!==M||e[64]!==h||e[65]!==x||e[66]!==R?(W=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[h,x,R,$,M]}),e[62]=$,e[63]=M,e[64]=h,e[65]=x,e[66]=R,e[67]=W):W=e[67],W},"je"),je=N(c=>{let e=(0,_.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:i,onUserChange:o,outcomeFilter:m,pathPrefix:p,tableFilter:f,userIdFilter:n}=c,l=B(),v;e[0]!==l?(v=l("Function path"),e[0]=l,e[1]=v):v=e[1];let a;e[2]!==l?(a=l("file:function"),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==s||e[5]!==p||e[6]!==v||e[7]!==a?(d=(0,r.jsx)(D,{"aria-label":v,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:a,value:p}),e[4]=s,e[5]=p,e[6]=v,e[7]=a,e[8]=d):d=e[8];let u;e[9]!==l?(u=l("User id"),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("userId"),e[11]=l,e[12]=h):h=e[12];let b;e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==n?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:h,value:n}),e[13]=o,e[14]=u,e[15]=h,e[16]=n,e[17]=b):b=e[17];let g;e[18]!==l?(g=l("Table touched"),e[18]=l,e[19]=g):g=e[19];let x;e[20]!==l?(x=l("table"),e[20]=l,e[21]=x):x=e[21];let y;e[22]!==i||e[23]!==g||e[24]!==x||e[25]!==f?(y=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-table",onChange:i,placeholder:x,value:f}),e[22]=i,e[23]=g,e[24]=x,e[25]=f,e[26]=y):y=e[26];let S;e[27]!==l?(S=l("Outcome filter"),e[27]=l,e[28]=S):S=e[28];let R;e[29]!==l?(R=l("all"),e[29]=l,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=L):L=e[32];let k;e[33]!==l?(k=l("ok"),e[33]=l,e[34]=k):k=e[34];let I;e[35]!==k?(I=(0,r.jsx)("option",{value:"ok",children:k}),e[35]=k,e[36]=I):I=e[36];let w;e[37]!==l?(w=l("error"),e[37]=l,e[38]=w):w=e[38];let C;e[39]!==w?(C=(0,r.jsx)("option",{value:"error",children:w}),e[39]=w,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==m||e[43]!==S||e[44]!==L||e[45]!==I||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:m,children:[L,I,C]}),e[41]=t,e[42]=m,e[43]=S,e[44]=L,e[45]=I,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==d||e[50]!==b||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d,b,y,q]}),e[48]=q,e[49]=d,e[50]=b,e[51]=y,e[52]=F):F=e[52],F},"Be"),Ie=N(c=>{let e=(0,_.c)(7),{bucket:t}=c,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let i;e[2]!==t.count?(i=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==i?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,i]}),e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"ve"),Be=N(c=>{let e=(0,_.c)(31),{summary:t}=c,s=B(),i;e[0]!==t.total||e[1]!==s?(i=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==i?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:i}),e[3]=i,e[4]=o):o=e[4];let m;e[5]!==s?(m=s("By level"),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==m?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[7]=m,e[8]=p):p=e[8];let f;e[9]!==t.byLevel?(f=t.byLevel.map(We),e[9]=t.byLevel,e[10]=f):f=e[10];let n;e[11]!==f?(n=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:f}),e[11]=f,e[12]=n):n=e[12];let l;e[13]!==p||e[14]!==n?(l=(0,r.jsxs)("div",{children:[p,n]}),e[13]=p,e[14]=n,e[15]=l):l=e[15];let v;e[16]!==s?(v=s("By function"),e[16]=s,e[17]=v):v=e[17];let a;e[18]!==v?(a=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[18]=v,e[19]=a):a=e[19];let d;e[20]!==t.byPath?(d=t.byPath.map(Ge),e[20]=t.byPath,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:d}),e[22]=d,e[23]=u):u=e[23];let h;e[24]!==u||e[25]!==a?(h=(0,r.jsxs)("div",{children:[a,u]}),e[24]=u,e[25]=a,e[26]=h):h=e[26];let b;return e[27]!==h||e[28]!==o||e[29]!==l?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,l,h]}),e[27]=h,e[28]=o,e[29]=l,e[30]=b):b=e[30],b},"ze");function We(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(We,"Ge");function Ge(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(Ge,"We");var Ve=N(c=>{let e=(0,_.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:i,onShowErrors:o,onShowRequests:m,shardKey:p,view:f}=c,n=B(),l=f==="requests",v=f==="requests"?"bg-muted font-medium":"text-muted-foreground",a;e[0]!==v?(a=G("px-3 py-1 text-sm",v),e[0]=v,e[1]=a):a=e[1];let d;e[2]!==n?(d=n("Requests"),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==m||e[5]!==l||e[6]!==a||e[7]!==d?(u=(0,r.jsx)("button",{"aria-selected":l,className:a,"data-testid":"lg-view-requests",onClick:m,role:"tab",type:"button",children:d}),e[4]=m,e[5]=l,e[6]=a,e[7]=d,e[8]=u):u=e[8];let h=f==="errors",b=f==="errors"?"bg-muted font-medium":"text-muted-foreground",g;e[9]!==b?(g=G("px-3 py-1 text-sm",b),e[9]=b,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Errors"),e[11]=n,e[12]=x):x=e[12];let y;e[13]!==o||e[14]!==h||e[15]!==g||e[16]!==x?(y=(0,r.jsx)("button",{"aria-selected":h,className:g,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:x}),e[13]=o,e[14]=h,e[15]=g,e[16]=x,e[17]=y):y=e[17];let S=f==="archive",R=f==="archive"?"bg-muted font-medium":"text-muted-foreground",L;e[18]!==R?(L=G("px-3 py-1 text-sm",R),e[18]=R,e[19]=L):L=e[19];let k;e[20]!==n?(k=n("Archive"),e[20]=n,e[21]=k):k=e[21];let I;e[22]!==i||e[23]!==S||e[24]!==L||e[25]!==k?(I=(0,r.jsx)("button",{"aria-selected":S,className:L,"data-testid":"lg-view-archive",onClick:i,role:"tab",type:"button",children:k}),e[22]=i,e[23]=S,e[24]=L,e[25]=k,e[26]=I):I=e[26];let w;e[27]!==y||e[28]!==I||e[29]!==u?(w=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,y,I]}),e[27]=y,e[28]=I,e[29]=u,e[30]=w):w=e[30];let C;e[31]!==s||e[32]!==p?(C=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==f?(q=f!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=f,e[36]=q):q=e[36];let F;e[37]!==n?(F=n("Open in Cloudflare"),e[37]=n,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let K;return e[41]!==w||e[42]!==C||e[43]!==q||e[44]!==E?(K=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[w,C,q,E]}),e[41]=w,e[42]=C,e[43]=q,e[44]=E,e[45]=K):K=e[45],K},"Qe"),ce=400,Qe=36,Ye={height:ce,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},He={error:"destructive",ok:"secondary"},Je=N(c=>{let e=(0,_.c)(26),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.fields?(n=X(t.fields),e[2]=t.fields,e[3]=n):n=e[3];let l=n,v;e[4]!==t.timestamp?(v=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=v):v=e[5];let a;e[6]!==v?(a=(0,r.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:v}),e[6]=v,e[7]=a):a=e[7];let d=Re[t.level],u;e[8]!==t.level||e[9]!==d?(u=(0,r.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:d,children:t.level})}),e[8]=t.level,e[9]=d,e[10]=u):u=e[10];let h=t.functionPath??"\u2014",b;e[11]!==h?(b=(0,r.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=b):b=e[12];let g;e[13]!==l?(g=l===""?null:(0,r.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:l}),e[13]=l,e[14]=g):g=e[14];let x;e[15]!==t.message||e[16]!==g?(x=(0,r.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]}),e[15]=t.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==i||e[20]!==f||e[21]!==x||e[22]!==a||e[23]!==u||e[24]!==b?(y=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:i,role:"row",style:f,children:[a,u,b,x]}),e[18]=s,e[19]=i,e[20]=f,e[21]=x,e[22]=a,e[23]=u,e[24]=b,e[25]=y):y=e[25],y},"Xe"),ke=N(c=>c.length===0?"\u2014":c.join(", "),"ce"),Ze=N(c=>{let e=(0,_.c)(37),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.ts?(n=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=n):n=e[3];let l;e[4]!==n?(l=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:n}),e[4]=n,e[5]=l):l=e[5];let v=He[t.outcome],a;e[6]!==t.outcome||e[7]!==v?(a=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:v,children:t.outcome})}),e[6]=t.outcome,e[7]=v,e[8]=a):a=e[8];let d;e[9]!==t.functionPath?(d=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=d):d=e[10];let u=t.shardKey??"\u2014",h;e[11]!==u?(h=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[11]=u,e[12]=h):h=e[12];let b=t.userId??"\u2014",g;e[13]!==b?(g=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[13]=b,e[14]=g):g=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let y=`${String(x)}ms`,S;e[17]!==y?(S=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=S):S=e[18];let R;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(R=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ke(t.tablesRead)} \xB7 w:${ke(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=R):R=e[23];let L;e[24]!==R?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=L):L=e[25];let k;return e[26]!==s||e[27]!==i||e[28]!==f||e[29]!==g||e[30]!==S||e[31]!==L||e[32]!==l||e[33]!==a||e[34]!==d||e[35]!==h?(k=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:i,role:"row",style:f,children:[l,a,d,h,g,S,L]}),e[26]=s,e[27]=i,e[28]=f,e[29]=g,e[30]=S,e[31]=L,e[32]=l,e[33]=a,e[34]=d,e[35]=h,e[36]=k):k=e[36],k},"Ze"),Pe=N(c=>{let{entries:e}=c??{};return Array.isArray(e)?e:[]},"ue"),Xe=N(c=>{let e={};return c.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=c.functionPathPrefix.trim()),c.userId.trim()!==""&&(e.userId=c.userId.trim()),c.tableTouched.trim()!==""&&(e.tableTouched=c.tableTouched.trim()),(c.outcome==="ok"||c.outcome==="error")&&(e.outcome=c.outcome),e},"et"),et={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},tt=N((c,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-et[e.range];return c.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||X(o.fields).toLowerCase().includes(t))},"rt"),rt="\u2014",lt=N(c=>{let e=new Map,t=new Map;for(let o of c){e.set(o.level,(e.get(o.level)??0)+1);let m=o.functionPath??rt;t.set(m,(t.get(m)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,m])=>({count:m,key:o})).toSorted((o,m)=>m.count===o.count?o.key.localeCompare(m.key):m.count-o.count);return{byLevel:s,byPath:i,total:c.length}},"at"),Lt=N(({initialShardKey:c})=>{let e=B(),[t,s]=(0,T.useState)("requests"),{queryShardKey:i,setShardKey:o,shardKey:m}=be(c),[p,f]=(0,T.useState)(""),[n,l]=(0,T.useState)(()=>new Set),[v,a]=(0,T.useState)(""),[d,u]=(0,T.useState)("all"),[h,b]=(0,T.useState)(!1),[g,x]=(0,T.useState)(""),[y,S]=(0,T.useState)(""),[R,L]=(0,T.useState)(""),[k,I]=(0,T.useState)("all"),w=Xe({functionPathPrefix:g,outcome:k,tableTouched:R,userId:y}),C=oe(se.getRequestLog,w,{enabled:t==="requests",live:!0,shardKey:i}),q=oe(se.getLogs,{},{enabled:t==="errors",live:!0,shardKey:i}),F=t==="requests"?C:q,{error:E,errorSource:K,isLoading:$,liveError:V}=F,O=Pe(q.data),A=Pe(C.data);(0,T.useEffect)(()=>{F.data!==void 0&&pe(i)},[F.data,i]);let M=tt(O,{levels:n,now:Date.now(),path:v,range:d,search:p}),W=lt(M),j=t==="requests"?A.length:M.length,ee=t==="errors"&&h,Q=(0,T.useMemo)(()=>E!==null?"error":j===0?$?ee?"summary":"list":"empty":ee?"summary":"list",[j,$,E,ee]),me=(0,T.useRef)(null),Y=Se({count:j,estimateSize:N(()=>Qe,"estimateSize"),getScrollElement:N(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:N((P,te)=>Le(P,te,ce),"observeElementRect"),overscan:8}),qe=Y.getVirtualItems(),Fe={height:Y.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ve,{liveError:V,onShardKeyChange:o,onShowArchive:N(()=>{s("archive"),b(!1)},"onShowArchive"),onShowErrors:N(()=>{s("errors"),b(!1)},"onShowErrors"),onShowRequests:N(()=>{s("requests"),b(!1)},"onShowRequests"),shardKey:m,view:t}),t==="errors"&&(0,r.jsx)(ze,{levelFilter:n,onLogPathChange:N(P=>{a(P.target.value)},"onLogPathChange"),onSearchChange:N(P=>{f(P.target.value)},"onSearchChange"),onTimeRangeChange:N(P=>{u(P.target.value)},"onTimeRangeChange"),onToggleLevel:N(P=>{l(te=>{let H=new Set(te);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:N(()=>{b(P=>!P)},"onToggleSummary"),pathFilter:v,search:p,showSummary:h,timeRange:d}),t==="requests"&&(0,r.jsx)(je,{onOutcomeChange:N(P=>{I(P.target.value)},"onOutcomeChange"),onPathChange:N(P=>{x(P.target.value)},"onPathChange"),onTableChange:N(P=>{L(P.target.value)},"onTableChange"),onUserChange:N(P=>{S(P.target.value)},"onUserChange"),outcomeFilter:k,pathPrefix:g,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(De,{shardKey:i}):(0,r.jsxs)(r.Fragment,{children:[Q==="error"&&(0,r.jsx)(xe,{error:K,testId:"lg-error"}),Q==="empty"&&(0,r.jsx)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Q==="summary"&&(0,r.jsx)(Be,{summary:W}),Q==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:Ye,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Fe,children:qe.map(P=>t==="requests"?(0,r.jsx)(Ze,{entry:A[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key):(0,r.jsx)(Je,{entry:M[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key))})})]})]})},"Pt");export{Lt as LogsPanel,tt as filterLogs,lt as summarizeLogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as Q}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as W}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{f as F}from"./chunk-
|
|
1
|
+
import{R as Q}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as W}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{f as F}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as q,b as L,c as B,d as f,e as c,f as d}from"./chunk-WJQLNYGX.js";import{a as I,e as j}from"./chunk-WQH3LT2P.js";import{d as K,h as S,m as $,o as V}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as h,e as C,f as R,g as P,h as U}from"./chunk-3XIESWL4.js";var A=C(P(),1);var n=C(R(),1);var e=C(U(),1);var X=10,b=h(v=>{let l=(0,A.c)(7),{label:m,value:a}=v,r;l[0]!==m?(r=(0,e.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m}),l[0]=m,l[1]=r):r=l[1];let p=a??"\u2014",s;l[2]!==p?(s=(0,e.jsx)("span",{className:"font-mono text-sm",children:p}),l[2]=p,l[3]=s):s=l[3];let u;return l[4]!==r||l[5]!==s?(u=(0,e.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,s]}),l[4]=r,l[5]=s,l[6]=u):u=l[6],u},"g"),se=h(({loadIndexes:v,runQuery:l}={})=>{let m=F(),a=K(),[r,p]=(0,n.useState)(null),[s,u]=(0,n.useState)(null),[N,E]=(0,n.useState)(null),[g,D]=(0,n.useState)(""),[x,y]=(0,n.useState)(null),[M,w]=(0,n.useState)(null),[T,z]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let t={cancelled:!1};return V((async()=>{try{let i=await(v??(()=>m.listVectorIndexes()))();t.cancelled||(p(i),u(null),E(k=>k??i[0]?.name??null))}catch(i){t.cancelled||(p(null),u(S(i)))}})()),()=>{t.cancelled=!0}},[m,v]);let o=r?.find(t=>t.name===N)??null,G=h(t=>{E(t.currentTarget.dataset.index??null),y(null),w(null)},"K"),H=h(t=>{D(t.target.value)},"T"),J=h(async()=>{let t=g.trim();if(!(N===null||t==="")){z(!0),w(null);try{let i=await(l??(k=>m.queryVectorIndex(k)))({name:N,text:t,topK:X});y(i)}catch(i){y(null),w(S(i))}z(!1)}},"Z"),O=h(()=>{V(J())},"z");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[s!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:s}),r!==null&&r.length===0&&(0,e.jsx)(Z,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:a("No vector indexes.")}),r!==null&&r.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-table",children:[(0,e.jsx)(L,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("name")}),(0,e.jsx)(c,{children:a("table")}),(0,e.jsx)(c,{children:a("dimensions")}),(0,e.jsx)(c,{children:a("metric")}),(0,e.jsx)(c,{children:a("vectors")})]})}),(0,e.jsx)(B,{children:r.map(t=>(0,e.jsxs)(f,{className:t.name===N?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:G,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.table}),(0,e.jsx)(d,{className:"tabular-nums",children:t.dimensions??"\u2014"}),(0,e.jsx)(d,{children:t.metric??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:t.vectorsCount??"\u2014"})]},t.name))})]})})}),o!==null&&(0,e.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsx)(b,{label:a("field"),value:o.field}),(0,e.jsx)(b,{label:a("dimensions"),value:o.dimensions}),(0,e.jsx)(b,{label:a("metric"),value:o.metric}),(0,e.jsx)(b,{label:a("vectors"),value:o.vectorsCount})]}),o.metadata!==void 0&&o.metadata.length>0&&(0,e.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsx)("span",{className:"font-mono",children:o.metadata.join(", ")})]}),(0,e.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsx)(Q,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:H,placeholder:a("Search by similarity\u2026"),value:g}),(0,e.jsx)(W,{"data-testid":"vector-search",disabled:T||g.trim()==="",onClick:O,children:a(T?"Searching\u2026":"Search")})]}),M!==null&&(0,e.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M}),x!==null&&x.length===0&&(0,e.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")}),x!==null&&x.length>0&&(0,e.jsx)(I,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsx)(j,{className:"px-0",children:(0,e.jsxs)(q,{"data-testid":"vector-matches",children:[(0,e.jsx)(L,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(c,{children:a("id")}),(0,e.jsx)(c,{children:a("score")}),(0,e.jsx)(c,{children:a("metadata")})]})}),(0,e.jsx)(B,{children:x.map(t=>(0,e.jsxs)(f,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.id}),(0,e.jsx)(d,{className:"tabular-nums",children:t.score.toFixed(4)}),(0,e.jsx)(d,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":$(t.metadata)})]},t.id))})]})})})]})]})},"ce");export{se as VectorBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N}from"./chunk-
|
|
1
|
+
import{a as N}from"./chunk-TMGHRD6W.js";import{a as z}from"./chunk-54MMVNPT.js";import{a as q}from"./chunk-3CWGJYBB.js";import{a as W}from"./chunk-RMN2JN4S.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as R}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as B}from"./chunk-3WISGFZ7.js";import"./chunk-XXQUMVWH.js";import"./chunk-DGO2XJOT.js";import"./chunk-QLQADHFE.js";import{a as U}from"./chunk-VDW32UET.js";import{c as L}from"./chunk-LZGOETI3.js";import"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-XQCVZAGU.js";import{a as E,b as H,c as O,d as K,e as T,f as D}from"./chunk-WJQLNYGX.js";import{a as _}from"./chunk-WQH3LT2P.js";import{d as j}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as M,e as F,g as V,h as X}from"./chunk-3XIESWL4.js";var P=F(V(),1);var t=F(X(),1);var G=M(n=>`${n.toString()} ms`,"D"),Q=M(n=>n.totalConnections===0&&n.shapePoke.passes===0&&n.whisper.passes===0,"z"),J=M(n=>{let e=(0,P.c)(48),{counters:r,includeTiming:s,prefix:l,t:o,title:b}=n,k=`${l}-section`,p;e[0]!==b?(p=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:b}),e[0]=b,e[1]=p):p=e[1];let a=`${l}-stats`,i;e[2]!==o?(i=o("Passes"),e[2]=o,e[3]=i):i=e[3];let I=`${l}-passes`,v;e[4]!==r.passes||e[5]!==i||e[6]!==I?(v=(0,t.jsx)(N,{label:i,testId:I,value:r.passes}),e[4]=r.passes,e[5]=i,e[6]=I,e[7]=v):v=e[7];let h;e[8]!==o?(h=o("Sockets iterated"),e[8]=o,e[9]=h):h=e[9];let x=`${l}-iterated`,c;e[10]!==r.socketsIterated||e[11]!==h||e[12]!==x?(c=(0,t.jsx)(N,{label:h,testId:x,value:r.socketsIterated}),e[10]=r.socketsIterated,e[11]=h,e[12]=x,e[13]=c):c=e[13];let d;e[14]!==o?(d=o("Delivered"),e[14]=o,e[15]=d):d=e[15];let y=`${l}-delivered`,m;e[16]!==r.socketsDelivered||e[17]!==d||e[18]!==y?(m=(0,t.jsx)(N,{label:d,testId:y,value:r.socketsDelivered}),e[16]=r.socketsDelivered,e[17]=d,e[18]=y,e[19]=m):m=e[19];let u;e[20]!==o?(u=o("Peak width"),e[20]=o,e[21]=u):u=e[21];let g=`${l}-peak`,f;e[22]!==r.peakSocketsIterated||e[23]!==u||e[24]!==g?(f=(0,t.jsx)(N,{label:u,testId:g,value:r.peakSocketsIterated}),e[22]=r.peakSocketsIterated,e[23]=u,e[24]=g,e[25]=f):f=e[25];let S;e[26]!==r.totalMs||e[27]!==s||e[28]!==l||e[29]!==o?(S=s&&(0,t.jsx)(N,{label:o("Total time"),testId:`${l}-total-ms`,value:G(r.totalMs)}),e[26]=r.totalMs,e[27]=s,e[28]=l,e[29]=o,e[30]=S):S=e[30];let C;e[31]!==r.maxMs||e[32]!==s||e[33]!==l||e[34]!==o?(C=s&&(0,t.jsx)(N,{label:o("Max time"),testId:`${l}-max-ms`,value:G(r.maxMs)}),e[31]=r.maxMs,e[32]=s,e[33]=l,e[34]=o,e[35]=C):C=e[35];let $;e[36]!==m||e[37]!==f||e[38]!==S||e[39]!==C||e[40]!==a||e[41]!==v||e[42]!==c?($=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":a,children:[v,c,m,f,S,C]}),e[36]=m,e[37]=f,e[38]=S,e[39]=C,e[40]=a,e[41]=v,e[42]=c,e[43]=$):$=e[43];let w;return e[44]!==k||e[45]!==$||e[46]!==p?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":k,children:[p,$]}),e[44]=k,e[45]=$,e[46]=p,e[47]=w):w=e[47],w},"F"),me=M(n=>{let e=(0,P.c)(31),{initialShardKey:r}=n,s=j(),{queryShardKey:l,setShardKey:o,shardKey:b}=q(r),k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={},e[0]=k):k=e[0];let p;e[1]!==l?(p={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=p):p=e[2];let{data:a,error:i,errorSource:I,refetch:v}=L(U.getFanoutMetrics,k,p);z(v,!0);let h;e[3]!==a?(h=a!==void 0&&Q(a),e[3]=a,e[4]=h):h=e[4];let x=h,c;e[5]!==o||e[6]!==b?(c=(0,t.jsx)(W,{onChange:o,testId:"fanout-shard-input",value:b}),e[5]=o,e[6]=b,e[7]=c):c=e[7];let d;e[8]!==a||e[9]!==s?(d=a!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[a.promoted&&(0,t.jsx)(R,{"data-testid":"fanout-promoted",variant:a.relayCount>=a.maxRelays?"destructive":"default",children:a.relayCount>=a.maxRelays?s("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:a.maxRelays,relayCount:a.relayCount}):s("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:a.maxRelays,relayCount:a.relayCount})}),(0,t.jsx)(R,{variant:"secondary",children:s("{count} connections",{count:a.totalConnections})}),(0,t.jsx)(R,{variant:"secondary",children:s("peak {count} subscribers",{count:a.peakSubscribers})})]}),e[8]=a,e[9]=s,e[10]=d):d=e[10];let y;e[11]!==c||e[12]!==d?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[11]=c,e[12]=d,e[13]=y):y=e[13];let m;e[14]!==i||e[15]!==I?(m=i!==null&&(0,t.jsx)(B,{error:I,testId:"fanout-error"}),e[14]=i,e[15]=I,e[16]=m):m=e[16];let u;e[17]!==i||e[18]!==x||e[19]!==s?(u=i===null&&x&&(0,t.jsx)(A,{description:s("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:s("No fan-out activity yet.")}),e[17]=i,e[18]=x,e[19]=s,e[20]=u):u=e[20];let g;e[21]!==i||e[22]!==x||e[23]!==a||e[24]!==s?(g=i===null&&a!==void 0&&!x&&(0,t.jsxs)(t.Fragment,{children:[a.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:s("Hot topics")}),(0,t.jsx)(_,{className:"overflow-hidden py-0",children:(0,t.jsxs)(E,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(K,{children:[(0,t.jsx)(T,{children:s("Topic")}),(0,t.jsx)(T,{children:s("Kind")}),(0,t.jsx)(T,{className:"text-right",children:s("Subscribers")})]})}),(0,t.jsx)(O,{children:a.topics.map(Y)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:s("Fan-out cost since this instance woke")}),(0,t.jsx)(J,{counters:a.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:s,title:s("Shape pokes")}),(0,t.jsx)(J,{counters:a.whisper,includeTiming:!1,prefix:"fanout-whisper",t:s,title:s("Whisper broadcasts")})]})]}),e[21]=i,e[22]=x,e[23]=a,e[24]=s,e[25]=g):g=e[25];let f;return e[26]!==y||e[27]!==m||e[28]!==u||e[29]!==g?(f=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,m,u,g]}),e[26]=y,e[27]=m,e[28]=u,e[29]=g,e[30]=f):f=e[30],f},"me");function Y(n){return(0,t.jsxs)(K,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(D,{className:"font-mono text-xs",children:n.topic}),(0,t.jsx)(D,{children:(0,t.jsx)(R,{variant:"outline",children:n.kind})}),(0,t.jsx)(D,{className:"text-right font-medium tabular-nums",children:n.subscribers})]},`${n.kind}:${n.topic}`)}M(Y,"G");export{me as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as g,n as b}from"./chunk-
|
|
1
|
+
import{m as g,n as b}from"./chunk-U7ILDM43.js";import{a as c,e as p,g as y,h as M,j as d}from"./chunk-3XIESWL4.js";var w=c(e=>{let t=0,s=0,r=0,a=0,i=0,l=0,o=0;for(let{metrics:n}of e){if(n===null){i+=1;continue}a+=1,t+=n.requests,s+=n.errors,r+=n.databaseSize??0,n.cache!==null&&(l+=n.cache.hits,o+=n.cache.hits+n.cache.misses)}return{failed:i,hitRate:o===0?null:l/o,reachable:a,totalDatabaseSize:r,totalErrors:s,totalRequests:t}},"u"),C=c((e,t)=>{let s=new Set,r=[];for(let a of["",e.trim(),...t])s.has(a)||(s.add(a),r.push(a));return r},"h"),v=c((e,t)=>{if(e.length===0)return 0;if(e.sort((r,a)=>r-a),t<=0)return e[0]??0;if(t>=100)return e.at(-1)??0;let s=Math.ceil(t/100*e.length)-1;return e[s]??0},"i"),N=c(e=>{let t=e.functions;if(!t||t.length===0)return{p90:0,p95:0};let s=1e3,r=[];for(let a of t){if(a.calls<=0)continue;let i=a.totalDurationMs/a.calls,l=Math.min(a.calls,s);for(let o=0;o<l;o+=1)r.push(i)}return r.length===0?{p90:0,p95:0}:{p90:v([...r],90),p95:v([...r],95)}},"f");var q=c(e=>e.map(t=>({...t,avgDurationMs:t.execCount>0?t.totalDurationMs/t.execCount:0})),"g");var x=p(y(),1);var m=p(M(),1);var S={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},T=c(e=>{let t=(0,x.c)(12),{ariaLabel:s,className:r,series:a,testId:i}=e;if(a.length<2)return null;let l;t[0]!==a?(l=a.slice(-40).map(D),t[0]=a,t[1]=l):l=t[1];let o=l,n;t[2]!==r?(n=d("h-6 w-[120px]",r),t[2]=r,t[3]=n):n=t[3];let f;t[4]===Symbol.for("react.memo_cache_sentinel")?(f=(0,m.jsx)(b,{dataKey:"value"}),t[4]=f):f=t[4];let u;t[5]!==o?(u=(0,m.jsx)(g,{animationType:"none",barCategoryGap:1,className:"h-full w-full",config:S,data:o,children:f}),t[5]=o,t[6]=u):u=t[6];let h;return t[7]!==s||t[8]!==n||t[9]!==u||t[10]!==i?(h=(0,m.jsx)("div",{"aria-label":s,className:n,"data-testid":i,role:"img",children:u}),t[7]=s,t[8]=n,t[9]=u,t[10]=i,t[11]=h):h=t[11],h},"S");function D(e,t){return{index:t,value:e}}c(D,"b");export{w as a,C as b,N as c,q as d,T as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as re}from"./chunk-IGCNMZSB.js";import{a as X}from"./chunk-3CWGJYBB.js";import{a as V}from"./chunk-RMN2JN4S.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as
|
|
1
|
+
import{a as re}from"./chunk-IGCNMZSB.js";import{a as X}from"./chunk-3CWGJYBB.js";import{a as V}from"./chunk-RMN2JN4S.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as O}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as B}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as Y}from"./chunk-3WISGFZ7.js";import"./chunk-XXQUMVWH.js";import"./chunk-DGO2XJOT.js";import"./chunk-QLQADHFE.js";import{a as Q}from"./chunk-VDW32UET.js";import{c as J}from"./chunk-LZGOETI3.js";import"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as G}from"./chunk-XQCVZAGU.js";import{a as Z,b as ee,c as te,d as U,e as n,f as o}from"./chunk-WJQLNYGX.js";import{a as R,e as W}from"./chunk-WQH3LT2P.js";import{d as z,r as H}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a,e as T,f as de,g as me,h as he,j as P}from"./chunk-3XIESWL4.js";var le=T(me(),1),ae=T(de(),1);var t=T(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},se=a(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"z"),fe=a(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=a(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:a((r,e)=>e.calls-r.calls,"calls"),recent:a((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:a((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},_e=a(r=>{let e=(0,le.c)(47),{functions:A,initialShardKey:ne}=r,l=z(),{queryShardKey:E,setShardKey:y,shardKey:v}=X(ne),[i,oe]=(0,ae.useState)("recent"),w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w={},e[0]=w):w=e[0];let $;e[1]!==E?($={live:!0,shardKey:E},e[1]=E,e[2]=$):$=e[2];let{data:ie,error:c,errorSource:S,liveError:b}=J(Q.getFunctionStats,w,$),k=ie?.functions??null,C;e[3]!==A?(C=new Map((A??[]).map(ge)),e[3]=A,e[4]=C):C=e[4];let j=C,F;e[5]===Symbol.for("react.memo_cache_sentinel")?(F=a(M=>{oe(M.currentTarget.dataset.sort)},"F"),e[5]=F):F=e[5];let ce=F,D;if(e[6]!==c||e[7]!==S||e[8]!==j||e[9]!==b||e[10]!==y||e[11]!==v||e[12]!==i||e[13]!==k||e[14]!==l){let M=k===null?[]:k.toSorted(xe[i]),d;e[16]!==l?(d=l("Recent"),e[16]=l,e[17]=d):d=e[17];let m;e[18]!==d?(m={key:"recent",label:d},e[18]=d,e[19]=m):m=e[19];let h;e[20]!==l?(h=l("Most called"),e[20]=l,e[21]=h):h=e[21];let u;e[22]!==h?(u={key:"calls",label:h},e[22]=h,e[23]=u):u=e[23];let f;e[24]!==l?(f=l("Slowest"),e[24]=l,e[25]=f):f=e[25];let p;e[26]!==f?(p={key:"slowest",label:f},e[26]=f,e[27]=p):p=e[27];let I;e[28]!==p||e[29]!==m||e[30]!==u?(I=[m,u,p],e[28]=p,e[29]=m,e[30]=u,e[31]=I):I=e[31];let q=I,x;e[32]!==y||e[33]!==v?(x=(0,t.jsx)(V,{onChange:y,testId:"fs-shard-input",value:v}),e[32]=y,e[33]=v,e[34]=x):x=e[34];let g;e[35]!==b?(g=(0,t.jsx)(re,{message:b,prefix:"fs"}),e[35]=b,e[36]=g):g=e[36];let N;e[37]!==q||e[38]!==i?(N=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:q.map(s=>(0,t.jsx)(O,{"data-sort":s.key,"data-testid":`fs-sort-${s.key}`,onClick:ce,size:"sm",type:"button",variant:i===s.key?"secondary":"ghost",children:s.label},s.key))}),e[37]=q,e[38]=i,e[39]=N):N=e[39];let K;e[40]!==x||e[41]!==g||e[42]!==N?(K=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[x,g,N]}),e[40]=x,e[41]=g,e[42]=N,e[43]=K):K=e[43];let _;e[44]!==c||e[45]!==S?(_=c!==null&&(0,t.jsx)(Y,{error:S,testId:"fs-error"}),e[44]=c,e[45]=S,e[46]=_):_=e[46],D=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[K,_,k!==null&&M.length===0&&c===null&&(0,t.jsx)(G,{description:l("Per-function call counts, error rates, and latency land here after your first request."),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)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:l("No functions have run on this shard yet.")}),M.length>0&&(0,t.jsx)(R,{className:"overflow-hidden py-0",children:(0,t.jsx)(W,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(U,{children:[(0,t.jsx)(n,{children:l("function")}),(0,t.jsx)(n,{children:l("kind")}),(0,t.jsx)(n,{className:"text-right",children:l("calls")}),(0,t.jsx)(n,{className:"text-right",children:l("errors")}),(0,t.jsx)(n,{className:"text-right",children:l("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:l("avg")}),(0,t.jsx)(n,{className:"text-right",children:l("max")}),(0,t.jsx)(n,{children:l("last run")}),(0,t.jsx)(n,{children:l("last error")})]})}),(0,t.jsx)(te,{children:M.map(s=>{let L=j.get(s.path);return(0,t.jsxs)(U,{"data-testid":`fs-row-${s.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:s.path}),(0,t.jsx)(o,{children:L===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(B,{variant:ue[L],children:L})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:s.calls}),(0,t.jsx)(o,{className:P("text-right tabular-nums",s.errors>0&&"text-destructive"),children:fe(s)}),(0,t.jsx)(o,{className:P("text-right tabular-nums",(s.conflicts??0)>0&&"text-warning"),children:pe(s)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:s.calls===0?"\u2014":se(s.totalDurationMs/s.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:s.calls===0?"\u2014":se(s.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:H(s.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:s.lastErrorMessage??void 0,children:s.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},s.path)})})]})})})]}),e[6]=c,e[7]=S,e[8]=j,e[9]=b,e[10]=y,e[11]=v,e[12]=i,e[13]=k,e[14]=l,e[15]=D}else D=e[15];return D},"De");function ge(r){return[r.path,r.kind]}a(ge,"ue");export{_e as FunctionStatsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as me,e as _}from"./chunk-4LCY5XUR.js";import{a as ue}from"./chunk-IGCNMZSB.js";import"./chunk-S3DWUXGY.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import{a as de}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{b as T}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-QLQADHFE.js";import{a as M}from"./chunk-VDW32UET.js";import{c as ce}from"./chunk-ZNAGZU6H.js";import{f as ne,g as oe}from"./chunk-5KCULF7S.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-UZERI5YC.js";import{d as D,f as j,g as W,h as X,o as K,r as ie}from"./chunk-IUYFXK4X.js";import"./chunk-XNGYYOLS.js";import{a as p,e as I,f as Ee,g as ae,h as le,j as E}from"./chunk-3XIESWL4.js";var Z=I(ae(),1);var f=I(Ee(),1);var fe=I(ae(),1);var $=I(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},he=p(()=>{let t=(0,fe.c)(16),e=D(),a=oe(),s;e:switch(a){case"connected":{let o;t[0]!==e?(o=e("Connected"),t[0]=e,t[1]=o):o=t[1],s=o;break e}case"connecting":{let o;t[2]!==e?(o=e("Connecting\u2026"),t[2]=e,t[3]=o):o=t[3],s=o;break e}case"idle":{let o;t[4]!==e?(o=e("Idle"),t[4]=e,t[5]=o):o=t[5],s=o;break e}case"offline":{let o;t[6]!==e?(o=e("Offline"),t[6]=e,t[7]=o):o=t[7],s=o;break e}default:s=a}let l=Me[a],c;t[8]!==l?(c=E("size-2 rounded-full",l),t[8]=l,t[9]=c):c=t[9];let i;t[10]!==c?(i=(0,$.jsx)("span",{"aria-hidden":"true",className:c}),t[10]=c,t[11]=i):i=t[11];let n;return t[12]!==a||t[13]!==i||t[14]!==s?(n=(0,$.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[i,s]}),t[12]=a,t[13]=i,t[14]=s,t[15]=n):n=t[15],n},"j");var r=I(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=p((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"_"),Y=p((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","V"),xe=.01,ve=.05,je=p(t=>{let e=(0,Z.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=D(),n;e[0]!==i?(n=i("Functions by error rate"),e[0]=i,e[1]=n):n=e[1];let o;e[2]!==n?(o=(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:n})}),e[2]=n,e[3]=o):o=e[3];let h;e[4]!==i||e[5]!==c?(h=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(y=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:y.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:y.calls.toString()})}),(0,r.jsx)(T,{variant:Ae[Y(y.errors/y.calls,xe,ve)],children:U(y.errors,y.calls)})]})]},y.path))}),e[4]=i,e[5]=c,e[6]=h):h=e[6];let g;e[7]!==o||e[8]!==h?(g=(0,r.jsxs)(A,{className:"gap-0 py-0","data-testid":"hl-functions",children:[o,h]}),e[7]=o,e[8]=h,e[9]=g):g=e[9];let b;e[10]!==i?(b=i("Recent errors"),e[10]=i,e[11]=b):b=e[11];let d;e[12]!==b?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[12]=b,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",x;e[14]!==a||e[15]!==u?(x=(0,r.jsx)(T,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=x):x=e[16];let v;e[17]!==d||e[18]!==x?(v=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,x]}),e[17]=d,e[18]=x,e[19]=v):v=e[19];let k;e[20]!==s?(k=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=k):k=e[21];let S;e[22]!==s||e[23]!==i||e[24]!==l.length?(S=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=S):S=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==k||e[29]!==S||e[30]!==q||e[31]!==v?(N=(0,r.jsxs)(A,{className:"gap-0 py-0",children:[v,k,S,q]}),e[28]=k,e[29]=S,e[30]=q,e[31]=v,e[32]=N):N=e[32];let w;return e[33]!==N||e[34]!==g?(w=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[g,N]}),e[33]=N,e[34]=g,e[35]=w):w=e[35],w},"Se");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}p(Ce,"qe");var pe={completed:0,failed:2,in_progress:1},Ie=p(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:n}of t){if(n===null){l+=1;continue}s+=1,e+=n.requests,a+=n.errors,i.push(...n.history??[]),c||=n.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ee"),De=p(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"Me"),Te=p(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let c=pe[s.status]-pe[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"$e"),Pe=j(M.getAuthMetrics),Fe=j(M.getFunctionStats),Le=j(M.getLogs),Re=j(M.getMetrics),ze=j(M.migrationStatus),Oe=5,ge=2e3,Ke=5,_e=.1,$e=.3,He=1,Ue=50,Ge=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","_e"),Qe=p(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"ze"),Je=p(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"Ke"),Ve=p((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"He"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},We={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Xe=p(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Be"),H=p(t=>{let e=(0,Z.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,n=be[l],o;e[0]!==n?(o=E("size-1.5 shrink-0 rounded-full",n),e[0]=n,e[1]=o):o=e[1];let h;e[2]!==o?(h=(0,r.jsx)("span",{"aria-hidden":"true",className:o}),e[2]=o,e[3]=h):h=e[3];let g;e[4]!==s||e[5]!==h?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[h,s]}),e[4]=s,e[5]=h,e[6]=g):g=e[6];let b=Ne[l],d;e[7]!==b?(d=E("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let x;e[13]!==a||e[14]!==u?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(A,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"O"),Ye=p(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=W(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=W(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,n,o]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),h=s.map(([d,u,x])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ie(h),b=s[0]?.[0];return{auth:n.status==="fulfilled"?n.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:De(h.map(d=>d.functions)),logsError:i.status==="rejected"?X(i.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?X(b.reason):null,migrations:Te(h.map(d=>d.migrations)),scheduler:o.status==="fulfilled"?o.value:null,totals:g}},"Ge"),Ze=p(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"Qe"),xt=p(({initialShardKey:t})=>{let e=ne(),a=D(),[s,l]=(0,f.useState)([]),[c,i]=(0,f.useState)(null),[n,o]=(0,f.useState)(null),[h,g]=(0,f.useState)(null),[b,d]=(0,f.useState)([]),[u,x]=(0,f.useState)(null),[v,k]=(0,f.useState)(null),[S,q]=(0,f.useState)([]),[N]=(0,f.useState)(de),w=(0,f.useRef)(!1),y=(0,f.useRef)(!0);(0,f.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let P=t??"",F=(0,f.useCallback)(async()=>{if(w.current)return;w.current=!0;let m=await Ye(e,P,me(P,N));if(!y.current){w.current=!1;return}o(m.totals),g(m.metricsError),d(m.functions),q(m.migrations),l(m.entries),i(m.logsError),x(m.auth),k(m.scheduler),w.current=!1},[e,N,P]);(0,f.useEffect)(()=>{K(F())},[F]);let G=(0,f.useRef)(0),C=(0,f.useRef)(null),ye=p(()=>{let m=Date.now()-G.current;if(m>=ge){G.current=Date.now(),K(F());return}C.current===null&&(C.current=setTimeout(()=>{C.current=null,G.current=Date.now(),K(F())},ge-m))},"de");(0,f.useEffect)(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let{data:B,liveError:we}=ce(M.getMetrics,{},{live:!0,shardKey:P});(0,f.useEffect)(()=>{B!==void 0&&ye()},[B]);let ee=s.filter(m=>m.level==="error"),ke=ee.slice(0,Oe),L=Qe(n?.history),te=Ze(u),Se=b.filter(m=>m.calls>0).toSorted((m,V)=>V.errors/V.calls-m.errors/m.calls||V.calls-m.calls).slice(0,Ke),Q=Je(S),qe=n===null||n.requests===0?0:n.errors/n.requests,J=Y(qe,xe,ve),re=u===null?"ok":Y(u.failureRate,_e,$e),se=v===null?"ok":Ge(v.backlog,He,Ue),R=Xe([J,re,se,Q.level]),z,O;return R==="crit"?(z=a("Critical"),O=a("One or more service levels are breached.")):R==="warn"?(z=a("Degraded"),O=a("Some service levels need attention.")):(z=a("All systems healthy"),O=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:E("flex size-10 shrink-0 items-center justify-center rounded-full",We[R]),children:(0,r.jsx)("span",{className:E("size-3 rounded-full",be[R])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:z}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:O})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsx)(_,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(n?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:E("text-lg font-semibold tabular-nums",Ne[J]),"data-testid":"hl-error-rate",children:n===null?"\u2014":U(n.errors,n.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(he,{}),(0,r.jsx)(ue,{message:we,prefix:"hl"})]})]})]}),h!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:h}),h===null&&n?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:L.errors.length>=2?(0,r.jsx)(_,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:n===null?"\u2014":U(n.errors,n.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)(_,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:Q.level,testId:"hl-slo-migrations",value:Ve(Q,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 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:a("Shards seen")}),(0,r.jsx)(T,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(m=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(T,{variant:"secondary",children:m})},m))})]})]})},"dt");export{xt as HealthPanel};
|
|
1
|
+
import{b as me,e as _}from"./chunk-LT236J7E.js";import{a as ue}from"./chunk-IGCNMZSB.js";import"./chunk-U7ILDM43.js";import"./chunk-4UOFSGUS.js";import"./chunk-CZZWYUTR.js";import{a as de}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import{b as T}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import"./chunk-QLQADHFE.js";import{a as M}from"./chunk-VDW32UET.js";import{c as ce}from"./chunk-LZGOETI3.js";import{f as ne,g as oe}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as A}from"./chunk-WQH3LT2P.js";import{d as D,f as j,g as W,h as X,o as K,r as ie}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as p,e as I,f as Ee,g as ae,h as le,j as E}from"./chunk-3XIESWL4.js";var Z=I(ae(),1);var f=I(Ee(),1);var fe=I(ae(),1);var $=I(le(),1);var Me={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive"},he=p(()=>{let t=(0,fe.c)(16),e=D(),a=oe(),s;e:switch(a){case"connected":{let o;t[0]!==e?(o=e("Connected"),t[0]=e,t[1]=o):o=t[1],s=o;break e}case"connecting":{let o;t[2]!==e?(o=e("Connecting\u2026"),t[2]=e,t[3]=o):o=t[3],s=o;break e}case"idle":{let o;t[4]!==e?(o=e("Idle"),t[4]=e,t[5]=o):o=t[5],s=o;break e}case"offline":{let o;t[6]!==e?(o=e("Offline"),t[6]=e,t[7]=o):o=t[7],s=o;break e}default:s=a}let l=Me[a],c;t[8]!==l?(c=E("size-2 rounded-full",l),t[8]=l,t[9]=c):c=t[9];let i;t[10]!==c?(i=(0,$.jsx)("span",{"aria-hidden":"true",className:c}),t[10]=c,t[11]=i):i=t[11];let n;return t[12]!==a||t[13]!==i||t[14]!==s?(n=(0,$.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":a,"data-testid":"dash-connection",role:"status",children:[i,s]}),t[12]=a,t[13]=i,t[14]=s,t[15]=n):n=t[15],n},"j");var r=I(le(),1);var Ae={crit:"destructive",ok:"secondary",warn:"default"},U=p((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"_"),Y=p((t,e,a)=>Number.isNaN(t)?"ok":t>=a?"crit":t>=e?"warn":"ok","V"),xe=.01,ve=.05,je=p(t=>{let e=(0,Z.c)(36),{errorCount:a,logsError:s,topErrors:l,worstFunctions:c}=t,i=D(),n;e[0]!==i?(n=i("Functions by error rate"),e[0]=i,e[1]=n):n=e[1];let o;e[2]!==n?(o=(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:n})}),e[2]=n,e[3]=o):o=e[3];let h;e[4]!==i||e[5]!==c?(h=c.length===0?(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,r.jsx)("ul",{className:"divide-y divide-border",children:c.map(y=>(0,r.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:y.path}),(0,r.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,r.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:y.calls.toString()})}),(0,r.jsx)(T,{variant:Ae[Y(y.errors/y.calls,xe,ve)],children:U(y.errors,y.calls)})]})]},y.path))}),e[4]=i,e[5]=c,e[6]=h):h=e[6];let g;e[7]!==o||e[8]!==h?(g=(0,r.jsxs)(A,{className:"gap-0 py-0","data-testid":"hl-functions",children:[o,h]}),e[7]=o,e[8]=h,e[9]=g):g=e[9];let b;e[10]!==i?(b=i("Recent errors"),e[10]=i,e[11]=b):b=e[11];let d;e[12]!==b?(d=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:b}),e[12]=b,e[13]=d):d=e[13];let u=a>0?"destructive":"outline",x;e[14]!==a||e[15]!==u?(x=(0,r.jsx)(T,{"data-testid":"hl-error-count",variant:u,children:a}),e[14]=a,e[15]=u,e[16]=x):x=e[16];let v;e[17]!==d||e[18]!==x?(v=(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[d,x]}),e[17]=d,e[18]=x,e[19]=v):v=e[19];let k;e[20]!==s?(k=s!==null&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:s}),e[20]=s,e[21]=k):k=e[21];let S;e[22]!==s||e[23]!==i||e[24]!==l.length?(S=s===null&&l.length===0&&(0,r.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=s,e[23]=i,e[24]=l.length,e[25]=S):S=e[25];let q;e[26]!==l?(q=l.length>0&&(0,r.jsx)("ul",{className:"divide-y divide-border",children:l.map(Ce)}),e[26]=l,e[27]=q):q=e[27];let N;e[28]!==k||e[29]!==S||e[30]!==q||e[31]!==v?(N=(0,r.jsxs)(A,{className:"gap-0 py-0",children:[v,k,S,q]}),e[28]=k,e[29]=S,e[30]=q,e[31]=v,e[32]=N):N=e[32];let w;return e[33]!==N||e[34]!==g?(w=(0,r.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[g,N]}),e[33]=N,e[34]=g,e[35]=w):w=e[35],w},"Se");function Ce(t,e){return(0,r.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,r.jsxs)("span",{className:"flex items-center gap-2",children:[(0,r.jsx)("time",{className:"shrink-0 text-muted-foreground",children:ie(t.timestamp)}),t.functionPath!==void 0&&(0,r.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,r.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}p(Ce,"qe");var pe={completed:0,failed:2,in_progress:1},Ie=p(t=>{let e=0,a=0,s=0,l=0,c=!1,i=[];for(let{metrics:n}of t){if(n===null){l+=1;continue}s+=1,e+=n.requests,a+=n.errors,i.push(...n.history??[]),c||=n.historyTruncated===!0}return{errors:a,failed:l,history:i,historyTruncated:c,reachable:s,requests:e}},"Ee"),De=p(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.path);if(l===void 0){e.set(s.path,{...s});continue}l.calls+=s.calls,l.errors+=s.errors,l.totalDurationMs+=s.totalDurationMs,l.scans=(l.scans??0)+(s.scans??0),l.maxDurationMs=Math.max(l.maxDurationMs,s.maxDurationMs),l.lastCalledAt=Math.max(l.lastCalledAt,s.lastCalledAt),(s.lastErrorAt??0)>(l.lastErrorAt??0)&&(l.lastErrorAt=s.lastErrorAt,l.lastErrorMessage=s.lastErrorMessage)}return[...e.values()]},"Me"),Te=p(t=>{let e=new Map;for(let a of t)for(let s of a){let l=e.get(s.id);if(l===void 0){e.set(s.id,s);continue}let c=pe[s.status]-pe[l.status];(c>0||c===0&&(s.updatedAt??0)>(l.updatedAt??0))&&e.set(s.id,s)}return[...e.values()]},"$e"),Pe=j(M.getAuthMetrics),Fe=j(M.getFunctionStats),Le=j(M.getLogs),Re=j(M.getMetrics),ze=j(M.migrationStatus),Oe=5,ge=2e3,Ke=5,_e=.1,$e=.3,He=1,Ue=50,Ge=p((t,e,a)=>t>=a?"crit":t>=e?"warn":"ok","_e"),Qe=p(t=>{let e=new Map;for(let s of t??[]){let l=e.get(s.bucketMs)??{calls:0,errors:0};l.calls+=s.calls,l.errors+=s.errors,e.set(s.bucketMs,l)}let a=[...e.entries()].toSorted((s,l)=>s[0]-l[0]);return{errors:a.map(([,s])=>s.errors),requests:a.map(([,s])=>s.calls)}},"ze"),Je=p(t=>{let e=0,a=0;for(let l of t)l.status==="failed"?e+=1:l.status==="in_progress"&&(a+=1);let s="ok";return e>0?s="crit":a>0&&(s="warn"),{failed:e,level:s,running:a}},"Ke"),Ve=p((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"He"),be={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Ne={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},We={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Xe=p(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","Be"),H=p(t=>{let e=(0,Z.c)(19),{chart:a,label:s,level:l,testId:c,value:i}=t,n=be[l],o;e[0]!==n?(o=E("size-1.5 shrink-0 rounded-full",n),e[0]=n,e[1]=o):o=e[1];let h;e[2]!==o?(h=(0,r.jsx)("span",{"aria-hidden":"true",className:o}),e[2]=o,e[3]=h):h=e[3];let g;e[4]!==s||e[5]!==h?(g=(0,r.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[h,s]}),e[4]=s,e[5]=h,e[6]=g):g=e[6];let b=Ne[l],d;e[7]!==b?(d=E("truncate text-2xl font-semibold tabular-nums",b),e[7]=b,e[8]=d):d=e[8];let u;e[9]!==d||e[10]!==c||e[11]!==i?(u=(0,r.jsx)("span",{className:d,"data-testid":c,children:i}),e[9]=d,e[10]=c,e[11]=i,e[12]=u):u=e[12];let x;e[13]!==a||e[14]!==u?(x=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[u,a]}),e[13]=a,e[14]=u,e[15]=x):x=e[15];let v;return e[16]!==g||e[17]!==x?(v=(0,r.jsx)(A,{className:"gap-0 py-0",children:(0,r.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[g,x]})}),e[16]=g,e[17]=x,e[18]=v):v=e[18],v},"O"),Ye=p(async(t,e,a)=>{let s=await Promise.all(a.map(d=>{let u=W(d);return Promise.allSettled([t.query(Re,{},u),t.query(Fe,{},u),t.query(ze,{},u)])})),l=W(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,n,o]=await Promise.allSettled([t.query(Le,{},l),t.query(Pe,{},l),c]),h=s.map(([d,u,x])=>({functions:u.status==="fulfilled"?u.value.functions:[],metrics:d.status==="fulfilled"?d.value:null,migrations:x.status==="fulfilled"?x.value.migrations:[]})),g=Ie(h),b=s[0]?.[0];return{auth:n.status==="fulfilled"?n.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:De(h.map(d=>d.functions)),logsError:i.status==="rejected"?X(i.reason):null,metricsError:g.reachable===0&&b?.status==="rejected"?X(b.reason):null,migrations:Te(h.map(d=>d.migrations)),scheduler:o.status==="fulfilled"?o.value:null,totals:g}},"Ge"),Ze=p(t=>{let e=t?.history??[];return{attempts:e.map(a=>a.attempts),failures:e.map(a=>a.failures)}},"Qe"),xt=p(({initialShardKey:t})=>{let e=ne(),a=D(),[s,l]=(0,f.useState)([]),[c,i]=(0,f.useState)(null),[n,o]=(0,f.useState)(null),[h,g]=(0,f.useState)(null),[b,d]=(0,f.useState)([]),[u,x]=(0,f.useState)(null),[v,k]=(0,f.useState)(null),[S,q]=(0,f.useState)([]),[N]=(0,f.useState)(de),w=(0,f.useRef)(!1),y=(0,f.useRef)(!0);(0,f.useEffect)(()=>(y.current=!0,()=>{y.current=!1}),[]);let P=t??"",F=(0,f.useCallback)(async()=>{if(w.current)return;w.current=!0;let m=await Ye(e,P,me(P,N));if(!y.current){w.current=!1;return}o(m.totals),g(m.metricsError),d(m.functions),q(m.migrations),l(m.entries),i(m.logsError),x(m.auth),k(m.scheduler),w.current=!1},[e,N,P]);(0,f.useEffect)(()=>{K(F())},[F]);let G=(0,f.useRef)(0),C=(0,f.useRef)(null),ye=p(()=>{let m=Date.now()-G.current;if(m>=ge){G.current=Date.now(),K(F());return}C.current===null&&(C.current=setTimeout(()=>{C.current=null,G.current=Date.now(),K(F())},ge-m))},"de");(0,f.useEffect)(()=>()=>{C.current!==null&&clearTimeout(C.current)},[]);let{data:B,liveError:we}=ce(M.getMetrics,{},{live:!0,shardKey:P});(0,f.useEffect)(()=>{B!==void 0&&ye()},[B]);let ee=s.filter(m=>m.level==="error"),ke=ee.slice(0,Oe),L=Qe(n?.history),te=Ze(u),Se=b.filter(m=>m.calls>0).toSorted((m,V)=>V.errors/V.calls-m.errors/m.calls||V.calls-m.calls).slice(0,Ke),Q=Je(S),qe=n===null||n.requests===0?0:n.errors/n.requests,J=Y(qe,xe,ve),re=u===null?"ok":Y(u.failureRate,_e,$e),se=v===null?"ok":Ge(v.backlog,He,Ue),R=Xe([J,re,se,Q.level]),z,O;return R==="crit"?(z=a("Critical"),O=a("One or more service levels are breached.")):R==="warn"?(z=a("Degraded"),O=a("Some service levels need attention.")):(z=a("All systems healthy"),O=a("All service levels are within target.")),(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:E("flex size-10 shrink-0 items-center justify-center rounded-full",We[R]),children:(0,r.jsx)("span",{className:E("size-3 rounded-full",be[R])})}),(0,r.jsxs)("div",{className:"grid leading-tight",children:[(0,r.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:z}),(0,r.jsx)("span",{className:"text-[13px] text-muted-foreground",children:O})]})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Requests")}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[L.requests.length>=2&&(0,r.jsx)(_,{ariaLabel:a("Requests over time"),className:"h-6 w-20 text-foreground",series:L.requests,testId:"hl-spark-requests"}),(0,r.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(n?.requests??0).toString()})]})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"text-end",children:[(0,r.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:a("Error rate")}),(0,r.jsx)("div",{className:E("text-lg font-semibold tabular-nums",Ne[J]),"data-testid":"hl-error-rate",children:n===null?"\u2014":U(n.errors,n.requests)})]}),(0,r.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(he,{}),(0,r.jsx)(ue,{message:we,prefix:"hl"})]})]})]}),h!==null&&(0,r.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:h}),h===null&&n?.historyTruncated===!0&&(0,r.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:a("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,r.jsx)(H,{chart:L.errors.length>=2?(0,r.jsx)(_,{ariaLabel:a("Errors over time"),className:"h-7 w-20 text-destructive",series:L.errors,testId:"hl-spark-errors"}):void 0,label:a("Error rate"),level:J,testId:"hl-slo-errorrate",value:n===null?"\u2014":U(n.errors,n.requests)}),(0,r.jsx)(H,{chart:te.failures.length>=2?(0,r.jsx)(_,{ariaLabel:a("Auth failures over time"),className:"h-7 w-20 text-destructive",series:te.failures,testId:"hl-spark-auth"}):void 0,label:a("Auth failures"),level:re,testId:"hl-slo-auth",value:u===null?"\u2014":U(u.failures,u.attempts)}),(0,r.jsx)(H,{label:a("Scheduler backlog"),level:se,testId:"hl-slo-backlog",value:v===null?"\u2014":v.backlog.toString()}),(0,r.jsx)(H,{label:a("Migrations"),level:Q.level,testId:"hl-slo-migrations",value:Ve(Q,a)})]}),(0,r.jsx)(je,{errorCount:ee.length,logsError:c,topErrors:ke,worstFunctions:Se}),(0,r.jsxs)(A,{className:"gap-0 py-0",children:[(0,r.jsxs)("header",{className:"flex items-center justify-between gap-2 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:a("Shards seen")}),(0,r.jsx)(T,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&(0,r.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(m=>(0,r.jsx)("li",{"data-testid":"hl-shard",children:(0,r.jsx)(T,{variant:"secondary",children:m})},m))})]})]})},"dt");export{xt as HealthPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as D,c as g,d as P,f as k}from"./chunk-
|
|
1
|
+
import{b as D,c as g,d as P,f as k}from"./chunk-ETU7KIO4.js";import{f as v,g as S,h as T,o as q}from"./chunk-IUYFXK4X.js";import{a as i,e as A,f as $,g as M}from"./chunk-3XIESWL4.js";var I=A(M(),1);var f=A($(),1);var l=i(e=>typeof e=="string"?e===""?void 0:e:typeof e=="number"||typeof e=="boolean"?String(e):void 0,"u"),h=i(e=>e.filter(r=>r!==void 0).join(" "),"d"),Q={deleteRows:i(e=>h([l(e.table),Array.isArray(e.ids)?`${String(e.ids.length)} rows`:void 0]),"deleteRows"),facetColumn:i(e=>h([l(e.table),l(e.column)]),"facetColumn"),lintSql:i(()=>"sql","lintSql"),readTablePage:i(e=>h([l(e.table),Array.isArray(e.filters)&&e.filters.length>0?`${String(e.filters.length)} filters`:void 0,typeof e.search=="string"&&e.search!==""?"search":void 0,typeof e.limit=="number"?`limit ${String(e.limit)}`:void 0]),"readTablePage"),runMigration:i(e=>h([l(e.id),l(e.direction),e.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(e=>typeof e.sql=="string"?`${String(e.sql.length)} chars`:"","runSql"),schemaVersion:i(e=>typeof e.hash=="string"?e.hash.slice(0,8):"","schemaVersion"),writeRow:i(e=>h([l(e.table),"1 row"]),"writeRow")},E="__lunora_admin__:",C=i((e,r)=>{let s=e.startsWith(E)?e.slice(E.length):e,t=Q[s];if(t!==void 0)return t(r);let n=Object.keys(r);return n.length===0?"":n.join(", ")},"N"),L=i(e=>{if(Array.isArray(e))return e.length;if(!(typeof e!="object"||e===null)){for(let r of Object.values(e))if(Array.isArray(r))return r.length}},"K"),w=class{static{i(this,"L")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}),"subscribe");start(r,s,t){return this.append(r,s,t,"call","pending")}startSubscription(r,s,t){return this.append(r,s,t,"subscription","live")}recordPush(r){if(this.listeners.size===0){let s=this.entries.find(t=>t.seq===r);s!==void 0&&(s.pushes=(s.pushes??0)+1);return}this.patch(r,s=>({...s,pushes:(s.pushes??0)+1}))}failSubscription(r,s){this.patch(r,t=>({...t,error:s,status:"error"}))}endSubscription(r){this.patch(r,s=>s.status==="error"?s:{...s,durationMs:Date.now()-s.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(r=>r.status==="error")?.seq}settle(r,s){this.patch(r,t=>({...t,durationMs:Date.now()-t.startedAt,...s.error===void 0?{resultCount:L(s.result),status:"ok"}:{error:s.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(r,s,t,n,a){let o=this.nextSeq;this.nextSeq+=1;let d={functionPath:r,kind:n,seq:o,shardKey:t,startedAt:Date.now(),status:a,summary:C(r,s),...n==="subscription"?{pushes:0}:{}},u=[...this.entries,d];return this.entries=u.length>300?u.slice(u.length-300):u,this.emit(),o}patch(r,s){let t=this.entries.findIndex(n=>n.seq===r);t!==-1&&(this.entries=this.entries.with(t,s(this.entries[t])),this.emit())}emit(){for(let r of this.listeners)r()}},p=new w,_=i((e,r,s)=>["lunora-admin",e,r,s.trim()],"q");function R(e,r,s={}){let{enabled:t=!0,keepPreviousData:n=!1,staleTime:a=0}=s,o=P({enabled:t,queryFn:r,placeholderData:n?D:void 0,queryKey:e,staleTime:a});return{data:o.data,error:o.error?T(o.error):o.error,errorSource:o.error??void 0,isLoading:o.isLoading,liveError:void 0,refetch:i(()=>{q(o.refetch())},"refetch")}}i(R,"M");function V(e,r,s={}){let t=k(),n=g(),{enabled:a=!0,keepPreviousData:o=!1,live:d=!1,shardKey:u="",staleTime:j}=s,m=_(e,r,u),x=R(m,()=>t.query(v(e),r,S(u)),{enabled:a,keepPreviousData:o,staleTime:j??(d?Number.POSITIVE_INFINITY:0)}),[N,y]=(0,f.useState)(void 0),O=JSON.stringify(m);return(0,f.useEffect)(()=>{if(!a||!d)return;y(void 0);let b=p.startSubscription(e,r,u),K=t.subscribe(v(e),r,c=>{p.recordPush(b),y(void 0),n.setQueryData(m,c)},{...S(u),onError:i(c=>{p.failSubscription(b,c.message),y(c.message)},"onError")});return()=>{p.endSubscription(b),K()}},[O,a,d]),{...x,liveError:a&&d?N:void 0}}i(V,"z");var U=i(()=>{let e=(0,I.c)(2),r=g(),s;return e[0]!==r?(s=i((t,n,a)=>{let o=n===void 0?["lunora-admin",t]:_(t,n,a??"");q(r.invalidateQueries({queryKey:o}))},"e"),e[0]=r,e[1]=s):s=e[1],s},"J");export{p as a,R as b,V as c,U as d};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-RMN2JN4S.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-RMN2JN4S.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{d as K,e as _,f as z,h as P,o as q,r as E}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as s,e as T,f as ie,h as oe}from"./chunk-3XIESWL4.js";var i=T(ie(),1);var e=T(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,"ie"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"oe"),ue=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"),ce=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ue(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(M.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(),c=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),x=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[u,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 c.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(P(d))}),()=>{t=!0}},[c,r]);let R=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===R),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},j=u.trim()===""?{}:{shardKey:u.trim()},A=o?f.trim():"",J=s(l=>{Y(L=>[{argsText:m,at:Date.now(),id:(L[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:u,status:l},...L].slice(0,fe))},"j");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,j):await c.query(me,{args:t,functionPath:n.path,userId:A},j);U(u),y(l),p("success"),J("success")}catch(l){y(void 0),N(l.message),p("error"),J("error")}},"_"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"q"),te=s(t=>{S(t.target.value)},"B"),re=s(t=>{b(t.target.value)},"D"),ae=s(t=>{W(t.target.value)},"E"),se=s(()=>{q(Z())},"U"),ne=s(()=>{b(ce(n?.args))},"X");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)(g,{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:R,children:x.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)(g,{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)(B,{onChange:F,testId:"shard-input",value:u}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(g,{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:E(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))})]})},"Ie");export{Fe as FunctionRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as le}from"./chunk-HPFLBYRI.js";import{b as re}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{d as de,f as oe}from"./chunk-
|
|
1
|
+
import{a as le}from"./chunk-HPFLBYRI.js";import{b as re}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{d as de,f as oe}from"./chunk-ETU7KIO4.js";import"./chunk-XBDKZZ67.js";import{a as me}from"./chunk-XQCVZAGU.js";import{a as ae}from"./chunk-WQH3LT2P.js";import{d as ce,r as pe}from"./chunk-IUYFXK4X.js";import"./chunk-YEGFNH56.js";import{a as k,e as ie,g as xe,h as ge,j as Z}from"./chunk-3XIESWL4.js";var ne=ie(xe(),1);var a=ie(ge(),1);var ye="/_lunora/health",Ne="/_lunora/health/ready",ve=k((n,e)=>(n.endsWith("/")?n.slice(0,-1):n)+e,"xe"),be=k(()=>{let n=oe();return async e=>{let w=e==="ready"?Ne:ye,t=n.getAuthToken(),_=ve(n.url,w);try{let l=await fetch(_,{headers:t===null?{}:{authorization:`Bearer ${t}`}}),d=null;try{d=await l.json()}catch{d=null}return{body:d,ok:l.ok,status:l.status}}catch(l){return{body:null,error:l instanceof Error?l.message:String(l),ok:!1,status:0}}}},"Ne"),he={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ke={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},we=k(n=>n==="unhealthy"?"crit":n==="degraded"?"warn":"ok","ye"),ue=k(n=>{let e=(0,ne.c)(13),{label:w,level:t,testId:_,value:l}=n,d=he[t],o;e[0]!==d?(o=Z("size-1.5 shrink-0 rounded-full",d),e[0]=d,e[1]=o):o=e[1];let c;e[2]!==o?(c=(0,a.jsx)("span",{"aria-hidden":"true",className:o}),e[2]=o,e[3]=c):c=e[3];let x;e[4]!==w||e[5]!==c?(x=(0,a.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[c,w]}),e[4]=w,e[5]=c,e[6]=x):x=e[6];let g;e[7]!==_||e[8]!==l?(g=(0,a.jsx)("span",{className:"text-lg font-semibold text-foreground","data-testid":_,children:l}),e[7]=_,e[8]=l,e[9]=g):g=e[9];let u;return e[10]!==x||e[11]!==g?(u=(0,a.jsx)(ae,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[x,g]})}),e[10]=x,e[11]=g,e[12]=u):u=e[12],u},"ne"),De=k(n=>{let e=(0,ne.c)(115),{probe:w}=n,t=ce(),_=be(),l=w??_,d;e[0]!==l?(d=k(async()=>{let[s,i]=await Promise.all([l("live"),l("ready")]);return{live:s,ready:i}},"d"),e[0]=l,e[1]=d):d=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=["deployment-health"],e[2]=o):o=e[2];let c;e[3]!==d?(c={queryFn:d,queryKey:o},e[3]=d,e[4]=c):c=e[4];let{data:x,isPending:g}=de(c),u=x?.live??null,fe=x?.ready??null;if(g){let s;return e[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[(0,a.jsx)(le,{className:"h-16 w-full"}),(0,a.jsx)(le,{className:"h-40 w-full"})]}),e[5]=s):s=e[5],s}let r=u?.body??null;if(r===null){let s=u?.status===403,i;e[6]!==s||e[7]!==u?.error||e[8]!==t?(i=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:u?.error??t("no response")}),e[6]=s,e[7]=u?.error,e[8]=t,e[9]=i):i=e[9];let h;e[10]!==t?(h=t("Health endpoint unavailable"),e[10]=t,e[11]=h):h=e[11];let p;return e[12]!==i||e[13]!==h?(p=(0,a.jsx)(me,{description:i,testId:"deployment-health-error",title:h}),e[12]=i,e[13]=h,e[14]=p):p=e[14],p}let ee;e[15]!==r.status?(ee=we(r.status),e[15]=r.status,e[16]=ee):ee=e[16];let j=ee,m;if(r.status==="unhealthy"){let s;e[17]!==t?(s=t("Unhealthy"),e[17]=t,e[18]=s):s=e[18],m=s}else if(r.status==="degraded"){let s;e[19]!==t?(s=t("Degraded"),e[19]=t,e[20]=s):s=e[20],m=s}else{let s;e[21]!==t?(s=t("Healthy"),e[21]=t,e[22]=s):s=e[22],m=s}let C=fe?.ok??!1,Y=C?"ok":"crit",z,I,y,N,v,S,V,b,$,H;if(e[23]!==r.appName||e[24]!==r.appVersion||e[25]!==r.checks||e[26]!==r.timestamp||e[27]!==j||e[28]!==Y||e[29]!==C||e[30]!==m||e[31]!==t){let s=[...r.checks].toSorted(_e);H="flex flex-col gap-6",I="deployment-health";let i;e[42]!==t?(i=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint \u2014 wire an uptime monitor or a Cloudflare Health Check at it."),e[42]=t,e[43]=i):i=e[43],e[44]!==i?(y=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[44]=i,e[45]=y):y=e[45];let h=ke[j],p;e[46]!==h?(p=Z("flex size-10 shrink-0 items-center justify-center rounded-full",h),e[46]=h,e[47]=p):p=e[47];let se=he[j],D;e[48]!==se?(D=Z("size-3 rounded-full",se),e[48]=se,e[49]=D):D=e[49];let L;e[50]!==D?(L=(0,a.jsx)("span",{className:D}),e[50]=D,e[51]=L):L=e[51];let T;e[52]!==p||e[53]!==L?(T=(0,a.jsx)("span",{"aria-hidden":"true",className:p,children:L}),e[52]=p,e[53]=L,e[54]=T):T=e[54];let q;e[55]!==m?(q=(0,a.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:m}),e[55]=m,e[56]=q):q=e[56];let E;e[57]!==r.appName||e[58]!==r.appVersion?(E=(0,a.jsxs)("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[r.appName," \xB7 ",r.appVersion]}),e[57]=r.appName,e[58]=r.appVersion,e[59]=E):E=e[59];let R;e[60]!==q||e[61]!==E?(R=(0,a.jsxs)("div",{className:"grid leading-tight",children:[q,E]}),e[60]=q,e[61]=E,e[62]=R):R=e[62];let U;e[63]!==T||e[64]!==R?(U=(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[T,R]}),e[63]=T,e[64]=R,e[65]=U):U=e[65];let A;e[66]!==t?(A=t("Checked"),e[66]=t,e[67]=A):A=e[67];let B;e[68]!==A?(B=(0,a.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:A}),e[68]=A,e[69]=B):B=e[69];let F;e[70]!==r.timestamp?(F=pe(r.timestamp),e[70]=r.timestamp,e[71]=F):F=e[71];let K;e[72]!==F?(K=(0,a.jsx)("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:F}),e[72]=F,e[73]=K):K=e[73];let Q;e[74]!==B||e[75]!==K?(Q=(0,a.jsxs)("div",{className:"text-end",children:[B,K]}),e[74]=B,e[75]=K,e[76]=Q):Q=e[76],e[77]!==U||e[78]!==Q?(N=(0,a.jsx)(ae,{className:"gap-0 py-0",children:(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[U,Q]})}),e[77]=U,e[78]=Q,e[79]=N):N=e[79];let W;e[80]!==t?(W=t("Liveness"),e[80]=t,e[81]=W):W=e[81];let G;e[82]!==j||e[83]!==m||e[84]!==W?(G=(0,a.jsx)(ue,{label:W,level:j,testId:"dh-liveness",value:m}),e[82]=j,e[83]=m,e[84]=W,e[85]=G):G=e[85];let J;e[86]!==t?(J=t("Readiness"),e[86]=t,e[87]=J):J=e[87];let M;e[88]!==C||e[89]!==t?(M=t(C?"Ready":"Not ready"),e[88]=C,e[89]=t,e[90]=M):M=e[90];let O;e[91]!==Y||e[92]!==J||e[93]!==M?(O=(0,a.jsx)(ue,{label:J,level:Y,testId:"dh-readiness",value:M}),e[91]=Y,e[92]=J,e[93]=M,e[94]=O):O=e[94],e[95]!==G||e[96]!==O?(v=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[G,O]}),e[95]=G,e[96]=O,e[97]=v):v=e[97],z=ae,S="gap-0 py-0",V="dh-checks";let X;e[98]!==t?(X=t("Subsystem checks"),e[98]=t,e[99]=X):X=e[99],e[100]!==X?(b=(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:X})}),e[100]=X,e[101]=b):b=e[101],$=s.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:s.map(f=>(0,a.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${f.name}`,children:[(0,a.jsxs)("span",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:Z("size-1.5 shrink-0 rounded-full",f.status==="up"?"bg-success":"bg-destructive")}),(0,a.jsx)("span",{className:"font-mono text-foreground",children:f.name}),f.critical&&(0,a.jsx)(re,{variant:"outline",children:t("Critical")})]}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[f.message!==void 0&&(0,a.jsx)("span",{className:"text-muted-foreground",children:f.message}),(0,a.jsx)(re,{"data-testid":`dh-check-status-${f.name}`,variant:f.status==="up"?"secondary":"destructive",children:f.status==="up"?t("Up"):t("Down")})]})]},f.name))}),e[23]=r.appName,e[24]=r.appVersion,e[25]=r.checks,e[26]=r.timestamp,e[27]=j,e[28]=Y,e[29]=C,e[30]=m,e[31]=t,e[32]=z,e[33]=I,e[34]=y,e[35]=N,e[36]=v,e[37]=S,e[38]=V,e[39]=b,e[40]=$,e[41]=H}else z=e[32],I=e[33],y=e[34],N=e[35],v=e[36],S=e[37],V=e[38],b=e[39],$=e[40],H=e[41];let P;e[102]!==z||e[103]!==S||e[104]!==V||e[105]!==b||e[106]!==$?(P=(0,a.jsxs)(z,{className:S,"data-testid":V,children:[b,$]}),e[102]=z,e[103]=S,e[104]=V,e[105]=b,e[106]=$,e[107]=P):P=e[107];let te;return e[108]!==I||e[109]!==y||e[110]!==N||e[111]!==v||e[112]!==P||e[113]!==H?(te=(0,a.jsxs)("div",{className:H,"data-testid":I,children:[y,N,v,P]}),e[108]=I,e[109]=y,e[110]=N,e[111]=v,e[112]=P,e[113]=H,e[114]=te):te=e[114],te},"Ie");function _e(n,e){return n.name.localeCompare(e.name)}k(_e,"be");export{De as DeploymentHealthPanel};
|