@lunora/studio 1.0.0-alpha.374 → 1.0.0-alpha.376
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/organizations-panel.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/sync-client-panel.mjs +1 -1
- package/dist/packem_chunks/users-panel.mjs +1 -1
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-B9kGlqXE.mjs +1 -0
- package/dist/packem_shared/{DataBrowser-BrRWqnCr.mjs → DataBrowser-BR2nrvMW.mjs} +1 -1
- package/dist/packem_shared/GlobalDataBrowser-Df5S1NxG.mjs +1 -0
- package/dist/packem_shared/{ScheduledJobs-QCTRdugp.mjs → ScheduledJobs-Du8ZGL7v.mjs} +1 -1
- package/dist/packem_shared/{Studio-pDEG4JTx.mjs → Studio-JuMI1hpi.mjs} +1 -1
- package/dist/packem_shared/{StudioApp-C4IOJPR6.mjs → StudioApp-02dw_keu.mjs} +1 -1
- package/dist/packem_shared/{studio-DE7i2--m.mjs → studio-DtxNxSjs.mjs} +1 -1
- package/dist/packem_shared/{table-list-sidebar-DUnCjFL7.mjs → table-list-sidebar-C8qPvzGk.mjs} +1 -1
- package/dist/standalone/{chunk-4EQAUONF.js → chunk-2BQNNRAP.js} +1 -1
- package/dist/standalone/{chunk-USVLFLZL.js → chunk-3BQ6FMEA.js} +2 -2
- package/dist/standalone/{chunk-HCWB4UDT.js → chunk-3D2E7WXH.js} +1 -1
- package/dist/standalone/{chunk-QMULO5AP.js → chunk-4DIRNQHR.js} +1 -1
- package/dist/standalone/{chunk-QN66FO5B.js → chunk-64LU3VU6.js} +1 -1
- package/dist/standalone/{chunk-FK2S7VR4.js → chunk-6BH5TIGF.js} +1 -1
- package/dist/standalone/{chunk-ILSJ22BK.js → chunk-7LCGAQWG.js} +1 -1
- package/dist/standalone/{chunk-GH6CI2P2.js → chunk-AFVVESAA.js} +1 -1
- package/dist/standalone/{chunk-NGGTRLCC.js → chunk-ALNEZ5D2.js} +1 -1
- package/dist/standalone/chunk-AQ62YJJ5.js +1 -0
- package/dist/standalone/{chunk-TDJQ7HQM.js → chunk-B3TXCZUI.js} +1 -1
- package/dist/standalone/{chunk-PIOHOROI.js → chunk-B4PRNI7H.js} +1 -1
- package/dist/standalone/{chunk-52ULLZJX.js → chunk-BE3FD3E6.js} +1 -1
- package/dist/standalone/{chunk-OODTH4NA.js → chunk-BYUXIOPZ.js} +1 -1
- package/dist/standalone/{chunk-PIQ4A4BZ.js → chunk-CCETXQNF.js} +1 -1
- package/dist/standalone/{chunk-LR2FBYCC.js → chunk-CHIQ3CJZ.js} +1 -1
- package/dist/standalone/{chunk-TUFOWHEF.js → chunk-CLQKKJHL.js} +1 -1
- package/dist/standalone/{chunk-RKPVI2PI.js → chunk-CURIWKKC.js} +1 -1
- package/dist/standalone/{chunk-4B54WP4R.js → chunk-CZA2P2TU.js} +1 -1
- package/dist/standalone/{chunk-N7EIHD3H.js → chunk-EVJSGZXV.js} +1 -1
- package/dist/standalone/{chunk-RHYQB4RH.js → chunk-EYJX6GXU.js} +1 -1
- package/dist/standalone/{chunk-FGZ73BFG.js → chunk-EYMLYHWK.js} +1 -1
- package/dist/standalone/{chunk-XZHTVLDG.js → chunk-F4S2YEYW.js} +1 -1
- package/dist/standalone/{chunk-2CPMCEHD.js → chunk-FEHRNTIU.js} +1 -1
- package/dist/standalone/{chunk-FT3BWJVP.js → chunk-FERYOTLW.js} +1 -1
- package/dist/standalone/{chunk-WFXS3YRM.js → chunk-G6VBT4AU.js} +1 -1
- package/dist/standalone/{chunk-KYN4A72O.js → chunk-GMT66LBU.js} +1 -1
- package/dist/standalone/{chunk-ZCOMJH2I.js → chunk-HAK2T6YN.js} +1 -1
- package/dist/standalone/{chunk-SKZNH5QQ.js → chunk-HSI24FPH.js} +1 -1
- package/dist/standalone/{chunk-6VOBO5QL.js → chunk-JIBRGVA7.js} +1 -1
- package/dist/standalone/{chunk-XITLHKKR.js → chunk-JYCGHNPF.js} +1 -1
- package/dist/standalone/{chunk-JPCVFWR5.js → chunk-K3MVWN6E.js} +1 -1
- package/dist/standalone/{chunk-R52GVSS2.js → chunk-K46QTJR6.js} +1 -1
- package/dist/standalone/{chunk-MJWIIV2C.js → chunk-LKML3CX4.js} +1 -1
- package/dist/standalone/{chunk-LCIDEYA4.js → chunk-LQCF6SZW.js} +1 -1
- package/dist/standalone/{chunk-LFKKTGEF.js → chunk-N3FNOCHB.js} +1 -1
- package/dist/standalone/{chunk-EAPNLM2Q.js → chunk-OT2YNQPU.js} +1 -1
- package/dist/standalone/{chunk-4ADB7TWC.js → chunk-PEVNCIZQ.js} +1 -1
- package/dist/standalone/chunk-PFPJA2HR.js +7 -0
- package/dist/standalone/{chunk-RUQTILJN.js → chunk-PUU56AIE.js} +1 -1
- package/dist/standalone/{chunk-JB3DZ2PJ.js → chunk-PYQUCCUO.js} +1 -1
- package/dist/standalone/{chunk-QNY5EEBN.js → chunk-QAQ3KMY6.js} +1 -1
- package/dist/standalone/{chunk-WJA2IGZC.js → chunk-QGAWQTUE.js} +1 -1
- package/dist/standalone/{chunk-DDTWGWM4.js → chunk-QURCU2N2.js} +1 -1
- package/dist/standalone/{chunk-CBACG4XF.js → chunk-QXNMGPXW.js} +1 -1
- package/dist/standalone/{chunk-HZU4WF4X.js → chunk-R3P6KKUH.js} +1 -1
- package/dist/standalone/{chunk-2U6Z7A6C.js → chunk-RTE7SDRS.js} +1 -1
- package/dist/standalone/{chunk-PGJOTPWC.js → chunk-RWMOWRJX.js} +1 -1
- package/dist/standalone/{chunk-XWVFKYZV.js → chunk-SW52HGM4.js} +1 -1
- package/dist/standalone/{chunk-CGXIERYO.js → chunk-SWFSB4QT.js} +1 -1
- package/dist/standalone/{chunk-2IOS27FL.js → chunk-SZBLYYV6.js} +1 -1
- package/dist/standalone/{chunk-DHH7WHXQ.js → chunk-UBTKEHX6.js} +1 -1
- package/dist/standalone/{chunk-6IRGBPDN.js → chunk-UVNJG3UL.js} +1 -1
- package/dist/standalone/{chunk-VDSTHVWZ.js → chunk-W2FHSEQW.js} +1 -1
- package/dist/standalone/{chunk-LA76GGAT.js → chunk-WAIESA3E.js} +1 -1
- package/dist/standalone/{chunk-MTX62MQ7.js → chunk-WB6VGH7X.js} +1 -1
- package/dist/standalone/{chunk-3BQD5ITB.js → chunk-X45MVUVK.js} +1 -1
- package/dist/standalone/{chunk-IELLWQGA.js → chunk-X72A525Z.js} +1 -1
- package/dist/standalone/{chunk-G5REMLEG.js → chunk-YTPE33AO.js} +1 -1
- package/dist/standalone/{chunk-Z6WEYWT7.js → chunk-ZCXG3567.js} +1 -1
- package/dist/standalone/{chunk-RDS72J4I.js → chunk-ZFEDRJ7R.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +4 -4
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs +0 -1
- package/dist/packem_shared/GlobalDataBrowser-DB1B-WAN.mjs +0 -1
- package/dist/standalone/chunk-ACWAMBGT.js +0 -1
- package/dist/standalone/chunk-ODLNNVP2.js +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as nt,b as ot}from"./chunk-42RZZFLX.js";import"./chunk-BQS3C5V3.js";import"./chunk-IJNP6YSD.js";import{d as tt}from"./chunk-CAEJQOMU.js";import"./chunk-D3DZZHZA.js";import{a as Ae}from"./chunk-CVSIFPI5.js";import{a as Ze}from"./chunk-
|
|
1
|
+
import{a as nt,b as ot}from"./chunk-42RZZFLX.js";import"./chunk-BQS3C5V3.js";import"./chunk-IJNP6YSD.js";import{d as tt}from"./chunk-CAEJQOMU.js";import"./chunk-D3DZZHZA.js";import{a as Ae}from"./chunk-CVSIFPI5.js";import{a as Ze}from"./chunk-4DIRNQHR.js";import"./chunk-Y2YLTUMD.js";import"./chunk-OVEOTKK5.js";import"./chunk-UBX5ZPLV.js";import"./chunk-VNH4OBJS.js";import{a as et}from"./chunk-2DT3QG6Q.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-QAOZXPLU.js";import"./chunk-BG2CJOVS.js";import{a as Ye}from"./chunk-645S7KRU.js";import{b as Ve}from"./chunk-3D67ZJRW.js";import"./chunk-6YBEKVUG.js";import{c as Xe,d as we,e as Ne,f as Ee,g as Me}from"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import{i as ye}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import"./chunk-YUVGMKHG.js";import{a as Je}from"./chunk-F5WJCL3F.js";import"./chunk-VXZAS5VS.js";import{b as Ge}from"./chunk-PUU56AIE.js";import{a as ve}from"./chunk-6A6AELDJ.js";import"./chunk-CLQKKJHL.js";import{n as Ce}from"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as J,h as ge,i as xe,j as Ke,r as Ue,s as le,x as ie}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as Et}from"./chunk-GWNGVKLG.js";import{a as Nt,b as Lt}from"./chunk-6G3E4PJ2.js";import{a as d,d as De}from"./chunk-5PEAXTYQ.js";var V=De(Et(),1),j=De(Nt(),1);var u=De(Lt(),1);var Se=class{static{d(this,"Diff")}diff(e,n,t={}){let o;typeof t=="function"?(o=t,t={}):"callback"in t&&(o=t.callback);let r=this.castInput(e,t),l=this.castInput(n,t),i=this.removeEmpty(this.tokenize(r,t)),a=this.removeEmpty(this.tokenize(l,t));return this.diffWithOptionsObj(i,a,t,o)}diffWithOptionsObj(e,n,t,o){var r;let l=d(h=>{if(h=this.postProcess(h,t),o){setTimeout(function(){o(h)},0);return}else return h},"done"),i=n.length,a=e.length,c=1,m=i+a;t.maxEditLength!=null&&(m=Math.min(m,t.maxEditLength));let p=(r=t.timeout)!==null&&r!==void 0?r:1/0,f=Date.now()+p,b=[{oldPos:-1,lastComponent:void 0}],g=this.extractCommon(b[0],n,e,0,t);if(b[0].oldPos+1>=a&&g+1>=i)return l(this.buildValues(b[0].lastComponent,n,e));let k=-1/0,q=1/0,N=d(()=>{for(let h=Math.max(k,-c);h<=Math.min(q,c);h+=2){let S,x=b[h-1],v=b[h+1];x&&(b[h-1]=void 0);let y=!1;if(v){let E=v.oldPos-h;y=v&&0<=E&&E<i}let w=x&&x.oldPos+1<a;if(!y&&!w){b[h]=void 0;continue}if(!w||y&&x.oldPos<v.oldPos?S=this.addToPath(v,!0,!1,0,t):S=this.addToPath(x,!1,!0,1,t),g=this.extractCommon(S,n,e,h,t),S.oldPos+1>=a&&g+1>=i)return l(this.buildValues(S.lastComponent,n,e))||!0;b[h]=S,S.oldPos+1>=a&&(q=Math.min(q,h-1)),g+1>=i&&(k=Math.max(k,h+1))}c++},"execEditLength");if(o)d(function h(){setTimeout(function(){if(c>m||Date.now()>f)return o(void 0);N()||h()},0)},"exec")();else for(;c<=m&&Date.now()<=f;){let h=N();if(h)return h}}addToPath(e,n,t,o,r){let l=e.lastComponent;return l&&!r.oneChangePerToken&&l.added===n&&l.removed===t?{oldPos:e.oldPos+o,lastComponent:{count:l.count+1,added:n,removed:t,previousComponent:l.previousComponent}}:{oldPos:e.oldPos+o,lastComponent:{count:1,added:n,removed:t,previousComponent:l}}}extractCommon(e,n,t,o,r){let l=n.length,i=t.length,a=e.oldPos,c=a-o,m=0;for(;c+1<l&&a+1<i&&this.equals(t[a+1],n[c+1],r);)c++,a++,m++,r.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return m&&!r.oneChangePerToken&&(e.lastComponent={count:m,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=a,c}equals(e,n,t){return t.comparator?t.comparator(e,n):e===n||!!t.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){let n=[];for(let t=0;t<e.length;t++)e[t]&&n.push(e[t]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,t){let o=[],r;for(;e;)o.push(e),r=e.previousComponent,delete e.previousComponent,e=r;o.reverse();let l=o.length,i=0,a=0,c=0;for(;i<l;i++){let m=o[i];if(m.removed)m.value=this.join(t.slice(c,c+m.count)),c+=m.count;else{if(!m.added&&this.useLongestToken){let p=n.slice(a,a+m.count);p=p.map(function(f,b){let g=t[c+b];return g.length>f.length?g:f}),m.value=this.join(p)}else m.value=this.join(n.slice(a,a+m.count));a+=m.count,m.added||(c+=m.count)}}return o}};var $e=class extends Se{static{d(this,"LineDiff")}constructor(){super(...arguments),this.tokenize=_t}equals(e,n,t){return t.ignoreWhitespace?((!t.newlineIsToken||!e.includes(`
|
|
2
2
|
`))&&(e=e.trim()),(!t.newlineIsToken||!n.includes(`
|
|
3
3
|
`))&&(n=n.trim())):t.ignoreNewlineAtEof&&!t.newlineIsToken&&(e.endsWith(`
|
|
4
4
|
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as _}from"./chunk-FWOOA2ZR.js";import{b as j}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as J}from"./chunk-
|
|
1
|
+
import{a as _}from"./chunk-FWOOA2ZR.js";import{b as j}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as J}from"./chunk-EVJSGZXV.js";import"./chunk-F5WJCL3F.js";import{a as E,b as G,c as L,d as I,e as c,f as p}from"./chunk-VXZAS5VS.js";import"./chunk-EYMLYHWK.js";import{b as q}from"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as O}from"./chunk-6A6AELDJ.js";import{c as H}from"./chunk-CLQKKJHL.js";import{a as D,e as W}from"./chunk-OSHODLMU.js";import"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as z}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as Q}from"./chunk-GWNGVKLG.js";import{b as V}from"./chunk-6G3E4PJ2.js";import{a as d,d as F}from"./chunk-5PEAXTYQ.js";var K=F(Q(),1);var r=F(V(),1);var U=["read","insert","update","delete"],M=30,X=d((e,t)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[t],"z"),Y=d(e=>{let t=new Map;for(let s of e){let a=t.get(s.table)??{operations:new Set,procedures:new Set,table:s.table};a.operations.add(s.on),a.procedures.add(s.procedure),t.set(s.table,a)}return[...t.values()].toSorted((s,a)=>s.table.localeCompare(a.table))},"J"),Z=d(e=>{let t=e.slice(0,M).map(s=>`${s.table}: ${U.filter(a=>s.operations.has(a)).join("/")}`).join("; ");return e.length>M?`${t}; and ${String(e.length-M)} more tables`:t},"K"),pe=d(()=>{let e=(0,K.c)(45),t=z(),s=q(),a=s!==void 0&&!s.unavailable,k;e[0]===Symbol.for("react.memo_cache_sentinel")?(k={},e[0]=k):k=e[0];let{data:l,error:C,errorSource:P}=H(O.rlsPolicies,k),o=l!==void 0,m;e[1]!==l?(m=Array.isArray(l?.policies)?l.policies:[],e[1]=l,e[2]=m):m=e[2];let S;e[3]!==m?(S=Y(m),e[3]=m,e[4]=S):S=e[4];let i=S,R;e[5]!==l?(R=Array.isArray(l?.roles)?l.roles:[],e[5]=l,e[6]=R):R=e[6];let T=R,h;e[7]!==C||e[8]!==P?(h=C!==null&&(0,r.jsx)(J,{error:P,testId:"rls-error"}),e[7]=C,e[8]=P,e[9]=h):h=e[9];let u;e[10]!==t?(u=t("Policies"),e[10]=t,e[11]=u):u=e[11];let f;e[12]!==u?(f=(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:u}),e[12]=u,e[13]=f):f=e[13];let b;e[14]!==s||e[15]!==a||e[16]!==o||e[17]!==t||e[18]!==i?(b=o&&a&&(0,r.jsx)("button",{className:"ms-auto text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"rls-ask-assistant",onClick:d(()=>{s.openAssistant({ask:i.length===0?t("This app declares no row-level-security policies at all. Which tables most need one, and what policy should I write for them?"):t("The Lunora RLS inspector shows these declared policies \u2014 {coverage}. Which tables and operations are still unguarded, and what policy should I add?",{coverage:Z(i)}),suggestions:[t("Which procedures still need .use(rls(...))?"),t("How do I test a policy?")],title:t("Access rules")})},"onClick"),type:"button",children:t("Ask the assistant")}),e[14]=s,e[15]=a,e[16]=o,e[17]=t,e[18]=i,e[19]=b):b=e[19];let x;e[20]!==f||e[21]!==b?(x=(0,r.jsxs)("header",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[f,b]}),e[20]=f,e[21]=b,e[22]=x):x=e[22];let g;e[23]!==o||e[24]!==t||e[25]!==i?(g=o&&i.length===0?(0,r.jsx)(_,{description:t("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:t("No policies defined")}):(0,r.jsx)(W,{className:"px-0",children:(0,r.jsxs)(E,{"data-testid":"rls-policies-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(c,{children:t("Table")}),U.map(n=>(0,r.jsx)(c,{children:X(t,n)},n)),(0,r.jsx)(c,{children:t("Guarded by")})]})}),(0,r.jsx)(L,{children:i.map(n=>(0,r.jsxs)(I,{"data-testid":`rls-table-${n.table}`,children:[(0,r.jsx)(p,{className:"font-mono text-xs",children:n.table}),U.map(B=>(0,r.jsx)(p,{children:n.operations.has(B)?(0,r.jsx)(j,{variant:"secondary",children:t("Guarded")}):(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"})},B)),(0,r.jsx)(p,{className:"font-mono text-xs text-muted-foreground",children:[...n.procedures].join(", ")})]},n.table))})]})}),e[23]=o,e[24]=t,e[25]=i,e[26]=g):g=e[26];let N;e[27]!==x||e[28]!==g?(N=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[x,g]})}),e[27]=x,e[28]=g,e[29]=N):N=e[29];let y;e[30]!==t?(y=t("Roles"),e[30]=t,e[31]=y):y=e[31];let w;e[32]!==y?(w=(0,r.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,r.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:y})}),e[32]=y,e[33]=w):w=e[33];let v;e[34]!==o||e[35]!==T||e[36]!==t?(v=o&&T.length===0?(0,r.jsx)(_,{description:t("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:t("No roles defined")}):(0,r.jsx)(W,{className:"px-0",children:(0,r.jsxs)(E,{"data-testid":"rls-roles-table",children:[(0,r.jsx)(G,{children:(0,r.jsxs)(I,{children:[(0,r.jsx)(c,{children:t("Role")}),(0,r.jsx)(c,{children:t("Description")}),(0,r.jsx)(c,{children:t("Permissions")})]})}),(0,r.jsx)(L,{children:T.map(re)})]})}),e[34]=o,e[35]=T,e[36]=t,e[37]=v):v=e[37];let A;e[38]!==w||e[39]!==v?(A=(0,r.jsx)("section",{className:"flex flex-col gap-2",children:(0,r.jsxs)(D,{className:"overflow-hidden py-0",children:[w,v]})}),e[38]=w,e[39]=v,e[40]=A):A=e[40];let $;return e[41]!==N||e[42]!==A||e[43]!==h?($=(0,r.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-rls-panel",children:[h,N,A]}),e[41]=N,e[42]=A,e[43]=h,e[44]=$):$=e[44],$},"ce");function ee(e){return(0,r.jsx)(j,{variant:"outline",children:e},e)}d(ee,"V");function re(e){return(0,r.jsxs)(I,{"data-testid":`rls-role-${e.name}`,children:[(0,r.jsx)(p,{className:"font-mono text-xs",children:e.name}),(0,r.jsx)(p,{className:"text-muted-foreground",children:e.description??""}),(0,r.jsx)(p,{children:e.permissions.length===0?(0,r.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,r.jsx)("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(ee)})})]},e.name)}d(re,"Y");export{pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as H}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as G}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as J}from"./chunk-FWOOA2ZR.js";import"./chunk-YUVGMKHG.js";import{a as Q,b as W,c as Z,d as V,e as C,f as S}from"./chunk-VXZAS5VS.js";import{a as F,e as K}from"./chunk-OSHODLMU.js";import{n as D}from"./chunk-
|
|
1
|
+
import{i as H}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as G}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as J}from"./chunk-FWOOA2ZR.js";import"./chunk-YUVGMKHG.js";import{a as Q,b as W,c as Z,d as V,e as C,f as S}from"./chunk-VXZAS5VS.js";import{a as F,e as K}from"./chunk-OSHODLMU.js";import{n as D}from"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B,j as $,r as A,s as z}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as X}from"./chunk-GWNGVKLG.js";import{a as U,b as Y}from"./chunk-6G3E4PJ2.js";import{a as I,d as M}from"./chunk-5PEAXTYQ.js";var L=M(X(),1),g=M(U(),1);var t=M(Y(),1);var _=10,E=I(h=>{let e=(0,L.c)(7),{label:i,value:l}=h,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let a=l??"\u2014",n;e[2]!==a?(n=(0,t.jsx)("span",{className:"font-mono text-sm",children:a}),e[2]=a,e[3]=n):n=e[3];let s;return e[4]!==r||e[5]!==n?(s=(0,t.jsxs)("div",{className:"flex flex-col gap-0.5",children:[r,n]}),e[4]=r,e[5]=n,e[6]=s):s=e[6],s},"_"),ee=I(h=>{let e=(0,L.c)(38),{indexes:i,onSelect:l,selected:r}=h,a=B(),n;e[0]!==a?(n=a("name"),e[0]=a,e[1]=n):n=e[1];let s;e[2]!==n?(s=(0,t.jsx)(C,{children:n}),e[2]=n,e[3]=s):s=e[3];let c;e[4]!==a?(c=a("table"),e[4]=a,e[5]=c):c=e[5];let o;e[6]!==c?(o=(0,t.jsx)(C,{children:c}),e[6]=c,e[7]=o):o=e[7];let d;e[8]!==a?(d=a("dimensions"),e[8]=a,e[9]=d):d=e[9];let x;e[10]!==d?(x=(0,t.jsx)(C,{children:d}),e[10]=d,e[11]=x):x=e[11];let m;e[12]!==a?(m=a("metric"),e[12]=a,e[13]=m):m=e[13];let p;e[14]!==m?(p=(0,t.jsx)(C,{children:m}),e[14]=m,e[15]=p):p=e[15];let u;e[16]!==a?(u=a("vectors"),e[16]=a,e[17]=u):u=e[17];let v;e[18]!==u?(v=(0,t.jsx)(C,{children:u}),e[18]=u,e[19]=v):v=e[19];let y;e[20]!==v||e[21]!==s||e[22]!==o||e[23]!==x||e[24]!==p?(y=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[s,o,x,p,v]})}),e[20]=v,e[21]=s,e[22]=o,e[23]=x,e[24]=p,e[25]=y):y=e[25];let k;if(e[26]!==i||e[27]!==l||e[28]!==r){let q;e[30]!==l||e[31]!==r?(q=I(w=>(0,t.jsxs)(V,{className:w.name===r?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":w.name,"data-testid":`vector-row-${w.name}`,onClick:l,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:w.name}),(0,t.jsx)(S,{className:"font-mono text-xs",children:w.table}),(0,t.jsx)(S,{className:"tabular-nums",children:w.dimensions??"\u2014"}),(0,t.jsx)(S,{children:w.metric??"\u2014"}),(0,t.jsx)(S,{className:"tabular-nums",children:w.vectorsCount??"\u2014"})]},w.name),"q"),e[30]=l,e[31]=r,e[32]=q):q=e[32],k=i.map(q),e[26]=i,e[27]=l,e[28]=r,e[29]=k}else k=e[29];let N;e[33]!==k?(N=(0,t.jsx)(Z,{children:k}),e[33]=k,e[34]=N):N=e[34];let f;return e[35]!==y||e[36]!==N?(f=(0,t.jsx)(F,{className:"overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-table",children:[y,N]})})}),e[35]=y,e[36]=N,e[37]=f):f=e[37],f},"X"),te=I(h=>{let e=(0,L.c)(27),{matches:i}=h,l=B();if(i.length===0){let u;e[0]!==l?(u=l("No matches."),e[0]=l,e[1]=u):u=e[1];let v;return e[2]!==u?(v=(0,t.jsx)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:u}),e[2]=u,e[3]=v):v=e[3],v}let r;e[4]!==l?(r=l("id"),e[4]=l,e[5]=r):r=e[5];let a;e[6]!==r?(a=(0,t.jsx)(C,{children:r}),e[6]=r,e[7]=a):a=e[7];let n;e[8]!==l?(n=l("score"),e[8]=l,e[9]=n):n=e[9];let s;e[10]!==n?(s=(0,t.jsx)(C,{children:n}),e[10]=n,e[11]=s):s=e[11];let c;e[12]!==l?(c=l("metadata"),e[12]=l,e[13]=c):c=e[13];let o;e[14]!==c?(o=(0,t.jsx)(C,{children:c}),e[14]=c,e[15]=o):o=e[15];let d;e[16]!==a||e[17]!==s||e[18]!==o?(d=(0,t.jsx)(W,{children:(0,t.jsxs)(V,{children:[a,s,o]})}),e[16]=a,e[17]=s,e[18]=o,e[19]=d):d=e[19];let x;e[20]!==i?(x=i.map(le),e[20]=i,e[21]=x):x=e[21];let m;e[22]!==x?(m=(0,t.jsx)(Z,{children:x}),e[22]=x,e[23]=m):m=e[23];let p;return e[24]!==d||e[25]!==m?(p=(0,t.jsx)(F,{className:"mt-3 overflow-hidden py-0",children:(0,t.jsx)(K,{className:"px-0",children:(0,t.jsxs)(Q,{"data-testid":"vector-matches",children:[d,m]})})}),e[24]=d,e[25]=m,e[26]=p):p=e[26],p},"Y"),me=I(({loadIndexes:h,runQuery:e}={})=>{let i=D(),l=B(),[r,a]=(0,g.useState)(null),[n,s]=(0,g.useState)(null),[c,o]=(0,g.useState)(null),[d,x]=(0,g.useState)(""),[m,p]=(0,g.useState)(null),[u,v]=(0,g.useState)(null),[y,k]=(0,g.useState)(!1),N=(0,g.useRef)(0);(0,g.useEffect)(()=>{let b={cancelled:!1};return z((async()=>{try{let j=await(h??(()=>i.listVectorIndexes()))();b.cancelled||(a(j),s(null),o(T=>T??j[0]?.name??null))}catch(j){b.cancelled||(a(null),s($(j)))}})()),()=>{b.cancelled=!0}},[i,h]);let f=r?.find(b=>b.name===c)??null,q=I(b=>{N.current+=1,o(b.currentTarget.dataset.index??null),p(null),v(null),k(!1)},"q"),w=I(b=>{x(b.target.value)},"y"),O=I(async()=>{let b=d.trim();if(c===null||b==="")return;N.current+=1;let j=N.current;k(!0),v(null);try{let T=await(e??(R=>i.queryVectorIndex(R)))({name:c,text:b,topK:_});if(j!==N.current)return;p(T)}catch(T){if(j!==N.current)return;p(null),v($(T))}k(!1)},"H"),P=I(()=>{z(O())},"K");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[n!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:n}),r!==null&&r.length===0&&(0,t.jsx)(J,{description:l("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"})}),testId:"vector-empty",title:l("No vector indexes.")}),r!==null&&r.length>0&&(0,t.jsx)(ee,{indexes:r,onSelect:q,selected:c}),f!==null&&(0,t.jsxs)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,t.jsx)(E,{label:l("field"),value:f.field}),(0,t.jsx)(E,{label:l("dimensions"),value:f.dimensions}),(0,t.jsx)(E,{label:l("metric"),value:f.metric}),(0,t.jsx)(E,{label:l("vectors"),value:f.vectorsCount})]}),f.metadata!==void 0&&f.metadata.length>0&&(0,t.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[l("metadata"),": ",(0,t.jsx)("span",{className:"font-mono",children:f.metadata.join(", ")})]}),(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,t.jsx)(H,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:w,placeholder:l("Search by similarity\u2026"),value:d}),(0,t.jsx)(G,{"data-testid":"vector-search",disabled:y||d.trim()==="",onClick:P,children:l(y?"Searching\u2026":"Search")})]}),u!==null&&(0,t.jsx)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:u}),m!==null&&(0,t.jsx)(te,{matches:m})]})]})},"ue");function le(h){return(0,t.jsxs)(V,{"data-testid":`vector-match-${h.id}`,children:[(0,t.jsx)(S,{className:"font-mono text-xs",children:h.id}),(0,t.jsx)(S,{className:"tabular-nums",children:h.score.toFixed(4)}),(0,t.jsx)(S,{className:"max-w-md truncate font-mono text-xs",children:h.metadata===void 0?"\u2014":A(h.metadata)})]},h.id)}I(le,"ee");export{me as VectorBrowser};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as M}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as D}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as R}from"./chunk-FWOOA2ZR.js";import{b as j}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as U}from"./chunk-
|
|
1
|
+
import{i as M}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as D}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as R}from"./chunk-FWOOA2ZR.js";import{b as j}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as U}from"./chunk-EVJSGZXV.js";import"./chunk-F5WJCL3F.js";import{a as G,b as H,c as J,d as B,e as x,f as N}from"./chunk-VXZAS5VS.js";import"./chunk-EYMLYHWK.js";import"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as q}from"./chunk-6A6AELDJ.js";import{c as k}from"./chunk-CLQKKJHL.js";import{a as O,e as P}from"./chunk-OSHODLMU.js";import"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as z,w as F}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as X}from"./chunk-GWNGVKLG.js";import{a as $,b as Y}from"./chunk-6G3E4PJ2.js";import{a as A,d as T}from"./chunk-5PEAXTYQ.js";var K=T(X(),1),Q=T($(),1);var t=T(Y(),1);var de=A(()=>{let e=(0,K.c)(39),a=z(),[s,V]=(0,Q.useState)(""),y;e[0]===Symbol.for("react.memo_cache_sentinel")?(y={},e[0]=y):y=e[0];let{data:C,error:l,errorSource:S,isLoading:E,refetch:_}=k(q.getAuthAuditLog,y),I;if(e[1]!==C?.entries||e[2]!==s){let r=C?.entries??[],v=s.trim().toLowerCase();I=v===""?r:r.filter(w=>w.event.toLowerCase().includes(v)||(w.actorId??"").toLowerCase().includes(v)||(w.actorEmail??"").toLowerCase().includes(v)||(w.ip??"").toLowerCase().includes(v)||w.outcome.toLowerCase().includes(v)),e[1]=C?.entries,e[2]=s,e[3]=I}else I=e[3];let o=I,L;e[4]===Symbol.for("react.memo_cache_sentinel")?(L=A(r=>{V(r.target.value)},"I"),e[4]=L):L=e[4];let W=L,i;e[5]!==a?(i=a("Filter security events"),e[5]=a,e[6]=i):i=e[6];let n;e[7]!==a?(n=a("filter event, actor, IP"),e[7]=a,e[8]=n):n=e[8];let c;e[9]!==s||e[10]!==i||e[11]!==n?(c=(0,t.jsx)(M,{"aria-label":i,className:"h-8 w-56","data-testid":"aa-search",onChange:W,placeholder:n,value:s}),e[9]=s,e[10]=i,e[11]=n,e[12]=c):c=e[12];let d;e[13]!==_?(d=A(()=>{_()},"m"),e[13]=_,e[14]=d):d=e[14];let m;e[15]!==a?(m=a("Refresh"),e[15]=a,e[16]=m):m=e[16];let u;e[17]!==d||e[18]!==m?(u=(0,t.jsx)(D,{"data-testid":"aa-refresh",onClick:d,size:"xs",type:"button",variant:"ghost",children:m}),e[17]=d,e[18]=m,e[19]=u):u=e[19];let h;e[20]!==c||e[21]!==u?(h=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,u]}),e[20]=c,e[21]=u,e[22]=h):h=e[22];let f;e[23]!==l||e[24]!==S?(f=l!==null&&(0,t.jsx)(U,{error:S,testId:"aa-error"}),e[23]=l,e[24]=S,e[25]=f):f=e[25];let p;e[26]!==l||e[27]!==o.length||e[28]!==E||e[29]!==a?(p=l===null&&!E&&o.length===0&&(0,t.jsx)(R,{description:a("Authentication and security events are recorded here."),testId:"aa-empty",title:a("No security events.")}),e[26]=l,e[27]=o.length,e[28]=E,e[29]=a,e[30]=p):p=e[30];let g;e[31]!==o||e[32]!==a?(g=o.length>0&&(0,t.jsx)(O,{className:"overflow-hidden py-0",children:(0,t.jsx)(P,{className:"max-h-[30rem] overflow-auto px-0",children:(0,t.jsxs)(G,{"data-testid":"aa-table",children:[(0,t.jsx)(H,{children:(0,t.jsxs)(B,{children:[(0,t.jsx)(x,{children:a("time")}),(0,t.jsx)(x,{children:a("event")}),(0,t.jsx)(x,{children:a("actor")}),(0,t.jsx)(x,{children:a("ip / user agent")}),(0,t.jsx)(x,{children:a("outcome")})]})}),(0,t.jsx)(J,{children:o.map(r=>(0,t.jsxs)(B,{"data-testid":"aa-row",children:[(0,t.jsx)(N,{className:"text-muted-foreground tabular-nums",children:F(r.ts,"\u2014")}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:"secondary",children:r.event})}),(0,t.jsx)(N,{className:"max-w-[24ch] truncate font-mono text-xs",title:r.actorId??void 0,children:r.actorEmail??r.actorId??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})}),(0,t.jsxs)(N,{className:"max-w-[28ch] truncate text-xs text-muted-foreground",title:r.userAgent??void 0,children:[r.ip??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),r.userAgent!==void 0&&(0,t.jsxs)("span",{className:"ml-1 opacity-70",children:["\xB7 ",r.userAgent]})]}),(0,t.jsx)(N,{children:(0,t.jsx)(j,{variant:r.outcome==="failure"?"destructive":"outline",children:a(r.outcome)})})]},r.seq))})]})})}),e[31]=o,e[32]=a,e[33]=g):g=e[33];let b;return e[34]!==f||e[35]!==p||e[36]!==g||e[37]!==h?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-auth-audit",children:[h,f,p,g]}),e[34]=f,e[35]=p,e[36]=g,e[37]=h,e[38]=b):b=e[38],b},"ne");export{de as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as $e}from"./chunk-QMULO5AP.js";import{g as Le}from"./chunk-FT3BWJVP.js";import"./chunk-GXTSE66Z.js";import"./chunk-CGXIERYO.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-ACWAMBGT.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-2MZLFQR5.js";import"./chunk-QAOZXPLU.js";import{a as ge}from"./chunk-J45HAKBU.js";import{a as be}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-6YBEKVUG.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as Je}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as ce}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as se}from"./chunk-FWOOA2ZR.js";import{b as oe}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-VXZAS5VS.js";import"./chunk-RUQTILJN.js";import"./chunk-4PI2OSSP.js";import{a as me}from"./chunk-6A6AELDJ.js";import{b as ne,c as ve}from"./chunk-TUFOWHEF.js";import{a as Z,e as H}from"./chunk-OSHODLMU.js";import{l as je,n as de}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as Ce}from"./chunk-GWNGVKLG.js";import{a as we,b as Se}from"./chunk-6G3E4PJ2.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(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 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
|
|
1
|
+
import{a as $e}from"./chunk-4DIRNQHR.js";import{g as Le}from"./chunk-FERYOTLW.js";import"./chunk-GXTSE66Z.js";import"./chunk-SWFSB4QT.js";import"./chunk-CL3JOU6F.js";import{a as ae}from"./chunk-AQ62YJJ5.js";import"./chunk-KTK4NDWQ.js";import"./chunk-XLYFGUEF.js";import"./chunk-D65UVZIA.js";import"./chunk-NGVP66OH.js";import"./chunk-2MZLFQR5.js";import"./chunk-QAOZXPLU.js";import{a as ge}from"./chunk-J45HAKBU.js";import{a as be}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-DA2CAFXI.js";import{a as ue}from"./chunk-6YBEKVUG.js";import"./chunk-ZSWW2UGP.js";import"./chunk-RTS5G3ET.js";import"./chunk-QRA7AKYO.js";import{i as Je}from"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as ce}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as se}from"./chunk-FWOOA2ZR.js";import{b as oe}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as ee,b as te,c as re,d as z,e as L,f as K}from"./chunk-VXZAS5VS.js";import"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as me}from"./chunk-6A6AELDJ.js";import{b as ne,c as ve}from"./chunk-CLQKKJHL.js";import{a as Z,e as H}from"./chunk-OSHODLMU.js";import{l as je,n as de}from"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as V,h as fe,i as Ae,j as ie,k as xe,s as Y,w as le,x as Ie}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as Ce}from"./chunk-GWNGVKLG.js";import{a as we,b as Se}from"./chunk-6G3E4PJ2.js";import{a as y,d as he}from"./chunk-5PEAXTYQ.js";var G=he(Ce(),1),Q=he(we(),1);var t=he(Se(),1);var Fe=he(Ce(),1),pe=he(we(),1);var D=he(Se(),1);var Me=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","X"),Ke=y(r=>r.toSorted((e,o)=>e.scheduledFor-o.scheduledFor),"F"),Be=y((r,e,o)=>e!==void 0?e:o===void 0?n=>r.cancelScheduledJob(n):void 0,"Y"),Te=y(r=>{let e=(0,Fe.c)(16),{cancelJob:o,loadJobs:n}=r===void 0?{}:r,l=de(),s=V(),a=n===void 0,i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=["lunora-scheduled-jobs"],e[0]=i):i=e[0];let c=ne(i,async()=>{let x=await(n??(()=>l.listScheduledJobs()))();return Ke(x)}),[N,p]=(0,pe.useState)(void 0),[h,m]=(0,pe.useState)(void 0),k,f;e[1]!==l||e[2]!==a?(k=y(()=>{if(a)return l.subscribeScheduledJobs(x=>{m(void 0),p(Ke(x))})},"v"),f=[a,l],e[1]=l,e[2]=a,e[3]=k,e[4]=f):(k=e[3],f=e[4]),(0,pe.useEffect)(k,f);let d;e[5]!==c?(d=y(()=>c.poll(),"y"),e[5]=c,e[6]=d):d=e[6],ae(d,!a);let u=Be(l,o,n),v=N??c.data,b=h??c.error,S=y(async x=>{if(u!==void 0){m(void 0);try{await u(x),a||c.refetch()}catch(A){m(ie(A))}}},"E"),I="flex flex-col gap-3",w="lunora-scheduled-jobs",C;e[7]!==b?(C=b!==null&&(0,D.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:b}),e[7]=b,e[8]=C):C=e[8];let J;e[9]!==v?.length||e[10]!==s?(J=v?.length===0&&(0,D.jsx)(se,{description:s("Jobs queued with runAfter / runAt will appear here."),icon:(0,D.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,D.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,D.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:s("No scheduled jobs.")}),e[9]=v?.length,e[10]=s,e[11]=J):J=e[11];let $=v!==void 0&&v.length>0&&(0,D.jsx)(Z,{className:"overflow-hidden py-0",children:(0,D.jsx)(H,{className:"px-0",children:(0,D.jsxs)(ee,{"data-testid":"sj-table",children:[(0,D.jsx)(te,{children:(0,D.jsxs)(z,{children:[(0,D.jsx)(L,{children:s("function")}),(0,D.jsx)(L,{children:s("scheduled for")}),(0,D.jsx)(L,{children:s("pool")}),(0,D.jsx)(L,{children:s("attempts")}),(0,D.jsx)(L,{children:s("shard")}),(0,D.jsx)(L,{children:s("id")}),u!==void 0&&(0,D.jsx)(L,{"aria-label":s("Actions")})]})}),(0,D.jsx)(re,{children:v.map(x=>(0,D.jsxs)(z,{"data-testid":`sj-row-${x.id}`,children:[(0,D.jsx)(K,{className:"font-mono text-xs",children:x.workflow??x.functionPath}),(0,D.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Me(x.scheduledFor)}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.pool??""}),(0,D.jsx)(K,{className:"tabular-nums",children:x.attempts??0}),(0,D.jsx)(K,{children:x.shardKey??""}),(0,D.jsx)(K,{className:"font-mono text-xs",children:x.id}),u!==void 0&&(0,D.jsx)(K,{className:"text-right",children:(0,D.jsx)(ue,{confirmLabel:s("Cancel job?"),onConfirm:y(()=>{Y(S(x.id))},"onConfirm"),testId:`sj-cancel-${x.id}`,children:s("Cancel")})})]},x.id))})]})})}),j;return e[12]!==$||e[13]!==C||e[14]!==J?(j=(0,D.jsxs)("div",{className:I,"data-testid":w,children:[C,J,$]}),e[12]=$,e[13]=C,e[14]=J,e[15]=j):j=e[15],j},"he");var _e={failed:"destructive",skipped:"warning",succeeded:"success"},Re=25,Pe=y(r=>r<1e3?`${String(r)} ms`:`${(r/1e3).toFixed(1)} s`,"Ee"),Oe=y(r=>{let e=(0,G.c)(39),{inFlight:o,last:n}=r,l=V();if(o!==void 0){let u;e[0]!==l?(u=l("running"),e[0]=l,e[1]=u):u=e[1];let v;e[2]!==u?(v=(0,t.jsx)(oe,{variant:"info",children:u}),e[2]=u,e[3]=v):v=e[3];let b;e[4]!==o.startedAt?(b=le(o.startedAt,"\u2014"),e[4]=o.startedAt,e[5]=b):b=e[5];let S;e[6]!==b?(S=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=S):S=e[7];let I;e[8]!==o.skipped||e[9]!==l?(I=o.skipped>0&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("{count} ticks skipped",{count:o.skipped})}),e[8]=o.skipped,e[9]=l,e[10]=I):I=e[10];let w;return e[11]!==v||e[12]!==S||e[13]!==I?(w=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[v,S,I]}),e[11]=v,e[12]=S,e[13]=I,e[14]=w):w=e[14],w}if(n===void 0){let u;e[15]!==l?(u=l("never"),e[15]=l,e[16]=u):u=e[16];let v;return e[17]!==u?(v=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:u}),e[17]=u,e[18]=v):v=e[18],v}let s;e[19]!==l?(s=l("failed"),e[19]=l,e[20]=s):s=e[20];let a;e[21]!==l?(a=l("skipped"),e[21]=l,e[22]=a):a=e[22];let i;e[23]!==l?(i=l("succeeded"),e[23]=l,e[24]=i):i=e[24];let c;e[25]!==s||e[26]!==a||e[27]!==i?(c={failed:s,skipped:a,succeeded:i},e[25]=s,e[26]=a,e[27]=i,e[28]=c):c=e[28];let N=c,p=_e[n.status],h=N[n.status],m;e[29]!==p||e[30]!==h?(m=(0,t.jsx)(oe,{variant:p,children:h}),e[29]=p,e[30]=h,e[31]=m):m=e[31];let k;e[32]!==n.startedAt?(k=le(n.startedAt,"\u2014"),e[32]=n.startedAt,e[33]=k):k=e[33];let f;e[34]!==k?(f=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:k}),e[34]=k,e[35]=f):f=e[35];let d;return e[36]!==m||e[37]!==f?(d=(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[m,f]}),e[36]=m,e[37]=f,e[38]=d):d=e[38],d},"Re"),Ee=y(r=>{let e=(0,G.c)(80),{runs:o}=r,n=V();if(o.length===0)return;let l,s,a,i,c,N,p,h,m,k,f;if(e[0]!==o||e[1]!==n){let I=o.toSorted(Ue).slice(0,Re),w;e[13]!==n?(w=n("failed"),e[13]=n,e[14]=w):w=e[14];let C;e[15]!==n?(C=n("skipped"),e[15]=n,e[16]=C):C=e[16];let J;e[17]!==n?(J=n("succeeded"),e[17]=n,e[18]=J):J=e[18];let $;e[19]!==J||e[20]!==w||e[21]!==C?($={failed:w,skipped:C,succeeded:J},e[19]=J,e[20]=w,e[21]=C,e[22]=$):$=e[22];let j=$;m="flex flex-col gap-2",k="cron-run-history";let x;e[23]!==n?(x=n("Recent runs"),e[23]=n,e[24]=x):x=e[24],e[25]!==x?(f=(0,t.jsx)("h3",{className:"text-sm font-medium",children:x}),e[25]=x,e[26]=f):f=e[26],i=Z,h="overflow-hidden py-0",a=H,p="px-0",s=ee;let A;e[27]!==n?(A=n("name"),e[27]=n,e[28]=A):A=e[28];let g;e[29]!==A?(g=(0,t.jsx)(L,{children:A}),e[29]=A,e[30]=g):g=e[30];let F;e[31]!==n?(F=n("status"),e[31]=n,e[32]=F):F=e[32];let _;e[33]!==F?(_=(0,t.jsx)(L,{children:F}),e[33]=F,e[34]=_):_=e[34];let T;e[35]!==n?(T=n("started"),e[35]=n,e[36]=T):T=e[36];let M;e[37]!==T?(M=(0,t.jsx)(L,{children:T}),e[37]=T,e[38]=M):M=e[38];let R;e[39]!==n?(R=n("duration"),e[39]=n,e[40]=R):R=e[40];let W;e[41]!==R?(W=(0,t.jsx)(L,{children:R}),e[41]=R,e[42]=W):W=e[42];let B;e[43]!==n?(B=n("skipped"),e[43]=n,e[44]=B):B=e[44];let E;e[45]!==B?(E=(0,t.jsx)(L,{children:B}),e[45]=B,e[46]=E):E=e[46];let U;e[47]!==n?(U=n("error"),e[47]=n,e[48]=U):U=e[48];let P;e[49]!==U?(P=(0,t.jsx)(L,{children:U}),e[49]=U,e[50]=P):P=e[50],e[51]!==g||e[52]!==_||e[53]!==M||e[54]!==W||e[55]!==E||e[56]!==P?(N=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[g,_,M,W,E,P]})}),e[51]=g,e[52]=_,e[53]=M,e[54]=W,e[55]=E,e[56]=P,e[57]=N):N=e[57],l=re;let X;e[58]!==j?(X=y(q=>(0,t.jsxs)(z,{"data-testid":`cron-run-row-${q.runId}`,children:[(0,t.jsx)(K,{children:q.name}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{variant:_e[q.status],children:j[q.status]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(q.startedAt,"\u2014")}),(0,t.jsx)(K,{className:"tabular-nums",children:q.status==="skipped"?"":Pe(q.durationMs)}),(0,t.jsx)(K,{className:"tabular-nums",children:q.skipped>0?q.skipped:""}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:q.error??""})]},q.runId),"W"),e[58]=j,e[59]=X):X=e[59],c=I.map(X),e[0]=o,e[1]=n,e[2]=l,e[3]=s,e[4]=a,e[5]=i,e[6]=c,e[7]=N,e[8]=p,e[9]=h,e[10]=m,e[11]=k,e[12]=f}else l=e[2],s=e[3],a=e[4],i=e[5],c=e[6],N=e[7],p=e[8],h=e[9],m=e[10],k=e[11],f=e[12];let d;e[60]!==l||e[61]!==c?(d=(0,t.jsx)(l,{children:c}),e[60]=l,e[61]=c,e[62]=d):d=e[62];let u;e[63]!==s||e[64]!==N||e[65]!==d?(u=(0,t.jsxs)(s,{children:[N,d]}),e[63]=s,e[64]=N,e[65]=d,e[66]=u):u=e[66];let v;e[67]!==a||e[68]!==p||e[69]!==u?(v=(0,t.jsx)(a,{className:p,children:u}),e[67]=a,e[68]=p,e[69]=u,e[70]=v):v=e[70];let b;e[71]!==i||e[72]!==v||e[73]!==h?(b=(0,t.jsx)(i,{className:h,children:v}),e[71]=i,e[72]=v,e[73]=h,e[74]=b):b=e[74];let S;return e[75]!==b||e[76]!==m||e[77]!==k||e[78]!==f?(S=(0,t.jsxs)("div",{className:m,"data-testid":k,children:[f,b]}),e[75]=b,e[76]=m,e[77]=k,e[78]=f,e[79]=S):S=e[79],S},"Le");function Ue(r,e){return e.startedAt-r.startedAt}y(Ue,"Oe");var We=y(()=>{let r=(0,G.c)(50),e=V(),o=$e(""),[n,l]=(0,Q.useState)(""),[s,a]=(0,Q.useState)(void 0),[i,c]=(0,Q.useState)(!1);if(o.unavailable)return null;let N;r[0]!==o?(N=o.pending("cron"),r[0]=o,r[1]=N):N=r[1];let p=N,h;r[2]!==o?(h=o.reason("cron"),r[2]=o,r[3]=h):h=r[3];let m=h,k;r[4]!==n||r[5]!==o?(k=y(()=>{let T=n.trim();T!==""&&Y((async()=>{let M=await o.suggestCron(T);c(!1),a(M)})())},"y"),r[4]=n,r[5]=o,r[6]=k):k=r[6];let f=k,d;r[7]!==s?(d=y(()=>{let T="navigator"in globalThis?globalThis.navigator.clipboard:void 0;T===void 0||s===void 0||Y((async()=>{try{await T.writeText(s),c(!0)}catch{c(!1)}})())},"d"),r[7]=s,r[8]=d):d=r[8];let u=d,v;r[9]!==e?(v=e("Describe a schedule"),r[9]=e,r[10]=v):v=r[10];let b;r[11]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{l(T.target.value)},"b"),r[11]=b):b=r[11];let S;r[12]!==f?(S=y(T=>{T.key==="Enter"&&(T.preventDefault(),f())},"w"),r[12]=f,r[13]=S):S=r[13];let I;r[14]!==e?(I=e("Describe a schedule"),r[14]=e,r[15]=I):I=r[15];let w;r[16]!==p||r[17]!==n||r[18]!==v||r[19]!==S||r[20]!==I?(w=(0,t.jsx)(Je,{"aria-label":v,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:p,onChange:b,onKeyDown:S,placeholder:I,value:n}),r[16]=p,r[17]=n,r[18]=v,r[19]=S,r[20]=I,r[21]=w):w=r[21];let C=p&&"opacity-60",J;r[22]!==C?(J=Ie("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",C),r[22]=C,r[23]=J):J=r[23];let $;r[24]!==p||r[25]!==n?($=p||n.trim()==="",r[24]=p,r[25]=n,r[26]=$):$=r[26];let j;r[27]!==p||r[28]!==e?(j=e(p?"Thinking\u2026":"Suggest schedule"),r[27]=p,r[28]=e,r[29]=j):j=r[29];let x;r[30]!==f||r[31]!==J||r[32]!==$||r[33]!==j?(x=(0,t.jsx)("button",{className:J,"data-testid":"cron-assistant-generate",disabled:$,onClick:f,type:"button",children:j}),r[30]=f,r[31]=J,r[32]=$,r[33]=j,r[34]=x):x=r[34];let A;r[35]!==x||r[36]!==w?(A=(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[w,x]}),r[35]=x,r[36]=w,r[37]=A):A=r[37];let g;r[38]!==i||r[39]!==u||r[40]!==s||r[41]!==e?(g=s!==void 0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:s}),(0,t.jsx)("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:u,type:"button",children:e(i?"Copied":"Copy")}),(0,t.jsx)("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts \u2014 triggers are compiled into the worker.")})]}),r[38]=i,r[39]=u,r[40]=s,r[41]=e,r[42]=g):g=r[42];let F;r[43]!==m||r[44]!==e?(F=m!==void 0&&(0,t.jsx)("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(m==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),r[43]=m,r[44]=e,r[45]=F):F=r[45];let _;return r[46]!==A||r[47]!==g||r[48]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[A,g,F]}),r[46]=A,r[47]=g,r[48]=F,r[49]=_):_=r[49],_},"Ke"),ze={kind:"idle"},qe="SCHEDULER_NOT_CONFIGURED",ye={inFlight:[],runs:[]},Ve=y((r,e,o)=>o!==void 0?o:e===void 0?n=>r.runCronJob(n):void 0,"Fe"),Ge=y(({loadCronJobs:r,loadCronRuns:e,runCronJob:o}={})=>{let n=de(),l=V(),[s,a]=(0,Q.useState)({}),i=ne(["lunora-cron-jobs",r?"custom":"default"],()=>(r??(()=>n.getCronJobs()))()),{data:c,error:N}=i,p=e??(r===void 0?()=>n.listCronRuns():void 0),h=ne(["lunora-cron-runs",e?"custom":"default"],async()=>p===void 0?ye:p().catch(d=>{if(xe(d)===qe)return ye;throw d})),m=h.data??ye;ae(()=>h.poll(),p!==void 0);let k=Ve(n,r,o),f=y(async d=>{if(k!==void 0){a(u=>({...u,[d]:{kind:"running"}}));try{await k(d),a(u=>({...u,[d]:{kind:"ok"}})),i.refetch(),h.refetch()}catch(u){a(v=>({...v,[d]:{kind:"error",message:ie(u)}}))}}},"p");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[(0,t.jsx)(We,{}),N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:h.error}),c?.length===0&&(0,t.jsx)(se,{description:l("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:l("No cron triggers.")}),c!==void 0&&c.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"cron-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:l("name")}),(0,t.jsx)(L,{children:l("schedule")}),(0,t.jsx)(L,{children:l("target")}),(0,t.jsx)(L,{children:l("shard")}),(0,t.jsx)(L,{children:l("last run")}),k!==void 0&&(0,t.jsx)(L,{"aria-label":l("Actions")})]})}),(0,t.jsx)(re,{children:c.map(d=>{let u=s[d.name]??ze;return(0,t.jsxs)(z,{"data-testid":`cron-row-${d.name}`,children:[(0,t.jsx)(K,{children:d.name}),(0,t.jsx)(K,{className:"font-mono text-xs tabular-nums",children:d.cron}),(0,t.jsx)(K,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[d.workflow===void 0?(0,t.jsx)(oe,{variant:"outline",children:l("function")}):(0,t.jsx)(oe,{variant:"secondary",children:l("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:d.workflow??d.functionPath})]})}),(0,t.jsx)(K,{children:d.shardKey??""}),(0,t.jsx)(K,{"data-testid":`cron-last-run-${d.name}`,children:(0,t.jsx)(Oe,{inFlight:m.inFlight.find(v=>v.name===d.name),last:m.runs.find(v=>v.name===d.name)})}),k!==void 0&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[u.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${d.name}`,children:l("ran")}),u.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${d.name}`,role:"alert",children:u.message}),(0,t.jsx)(ue,{confirmLabel:l("Run now?"),disabled:u.kind==="running",onConfirm:y(()=>{Y(f(d.name))},"onConfirm"),testId:`cron-run-${d.name}`,children:u.kind==="running"?l("Running\u2026"):l("Run now")})]})})]},`${d.cron}:${d.name}`)})})]})})}),(0,t.jsx)(Ee,{runs:m.runs})]})},"Je"),Qe=y(r=>Number.isFinite(r)?le(r,"\u2014"):"\u2014","Me"),Xe=y(r=>{let e=(0,G.c)(34),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n,removeJob:l,retryJob:s}=o,a=de(),i=V(),c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=["lunora-dead-jobs"],e[2]=c):c=e[2];let N;e[3]!==a||e[4]!==n?(N=y(async()=>(await(n??(()=>a.listDeadJobs()))()).toSorted(Ye),"v"),e[3]=a,e[4]=n,e[5]=N):N=e[5];let p=ne(c,N),h=p.data,[m,k]=(0,Q.useState)(void 0),f=p.error??m,d=n===void 0,u;e[6]!==a||e[7]!==d||e[8]!==s?(u=s??(d?g=>a.retryDeadJob(g):void 0),e[6]=a,e[7]=d,e[8]=s,e[9]=u):u=e[9];let v=u,b;e[10]!==a||e[11]!==d||e[12]!==l?(b=l??(d?g=>a.removeDeadJob(g):void 0),e[10]=a,e[11]=d,e[12]=l,e[13]=b):b=e[13];let S=b,I;e[14]!==p?(I=y(()=>p.poll(),"S"),e[14]=p,e[15]=I):I=e[15],ae(I,!0);let w;e[16]!==p?(w=y(async g=>{k(void 0);try{await g,p.refetch()}catch(F){k(ie(F))}},"N"),e[16]=p,e[17]=w):w=e[17];let C=w,J=v!==void 0||S!==void 0,$;e[18]!==f?($=f!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:f}),e[18]=f,e[19]=$):$=e[19];let j;e[20]!==h?.length||e[21]!==i?(j=h?.length===0&&(0,t.jsx)(se,{description:i("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:i("No dead-letter jobs.")}),e[20]=h?.length,e[21]=i,e[22]=j):j=e[22];let x;e[23]!==C||e[24]!==J||e[25]!==h||e[26]!==S||e[27]!==v||e[28]!==i?(x=h!==void 0&&h.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"dlq-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:i("function")}),(0,t.jsx)(L,{children:i("attempts")}),(0,t.jsx)(L,{children:i("last tried")}),(0,t.jsx)(L,{children:i("pool")}),(0,t.jsx)(L,{children:i("shard")}),(0,t.jsx)(L,{children:i("id")}),J&&(0,t.jsx)(L,{"aria-label":i("Actions")})]})}),(0,t.jsx)(re,{children:h.map(g=>(0,t.jsxs)(z,{"data-testid":`dlq-row-${g.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:g.workflow??g.functionPath}),(0,t.jsx)(K,{className:"tabular-nums",children:g.attempts??0}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:Qe(g.scheduledFor)}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.pool??""}),(0,t.jsx)(K,{children:g.shardKey??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:g.id}),J&&(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[v!==void 0&&(0,t.jsx)(ce,{"data-testid":`dlq-retry-${g.id}`,onClick:y(()=>{Y(C(v(g.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:i("Retry")}),S!==void 0&&(0,t.jsx)(ue,{confirmLabel:i("Drop job?"),onConfirm:y(()=>{Y(C(S(g.id)))},"onConfirm"),testId:`dlq-remove-${g.id}`,children:i("Drop")})]})})]},g.id))})]})})}),e[23]=C,e[24]=J,e[25]=h,e[26]=S,e[27]=v,e[28]=i,e[29]=x):x=e[29];let A;return e[30]!==x||e[31]!==$||e[32]!==j?(A=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,j,x]}),e[30]=x,e[31]=$,e[32]=j,e[33]=A):A=e[33],A},"Pe");function Ye(r,e){return(e.attempts??0)-(r.attempts??0)}y(Ye,"qe");var Ze={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},He=y(r=>{let e=(0,G.c)(47),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{loadJobs:n}=o,l=de(),s=V(),a;e[2]!==l||e[3]!==n?(a=n??(async O=>l.listScheduledHistory(O===void 0?{}:{cursor:O})),e[2]=l,e[3]=n,e[4]=a):a=e[4];let i=a,c=n?"custom":"default",N;e[5]!==c?(N=["lunora-job-history",c],e[5]=c,e[6]=N):N=e[6];let p;e[7]!==i?(p=y(async()=>i(),"f"),e[7]=i,e[8]=p):p=e[8];let h=ne(N,p),[m,k]=(0,Q.useState)(void 0),[f,d]=(0,Q.useState)(!1),[u,v]=(0,Q.useState)(void 0),b=h.data?.records,S;e[9]!==b?(S=new Set(b?.map(et)),e[9]=b,e[10]=S):S=e[10];let I=S,w=b===void 0?void 0:[...b,...(m?.records??[]).filter(O=>!I.has(O.id))],C=m===void 0?h.data?.cursor:m.cursor,J;e[11]!==i||e[12]!==C?(J=y(async()=>{d(!0),v(void 0);try{let O=await i(C);k(De=>({cursor:O.cursor,records:[...De?.records??[],...O.records]})),d(!1)}catch(O){v(ie(O)),d(!1)}},"L"),e[11]=i,e[12]=C,e[13]=J):J=e[13];let $=J,j;e[14]!==s?(j=s("canceled"),e[14]=s,e[15]=j):j=e[15];let x;e[16]!==s?(x=s("failed"),e[16]=s,e[17]=x):x=e[17];let A;e[18]!==s?(A=s("pending"),e[18]=s,e[19]=A):A=e[19];let g;e[20]!==s?(g=s("running"),e[20]=s,e[21]=g):g=e[21];let F;e[22]!==s?(F=s("succeeded"),e[22]=s,e[23]=F):F=e[23];let _;e[24]!==A||e[25]!==g||e[26]!==F||e[27]!==j||e[28]!==x?(_={canceled:j,failed:x,pending:A,running:g,succeeded:F},e[24]=A,e[25]=g,e[26]=F,e[27]=j,e[28]=x,e[29]=_):_=e[29];let T=_,M;e[30]!==h?(M=y(()=>h.poll(),"_"),e[30]=h,e[31]=M):M=e[31],ae(M,m===void 0);let R="flex flex-col gap-3",W="lunora-job-history",B;e[32]!==h.error?(B=h.error!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:h.error}),e[32]=h.error,e[33]=B):B=e[33];let E=w?.length===0&&(0,t.jsx)(se,{description:s("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:s("No finished jobs.")}),U=w!==void 0&&w.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"job-history-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:s("function")}),(0,t.jsx)(L,{children:s("state")}),(0,t.jsx)(L,{children:s("finished")}),(0,t.jsx)(L,{children:s("error")}),(0,t.jsx)(L,{children:s("id")})]})}),(0,t.jsx)(re,{children:w.map(O=>(0,t.jsxs)(z,{"data-testid":`job-history-row-${O.id}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:O.workflow??O.functionPath}),(0,t.jsx)(K,{children:(0,t.jsx)(oe,{"data-testid":`job-history-state-${O.id}`,variant:Ze[O.state],children:T[O.state]})}),(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:le(O.completedAt,"\u2014")}),(0,t.jsx)(K,{className:"text-xs text-destructive",children:O.error??""}),(0,t.jsx)(K,{className:"font-mono text-xs",children:O.id})]},O.id))})]})})}),P;e[34]!==u?(P=u!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive",role:"alert",children:u}),e[34]=u,e[35]=P):P=e[35];let X;e[36]!==f||e[37]!==C||e[38]!==$||e[39]!==s?(X=C!==void 0&&(0,t.jsx)("div",{children:(0,t.jsx)(ce,{"data-testid":"job-history-load-more",disabled:f,onClick:y(()=>{Y($())},"onClick"),variant:"outline",children:s(f?"Loading\u2026":"Load more")})}),e[36]=f,e[37]=C,e[38]=$,e[39]=s,e[40]=X):X=e[40];let q;return e[41]!==B||e[42]!==E||e[43]!==U||e[44]!==P||e[45]!==X?(q=(0,t.jsxs)("div",{className:R,"data-testid":W,children:[B,E,U,P,X]}),e[41]=B,e[42]=E,e[43]=U,e[44]=P,e[45]=X,e[46]=q):q=e[46],q},"Be");function et(r){return r.id}y(et,"He");var tt=fe(me.dropOutboxEntry),rt=fe(me.retryOutboxEntry),lt=y(()=>{let r=(0,G.c)(8),e=V(),o;r[0]!==e?(o=e("Jobs whose mutation committed but that the scheduler has not accepted yet wait here."),r[0]=e,r[1]=o):o=r[1];let n;r[2]===Symbol.for("react.memo_cache_sentinel")?(n=(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 4h16v12H4zM4 16l4 4h8l4-4"})}),r[2]=n):n=r[2];let l;r[3]!==e?(l=e("Nothing is waiting for the scheduler."),r[3]=e,r[4]=l):l=r[4];let s;return r[5]!==o||r[6]!==l?(s=(0,t.jsx)(se,{description:o,icon:n,testId:"outbox-empty",title:l}),r[5]=o,r[6]=l,r[7]=s):s=r[7],s},"ze"),at=y(r=>{let e=(0,G.c)(58),{entry:o,onAct:n}=r,l=V(),s=`outbox-row-${o.id}`,a;e[0]!==o.target||e[1]!==l?(a=o.target??l("unreadable"),e[0]=o.target,e[1]=l,e[2]=a):a=e[2];let i;e[3]!==a?(i=(0,t.jsx)(K,{className:"font-mono text-xs",children:a}),e[3]=a,e[4]=i):i=e[4];let c=o.parked?"destructive":"secondary",N;e[5]!==o.parked||e[6]!==l?(N=o.parked?l("parked"):l("retrying"),e[5]=o.parked,e[6]=l,e[7]=N):N=e[7];let p;e[8]!==c||e[9]!==N?(p=(0,t.jsx)(oe,{variant:c,children:N}),e[8]=c,e[9]=N,e[10]=p):p=e[10];let h;e[11]!==o.forever||e[12]!==l?(h=o.forever&&(0,t.jsx)(oe,{variant:"outline",children:l("forever")}),e[11]=o.forever,e[12]=l,e[13]=h):h=e[13];let m;e[14]!==p||e[15]!==h?(m=(0,t.jsx)(K,{children:(0,t.jsxs)("div",{className:"flex gap-1",children:[p,h]})}),e[14]=p,e[15]=h,e[16]=m):m=e[16];let k;e[17]!==o.attempts?(k=(0,t.jsx)(K,{className:"tabular-nums",children:o.attempts}),e[17]=o.attempts,e[18]=k):k=e[18];let f;e[19]!==o.nextAttemptAt||e[20]!==o.parked?(f=o.parked?"\u2014":le(o.nextAttemptAt,"\u2014"),e[19]=o.nextAttemptAt,e[20]=o.parked,e[21]=f):f=e[21];let d;e[22]!==f?(d=(0,t.jsx)(K,{className:"text-muted-foreground tabular-nums",children:f}),e[22]=f,e[23]=d):d=e[23];let u;e[24]!==o.id?(u=(0,t.jsx)(K,{className:"font-mono text-xs",children:o.id}),e[24]=o.id,e[25]=u):u=e[25];let v=`outbox-retry-${o.id}`,b;e[26]!==o.id||e[27]!==n?(b=y(()=>{Y(n(rt,o.id))},"b"),e[26]=o.id,e[27]=n,e[28]=b):b=e[28];let S;e[29]!==l?(S=l("Retry now"),e[29]=l,e[30]=S):S=e[30];let I;e[31]!==v||e[32]!==b||e[33]!==S?(I=(0,t.jsx)(ce,{"data-testid":v,onClick:b,size:"sm",type:"button",variant:"outline",children:S}),e[31]=v,e[32]=b,e[33]=S,e[34]=I):I=e[34];let w;e[35]!==l?(w=l("Drop job?"),e[35]=l,e[36]=w):w=e[36];let C;e[37]!==o.id||e[38]!==n?(C=y(()=>{Y(n(tt,o.id))},"T"),e[37]=o.id,e[38]=n,e[39]=C):C=e[39];let J=`outbox-drop-${o.id}`,$;e[40]!==l?($=l("Drop"),e[40]=l,e[41]=$):$=e[41];let j;e[42]!==w||e[43]!==C||e[44]!==J||e[45]!==$?(j=(0,t.jsx)(ue,{confirmLabel:w,onConfirm:C,testId:J,children:$}),e[42]=w,e[43]=C,e[44]=J,e[45]=$,e[46]=j):j=e[46];let x;e[47]!==I||e[48]!==j?(x=(0,t.jsx)(K,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[I,j]})}),e[47]=I,e[48]=j,e[49]=x):x=e[49];let A;return e[50]!==s||e[51]!==d||e[52]!==u||e[53]!==x||e[54]!==i||e[55]!==m||e[56]!==k?(A=(0,t.jsxs)(z,{"data-testid":s,children:[i,m,k,d,u,x]}),e[50]=s,e[51]=d,e[52]=u,e[53]=x,e[54]=i,e[55]=m,e[56]=k,e[57]=A):A=e[57],A},"We"),ot=y(r=>{let e=(0,G.c)(41),{entries:o,onAct:n}=r,l=V(),s;e[0]!==l?(s=l("function"),e[0]=l,e[1]=s):s=e[1];let a;e[2]!==s?(a=(0,t.jsx)(L,{children:s}),e[2]=s,e[3]=a):a=e[3];let i;e[4]!==l?(i=l("state"),e[4]=l,e[5]=i):i=e[5];let c;e[6]!==i?(c=(0,t.jsx)(L,{children:i}),e[6]=i,e[7]=c):c=e[7];let N;e[8]!==l?(N=l("attempts"),e[8]=l,e[9]=N):N=e[9];let p;e[10]!==N?(p=(0,t.jsx)(L,{children:N}),e[10]=N,e[11]=p):p=e[11];let h;e[12]!==l?(h=l("next attempt"),e[12]=l,e[13]=h):h=e[13];let m;e[14]!==h?(m=(0,t.jsx)(L,{children:h}),e[14]=h,e[15]=m):m=e[15];let k;e[16]!==l?(k=l("id"),e[16]=l,e[17]=k):k=e[17];let f;e[18]!==k?(f=(0,t.jsx)(L,{children:k}),e[18]=k,e[19]=f):f=e[19];let d;e[20]!==l?(d=l("Actions"),e[20]=l,e[21]=d):d=e[21];let u;e[22]!==d?(u=(0,t.jsx)(L,{"aria-label":d}),e[22]=d,e[23]=u):u=e[23];let v;e[24]!==f||e[25]!==u||e[26]!==a||e[27]!==c||e[28]!==p||e[29]!==m?(v=(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[a,c,p,m,f,u]})}),e[24]=f,e[25]=u,e[26]=a,e[27]=c,e[28]=p,e[29]=m,e[30]=v):v=e[30];let b;if(e[31]!==o||e[32]!==n){let w;e[34]!==n?(w=y(C=>(0,t.jsx)(at,{entry:C,onAct:n},C.id),"N"),e[34]=n,e[35]=w):w=e[35],b=o.map(w),e[31]=o,e[32]=n,e[33]=b}else b=e[33];let S;e[36]!==b?(S=(0,t.jsx)(re,{children:b}),e[36]=b,e[37]=S):S=e[37];let I;return e[38]!==v||e[39]!==S?(I=(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"outbox-table",children:[v,S]})})}),e[38]=v,e[39]=S,e[40]=I):I=e[40],I},"Ge"),nt=y(r=>{let e=(0,G.c)(11),{cursor:o,nextCursor:n,onFirst:l,onNext:s}=r,a=V();if(o===void 0&&n===void 0)return;let i;e[0]!==o||e[1]!==l||e[2]!==a?(i=o!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-first-page",onClick:l,size:"sm",type:"button",variant:"outline",children:a("First page")}),e[0]=o,e[1]=l,e[2]=a,e[3]=i):i=e[3];let c;e[4]!==n||e[5]!==s||e[6]!==a?(c=n!==void 0&&(0,t.jsx)(ce,{"data-testid":"outbox-next-page",onClick:y(()=>{s(n)},"onClick"),size:"sm",type:"button",variant:"outline",children:a("Next page")}),e[4]=n,e[5]=s,e[6]=a,e[7]=c):c=e[7];let N;return e[8]!==i||e[9]!==c?(N=(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[i,c]}),e[8]=i,e[9]=c,e[10]=N):N=e[10],N},"Ye"),st=y(r=>{let e=(0,G.c)(38),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n}=o,l=je(),s=V(),{queryShardKey:a,setShardKey:i,shardKey:c}=ge(n),N;e[2]!==a?(N={cursor:void 0,shardKey:a},e[2]=a,e[3]=N):N=e[3];let[p,h]=(0,Q.useState)(N);p.shardKey!==a&&h({cursor:void 0,shardKey:a});let m=p.shardKey===a?p.cursor:void 0,k=c.trim()!==a,f;e[4]!==m?(f=m===void 0?{}:{cursor:m},e[4]=m,e[5]=f):f=e[5];let d;e[6]!==a?(d={shardKey:a},e[6]=a,e[7]=d):d=e[7];let{data:u,error:v,poll:b,refetch:S}=ve(me.getScheduleOutbox,f,d),I=k?void 0:u?.entries,w=k?void 0:u?.nextCursor,[C,J]=(0,Q.useState)(void 0),$=v??(C?.shardKey===a?C.message:void 0);ae(b,!0);let j;e[8]!==l||e[9]!==a||e[10]!==S||e[11]!==s?(j=y(async(B,E)=>{J(void 0);try{(await l.query(B,{id:E},Ae(a))).retried===!1&&J({message:s("That job is no longer in the outbox."),shardKey:a}),S()}catch(U){J({message:ie(U),shardKey:a})}},"A"),e[8]=l,e[9]=a,e[10]=S,e[11]=s,e[12]=j):j=e[12];let x=j,A;e[13]!==i||e[14]!==c?(A=(0,t.jsx)(be,{onChange:i,testId:"outbox-shard-input",value:c}),e[13]=i,e[14]=c,e[15]=A):A=e[15];let g;e[16]!==$?(g=$!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"outbox-error",role:"alert",children:$}),e[16]=$,e[17]=g):g=e[17];let F;e[18]!==m||e[19]!==I?.length?(F=I?.length===0&&m===void 0&&(0,t.jsx)(lt,{}),e[18]=m,e[19]=I?.length,e[20]=F):F=e[20];let _;e[21]!==x||e[22]!==I?(_=I!==void 0&&I.length>0&&(0,t.jsx)(ot,{entries:I,onAct:x}),e[21]=x,e[22]=I,e[23]=_):_=e[23];let T,M;e[24]!==a?(T=y(()=>{h({cursor:void 0,shardKey:a})},"E"),M=y(B=>{h({cursor:B,shardKey:a})},"_"),e[24]=a,e[25]=T,e[26]=M):(T=e[25],M=e[26]);let R;e[27]!==m||e[28]!==w||e[29]!==T||e[30]!==M?(R=(0,t.jsx)(nt,{cursor:m,nextCursor:w,onFirst:T,onNext:M}),e[27]=m,e[28]=w,e[29]=T,e[30]=M,e[31]=R):R=e[31];let W;return e[32]!==R||e[33]!==A||e[34]!==g||e[35]!==F||e[36]!==_?(W=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-schedule-outbox",children:[A,g,F,_,R]}),e[32]=R,e[33]=A,e[34]=g,e[35]=F,e[36]=_,e[37]=W):W=e[37],W},"je"),it="scheduler.lag_ms",Ne=y(r=>{let e=r.attributes?.function;return typeof e=="string"?e:r.functionPath},"he"),ke=y(r=>{let e=(0,G.c)(8),{label:o,testId:n,value:l}=r,s;e[0]!==o?(s=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:o}),e[0]=o,e[1]=s):s=e[1];let a;e[2]!==n||e[3]!==l?(a=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":n,children:l}),e[2]=n,e[3]=l,e[4]=a):a=e[4];let i;return e[5]!==s||e[6]!==a?(i=(0,t.jsx)(Z,{className:"flex-1 py-0",children:(0,t.jsxs)(H,{className:"flex flex-col gap-1 p-4",children:[s,a]})}),e[5]=s,e[6]=a,e[7]=i):i=e[7],i},"fe"),dt=y(r=>{let e=(0,G.c)(65),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadStatus:l}=o,s=de(),a=V(),i=l===void 0,c;e[2]!==i?(c=["lunora-scheduler-status",i],e[2]=i,e[3]=c):c=e[3];let N;e[4]!==s||e[5]!==l?(N=y(async()=>{let B=await(l??(()=>s.schedulerStatus()))();return{...B,pools:B.pools.toSorted(ct)}},"v"),e[4]=s,e[5]=l,e[6]=N):N=e[6];let p=ne(c,N),{data:h,error:m}=p,{queryShardKey:k,setShardKey:f,shardKey:d}=ge(n),u;e[7]===Symbol.for("react.memo_cache_sentinel")?(u={},e[7]=u):u=e[7];let v;e[8]!==k?(v={shardKey:k},e[8]=k,e[9]=v):v=e[9];let b=ve(me.getMetricSeries,u,v),{data:S,errorSource:I}=b,w;e[10]!==I||e[11]!==b.error?(w=xe(I)==="FUNCTION_NOT_FOUND"?null:b.error,e[10]=I,e[11]=b.error,e[12]=w):w=e[12];let C=w,J;e[13]!==p?(J=y(()=>p.poll(),"L"),e[13]=p,e[14]=J):J=e[14],ae(J,!0);let $;e[15]!==b?($=y(()=>b.poll(),"$"),e[15]=b,e[16]=$):$=e[16],ae($,!0);let j,x,A,g,F,_,T,M;if(e[17]!==m||e[18]!==S||e[19]!==C||e[20]!==f||e[21]!==d||e[22]!==h||e[23]!==a){let B=(Array.isArray(S?.series)?S.series:[]).filter(ht).toSorted(ut);j="flex flex-col gap-3",x="lunora-scheduler-pools",e[32]!==m?(A=m!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:m}),e[32]=m,e[33]=A):A=e[33],e[34]!==h||e[35]!==a?(g=h!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(ke,{label:a("backlog"),testId:"pools-backlog",value:h.backlog}),(0,t.jsx)(ke,{label:a("in flight"),testId:"pools-inflight",value:h.inFlight}),(0,t.jsx)(ke,{label:a("pools"),testId:"pools-count",value:h.pools.length})]}),e[34]=h,e[35]=a,e[36]=g):g=e[36],e[37]!==h?.pools.length||e[38]!==a?(F=h?.pools.length===0&&(0,t.jsx)(se,{description:a("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:a("No workpools.")}),e[37]=h?.pools.length,e[38]=a,e[39]=F):F=e[39];let E;e[40]!==f||e[41]!==d?(E=(0,t.jsx)(be,{onChange:f,testId:"lag-shard-input",value:d}),e[40]=f,e[41]=d,e[42]=E):E=e[42];let U;e[43]!==a?(U=a("Start lag per job on this shard since it last woke; the series reset when the shard hibernates."),e[43]=a,e[44]=U):U=e[44];let P;e[45]!==U?(P=(0,t.jsx)("p",{className:"text-xs text-muted-foreground","data-testid":"lag-scope",children:U}),e[45]=U,e[46]=P):P=e[46],e[47]!==E||e[48]!==P?(_=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[E,P]}),e[47]=E,e[48]=P,e[49]=_):_=e[49],e[50]!==C?(T=C!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"lag-error",role:"alert",children:C}),e[50]=C,e[51]=T):T=e[51],M=C===null&&B.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"lag-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("function")}),(0,t.jsx)(L,{children:a("runs")}),(0,t.jsx)(L,{children:a("mean lag (ms)")}),(0,t.jsx)(L,{children:a("max lag (ms)")}),(0,t.jsx)(L,{children:a("last lag (ms)")})]})}),(0,t.jsx)(re,{children:B.map(mt)})]})})}),e[17]=m,e[18]=S,e[19]=C,e[20]=f,e[21]=d,e[22]=h,e[23]=a,e[24]=j,e[25]=x,e[26]=A,e[27]=g,e[28]=F,e[29]=_,e[30]=T,e[31]=M}else j=e[24],x=e[25],A=e[26],g=e[27],F=e[28],_=e[29],T=e[30],M=e[31];let R;e[52]!==h||e[53]!==a?(R=h!==void 0&&h.pools.length>0&&(0,t.jsx)(Z,{className:"overflow-hidden py-0",children:(0,t.jsx)(H,{className:"px-0",children:(0,t.jsxs)(ee,{"data-testid":"pools-table",children:[(0,t.jsx)(te,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(L,{children:a("pool")}),(0,t.jsx)(L,{children:a("queued")}),(0,t.jsx)(L,{children:a("in flight")}),(0,t.jsx)(L,{children:a("max concurrency")})]})}),(0,t.jsx)(re,{children:h.pools.map(pt)})]})})}),e[52]=h,e[53]=a,e[54]=R):R=e[54];let W;return e[55]!==j||e[56]!==x||e[57]!==A||e[58]!==g||e[59]!==F||e[60]!==_||e[61]!==T||e[62]!==M||e[63]!==R?(W=(0,t.jsxs)("div",{className:j,"data-testid":x,children:[A,g,F,_,T,M,R]}),e[55]=j,e[56]=x,e[57]=A,e[58]=g,e[59]=F,e[60]=_,e[61]=T,e[62]=M,e[63]=R,e[64]=W):W=e[64],W},"Ze");function ct(r,e){return e.queued-r.queued}y(ct,"et");function ht(r){return r.name===it&&r.kind==="histogram"&&r.count>0}y(ht,"tt");function ut(r,e){return e.max-r.max}y(ut,"st");function mt(r){return(0,t.jsxs)(z,{"data-testid":`lag-row-${Ne(r)}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:Ne(r)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.count}),(0,t.jsx)(K,{className:"tabular-nums",children:Math.round(r.sum/r.count)}),(0,t.jsx)(K,{className:"tabular-nums",children:r.max}),(0,t.jsx)(K,{className:"tabular-nums",children:r.last})]},Ne(r))}y(mt,"lt");function pt(r){return(0,t.jsxs)(z,{"data-testid":`pools-row-${r.name}`,children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:r.name}),(0,t.jsx)(K,{className:"tabular-nums",children:r.queued}),(0,t.jsxs)(K,{className:"tabular-nums",children:[r.inFlight," / ",r.maxConcurrency]}),(0,t.jsx)(K,{className:"tabular-nums",children:r.maxConcurrency})]},r.name)}y(pt,"rt");var ft=["jobs","outbox","history","dead","pools","cron"],Vt=y(r=>{let e=(0,G.c)(55),o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];let{initialShardKey:n,loadCronJobs:l,scheduledCancel:s,scheduledLoad:a}=o,i=V(),[c,N]=(0,Q.useState)("jobs"),p;e[2]!==i?(p=i("Cron triggers"),e[2]=i,e[3]=p):p=e[3];let h;e[4]!==i?(h=i("Dead letter"),e[4]=i,e[5]=h):h=e[5];let m;e[6]!==i?(m=i("History"),e[6]=i,e[7]=m):m=e[7];let k;e[8]!==i?(k=i("Scheduled jobs"),e[8]=i,e[9]=k):k=e[9];let f;e[10]!==i?(f=i("Outbox"),e[10]=i,e[11]=f):f=e[11];let d;e[12]!==i?(d=i("Pools"),e[12]=i,e[13]=d):d=e[13];let u;e[14]!==p||e[15]!==h||e[16]!==m||e[17]!==k||e[18]!==f||e[19]!==d?(u={cron:p,dead:h,history:m,jobs:k,outbox:f,pools:d},e[14]=p,e[15]=h,e[16]=m,e[17]=k,e[18]=f,e[19]=d,e[20]=u):u=e[20];let v=u,b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=y(T=>{N(T.currentTarget.dataset.view)},"b"),e[21]=b):b=e[21];let S=b,I;e[22]===Symbol.for("react.memo_cache_sentinel")?(I=(0,t.jsx)(Le,{}),e[22]=I):I=e[22];let w;e[23]!==i?(w=i("Schedule view"),e[23]=i,e[24]=w):w=e[24];let C;e[25]!==c||e[26]!==v?(C=ft.map(T=>(0,t.jsx)(ce,{"aria-selected":c===T,"data-testid":`schedule-view-${T}`,"data-view":T,onClick:S,role:"tab",size:"sm",type:"button",variant:c===T?"default":"outline",children:v[T]},T)),e[25]=c,e[26]=v,e[27]=C):C=e[27];let J;e[28]!==w||e[29]!==C?(J=(0,t.jsx)("div",{"aria-label":w,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:C}),e[28]=w,e[29]=C,e[30]=J):J=e[30];let $;e[31]!==s||e[32]!==a||e[33]!==c?($=c==="jobs"&&(0,t.jsx)(Te,{cancelJob:s,loadJobs:a}),e[31]=s,e[32]=a,e[33]=c,e[34]=$):$=e[34];let j;e[35]!==c?(j=c==="outbox"&&(0,t.jsx)(st,{}),e[35]=c,e[36]=j):j=e[36];let x;e[37]!==c?(x=c==="history"&&(0,t.jsx)(He,{}),e[37]=c,e[38]=x):x=e[38];let A;e[39]!==c?(A=c==="dead"&&(0,t.jsx)(Xe,{}),e[39]=c,e[40]=A):A=e[40];let g;e[41]!==n||e[42]!==c?(g=c==="pools"&&(0,t.jsx)(dt,{initialShardKey:n}),e[41]=n,e[42]=c,e[43]=g):g=e[43];let F;e[44]!==l||e[45]!==c?(F=c==="cron"&&(0,t.jsx)(Ge,{loadCronJobs:l}),e[44]=l,e[45]=c,e[46]=F):F=e[46];let _;return e[47]!==J||e[48]!==$||e[49]!==j||e[50]!==x||e[51]!==A||e[52]!==g||e[53]!==F?(_=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,J,$,j,x,A,g,F]}),e[47]=J,e[48]=$,e[49]=j,e[50]=x,e[51]=A,e[52]=g,e[53]=F,e[54]=_):_=e[54],_},"It");export{Vt as SchedulePanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as be}from"./chunk-RIAOZECW.js";import{a as le}from"./chunk-ELUYMLPL.js";import"./chunk-BQS3C5V3.js";import{a as ve}from"./chunk-7SNL633X.js";import"./chunk-Y2YLTUMD.js";import"./chunk-BG2CJOVS.js";import{a as xe}from"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import"./chunk-4EPW63HS.js";import{b as ee}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import"./chunk-4PI2OSSP.js";import{a as B}from"./chunk-6A6AELDJ.js";import{c as ge}from"./chunk-TUFOWHEF.js";import{a as X}from"./chunk-OSHODLMU.js";import{m as he,n as fe}from"./chunk-ODLNNVP2.js";import"./chunk-ZPQBVYNN.js";import{B as U,h as W,i as ie,j as ce,s as se,w as pe,x as $}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as ue}from"./chunk-GWNGVKLG.js";import{a as Ae,b as me}from"./chunk-6G3E4PJ2.js";import{a as h,d as Z}from"./chunk-5PEAXTYQ.js";var te=Z(ue(),1),x=Z(Ae(),1);var Ne=Z(ue(),1);var ae=Z(me(),1);var je={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},ye=h(()=>{let t=(0,Ne.c)(18),e=U(),n=he(),r;e:switch(n){case"connected":{let l;t[0]!==e?(l=e("Connected"),t[0]=e,t[1]=l):l=t[1],r=l;break e}case"connecting":{let l;t[2]!==e?(l=e("Connecting\u2026"),t[2]=e,t[3]=l):l=t[3],r=l;break e}case"idle":{let l;t[4]!==e?(l=e("Idle"),t[4]=e,t[5]=l):l=t[5],r=l;break e}case"offline":{let l;t[6]!==e?(l=e("Offline"),t[6]=e,t[7]=l):l=t[7],r=l;break e}case"polling":{let l;t[8]!==e?(l=e("Polling"),t[8]=e,t[9]=l):l=t[9],r=l;break e}default:r=n}let a=je[n],c;t[10]!==a?(c=$("size-2 rounded-full",a),t[10]=a,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,ae.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==n||t[15]!==i||t[16]!==r?(o=(0,ae.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":n,"data-testid":"dash-connection",role:"status",children:[i,r]}),t[14]=n,t[15]=i,t[16]=r,t[17]=o):o=t[17],o},"T");var s=Z(me(),1);var Te={crit:"destructive",ok:"secondary",warn:"default"},oe=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"re"),de=h((t,e,n)=>Number.isNaN(t)?"ok":t>=n?"crit":t>=e?"warn":"ok","oe"),Se=.01,Ee=.05,Ce=h(t=>{let e=(0,te.c)(36),{errorCount:n,logsError:r,topErrors:a,worstFunctions:c}=t,i=U(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==o?(l=(0,s.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,s.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=l):l=e[3];let u;e[4]!==i||e[5]!==c?(u=c.length===0?(0,s.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,s.jsx)("ul",{className:"divide-y divide-border",children:c.map(y=>(0,s.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,s.jsx)("span",{className:"truncate font-mono text-foreground",children:y.path}),(0,s.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:y.calls.toString()})}),(0,s.jsx)(ee,{variant:Te[de(y.errors/y.calls,Se,Ee)],children:oe(y.errors,y.calls)})]})]},y.path))}),e[4]=i,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==l||e[8]!==u?(f=(0,s.jsxs)(X,{className:"gap-0 py-0","data-testid":"hl-functions",children:[l,u]}),e[7]=l,e[8]=u,e[9]=f):f=e[9];let v;e[10]!==i?(v=i("Recent errors"),e[10]=i,e[11]=v):v=e[11];let m;e[12]!==v?(m=(0,s.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=m):m=e[13];let d=n>0?"destructive":"outline",g;e[14]!==n||e[15]!==d?(g=(0,s.jsx)(ee,{"data-testid":"hl-error-count",variant:d,children:n}),e[14]=n,e[15]=d,e[16]=g):g=e[16];let p;e[17]!==m||e[18]!==g?(p=(0,s.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[m,g]}),e[17]=m,e[18]=g,e[19]=p):p=e[19];let S;e[20]!==r?(S=r!==null&&(0,s.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:r}),e[20]=r,e[21]=S):S=e[21];let E;e[22]!==r||e[23]!==i||e[24]!==a.length?(E=r===null&&a.length===0&&(0,s.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=r,e[23]=i,e[24]=a.length,e[25]=E):E=e[25];let q;e[26]!==a?(q=a.length>0&&(0,s.jsx)("ul",{className:"divide-y divide-border",children:a.map(Ie)}),e[26]=a,e[27]=q):q=e[27];let w;e[28]!==S||e[29]!==E||e[30]!==q||e[31]!==p?(w=(0,s.jsxs)(X,{className:"gap-0 py-0",children:[p,S,E,q]}),e[28]=S,e[29]=E,e[30]=q,e[31]=p,e[32]=w):w=e[32];let k;return e[33]!==w||e[34]!==f?(k=(0,s.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[f,w]}),e[33]=w,e[34]=f,e[35]=k):k=e[35],k},"_e");function Ie(t,e){return(0,s.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("time",{className:"shrink-0 text-muted-foreground",children:pe(t.timestamp)}),t.functionPath!==void 0&&(0,s.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,s.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}h(Ie,"Ae");var we={completed:0,failed:2,in_progress:1},De=h(t=>{let e=0,n=0,r=0,a=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){a+=1;continue}r+=1,e+=o.requests,n+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:n,failed:a,history:i,historyTruncated:c,reachable:r,requests:e}},"ke"),_e=h(t=>{let e=new Map;for(let n of t)for(let r of n){let a=e.get(r.path);if(a===void 0){e.set(r.path,{...r});continue}a.calls+=r.calls,a.errors+=r.errors,a.totalDurationMs+=r.totalDurationMs,a.scans=(a.scans??0)+(r.scans??0),a.maxDurationMs=Math.max(a.maxDurationMs,r.maxDurationMs),a.lastCalledAt=Math.max(a.lastCalledAt,r.lastCalledAt),(r.lastErrorAt??0)>(a.lastErrorAt??0)&&(a.lastErrorAt=r.lastErrorAt,a.lastErrorMessage=r.lastErrorMessage)}return[...e.values()]},"Re"),Pe=h(t=>{let e=new Map;for(let n of t)for(let r of n){let a=e.get(r.id);if(a===void 0){e.set(r.id,r);continue}let c=we[r.status]-we[a.status];(c>0||c===0&&(r.updatedAt??0)>(a.updatedAt??0))&&e.set(r.id,r)}return[...e.values()]},"Me"),Le=W(B.getAuthMetrics),Fe=W(B.getFunctionStats),Re=W(B.getLogs),Oe=W(B.getMetrics),ze=W(B.migrationStatus),$e=5,ke=2e3,Ke=5,Be=.1,Ue=.3,Ge=1,He=50,Qe=h((t,e,n)=>t>=n?"crit":t>=e?"warn":"ok","$e"),Je=h(t=>{let e=new Map;for(let r of t??[]){let a=e.get(r.bucketMs)??{calls:0,errors:0};a.calls+=r.calls,a.errors+=r.errors,e.set(r.bucketMs,a)}let n=[...e.entries()].toSorted((r,a)=>r[0]-a[0]);return{errors:n.map(([,r])=>r.errors),requests:n.map(([,r])=>r.calls)}},"Be"),Ve=h(t=>{let e=0,n=0;for(let a of t)a.status==="failed"?e+=1:a.status==="in_progress"&&(n+=1);let r="ok";return e>0?r="crit":n>0&&(r="warn"),{failed:e,level:r,running:n}},"Ve"),We=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"He"),qe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Me={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Xe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Ye=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","ze"),ne=h(t=>{let e=(0,te.c)(19),{chart:n,label:r,level:a,testId:c,value:i}=t,o=qe[a],l;e[0]!==o?(l=$("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]!==l?(u=(0,s.jsx)("span",{"aria-hidden":"true",className:l}),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==r||e[5]!==u?(f=(0,s.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[u,r]}),e[4]=r,e[5]=u,e[6]=f):f=e[6];let v=Me[a],m;e[7]!==v?(m=$("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=m):m=e[8];let d;e[9]!==m||e[10]!==c||e[11]!==i?(d=(0,s.jsx)("span",{className:m,"data-testid":c,children:i}),e[9]=m,e[10]=c,e[11]=i,e[12]=d):d=e[12];let g;e[13]!==n||e[14]!==d?(g=(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[d,n]}),e[13]=n,e[14]=d,e[15]=g):g=e[15];let p;return e[16]!==f||e[17]!==g?(p=(0,s.jsx)(X,{className:"gap-0 py-0",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[f,g]})}),e[16]=f,e[17]=g,e[18]=p):p=e[18],p},"ee"),Ze=h(async(t,e,n)=>{let r=await Promise.all(n.map(m=>{let d=ie(m);return Promise.allSettled([t.query(Oe,{},d),t.query(Fe,{},d),t.query(ze,{},d)])})),a=ie(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,l]=await Promise.allSettled([t.query(Re,{},a),t.query(Le,{},a),c]),u=r.map(([m,d,g])=>({functions:d.status==="fulfilled"?d.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),f=De(u),v=r[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:_e(u.map(m=>m.functions)),logsError:i.status==="rejected"?ce(i.reason):null,metricsError:f.reachable===0&&v?.status==="rejected"?ce(v.reason):null,migrations:Pe(u.map(m=>m.migrations)),scheduler:l.status==="fulfilled"?l.value:null,totals:f}},"Qe"),et=h(t=>{let e=t?.history??[];return{attempts:e.map(n=>n.attempts),failures:e.map(n=>n.failures)}},"We"),tt=h((t,e)=>t==="crit"?{description:e("One or more service levels are breached."),label:e("Critical")}:t==="warn"?{description:e("Some service levels need attention."),label:e("Degraded")}:{description:e("All service levels are within target."),label:e("All systems healthy")},"Xe"),rt=h(t=>{let e=(0,te.c)(75),{errorLevel:n,liveError:r,metricsError:a,overall:c,requestSeries:i,totals:o}=t,l=U(),u;e[0]!==c||e[1]!==l?(u=tt(c,l),e[0]=c,e[1]=l,e[2]=u):u=e[2];let{description:f,label:v}=u,m=Xe[c],d;e[3]!==m?(d=$("flex size-10 shrink-0 items-center justify-center rounded-full",m),e[3]=m,e[4]=d):d=e[4];let g=qe[c],p;e[5]!==g?(p=$("size-3 rounded-full",g),e[5]=g,e[6]=p):p=e[6];let S;e[7]!==p?(S=(0,s.jsx)("span",{className:p}),e[7]=p,e[8]=S):S=e[8];let E;e[9]!==d||e[10]!==S?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:d,children:S}),e[9]=d,e[10]=S,e[11]=E):E=e[11];let q;e[12]!==v?(q=(0,s.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:v}),e[12]=v,e[13]=q):q=e[13];let w;e[14]!==f?(w=(0,s.jsx)("span",{className:"text-[13px] text-muted-foreground",children:f}),e[14]=f,e[15]=w):w=e[15];let k;e[16]!==q||e[17]!==w?(k=(0,s.jsxs)("div",{className:"grid leading-tight",children:[q,w]}),e[16]=q,e[17]=w,e[18]=k):k=e[18];let y;e[19]!==k||e[20]!==E?(y=(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[E,k]}),e[19]=k,e[20]=E,e[21]=y):y=e[21];let j;e[22]!==l?(j=l("Requests"),e[22]=l,e[23]=j):j=e[23];let M;e[24]!==j?(M=(0,s.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:j}),e[24]=j,e[25]=M):M=e[25];let A;e[26]!==i||e[27]!==l?(A=i.length>=2&&(0,s.jsx)(le,{ariaLabel:l("Requests over time"),className:"h-6 w-20 text-foreground",series:i,testId:"hl-spark-requests"}),e[26]=i,e[27]=l,e[28]=A):A=e[28];let F=o?.requests??0,R;e[29]!==F?(R=F.toString(),e[29]=F,e[30]=R):R=e[30];let D;e[31]!==R?(D=(0,s.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:R}),e[31]=R,e[32]=D):D=e[32];let O;e[33]!==A||e[34]!==D?(O=(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[A,D]}),e[33]=A,e[34]=D,e[35]=O):O=e[35];let _;e[36]!==M||e[37]!==O?(_=(0,s.jsxs)("div",{className:"text-end",children:[M,O]}),e[36]=M,e[37]=O,e[38]=_):_=e[38];let G;e[39]===Symbol.for("react.memo_cache_sentinel")?(G=(0,s.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),e[39]=G):G=e[39];let T;e[40]!==l?(T=l("Error rate"),e[40]=l,e[41]=T):T=e[41];let P;e[42]!==T?(P=(0,s.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:T}),e[42]=T,e[43]=P):P=e[43];let Y=Me[n],C;e[44]!==Y?(C=$("text-lg font-semibold tabular-nums",Y),e[44]=Y,e[45]=C):C=e[45];let z;e[46]!==o?(z=o===null?"\u2014":oe(o.errors,o.requests),e[46]=o,e[47]=z):z=e[47];let I;e[48]!==C||e[49]!==z?(I=(0,s.jsx)("div",{className:C,"data-testid":"hl-error-rate",children:z}),e[48]=C,e[49]=z,e[50]=I):I=e[50];let L;e[51]!==P||e[52]!==I?(L=(0,s.jsxs)("div",{className:"text-end",children:[P,I]}),e[51]=P,e[52]=I,e[53]=L):L=e[53];let K;e[54]===Symbol.for("react.memo_cache_sentinel")?(K=(0,s.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),e[54]=K):K=e[54];let H;e[55]===Symbol.for("react.memo_cache_sentinel")?(H=(0,s.jsx)(ye,{}),e[55]=H):H=e[55];let b;e[56]!==r?(b=(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[H,(0,s.jsx)(ve,{message:r,prefix:"hl"})]}),e[56]=r,e[57]=b):b=e[57];let N;e[58]!==_||e[59]!==L||e[60]!==b?(N=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[_,G,L,K,b]}),e[58]=_,e[59]=L,e[60]=b,e[61]=N):N=e[61];let Q;e[62]!==y||e[63]!==N?(Q=(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[y,N]}),e[62]=y,e[63]=N,e[64]=Q):Q=e[64];let J;e[65]!==a?(J=a!==null&&(0,s.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:a}),e[65]=a,e[66]=J):J=e[66];let V;e[67]!==a||e[68]!==l||e[69]!==o?.historyTruncated?(V=a===null&&o?.historyTruncated===!0&&(0,s.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:l("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")}),e[67]=a,e[68]=l,e[69]=o?.historyTruncated,e[70]=V):V=e[70];let re;return e[71]!==Q||e[72]!==J||e[73]!==V?(re=(0,s.jsxs)(X,{className:"gap-0 py-0",children:[Q,J,V]}),e[71]=Q,e[72]=J,e[73]=V,e[74]=re):re=e[74],re},"Je"),st=h(t=>{let e=(0,te.c)(14),{shards:n}=t,r=U(),a;e[0]!==r?(a=r("Shards seen"),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==a?(c=(0,s.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=c):c=e[3];let i;e[4]!==n.length?(i=(0,s.jsx)(ee,{"data-testid":"hl-shard-count",variant:"outline",children:n.length}),e[4]=n.length,e[5]=i):i=e[5];let o;e[6]!==c||e[7]!==i?(o=(0,s.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[c,i]}),e[6]=c,e[7]=i,e[8]=o):o=e[8];let l;e[9]!==n?(l=n.length>0&&(0,s.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:n.map(lt)}),e[9]=n,e[10]=l):l=e[10];let u;return e[11]!==o||e[12]!==l?(u=(0,s.jsxs)(X,{className:"gap-0 py-0",children:[o,l]}),e[11]=o,e[12]=l,e[13]=u):u=e[13],u},"Ye"),kt=h(({initialShardKey:t})=>{let e=fe(),n=U(),[r,a]=(0,x.useState)([]),[c,i]=(0,x.useState)(null),[o,l]=(0,x.useState)(null),[u,f]=(0,x.useState)(null),[v,m]=(0,x.useState)([]),[d,g]=(0,x.useState)(null),[p,S]=(0,x.useState)(null),[E,q]=(0,x.useState)([]),[w]=(0,x.useState)(xe),k=(0,x.useRef)(!1),y=(0,x.useRef)(0),j=(0,x.useRef)(0),M=(0,x.useRef)(null),A=t??"",F=(0,x.useCallback)(async()=>{if(k.current)return;k.current=!0;let b=y.current,N=await Ze(e,A,be(A,w));b===y.current&&(l(N.totals),f(N.metricsError),m(N.functions),q(N.migrations),a(N.entries),i(N.logsError),g(N.auth),S(N.scheduler),k.current=!1)},[e,w,A]);(0,x.useEffect)(()=>(se(F()),()=>{y.current+=1,k.current=!1,M.current!==null&&(clearTimeout(M.current),M.current=null)}),[F]);let R=h(()=>{let b=Date.now()-j.current;if(b>=ke){j.current=Date.now(),se(F());return}M.current===null&&(M.current=setTimeout(()=>{M.current=null,j.current=Date.now(),se(F())},ke-b))},"j"),{data:D,liveError:O}=ge(B.getMetrics,{},{live:!0,shardKey:A});(0,x.useEffect)(()=>{D!==void 0&&R()},[D]);let _=r.filter(b=>b.level==="error"),G=_.slice(0,$e),T=Je(o?.history),P=et(d),Y=v.filter(b=>b.calls>0).toSorted((b,N)=>N.errors/N.calls-b.errors/b.calls||N.calls-b.calls).slice(0,Ke),C=Ve(E),z=o===null||o.requests===0?0:o.errors/o.requests,I=de(z,Se,Ee),L=d===null?"ok":de(d.failureRate,Be,Ue),K=p===null?"ok":Qe(p.backlog,Ge,He),H=Ye([I,L,K,C.level]);return(0,s.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,s.jsx)(rt,{errorLevel:I,liveError:O,metricsError:u,overall:H,requestSeries:T.requests,totals:o}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,s.jsx)(ne,{chart:T.errors.length>=2?(0,s.jsx)(le,{ariaLabel:n("Errors over time"),className:"h-7 w-20 text-destructive",series:T.errors,testId:"hl-spark-errors"}):void 0,label:n("Error rate"),level:I,testId:"hl-slo-errorrate",value:o===null?"\u2014":oe(o.errors,o.requests)}),(0,s.jsx)(ne,{chart:P.failures.length>=2?(0,s.jsx)(le,{ariaLabel:n("Auth failures over time"),className:"h-7 w-20 text-destructive",series:P.failures,testId:"hl-spark-auth"}):void 0,label:n("Auth failures"),level:L,testId:"hl-slo-auth",value:d===null?"\u2014":oe(d.failures,d.attempts)}),(0,s.jsx)(ne,{label:n("Scheduler backlog"),level:K,testId:"hl-slo-backlog",value:p===null?"\u2014":p.backlog.toString()}),(0,s.jsx)(ne,{label:n("Migrations"),level:C.level,testId:"hl-slo-migrations",value:We(C,n)})]}),(0,s.jsx)(Ce,{errorCount:_.length,logsError:c,topErrors:G,worstFunctions:Y}),(0,s.jsx)(st,{shards:w})]})},"gt");function lt(t){return(0,s.jsx)("li",{"data-testid":"hl-shard",children:(0,s.jsx)(ee,{variant:"secondary",children:t})},t)}h(lt,"Ze");export{kt as HealthPanel};
|
|
1
|
+
import{b as be}from"./chunk-RIAOZECW.js";import{a as le}from"./chunk-ELUYMLPL.js";import"./chunk-BQS3C5V3.js";import{a as ve}from"./chunk-7SNL633X.js";import"./chunk-Y2YLTUMD.js";import"./chunk-BG2CJOVS.js";import{a as xe}from"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-QRA7AKYO.js";import"./chunk-4EPW63HS.js";import{b as ee}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import"./chunk-4PI2OSSP.js";import{a as B}from"./chunk-6A6AELDJ.js";import{c as ge}from"./chunk-CLQKKJHL.js";import{a as X}from"./chunk-OSHODLMU.js";import{m as he,n as fe}from"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as U,h as W,i as ie,j as ce,s as se,w as pe,x as $}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as ue}from"./chunk-GWNGVKLG.js";import{a as Ae,b as me}from"./chunk-6G3E4PJ2.js";import{a as h,d as Z}from"./chunk-5PEAXTYQ.js";var te=Z(ue(),1),x=Z(Ae(),1);var Ne=Z(ue(),1);var ae=Z(me(),1);var je={connected:"bg-success",connecting:"bg-warning",idle:"bg-muted-foreground",offline:"bg-destructive",polling:"bg-warning"},ye=h(()=>{let t=(0,Ne.c)(18),e=U(),n=he(),r;e:switch(n){case"connected":{let l;t[0]!==e?(l=e("Connected"),t[0]=e,t[1]=l):l=t[1],r=l;break e}case"connecting":{let l;t[2]!==e?(l=e("Connecting\u2026"),t[2]=e,t[3]=l):l=t[3],r=l;break e}case"idle":{let l;t[4]!==e?(l=e("Idle"),t[4]=e,t[5]=l):l=t[5],r=l;break e}case"offline":{let l;t[6]!==e?(l=e("Offline"),t[6]=e,t[7]=l):l=t[7],r=l;break e}case"polling":{let l;t[8]!==e?(l=e("Polling"),t[8]=e,t[9]=l):l=t[9],r=l;break e}default:r=n}let a=je[n],c;t[10]!==a?(c=$("size-2 rounded-full",a),t[10]=a,t[11]=c):c=t[11];let i;t[12]!==c?(i=(0,ae.jsx)("span",{"aria-hidden":"true",className:c}),t[12]=c,t[13]=i):i=t[13];let o;return t[14]!==n||t[15]!==i||t[16]!==r?(o=(0,ae.jsxs)("span",{"aria-live":"polite",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground","data-status":n,"data-testid":"dash-connection",role:"status",children:[i,r]}),t[14]=n,t[15]=i,t[16]=r,t[17]=o):o=t[17],o},"T");var s=Z(me(),1);var Te={crit:"destructive",ok:"secondary",warn:"default"},oe=h((t,e)=>e===0?"\u2014":`${(t/e*100).toFixed(1)}%`,"re"),de=h((t,e,n)=>Number.isNaN(t)?"ok":t>=n?"crit":t>=e?"warn":"ok","oe"),Se=.01,Ee=.05,Ce=h(t=>{let e=(0,te.c)(36),{errorCount:n,logsError:r,topErrors:a,worstFunctions:c}=t,i=U(),o;e[0]!==i?(o=i("Functions by error rate"),e[0]=i,e[1]=o):o=e[1];let l;e[2]!==o?(l=(0,s.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,s.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o})}),e[2]=o,e[3]=l):l=e[3];let u;e[4]!==i||e[5]!==c?(u=c.length===0?(0,s.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:i("No function activity yet.")}):(0,s.jsx)("ul",{className:"divide-y divide-border",children:c.map(y=>(0,s.jsxs)("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[(0,s.jsx)("span",{className:"truncate font-mono text-foreground",children:y.path}),(0,s.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"tabular-nums text-muted-foreground",children:i("{count} calls",{count:y.calls.toString()})}),(0,s.jsx)(ee,{variant:Te[de(y.errors/y.calls,Se,Ee)],children:oe(y.errors,y.calls)})]})]},y.path))}),e[4]=i,e[5]=c,e[6]=u):u=e[6];let f;e[7]!==l||e[8]!==u?(f=(0,s.jsxs)(X,{className:"gap-0 py-0","data-testid":"hl-functions",children:[l,u]}),e[7]=l,e[8]=u,e[9]=f):f=e[9];let v;e[10]!==i?(v=i("Recent errors"),e[10]=i,e[11]=v):v=e[11];let m;e[12]!==v?(m=(0,s.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=m):m=e[13];let d=n>0?"destructive":"outline",g;e[14]!==n||e[15]!==d?(g=(0,s.jsx)(ee,{"data-testid":"hl-error-count",variant:d,children:n}),e[14]=n,e[15]=d,e[16]=g):g=e[16];let p;e[17]!==m||e[18]!==g?(p=(0,s.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[m,g]}),e[17]=m,e[18]=g,e[19]=p):p=e[19];let S;e[20]!==r?(S=r!==null&&(0,s.jsx)("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:r}),e[20]=r,e[21]=S):S=e[21];let E;e[22]!==r||e[23]!==i||e[24]!==a.length?(E=r===null&&a.length===0&&(0,s.jsx)("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:i("No recent errors.")}),e[22]=r,e[23]=i,e[24]=a.length,e[25]=E):E=e[25];let q;e[26]!==a?(q=a.length>0&&(0,s.jsx)("ul",{className:"divide-y divide-border",children:a.map(Ie)}),e[26]=a,e[27]=q):q=e[27];let w;e[28]!==S||e[29]!==E||e[30]!==q||e[31]!==p?(w=(0,s.jsxs)(X,{className:"gap-0 py-0",children:[p,S,E,q]}),e[28]=S,e[29]=E,e[30]=q,e[31]=p,e[32]=w):w=e[32];let k;return e[33]!==w||e[34]!==f?(k=(0,s.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[f,w]}),e[33]=w,e[34]=f,e[35]=k):k=e[35],k},"_e");function Ie(t,e){return(0,s.jsxs)("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("time",{className:"shrink-0 text-muted-foreground",children:pe(t.timestamp)}),t.functionPath!==void 0&&(0,s.jsx)("span",{className:"truncate font-mono text-foreground",children:t.functionPath})]}),(0,s.jsx)("span",{className:"text-destructive",children:t.message})]},`${t.timestamp.toString()}-${e.toString()}`)}h(Ie,"Ae");var we={completed:0,failed:2,in_progress:1},De=h(t=>{let e=0,n=0,r=0,a=0,c=!1,i=[];for(let{metrics:o}of t){if(o===null){a+=1;continue}r+=1,e+=o.requests,n+=o.errors,i.push(...o.history??[]),c||=o.historyTruncated===!0}return{errors:n,failed:a,history:i,historyTruncated:c,reachable:r,requests:e}},"ke"),_e=h(t=>{let e=new Map;for(let n of t)for(let r of n){let a=e.get(r.path);if(a===void 0){e.set(r.path,{...r});continue}a.calls+=r.calls,a.errors+=r.errors,a.totalDurationMs+=r.totalDurationMs,a.scans=(a.scans??0)+(r.scans??0),a.maxDurationMs=Math.max(a.maxDurationMs,r.maxDurationMs),a.lastCalledAt=Math.max(a.lastCalledAt,r.lastCalledAt),(r.lastErrorAt??0)>(a.lastErrorAt??0)&&(a.lastErrorAt=r.lastErrorAt,a.lastErrorMessage=r.lastErrorMessage)}return[...e.values()]},"Re"),Pe=h(t=>{let e=new Map;for(let n of t)for(let r of n){let a=e.get(r.id);if(a===void 0){e.set(r.id,r);continue}let c=we[r.status]-we[a.status];(c>0||c===0&&(r.updatedAt??0)>(a.updatedAt??0))&&e.set(r.id,r)}return[...e.values()]},"Me"),Le=W(B.getAuthMetrics),Fe=W(B.getFunctionStats),Re=W(B.getLogs),Oe=W(B.getMetrics),ze=W(B.migrationStatus),$e=5,ke=2e3,Ke=5,Be=.1,Ue=.3,Ge=1,He=50,Qe=h((t,e,n)=>t>=n?"crit":t>=e?"warn":"ok","$e"),Je=h(t=>{let e=new Map;for(let r of t??[]){let a=e.get(r.bucketMs)??{calls:0,errors:0};a.calls+=r.calls,a.errors+=r.errors,e.set(r.bucketMs,a)}let n=[...e.entries()].toSorted((r,a)=>r[0]-a[0]);return{errors:n.map(([,r])=>r.errors),requests:n.map(([,r])=>r.calls)}},"Be"),Ve=h(t=>{let e=0,n=0;for(let a of t)a.status==="failed"?e+=1:a.status==="in_progress"&&(n+=1);let r="ok";return e>0?r="crit":n>0&&(r="warn"),{failed:e,level:r,running:n}},"Ve"),We=h((t,e)=>t.failed>0?e("{count} failed",{count:t.failed.toString()}):t.running>0?e("{count} running",{count:t.running.toString()}):e("OK"),"He"),qe={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},Me={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},Xe={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Ye=h(t=>t.includes("crit")?"crit":t.includes("warn")?"warn":"ok","ze"),ne=h(t=>{let e=(0,te.c)(19),{chart:n,label:r,level:a,testId:c,value:i}=t,o=qe[a],l;e[0]!==o?(l=$("size-1.5 shrink-0 rounded-full",o),e[0]=o,e[1]=l):l=e[1];let u;e[2]!==l?(u=(0,s.jsx)("span",{"aria-hidden":"true",className:l}),e[2]=l,e[3]=u):u=e[3];let f;e[4]!==r||e[5]!==u?(f=(0,s.jsxs)("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[u,r]}),e[4]=r,e[5]=u,e[6]=f):f=e[6];let v=Me[a],m;e[7]!==v?(m=$("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=m):m=e[8];let d;e[9]!==m||e[10]!==c||e[11]!==i?(d=(0,s.jsx)("span",{className:m,"data-testid":c,children:i}),e[9]=m,e[10]=c,e[11]=i,e[12]=d):d=e[12];let g;e[13]!==n||e[14]!==d?(g=(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[d,n]}),e[13]=n,e[14]=d,e[15]=g):g=e[15];let p;return e[16]!==f||e[17]!==g?(p=(0,s.jsx)(X,{className:"gap-0 py-0",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2.5 p-4",children:[f,g]})}),e[16]=f,e[17]=g,e[18]=p):p=e[18],p},"ee"),Ze=h(async(t,e,n)=>{let r=await Promise.all(n.map(m=>{let d=ie(m);return Promise.allSettled([t.query(Oe,{},d),t.query(Fe,{},d),t.query(ze,{},d)])})),a=ie(e),c=typeof t.schedulerStatus=="function"?t.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[i,o,l]=await Promise.allSettled([t.query(Re,{},a),t.query(Le,{},a),c]),u=r.map(([m,d,g])=>({functions:d.status==="fulfilled"?d.value.functions:[],metrics:m.status==="fulfilled"?m.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),f=De(u),v=r[0]?.[0];return{auth:o.status==="fulfilled"?o.value:null,entries:i.status==="fulfilled"?i.value.entries:[],functions:_e(u.map(m=>m.functions)),logsError:i.status==="rejected"?ce(i.reason):null,metricsError:f.reachable===0&&v?.status==="rejected"?ce(v.reason):null,migrations:Pe(u.map(m=>m.migrations)),scheduler:l.status==="fulfilled"?l.value:null,totals:f}},"Qe"),et=h(t=>{let e=t?.history??[];return{attempts:e.map(n=>n.attempts),failures:e.map(n=>n.failures)}},"We"),tt=h((t,e)=>t==="crit"?{description:e("One or more service levels are breached."),label:e("Critical")}:t==="warn"?{description:e("Some service levels need attention."),label:e("Degraded")}:{description:e("All service levels are within target."),label:e("All systems healthy")},"Xe"),rt=h(t=>{let e=(0,te.c)(75),{errorLevel:n,liveError:r,metricsError:a,overall:c,requestSeries:i,totals:o}=t,l=U(),u;e[0]!==c||e[1]!==l?(u=tt(c,l),e[0]=c,e[1]=l,e[2]=u):u=e[2];let{description:f,label:v}=u,m=Xe[c],d;e[3]!==m?(d=$("flex size-10 shrink-0 items-center justify-center rounded-full",m),e[3]=m,e[4]=d):d=e[4];let g=qe[c],p;e[5]!==g?(p=$("size-3 rounded-full",g),e[5]=g,e[6]=p):p=e[6];let S;e[7]!==p?(S=(0,s.jsx)("span",{className:p}),e[7]=p,e[8]=S):S=e[8];let E;e[9]!==d||e[10]!==S?(E=(0,s.jsx)("span",{"aria-hidden":"true",className:d,children:S}),e[9]=d,e[10]=S,e[11]=E):E=e[11];let q;e[12]!==v?(q=(0,s.jsx)("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:v}),e[12]=v,e[13]=q):q=e[13];let w;e[14]!==f?(w=(0,s.jsx)("span",{className:"text-[13px] text-muted-foreground",children:f}),e[14]=f,e[15]=w):w=e[15];let k;e[16]!==q||e[17]!==w?(k=(0,s.jsxs)("div",{className:"grid leading-tight",children:[q,w]}),e[16]=q,e[17]=w,e[18]=k):k=e[18];let y;e[19]!==k||e[20]!==E?(y=(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[E,k]}),e[19]=k,e[20]=E,e[21]=y):y=e[21];let j;e[22]!==l?(j=l("Requests"),e[22]=l,e[23]=j):j=e[23];let M;e[24]!==j?(M=(0,s.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:j}),e[24]=j,e[25]=M):M=e[25];let A;e[26]!==i||e[27]!==l?(A=i.length>=2&&(0,s.jsx)(le,{ariaLabel:l("Requests over time"),className:"h-6 w-20 text-foreground",series:i,testId:"hl-spark-requests"}),e[26]=i,e[27]=l,e[28]=A):A=e[28];let F=o?.requests??0,R;e[29]!==F?(R=F.toString(),e[29]=F,e[30]=R):R=e[30];let D;e[31]!==R?(D=(0,s.jsx)("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:R}),e[31]=R,e[32]=D):D=e[32];let O;e[33]!==A||e[34]!==D?(O=(0,s.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[A,D]}),e[33]=A,e[34]=D,e[35]=O):O=e[35];let _;e[36]!==M||e[37]!==O?(_=(0,s.jsxs)("div",{className:"text-end",children:[M,O]}),e[36]=M,e[37]=O,e[38]=_):_=e[38];let G;e[39]===Symbol.for("react.memo_cache_sentinel")?(G=(0,s.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),e[39]=G):G=e[39];let T;e[40]!==l?(T=l("Error rate"),e[40]=l,e[41]=T):T=e[41];let P;e[42]!==T?(P=(0,s.jsx)("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:T}),e[42]=T,e[43]=P):P=e[43];let Y=Me[n],C;e[44]!==Y?(C=$("text-lg font-semibold tabular-nums",Y),e[44]=Y,e[45]=C):C=e[45];let z;e[46]!==o?(z=o===null?"\u2014":oe(o.errors,o.requests),e[46]=o,e[47]=z):z=e[47];let I;e[48]!==C||e[49]!==z?(I=(0,s.jsx)("div",{className:C,"data-testid":"hl-error-rate",children:z}),e[48]=C,e[49]=z,e[50]=I):I=e[50];let L;e[51]!==P||e[52]!==I?(L=(0,s.jsxs)("div",{className:"text-end",children:[P,I]}),e[51]=P,e[52]=I,e[53]=L):L=e[53];let K;e[54]===Symbol.for("react.memo_cache_sentinel")?(K=(0,s.jsx)("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),e[54]=K):K=e[54];let H;e[55]===Symbol.for("react.memo_cache_sentinel")?(H=(0,s.jsx)(ye,{}),e[55]=H):H=e[55];let b;e[56]!==r?(b=(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[H,(0,s.jsx)(ve,{message:r,prefix:"hl"})]}),e[56]=r,e[57]=b):b=e[57];let N;e[58]!==_||e[59]!==L||e[60]!==b?(N=(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-4",children:[_,G,L,K,b]}),e[58]=_,e[59]=L,e[60]=b,e[61]=N):N=e[61];let Q;e[62]!==y||e[63]!==N?(Q=(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[y,N]}),e[62]=y,e[63]=N,e[64]=Q):Q=e[64];let J;e[65]!==a?(J=a!==null&&(0,s.jsx)("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:a}),e[65]=a,e[66]=J):J=e[66];let V;e[67]!==a||e[68]!==l||e[69]!==o?.historyTruncated?(V=a===null&&o?.historyTruncated===!0&&(0,s.jsx)("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:l("Showing a partial request/error history \u2014 one or more shards have more data than the trend chart can display.")}),e[67]=a,e[68]=l,e[69]=o?.historyTruncated,e[70]=V):V=e[70];let re;return e[71]!==Q||e[72]!==J||e[73]!==V?(re=(0,s.jsxs)(X,{className:"gap-0 py-0",children:[Q,J,V]}),e[71]=Q,e[72]=J,e[73]=V,e[74]=re):re=e[74],re},"Je"),st=h(t=>{let e=(0,te.c)(14),{shards:n}=t,r=U(),a;e[0]!==r?(a=r("Shards seen"),e[0]=r,e[1]=a):a=e[1];let c;e[2]!==a?(c=(0,s.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=c):c=e[3];let i;e[4]!==n.length?(i=(0,s.jsx)(ee,{"data-testid":"hl-shard-count",variant:"outline",children:n.length}),e[4]=n.length,e[5]=i):i=e[5];let o;e[6]!==c||e[7]!==i?(o=(0,s.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[c,i]}),e[6]=c,e[7]=i,e[8]=o):o=e[8];let l;e[9]!==n?(l=n.length>0&&(0,s.jsx)("ul",{className:"flex flex-wrap gap-1.5 p-4",children:n.map(lt)}),e[9]=n,e[10]=l):l=e[10];let u;return e[11]!==o||e[12]!==l?(u=(0,s.jsxs)(X,{className:"gap-0 py-0",children:[o,l]}),e[11]=o,e[12]=l,e[13]=u):u=e[13],u},"Ye"),kt=h(({initialShardKey:t})=>{let e=fe(),n=U(),[r,a]=(0,x.useState)([]),[c,i]=(0,x.useState)(null),[o,l]=(0,x.useState)(null),[u,f]=(0,x.useState)(null),[v,m]=(0,x.useState)([]),[d,g]=(0,x.useState)(null),[p,S]=(0,x.useState)(null),[E,q]=(0,x.useState)([]),[w]=(0,x.useState)(xe),k=(0,x.useRef)(!1),y=(0,x.useRef)(0),j=(0,x.useRef)(0),M=(0,x.useRef)(null),A=t??"",F=(0,x.useCallback)(async()=>{if(k.current)return;k.current=!0;let b=y.current,N=await Ze(e,A,be(A,w));b===y.current&&(l(N.totals),f(N.metricsError),m(N.functions),q(N.migrations),a(N.entries),i(N.logsError),g(N.auth),S(N.scheduler),k.current=!1)},[e,w,A]);(0,x.useEffect)(()=>(se(F()),()=>{y.current+=1,k.current=!1,M.current!==null&&(clearTimeout(M.current),M.current=null)}),[F]);let R=h(()=>{let b=Date.now()-j.current;if(b>=ke){j.current=Date.now(),se(F());return}M.current===null&&(M.current=setTimeout(()=>{M.current=null,j.current=Date.now(),se(F())},ke-b))},"j"),{data:D,liveError:O}=ge(B.getMetrics,{},{live:!0,shardKey:A});(0,x.useEffect)(()=>{D!==void 0&&R()},[D]);let _=r.filter(b=>b.level==="error"),G=_.slice(0,$e),T=Je(o?.history),P=et(d),Y=v.filter(b=>b.calls>0).toSorted((b,N)=>N.errors/N.calls-b.errors/b.calls||N.calls-b.calls).slice(0,Ke),C=Ve(E),z=o===null||o.requests===0?0:o.errors/o.requests,I=de(z,Se,Ee),L=d===null?"ok":de(d.failureRate,Be,Ue),K=p===null?"ok":Qe(p.backlog,Ge,He),H=Ye([I,L,K,C.level]);return(0,s.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[(0,s.jsx)(rt,{errorLevel:I,liveError:O,metricsError:u,overall:H,requestSeries:T.requests,totals:o}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[(0,s.jsx)(ne,{chart:T.errors.length>=2?(0,s.jsx)(le,{ariaLabel:n("Errors over time"),className:"h-7 w-20 text-destructive",series:T.errors,testId:"hl-spark-errors"}):void 0,label:n("Error rate"),level:I,testId:"hl-slo-errorrate",value:o===null?"\u2014":oe(o.errors,o.requests)}),(0,s.jsx)(ne,{chart:P.failures.length>=2?(0,s.jsx)(le,{ariaLabel:n("Auth failures over time"),className:"h-7 w-20 text-destructive",series:P.failures,testId:"hl-spark-auth"}):void 0,label:n("Auth failures"),level:L,testId:"hl-slo-auth",value:d===null?"\u2014":oe(d.failures,d.attempts)}),(0,s.jsx)(ne,{label:n("Scheduler backlog"),level:K,testId:"hl-slo-backlog",value:p===null?"\u2014":p.backlog.toString()}),(0,s.jsx)(ne,{label:n("Migrations"),level:C.level,testId:"hl-slo-migrations",value:We(C,n)})]}),(0,s.jsx)(Ce,{errorCount:_.length,logsError:c,topErrors:G,worstFunctions:Y}),(0,s.jsx)(st,{shards:w})]})},"gt");function lt(t){return(0,s.jsx)("li",{"data-testid":"hl-shard",children:(0,s.jsx)(ee,{variant:"secondary",children:t})},t)}h(lt,"Ze");export{kt as HealthPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as re}from"./chunk-7SNL633X.js";import{a as X}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as W}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Q}from"./chunk-FWOOA2ZR.js";import{b as G}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as Y}from"./chunk-
|
|
1
|
+
import{a as re}from"./chunk-7SNL633X.js";import{a as X}from"./chunk-J45HAKBU.js";import{a as V}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import{a as W}from"./chunk-KBYFBEG2.js";import"./chunk-JMZT3CEW.js";import"./chunk-VUOEJJUH.js";import{a as Q}from"./chunk-FWOOA2ZR.js";import{b as G}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as Y}from"./chunk-EVJSGZXV.js";import"./chunk-F5WJCL3F.js";import{a as Z,b as ee,c as te,d as P,e as n,f as o}from"./chunk-VXZAS5VS.js";import"./chunk-EYMLYHWK.js";import"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as R}from"./chunk-6A6AELDJ.js";import{c as O}from"./chunk-CLQKKJHL.js";import{a as H,e as J}from"./chunk-OSHODLMU.js";import"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as U,w as z,x as L}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as me}from"./chunk-GWNGVKLG.js";import{a as de,b as he}from"./chunk-6G3E4PJ2.js";import{a as l,d as B}from"./chunk-5PEAXTYQ.js";var se=B(me(),1),le=B(de(),1);var t=B(he(),1);var ue={action:"outline",mutation:"default",query:"secondary"},ae=l(r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,"q"),fe=l(r=>r.calls===0?"\u2014":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,"de"),pe=l(r=>{let e=r.conflicts??0;return r.calls===0?"\u2014":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},"me"),xe={calls:l((r,e)=>e.calls-r.calls,"calls"),recent:l((r,e)=>e.lastCalledAt-r.lastCalledAt,"recent"),slowest:l((r,e)=>e.maxDurationMs-r.maxDurationMs,"slowest")},De=l(r=>{let e=(0,se.c)(49),{functions:_,initialShardKey:ne}=r,s=U(),{queryShardKey:i,setShardKey:v,shardKey:S}=X(ne),[c,oe]=(0,le.useState)("recent"),C;e[0]===Symbol.for("react.memo_cache_sentinel")?(C={},e[0]=C):C=e[0];let $;e[1]!==i?($={live:!0,shardKey:i},e[1]=i,e[2]=$):$=e[2];let{data:ie,error:d,errorSource:b,liveError:k}=O(R.getFunctionStats,C,$),M=ie?.functions??null,F;e[3]!==_?(F=new Map((_??[]).map(ge)),e[3]=_,e[4]=F):F=e[4];let T=F,I;e[5]===Symbol.for("react.memo_cache_sentinel")?(I=l(w=>{oe(w.currentTarget.dataset.sort)},"E"),e[5]=I):I=e[5];let ce=I,K;if(e[6]!==d||e[7]!==b||e[8]!==T||e[9]!==k||e[10]!==i||e[11]!==v||e[12]!==S||e[13]!==c||e[14]!==M||e[15]!==s){let w=M===null?[]:M.toSorted(xe[c]),m;e[17]!==s?(m=s("Recent"),e[17]=s,e[18]=m):m=e[18];let h;e[19]!==m?(h={key:"recent",label:m},e[19]=m,e[20]=h):h=e[20];let u;e[21]!==s?(u=s("Most called"),e[21]=s,e[22]=u):u=e[22];let f;e[23]!==u?(f={key:"calls",label:u},e[23]=u,e[24]=f):f=e[24];let p;e[25]!==s?(p=s("Slowest"),e[25]=s,e[26]=p):p=e[26];let x;e[27]!==p?(x={key:"slowest",label:p},e[27]=p,e[28]=x):x=e[28];let A;e[29]!==x||e[30]!==h||e[31]!==f?(A=[h,f,x],e[29]=x,e[30]=h,e[31]=f,e[32]=A):A=e[32];let j=A,g;e[33]!==v||e[34]!==S?(g=(0,t.jsx)(V,{onChange:v,testId:"fs-shard-input",value:S}),e[33]=v,e[34]=S,e[35]=g):g=e[35];let y;e[36]!==k?(y=(0,t.jsx)(re,{message:k,prefix:"fs"}),e[36]=k,e[37]=y):y=e[37];let N;e[38]!==j||e[39]!==c?(N=(0,t.jsx)("div",{className:"ml-auto flex items-center gap-1",role:"group",children:j.map(a=>(0,t.jsx)(W,{"data-sort":a.key,"data-testid":`fs-sort-${a.key}`,onClick:ce,size:"sm",type:"button",variant:c===a.key?"secondary":"ghost",children:a.label},a.key))}),e[38]=j,e[39]=c,e[40]=N):N=e[40];let D;e[41]!==g||e[42]!==y||e[43]!==N?(D=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[g,y,N]}),e[41]=g,e[42]=y,e[43]=N,e[44]=D):D=e[44];let E;e[45]!==d||e[46]!==b||e[47]!==i?(E=d!==null&&(0,t.jsx)(Y,{error:b,shardKey:i,testId:"fs-error"}),e[45]=d,e[46]=b,e[47]=i,e[48]=E):E=e[48],K=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[D,E,M!==null&&w.length===0&&d===null&&(0,t.jsx)(Q,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M3 3v18h18"}),(0,t.jsx)("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),w.length>0&&(0,t.jsx)(H,{className:"overflow-hidden py-0",children:(0,t.jsx)(J,{className:"px-0",children:(0,t.jsxs)(Z,{"data-testid":"fs-table",children:[(0,t.jsx)(ee,{children:(0,t.jsxs)(P,{children:[(0,t.jsx)(n,{children:s("function")}),(0,t.jsx)(n,{children:s("kind")}),(0,t.jsx)(n,{className:"text-right",children:s("calls")}),(0,t.jsx)(n,{className:"text-right",children:s("errors")}),(0,t.jsx)(n,{className:"text-right",children:s("conflicts")}),(0,t.jsx)(n,{className:"text-right",children:s("avg")}),(0,t.jsx)(n,{className:"text-right",children:s("max")}),(0,t.jsx)(n,{children:s("last run")}),(0,t.jsx)(n,{children:s("last error")})]})}),(0,t.jsx)(te,{children:w.map(a=>{let q=T.get(a.path);return(0,t.jsxs)(P,{"data-testid":`fs-row-${a.path}`,children:[(0,t.jsx)(o,{className:"font-medium",children:a.path}),(0,t.jsx)(o,{children:q===void 0?(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)(G,{variant:ue[q],children:q})}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls}),(0,t.jsx)(o,{className:L("text-right tabular-nums",a.errors>0&&"text-destructive"),children:fe(a)}),(0,t.jsx)(o,{className:L("text-right tabular-nums",(a.conflicts??0)>0&&"text-warning"),children:pe(a)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.totalDurationMs/a.calls)}),(0,t.jsx)(o,{className:"text-right tabular-nums",children:a.calls===0?"\u2014":ae(a.maxDurationMs)}),(0,t.jsx)(o,{className:"text-muted-foreground",children:z(a.lastCalledAt,"\u2014")}),(0,t.jsx)(o,{className:"max-w-[24ch] truncate text-destructive",title:a.lastErrorMessage??void 0,children:a.lastErrorMessage??(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"})})]},a.path)})})]})})})]}),e[6]=d,e[7]=b,e[8]=T,e[9]=k,e[10]=i,e[11]=v,e[12]=S,e[13]=c,e[14]=M,e[15]=s,e[16]=K}else K=e[16];return K},"Ae");function ge(r){return[r.path,r.kind]}l(ge,"fe");export{De as FunctionStatsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as v}from"./chunk-EX2DUBRT.js";import{a as A}from"./chunk-
|
|
1
|
+
import{a as v}from"./chunk-EX2DUBRT.js";import{a as A}from"./chunk-AQ62YJJ5.js";import{a as W}from"./chunk-J45HAKBU.js";import{a as L}from"./chunk-645S7KRU.js";import"./chunk-3D67ZJRW.js";import"./chunk-ZSWW2UGP.js";import"./chunk-MWYGLPDV.js";import"./chunk-HFBSWKJS.js";import"./chunk-4EPW63HS.js";import"./chunk-VUOEJJUH.js";import{a as G}from"./chunk-FWOOA2ZR.js";import{b as $}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as q}from"./chunk-EVJSGZXV.js";import"./chunk-F5WJCL3F.js";import{a as H,b as O,c as Q,d as D,e as T,f as K}from"./chunk-VXZAS5VS.js";import"./chunk-EYMLYHWK.js";import"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as _}from"./chunk-6A6AELDJ.js";import{c as j}from"./chunk-CLQKKJHL.js";import{a as E}from"./chunk-OSHODLMU.js";import"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import{a as J}from"./chunk-GWNGVKLG.js";import{b as V}from"./chunk-6G3E4PJ2.js";import{a as S,d as F}from"./chunk-5PEAXTYQ.js";var R=F(J(),1);var t=F(V(),1);var U=S(c=>`${c.toString()} ms`,"D"),X=S(c=>c.totalConnections===0&&c.shapePoke.passes===0&&c.whisper.passes===0&&c.shapeProbe.run===0&&c.shapeProbe.served===0&&c.globalPoll.drains===0&&c.globalPoll.pairsSkipped===0,"J"),z=S(c=>{let e=(0,R.c)(48),{counters:o,includeTiming:a,prefix:r,t:l,title:u}=c,d=`${r}-section`,n;e[0]!==u?(n=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:u}),e[0]=u,e[1]=n):n=e[1];let s=`${r}-stats`,i;e[2]!==l?(i=l("Passes"),e[2]=l,e[3]=i):i=e[3];let m=`${r}-passes`,I;e[4]!==o.passes||e[5]!==i||e[6]!==m?(I=(0,t.jsx)(v,{label:i,testId:m,value:o.passes}),e[4]=o.passes,e[5]=i,e[6]=m,e[7]=I):I=e[7];let g;e[8]!==l?(g=l("Sockets iterated"),e[8]=l,e[9]=g):g=e[9];let k=`${r}-iterated`,p;e[10]!==o.socketsIterated||e[11]!==g||e[12]!==k?(p=(0,t.jsx)(v,{label:g,testId:k,value:o.socketsIterated}),e[10]=o.socketsIterated,e[11]=g,e[12]=k,e[13]=p):p=e[13];let f;e[14]!==l?(f=l("Delivered"),e[14]=l,e[15]=f):f=e[15];let y=`${r}-delivered`,h;e[16]!==o.socketsDelivered||e[17]!==f||e[18]!==y?(h=(0,t.jsx)(v,{label:f,testId:y,value:o.socketsDelivered}),e[16]=o.socketsDelivered,e[17]=f,e[18]=y,e[19]=h):h=e[19];let x;e[20]!==l?(x=l("Peak width"),e[20]=l,e[21]=x):x=e[21];let N=`${r}-peak`,b;e[22]!==o.peakSocketsIterated||e[23]!==x||e[24]!==N?(b=(0,t.jsx)(v,{label:x,testId:N,value:o.peakSocketsIterated}),e[22]=o.peakSocketsIterated,e[23]=x,e[24]=N,e[25]=b):b=e[25];let C;e[26]!==o.totalMs||e[27]!==a||e[28]!==r||e[29]!==l?(C=a&&(0,t.jsx)(v,{label:l("Total time"),testId:`${r}-total-ms`,value:U(o.totalMs)}),e[26]=o.totalMs,e[27]=a,e[28]=r,e[29]=l,e[30]=C):C=e[30];let P;e[31]!==o.maxMs||e[32]!==a||e[33]!==r||e[34]!==l?(P=a&&(0,t.jsx)(v,{label:l("Max time"),testId:`${r}-max-ms`,value:U(o.maxMs)}),e[31]=o.maxMs,e[32]=a,e[33]=r,e[34]=l,e[35]=P):P=e[35];let M;e[36]!==h||e[37]!==b||e[38]!==C||e[39]!==P||e[40]!==s||e[41]!==I||e[42]!==p?(M=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":s,children:[I,p,h,b,C,P]}),e[36]=h,e[37]=b,e[38]=C,e[39]=P,e[40]=s,e[41]=I,e[42]=p,e[43]=M):M=e[43];let w;return e[44]!==d||e[45]!==M||e[46]!==n?(w=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":d,children:[n,M]}),e[44]=d,e[45]=M,e[46]=n,e[47]=w):w=e[47],w},"F"),Y=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Membership probes"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Queries run"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.run||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-probe-run",value:o.run}),e[6]=o.run,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Shared from cache"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.served||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-probe-served",value:o.served}),e[11]=o.served,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-probe-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-probe-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"V"),Z=S(c=>{let e=(0,R.c)(20),{counters:o,t:a}=c,r;e[0]!==a?(r=a("Global shape polls"),e[0]=a,e[1]=r):r=e[1];let l;e[2]!==r?(l=(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let u;e[4]!==a?(u=a("Global reads"),e[4]=a,e[5]=u):u=e[5];let d;e[6]!==o.drains||e[7]!==u?(d=(0,t.jsx)(v,{label:u,testId:"fanout-global-poll-drains",value:o.drains}),e[6]=o.drains,e[7]=u,e[8]=d):d=e[8];let n;e[9]!==a?(n=a("Pairs skipped"),e[9]=a,e[10]=n):n=e[10];let s;e[11]!==o.pairsSkipped||e[12]!==n?(s=(0,t.jsx)(v,{label:n,testId:"fanout-global-poll-pairs-skipped",value:o.pairsSkipped}),e[11]=o.pairsSkipped,e[12]=n,e[13]=s):s=e[13];let i;e[14]!==d||e[15]!==s?(i=(0,t.jsxs)("dl",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3","data-testid":"fanout-global-poll-stats",children:[d,s]}),e[14]=d,e[15]=s,e[16]=i):i=e[16];let m;return e[17]!==l||e[18]!==i?(m=(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-global-poll-section",children:[l,i]}),e[17]=l,e[18]=i,e[19]=m):m=e[19],m},"X"),pe=S(c=>{let e=(0,R.c)(32),{initialShardKey:o}=c,a=B(),{queryShardKey:r,setShardKey:l,shardKey:u}=W(o),d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d={},e[0]=d):d=e[0];let n;e[1]!==r?(n={keepPreviousData:!0,shardKey:r},e[1]=r,e[2]=n):n=e[2];let{data:s,error:i,errorSource:m,poll:I}=j(_.getFanoutMetrics,d,n);A(I,!0);let g;e[3]!==s?(g=s!==void 0&&X(s),e[3]=s,e[4]=g):g=e[4];let k=g,p;e[5]!==l||e[6]!==u?(p=(0,t.jsx)(L,{onChange:l,testId:"fanout-shard-input",value:u}),e[5]=l,e[6]=u,e[7]=p):p=e[7];let f;e[8]!==s||e[9]!==a?(f=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"fanout-count",children:[s.promoted&&(0,t.jsx)($,{"data-testid":"fanout-promoted",variant:s.relayCount>=s.maxRelays?"destructive":"default",children:s.relayCount>=s.maxRelays?a("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)",{maxRelays:s.maxRelays,relayCount:s.relayCount}):a("auto-scaled: {relayCount}/{maxRelays} relays",{maxRelays:s.maxRelays,relayCount:s.relayCount})}),(0,t.jsx)($,{variant:"secondary",children:a("{count} connections",{count:s.totalConnections})}),(0,t.jsx)($,{variant:"secondary",children:a("peak {count} subscribers",{count:s.peakSubscribers})})]}),e[8]=s,e[9]=a,e[10]=f):f=e[10];let y;e[11]!==p||e[12]!==f?(y=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[p,f]}),e[11]=p,e[12]=f,e[13]=y):y=e[13];let h;e[14]!==i||e[15]!==m||e[16]!==r?(h=i!==null&&(0,t.jsx)(q,{error:m,shardKey:r,testId:"fanout-error"}),e[14]=i,e[15]=m,e[16]=r,e[17]=h):h=e[17];let x;e[18]!==i||e[19]!==k||e[20]!==a?(x=i===null&&k&&(0,t.jsx)(G,{description:a("Realtime fan-out cost and per-topic subscriber counts for this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 12h4l3 7 4-14 3 7h2"})}),testId:"fanout-empty",title:a("No fan-out activity yet.")}),e[18]=i,e[19]=k,e[20]=a,e[21]=x):x=e[21];let N;e[22]!==i||e[23]!==k||e[24]!==s||e[25]!==a?(N=i===null&&s!==void 0&&!k&&(0,t.jsxs)(t.Fragment,{children:[s.topics.length>0&&(0,t.jsxs)("section",{className:"flex flex-col gap-2","data-testid":"fanout-topics-section",children:[(0,t.jsx)("h3",{className:"text-sm font-medium text-foreground",children:a("Hot topics")}),(0,t.jsx)(E,{className:"overflow-hidden py-0",children:(0,t.jsxs)(H,{"data-testid":"fanout-topics-table",children:[(0,t.jsx)(O,{children:(0,t.jsxs)(D,{children:[(0,t.jsx)(T,{children:a("Topic")}),(0,t.jsx)(T,{children:a("Kind")}),(0,t.jsx)(T,{className:"text-right",children:a("Subscribers")})]})}),(0,t.jsx)(Q,{children:s.topics.map(ee)})]})})]}),(0,t.jsxs)("section",{className:"flex flex-col gap-3","data-testid":"fanout-cost",children:[(0,t.jsx)("h2",{className:"text-sm font-medium text-muted-foreground",children:a("Fan-out cost since this instance woke")}),(0,t.jsx)(z,{counters:s.shapePoke,includeTiming:!0,prefix:"fanout-poke",t:a,title:a("Shape pokes")}),(0,t.jsx)(z,{counters:s.whisper,includeTiming:!1,prefix:"fanout-whisper",t:a,title:a("Whisper broadcasts")}),(0,t.jsx)(Y,{counters:s.shapeProbe,t:a}),(0,t.jsx)(Z,{counters:s.globalPoll,t:a})]})]}),e[22]=i,e[23]=k,e[24]=s,e[25]=a,e[26]=N):N=e[26];let b;return e[27]!==y||e[28]!==h||e[29]!==x||e[30]!==N?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"fanout-panel",children:[y,h,x,N]}),e[27]=y,e[28]=h,e[29]=x,e[30]=N,e[31]=b):b=e[31],b},"me");function ee(c){return(0,t.jsxs)(D,{"data-testid":"fanout-topic-row",children:[(0,t.jsx)(K,{className:"font-mono text-xs",children:c.topic}),(0,t.jsx)(K,{children:(0,t.jsx)($,{variant:"outline",children:c.kind})}),(0,t.jsx)(K,{className:"text-right font-medium tabular-nums",children:c.subscribers})]},`${c.kind}:${c.topic}`)}S(ee,"Y");export{pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O}from"./chunk-SUUBCPUD.js";import{a as C}from"./chunk-RDS46R5R.js";import{a as c}from"./chunk-FWOOA2ZR.js";import{b as N}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as k}from"./chunk-
|
|
1
|
+
import{a as O}from"./chunk-SUUBCPUD.js";import{a as C}from"./chunk-RDS46R5R.js";import{a as c}from"./chunk-FWOOA2ZR.js";import{b as N}from"./chunk-M4TCBPSY.js";import"./chunk-YUVGMKHG.js";import{a as k}from"./chunk-EVJSGZXV.js";import"./chunk-F5WJCL3F.js";import{a as w,b as T,c as A,d as f,e as s,f as l}from"./chunk-VXZAS5VS.js";import"./chunk-EYMLYHWK.js";import"./chunk-PUU56AIE.js";import"./chunk-4PI2OSSP.js";import{a as v}from"./chunk-6A6AELDJ.js";import{c as p}from"./chunk-CLQKKJHL.js";import{a as b,e as S}from"./chunk-OSHODLMU.js";import"./chunk-PFPJA2HR.js";import"./chunk-ZPQBVYNN.js";import{B as y}from"./chunk-PUK3H4RN.js";import"./chunk-PDBW6GTJ.js";import"./chunk-GWNGVKLG.js";import{a as R,b as V}from"./chunk-6G3E4PJ2.js";import{a as n,d as x}from"./chunk-5PEAXTYQ.js";var F=x(R(),1);var e=x(V(),1);var $=n(a=>{let t=a.trim();if(t.length===0)return{context:void 0,error:null};try{let o=JSON.parse(t);return o===null||typeof o!="object"||Array.isArray(o)?{context:void 0,error:"Targeting context must be a JSON object."}:{context:o,error:null}}catch{return{context:void 0,error:"Targeting context is not valid JSON."}}},"H"),q='{ "targetingKey": "user-123", "plan": "premium" }',D=n(a=>a.type==="object"?JSON.stringify(a.value):String(a.value),"R"),Y=n(({initialShardKey:a=""})=>{let t=y(),[o,j]=(0,F.useState)(""),{context:g,error:m}=$(o),I=g===void 0?{}:{context:g},{data:i,error:J,errorSource:K,liveError:E}=p(v.listFlags,I,{live:!0,shardKey:a}),u=i!==void 0,L=i?.configured??!1,h=Array.isArray(i?.flags)?[...i.flags].toSorted((r,B)=>r.key.localeCompare(B.key)):[],d;return u&&!L?d=(0,e.jsx)(c,{description:t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),testId:"flags-unconfigured",title:t("No flags provider configured")}):u&&h.length===0?d=(0,e.jsx)(c,{description:t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),testId:"flags-empty",title:t("No flags read")}):d=(0,e.jsx)(b,{className:"overflow-hidden py-0",children:(0,e.jsx)(S,{className:"px-0",children:(0,e.jsxs)(w,{"data-testid":"flags-table",children:[(0,e.jsx)(T,{children:(0,e.jsxs)(f,{children:[(0,e.jsx)(s,{children:t("Key")}),(0,e.jsx)(s,{children:t("Type")}),(0,e.jsx)(s,{children:t("Value")}),(0,e.jsx)(s,{children:t("Reason")}),(0,e.jsx)(s,{children:t("Variant")})]})}),(0,e.jsx)(A,{children:h.map(r=>(0,e.jsxs)(f,{"data-testid":`flags-row-${r.key}`,children:[(0,e.jsx)(l,{className:"font-mono text-xs",children:r.key}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.type}),(0,e.jsx)(l,{className:"font-mono text-xs",children:D(r)}),(0,e.jsx)(l,{children:r.errorCode===void 0?(0,e.jsx)("span",{className:"font-mono text-xs text-muted-foreground",children:r.reason??"\u2014"}):(0,e.jsx)(N,{"data-testid":`flags-error-${r.key}`,variant:"destructive",children:r.errorCode})}),(0,e.jsx)(l,{className:"font-mono text-xs text-muted-foreground",children:r.variant??"\u2014"})]},r.key))})]})})}),(0,e.jsxs)("div",{className:"flex flex-col gap-6","data-testid":"lunora-flags-panel",children:[J!==null&&(0,e.jsx)(k,{error:K,shardKey:a,testId:"flags-error"}),(0,e.jsx)("p",{className:"text-sm text-muted-foreground",children:t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')}),(0,e.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,e.jsx)(C,{htmlFor:"flags-targeting-context",children:t("Targeting context (JSON)")}),(0,e.jsx)(O,{className:"font-mono text-xs","data-testid":"flags-context-input",id:"flags-targeting-context",onChange:n(r=>{j(r.target.value)},"onChange"),placeholder:q,rows:3,value:o}),m!==null&&(0,e.jsx)("p",{className:"text-xs text-destructive","data-testid":"flags-context-error",role:"alert",children:t(m)}),E!==void 0&&(0,e.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"flags-live-error",role:"alert",children:t("Live updates unavailable; showing the last evaluation.")})]}),d]})},"W");export{Y as default};
|