@lunora/studio 1.0.0-alpha.350 → 1.0.0-alpha.352
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.mjs +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +8 -8
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/{ADMIN_FUNCTIONS-B8yyk5BX.mjs → ADMIN_FUNCTIONS-4aGsMs95.mjs} +1 -1
- package/dist/packem_shared/{ApiDocsPanel-B_RaW7Br.mjs → ApiDocsPanel-E4Vr-8zW.mjs} +1 -1
- package/dist/packem_shared/{DataBrowser-Cc1qZX-4.mjs → DataBrowser-C5HbI4TH.mjs} +1 -1
- package/dist/packem_shared/{GlobalDataBrowser-Hq6gTlkb.mjs → GlobalDataBrowser-D0H2yJSl.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-DeyYLVxc.mjs → HomePanel-CcYkDlR-.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-CMZYYcQ5.mjs → MigrationsPanel-YyCO_T-3.mjs} +1 -1
- package/dist/packem_shared/{Studio-BhTqTeGb.mjs → Studio-4vJzwwNa.mjs} +1 -1
- package/dist/packem_shared/{StudioApp-B1d0beD4.mjs → StudioApp-px2FMPDS.mjs} +1 -1
- package/dist/packem_shared/{home-panel-0XMGe1hP.mjs → home-panel-DPiMVQZ2.mjs} +1 -1
- package/dist/packem_shared/{studio-CA3ZKwVK.mjs → studio-DIUgH7k0.mjs} +1 -1
- package/dist/packem_shared/{table-list-sidebar-nA7g7uSk.mjs → table-list-sidebar-CCRB_iYz.mjs} +1 -1
- package/dist/packem_shared/{use-sql-assistant-DXnqbBs-.mjs → use-sql-assistant-BMVlguKF.mjs} +1 -1
- package/dist/standalone/{chunk-WQGT24W6.js → chunk-22O2JDWR.js} +1 -1
- package/dist/standalone/{chunk-RXVXXRYD.js → chunk-2DV455PX.js} +1 -1
- package/dist/standalone/{chunk-B7MHW3A5.js → chunk-2EMNPL3B.js} +1 -1
- package/dist/standalone/{chunk-LOV52GLG.js → chunk-35BGGOWV.js} +1 -1
- package/dist/standalone/{chunk-BTRYFPZH.js → chunk-3MQ477EE.js} +1 -1
- package/dist/standalone/{chunk-XWEDIIIT.js → chunk-453GHHZ4.js} +1 -1
- package/dist/standalone/{chunk-QAQVT4FS.js → chunk-4CITH2NU.js} +1 -1
- package/dist/standalone/{chunk-E32FS6PE.js → chunk-4EDOPHLM.js} +1 -1
- package/dist/standalone/{chunk-EDGOSJXL.js → chunk-4QRVJDM4.js} +1 -1
- package/dist/standalone/{chunk-B3AXFXAD.js → chunk-4UWYDYM5.js} +1 -1
- package/dist/standalone/{chunk-SXD6JQXF.js → chunk-57ZNR6IA.js} +1 -1
- package/dist/standalone/{chunk-R3KLR5EP.js → chunk-6DYXTEU7.js} +1 -1
- package/dist/standalone/chunk-6GPEHYCG.js +1 -0
- package/dist/standalone/{chunk-E3VSRIQU.js → chunk-6GRI2HXU.js} +1 -1
- package/dist/standalone/{chunk-7F3S5OQT.js → chunk-6QBK3Z7A.js} +1 -1
- package/dist/standalone/{chunk-4ZEL6BYL.js → chunk-6UTZXEW3.js} +1 -1
- package/dist/standalone/{chunk-CGZVMM3P.js → chunk-7EAHHRJR.js} +1 -1
- package/dist/standalone/{chunk-HOPAJ5F6.js → chunk-ACNWZIAH.js} +1 -1
- package/dist/standalone/{chunk-5J32EGHF.js → chunk-ANACHJRU.js} +1 -1
- package/dist/standalone/chunk-BAGJYLSU.js +8 -0
- package/dist/standalone/{chunk-HLAAOW33.js → chunk-BCOOULSO.js} +1 -1
- package/dist/standalone/{chunk-ZMQ6PKLN.js → chunk-BKH2NALB.js} +1 -1
- package/dist/standalone/{chunk-ZBFWT34B.js → chunk-BTOOJXUL.js} +1 -1
- package/dist/standalone/{chunk-2EL4EMYZ.js → chunk-C6FNBKCO.js} +1 -1
- package/dist/standalone/{chunk-OECMBE6Q.js → chunk-DSTNWB4N.js} +1 -1
- package/dist/standalone/{chunk-WIET27J3.js → chunk-DTW4E5AB.js} +1 -1
- package/dist/standalone/{chunk-VB6YJKPA.js → chunk-FNWRS4VQ.js} +1 -1
- package/dist/standalone/{chunk-UTX6IBA3.js → chunk-FST24UXA.js} +1 -1
- package/dist/standalone/{chunk-ZTOXQK4V.js → chunk-FXGYX2V6.js} +1 -1
- package/dist/standalone/{chunk-MFNO5BFR.js → chunk-HWTX54JM.js} +1 -1
- package/dist/standalone/{chunk-26OKWFLO.js → chunk-HZCLLEWP.js} +1 -1
- package/dist/standalone/{chunk-7AZYREIY.js → chunk-IRCUXARN.js} +1 -1
- package/dist/standalone/{chunk-W7Z35E2E.js → chunk-IVQKQBKK.js} +1 -1
- package/dist/standalone/{chunk-W2XSKODB.js → chunk-K7FZTYAY.js} +1 -1
- package/dist/standalone/{chunk-5NZWQEEJ.js → chunk-KNX3KB7E.js} +1 -1
- package/dist/standalone/{chunk-MMJTKSHL.js → chunk-LYHEBMM6.js} +1 -1
- package/dist/standalone/{chunk-BVKQA5OL.js → chunk-M2RIGPGL.js} +1 -1
- package/dist/standalone/{chunk-EOR73TZZ.js → chunk-MKVZXGJQ.js} +1 -1
- package/dist/standalone/chunk-OIDFWEJX.js +21 -0
- package/dist/standalone/{chunk-CLINNLLE.js → chunk-OJG65AG4.js} +1 -1
- package/dist/standalone/{chunk-XMEVNOCA.js → chunk-Q4N3TJPV.js} +1 -1
- package/dist/standalone/{chunk-NVHHB5EV.js → chunk-QEVFVWGC.js} +1 -1
- package/dist/standalone/{chunk-JAHK7RRJ.js → chunk-RHOQJNDW.js} +1 -1
- package/dist/standalone/{chunk-7MN724WR.js → chunk-RQDSPVVH.js} +1 -1
- package/dist/standalone/{chunk-P5GAJKDW.js → chunk-S5S2YICJ.js} +1 -1
- package/dist/standalone/{chunk-ZZAJHNZ6.js → chunk-S6JFSLBK.js} +1 -1
- package/dist/standalone/{chunk-GMW2DYFU.js → chunk-SDTHCM5H.js} +1 -1
- package/dist/standalone/{chunk-JG2C7SS2.js → chunk-SM2IQWCJ.js} +1 -1
- package/dist/standalone/{chunk-GPOSJNMV.js → chunk-T2QAOXUO.js} +1 -1
- package/dist/standalone/{chunk-2WNL74MI.js → chunk-T4VAXHRL.js} +1 -1
- package/dist/standalone/{chunk-FPIUVV7Q.js → chunk-TBDJVYCB.js} +1 -1
- package/dist/standalone/{chunk-HFYFYNSX.js → chunk-TTD7BKB6.js} +1 -1
- package/dist/standalone/{chunk-KFNDET5D.js → chunk-UCK6ITED.js} +1 -1
- package/dist/standalone/{chunk-UZIBQZ2F.js → chunk-UKKZJRJT.js} +1 -1
- package/dist/standalone/{chunk-F5LTDUMB.js → chunk-V74BXQXC.js} +1 -1
- package/dist/standalone/{chunk-2ZO7XY3Z.js → chunk-VHMA6YPT.js} +1 -1
- package/dist/standalone/{chunk-SOO2HXV6.js → chunk-W4X4J7BU.js} +1 -1
- package/dist/standalone/{chunk-S7XAAH7U.js → chunk-W6ZKEW5M.js} +1 -1
- package/dist/standalone/{chunk-D7JK65OK.js → chunk-WIYDA4XT.js} +1 -1
- package/dist/standalone/{chunk-2X6O33OX.js → chunk-X7GSROPX.js} +1 -1
- package/dist/standalone/{chunk-O3FDK56W.js → chunk-Y7SN6CTX.js} +1 -1
- package/dist/standalone/{chunk-JGMQQ3S7.js → chunk-YRQHFMEY.js} +1 -1
- package/dist/standalone/{chunk-YJ2WHOGO.js → chunk-ZKPRORLI.js} +1 -1
- package/dist/standalone/{chunk-TWMS2TMF.js → chunk-ZLSNET6H.js} +1 -1
- package/dist/standalone/{chunk-CIVMATZK.js → chunk-ZM4K2ETZ.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/standalone/chunk-BHOLL76W.js +0 -8
- package/dist/standalone/chunk-GQYA5W5T.js +0 -1
- package/dist/standalone/chunk-U76DVXTR.js +0 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as st}from"./chunk-X5KWBDTF.js";import"./chunk-A566HCBX.js";import{a as et}from"./chunk-P6L6ABWO.js";import{a as tt}from"./chunk-SOO2HXV6.js";import"./chunk-W2BCSK5S.js";import{a as Ze}from"./chunk-ZWDORIZY.js";import{i as Ge}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as pe}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as me}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as Ye}from"./chunk-OECMBE6Q.js";import{a as Xe}from"./chunk-OSJ7HV7B.js";import"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import{a as G}from"./chunk-4ZEL6BYL.js";import{c as Oe}from"./chunk-YJ2WHOGO.js";import{p as Ve}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as he}from"./chunk-3Y5K3IQO.js";import{a as Re,b as _e,c as Je,d as H,e as L,f as S}from"./chunk-CW57Q264.js";import{a as ke,e as Be}from"./chunk-MD67S53Z.js";import{f as O,h as ge,i as fe,j as K,p as He,s as xe,w as Ke}from"./chunk-LPINY2IJ.js";import{a as c,d as $e,e as it,f as ut,g as ct}from"./chunk-OXFKZ4BM.js";var $=$e(ut(),1),M=$e(it(),1);var s=$e(ct(),1);var mt=c((n,e)=>{let t=new Set(n.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),o=n.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!t.has(a.name)),r=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:o,showReliabilityWarning:o.length>0||r>0}},"ct"),We="topic:",je=c(n=>{let e=[],t=new Map;for(let o of n)o.topic===void 0?e.push(o):t.set(o.topic,[...t.get(o.topic)??[],o]);return{plain:e,topics:t}},"Be"),rt=c(n=>`${We}${n}`,"He"),pt=c((n,e)=>n.startsWith(We)?(e.get(n.slice(We.length))??[]).map(t=>t.exportName):[n],"ut"),ht=200,gt=ge(G.sendQueueMessage),ft=c(async(n,e,t)=>{let o=(await Promise.allSettled(e.map(async a=>n.query(gt,a,fe(""))))).flatMap((a,l)=>a.status==="rejected"?[{exportName:e[l]?.exportName??"",message:K(a.reason)}]:[]),[r]=o;return r===void 0?null:e.length===1?r.message:t("Not sent to {failed}",{failed:o.map(a=>`${a.exportName}: ${a.message}`).join("; ")})},"ft"),xt=ge(G.replayQueueMessage),yt=ge(G.clearQueueMessages),at=96,Nt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,He)}catch{return"[unserializable]"}},"xt"),bt=c(n=>n.length>at?`${n.slice(0,at)}\u2026`:n,"yt"),qt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","bt"),vt=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"Nt"),nt=c(n=>{let e=(0,$.c)(17),{queue:t}=n,o=`queues-row-${t.exportName}`,r;e[0]!==t.exportName?(r=(0,s.jsx)(S,{className:"font-mono text-xs",children:t.exportName}),e[0]=t.exportName,e[1]=r):r=e[1];let a;e[2]!==t.name?(a=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e[2]=t.name,e[3]=a):a=e[3];let l;e[4]!==t.mode?(l=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:t.mode}),e[4]=t.mode,e[5]=l):l=e[5];let d;e[6]!==t.binding?(d=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:t.binding}),e[6]=t.binding,e[7]=d):d=e[7];let i=t.deadLetterQueue??"\u2014",u;e[8]!==i?(u=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:i}),e[8]=i,e[9]=u):u=e[9];let p;return e[10]!==o||e[11]!==r||e[12]!==a||e[13]!==l||e[14]!==d||e[15]!==u?(p=(0,s.jsxs)(H,{"data-testid":o,children:[r,a,l,d,u]}),e[10]=o,e[11]=r,e[12]=a,e[13]=l,e[14]=d,e[15]=u,e[16]=p):p=e[16],p},"Ve"),St=c(n=>{let e=(0,$.c)(8),{loaded:t,queues:o}=n,r=O(),a;if(e[0]!==t||e[1]!==o||e[2]!==r){let{plain:l,topics:d}=je(o),i;e[4]!==r?(i=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=i):i=e[5];let u;e[6]!==i?(u=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[6]=i,e[7]=u):u=e[7],a=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[u,t&&o.length===0?(0,s.jsx)(he,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,s.jsx)(ke,{className:"overflow-hidden py-0",children:(0,s.jsx)(Be,{className:"px-0",children:(0,s.jsxs)(Re,{"data-testid":"queues-table",children:[(0,s.jsx)(_e,{children:(0,s.jsxs)(H,{children:[(0,s.jsx)(L,{children:r("Export")}),(0,s.jsx)(L,{children:r("Queue")}),(0,s.jsx)(L,{children:r("Mode")}),(0,s.jsx)(L,{children:r("Binding")}),(0,s.jsx)(L,{children:r("Dead-letter")})]})}),(0,s.jsxs)(Je,{children:[l.map(Et),[...d].map(p=>{let[f,x]=p;return(0,s.jsxs)(M.Fragment,{children:[(0,s.jsx)(H,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,s.jsx)(S,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=t,e[1]=o,e[2]=r,e[3]=a}else a=e[3];return a},"qt"),Ct=c(n=>{let e=(0,$.c)(67),{message:t,onReplay:o,replayingId:r}=n,a=O(),l,d,i,u,p,f,x,m,h,N;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==a){let R=Nt(t.body);d=H,f=`queues-message-${t.id}`;let _=t.exportName??t.queue;e[19]!==_?(x=(0,s.jsx)(S,{className:"font-mono text-xs",children:_}),e[19]=_,e[20]=x):x=e[20],e[21]!==t.messageId?(m=(0,s.jsx)(S,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=m):m=e[22],e[23]!==t.attempts?(h=(0,s.jsx)(S,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=h):h=e[24];let k=`queues-outcome-${t.id}`,w;e[25]!==t.outcome?(w=qt(t.outcome),e[25]=t.outcome,e[26]=w):w=e[26];let T;e[27]!==t.outcome||e[28]!==k||e[29]!==w?(T=(0,s.jsx)(me,{"data-testid":k,variant:w,children:t.outcome}),e[27]=t.outcome,e[28]=k,e[29]=w,e[30]=T):T=e[30];let I;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==a?(I=t.deadLettered&&(0,s.jsx)(me,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:a("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=a,e[34]=I):I=e[34],e[35]!==T||e[36]!==I?(N=(0,s.jsx)(S,{children:(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[T,I]})}),e[35]=T,e[36]=I,e[37]=N):N=e[37],l=S,i="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=R,p=bt(R),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=a,e[9]=l,e[10]=d,e[11]=i,e[12]=u,e[13]=p,e[14]=f,e[15]=x,e[16]=m,e[17]=h,e[18]=N}else l=e[9],d=e[10],i=e[11],u=e[12],p=e[13],f=e[14],x=e[15],m=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==i||e[40]!==u||e[41]!==p?(y=(0,s.jsx)(l,{className:i,title:u,children:p}),e[38]=l,e[39]=i,e[40]=u,e[41]=p,e[42]=y):y=e[42];let b;e[43]!==t.capturedAt?(b=Ke(t.capturedAt,"\u2014"),e[43]=t.capturedAt,e[44]=b):b=e[44];let C;e[45]!==b?(C=(0,s.jsx)(S,{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[45]=b,e[46]=C):C=e[46];let q=`queues-replay-${t.id}`,v=r!==null,E;e[47]!==t.id||e[48]!==r||e[49]!==a?(E=r===t.id?a("Replaying\u2026"):a("Replay"),e[47]=t.id,e[48]=r,e[49]=a,e[50]=E):E=e[50];let A;e[51]!==t.id||e[52]!==o||e[53]!==q||e[54]!==v||e[55]!==E?(A=(0,s.jsx)(S,{children:(0,s.jsx)(pe,{"data-id":t.id,"data-testid":q,disabled:v,onClick:o,size:"xs",type:"button",variant:"outline",children:E})}),e[51]=t.id,e[52]=o,e[53]=q,e[54]=v,e[55]=E,e[56]=A):A=e[56];let D;return e[57]!==d||e[58]!==C||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==m||e[63]!==h||e[64]!==N||e[65]!==y?(D=(0,s.jsxs)(d,{"data-testid":f,children:[x,m,h,N,y,C,A]}),e[57]=d,e[58]=C,e[59]=A,e[60]=f,e[61]=x,e[62]=m,e[63]=h,e[64]=N,e[65]=y,e[66]=D):D=e[66],D},"St"),wt=c(n=>{let e=(0,$.c)(29),{hasError:t,messages:o,onClear:r,onReplay:a,replayingId:l}=n,d=O(),i;e[0]!==d?(i=d("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=d,e[1]=i):i=e[1];let u;e[2]!==i?(u=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=u):u=e[3];let p;e[4]!==d?(p=d("Clear the whole message log?"),e[4]=d,e[5]=p):p=e[5];let f=o.length===0,x;e[6]!==d?(x=d("Clear log"),e[6]=d,e[7]=x):x=e[7];let m;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(m=(0,s.jsx)("div",{className:"ml-auto",children:(0,s.jsx)(Ze,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=m):m=e[12];let h;e[13]!==o.length||e[14]!==d?(h=o.length>0&&(0,s.jsx)(me,{"data-testid":"queues-count",variant:"secondary",children:d("{count} messages",{count:o.length})}),e[13]=o.length,e[14]=d,e[15]=h):h=e[15];let N;e[16]!==u||e[17]!==m||e[18]!==h?(N=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,m,h]}),e[16]=u,e[17]=m,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==t||e[21]!==o||e[22]!==a||e[23]!==l||e[24]!==d?(y=!t&&o.length===0?(0,s.jsx)(he,{description:d("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:d("No consumed messages yet.")}):(0,s.jsx)(ke,{className:"overflow-hidden py-0",children:(0,s.jsx)(Be,{className:"px-0",children:(0,s.jsx)(st,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,s.jsxs)(Re,{"data-testid":"queues-messages-table",children:[(0,s.jsx)(_e,{children:(0,s.jsxs)(H,{children:[(0,s.jsx)(L,{children:d("Export")}),(0,s.jsx)(L,{children:d("Message")}),(0,s.jsx)(L,{children:d("Attempts")}),(0,s.jsx)(L,{children:d("Outcome")}),(0,s.jsx)(L,{children:d("Body")}),(0,s.jsx)(L,{children:d("Captured")}),(0,s.jsx)(L,{})]})}),(0,s.jsx)(Je,{children:o.map(C=>(0,s.jsx)(Ct,{message:C,onReplay:a,replayingId:l},C.id))})]})})})}),e[20]=t,e[21]=o,e[22]=a,e[23]=l,e[24]=d,e[25]=y):y=e[25];let b;return e[26]!==N||e[27]!==y?(b=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=b):b=e[28],b},"Et"),It=c(n=>{let e=(0,$.c)(20),{batchMode:t,bodyText:o,delayText:r,onBatchModeChange:a,onBodyChange:l,onDelayChange:d,onSelectExport:i,onSend:u,queues:p,selectedExportName:f,sending:x}=n,m=O(),h;e[0]!==m?(h=m("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=m,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==t||e[5]!==o||e[6]!==r||e[7]!==a||e[8]!==l||e[9]!==d||e[10]!==i||e[11]!==u||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==m?(y=p.length===0?(0,s.jsx)(he,{description:m("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:m("No queues to send to")}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("select",{"aria-label":m("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:i,value:f,children:[p.map(At),[...je(p).topics].map(C=>{let[q,v]=C;return(0,s.jsx)("option",{value:rt(q),children:m("{topic} (topic \u2192 {count} subscriptions)",{count:v.length,topic:q})},q)})]}),(0,s.jsx)(Ge,{"aria-label":m("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:d,placeholder:m("Delay (s)"),type:"number",value:r}),(0,s.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,s.jsx)("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"}),m("Send as batch (JSON array)")]}),(0,s.jsx)(pe,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:u,type:"button",children:m(x?"Sending\u2026":"Send message")})]}),(0,s.jsx)(et,{"aria-label":m("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:o})]}),e[4]=t,e[5]=o,e[6]=r,e[7]=a,e[8]=l,e[9]=d,e[10]=i,e[11]=u,e[12]=p,e[13]=f,e[14]=x,e[15]=m,e[16]=y):y=e[16];let b;return e[17]!==N||e[18]!==y?(b=(0,s.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=b):b=e[19],b},"Tt"),Qt=c((n,e,t,o)=>{let r=null,a=n.trim();if(a!=="")try{r=JSON.parse(a)}catch{return{error:o("Body must be valid JSON.")}}let l,d=e.trim();if(d!==""){let i=Number(d);if(!Number.isFinite(i)||i<0)return{error:o("Delay must be a non-negative number of seconds.")};l=i}return t&&!Array.isArray(r)?{error:o("Batch mode needs a JSON array body \u2014 each element is enqueued as one message.")}:{body:r,delaySeconds:l}},"Ct"),Lt=c(n=>{let e=(0,$.c)(11),{deadLetteredCount:t,queuesWithoutDlq:o}=n,r=O(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),e[0]=a):a=e[0];let l;e[1]!==o||e[2]!==r?(l=o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"font-medium",children:r("No dead-letter queue on {queues}.",{queues:o.map(Tt).join(", ")})}),(0,s.jsx)("p",{className:"text-muted-foreground",children:r("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),e[1]=o,e[2]=r,e[3]=l):l=e[3];let d;e[4]!==t||e[5]!==o.length||e[6]!==r?(d=t>0&&(0,s.jsx)("p",{className:o.length>0?"text-muted-foreground":"font-medium",children:t===1?r("1 message was recently dead-lettered."):r("{count} messages were recently dead-lettered.",{count:t})}),e[4]=t,e[5]=o.length,e[6]=r,e[7]=d):d=e[7];let i;return e[8]!==l||e[9]!==d?(i=(0,s.jsx)(Xe,{icon:a,testId:"queues-dlq-warning",variant:"warning",children:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[l,d]})}),e[8]=l,e[9]=d,e[10]=i):i=e[10],i},"_t"),Zt=c(n=>{let e=(0,$.c)(76),{limit:t}=n,o=t??ht,r=Ve(),a=O(),[l,d]=(0,M.useState)("declared"),[i,u]=(0,M.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:m}=Oe(G.listQueues,p),h;e[1]!==o?(h={limit:o},e[1]=o,e[2]=h):h=e[2];let{data:N,error:y,errorSource:b,poll:C,refetch:q}=Oe(G.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Dt):[],E=N?.entries??[],{deadLetteredCount:A,queuesWithoutDlq:D,showReliabilityWarning:R}=mt(v,E),[_,k]=(0,M.useState)(""),[w,T]=(0,M.useState)(""),[I,ye]=(0,M.useState)(""),[B,Ne]=(0,M.useState)(!1),[be,V]=(0,M.useState)(!1),[qe,X]=(0,M.useState)(null),{topics:Y}=je(v),Fe=[...v.map($t),...[...Y.keys()].map(kt)],J=Fe.includes(_)?_:Fe[0]??"",ze=l==="messages"?y:x,ot=l==="messages"?b:m,ve=ze??i,Se=ze===null?i:ot;tt(C,l==="messages");let Z;e[3]!==B||e[4]!==w||e[5]!==r||e[6]!==I||e[7]!==q||e[8]!==J||e[9]!==V||e[10]!==a||e[11]!==Y?(Z=c(async()=>{u(null);let g=J;if(g==="")return;let Q=Qt(w,I,B,a);if("error"in Q){u(Q.error);return}let{body:Pe,delaySeconds:Ue}=Q;V(!0);let lt=pt(g,Y).map(ce=>B?{batch:Pe,delaySeconds:Ue,exportName:ce}:{body:Pe,delaySeconds:Ue,exportName:ce});try{u(await ft(r,lt,a)),q()}catch(ce){u(K(ce))}V(!1)},"K"),e[3]=B,e[4]=w,e[5]=r,e[6]=I,e[7]=q,e[8]=J,e[9]=V,e[10]=a,e[11]=Y,e[12]=Z):Z=e[12];let Ce=Z,ee;e[13]!==r||e[14]!==q||e[15]!==X?(ee=c(async g=>{u(null),X(g);try{await r.query(xt,{id:g},fe("")),q()}catch(Q){u(K(Q))}X(null)},"Z"),e[13]=r,e[14]=q,e[15]=X,e[16]=ee):ee=e[16];let we=ee,te;e[17]!==r||e[18]!==q?(te=c(async()=>{u(null);try{await r.query(yt,{},fe("")),q()}catch(g){u(K(g))}},"ee"),e[17]=r,e[18]=q,e[19]=te):te=e[19];let Ie=te,se;e[20]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{let Q=g.currentTarget.dataset.tab;(Q==="declared"||Q==="messages"||Q==="send")&&d(Q)},"te"),e[20]=se):se=e[20];let dt=se,ae;e[21]!==k?(ae=c(g=>{k(g.currentTarget.value)},"se"),e[21]=k,e[22]=ae):ae=e[22];let Qe=ae,re;e[23]!==T?(re=c(g=>{T(g.currentTarget.value)},"re"),e[23]=T,e[24]=re):re=e[24];let Le=re,ne;e[25]!==ye?(ne=c(g=>{ye(g.currentTarget.value)},"ae"),e[25]=ye,e[26]=ne):ne=e[26];let Ee=ne,oe;e[27]!==Ne?(oe=c(g=>{Ne(g.currentTarget.checked)},"ne"),e[27]=Ne,e[28]=oe):oe=e[28];let Me=oe,de;e[29]!==Ce?(de=c(()=>{xe(Ce())},"oe"),e[29]=Ce,e[30]=de):de=e[30];let Ae=de,le;e[31]!==we?(le=c(g=>{let{id:Q}=g.currentTarget.dataset;Q!==void 0&&xe(we(Q))},"le"),e[31]=we,e[32]=le):le=e[32];let Te=le,ie;e[33]!==Ie?(ie=c(()=>{xe(Ie())},"ie"),e[33]=Ie,e[34]=ie):ie=e[34];let De=ie,W;e[35]!==a||e[36]!==l?(W=(0,s.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,s.jsx)(pe,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:dt,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:vt(g,a)},g))}),e[35]=a,e[36]=l,e[37]=W):W=e[37];let j;e[38]!==ve||e[39]!==Se?(j=ve!==null&&(0,s.jsx)(Ye,{error:Se,testId:"queues-error"}),e[38]=ve,e[39]=Se,e[40]=j):j=e[40];let F;e[41]!==A||e[42]!==D||e[43]!==R?(F=R&&(0,s.jsx)(Lt,{deadLetteredCount:A,queuesWithoutDlq:D}),e[41]=A,e[42]=D,e[43]=R,e[44]=F):F=e[44];let z;e[45]!==v||e[46]!==f||e[47]!==l?(z=l==="declared"&&(0,s.jsx)(St,{loaded:f!==void 0,queues:v}),e[45]=v,e[46]=f,e[47]=l,e[48]=z):z=e[48];let P;e[49]!==E||e[50]!==y||e[51]!==De||e[52]!==Te||e[53]!==qe||e[54]!==l?(P=l==="messages"&&(0,s.jsx)(wt,{hasError:y!==null,messages:E,onClear:De,onReplay:Te,replayingId:qe}),e[49]=E,e[50]=y,e[51]=De,e[52]=Te,e[53]=qe,e[54]=l,e[55]=P):P=e[55];let U;e[56]!==B||e[57]!==w||e[58]!==I||e[59]!==Me||e[60]!==Le||e[61]!==Ee||e[62]!==Qe||e[63]!==Ae||e[64]!==v||e[65]!==J||e[66]!==be||e[67]!==l?(U=l==="send"&&(0,s.jsx)(It,{batchMode:B,bodyText:w,delayText:I,onBatchModeChange:Me,onBodyChange:Le,onDelayChange:Ee,onSelectExport:Qe,onSend:Ae,queues:v,selectedExportName:J,sending:be}),e[56]=B,e[57]=w,e[58]=I,e[59]=Me,e[60]=Le,e[61]=Ee,e[62]=Qe,e[63]=Ae,e[64]=v,e[65]=J,e[66]=be,e[67]=l,e[68]=U):U=e[68];let ue;return e[69]!==W||e[70]!==j||e[71]!==F||e[72]!==z||e[73]!==P||e[74]!==U?(ue=(0,s.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[W,j,F,z,P,U]}),e[69]=W,e[70]=j,e[71]=F,e[72]=z,e[73]=P,e[74]=U,e[75]=ue):ue=e[75],ue},"ts");function Et(n){return(0,s.jsx)(nt,{queue:n},n.exportName)}c(Et,"vt");function Mt(n){return(0,s.jsx)(nt,{queue:n},n.exportName)}c(Mt,"wt");function At(n){return(0,s.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"Qt");function Tt(n){return n.name}c(Tt,"At");function Dt(n,e){return n.exportName.localeCompare(e.exportName)}c(Dt,"It");function $t(n){return n.exportName}c($t,"Mt");function kt(n){return rt(n)}c(kt,"Lt");export{Zt as default};
|
|
1
|
+
import{a as st}from"./chunk-X5KWBDTF.js";import"./chunk-A566HCBX.js";import{a as et}from"./chunk-P6L6ABWO.js";import{a as tt}from"./chunk-W4X4J7BU.js";import"./chunk-W2BCSK5S.js";import{a as Ze}from"./chunk-ZWDORIZY.js";import{i as Ge}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as pe}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import{b as me}from"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{a as Ye}from"./chunk-DSTNWB4N.js";import{a as Xe}from"./chunk-OSJ7HV7B.js";import"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import{a as G}from"./chunk-6UTZXEW3.js";import{c as Oe}from"./chunk-ZKPRORLI.js";import{p as Ve}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import{a as he}from"./chunk-3Y5K3IQO.js";import{a as Re,b as _e,c as Je,d as H,e as L,f as S}from"./chunk-CW57Q264.js";import{a as ke,e as Be}from"./chunk-MD67S53Z.js";import{f as O,h as ge,i as fe,j as K,p as He,s as xe,w as Ke}from"./chunk-LPINY2IJ.js";import{a as c,d as $e,e as it,f as ut,g as ct}from"./chunk-OXFKZ4BM.js";var $=$e(ut(),1),M=$e(it(),1);var s=$e(ct(),1);var mt=c((n,e)=>{let t=new Set(n.map(a=>a.deadLetterQueue).filter(a=>typeof a=="string"&&a!=="")),o=n.filter(a=>(a.deadLetterQueue===void 0||a.deadLetterQueue==="")&&!t.has(a.name)),r=e.filter(a=>a.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:o,showReliabilityWarning:o.length>0||r>0}},"ct"),We="topic:",je=c(n=>{let e=[],t=new Map;for(let o of n)o.topic===void 0?e.push(o):t.set(o.topic,[...t.get(o.topic)??[],o]);return{plain:e,topics:t}},"Be"),rt=c(n=>`${We}${n}`,"He"),pt=c((n,e)=>n.startsWith(We)?(e.get(n.slice(We.length))??[]).map(t=>t.exportName):[n],"ut"),ht=200,gt=ge(G.sendQueueMessage),ft=c(async(n,e,t)=>{let o=(await Promise.allSettled(e.map(async a=>n.query(gt,a,fe(""))))).flatMap((a,l)=>a.status==="rejected"?[{exportName:e[l]?.exportName??"",message:K(a.reason)}]:[]),[r]=o;return r===void 0?null:e.length===1?r.message:t("Not sent to {failed}",{failed:o.map(a=>`${a.exportName}: ${a.message}`).join("; ")})},"ft"),xt=ge(G.replayQueueMessage),yt=ge(G.clearQueueMessages),at=96,Nt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,He)}catch{return"[unserializable]"}},"xt"),bt=c(n=>n.length>at?`${n.slice(0,at)}\u2026`:n,"yt"),qt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","bt"),vt=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"Nt"),nt=c(n=>{let e=(0,$.c)(17),{queue:t}=n,o=`queues-row-${t.exportName}`,r;e[0]!==t.exportName?(r=(0,s.jsx)(S,{className:"font-mono text-xs",children:t.exportName}),e[0]=t.exportName,e[1]=r):r=e[1];let a;e[2]!==t.name?(a=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e[2]=t.name,e[3]=a):a=e[3];let l;e[4]!==t.mode?(l=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:t.mode}),e[4]=t.mode,e[5]=l):l=e[5];let d;e[6]!==t.binding?(d=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:t.binding}),e[6]=t.binding,e[7]=d):d=e[7];let i=t.deadLetterQueue??"\u2014",u;e[8]!==i?(u=(0,s.jsx)(S,{className:"font-mono text-xs text-muted-foreground",children:i}),e[8]=i,e[9]=u):u=e[9];let p;return e[10]!==o||e[11]!==r||e[12]!==a||e[13]!==l||e[14]!==d||e[15]!==u?(p=(0,s.jsxs)(H,{"data-testid":o,children:[r,a,l,d,u]}),e[10]=o,e[11]=r,e[12]=a,e[13]=l,e[14]=d,e[15]=u,e[16]=p):p=e[16],p},"Ve"),St=c(n=>{let e=(0,$.c)(8),{loaded:t,queues:o}=n,r=O(),a;if(e[0]!==t||e[1]!==o||e[2]!==r){let{plain:l,topics:d}=je(o),i;e[4]!==r?(i=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=i):i=e[5];let u;e[6]!==i?(u=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[6]=i,e[7]=u):u=e[7],a=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[u,t&&o.length===0?(0,s.jsx)(he,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,s.jsx)(ke,{className:"overflow-hidden py-0",children:(0,s.jsx)(Be,{className:"px-0",children:(0,s.jsxs)(Re,{"data-testid":"queues-table",children:[(0,s.jsx)(_e,{children:(0,s.jsxs)(H,{children:[(0,s.jsx)(L,{children:r("Export")}),(0,s.jsx)(L,{children:r("Queue")}),(0,s.jsx)(L,{children:r("Mode")}),(0,s.jsx)(L,{children:r("Binding")}),(0,s.jsx)(L,{children:r("Dead-letter")})]})}),(0,s.jsxs)(Je,{children:[l.map(Et),[...d].map(p=>{let[f,x]=p;return(0,s.jsxs)(M.Fragment,{children:[(0,s.jsx)(H,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,s.jsx)(S,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=t,e[1]=o,e[2]=r,e[3]=a}else a=e[3];return a},"qt"),Ct=c(n=>{let e=(0,$.c)(67),{message:t,onReplay:o,replayingId:r}=n,a=O(),l,d,i,u,p,f,x,m,h,N;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==a){let R=Nt(t.body);d=H,f=`queues-message-${t.id}`;let _=t.exportName??t.queue;e[19]!==_?(x=(0,s.jsx)(S,{className:"font-mono text-xs",children:_}),e[19]=_,e[20]=x):x=e[20],e[21]!==t.messageId?(m=(0,s.jsx)(S,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=m):m=e[22],e[23]!==t.attempts?(h=(0,s.jsx)(S,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=h):h=e[24];let k=`queues-outcome-${t.id}`,w;e[25]!==t.outcome?(w=qt(t.outcome),e[25]=t.outcome,e[26]=w):w=e[26];let T;e[27]!==t.outcome||e[28]!==k||e[29]!==w?(T=(0,s.jsx)(me,{"data-testid":k,variant:w,children:t.outcome}),e[27]=t.outcome,e[28]=k,e[29]=w,e[30]=T):T=e[30];let I;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==a?(I=t.deadLettered&&(0,s.jsx)(me,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:a("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=a,e[34]=I):I=e[34],e[35]!==T||e[36]!==I?(N=(0,s.jsx)(S,{children:(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[T,I]})}),e[35]=T,e[36]=I,e[37]=N):N=e[37],l=S,i="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",u=R,p=bt(R),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=a,e[9]=l,e[10]=d,e[11]=i,e[12]=u,e[13]=p,e[14]=f,e[15]=x,e[16]=m,e[17]=h,e[18]=N}else l=e[9],d=e[10],i=e[11],u=e[12],p=e[13],f=e[14],x=e[15],m=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==i||e[40]!==u||e[41]!==p?(y=(0,s.jsx)(l,{className:i,title:u,children:p}),e[38]=l,e[39]=i,e[40]=u,e[41]=p,e[42]=y):y=e[42];let b;e[43]!==t.capturedAt?(b=Ke(t.capturedAt,"\u2014"),e[43]=t.capturedAt,e[44]=b):b=e[44];let C;e[45]!==b?(C=(0,s.jsx)(S,{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[45]=b,e[46]=C):C=e[46];let q=`queues-replay-${t.id}`,v=r!==null,E;e[47]!==t.id||e[48]!==r||e[49]!==a?(E=r===t.id?a("Replaying\u2026"):a("Replay"),e[47]=t.id,e[48]=r,e[49]=a,e[50]=E):E=e[50];let A;e[51]!==t.id||e[52]!==o||e[53]!==q||e[54]!==v||e[55]!==E?(A=(0,s.jsx)(S,{children:(0,s.jsx)(pe,{"data-id":t.id,"data-testid":q,disabled:v,onClick:o,size:"xs",type:"button",variant:"outline",children:E})}),e[51]=t.id,e[52]=o,e[53]=q,e[54]=v,e[55]=E,e[56]=A):A=e[56];let D;return e[57]!==d||e[58]!==C||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==m||e[63]!==h||e[64]!==N||e[65]!==y?(D=(0,s.jsxs)(d,{"data-testid":f,children:[x,m,h,N,y,C,A]}),e[57]=d,e[58]=C,e[59]=A,e[60]=f,e[61]=x,e[62]=m,e[63]=h,e[64]=N,e[65]=y,e[66]=D):D=e[66],D},"St"),wt=c(n=>{let e=(0,$.c)(29),{hasError:t,messages:o,onClear:r,onReplay:a,replayingId:l}=n,d=O(),i;e[0]!==d?(i=d("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=d,e[1]=i):i=e[1];let u;e[2]!==i?(u=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:i}),e[2]=i,e[3]=u):u=e[3];let p;e[4]!==d?(p=d("Clear the whole message log?"),e[4]=d,e[5]=p):p=e[5];let f=o.length===0,x;e[6]!==d?(x=d("Clear log"),e[6]=d,e[7]=x):x=e[7];let m;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(m=(0,s.jsx)("div",{className:"ml-auto",children:(0,s.jsx)(Ze,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=m):m=e[12];let h;e[13]!==o.length||e[14]!==d?(h=o.length>0&&(0,s.jsx)(me,{"data-testid":"queues-count",variant:"secondary",children:d("{count} messages",{count:o.length})}),e[13]=o.length,e[14]=d,e[15]=h):h=e[15];let N;e[16]!==u||e[17]!==m||e[18]!==h?(N=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[u,m,h]}),e[16]=u,e[17]=m,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==t||e[21]!==o||e[22]!==a||e[23]!==l||e[24]!==d?(y=!t&&o.length===0?(0,s.jsx)(he,{description:d("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:d("No consumed messages yet.")}):(0,s.jsx)(ke,{className:"overflow-hidden py-0",children:(0,s.jsx)(Be,{className:"px-0",children:(0,s.jsx)(st,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,s.jsxs)(Re,{"data-testid":"queues-messages-table",children:[(0,s.jsx)(_e,{children:(0,s.jsxs)(H,{children:[(0,s.jsx)(L,{children:d("Export")}),(0,s.jsx)(L,{children:d("Message")}),(0,s.jsx)(L,{children:d("Attempts")}),(0,s.jsx)(L,{children:d("Outcome")}),(0,s.jsx)(L,{children:d("Body")}),(0,s.jsx)(L,{children:d("Captured")}),(0,s.jsx)(L,{})]})}),(0,s.jsx)(Je,{children:o.map(C=>(0,s.jsx)(Ct,{message:C,onReplay:a,replayingId:l},C.id))})]})})})}),e[20]=t,e[21]=o,e[22]=a,e[23]=l,e[24]=d,e[25]=y):y=e[25];let b;return e[26]!==N||e[27]!==y?(b=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=b):b=e[28],b},"Et"),It=c(n=>{let e=(0,$.c)(20),{batchMode:t,bodyText:o,delayText:r,onBatchModeChange:a,onBodyChange:l,onDelayChange:d,onSelectExport:i,onSend:u,queues:p,selectedExportName:f,sending:x}=n,m=O(),h;e[0]!==m?(h=m("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=m,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==t||e[5]!==o||e[6]!==r||e[7]!==a||e[8]!==l||e[9]!==d||e[10]!==i||e[11]!==u||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==m?(y=p.length===0?(0,s.jsx)(he,{description:m("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:m("No queues to send to")}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("select",{"aria-label":m("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:i,value:f,children:[p.map(At),[...je(p).topics].map(C=>{let[q,v]=C;return(0,s.jsx)("option",{value:rt(q),children:m("{topic} (topic \u2192 {count} subscriptions)",{count:v.length,topic:q})},q)})]}),(0,s.jsx)(Ge,{"aria-label":m("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:d,placeholder:m("Delay (s)"),type:"number",value:r}),(0,s.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,s.jsx)("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:a,type:"checkbox"}),m("Send as batch (JSON array)")]}),(0,s.jsx)(pe,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:u,type:"button",children:m(x?"Sending\u2026":"Send message")})]}),(0,s.jsx)(et,{"aria-label":m("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:o})]}),e[4]=t,e[5]=o,e[6]=r,e[7]=a,e[8]=l,e[9]=d,e[10]=i,e[11]=u,e[12]=p,e[13]=f,e[14]=x,e[15]=m,e[16]=y):y=e[16];let b;return e[17]!==N||e[18]!==y?(b=(0,s.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=b):b=e[19],b},"Tt"),Qt=c((n,e,t,o)=>{let r=null,a=n.trim();if(a!=="")try{r=JSON.parse(a)}catch{return{error:o("Body must be valid JSON.")}}let l,d=e.trim();if(d!==""){let i=Number(d);if(!Number.isFinite(i)||i<0)return{error:o("Delay must be a non-negative number of seconds.")};l=i}return t&&!Array.isArray(r)?{error:o("Batch mode needs a JSON array body \u2014 each element is enqueued as one message.")}:{body:r,delaySeconds:l}},"Ct"),Lt=c(n=>{let e=(0,$.c)(11),{deadLetteredCount:t,queuesWithoutDlq:o}=n,r=O(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=(0,s.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),e[0]=a):a=e[0];let l;e[1]!==o||e[2]!==r?(l=o.length>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"font-medium",children:r("No dead-letter queue on {queues}.",{queues:o.map(Tt).join(", ")})}),(0,s.jsx)("p",{className:"text-muted-foreground",children:r("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),e[1]=o,e[2]=r,e[3]=l):l=e[3];let d;e[4]!==t||e[5]!==o.length||e[6]!==r?(d=t>0&&(0,s.jsx)("p",{className:o.length>0?"text-muted-foreground":"font-medium",children:t===1?r("1 message was recently dead-lettered."):r("{count} messages were recently dead-lettered.",{count:t})}),e[4]=t,e[5]=o.length,e[6]=r,e[7]=d):d=e[7];let i;return e[8]!==l||e[9]!==d?(i=(0,s.jsx)(Xe,{icon:a,testId:"queues-dlq-warning",variant:"warning",children:(0,s.jsxs)("div",{className:"flex flex-col gap-1",children:[l,d]})}),e[8]=l,e[9]=d,e[10]=i):i=e[10],i},"_t"),Zt=c(n=>{let e=(0,$.c)(76),{limit:t}=n,o=t??ht,r=Ve(),a=O(),[l,d]=(0,M.useState)("declared"),[i,u]=(0,M.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:m}=Oe(G.listQueues,p),h;e[1]!==o?(h={limit:o},e[1]=o,e[2]=h):h=e[2];let{data:N,error:y,errorSource:b,poll:C,refetch:q}=Oe(G.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Dt):[],E=N?.entries??[],{deadLetteredCount:A,queuesWithoutDlq:D,showReliabilityWarning:R}=mt(v,E),[_,k]=(0,M.useState)(""),[w,T]=(0,M.useState)(""),[I,ye]=(0,M.useState)(""),[B,Ne]=(0,M.useState)(!1),[be,V]=(0,M.useState)(!1),[qe,X]=(0,M.useState)(null),{topics:Y}=je(v),Fe=[...v.map($t),...[...Y.keys()].map(kt)],J=Fe.includes(_)?_:Fe[0]??"",ze=l==="messages"?y:x,ot=l==="messages"?b:m,ve=ze??i,Se=ze===null?i:ot;tt(C,l==="messages");let Z;e[3]!==B||e[4]!==w||e[5]!==r||e[6]!==I||e[7]!==q||e[8]!==J||e[9]!==V||e[10]!==a||e[11]!==Y?(Z=c(async()=>{u(null);let g=J;if(g==="")return;let Q=Qt(w,I,B,a);if("error"in Q){u(Q.error);return}let{body:Pe,delaySeconds:Ue}=Q;V(!0);let lt=pt(g,Y).map(ce=>B?{batch:Pe,delaySeconds:Ue,exportName:ce}:{body:Pe,delaySeconds:Ue,exportName:ce});try{u(await ft(r,lt,a)),q()}catch(ce){u(K(ce))}V(!1)},"K"),e[3]=B,e[4]=w,e[5]=r,e[6]=I,e[7]=q,e[8]=J,e[9]=V,e[10]=a,e[11]=Y,e[12]=Z):Z=e[12];let Ce=Z,ee;e[13]!==r||e[14]!==q||e[15]!==X?(ee=c(async g=>{u(null),X(g);try{await r.query(xt,{id:g},fe("")),q()}catch(Q){u(K(Q))}X(null)},"Z"),e[13]=r,e[14]=q,e[15]=X,e[16]=ee):ee=e[16];let we=ee,te;e[17]!==r||e[18]!==q?(te=c(async()=>{u(null);try{await r.query(yt,{},fe("")),q()}catch(g){u(K(g))}},"ee"),e[17]=r,e[18]=q,e[19]=te):te=e[19];let Ie=te,se;e[20]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{let Q=g.currentTarget.dataset.tab;(Q==="declared"||Q==="messages"||Q==="send")&&d(Q)},"te"),e[20]=se):se=e[20];let dt=se,ae;e[21]!==k?(ae=c(g=>{k(g.currentTarget.value)},"se"),e[21]=k,e[22]=ae):ae=e[22];let Qe=ae,re;e[23]!==T?(re=c(g=>{T(g.currentTarget.value)},"re"),e[23]=T,e[24]=re):re=e[24];let Le=re,ne;e[25]!==ye?(ne=c(g=>{ye(g.currentTarget.value)},"ae"),e[25]=ye,e[26]=ne):ne=e[26];let Ee=ne,oe;e[27]!==Ne?(oe=c(g=>{Ne(g.currentTarget.checked)},"ne"),e[27]=Ne,e[28]=oe):oe=e[28];let Me=oe,de;e[29]!==Ce?(de=c(()=>{xe(Ce())},"oe"),e[29]=Ce,e[30]=de):de=e[30];let Ae=de,le;e[31]!==we?(le=c(g=>{let{id:Q}=g.currentTarget.dataset;Q!==void 0&&xe(we(Q))},"le"),e[31]=we,e[32]=le):le=e[32];let Te=le,ie;e[33]!==Ie?(ie=c(()=>{xe(Ie())},"ie"),e[33]=Ie,e[34]=ie):ie=e[34];let De=ie,W;e[35]!==a||e[36]!==l?(W=(0,s.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,s.jsx)(pe,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:dt,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:vt(g,a)},g))}),e[35]=a,e[36]=l,e[37]=W):W=e[37];let j;e[38]!==ve||e[39]!==Se?(j=ve!==null&&(0,s.jsx)(Ye,{error:Se,testId:"queues-error"}),e[38]=ve,e[39]=Se,e[40]=j):j=e[40];let F;e[41]!==A||e[42]!==D||e[43]!==R?(F=R&&(0,s.jsx)(Lt,{deadLetteredCount:A,queuesWithoutDlq:D}),e[41]=A,e[42]=D,e[43]=R,e[44]=F):F=e[44];let z;e[45]!==v||e[46]!==f||e[47]!==l?(z=l==="declared"&&(0,s.jsx)(St,{loaded:f!==void 0,queues:v}),e[45]=v,e[46]=f,e[47]=l,e[48]=z):z=e[48];let P;e[49]!==E||e[50]!==y||e[51]!==De||e[52]!==Te||e[53]!==qe||e[54]!==l?(P=l==="messages"&&(0,s.jsx)(wt,{hasError:y!==null,messages:E,onClear:De,onReplay:Te,replayingId:qe}),e[49]=E,e[50]=y,e[51]=De,e[52]=Te,e[53]=qe,e[54]=l,e[55]=P):P=e[55];let U;e[56]!==B||e[57]!==w||e[58]!==I||e[59]!==Me||e[60]!==Le||e[61]!==Ee||e[62]!==Qe||e[63]!==Ae||e[64]!==v||e[65]!==J||e[66]!==be||e[67]!==l?(U=l==="send"&&(0,s.jsx)(It,{batchMode:B,bodyText:w,delayText:I,onBatchModeChange:Me,onBodyChange:Le,onDelayChange:Ee,onSelectExport:Qe,onSend:Ae,queues:v,selectedExportName:J,sending:be}),e[56]=B,e[57]=w,e[58]=I,e[59]=Me,e[60]=Le,e[61]=Ee,e[62]=Qe,e[63]=Ae,e[64]=v,e[65]=J,e[66]=be,e[67]=l,e[68]=U):U=e[68];let ue;return e[69]!==W||e[70]!==j||e[71]!==F||e[72]!==z||e[73]!==P||e[74]!==U?(ue=(0,s.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[W,j,F,z,P,U]}),e[69]=W,e[70]=j,e[71]=F,e[72]=z,e[73]=P,e[74]=U,e[75]=ue):ue=e[75],ue},"ts");function Et(n){return(0,s.jsx)(nt,{queue:n},n.exportName)}c(Et,"vt");function Mt(n){return(0,s.jsx)(nt,{queue:n},n.exportName)}c(Mt,"wt");function At(n){return(0,s.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"Qt");function Tt(n){return n.name}c(Tt,"At");function Dt(n,e){return n.exportName.localeCompare(e.exportName)}c(Dt,"It");function $t(n){return n.exportName}c($t,"Mt");function kt(n){return rt(n)}c(kt,"Lt");export{Zt as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{a as at}from"./chunk-DBVJ5VLI.js";import{i as Ee}from"./chunk-LUHXNZI4.js";import{a as Fe}from"./chunk-2O6KKVH2.js";import{b as We}from"./chunk-6I42AM75.js";import{a as D}from"./chunk-
|
|
1
|
+
import{a as at}from"./chunk-DBVJ5VLI.js";import{i as Ee}from"./chunk-LUHXNZI4.js";import{a as Fe}from"./chunk-2O6KKVH2.js";import{b as We}from"./chunk-6I42AM75.js";import{a as D}from"./chunk-6UTZXEW3.js";import{c as _e}from"./chunk-ZKPRORLI.js";import{p as Te}from"./chunk-OIDFWEJX.js";import{a as Ze}from"./chunk-3Y5K3IQO.js";import{a as j,e as Ue}from"./chunk-MD67S53Z.js";import{b as Ve,f as $,h as Qe,i as Xe,o as et,s as Ne,u as tt,v as nt}from"./chunk-LPINY2IJ.js";import{a as c,d as ze,e as dt,f as mt,g as ut}from"./chunk-OXFKZ4BM.js";var _=ze(mt(),1);var B=ze(dt(),1);var a=ze(ut(),1);var pt=Qe(D.studioFeatures),Ge={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},ft=c(t=>{if(t===null||typeof t!="object")return;let{id:e,name:r,unsupported:n}=t;if(!(typeof e!="string"||typeof r!="string"||!Array.isArray(n)))return{id:e,name:r,unsupported:n.filter(s=>typeof s=="string")}},"ut"),ht=c(t=>{if(t===null||typeof t!="object")return Ge;let e=t,r=c(n=>typeof e[n]=="boolean"?e[n]:!0,"n");return{analytics:r("analytics"),auth:r("auth"),containers:r("containers"),flags:r("flags"),kv:r("kv"),mail:r("mail"),notifications:r("notifications"),payments:r("payments"),privacy:r("privacy"),platform:ft(e.platform),queues:r("queues"),scheduler:r("scheduler"),storage:r("storage"),vectors:r("vectors"),workflows:r("workflows")}},"mt"),gt={...Ge,settled:!1},xt=c(()=>{let t=(0,_.c)(3),e=Te(),[r,n]=(0,B.useState)(void 0),s,l;return t[0]!==e?(s=c(()=>{let i=new AbortController;return Ne((async()=>{let o;try{o={...ht(await e.query(pt,{},Xe(""))),settled:!0}}catch{o={...Ge,settled:!0}}i.signal.aborted||n({client:e,features:o})})()),()=>{i.abort()}},"l"),l=[e],t[0]=e,t[1]=s,t[2]=l):(s=t[1],l=t[2]),(0,B.useEffect)(s,l),r?.client===e?r.features:gt},"pt"),bt=c(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},"ht"),yt=c(t=>{let e=(0,_.c)(24),{group:r}=t,n=$(),s=Ee(),l;e[0]!==r.tab||e[1]!==s?(l=c(()=>{Ne(s({to:`/${r.tab}`}))},"r"),e[0]=r.tab,e[1]=s,e[2]=l):l=e[2];let i=l,o=r.bindings.length,d;e[3]!==r.label?(d=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:r.label}),e[3]=r.label,e[4]=d):d=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=(0,a.jsx)(bt,{}),e[5]=u):u=e[5];let p;e[6]!==d?(p=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[d,u]}),e[6]=d,e[7]=p):p=e[7];let m;e[8]!==o||e[9]!==n?(m=o===1?n("1 binding"):n("{count} bindings",{count:o}),e[8]=o,e[9]=n,e[10]=m):m=e[10];let f;e[11]!==m?(f=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:m}),e[11]=m,e[12]=f):f=e[12];let h;e[13]!==o||e[14]!==r.bindings?(h=o>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:r.bindings.map(_t)}),e[13]=o,e[14]=r.bindings,e[15]=h):h=e[15];let g;e[16]!==p||e[17]!==f||e[18]!==h?(g=(0,a.jsxs)(Ue,{className:"flex flex-col gap-2 py-4",children:[p,f,h]}),e[16]=p,e[17]=f,e[18]=h,e[19]=g):g=e[19];let x;return e[20]!==r.testId||e[21]!==i||e[22]!==g?(x=(0,a.jsx)(j,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":r.testId,onClick:i,children:g}),e[20]=r.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},"gt"),rt=["kv","files","vectors"],vt=c((t,e)=>[...t.filter(r=>r.tab!==e.tab),e].toSorted((r,n)=>rt.indexOf(r.tab)-rt.indexOf(n.tab)),"xt"),Nt=c(()=>{let t=(0,_.c)(19),e=Te(),r=xt(),n=$(),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=[],t[0]=s):s=t[0];let[l,i]=(0,B.useState)(s),o,d;if(t[1]!==e||t[2]!==r.kv||t[3]!==r.storage||t[4]!==r.vectors||t[5]!==n?(o=c(()=>{let g={cancelled:!1},x=[{enabled:r.kv,label:n("KV Namespaces"),load:c(async()=>(await e.listKvNamespaces()).map(wt),"load"),tab:"kv",testId:"home-binding-kv"},{enabled:r.storage,label:n("R2 Buckets"),load:c(()=>e.listStorageBuckets(),"load"),tab:"files",testId:"home-binding-r2"},{enabled:r.vectors,label:n("Vectorize Indexes"),load:c(async()=>(await e.listVectorIndexes()).map(kt),"load"),tab:"vectors",testId:"home-binding-vectors"}];for(let b of x)b.enabled&&Ne((async()=>{try{let v=await b.load();if(!g.cancelled){let w={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(k=>vt(k,w))}}catch{}})());return()=>{g.cancelled=!0}},"o"),d=[e,r.kv,r.storage,r.vectors,n],t[1]=e,t[2]=r.kv,t[3]=r.storage,t[4]=r.vectors,t[5]=n,t[6]=o,t[7]=d):(o=t[6],d=t[7]),(0,B.useEffect)(o,d),l.length===0)return null;let u;t[8]!==n?(u=n("Bindings"),t[8]=n,t[9]=u):u=t[9];let p;t[10]!==u?(p=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=p):p=t[11];let m;t[12]!==l?(m=l.map(St),t[12]=l,t[13]=m):m=t[13];let f;t[14]!==m?(f=(0,a.jsx)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:m}),t[14]=m,t[15]=f):f=t[15];let h;return t[16]!==p||t[17]!==f?(h=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[p,f]}),t[16]=p,t[17]=f,t[18]=h):h=t[18],h},"bt");function _t(t){return(0,a.jsx)(We,{variant:"secondary",children:t},t)}c(_t,"yt");function wt(t){return t.binding}c(wt,"vt");function kt(t){return t.name}c(kt,"Nt");function St(t){return(0,a.jsx)(yt,{group:t},t.tab)}c(St,"_t");var Mt=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation \u2014 writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action \u2014 writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],At=c(t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),"wt"),Ct=c(t=>{let e=Mt.map(r=>`- ${r.name} \u2014 ${r.summary}`).join(`
|
|
2
2
|
`);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
|
|
3
3
|
`)},"kt"),It=1500,Lt=c(()=>{let t=(0,_.c)(40),e=$(),{url:r}=Te(),n;t[0]!==r?(n=tt(r),t[0]=r,t[1]=n):n=t[1];let s=n,[l,i]=(0,B.useState)(null),o,d;t[2]!==l?(o=c(()=>{if(l===null)return;let L=globalThis.setTimeout(()=>{i(null)},It);return()=>{globalThis.clearTimeout(L)}},"o"),d=[l],t[2]=l,t[3]=o,t[4]=d):(o=t[3],d=t[4]),(0,B.useEffect)(o,d);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=c((L,T)=>{nt(T)&&i(L)},"u"),t[5]=u):u=t[5];let p=u,m;t[6]!==s?(m=c(()=>{p("config",At(s))},"d"),t[6]=s,t[7]=m):m=t[7];let f=m,h;t[8]!==s?(h=c(()=>{p("prompt",Ct(s))},"p"),t[8]=s,t[9]=h):h=t[9];let g=h,x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol \u2014 it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let w;t[16]!==v?(w=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=w):w=t[17];let k;t[18]!==b||t[19]!==w?(k=(0,a.jsxs)("div",{className:"flex flex-col gap-1.5 p-4",children:[b,w]}),t[18]=b,t[19]=w,t[20]=k):k=t[20];let I;t[21]===Symbol.for("react.memo_cache_sentinel")?(I=(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=I):I=t[21];let y;t[22]!==l||t[23]!==e?(y=e(l==="config"?"Copied":"Copy MCP config"),t[22]=l,t[23]=e,t[24]=y):y=t[24];let S;t[25]!==f||t[26]!==y?(S=(0,a.jsx)(Fe,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=S):S=t[27];let M;t[28]!==l||t[29]!==e?(M=e(l==="prompt"?"Copied":"Copy agent prompt"),t[28]=l,t[29]=e,t[30]=M):M=t[30];let A;t[31]!==g||t[32]!==M?(A=(0,a.jsx)(Fe,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:M}),t[31]=g,t[32]=M,t[33]=A):A=t[33];let N;t[34]!==S||t[35]!==A?(N=(0,a.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[I,(0,a.jsxs)("div",{className:"flex flex-wrap gap-2",children:[S,A]})]}),t[34]=S,t[35]=A,t[36]=N):N=t[36];let C;return t[37]!==k||t[38]!==N?(C=(0,a.jsxs)(j,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[k,N]}),t[37]=k,t[38]=N,t[39]=C):C=t[39],C},"At"),$t=112,st=32,Oe=5,lt=1,jt=3,Tt=c(t=>{let e=t.slice(-16),r=Math.max(0,...e),n=st-Oe*2,s=($t-Oe*2)/e.length;return e.map((l,i)=>{let o=r>0?Math.max(0,l)/r*n:0;return{height:Math.max(0,o-jt),width:Math.max(0,s-lt*2),x:Oe+i*s+lt,y:st-Oe-o}})},"It"),Ot=c(t=>{let e=(0,_.c)(4),{data:r}=t,n;e[0]!==r?(n=Tt(r).map(qt),e[0]=r,e[1]=n):n=e[1];let s;return e[2]!==n?(s=(0,a.jsx)("svg",{"aria-hidden":"true",className:"h-8 w-28 fill-foreground","data-testid":"home-sparkline",viewBox:"0 0 112 32",children:n}),e[2]=n,e[3]=s):s=e[3],s},"Tt");function qt(t){return(0,a.jsx)("rect",{height:t.height,rx:2,width:t.width,x:t.x,y:t.y},t.x)}c(qt,"Lt");var Rt=3,Kt=c((t,e)=>{if(e==null)return t("cache not enabled");let r=e.hits+e.misses;return r===0?t("no cache traffic yet"):`${Math.round(e.hits/r*100).toString()}% ${t("cache hit")}`},"Rt"),Je=c(t=>{if(t<1e3)return`${String(Math.round(t))}ms`;let e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},"Fe"),Bt=c((t,e)=>{let r=Math.max(0,Math.round((e-t)/1e3));if(r<60)return`${String(r)}s ago`;let n=Math.round(r/60);if(n<60)return`${String(n)}m ago`;let s=Math.round(n/60);return s<24?`${String(s)}h ago`:`${String(Math.round(s/24))}d ago`},"Et"),ot=c((t,e)=>{if(t===void 0||t.length===0)return[];let r=new Map;for(let n of t)r.set(n.bucketMs,(r.get(n.bucketMs)??0)+n[e]);return[...r.entries()].toSorted(([n],[s])=>n-s).map(([,n])=>n)},"Je"),it=c((t,e=!0)=>{if(t.length<4)return null;let r=Math.floor(t.length/2),n=t.slice(0,r).reduce((i,o)=>i+o,0),s=t.slice(r).reduce((i,o)=>i+o,0);if(n===0)return null;let l=(s-n)/n*100;return{positive:e?l>=0:l<=0,text:`${l>=0?"+":""}${l.toFixed(1)}%`}},"Ye"),qe=c(t=>{let e=(0,_.c)(24),{delta:r,footer:n,label:s,trend:l,unit:i,value:o}=t,d=$(),u;e[0]!==s?(u=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[0]=s,e[1]=u):u=e[1];let p;e[2]!==o?(p=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=p):p=e[3];let m;e[4]!==i?(m=i!==void 0&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=m):m=e[5];let f;e[6]!==p||e[7]!==m?(f=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[p,m]}),e[6]=p,e[7]=m,e[8]=f):f=e[8];let h;e[9]!==l?(h=l!==void 0&&l.length>=Rt&&(0,a.jsx)(Ot,{data:l}),e[9]=l,e[10]=h):h=e[10];let g;e[11]!==f||e[12]!==h?(g=(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[f,h]}),e[11]=f,e[12]=h,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=(0,a.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==r||e[18]!==n||e[19]!==d?(b=r==null?n!=null&&(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:n}):(0,a.jsxs)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[(0,a.jsx)("span",{className:Ve("font-semibold",r.positive?"text-success":"text-destructive"),children:r.text})," ",(0,a.jsx)("span",{className:"text-muted-foreground",children:d("vs. prev.")})]}),e[17]=r,e[18]=n,e[19]=d,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=(0,a.jsxs)(j,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},"Oe"),Dt=c(()=>{let t=(0,_.c)(1),e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,a.jsx)("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:(0,a.jsx)("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},"Bt"),He=c(t=>{let e=(0,_.c)(7),{command:r,label:n}=t,s;e[0]!==n?(s=(0,a.jsx)("div",{className:"p-4",children:(0,a.jsx)("span",{className:"text-sm font-medium text-foreground",children:n})}),e[0]=n,e[1]=s):s=e[1];let l;e[2]!==r?(l=(0,a.jsx)("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:(0,a.jsx)("code",{className:"font-mono text-xs text-muted-foreground",children:r})}),e[2]=r,e[3]=l):l=e[3];let i;return e[4]!==s||e[5]!==l?(i=(0,a.jsxs)(j,{className:"justify-between gap-0 py-0",children:[s,l]}),e[4]=s,e[5]=l,e[6]=i):i=e[6],i},"je"),ct=c(t=>{let e=(0,_.c)(18),{count:r,onView:n,testId:s,title:l}=t,i=$(),o;e[0]!==l?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=o):o=e[1];let d;e[2]!==r||e[3]!==i?(d=r===null?(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):(0,a.jsx)(We,{variant:r>0?"destructive":"success",children:r>0?r:i("All clear")}),e[2]=r,e[3]=i,e[4]=d):d=e[4];let u;e[5]!==o||e[6]!==d?(u=(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,d]}),e[5]=o,e[6]=d,e[7]=u):u=e[7];let p;e[8]!==i?(p=i("View"),e[8]=i,e[9]=p):p=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=(0,a.jsx)(Dt,{}),e[10]=m):m=e[10];let f;e[11]!==n||e[12]!==p?(f=(0,a.jsxs)("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:n,type:"button",children:[p,m]}),e[11]=n,e[12]=p,e[13]=f):f=e[13];let h;return e[14]!==u||e[15]!==f||e[16]!==s?(h=(0,a.jsxs)(j,{className:"justify-between gap-0 py-0","data-testid":s,children:[u,f]}),e[14]=u,e[15]=f,e[16]=s,e[17]=h):h=e[17],h},"Ze"),Pt=c(t=>{let e=(0,_.c)(7),{functions:r}=t,n=$(),s;if(e[0]!==r||e[1]!==n){let l=[...r].toSorted(Wt).slice(0,5),i;e[3]!==n?(i=n("Top functions"),e[3]=n,e[4]=i):i=e[4];let o;e[5]!==i?(o=(0,a.jsx)("div",{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:i})}),e[5]=i,e[6]=o):o=e[6],s=(0,a.jsxs)(j,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,l.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No functions called yet.")}):(0,a.jsxs)("div",{className:"divide-y divide-border",children:[(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[(0,a.jsx)("span",{children:n("Function")}),(0,a.jsx)("span",{className:"text-end",children:n("Calls")}),(0,a.jsx)("span",{className:"w-12 text-end",children:n("Avg")}),(0,a.jsx)("span",{className:"w-8 text-end",children:n("Err")})]}),l.map(Ft)]})]}),e[0]=r,e[1]=n,e[2]=s}else s=e[2];return s},"Pt"),zt=c(t=>{let e=(0,_.c)(26),{subs:r}=t,n=$(),s;e[0]!==n?(s=n("Live connections"),e[0]=n,e[1]=s):s=e[1];let l;e[2]!==s?(l=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s}),e[2]=s,e[3]=l):l=e[3];let i=r?.totalConnections??0,o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let d;e[6]!==o?(d=(0,a.jsx)("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=d):d=e[7];let u;e[8]!==n?(u=n("sockets"),e[8]=n,e[9]=u):u=e[9];let p;e[10]!==u?(p=(0,a.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=p):p=e[11];let m;e[12]!==d||e[13]!==p?(m=(0,a.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[d,p]}),e[12]=d,e[13]=p,e[14]=m):m=e[14];let f=r?.totalSubscriptions??0,h;e[15]!==f?(h=f.toLocaleString(),e[15]=f,e[16]=h):h=e[16];let g;e[17]!==n?(g=n("active subscriptions"),e[17]=n,e[18]=g):g=e[18];let x;e[19]!==h||e[20]!==g?(x=(0,a.jsxs)("span",{className:"text-[11px] text-muted-foreground",children:[h," ",g]}),e[19]=h,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==l||e[24]!==m?(b=(0,a.jsx)(j,{"data-testid":"home-live-connections",children:(0,a.jsxs)(Ue,{className:"flex flex-col gap-2.5 py-4",children:[l,m,x]})}),e[22]=x,e[23]=l,e[24]=m,e[25]=b):b=e[25],b},"Dt"),Et=c(t=>{let e=(0,_.c)(7),{entries:r}=t,n=$(),s;if(e[0]!==r||e[1]!==n){let l=Date.now(),i;e[3]!==n?(i=n("Recent activity"),e[3]=n,e[4]=i):i=e[4];let o;e[5]!==i?(o=(0,a.jsx)("div",{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:i})}),e[5]=i,e[6]=o):o=e[6],s=(0,a.jsxs)(j,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,r.length===0?(0,a.jsx)("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:n("No recent activity.")}):(0,a.jsx)("ul",{className:"divide-y divide-border",children:r.slice(0,5).map(d=>(0,a.jsxs)("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),(0,a.jsxs)("span",{className:"truncate text-foreground",children:[d.op,d.table!==void 0&&(0,a.jsxs)("span",{className:"text-muted-foreground",children:[" \xB7 ",d.table,d.id===void 0?"":`#${d.id}`]})]})]}),(0,a.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Bt(d.ts,l)})]},d.seq))})]}),e[0]=r,e[1]=n,e[2]=s}else s=e[2];return s},"jt"),Vt=c(t=>{let e=t.reduce((r,n)=>r+n.calls,0);return e===0?null:t.reduce((r,n)=>r+n.totalDurationMs,0)/e},"Ft"),sn=c(t=>{let e=(0,_.c)(149),{initialShardKey:r}=t,n=$(),s=Ee(),l=r??"",i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==l?(o={shardKey:l},e[1]=l,e[2]=o):o=e[2];let d=_e(D.getMetrics,i,o),u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let p;e[4]!==l?(p={shardKey:l},e[4]=l,e[5]=p):p=e[5];let m=_e(D.getFunctionStats,u,p),f,h;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},h={shardKey:""},e[6]=f,e[7]=h):(f=e[6],h=e[7]);let g=_e(D.getSecurityAudit,f,h),x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==l?(b={shardKey:l},e[9]=l,e[10]=b):b=e[10];let v=_e(D.listSubscriptions,x,b),w;e[11]===Symbol.for("react.memo_cache_sentinel")?(w={},e[11]=w):w=e[11];let k;e[12]!==l?(k={shardKey:l},e[12]=l,e[13]=k):k=e[13];let I=_e(D.getAuditLog,w,k),y=d.data??null,S,M,A,N,C,L,T,O,q,P,z,E,R,K,V,W,F,U;if(e[14]!==I.data||e[15]!==g.data||e[16]!==y||e[17]!==d.data||e[18]!==s||e[19]!==m.data||e[20]!==v.data||e[21]!==n){N=Array.isArray(m.data?.functions)?m.data.functions:[],T=v.data??null;let Me;e[40]!==I.data?(Me=Array.isArray(I.data?.entries)?I.data.entries:[],e[40]=I.data,e[41]=Me):Me=e[41],M=Me,C=d.data===void 0||m.data===void 0?null:at(y,N).length,L=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ae;e[42]!==s?(Ae=c(()=>{Ne(s({to:"/security"}))},"Ce"),e[42]=s,e[43]=Ae):Ae=e[43],U=Ae;let Ce;e[44]!==s?(Ce=c(()=>{Ne(s({to:"/insights"}))},"Ae"),e[44]=s,e[45]=Ce):Ce=e[45],F=Ce;let Ie=ot(y?.history,"calls"),Le=ot(y?.history,"errors"),Ye=Vt(N),$e=Math.max(0,...N.map(Ut)),je;e[46]!==y||e[47]!==n?(je=y===null?void 0:Kt(n,y.cache),e[46]=y,e[47]=n,e[48]=je):je=e[48],A=je,V="flex flex-col gap-6",W="lunora-home",z="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",E="home-health";let Ke=it(Ie),xe;e[49]!==n?(xe=n("Requests"),e[49]=n,e[50]=xe):xe=e[50];let Be=y?.requests??0,be;e[51]!==Be?(be=Be.toLocaleString(),e[51]=Be,e[52]=be):be=e[52],e[53]!==Ie||e[54]!==Ke||e[55]!==xe||e[56]!==be?(R=(0,a.jsx)(qe,{delta:Ke,label:xe,trend:Ie,value:be}),e[53]=Ie,e[54]=Ke,e[55]=xe,e[56]=be,e[57]=R):R=e[57];let De=it(Le,!1),ye;e[58]!==n?(ye=n("Errors"),e[58]=n,e[59]=ye):ye=e[59];let Pe=y?.errors??0,ve;e[60]!==Pe?(ve=Pe.toLocaleString(),e[60]=Pe,e[61]=ve):ve=e[61],e[62]!==Le||e[63]!==De||e[64]!==ye||e[65]!==ve?(K=(0,a.jsx)(qe,{delta:De,label:ye,trend:Le,value:ve}),e[62]=Le,e[63]=De,e[64]=ye,e[65]=ve,e[66]=K):K=e[66],S=qe,e[67]!==$e||e[68]!==n?(O=$e>0?`${n("max")} ${Je($e)}`:void 0,e[67]=$e,e[68]=n,e[69]=O):O=e[69],e[70]!==n?(q=n("Avg latency"),e[70]=n,e[71]=q):q=e[71],P=Ye===null?"\u2014":Je(Ye),e[14]=I.data,e[15]=g.data,e[16]=y,e[17]=d.data,e[18]=s,e[19]=m.data,e[20]=v.data,e[21]=n,e[22]=S,e[23]=M,e[24]=A,e[25]=N,e[26]=C,e[27]=L,e[28]=T,e[29]=O,e[30]=q,e[31]=P,e[32]=z,e[33]=E,e[34]=R,e[35]=K,e[36]=V,e[37]=W,e[38]=F,e[39]=U}else S=e[22],M=e[23],A=e[24],N=e[25],C=e[26],L=e[27],T=e[28],O=e[29],q=e[30],P=e[31],z=e[32],E=e[33],R=e[34],K=e[35],V=e[36],W=e[37],F=e[38],U=e[39];let H;e[72]!==S||e[73]!==O||e[74]!==q||e[75]!==P?(H=(0,a.jsx)(S,{footer:O,label:q,value:P}),e[72]=S,e[73]=O,e[74]=q,e[75]=P,e[76]=H):H=e[76];let J;e[77]!==n?(J=n("Database size"),e[77]=n,e[78]=J):J=e[78];let Re=y?.databaseSize??null,G;e[79]!==Re?(G=et(Re),e[79]=Re,e[80]=G):G=e[80];let Y;e[81]!==A||e[82]!==J||e[83]!==G?(Y=(0,a.jsx)(qe,{footer:A,label:J,value:G}),e[81]=A,e[82]=J,e[83]=G,e[84]=Y):Y=e[84];let Z;e[85]!==z||e[86]!==E||e[87]!==R||e[88]!==K||e[89]!==H||e[90]!==Y?(Z=(0,a.jsxs)("div",{className:z,"data-testid":E,children:[R,K,H,Y]}),e[85]=z,e[86]=E,e[87]=R,e[88]=K,e[89]=H,e[90]=Y,e[91]=Z):Z=e[91];let we;e[92]===Symbol.for("react.memo_cache_sentinel")?(we=(0,a.jsx)(Nt,{}),e[92]=we):we=e[92];let Q;e[93]!==N?(Q=(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsx)(Pt,{functions:N})}),e[93]=N,e[94]=Q):Q=e[94];let X;e[95]!==T?(X=(0,a.jsx)(zt,{subs:T}),e[95]=T,e[96]=X):X=e[96];let ee;e[97]!==M?(ee=(0,a.jsx)(Et,{entries:M}),e[97]=M,e[98]=ee):ee=e[98];let te;e[99]!==X||e[100]!==ee?(te=(0,a.jsxs)("div",{className:"flex flex-col gap-3",children:[X,ee]}),e[99]=X,e[100]=ee,e[101]=te):te=e[101];let ne;e[102]!==Q||e[103]!==te?(ne=(0,a.jsxs)("div",{className:"grid gap-3 lg:grid-cols-3",children:[Q,te]}),e[102]=Q,e[103]=te,e[104]=ne):ne=e[104];let ae;e[105]!==n?(ae=n("Advisors"),e[105]=n,e[106]=ae):ae=e[106];let re;e[107]!==ae?(re=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[107]=ae,e[108]=re):re=e[108];let se;e[109]!==C||e[110]!==L||e[111]!==n||e[112]!==F||e[113]!==U?(se=L===0&&C===0?(0,a.jsx)(Ze,{description:n("No security or performance issues detected."),icon:(0,a.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,a.jsx)("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),(0,a.jsx)("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:n("No issues found")}):(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsx)(ct,{count:L,onView:U,testId:"home-security",title:n("Security findings")}),(0,a.jsx)(ct,{count:C,onView:F,testId:"home-performance",title:n("Performance issues")})]}),e[109]=C,e[110]=L,e[111]=n,e[112]=F,e[113]=U,e[114]=se):se=e[114];let le;e[115]!==re||e[116]!==se?(le=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[re,se]}),e[115]=re,e[116]=se,e[117]=le):le=e[117];let oe;e[118]!==n?(oe=n("Get connected"),e[118]=n,e[119]=oe):oe=e[119];let ie;e[120]!==oe?(ie=(0,a.jsx)("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:oe}),e[120]=oe,e[121]=ie):ie=e[121];let ce;e[122]!==n?(ce=n("Client SDK"),e[122]=n,e[123]=ce):ce=e[123];let de;e[124]!==ce?(de=(0,a.jsx)(He,{command:"npm i @lunora/client",label:ce}),e[124]=ce,e[125]=de):de=e[125];let me;e[126]!==n?(me=n("React"),e[126]=n,e[127]=me):me=e[127];let ue;e[128]!==me?(ue=(0,a.jsx)(He,{command:"npm i @lunora/react",label:me}),e[128]=me,e[129]=ue):ue=e[129];let pe;e[130]!==n?(pe=n("CLI"),e[130]=n,e[131]=pe):pe=e[131];let fe;e[132]!==pe?(fe=(0,a.jsx)(He,{command:"lunora dev",label:pe}),e[132]=pe,e[133]=fe):fe=e[133];let he;e[134]!==de||e[135]!==ue||e[136]!==fe?(he=(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-3",children:[de,ue,fe]}),e[134]=de,e[135]=ue,e[136]=fe,e[137]=he):he=e[137];let ke;e[138]===Symbol.for("react.memo_cache_sentinel")?(ke=(0,a.jsx)(Lt,{}),e[138]=ke):ke=e[138];let ge;e[139]!==ie||e[140]!==he?(ge=(0,a.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[ie,he,ke]}),e[139]=ie,e[140]=he,e[141]=ge):ge=e[141];let Se;return e[142]!==V||e[143]!==W||e[144]!==Z||e[145]!==ne||e[146]!==le||e[147]!==ge?(Se=(0,a.jsxs)("div",{className:V,"data-testid":W,children:[Z,we,ne,le,ge]}),e[142]=V,e[143]=W,e[144]=Z,e[145]=ne,e[146]=le,e[147]=ge,e[148]=Se):Se=e[148],Se},"as");function Wt(t,e){return e.calls-t.calls}c(Wt,"Ut");function Ft(t){return(0,a.jsxs)("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[(0,a.jsx)("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),(0,a.jsx)("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),(0,a.jsx)("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Je(t.calls>0?t.totalDurationMs/t.calls:0)}),(0,a.jsx)("span",{className:Ve("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}c(Ft,"qt");function Ut(t){return t.maxDurationMs}c(Ut,"Kt");export{xt as a,sn as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as X0,b as Cf,c as K0,d as qf,e as J0,f as p0,k as r0}from"./chunk-KFNDET5D.js";import"./chunk-YHTHRYP5.js";import"./chunk-CIVMATZK.js";import"./chunk-DX55P3KZ.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-HKLF627N.js";import{a as L0}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import"./chunk-DBVJ5VLI.js";import{a as Bf}from"./chunk-6M7FLLMT.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import{i as V0}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import{a as Pd}from"./chunk-IBJVVHV5.js";import{a as x0}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as Rf}from"./chunk-7F3S5OQT.js";import"./chunk-E26OT26O.js";import"./chunk-4ZEL6BYL.js";import"./chunk-YJ2WHOGO.js";import{c as R0,i as Y0,n as Q0}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import"./chunk-3Y5K3IQO.js";import"./chunk-MD67S53Z.js";import{b as Mf,c as Z0,f as Hf,t as j0}from"./chunk-LPINY2IJ.js";import{a as f,b as jn,d as Xa,e as q0,f as ly,g as G0}from"./chunk-OXFKZ4BM.js";var u1=jn(W=>{"use strict";function Xf(l,t){var u=l.length;l.push(t);l:for(;0<u;){var a=u-1>>>1,n=l[a];if(0<Ln(n,t))l[a]=t,l[u]=n,u=a;else break l}}f(Xf,"push");function et(l){return l.length===0?null:l[0]}f(et,"peek");function Jn(l){if(l.length===0)return null;var t=l[0],u=l.pop();if(u!==t){l[0]=u;l:for(var a=0,n=l.length,e=n>>>1;a<e;){var c=2*(a+1)-1,i=l[c],v=c+1,o=l[v];if(0>Ln(i,u))v<n&&0>Ln(o,i)?(l[a]=o,l[v]=u,a=v):(l[a]=i,l[c]=u,a=c);else if(v<n&&0>Ln(o,u))l[a]=o,l[v]=u,a=v;else break l}}return t}f(Jn,"pop");function Ln(l,t){var u=l.sortIndex-t.sortIndex;return u!==0?u:l.id-t.id}f(Ln,"compare");W.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(w0=performance,W.unstable_now=function(){return w0.now()}):(Yf=Date,F0=Yf.now(),W.unstable_now=function(){return Yf.now()-F0});var w0,Yf,F0,Ot=[],Zt=[],ty=1,Kl=null,zl=3,Zf=!1,Za=!1,Va=!1,Vf=!1,k0=typeof setTimeout=="function"?setTimeout:null,I0=typeof clearTimeout=="function"?clearTimeout:null,W0=typeof setImmediate<"u"?setImmediate:null;function Kn(l){for(var t=et(Zt);t!==null;){if(t.callback===null)Jn(Zt);else if(t.startTime<=l)Jn(Zt),t.sortIndex=t.expirationTime,Xf(Ot,t);else break;t=et(Zt)}}f(Kn,"advanceTimers");function xf(l){if(Va=!1,Kn(l),!Za)if(et(Ot)!==null)Za=!0,xu||(xu=!0,Vu());else{var t=et(Zt);t!==null&&jf(xf,t.startTime-l)}}f(xf,"handleTimeout");var xu=!1,xa=-1,P0=5,l1=-1;function t1(){return Vf?!0:!(W.unstable_now()-l1<P0)}f(t1,"shouldYieldToHost");function Gf(){if(Vf=!1,xu){var l=W.unstable_now();l1=l;var t=!0;try{l:{Za=!1,Va&&(Va=!1,I0(xa),xa=-1),Zf=!0;var u=zl;try{t:{for(Kn(l),Kl=et(Ot);Kl!==null&&!(Kl.expirationTime>l&&t1());){var a=Kl.callback;if(typeof a=="function"){Kl.callback=null,zl=Kl.priorityLevel;var n=a(Kl.expirationTime<=l);if(l=W.unstable_now(),typeof n=="function"){Kl.callback=n,Kn(l),t=!0;break t}Kl===et(Ot)&&Jn(Ot),Kn(l)}else Jn(Ot);Kl=et(Ot)}if(Kl!==null)t=!0;else{var e=et(Zt);e!==null&&jf(xf,e.startTime-l),t=!1}}break l}finally{Kl=null,zl=u,Zf=!1}t=void 0}}finally{t?Vu():xu=!1}}}f(Gf,"performWorkUntilDeadline");var Vu;typeof W0=="function"?Vu=f(function(){W0(Gf)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Qf=new MessageChannel,$0=Qf.port2,Qf.port1.onmessage=Gf,Vu=f(function(){$0.postMessage(null)},"schedulePerformWorkUntilDeadline")):Vu=f(function(){k0(Gf,0)},"schedulePerformWorkUntilDeadline");var Qf,$0;function jf(l,t){xa=k0(function(){l(W.unstable_now())},t)}f(jf,"requestHostTimeout");W.unstable_IdlePriority=5;W.unstable_ImmediatePriority=1;W.unstable_LowPriority=4;W.unstable_NormalPriority=3;W.unstable_Profiling=null;W.unstable_UserBlockingPriority=2;W.unstable_cancelCallback=function(l){l.callback=null};W.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P0=0<l?Math.floor(1e3/l):5};W.unstable_getCurrentPriorityLevel=function(){return zl};W.unstable_next=function(l){switch(zl){case 1:case 2:case 3:var t=3;break;default:t=zl}var u=zl;zl=t;try{return l()}finally{zl=u}};W.unstable_requestPaint=function(){Vf=!0};W.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var u=zl;zl=l;try{return t()}finally{zl=u}};W.unstable_scheduleCallback=function(l,t,u){var a=W.unstable_now();switch(typeof u=="object"&&u!==null?(u=u.delay,u=typeof u=="number"&&0<u?a+u:a):u=a,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=u+n,l={id:ty++,callback:t,priorityLevel:l,startTime:u,expirationTime:n,sortIndex:-1},u>a?(l.sortIndex=u,Xf(Zt,l),et(Ot)===null&&l===et(Zt)&&(Va?(I0(xa),xa=-1):Va=!0,jf(xf,u-a))):(l.sortIndex=n,Xf(Ot,l),Za||Zf||(Za=!0,xu||(xu=!0,Vu()))),l};W.unstable_shouldYield=t1;W.unstable_wrapCallback=function(l){var t=zl;return function(){var u=zl;zl=t;try{return l.apply(this,arguments)}finally{zl=u}}}});var n1=jn((Sg,a1)=>{"use strict";a1.exports=u1()});var pd=jn(Df=>{"use strict";var cl=n1(),Kv=q0(),uy=Pd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)t+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}f(z,"formatProdErrorMessage");function Jv(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}f(Jv,"isValidContainer");function Mn(l){for(var t=l,u=t;u&&!u.alternate;)t=u,(t.flags&4098)!==0&&(l=t.return),u=t.return;for(;t.return;)t=t.return;return t.tag===3?l:null}f(Mn,"getNearestMountedFiber");function pv(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}f(pv,"getSuspenseInstanceFromFiber");function rv(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}f(rv,"getActivityInstanceFromFiber");function e1(l){if(Mn(l)!==l)throw Error(z(188))}f(e1,"assertIsMounted");function ay(l){var t=l.alternate;if(!t){if(t=Mn(l),t===null)throw Error(z(188));return t!==l?null:l}for(var u=l,a=t;;){var n=u.return;if(n===null)break;var e=n.alternate;if(e===null){if(a=n.return,a!==null){u=a;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===u)return e1(n),l;if(e===a)return e1(n),t;e=e.sibling}throw Error(z(188))}if(u.return!==a.return)u=n,a=e;else{for(var c=!1,i=n.child;i;){if(i===u){c=!0,u=n,a=e;break}if(i===a){c=!0,a=n,u=e;break}i=i.sibling}if(!c){for(i=e.child;i;){if(i===u){c=!0,u=e,a=n;break}if(i===a){c=!0,a=e,u=n;break}i=i.sibling}if(!c)throw Error(z(189))}}if(u.alternate!==a)throw Error(z(190))}if(u.tag!==3)throw Error(z(188));return u.stateNode.current===u?l:t}f(ay,"findCurrentFiberUsingSlowPath");function wv(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=wv(l),t!==null)return t;l=l.sibling}return null}f(wv,"findCurrentHostFiberImpl");function Cl(l,t,u,a,n,e){for(;l!==null;){if((l.tag===5||l.tag===27||l.tag===6)&&u(l,a,n,e)||(l.tag!==22||l.memoizedState===null)&&(t||l.tag!==5&&l.tag!==27)&&Cl(l.child,t,u,a,n,e))return!0;l=l.sibling}return!1}f(Cl,"traverseVisibleInstancesAndTextInstances");function Yu(l){for(l=l.return;l!==null;){if(l.tag===3||l.tag===5||l.tag===27)return l;l=l.return}return null}f(Yu,"getFragmentParentInstanceOrContainerFiber");function f1(l){var t=!1;for(l=l.return;l!==null&&(l.tag===4&&(t=!0),!(l.tag===3||l.tag===5||l.tag===27));)l=l.return;return t}f(f1,"fiberIsPortaledIntoHost");function Fv(l){var t=[null,null],u=Yu(l);return u===null||Wv(t,l,u.child,{foundSelf:!1}),t}f(Fv,"getFragmentInstanceOrTextInstanceSiblings");function Wv(l,t,u,a){for(;u!==null;){if(u===t)a.foundSelf=!0;else if(u.tag===5||u.tag===27||u.tag===6){if(a.foundSelf)return l[1]=u,!0;l[0]=u}else if((u.tag!==22||u.memoizedState===null)&&Wv(l,t,u.child,a))return!0;u=u.sibling}return!1}f(Wv,"findFragmentInstanceOrTextInstanceSiblings");function fl(l){switch(l.tag){case 5:case 27:case 6:return l.stateNode;case 3:return l.stateNode.containerInfo;default:throw Error(z(559))}}f(fl,"getInstanceFromHostFiber");var wu=null,zc=null;function ny(l,t,u){return l===u?!0:l===t?(wu=l,!0):!1}f(ny,"isFiberPrecedingCheck");function ey(l,t,u){return l===u?(zc=l,!1):l===t?(zc!==null&&(wu=l),!0):!1}f(ey,"isFiberFollowingCheck");function c1(l){if(l===null)return null;do l=l===null?null:l.return;while(l&&l.tag!==5&&l.tag!==27&&l.tag!==3);return l||null}f(c1,"getParentForFragmentAncestors");function Ec(l,t,u){for(var a=0,n=l;n;n=u(n))a++;n=0;for(var e=t;e;e=u(e))n++;for(;0<a-n;)l=u(l),a--;for(;0<n-a;)t=u(t),n--;for(;a--;){if(l===t||t!==null&&l===t.alternate)return l;l=u(l),t=u(t)}return null}f(Ec,"getLowestCommonAncestor");var J=Object.assign,fy=Symbol.for("react.element"),pn=Symbol.for("react.transitional.element"),wa=Symbol.for("react.portal"),Fu=Symbol.for("react.fragment"),$v=Symbol.for("react.strict_mode"),Oc=Symbol.for("react.profiler"),kv=Symbol.for("react.consumer"),ot=Symbol.for("react.context"),Ci=Symbol.for("react.forward_ref"),sc=Symbol.for("react.suspense"),Nc=Symbol.for("react.suspense_list"),Bi=Symbol.for("react.memo"),Lt=Symbol.for("react.lazy"),Ac=Symbol.for("react.activity"),cy=Symbol.for("react.legacy_hidden"),iy=Symbol.for("react.memo_cache_sentinel"),_c=Symbol.for("react.view_transition"),vy=Symbol.for("react.recoverable"),i1=Symbol.iterator;function ja(l){return l===null||typeof l!="object"?null:(l=i1&&l[i1]||l["@@iterator"],typeof l=="function"?l:null)}f(ja,"getIteratorFn");var my=Symbol.for("react.client.reference");function Dc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===my?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Fu:return"Fragment";case Oc:return"Profiler";case $v:return"StrictMode";case sc:return"Suspense";case Nc:return"SuspenseList";case Ac:return"Activity";case _c:return"ViewTransition"}if(typeof l=="object")switch(l.$$typeof){case wa:return"Portal";case ot:return l.displayName||"Context";case kv:return(l._context.displayName||"Context")+".Consumer";case Ci:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bi:return t=l.displayName||null,t!==null?t:Dc(l.type)||"Memo";case Lt:t=l._payload,l=l._init;try{return Dc(l(t))}catch{}}return null}f(Dc,"getComponentNameFromType");var Fa=Array.isArray,U=Kv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=uy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ou={pending:!1,data:null,method:null,action:null},Uc=[],Wu=-1;function bt(l){return{current:l}}f(bt,"createCursor");function gl(l){0>Wu||(l.current=Uc[Wu],Uc[Wu]=null,Wu--)}f(gl,"pop");function F(l,t){Wu++,Uc[Wu]=l.current,l.current=t}f(F,"push");var gt=bt(null),dn=bt(null),kt=bt(null),Be=bt(null);function Re(l,t){switch(F(kt,t),F(dn,l),F(gt,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?sv(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=sv(t),l=Ed(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}gl(gt),F(gt,l)}f(Re,"pushHostContainer");function ga(){gl(gt),gl(dn),gl(kt)}f(ga,"popHostContainer");function Mc(l){var t=l.memoizedState;t!==null&&(_a._currentValue=t.memoizedState,F(Be,l)),t=gt.current;var u=Ed(t,l.type);t!==u&&(F(dn,l),F(gt,u))}f(Mc,"pushHostContext");function qe(l){dn.current===l&&(gl(gt),gl(dn)),Be.current===l&&(gl(Be),_a._currentValue=Ou)}f(qe,"popHostContext");var Lf,v1;function xt(l){if(Lf===void 0)try{throw Error()}catch(u){var t=u.stack.trim().match(/\n( *(at )?)/);Lf=t&&t[1]||"",v1=-1<u.stack.indexOf(`
|
|
1
|
+
import{a as X0,b as Cf,c as K0,d as qf,e as J0,f as p0,k as r0}from"./chunk-UCK6ITED.js";import"./chunk-YHTHRYP5.js";import"./chunk-ZM4K2ETZ.js";import"./chunk-DX55P3KZ.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-HKLF627N.js";import{a as L0}from"./chunk-6QEXGYWH.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import"./chunk-DBVJ5VLI.js";import{a as Bf}from"./chunk-6M7FLLMT.js";import"./chunk-LUHXNZI4.js";import"./chunk-ZTOREMGH.js";import{i as V0}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import{a as Pd}from"./chunk-IBJVVHV5.js";import{a as x0}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-6I42AM75.js";import"./chunk-4C4THJUD.js";import{b as Rf}from"./chunk-6QBK3Z7A.js";import"./chunk-E26OT26O.js";import"./chunk-6UTZXEW3.js";import"./chunk-ZKPRORLI.js";import{a as R0,i as Y0,n as Q0}from"./chunk-OIDFWEJX.js";import"./chunk-WZTY3ZYI.js";import"./chunk-3Y5K3IQO.js";import"./chunk-MD67S53Z.js";import{b as Mf,c as Z0,f as Hf,t as j0}from"./chunk-LPINY2IJ.js";import{a as f,b as jn,d as Xa,e as q0,f as ly,g as G0}from"./chunk-OXFKZ4BM.js";var u1=jn(W=>{"use strict";function Xf(l,t){var u=l.length;l.push(t);l:for(;0<u;){var a=u-1>>>1,n=l[a];if(0<Ln(n,t))l[a]=t,l[u]=n,u=a;else break l}}f(Xf,"push");function et(l){return l.length===0?null:l[0]}f(et,"peek");function Jn(l){if(l.length===0)return null;var t=l[0],u=l.pop();if(u!==t){l[0]=u;l:for(var a=0,n=l.length,e=n>>>1;a<e;){var c=2*(a+1)-1,i=l[c],v=c+1,o=l[v];if(0>Ln(i,u))v<n&&0>Ln(o,i)?(l[a]=o,l[v]=u,a=v):(l[a]=i,l[c]=u,a=c);else if(v<n&&0>Ln(o,u))l[a]=o,l[v]=u,a=v;else break l}}return t}f(Jn,"pop");function Ln(l,t){var u=l.sortIndex-t.sortIndex;return u!==0?u:l.id-t.id}f(Ln,"compare");W.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(w0=performance,W.unstable_now=function(){return w0.now()}):(Yf=Date,F0=Yf.now(),W.unstable_now=function(){return Yf.now()-F0});var w0,Yf,F0,Ot=[],Zt=[],ty=1,Kl=null,zl=3,Zf=!1,Za=!1,Va=!1,Vf=!1,k0=typeof setTimeout=="function"?setTimeout:null,I0=typeof clearTimeout=="function"?clearTimeout:null,W0=typeof setImmediate<"u"?setImmediate:null;function Kn(l){for(var t=et(Zt);t!==null;){if(t.callback===null)Jn(Zt);else if(t.startTime<=l)Jn(Zt),t.sortIndex=t.expirationTime,Xf(Ot,t);else break;t=et(Zt)}}f(Kn,"advanceTimers");function xf(l){if(Va=!1,Kn(l),!Za)if(et(Ot)!==null)Za=!0,xu||(xu=!0,Vu());else{var t=et(Zt);t!==null&&jf(xf,t.startTime-l)}}f(xf,"handleTimeout");var xu=!1,xa=-1,P0=5,l1=-1;function t1(){return Vf?!0:!(W.unstable_now()-l1<P0)}f(t1,"shouldYieldToHost");function Gf(){if(Vf=!1,xu){var l=W.unstable_now();l1=l;var t=!0;try{l:{Za=!1,Va&&(Va=!1,I0(xa),xa=-1),Zf=!0;var u=zl;try{t:{for(Kn(l),Kl=et(Ot);Kl!==null&&!(Kl.expirationTime>l&&t1());){var a=Kl.callback;if(typeof a=="function"){Kl.callback=null,zl=Kl.priorityLevel;var n=a(Kl.expirationTime<=l);if(l=W.unstable_now(),typeof n=="function"){Kl.callback=n,Kn(l),t=!0;break t}Kl===et(Ot)&&Jn(Ot),Kn(l)}else Jn(Ot);Kl=et(Ot)}if(Kl!==null)t=!0;else{var e=et(Zt);e!==null&&jf(xf,e.startTime-l),t=!1}}break l}finally{Kl=null,zl=u,Zf=!1}t=void 0}}finally{t?Vu():xu=!1}}}f(Gf,"performWorkUntilDeadline");var Vu;typeof W0=="function"?Vu=f(function(){W0(Gf)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Qf=new MessageChannel,$0=Qf.port2,Qf.port1.onmessage=Gf,Vu=f(function(){$0.postMessage(null)},"schedulePerformWorkUntilDeadline")):Vu=f(function(){k0(Gf,0)},"schedulePerformWorkUntilDeadline");var Qf,$0;function jf(l,t){xa=k0(function(){l(W.unstable_now())},t)}f(jf,"requestHostTimeout");W.unstable_IdlePriority=5;W.unstable_ImmediatePriority=1;W.unstable_LowPriority=4;W.unstable_NormalPriority=3;W.unstable_Profiling=null;W.unstable_UserBlockingPriority=2;W.unstable_cancelCallback=function(l){l.callback=null};W.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):P0=0<l?Math.floor(1e3/l):5};W.unstable_getCurrentPriorityLevel=function(){return zl};W.unstable_next=function(l){switch(zl){case 1:case 2:case 3:var t=3;break;default:t=zl}var u=zl;zl=t;try{return l()}finally{zl=u}};W.unstable_requestPaint=function(){Vf=!0};W.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var u=zl;zl=l;try{return t()}finally{zl=u}};W.unstable_scheduleCallback=function(l,t,u){var a=W.unstable_now();switch(typeof u=="object"&&u!==null?(u=u.delay,u=typeof u=="number"&&0<u?a+u:a):u=a,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=u+n,l={id:ty++,callback:t,priorityLevel:l,startTime:u,expirationTime:n,sortIndex:-1},u>a?(l.sortIndex=u,Xf(Zt,l),et(Ot)===null&&l===et(Zt)&&(Va?(I0(xa),xa=-1):Va=!0,jf(xf,u-a))):(l.sortIndex=n,Xf(Ot,l),Za||Zf||(Za=!0,xu||(xu=!0,Vu()))),l};W.unstable_shouldYield=t1;W.unstable_wrapCallback=function(l){var t=zl;return function(){var u=zl;zl=t;try{return l.apply(this,arguments)}finally{zl=u}}}});var n1=jn((Sg,a1)=>{"use strict";a1.exports=u1()});var pd=jn(Df=>{"use strict";var cl=n1(),Kv=q0(),uy=Pd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)t+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}f(z,"formatProdErrorMessage");function Jv(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}f(Jv,"isValidContainer");function Mn(l){for(var t=l,u=t;u&&!u.alternate;)t=u,(t.flags&4098)!==0&&(l=t.return),u=t.return;for(;t.return;)t=t.return;return t.tag===3?l:null}f(Mn,"getNearestMountedFiber");function pv(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}f(pv,"getSuspenseInstanceFromFiber");function rv(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}f(rv,"getActivityInstanceFromFiber");function e1(l){if(Mn(l)!==l)throw Error(z(188))}f(e1,"assertIsMounted");function ay(l){var t=l.alternate;if(!t){if(t=Mn(l),t===null)throw Error(z(188));return t!==l?null:l}for(var u=l,a=t;;){var n=u.return;if(n===null)break;var e=n.alternate;if(e===null){if(a=n.return,a!==null){u=a;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===u)return e1(n),l;if(e===a)return e1(n),t;e=e.sibling}throw Error(z(188))}if(u.return!==a.return)u=n,a=e;else{for(var c=!1,i=n.child;i;){if(i===u){c=!0,u=n,a=e;break}if(i===a){c=!0,a=n,u=e;break}i=i.sibling}if(!c){for(i=e.child;i;){if(i===u){c=!0,u=e,a=n;break}if(i===a){c=!0,a=e,u=n;break}i=i.sibling}if(!c)throw Error(z(189))}}if(u.alternate!==a)throw Error(z(190))}if(u.tag!==3)throw Error(z(188));return u.stateNode.current===u?l:t}f(ay,"findCurrentFiberUsingSlowPath");function wv(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=wv(l),t!==null)return t;l=l.sibling}return null}f(wv,"findCurrentHostFiberImpl");function Cl(l,t,u,a,n,e){for(;l!==null;){if((l.tag===5||l.tag===27||l.tag===6)&&u(l,a,n,e)||(l.tag!==22||l.memoizedState===null)&&(t||l.tag!==5&&l.tag!==27)&&Cl(l.child,t,u,a,n,e))return!0;l=l.sibling}return!1}f(Cl,"traverseVisibleInstancesAndTextInstances");function Yu(l){for(l=l.return;l!==null;){if(l.tag===3||l.tag===5||l.tag===27)return l;l=l.return}return null}f(Yu,"getFragmentParentInstanceOrContainerFiber");function f1(l){var t=!1;for(l=l.return;l!==null&&(l.tag===4&&(t=!0),!(l.tag===3||l.tag===5||l.tag===27));)l=l.return;return t}f(f1,"fiberIsPortaledIntoHost");function Fv(l){var t=[null,null],u=Yu(l);return u===null||Wv(t,l,u.child,{foundSelf:!1}),t}f(Fv,"getFragmentInstanceOrTextInstanceSiblings");function Wv(l,t,u,a){for(;u!==null;){if(u===t)a.foundSelf=!0;else if(u.tag===5||u.tag===27||u.tag===6){if(a.foundSelf)return l[1]=u,!0;l[0]=u}else if((u.tag!==22||u.memoizedState===null)&&Wv(l,t,u.child,a))return!0;u=u.sibling}return!1}f(Wv,"findFragmentInstanceOrTextInstanceSiblings");function fl(l){switch(l.tag){case 5:case 27:case 6:return l.stateNode;case 3:return l.stateNode.containerInfo;default:throw Error(z(559))}}f(fl,"getInstanceFromHostFiber");var wu=null,zc=null;function ny(l,t,u){return l===u?!0:l===t?(wu=l,!0):!1}f(ny,"isFiberPrecedingCheck");function ey(l,t,u){return l===u?(zc=l,!1):l===t?(zc!==null&&(wu=l),!0):!1}f(ey,"isFiberFollowingCheck");function c1(l){if(l===null)return null;do l=l===null?null:l.return;while(l&&l.tag!==5&&l.tag!==27&&l.tag!==3);return l||null}f(c1,"getParentForFragmentAncestors");function Ec(l,t,u){for(var a=0,n=l;n;n=u(n))a++;n=0;for(var e=t;e;e=u(e))n++;for(;0<a-n;)l=u(l),a--;for(;0<n-a;)t=u(t),n--;for(;a--;){if(l===t||t!==null&&l===t.alternate)return l;l=u(l),t=u(t)}return null}f(Ec,"getLowestCommonAncestor");var J=Object.assign,fy=Symbol.for("react.element"),pn=Symbol.for("react.transitional.element"),wa=Symbol.for("react.portal"),Fu=Symbol.for("react.fragment"),$v=Symbol.for("react.strict_mode"),Oc=Symbol.for("react.profiler"),kv=Symbol.for("react.consumer"),ot=Symbol.for("react.context"),Ci=Symbol.for("react.forward_ref"),sc=Symbol.for("react.suspense"),Nc=Symbol.for("react.suspense_list"),Bi=Symbol.for("react.memo"),Lt=Symbol.for("react.lazy"),Ac=Symbol.for("react.activity"),cy=Symbol.for("react.legacy_hidden"),iy=Symbol.for("react.memo_cache_sentinel"),_c=Symbol.for("react.view_transition"),vy=Symbol.for("react.recoverable"),i1=Symbol.iterator;function ja(l){return l===null||typeof l!="object"?null:(l=i1&&l[i1]||l["@@iterator"],typeof l=="function"?l:null)}f(ja,"getIteratorFn");var my=Symbol.for("react.client.reference");function Dc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===my?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Fu:return"Fragment";case Oc:return"Profiler";case $v:return"StrictMode";case sc:return"Suspense";case Nc:return"SuspenseList";case Ac:return"Activity";case _c:return"ViewTransition"}if(typeof l=="object")switch(l.$$typeof){case wa:return"Portal";case ot:return l.displayName||"Context";case kv:return(l._context.displayName||"Context")+".Consumer";case Ci:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bi:return t=l.displayName||null,t!==null?t:Dc(l.type)||"Memo";case Lt:t=l._payload,l=l._init;try{return Dc(l(t))}catch{}}return null}f(Dc,"getComponentNameFromType");var Fa=Array.isArray,U=Kv.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=uy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ou={pending:!1,data:null,method:null,action:null},Uc=[],Wu=-1;function bt(l){return{current:l}}f(bt,"createCursor");function gl(l){0>Wu||(l.current=Uc[Wu],Uc[Wu]=null,Wu--)}f(gl,"pop");function F(l,t){Wu++,Uc[Wu]=l.current,l.current=t}f(F,"push");var gt=bt(null),dn=bt(null),kt=bt(null),Be=bt(null);function Re(l,t){switch(F(kt,t),F(dn,l),F(gt,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?sv(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=sv(t),l=Ed(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}gl(gt),F(gt,l)}f(Re,"pushHostContainer");function ga(){gl(gt),gl(dn),gl(kt)}f(ga,"popHostContainer");function Mc(l){var t=l.memoizedState;t!==null&&(_a._currentValue=t.memoizedState,F(Be,l)),t=gt.current;var u=Ed(t,l.type);t!==u&&(F(dn,l),F(gt,u))}f(Mc,"pushHostContext");function qe(l){dn.current===l&&(gl(gt),gl(dn)),Be.current===l&&(gl(Be),_a._currentValue=Ou)}f(qe,"popHostContext");var Lf,v1;function xt(l){if(Lf===void 0)try{throw Error()}catch(u){var t=u.stack.trim().match(/\n( *(at )?)/);Lf=t&&t[1]||"",v1=-1<u.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+Lf+l+v1}f(xt,"describeBuiltInComponentFrame");var Kf=!1;function Jf(l,t){if(!l||Kf)return"";Kf=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var a={DetermineComponentFrameRoot:f(function(){try{if(t){var T=f(function(){throw Error()},"Fake");if(Object.defineProperty(T.prototype,"props",{set:f(function(){throw Error()},"set")}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(T,[])}catch(E){var y=E}Reflect.construct(l,[],T)}else{try{T.call()}catch(E){y=E}T=!1;try{var g=Object.getOwnPropertyDescriptor(l.prototype,"props");Object.defineProperty(l.prototype,"props",{configurable:!0,set:f(function(){throw Error()},"set")}),T=!0,new l}finally{T&&(g!==void 0?Object.defineProperty(l.prototype,"props",g):delete l.prototype.props)}}}else{try{throw Error()}catch(E){y=E}(T=l())&&typeof T.catch=="function"&&T.catch(function(){})}}catch(E){if(E&&y&&typeof E.stack=="string")return[E.stack,y.stack]}return[null,null]},"DetermineComponentFrameRoot")};a.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(a.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(a.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var e=a.DetermineComponentFrameRoot(),c=e[0],i=e[1];if(c&&i){var v=c.split(`
|
|
4
4
|
`),o=i.split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/studio",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.352",
|
|
4
4
|
"description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin-ui",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"@hugeicons/react": "^1.1.10",
|
|
59
59
|
"@lingui/core": "^6.9.0",
|
|
60
60
|
"@lingui/message-utils": "^6.9.0",
|
|
61
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
62
|
-
"@lunora/bindings": "1.0.0-alpha.
|
|
63
|
-
"@lunora/client": "1.0.0-alpha.
|
|
61
|
+
"@lunora/advisor": "1.0.0-alpha.266",
|
|
62
|
+
"@lunora/bindings": "1.0.0-alpha.139",
|
|
63
|
+
"@lunora/client": "1.0.0-alpha.259",
|
|
64
64
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
65
|
-
"@lunora/react": "1.0.0-alpha.
|
|
65
|
+
"@lunora/react": "1.0.0-alpha.271",
|
|
66
66
|
"@lunora/wire": "1.0.0-alpha.3",
|
|
67
67
|
"@tanstack/react-query": "5.101.4",
|
|
68
68
|
"@tanstack/react-router": "^1.170.41",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{a as se,b as ae,c as ce,d as de,e as ue}from"./chunk-FLVDICZL.js";import"./chunk-A566HCBX.js";import{c as le}from"./chunk-DS7HZKZ2.js";import"./chunk-CTE6RPXC.js";import"./chunk-LIGOLZND.js";import"./chunk-3GXPALXG.js";import"./chunk-NMVFSJM7.js";import"./chunk-AP4PC2M4.js";import"./chunk-KRPXOSBL.js";import"./chunk-W2BCSK5S.js";import"./chunk-NGVP66OH.js";import"./chunk-XYR5NST4.js";import{a as ie}from"./chunk-ZWDORIZY.js";import{a as oe}from"./chunk-KYONGQQ4.js";import{b as H}from"./chunk-SLIDAWNX.js";import"./chunk-6M7FLLMT.js";import"./chunk-ZTOREMGH.js";import"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as Z}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as E}from"./chunk-4ZEL6BYL.js";import{c as re,d as ne}from"./chunk-YJ2WHOGO.js";import{c as A,f as K,g as ee,p as te}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as P,e as W}from"./chunk-MD67S53Z.js";import{f as V,h as O,i as L,j as q,s as z}from"./chunk-LPINY2IJ.js";import{a as l,d as J,e as qe,f as Fe,g as Oe}from"./chunk-OXFKZ4BM.js";var ge=J(Fe(),1);var S=J(qe(),1);var c=J(Oe(),1);var j=class extends Error{static{l(this,"R")}problem;constructor(e){super(e.kind),this.name="CsvFormatError",this.problem=e}},Be="\uFEFF",Ae=l(()=>{let t=[],e=1,r=!1,n=!1,o="start",i="",s=l(()=>{t.push(o==="closing"||i!==""?i:void 0),o="start",i=""},"i"),m=l(a=>{s(),t.some(d=>d!==void 0)&&a.push({cells:t,number:e}),t=[],e+=1},"c"),f=l((a,d)=>{let h=r;if(r=!1,!(h&&a===`
|
|
2
|
-
`)){if(o==="quoted"){a==='"'?o="closing":i+=a;return}if(o==="closing"&&a==='"'){i+=a,o="quoted";return}if(a===","){s();return}if(a==="\r"){m(d),r=!0;return}if(a===`
|
|
3
|
-
`){m(d);return}if(o==="closing")throw new j({kind:"text-after-quote",record:e});if(o==="start"&&a==='"'){o="quoted";return}o="unquoted",i+=a}},"d");return{finish:l(()=>{if(o==="quoted")throw new j({kind:"unterminated-quote",record:e});let a=[];return m(a),a},"finish"),push:l(a=>{let d=[],h=0;for(!n&&a!==""&&(n=!0,h=a.startsWith(Be)?1:0);h<a.length;h+=1)f(a.charAt(h),d);return d},"push")}},"Fe"),be=l(async function*(t){let e=Ae();for await(let r of t)yield*e.push(r);yield*e.finish()},"oe"),D=l((t,e,r)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0})},"D"),xe=l(t=>{let e=[],r=new Set;return t.forEach((n,o)=>{let i=(n??"").trim();if(i==="")throw new j({column:o+1,kind:"empty-header"});if(r.has(i))throw new j({kind:"duplicate-header",name:i});r.add(i),e.push(i)}),e},"se"),ye=l(({cells:t,number:e},r,n)=>{if(t.length!==r.length)throw new j({expected:r.length,found:t.length,kind:"ragged",record:e});let o={};return r.forEach((i,s)=>{let m=t[s];m!==void 0?D(o,i,m):n.has(i)&&D(o,i,null)}),{doc:o,record:e}},"ie"),Ke=/^-?\d+$/u,De=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/iu,Re=/^-?\d{11,}$/u,Me=/^(\d{4})-(\d{2})-(\d{2})$/u,Ue=/^(\d{2}):(\d{2})(?::(\d{2})(?:\.\d+)?)?(Z|[+-]\d{2}:\d{2})?$/u,Je=/\.(\d+)/u,Ve=/[1-9]/u,Ze=/^[+-]?(\d*)(?:\.(\d*))?(?:e([+-]?\d+))?$/iu,me=l(t=>{let[,e="",r="",n="0"]=Ze.exec(t)??[],o=`${e}${r}`,i=0,s=o.length;for(;i<s&&o.charAt(i)==="0";)i+=1;for(;s>i&&o.charAt(s-1)==="0";)s-=1;return i===s?{digits:"",exponent:0}:{digits:o.slice(i,s),exponent:Number(n)-r.length+(o.length-s)}},"z"),Pe=l((t,e)=>{let r=me(t),n=me(e.toExponential());return r.digits===n.digits&&r.exponent===n.exponent?!0:r.digits!==""&&r.exponent>=0&&Number.isInteger(e)&&BigInt(r.digits)*10n**BigInt(r.exponent)===BigInt(Math.abs(e))},"qe"),We=l(t=>{let e=t.trim();if(!De.test(e))return;let r=Number(e);if(Number.isFinite(r))return Pe(e,r)?{number:r}:{inexact:!0}},"Ke"),ze=l((t,e,r)=>{let n=new Date(0);return n.setUTCFullYear(t,e-1,r),n.getUTCMonth()===e-1&&n.getUTCDate()===r},"Xe"),He=l((t,e,r,n)=>Number(t)<=23&&Number(e)<=59&&Number(r)<=59&&(n==="Z"||Number(n.slice(1,3))<=23&&Number(n.slice(4,6))<=59),"Ue"),Ye=l(t=>{let[e="",r,...n]=t.split("T"),o=Me.exec(e),i=r===void 0?void 0:Ue.exec(r);if(o===null||n.length>0||r!==void 0&&i===null)return;let[,s="",m="",f=""]=o;if(!ze(Number(s),Number(m),Number(f)))return;let[,a="0",d="0",h="0",v]=i??[];if(!He(a,d,h,v??"Z"))return;let w=Je.exec(r??"")?.[1]??"";if(Ve.test(w.slice(3)))return;let p=Date.parse(i!==void 0&&v===void 0?`${t}Z`:t);return Number.isFinite(p)?p:void 0},"Ve"),_e=l(t=>{let e=We(t);return e===void 0?{expected:"number",kind:"rejected"}:"number"in e?{kind:"ok",value:e.number}:{expected:"number",inexact:!0,kind:"rejected"}},"He"),Ge=l(t=>{let e=t.trim(),r=Ye(e);return r===void 0&&Re.test(e)&&(r=Number(e)),r===void 0||!Number.isFinite(new Date(r).getTime())?{expected:"date",kind:"rejected"}:{kind:"ok",value:r}},"We"),Qe=l(t=>{try{return K(t),!0}catch{return!1}},"Je"),Xe=l((t,e)=>{if(e==="bigint"){let r=t.trim();if(!Ke.test(r))return{expected:"bigint",kind:"rejected"};let n=BigInt(r);return Qe(n)?{kind:"ok",value:n}:{expected:"bigint",kind:"rejected",tooLong:!0}}if(e==="boolean"){let r=t.trim().toLowerCase();return r==="true"||r==="false"?{kind:"ok",value:r==="true"}:{expected:"boolean",kind:"rejected"}}return e==="number"?_e(t):e==="date"||e==="timestamp"?Ge(t):{kind:"ok",value:t}},"Ye"),ve=l(({doc:t,record:e},r)=>{let n={};for(let[o,i]of Object.entries(t)){if(i===null){D(n,o,null);continue}let s=Xe(i,r.get(o));if(s.kind==="rejected")throw new j({column:o,expected:s.expected,...s.inexact===!0&&{inexact:!0},kind:"cell-type",record:e,...s.tooLong===!0&&{tooLong:!0},value:i});D(n,o,s.value)}return{doc:n,record:e}},"le"),et=l(async function*(t,e,r){let n;for await(let o of be(t))n===void 0?n=xe(o.cells):yield ve(ye(o,n,r),e)},"Ze"),tt=l(t=>new Set(t.filter(e=>e.nullable===!0&&!e.optional).map(e=>e.name)),"Ge"),fe=l(t=>{if(t instanceof j)return t;throw t},"Q"),rt=l(async(t,e,r,n)=>{let o,i,s;for await(let f of be(t)){if(o===void 0){try{o=xe(f.cells)}catch(d){i=fe(d),o=[]}continue}let a;try{a=ve(ye(f,o,r),e)}catch(d){s??=fe(d);continue}n(a)}let m=i??s;if(m!==void 0)throw m},"ze"),nt=O(E.exportShard),Y=O(E.importShard),ot=O(E.listTables),it=O(E.describeTable),lt={},st=l(t=>t.map(e=>JSON.stringify(K(e))).join(`
|
|
4
|
-
`),"rt"),at=l((t,e)=>{let r=t.trim();if(r==="")return;let n=ee(JSON.parse(r));if(typeof n!="object"||n===null)throw new A("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);let o=n;if(typeof o.table!="string"||typeof o.doc!="object"||o.doc===null||Array.isArray(o.doc))throw new A("INTERNAL",`line ${e.toString()}: expected a { table, doc } object`);return o},"ot"),he=1024*1024,G=l(async function*(t){let e=new TextDecoder("utf-8",{fatal:!0});for(let n=0;n<t.size;n+=he){let o=await t.slice(n,n+he).arrayBuffer();yield e.decode(o,{stream:!0})}let r=e.decode();r!==""&&(yield r)},"U"),ct=l(async function*(t){let e="",r=0;for await(let n of G(t)){let o=`${e}${n}`.split(`
|
|
5
|
-
`);e=o.pop()??"";for(let i of o)r+=1,yield{line:i,lineNumber:r}}e!==""&&(yield{line:e,lineNumber:r+1})},"st"),dt=l(async function*(t){for await(let{line:e,lineNumber:r}of ct(t)){let n=at(e,r);n!==void 0&&(yield{line:r,row:n})}},"it"),ut=l(async function*(t,e,r,n){for await(let{doc:o,record:i}of et(G(t),r,n))yield{line:i,row:{doc:o,table:e}}},"lt"),mt=l(async(t,e,r,n)=>{try{let{columns:o}=await t.query(it,{table:n},L(r));return{kinds:new Map(o.map(i=>[i.name,i.type])),nullOnEmpty:tt(o)}}catch(o){return{failure:e("Couldn't read the columns of {table}: {message}",{message:q(o),table:n})}}},"at"),pe=50,ft=500,R=9e5,Q=l(t=>new TextEncoder().encode(JSON.stringify(K(t))).byteLength,"V"),_="application/x-ndjson",Ne=l(t=>new A("INTERNAL",`line ${t.toString()}: a single row is over the ${R.toString()}-byte import limit`),"ae"),ht=l(async t=>{let e=0;for await(let{line:r,row:n}of t){if(Q(n)>R)throw Ne(r);e+=1}return e},"dt"),pt=l(async(t,e,r,n)=>{let o={rows:0};if(await rt(G(t),r,n,({doc:i,record:s})=>{o.rows+=1,o.wide===void 0&&Q({doc:i,table:e})>R&&(o.wide=s)}),o.wide!==void 0)throw Ne(o.wide);return o.rows},"ut"),we=l(async(t,e)=>{let r=[],n=0,o=0,i=0;for await(let{line:s,row:m}of t){let f=Q(m),a=s!==i+1;r.length>0&&(a||r.length===ft||n+f>R)&&(await e(r,o),r=[],n=0),r.length===0&&(o=s),r.push(m),n+=f,i=s}r.length>0&&await e(r,o)},"ne"),wt=/\.csv$/iu,gt=l(t=>wt.test(t.name)||t.type==="text/csv","mt"),bt=l((t,e)=>t.expected==="boolean"?e("line {line}: column \u201C{column}\u201D must be true or false, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.tooLong===!0?e("line {line}: column \u201C{column}\u201D holds an integer longer than the import can send.",{column:t.column,line:t.record}):t.expected==="bigint"?e("line {line}: column \u201C{column}\u201D must be an integer, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.expected==="date"?e("line {line}: column \u201C{column}\u201D must be an ISO-8601 date or epoch milliseconds of at least 11 digits, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}):t.inexact===!0?e("line {line}: column \u201C{column}\u201D holds \u201C{value}\u201D, which a number column cannot store exactly. Store a whole number past 9007199254740991 in a bigint column.",{column:t.column,line:t.record,value:t.value}):e("line {line}: column \u201C{column}\u201D must be a number, got \u201C{value}\u201D.",{column:t.column,line:t.record,value:t.value}),"ht"),xt=l((t,e)=>t.kind==="duplicate-header"?e("The header \u201C{name}\u201D appears more than once.",{name:t.name}):t.kind==="empty-header"?e("Header column {column} is empty.",{column:t.column}):t.kind==="ragged"?e("line {line}: expected {expected} cells, found {found}.",{expected:t.expected,found:t.found,line:t.record}):t.kind==="cell-type"?bt(t,e):t.kind==="text-after-quote"?e("line {line}: text follows a closing quote.",{line:t.record}):e("line {line}: a quoted field is never closed.",{line:t.record}),"pt"),yt=l((t,e,r)=>{let n=e instanceof j?xt(e.problem,r):q(e);return t===null?r("Invalid NDJSON: {message}",{message:n}):r("Invalid CSV: {message}",{message:n})},"wt"),vt=l(t=>{let e=(0,ge.c)(31),{onChange:r,shardKey:n,value:o}=t,i=V(),s;e[0]!==n?(s={shardKey:n},e[0]=n,e[1]=s):s=e[1];let{data:m}=re(E.listTables,lt,s),f;e[2]!==r?(f=l(T=>{r(T??"")},"d"),e[2]=r,e[3]=f):f=e[3];let a;e[4]!==i?(a=i("Target table"),e[4]=i,e[5]=a):a=e[5];let d;e[6]!==i?(d=i("Choose a table"),e[6]=i,e[7]=d):d=e[7];let h;e[8]!==d?(h=(0,c.jsx)(ae,{placeholder:d}),e[8]=d,e[9]=h):h=e[9];let v;e[10]!==a||e[11]!==h?(v=(0,c.jsx)(ce,{"aria-label":a,className:"w-56","data-testid":"ei-csv-table",children:h}),e[10]=a,e[11]=h,e[12]=v):v=e[12];let w;e[13]!==m?(w=m??[],e[13]=m,e[14]=w):w=e[14];let p;e[15]!==w?(p=w.map(kt),e[15]=w,e[16]=p):p=e[16];let b;e[17]!==p?(b=(0,c.jsx)(de,{children:p}),e[17]=p,e[18]=b):b=e[18];let k;e[19]!==f||e[20]!==v||e[21]!==b||e[22]!==o?(k=(0,c.jsxs)(se,{onValueChange:f,value:o,children:[v,b]}),e[19]=f,e[20]=v,e[21]=b,e[22]=o,e[23]=k):k=e[23];let N;e[24]!==i?(N=i("CSV rows have no table column, so choose the table they go into."),e[24]=i,e[25]=N):N=e[25];let g;e[26]!==N?(g=(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:N}),e[26]=N,e[27]=g):g=e[27];let u;return e[28]!==k||e[29]!==g?(u=(0,c.jsxs)("div",{className:"flex flex-col gap-1.5",children:[k,g]}),e[28]=k,e[29]=g,e[30]=u):u=e[30],u},"gt"),ke=l(t=>Object.values(t).reduce((e,r)=>e+r,0),"ce"),Nt=l(async(t,e,r,n,o,i)=>{let s={conflicts:0,errors:[],inserted:{}},m,f=i===null?{kinds:new Map,nullOnEmpty:new Set}:await mt(t,e,r,i);if("failure"in f)return{failure:{message:f.failure,rows:0},total:s};let{kinds:a,nullOnEmpty:d}=f;try{if(i===null){let u=l(()=>dt(o),"f");m={rows:await ht(u()),source:u}}else m={rows:await pt(o,i,a,d),source:l(()=>ut(o,i,a,d),"source")}}catch(u){return{failure:{message:yt(i,u,e),rows:0},total:s}}let{rows:h,source:v}=m;if(i!==null&&h===0)return{failure:{message:e("The CSV has no data rows after the header."),rows:0},total:s};let w={conflicts:0,errors:[],inserted:{}};n(e("Checking {total} rows before writing\u2026",{total:h}));try{if((await t.query(Y,{dryRun:!0,rows:[],startLine:1},L(r))).dryRun!==!0)return{failure:{message:e("This shard predates import checks, so it would write the file while checking it. Nothing was sent. Update the app and import again."),rows:0},total:s};await we(v(),async(u,T)=>{let I=await t.query(Y,{dryRun:!0,rows:u,startLine:T},L(r));w.errors.push(...I.errors)})}catch(u){return{failure:{message:q(u),rows:0},total:s}}if(w.errors.length>0)return{failure:{message:e("Nothing was written, because some rows would be refused. Fix the rows listed below and import again."),rows:0},total:w};let p=0,b=1,k={},N={},g=l(async(u,T)=>{n(e("Importing rows {from}\u2013{to} of {total}\u2026",{from:p+1,to:p+u.length,total:h})),N.startLine=T;let I=await t.query(Y,{dryRun:!1,rows:u,startLine:T},L(r));N.startLine=void 0,s.conflicts+=I.conflicts,s.errors.push(...I.errors);for(let[$,M]of Object.entries(I.inserted))s.inserted[$]=(s.inserted[$]??0)+M;if(p+=u.length,b=T+u.length,I.errors.length>0){let $=ke(s.inserted);throw k.refused=!0,new Error($===0?e("The shard refused {count} rows, so the rest of the file was not sent. Nothing was written. Fix the rows listed below and import again.",{count:I.errors.length}):e("The shard refused {count} rows, so the rest of the file was not sent. {written} rows were already written, so do not import the whole file again. Import the refused rows and any rows from line {line} onward, or delete the written rows first and then import the whole file.",{count:I.errors.length,line:T+u.length,written:$}))}},"w");try{return await we(v(),g),{failure:void 0,total:s}}catch(u){return{failure:{message:q(u),nextLine:b,rows:p,unknownFrom:N.startLine,...k},total:s}}},"xt"),Dt=l(({initialShardKey:t})=>{let e=te(),r=ne(),n=V(),[o,i]=(0,S.useState)(t??""),[s,m]=(0,S.useState)(null),[f,a]=(0,S.useState)(null),[d,h]=(0,S.useState)(!1),[v,w]=(0,S.useState)(null),[p,b]=(0,S.useState)(null),[k,N]=(0,S.useState)(null),[g,u]=(0,S.useState)(null),T=s!==null&>(s),I=f!==null&&f.shardKey===o?f.table:"",$=s!==null&&(!T||I!==""),M=l(async()=>{let x=o;h(!0),w(null),b(null),u(null);try{let F=await e.query(ot,{},L(x)),y=new Blob([],{type:_}),C=0,B=[];for(let{name:Le}of F){let{rows:U}=await e.query(nt,{tables:[Le]},L(x));if(U.length===0)continue;let X=st(U);y=new Blob([y,`${X}
|
|
6
|
-
`],{type:_}),C+=U.length,B.length<pe&&B.push(...X.split(`
|
|
7
|
-
`).slice(0,pe-B.length))}H(x),u({blob:y,count:C,preview:B.join(`
|
|
8
|
-
`),shardKey:x})}catch(F){w(q(F))}},"B"),Te=l(async(x,F)=>{h(!0),w(null),b(null),u(null);let{failure:y,total:C}=await Nt(e,n,o,N,x,F);y===void 0?(H(o),b(C)):y.unknownFrom===void 0&&(y.refused===!0||y.rows===0)?(C.errors.length>0&&b(C),w(y.message)):y.unknownFrom===void 0?(b(C),w(n("Import stopped after {rows} rows: {message}. The counts below cover those rows. Rows from line {line} onward were not sent: do not import the whole file again, import from that line onward, or delete the written rows first and then import the whole file.",{line:y.nextLine,message:y.message,rows:y.rows}))):(b(C),w(n("Import stopped after {rows} rows: {message}. The counts below cover completed chunks only. The chunk from line {line} may have written rows: check the table for rows from line {line} onward before importing again, or delete the written rows first and then import the whole file.",{line:y.unknownFrom,message:y.message,rows:y.rows}))),r(E.readTablePage),r(E.listTables)},"de"),Ie=p===null?0:ke(p.inserted),je=l(()=>{z(M().finally(()=>{h(!1)}))},"fe"),Se=l(()=>{s!==null&&$&&z(Te(s,T?I:null).finally(()=>{N(null),h(!1)}))},"me"),$e=l(()=>{g!==null&&le(`${g.shardKey.trim()===""?"shard":g.shardKey.trim()}.ndjson`,g.blob,_)},"he"),Ce=l(x=>{m(x.target.files?.[0]??null),a(null)},"pe"),Ee=l(x=>{a({shardKey:o,table:x})},"we");return(0,c.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-export-import",children:[(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Export")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)(oe,{onChange:i,testId:"ei-shard-input",value:o}),(0,c.jsx)(Z,{"data-testid":"ei-export",disabled:d,onClick:je,type:"button",children:n("Export")})]}),g!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,c.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-export-result",children:n("Exported {count} rows.",{count:g.count})}),(0,c.jsx)(Z,{"data-testid":"ei-download",onClick:$e,size:"sm",type:"button",variant:"outline",children:n("Download")})]}),g.preview!==""&&(0,c.jsx)("pre",{className:"max-h-60 overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"ei-preview",children:g.preview})]})]})]}),(0,c.jsxs)(P,{className:"gap-0 py-0 rounded-xl border border-border bg-card shadow-xs",children:[(0,c.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,c.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n("Import")})}),(0,c.jsxs)(W,{className:"flex flex-col gap-3 p-4",children:[(0,c.jsx)("input",{accept:".ndjson,.jsonl,.csv,application/x-ndjson,text/csv","aria-label":n("Import file"),className:"text-sm","data-testid":"ei-file",onChange:Ce,type:"file"}),T&&(0,c.jsx)(vt,{onChange:Ee,shardKey:o,value:I}),(0,c.jsx)("div",{className:"flex flex-wrap items-center gap-2",children:(0,c.jsx)(ie,{confirmLabel:n("Import (writes rows)?"),disabled:d||!$,onConfirm:Se,testId:"ei-import",children:n("Import")})}),k!==null&&(0,c.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ei-progress",role:"status",children:k}),p!==null&&(0,c.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ei-import-result",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:n("Inserted {inserted}, {conflicts} conflicts, {errors} errors.",{conflicts:p.conflicts,errors:p.errors.length,inserted:Ie})}),p.errors.length>0&&(0,c.jsx)("ul",{className:"flex flex-col gap-1","data-testid":"ei-import-errors",children:p.errors.map(x=>(0,c.jsx)("li",{className:"text-xs text-destructive",children:n("line {line} ({table}): {message}",{line:x.line,message:x.message,table:x.table})},`${x.table}-${x.line.toString()}`))})]})]})]}),v!==null&&(0,c.jsx)("p",{className:"text-sm text-destructive","data-testid":"ei-error",role:"alert",children:v})]})},"$t");function kt(t){return(0,c.jsx)(ue,{value:t.name,children:t.name},t.name)}l(kt,"vt");export{Dt as ExportImportPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as oe}from"./chunk-P6L6ABWO.js";import{a as se}from"./chunk-ZWDORIZY.js";import{i as ae}from"./chunk-SDQH4HR6.js";import"./chunk-W7MRISE3.js";import"./chunk-IBJVVHV5.js";import{a as A}from"./chunk-2O6KKVH2.js";import"./chunk-JTGGWF7R.js";import"./chunk-ZBON5T5A.js";import"./chunk-4C4THJUD.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-YJ2WHOGO.js";import{p as te}from"./chunk-U76DVXTR.js";import"./chunk-WZTY3ZYI.js";import{a as G}from"./chunk-3Y5K3IQO.js";import{a as _,b as J,c as j,d as y,e as i,f as d}from"./chunk-CW57Q264.js";import{a as E,e as F}from"./chunk-MD67S53Z.js";import{f as K,h as Y,i as Z,j as T,p as ee,s as R}from"./chunk-LPINY2IJ.js";import{a as s,d as X,e as ie,f as de,g as ce}from"./chunk-OXFKZ4BM.js";var l=X(ie(),1);var le=X(de(),1);var e=X(ce(),1);var me=["queued","running","rollingBack","paused","waiting","complete","errored","terminated"],ue=["pause","resume","restart","terminate"],fe=s(o=>{let r=(0,le.c)(7),{busy:w,id:k,onAct:h}=o,x=K(),n;r[0]!==w||r[1]!==k||r[2]!==h||r[3]!==x?(n=ue.map(c=>c==="restart"?(0,e.jsx)(se,{confirmLabel:x("Restart?"),disabled:w,onConfirm:s(()=>{h(c)},"onConfirm"),testId:`workflow-instance-${c}-${k}`,children:x(c)},c):(0,e.jsx)(A,{"data-testid":`workflow-instance-${c}-${k}`,disabled:w,onClick:s(()=>{h(c)},"onClick"),size:"sm",type:"button",variant:"ghost",children:x(c)},c)),r[0]=w,r[1]=k,r[2]=h,r[3]=x,r[4]=n):n=r[4];let p;return r[5]!==n?(p=(0,e.jsx)(e.Fragment,{children:n}),r[5]=n,r[6]=p):p=r[6],p},"me"),he="WORKFLOWS_NOT_CONFIGURED",pe=s(o=>typeof o=="object"&&o!==null&&o.code===he,"he"),we=s(o=>{let r=o.error??o.output;if(r===void 0)return"\u2014";try{return JSON.stringify(r,ee)}catch{return"(unserializable)"}},"pe"),xe=s(({loadDetail:o,loadInstances:r,readOnly:w,runAction:k,workflowName:h})=>{let x=te(),n=K(),[p,c]=(0,l.useState)(null),[O,$]=(0,l.useState)(null),[S,z]=(0,l.useState)(""),[C,v]=(0,l.useState)(null),[L,W]=(0,l.useState)(!1),[P,U]=(0,l.useState)(null),N=(0,l.useRef)(0),g=(0,l.useRef)(0),b=(0,l.useRef)(0),B=o??(a=>x.getWorkflowInstance(a)),D=w?void 0:k??(r===void 0?a=>x.setWorkflowInstanceStatus(a):void 0),q=s(async()=>{g.current+=1;let a=g.current;v(null),W(!1);let u=S===""?void 0:S;try{if(r===void 0){let m=await x.listWorkflowInstances({name:h,status:u});if(a!==g.current)return;if(m.configured===!1){c(null),W(!0);return}c(m.instances);return}let t=await r({name:h,status:u});a===g.current&&c(t)}catch(t){if(a!==g.current)return;c(null),pe(t)?W(!0):v(T(t))}},"P");(0,l.useEffect)(()=>{N.current+=1,b.current+=1,$(null),R(q())},[h,S]);let H=s(async a=>{b.current+=1;let u=b.current;v(null);try{let t=await B({id:a,name:h});u===b.current&&$(t)}catch(t){u===b.current&&v(T(t))}},"B"),Q=s(()=>{b.current+=1,$(null)},"J"),V=s(async(a,u)=>{if(D===void 0)return;let t=N.current;U(a),v(null);try{await D({action:u,id:a,name:h}),t===N.current&&await q()}catch(m){v(T(m))}U(null)},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-workflow-instances",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:n("Instance history")}),(0,e.jsxs)("select",{"aria-label":n("Filter by status"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflow-instances-filter",onChange:s(a=>{z(a.target.value)},"onChange"),value:S,children:[(0,e.jsx)("option",{value:"",children:n("All statuses")}),me.map(a=>(0,e.jsx)("option",{value:a,children:a},a))]})]}),C!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflow-instances-error",role:"alert",children:C}),L&&(0,e.jsx)(G,{description:n("Set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_API_TOKEN in your .dev.vars to enable workflow instance history."),testId:"workflow-instances-unconfigured",title:n("Workflow inspection not configured")}),!L&&p!==null&&p.length===0&&(0,e.jsx)(G,{description:n("No instances match this filter for the selected workflow."),testId:"workflow-instances-empty",title:n("No instances")}),p!==null&&p.length>0&&(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(_,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(J,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:n("Instance id")}),(0,e.jsx)(i,{children:n("Status")}),(0,e.jsx)(i,{children:n("Created")}),(0,e.jsx)(i,{children:n("Ended")}),(0,e.jsx)(i,{"aria-label":n("Actions")})]})}),(0,e.jsx)(j,{children:p.map(a=>(0,e.jsxs)(y,{"data-testid":`workflow-instance-${a.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:a.status}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.createdOn??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.endedOn??"\u2014"}),(0,e.jsx)(d,{className:"text-right",children:(0,e.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,e.jsx)(A,{"data-testid":`workflow-instance-steps-${a.id}`,onClick:s(()=>{R(H(a.id))},"onClick"),size:"sm",type:"button",variant:"outline",children:n("Steps")}),D!==void 0&&(0,e.jsx)(fe,{busy:P===a.id,id:a.id,onAct:s(u=>{R(V(a.id,u))},"onAct")},h)]})})]},a.id))})]})})}),O!==null&&(0,e.jsx)(E,{className:"overflow-hidden py-0","data-testid":"workflow-instance-detail",children:(0,e.jsxs)(F,{className:"flex flex-col gap-2 px-4 py-3",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsxs)("span",{className:"font-mono text-xs",children:[n("Steps")," \xB7 ",O.id]}),(0,e.jsx)(A,{"data-testid":"workflow-instance-detail-close",onClick:Q,size:"xs",type:"button",variant:"ghost",children:n("Close")})]}),O.steps.length===0?(0,e.jsx)("p",{className:"text-xs text-muted-foreground",children:n("This instance has no recorded steps yet.")}):(0,e.jsxs)(_,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(J,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:n("Step")}),(0,e.jsx)(i,{children:n("Type")}),(0,e.jsx)(i,{children:n("Attempts")}),(0,e.jsx)(i,{children:n("Started")}),(0,e.jsx)(i,{children:n("Output")})]})}),(0,e.jsx)(j,{children:O.steps.map((a,u)=>(0,e.jsxs)(y,{"data-testid":`workflow-step-${String(u)}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:a.name}),(0,e.jsx)(d,{className:"text-xs text-muted-foreground",children:a.type??"\u2014"}),(0,e.jsx)(d,{className:"tabular-nums",children:a.attempts??"\u2014"}),(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:a.start??"\u2014"}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:we(a)})]},`${a.name}:${String(u)}`))})]})]})})]})},"xe"),Ne=Y(M.createWorkflowInstance),ge=Y(M.getWorkflowInstanceStatus),ke=s(o=>{if(o.error)return`${o.error.name}: ${o.error.message}`;if(o.output===void 0)return"\u2014";try{return JSON.stringify(o.output,ee)}catch{return"(unserializable)"}},"ge"),ve=s((o,r)=>o.some(w=>w.exportName===r)?r:o[0]?.exportName??"","be"),Ee=s(()=>{let o=te(),r=K(),{data:w,error:k}=ne(M.listWorkflows,{}),[h,x]=(0,l.useState)(""),[n,p]=(0,l.useState)(""),[c,O]=(0,l.useState)(""),[$,S]=(0,l.useState)(!1),[z,C]=(0,l.useState)(null),[v,L]=(0,l.useState)([]),[W,P]=(0,l.useState)(null),U=w!==void 0,N=Array.isArray(w?.workflows)?[...w.workflows].toSorted((t,m)=>t.exportName.localeCompare(m.exportName)):[],g=ve(N,h),b=N.find(t=>t.exportName===g),B=s(t=>{L(m=>{let f=m.filter(I=>!(I.exportName===t.exportName&&I.id===t.id));return[t,...f]})},"D"),D=s(async()=>{let t=g;if(t==="")return;let m,f=c.trim();if(f!=="")try{m=JSON.parse(f)}catch{C(r("Params must be valid JSON"));return}S(!0),C(null);try{let I=n.trim(),re=await o.query(Ne,{exportName:t,id:I===""?void 0:I,params:m},Z(""));B({exportName:t,id:re.id,status:re.status}),p("")}catch(I){C(T(I))}S(!1)},"V"),q=s(()=>{R(D())},"X"),H=s(async(t,m)=>{P(m);try{let f=await o.query(ge,{exportName:t,id:m},Z(""));B({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){C(T(f))}P(null)},"T"),Q=s(t=>{x(t.target.value)},"P"),V=s(t=>{p(t.target.value)},"B"),a=s(t=>{O(t.target.value)},"J"),u=s(t=>{let{export:m,id:f}=t.currentTarget.dataset;m!==void 0&&f!==void 0&&R(H(m,f))},"K");return(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-workflows-panel",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-error",role:"alert",children:k}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:r("Workflows are declared in code with defineWorkflow and run as durable Cloudflare Workflows. Start an instance and observe its status below.")}),U&&N.length===0?(0,e.jsx)(G,{description:r("No defineWorkflow is declared in lunora/workflows.ts in this deployment. Add one to run a durable, multi-step workflow."),testId:"workflows-empty",title:r("No workflows defined")}):(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(_,{"data-testid":"workflows-table",children:[(0,e.jsx)(J,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:r("Export")}),(0,e.jsx)(i,{children:r("Name")}),(0,e.jsx)(i,{children:r("Class")})]})}),(0,e.jsx)(j,{children:N.map(t=>(0,e.jsxs)(y,{"data-testid":`workflows-row-${t.exportName}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.name}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.className})]},t.exportName))})]})})}),N.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-start",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Start instance")}),z!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:z}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("select",{"aria-label":r("Workflow"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"workflows-start-select",onChange:Q,value:g,children:N.map(t=>(0,e.jsx)("option",{value:t.exportName,children:t.exportName},t.exportName))}),(0,e.jsx)(ae,{"aria-label":r("Instance id (optional)"),className:"max-w-48","data-testid":"workflows-start-id",onChange:V,placeholder:r("Instance id (optional)"),value:n}),(0,e.jsx)(A,{"data-testid":"workflows-start-button",disabled:$||g==="",onClick:q,children:r($?"Starting\u2026":"Start instance")})]}),(0,e.jsx)(oe,{"aria-label":r("Params (JSON)"),className:"font-mono","data-testid":"workflows-start-params",onChange:a,placeholder:r("Params (JSON, optional)"),value:c})]}),v.length>0&&(0,e.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"workflows-instances",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:r("Instances")}),(0,e.jsx)(E,{className:"overflow-hidden py-0",children:(0,e.jsx)(F,{className:"px-0",children:(0,e.jsxs)(_,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(J,{children:(0,e.jsxs)(y,{children:[(0,e.jsx)(i,{children:r("Workflow")}),(0,e.jsx)(i,{children:r("Instance id")}),(0,e.jsx)(i,{children:r("Status")}),(0,e.jsx)(i,{children:r("Output")}),(0,e.jsx)(i,{})]})}),(0,e.jsx)(j,{children:v.map(t=>(0,e.jsxs)(y,{"data-testid":`workflows-instance-${t.id}`,children:[(0,e.jsx)(d,{className:"font-mono text-xs",children:t.exportName}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:t.id}),(0,e.jsx)(d,{className:"font-mono text-xs",children:t.status}),(0,e.jsx)(d,{className:"font-mono text-xs text-muted-foreground",children:ke(t)}),(0,e.jsx)(d,{children:(0,e.jsx)(A,{"data-export":t.exportName,"data-id":t.id,"data-testid":`workflows-instance-refresh-${t.id}`,disabled:W===t.id,onClick:u,size:"xs",variant:"outline",children:W===t.id?r("Refreshing\u2026"):r("Refresh")})})]},`${t.exportName}:${t.id}`))})]})})})]}),b!==void 0&&(0,e.jsx)(xe,{workflowName:b.name})]})},"De");export{Ee as default};
|