@lunora/studio 1.0.0-alpha.61 → 1.0.0-alpha.63

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.
Files changed (111) hide show
  1. package/dist/standalone/{chunk-JC6WYIHM.js → chunk-26TQSVUV.js} +1 -1
  2. package/dist/standalone/{chunk-ZFWEPGWG.js → chunk-2OUPA2WJ.js} +1 -1
  3. package/dist/standalone/{chunk-HA34GYEX.js → chunk-2PJNAWB3.js} +1 -1
  4. package/dist/standalone/{chunk-CVMRZUF5.js → chunk-2Y36BVVM.js} +1 -1
  5. package/dist/standalone/{chunk-KNN3ZEQ7.js → chunk-37RIZFJ4.js} +1 -1
  6. package/dist/standalone/{chunk-UNN4CESU.js → chunk-3NHORZCK.js} +1 -1
  7. package/dist/standalone/{chunk-UNDFOYRI.js → chunk-3RTTXLMU.js} +1 -1
  8. package/dist/standalone/{chunk-UHHTEBC3.js → chunk-3XIESWL4.js} +1 -1
  9. package/dist/standalone/{chunk-KLLYGWNF.js → chunk-4CGALXS3.js} +1 -1
  10. package/dist/standalone/{chunk-O62HJZV3.js → chunk-4MSKCWUL.js} +1 -1
  11. package/dist/standalone/{chunk-SEDZDNQF.js → chunk-4UOFSGUS.js} +1 -1
  12. package/dist/standalone/{chunk-SA6MBPBL.js → chunk-54MMVNPT.js} +1 -1
  13. package/dist/standalone/{chunk-RE6UWCMG.js → chunk-5L2MD6F6.js} +1 -1
  14. package/dist/standalone/{chunk-HY46NTNW.js → chunk-5RF4QDDA.js} +1 -1
  15. package/dist/standalone/{chunk-YT7VXQVX.js → chunk-5Y3QLNWX.js} +1 -1
  16. package/dist/standalone/{chunk-LPOKAJT4.js → chunk-66TS6K5F.js} +1 -1
  17. package/dist/standalone/{chunk-4FNHHFWR.js → chunk-6ST5ECQA.js} +1 -1
  18. package/dist/standalone/{chunk-C4VURT57.js → chunk-7LQWFOEU.js} +1 -1
  19. package/dist/standalone/{chunk-46IB4C4Q.js → chunk-7QIFDWQV.js} +1 -1
  20. package/dist/standalone/{chunk-AKTGRZXN.js → chunk-7RXOPYR5.js} +1 -1
  21. package/dist/standalone/{chunk-PTTDIYGP.js → chunk-7T7UOTYK.js} +1 -1
  22. package/dist/standalone/{chunk-XRKCGQM2.js → chunk-7YAUSG6S.js} +1 -1
  23. package/dist/standalone/{chunk-PWDMXMRD.js → chunk-7YEFOSPH.js} +1 -1
  24. package/dist/standalone/chunk-AVAC26HJ.js +1 -0
  25. package/dist/standalone/{chunk-VUJGR4PB.js → chunk-AX4PAEGP.js} +1 -1
  26. package/dist/standalone/{chunk-JRWBGR5B.js → chunk-B5E7GQHG.js} +1 -1
  27. package/dist/standalone/{chunk-3DTM4GI5.js → chunk-BEH5N5ZA.js} +1 -1
  28. package/dist/standalone/{chunk-YNBJ6ICE.js → chunk-BGBLQ563.js} +1 -1
  29. package/dist/standalone/{chunk-SZUHZ2OG.js → chunk-BY4QROKU.js} +1 -1
  30. package/dist/standalone/{chunk-7Z5QEFR4.js → chunk-CFPZYHPY.js} +1 -1
  31. package/dist/standalone/{chunk-BAIN7UJ4.js → chunk-DCJKCERP.js} +1 -1
  32. package/dist/standalone/{chunk-P4J6XNG3.js → chunk-DY7CLL2H.js} +1 -1
  33. package/dist/standalone/{chunk-VEFNSN7P.js → chunk-ESVP44Y3.js} +1 -1
  34. package/dist/standalone/{chunk-IE4ROTQD.js → chunk-F6LUZVVI.js} +1 -1
  35. package/dist/standalone/{chunk-UY2Y5CXB.js → chunk-FXCBF4XT.js} +1 -1
  36. package/dist/standalone/{chunk-BHWSIIDT.js → chunk-GBQHGYGH.js} +1 -1
  37. package/dist/standalone/{chunk-HMIOF5GV.js → chunk-GHUPW2Y5.js} +1 -1
  38. package/dist/standalone/{chunk-FXFK4M4E.js → chunk-GMR677FL.js} +1 -1
  39. package/dist/standalone/{chunk-UWF5DOGV.js → chunk-GRL5MG3Z.js} +1 -1
  40. package/dist/standalone/{chunk-GTXVH7I5.js → chunk-H3V2QQ4K.js} +1 -1
  41. package/dist/standalone/{chunk-KZ2YUNMR.js → chunk-H7NIIBHH.js} +1 -1
  42. package/dist/standalone/{chunk-H6SIM4BT.js → chunk-HPFLBYRI.js} +1 -1
  43. package/dist/standalone/{chunk-CZEUVNCQ.js → chunk-IC4L6G56.js} +1 -1
  44. package/dist/standalone/{chunk-PGDWFWH5.js → chunk-IGBEXNXY.js} +1 -1
  45. package/dist/standalone/{chunk-TEIBKU46.js → chunk-IJFCOWEQ.js} +1 -1
  46. package/dist/standalone/{chunk-TYTJDFX2.js → chunk-ILNELDFC.js} +1 -1
  47. package/dist/standalone/{chunk-AGVJJQFL.js → chunk-IPHXIGYP.js} +1 -1
  48. package/dist/standalone/{chunk-TAE2H7PU.js → chunk-IUW24D4X.js} +1 -1
  49. package/dist/standalone/{chunk-C4O5UR4Y.js → chunk-IVFHIQOT.js} +1 -1
  50. package/dist/standalone/{chunk-MZEK4SGD.js → chunk-JGY4NGFW.js} +1 -1
  51. package/dist/standalone/{chunk-JLFCXBNQ.js → chunk-JN2Y24PY.js} +1 -1
  52. package/dist/standalone/{chunk-CYET4BRZ.js → chunk-K7M4SMQ7.js} +1 -1
  53. package/dist/standalone/{chunk-6CLVIOCB.js → chunk-KUVMORDQ.js} +1 -1
  54. package/dist/standalone/{chunk-NCCUM26H.js → chunk-KYF2E5CJ.js} +1 -1
  55. package/dist/standalone/{chunk-QC5HCNJZ.js → chunk-LA3HEESS.js} +1 -1
  56. package/dist/standalone/{chunk-UDZY7MKE.js → chunk-LE56LPNH.js} +1 -1
  57. package/dist/standalone/{chunk-SNDYNCAA.js → chunk-LEDWUPXM.js} +1 -1
  58. package/dist/standalone/{chunk-YQ5PILIJ.js → chunk-LFKCLLPT.js} +1 -1
  59. package/dist/standalone/{chunk-V66TSUKV.js → chunk-LFXFP4IF.js} +1 -1
  60. package/dist/standalone/{chunk-VUXJER3D.js → chunk-LLXFYRGQ.js} +1 -1
  61. package/dist/standalone/{chunk-KJTLW5W2.js → chunk-LWECXQWP.js} +3 -3
  62. package/dist/standalone/{chunk-2A4RKII2.js → chunk-M2B3MDFJ.js} +1 -1
  63. package/dist/standalone/{chunk-ICKBVXPP.js → chunk-M536Y2KX.js} +1 -1
  64. package/dist/standalone/{chunk-LKHUVEHX.js → chunk-M7QCL3ZP.js} +1 -1
  65. package/dist/standalone/{chunk-Q5WXTZWX.js → chunk-MIQTKZAR.js} +1 -1
  66. package/dist/standalone/{chunk-IYYTWZ2E.js → chunk-NPIULIRO.js} +1 -1
  67. package/dist/standalone/{chunk-SKJZDOHG.js → chunk-OWADN6BI.js} +1 -1
  68. package/dist/standalone/{chunk-IBCKC2BO.js → chunk-OZGWNJXD.js} +1 -1
  69. package/dist/standalone/{chunk-CKO3F55C.js → chunk-P4DHFWH7.js} +1 -1
  70. package/dist/standalone/{chunk-3MHKT76P.js → chunk-P4J3Z3SA.js} +1 -1
  71. package/dist/standalone/chunk-PF7V3G2Z.js +62 -0
  72. package/dist/standalone/{chunk-W572365D.js → chunk-PYXZLNG2.js} +1 -1
  73. package/dist/standalone/{chunk-R43KHQDA.js → chunk-PZPFWABF.js} +1 -1
  74. package/dist/standalone/chunk-QBWRC5YX.js +1 -0
  75. package/dist/standalone/{chunk-GS7OBQO5.js → chunk-QLJJ5YYZ.js} +1 -1
  76. package/dist/standalone/{chunk-ZMFZRGAN.js → chunk-QWGT25SE.js} +1 -1
  77. package/dist/standalone/{chunk-RC2K5RBE.js → chunk-RLEENOIX.js} +1 -1
  78. package/dist/standalone/{chunk-Z7MUQMLE.js → chunk-RWZKO2P6.js} +1 -1
  79. package/dist/standalone/{chunk-PR2SE2MD.js → chunk-SD4BERSA.js} +1 -1
  80. package/dist/standalone/{chunk-KYCAYNXM.js → chunk-SFDOII3B.js} +1 -1
  81. package/dist/standalone/{chunk-UNXX5GQH.js → chunk-SM67QXQI.js} +1 -1
  82. package/dist/standalone/{chunk-6UYILUSX.js → chunk-SMIESS7P.js} +1 -1
  83. package/dist/standalone/{chunk-KSRXMTBV.js → chunk-T6VMSOBB.js} +1 -1
  84. package/dist/standalone/{chunk-WYFLGXZ3.js → chunk-TCQEDMAQ.js} +1 -1
  85. package/dist/standalone/{chunk-23HKRH5H.js → chunk-TDE4AR5O.js} +1 -1
  86. package/dist/standalone/{chunk-K5PFWU5J.js → chunk-THIXMMZD.js} +1 -1
  87. package/dist/standalone/{chunk-RUP3M2GF.js → chunk-TRHTFGFW.js} +2 -2
  88. package/dist/standalone/{chunk-Q34MSC2F.js → chunk-UNUU7CJJ.js} +1 -1
  89. package/dist/standalone/{chunk-FYAJPWE7.js → chunk-UVDPQU7J.js} +1 -1
  90. package/dist/standalone/{chunk-JKPK25JO.js → chunk-UZERI5YC.js} +1 -1
  91. package/dist/standalone/{chunk-P2NBOUGZ.js → chunk-V4RWA7QI.js} +1 -1
  92. package/dist/standalone/{chunk-UZYGEOWY.js → chunk-V53KNYRN.js} +1 -1
  93. package/dist/standalone/{chunk-7AZZ7OJO.js → chunk-VSS7NFZJ.js} +1 -1
  94. package/dist/standalone/{chunk-7CRLAMGB.js → chunk-WQTUQZUM.js} +1 -1
  95. package/dist/standalone/{chunk-6I62RSI5.js → chunk-X2FQ6B5V.js} +1 -1
  96. package/dist/standalone/{chunk-UREY4GLG.js → chunk-XBDKZZ67.js} +1 -1
  97. package/dist/standalone/{chunk-TO6NLVFD.js → chunk-XBGJVK32.js} +1 -1
  98. package/dist/standalone/{chunk-QJKRHZYV.js → chunk-XITDHIVL.js} +1 -1
  99. package/dist/standalone/{chunk-6OKDCV7J.js → chunk-XQCVZAGU.js} +1 -1
  100. package/dist/standalone/{chunk-6P7HIPUE.js → chunk-XQGANNLS.js} +1 -1
  101. package/dist/standalone/{chunk-4AYEV5UN.js → chunk-XXQUMVWH.js} +1 -1
  102. package/dist/standalone/{chunk-H6WOFY6A.js → chunk-YQP2EYOC.js} +1 -1
  103. package/dist/standalone/chunk-ZJGP6EKR.js +1 -0
  104. package/dist/standalone/{chunk-J2LMP2A7.js → chunk-ZKEVSU66.js} +1 -1
  105. package/dist/standalone/{chunk-CWWGDW4V.js → chunk-ZSWWTXVW.js} +1 -1
  106. package/dist/standalone/studio.js +2 -2
  107. package/package.json +10 -10
  108. package/dist/standalone/chunk-725RLB7D.js +0 -1
  109. package/dist/standalone/chunk-KOC5KV3E.js +0 -1
  110. package/dist/standalone/chunk-OTJOI23O.js +0 -62
  111. package/dist/standalone/chunk-XDKFPBIL.js +0 -1
@@ -1 +1 @@
1
- import{a as C}from"./chunk-SA6MBPBL.js";import{a as _}from"./chunk-SKJZDOHG.js";import{a as $,b as z,c as B,d as g,e as n,f as i}from"./chunk-Q5WXTZWX.js";import{a as S,e as I}from"./chunk-JKPK25JO.js";import{c as w}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import"./chunk-4FNHHFWR.js";import{f as b}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as j}from"./chunk-6OKDCV7J.js";import{d as k,m as R,q as T}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as h,e as y,g as P,h as Q}from"./chunk-UHHTEBC3.js";var L=y(P(),1);var s=y(Q(),1);var E=200,U=h(()=>{let e=(0,L.c)(21),l=b(),t=k(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",E],e[0]=u):u=e[0];let p;e[1]!==l?(p=h(()=>l.listAuthSessions({limit:E}),"u"),e[1]=l,e[2]=p):p=e[2];let o=_(u,p),{error:f}=o,a=o.data?.rows??null,x;e[3]!==o?(x=h(()=>{o.refetch()},"f"),e[3]=o,e[4]=x):x=e[4],C(x,!0);let N;e[5]!==l||e[6]!==o?(N=h(r=>{R((async()=>{await l.revokeAuthSession({sessionId:r}),o.refetch()})())},"x"),e[5]=l,e[6]=o,e[7]=N):N=e[7];let A=N,d;e[8]!==f?(d=f!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:f}),e[8]=f,e[9]=d):d=e[9];let c;e[10]!==a||e[11]!==t?(c=a!==null&&a.length===0&&(0,s.jsx)(j,{testId:"auth-sessions-empty",title:t("No active sessions.")}),e[10]=a,e[11]=t,e[12]=c):c=e[12];let m;e[13]!==A||e[14]!==a||e[15]!==t?(m=a!==null&&a.length>0&&(0,s.jsx)(S,{className:"overflow-hidden py-0",children:(0,s.jsx)(I,{className:"px-0",children:(0,s.jsxs)($,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(z,{children:(0,s.jsxs)(g,{children:[(0,s.jsx)(n,{children:t("user")}),(0,s.jsx)(n,{children:t("expires")}),(0,s.jsx)(n,{children:t("ip")}),(0,s.jsx)(n,{children:t("user agent")}),(0,s.jsx)(n,{children:t("impersonated by")}),(0,s.jsx)(n,{"aria-label":t("Actions")})]})}),(0,s.jsx)(B,{children:a.map(r=>(0,s.jsxs)(g,{"data-testid":`auth-session-${r.id}`,children:[(0,s.jsx)(i,{className:"font-mono text-xs",children:r.userId}),(0,s.jsx)(i,{className:"text-muted-foreground tabular-nums",children:T(r.expiresAt)}),(0,s.jsx)(i,{children:r.ipAddress??""}),(0,s.jsx)(i,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,s.jsx)(i,{className:"font-mono text-xs",children:r.impersonatedBy??""}),(0,s.jsx)(i,{children:(0,s.jsx)(w,{"data-testid":`auth-session-revoke-${r.id}`,onClick:h(()=>{A(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Revoke")})})]},r.id))})]})})}),e[13]=A,e[14]=a,e[15]=t,e[16]=m):m=e[16];let v;return e[17]!==d||e[18]!==c||e[19]!==m?(v=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[d,c,m]}),e[17]=d,e[18]=c,e[19]=m,e[20]=v):v=e[20],v},"Q");export{U as AuthSessionsPanel};
1
+ import{a as C}from"./chunk-54MMVNPT.js";import{a as _}from"./chunk-OWADN6BI.js";import{a as $,b as z,c as B,d as g,e as n,f as i}from"./chunk-MIQTKZAR.js";import{a as S,e as I}from"./chunk-UZERI5YC.js";import{c as w}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import"./chunk-6ST5ECQA.js";import{f as b}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as j}from"./chunk-XQCVZAGU.js";import{d as k,m as R,q as T}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as h,e as y,g as P,h as Q}from"./chunk-3XIESWL4.js";var L=y(P(),1);var s=y(Q(),1);var E=200,U=h(()=>{let e=(0,L.c)(21),l=b(),t=k(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",E],e[0]=u):u=e[0];let p;e[1]!==l?(p=h(()=>l.listAuthSessions({limit:E}),"u"),e[1]=l,e[2]=p):p=e[2];let o=_(u,p),{error:f}=o,a=o.data?.rows??null,x;e[3]!==o?(x=h(()=>{o.refetch()},"f"),e[3]=o,e[4]=x):x=e[4],C(x,!0);let N;e[5]!==l||e[6]!==o?(N=h(r=>{R((async()=>{await l.revokeAuthSession({sessionId:r}),o.refetch()})())},"x"),e[5]=l,e[6]=o,e[7]=N):N=e[7];let A=N,d;e[8]!==f?(d=f!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:f}),e[8]=f,e[9]=d):d=e[9];let c;e[10]!==a||e[11]!==t?(c=a!==null&&a.length===0&&(0,s.jsx)(j,{testId:"auth-sessions-empty",title:t("No active sessions.")}),e[10]=a,e[11]=t,e[12]=c):c=e[12];let m;e[13]!==A||e[14]!==a||e[15]!==t?(m=a!==null&&a.length>0&&(0,s.jsx)(S,{className:"overflow-hidden py-0",children:(0,s.jsx)(I,{className:"px-0",children:(0,s.jsxs)($,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(z,{children:(0,s.jsxs)(g,{children:[(0,s.jsx)(n,{children:t("user")}),(0,s.jsx)(n,{children:t("expires")}),(0,s.jsx)(n,{children:t("ip")}),(0,s.jsx)(n,{children:t("user agent")}),(0,s.jsx)(n,{children:t("impersonated by")}),(0,s.jsx)(n,{"aria-label":t("Actions")})]})}),(0,s.jsx)(B,{children:a.map(r=>(0,s.jsxs)(g,{"data-testid":`auth-session-${r.id}`,children:[(0,s.jsx)(i,{className:"font-mono text-xs",children:r.userId}),(0,s.jsx)(i,{className:"text-muted-foreground tabular-nums",children:T(r.expiresAt)}),(0,s.jsx)(i,{children:r.ipAddress??""}),(0,s.jsx)(i,{className:"max-w-40 truncate",children:r.userAgent??""}),(0,s.jsx)(i,{className:"font-mono text-xs",children:r.impersonatedBy??""}),(0,s.jsx)(i,{children:(0,s.jsx)(w,{"data-testid":`auth-session-revoke-${r.id}`,onClick:h(()=>{A(r.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:t("Revoke")})})]},r.id))})]})})}),e[13]=A,e[14]=a,e[15]=t,e[16]=m):m=e[16];let v;return e[17]!==d||e[18]!==c||e[19]!==m?(v=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[d,c,m]}),e[17]=d,e[18]=c,e[19]=m,e[20]=v):v=e[20],v},"Q");export{U as AuthSessionsPanel};
@@ -1 +1 @@
1
- import{a as Q}from"./chunk-6I62RSI5.js";import{a as J}from"./chunk-C4VURT57.js";import{a as W}from"./chunk-YQ5PILIJ.js";import{a as _}from"./chunk-Q34MSC2F.js";import"./chunk-4AYEV5UN.js";import{b as O}from"./chunk-SKJZDOHG.js";import{a as $,b as G,c as H,d as x,e as t,f as n}from"./chunk-Q5WXTZWX.js";import{a as j,e as K}from"./chunk-JKPK25JO.js";import{a as y}from"./chunk-YT7VXQVX.js";import{a as U}from"./chunk-V66TSUKV.js";import{b as P}from"./chunk-UWF5DOGV.js";import"./chunk-PTTDIYGP.js";import{R as S}from"./chunk-7Z5QEFR4.js";import"./chunk-46IB4C4Q.js";import{c as D}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import{b as E}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as v}from"./chunk-GXZAXNZI.js";import{f as L}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as z}from"./chunk-6OKDCV7J.js";import{d as M,f as A,g as B,h as F,m as T,q}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as s,e as I,f as lr,h as cr}from"./chunk-UHHTEBC3.js";var i=I(lr(),1);var r=I(cr(),1);var mr=A(v.runMigration),Sr=s(({initialShardKey:V})=>{let X=L(),e=M(),[c,Y]=(0,i.useState)(V??""),[b,Z]=(0,i.useState)(""),[w,rr]=(0,i.useState)("up"),[h,er]=(0,i.useState)(!0),[m,N]=(0,i.useState)(!1),[d,p]=(0,i.useState)(null),[k,g]=(0,i.useState)(null),u=W(c.trim(),400),C=c.trim()===u,o=O(v.migrationStatus,{},{live:!0,shardKey:u}),l=o.data?.migrations??null,ar=o.error,{errorSource:ir,liveError:tr}=o;(0,i.useEffect)(()=>{o.data!==void 0&&P(u)},[o.data,u]);let nr=s(async()=>{let a=b.trim();if(a===""){g(e("Enter a migration id")),p(null);return}N(!0),g(null);try{let f=await X.query(mr,{direction:w,dryRun:h,id:a},B(c));p(f),o.refetch()}catch(f){p(null),g(F(f))}finally{N(!1)}},"K"),R=s(()=>{T(nr())},"N"),sr=s(a=>{Z(a.target.value)},"T"),or=s(a=>{rr(a.target.value==="down"?"down":"up")},"B"),dr=s(a=>{er(a.target.checked)},"F");return(0,r.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(U,{onChange:Y,testId:"mg-shard-input",value:c}),(0,r.jsx)(Q,{message:tr,prefix:"mg"})]}),ar!==null&&(0,r.jsx)(_,{error:ir,testId:"mg-status-error"}),l!==null&&l.length===0&&(0,r.jsx)(z,{description:e("Data migrations you run against this shard will be tracked here."),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 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:e("No migrations have run on this shard.")}),l!==null&&l.length>0&&(0,r.jsx)(j,{className:"overflow-hidden py-0",children:(0,r.jsx)(K,{className:"px-0",children:(0,r.jsxs)($,{"data-testid":"mg-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(t,{children:e("id")}),(0,r.jsx)(t,{children:e("direction")}),(0,r.jsx)(t,{children:e("status")}),(0,r.jsx)(t,{children:e("processed")}),(0,r.jsx)(t,{children:e("changed")}),(0,r.jsx)(t,{children:e("updated")}),(0,r.jsx)(t,{children:e("error")})]})}),(0,r.jsx)(H,{children:l.map(a=>(0,r.jsxs)(x,{"data-testid":`mg-row-${a.id}`,children:[(0,r.jsx)(n,{children:a.id}),(0,r.jsx)(n,{children:a.direction}),(0,r.jsx)(n,{children:(0,r.jsx)(E,{variant:"secondary",children:a.status})}),(0,r.jsx)(n,{children:a.processed}),(0,r.jsx)(n,{children:a.changed}),(0,r.jsx)(n,{children:q(a.updatedAt)}),(0,r.jsx)(n,{children:a.error??""})]},a.id))})]})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,r.jsx)(y,{children:e("Run migration")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(S,{"aria-label":e("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:sr,placeholder:e("migration id"),value:b}),(0,r.jsxs)("select",{"aria-label":e("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:or,value:w,children:[(0,r.jsx)("option",{value:"up",children:e("up")}),(0,r.jsx)("option",{value:"down",children:e("down")})]}),(0,r.jsxs)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,r.jsx)("input",{checked:h,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dr,type:"checkbox"}),e("Dry run")]}),h?(0,r.jsx)(D,{"data-testid":"mg-run",disabled:m||!C,onClick:R,size:"sm",type:"button",children:e(m?"Running\u2026":"Run")}):(0,r.jsx)(J,{confirmLabel:e(m?"Running\u2026":"Run migration?"),disabled:m||!C,onConfirm:R,testId:"mg-run",children:e("Run")})]})]}),k!==null&&(0,r.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:k}),d!==null&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?e("Dry run: "):"",e("{status} \u2014 processed",{status:d.status}),d.processed,e(", changed"),d.changed]})]})},"Er");export{Sr as MigrationsPanel};
1
+ import{a as Q}from"./chunk-X2FQ6B5V.js";import{a as J}from"./chunk-7LQWFOEU.js";import{a as W}from"./chunk-LFKCLLPT.js";import{a as _}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as O}from"./chunk-OWADN6BI.js";import{a as $,b as G,c as H,d as x,e as t,f as n}from"./chunk-MIQTKZAR.js";import{a as j,e as K}from"./chunk-UZERI5YC.js";import{a as y}from"./chunk-5Y3QLNWX.js";import{a as U}from"./chunk-LFXFP4IF.js";import{b as P}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as S}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as D}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as E}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as v}from"./chunk-GXZAXNZI.js";import{f as L}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as z}from"./chunk-XQCVZAGU.js";import{d as M,f as A,g as B,h as F,m as T,q}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as s,e as I,f as lr,h as cr}from"./chunk-3XIESWL4.js";var i=I(lr(),1);var r=I(cr(),1);var mr=A(v.runMigration),Sr=s(({initialShardKey:V})=>{let X=L(),e=M(),[c,Y]=(0,i.useState)(V??""),[b,Z]=(0,i.useState)(""),[w,rr]=(0,i.useState)("up"),[h,er]=(0,i.useState)(!0),[m,N]=(0,i.useState)(!1),[d,p]=(0,i.useState)(null),[k,g]=(0,i.useState)(null),u=W(c.trim(),400),C=c.trim()===u,o=O(v.migrationStatus,{},{live:!0,shardKey:u}),l=o.data?.migrations??null,ar=o.error,{errorSource:ir,liveError:tr}=o;(0,i.useEffect)(()=>{o.data!==void 0&&P(u)},[o.data,u]);let nr=s(async()=>{let a=b.trim();if(a===""){g(e("Enter a migration id")),p(null);return}N(!0),g(null);try{let f=await X.query(mr,{direction:w,dryRun:h,id:a},B(c));p(f),o.refetch()}catch(f){p(null),g(F(f))}finally{N(!1)}},"K"),R=s(()=>{T(nr())},"N"),sr=s(a=>{Z(a.target.value)},"T"),or=s(a=>{rr(a.target.value==="down"?"down":"up")},"B"),dr=s(a=>{er(a.target.checked)},"F");return(0,r.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-migrations",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(U,{onChange:Y,testId:"mg-shard-input",value:c}),(0,r.jsx)(Q,{message:tr,prefix:"mg"})]}),ar!==null&&(0,r.jsx)(_,{error:ir,testId:"mg-status-error"}),l!==null&&l.length===0&&(0,r.jsx)(z,{description:e("Data migrations you run against this shard will be tracked here."),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 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})}),testId:"mg-empty",title:e("No migrations have run on this shard.")}),l!==null&&l.length>0&&(0,r.jsx)(j,{className:"overflow-hidden py-0",children:(0,r.jsx)(K,{className:"px-0",children:(0,r.jsxs)($,{"data-testid":"mg-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(t,{children:e("id")}),(0,r.jsx)(t,{children:e("direction")}),(0,r.jsx)(t,{children:e("status")}),(0,r.jsx)(t,{children:e("processed")}),(0,r.jsx)(t,{children:e("changed")}),(0,r.jsx)(t,{children:e("updated")}),(0,r.jsx)(t,{children:e("error")})]})}),(0,r.jsx)(H,{children:l.map(a=>(0,r.jsxs)(x,{"data-testid":`mg-row-${a.id}`,children:[(0,r.jsx)(n,{children:a.id}),(0,r.jsx)(n,{children:a.direction}),(0,r.jsx)(n,{children:(0,r.jsx)(E,{variant:"secondary",children:a.status})}),(0,r.jsx)(n,{children:a.processed}),(0,r.jsx)(n,{children:a.changed}),(0,r.jsx)(n,{children:q(a.updatedAt)}),(0,r.jsx)(n,{children:a.error??""})]},a.id))})]})})}),(0,r.jsxs)("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs",children:[(0,r.jsx)(y,{children:e("Run migration")}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsx)(S,{"aria-label":e("Migration id"),className:"w-auto","data-testid":"mg-id-input",onChange:sr,placeholder:e("migration id"),value:b}),(0,r.jsxs)("select",{"aria-label":e("Direction"),className:"flex h-9 rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"mg-direction",onChange:or,value:w,children:[(0,r.jsx)("option",{value:"up",children:e("up")}),(0,r.jsx)("option",{value:"down",children:e("down")})]}),(0,r.jsxs)(y,{className:"flex items-center gap-1.5",htmlFor:"mg-dry-run",children:[(0,r.jsx)("input",{checked:h,className:"size-4 accent-primary","data-testid":"mg-dry-run",id:"mg-dry-run",onChange:dr,type:"checkbox"}),e("Dry run")]}),h?(0,r.jsx)(D,{"data-testid":"mg-run",disabled:m||!C,onClick:R,size:"sm",type:"button",children:e(m?"Running\u2026":"Run")}):(0,r.jsx)(J,{confirmLabel:e(m?"Running\u2026":"Run migration?"),disabled:m||!C,onConfirm:R,testId:"mg-run",children:e("Run")})]})]}),k!==null&&(0,r.jsx)("pre",{className:"text-sm text-destructive whitespace-pre-wrap","data-testid":"mg-run-error",role:"alert",children:k}),d!==null&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground","data-testid":"mg-run-result",children:[d.dryRun?e("Dry run: "):"",e("{status} \u2014 processed",{status:d.status}),d.processed,e(", changed"),d.changed]})]})},"Er");export{Sr as MigrationsPanel};
@@ -0,0 +1 @@
1
+ import{e as F,f as Z}from"./chunk-3XIESWL4.js";var m=[["path",{d:"M18 9.00005C18 9.00005 13.5811 15 12 15C10.4188 15 6 9 6 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var A=[["path",{d:"M17.9998 15C17.9998 15 13.5809 9.00001 11.9998 9C10.4187 8.99999 5.99985 15 5.99985 15",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var B=[["path",{d:"M18 6L6.00081 17.9992M17.9992 18L6 6.00085",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var f=[["path",{d:"M9 15C9 12.1716 9 10.7574 9.87868 9.87868C10.7574 9 12.1716 9 15 9L16 9C18.8284 9 20.2426 9 21.1213 9.87868C22 10.7574 22 12.1716 22 15V16C22 18.8284 22 20.2426 21.1213 21.1213C20.2426 22 18.8284 22 16 22H15C12.1716 22 10.7574 22 9.87868 21.1213C9 20.2426 9 18.8284 9 16L9 15Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.9999 9C16.9975 6.04291 16.9528 4.51121 16.092 3.46243C15.9258 3.25989 15.7401 3.07418 15.5376 2.90796C14.4312 2 12.7875 2 9.5 2C6.21252 2 4.56878 2 3.46243 2.90796C3.25989 3.07417 3.07418 3.25989 2.90796 3.46243C2 4.56878 2 6.21252 2 9.5C2 12.7875 2 14.4312 2.90796 15.5376C3.07417 15.7401 3.25989 15.9258 3.46243 16.092C4.51121 16.9528 6.04291 16.9975 9 16.9999",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var w=[["path",{d:"M2.99969 17.0002C2.99969 17.9302 2.99969 18.3952 3.10192 18.7767C3.37932 19.8119 4.18796 20.6206 5.22324 20.898C5.60474 21.0002 6.06972 21.0002 6.99969 21.0002L16.9997 21.0002C17.9297 21.0002 18.3947 21.0002 18.7762 20.898C19.8114 20.6206 20.6201 19.8119 20.8975 18.7767C20.9997 18.3952 20.9997 17.9302 20.9997 17.0002",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M16.4998 11.5002C16.4998 11.5002 13.1856 16.0002 11.9997 16.0002C10.8139 16.0002 7.49976 11.5002 7.49976 11.5002M11.9997 15.0002V3.00016",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var P=[["path",{d:"M17 17L21 21",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11C3 15.4183 6.58172 19 11 19C15.4183 19 19 15.4183 19 11Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var D=[["path",{d:"M21.0477 3.05293C18.8697 0.707363 2.48648 6.4532 2.50001 8.551C2.51535 10.9299 8.89809 11.6617 10.6672 12.1581C11.7311 12.4565 12.016 12.7625 12.2613 13.8781C13.3723 18.9305 13.9301 21.4435 15.2014 21.4996C17.2278 21.5892 23.1733 5.342 21.0477 3.05293Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M11.4999 12.5L14.9999 9",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var T=[["path",{d:"M2 12C2 8.31087 2 6.4663 2.81382 5.15877C3.1149 4.67502 3.48891 4.25427 3.91891 3.91554C5.08116 3 6.72077 3 10 3H14C17.2792 3 18.9188 3 20.0811 3.91554C20.5111 4.25427 20.8851 4.67502 21.1862 5.15877C22 6.4663 22 8.31087 22 12C22 15.6891 22 17.5337 21.1862 18.8412C20.8851 19.325 20.5111 19.7457 20.0811 20.0845C18.9188 21 17.2792 21 14 21H10C6.72077 21 5.08116 21 3.91891 20.0845C3.48891 19.7457 3.1149 19.325 2.81382 18.8412C2 17.5337 2 15.6891 2 12Z",stroke:"currentColor",strokeWidth:"1.5",key:"0"}],["path",{d:"M9.5 3L9.5 21",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}],["path",{d:"M5 7H6M5 10H6",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"2"}]];var R=[["path",{d:"M5 14L8.5 17.5L19 6.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}]];var b=[["path",{d:"M18 14C18 14 13.5811 19 12 19C10.4188 19 6 14 6 14",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"0"}],["path",{d:"M18 9.99996C18 9.99996 13.5811 5.00001 12 5C10.4188 4.99999 6 10 6 10",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5",key:"1"}]];var e=F(Z(),1),g={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none"},L=(0,e.forwardRef)(({color:t="currentColor",size:n=24,strokeWidth:C,absoluteStrokeWidth:h=!1,className:p="",altIcon:d,showAlt:M=!1,icon:l,primaryColor:s,secondaryColor:k,disableSecondaryOpacity:y=!1,...W},j)=>{let c=C!==void 0?h?Number(C)*24/Number(n):C:void 0,u=c!==void 0?{strokeWidth:c,stroke:"currentColor"}:{},I={ref:j,...g,width:n,height:n,color:s||t,className:p,...u,...W},H=[...M&&d?d:l].sort(([,i],[,o])=>{let r=i.opacity!==void 0;return o.opacity!==void 0?1:r?-1:0}).map(([i,o])=>{let r=o.opacity!==void 0,a=r&&!y?o.opacity:void 0,V=k?{...o.stroke!==void 0?{stroke:r?k:s||t}:{fill:r?k:s||t}}:{};return(0,e.createElement)(i,{...o,...u,...V,opacity:a,key:o.key})});return(0,e.createElement)("svg",I,H)});L.displayName="HugeiconsIcon";export{m as a,A as b,B as c,f as d,w as e,P as f,D as g,T as h,R as i,b as j,L as k};
@@ -1 +1 @@
1
- import{a as u,b as d}from"./chunk-OTJOI23O.js";import"./chunk-SEDZDNQF.js";import"./chunk-TYTJDFX2.js";import"./chunk-KSRXMTBV.js";import"./chunk-46IB4C4Q.js";import"./chunk-UDZY7MKE.js";import{a as c,e as f,g as p,h as y}from"./chunk-UHHTEBC3.js";var h=f(p(),1);var n=f(y(),1);var b={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},_=c(o=>{let e=(0,h.c)(6),{data:i}=o,a,r;if(e[0]!==i){r=Symbol.for("react.early_return_sentinel");e:{let m=i.slice(-16);if(m.length<3){r=null;break e}a=m.map(g)}e[0]=i,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;let s=a,t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)(d,{dataKey:"value"}),e[3]=t):t=e[3];let l;return e[4]!==s?(l=(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28",children:(0,n.jsx)(u,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:b,data:s,children:t})}),e[4]=s,e[5]=l):l=e[5],l},"b");function g(o,e){return{index:e,value:o}}c(g,"h");export{_ as Sparkline};
1
+ import{a as u,b as d}from"./chunk-PF7V3G2Z.js";import"./chunk-4UOFSGUS.js";import"./chunk-ILNELDFC.js";import"./chunk-T6VMSOBB.js";import"./chunk-7QIFDWQV.js";import"./chunk-LE56LPNH.js";import{a as c,e as f,g as p,h as y}from"./chunk-3XIESWL4.js";var h=f(p(),1);var n=f(y(),1);var b={value:{colors:{dark:["var(--foreground)"],light:["var(--foreground)"]},label:""}},_=c(o=>{let e=(0,h.c)(6),{data:i}=o,a,r;if(e[0]!==i){r=Symbol.for("react.early_return_sentinel");e:{let m=i.slice(-16);if(m.length<3){r=null;break e}a=m.map(g)}e[0]=i,e[1]=a,e[2]=r}else a=e[1],r=e[2];if(r!==Symbol.for("react.early_return_sentinel"))return r;let s=a,t;e[3]===Symbol.for("react.memo_cache_sentinel")?(t=(0,n.jsx)(d,{dataKey:"value"}),e[3]=t):t=e[3];let l;return e[4]!==s?(l=(0,n.jsx)("div",{"aria-hidden":"true",className:"h-8 w-28",children:(0,n.jsx)(u,{animationType:"none",barCategoryGap:1,className:"h-8 w-full",config:b,data:s,children:t})}),e[4]=s,e[5]=l):l=e[5],l},"b");function g(o,e){return{index:e,value:o}}c(g,"h");export{_ as Sparkline};
@@ -1 +1 @@
1
- import{a as n}from"./chunk-UHHTEBC3.js";var r=n(t=>{if(typeof t=="string")return t;try{return JSON.stringify(t)??String(t)}catch{return String(t)}},"i"),o=n(t=>typeof t!="object"||t===null||Array.isArray(t)?"":Object.entries(t).map(([e,i])=>`${e}=${r(i)}`).join(" "),"o");export{o as a};
1
+ import{a as n}from"./chunk-3XIESWL4.js";var r=n(t=>{if(typeof t=="string")return t;try{return JSON.stringify(t)??String(t)}catch{return String(t)}},"i"),o=n(t=>typeof t!="object"||t===null||Array.isArray(t)?"":Object.entries(t).map(([e,i])=>`${e}=${r(i)}`).join(" "),"o");export{o as a};
@@ -1 +1 @@
1
- import{a as z}from"./chunk-ZMFZRGAN.js";import{a as be}from"./chunk-6I62RSI5.js";import{a as we}from"./chunk-XDKFPBIL.js";import{a as te}from"./chunk-SKHEGARW.js";import{b as xe}from"./chunk-725RLB7D.js";import{a as U}from"./chunk-YQ5PILIJ.js";import{a as ge}from"./chunk-Q34MSC2F.js";import"./chunk-4AYEV5UN.js";import{b as Z}from"./chunk-SKJZDOHG.js";import{a as fe,b as pe,c as ve,d as re,e as T,f as M}from"./chunk-Q5WXTZWX.js";import{a as he}from"./chunk-V66TSUKV.js";import{b as me}from"./chunk-UWF5DOGV.js";import"./chunk-PTTDIYGP.js";import{R as q}from"./chunk-7Z5QEFR4.js";import"./chunk-46IB4C4Q.js";import{c as ce}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import{b as $}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as ee}from"./chunk-GXZAXNZI.js";import{f as de}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as D}from"./chunk-6OKDCV7J.js";import{d as H,h as J,i as ue,m as X}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as n,e as Y,f as Be,g as Ve,h as Ge,j as _}from"./chunk-UHHTEBC3.js";var F=Y(Ve(),1);var b=Y(Be(),1);var t=Y(Ge(),1);var Ce=["trace","debug","log","info","warn","error","fatal"],Qe="LOG_ARCHIVE_NOT_CONFIGURED",Le={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},Ye={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},He=n((l,e)=>{switch(e.type){case"append":return{...l,cursor:e.cursor,error:null,loading:!1,rows:[...l.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{...l,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...l,error:e.message,loading:!1};default:return l}},"Je"),Je=n(l=>{let e=(0,F.c)(33),{row:r}=l,o;e[0]!==r.fields?(o=z(r.fields),e[0]=r.fields,e[1]=o):o=e[1];let i=o,a=`lg-archive-row-${String(r.ts)}`,d;e[2]!==r.ts?(d=new Date(r.ts).toLocaleString(),e[2]=r.ts,e[3]=d):d=e[3];let m;e[4]!==d?(m=(0,t.jsx)(M,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:d}),e[4]=d,e[5]=m):m=e[5];let x=Le[r.level],u;e[6]!==r.level||e[7]!==x?(u=(0,t.jsx)(M,{children:(0,t.jsx)($,{variant:x,children:r.level})}),e[6]=r.level,e[7]=x,e[8]=u):u=e[8];let c;e[9]!==r.functionPath?(c=(0,t.jsx)(M,{className:"font-mono text-xs",children:r.functionPath}),e[9]=r.functionPath,e[10]=c):c=e[10];let w;e[11]!==r.message?(w=(0,t.jsx)("div",{className:"truncate",title:r.message,children:r.message}),e[11]=r.message,e[12]=w):w=e[12];let p;e[13]!==i?(p=i!==""&&(0,t.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=p):p=e[14];let h;e[15]!==w||e[16]!==p?(h=(0,t.jsxs)(M,{className:"max-w-md",children:[w,p]}),e[15]=w,e[16]=p,e[17]=h):h=e[17];let g=r.traceId??"\u2014",v;e[18]!==g?(v=(0,t.jsx)(M,{className:"font-mono text-[11px] text-muted-foreground",children:g}),e[18]=g,e[19]=v):v=e[19];let C=r.shardKey??"\u2014",f;e[20]!==C?(f=(0,t.jsx)(M,{className:"font-mono text-[11px] text-muted-foreground",children:C}),e[20]=C,e[21]=f):f=e[21];let y=r.userId??"\u2014",N;e[22]!==y?(N=(0,t.jsx)(M,{className:"font-mono text-[11px] text-muted-foreground",children:y}),e[22]=y,e[23]=N):N=e[23];let L;return e[24]!==h||e[25]!==v||e[26]!==f||e[27]!==N||e[28]!==a||e[29]!==m||e[30]!==u||e[31]!==c?(L=(0,t.jsxs)(re,{"data-testid":a,children:[m,u,c,h,v,f,N]}),e[24]=h,e[25]=v,e[26]=f,e[27]=N,e[28]=a,e[29]=m,e[30]=u,e[31]=c,e[32]=L):L=e[32],L},"Xe"),Xe=n(({shardKey:l})=>{let e=de(),r=H(),[o,i]=(0,b.useState)(""),[a,d]=(0,b.useState)(""),[m,x]=(0,b.useState)(""),[{cursor:u,error:c,loading:w,notConfigured:p,rows:h},g]=(0,b.useReducer)(He,Ye),v=U(o.trim(),400),C=U(a.trim(),400),f={...v===""?{}:{functionPathPrefix:v},...m===""?{}:{minLevel:m},...l===""?{}:{shardKey:l},...C===""?{}:{userId:C}},y=JSON.stringify(f),N=(0,b.useRef)(y);(0,b.useEffect)(()=>{let k={cancelled:!1};return N.current=y,X((async()=>{g({type:"loading"});try{let S=await e.queryLogArchive(f);k.cancelled||g({cursor:S.nextCursor,rows:S.rows,type:"loaded"})}catch(S){k.cancelled||g(ue(S)===Qe?{type:"notConfigured"}:{message:J(S),type:"failed"})}})()),()=>{k.cancelled=!0}},[e,y]);let L=n(async()=>{if(u===void 0)return;let k=y;g({type:"loading"});try{let S=await e.queryLogArchive({...f,cursor:u});N.current===k&&g({cursor:S.nextCursor,rows:S.rows,type:"append"})}catch(S){N.current===k&&g({message:J(S),type:"pageFailed"})}},"C"),P=n(k=>{i(k.target.value)},"R"),I=n(k=>{d(k.target.value)},"S"),R=n(k=>{x(k.target.value)},"I"),E=n(()=>{X(L())},"E");return p?(0,t.jsx)(D,{action:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:te,rel:"noreferrer",target:"_blank",children:r("Open in Cloudflare")}),description:r("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:r("Log archive not configured")}):(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":r("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:P,placeholder:r("function path\u2026"),value:o}),(0,t.jsx)(q,{"aria-label":r("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:I,placeholder:r("user id\u2026"),value:a}),(0,t.jsxs)("select",{"aria-label":r("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:R,value:m,children:[(0,t.jsx)("option",{value:"",children:r("min level")}),Ce.map(k=>(0,t.jsx)("option",{value:k,children:k},k))]})]}),c!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:c}),w&&h===null&&c===null&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:r("Loading\u2026")}),h!==null&&h.length===0&&(0,t.jsx)(D,{description:r("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:r("No archived logs.")}),h!==null&&h.length>0&&(0,t.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,t.jsxs)(fe,{"data-testid":"lg-archive-table",children:[(0,t.jsx)(pe,{children:(0,t.jsxs)(re,{children:[(0,t.jsx)(T,{children:r("Time")}),(0,t.jsx)(T,{children:r("Level")}),(0,t.jsx)(T,{children:r("Function")}),(0,t.jsx)(T,{children:r("Message")}),(0,t.jsx)(T,{children:r("Trace")}),(0,t.jsx)(T,{children:r("Shard")}),(0,t.jsx)(T,{children:r("User")})]})}),(0,t.jsx)(ve,{children:h.map((k,S)=>(0,t.jsx)(Je,{row:k},`${String(k.ts)}-${String(S)}`))})]})}),u!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"lg-archive-more",disabled:w,onClick:E,size:"sm",variant:"outline",children:r(w?"Loading\u2026":"Load more")})})]})},"Ze"),ae=400,Ze=36,er={height:ae,overflow:"auto"},Se={left:0,position:"absolute",top:0,width:"100%"},rr={error:"destructive",ok:"secondary"},tr=n(l=>{let e=(0,F.c)(26),{entry:r,index:o,measureRef:i,start:a}=l,d=`translateY(${String(a)}px)`,m;e[0]!==d?(m={...Se,transform:d},e[0]=d,e[1]=m):m=e[1];let x=m,u;e[2]!==r.fields?(u=z(r.fields),e[2]=r.fields,e[3]=u):u=e[3];let c=u,w;e[4]!==r.timestamp?(w=new Date(r.timestamp).toLocaleString(),e[4]=r.timestamp,e[5]=w):w=e[5];let p;e[6]!==w?(p=(0,t.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:w}),e[6]=w,e[7]=p):p=e[7];let h=Le[r.level],g;e[8]!==r.level||e[9]!==h?(g=(0,t.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,t.jsx)($,{variant:h,children:r.level})}),e[8]=r.level,e[9]=h,e[10]=g):g=e[10];let v=r.functionPath??"\u2014",C;e[11]!==v?(C=(0,t.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:v}),e[11]=v,e[12]=C):C=e[12];let f;e[13]!==c?(f=c===""?null:(0,t.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[13]=c,e[14]=f):f=e[14];let y;e[15]!==r.message||e[16]!==f?(y=(0,t.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[r.message,f]}),e[15]=r.message,e[16]=f,e[17]=y):y=e[17];let N;return e[18]!==o||e[19]!==i||e[20]!==x||e[21]!==y||e[22]!==p||e[23]!==g||e[24]!==C?(N=(0,t.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":o,"data-testid":"lg-row",ref:i,role:"row",style:x,children:[p,g,C,y]}),e[18]=o,e[19]=i,e[20]=x,e[21]=y,e[22]=p,e[23]=g,e[24]=C,e[25]=N):N=e[25],N},"ar"),ye=n(l=>l.length===0?"\u2014":l.join(", "),"oe"),ar=n(l=>{let e=(0,F.c)(37),{entry:r,index:o,measureRef:i,start:a}=l,d=`translateY(${String(a)}px)`,m;e[0]!==d?(m={...Se,transform:d},e[0]=d,e[1]=m):m=e[1];let x=m,u;e[2]!==r.ts?(u=new Date(r.ts).toLocaleString(),e[2]=r.ts,e[3]=u):u=e[3];let c;e[4]!==u?(c=(0,t.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u}),e[4]=u,e[5]=c):c=e[5];let w=rr[r.outcome],p;e[6]!==r.outcome||e[7]!==w?(p=(0,t.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,t.jsx)($,{variant:w,children:r.outcome})}),e[6]=r.outcome,e[7]=w,e[8]=p):p=e[8];let h;e[9]!==r.functionPath?(h=(0,t.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:r.functionPath,children:r.functionPath}),e[9]=r.functionPath,e[10]=h):h=e[10];let g=r.shardKey??"\u2014",v;e[11]!==g?(v=(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:g}),e[11]=g,e[12]=v):v=e[12];let C=r.userId??"\u2014",f;e[13]!==C?(f=(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C}),e[13]=C,e[14]=f):f=e[14];let y;e[15]!==r.durationMs?(y=Math.round(r.durationMs),e[15]=r.durationMs,e[16]=y):y=e[16];let N=`${String(y)}ms`,L;e[17]!==N?(L=(0,t.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:N}),e[17]=N,e[18]=L):L=e[18];let P;e[19]!==r.errorMessage||e[20]!==r.outcome||e[21]!==r.tablesRead||e[22]!==r.tablesWritten?(P=r.outcome==="error"&&r.errorMessage!==void 0?r.errorMessage:`r:${ye(r.tablesRead)} \xB7 w:${ye(r.tablesWritten)}`,e[19]=r.errorMessage,e[20]=r.outcome,e[21]=r.tablesRead,e[22]=r.tablesWritten,e[23]=P):P=e[23];let I;e[24]!==P?(I=(0,t.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:P}),e[24]=P,e[25]=I):I=e[25];let R;return e[26]!==o||e[27]!==i||e[28]!==x||e[29]!==f||e[30]!==L||e[31]!==I||e[32]!==c||e[33]!==p||e[34]!==h||e[35]!==v?(R=(0,t.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":o,"data-testid":"lg-req-row",ref:i,role:"row",style:x,children:[c,p,h,v,f,L,I]}),e[26]=o,e[27]=i,e[28]=x,e[29]=f,e[30]=L,e[31]=I,e[32]=c,e[33]=p,e[34]=h,e[35]=v,e[36]=R):R=e[36],R},"lr"),Ne=n(l=>{let{entries:e}=l??{};return Array.isArray(e)?e:[]},"se"),lr=n(l=>{let e={};return l.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=l.functionPathPrefix.trim()),l.userId.trim()!==""&&(e.userId=l.userId.trim()),l.tableTouched.trim()!==""&&(e.tableTouched=l.tableTouched.trim()),(l.outcome==="ok"||l.outcome==="error")&&(e.outcome=l.outcome),e},"or"),Ie=Ce,sr={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},or=n((l,e)=>{let r=e.search.trim().toLowerCase(),o=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-sr[e.range];return l.filter(a=>e.levels.size>0&&!e.levels.has(a.level)||a.timestamp<i||o!==""&&!(a.functionPath??"").toLowerCase().includes(o)?!1:r===""||a.message.toLowerCase().includes(r)||z(a.fields).toLowerCase().includes(r))},"nr"),nr="\u2014",ir=n(l=>{let e=new Map,r=new Map;for(let a of l){e.set(a.level,(e.get(a.level)??0)+1);let d=a.functionPath??nr;r.set(d,(r.get(d)??0)+1)}let o=Ie.filter(a=>e.has(a)).map(a=>({count:e.get(a)??0,key:a})),i=[...r.entries()].map(([a,d])=>({count:d,key:a})).toSorted((a,d)=>d.count===a.count?a.key.localeCompare(d.key):d.count-a.count);return{byLevel:o,byPath:i,total:l.length}},"dr"),dr=n(l=>{let e=(0,F.c)(11),{level:r,onToggle:o,selected:i}=l,a;e[0]!==r||e[1]!==o?(a=n(()=>{o(r)},"a"),e[0]=r,e[1]=o,e[2]=a):a=e[2];let d=a,m=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",x;e[3]!==m?(x=_("rounded-md border px-2 py-1 text-xs",m),e[3]=m,e[4]=x):x=e[4];let u=`logs-level-${r}`,c;return e[5]!==r||e[6]!==d||e[7]!==i||e[8]!==x||e[9]!==u?(c=(0,t.jsx)("button",{"aria-pressed":i,className:x,"data-testid":u,onClick:d,type:"button",children:r}),e[5]=r,e[6]=d,e[7]=i,e[8]=x,e[9]=u,e[10]=c):c=e[10],c},"cr"),ke=n(l=>{let e=(0,F.c)(7),{bucket:r}=l,o;e[0]!==r.key?(o=(0,t.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:r.key}),e[0]=r.key,e[1]=o):o=e[1];let i;e[2]!==r.count?(i=(0,t.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:r.count}),e[2]=r.count,e[3]=i):i=e[3];let a;return e[4]!==o||e[5]!==i?(a=(0,t.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:[o,i]}),e[4]=o,e[5]=i,e[6]=a):a=e[6],a},"ne"),qr=n(({initialShardKey:l})=>{let e=H(),[r,o]=(0,b.useState)("requests"),[i,a]=(0,b.useState)(l??""),[d,m]=(0,b.useState)(""),[x,u]=(0,b.useState)(()=>new Set),[c,w]=(0,b.useState)(""),[p,h]=(0,b.useState)("all"),[g,v]=(0,b.useState)(!1),[C,f]=(0,b.useState)(""),[y,N]=(0,b.useState)(""),[L,P]=(0,b.useState)(""),[I,R]=(0,b.useState)("all"),E=U(i.trim(),400),k=lr({functionPathPrefix:C,outcome:I,tableTouched:L,userId:y}),S=Z(ee.getRequestLog,k,{enabled:r==="requests",live:!0,shardKey:E}),le=Z(ee.getLogs,{},{enabled:r==="errors",live:!0,shardKey:E}),W=r==="requests"?S:le,{error:se,errorSource:Pe,isLoading:oe,liveError:Re}=W,qe=Ne(le.data),ne=Ne(S.data);(0,b.useEffect)(()=>{W.data!==void 0&&me(E)},[W.data,E]);let j=or(qe,{levels:x,now:Date.now(),path:c,range:p,search:d}),B=ir(j),V=r==="requests"?ne.length:j.length,G=r==="errors"&&g,K=(0,b.useMemo)(()=>se!==null?"error":V===0?oe?G?"summary":"list":"empty":G?"summary":"list",[V,oe,se,G]),ie=(0,b.useRef)(null),A=xe({count:V,estimateSize:n(()=>Ze,"estimateSize"),getScrollElement:n(()=>ie.current,"getScrollElement"),initialRect:{height:ae,width:800},observeElementRect:n((s,Q)=>we(s,Q,ae),"observeElementRect"),overscan:8}),Te=A.getVirtualItems(),Me={height:A.getTotalSize(),position:"relative",width:"100%"},Ee=n(s=>{m(s.target.value)},"Ne"),_e=n(s=>{u(Q=>{let O=new Set(Q);return O.has(s)?O.delete(s):O.add(s),O})},"Le"),Fe=n(s=>{w(s.target.value)},"Ce"),Ke=n(s=>{h(s.target.value)},"ke"),Ae=n(()=>{v(s=>!s)},"$e"),Oe=n(s=>{f(s.target.value)},"Se"),$e=n(s=>{N(s.target.value)},"Re"),De=n(s=>{P(s.target.value)},"Ie"),Ue=n(s=>{R(s.target.value)},"Ee"),ze=n(()=>{o("requests"),v(!1)},"Pe"),We=n(()=>{o("errors"),v(!1)},"Te"),je=n(()=>{o("archive"),v(!1)},"_e");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[(0,t.jsx)("button",{"aria-selected":r==="requests",className:_("px-3 py-1 text-sm",r==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:ze,role:"tab",type:"button",children:e("Requests")}),(0,t.jsx)("button",{"aria-selected":r==="errors",className:_("px-3 py-1 text-sm",r==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:We,role:"tab",type:"button",children:e("Errors")}),(0,t.jsx)("button",{"aria-selected":r==="archive",className:_("px-3 py-1 text-sm",r==="archive"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-archive",onClick:je,role:"tab",type:"button",children:e("Archive")})]}),(0,t.jsx)(he,{onChange:a,testId:"lg-shard-input",value:i}),r!=="archive"&&(0,t.jsx)(be,{message:Re,prefix:"lg"}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:te,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")})]}),r==="errors"&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:Ee,placeholder:e("search message"),value:d}),(0,t.jsx)(q,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:Fe,placeholder:e("filter path"),value:c}),(0,t.jsx)("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:Ie.map(s=>(0,t.jsx)(dr,{level:s,onToggle:_e,selected:x.has(s)},s))}),(0,t.jsxs)("select",{"aria-label":e("Time range"),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:Ke,value:p,children:[(0,t.jsx)("option",{value:"all",children:e("All time")}),(0,t.jsx)("option",{value:"5m",children:e("Last 5m")}),(0,t.jsx)("option",{value:"15m",children:e("Last 15m")}),(0,t.jsx)("option",{value:"1h",children:e("Last hour")})]}),(0,t.jsx)("button",{"aria-pressed":g,className:_("h-8 rounded-md border px-3 text-sm",g?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:Ae,type:"button",children:e(g?"List":"Summary")})]}),r==="requests"&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:Oe,placeholder:e("file:function"),value:C}),(0,t.jsx)(q,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:$e,placeholder:e("userId"),value:y}),(0,t.jsx)(q,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:De,placeholder:e("table"),value:L}),(0,t.jsxs)("select",{"aria-label":e("Outcome filter"),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:Ue,value:I,children:[(0,t.jsx)("option",{value:"all",children:e("all")}),(0,t.jsx)("option",{value:"ok",children:e("ok")}),(0,t.jsx)("option",{value:"error",children:e("error")})]})]}),r==="archive"?(0,t.jsx)(Xe,{shardKey:E}):(0,t.jsxs)(t.Fragment,{children:[K==="error"&&(0,t.jsx)(ge,{error:Pe,testId:"lg-error"}),K==="empty"&&(0,t.jsx)(D,{description:e("Function and request logs for this shard show up here as your app handles traffic."),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 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),K==="summary"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:B.total})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")}),(0,t.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:B.byLevel.map(s=>(0,t.jsx)(ke,{bucket:s},s.key))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")}),(0,t.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:B.byPath.map(s=>(0,t.jsx)(ke,{bucket:s},s.key))})]})]}),K==="list"&&(0,t.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:ie,style:er,children:(0,t.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Me,children:Te.map(s=>r==="requests"?(0,t.jsx)(ar,{entry:ne[s.index],index:s.index,measureRef:A.measureElement,start:s.start},s.key):(0,t.jsx)(tr,{entry:j[s.index],index:s.index,measureRef:A.measureElement,start:s.start},s.key))})})]})]})},"qr");export{qr as LogsPanel,or as filterLogs,ir as summarizeLogs};
1
+ import{a as z}from"./chunk-QWGT25SE.js";import{a as be}from"./chunk-X2FQ6B5V.js";import{a as we}from"./chunk-ZJGP6EKR.js";import{a as te}from"./chunk-SKHEGARW.js";import{b as xe}from"./chunk-AVAC26HJ.js";import{a as U}from"./chunk-LFKCLLPT.js";import{a as ge}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as Z}from"./chunk-OWADN6BI.js";import{a as fe,b as pe,c as ve,d as re,e as T,f as M}from"./chunk-MIQTKZAR.js";import{a as he}from"./chunk-LFXFP4IF.js";import{b as me}from"./chunk-GRL5MG3Z.js";import"./chunk-7T7UOTYK.js";import{R as q}from"./chunk-CFPZYHPY.js";import"./chunk-7QIFDWQV.js";import{c as ce}from"./chunk-FXCBF4XT.js";import"./chunk-2OUPA2WJ.js";import{b as $}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as ee}from"./chunk-GXZAXNZI.js";import{f as de}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as D}from"./chunk-XQCVZAGU.js";import{d as H,h as J,i as ue,m as X}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as n,e as Y,f as Be,g as Ve,h as Ge,j as _}from"./chunk-3XIESWL4.js";var F=Y(Ve(),1);var b=Y(Be(),1);var t=Y(Ge(),1);var Ce=["trace","debug","log","info","warn","error","fatal"],Qe="LOG_ARCHIVE_NOT_CONFIGURED",Le={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},Ye={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},He=n((l,e)=>{switch(e.type){case"append":return{...l,cursor:e.cursor,error:null,loading:!1,rows:[...l.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{...l,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...l,error:e.message,loading:!1};default:return l}},"Je"),Je=n(l=>{let e=(0,F.c)(33),{row:r}=l,o;e[0]!==r.fields?(o=z(r.fields),e[0]=r.fields,e[1]=o):o=e[1];let i=o,a=`lg-archive-row-${String(r.ts)}`,d;e[2]!==r.ts?(d=new Date(r.ts).toLocaleString(),e[2]=r.ts,e[3]=d):d=e[3];let m;e[4]!==d?(m=(0,t.jsx)(M,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:d}),e[4]=d,e[5]=m):m=e[5];let x=Le[r.level],u;e[6]!==r.level||e[7]!==x?(u=(0,t.jsx)(M,{children:(0,t.jsx)($,{variant:x,children:r.level})}),e[6]=r.level,e[7]=x,e[8]=u):u=e[8];let c;e[9]!==r.functionPath?(c=(0,t.jsx)(M,{className:"font-mono text-xs",children:r.functionPath}),e[9]=r.functionPath,e[10]=c):c=e[10];let w;e[11]!==r.message?(w=(0,t.jsx)("div",{className:"truncate",title:r.message,children:r.message}),e[11]=r.message,e[12]=w):w=e[12];let p;e[13]!==i?(p=i!==""&&(0,t.jsx)("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:i,children:i}),e[13]=i,e[14]=p):p=e[14];let h;e[15]!==w||e[16]!==p?(h=(0,t.jsxs)(M,{className:"max-w-md",children:[w,p]}),e[15]=w,e[16]=p,e[17]=h):h=e[17];let g=r.traceId??"\u2014",v;e[18]!==g?(v=(0,t.jsx)(M,{className:"font-mono text-[11px] text-muted-foreground",children:g}),e[18]=g,e[19]=v):v=e[19];let C=r.shardKey??"\u2014",f;e[20]!==C?(f=(0,t.jsx)(M,{className:"font-mono text-[11px] text-muted-foreground",children:C}),e[20]=C,e[21]=f):f=e[21];let y=r.userId??"\u2014",N;e[22]!==y?(N=(0,t.jsx)(M,{className:"font-mono text-[11px] text-muted-foreground",children:y}),e[22]=y,e[23]=N):N=e[23];let L;return e[24]!==h||e[25]!==v||e[26]!==f||e[27]!==N||e[28]!==a||e[29]!==m||e[30]!==u||e[31]!==c?(L=(0,t.jsxs)(re,{"data-testid":a,children:[m,u,c,h,v,f,N]}),e[24]=h,e[25]=v,e[26]=f,e[27]=N,e[28]=a,e[29]=m,e[30]=u,e[31]=c,e[32]=L):L=e[32],L},"Xe"),Xe=n(({shardKey:l})=>{let e=de(),r=H(),[o,i]=(0,b.useState)(""),[a,d]=(0,b.useState)(""),[m,x]=(0,b.useState)(""),[{cursor:u,error:c,loading:w,notConfigured:p,rows:h},g]=(0,b.useReducer)(He,Ye),v=U(o.trim(),400),C=U(a.trim(),400),f={...v===""?{}:{functionPathPrefix:v},...m===""?{}:{minLevel:m},...l===""?{}:{shardKey:l},...C===""?{}:{userId:C}},y=JSON.stringify(f),N=(0,b.useRef)(y);(0,b.useEffect)(()=>{let k={cancelled:!1};return N.current=y,X((async()=>{g({type:"loading"});try{let S=await e.queryLogArchive(f);k.cancelled||g({cursor:S.nextCursor,rows:S.rows,type:"loaded"})}catch(S){k.cancelled||g(ue(S)===Qe?{type:"notConfigured"}:{message:J(S),type:"failed"})}})()),()=>{k.cancelled=!0}},[e,y]);let L=n(async()=>{if(u===void 0)return;let k=y;g({type:"loading"});try{let S=await e.queryLogArchive({...f,cursor:u});N.current===k&&g({cursor:S.nextCursor,rows:S.rows,type:"append"})}catch(S){N.current===k&&g({message:J(S),type:"pageFailed"})}},"C"),P=n(k=>{i(k.target.value)},"R"),I=n(k=>{d(k.target.value)},"S"),R=n(k=>{x(k.target.value)},"I"),E=n(()=>{X(L())},"E");return p?(0,t.jsx)(D,{action:(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:te,rel:"noreferrer",target:"_blank",children:r("Open in Cloudflare")}),description:r("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:r("Log archive not configured")}):(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":r("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:P,placeholder:r("function path\u2026"),value:o}),(0,t.jsx)(q,{"aria-label":r("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:I,placeholder:r("user id\u2026"),value:a}),(0,t.jsxs)("select",{"aria-label":r("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:R,value:m,children:[(0,t.jsx)("option",{value:"",children:r("min level")}),Ce.map(k=>(0,t.jsx)("option",{value:k,children:k},k))]})]}),c!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:c}),w&&h===null&&c===null&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:r("Loading\u2026")}),h!==null&&h.length===0&&(0,t.jsx)(D,{description:r("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:r("No archived logs.")}),h!==null&&h.length>0&&(0,t.jsx)("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:(0,t.jsxs)(fe,{"data-testid":"lg-archive-table",children:[(0,t.jsx)(pe,{children:(0,t.jsxs)(re,{children:[(0,t.jsx)(T,{children:r("Time")}),(0,t.jsx)(T,{children:r("Level")}),(0,t.jsx)(T,{children:r("Function")}),(0,t.jsx)(T,{children:r("Message")}),(0,t.jsx)(T,{children:r("Trace")}),(0,t.jsx)(T,{children:r("Shard")}),(0,t.jsx)(T,{children:r("User")})]})}),(0,t.jsx)(ve,{children:h.map((k,S)=>(0,t.jsx)(Je,{row:k},`${String(k.ts)}-${String(S)}`))})]})}),u!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"lg-archive-more",disabled:w,onClick:E,size:"sm",variant:"outline",children:r(w?"Loading\u2026":"Load more")})})]})},"Ze"),ae=400,Ze=36,er={height:ae,overflow:"auto"},Se={left:0,position:"absolute",top:0,width:"100%"},rr={error:"destructive",ok:"secondary"},tr=n(l=>{let e=(0,F.c)(26),{entry:r,index:o,measureRef:i,start:a}=l,d=`translateY(${String(a)}px)`,m;e[0]!==d?(m={...Se,transform:d},e[0]=d,e[1]=m):m=e[1];let x=m,u;e[2]!==r.fields?(u=z(r.fields),e[2]=r.fields,e[3]=u):u=e[3];let c=u,w;e[4]!==r.timestamp?(w=new Date(r.timestamp).toLocaleString(),e[4]=r.timestamp,e[5]=w):w=e[5];let p;e[6]!==w?(p=(0,t.jsx)("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:w}),e[6]=w,e[7]=p):p=e[7];let h=Le[r.level],g;e[8]!==r.level||e[9]!==h?(g=(0,t.jsx)("span",{className:"w-20 shrink-0",role:"gridcell",children:(0,t.jsx)($,{variant:h,children:r.level})}),e[8]=r.level,e[9]=h,e[10]=g):g=e[10];let v=r.functionPath??"\u2014",C;e[11]!==v?(C=(0,t.jsx)("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:v}),e[11]=v,e[12]=C):C=e[12];let f;e[13]!==c?(f=c===""?null:(0,t.jsx)("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[13]=c,e[14]=f):f=e[14];let y;e[15]!==r.message||e[16]!==f?(y=(0,t.jsxs)("span",{className:"flex-1 truncate",role:"gridcell",children:[r.message,f]}),e[15]=r.message,e[16]=f,e[17]=y):y=e[17];let N;return e[18]!==o||e[19]!==i||e[20]!==x||e[21]!==y||e[22]!==p||e[23]!==g||e[24]!==C?(N=(0,t.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":o,"data-testid":"lg-row",ref:i,role:"row",style:x,children:[p,g,C,y]}),e[18]=o,e[19]=i,e[20]=x,e[21]=y,e[22]=p,e[23]=g,e[24]=C,e[25]=N):N=e[25],N},"ar"),ye=n(l=>l.length===0?"\u2014":l.join(", "),"oe"),ar=n(l=>{let e=(0,F.c)(37),{entry:r,index:o,measureRef:i,start:a}=l,d=`translateY(${String(a)}px)`,m;e[0]!==d?(m={...Se,transform:d},e[0]=d,e[1]=m):m=e[1];let x=m,u;e[2]!==r.ts?(u=new Date(r.ts).toLocaleString(),e[2]=r.ts,e[3]=u):u=e[3];let c;e[4]!==u?(c=(0,t.jsx)("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:u}),e[4]=u,e[5]=c):c=e[5];let w=rr[r.outcome],p;e[6]!==r.outcome||e[7]!==w?(p=(0,t.jsx)("span",{className:"w-16 shrink-0",role:"gridcell",children:(0,t.jsx)($,{variant:w,children:r.outcome})}),e[6]=r.outcome,e[7]=w,e[8]=p):p=e[8];let h;e[9]!==r.functionPath?(h=(0,t.jsx)("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:r.functionPath,children:r.functionPath}),e[9]=r.functionPath,e[10]=h):h=e[10];let g=r.shardKey??"\u2014",v;e[11]!==g?(v=(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:g}),e[11]=g,e[12]=v):v=e[12];let C=r.userId??"\u2014",f;e[13]!==C?(f=(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:C}),e[13]=C,e[14]=f):f=e[14];let y;e[15]!==r.durationMs?(y=Math.round(r.durationMs),e[15]=r.durationMs,e[16]=y):y=e[16];let N=`${String(y)}ms`,L;e[17]!==N?(L=(0,t.jsx)("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:N}),e[17]=N,e[18]=L):L=e[18];let P;e[19]!==r.errorMessage||e[20]!==r.outcome||e[21]!==r.tablesRead||e[22]!==r.tablesWritten?(P=r.outcome==="error"&&r.errorMessage!==void 0?r.errorMessage:`r:${ye(r.tablesRead)} \xB7 w:${ye(r.tablesWritten)}`,e[19]=r.errorMessage,e[20]=r.outcome,e[21]=r.tablesRead,e[22]=r.tablesWritten,e[23]=P):P=e[23];let I;e[24]!==P?(I=(0,t.jsx)("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:P}),e[24]=P,e[25]=I):I=e[25];let R;return e[26]!==o||e[27]!==i||e[28]!==x||e[29]!==f||e[30]!==L||e[31]!==I||e[32]!==c||e[33]!==p||e[34]!==h||e[35]!==v?(R=(0,t.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":o,"data-testid":"lg-req-row",ref:i,role:"row",style:x,children:[c,p,h,v,f,L,I]}),e[26]=o,e[27]=i,e[28]=x,e[29]=f,e[30]=L,e[31]=I,e[32]=c,e[33]=p,e[34]=h,e[35]=v,e[36]=R):R=e[36],R},"lr"),Ne=n(l=>{let{entries:e}=l??{};return Array.isArray(e)?e:[]},"se"),lr=n(l=>{let e={};return l.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=l.functionPathPrefix.trim()),l.userId.trim()!==""&&(e.userId=l.userId.trim()),l.tableTouched.trim()!==""&&(e.tableTouched=l.tableTouched.trim()),(l.outcome==="ok"||l.outcome==="error")&&(e.outcome=l.outcome),e},"or"),Ie=Ce,sr={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},or=n((l,e)=>{let r=e.search.trim().toLowerCase(),o=e.path.trim().toLowerCase(),i=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-sr[e.range];return l.filter(a=>e.levels.size>0&&!e.levels.has(a.level)||a.timestamp<i||o!==""&&!(a.functionPath??"").toLowerCase().includes(o)?!1:r===""||a.message.toLowerCase().includes(r)||z(a.fields).toLowerCase().includes(r))},"nr"),nr="\u2014",ir=n(l=>{let e=new Map,r=new Map;for(let a of l){e.set(a.level,(e.get(a.level)??0)+1);let d=a.functionPath??nr;r.set(d,(r.get(d)??0)+1)}let o=Ie.filter(a=>e.has(a)).map(a=>({count:e.get(a)??0,key:a})),i=[...r.entries()].map(([a,d])=>({count:d,key:a})).toSorted((a,d)=>d.count===a.count?a.key.localeCompare(d.key):d.count-a.count);return{byLevel:o,byPath:i,total:l.length}},"dr"),dr=n(l=>{let e=(0,F.c)(11),{level:r,onToggle:o,selected:i}=l,a;e[0]!==r||e[1]!==o?(a=n(()=>{o(r)},"a"),e[0]=r,e[1]=o,e[2]=a):a=e[2];let d=a,m=i?"border-border bg-muted font-medium":"border-input text-muted-foreground",x;e[3]!==m?(x=_("rounded-md border px-2 py-1 text-xs",m),e[3]=m,e[4]=x):x=e[4];let u=`logs-level-${r}`,c;return e[5]!==r||e[6]!==d||e[7]!==i||e[8]!==x||e[9]!==u?(c=(0,t.jsx)("button",{"aria-pressed":i,className:x,"data-testid":u,onClick:d,type:"button",children:r}),e[5]=r,e[6]=d,e[7]=i,e[8]=x,e[9]=u,e[10]=c):c=e[10],c},"cr"),ke=n(l=>{let e=(0,F.c)(7),{bucket:r}=l,o;e[0]!==r.key?(o=(0,t.jsx)("span",{className:"truncate text-muted-foreground",role:"gridcell",children:r.key}),e[0]=r.key,e[1]=o):o=e[1];let i;e[2]!==r.count?(i=(0,t.jsx)("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:r.count}),e[2]=r.count,e[3]=i):i=e[3];let a;return e[4]!==o||e[5]!==i?(a=(0,t.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:[o,i]}),e[4]=o,e[5]=i,e[6]=a):a=e[6],a},"ne"),qr=n(({initialShardKey:l})=>{let e=H(),[r,o]=(0,b.useState)("requests"),[i,a]=(0,b.useState)(l??""),[d,m]=(0,b.useState)(""),[x,u]=(0,b.useState)(()=>new Set),[c,w]=(0,b.useState)(""),[p,h]=(0,b.useState)("all"),[g,v]=(0,b.useState)(!1),[C,f]=(0,b.useState)(""),[y,N]=(0,b.useState)(""),[L,P]=(0,b.useState)(""),[I,R]=(0,b.useState)("all"),E=U(i.trim(),400),k=lr({functionPathPrefix:C,outcome:I,tableTouched:L,userId:y}),S=Z(ee.getRequestLog,k,{enabled:r==="requests",live:!0,shardKey:E}),le=Z(ee.getLogs,{},{enabled:r==="errors",live:!0,shardKey:E}),W=r==="requests"?S:le,{error:se,errorSource:Pe,isLoading:oe,liveError:Re}=W,qe=Ne(le.data),ne=Ne(S.data);(0,b.useEffect)(()=>{W.data!==void 0&&me(E)},[W.data,E]);let j=or(qe,{levels:x,now:Date.now(),path:c,range:p,search:d}),B=ir(j),V=r==="requests"?ne.length:j.length,G=r==="errors"&&g,K=(0,b.useMemo)(()=>se!==null?"error":V===0?oe?G?"summary":"list":"empty":G?"summary":"list",[V,oe,se,G]),ie=(0,b.useRef)(null),A=xe({count:V,estimateSize:n(()=>Ze,"estimateSize"),getScrollElement:n(()=>ie.current,"getScrollElement"),initialRect:{height:ae,width:800},observeElementRect:n((s,Q)=>we(s,Q,ae),"observeElementRect"),overscan:8}),Te=A.getVirtualItems(),Me={height:A.getTotalSize(),position:"relative",width:"100%"},Ee=n(s=>{m(s.target.value)},"Ne"),_e=n(s=>{u(Q=>{let O=new Set(Q);return O.has(s)?O.delete(s):O.add(s),O})},"Le"),Fe=n(s=>{w(s.target.value)},"Ce"),Ke=n(s=>{h(s.target.value)},"ke"),Ae=n(()=>{v(s=>!s)},"$e"),Oe=n(s=>{f(s.target.value)},"Se"),$e=n(s=>{N(s.target.value)},"Re"),De=n(s=>{P(s.target.value)},"Ie"),Ue=n(s=>{R(s.target.value)},"Ee"),ze=n(()=>{o("requests"),v(!1)},"Pe"),We=n(()=>{o("errors"),v(!1)},"Te"),je=n(()=>{o("archive"),v(!1)},"_e");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[(0,t.jsx)("button",{"aria-selected":r==="requests",className:_("px-3 py-1 text-sm",r==="requests"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-requests",onClick:ze,role:"tab",type:"button",children:e("Requests")}),(0,t.jsx)("button",{"aria-selected":r==="errors",className:_("px-3 py-1 text-sm",r==="errors"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-errors",onClick:We,role:"tab",type:"button",children:e("Errors")}),(0,t.jsx)("button",{"aria-selected":r==="archive",className:_("px-3 py-1 text-sm",r==="archive"?"bg-muted font-medium":"text-muted-foreground"),"data-testid":"lg-view-archive",onClick:je,role:"tab",type:"button",children:e("Archive")})]}),(0,t.jsx)(he,{onChange:a,testId:"lg-shard-input",value:i}),r!=="archive"&&(0,t.jsx)(be,{message:Re,prefix:"lg"}),(0,t.jsx)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:te,rel:"noreferrer",target:"_blank",children:e("Open in Cloudflare")})]}),r==="errors"&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":e("Search messages"),className:"h-8 w-48","data-testid":"lg-search",onChange:Ee,placeholder:e("search message"),value:d}),(0,t.jsx)(q,{"aria-label":e("Function path"),className:"h-8 w-40","data-testid":"logs-path-filter",onChange:Fe,placeholder:e("filter path"),value:c}),(0,t.jsx)("div",{"aria-label":e("Level filter"),className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:Ie.map(s=>(0,t.jsx)(dr,{level:s,onToggle:_e,selected:x.has(s)},s))}),(0,t.jsxs)("select",{"aria-label":e("Time range"),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:Ke,value:p,children:[(0,t.jsx)("option",{value:"all",children:e("All time")}),(0,t.jsx)("option",{value:"5m",children:e("Last 5m")}),(0,t.jsx)("option",{value:"15m",children:e("Last 15m")}),(0,t.jsx)("option",{value:"1h",children:e("Last hour")})]}),(0,t.jsx)("button",{"aria-pressed":g,className:_("h-8 rounded-md border px-3 text-sm",g?"border-border bg-muted font-medium":"border-input text-muted-foreground"),"data-testid":"logs-summary-toggle",onClick:Ae,type:"button",children:e(g?"List":"Summary")})]}),r==="requests"&&(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(q,{"aria-label":e("Function path"),className:"h-8 w-44","data-testid":"lg-req-path",onChange:Oe,placeholder:e("file:function"),value:C}),(0,t.jsx)(q,{"aria-label":e("User id"),className:"h-8 w-32","data-testid":"lg-req-user",onChange:$e,placeholder:e("userId"),value:y}),(0,t.jsx)(q,{"aria-label":e("Table touched"),className:"h-8 w-32","data-testid":"lg-req-table",onChange:De,placeholder:e("table"),value:L}),(0,t.jsxs)("select",{"aria-label":e("Outcome filter"),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:Ue,value:I,children:[(0,t.jsx)("option",{value:"all",children:e("all")}),(0,t.jsx)("option",{value:"ok",children:e("ok")}),(0,t.jsx)("option",{value:"error",children:e("error")})]})]}),r==="archive"?(0,t.jsx)(Xe,{shardKey:E}):(0,t.jsxs)(t.Fragment,{children:[K==="error"&&(0,t.jsx)(ge,{error:Pe,testId:"lg-error"}),K==="empty"&&(0,t.jsx)(D,{description:e("Function and request logs for this shard show up here as your app handles traffic."),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 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),K==="summary"&&(0,t.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:e("{count} entries",{count:B.total})}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By level")}),(0,t.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:B.byLevel.map(s=>(0,t.jsx)(ke,{bucket:s},s.key))})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:e("By function")}),(0,t.jsx)("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:B.byPath.map(s=>(0,t.jsx)(ke,{bucket:s},s.key))})]})]}),K==="list"&&(0,t.jsx)("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:ie,style:er,children:(0,t.jsx)("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:Me,children:Te.map(s=>r==="requests"?(0,t.jsx)(ar,{entry:ne[s.index],index:s.index,measureRef:A.measureElement,start:s.start},s.key):(0,t.jsx)(tr,{entry:j[s.index],index:s.index,measureRef:A.measureElement,start:s.start},s.key))})})]})]})},"qr");export{qr as LogsPanel,or as filterLogs,ir as summarizeLogs};
@@ -1 +1 @@
1
- import{a as v}from"./chunk-Q34MSC2F.js";import"./chunk-4AYEV5UN.js";import{b as $}from"./chunk-SKJZDOHG.js";import{a as A,b as I,c as j,d as x,e as n,f as c}from"./chunk-Q5WXTZWX.js";import{a as k,e as S}from"./chunk-JKPK25JO.js";import{b as y}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as R}from"./chunk-GXZAXNZI.js";import"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{a as w}from"./chunk-6OKDCV7J.js";import{d as b}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as f,e as N,g as E,h as _}from"./chunk-UHHTEBC3.js";var T=N(E(),1);var r=N(_(),1);var D=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"C"),C={delete:2,list:3,read:0,write:1},K=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||C[t.on]-C[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"T"),W=f(()=>{let e=(0,T.c)(14),t=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(R.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=K(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(v,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(w,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(S,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(I,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(n,{children:t("Bucket")}),(0,r.jsx)(n,{children:t("Operation")}),(0,r.jsx)(n,{children:t("Key prefix")}),(0,r.jsx)(n,{children:t("Guarded by")})]})}),(0,r.jsx)(j,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(c,{children:(0,r.jsx)(y,{variant:"secondary",children:D(t,s.on)})}),(0,r.jsx)(c,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"U");export{W as StorageRulesPanel};
1
+ import{a as v}from"./chunk-UNUU7CJJ.js";import"./chunk-XXQUMVWH.js";import{b as $}from"./chunk-OWADN6BI.js";import{a as A,b as I,c as j,d as x,e as n,f as c}from"./chunk-MIQTKZAR.js";import{a as k,e as S}from"./chunk-UZERI5YC.js";import{b as y}from"./chunk-THIXMMZD.js";import"./chunk-6ST5ECQA.js";import{a as R}from"./chunk-GXZAXNZI.js";import"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{a as w}from"./chunk-XQCVZAGU.js";import{d as b}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.js";import{a as f,e as N,g as E,h as _}from"./chunk-3XIESWL4.js";var T=N(E(),1);var r=N(_(),1);var D=f((e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],"C"),C={delete:2,list:3,read:0,write:1},K=f(e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||C[t.on]-C[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),"T"),W=f(()=>{let e=(0,T.c)(14),t=b(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];let{data:l,error:i,errorSource:d}=$(R.storageRules,a),h=l!==void 0,m;if(e[1]!==l||e[2]!==i||e[3]!==d||e[4]!==h||e[5]!==t){let g=K(Array.isArray(l?.rules)?l.rules:[]),u;e[7]!==i||e[8]!==d?(u=i!==null&&(0,r.jsx)(v,{error:d,testId:"storage-rules-error"}),e[7]=i,e[8]=d,e[9]=u):u=e[9];let o;e[10]!==t?(o=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=o):o=e[11];let p;e[12]!==o?(p=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:o}),e[12]=o,e[13]=p):p=e[13],m=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[u,p,h&&g.length===0?(0,r.jsx)(w,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):(0,r.jsx)(k,{className:"overflow-hidden py-0",children:(0,r.jsx)(S,{className:"px-0",children:(0,r.jsxs)(A,{"data-testid":"storage-rules-table",children:[(0,r.jsx)(I,{children:(0,r.jsxs)(x,{children:[(0,r.jsx)(n,{children:t("Bucket")}),(0,r.jsx)(n,{children:t("Operation")}),(0,r.jsx)(n,{children:t("Key prefix")}),(0,r.jsx)(n,{children:t("Guarded by")})]})}),(0,r.jsx)(j,{children:g.map(s=>(0,r.jsxs)(x,{"data-testid":`storage-rule-${s.bucket}-${s.on}-${s.prefix??""}`,children:[(0,r.jsx)(c,{className:"font-mono text-xs",children:s.bucket}),(0,r.jsx)(c,{children:(0,r.jsx)(y,{variant:"secondary",children:D(t,s.on)})}),(0,r.jsx)(c,{className:"font-mono text-xs",children:s.prefix??(0,r.jsx)("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),(0,r.jsx)(c,{className:"font-mono text-xs text-muted-foreground",children:s.procedure})]},`${s.bucket}:${s.on}:${s.prefix??""}:${s.procedure}`))})]})})})]}),e[1]=l,e[2]=i,e[3]=d,e[4]=h,e[5]=t,e[6]=m}else m=e[6];return m},"U");export{W as StorageRulesPanel};
@@ -1 +1 @@
1
- import{i as y}from"./chunk-7Z5QEFR4.js";import{a as C,c as M,e as P}from"./chunk-ZFWEPGWG.js";import{d as T}from"./chunk-4FNHHFWR.js";import{a as o,e as L,f as S,h as z}from"./chunk-UHHTEBC3.js";var O=L(S(),1);var w=L(S(),1);var _=w.createContext({register:o(()=>{},"register"),unregister:o(()=>{},"unregister"),subscribeMapChange:o(()=>()=>{},"subscribeMapChange"),elementsRef:{current:[]},nextIndexRef:{current:0}});function F(){return w.useContext(_)}o(F,"useCompositeListContext");var W=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function V(t={}){let{label:n,metadata:r,textRef:s,indexGuessBehavior:N,index:m}=t,{register:x,unregister:p,subscribeMapChange:f,elementsRef:d,labelsRef:h,nextIndexRef:c}=F(),g=O.useRef(-1),[a,i]=O.useState(m??(N===W.GuessFromOrder?()=>{if(g.current===-1){let e=c.current;c.current+=1,g.current=e}return g.current}:-1)),E=O.useRef(null),D=O.useCallback(e=>{if(E.current=e,a!==-1&&e!==null&&(d.current[a]=e,h)){let l=n!==void 0;h.current[a]=l?n:s?.current?.textContent??e.textContent}},[a,d,h,n,s]);return C(()=>{if(m!=null)return;let e=E.current;if(e)return x(e,r),()=>{p(e)}},[m,x,p,r]),C(()=>{if(m==null)return f(e=>{let l=E.current?e.get(E.current)?.index:null;l!=null&&i(l)})},[m,f,i]),{ref:D,index:a}}o(V,"useCompositeListItem");var b=L(S(),1);var v=L(z(),1);function Z(t){let{children:n,elementsRef:r,labelsRef:s,onMapChange:N}=t,m=M(N),x=b.useRef(0),p=T(U).current,f=T(k).current,[d,h]=b.useState(0),c=b.useRef(d),g=M((e,l)=>{f.set(e,l??null),c.current+=1,h(c.current)}),a=M(e=>{f.delete(e),c.current+=1,h(c.current)}),i=b.useMemo(()=>{let e=new Map;return Array.from(f.keys()).filter(u=>u.isConnected).sort(A).forEach((u,I)=>{let R=f.get(u)??{};e.set(u,{...R,index:I})}),e},[f,d]);C(()=>{if(typeof MutationObserver!="function"||i.size===0)return;let e=new MutationObserver(l=>{let u=new Set,I=o(R=>u.has(R)?u.delete(R):u.add(R),"updateDiff");l.forEach(R=>{R.removedNodes.forEach(I),R.addedNodes.forEach(I)}),u.size===0&&(c.current+=1,h(c.current))});return i.forEach((l,u)=>{u.parentElement&&e.observe(u.parentElement,{childList:!0})}),()=>{e.disconnect()}},[i]),C(()=>{c.current===d&&(r.current.length!==i.size&&(r.current.length=i.size),s&&s.current.length!==i.size&&(s.current.length=i.size),x.current=i.size),m(i)},[m,i,r,s,d]),C(()=>()=>{r.current=[]},[r]),C(()=>()=>{s&&(s.current=[])},[s]);let E=M(e=>(p.add(e),()=>{p.delete(e)}));C(()=>{p.forEach(e=>e(i))},[p,i]);let D=b.useMemo(()=>({register:g,unregister:a,subscribeMapChange:E,elementsRef:r,labelsRef:s,nextIndexRef:x}),[g,a,E,r,s,x]);return(0,v.jsx)(_.Provider,{value:D,children:n})}o(Z,"CompositeList");function k(){return new Map}o(k,"createMap");function U(){return new Set}o(U,"createListeners");function A(t,n){let r=t.compareDocumentPosition(n);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}o(A,"sortByDocumentPosition");function re(t){let n=t.getBoundingClientRect(),r=P(t);if(y.env.jsdom)return n;let s=r.getComputedStyle(t,"::before"),N=r.getComputedStyle(t,"::after");if(!(s.content!=="none"||N.content!=="none"))return n;let x=parseFloat(s.width)||0,p=parseFloat(s.height)||0,f=parseFloat(N.width)||0,d=parseFloat(N.height)||0,h=Math.max(n.width,x,f),c=Math.max(n.height,p,d),g=h-n.width,a=c-n.height;return{left:n.left-g/2,right:n.right+g/2,top:n.top-a/2,bottom:n.bottom+a/2}}o(re,"getPseudoElementBounds");function ie(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}o(ie,"isElementDisabled");export{W as a,V as b,Z as c,re as d,ie as e};
1
+ import{i as y}from"./chunk-CFPZYHPY.js";import{a as C,c as M,e as P}from"./chunk-2OUPA2WJ.js";import{d as T}from"./chunk-6ST5ECQA.js";import{a as o,e as L,f as S,h as z}from"./chunk-3XIESWL4.js";var O=L(S(),1);var w=L(S(),1);var _=w.createContext({register:o(()=>{},"register"),unregister:o(()=>{},"unregister"),subscribeMapChange:o(()=>()=>{},"subscribeMapChange"),elementsRef:{current:[]},nextIndexRef:{current:0}});function F(){return w.useContext(_)}o(F,"useCompositeListContext");var W=(function(t){return t[t.None=0]="None",t[t.GuessFromOrder=1]="GuessFromOrder",t})({});function V(t={}){let{label:n,metadata:r,textRef:s,indexGuessBehavior:N,index:m}=t,{register:x,unregister:p,subscribeMapChange:f,elementsRef:d,labelsRef:h,nextIndexRef:c}=F(),g=O.useRef(-1),[a,i]=O.useState(m??(N===W.GuessFromOrder?()=>{if(g.current===-1){let e=c.current;c.current+=1,g.current=e}return g.current}:-1)),E=O.useRef(null),D=O.useCallback(e=>{if(E.current=e,a!==-1&&e!==null&&(d.current[a]=e,h)){let l=n!==void 0;h.current[a]=l?n:s?.current?.textContent??e.textContent}},[a,d,h,n,s]);return C(()=>{if(m!=null)return;let e=E.current;if(e)return x(e,r),()=>{p(e)}},[m,x,p,r]),C(()=>{if(m==null)return f(e=>{let l=E.current?e.get(E.current)?.index:null;l!=null&&i(l)})},[m,f,i]),{ref:D,index:a}}o(V,"useCompositeListItem");var b=L(S(),1);var v=L(z(),1);function Z(t){let{children:n,elementsRef:r,labelsRef:s,onMapChange:N}=t,m=M(N),x=b.useRef(0),p=T(U).current,f=T(k).current,[d,h]=b.useState(0),c=b.useRef(d),g=M((e,l)=>{f.set(e,l??null),c.current+=1,h(c.current)}),a=M(e=>{f.delete(e),c.current+=1,h(c.current)}),i=b.useMemo(()=>{let e=new Map;return Array.from(f.keys()).filter(u=>u.isConnected).sort(A).forEach((u,I)=>{let R=f.get(u)??{};e.set(u,{...R,index:I})}),e},[f,d]);C(()=>{if(typeof MutationObserver!="function"||i.size===0)return;let e=new MutationObserver(l=>{let u=new Set,I=o(R=>u.has(R)?u.delete(R):u.add(R),"updateDiff");l.forEach(R=>{R.removedNodes.forEach(I),R.addedNodes.forEach(I)}),u.size===0&&(c.current+=1,h(c.current))});return i.forEach((l,u)=>{u.parentElement&&e.observe(u.parentElement,{childList:!0})}),()=>{e.disconnect()}},[i]),C(()=>{c.current===d&&(r.current.length!==i.size&&(r.current.length=i.size),s&&s.current.length!==i.size&&(s.current.length=i.size),x.current=i.size),m(i)},[m,i,r,s,d]),C(()=>()=>{r.current=[]},[r]),C(()=>()=>{s&&(s.current=[])},[s]);let E=M(e=>(p.add(e),()=>{p.delete(e)}));C(()=>{p.forEach(e=>e(i))},[p,i]);let D=b.useMemo(()=>({register:g,unregister:a,subscribeMapChange:E,elementsRef:r,labelsRef:s,nextIndexRef:x}),[g,a,E,r,s,x]);return(0,v.jsx)(_.Provider,{value:D,children:n})}o(Z,"CompositeList");function k(){return new Map}o(k,"createMap");function U(){return new Set}o(U,"createListeners");function A(t,n){let r=t.compareDocumentPosition(n);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}o(A,"sortByDocumentPosition");function re(t){let n=t.getBoundingClientRect(),r=P(t);if(y.env.jsdom)return n;let s=r.getComputedStyle(t,"::before"),N=r.getComputedStyle(t,"::after");if(!(s.content!=="none"||N.content!=="none"))return n;let x=parseFloat(s.width)||0,p=parseFloat(s.height)||0,f=parseFloat(N.width)||0,d=parseFloat(N.height)||0,h=Math.max(n.width,x,f),c=Math.max(n.height,p,d),g=h-n.width,a=c-n.height;return{left:n.left-g/2,right:n.right+g/2,top:n.top-a/2,bottom:n.bottom+a/2}}o(re,"getPseudoElementBounds");function ie(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}o(ie,"isElementDisabled");export{W as a,V as b,Z as c,re as d,ie as e};
@@ -1 +1 @@
1
- import{a as o}from"./chunk-UHHTEBC3.js";var u={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3},h={error:0,info:2,warning:1},g=o((e,a)=>{let s=[];if(e.maxDurationMs>=a.slowFunctionMs){let n=e.scannedTables??[];n.length>0?s.push({fn:e.path,kind:"missing-index",severity:"warning",tables:n.map(t=>t.table),value:e.maxDurationMs}):s.push({fn:e.path,kind:"slow-function",severity:"info",value:e.maxDurationMs})}e.calls>=a.minErrorCalls&&e.errors/e.calls>=a.highErrorRate&&s.push({fn:e.path,kind:"high-error-rate",message:e.lastErrorMessage??void 0,severity:"error",value:e.errors/e.calls});let r=e.conflicts??0;return r>0&&e.calls>=a.minConflictCalls&&r/e.calls>=a.highWriteContention&&s.push({fn:e.path,kind:"high-write-contention",severity:"warning",value:r/e.calls}),s},"u"),v=o((e,a,s=u)=>{let r=[];if(e?.cache){let{evictions:n,hits:t,misses:c}=e.cache,i=t+c;if(i>=s.minCacheSamples){let l=t/i;l<s.lowCacheHitRate&&r.push({kind:"low-cache-hit-rate",severity:"warning",value:l})}n>0&&n>t&&r.push({kind:"high-evictions",severity:"warning",value:n})}for(let n of a??[])r.push(...g(n,s));return r.toSorted((n,t)=>h[n.severity]-h[t.severity])},"g");export{v as a};
1
+ import{a as o}from"./chunk-3XIESWL4.js";var u={highErrorRate:.05,highWriteContention:.1,lowCacheHitRate:.5,minCacheSamples:10,minConflictCalls:5,minErrorCalls:5,slowFunctionMs:1e3},h={error:0,info:2,warning:1},g=o((e,a)=>{let s=[];if(e.maxDurationMs>=a.slowFunctionMs){let n=e.scannedTables??[];n.length>0?s.push({fn:e.path,kind:"missing-index",severity:"warning",tables:n.map(t=>t.table),value:e.maxDurationMs}):s.push({fn:e.path,kind:"slow-function",severity:"info",value:e.maxDurationMs})}e.calls>=a.minErrorCalls&&e.errors/e.calls>=a.highErrorRate&&s.push({fn:e.path,kind:"high-error-rate",message:e.lastErrorMessage??void 0,severity:"error",value:e.errors/e.calls});let r=e.conflicts??0;return r>0&&e.calls>=a.minConflictCalls&&r/e.calls>=a.highWriteContention&&s.push({fn:e.path,kind:"high-write-contention",severity:"warning",value:r/e.calls}),s},"u"),v=o((e,a,s=u)=>{let r=[];if(e?.cache){let{evictions:n,hits:t,misses:c}=e.cache,i=t+c;if(i>=s.minCacheSamples){let l=t/i;l<s.lowCacheHitRate&&r.push({kind:"low-cache-hit-rate",severity:"warning",value:l})}n>0&&n>t&&r.push({kind:"high-evictions",severity:"warning",value:n})}for(let n of a??[])r.push(...g(n,s));return r.toSorted((n,t)=>h[n.severity]-h[t.severity])},"g");export{v as a};
@@ -1 +1 @@
1
- import{a as G}from"./chunk-UZYGEOWY.js";import{a as g}from"./chunk-YT7VXQVX.js";import{a as B}from"./chunk-V66TSUKV.js";import{b as U}from"./chunk-UWF5DOGV.js";import"./chunk-PTTDIYGP.js";import{R as O}from"./chunk-7Z5QEFR4.js";import"./chunk-46IB4C4Q.js";import{c as h}from"./chunk-UY2Y5CXB.js";import"./chunk-ZFWEPGWG.js";import{b as w}from"./chunk-K5PFWU5J.js";import"./chunk-4FNHHFWR.js";import{a as M}from"./chunk-GXZAXNZI.js";import{f as D}from"./chunk-KJTLW5W2.js";import"./chunk-UREY4GLG.js";import{d as K,e as _,f as z,h as P,m as q,q as E}from"./chunk-KLLYGWNF.js";import"./chunk-UDZY7MKE.js";import{a as s,e as T,f as ie,h as oe}from"./chunk-UHHTEBC3.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 j=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===j),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=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))},"A");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,R):await c.query(me,{args:t,functionPath:n.path,userId:A},R);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:j,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
+ import{a as G}from"./chunk-V53KNYRN.js";import{a as g}from"./chunk-5Y3QLNWX.js";import{a as B}from"./chunk-LFXFP4IF.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-GXZAXNZI.js";import{f as D}from"./chunk-LWECXQWP.js";import"./chunk-XBDKZZ67.js";import{d as K,e as _,f as z,h as P,m as q,q as E}from"./chunk-4CGALXS3.js";import"./chunk-LE56LPNH.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 j=I===""?x[0]?.path??"":I,n=x.find(t=>t.path===j),Z=s(async()=>{if(!n)return;let t;try{t=m.trim()===""?{}:JSON.parse(m)}catch(l){p("error"),y(void 0),N(a("Invalid JSON args: {message}",{message:l.message}));return}let d={__lunoraRef:n.path},R=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))},"A");p("running"),N(null);try{let l=A===""?await _(c,n.kind,d,t,R):await c.query(me,{args:t,functionPath:n.path,userId:A},R);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:j,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};