@lunora/studio 1.0.0-alpha.97 → 1.0.0-alpha.99
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-ON2FIVI2.js → chunk-2TFGS62O.js} +1 -1
- package/dist/standalone/{chunk-NDO6YSEG.js → chunk-3J6AAVUL.js} +1 -1
- package/dist/standalone/{chunk-DDO5EGID.js → chunk-4D56O2UT.js} +1 -1
- package/dist/standalone/{chunk-VH2IO643.js → chunk-5GMRSN6L.js} +1 -1
- package/dist/standalone/chunk-6FQJRXVI.js +11 -0
- package/dist/standalone/{chunk-STESBRLN.js → chunk-6IKXBSNY.js} +1 -1
- package/dist/standalone/{chunk-YZIR7PL5.js → chunk-7HWEPGII.js} +1 -1
- package/dist/standalone/{chunk-SZXVX6PY.js → chunk-7IIICQZ7.js} +1 -1
- package/dist/standalone/{chunk-OKZP3YY3.js → chunk-AIB3GCQI.js} +1 -1
- package/dist/standalone/{chunk-J4UYSDWF.js → chunk-AS4WSCMT.js} +1 -1
- package/dist/standalone/{chunk-5A7NIX77.js → chunk-BAZ2VU7R.js} +1 -1
- package/dist/standalone/{chunk-3IF75YS7.js → chunk-BG54FBTO.js} +1 -1
- package/dist/standalone/{chunk-KP6VHTO4.js → chunk-BMZPRRSX.js} +1 -1
- package/dist/standalone/{chunk-2KRXOCZ2.js → chunk-D34YXUQY.js} +1 -1
- package/dist/standalone/{chunk-I7V54EDS.js → chunk-DK4J7ZBH.js} +1 -1
- package/dist/standalone/{chunk-NJRW66LJ.js → chunk-DSU54IAT.js} +1 -1
- package/dist/standalone/{chunk-5L63KFHD.js → chunk-FKBHX7BD.js} +1 -1
- package/dist/standalone/{chunk-6F7KP54M.js → chunk-HRRFUAP6.js} +1 -1
- package/dist/standalone/{chunk-IZFPJXB3.js → chunk-II5ZTRTW.js} +1 -1
- package/dist/standalone/{chunk-S7ZOM3NK.js → chunk-IMME7XEE.js} +1 -1
- package/dist/standalone/{chunk-QEVFPILV.js → chunk-IXAMI2KV.js} +1 -1
- package/dist/standalone/{chunk-FHZ5WDTU.js → chunk-J3Q3ESBP.js} +1 -1
- package/dist/standalone/{chunk-SPE3AB54.js → chunk-J6PMARYI.js} +1 -1
- package/dist/standalone/{chunk-FXBBFE7Y.js → chunk-JR4LDDRW.js} +1 -1
- package/dist/standalone/{chunk-QC4T2L6I.js → chunk-JZUM7FBJ.js} +1 -1
- package/dist/standalone/{chunk-NCKRVNF2.js → chunk-KBBOZRRX.js} +1 -1
- package/dist/standalone/{chunk-XPOUF2XH.js → chunk-KVYAMWYX.js} +1 -1
- package/dist/standalone/{chunk-H5ZYPSLB.js → chunk-MCPDCNPO.js} +1 -1
- package/dist/standalone/{chunk-NBANYYGB.js → chunk-N6N6MMWG.js} +1 -1
- package/dist/standalone/{chunk-PMGTIUU2.js → chunk-NTAN75BV.js} +1 -1
- package/dist/standalone/{chunk-4EHNOASW.js → chunk-O36FXWMR.js} +1 -1
- package/dist/standalone/{chunk-QQYX5WN4.js → chunk-O3BG6T4B.js} +1 -1
- package/dist/standalone/{chunk-73B3T2SA.js → chunk-QVK5DESS.js} +1 -1
- package/dist/standalone/{chunk-D264UAKY.js → chunk-RE7VLJ6H.js} +1 -1
- package/dist/standalone/{chunk-EZKBI7SZ.js → chunk-T2NCAYLT.js} +1 -1
- package/dist/standalone/{chunk-UYPXC3OO.js → chunk-T7AVSVIA.js} +1 -1
- package/dist/standalone/{chunk-M3Z2YAHD.js → chunk-T7YW6OMG.js} +1 -1
- package/dist/standalone/{chunk-G2O3XP7Y.js → chunk-TLVSMHK2.js} +1 -1
- package/dist/standalone/{chunk-E3Z4QXAD.js → chunk-TMZQNRFA.js} +1 -1
- package/dist/standalone/{chunk-CXBXUT5A.js → chunk-U3Y2BI4W.js} +1 -1
- package/dist/standalone/{chunk-3626PHEZ.js → chunk-UE2NC2ZZ.js} +1 -1
- package/dist/standalone/{chunk-3SGYSFRC.js → chunk-URCRLZN7.js} +1 -1
- package/dist/standalone/{chunk-OZA2RA45.js → chunk-UYOSHHOV.js} +1 -1
- package/dist/standalone/{chunk-WLXH4ECM.js → chunk-V3EN6YQV.js} +1 -1
- package/dist/standalone/{chunk-LHAHIDNT.js → chunk-V4R4HI3U.js} +1 -1
- package/dist/standalone/{chunk-LAEO6D34.js → chunk-VKK7A4VH.js} +1 -1
- package/dist/standalone/{chunk-PKWJ7UOG.js → chunk-VOYG35OH.js} +1 -1
- package/dist/standalone/{chunk-II64XEZV.js → chunk-W2GXYXCQ.js} +1 -1
- package/dist/standalone/{chunk-MW5YIENZ.js → chunk-WG3WC2F2.js} +1 -1
- package/dist/standalone/{chunk-5L2VKBAJ.js → chunk-WZXZ6YN5.js} +1 -1
- package/dist/standalone/{chunk-YP7WZ6YM.js → chunk-XGL7QCYN.js} +1 -1
- package/dist/standalone/{chunk-HH5CZ6KD.js → chunk-XUQEE25M.js} +1 -1
- package/dist/standalone/{chunk-A6NAMYVS.js → chunk-XYENOWOR.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +5 -5
- package/dist/standalone/chunk-C2ZFQARQ.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Qe}from"./chunk-JN2Y24PY.js";import{a as Me}from"./chunk-FXBBFE7Y.js";import{a as Ve}from"./chunk-ESVP44Y3.js";import{a as Je}from"./chunk-3SCGCJYS.js";import{a as D}from"./chunk-5Y3QLNWX.js";import{a as He}from"./chunk-54MMVNPT.js";import{a as Ke}from"./chunk-FURI47Z2.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{R as B}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as z}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as T}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as Ge}from"./chunk-6F7KP54M.js";import{f as E}from"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as Ze}from"./chunk-XQCVZAGU.js";import{a as Ue,b as _e,c as $e,d as L,e as U,f as _}from"./chunk-WJQLNYGX.js";import{a as we,e as Ce}from"./chunk-WQH3LT2P.js";import{d as W,h as je,m as Ae,o as ze,r as Ie}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as r,e as Le,f as Ye,g as et,h as tt}from"./chunk-3XIESWL4.js";var k=Le(Ye(),1);var Z=Le(et(),1);var t=Le(tt(),1);var at=r(()=>{let u=(0,Z.c)(3),{config:e,ready:l}=Me(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"et"),st={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},lt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"at"),rt=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"lt"),it=r(u=>{let e=(0,Z.c)(105),{onClose:l,onCreated:s}=u,c=E(),a=W(),{config:o}=Me(),{busy:i,error:n,run:m}=Je(),[w,S]=(0,k.useState)(""),[b,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={},e[0]=v):v=e[0];let[f,d]=(0,k.useState)(v),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let x=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"F"),e[2]=F):F=e[2];let O=F,P;e[3]===Symbol.for("react.memo_cache_sentinel")?(P=r(p=>{I(p.target.value)},"P"),e[3]=P):P=e[3];let Be=P,G;e[4]===Symbol.for("react.memo_cache_sentinel")?(G=r(p=>{g(p.target.value)},"O"),e[4]=G):G=e[4];let Te=G,H;e[5]===Symbol.for("react.memo_cache_sentinel")?(H=r((p,$)=>{d(V=>({...V,[p]:$}))},"G"),e[5]=H):H=e[5];let Pe=H,J;e[6]!==f?(J=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"H"),e[6]=f,e[7]=J):J=e[7];let R=J,K;if(e[8]!==o.userFields||e[9]!==R){let p;e[11]!==R?(p=r($=>!$.required||lt($,R($)),"p"),e[11]=R,e[12]=p):p=e[12],K=o.userFields.every(p),e[8]=o.userFields,e[9]=R,e[10]=K}else K=e[10];let Fe=K,Q;e[13]!==i||e[14]!==w||e[15]!==b||e[16]!==Fe?(Q=!i&&w.trim()!==""&&b.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=b,e[16]=Fe,e[17]=Q):Q=e[17];let De=Q,X;e[18]!==o.userFields||e[19]!==R?(X=r(()=>{let p={};for(let $ of o.userFields){let V=rt($,R($));V!==void 0&&(p[$.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=R,e[20]=X):X=e[20];let Se=X,Y;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==b||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(Y=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:b.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"Z"),e[21]=Se,e[22]=c,e[23]=w,e[24]=b,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=Y):Y=e[30];let N=Y,j;e[31]!==a?(j=a("Create user"),e[31]=a,e[32]=j):j=e[32];let q;e[33]!==a?(q=a("Create user"),e[33]=a,e[34]=q):q=e[34];let M;e[35]!==q?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:q}),e[35]=q,e[36]=M):M=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(B,{"data-testid":"uc-email",id:"uc-email",onChange:x,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==b?(ie=(0,t.jsx)(B,{"data-testid":"uc-name",id:"uc-name",onChange:O,value:b}),e[50]=b,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(B,{"data-testid":"uc-role",id:"uc-role",onChange:Te,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o.userFields||e[74]!==R||e[75]!==a?(ve=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let $=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let qe=R(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:$,children:[(0,t.jsx)(Qe,{checked:qe,"data-testid":$,id:$,onCheckedChange:r(Xe=>{Pe(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let We=R(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:$,children:[p.name,V]}),(0,t.jsx)(B,{"data-testid":$,id:$,onChange:r(qe=>{Pe(p.name,qe.target.value)},"onChange"),type:st[p.type],value:typeof We=="string"?We:""})]},p.name)})]}),e[73]=o.userFields,e[74]=R,e[75]=a,e[76]=ve):ve=e[76];let xe;e[77]!==n?(xe=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=xe):xe=e[78];let be;e[79]!==a?(be=a("Cancel"),e[79]=a,e[80]=be):be=e[80];let ye;e[81]!==l||e[82]!==be?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:be}),e[81]=l,e[82]=be,e[83]=ye):ye=e[83];let Oe=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Oe||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:Oe,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=Oe,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Re;return e[94]!==l||e[95]!==j||e[96]!==M||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==ve||e[102]!==xe||e[103]!==ke?(Re=(0,t.jsxs)(Ve,{label:j,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,se,ne,ue,fe,ve,xe,ke]}),e[94]=l,e[95]=j,e[96]=M,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=ve,e[102]=xe,e[103]=ke,e[104]=Re):Re=e[104],Re},"st"),Ee=r(u=>{let e=(0,Z.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Le"),nt=r(u=>{let e=(0,Z.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=E(),i=W(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),b;e[0]!==o||e[1]!==c?(b=r(()=>{ze((async()=>{S(null);try{let x=await o.listAuthSessions({limit:50,userId:c});m(x.rows)}catch(x){let F=x;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=b):b=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(b,C);let y;e[7]!==o||e[8]!==s?(y=r(x=>{s(()=>o.revokeAuthSession({sessionId:x}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Ee,{children:h}),e[12]=h,e[13]=g):g=e[13];let v;e[14]!==w?(v=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=v):v=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)($e,{children:n.map(x=>(0,t.jsxs)(L,{"data-testid":`ud-session-${x.id}`,children:[(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(x.expiresAt)}),(0,t.jsx)(_,{children:x.ipAddress??""}),(0,t.jsx)(_,{className:"max-w-40 truncate",children:x.userAgent??""}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${x.id}`,disabled:l,onClick:r(()=>{I(x.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},x.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==v||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,v,f,d]}),e[24]=g,e[25]=v,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),dt=r(u=>{let e=(0,Z.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=E(),i=W(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),b;e[0]!==o||e[1]!==c?(b=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(x){let F=x;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=b):b=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(b,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(x=>{s(()=>o.unlinkAuthAccount({accountId:x,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Ee,{children:h}),e[13]=h,e[14]=g):g=e[14];let v;e[15]!==w?(v=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=v):v=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)($e,{children:n.map(x=>{let F=Ae(x.id);return(0,t.jsxs)(L,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)(_,{children:Ae(x.providerId)}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(x.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==v||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,v,f,d]}),e[25]=g,e[26]=v,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ot=r(u=>{let e=(0,Z.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=E(),n=W(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"I"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let b;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(b=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=b):b=e[8],(0,k.useEffect)(S,b);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let v;e[18]!==g?(v=(0,t.jsx)(Ee,{children:g}),e[18]=g,e[19]=v):v=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)($e,{children:m.map(F=>{let O=Ae(F.id);return(0,t.jsxs)(L,{"data-testid":`ud-passkey-${O}`,children:[(0,t.jsx)(_,{children:Ae(F.name)||O}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${O}`,disabled:l,onClick:r(()=>{h(O)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},O)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let x;return e[35]!==v||e[36]!==f||e[37]!==d||e[38]!==A?(x=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[v,f,d,A]}),e[35]=v,e[36]=f,e[37]=d,e[38]=A,e[39]=x):x=e[39],x},"nt"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),mt=r((u,e)=>typeof e=="number"&&ct.test(u)?Ie(e):Ae(e),"ct"),ht=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=E(),a=W(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,b]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,v]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,x]=(0,k.useState)(null),[F,O]=(0,k.useState)(!1),P=r((N,j)=>{ze((async()=>{w(!0),n(null);try{let q=await N();j?.refresh!==!1&&(b(M=>M+1),e()),j?.onResult?.(q)}catch(q){n(je(q))}w(!1)})())},"P"),Be=r(N=>{y(N.target.value)},"De"),G=r(N=>{h(N.target.value)},"O"),Te=r(N=>{v(N.target.value)},"je"),H=r(N=>{d(N.target.value)},"G"),Pe=r(()=>{let N=C.trim();N!==""&&P(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Se"),J=r(()=>{let N=Number.parseInt(g,10),j=Number.isFinite(N)&&N>0?N*86400:void 0;P(async()=>{await c.banAuthUser({expiresInSeconds:j,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"H"),R=r(()=>{P(async()=>{await c.unbanAuthUser({userId:s.id})})},"R"),K=r(()=>{P(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"J"),Fe=r(()=>{P(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{x(N.token)},"onResult"),refresh:!1})},"we"),Q=r(()=>{P(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"K"),De=r(()=>{P(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"Te"),X=r(()=>{O(!0)},"W"),Se=r(()=>{O(!1)},"Ce"),Y=Object.entries(s).filter(([N])=>!ut.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(T,{variant:"secondary",children:s.role}),o?(0,t.jsx)(T,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(T,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(T,{variant:"secondary",children:a("verified")}):(0,t.jsx)(T,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{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:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Pe,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:R,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:G,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Te,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:J,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(B,{"data-testid":"ud-password",id:"ud-password",onChange:H,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:K,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:Q,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:X,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(nt,{busy:m,runAction:P,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(dt,{busy:m,runAction:P,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ot,{busy:m,capabilities:u,runAction:P,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:Y.map(([N,j])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:mt(N,j)})]},N))})]})]})},"ut"),pt=50,$t=r(({pageSize:u=pt}={})=>{let e=E(),l=W(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=Ke(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:b}=at(),C=i.trim(),y=a.trim(),I=Ge(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,v=r(()=>{I.refetch()},"v");He(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(B,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(B,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(Ze,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)($e,{children:h.map(d=>(0,t.jsxs)(L,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)(_,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)(_,{children:d.email??""}),(0,t.jsx)(_,{children:d.name??""}),(0,t.jsx)(_,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(T,{variant:"secondary",children:d.role}):""}),(0,t.jsx)(_,{children:d.banned===!0?(0,t.jsx)(T,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(T,{variant:"success",children:l("Active")})}),(0,t.jsx)(_,{children:d.emailVerified===!0?(0,t.jsx)(T,{variant:"success",children:l("yes")}):(0,t.jsx)(T,{variant:"outline",children:l("no")})}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(ht,{capabilities:b,onChanged:v,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(it,{onClose:r(()=>{S(!1)},"onClose"),onCreated:v})]})},"Pt");export{$t as UsersPanel};
|
|
1
|
+
import{a as Qe}from"./chunk-JN2Y24PY.js";import{a as Me}from"./chunk-JR4LDDRW.js";import{a as Ve}from"./chunk-ESVP44Y3.js";import{a as Je}from"./chunk-3SCGCJYS.js";import{a as D}from"./chunk-5Y3QLNWX.js";import{a as He}from"./chunk-54MMVNPT.js";import{a as Ke}from"./chunk-FURI47Z2.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import{R as B}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as z}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as T}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as Ge}from"./chunk-HRRFUAP6.js";import{f as E}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{a as Ze}from"./chunk-XQCVZAGU.js";import{a as Ue,b as _e,c as $e,d as L,e as U,f as _}from"./chunk-WJQLNYGX.js";import{a as we,e as Ce}from"./chunk-WQH3LT2P.js";import{d as W,h as je,m as Ae,o as ze,r as Ie}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as r,e as Le,f as Ye,g as et,h as tt}from"./chunk-3XIESWL4.js";var k=Le(Ye(),1);var Z=Le(et(),1);var t=Le(tt(),1);var at=r(()=>{let u=(0,Z.c)(3),{config:e,ready:l}=Me(),s;return u[0]!==e.capabilities||u[1]!==l?(s={capabilities:e.capabilities,ready:l},u[0]=e.capabilities,u[1]=l,u[2]=s):s=u[2],s},"et"),st={boolean:"checkbox",date:"datetime-local",number:"number",string:"text"},lt=r((u,e)=>u.type==="boolean"?!0:typeof e!="string"||e.trim()===""?!1:u.type!=="number"||!Number.isNaN(Number(e.trim())),"at"),rt=r((u,e)=>{if(u.type==="boolean")return e===!0?{value:!0}:u.required?{value:!1}:void 0;let l=typeof e=="string"?e.trim():"";if(l!==""){if(u.type==="number"){let s=Number(l);return Number.isNaN(s)?void 0:{value:s}}return{value:l}}},"lt"),it=r(u=>{let e=(0,Z.c)(105),{onClose:l,onCreated:s}=u,c=E(),a=W(),{config:o}=Me(),{busy:i,error:n,run:m}=Je(),[w,S]=(0,k.useState)(""),[b,C]=(0,k.useState)(""),[y,I]=(0,k.useState)(""),[h,g]=(0,k.useState)(""),v;e[0]===Symbol.for("react.memo_cache_sentinel")?(v={},e[0]=v):v=e[0];let[f,d]=(0,k.useState)(v),A;e[1]===Symbol.for("react.memo_cache_sentinel")?(A=r(p=>{S(p.target.value)},"C"),e[1]=A):A=e[1];let x=A,F;e[2]===Symbol.for("react.memo_cache_sentinel")?(F=r(p=>{C(p.target.value)},"F"),e[2]=F):F=e[2];let O=F,P;e[3]===Symbol.for("react.memo_cache_sentinel")?(P=r(p=>{I(p.target.value)},"P"),e[3]=P):P=e[3];let Be=P,G;e[4]===Symbol.for("react.memo_cache_sentinel")?(G=r(p=>{g(p.target.value)},"O"),e[4]=G):G=e[4];let Te=G,H;e[5]===Symbol.for("react.memo_cache_sentinel")?(H=r((p,$)=>{d(V=>({...V,[p]:$}))},"G"),e[5]=H):H=e[5];let Pe=H,J;e[6]!==f?(J=r(p=>f[p.name]??(p.type==="boolean"?!1:""),"H"),e[6]=f,e[7]=J):J=e[7];let R=J,K;if(e[8]!==o.userFields||e[9]!==R){let p;e[11]!==R?(p=r($=>!$.required||lt($,R($)),"p"),e[11]=R,e[12]=p):p=e[12],K=o.userFields.every(p),e[8]=o.userFields,e[9]=R,e[10]=K}else K=e[10];let Fe=K,Q;e[13]!==i||e[14]!==w||e[15]!==b||e[16]!==Fe?(Q=!i&&w.trim()!==""&&b.trim()!==""&&Fe,e[13]=i,e[14]=w,e[15]=b,e[16]=Fe,e[17]=Q):Q=e[17];let De=Q,X;e[18]!==o.userFields||e[19]!==R?(X=r(()=>{let p={};for(let $ of o.userFields){let V=rt($,R($));V!==void 0&&(p[$.name]=V.value)}return Object.keys(p).length===0?void 0:p},"W"),e[18]=o.userFields,e[19]=R,e[20]=X):X=e[20];let Se=X,Y;e[21]!==Se||e[22]!==c||e[23]!==w||e[24]!==b||e[25]!==l||e[26]!==s||e[27]!==y||e[28]!==h||e[29]!==m?(Y=r(()=>{m(async()=>{await c.createAuthUser({data:Se(),email:w.trim(),name:b.trim(),password:y===""?void 0:y,role:h.trim()===""?void 0:h.trim()}),s(),l()})},"Z"),e[21]=Se,e[22]=c,e[23]=w,e[24]=b,e[25]=l,e[26]=s,e[27]=y,e[28]=h,e[29]=m,e[30]=Y):Y=e[30];let N=Y,j;e[31]!==a?(j=a("Create user"),e[31]=a,e[32]=j):j=e[32];let q;e[33]!==a?(q=a("Create user"),e[33]=a,e[34]=q):q=e[34];let M;e[35]!==q?(M=(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:q}),e[35]=q,e[36]=M):M=e[36];let ee;e[37]!==a?(ee=a("email"),e[37]=a,e[38]=ee):ee=e[38];let te;e[39]!==ee?(te=(0,t.jsx)(D,{htmlFor:"uc-email",children:ee}),e[39]=ee,e[40]=te):te=e[40];let ae;e[41]!==w?(ae=(0,t.jsx)(B,{"data-testid":"uc-email",id:"uc-email",onChange:x,type:"email",value:w}),e[41]=w,e[42]=ae):ae=e[42];let se;e[43]!==te||e[44]!==ae?(se=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[te,ae]}),e[43]=te,e[44]=ae,e[45]=se):se=e[45];let le;e[46]!==a?(le=a("name"),e[46]=a,e[47]=le):le=e[47];let re;e[48]!==le?(re=(0,t.jsx)(D,{htmlFor:"uc-name",children:le}),e[48]=le,e[49]=re):re=e[49];let ie;e[50]!==b?(ie=(0,t.jsx)(B,{"data-testid":"uc-name",id:"uc-name",onChange:O,value:b}),e[50]=b,e[51]=ie):ie=e[51];let ne;e[52]!==re||e[53]!==ie?(ne=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[re,ie]}),e[52]=re,e[53]=ie,e[54]=ne):ne=e[54];let de;e[55]!==a?(de=a("Password (optional)"),e[55]=a,e[56]=de):de=e[56];let oe;e[57]!==de?(oe=(0,t.jsx)(D,{htmlFor:"uc-password",children:de}),e[57]=de,e[58]=oe):oe=e[58];let ce;e[59]!==y?(ce=(0,t.jsx)(B,{"data-testid":"uc-password",id:"uc-password",onChange:Be,type:"password",value:y}),e[59]=y,e[60]=ce):ce=e[60];let ue;e[61]!==oe||e[62]!==ce?(ue=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[oe,ce]}),e[61]=oe,e[62]=ce,e[63]=ue):ue=e[63];let me;e[64]!==a?(me=a("Role (optional)"),e[64]=a,e[65]=me):me=e[65];let he;e[66]!==me?(he=(0,t.jsx)(D,{htmlFor:"uc-role",children:me}),e[66]=me,e[67]=he):he=e[67];let pe;e[68]!==h?(pe=(0,t.jsx)(B,{"data-testid":"uc-role",id:"uc-role",onChange:Te,value:h}),e[68]=h,e[69]=pe):pe=e[69];let fe;e[70]!==he||e[71]!==pe?(fe=(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[he,pe]}),e[70]=he,e[71]=pe,e[72]=fe):fe=e[72];let ve;e[73]!==o.userFields||e[74]!==R||e[75]!==a?(ve=o.userFields.length>0&&(0,t.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border pt-3","data-testid":"uc-plugin-fields",children:[(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Plugin fields")}),o.userFields.map(p=>{let $=`uc-field-${p.name}`,V=p.required?"":` (${a("optional")})`;if(p.type==="boolean"){let qe=R(p)===!0;return(0,t.jsxs)("label",{className:"flex items-center gap-2",htmlFor:$,children:[(0,t.jsx)(Qe,{checked:qe,"data-testid":$,id:$,onCheckedChange:r(Xe=>{Pe(p.name,Xe)},"onCheckedChange")}),(0,t.jsxs)("span",{className:"text-sm",children:[p.name,V]})]},p.name)}let We=R(p);return(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsxs)(D,{htmlFor:$,children:[p.name,V]}),(0,t.jsx)(B,{"data-testid":$,id:$,onChange:r(qe=>{Pe(p.name,qe.target.value)},"onChange"),type:st[p.type],value:typeof We=="string"?We:""})]},p.name)})]}),e[73]=o.userFields,e[74]=R,e[75]=a,e[76]=ve):ve=e[76];let xe;e[77]!==n?(xe=n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"uc-error",role:"alert",children:n}),e[77]=n,e[78]=xe):xe=e[78];let be;e[79]!==a?(be=a("Cancel"),e[79]=a,e[80]=be):be=e[80];let ye;e[81]!==l||e[82]!==be?(ye=(0,t.jsx)(z,{"data-testid":"uc-cancel",onClick:l,size:"sm",type:"button",variant:"outline",children:be}),e[81]=l,e[82]=be,e[83]=ye):ye=e[83];let Oe=!De,ge;e[84]!==i||e[85]!==a?(ge=a(i?"Creating\u2026":"Create"),e[84]=i,e[85]=a,e[86]=ge):ge=e[86];let Ne;e[87]!==N||e[88]!==Oe||e[89]!==ge?(Ne=(0,t.jsx)(z,{"data-testid":"uc-submit",disabled:Oe,onClick:N,size:"sm",type:"button",children:ge}),e[87]=N,e[88]=Oe,e[89]=ge,e[90]=Ne):Ne=e[90];let ke;e[91]!==ye||e[92]!==Ne?(ke=(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[ye,Ne]}),e[91]=ye,e[92]=Ne,e[93]=ke):ke=e[93];let Re;return e[94]!==l||e[95]!==j||e[96]!==M||e[97]!==se||e[98]!==ne||e[99]!==ue||e[100]!==fe||e[101]!==ve||e[102]!==xe||e[103]!==ke?(Re=(0,t.jsxs)(Ve,{label:j,onClose:l,panelTestId:"uc-dialog",testId:"uc-overlay",variant:"dialog",children:[M,se,ne,ue,fe,ve,xe,ke]}),e[94]=l,e[95]=j,e[96]=M,e[97]=se,e[98]=ne,e[99]=ue,e[100]=fe,e[101]=ve,e[102]=xe,e[103]=ke,e[104]=Re):Re=e[104],Re},"st"),Ee=r(u=>{let e=(0,Z.c)(2),{children:l}=u,s;return e[0]!==l?(s=(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:l}),e[0]=l,e[1]=s):s=e[1],s},"Le"),nt=r(u=>{let e=(0,Z.c)(29),{busy:l,runAction:s,userId:c,version:a}=u,o=E(),i=W(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),b;e[0]!==o||e[1]!==c?(b=r(()=>{ze((async()=>{S(null);try{let x=await o.listAuthSessions({limit:50,userId:c});m(x.rows)}catch(x){let F=x;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=b):b=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(b,C);let y;e[7]!==o||e[8]!==s?(y=r(x=>{s(()=>o.revokeAuthSession({sessionId:x}))},"y"),e[7]=o,e[8]=s,e[9]=y):y=e[9];let I=y,h;e[10]!==i?(h=i("Sessions"),e[10]=i,e[11]=h):h=e[11];let g;e[12]!==h?(g=(0,t.jsx)(Ee,{children:h}),e[12]=h,e[13]=g):g=e[13];let v;e[14]!==w?(v=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-sessions-error",role:"alert",children:w}),e[14]=w,e[15]=v):v=e[15];let f;e[16]!==n||e[17]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"ud-sessions-empty",children:i("No active sessions.")}),e[16]=n,e[17]=i,e[18]=f):f=e[18];let d;e[19]!==l||e[20]!==I||e[21]!==n||e[22]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-sessions-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:i("expires")}),(0,t.jsx)(U,{children:i("ip")}),(0,t.jsx)(U,{children:i("user agent")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)($e,{children:n.map(x=>(0,t.jsxs)(L,{"data-testid":`ud-session-${x.id}`,children:[(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(x.expiresAt)}),(0,t.jsx)(_,{children:x.ipAddress??""}),(0,t.jsx)(_,{className:"max-w-40 truncate",children:x.userAgent??""}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-revoke-${x.id}`,disabled:l,onClick:r(()=>{I(x.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Revoke")})})]},x.id))})]})})}),e[19]=l,e[20]=I,e[21]=n,e[22]=i,e[23]=d):d=e[23];let A;return e[24]!==g||e[25]!==v||e[26]!==f||e[27]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-sessions",children:[g,v,f,d]}),e[24]=g,e[25]=v,e[26]=f,e[27]=d,e[28]=A):A=e[28],A},"rt"),dt=r(u=>{let e=(0,Z.c)(30),{busy:l,runAction:s,userId:c,version:a}=u,o=E(),i=W(),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(null),b;e[0]!==o||e[1]!==c?(b=r(()=>{ze((async()=>{S(null);try{m(await o.listAuthAccounts({userId:c}))}catch(x){let F=x;m(null),S(je(F))}})())},"x"),e[0]=o,e[1]=c,e[2]=b):b=e[2];let C;e[3]!==o||e[4]!==c||e[5]!==a?(C=[o,c,a],e[3]=o,e[4]=c,e[5]=a,e[6]=C):C=e[6],(0,k.useEffect)(b,C);let y;e[7]!==o||e[8]!==s||e[9]!==c?(y=r(x=>{s(()=>o.unlinkAuthAccount({accountId:x,userId:c}))},"y"),e[7]=o,e[8]=s,e[9]=c,e[10]=y):y=e[10];let I=y,h;e[11]!==i?(h=i("Linked accounts"),e[11]=i,e[12]=h):h=e[12];let g;e[13]!==h?(g=(0,t.jsx)(Ee,{children:h}),e[13]=h,e[14]=g):g=e[14];let v;e[15]!==w?(v=w!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:w}),e[15]=w,e[16]=v):v=e[16];let f;e[17]!==n||e[18]!==i?(f=n!==null&&n.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:i("No linked accounts.")}),e[17]=n,e[18]=i,e[19]=f):f=e[19];let d;e[20]!==n||e[21]!==l||e[22]!==I||e[23]!==i?(d=n!==null&&n.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-accounts-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:i("provider")}),(0,t.jsx)(U,{children:i("created")}),(0,t.jsx)(U,{"aria-label":i("Actions")})]})}),(0,t.jsx)($e,{children:n.map(x=>{let F=Ae(x.id);return(0,t.jsxs)(L,{"data-testid":`ud-account-${F}`,children:[(0,t.jsx)(_,{children:Ae(x.providerId)}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(x.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-unlink-${F}`,disabled:l,onClick:r(()=>{I(F)},"onClick"),size:"xs",type:"button",variant:"ghost",children:i("Unlink")})})]},F)})})]})})}),e[20]=n,e[21]=l,e[22]=I,e[23]=i,e[24]=d):d=e[24];let A;return e[25]!==g||e[26]!==v||e[27]!==f||e[28]!==d?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-accounts",children:[g,v,f,d]}),e[25]=g,e[26]=v,e[27]=f,e[28]=d,e[29]=A):A=e[29],A},"it"),ot=r(u=>{let e=(0,Z.c)(40),{busy:l,capabilities:s,runAction:c,userId:a,version:o}=u,i=E(),n=W(),[m,w]=(0,k.useState)(null),S;e[0]!==s.passkey||e[1]!==i||e[2]!==a?(S=r(()=>{s.passkey&&ze((async()=>{try{w(await i.listAuthPasskeys({userId:a}))}catch{w(null)}})())},"I"),e[0]=s.passkey,e[1]=i,e[2]=a,e[3]=S):S=e[3];let b;e[4]!==s.passkey||e[5]!==i||e[6]!==a||e[7]!==o?(b=[s.passkey,i,a,o],e[4]=s.passkey,e[5]=i,e[6]=a,e[7]=o,e[8]=b):b=e[8],(0,k.useEffect)(S,b);let C;e[9]!==i||e[10]!==c||e[11]!==a?(C=r(()=>{c(()=>i.disableAuthTwoFactor({userId:a}))},"w"),e[9]=i,e[10]=c,e[11]=a,e[12]=C):C=e[12];let y=C,I;e[13]!==i||e[14]!==c?(I=r(F=>{c(()=>i.deleteAuthPasskey({passkeyId:F}))},"A"),e[13]=i,e[14]=c,e[15]=I):I=e[15];let h=I,g;e[16]!==n?(g=n("Security"),e[16]=n,e[17]=g):g=e[17];let v;e[18]!==g?(v=(0,t.jsx)(Ee,{children:g}),e[18]=g,e[19]=v):v=e[19];let f;e[20]!==l||e[21]!==s.twoFactor||e[22]!==y||e[23]!==n?(f=s.twoFactor&&(0,t.jsx)(z,{"data-testid":"ud-disable-2fa",disabled:l,onClick:y,size:"sm",type:"button",variant:"outline",children:n("Disable two-factor")}),e[20]=l,e[21]=s.twoFactor,e[22]=y,e[23]=n,e[24]=f):f=e[24];let d;e[25]!==s.passkey||e[26]!==m||e[27]!==n?(d=s.passkey&&m!==null&&m.length===0&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:n("No passkeys.")}),e[25]=s.passkey,e[26]=m,e[27]=n,e[28]=d):d=e[28];let A;e[29]!==l||e[30]!==s.passkey||e[31]!==h||e[32]!==m||e[33]!==n?(A=s.passkey&&m!==null&&m.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"ud-passkeys-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:n("name")}),(0,t.jsx)(U,{children:n("created")}),(0,t.jsx)(U,{"aria-label":n("Actions")})]})}),(0,t.jsx)($e,{children:m.map(F=>{let O=Ae(F.id);return(0,t.jsxs)(L,{"data-testid":`ud-passkey-${O}`,children:[(0,t.jsx)(_,{children:Ae(F.name)||O}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(F.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`ud-delete-passkey-${O}`,disabled:l,onClick:r(()=>{h(O)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})})]},O)})})]})})}),e[29]=l,e[30]=s.passkey,e[31]=h,e[32]=m,e[33]=n,e[34]=A):A=e[34];let x;return e[35]!==v||e[36]!==f||e[37]!==d||e[38]!==A?(x=(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"ud-security",children:[v,f,d,A]}),e[35]=v,e[36]=f,e[37]=d,e[38]=A,e[39]=x):x=e[39],x},"nt"),ct=/(?:at|expires)$/iu,ut=new Set(["banExpires","banned","banReason","email","emailVerified","id","name","role"]),mt=r((u,e)=>typeof e=="number"&&ct.test(u)?Ie(e):Ae(e),"ct"),ht=r(({capabilities:u,onChanged:e,onClose:l,user:s})=>{let c=E(),a=W(),o=s.banned===!0,[i,n]=(0,k.useState)(null),[m,w]=(0,k.useState)(!1),[S,b]=(0,k.useState)(0),[C,y]=(0,k.useState)(typeof s.role=="string"?s.role:""),[I,h]=(0,k.useState)(""),[g,v]=(0,k.useState)(""),[f,d]=(0,k.useState)(""),[A,x]=(0,k.useState)(null),[F,O]=(0,k.useState)(!1),P=r((N,j)=>{ze((async()=>{w(!0),n(null);try{let q=await N();j?.refresh!==!1&&(b(M=>M+1),e()),j?.onResult?.(q)}catch(q){n(je(q))}w(!1)})())},"P"),Be=r(N=>{y(N.target.value)},"De"),G=r(N=>{h(N.target.value)},"O"),Te=r(N=>{v(N.target.value)},"je"),H=r(N=>{d(N.target.value)},"G"),Pe=r(()=>{let N=C.trim();N!==""&&P(async()=>{await c.setAuthUserRole({role:N,userId:s.id})})},"Se"),J=r(()=>{let N=Number.parseInt(g,10),j=Number.isFinite(N)&&N>0?N*86400:void 0;P(async()=>{await c.banAuthUser({expiresInSeconds:j,reason:I.trim()===""?void 0:I.trim(),userId:s.id})})},"H"),R=r(()=>{P(async()=>{await c.unbanAuthUser({userId:s.id})})},"R"),K=r(()=>{P(async()=>{await c.setAuthUserPassword({newPassword:f,userId:s.id}),d("")})},"J"),Fe=r(()=>{P(()=>c.impersonateAuthUser({userId:s.id}),{onResult:r(N=>{x(N.token)},"onResult"),refresh:!1})},"we"),Q=r(()=>{P(async()=>{await c.revokeAuthUserSessions({userId:s.id})})},"K"),De=r(()=>{P(async()=>{await c.removeAuthUser({userId:s.id}),l()})},"Te"),X=r(()=>{O(!0)},"W"),Se=r(()=>{O(!1)},"Ce"),Y=Object.entries(s).filter(([N])=>!ut.has(N));return(0,t.jsxs)(Ve,{label:a("User details"),onClose:l,panelTestId:"ud-panel",testId:"ud-overlay",variant:"drawer",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:s.name??s.email??s.id}),(0,t.jsx)("p",{className:"font-mono text-xs text-muted-foreground",children:s.id}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 pt-1",children:[typeof s.role=="string"&&s.role!==""&&(0,t.jsx)(T,{variant:"secondary",children:s.role}),o?(0,t.jsx)(T,{variant:"destructive",children:a("Banned")}):(0,t.jsx)(T,{variant:"outline",children:a("Active")}),s.emailVerified===!0?(0,t.jsx)(T,{variant:"secondary",children:a("verified")}):(0,t.jsx)(T,{variant:"outline",children:a("unverified")})]})]}),(0,t.jsx)(z,{"data-testid":"ud-close",onClick:l,size:"sm",type:"button",variant:"ghost",children:a("Close")})]}),i!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"ud-action-error",role:"alert",children:i}),u.admin&&(0,t.jsxs)(we,{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:a("Actions")})}),(0,t.jsxs)(Ce,{className:"flex flex-col gap-3 p-3",children:[(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-role",children:a("Role")}),(0,t.jsx)(B,{"data-testid":"ud-role-input",id:"ud-role",onChange:Be,value:C})]}),(0,t.jsx)(z,{"data-testid":"ud-set-role",disabled:m||C.trim()==="",onClick:Pe,size:"sm",type:"button",variant:"outline",children:a("Set role")})]}),o?(0,t.jsx)(z,{"data-testid":"ud-unban",disabled:m,onClick:R,size:"sm",type:"button",variant:"outline",children:a("Unban")}):(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-reason",children:a("Ban reason (optional)")}),(0,t.jsx)(B,{"data-testid":"ud-ban-reason",id:"ud-ban-reason",onChange:G,value:I})]}),(0,t.jsxs)("div",{className:"flex w-24 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-ban-days",children:a("Days")}),(0,t.jsx)(B,{"data-testid":"ud-ban-days",id:"ud-ban-days",onChange:Te,type:"number",value:g})]}),(0,t.jsx)(z,{"data-testid":"ud-ban",disabled:m,onClick:J,size:"sm",type:"button",variant:"destructive",children:a("Ban user")})]}),(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[(0,t.jsxs)("div",{className:"flex flex-1 flex-col gap-1",children:[(0,t.jsx)(D,{htmlFor:"ud-password",children:a("New password")}),(0,t.jsx)(B,{"data-testid":"ud-password",id:"ud-password",onChange:H,type:"password",value:f})]}),(0,t.jsx)(z,{"data-testid":"ud-set-password",disabled:m||f==="",onClick:K,size:"sm",type:"button",variant:"outline",children:a("Set password")})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(z,{"data-testid":"ud-impersonate",disabled:m,onClick:Fe,size:"sm",type:"button",variant:"outline",children:a("Impersonate")}),(0,t.jsx)(z,{"data-testid":"ud-revoke-all",disabled:m,onClick:Q,size:"sm",type:"button",variant:"outline",children:a("Revoke all sessions")}),F?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{"data-testid":"ud-delete-confirm",disabled:m,onClick:De,size:"sm",type:"button",variant:"destructive",children:a("Confirm delete")}),(0,t.jsx)(z,{"data-testid":"ud-delete-cancel",onClick:Se,size:"sm",type:"button",variant:"ghost",children:a("Cancel")})]}):(0,t.jsx)(z,{"data-testid":"ud-delete",disabled:m,onClick:X,size:"sm",type:"button",variant:"destructive",children:a("Delete user")})]}),A!==null&&(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-impersonation",children:[(0,t.jsx)(D,{htmlFor:"ud-token",children:a("Impersonation token")}),(0,t.jsx)(B,{"data-testid":"ud-token",id:"ud-token",readOnly:!0,value:A})]})]})]}),(0,t.jsx)(nt,{busy:m,runAction:P,userId:s.id,version:S}),u.accounts&&(0,t.jsx)(dt,{busy:m,runAction:P,userId:s.id,version:S}),(u.twoFactor||u.passkey)&&(0,t.jsx)(ot,{busy:m,capabilities:u,runAction:P,userId:s.id,version:S}),(0,t.jsxs)("div",{className:"flex flex-col gap-1","data-testid":"ud-fields",children:[(0,t.jsx)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a("Fields")}),(0,t.jsx)("dl",{className:"flex flex-col",children:Y.map(([N,j])=>(0,t.jsxs)("div",{className:"flex flex-col border-t border-border py-1.5",children:[(0,t.jsx)("dt",{className:"text-xs font-semibold text-muted-foreground",children:N}),(0,t.jsx)("dd",{className:"m-0 font-mono text-xs break-words",children:mt(N,j)})]},N))})]})]})},"ut"),pt=50,$t=r(({pageSize:u=pt}={})=>{let e=E(),l=W(),[s,c]=(0,k.useState)(""),[a,o]=(0,k.useState)(""),i=Ke(s),[n,m]=(0,k.useState)(null),[w,S]=(0,k.useState)(!1),{capabilities:b}=at(),C=i.trim(),y=a.trim(),I=Ge(["lunora-auth-users",C,y,u],()=>e.listAuthUsers({filterField:y===""?void 0:"role",filterValue:y===""?void 0:y,limit:u,search:C===""?void 0:C}),{keepPreviousData:!0}),h=I.data?.rows??null,g=I.error,v=r(()=>{I.refetch()},"v");He(()=>{I.refetch()},!0);let f=n===null?null:h?.find(d=>d.id===n)??null;return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-users",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(B,{"aria-label":l("Search users"),className:"w-56","data-testid":"us-search",onChange:r(d=>{c(d.target.value)},"onChange"),placeholder:l("Search by email or name\u2026"),value:s}),(0,t.jsx)(B,{"aria-label":l("Filter by role"),className:"w-40","data-testid":"us-role-filter",onChange:r(d=>{o(d.target.value)},"onChange"),placeholder:l("Filter by role"),value:a}),(0,t.jsx)(z,{"data-testid":"us-new",onClick:r(()=>{S(!0)},"onClick"),size:"sm",type:"button",children:l("New user")})]}),g!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"us-users-error",role:"alert",children:g}),h!==null&&h.length===0&&(0,t.jsx)(Ze,{description:l("Users who sign up to your app will appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M16 20v-2a4 4 0 0 0-4-4H7a4 4 0 0 0-4 4v2M9.5 10a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7Zm11.5 10v-2a4 4 0 0 0-3-3.85"})}),testId:"us-empty",title:l("No users.")}),h!==null&&h.length>0&&(0,t.jsx)(we,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ce,{className:"px-0",children:(0,t.jsxs)(Ue,{"data-testid":"us-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(L,{children:[(0,t.jsx)(U,{children:l("id")}),(0,t.jsx)(U,{children:l("email")}),(0,t.jsx)(U,{children:l("name")}),(0,t.jsx)(U,{children:l("role")}),(0,t.jsx)(U,{children:l("status")}),(0,t.jsx)(U,{children:l("verified")}),(0,t.jsx)(U,{children:l("created")}),(0,t.jsx)(U,{"aria-label":l("Actions")})]})}),(0,t.jsx)($e,{children:h.map(d=>(0,t.jsxs)(L,{"data-testid":`us-row-${d.id}`,children:[(0,t.jsx)(_,{className:"font-mono text-xs",children:d.id}),(0,t.jsx)(_,{children:d.email??""}),(0,t.jsx)(_,{children:d.name??""}),(0,t.jsx)(_,{children:typeof d.role=="string"&&d.role!==""?(0,t.jsx)(T,{variant:"secondary",children:d.role}):""}),(0,t.jsx)(_,{children:d.banned===!0?(0,t.jsx)(T,{variant:"destructive",children:l("Banned")}):(0,t.jsx)(T,{variant:"success",children:l("Active")})}),(0,t.jsx)(_,{children:d.emailVerified===!0?(0,t.jsx)(T,{variant:"success",children:l("yes")}):(0,t.jsx)(T,{variant:"outline",children:l("no")})}),(0,t.jsx)(_,{className:"text-muted-foreground tabular-nums",children:Ie(d.createdAt)}),(0,t.jsx)(_,{children:(0,t.jsx)(z,{"data-testid":`us-manage-${d.id}`,onClick:r(()=>{m(d.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Manage")})})]},d.id))})]})})}),f!==null&&(0,t.jsx)(ht,{capabilities:b,onChanged:v,onClose:r(()=>{m(null)},"onClose"),user:f}),w&&(0,t.jsx)(it,{onClose:r(()=>{S(!1)},"onClose"),onCreated:v})]})},"Pt");export{$t as UsersPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-54MMVNPT.js";import{a as G}from"./chunk-AREBQI6D.js";import{c as ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Z}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as E}from"./chunk-6F7KP54M.js";import{f as _}from"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as W}from"./chunk-XQCVZAGU.js";import{a as K,b as V,c as z,d as M,e as u,f}from"./chunk-WJQLNYGX.js";import{a as B,e as D}from"./chunk-WQH3LT2P.js";import{d as A,h as O,o as T,r as X}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as c,e as R,f as oe,g as re,h as ae}from"./chunk-3XIESWL4.js";var U=R(re(),1),Y=R(oe(),1);var t=R(ae(),1);var se=R(re(),1);var Q=R(oe(),1);var h=R(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","Q"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"A"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"U"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,p=_(),r=A(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>p.listScheduledJobs()))();return le(g)}),[v,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),k,w;e[1]!==p||e[2]!==l?(k=c(()=>{if(l)return p.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),w=[l,p],e[1]=p,e[2]=l,e[3]=k,e[4]=w):(k=e[3],w=e[4]),(0,Q.useEffect)(k,w);let x;e[5]!==N?(x=c(()=>{N.refetch()},"j"),e[5]=N,e[6]=x):x=e[6],H(x,!l);let J=ce(p,i,d),b=v??N.data,j=s??N.error,q=c(async g=>{if(J!==void 0){m(void 0);try{await J(g),l||N.refetch()}catch(P){m(O(P))}}},"k"),I="flex flex-col gap-3",F="lunora-scheduled-jobs",C;e[7]!==j?(C=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=C):C=e[8];let S;e[9]!==b?.length||e[10]!==r?(S=b?.length===0&&(0,h.jsx)(W,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=S):S=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(B,{className:"overflow-hidden py-0",children:(0,h.jsx)(D,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(M,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(g=>(0,h.jsxs)(M,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(f,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(f,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(f,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(f,{children:g.shardKey??""}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.id}),J!==void 0&&(0,h.jsx)(f,{className:"text-right",children:(0,h.jsx)(G,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{T(q(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),y;return e[12]!==$||e[13]!==C||e[14]!==S?(y=(0,h.jsxs)("div",{className:I,"data-testid":F,children:[C,S,$]}),e[12]=$,e[13]=C,e[14]=S,e[15]=y):y=e[15],y},"me");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"oe"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=_(),d=A(),[p,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,v=me(i,a,e),n=c(async s=>{if(v!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await v(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(k=>({...k,[s]:{kind:"error",message:O(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(W,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),v!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=p[s.name]??he;return(0,t.jsxs)(M,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(f,{children:s.name}),(0,t.jsx)(f,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(f,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(f,{children:s.shardKey??""}),v!==void 0&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(G,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{T(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),fe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","re"),pe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:p,retryJob:r}=i,l=_(),o=A(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==l||e[4]!==d?(v=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=v):v=e[5];let n=E(N,v),s=n.data,[m,k]=(0,Y.useState)(void 0),w=n.error??m,x=d===void 0,J;e[6]!==l||e[7]!==x||e[8]!==r?(J=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==x||e[12]!==p?(j=p??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=p,e[13]=j):j=e[13];let q=j,I;e[14]!==n?(I=c(()=>{n.refetch()},"J"),e[14]=n,e[15]=I):I=e[15],H(I,!0);let F;e[16]!==n?(F=c(async L=>{k(void 0);try{await L,n.refetch()}catch(ne){k(O(ne))}},"j"),e[16]=n,e[17]=F):F=e[17];let C=F,S=b!==void 0||q!==void 0,$;e[18]!==w?($=w!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:w}),e[18]=w,e[19]=$):$=e[19];let y;e[20]!==s?.length||e[21]!==o?(y=s?.length===0&&(0,t.jsx)(W,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=y):y=e[22];let g;e[23]!==C||e[24]!==S||e[25]!==s||e[26]!==q||e[27]!==b||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(M,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(f,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(f,{className:"text-muted-foreground tabular-nums",children:fe(L.scheduledFor)}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(f,{children:L.shardKey??""}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{T(C(b(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),q!==void 0&&(0,t.jsx)(G,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{T(C(q(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=C,e[24]=S,e[25]=s,e[26]=q,e[27]=b,e[28]=o,e[29]=g):g=e[29];let P;return e[30]!==g||e[31]!==$||e[32]!==y?(P=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,y,g]}),e[30]=g,e[31]=$,e[32]=y,e[33]=P):P=e[33],P},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"ae");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:p}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==p?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:p}),e[2]=d,e[3]=p,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(B,{className:"flex-1 py-0",children:(0,t.jsxs)(D,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"F"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,p=_(),r=A(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==p||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>p.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"k"),e[4]=p,e[5]=d,e[6]=N):N=e[6];let v=E(o,N),{data:n,error:s}=v,m;e[7]!==v?(m=c(()=>{v.refetch()},"s"),e[7]=v,e[8]=m):m=e[8],H(m,!0);let k;e[9]!==s?(k=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=k):k=e[10];let w;e[11]!==n||e[12]!==r?(w=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=w):w=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(W,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==k||e[21]!==w||e[22]!==x||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[k,w,x,J]}),e[20]=k,e[21]=w,e[22]=x,e[23]=J,e[24]=b):b=e[24],b},"de");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(M,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(f,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(f,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(f,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"se");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:p,scheduledLoad:r}=i,l=A(),[o,N]=(0,Y.useState)("jobs"),v;e[2]!==l?(v=l("Cron triggers"),e[2]=l,e[3]=v):v=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let k;e[10]!==v||e[11]!==n||e[12]!==s||e[13]!==m?(k={cron:v,dead:n,jobs:s,pools:m},e[10]=v,e[11]=n,e[12]=s,e[13]=m,e[14]=k):k=e[14];let w=k,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(y=>{N(y.currentTarget.dataset.view)},"u"),e[15]=x):x=e[15];let J=x,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==w?(j=Ne.map(y=>(0,t.jsx)(ee,{"aria-selected":o===y,"data-testid":`schedule-view-${y}`,"data-view":y,onClick:J,role:"tab",size:"sm",type:"button",variant:o===y?"default":"outline",children:w[y]},y)),e[18]=o,e[19]=w,e[20]=j):j=e[20];let q;e[21]!==b||e[22]!==j?(q=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=q):q=e[23];let I;e[24]!==p||e[25]!==r||e[26]!==o?(I=o==="jobs"&&(0,t.jsx)(de,{cancelJob:p,loadJobs:r}),e[24]=p,e[25]=r,e[26]=o,e[27]=I):I=e[27];let F;e[28]!==o?(F=o==="dead"&&(0,t.jsx)(pe,{}),e[28]=o,e[29]=F):F=e[29];let C;e[30]!==o?(C=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=C):C=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==q||e[36]!==I||e[37]!==F||e[38]!==C||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[q,I,F,C,S]}),e[35]=q,e[36]=I,e[37]=F,e[38]=C,e[39]=S,e[40]=$):$=e[40],$},"Je");export{Ve as SchedulePanel};
|
|
1
|
+
import{a as H}from"./chunk-54MMVNPT.js";import{a as G}from"./chunk-AREBQI6D.js";import{c as ee}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as Z}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as E}from"./chunk-HRRFUAP6.js";import{f as _}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{a as W}from"./chunk-XQCVZAGU.js";import{a as K,b as V,c as z,d as M,e as u,f}from"./chunk-WJQLNYGX.js";import{a as B,e as D}from"./chunk-WQH3LT2P.js";import{d as A,h as O,o as T,r as X}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as c,e as R,f as oe,g as re,h as ae}from"./chunk-3XIESWL4.js";var U=R(re(),1),Y=R(oe(),1);var t=R(ae(),1);var se=R(re(),1);var Q=R(oe(),1);var h=R(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","Q"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"A"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"U"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,p=_(),r=A(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let g=await(d??(()=>p.listScheduledJobs()))();return le(g)}),[v,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),k,w;e[1]!==p||e[2]!==l?(k=c(()=>{if(l)return p.subscribeScheduledJobs(g=>{m(void 0),n(le(g))})},"v"),w=[l,p],e[1]=p,e[2]=l,e[3]=k,e[4]=w):(k=e[3],w=e[4]),(0,Q.useEffect)(k,w);let x;e[5]!==N?(x=c(()=>{N.refetch()},"j"),e[5]=N,e[6]=x):x=e[6],H(x,!l);let J=ce(p,i,d),b=v??N.data,j=s??N.error,q=c(async g=>{if(J!==void 0){m(void 0);try{await J(g),l||N.refetch()}catch(P){m(O(P))}}},"k"),I="flex flex-col gap-3",F="lunora-scheduled-jobs",C;e[7]!==j?(C=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=C):C=e[8];let S;e[9]!==b?.length||e[10]!==r?(S=b?.length===0&&(0,h.jsx)(W,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=S):S=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(B,{className:"overflow-hidden py-0",children:(0,h.jsx)(D,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(M,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(g=>(0,h.jsxs)(M,{"data-testid":`sj-row-${g.id}`,children:[(0,h.jsx)(f,{className:"font-mono text-xs",children:g.functionPath}),(0,h.jsx)(f,{className:"text-muted-foreground tabular-nums",children:ie(g.scheduledFor)}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.pool??""}),(0,h.jsx)(f,{className:"tabular-nums",children:g.attempts??0}),(0,h.jsx)(f,{children:g.shardKey??""}),(0,h.jsx)(f,{className:"font-mono text-xs",children:g.id}),J!==void 0&&(0,h.jsx)(f,{className:"text-right",children:(0,h.jsx)(G,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{T(q(g.id))},"onConfirm"),testId:`sj-cancel-${g.id}`,children:r("Cancel")})})]},g.id))})]})})}),y;return e[12]!==$||e[13]!==C||e[14]!==S?(y=(0,h.jsxs)("div",{className:I,"data-testid":F,children:[C,S,$]}),e[12]=$,e[13]=C,e[14]=S,e[15]=y):y=e[15],y},"me");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"oe"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=_(),d=A(),[p,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,v=me(i,a,e),n=c(async s=>{if(v!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await v(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(k=>({...k,[s]:{kind:"error",message:O(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(W,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),v!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=p[s.name]??he;return(0,t.jsxs)(M,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(f,{children:s.name}),(0,t.jsx)(f,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(f,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(f,{children:s.shardKey??""}),v!==void 0&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(G,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{T(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),fe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","re"),pe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:p,retryJob:r}=i,l=_(),o=A(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==l||e[4]!==d?(v=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=v):v=e[5];let n=E(N,v),s=n.data,[m,k]=(0,Y.useState)(void 0),w=n.error??m,x=d===void 0,J;e[6]!==l||e[7]!==x||e[8]!==r?(J=r??(x?L=>l.retryDeadJob(L):void 0),e[6]=l,e[7]=x,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==x||e[12]!==p?(j=p??(x?L=>l.removeDeadJob(L):void 0),e[10]=l,e[11]=x,e[12]=p,e[13]=j):j=e[13];let q=j,I;e[14]!==n?(I=c(()=>{n.refetch()},"J"),e[14]=n,e[15]=I):I=e[15],H(I,!0);let F;e[16]!==n?(F=c(async L=>{k(void 0);try{await L,n.refetch()}catch(ne){k(O(ne))}},"j"),e[16]=n,e[17]=F):F=e[17];let C=F,S=b!==void 0||q!==void 0,$;e[18]!==w?($=w!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:w}),e[18]=w,e[19]=$):$=e[19];let y;e[20]!==s?.length||e[21]!==o?(y=s?.length===0&&(0,t.jsx)(W,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=y):y=e[22];let g;e[23]!==C||e[24]!==S||e[25]!==s||e[26]!==q||e[27]!==b||e[28]!==o?(g=s!==void 0&&s.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),S&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(L=>(0,t.jsxs)(M,{"data-testid":`dlq-row-${L.id}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:L.functionPath}),(0,t.jsx)(f,{className:"tabular-nums",children:L.attempts??0}),(0,t.jsx)(f,{className:"text-muted-foreground tabular-nums",children:fe(L.scheduledFor)}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.pool??""}),(0,t.jsx)(f,{children:L.shardKey??""}),(0,t.jsx)(f,{className:"font-mono text-xs",children:L.id}),S&&(0,t.jsx)(f,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${L.id}`,onClick:c(()=>{T(C(b(L.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),q!==void 0&&(0,t.jsx)(G,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{T(C(q(L.id)))},"onConfirm"),testId:`dlq-remove-${L.id}`,children:o("Drop")})]})})]},L.id))})]})})}),e[23]=C,e[24]=S,e[25]=s,e[26]=q,e[27]=b,e[28]=o,e[29]=g):g=e[29];let P;return e[30]!==g||e[31]!==$||e[32]!==y?(P=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,y,g]}),e[30]=g,e[31]=$,e[32]=y,e[33]=P):P=e[33],P},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"ae");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:p}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==p?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:p}),e[2]=d,e[3]=p,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(B,{className:"flex-1 py-0",children:(0,t.jsxs)(D,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"F"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,p=_(),r=A(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==p||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>p.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"k"),e[4]=p,e[5]=d,e[6]=N):N=e[6];let v=E(o,N),{data:n,error:s}=v,m;e[7]!==v?(m=c(()=>{v.refetch()},"s"),e[7]=v,e[8]=m):m=e[8],H(m,!0);let k;e[9]!==s?(k=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=k):k=e[10];let w;e[11]!==n||e[12]!==r?(w=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=w):w=e[13];let x;e[14]!==n?.pools.length||e[15]!==r?(x=n?.pools.length===0&&(0,t.jsx)(W,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=x):x=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(B,{className:"overflow-hidden py-0",children:(0,t.jsx)(D,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(M,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==k||e[21]!==w||e[22]!==x||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[k,w,x,J]}),e[20]=k,e[21]=w,e[22]=x,e[23]=J,e[24]=b):b=e[24],b},"de");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(M,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(f,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(f,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(f,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(f,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"se");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:p,scheduledLoad:r}=i,l=A(),[o,N]=(0,Y.useState)("jobs"),v;e[2]!==l?(v=l("Cron triggers"),e[2]=l,e[3]=v):v=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let k;e[10]!==v||e[11]!==n||e[12]!==s||e[13]!==m?(k={cron:v,dead:n,jobs:s,pools:m},e[10]=v,e[11]=n,e[12]=s,e[13]=m,e[14]=k):k=e[14];let w=k,x;e[15]===Symbol.for("react.memo_cache_sentinel")?(x=c(y=>{N(y.currentTarget.dataset.view)},"u"),e[15]=x):x=e[15];let J=x,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==w?(j=Ne.map(y=>(0,t.jsx)(ee,{"aria-selected":o===y,"data-testid":`schedule-view-${y}`,"data-view":y,onClick:J,role:"tab",size:"sm",type:"button",variant:o===y?"default":"outline",children:w[y]},y)),e[18]=o,e[19]=w,e[20]=j):j=e[20];let q;e[21]!==b||e[22]!==j?(q=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=q):q=e[23];let I;e[24]!==p||e[25]!==r||e[26]!==o?(I=o==="jobs"&&(0,t.jsx)(de,{cancelJob:p,loadJobs:r}),e[24]=p,e[25]=r,e[26]=o,e[27]=I):I=e[27];let F;e[28]!==o?(F=o==="dead"&&(0,t.jsx)(pe,{}),e[28]=o,e[29]=F):F=e[29];let C;e[30]!==o?(C=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=C):C=e[31];let S;e[32]!==d||e[33]!==o?(S=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=S):S=e[34];let $;return e[35]!==q||e[36]!==I||e[37]!==F||e[38]!==C||e[39]!==S?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[q,I,F,C,S]}),e[35]=q,e[36]=I,e[37]=F,e[38]=C,e[39]=S,e[40]=$):$=e[40],$},"Je");export{Ve as SchedulePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-RMN2JN4S.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-
|
|
1
|
+
import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-RMN2JN4S.js";import{b as U}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as O}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as h}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as w}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as M}from"./chunk-VDW32UET.js";import{f as D}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{d as K,e as _,f as z,h as P,o as q,r as E}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as s,e as T,f as ie,h as oe}from"./chunk-3XIESWL4.js";var i=T(ie(),1);var e=T(oe(),1);var de=s(r=>r.kind==="id"?r.table===void 0?"id":`id<${r.table}>`:r.kind==="array"?r.element===void 0?"array":`${r.element}[]`:r.kind,"ie"),le=s(r=>r===void 0||r.length===0?"()":`(${r.map(o=>`${o.name}${o.optional?"?":""}: ${de(o)}`).join(", ")})`,"oe"),ue=s(r=>{switch(r){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},"de"),ce=s(r=>{let o={};for(let a of r??[])a.optional||(o[a.name]=ue(a.kind));return JSON.stringify(o,void 0,2)},"le"),me=z(M.runAs),fe=10,pe=s(r=>r===void 0?"undefined":JSON.stringify(r,null,2),"me"),Fe=s(({functions:r,runAsIdentity:o=!1}={})=>{let a=K(),c=D(),[H,Q]=(0,i.useState)(null),[k,V]=(0,i.useState)(null),x=r??H??[],[I,S]=(0,i.useState)(""),[m,b]=(0,i.useState)("{}"),[u,F]=(0,i.useState)(""),[f,W]=(0,i.useState)(""),[v,p]=(0,i.useState)("idle"),[X,y]=(0,i.useState)(void 0),[C,N]=(0,i.useState)(null),[$,Y]=(0,i.useState)([]);(0,i.useEffect)(()=>{if(r!==void 0)return;let t=!1;return c.listFunctions().then(d=>(t||Q(d),d)).catch(d=>{t||V(P(d))}),()=>{t=!0}},[c,r]);let R=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===R),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},j=u.trim()===""?{}:{shardKey:u.trim()},A=o?f.trim():"",J=s(l=>{Y(L=>[{argsText:m,at:Date.now(),id:(L[0]?.id??0)+1,kind:n.kind,path:n.path,shardKey:u,status:l},...L].slice(0,fe))},"j");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,j):await c.query(me,{args:t,functionPath:n.path,userId:A},j);U(u),y(l),p("success"),J("success")}catch(l){y(void 0),N(l.message),p("error"),J("error")}},"_"),ee=s(t=>{S(t.path),b(t.argsText),F(t.shardKey)},"q"),te=s(t=>{S(t.target.value)},"B"),re=s(t=>{b(t.target.value)},"D"),ae=s(t=>{W(t.target.value)},"E"),se=s(()=>{q(Z())},"U"),ne=s(()=>{b(ce(n?.args))},"X");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[k!==null&&(0,e.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:k}),(0,e.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsx)(g,{htmlFor:"function-select",children:a("Function")}),(0,e.jsx)("select",{"aria-label":a("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:te,value:R,children:x.map(t=>(0,e.jsxs)("option",{value:t.path,children:[t.path," (",t.kind,")"]},t.path))}),n!==void 0&&(0,e.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,e.jsx)("span",{className:"mr-1.5 font-medium",children:a("Signature")}),(0,e.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:le(n.args)})]})]}),(0,e.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,e.jsx)(g,{htmlFor:"args-input",children:a("Arguments")}),(0,e.jsx)(h,{"data-testid":"prefill-button",disabled:n===void 0,onClick:ne,size:"xs",type:"button",variant:"ghost",children:a("Prefill")})]}),(0,e.jsx)(G,{"aria-label":a("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:re,value:m})]}),(0,e.jsx)(B,{onChange:F,testId:"shard-input",value:u}),o&&(0,e.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,e.jsx)(g,{htmlFor:"run-as-input",children:a("Run as identity (userId)")}),(0,e.jsx)(O,{"aria-label":a("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:ae,placeholder:a("Leave empty to run as admin"),value:f}),(0,e.jsx)("p",{className:"text-[11px] text-muted-foreground",children:a("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(h,{"data-testid":"run-button",disabled:v==="running"||n===void 0,onClick:se,type:"button",children:a("Run")}),n!==void 0&&(0,e.jsx)(w,{variant:"outline",children:n.kind}),o&&f.trim()!==""&&(0,e.jsx)(w,{"data-testid":"run-as-badge",variant:"secondary",children:a("as {userId}",{userId:f.trim()})})]})]}),v==="error"&&C!==null&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:C}),v==="success"&&(0,e.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:pe(X)}),$.length>0&&(0,e.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:$.map((t,d)=>(0,e.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,e.jsx)("span",{className:t.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:t.status==="success"?"\u2713":"\u2717"})," ",(0,e.jsxs)("span",{className:"font-mono text-xs",children:[t.path," (",t.kind,")"]})," ",(0,e.jsx)("time",{className:"text-xs text-muted-foreground",children:E(t.at)})," ",(0,e.jsx)(h,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:s(()=>{ee(t)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Load")})]},t.id))})]})},"Ie");export{Fe as FunctionRunner};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as X}from"./chunk-QWGT25SE.js";import{a as Le}from"./chunk-ZJGP6EKR.js";import{b as Se}from"./chunk-AVAC26HJ.js";import{a as de}from"./chunk-XF2B7P5A.js";import{a as Ce}from"./chunk-IGCNMZSB.js";import{a as ie}from"./chunk-FURI47Z2.js";import{a as be}from"./chunk-3CWGJYBB.js";import{a as ve}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as D}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as J}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as xe}from"./chunk-NCKRVNF2.js";import"./chunk-XXQUMVWH.js";import"./chunk-NJRW66LJ.js";import"./chunk-QLQADHFE.js";import{a as se}from"./chunk-VDW32UET.js";import{c as oe}from"./chunk-6F7KP54M.js";import{f as he}from"./chunk-C2ZFQARQ.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as ye,b as we,c as Ne,d as ne,e as U,f as z}from"./chunk-WJQLNYGX.js";import{d as B,h as le,i as fe,o as ae}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as N,e as re,f as Ee,g as Ke,h as Me,j as G}from"./chunk-3XIESWL4.js";var _=re(Ke(),1);var T=re(Ee(),1);var r=re(Me(),1);var ue=["trace","debug","log","info","warn","error","fatal"],_e="LOG_ARCHIVE_NOT_CONFIGURED",Re={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},$e={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Ae=N((c,e)=>{switch(e.type){case"append":return{...c,cursor:e.cursor,error:null,loading:!1,rows:[...c.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...c,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...c,error:e.message,loading:!1};default:return c}},"Ke"),Oe=N(c=>{let e=(0,_.c)(33),{row:t}=c,s;e[0]!==t.fields?(s=X(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let i=s,o=`lg-archive-row-${String(t.ts)}`,m;e[2]!==t.ts?(m=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=m):m=e[3];let p;e[4]!==m?(p=(0,r.jsx)(z,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:m}),e[4]=m,e[5]=p):p=e[5];let f=Re[t.level],n;e[6]!==t.level||e[7]!==f?(n=(0,r.jsx)(z,{children:(0,r.jsx)(J,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=n):n=e[8];let l;e[9]!==t.functionPath?(l=(0,r.jsx)(z,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=l):l=e[10];let v;e[11]!==t.message?(v=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=v):v=e[12];let a;e[13]!==i?(a=i!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=a):a=e[14];let d;e[15]!==v||e[16]!==a?(d=(0,r.jsxs)(z,{className:"max-w-md",children:[v,a]}),e[15]=v,e[16]=a,e[17]=d):d=e[17];let u=t.traceId??"\u2014",h;e[18]!==u?(h=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:u}),e[18]=u,e[19]=h):h=e[19];let b=t.shardKey??"\u2014",g;e[20]!==b?(g=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=g):g=e[21];let x=t.userId??"\u2014",y;e[22]!==x?(y=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let S;return e[24]!==d||e[25]!==h||e[26]!==g||e[27]!==y||e[28]!==o||e[29]!==p||e[30]!==n||e[31]!==l?(S=(0,r.jsxs)(ne,{"data-testid":o,children:[p,n,l,d,h,g,y]}),e[24]=d,e[25]=h,e[26]=g,e[27]=y,e[28]=o,e[29]=p,e[30]=n,e[31]=l,e[32]=S):S=e[32],S},"Ue"),De=N(({shardKey:c})=>{let e=he(),t=B(),[s,i]=(0,T.useState)(""),[o,m]=(0,T.useState)(""),[p,f]=(0,T.useState)(""),[{cursor:n,error:l,loading:v,notConfigured:a,rows:d},u]=(0,T.useReducer)(Ae,$e),h=ie(s.trim(),400),b=ie(o.trim(),400),g={...h===""?{}:{functionPathPrefix:h},...p===""?{}:{minLevel:p},...c===""?{}:{shardKey:c},...b===""?{}:{userId:b}},x=JSON.stringify(g),y=(0,T.useRef)(x);(0,T.useEffect)(()=>{let w={cancelled:!1};return y.current=x,ae((async()=>{u({type:"loading"});try{let C=await e.queryLogArchive(g);w.cancelled||u({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){w.cancelled||u(fe(C)===_e?{type:"notConfigured"}:{message:le(C),type:"failed"})}})()),()=>{w.cancelled=!0}},[e,x]);let S=N(async()=>{if(n===void 0)return;let w=x;u({type:"loading"});try{let C=await e.queryLogArchive({...g,cursor:n});y.current===w&&u({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===w&&u({message:le(C),type:"pageFailed"})}},"C"),R=N(w=>{i(w.target.value)},"$"),L=N(w=>{m(w.target.value)},"L"),k=N(w=>{f(w.target.value)},"S"),I=N(()=>{ae(S())},"R");return a?(0,r.jsx)(Z,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:L,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:k,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(w=>(0,r.jsx)("option",{value:w,children:w},w))]})]}),l!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:l}),v&&d===null&&l===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),d!==null&&d.length===0&&(0,r.jsx)(Z,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),d!==null&&d.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(ne,{children:[(0,r.jsx)(U,{children:t("Time")}),(0,r.jsx)(U,{children:t("Level")}),(0,r.jsx)(U,{children:t("Function")}),(0,r.jsx)(U,{children:t("Message")}),(0,r.jsx)(U,{children:t("Trace")}),(0,r.jsx)(U,{children:t("Shard")}),(0,r.jsx)(U,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:d.map((w,C)=>(0,r.jsx)(Oe,{row:w},`${String(w.ts)}-${String(C)}`))})]})}),n!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(ge,{"data-testid":"lg-archive-more",disabled:v,onClick:I,size:"sm",variant:"outline",children:t(v?"Loading\u2026":"Load more")})})]})},"De"),Ue=N(c=>{let e=(0,_.c)(11),{level:t,onToggle:s,selected:i}=c,o;e[0]!==t||e[1]!==s?(o=N(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let m=o,p=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==p?(f=G("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=f):f=e[4];let n=`logs-level-${t}`,l;return e[5]!==t||e[6]!==m||e[7]!==i||e[8]!==f||e[9]!==n?(l=(0,r.jsx)("button",{"aria-pressed":i,className:f,"data-testid":n,onClick:m,type:"button",children:t}),e[5]=t,e[6]=m,e[7]=i,e[8]=f,e[9]=n,e[10]=l):l=e[10],l},"Ve"),ze=N(c=>{let e=(0,_.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:i,onTimeRangeChange:o,onToggleLevel:m,onToggleSummary:p,pathFilter:f,search:n,showSummary:l,timeRange:v}=c,a=B(),d;e[0]!==a?(d=a("Search messages"),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("search message"),e[2]=a,e[3]=u):u=e[3];let h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u?(h=(0,r.jsx)(D,{"aria-label":d,className:"h-8 w-48","data-testid":"lg-search",onChange:i,placeholder:u,value:n}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h):h=e[8];let b;e[9]!==a?(b=a("Function path"),e[9]=a,e[10]=b):b=e[10];let g;e[11]!==a?(g=a("filter path"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==s||e[14]!==f||e[15]!==b||e[16]!==g?(x=(0,r.jsx)(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:g,value:f}),e[13]=s,e[14]=f,e[15]=b,e[16]=g,e[17]=x):x=e[17];let y;e[18]!==a?(y=a("Level filter"),e[18]=a,e[19]=y):y=e[19];let S;e[20]!==t||e[21]!==m?(S=ue.map(j=>(0,r.jsx)(Ue,{level:j,onToggle:m,selected:t.has(j)},j)),e[20]=t,e[21]=m,e[22]=S):S=e[22];let R;e[23]!==y||e[24]!==S?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:S}),e[23]=y,e[24]=S,e[25]=R):R=e[25];let L;e[26]!==a?(L=a("Time range"),e[26]=a,e[27]=L):L=e[27];let k;e[28]!==a?(k=a("All time"),e[28]=a,e[29]=k):k=e[29];let I;e[30]!==k?(I=(0,r.jsx)("option",{value:"all",children:k}),e[30]=k,e[31]=I):I=e[31];let w;e[32]!==a?(w=a("Last 5m"),e[32]=a,e[33]=w):w=e[33];let C;e[34]!==w?(C=(0,r.jsx)("option",{value:"5m",children:w}),e[34]=w,e[35]=C):C=e[35];let q;e[36]!==a?(q=a("Last 15m"),e[36]=a,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let E;e[40]!==a?(E=a("Last hour"),e[40]=a,e[41]=E):E=e[41];let K;e[42]!==E?(K=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=K):K=e[43];let $;e[44]!==o||e[45]!==L||e[46]!==I||e[47]!==C||e[48]!==F||e[49]!==K||e[50]!==v?($=(0,r.jsxs)("select",{"aria-label":L,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:v,children:[I,C,F,K]}),e[44]=o,e[45]=L,e[46]=I,e[47]=C,e[48]=F,e[49]=K,e[50]=v,e[51]=$):$=e[51];let V=l?"border-border bg-muted font-medium":"border-input text-muted-foreground",O;e[52]!==V?(O=G("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=O):O=e[53];let A;e[54]!==l||e[55]!==a?(A=a(l?"List":"Summary"),e[54]=l,e[55]=a,e[56]=A):A=e[56];let M;e[57]!==p||e[58]!==l||e[59]!==O||e[60]!==A?(M=(0,r.jsx)("button",{"aria-pressed":l,className:O,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:A}),e[57]=p,e[58]=l,e[59]=O,e[60]=A,e[61]=M):M=e[61];let W;return e[62]!==$||e[63]!==M||e[64]!==h||e[65]!==x||e[66]!==R?(W=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[h,x,R,$,M]}),e[62]=$,e[63]=M,e[64]=h,e[65]=x,e[66]=R,e[67]=W):W=e[67],W},"je"),je=N(c=>{let e=(0,_.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:i,onUserChange:o,outcomeFilter:m,pathPrefix:p,tableFilter:f,userIdFilter:n}=c,l=B(),v;e[0]!==l?(v=l("Function path"),e[0]=l,e[1]=v):v=e[1];let a;e[2]!==l?(a=l("file:function"),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==s||e[5]!==p||e[6]!==v||e[7]!==a?(d=(0,r.jsx)(D,{"aria-label":v,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:a,value:p}),e[4]=s,e[5]=p,e[6]=v,e[7]=a,e[8]=d):d=e[8];let u;e[9]!==l?(u=l("User id"),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("userId"),e[11]=l,e[12]=h):h=e[12];let b;e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==n?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:h,value:n}),e[13]=o,e[14]=u,e[15]=h,e[16]=n,e[17]=b):b=e[17];let g;e[18]!==l?(g=l("Table touched"),e[18]=l,e[19]=g):g=e[19];let x;e[20]!==l?(x=l("table"),e[20]=l,e[21]=x):x=e[21];let y;e[22]!==i||e[23]!==g||e[24]!==x||e[25]!==f?(y=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-table",onChange:i,placeholder:x,value:f}),e[22]=i,e[23]=g,e[24]=x,e[25]=f,e[26]=y):y=e[26];let S;e[27]!==l?(S=l("Outcome filter"),e[27]=l,e[28]=S):S=e[28];let R;e[29]!==l?(R=l("all"),e[29]=l,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=L):L=e[32];let k;e[33]!==l?(k=l("ok"),e[33]=l,e[34]=k):k=e[34];let I;e[35]!==k?(I=(0,r.jsx)("option",{value:"ok",children:k}),e[35]=k,e[36]=I):I=e[36];let w;e[37]!==l?(w=l("error"),e[37]=l,e[38]=w):w=e[38];let C;e[39]!==w?(C=(0,r.jsx)("option",{value:"error",children:w}),e[39]=w,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==m||e[43]!==S||e[44]!==L||e[45]!==I||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:m,children:[L,I,C]}),e[41]=t,e[42]=m,e[43]=S,e[44]=L,e[45]=I,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==d||e[50]!==b||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d,b,y,q]}),e[48]=q,e[49]=d,e[50]=b,e[51]=y,e[52]=F):F=e[52],F},"Be"),Ie=N(c=>{let e=(0,_.c)(7),{bucket:t}=c,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let i;e[2]!==t.count?(i=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==i?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,i]}),e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"ve"),Be=N(c=>{let e=(0,_.c)(31),{summary:t}=c,s=B(),i;e[0]!==t.total||e[1]!==s?(i=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==i?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:i}),e[3]=i,e[4]=o):o=e[4];let m;e[5]!==s?(m=s("By level"),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==m?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[7]=m,e[8]=p):p=e[8];let f;e[9]!==t.byLevel?(f=t.byLevel.map(We),e[9]=t.byLevel,e[10]=f):f=e[10];let n;e[11]!==f?(n=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:f}),e[11]=f,e[12]=n):n=e[12];let l;e[13]!==p||e[14]!==n?(l=(0,r.jsxs)("div",{children:[p,n]}),e[13]=p,e[14]=n,e[15]=l):l=e[15];let v;e[16]!==s?(v=s("By function"),e[16]=s,e[17]=v):v=e[17];let a;e[18]!==v?(a=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[18]=v,e[19]=a):a=e[19];let d;e[20]!==t.byPath?(d=t.byPath.map(Ge),e[20]=t.byPath,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:d}),e[22]=d,e[23]=u):u=e[23];let h;e[24]!==u||e[25]!==a?(h=(0,r.jsxs)("div",{children:[a,u]}),e[24]=u,e[25]=a,e[26]=h):h=e[26];let b;return e[27]!==h||e[28]!==o||e[29]!==l?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,l,h]}),e[27]=h,e[28]=o,e[29]=l,e[30]=b):b=e[30],b},"ze");function We(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(We,"Ge");function Ge(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(Ge,"We");var Ve=N(c=>{let e=(0,_.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:i,onShowErrors:o,onShowRequests:m,shardKey:p,view:f}=c,n=B(),l=f==="requests",v=f==="requests"?"bg-muted font-medium":"text-muted-foreground",a;e[0]!==v?(a=G("px-3 py-1 text-sm",v),e[0]=v,e[1]=a):a=e[1];let d;e[2]!==n?(d=n("Requests"),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==m||e[5]!==l||e[6]!==a||e[7]!==d?(u=(0,r.jsx)("button",{"aria-selected":l,className:a,"data-testid":"lg-view-requests",onClick:m,role:"tab",type:"button",children:d}),e[4]=m,e[5]=l,e[6]=a,e[7]=d,e[8]=u):u=e[8];let h=f==="errors",b=f==="errors"?"bg-muted font-medium":"text-muted-foreground",g;e[9]!==b?(g=G("px-3 py-1 text-sm",b),e[9]=b,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Errors"),e[11]=n,e[12]=x):x=e[12];let y;e[13]!==o||e[14]!==h||e[15]!==g||e[16]!==x?(y=(0,r.jsx)("button",{"aria-selected":h,className:g,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:x}),e[13]=o,e[14]=h,e[15]=g,e[16]=x,e[17]=y):y=e[17];let S=f==="archive",R=f==="archive"?"bg-muted font-medium":"text-muted-foreground",L;e[18]!==R?(L=G("px-3 py-1 text-sm",R),e[18]=R,e[19]=L):L=e[19];let k;e[20]!==n?(k=n("Archive"),e[20]=n,e[21]=k):k=e[21];let I;e[22]!==i||e[23]!==S||e[24]!==L||e[25]!==k?(I=(0,r.jsx)("button",{"aria-selected":S,className:L,"data-testid":"lg-view-archive",onClick:i,role:"tab",type:"button",children:k}),e[22]=i,e[23]=S,e[24]=L,e[25]=k,e[26]=I):I=e[26];let w;e[27]!==y||e[28]!==I||e[29]!==u?(w=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,y,I]}),e[27]=y,e[28]=I,e[29]=u,e[30]=w):w=e[30];let C;e[31]!==s||e[32]!==p?(C=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==f?(q=f!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=f,e[36]=q):q=e[36];let F;e[37]!==n?(F=n("Open in Cloudflare"),e[37]=n,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let K;return e[41]!==w||e[42]!==C||e[43]!==q||e[44]!==E?(K=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[w,C,q,E]}),e[41]=w,e[42]=C,e[43]=q,e[44]=E,e[45]=K):K=e[45],K},"Qe"),ce=400,Qe=36,Ye={height:ce,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},He={error:"destructive",ok:"secondary"},Je=N(c=>{let e=(0,_.c)(26),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.fields?(n=X(t.fields),e[2]=t.fields,e[3]=n):n=e[3];let l=n,v;e[4]!==t.timestamp?(v=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=v):v=e[5];let a;e[6]!==v?(a=(0,r.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:v}),e[6]=v,e[7]=a):a=e[7];let d=Re[t.level],u;e[8]!==t.level||e[9]!==d?(u=(0,r.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:d,children:t.level})}),e[8]=t.level,e[9]=d,e[10]=u):u=e[10];let h=t.functionPath??"\u2014",b;e[11]!==h?(b=(0,r.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=b):b=e[12];let g;e[13]!==l?(g=l===""?null:(0,r.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:l}),e[13]=l,e[14]=g):g=e[14];let x;e[15]!==t.message||e[16]!==g?(x=(0,r.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]}),e[15]=t.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==i||e[20]!==f||e[21]!==x||e[22]!==a||e[23]!==u||e[24]!==b?(y=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:i,role:"row",style:f,children:[a,u,b,x]}),e[18]=s,e[19]=i,e[20]=f,e[21]=x,e[22]=a,e[23]=u,e[24]=b,e[25]=y):y=e[25],y},"Xe"),ke=N(c=>c.length===0?"\u2014":c.join(", "),"ce"),Ze=N(c=>{let e=(0,_.c)(37),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.ts?(n=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=n):n=e[3];let l;e[4]!==n?(l=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:n}),e[4]=n,e[5]=l):l=e[5];let v=He[t.outcome],a;e[6]!==t.outcome||e[7]!==v?(a=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:v,children:t.outcome})}),e[6]=t.outcome,e[7]=v,e[8]=a):a=e[8];let d;e[9]!==t.functionPath?(d=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=d):d=e[10];let u=t.shardKey??"\u2014",h;e[11]!==u?(h=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[11]=u,e[12]=h):h=e[12];let b=t.userId??"\u2014",g;e[13]!==b?(g=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[13]=b,e[14]=g):g=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let y=`${String(x)}ms`,S;e[17]!==y?(S=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=S):S=e[18];let R;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(R=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ke(t.tablesRead)} \xB7 w:${ke(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=R):R=e[23];let L;e[24]!==R?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=L):L=e[25];let k;return e[26]!==s||e[27]!==i||e[28]!==f||e[29]!==g||e[30]!==S||e[31]!==L||e[32]!==l||e[33]!==a||e[34]!==d||e[35]!==h?(k=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:i,role:"row",style:f,children:[l,a,d,h,g,S,L]}),e[26]=s,e[27]=i,e[28]=f,e[29]=g,e[30]=S,e[31]=L,e[32]=l,e[33]=a,e[34]=d,e[35]=h,e[36]=k):k=e[36],k},"Ze"),Pe=N(c=>{let{entries:e}=c??{};return Array.isArray(e)?e:[]},"ue"),Xe=N(c=>{let e={};return c.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=c.functionPathPrefix.trim()),c.userId.trim()!==""&&(e.userId=c.userId.trim()),c.tableTouched.trim()!==""&&(e.tableTouched=c.tableTouched.trim()),(c.outcome==="ok"||c.outcome==="error")&&(e.outcome=c.outcome),e},"et"),et={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},tt=N((c,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-et[e.range];return c.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||X(o.fields).toLowerCase().includes(t))},"rt"),rt="\u2014",lt=N(c=>{let e=new Map,t=new Map;for(let o of c){e.set(o.level,(e.get(o.level)??0)+1);let m=o.functionPath??rt;t.set(m,(t.get(m)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,m])=>({count:m,key:o})).toSorted((o,m)=>m.count===o.count?o.key.localeCompare(m.key):m.count-o.count);return{byLevel:s,byPath:i,total:c.length}},"at"),Lt=N(({initialShardKey:c})=>{let e=B(),[t,s]=(0,T.useState)("requests"),{queryShardKey:i,setShardKey:o,shardKey:m}=be(c),[p,f]=(0,T.useState)(""),[n,l]=(0,T.useState)(()=>new Set),[v,a]=(0,T.useState)(""),[d,u]=(0,T.useState)("all"),[h,b]=(0,T.useState)(!1),[g,x]=(0,T.useState)(""),[y,S]=(0,T.useState)(""),[R,L]=(0,T.useState)(""),[k,I]=(0,T.useState)("all"),w=Xe({functionPathPrefix:g,outcome:k,tableTouched:R,userId:y}),C=oe(se.getRequestLog,w,{enabled:t==="requests",live:!0,shardKey:i}),q=oe(se.getLogs,{},{enabled:t==="errors",live:!0,shardKey:i}),F=t==="requests"?C:q,{error:E,errorSource:K,isLoading:$,liveError:V}=F,O=Pe(q.data),A=Pe(C.data);(0,T.useEffect)(()=>{F.data!==void 0&&pe(i)},[F.data,i]);let M=tt(O,{levels:n,now:Date.now(),path:v,range:d,search:p}),W=lt(M),j=t==="requests"?A.length:M.length,ee=t==="errors"&&h,Q=(0,T.useMemo)(()=>E!==null?"error":j===0?$?ee?"summary":"list":"empty":ee?"summary":"list",[j,$,E,ee]),me=(0,T.useRef)(null),Y=Se({count:j,estimateSize:N(()=>Qe,"estimateSize"),getScrollElement:N(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:N((P,te)=>Le(P,te,ce),"observeElementRect"),overscan:8}),qe=Y.getVirtualItems(),Fe={height:Y.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ve,{liveError:V,onShardKeyChange:o,onShowArchive:N(()=>{s("archive"),b(!1)},"onShowArchive"),onShowErrors:N(()=>{s("errors"),b(!1)},"onShowErrors"),onShowRequests:N(()=>{s("requests"),b(!1)},"onShowRequests"),shardKey:m,view:t}),t==="errors"&&(0,r.jsx)(ze,{levelFilter:n,onLogPathChange:N(P=>{a(P.target.value)},"onLogPathChange"),onSearchChange:N(P=>{f(P.target.value)},"onSearchChange"),onTimeRangeChange:N(P=>{u(P.target.value)},"onTimeRangeChange"),onToggleLevel:N(P=>{l(te=>{let H=new Set(te);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:N(()=>{b(P=>!P)},"onToggleSummary"),pathFilter:v,search:p,showSummary:h,timeRange:d}),t==="requests"&&(0,r.jsx)(je,{onOutcomeChange:N(P=>{I(P.target.value)},"onOutcomeChange"),onPathChange:N(P=>{x(P.target.value)},"onPathChange"),onTableChange:N(P=>{L(P.target.value)},"onTableChange"),onUserChange:N(P=>{S(P.target.value)},"onUserChange"),outcomeFilter:k,pathPrefix:g,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(De,{shardKey:i}):(0,r.jsxs)(r.Fragment,{children:[Q==="error"&&(0,r.jsx)(xe,{error:K,testId:"lg-error"}),Q==="empty"&&(0,r.jsx)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Q==="summary"&&(0,r.jsx)(Be,{summary:W}),Q==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:Ye,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Fe,children:qe.map(P=>t==="requests"?(0,r.jsx)(Ze,{entry:A[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key):(0,r.jsx)(Je,{entry:M[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key))})})]})]})},"Pt");export{Lt as LogsPanel,tt as filterLogs,lt as summarizeLogs};
|
|
1
|
+
import{a as X}from"./chunk-QWGT25SE.js";import{a as Le}from"./chunk-ZJGP6EKR.js";import{b as Se}from"./chunk-AVAC26HJ.js";import{a as de}from"./chunk-XF2B7P5A.js";import{a as Ce}from"./chunk-IGCNMZSB.js";import{a as ie}from"./chunk-FURI47Z2.js";import{a as be}from"./chunk-3CWGJYBB.js";import{a as ve}from"./chunk-RMN2JN4S.js";import{b as pe}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as D}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ge}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as J}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as xe}from"./chunk-KBBOZRRX.js";import"./chunk-XXQUMVWH.js";import"./chunk-DSU54IAT.js";import"./chunk-QLQADHFE.js";import{a as se}from"./chunk-VDW32UET.js";import{c as oe}from"./chunk-HRRFUAP6.js";import{f as he}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{a as Z}from"./chunk-XQCVZAGU.js";import{a as ye,b as we,c as Ne,d as ne,e as U,f as z}from"./chunk-WJQLNYGX.js";import{d as B,h as le,i as fe,o as ae}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as N,e as re,f as Ee,g as Ke,h as Me,j as G}from"./chunk-3XIESWL4.js";var _=re(Ke(),1);var T=re(Ee(),1);var r=re(Me(),1);var ue=["trace","debug","log","info","warn","error","fatal"],_e="LOG_ARCHIVE_NOT_CONFIGURED",Re={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},$e={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},Ae=N((c,e)=>{switch(e.type){case"append":return{...c,cursor:e.cursor,error:null,loading:!1,rows:[...c.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...c,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...c,error:e.message,loading:!1};default:return c}},"Ke"),Oe=N(c=>{let e=(0,_.c)(33),{row:t}=c,s;e[0]!==t.fields?(s=X(t.fields),e[0]=t.fields,e[1]=s):s=e[1];let i=s,o=`lg-archive-row-${String(t.ts)}`,m;e[2]!==t.ts?(m=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=m):m=e[3];let p;e[4]!==m?(p=(0,r.jsx)(z,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:m}),e[4]=m,e[5]=p):p=e[5];let f=Re[t.level],n;e[6]!==t.level||e[7]!==f?(n=(0,r.jsx)(z,{children:(0,r.jsx)(J,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=n):n=e[8];let l;e[9]!==t.functionPath?(l=(0,r.jsx)(z,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=l):l=e[10];let v;e[11]!==t.message?(v=(0,r.jsx)("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=v):v=e[12];let a;e[13]!==i?(a=i!==""&&(0,r.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=a):a=e[14];let d;e[15]!==v||e[16]!==a?(d=(0,r.jsxs)(z,{className:"max-w-md",children:[v,a]}),e[15]=v,e[16]=a,e[17]=d):d=e[17];let u=t.traceId??"\u2014",h;e[18]!==u?(h=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:u}),e[18]=u,e[19]=h):h=e[19];let b=t.shardKey??"\u2014",g;e[20]!==b?(g=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=g):g=e[21];let x=t.userId??"\u2014",y;e[22]!==x?(y=(0,r.jsx)(z,{className:"font-mono text-[11px] text-muted-foreground",children:x}),e[22]=x,e[23]=y):y=e[23];let S;return e[24]!==d||e[25]!==h||e[26]!==g||e[27]!==y||e[28]!==o||e[29]!==p||e[30]!==n||e[31]!==l?(S=(0,r.jsxs)(ne,{"data-testid":o,children:[p,n,l,d,h,g,y]}),e[24]=d,e[25]=h,e[26]=g,e[27]=y,e[28]=o,e[29]=p,e[30]=n,e[31]=l,e[32]=S):S=e[32],S},"Ue"),De=N(({shardKey:c})=>{let e=he(),t=B(),[s,i]=(0,T.useState)(""),[o,m]=(0,T.useState)(""),[p,f]=(0,T.useState)(""),[{cursor:n,error:l,loading:v,notConfigured:a,rows:d},u]=(0,T.useReducer)(Ae,$e),h=ie(s.trim(),400),b=ie(o.trim(),400),g={...h===""?{}:{functionPathPrefix:h},...p===""?{}:{minLevel:p},...c===""?{}:{shardKey:c},...b===""?{}:{userId:b}},x=JSON.stringify(g),y=(0,T.useRef)(x);(0,T.useEffect)(()=>{let w={cancelled:!1};return y.current=x,ae((async()=>{u({type:"loading"});try{let C=await e.queryLogArchive(g);w.cancelled||u({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){w.cancelled||u(fe(C)===_e?{type:"notConfigured"}:{message:le(C),type:"failed"})}})()),()=>{w.cancelled=!0}},[e,x]);let S=N(async()=>{if(n===void 0)return;let w=x;u({type:"loading"});try{let C=await e.queryLogArchive({...g,cursor:n});y.current===w&&u({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){y.current===w&&u({message:le(C),type:"pageFailed"})}},"C"),R=N(w=>{i(w.target.value)},"$"),L=N(w=>{m(w.target.value)},"L"),k=N(w=>{f(w.target.value)},"S"),I=N(()=>{ae(S())},"R");return a?(0,r.jsx)(Z,{action:(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:de,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline \u2192 R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path\u2026"),value:s}),(0,r.jsx)(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:L,placeholder:t("user id\u2026"),value:o}),(0,r.jsxs)("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:k,value:p,children:[(0,r.jsx)("option",{value:"",children:t("min level")}),ue.map(w=>(0,r.jsx)("option",{value:w,children:w},w))]})]}),l!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:l}),v&&d===null&&l===null&&(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading\u2026")}),d!==null&&d.length===0&&(0,r.jsx)(Z,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),d!==null&&d.length>0&&(0,r.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,r.jsxs)(ye,{"data-testid":"lg-archive-table",children:[(0,r.jsx)(we,{children:(0,r.jsxs)(ne,{children:[(0,r.jsx)(U,{children:t("Time")}),(0,r.jsx)(U,{children:t("Level")}),(0,r.jsx)(U,{children:t("Function")}),(0,r.jsx)(U,{children:t("Message")}),(0,r.jsx)(U,{children:t("Trace")}),(0,r.jsx)(U,{children:t("Shard")}),(0,r.jsx)(U,{children:t("User")})]})}),(0,r.jsx)(Ne,{children:d.map((w,C)=>(0,r.jsx)(Oe,{row:w},`${String(w.ts)}-${String(C)}`))})]})}),n!==void 0&&(0,r.jsx)("div",{children:(0,r.jsx)(ge,{"data-testid":"lg-archive-more",disabled:v,onClick:I,size:"sm",variant:"outline",children:t(v?"Loading\u2026":"Load more")})})]})},"De"),Ue=N(c=>{let e=(0,_.c)(11),{level:t,onToggle:s,selected:i}=c,o;e[0]!==t||e[1]!==s?(o=N(()=>{s(t)},"o"),e[0]=t,e[1]=s,e[2]=o):o=e[2];let m=o,p=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",f;e[3]!==p?(f=G("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=f):f=e[4];let n=`logs-level-${t}`,l;return e[5]!==t||e[6]!==m||e[7]!==i||e[8]!==f||e[9]!==n?(l=(0,r.jsx)("button",{"aria-pressed":i,className:f,"data-testid":n,onClick:m,type:"button",children:t}),e[5]=t,e[6]=m,e[7]=i,e[8]=f,e[9]=n,e[10]=l):l=e[10],l},"Ve"),ze=N(c=>{let e=(0,_.c)(68),{levelFilter:t,onLogPathChange:s,onSearchChange:i,onTimeRangeChange:o,onToggleLevel:m,onToggleSummary:p,pathFilter:f,search:n,showSummary:l,timeRange:v}=c,a=B(),d;e[0]!==a?(d=a("Search messages"),e[0]=a,e[1]=d):d=e[1];let u;e[2]!==a?(u=a("search message"),e[2]=a,e[3]=u):u=e[3];let h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==u?(h=(0,r.jsx)(D,{"aria-label":d,className:"h-8 w-48","data-testid":"lg-search",onChange:i,placeholder:u,value:n}),e[4]=i,e[5]=n,e[6]=d,e[7]=u,e[8]=h):h=e[8];let b;e[9]!==a?(b=a("Function path"),e[9]=a,e[10]=b):b=e[10];let g;e[11]!==a?(g=a("filter path"),e[11]=a,e[12]=g):g=e[12];let x;e[13]!==s||e[14]!==f||e[15]!==b||e[16]!==g?(x=(0,r.jsx)(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:s,placeholder:g,value:f}),e[13]=s,e[14]=f,e[15]=b,e[16]=g,e[17]=x):x=e[17];let y;e[18]!==a?(y=a("Level filter"),e[18]=a,e[19]=y):y=e[19];let S;e[20]!==t||e[21]!==m?(S=ue.map(j=>(0,r.jsx)(Ue,{level:j,onToggle:m,selected:t.has(j)},j)),e[20]=t,e[21]=m,e[22]=S):S=e[22];let R;e[23]!==y||e[24]!==S?(R=(0,r.jsx)("div",{"aria-label":y,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:S}),e[23]=y,e[24]=S,e[25]=R):R=e[25];let L;e[26]!==a?(L=a("Time range"),e[26]=a,e[27]=L):L=e[27];let k;e[28]!==a?(k=a("All time"),e[28]=a,e[29]=k):k=e[29];let I;e[30]!==k?(I=(0,r.jsx)("option",{value:"all",children:k}),e[30]=k,e[31]=I):I=e[31];let w;e[32]!==a?(w=a("Last 5m"),e[32]=a,e[33]=w):w=e[33];let C;e[34]!==w?(C=(0,r.jsx)("option",{value:"5m",children:w}),e[34]=w,e[35]=C):C=e[35];let q;e[36]!==a?(q=a("Last 15m"),e[36]=a,e[37]=q):q=e[37];let F;e[38]!==q?(F=(0,r.jsx)("option",{value:"15m",children:q}),e[38]=q,e[39]=F):F=e[39];let E;e[40]!==a?(E=a("Last hour"),e[40]=a,e[41]=E):E=e[41];let K;e[42]!==E?(K=(0,r.jsx)("option",{value:"1h",children:E}),e[42]=E,e[43]=K):K=e[43];let $;e[44]!==o||e[45]!==L||e[46]!==I||e[47]!==C||e[48]!==F||e[49]!==K||e[50]!==v?($=(0,r.jsxs)("select",{"aria-label":L,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:v,children:[I,C,F,K]}),e[44]=o,e[45]=L,e[46]=I,e[47]=C,e[48]=F,e[49]=K,e[50]=v,e[51]=$):$=e[51];let V=l?"border-border bg-muted font-medium":"border-input text-muted-foreground",O;e[52]!==V?(O=G("h-8 rounded-md border px-3 text-sm",V),e[52]=V,e[53]=O):O=e[53];let A;e[54]!==l||e[55]!==a?(A=a(l?"List":"Summary"),e[54]=l,e[55]=a,e[56]=A):A=e[56];let M;e[57]!==p||e[58]!==l||e[59]!==O||e[60]!==A?(M=(0,r.jsx)("button",{"aria-pressed":l,className:O,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:A}),e[57]=p,e[58]=l,e[59]=O,e[60]=A,e[61]=M):M=e[61];let W;return e[62]!==$||e[63]!==M||e[64]!==h||e[65]!==x||e[66]!==R?(W=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[h,x,R,$,M]}),e[62]=$,e[63]=M,e[64]=h,e[65]=x,e[66]=R,e[67]=W):W=e[67],W},"je"),je=N(c=>{let e=(0,_.c)(53),{onOutcomeChange:t,onPathChange:s,onTableChange:i,onUserChange:o,outcomeFilter:m,pathPrefix:p,tableFilter:f,userIdFilter:n}=c,l=B(),v;e[0]!==l?(v=l("Function path"),e[0]=l,e[1]=v):v=e[1];let a;e[2]!==l?(a=l("file:function"),e[2]=l,e[3]=a):a=e[3];let d;e[4]!==s||e[5]!==p||e[6]!==v||e[7]!==a?(d=(0,r.jsx)(D,{"aria-label":v,className:"h-8 w-44","data-testid":"lg-req-path",onChange:s,placeholder:a,value:p}),e[4]=s,e[5]=p,e[6]=v,e[7]=a,e[8]=d):d=e[8];let u;e[9]!==l?(u=l("User id"),e[9]=l,e[10]=u):u=e[10];let h;e[11]!==l?(h=l("userId"),e[11]=l,e[12]=h):h=e[12];let b;e[13]!==o||e[14]!==u||e[15]!==h||e[16]!==n?(b=(0,r.jsx)(D,{"aria-label":u,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:h,value:n}),e[13]=o,e[14]=u,e[15]=h,e[16]=n,e[17]=b):b=e[17];let g;e[18]!==l?(g=l("Table touched"),e[18]=l,e[19]=g):g=e[19];let x;e[20]!==l?(x=l("table"),e[20]=l,e[21]=x):x=e[21];let y;e[22]!==i||e[23]!==g||e[24]!==x||e[25]!==f?(y=(0,r.jsx)(D,{"aria-label":g,className:"h-8 w-32","data-testid":"lg-req-table",onChange:i,placeholder:x,value:f}),e[22]=i,e[23]=g,e[24]=x,e[25]=f,e[26]=y):y=e[26];let S;e[27]!==l?(S=l("Outcome filter"),e[27]=l,e[28]=S):S=e[28];let R;e[29]!==l?(R=l("all"),e[29]=l,e[30]=R):R=e[30];let L;e[31]!==R?(L=(0,r.jsx)("option",{value:"all",children:R}),e[31]=R,e[32]=L):L=e[32];let k;e[33]!==l?(k=l("ok"),e[33]=l,e[34]=k):k=e[34];let I;e[35]!==k?(I=(0,r.jsx)("option",{value:"ok",children:k}),e[35]=k,e[36]=I):I=e[36];let w;e[37]!==l?(w=l("error"),e[37]=l,e[38]=w):w=e[38];let C;e[39]!==w?(C=(0,r.jsx)("option",{value:"error",children:w}),e[39]=w,e[40]=C):C=e[40];let q;e[41]!==t||e[42]!==m||e[43]!==S||e[44]!==L||e[45]!==I||e[46]!==C?(q=(0,r.jsxs)("select",{"aria-label":S,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:m,children:[L,I,C]}),e[41]=t,e[42]=m,e[43]=S,e[44]=L,e[45]=I,e[46]=C,e[47]=q):q=e[47];let F;return e[48]!==q||e[49]!==d||e[50]!==b||e[51]!==y?(F=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[d,b,y,q]}),e[48]=q,e[49]=d,e[50]=b,e[51]=y,e[52]=F):F=e[52],F},"Be"),Ie=N(c=>{let e=(0,_.c)(7),{bucket:t}=c,s;e[0]!==t.key?(s=(0,r.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=s):s=e[1];let i;e[2]!==t.count?(i=(0,r.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=i):i=e[3];let o;return e[4]!==s||e[5]!==i?(o=(0,r.jsxs)("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[s,i]}),e[4]=s,e[5]=i,e[6]=o):o=e[6],o},"ve"),Be=N(c=>{let e=(0,_.c)(31),{summary:t}=c,s=B(),i;e[0]!==t.total||e[1]!==s?(i=s("{count} entries",{count:t.total}),e[0]=t.total,e[1]=s,e[2]=i):i=e[2];let o;e[3]!==i?(o=(0,r.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:i}),e[3]=i,e[4]=o):o=e[4];let m;e[5]!==s?(m=s("By level"),e[5]=s,e[6]=m):m=e[6];let p;e[7]!==m?(p=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[7]=m,e[8]=p):p=e[8];let f;e[9]!==t.byLevel?(f=t.byLevel.map(We),e[9]=t.byLevel,e[10]=f):f=e[10];let n;e[11]!==f?(n=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:f}),e[11]=f,e[12]=n):n=e[12];let l;e[13]!==p||e[14]!==n?(l=(0,r.jsxs)("div",{children:[p,n]}),e[13]=p,e[14]=n,e[15]=l):l=e[15];let v;e[16]!==s?(v=s("By function"),e[16]=s,e[17]=v):v=e[17];let a;e[18]!==v?(a=(0,r.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[18]=v,e[19]=a):a=e[19];let d;e[20]!==t.byPath?(d=t.byPath.map(Ge),e[20]=t.byPath,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,r.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:d}),e[22]=d,e[23]=u):u=e[23];let h;e[24]!==u||e[25]!==a?(h=(0,r.jsxs)("div",{children:[a,u]}),e[24]=u,e[25]=a,e[26]=h):h=e[26];let b;return e[27]!==h||e[28]!==o||e[29]!==l?(b=(0,r.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,l,h]}),e[27]=h,e[28]=o,e[29]=l,e[30]=b):b=e[30],b},"ze");function We(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(We,"Ge");function Ge(c){return(0,r.jsx)(Ie,{bucket:c},c.key)}N(Ge,"We");var Ve=N(c=>{let e=(0,_.c)(46),{liveError:t,onShardKeyChange:s,onShowArchive:i,onShowErrors:o,onShowRequests:m,shardKey:p,view:f}=c,n=B(),l=f==="requests",v=f==="requests"?"bg-muted font-medium":"text-muted-foreground",a;e[0]!==v?(a=G("px-3 py-1 text-sm",v),e[0]=v,e[1]=a):a=e[1];let d;e[2]!==n?(d=n("Requests"),e[2]=n,e[3]=d):d=e[3];let u;e[4]!==m||e[5]!==l||e[6]!==a||e[7]!==d?(u=(0,r.jsx)("button",{"aria-selected":l,className:a,"data-testid":"lg-view-requests",onClick:m,role:"tab",type:"button",children:d}),e[4]=m,e[5]=l,e[6]=a,e[7]=d,e[8]=u):u=e[8];let h=f==="errors",b=f==="errors"?"bg-muted font-medium":"text-muted-foreground",g;e[9]!==b?(g=G("px-3 py-1 text-sm",b),e[9]=b,e[10]=g):g=e[10];let x;e[11]!==n?(x=n("Errors"),e[11]=n,e[12]=x):x=e[12];let y;e[13]!==o||e[14]!==h||e[15]!==g||e[16]!==x?(y=(0,r.jsx)("button",{"aria-selected":h,className:g,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:x}),e[13]=o,e[14]=h,e[15]=g,e[16]=x,e[17]=y):y=e[17];let S=f==="archive",R=f==="archive"?"bg-muted font-medium":"text-muted-foreground",L;e[18]!==R?(L=G("px-3 py-1 text-sm",R),e[18]=R,e[19]=L):L=e[19];let k;e[20]!==n?(k=n("Archive"),e[20]=n,e[21]=k):k=e[21];let I;e[22]!==i||e[23]!==S||e[24]!==L||e[25]!==k?(I=(0,r.jsx)("button",{"aria-selected":S,className:L,"data-testid":"lg-view-archive",onClick:i,role:"tab",type:"button",children:k}),e[22]=i,e[23]=S,e[24]=L,e[25]=k,e[26]=I):I=e[26];let w;e[27]!==y||e[28]!==I||e[29]!==u?(w=(0,r.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[u,y,I]}),e[27]=y,e[28]=I,e[29]=u,e[30]=w):w=e[30];let C;e[31]!==s||e[32]!==p?(C=(0,r.jsx)(ve,{onChange:s,testId:"lg-shard-input",value:p}),e[31]=s,e[32]=p,e[33]=C):C=e[33];let q;e[34]!==t||e[35]!==f?(q=f!=="archive"&&(0,r.jsx)(Ce,{message:t,prefix:"lg"}),e[34]=t,e[35]=f,e[36]=q):q=e[36];let F;e[37]!==n?(F=n("Open in Cloudflare"),e[37]=n,e[38]=F):F=e[38];let E;e[39]!==F?(E=(0,r.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:de,rel:"noreferrer",target:"_blank",children:F}),e[39]=F,e[40]=E):E=e[40];let K;return e[41]!==w||e[42]!==C||e[43]!==q||e[44]!==E?(K=(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[w,C,q,E]}),e[41]=w,e[42]=C,e[43]=q,e[44]=E,e[45]=K):K=e[45],K},"Qe"),ce=400,Qe=36,Ye={height:ce,overflow:"auto"},Te={left:0,position:"absolute",top:0,width:"100%"},He={error:"destructive",ok:"secondary"},Je=N(c=>{let e=(0,_.c)(26),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.fields?(n=X(t.fields),e[2]=t.fields,e[3]=n):n=e[3];let l=n,v;e[4]!==t.timestamp?(v=new Date(t.timestamp).toLocaleString(),e[4]=t.timestamp,e[5]=v):v=e[5];let a;e[6]!==v?(a=(0,r.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:v}),e[6]=v,e[7]=a):a=e[7];let d=Re[t.level],u;e[8]!==t.level||e[9]!==d?(u=(0,r.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:d,children:t.level})}),e[8]=t.level,e[9]=d,e[10]=u):u=e[10];let h=t.functionPath??"\u2014",b;e[11]!==h?(b=(0,r.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:h}),e[11]=h,e[12]=b):b=e[12];let g;e[13]!==l?(g=l===""?null:(0,r.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:l}),e[13]=l,e[14]=g):g=e[14];let x;e[15]!==t.message||e[16]!==g?(x=(0,r.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,g]}),e[15]=t.message,e[16]=g,e[17]=x):x=e[17];let y;return e[18]!==s||e[19]!==i||e[20]!==f||e[21]!==x||e[22]!==a||e[23]!==u||e[24]!==b?(y=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-row",ref:i,role:"row",style:f,children:[a,u,b,x]}),e[18]=s,e[19]=i,e[20]=f,e[21]=x,e[22]=a,e[23]=u,e[24]=b,e[25]=y):y=e[25],y},"Xe"),ke=N(c=>c.length===0?"\u2014":c.join(", "),"ce"),Ze=N(c=>{let e=(0,_.c)(37),{entry:t,index:s,measureRef:i,start:o}=c,m=`translateY(${String(o)}px)`,p;e[0]!==m?(p={...Te,transform:m},e[0]=m,e[1]=p):p=e[1];let f=p,n;e[2]!==t.ts?(n=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=n):n=e[3];let l;e[4]!==n?(l=(0,r.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:n}),e[4]=n,e[5]=l):l=e[5];let v=He[t.outcome],a;e[6]!==t.outcome||e[7]!==v?(a=(0,r.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,r.jsx)(J,{variant:v,children:t.outcome})}),e[6]=t.outcome,e[7]=v,e[8]=a):a=e[8];let d;e[9]!==t.functionPath?(d=(0,r.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=d):d=e[10];let u=t.shardKey??"\u2014",h;e[11]!==u?(h=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[11]=u,e[12]=h):h=e[12];let b=t.userId??"\u2014",g;e[13]!==b?(g=(0,r.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:b}),e[13]=b,e[14]=g):g=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];let y=`${String(x)}ms`,S;e[17]!==y?(S=(0,r.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:y}),e[17]=y,e[18]=S):S=e[18];let R;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(R=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ke(t.tablesRead)} \xB7 w:${ke(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=R):R=e[23];let L;e[24]!==R?(L=(0,r.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:R}),e[24]=R,e[25]=L):L=e[25];let k;return e[26]!==s||e[27]!==i||e[28]!==f||e[29]!==g||e[30]!==S||e[31]!==L||e[32]!==l||e[33]!==a||e[34]!==d||e[35]!==h?(k=(0,r.jsxs)("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":s,"data-testid":"lg-req-row",ref:i,role:"row",style:f,children:[l,a,d,h,g,S,L]}),e[26]=s,e[27]=i,e[28]=f,e[29]=g,e[30]=S,e[31]=L,e[32]=l,e[33]=a,e[34]=d,e[35]=h,e[36]=k):k=e[36],k},"Ze"),Pe=N(c=>{let{entries:e}=c??{};return Array.isArray(e)?e:[]},"ue"),Xe=N(c=>{let e={};return c.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=c.functionPathPrefix.trim()),c.userId.trim()!==""&&(e.userId=c.userId.trim()),c.tableTouched.trim()!==""&&(e.tableTouched=c.tableTouched.trim()),(c.outcome==="ok"||c.outcome==="error")&&(e.outcome=c.outcome),e},"et"),et={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},tt=N((c,e)=>{let t=e.search.trim().toLowerCase(),s=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-et[e.range];return c.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<i||s!==""&&!(o.functionPath??"").toLowerCase().includes(s)?!1:t===""||o.message.toLowerCase().includes(t)||X(o.fields).toLowerCase().includes(t))},"rt"),rt="\u2014",lt=N(c=>{let e=new Map,t=new Map;for(let o of c){e.set(o.level,(e.get(o.level)??0)+1);let m=o.functionPath??rt;t.set(m,(t.get(m)??0)+1)}let s=ue.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),i=[...t.entries()].map(([o,m])=>({count:m,key:o})).toSorted((o,m)=>m.count===o.count?o.key.localeCompare(m.key):m.count-o.count);return{byLevel:s,byPath:i,total:c.length}},"at"),Lt=N(({initialShardKey:c})=>{let e=B(),[t,s]=(0,T.useState)("requests"),{queryShardKey:i,setShardKey:o,shardKey:m}=be(c),[p,f]=(0,T.useState)(""),[n,l]=(0,T.useState)(()=>new Set),[v,a]=(0,T.useState)(""),[d,u]=(0,T.useState)("all"),[h,b]=(0,T.useState)(!1),[g,x]=(0,T.useState)(""),[y,S]=(0,T.useState)(""),[R,L]=(0,T.useState)(""),[k,I]=(0,T.useState)("all"),w=Xe({functionPathPrefix:g,outcome:k,tableTouched:R,userId:y}),C=oe(se.getRequestLog,w,{enabled:t==="requests",live:!0,shardKey:i}),q=oe(se.getLogs,{},{enabled:t==="errors",live:!0,shardKey:i}),F=t==="requests"?C:q,{error:E,errorSource:K,isLoading:$,liveError:V}=F,O=Pe(q.data),A=Pe(C.data);(0,T.useEffect)(()=>{F.data!==void 0&&pe(i)},[F.data,i]);let M=tt(O,{levels:n,now:Date.now(),path:v,range:d,search:p}),W=lt(M),j=t==="requests"?A.length:M.length,ee=t==="errors"&&h,Q=(0,T.useMemo)(()=>E!==null?"error":j===0?$?ee?"summary":"list":"empty":ee?"summary":"list",[j,$,E,ee]),me=(0,T.useRef)(null),Y=Se({count:j,estimateSize:N(()=>Qe,"estimateSize"),getScrollElement:N(()=>me.current,"getScrollElement"),initialRect:{height:ce,width:800},observeElementRect:N((P,te)=>Le(P,te,ce),"observeElementRect"),overscan:8}),qe=Y.getVirtualItems(),Fe={height:Y.getTotalSize(),position:"relative",width:"100%"};return(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,r.jsx)(Ve,{liveError:V,onShardKeyChange:o,onShowArchive:N(()=>{s("archive"),b(!1)},"onShowArchive"),onShowErrors:N(()=>{s("errors"),b(!1)},"onShowErrors"),onShowRequests:N(()=>{s("requests"),b(!1)},"onShowRequests"),shardKey:m,view:t}),t==="errors"&&(0,r.jsx)(ze,{levelFilter:n,onLogPathChange:N(P=>{a(P.target.value)},"onLogPathChange"),onSearchChange:N(P=>{f(P.target.value)},"onSearchChange"),onTimeRangeChange:N(P=>{u(P.target.value)},"onTimeRangeChange"),onToggleLevel:N(P=>{l(te=>{let H=new Set(te);return H.has(P)?H.delete(P):H.add(P),H})},"onToggleLevel"),onToggleSummary:N(()=>{b(P=>!P)},"onToggleSummary"),pathFilter:v,search:p,showSummary:h,timeRange:d}),t==="requests"&&(0,r.jsx)(je,{onOutcomeChange:N(P=>{I(P.target.value)},"onOutcomeChange"),onPathChange:N(P=>{x(P.target.value)},"onPathChange"),onTableChange:N(P=>{L(P.target.value)},"onTableChange"),onUserChange:N(P=>{S(P.target.value)},"onUserChange"),outcomeFilter:k,pathPrefix:g,tableFilter:R,userIdFilter:y}),t==="archive"?(0,r.jsx)(De,{shardKey:i}):(0,r.jsxs)(r.Fragment,{children:[Q==="error"&&(0,r.jsx)(xe,{error:K,testId:"lg-error"}),Q==="empty"&&(0,r.jsx)(Z,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:(0,r.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,r.jsx)("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),Q==="summary"&&(0,r.jsx)(Be,{summary:W}),Q==="list"&&(0,r.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:me,style:Ye,children:(0,r.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Fe,children:qe.map(P=>t==="requests"?(0,r.jsx)(Ze,{entry:A[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key):(0,r.jsx)(Je,{entry:M[P.index],index:P.index,measureRef:Y.measureElement,start:P.start},P.key))})})]})]})},"Pt");export{Lt as LogsPanel,tt as filterLogs,lt as summarizeLogs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b as U}from"./chunk-AVAC26HJ.js";import{a as F}from"./chunk-IGCNMZSB.js";import{a as j}from"./chunk-3CWGJYBB.js";import{a as V}from"./chunk-RMN2JN4S.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as C}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as L}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as z}from"./chunk-
|
|
1
|
+
import{a as O,b as U}from"./chunk-AVAC26HJ.js";import{a as F}from"./chunk-IGCNMZSB.js";import{a as j}from"./chunk-3CWGJYBB.js";import{a as V}from"./chunk-RMN2JN4S.js";import"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as C}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import"./chunk-2OUPA2WJ.js";import{b as L}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as z}from"./chunk-KBBOZRRX.js";import"./chunk-XXQUMVWH.js";import"./chunk-DSU54IAT.js";import"./chunk-QLQADHFE.js";import{a as R}from"./chunk-VDW32UET.js";import{c as M}from"./chunk-HRRFUAP6.js";import"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import{a as K}from"./chunk-XQCVZAGU.js";import{a as A,b as T,c as q,d as p,e as n,f as d}from"./chunk-WJQLNYGX.js";import{a as I,e as E}from"./chunk-WQH3LT2P.js";import{d as b,r as k}from"./chunk-IUYFXK4X.js";import"./chunk-P33WK7YI.js";import{a as i,e as y,f as ee,h as te}from"./chunk-3XIESWL4.js";var o=y(ee(),1);var e=y(te(),1);var B=80,re=i(s=>{if(s===void 0)return"";let t=JSON.stringify(s);return t.length>B?`${t.slice(0,B)}\u2026`:t},"te"),ae=41,H=480,D=5,ie=i((s,t)=>O(s,l=>{t(l.height>0?l:{height:H,width:l.width})}),"ae"),Ne=i(({initialShardKey:s})=>{let t=b(),{queryShardKey:l,setShardKey:J,shardKey:P}=j(s),[c,W]=(0,o.useState)(""),{data:f,error:g,errorSource:Z,isLoading:_,liveError:$}=M(R.getAuditLog,{},{live:!0,shardKey:l}),h=(0,o.useMemo)(()=>f?.entries??[],[f]),m=(0,o.useMemo)(()=>{let a=c.trim().toLowerCase();return a===""?h:h.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[h,c]),x=(0,o.useRef)(null),v=U({count:m.length,estimateSize:i(()=>ae,"estimateSize"),getScrollElement:i(()=>x.current,"getScrollElement"),initialRect:{height:H,width:800},observeElementRect:ie,overscan:8}),u=v.getVirtualItems(),G=v.getTotalSize(),N=u[0]?.start??0,w=G-(u.at(-1)?.end??0),Q={height:N},X={height:w},Y=i(a=>{W(a.target.value)},"z");return(0,e.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)(V,{onChange:J,testId:"au-shard-input",value:P}),(0,e.jsx)(F,{message:$,prefix:"au"}),(0,e.jsx)(C,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:Y,placeholder:t("filter op, table, id"),value:c})]}),g!==null&&(0,e.jsx)(z,{error:Z,testId:"au-error"}),g===null&&!_&&m.length===0&&(0,e.jsx)(K,{description:t("State-changing admin operations are recorded here."),icon:(0,e.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsx)("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),m.length>0&&(0,e.jsx)(I,{className:"overflow-hidden py-0",children:(0,e.jsx)(E,{className:"max-h-[30rem] overflow-auto px-0",ref:x,children:(0,e.jsxs)(A,{"data-testid":"au-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(p,{children:[(0,e.jsx)(n,{children:t("time")}),(0,e.jsx)(n,{children:t("op")}),(0,e.jsx)(n,{children:t("table")}),(0,e.jsx)(n,{children:t("id")}),(0,e.jsx)(n,{children:t("detail")})]})}),(0,e.jsxs)(q,{children:[N>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:D,style:Q})}),u.map(a=>{let r=m[a.index],S=re(r.detail);return(0,e.jsxs)(p,{"data-testid":"au-row",children:[(0,e.jsx)(d,{className:"text-muted-foreground tabular-nums",children:k(r.ts,"\u2014")}),(0,e.jsx)(d,{children:(0,e.jsx)(L,{variant:"secondary",children:r.op})}),(0,e.jsx)(d,{className:"font-medium",children:r.table??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,e.jsx)(d,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||(0,e.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},r.seq)}),w>0&&(0,e.jsx)("tr",{"aria-hidden":"true",children:(0,e.jsx)("td",{colSpan:D,style:X})})]})]})})})]})},"we");export{Ne as AuditPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-
|
|
1
|
+
import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-7HWEPGII.js";import"./chunk-U3Y2BI4W.js";import"./chunk-3C3CG7ZK.js";import"./chunk-I6A5C46N.js";import"./chunk-2QSHLBCO.js";import"./chunk-BGBLQ563.js";import{a as Ci}from"./chunk-FURI47Z2.js";import"./chunk-IVFHIQOT.js";import"./chunk-QBWRC5YX.js";import"./chunk-HPFLBYRI.js";import"./chunk-CZZWYUTR.js";import"./chunk-SFDOII3B.js";import"./chunk-SMIESS7P.js";import{a as Le}from"./chunk-7T7UOTYK.js";import{R as Xi}from"./chunk-CFPZYHPY.js";import"./chunk-T6VMSOBB.js";import{a as zd}from"./chunk-7QIFDWQV.js";import{c as Gi}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{b as Ke}from"./chunk-DSU54IAT.js";import"./chunk-QLQADHFE.js";import"./chunk-VDW32UET.js";import"./chunk-HRRFUAP6.js";import{a as Hi,e as qi}from"./chunk-6FQJRXVI.js";import"./chunk-XBDKZZ67.js";import"./chunk-XQCVZAGU.js";import"./chunk-WQH3LT2P.js";import{a as Qi,d as je,p as pi}from"./chunk-IUYFXK4X.js";import{c as _i}from"./chunk-P33WK7YI.js";import{a as c,c as vn,e as fu,f as Ni,g as Ad,h as Bi,j as xe}from"./chunk-3XIESWL4.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,oa||(oa=!0,ga());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var oa=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,oa){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?ga():oa=!1}}}c(we,"performWorkUntilDeadline");var ga;typeof Ki=="function"?ga=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,ga=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):ga=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,oa||(oa=!0,ga()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((n2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+lc+l+a0}c(kt,"describeBuiltInComponentFrame");var tc=!1;function ac(l,t){if(!l||tc)return"";tc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:c(function(){try{if(t){var b=c(function(){throw Error()},"Fake");if(Object.defineProperty(b.prototype,"props",{set:c(function(){throw Error()},"set")}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(g){var S=g}Reflect.construct(l,[],b)}else{try{b.call()}catch(g){S=g}l.call(b.prototype)}}else{try{throw Error()}catch(g){S=g}(b=l())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(g){if(g&&S&&typeof g.stack=="string")return[g.stack,S.stack]}return[null,null]},"DetermineComponentFrameRoot")};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var e=u.DetermineComponentFrameRoot(),f=e[0],i=e[1];if(f&&i){var m=f.split(`
|
|
4
4
|
`),y=i.split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/studio",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.99",
|
|
4
4
|
"description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin-ui",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"@hugeicons/react": "^1.1.9",
|
|
59
59
|
"@lingui/core": "^6.6.0",
|
|
60
60
|
"@lingui/message-utils": "^6.6.0",
|
|
61
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
62
|
-
"@lunora/bindings": "1.0.0-alpha.
|
|
63
|
-
"@lunora/client": "1.0.0-alpha.
|
|
61
|
+
"@lunora/advisor": "1.0.0-alpha.71",
|
|
62
|
+
"@lunora/bindings": "1.0.0-alpha.23",
|
|
63
|
+
"@lunora/client": "1.0.0-alpha.43",
|
|
64
64
|
"@lunora/errors": "1.0.0-alpha.16",
|
|
65
|
-
"@lunora/react": "1.0.0-alpha.
|
|
65
|
+
"@lunora/react": "1.0.0-alpha.47",
|
|
66
66
|
"@tanstack/react-query": "^5.101.4",
|
|
67
67
|
"@tanstack/react-router": "^1.170.18",
|
|
68
68
|
"@tanstack/react-table": "^8.21.3",
|