@lunora/studio 1.0.0-alpha.348 → 1.0.0-alpha.349
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/standalone/{chunk-UJFT3C53.js → chunk-4H5PBJNF.js} +1 -1
- package/dist/standalone/{chunk-4TYCTORB.js → chunk-4UBF7HMZ.js} +1 -1
- package/dist/standalone/{chunk-IIU4TZRG.js → chunk-533J6WYA.js} +1 -1
- package/dist/standalone/{chunk-MT4E42PB.js → chunk-5J4FLDJH.js} +1 -1
- package/dist/standalone/{chunk-CCTWURT3.js → chunk-5ZNIQENA.js} +1 -1
- package/dist/standalone/{chunk-E4Y6TF6C.js → chunk-63QLK2KW.js} +1 -1
- package/dist/standalone/{chunk-SQYX2Z5H.js → chunk-63Z6OJ6G.js} +1 -1
- package/dist/standalone/{chunk-V7IFSDTT.js → chunk-75M6ZLLS.js} +1 -1
- package/dist/standalone/{chunk-R37RA67H.js → chunk-7EHAUFJY.js} +1 -1
- package/dist/standalone/{chunk-3FWAGIOT.js → chunk-7TN6VTTF.js} +1 -1
- package/dist/standalone/{chunk-UD7BKB4T.js → chunk-AWWECTQT.js} +1 -1
- package/dist/standalone/{chunk-WQW4IPHB.js → chunk-AXL4YZJR.js} +1 -1
- package/dist/standalone/{chunk-R75AFV7G.js → chunk-C7FJ2JKY.js} +1 -1
- package/dist/standalone/{chunk-6TJHYXQW.js → chunk-COK5BCWN.js} +1 -1
- package/dist/standalone/{chunk-L4BDA4VZ.js → chunk-CULVXE3K.js} +1 -1
- package/dist/standalone/{chunk-XEGAP64U.js → chunk-CWPBPBWJ.js} +1 -1
- package/dist/standalone/{chunk-JD6SCY7V.js → chunk-E4BAGQ53.js} +1 -1
- package/dist/standalone/{chunk-R457VG7L.js → chunk-EBTYSPZB.js} +1 -1
- package/dist/standalone/{chunk-B57UZJ6W.js → chunk-EC5PMSQ6.js} +1 -1
- package/dist/standalone/{chunk-IQ3SMVFW.js → chunk-G43F7LYA.js} +1 -1
- package/dist/standalone/{chunk-NARRSYMQ.js → chunk-GC5UHRDR.js} +1 -1
- package/dist/standalone/{chunk-XR2JH2A7.js → chunk-GRHO2IUN.js} +1 -1
- package/dist/standalone/{chunk-6FZLAL4W.js → chunk-H467GBSD.js} +1 -1
- package/dist/standalone/chunk-HBO4SMAO.js +15 -0
- package/dist/standalone/{chunk-FTN4XJOQ.js → chunk-HBTGWHTW.js} +1 -1
- package/dist/standalone/{chunk-KCPZ4P6C.js → chunk-HZTJLEIJ.js} +1 -1
- package/dist/standalone/{chunk-XCWVO6DI.js → chunk-I57ZVLUB.js} +1 -1
- package/dist/standalone/{chunk-2PMCHTCC.js → chunk-IRKWOUXO.js} +1 -1
- package/dist/standalone/{chunk-EGYPW6UY.js → chunk-IUSKFS3B.js} +1 -1
- package/dist/standalone/{chunk-ATVMUIBN.js → chunk-L5MI4PTP.js} +1 -1
- package/dist/standalone/{chunk-TET2ESOI.js → chunk-LVIL2SFA.js} +1 -1
- package/dist/standalone/{chunk-6XPDVZVB.js → chunk-LYQZERWS.js} +1 -1
- package/dist/standalone/{chunk-BOMFGCKX.js → chunk-MPEIBWCJ.js} +1 -1
- package/dist/standalone/{chunk-N45O7D5G.js → chunk-NCFYQR4L.js} +1 -1
- package/dist/standalone/{chunk-WW7D5RFR.js → chunk-NOS2OC45.js} +1 -1
- package/dist/standalone/{chunk-JGUKFZ3R.js → chunk-OQ2ORNN6.js} +1 -1
- package/dist/standalone/{chunk-C7SAXSO3.js → chunk-OVBYLXPD.js} +1 -1
- package/dist/standalone/{chunk-U7KUGVBB.js → chunk-OWQHP4KI.js} +1 -1
- package/dist/standalone/{chunk-LI2GRPOB.js → chunk-PKSRXFSZ.js} +1 -1
- package/dist/standalone/{chunk-EFGDGZHN.js → chunk-QC2GLF3I.js} +1 -1
- package/dist/standalone/{chunk-4GHCKQLY.js → chunk-QFK4UI4Q.js} +1 -1
- package/dist/standalone/{chunk-EPI4SHLN.js → chunk-QJ4AALXU.js} +1 -1
- package/dist/standalone/{chunk-M7HCYBJJ.js → chunk-R3RBUT32.js} +1 -1
- package/dist/standalone/{chunk-5YLFS5NU.js → chunk-RNYOBPQA.js} +1 -1
- package/dist/standalone/{chunk-T2JHVL34.js → chunk-RX755NMO.js} +1 -1
- package/dist/standalone/{chunk-MFZF7GEM.js → chunk-RYBLB23Z.js} +1 -1
- package/dist/standalone/{chunk-RTWSDGPV.js → chunk-S3EWTSAN.js} +1 -1
- package/dist/standalone/{chunk-JLQPIE3Z.js → chunk-S4AR74DJ.js} +2 -2
- package/dist/standalone/{chunk-KEHDC5BQ.js → chunk-SFMIR4YV.js} +1 -1
- package/dist/standalone/{chunk-4HYPC5NN.js → chunk-SROQCZ3P.js} +1 -1
- package/dist/standalone/{chunk-TNPF3XGI.js → chunk-T4SIZOJG.js} +1 -1
- package/dist/standalone/{chunk-GDP3S4GQ.js → chunk-U37BPX5J.js} +1 -1
- package/dist/standalone/{chunk-34OJ2OXP.js → chunk-UFZVSXRW.js} +1 -1
- package/dist/standalone/{chunk-XCVO3IAH.js → chunk-UQWGBWQ3.js} +1 -1
- package/dist/standalone/{chunk-PTIKIQY6.js → chunk-V6LPISRQ.js} +1 -1
- package/dist/standalone/{chunk-TVSU6RYZ.js → chunk-VFFW3ANI.js} +1 -1
- package/dist/standalone/{chunk-5TQHZVNN.js → chunk-WEPM5G3R.js} +1 -1
- package/dist/standalone/{chunk-XJPJSZ4W.js → chunk-WGBAHXMK.js} +1 -1
- package/dist/standalone/{chunk-6BELLPMP.js → chunk-WGUN4FNJ.js} +1 -1
- package/dist/standalone/{chunk-XT6GSN64.js → chunk-WNMY5ZKL.js} +1 -1
- package/dist/standalone/{chunk-6I2QO7SE.js → chunk-WOEHFC4J.js} +1 -1
- package/dist/standalone/{chunk-QDHFLZ3N.js → chunk-WX647YQ7.js} +1 -1
- package/dist/standalone/chunk-YBDF3DET.js +7 -0
- package/dist/standalone/{chunk-PQ6DUCKC.js → chunk-YJI56OCF.js} +1 -1
- package/dist/standalone/{chunk-RLVR5BRF.js → chunk-YUPEDAX3.js} +1 -1
- package/dist/standalone/{chunk-KNUGID7F.js → chunk-ZN7TURF4.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/standalone/chunk-3I25WO3P.js +0 -15
- package/dist/standalone/chunk-AVSMQPR3.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as oe}from"./chunk-FPI7AMQJ.js";import{a as se}from"./chunk-LXCVA5SP.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as A}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-T2JHVL34.js";import{l as Y}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as G}from"./chunk-RWVIV3U7.js";import{a as L,b as _,c as J,d as y,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as E,e as F}from"./chunk-2IKDEUCX.js";import{d as K,f as Z,g as ee,h as T,n as te,q as R}from"./chunk-74IYYDDI.js";import{a as s,d as X,e as ie,f as de,g as ce}from"./chunk-I26MS5PJ.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,te)}catch{return"(unserializable)"}},"pe"),xe=s(({loadDetail:o,loadInstances:r,readOnly:w,runAction:k,workflowName:h})=>{let x=Y(),n=K(),[p,c]=(0,l.useState)(null),[O,$]=(0,l.useState)(null),[S,j]=(0,l.useState)(""),[C,v]=(0,l.useState)(null),[z,W]=(0,l.useState)(!1),[U,B]=(0,l.useState)(null),N=(0,l.useRef)(0),g=(0,l.useRef)(0),b=(0,l.useRef)(0),P=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))}},"L");(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 P({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;B(a),v(null);try{await D({action:u,id:a,name:h}),t===N.current&&await q()}catch(m){v(T(m))}B(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=>{j(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}),z&&(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")}),!z&&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)(L,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(_,{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:U===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)(L,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(_,{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=Z(M.createWorkflowInstance),ge=Z(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,te)}catch{return"(unserializable)"}},"ge"),ve=s((o,r)=>o.some(w=>w.exportName===r)?r:o[0]?.exportName??"","be"),Ee=s(()=>{let o=Y(),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),[j,C]=(0,l.useState)(null),[v,z]=(0,l.useState)([]),[W,U]=(0,l.useState)(null),B=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),P=s(t=>{z(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},ee(""));P({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)=>{U(m);try{let f=await o.query(ge,{exportName:t,id:m},ee(""));P({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){C(T(f))}U(null)},"T"),Q=s(t=>{x(t.target.value)},"L"),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.")}),B&&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)(L,{"data-testid":"workflows-table",children:[(0,e.jsx)(_,{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")}),j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),(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)(L,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(_,{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};
|
|
1
|
+
import{a as oe}from"./chunk-FPI7AMQJ.js";import{a as se}from"./chunk-LXCVA5SP.js";import{i as ae}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as A}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as M}from"./chunk-4ZEL6BYL.js";import{c as ne}from"./chunk-RX755NMO.js";import{l as Y}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import"./chunk-HBO4SMAO.js";import{a as G}from"./chunk-RWVIV3U7.js";import{a as L,b as _,c as J,d as y,e as i,f as d}from"./chunk-HCTJKP5J.js";import{a as E,e as F}from"./chunk-2IKDEUCX.js";import{d as K,f as Z,g as ee,h as T,n as te,q as R}from"./chunk-74IYYDDI.js";import{a as s,d as X,e as ie,f as de,g as ce}from"./chunk-I26MS5PJ.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,te)}catch{return"(unserializable)"}},"pe"),xe=s(({loadDetail:o,loadInstances:r,readOnly:w,runAction:k,workflowName:h})=>{let x=Y(),n=K(),[p,c]=(0,l.useState)(null),[O,$]=(0,l.useState)(null),[S,j]=(0,l.useState)(""),[C,v]=(0,l.useState)(null),[z,W]=(0,l.useState)(!1),[U,B]=(0,l.useState)(null),N=(0,l.useRef)(0),g=(0,l.useRef)(0),b=(0,l.useRef)(0),P=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))}},"L");(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 P({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;B(a),v(null);try{await D({action:u,id:a,name:h}),t===N.current&&await q()}catch(m){v(T(m))}B(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=>{j(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}),z&&(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")}),!z&&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)(L,{"data-testid":"workflow-instances-table",children:[(0,e.jsx)(_,{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:U===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)(L,{"data-testid":"workflow-instance-steps",children:[(0,e.jsx)(_,{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=Z(M.createWorkflowInstance),ge=Z(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,te)}catch{return"(unserializable)"}},"ge"),ve=s((o,r)=>o.some(w=>w.exportName===r)?r:o[0]?.exportName??"","be"),Ee=s(()=>{let o=Y(),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),[j,C]=(0,l.useState)(null),[v,z]=(0,l.useState)([]),[W,U]=(0,l.useState)(null),B=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),P=s(t=>{z(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},ee(""));P({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)=>{U(m);try{let f=await o.query(ge,{exportName:t,id:m},ee(""));P({error:f.error,exportName:t,id:f.id,output:f.output,status:f.status})}catch(f){C(T(f))}U(null)},"T"),Q=s(t=>{x(t.target.value)},"L"),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.")}),B&&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)(L,{"data-testid":"workflows-table",children:[(0,e.jsx)(_,{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")}),j!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"workflows-start-error",role:"alert",children:j}),(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)(L,{"data-testid":"workflows-instances-table",children:[(0,e.jsx)(_,{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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as se,b as ae,c as ce,d as de,e as ue}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import{c as le}from"./chunk-XCYFP44W.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import"./chunk-QJLHH3ET.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as ie}from"./chunk-LXCVA5SP.js";import{a as oe}from"./chunk-7Q256NLI.js";import{b as H}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as Z}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as C}from"./chunk-4ZEL6BYL.js";import{c as re,d as ne}from"./chunk-
|
|
1
|
+
import{a as se,b as ae,c as ce,d as de,e as ue}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import{c as le}from"./chunk-XCYFP44W.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import"./chunk-QJLHH3ET.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as ie}from"./chunk-LXCVA5SP.js";import{a as oe}from"./chunk-7Q256NLI.js";import{b as H}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as Z}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{a as C}from"./chunk-4ZEL6BYL.js";import{c as re,d as ne}from"./chunk-RX755NMO.js";import{c as K,d as ee,l as te}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import{d as A}from"./chunk-HBO4SMAO.js";import{a as P,e as W}from"./chunk-2IKDEUCX.js";import{d as V,f as O,g as E,h as q,q as z}from"./chunk-74IYYDDI.js";import{a as l,d as J,e as qe,f as Fe,g as Oe}from"./chunk-I26MS5PJ.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
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
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")}},"Le"),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(C.exportShard),Y=O(C.importShard),ot=O(C.listTables),it=O(C.describeTable),lt={},st=l(t=>t.map(e=>JSON.stringify(K(e))).join(`
|
|
4
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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Ye}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Ve}from"./chunk-FPI7AMQJ.js";import{a as Xe}from"./chunk-4TYCTORB.js";import"./chunk-UC7MNI2F.js";import{a as Ke}from"./chunk-LXCVA5SP.js";import{i as ze}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as de}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as oe}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as He}from"./chunk-R75AFV7G.js";import{a as Ge}from"./chunk-NCPW7WHO.js";import"./chunk-IQ3SMVFW.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Ae}from"./chunk-T2JHVL34.js";import{l as We}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as le}from"./chunk-RWVIV3U7.js";import{a as Le,b as Te,c as _e,d as z,e as I,f as w}from"./chunk-HCTJKP5J.js";import{a as Ee,e as Me}from"./chunk-2IKDEUCX.js";import{d as F,f as ie,g as ce,h as G,n as Pe,q as ue,u as Ue}from"./chunk-74IYYDDI.js";import{a as c,d as Qe,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Qe(ut(),1);var A=Qe(ct(),1);var t=Qe(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),Be="topic:",De=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Qe"),et=c(n=>`${Be}${n}`,"je"),ht=c((n,e)=>n.startsWith(Be)?(e.get(n.slice(Be.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ie(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ce(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:G(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ie(W.replayQueueMessage),Nt=ie(W.clearQueueMessages),Ze=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Pe)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>Ze?`${n.slice(0,Ze)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),tt=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"We"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=De(d),m;e[4]!==r?(m=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]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(le,{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,t.jsx)(Ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(Me,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"queues-table",children:[(0,t.jsx)(Te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(I,{children:r("Export")}),(0,t.jsx)(I,{children:r("Queue")}),(0,t.jsx)(I,{children:r("Mode")}),(0,t.jsx)(I,{children:r("Binding")}),(0,t.jsx)(I,{children:r("Dead-letter")})]})}),(0,t.jsxs)(_e,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(A.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{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]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let H=bt(a.body);o=z,f=`queues-message-${a.id}`;let $=a.exportName??a.queue;e[19]!==$?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:$}),e[19]=$,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let P=`queues-outcome-${a.id}`,E;e[25]!==a.outcome?(E=vt(a.outcome),e[25]=a.outcome,e[26]=E):E=e[26];let _;e[27]!==a.outcome||e[28]!==P||e[29]!==E?(_=(0,t.jsx)(oe,{"data-testid":P,variant:E,children:a.outcome}),e[27]=a.outcome,e[28]=P,e[29]=E,e[30]=_):_=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(oe,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==_||e[36]!==M?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[_,M]})}),e[35]=_,e[36]=M,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=H,p=qt(H),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let b;e[43]!==a.capturedAt?(b=Ue(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=b):b=e[44];let C;e[45]!==b?(C=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[45]=b,e[46]=C):C=e[46];let q=`queues-replay-${a.id}`,v=r!==null,Q;e[47]!==a.id||e[48]!==r||e[49]!==s?(Q=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==d||e[53]!==q||e[54]!==v||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(de,{"data-id":a.id,"data-testid":q,disabled:v,onClick:d,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=d,e[53]=q,e[54]=v,e[55]=Q,e[56]=L):L=e[56];let T;return e[57]!==o||e[58]!==C||e[59]!==L||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?(T=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,C,L]}),e[57]=o,e[58]=C,e[59]=L,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=T):T=e[66],T},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ke,{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]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(oe,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(le,{description:o("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:o("No consumed messages yet.")}):(0,t.jsx)(Ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(Me,{className:"px-0",children:(0,t.jsx)(Ye,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Le,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(I,{children:o("Export")}),(0,t.jsx)(I,{children:o("Message")}),(0,t.jsx)(I,{children:o("Attempts")}),(0,t.jsx)(I,{children:o("Outcome")}),(0,t.jsx)(I,{children:o("Body")}),(0,t.jsx)(I,{children:o("Captured")}),(0,t.jsx)(I,{})]})}),(0,t.jsx)(_e,{children:d.map(C=>(0,t.jsx)(Ct,{message:C,onReplay:s,replayingId:l},C.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let b;return e[26]!==N||e[27]!==y?(b=(0,t.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},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(le,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...De(p).topics].map(C=>{let[q,v]=C;return(0,t.jsx)("option",{value:et(q),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:v.length,topic:q})},q)})]}),(0,t.jsx)(ze,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(de,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Ve,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let b;return e[17]!==N||e[18]!==y?(b=(0,t.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},"_t"),Yt=c(n=>{let e=(0,D.c)(55),{limit:a}=n,d=a??gt,r=We(),s=F(),[l,o]=(0,A.useState)("declared"),[m,i]=(0,A.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Ae(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:b,poll:C,refetch:q}=Ae(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],Q=N?.entries??[],{deadLetteredCount:L,queuesWithoutDlq:T,showReliabilityWarning:H}=pt(v,Q),[$,P]=(0,A.useState)(""),[E,_]=(0,A.useState)(""),[M,at]=(0,A.useState)(""),[U,st]=(0,A.useState)(!1),[me,$e]=(0,A.useState)(!1),[pe,ke]=(0,A.useState)(null),{topics:Oe}=De(v),Re=[...v.map(Tt),...[...Oe.keys()].map(_t)],K=Re.includes($)?$:Re[0]??"",Je=l==="messages"?y:x,nt=l==="messages"?b:u,he=Je??m,ge=Je===null?m:nt;Xe(C,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,je=E.trim();if(je!=="")try{S=JSON.parse(je)}catch{i(s("Body must be valid JSON."));return}let Ie,Fe=M.trim();if(Fe!==""){let B=Number(Fe);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Ie=B}if(U&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}$e(!0);let it=ht(g,Oe).map(B=>U?{batch:S,delaySeconds:Ie,exportName:B}:{body:S,delaySeconds:Ie,exportName:B});try{i(await xt(r,it,s)),q()}catch(B){i(G(B))}$e(!1)},"Ve"),V;e[3]!==r||e[4]!==q?(V=c(async g=>{i(null),ke(g);try{await r.query(yt,{id:g},ce("")),q()}catch(S){i(G(S))}ke(null)},"V"),e[3]=r,e[4]=q,e[5]=V):V=e[5];let fe=V,X;e[6]!==r||e[7]!==q?(X=c(async()=>{i(null);try{await r.query(Nt,{},ce("")),q()}catch(g){i(G(g))}},"X"),e[6]=r,e[7]=q,e[8]=X):X=e[8];let xe=X,Y;e[9]===Symbol.for("react.memo_cache_sentinel")?(Y=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"Y"),e[9]=Y):Y=e[9];let ot=Y,Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{P(g.currentTarget.value)},"K"),e[10]=Z):Z=e[10];let ye=Z,ee;e[11]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{_(g.currentTarget.value)},"Z"),e[11]=ee):ee=e[11];let Ne=ee,te;e[12]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{at(g.currentTarget.value)},"ee"),e[12]=te):te=e[12];let be=te,ae;e[13]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{st(g.currentTarget.checked)},"te"),e[13]=ae):ae=e[13];let qe=ae,ve=c(()=>{ue(rt())},"ge"),se;e[14]!==fe?(se=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&ue(fe(S))},"se"),e[14]=fe,e[15]=se):se=e[15];let Se=se,ne;e[16]!==xe?(ne=c(()=>{ue(xe())},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[18]!==s||e[19]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(de,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[18]=s,e[19]=l,e[20]=k):k=e[20];let O;e[21]!==he||e[22]!==ge?(O=he!==null&&(0,t.jsx)(He,{error:ge,testId:"queues-error"}),e[21]=he,e[22]=ge,e[23]=O):O=e[23];let Ce=H&&(0,t.jsx)(Ge,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[T.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:T.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),L>0&&(0,t.jsx)("p",{className:T.length>0?"text-muted-foreground":"font-medium",children:L===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:L})})]})}),R;e[24]!==v||e[25]!==f||e[26]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[24]=v,e[25]=f,e[26]=l,e[27]=R):R=e[27];let J;e[28]!==Q||e[29]!==y||e[30]!==we||e[31]!==Se||e[32]!==pe||e[33]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:Q,onClear:we,onReplay:Se,replayingId:pe}),e[28]=Q,e[29]=y,e[30]=we,e[31]=Se,e[32]=pe,e[33]=l,e[34]=J):J=e[34];let j;e[35]!==U||e[36]!==E||e[37]!==M||e[38]!==qe||e[39]!==Ne||e[40]!==be||e[41]!==ye||e[42]!==ve||e[43]!==v||e[44]!==K||e[45]!==me||e[46]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:U,bodyText:E,delayText:M,onBatchModeChange:qe,onBodyChange:Ne,onDelayChange:be,onSelectExport:ye,onSend:ve,queues:v,selectedExportName:K,sending:me}),e[35]=U,e[36]=E,e[37]=M,e[38]=qe,e[39]=Ne,e[40]=be,e[41]=ye,e[42]=ve,e[43]=v,e[44]=K,e[45]=me,e[46]=l,e[47]=j):j=e[47];let re;return e[48]!==k||e[49]!==O||e[50]!==Ce||e[51]!==R||e[52]!==J||e[53]!==j?(re=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ce,R,J,j]}),e[48]=k,e[49]=O,e[50]=Ce,e[51]=R,e[52]=J,e[53]=j,e[54]=re):re=e[54],re},"es");function Et(n){return(0,t.jsx)(tt,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(tt,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return et(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
|
|
1
|
+
import{a as Ye}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Ve}from"./chunk-FPI7AMQJ.js";import{a as Xe}from"./chunk-4UBF7HMZ.js";import"./chunk-UC7MNI2F.js";import{a as Ke}from"./chunk-LXCVA5SP.js";import{i as ze}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as de}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as oe}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as He}from"./chunk-C7FJ2JKY.js";import{a as Ge}from"./chunk-NCPW7WHO.js";import"./chunk-G43F7LYA.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Ae}from"./chunk-RX755NMO.js";import{l as We}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import"./chunk-HBO4SMAO.js";import{a as le}from"./chunk-RWVIV3U7.js";import{a as Le,b as Te,c as _e,d as z,e as I,f as w}from"./chunk-HCTJKP5J.js";import{a as Ee,e as Me}from"./chunk-2IKDEUCX.js";import{d as F,f as ie,g as ce,h as G,n as Pe,q as ue,u as Ue}from"./chunk-74IYYDDI.js";import{a as c,d as Qe,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Qe(ut(),1);var A=Qe(ct(),1);var t=Qe(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),Be="topic:",De=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Qe"),et=c(n=>`${Be}${n}`,"je"),ht=c((n,e)=>n.startsWith(Be)?(e.get(n.slice(Be.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ie(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ce(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:G(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ie(W.replayQueueMessage),Nt=ie(W.clearQueueMessages),Ze=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Pe)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>Ze?`${n.slice(0,Ze)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),tt=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"We"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=De(d),m;e[4]!==r?(m=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]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(le,{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,t.jsx)(Ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(Me,{className:"px-0",children:(0,t.jsxs)(Le,{"data-testid":"queues-table",children:[(0,t.jsx)(Te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(I,{children:r("Export")}),(0,t.jsx)(I,{children:r("Queue")}),(0,t.jsx)(I,{children:r("Mode")}),(0,t.jsx)(I,{children:r("Binding")}),(0,t.jsx)(I,{children:r("Dead-letter")})]})}),(0,t.jsxs)(_e,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(A.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{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]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let H=bt(a.body);o=z,f=`queues-message-${a.id}`;let $=a.exportName??a.queue;e[19]!==$?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:$}),e[19]=$,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let P=`queues-outcome-${a.id}`,E;e[25]!==a.outcome?(E=vt(a.outcome),e[25]=a.outcome,e[26]=E):E=e[26];let _;e[27]!==a.outcome||e[28]!==P||e[29]!==E?(_=(0,t.jsx)(oe,{"data-testid":P,variant:E,children:a.outcome}),e[27]=a.outcome,e[28]=P,e[29]=E,e[30]=_):_=e[30];let M;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(M=a.deadLettered&&(0,t.jsx)(oe,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=M):M=e[34],e[35]!==_||e[36]!==M?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[_,M]})}),e[35]=_,e[36]=M,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=H,p=qt(H),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let b;e[43]!==a.capturedAt?(b=Ue(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=b):b=e[44];let C;e[45]!==b?(C=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[45]=b,e[46]=C):C=e[46];let q=`queues-replay-${a.id}`,v=r!==null,Q;e[47]!==a.id||e[48]!==r||e[49]!==s?(Q=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=Q):Q=e[50];let L;e[51]!==a.id||e[52]!==d||e[53]!==q||e[54]!==v||e[55]!==Q?(L=(0,t.jsx)(w,{children:(0,t.jsx)(de,{"data-id":a.id,"data-testid":q,disabled:v,onClick:d,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=a.id,e[52]=d,e[53]=q,e[54]=v,e[55]=Q,e[56]=L):L=e[56];let T;return e[57]!==o||e[58]!==C||e[59]!==L||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?(T=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,C,L]}),e[57]=o,e[58]=C,e[59]=L,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=T):T=e[66],T},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ke,{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]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(oe,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(le,{description:o("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:o("No consumed messages yet.")}):(0,t.jsx)(Ee,{className:"overflow-hidden py-0",children:(0,t.jsx)(Me,{className:"px-0",children:(0,t.jsx)(Ye,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Le,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(Te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(I,{children:o("Export")}),(0,t.jsx)(I,{children:o("Message")}),(0,t.jsx)(I,{children:o("Attempts")}),(0,t.jsx)(I,{children:o("Outcome")}),(0,t.jsx)(I,{children:o("Body")}),(0,t.jsx)(I,{children:o("Captured")}),(0,t.jsx)(I,{})]})}),(0,t.jsx)(_e,{children:d.map(C=>(0,t.jsx)(Ct,{message:C,onReplay:s,replayingId:l},C.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let b;return e[26]!==N||e[27]!==y?(b=(0,t.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},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(le,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...De(p).topics].map(C=>{let[q,v]=C;return(0,t.jsx)("option",{value:et(q),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:v.length,topic:q})},q)})]}),(0,t.jsx)(ze,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(de,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Ve,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let b;return e[17]!==N||e[18]!==y?(b=(0,t.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},"_t"),Yt=c(n=>{let e=(0,D.c)(55),{limit:a}=n,d=a??gt,r=We(),s=F(),[l,o]=(0,A.useState)("declared"),[m,i]=(0,A.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Ae(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:b,poll:C,refetch:q}=Ae(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],Q=N?.entries??[],{deadLetteredCount:L,queuesWithoutDlq:T,showReliabilityWarning:H}=pt(v,Q),[$,P]=(0,A.useState)(""),[E,_]=(0,A.useState)(""),[M,at]=(0,A.useState)(""),[U,st]=(0,A.useState)(!1),[me,$e]=(0,A.useState)(!1),[pe,ke]=(0,A.useState)(null),{topics:Oe}=De(v),Re=[...v.map(Tt),...[...Oe.keys()].map(_t)],K=Re.includes($)?$:Re[0]??"",Je=l==="messages"?y:x,nt=l==="messages"?b:u,he=Je??m,ge=Je===null?m:nt;Xe(C,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,je=E.trim();if(je!=="")try{S=JSON.parse(je)}catch{i(s("Body must be valid JSON."));return}let Ie,Fe=M.trim();if(Fe!==""){let B=Number(Fe);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Ie=B}if(U&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}$e(!0);let it=ht(g,Oe).map(B=>U?{batch:S,delaySeconds:Ie,exportName:B}:{body:S,delaySeconds:Ie,exportName:B});try{i(await xt(r,it,s)),q()}catch(B){i(G(B))}$e(!1)},"Ve"),V;e[3]!==r||e[4]!==q?(V=c(async g=>{i(null),ke(g);try{await r.query(yt,{id:g},ce("")),q()}catch(S){i(G(S))}ke(null)},"V"),e[3]=r,e[4]=q,e[5]=V):V=e[5];let fe=V,X;e[6]!==r||e[7]!==q?(X=c(async()=>{i(null);try{await r.query(Nt,{},ce("")),q()}catch(g){i(G(g))}},"X"),e[6]=r,e[7]=q,e[8]=X):X=e[8];let xe=X,Y;e[9]===Symbol.for("react.memo_cache_sentinel")?(Y=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"Y"),e[9]=Y):Y=e[9];let ot=Y,Z;e[10]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{P(g.currentTarget.value)},"K"),e[10]=Z):Z=e[10];let ye=Z,ee;e[11]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{_(g.currentTarget.value)},"Z"),e[11]=ee):ee=e[11];let Ne=ee,te;e[12]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{at(g.currentTarget.value)},"ee"),e[12]=te):te=e[12];let be=te,ae;e[13]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{st(g.currentTarget.checked)},"te"),e[13]=ae):ae=e[13];let qe=ae,ve=c(()=>{ue(rt())},"ge"),se;e[14]!==fe?(se=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&ue(fe(S))},"se"),e[14]=fe,e[15]=se):se=e[15];let Se=se,ne;e[16]!==xe?(ne=c(()=>{ue(xe())},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[18]!==s||e[19]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(de,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[18]=s,e[19]=l,e[20]=k):k=e[20];let O;e[21]!==he||e[22]!==ge?(O=he!==null&&(0,t.jsx)(He,{error:ge,testId:"queues-error"}),e[21]=he,e[22]=ge,e[23]=O):O=e[23];let Ce=H&&(0,t.jsx)(Ge,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[T.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:T.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),L>0&&(0,t.jsx)("p",{className:T.length>0?"text-muted-foreground":"font-medium",children:L===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:L})})]})}),R;e[24]!==v||e[25]!==f||e[26]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[24]=v,e[25]=f,e[26]=l,e[27]=R):R=e[27];let J;e[28]!==Q||e[29]!==y||e[30]!==we||e[31]!==Se||e[32]!==pe||e[33]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:Q,onClear:we,onReplay:Se,replayingId:pe}),e[28]=Q,e[29]=y,e[30]=we,e[31]=Se,e[32]=pe,e[33]=l,e[34]=J):J=e[34];let j;e[35]!==U||e[36]!==E||e[37]!==M||e[38]!==qe||e[39]!==Ne||e[40]!==be||e[41]!==ye||e[42]!==ve||e[43]!==v||e[44]!==K||e[45]!==me||e[46]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:U,bodyText:E,delayText:M,onBatchModeChange:qe,onBodyChange:Ne,onDelayChange:be,onSelectExport:ye,onSend:ve,queues:v,selectedExportName:K,sending:me}),e[35]=U,e[36]=E,e[37]=M,e[38]=qe,e[39]=Ne,e[40]=be,e[41]=ye,e[42]=ve,e[43]=v,e[44]=K,e[45]=me,e[46]=l,e[47]=j):j=e[47];let re;return e[48]!==k||e[49]!==O||e[50]!==Ce||e[51]!==R||e[52]!==J||e[53]!==j?(re=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ce,R,J,j]}),e[48]=k,e[49]=O,e[50]=Ce,e[51]=R,e[52]=J,e[53]=j,e[54]=re):re=e[54],re},"es");function Et(n){return(0,t.jsx)(tt,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(tt,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return et(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Se}from"./chunk-FPI7AMQJ.js";import{a as F}from"./chunk-37WYCOQ2.js";import{a as Ie}from"./chunk-EWMBX5N2.js";import{a as Ce}from"./chunk-LXCVA5SP.js";import{a as ve}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as K}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as D}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as $}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ne}from"./chunk-R75AFV7G.js";import"./chunk-NCPW7WHO.js";import"./chunk-IQ3SMVFW.js";import"./chunk-55UGUCQ6.js";import{a as Z}from"./chunk-4ZEL6BYL.js";import{c as ae}from"./chunk-T2JHVL34.js";import{d as me,l as oe}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as de}from"./chunk-RWVIV3U7.js";import{a as ke,b as we,c as Pe,d as ce,e as re,f as le}from"./chunk-HCTJKP5J.js";import{a as se,b as ue,c as fe,d as he,e as ne}from"./chunk-2IKDEUCX.js";import{d as X,f as xe,g as ye,h as ge,n as be,q as te}from"./chunk-74IYYDDI.js";import{a as n,d as ie,e as Re,f as Ee,g as Ae}from"./chunk-I26MS5PJ.js";var m=ie(Re(),1);var pe=ie(Ee(),1);var t=ie(Ae(),1);var _e=["read","insert","update","delete"],ze=n((e,a)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[a],"_e"),$e=n(e=>e.file===""?e.procedure:`${e.file}:${e.procedure}`,"Fe"),De=n(e=>{let a=new Set;for(let o of e?.advisories??[])if(o.name==="rls_uncovered_table"){let{table:c}=o.metadata;typeof c=="string"&&c!==""&&a.add(c)}return a},"Oe"),Le=n((e,a,o)=>{let c=new Map,r=n(d=>{let s=c.get(d);if(s!==void 0)return s;let u={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:d,uncovered:o.has(d)};return c.set(d,u),u},"r");for(let d of e)r(d.table).cells[d.on]={path:$e(d),procedure:d.procedure};for(let d of a)r(d.table).maskedColumns.add(d.column);for(let d of o)r(d);return[...c.values()].toSorted((d,s)=>d.table.localeCompare(s.table))},"De"),qe=n(e=>{let a=(0,pe.c)(17),o;a[0]!==e?(o=e===void 0?{}:e,a[0]=e,a[1]=o):o=a[1];let{onProbe:c}=o,r=X(),d,s;a[2]===Symbol.for("react.memo_cache_sentinel")?(d={},s={live:!0},a[2]=d,a[3]=s):(d=a[2],s=a[3]);let u=ae(Z.rlsPolicies,d,s),l;a[4]===Symbol.for("react.memo_cache_sentinel")?(l={},a[4]=l):l=a[4];let k=ae(Z.maskPolicies,l),h;a[5]===Symbol.for("react.memo_cache_sentinel")?(h={},a[5]=h):h=a[5];let y=ae(Z.getAdvisories,h),g;if(a[6]!==y.data||a[7]!==k.data||a[8]!==c||a[9]!==u||a[10]!==r){let w=null;u.data!==void 0&&(w=Array.isArray(u.data.policies)?u.data.policies:[]);let L=Array.isArray(k.data?.columns)?k.data.columns:[],H=y.data??null,{error:S,errorSource:b,liveError:I}=u,_=w===null?[]:Le(w,L,De(H)),P;a[12]!==I?(P=(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(Ie,{message:I,prefix:"pm"})}),a[12]=I,a[13]=P):P=a[13];let f;a[14]!==S||a[15]!==b?(f=S!==null&&(0,t.jsx)(Ne,{error:b,testId:"pm-error"}),a[14]=S,a[15]=b,a[16]=f):f=a[16],g=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[P,f,w!==null&&_.length===0?(0,t.jsx)(de,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):(0,t.jsxs)(ke,{"data-testid":"pm-table",children:[(0,t.jsx)(we,{children:(0,t.jsxs)(ce,{children:[(0,t.jsx)(re,{children:r("Table")}),_e.map(p=>(0,t.jsx)(re,{children:ze(r,p)},p)),(0,t.jsx)(re,{children:r("Masked columns")})]})}),(0,t.jsx)(Pe,{children:_.map(p=>(0,t.jsxs)(ce,{"data-testid":`pm-row-${p.table}`,children:[(0,t.jsx)(le,{className:"font-mono text-xs",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[p.table,p.uncovered&&(0,t.jsx)($,{"data-testid":`pm-uncovered-${p.table}`,title:r("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:r("Uncovered \u2014 reachable without a policy")})]})}),_e.map(T=>{let v=p.cells[T];return(0,t.jsx)(le,{"data-testid":`pm-cell-${p.table}-${T}`,children:v.procedure===void 0?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsx)($,{variant:"secondary",children:r("Covered by {procedure}",{procedure:v.procedure})}),c!==void 0&&(0,t.jsx)(D,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${p.table}-${T}`,onClick:n(()=>{c(p.table,T,v.path??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},T)}),(0,t.jsx)(le,{children:p.maskedColumns.size===0?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)("span",{className:"flex flex-wrap gap-1",children:[...p.maskedColumns].map(Oe)})})]},p.table))})]})]}),a[6]=y.data,a[7]=k.data,a[8]=c,a[9]=u,a[10]=r,a[11]=g}else g=a[11];return g},"Le");function Oe(e){return(0,t.jsx)($,{variant:"outline",children:e},e)}n(Oe,"$e");var Ue=xe(Z.runAs),je=new Set(["FORBIDDEN","RLS_REQUIRED","UNAUTHORIZED"]),Be=n(e=>{let a=e?.code;return typeof a=="string"?a:void 0},"We"),Me=n(()=>{let e=oe();return async({args:a,functionPath:o,shardKey:c="",userId:r})=>{if(r.trim()==="")return{kind:"invalid",message:"No identity to probe: enter the userId whose access you want to test."};let d=Ue;try{return{kind:"allowed",value:await e.query(d,{args:a,functionPath:o,userId:r},ye(c))}}catch(s){let u=s instanceof Error?s.message:String(s),l=Be(s);return l!==void 0&&je.has(l)?{kind:"denied",message:u}:{kind:"errored",message:u}}}},"ze"),We=n(e=>e===void 0?"undefined":JSON.stringify(e,be,2),"qe"),Je=n(({functions:e,prefill:a,runAsIdentity:o=!1}={})=>{let c=oe(),r=X(),d=Me(),[s,u]=(0,m.useState)(null),[l,k]=(0,m.useState)(null),h=e??s??[],[y,g]=(0,m.useState)(""),[w,L]=(0,m.useState)("{}"),[H,S]=(0,m.useState)(""),[b,I]=(0,m.useState)(""),[_,P]=(0,m.useState)(!1),[f,p]=(0,m.useState)(null),[T,v]=(0,m.useState)(null),[R,q]=(0,m.useState)(!1),E=(0,m.useRef)(-1),C=(0,m.useRef)(0);(0,m.useEffect)(()=>{if(e!==void 0)return;let i=!1;return c.listFunctions().then(N=>(i||u(N),N)).catch(N=>{i||k(ge(N))}),()=>{i=!0}},[c,e]),(0,m.useEffect)(()=>{if(a===void 0||E.current===a.nonce)return;E.current=a.nonce,C.current+=1;let i=a.functionPath;queueMicrotask(()=>{g(i),p(null)})},[a]);let Q=R?h:h.filter(i=>i.kind==="query"||i.path===y),x=y===""?Q[0]?.path??"":y,O=h.find(i=>i.path===x),Y=x!==""&&O?.kind!=="query",U=n(async()=>{if(x==="")return;let i;try{i=w.trim()===""?{}:me(JSON.parse(w))}catch(J){v(r("Invalid JSON args: {message}",{message:J.message})),p(null);return}C.current+=1;let N=C.current;v(null),P(!0);try{let J=await d({args:i,functionPath:x,shardKey:H.trim(),userId:b.trim()});N===C.current&&p(J)}finally{P(!1)}},"U"),A=n(()=>{te(U())},"_"),j=n(i=>{g(i.target.value)},"M"),B=n(i=>{L(i.target.value)},"W"),M=n(i=>{I(i.target.value)},"z"),W=n(i=>{q(i.target.checked),!i.target.checked&&Y&&g("")},"q"),z=!o||_||x==="";return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[l!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:l}),!o&&(0,t.jsx)(de,{description:r("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:r("Set `runAsIdentity` to forge an identity and probe access.")}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(F,{htmlFor:"pp-function",children:r("Function")}),(0,t.jsx)("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:j,value:x,children:Q.map(i=>(0,t.jsxs)("option",{value:i.path,children:[i.path," (",i.kind,")"]},i.path))}),(0,t.jsxs)(F,{className:"flex items-center gap-1.5 text-xs font-normal",htmlFor:"pp-include-writes",children:[(0,t.jsx)("input",{checked:R,className:"size-4 accent-primary","data-testid":"pp-include-writes",id:"pp-include-writes",onChange:W,type:"checkbox"}),r("Include mutations and actions")]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(F,{htmlFor:"pp-args",children:r("Arguments")}),(0,t.jsx)(Se,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:B,value:w})]}),(0,t.jsx)(ve,{onChange:S,testId:"pp-shard",value:H}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(F,{htmlFor:"pp-user",children:r("Run as (userId)")}),(0,t.jsx)(K,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:M,placeholder:r("Required \u2014 the identity to probe as"),value:b})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Y?(0,t.jsx)(Ce,{confirmLabel:r("This will execute `{functionPath}` as user `{userId}`.",{functionPath:x,userId:b.trim()}),disabled:z,onConfirm:A,testId:"pp-run",children:r(_?"Probing\u2026":"Run probe")}):(0,t.jsx)(D,{"data-testid":"pp-run",disabled:z,onClick:A,type:"button",children:r(_?"Probing\u2026":"Run probe")}),b.trim()!==""&&(0,t.jsx)($,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:b.trim()})})]})]}),T!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:T}),f!==null&&f.kind==="allowed"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,t.jsx)($,{variant:"secondary",children:r("Allowed")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:We(f.value)})]}),f!==null&&f.kind==="invalid"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-invalid",children:[(0,t.jsx)($,{variant:"outline",children:r("Not run")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pp-invalid",role:"status",children:f.message})]}),f!==null&&f.kind==="errored"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-errored",children:[(0,t.jsx)($,{variant:"outline",children:r("Errored")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:r("The call failed for a reason that is not an access verdict, so it says nothing about the policy.")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-errored",role:"alert",children:f.message})]}),f!==null&&f.kind==="denied"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,t.jsx)($,{variant:"destructive",children:r("Denied")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:f.message})]})]})},"Be"),He="/__lunora/policy-scaffold",Ke={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},Qe=n(async e=>{let a=await fetch(He,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),o=await a.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(a.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};let c=o.error;return{kind:"error",message:c===void 0?`policy scaffold failed (${String(a.status)})`:Ke[c]??c}},"He"),Te={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Ye=n(()=>{let e=(0,pe.c)(69),a=X(),[o,c]=(0,m.useState)(null),[r,d]=(0,m.useState)(!1),[s,u]=(0,m.useState)(null),[l,k]=(0,m.useState)(Te),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n(ee=>{let V=ee.target.name,{value:G}=ee.target;k(Fe=>({...Fe,[V]:G}))},"u"),e[0]=h):h=e[0];let y=h,g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=n(()=>{c(null),k(Te)},"b"),e[1]=g):g=e[1];let w=g,L;e[2]===Symbol.for("react.memo_cache_sentinel")?(L=n(async ee=>{d(!0),u(null);try{let V=await Qe(ee);u(V),V.kind==="ok"&&w()}catch(V){let G=V;u({kind:"error",message:G instanceof Error?G.message:String(G)})}d(!1)},"D"),e[2]=L):L=e[2];let H=L,S;e[3]!==l.policyName||e[4]!==l.tableName?(S=n(()=>{te(H({kind:"scaffoldPolicy",name:l.policyName.trim(),table:l.tableName.trim()}))},"P"),e[3]=l.policyName,e[4]=l.tableName,e[5]=S):S=e[5];let b=S,I;e[6]!==l.exportName||e[7]!==l.filePath||e[8]!==l.policies?(I=n(()=>{te(H({exportName:l.exportName.trim(),filePath:l.filePath.trim(),kind:"wireRls",policies:l.policies.trim()}))},"I"),e[6]=l.exportName,e[7]=l.filePath,e[8]=l.policies,e[9]=I):I=e[9];let _=I,P;e[10]===Symbol.for("react.memo_cache_sentinel")?(P=n(()=>{u(null),c("scaffold")},"S"),e[10]=P):P=e[10];let f=P,p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n(()=>{u(null),c("wire")},"m"),e[11]=p):p=e[11];let T=p,v;e[12]!==a?(v=a("Scaffold access rules"),e[12]=a,e[13]=v):v=e[13];let R;e[14]!==v?(R=(0,t.jsx)(fe,{children:v}),e[14]=v,e[15]=R):R=e[15];let q;e[16]!==a?(q=a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=a,e[17]=q):q=e[17];let E;e[18]!==q?(E=(0,t.jsx)(he,{children:q}),e[18]=q,e[19]=E):E=e[19];let C;e[20]!==E||e[21]!==R?(C=(0,t.jsxs)(ue,{children:[R,E]}),e[20]=E,e[21]=R,e[22]=C):C=e[22];let Q=o==="scaffold"?"default":"outline",x;e[23]!==a?(x=a("New policy file"),e[23]=a,e[24]=x):x=e[24];let O;e[25]!==Q||e[26]!==x?(O=(0,t.jsx)(D,{"data-testid":"policy-scaffolder-new",onClick:f,size:"xs",type:"button",variant:Q,children:x}),e[25]=Q,e[26]=x,e[27]=O):O=e[27];let Y=o==="wire"?"default":"outline",U;e[28]!==a?(U=a("Wire into a procedure"),e[28]=a,e[29]=U):U=e[29];let A;e[30]!==Y||e[31]!==U?(A=(0,t.jsx)(D,{"data-testid":"policy-scaffolder-wire",onClick:T,size:"xs",type:"button",variant:Y,children:U}),e[30]=Y,e[31]=U,e[32]=A):A=e[32];let j;e[33]!==O||e[34]!==A?(j=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[O,A]}),e[33]=O,e[34]=A,e[35]=j):j=e[35];let B;e[36]!==r||e[37]!==l.policyName||e[38]!==l.tableName||e[39]!==o||e[40]!==b||e[41]!==a?(B=o==="scaffold"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:y,value:l.policyName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:y,value:l.tableName})]}),(0,t.jsx)(D,{"data-testid":"policy-scaffolder-create",disabled:r||l.policyName.trim()===""||l.tableName.trim()==="",onClick:b,size:"xs",type:"button",children:a(r?"Creating\u2026":"Create policy file")}),(0,t.jsx)(D,{onClick:w,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[36]=r,e[37]=l.policyName,e[38]=l.tableName,e[39]=o,e[40]=b,e[41]=a,e[42]=B):B=e[42];let M;e[43]!==r||e[44]!==l.exportName||e[45]!==l.filePath||e[46]!==l.policies||e[47]!==o||e[48]!==_||e[49]!==a?(M=o==="wire"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:y,value:l.filePath})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:y,value:l.exportName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:y,value:l.policies})]}),(0,t.jsx)(D,{"data-testid":"policy-scaffolder-apply",disabled:r||l.filePath.trim()===""||l.exportName.trim()===""||l.policies.trim()==="",onClick:_,size:"xs",type:"button",children:a(r?"Wiring\u2026":"Wire RLS")}),(0,t.jsx)(D,{onClick:w,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[43]=r,e[44]=l.exportName,e[45]=l.filePath,e[46]=l.policies,e[47]=o,e[48]=_,e[49]=a,e[50]=M):M=e[50];let W;e[51]!==s?(W=s?.kind==="error"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message}),e[51]=s,e[52]=W):W=e[52];let z;e[53]!==s?.kind||e[54]!==a?(z=s?.kind==="needs-manual-edit"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),e[53]=s?.kind,e[54]=a,e[55]=z):z=e[55];let i;e[56]!==s||e[57]!==a?(i=s?.kind==="ok"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})}),s.diagnostics.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(Ve)})]}),e[56]=s,e[57]=a,e[58]=i):i=e[58];let N;e[59]!==j||e[60]!==B||e[61]!==M||e[62]!==W||e[63]!==z||e[64]!==i?(N=(0,t.jsxs)(ne,{children:[j,B,M,W,z,i]}),e[59]=j,e[60]=B,e[61]=M,e[62]=W,e[63]=z,e[64]=i,e[65]=N):N=e[65];let J;return e[66]!==C||e[67]!==N?(J=(0,t.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[C,N]}),e[66]=C,e[67]=N,e[68]=J):J=e[68],J},"Je");function Ve(e){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}n(Ve,"Ke");var ht=n(({functions:e,runAsIdentity:a=!1,schemaEditable:o=!1}={})=>{let c=X(),[r,d]=(0,m.useState)(void 0),s=n((u,l,k)=>{k!==""&&d(h=>({functionPath:k,nonce:(h?.nonce??0)+1}))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c("Permissions")})}),(0,t.jsx)(qe,{onProbe:s})]}),(0,t.jsx)("section",{className:"flex flex-col gap-3",children:(0,t.jsxs)(se,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c("Probe")})}),(0,t.jsxs)(ne,{className:"px-4 py-4",children:[(0,t.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:c("Pick a function and an identity, then run it to see the access outcome.")}),(0,t.jsx)(Je,{functions:e,prefill:r,runAsIdentity:a})]})]})}),o&&(0,t.jsx)("section",{className:"flex flex-col gap-2",children:(0,t.jsx)(Ye,{})})]})},"xt");export{ht as PermissionsPanel};
|
|
1
|
+
import{a as Se}from"./chunk-FPI7AMQJ.js";import{a as F}from"./chunk-37WYCOQ2.js";import{a as Ie}from"./chunk-EWMBX5N2.js";import{a as Ce}from"./chunk-LXCVA5SP.js";import{a as ve}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as K}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as D}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as $}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ne}from"./chunk-C7FJ2JKY.js";import"./chunk-NCPW7WHO.js";import"./chunk-G43F7LYA.js";import"./chunk-55UGUCQ6.js";import{a as Z}from"./chunk-4ZEL6BYL.js";import{c as ae}from"./chunk-RX755NMO.js";import{d as me,l as oe}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import"./chunk-HBO4SMAO.js";import{a as de}from"./chunk-RWVIV3U7.js";import{a as ke,b as we,c as Pe,d as ce,e as re,f as le}from"./chunk-HCTJKP5J.js";import{a as se,b as ue,c as fe,d as he,e as ne}from"./chunk-2IKDEUCX.js";import{d as X,f as xe,g as ye,h as ge,n as be,q as te}from"./chunk-74IYYDDI.js";import{a as n,d as ie,e as Re,f as Ee,g as Ae}from"./chunk-I26MS5PJ.js";var m=ie(Re(),1);var pe=ie(Ee(),1);var t=ie(Ae(),1);var _e=["read","insert","update","delete"],ze=n((e,a)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[a],"_e"),$e=n(e=>e.file===""?e.procedure:`${e.file}:${e.procedure}`,"Fe"),De=n(e=>{let a=new Set;for(let o of e?.advisories??[])if(o.name==="rls_uncovered_table"){let{table:c}=o.metadata;typeof c=="string"&&c!==""&&a.add(c)}return a},"Oe"),Le=n((e,a,o)=>{let c=new Map,r=n(d=>{let s=c.get(d);if(s!==void 0)return s;let u={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:d,uncovered:o.has(d)};return c.set(d,u),u},"r");for(let d of e)r(d.table).cells[d.on]={path:$e(d),procedure:d.procedure};for(let d of a)r(d.table).maskedColumns.add(d.column);for(let d of o)r(d);return[...c.values()].toSorted((d,s)=>d.table.localeCompare(s.table))},"De"),qe=n(e=>{let a=(0,pe.c)(17),o;a[0]!==e?(o=e===void 0?{}:e,a[0]=e,a[1]=o):o=a[1];let{onProbe:c}=o,r=X(),d,s;a[2]===Symbol.for("react.memo_cache_sentinel")?(d={},s={live:!0},a[2]=d,a[3]=s):(d=a[2],s=a[3]);let u=ae(Z.rlsPolicies,d,s),l;a[4]===Symbol.for("react.memo_cache_sentinel")?(l={},a[4]=l):l=a[4];let k=ae(Z.maskPolicies,l),h;a[5]===Symbol.for("react.memo_cache_sentinel")?(h={},a[5]=h):h=a[5];let y=ae(Z.getAdvisories,h),g;if(a[6]!==y.data||a[7]!==k.data||a[8]!==c||a[9]!==u||a[10]!==r){let w=null;u.data!==void 0&&(w=Array.isArray(u.data.policies)?u.data.policies:[]);let L=Array.isArray(k.data?.columns)?k.data.columns:[],H=y.data??null,{error:S,errorSource:b,liveError:I}=u,_=w===null?[]:Le(w,L,De(H)),P;a[12]!==I?(P=(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(Ie,{message:I,prefix:"pm"})}),a[12]=I,a[13]=P):P=a[13];let f;a[14]!==S||a[15]!==b?(f=S!==null&&(0,t.jsx)(Ne,{error:b,testId:"pm-error"}),a[14]=S,a[15]=b,a[16]=f):f=a[16],g=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[P,f,w!==null&&_.length===0?(0,t.jsx)(de,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):(0,t.jsxs)(ke,{"data-testid":"pm-table",children:[(0,t.jsx)(we,{children:(0,t.jsxs)(ce,{children:[(0,t.jsx)(re,{children:r("Table")}),_e.map(p=>(0,t.jsx)(re,{children:ze(r,p)},p)),(0,t.jsx)(re,{children:r("Masked columns")})]})}),(0,t.jsx)(Pe,{children:_.map(p=>(0,t.jsxs)(ce,{"data-testid":`pm-row-${p.table}`,children:[(0,t.jsx)(le,{className:"font-mono text-xs",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[p.table,p.uncovered&&(0,t.jsx)($,{"data-testid":`pm-uncovered-${p.table}`,title:r("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:r("Uncovered \u2014 reachable without a policy")})]})}),_e.map(T=>{let v=p.cells[T];return(0,t.jsx)(le,{"data-testid":`pm-cell-${p.table}-${T}`,children:v.procedure===void 0?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsx)($,{variant:"secondary",children:r("Covered by {procedure}",{procedure:v.procedure})}),c!==void 0&&(0,t.jsx)(D,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${p.table}-${T}`,onClick:n(()=>{c(p.table,T,v.path??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},T)}),(0,t.jsx)(le,{children:p.maskedColumns.size===0?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)("span",{className:"flex flex-wrap gap-1",children:[...p.maskedColumns].map(Oe)})})]},p.table))})]})]}),a[6]=y.data,a[7]=k.data,a[8]=c,a[9]=u,a[10]=r,a[11]=g}else g=a[11];return g},"Le");function Oe(e){return(0,t.jsx)($,{variant:"outline",children:e},e)}n(Oe,"$e");var Ue=xe(Z.runAs),je=new Set(["FORBIDDEN","RLS_REQUIRED","UNAUTHORIZED"]),Be=n(e=>{let a=e?.code;return typeof a=="string"?a:void 0},"We"),Me=n(()=>{let e=oe();return async({args:a,functionPath:o,shardKey:c="",userId:r})=>{if(r.trim()==="")return{kind:"invalid",message:"No identity to probe: enter the userId whose access you want to test."};let d=Ue;try{return{kind:"allowed",value:await e.query(d,{args:a,functionPath:o,userId:r},ye(c))}}catch(s){let u=s instanceof Error?s.message:String(s),l=Be(s);return l!==void 0&&je.has(l)?{kind:"denied",message:u}:{kind:"errored",message:u}}}},"ze"),We=n(e=>e===void 0?"undefined":JSON.stringify(e,be,2),"qe"),Je=n(({functions:e,prefill:a,runAsIdentity:o=!1}={})=>{let c=oe(),r=X(),d=Me(),[s,u]=(0,m.useState)(null),[l,k]=(0,m.useState)(null),h=e??s??[],[y,g]=(0,m.useState)(""),[w,L]=(0,m.useState)("{}"),[H,S]=(0,m.useState)(""),[b,I]=(0,m.useState)(""),[_,P]=(0,m.useState)(!1),[f,p]=(0,m.useState)(null),[T,v]=(0,m.useState)(null),[R,q]=(0,m.useState)(!1),E=(0,m.useRef)(-1),C=(0,m.useRef)(0);(0,m.useEffect)(()=>{if(e!==void 0)return;let i=!1;return c.listFunctions().then(N=>(i||u(N),N)).catch(N=>{i||k(ge(N))}),()=>{i=!0}},[c,e]),(0,m.useEffect)(()=>{if(a===void 0||E.current===a.nonce)return;E.current=a.nonce,C.current+=1;let i=a.functionPath;queueMicrotask(()=>{g(i),p(null)})},[a]);let Q=R?h:h.filter(i=>i.kind==="query"||i.path===y),x=y===""?Q[0]?.path??"":y,O=h.find(i=>i.path===x),Y=x!==""&&O?.kind!=="query",U=n(async()=>{if(x==="")return;let i;try{i=w.trim()===""?{}:me(JSON.parse(w))}catch(J){v(r("Invalid JSON args: {message}",{message:J.message})),p(null);return}C.current+=1;let N=C.current;v(null),P(!0);try{let J=await d({args:i,functionPath:x,shardKey:H.trim(),userId:b.trim()});N===C.current&&p(J)}finally{P(!1)}},"U"),A=n(()=>{te(U())},"_"),j=n(i=>{g(i.target.value)},"M"),B=n(i=>{L(i.target.value)},"W"),M=n(i=>{I(i.target.value)},"z"),W=n(i=>{q(i.target.checked),!i.target.checked&&Y&&g("")},"q"),z=!o||_||x==="";return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[l!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:l}),!o&&(0,t.jsx)(de,{description:r("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:r("Set `runAsIdentity` to forge an identity and probe access.")}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(F,{htmlFor:"pp-function",children:r("Function")}),(0,t.jsx)("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:j,value:x,children:Q.map(i=>(0,t.jsxs)("option",{value:i.path,children:[i.path," (",i.kind,")"]},i.path))}),(0,t.jsxs)(F,{className:"flex items-center gap-1.5 text-xs font-normal",htmlFor:"pp-include-writes",children:[(0,t.jsx)("input",{checked:R,className:"size-4 accent-primary","data-testid":"pp-include-writes",id:"pp-include-writes",onChange:W,type:"checkbox"}),r("Include mutations and actions")]})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(F,{htmlFor:"pp-args",children:r("Arguments")}),(0,t.jsx)(Se,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:B,value:w})]}),(0,t.jsx)(ve,{onChange:S,testId:"pp-shard",value:H}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(F,{htmlFor:"pp-user",children:r("Run as (userId)")}),(0,t.jsx)(K,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:M,placeholder:r("Required \u2014 the identity to probe as"),value:b})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[Y?(0,t.jsx)(Ce,{confirmLabel:r("This will execute `{functionPath}` as user `{userId}`.",{functionPath:x,userId:b.trim()}),disabled:z,onConfirm:A,testId:"pp-run",children:r(_?"Probing\u2026":"Run probe")}):(0,t.jsx)(D,{"data-testid":"pp-run",disabled:z,onClick:A,type:"button",children:r(_?"Probing\u2026":"Run probe")}),b.trim()!==""&&(0,t.jsx)($,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:b.trim()})})]})]}),T!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:T}),f!==null&&f.kind==="allowed"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,t.jsx)($,{variant:"secondary",children:r("Allowed")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:We(f.value)})]}),f!==null&&f.kind==="invalid"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-invalid",children:[(0,t.jsx)($,{variant:"outline",children:r("Not run")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pp-invalid",role:"status",children:f.message})]}),f!==null&&f.kind==="errored"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-errored",children:[(0,t.jsx)($,{variant:"outline",children:r("Errored")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:r("The call failed for a reason that is not an access verdict, so it says nothing about the policy.")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-errored",role:"alert",children:f.message})]}),f!==null&&f.kind==="denied"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,t.jsx)($,{variant:"destructive",children:r("Denied")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:f.message})]})]})},"Be"),He="/__lunora/policy-scaffold",Ke={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},Qe=n(async e=>{let a=await fetch(He,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),o=await a.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(a.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};let c=o.error;return{kind:"error",message:c===void 0?`policy scaffold failed (${String(a.status)})`:Ke[c]??c}},"He"),Te={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Ye=n(()=>{let e=(0,pe.c)(69),a=X(),[o,c]=(0,m.useState)(null),[r,d]=(0,m.useState)(!1),[s,u]=(0,m.useState)(null),[l,k]=(0,m.useState)(Te),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n(ee=>{let V=ee.target.name,{value:G}=ee.target;k(Fe=>({...Fe,[V]:G}))},"u"),e[0]=h):h=e[0];let y=h,g;e[1]===Symbol.for("react.memo_cache_sentinel")?(g=n(()=>{c(null),k(Te)},"b"),e[1]=g):g=e[1];let w=g,L;e[2]===Symbol.for("react.memo_cache_sentinel")?(L=n(async ee=>{d(!0),u(null);try{let V=await Qe(ee);u(V),V.kind==="ok"&&w()}catch(V){let G=V;u({kind:"error",message:G instanceof Error?G.message:String(G)})}d(!1)},"D"),e[2]=L):L=e[2];let H=L,S;e[3]!==l.policyName||e[4]!==l.tableName?(S=n(()=>{te(H({kind:"scaffoldPolicy",name:l.policyName.trim(),table:l.tableName.trim()}))},"P"),e[3]=l.policyName,e[4]=l.tableName,e[5]=S):S=e[5];let b=S,I;e[6]!==l.exportName||e[7]!==l.filePath||e[8]!==l.policies?(I=n(()=>{te(H({exportName:l.exportName.trim(),filePath:l.filePath.trim(),kind:"wireRls",policies:l.policies.trim()}))},"I"),e[6]=l.exportName,e[7]=l.filePath,e[8]=l.policies,e[9]=I):I=e[9];let _=I,P;e[10]===Symbol.for("react.memo_cache_sentinel")?(P=n(()=>{u(null),c("scaffold")},"S"),e[10]=P):P=e[10];let f=P,p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n(()=>{u(null),c("wire")},"m"),e[11]=p):p=e[11];let T=p,v;e[12]!==a?(v=a("Scaffold access rules"),e[12]=a,e[13]=v):v=e[13];let R;e[14]!==v?(R=(0,t.jsx)(fe,{children:v}),e[14]=v,e[15]=R):R=e[15];let q;e[16]!==a?(q=a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=a,e[17]=q):q=e[17];let E;e[18]!==q?(E=(0,t.jsx)(he,{children:q}),e[18]=q,e[19]=E):E=e[19];let C;e[20]!==E||e[21]!==R?(C=(0,t.jsxs)(ue,{children:[R,E]}),e[20]=E,e[21]=R,e[22]=C):C=e[22];let Q=o==="scaffold"?"default":"outline",x;e[23]!==a?(x=a("New policy file"),e[23]=a,e[24]=x):x=e[24];let O;e[25]!==Q||e[26]!==x?(O=(0,t.jsx)(D,{"data-testid":"policy-scaffolder-new",onClick:f,size:"xs",type:"button",variant:Q,children:x}),e[25]=Q,e[26]=x,e[27]=O):O=e[27];let Y=o==="wire"?"default":"outline",U;e[28]!==a?(U=a("Wire into a procedure"),e[28]=a,e[29]=U):U=e[29];let A;e[30]!==Y||e[31]!==U?(A=(0,t.jsx)(D,{"data-testid":"policy-scaffolder-wire",onClick:T,size:"xs",type:"button",variant:Y,children:U}),e[30]=Y,e[31]=U,e[32]=A):A=e[32];let j;e[33]!==O||e[34]!==A?(j=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[O,A]}),e[33]=O,e[34]=A,e[35]=j):j=e[35];let B;e[36]!==r||e[37]!==l.policyName||e[38]!==l.tableName||e[39]!==o||e[40]!==b||e[41]!==a?(B=o==="scaffold"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:y,value:l.policyName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:y,value:l.tableName})]}),(0,t.jsx)(D,{"data-testid":"policy-scaffolder-create",disabled:r||l.policyName.trim()===""||l.tableName.trim()==="",onClick:b,size:"xs",type:"button",children:a(r?"Creating\u2026":"Create policy file")}),(0,t.jsx)(D,{onClick:w,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[36]=r,e[37]=l.policyName,e[38]=l.tableName,e[39]=o,e[40]=b,e[41]=a,e[42]=B):B=e[42];let M;e[43]!==r||e[44]!==l.exportName||e[45]!==l.filePath||e[46]!==l.policies||e[47]!==o||e[48]!==_||e[49]!==a?(M=o==="wire"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:y,value:l.filePath})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:y,value:l.exportName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(F,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),(0,t.jsx)(K,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:y,value:l.policies})]}),(0,t.jsx)(D,{"data-testid":"policy-scaffolder-apply",disabled:r||l.filePath.trim()===""||l.exportName.trim()===""||l.policies.trim()==="",onClick:_,size:"xs",type:"button",children:a(r?"Wiring\u2026":"Wire RLS")}),(0,t.jsx)(D,{onClick:w,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[43]=r,e[44]=l.exportName,e[45]=l.filePath,e[46]=l.policies,e[47]=o,e[48]=_,e[49]=a,e[50]=M):M=e[50];let W;e[51]!==s?(W=s?.kind==="error"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:s.message}),e[51]=s,e[52]=W):W=e[52];let z;e[53]!==s?.kind||e[54]!==a?(z=s?.kind==="needs-manual-edit"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),e[53]=s?.kind,e[54]=a,e[55]=z):z=e[55];let i;e[56]!==s||e[57]!==a?(i=s?.kind==="ok"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:s.label})}),s.diagnostics.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:s.diagnostics.map(Ve)})]}),e[56]=s,e[57]=a,e[58]=i):i=e[58];let N;e[59]!==j||e[60]!==B||e[61]!==M||e[62]!==W||e[63]!==z||e[64]!==i?(N=(0,t.jsxs)(ne,{children:[j,B,M,W,z,i]}),e[59]=j,e[60]=B,e[61]=M,e[62]=W,e[63]=z,e[64]=i,e[65]=N):N=e[65];let J;return e[66]!==C||e[67]!==N?(J=(0,t.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[C,N]}),e[66]=C,e[67]=N,e[68]=J):J=e[68],J},"Je");function Ve(e){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}n(Ve,"Ke");var ht=n(({functions:e,runAsIdentity:a=!1,schemaEditable:o=!1}={})=>{let c=X(),[r,d]=(0,m.useState)(void 0),s=n((u,l,k)=>{k!==""&&d(h=>({functionPath:k,nonce:(h?.nonce??0)+1}))},"n");return(0,t.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c("Permissions")})}),(0,t.jsx)(qe,{onProbe:s})]}),(0,t.jsx)("section",{className:"flex flex-col gap-3",children:(0,t.jsxs)(se,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:c("Probe")})}),(0,t.jsxs)(ne,{className:"px-4 py-4",children:[(0,t.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:c("Pick a function and an identity, then run it to see the access outcome.")}),(0,t.jsx)(Je,{functions:e,prefill:r,runAsIdentity:a})]})]})}),o&&(0,t.jsx)("section",{className:"flex flex-col gap-2",children:(0,t.jsx)(Ye,{})})]})},"xt");export{ht as PermissionsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as y}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as R}from"./chunk-
|
|
1
|
+
import{b as y}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as R}from"./chunk-C7FJ2JKY.js";import"./chunk-NCPW7WHO.js";import"./chunk-G43F7LYA.js";import"./chunk-55UGUCQ6.js";import{a as v}from"./chunk-4ZEL6BYL.js";import{c as $}from"./chunk-RX755NMO.js";import"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import"./chunk-HBO4SMAO.js";import{a as S}from"./chunk-RWVIV3U7.js";import{a as A,b as C,c as I,d as x,e as c,f as n}from"./chunk-HCTJKP5J.js";import{a as k,e as w}from"./chunk-2IKDEUCX.js";import{d as N}from"./chunk-74IYYDDI.js";import{a as f,d as b,f as E,g as O}from"./chunk-I26MS5PJ.js";var j=b(E(),1);var r=b(O(),1);var _=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"I"),T={delete:2,list:3,read:0,write:1},B=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||T[t.on]-T[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"O"),q=f(()=>{let e=(0,j.c)(14),t=N(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(v.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=B(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(R,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(w,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(C,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(c,{children:t("Bucket")}),(0,r.jsx)(c,{children:t("Operation")}),(0,r.jsx)(c,{children:t("Key prefix")}),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(I,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(n,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(n,{children:(0,r.jsx)(y,{variant:"secondary",children:_(t,s.on)})}),(0,r.jsx)(n,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(n,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"M");export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s}from"./chunk-
|
|
1
|
+
import{a as s}from"./chunk-RX755NMO.js";import{a as n}from"./chunk-I26MS5PJ.js";var b="__lunora_admin__:",g=new Set(["action","mutation","query"]),c=Symbol("lunora.operationSeq"),_=n(t=>{if(typeof t!="object"||t===null)return;let e=t[c];return typeof e=="number"?e:void 0},"g"),d=n((t,e)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,c,{configurable:!0,enumerable:!1,value:e,writable:!0})}catch{}},"h"),m=n(t=>{if(typeof t!="object"||t===null)return;let e=t.__lunoraRef;return typeof e=="string"&&e.startsWith(b)?e:void 0},"p"),h=n(t=>{if(typeof t!="object"||t===null)return"";let{shardKey:e}=t;return typeof e=="string"?e:""},"O"),w=n(t=>new Proxy(t,{get(e,u,y){let i=Reflect.get(e,u,y);if(typeof i!="function"||typeof u!="string"||!g.has(u))return typeof i=="function"?i.bind(e):i;let f=i;return async(...o)=>{let l=m(o[0]);if(l===void 0)return f.apply(e,o);let p=typeof o[1]=="object"&&o[1]!==null?o[1]:{},a=s.start(l,p,h(o[2]));try{let r=await f.apply(e,o);return s.settle(a,{result:r}),r}catch(r){throw s.settle(a,{error:r instanceof Error?r.message:String(r)}),d(r,a),r}}}}),"E");export{_ as a,w as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-KNUGID7F.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-VDC6JP4A.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import"./chunk-3I25WO3P.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,q as ge}from"./chunk-74IYYDDI.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,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":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
|
|
1
|
+
import{a as ae,d as le,e as ke,i as Ne,j as we,l as Se}from"./chunk-ZN7TURF4.js";import"./chunk-NQZALRU3.js";import"./chunk-OPM7ESDV.js";import"./chunk-Y3AYVFTK.js";import{a as ye}from"./chunk-VDC6JP4A.js";import"./chunk-OYCUPD3Q.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import{a as oe}from"./chunk-SA2OGF3F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import"./chunk-AUGKHAMQ.js";import{i as me}from"./chunk-OQ6I6OXT.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{l as ue}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import"./chunk-HBO4SMAO.js";import{a as re}from"./chunk-RWVIV3U7.js";import{a as be,b as xe,c as ve,d as J,e as T,f as _}from"./chunk-HCTJKP5J.js";import{a as he,e as pe}from"./chunk-2IKDEUCX.js";import{d as Y,q as ge}from"./chunk-74IYYDDI.js";import{a as c,d as te,e as Ae,f as qe,g as je,i as fe}from"./chunk-I26MS5PJ.js";var z=te(qe(),1);var E=te(Ae(),1);var n=te(je(),1);var Ie=["call","schedule","read","write","enqueue","publish","subscribe","start","trigger","invoke"],Me=new Set(["enqueue","publish","schedule","start","subscribe","trigger"]),$e={cron:1,function:2,http:0,queue:4,service:7,table:6,topic:3,workflow:5},Be={stroke:"var(--muted-foreground)"},De={fill:"var(--muted-foreground)",fontSize:10},Fe={fill:"var(--background)"},Q="",se=260,Oe=120,Ce=44,de=40,_e=12,ie=16,Re=c(r=>{if(typeof r!="object"||r===null)return;let e=r;return["edges","nodes","modules","unresolved"].every(d=>Array.isArray(e[d]))?e:void 0},"Ge"),ze={cron:c(()=>({to:"/schedule"}),"cron"),function:c(()=>({to:"/functions"}),"function"),http:c(()=>({to:"/api"}),"http"),queue:c(()=>({to:"/queues"}),"queue"),service:c(()=>({to:"/functions"}),"service"),table:c(r=>({search:{table:r.name},to:"/data"}),"table"),topic:c(()=>({to:"/queues"}),"topic"),workflow:c(()=>({to:"/workflows"}),"workflow")},Pe=c(r=>ze[r.kind](r),"Me"),H=c(r=>r.module??Q,"R"),Te=c((r,e,d)=>{let t=new Set;for(let l of r.nodes)(e===void 0||H(l)===e)&&t.add(l.id);if(e===void 0)return t;let a=new Set(t);for(let l of r.edges)d.has(l.kind)&&(t.has(l.from)&&a.add(l.to),t.has(l.to)&&a.add(l.from));return a},"Pe"),Ee=c((r,e,d,t)=>{let a=`lane:${r}`;return[{data:{label:e},id:a,position:{x:d*(se+Oe),y:0},selectable:!1,style:{height:Ce+t.length*(de+_e)+ie,width:se},type:"lane"},...t.map((l,i)=>({className:"flex cursor-pointer items-center truncate rounded-md border border-border bg-card px-2 text-xs text-foreground hover:border-ring",data:{label:`${l.detail??l.kind} \xB7 ${l.name}`,link:Pe(l)},extent:"parent",id:l.id,parentId:a,position:{x:ie,y:Ce+i*(de+_e)},style:{height:de,width:se-ie*2},type:"member"}))]},"Re"),He=c((r,e)=>{let d=Te(r,e.lane,e.kinds),t=new Map;for(let o of r.nodes)d.has(o.id)&&t.set(H(o),[...t.get(H(o))??[],o]);let a=[...r.modules.map(o=>({label:o.installed===!0?`${o.name} \xB7 ${e.componentLabel}`:o.name,lane:o.name})),{label:e.appLaneLabel,lane:Q}],l=[],i=0;for(let{label:o,lane:f}of a){let m=(t.get(f)??[]).toSorted((h,s)=>$e[h.kind]-$e[s.kind]||h.name.localeCompare(s.name));m.length>0&&(l.push(...Ee(f,o,i,m)),i+=1)}let u=[];for(let o of r.edges)e.kinds.has(o.kind)&&d.has(o.from)&&d.has(o.to)&&u.push({animated:Me.has(o.kind),id:`${o.from}|${o.kind}|${o.to}`,label:o.kind,labelBgStyle:Fe,labelStyle:De,source:o.from,style:Be,target:o.to,type:"smoothstep"});return{edges:u,nodes:l}},"Fe"),ce="*",Ve=c(r=>{let e=(0,z.c)(2),{data:d}=r,t=String(d.label),a;return e[0]!==t?(a=(0,n.jsx)("div",{className:"size-full rounded-lg border border-dashed border-border bg-background/60 px-3 py-2 text-xs font-medium text-muted-foreground",children:t}),e[0]=t,e[1]=a):a=e[1],a},"qe"),Le={opacity:0},Ze=c(r=>{let e=(0,z.c)(10),{data:d}=r,t=me(),{label:a,link:l}=d,i;e[0]!==l||e[1]!==t?(i=c(()=>{ge(t(l))},"u"),e[0]=l,e[1]=t,e[2]=i):i=e[2];let u=i,o;e[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,n.jsx)(le,{isConnectable:!1,position:ae.Left,style:Le,type:"target"}),e[3]=o):o=e[3];let f;e[4]!==a||e[5]!==u?(f=(0,n.jsx)("button",{className:"size-full cursor-pointer truncate rounded-md text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",onClick:u,type:"button",children:a}),e[4]=a,e[5]=u,e[6]=f):f=e[6];let m;e[7]===Symbol.for("react.memo_cache_sentinel")?(m=(0,n.jsx)(le,{isConnectable:!1,position:ae.Right,style:Le,type:"source"}),e[7]=m):m=e[7];let h;return e[8]!==f?(h=(0,n.jsxs)(n.Fragment,{children:[o,f,m]}),e[8]=f,e[9]=h):h=e[9],h},"je"),Ge={lane:Ve,member:Ze},Ke=c(r=>{let e=Re(r);return e===void 0?{kind:"error",message:"the response is not an architecture manifest"}:e.modules.length===0?{kind:"empty"}:{kind:"ready",spec:e}},"ze"),We=c(r=>{let e=(0,z.c)(54),{manifest:d}=r,t=Y(),a,l,i,u,o,f,m,h,s,p;if(e[0]!==d.modules||e[1]!==d.nodes||e[2]!==t){let P=new Map;for(let g of d.nodes)g.kind==="function"&&P.set(H(g),(P.get(H(g))??0)+1);let j=c(g=>P.get(g)??0,"I");o=j(Q),u=he,p="overflow-hidden py-0",i=pe,s="px-0",l=be,m="architecture-catalog";let L;e[13]!==t?(L=t("Module"),e[13]=t,e[14]=L):L=e[14];let I;e[15]!==L?(I=(0,n.jsx)(T,{children:L}),e[15]=L,e[16]=I):I=e[16];let A;e[17]!==t?(A=t("Description"),e[17]=t,e[18]=A):A=e[18];let q;e[19]!==A?(q=(0,n.jsx)(T,{children:A}),e[19]=A,e[20]=q):q=e[20];let v;e[21]!==t?(v=t("Owned tables"),e[21]=t,e[22]=v):v=e[22];let y;e[23]!==v?(y=(0,n.jsx)(T,{children:v}),e[23]=v,e[24]=y):y=e[24];let k;e[25]!==t?(k=t("Functions"),e[25]=t,e[26]=k):k=e[26];let N;e[27]!==k?(N=(0,n.jsx)(T,{children:k}),e[27]=k,e[28]=N):N=e[28],e[29]!==y||e[30]!==N||e[31]!==I||e[32]!==q?(h=(0,n.jsx)(xe,{children:(0,n.jsxs)(J,{children:[I,q,y,N]})}),e[29]=y,e[30]=N,e[31]=I,e[32]=q,e[33]=h):h=e[33],a=ve,f=d.modules.map(g=>(0,n.jsxs)(J,{"data-testid":`architecture-module-${g.name}`,children:[(0,n.jsxs)(_,{className:"font-mono text-xs",children:[g.name,g.installed===!0&&(0,n.jsx)(ne,{className:"ml-2","data-testid":`architecture-component-${g.name}`,variant:"outline",children:t("Component")})]}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:g.description??(g.installed===!0?t("Installed component"):"\u2014")}),(0,n.jsx)(_,{className:"font-mono text-xs text-muted-foreground",children:g.tables.length===0?"\u2014":g.tables.join(", ")}),(0,n.jsx)(_,{className:"text-xs",children:j(g.name)})]},g.name)),e[0]=d.modules,e[1]=d.nodes,e[2]=t,e[3]=a,e[4]=l,e[5]=i,e[6]=u,e[7]=o,e[8]=f,e[9]=m,e[10]=h,e[11]=s,e[12]=p}else a=e[3],l=e[4],i=e[5],u=e[6],o=e[7],f=e[8],m=e[9],h=e[10],s=e[11],p=e[12];let b;e[34]!==o||e[35]!==t?(b=o>0&&(0,n.jsxs)(J,{"data-testid":"architecture-module-app",children:[(0,n.jsx)(_,{className:"text-xs italic text-muted-foreground",children:t("Outside any module")}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs text-muted-foreground",children:"\u2014"}),(0,n.jsx)(_,{className:"text-xs",children:o})]}),e[34]=o,e[35]=t,e[36]=b):b=e[36];let x;e[37]!==a||e[38]!==f||e[39]!==b?(x=(0,n.jsxs)(a,{children:[f,b]}),e[37]=a,e[38]=f,e[39]=b,e[40]=x):x=e[40];let S;e[41]!==l||e[42]!==m||e[43]!==h||e[44]!==x?(S=(0,n.jsxs)(l,{"data-testid":m,children:[h,x]}),e[41]=l,e[42]=m,e[43]=h,e[44]=x,e[45]=S):S=e[45];let $;e[46]!==i||e[47]!==s||e[48]!==S?($=(0,n.jsx)(i,{className:s,children:S}),e[46]=i,e[47]=s,e[48]=S,e[49]=$):$=e[49];let C;return e[50]!==u||e[51]!==p||e[52]!==$?(C=(0,n.jsx)(u,{className:p,children:$}),e[50]=u,e[51]=p,e[52]=$,e[53]=C):C=e[53],C},"Ye"),Ye=c(r=>{let e=(0,z.c)(52),{manifest:d}=r,t=Y(),[a,l]=(0,E.useState)(ce),[i,u]=(0,E.useState)(Je),o;e[0]!==d.edges?(o=c(w=>d.edges.some(X=>X.kind===w),"n"),e[0]=d.edges,e[1]=o):o=e[1];let f=Ie.filter(o),m;e[2]!==t?(m=t("Outside any module"),e[2]=t,e[3]=m):m=e[3];let h=m,s;e[4]!==t?(s=t("Component"),e[4]=t,e[5]=s):s=e[5];let p=s,b;e[6]!==h||e[7]!==p||e[8]!==i||e[9]!==a||e[10]!==d?(b=He(d,{appLaneLabel:h,componentLabel:p,kinds:i,...a===ce?{}:{lane:a}}),e[6]=h,e[7]=p,e[8]=i,e[9]=a,e[10]=d,e[11]=b):b=e[11];let{edges:x,nodes:S}=b,$=(0,E.useRef)(null),C;e[12]===Symbol.for("react.memo_cache_sentinel")?(C=c(w=>{l(w.target.value)},"_"),e[12]=C):C=e[12];let P=C,j;e[13]===Symbol.for("react.memo_cache_sentinel")?(j=c(w=>{u(X=>{let ee=new Set(X);return ee.delete(w)||ee.add(w),ee})},"I"),e[13]=j):j=e[13];let L=j,I="flex flex-col gap-2",A="architecture-diagram",q="flex flex-wrap items-center gap-2",v;e[14]!==t?(v=t("Module"),e[14]=t,e[15]=v):v=e[15];let y;e[16]!==t?(y=t("All modules"),e[16]=t,e[17]=y):y=e[17];let k;e[18]!==y?(k=(0,n.jsx)("option",{value:ce,children:y}),e[18]=y,e[19]=k):k=e[19];let N;e[20]!==d.modules?(N=d.modules.map(Qe),e[20]=d.modules,e[21]=N):N=e[21];let g;e[22]!==t?(g=t("Outside any module"),e[22]=t,e[23]=g):g=e[23];let M;e[24]!==g?(M=(0,n.jsx)("option",{value:Q,children:g}),e[24]=g,e[25]=M):M=e[25];let B;e[26]!==a||e[27]!==v||e[28]!==k||e[29]!==N||e[30]!==M?(B=(0,n.jsxs)("select",{"aria-label":v,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":"architecture-module-filter",onChange:P,value:a,children:[k,N,M]}),e[26]=a,e[27]=v,e[28]=k,e[29]=N,e[30]=M,e[31]=B):B=e[31];let D;e[32]!==x.length||e[33]!==t?(D=t("{count} edges shown",{count:x.length}),e[32]=x.length,e[33]=t,e[34]=D):D=e[34];let F;e[35]!==D?(F=(0,n.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":"architecture-edge-count",children:D}),e[35]=D,e[36]=F):F=e[36];let V;e[37]!==i?(V=c(w=>(0,n.jsx)("button",{"aria-pressed":i.has(w),className:fe("rounded-full border border-border px-2.5 py-0.5 text-xs",i.has(w)?"bg-muted":"text-muted-foreground line-through"),"data-testid":`architecture-kind-${w}`,onClick:c(()=>{L(w)},"onClick"),type:"button",children:w},w),"q"),e[37]=i,e[38]=V):V=e[38];let U=f.map(V),O;e[39]!==B||e[40]!==F||e[41]!==U?(O=(0,n.jsxs)("div",{className:q,children:[B,F,U]}),e[39]=B,e[40]=F,e[41]=U,e[42]=O):O=e[42];let Z,G,K;e[43]===Symbol.for("react.memo_cache_sentinel")?(Z=(0,n.jsx)(Ne,{}),G=(0,n.jsx)(we,{showInteractive:!1}),K=(0,n.jsx)(Se,{containerRef:$,filenameBase:"architecture",testIdPrefix:"architecture"}),e[43]=Z,e[44]=G,e[45]=K):(Z=e[43],G=e[44],K=e[45]);let R;e[46]!==x||e[47]!==S?(R=(0,n.jsx)("div",{className:"h-[600px] w-full overflow-hidden border border-border bg-muted/20","data-testid":"architecture-canvas",ref:$,children:(0,n.jsxs)(ke,{edges:x,edgesFocusable:!1,fitView:!0,minZoom:.1,nodes:S,nodesConnectable:!1,nodesDraggable:!1,nodeTypes:Ge,children:[Z,G,K]})}),e[46]=x,e[47]=S,e[48]=R):R=e[48];let W;return e[49]!==O||e[50]!==R?(W=(0,n.jsxs)("section",{className:I,"data-testid":A,children:[O,R]}),e[49]=O,e[50]=R,e[51]=W):W=e[51],W},"Ve"),mt=c(r=>{let e=(0,z.c)(28),{manifest:d}=r,t=Y(),a=ue(),l;e[0]!==a?(l=c(()=>a.fetchArchitecture(),"r"),e[0]=a,e[1]=l):l=e[1];let i=ye(d,l,Ke);if(i.kind==="loading"){let s;return e[2]===Symbol.for("react.memo_cache_sentinel")?(s=(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"architecture-loading",children:[(0,n.jsx)(oe,{className:"h-8 w-48"}),(0,n.jsx)(oe,{className:"h-64 w-full"})]}),e[2]=s):s=e[2],s}if(i.kind==="error"){let s;e[3]!==i.message||e[4]!==t?(s=t("Couldn't load the architecture manifest: {message}",{message:i.message}),e[3]=i.message,e[4]=t,e[5]=s):s=e[5];let p;e[6]!==t?(p=t("Architecture unavailable"),e[6]=t,e[7]=p):p=e[7];let b;return e[8]!==s||e[9]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-error",title:p}),e[8]=s,e[9]=p,e[10]=b):b=e[10],b}if(i.kind==="empty"){let s;e[11]!==t?(s=t("Add a lunora/<folder>/module.ts that default-exports defineModule(...) and run lunora codegen to map your modules here. Installed components join the map once you declare one."),e[11]=t,e[12]=s):s=e[12];let p;e[13]!==t?(p=t("No modules declared"),e[13]=t,e[14]=p):p=e[14];let b;return e[15]!==s||e[16]!==p?(b=(0,n.jsx)(re,{description:s,testId:"architecture-empty",title:p}),e[15]=s,e[16]=p,e[17]=b):b=e[17],b}let{spec:u}=i,o,f;e[18]!==u?(o=(0,n.jsx)(We,{manifest:u}),f=(0,n.jsx)(Ye,{manifest:u}),e[18]=u,e[19]=o,e[20]=f):(o=e[19],f=e[20]);let m;e[21]!==u.unresolved||e[22]!==t?(m=u.unresolved.length>0&&(0,n.jsxs)("details",{className:"text-sm","data-testid":"architecture-unresolved",children:[(0,n.jsxs)("summary",{className:"cursor-pointer text-muted-foreground",children:[t("{count} call sites could not be drawn",{count:u.unresolved.length})," ",(0,n.jsx)(ne,{variant:"outline",children:u.unresolved.length})]}),(0,n.jsx)("ul",{className:"mt-2 flex flex-col gap-1 font-mono text-xs",children:u.unresolved.map(Ue)})]}),e[21]=u.unresolved,e[22]=t,e[23]=m):m=e[23];let h;return e[24]!==o||e[25]!==f||e[26]!==m?(h=(0,n.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"architecture-panel",children:[o,f,m]}),e[24]=o,e[25]=f,e[26]=m,e[27]=h):h=e[27],h},"mt");function Je(){return new Set(Ie)}c(Je,"We");function Qe(r){return(0,n.jsx)("option",{value:r.name,children:r.name},r.name)}c(Qe,"Ze");function Ue(r){return(0,n.jsxs)("li",{children:[r.file,":",r.line," \xB7 ",r.kind," \xB7 ",r.reason]},`${r.file}:${String(r.line)}:${r.kind}:${r.reason}`)}c(Ue,"Je");export{mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as c}from"./chunk-
|
|
1
|
+
import{b as c}from"./chunk-RX755NMO.js";import{l}from"./chunk-YBDF3DET.js";import{a as r,d as f,f as g}from"./chunk-I26MS5PJ.js";var m=f(g(),1);var p={capabilities:{accounts:!0,admin:!0,inviteOnly:!1,organization:!1,passkey:!1,twoFactor:!1},emailAndPassword:!1,organization:{enabled:!1,roles:!1,teams:!1},plugins:[],rateLimit:{enabled:!1},session:{},socialProviders:[],userFields:[]},h=r(()=>{let a=(0,m.c)(6),t=l(),o;a[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-auth-config"],a[0]=o):o=a[0];let e;a[1]!==t?(e=r(()=>t.getAuthConfig(),"t"),a[1]=t,a[2]=e):e=a[2];let{data:u,isLoading:d}=c(o,e),s=u??p,n=!d,i;return a[3]!==s||a[4]!==n?(i={config:s,ready:n},a[3]=s,a[4]=n,a[5]=i):i=a[5],i},"y");export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as Ve}from"./chunk-WVWCUB4S.js";import{a as qe}from"./chunk-EWMBX5N2.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as Le}from"./chunk-R6U22RSY.js";import{a as _e}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ke}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as ie}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as me}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-T2JHVL34.js";import{l as Ne}from"./chunk-AVSMQPR3.js";import"./chunk-QAQDMS6R.js";import{b as Ie,c as $e}from"./chunk-3I25WO3P.js";import{a as Ae}from"./chunk-RWVIV3U7.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ce}from"./chunk-2IKDEUCX.js";import{d as ue,f as re,g as be,h as Ke,q as le,u as Te}from"./chunk-74IYYDDI.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-I26MS5PJ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|
|
1
|
+
import{a as Be,b as Ue,c as We,d as De,e as we}from"./chunk-5QR2SQIS.js";import"./chunk-NRP22GKC.js";import"./chunk-OPM7ESDV.js";import{a as Ve}from"./chunk-WVWCUB4S.js";import{a as qe}from"./chunk-EWMBX5N2.js";import"./chunk-NXQW5E6W.js";import"./chunk-UC7MNI2F.js";import"./chunk-NGVP66OH.js";import"./chunk-GHQ2VDI2.js";import{a as Le}from"./chunk-R6U22RSY.js";import{a as _e}from"./chunk-7Q256NLI.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as ke}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-SJQERRSZ.js";import"./chunk-7Y3SY37W.js";import{a as ie}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as me}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import"./chunk-55UGUCQ6.js";import{a as U}from"./chunk-4ZEL6BYL.js";import{c as Ee}from"./chunk-RX755NMO.js";import{l as Ne}from"./chunk-YBDF3DET.js";import"./chunk-QAQDMS6R.js";import{b as Ie,c as $e}from"./chunk-HBO4SMAO.js";import{a as Ae}from"./chunk-RWVIV3U7.js";import{a as ze,b as Re,c as je,d as pe,e as B,f as z}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ce}from"./chunk-2IKDEUCX.js";import{d as ue,f as re,g as be,h as Ke,q as le,u as Te}from"./chunk-74IYYDDI.js";import{a as d,d as ye,e as Oe,f as Ge,g as He}from"./chunk-I26MS5PJ.js";var ge=ye(Ge(),1);var ne=ye(Oe(),1);var t=ye(He(),1);var Se="none",Je=["all","open","resolved","ignored"],Pe=["critical","high","medium","low"],Qe=re(U.resolveIssue),Xe=re(U.ignoreIssue),Fe=re(U.assignIssue),Ye=re(U.setIssueSeverity),Ze=re(U.explainIssue),es=d(n=>Array.isArray(n?.issues)?n.issues:[],"Xe"),ss=d(n=>n==="resolved"?"success":n==="ignored"?"secondary":"warning","Je"),ts=d(n=>n==="critical"?"destructive":n==="high"?"warning":n==="medium"?"info":"secondary","Ze"),as=d(n=>{let e=(0,ge.c)(44),{expanded:u,issue:s,shardKey:$}=n,i=Ne(),l=ue(),[a,o]=(0,ne.useState)(void 0),{busy:_,error:A,run:R}=Ve(),K;e[0]!==i||e[1]!==s||e[2]!==R||e[3]!==$?(K=d(()=>{o(void 0),R(async()=>{let g={culprit:s.culprit,sampleMessage:s.sampleMessage,title:s.title},I=await i.query(Ze,g,be($));o(I)})},"C"),e[0]=i,e[1]=s,e[2]=R,e[3]=$,e[4]=K):K=e[4];let L=K;if(!u)return null;let k;if(e[5]!==s.sampleMessage){let g=$e(s.sampleMessage);k=g===void 0?void 0:Ie(g.body),e[5]=s.sampleMessage,e[6]=k}else k=e[6];let T=k,E=`issues-detail-${s.hash}`,h;e[7]!==s.sampleMessage?(h=(0,t.jsx)("p",{className:"whitespace-pre-wrap font-mono text-xs text-muted-foreground",children:s.sampleMessage}),e[7]=s.sampleMessage,e[8]=h):h=e[8];let x;e[9]!==l?(x=l("Suggested fix"),e[9]=l,e[10]=x):x=e[10];let M;e[11]!==x?(M=(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:x}),e[11]=x,e[12]=M):M=e[12];let v;e[13]!==T||e[14]!==s.hash||e[15]!==l?(v=T===void 0?(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":`issues-hint-empty-${s.hash}`,children:l("No known fix for this error yet.")}):(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm","data-testid":`issues-hint-${s.hash}`,children:T}),e[13]=T,e[14]=s.hash,e[15]=l,e[16]=v):v=e[16];let y;e[17]!==M||e[18]!==v?(y=(0,t.jsxs)("div",{children:[M,v]}),e[17]=M,e[18]=v,e[19]=y):y=e[19];let b=`issues-explain-${s.hash}`,w;e[20]!==_||e[21]!==l?(w=l(_?"Explaining\u2026":"Explain in plain language"),e[20]=_,e[21]=l,e[22]=w):w=e[22];let m;e[23]!==_||e[24]!==L||e[25]!==w||e[26]!==b?(m=(0,t.jsx)("div",{children:(0,t.jsx)(ie,{"data-testid":b,disabled:_,onClick:L,size:"sm",type:"button",variant:"outline",children:w})}),e[23]=_,e[24]=L,e[25]=w,e[26]=b,e[27]=m):m=e[27];let f;e[28]!==A||e[29]!==s.hash?(f=A!==null&&(0,t.jsx)("p",{className:"text-xs text-destructive","data-testid":`issues-explain-error-${s.hash}`,role:"alert",children:A}),e[28]=A,e[29]=s.hash,e[30]=f):f=e[30];let p;e[31]!==a||e[32]!==s.hash||e[33]!==l?(p=a!==void 0&&(a.degraded?(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":`issues-degraded-${s.hash}`,children:a.reason==="no-ai-binding"?l("No AI binding is configured. Wire an AI binding to enable plain-language explanations \u2014 the suggested fix above is always available."):l("The AI model could not explain this error right now. The suggested fix above still applies.")}):(0,t.jsxs)("div",{"data-testid":`issues-explanation-${s.hash}`,children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:l("AI explanation")}),(0,t.jsx)("p",{className:"mt-1 whitespace-pre-wrap text-sm",children:a.explanation}),a.groundedId===void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-muted-foreground","data-testid":`issues-ungrounded-${s.hash}`,children:l("No catalog fix matched this error, so this explanation is the model's own reading of the message. Verify before acting on it.")}),(0,t.jsx)("p",{className:"mt-1 text-[0.7rem] text-muted-foreground",children:l("Generated by {model}",{model:a.model})})]})),e[31]=a,e[32]=s.hash,e[33]=l,e[34]=p):p=e[34];let c;e[35]!==m||e[36]!==f||e[37]!==p||e[38]!==h||e[39]!==y?(c=(0,t.jsx)(z,{className:"bg-muted/30",colSpan:7,children:(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-1",children:[h,y,m,f,p]})}),e[35]=m,e[36]=f,e[37]=p,e[38]=h,e[39]=y,e[40]=c):c=e[40];let S;return e[41]!==c||e[42]!==E?(S=(0,t.jsx)(pe,{"data-testid":E,children:c}),e[41]=c,e[42]=E,e[43]=S):S=e[43],S},"et"),is=d(n=>{let e=(0,ge.c)(119),{busy:u,issue:s,rowError:$,runTriage:i,shardKey:l}=n,a=ue(),[o,_]=(0,ne.useState)(!1),A;e[0]===Symbol.for("react.memo_cache_sentinel")?(A=d(()=>{_(rs)},"A"),e[0]=A):A=e[0];let R=A,K;e[1]!==s.hash||e[2]!==i?(K=d(ae=>{let ce=ae===null||ae===Se?null:ae;le(i(s.hash,Ye,{severity:ce}))},"C"),e[1]=s.hash,e[2]=i,e[3]=K):K=e[3];let L=K,k;e[4]!==s.hash||e[5]!==i?(k=d(ae=>{if(ae.key!=="Enter")return;let ce=ae.currentTarget.value.trim();le(i(s.hash,Fe,{assignee:ce===""?null:ce}))},"T"),e[4]=s.hash,e[5]=i,e[6]=k):k=e[6];let T=k,E=`issues-row-${s.hash}`,h;e[7]!==a?(h=a("Toggle issue details"),e[7]=a,e[8]=h):h=e[8];let x=`issues-toggle-${s.hash}`,M=`mt-1 size-3 shrink-0 text-muted-foreground transition-transform ${o?"rotate-90":""}`,v;e[9]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)("path",{d:"m9 6 6 6-6 6"}),e[9]=v):v=e[9];let y;e[10]!==M?(y=(0,t.jsx)("svg",{"aria-hidden":"true",className:M,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24",children:v}),e[10]=M,e[11]=y):y=e[11];let b;e[12]!==s.title?(b=(0,t.jsx)("span",{className:"block truncate font-medium",title:s.title,children:s.title}),e[12]=s.title,e[13]=b):b=e[13];let w;e[14]!==s.culprit?(w=(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",title:s.culprit,children:s.culprit}),e[14]=s.culprit,e[15]=w):w=e[15];let m;e[16]!==b||e[17]!==w?(m=(0,t.jsxs)("span",{className:"min-w-0",children:[b,w]}),e[16]=b,e[17]=w,e[18]=m):m=e[18];let f;e[19]!==o||e[20]!==m||e[21]!==h||e[22]!==x||e[23]!==y?(f=(0,t.jsxs)("button",{"aria-expanded":o,"aria-label":h,className:"flex w-full items-start gap-2 text-left","data-testid":x,onClick:R,type:"button",children:[y,m]}),e[19]=o,e[20]=m,e[21]=h,e[22]=x,e[23]=y,e[24]=f):f=e[24];let p;e[25]!==s.hash||e[26]!==$?(p=$!==void 0&&(0,t.jsx)("p",{className:"mt-1 text-xs text-destructive","data-testid":`issues-action-error-${s.hash}`,role:"alert",children:$}),e[25]=s.hash,e[26]=$,e[27]=p):p=e[27];let c;e[28]!==f||e[29]!==p?(c=(0,t.jsxs)(z,{className:"max-w-80",children:[f,p]}),e[28]=f,e[29]=p,e[30]=c):c=e[30];let S=`issues-status-${s.hash}`,g;e[31]!==s.status?(g=ss(s.status),e[31]=s.status,e[32]=g):g=e[32];let I;e[33]!==s.status||e[34]!==S||e[35]!==g?(I=(0,t.jsx)(z,{children:(0,t.jsx)(me,{"data-testid":S,variant:g,children:s.status})}),e[33]=s.status,e[34]=S,e[35]=g,e[36]=I):I=e[36];let j=s.severity??Se,r;e[37]!==a?(r=a("Set severity"),e[37]=a,e[38]=r):r=e[38];let oe=`issues-severity-${s.hash}`,V;e[39]!==a?(V=a("\u2014"),e[39]=a,e[40]=V):V=e[40];let N;e[41]!==s.severity||e[42]!==a?(N=s.severity===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:a("\u2014")}):(0,t.jsx)(me,{variant:ts(s.severity),children:s.severity}),e[41]=s.severity,e[42]=a,e[43]=N):N=e[43];let C;e[44]!==V||e[45]!==N?(C=(0,t.jsx)(Ue,{placeholder:V,children:N}),e[44]=V,e[45]=N,e[46]=C):C=e[46];let q;e[47]!==r||e[48]!==oe||e[49]!==C?(q=(0,t.jsx)(We,{"aria-label":r,className:"h-7 w-[110px]","data-testid":oe,children:C}),e[47]=r,e[48]=oe,e[49]=C,e[50]=q):q=e[50];let de;e[51]===Symbol.for("react.memo_cache_sentinel")?(de=Pe.map(ls),e[51]=de):de=e[51];let W;e[52]!==a?(W=a("Clear"),e[52]=a,e[53]=W):W=e[53];let D;e[54]!==W?(D=(0,t.jsxs)(De,{children:[de,(0,t.jsx)(we,{value:Se,children:W})]}),e[54]=W,e[55]=D):D=e[55];let F;e[56]!==u||e[57]!==L||e[58]!==j||e[59]!==q||e[60]!==D?(F=(0,t.jsx)(z,{children:(0,t.jsxs)(Be,{disabled:u,onValueChange:L,value:j,children:[q,D]})}),e[56]=u,e[57]=L,e[58]=j,e[59]=q,e[60]=D,e[61]=F):F=e[61];let O;e[62]!==a?(O=a("Assignee"),e[62]=a,e[63]=O):O=e[63];let fe=`issues-assignee-${s.hash}`,xe=s.assignee??"",ve=s.assignee??"",G;e[64]!==a?(G=a("Unassigned"),e[64]=a,e[65]=G):G=e[65];let H;e[66]!==u||e[67]!==T||e[68]!==O||e[69]!==fe||e[70]!==xe||e[71]!==ve||e[72]!==G?(H=(0,t.jsx)(z,{children:(0,t.jsx)(ke,{"aria-label":O,className:"h-7 w-32","data-testid":fe,defaultValue:xe,disabled:u,onKeyDown:T,placeholder:G},ve)}),e[66]=u,e[67]=T,e[68]=O,e[69]=fe,e[70]=xe,e[71]=ve,e[72]=G,e[73]=H):H=e[73];let J;e[74]!==s.count?(J=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsx)(me,{variant:"secondary",children:s.count})}),e[74]=s.count,e[75]=J):J=e[75];let P;e[76]!==s.lastSeen?(P=Te(s.lastSeen),e[76]=s.lastSeen,e[77]=P):P=e[77];let Q;e[78]!==P?(Q=(0,t.jsx)(z,{className:"text-xs tabular-nums text-muted-foreground",children:P}),e[78]=P,e[79]=Q):Q=e[79];let X;e[80]!==u||e[81]!==s.hash||e[82]!==s.status||e[83]!==i||e[84]!==a?(X=s.status!=="resolved"&&(0,t.jsx)(ie,{"data-testid":`issues-resolve-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Qe,{}))},"onClick"),size:"xs",variant:"outline",children:a("Resolve")}),e[80]=u,e[81]=s.hash,e[82]=s.status,e[83]=i,e[84]=a,e[85]=X):X=e[85];let Y;e[86]!==u||e[87]!==s.hash||e[88]!==s.status||e[89]!==i||e[90]!==a?(Y=s.status!=="ignored"&&(0,t.jsx)(ie,{"data-testid":`issues-ignore-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Xe,{}))},"onClick"),size:"xs",variant:"ghost",children:a("Ignore")}),e[86]=u,e[87]=s.hash,e[88]=s.status,e[89]=i,e[90]=a,e[91]=Y):Y=e[91];let Z;e[92]!==u||e[93]!==s.assignee||e[94]!==s.hash||e[95]!==s.status||e[96]!==i||e[97]!==a?(Z=s.status!=="open"&&(0,t.jsx)(ie,{"data-testid":`issues-reopen-${s.hash}`,disabled:u,onClick:d(()=>{le(i(s.hash,Fe,{assignee:s.assignee??null}))},"onClick"),size:"xs",variant:"ghost",children:a("Reopen")}),e[92]=u,e[93]=s.assignee,e[94]=s.hash,e[95]=s.status,e[96]=i,e[97]=a,e[98]=Z):Z=e[98];let ee;e[99]!==X||e[100]!==Y||e[101]!==Z?(ee=(0,t.jsx)(z,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1",children:[X,Y,Z]})}),e[99]=X,e[100]=Y,e[101]=Z,e[102]=ee):ee=e[102];let se;e[103]!==c||e[104]!==I||e[105]!==F||e[106]!==H||e[107]!==J||e[108]!==Q||e[109]!==E||e[110]!==ee?(se=(0,t.jsxs)(pe,{"data-testid":E,children:[c,I,F,H,J,Q,ee]}),e[103]=c,e[104]=I,e[105]=F,e[106]=H,e[107]=J,e[108]=Q,e[109]=E,e[110]=ee,e[111]=se):se=e[111];let te;e[112]!==o||e[113]!==s||e[114]!==l?(te=(0,t.jsx)(as,{expanded:o,issue:s,shardKey:l},s.sampleMessage),e[112]=o,e[113]=s,e[114]=l,e[115]=te):te=e[115];let he;return e[116]!==se||e[117]!==te?(he=(0,t.jsxs)(t.Fragment,{children:[se,te]}),e[116]=se,e[117]=te,e[118]=he):he=e[118],he},"tt"),ks=d(n=>{let e=(0,ge.c)(38),{initialShardKey:u}=n,s=ue(),$=Ne(),{queryShardKey:i,setShardKey:l,shardKey:a}=Le(u),[o,_]=(0,ne.useState)("all"),[A,R]=(0,ne.useState)(ns),[K,L]=(0,ne.useState)(os),k;e[0]!==o?(k=o==="all"?{}:{status:o},e[0]=o,e[1]=k):k=e[1];let T;e[2]!==i?(T={live:!0,shardKey:i},e[2]=i,e[3]=T):T=e[3];let{data:E,error:h,liveError:x}=Ee(U.getIssues,k,T),M=E!==void 0,v;if(e[4]!==K||e[5]!==A||e[6]!==$||e[7]!==E||e[8]!==h||e[9]!==x||e[10]!==M||e[11]!==i||e[12]!==l||e[13]!==a||e[14]!==o||e[15]!==s){let y=es(E),b;e[17]!==$||e[18]!==i?(b=d(async(r,oe,V)=>{L(N=>{if(!N.has(r))return N;let C=new Map(N);return C.delete(r),C}),R(N=>new Set(N).add(r));try{await $.query(oe,{...V,hash:r},be(i))}catch(N){let C=Ke(N);L(q=>new Map(q).set(r,C))}R(N=>{let C=new Set(N);return C.delete(r),C})},"S"),e[17]=$,e[18]=i,e[19]=b):b=e[19];let w=b,m;e[20]!==s?(m=d(r=>s(r==="all"?"All":r==="open"?"Open":r==="resolved"?"Resolved":"Ignored"),"u"),e[20]=s,e[21]=m):m=e[21];let f=m,p;e[22]!==h?(p=h!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"issues-error",role:"alert",children:h}),e[22]=h,e[23]=p):p=e[23];let c;e[24]!==l||e[25]!==a?(c=(0,t.jsx)(_e,{onChange:l,testId:"issues-shard-input",value:a}),e[24]=l,e[25]=a,e[26]=c):c=e[26];let S;e[27]!==x?(S=(0,t.jsx)(qe,{message:x,prefix:"issues"}),e[27]=x,e[28]=S):S=e[28];let g;e[29]!==o||e[30]!==f?(g=Je.map(r=>(0,t.jsx)(ie,{"data-active":o===r?"":void 0,"data-testid":`issues-filter-${r}`,onClick:d(()=>{_(r)},"onClick"),size:"xs",variant:o===r?"default":"outline",children:f(r)},r)),e[29]=o,e[30]=f,e[31]=g):g=e[31];let I;e[32]!==g?(I=(0,t.jsx)("div",{className:"ms-auto flex items-center gap-1","data-testid":"issues-status-filter",role:"group",children:g}),e[32]=g,e[33]=I):I=e[33];let j;e[34]!==I||e[35]!==c||e[36]!==S?(j=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,S,I]}),e[34]=I,e[35]=c,e[36]=S,e[37]=j):j=e[37],v=(0,t.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-issues-panel",children:[p,j,M&&y.length===0?(0,t.jsx)(Ae,{description:s("No grouped errors yet. When a function throws or a container crashes, matching errors fold into a single issue here."),testId:"issues-empty",title:s("No issues")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(ze,{"data-testid":"issues-table",children:[(0,t.jsx)(Re,{children:(0,t.jsxs)(pe,{children:[(0,t.jsx)(B,{children:s("Issue")}),(0,t.jsx)(B,{children:s("Status")}),(0,t.jsx)(B,{children:s("Severity")}),(0,t.jsx)(B,{children:s("Assignee")}),(0,t.jsx)(B,{className:"text-right",children:s("Events")}),(0,t.jsx)(B,{children:s("Last seen")}),(0,t.jsx)(B,{className:"text-right",children:s("Actions")})]})}),(0,t.jsx)(je,{children:y.map(r=>(0,t.jsx)(is,{busy:A.has(r.hash),issue:r,rowError:K.get(r.hash),runTriage:w,shardKey:i},r.hash))})]})})})]}),e[4]=K,e[5]=A,e[6]=$,e[7]=E,e[8]=h,e[9]=x,e[10]=M,e[11]=i,e[12]=l,e[13]=a,e[14]=o,e[15]=s,e[16]=v}else v=e[16];return v},"Tt");function rs(n){return!n}d(rs,"st");function ls(n){return(0,t.jsx)(we,{value:n,children:n},n)}d(ls,"at");function ns(){return new Set}d(ns,"it");function os(){return new Map}d(os,"lt");export{ks as default};
|