bunqueue-dashboard 0.0.35 → 0.0.36
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/README.md +18 -11
- package/agent/backup/processExecutor.ts +90 -0
- package/agent/backup/resultValidation.ts +85 -0
- package/agent/backup/routes.ts +160 -0
- package/agent/backup/runner.ts +91 -0
- package/agent/backup/standaloneWorker.ts +23 -0
- package/agent/backup/workerExecutor.ts +40 -0
- package/agent/backup/workerFactory.ts +21 -0
- package/agent/backup/workerProtocol.ts +10 -0
- package/agent/db/core.ts +141 -0
- package/agent/db/csvExport.ts +172 -0
- package/agent/db/exportTimeout.ts +190 -0
- package/agent/db/query.ts +82 -0
- package/agent/db/queryTimeout.ts +76 -0
- package/agent/db/schema.ts +79 -0
- package/agent/db/tables.ts +157 -0
- package/agent/db/types.ts +118 -0
- package/agent/db/workerFactory.ts +25 -0
- package/agent/db.ts +43 -1099
- package/agent/errorMessage.ts +9 -0
- package/agent/flow/routes.ts +250 -0
- package/agent/flow/service.ts +266 -0
- package/agent/flow/types.ts +34 -0
- package/agent/flow/validation.ts +230 -0
- package/agent/index.ts +5 -17
- package/agent/logger.ts +121 -17
- package/agent/managedTarget.ts +43 -0
- package/agent/manager/config.ts +84 -0
- package/agent/manager/logs.ts +83 -0
- package/agent/manager/process.ts +233 -0
- package/agent/manager/storage.ts +28 -0
- package/agent/manager/types.ts +38 -0
- package/agent/manager.ts +10 -490
- package/agent/queue/routes.ts +128 -0
- package/agent/queue/runtime.ts +119 -0
- package/agent/queue/types.ts +34 -0
- package/agent/queue/validation.ts +100 -0
- package/agent/server/controlRoutes.ts +153 -0
- package/agent/server/databaseRoutes.ts +165 -0
- package/agent/server/errors.ts +48 -0
- package/agent/server/handler.ts +146 -0
- package/agent/server/jsonBody.ts +109 -0
- package/agent/server/lifecycle.ts +72 -0
- package/agent/server/managedRuntime.ts +41 -0
- package/agent/server/policy.ts +60 -0
- package/agent/server/router.ts +150 -0
- package/agent/server/types.ts +39 -0
- package/agent/server/workflowReadRoutes.ts +80 -0
- package/agent/server.ts +16 -441
- package/agent/shutdown.ts +156 -0
- package/agent/workflow/codec.ts +78 -0
- package/agent/workflow/detail.ts +63 -0
- package/agent/workflow/list.ts +87 -0
- package/agent/workflow/runtime.ts +274 -0
- package/agent/workflow/runtimeConfig.ts +103 -0
- package/agent/workflow/runtimeRoutes.ts +162 -0
- package/agent/workflow/sqlite.ts +52 -0
- package/agent/workflow/stats.ts +79 -0
- package/agent/workflow/types.ts +81 -0
- package/agent/workflow/validation.ts +114 -0
- package/agent/workflows.ts +14 -489
- package/dist/.vite/manifest.json +595 -234
- package/dist/assets/AddJob-UUa2fSXE.js +3 -0
- package/dist/assets/Alerts-7oGYfQMb.js +1 -0
- package/dist/assets/{AreaChart-REK4ZsTC.js → AreaChart-w0ruozXH.js} +1 -1
- package/dist/assets/Benchmark-C2NFp_kj.js +1 -0
- package/dist/assets/BulkAddJobs-CL4yBae-.js +5 -0
- package/dist/assets/Button-BPqpRZJD.js +1 -0
- package/dist/assets/Card-C7NMhqUt.js +1 -0
- package/dist/assets/{CopilotPanel-COLw-atS.js → CopilotPanel-BQ2Cgo9p.js} +3 -3
- package/dist/assets/Cron-DfWBhoBf.js +1 -0
- package/dist/assets/CronManager-DAK7RSOX.js +1 -0
- package/dist/assets/Database-DqL7giEj.js +3 -0
- package/dist/assets/Diagnostics-D98YwN-6.js +1 -0
- package/dist/assets/Dlq-BHmA5PTI.js +1 -0
- package/dist/assets/DlqControl-DihxvP-i.js +1 -0
- package/dist/assets/DlqPro-ncgnDtpE.js +1 -0
- package/dist/assets/Flows-B5N5Cil0.js +2 -0
- package/dist/assets/JobInspector-B40nFiGh.js +2 -0
- package/dist/assets/Jobs-Bla3IEef.js +1 -0
- package/dist/assets/JobsPro-CnczVx7x.js +1 -0
- package/dist/assets/Logs-T91Q3cH0.js +1 -0
- package/dist/assets/LogsPro-CMn6-Wwv.js +1 -0
- package/dist/assets/{McpServer-CbaU52l2.js → McpServer-BQBabwW-.js} +2 -2
- package/dist/assets/Metrics-DxT_RI2B.js +1 -0
- package/dist/assets/MetricsPro-Cjen-nAP.js +1 -0
- package/dist/assets/Overview-XN2ej8ph.js +1 -0
- package/dist/assets/PageHeader-BXlZSBcc.js +1 -0
- package/dist/assets/Pagination-Q-vf4hsX.js +1 -0
- package/dist/assets/QueueActions-C-Aferd6.js +1 -0
- package/dist/assets/QueueControl-B8Q9NX6t.js +1 -0
- package/dist/assets/QueueDetail-BMhG0jUB.js +1 -0
- package/dist/assets/QueueDetailPro-BKTTyLR4.js +1 -0
- package/dist/assets/Queues-COqPMoY9.js +1 -0
- package/dist/assets/QueuesOverview-pWdrPy8Z.js +1 -0
- package/dist/assets/S3Backup-BmsZ8xtq.js +1 -0
- package/dist/assets/S3BackupPro-AtlsPUJL.js +3 -0
- package/dist/assets/ServerControl-D3XwHr72.js +3 -0
- package/dist/assets/Settings-BofKZoHn.js +1 -0
- package/dist/assets/StatusBadge-B0I7hNBX.js +1 -0
- package/dist/assets/Usage-DAR9E22v.js +1 -0
- package/dist/assets/UsagePro-Bc30N2Lo.js +1 -0
- package/dist/assets/Webhooks-Bg2k1PU4.js +1 -0
- package/dist/assets/Workers-BqUZMJVQ.js +1 -0
- package/dist/assets/WorkersPro-C9aSadUh.js +1 -0
- package/dist/assets/Workflows-BEFMfHmo.js +1 -0
- package/dist/assets/api-CQ5Z7xR7.js +1 -0
- package/dist/assets/bq-BeBxa743.js +1 -0
- package/dist/assets/cn-zFEt5SO8.js +1 -0
- package/dist/assets/connectionStore-DbBYqHEY.js +1 -0
- package/dist/assets/controlConnectionEpoch-CFSO6237.js +1 -0
- package/dist/assets/feedback-BnGE2oW2.js +1 -0
- package/dist/assets/{form-DsUq0w8s.js → form-tC20r4Ma.js} +1 -1
- package/dist/assets/format-Cg7VCIZW.js +1 -0
- package/dist/assets/icons-CIvFfU2b.js +1 -0
- package/dist/assets/index-Cui9IwWy.js +8 -0
- package/dist/assets/index-DOze4TKg.css +1 -0
- package/dist/assets/install-Cd9Is10G.js +3 -0
- package/dist/assets/{react-vendor-Bjui4wS4.js → react-vendor-CyjgmGTq.js} +3 -3
- package/dist/assets/responses-kPO4rSu5.js +1 -0
- package/dist/assets/toastStore-CS_9Xndn.js +1 -0
- package/dist/assets/usePolledData-DzlUpBOO.js +1 -0
- package/dist/assets/{useServerActionGuard-CItj3hvh.js → useServerActionGuard-BlH-Kso1.js} +1 -1
- package/dist/assets/useThroughputSeries-C2pa1Wd_.js +1 -0
- package/dist/index.html +16 -5
- package/package.json +12 -3
- package/scripts/embedded.gen.ts +152 -126
- package/scripts/serve.ts +96 -484
- package/scripts/serveHandler.ts +217 -0
- package/scripts/servePolicy.ts +133 -0
- package/dist/assets/AddJob-CG28MSxU.js +0 -3
- package/dist/assets/Alerts-D9JojJrj.js +0 -1
- package/dist/assets/Benchmark-BVjUH9dG.js +0 -1
- package/dist/assets/BulkAddJobs-BHzUCMj_.js +0 -5
- package/dist/assets/Cron-DoEHDHwy.js +0 -1
- package/dist/assets/CronManager-vulcesqJ.js +0 -1
- package/dist/assets/Database-DlB_t04Z.js +0 -3
- package/dist/assets/Diagnostics-DddCUgeR.js +0 -1
- package/dist/assets/Dlq-DMKrsSMP.js +0 -1
- package/dist/assets/DlqControl-9m0Re_TH.js +0 -1
- package/dist/assets/DlqPro-Dmw-0wta.js +0 -1
- package/dist/assets/Flows-C3-9nXW4.js +0 -1
- package/dist/assets/JobInspector-DwIfABmI.js +0 -2
- package/dist/assets/Jobs-j8tTS3NC.js +0 -1
- package/dist/assets/JobsPro-CS__CJJl.js +0 -1
- package/dist/assets/Logs-BB-VDPA1.js +0 -1
- package/dist/assets/LogsPro-RNtSQZRT.js +0 -1
- package/dist/assets/Metrics-ivcddPwT.js +0 -1
- package/dist/assets/MetricsPro-xjZno4vg.js +0 -1
- package/dist/assets/Overview-D84aD2ph.js +0 -1
- package/dist/assets/Pagination-Bfi4vkpp.js +0 -1
- package/dist/assets/QueueActions-DTbD6uek.js +0 -1
- package/dist/assets/QueueControl-B5xK_SQ-.js +0 -1
- package/dist/assets/QueueDetail-BH59kwm9.js +0 -1
- package/dist/assets/QueueDetailPro-DoN25ndy.js +0 -1
- package/dist/assets/Queues-CKMJqFHX.js +0 -1
- package/dist/assets/QueuesOverview-BX1lzojl.js +0 -1
- package/dist/assets/S3Backup-Bz3GfoZ9.js +0 -1
- package/dist/assets/S3BackupPro-BC_6-uX-.js +0 -2
- package/dist/assets/ServerControl-CSSrN8G5.js +0 -3
- package/dist/assets/Settings-DkqmZUIS.js +0 -1
- package/dist/assets/Usage-Ba20p0xd.js +0 -1
- package/dist/assets/UsagePro-C2pQwjN9.js +0 -1
- package/dist/assets/Webhooks-CVuuvb0L.js +0 -1
- package/dist/assets/Workers-C1wPU6CS.js +0 -1
- package/dist/assets/WorkersPro-B0vEkC0T.js +0 -1
- package/dist/assets/Workflows-C8Qmkflf.js +0 -1
- package/dist/assets/cn-CMFYpumL.js +0 -1
- package/dist/assets/connectionStore-Cd9-3Fw0.js +0 -1
- package/dist/assets/index-BCNzbhhD.css +0 -1
- package/dist/assets/index-CAtsVmyh.js +0 -8
- package/dist/assets/install-D0eRLf9F.js +0 -3
- package/dist/assets/useThroughputSeries-DjxGN8ob.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{d as n,g as r,r as i,t as a}from"./react-vendor-CyjgmGTq.js";import{t as o}from"./bq-BeBxa743.js";import{t as s}from"./toastStore-CS_9Xndn.js";import{i as c,n as l}from"./icons-CIvFfU2b.js";import{n as u}from"./usePolledData-DzlUpBOO.js";import{t as d}from"./Button-BPqpRZJD.js";import{n as f,t as p}from"./Card-C7NMhqUt.js";import{i as m,n as h,r as g,t as _}from"./feedback-BnGE2oW2.js";import{n as v}from"./StatusBadge-B0I7hNBX.js";import{t as y}from"./PageHeader-BXlZSBcc.js";import{a as b,c as x,s as S,t as C}from"./format-Cg7VCIZW.js";import{n as w}from"./index-Cui9IwWy.js";import{r as T,t as E}from"./useServerActionGuard-BlH-Kso1.js";import{r as D}from"./flowMutationSafety-CoOp94wS.js";import{t as O}from"./AreaChart-w0ruozXH.js";import{a as k,i as A,n as j,r as M,t as N}from"./QueueActions-C-Aferd6.js";import{t as P}from"./useThroughputSeries-C2pa1Wd_.js";var F=e(r(),1),I=[`waiting`,`prioritized`,`active`,`waiting-children`,`delayed`,`completed`,`failed`,`paused`],L=[`active`,`waiting`,`prioritized`,`waiting-children`,`completed`,`failed`,`delayed`],R=2e3,z=a();function B({name:e,jobs:t,error:n}){return(0,z.jsxs)(p,{padded:!1,className:`mb-6`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between px-5 py-3`,children:[(0,z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:`Recent jobs`}),(0,z.jsxs)(i,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 text-sm text-muted hover:text-fg`,children:[`View all `,(0,z.jsx)(l,{className:`size-3.5`})]})]}),(0,z.jsx)(`div`,{className:`overflow-x-auto border-t border-line`,children:(0,z.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,z.jsx)(`thead`,{children:(0,z.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,z.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`ID`}),(0,z.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Name`}),(0,z.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`State`}),(0,z.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Attempts`}),(0,z.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Duration`})]})}),(0,z.jsx)(`tbody`,{children:n?(0,z.jsx)(`tr`,{children:(0,z.jsxs)(`td`,{colSpan:5,className:`px-5 py-10 text-center text-sm text-danger`,children:[`Could not load recent jobs — `,n,`. Retry the page.`]})}):t.length===0?(0,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:5,className:`px-5 py-10 text-center text-sm text-faint`,children:`No recent jobs.`})}):t.map(e=>(0,z.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,z.jsx)(`td`,{className:`px-5 py-3`,children:(0,z.jsx)(i,{to:`/job?id=${encodeURIComponent(e.id)}`,className:`font-mono text-xs text-accent hover:underline`,children:e.id})}),(0,z.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.name??`default`}),(0,z.jsx)(`td`,{className:`px-5 py-3 text-muted`,children:e.state??`—`}),(0,z.jsxs)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:[e.attempts??0,` / `,e.maxAttempts??`?`]}),(0,z.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:b(e.startedAt&&e.completedAt?e.completedAt-e.startedAt:void 0)})]},e.id))})]})})]})}function V({counts:e}){let t=Object.entries(e??{}).map(([e,t])=>[Number(e),t]).filter(([,e])=>e>0).sort((e,t)=>t[0]-e[0]);if(t.length===0)return null;let n=Math.max(...t.map(([,e])=>e));return(0,z.jsxs)(p,{className:`mb-6`,children:[(0,z.jsx)(f,{title:`Jobs by priority`}),(0,z.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.map(([e,t])=>(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,z.jsxs)(`span`,{className:`w-16 shrink-0 text-right font-mono text-xs text-muted`,children:[`p`,e]}),(0,z.jsx)(`div`,{className:`h-4 flex-1 overflow-hidden rounded bg-surface-2`,children:(0,z.jsx)(`div`,{className:`h-full rounded bg-accent`,style:{width:`${Math.max(2,t/n*100)}%`}})}),(0,z.jsx)(`span`,{className:`w-14 shrink-0 tnum text-xs text-fg`,children:S(t)})]},e))}),(0,z.jsx)(`p`,{className:`mt-2 text-xs text-faint`,children:`Higher p = higher priority. Waiting jobs only.`})]})}function H({name:e,depth:n,trend:r,rate:i}){return(0,z.jsxs)(p,{className:`mb-6`,children:[(0,z.jsx)(f,{title:`Backlog depth`,action:(0,z.jsx)(`span`,{className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,r.draining?`bg-emerald-500/10 text-success`:r.label===`accumulating`?`bg-red-500/10 text-danger`:`bg-surface-2 text-muted`),children:r.label})}),n.length<2?(0,z.jsx)(`p`,{className:`py-6 text-center text-xs text-faint`,children:`Sampling… the backlog trend appears after a few polls.`}):(0,z.jsx)(O,{height:140,ariaLabel:`${e} backlog depth`,series:[{label:`depth`,color:`var(--accent)`,points:n,area:!0}]}),(0,z.jsxs)(`div`,{className:`mt-1 flex items-center justify-between text-xs text-faint`,children:[(0,z.jsx)(`span`,{children:`waiting + prioritized + active + delayed + waiting-children`}),(0,z.jsxs)(`span`,{className:`tnum`,children:[`Error rate `,i==null?`—`:x(i)]})]})]})}function U(e,t){let[n,r]=(0,F.useState)([]),i=(0,F.useRef)(null);return(0,F.useEffect)(()=>{t&&(i.current=(t.waiting??0)+(t.prioritized??0)+(t.active??0)+(t.delayed??0)+(t[`waiting-children`]??0))},[t]),(0,F.useEffect)(()=>{i.current=null,r([]);let e=setInterval(()=>{let e=i.current;e!=null&&r(t=>[...t,e].slice(-40))},R);return()=>clearInterval(e)},[e]),{depth:n,trend:P(n)}}function W(){let{name:e=``}=n(),[t,r]=(0,F.useState)(!1),[a,f]=(0,F.useState)(null),p=T(`queue:${e}`);(0,F.useEffect)(()=>{r(!1),f(null)},[p.scopeKey]);let{data:b,error:x,loading:O,refetch:P}=u((0,F.useCallback)(async()=>{if(!e)return null;if(!(await o.queuesSummary()).some(t=>t.name===e))return{queue:e,exists:!1,detail:null,stall:null,dlq:null,jobs:[],recentJobsError:null};let[t,n,r,i]=await Promise.all([o.queueDetail(e,!1),o.getStallConfig(e).catch(()=>null),o.getDlqConfig(e).catch(()=>null),o.jobsList(e,L,12).then(e=>({jobs:e.jobs??[],error:null})).catch(e=>({jobs:[],error:e.message||`Unknown error`}))]);return{queue:e,exists:!0,detail:t,stall:n?.config??null,dlq:r?.config??null,jobs:i.jobs,recentJobsError:i.error}},[e]),[e]),R=b&&b.queue===e?b:null,{depth:W,trend:G}=U(e,R?.detail?.counts),K=async(t,n,i,a)=>{if(i&&!window.confirm(i))return;let c=p.begin();if(c){r(!0),f(null);try{let r=await o.queuesSummary();if(!c.isCurrent())return;if(!r.some(t=>t.name===e))throw Error(`Queue "${e}" no longer exists`);let i=await n();if(E(i,t),!c.isCurrent())return;let l=i.count;if(l!==void 0&&(!Number.isSafeInteger(l)||l<0))throw Error(`${t} returned an invalid count`);let u=`${t}${l==null?` ✓`:`: ${l}`}`;f({ok:!0,text:u}),s.success(u,e),a?.(),P()}catch(e){if(!c.isCurrent())return;let n=e.message;f({ok:!1,text:n}),s.error(`${t} failed`,n)}finally{c.finish()&&r(!1)}}},q=R?.detail,J=q?.counts,Y=J?C(J.completed??0,J.failed??0):null;return(0,z.jsxs)(`div`,{children:[(0,z.jsx)(y,{title:(0,z.jsx)(`span`,{className:`font-mono`,children:e}),description:`Full per-queue operations and complete live non-terminal depth.`,live:R?.exists===!0&&!!R.detail&&!!R.stall&&!!R.dlq&&!R.recentJobsError&&!x,back:(0,z.jsx)(i,{to:`/queues`,"aria-label":`Back to queues`,className:`inline-flex size-8 items-center justify-center rounded-lg text-muted transition-colors hover:bg-surface-2 hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:(0,z.jsx)(c,{className:`size-4`})}),actions:R?.exists===!0?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(i,{to:`/jobs?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:[`Jobs `,(0,z.jsx)(l,{className:`size-3.5`})]}),(0,z.jsxs)(i,{to:`/dlq?queue=${encodeURIComponent(e)}`,className:`flex items-center gap-1 rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:[`DLQ `,(0,z.jsx)(l,{className:`size-3.5`})]}),(0,z.jsx)(d,{variant:`danger`,size:`sm`,disabled:!0,title:D,children:`Obliterate`})]}):void 0}),x&&R&&(0,z.jsx)(m,{message:`Queue refresh failed — showing the last successful snapshot.`,onRetry:P}),x&&!R?(0,z.jsx)(h,{error:x,onRetry:P}):O&&!R?(0,z.jsx)(g,{label:`Loading ${e}…`}):R?.exists===!1||!q||!J?!x&&(0,z.jsx)(_,{title:`Queue not found`,hint:`No queue named "${e}" exists — it may have been obliterated, or the link is stale.`,action:(0,z.jsx)(i,{to:`/queues`,className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Back to queues`})}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{className:`mb-6 flex flex-wrap items-center gap-3`,children:[(0,z.jsx)(v,{label:q.paused?`Paused`:`Active`,tone:q.paused?`amber`:`green`}),a&&(0,z.jsx)(`span`,{role:`status`,className:a.ok?`text-xs text-success`:`text-xs text-danger`,children:a.text}),(0,z.jsx)(`span`,{className:`text-xs text-warning`,children:D})]}),(0,z.jsx)(`div`,{className:`mb-6 grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-8`,children:I.map(e=>(0,z.jsx)(w,{label:e,value:S(J[e]),tone:e===`failed`&&J.failed?`red`:`default`,compact:!0},e))}),(0,z.jsx)(B,{name:e,jobs:R.jobs,error:R.recentJobsError}),(0,z.jsx)(V,{counts:q.priorityCounts}),(0,z.jsx)(H,{name:e,depth:W,trend:G,rate:Y}),(0,z.jsx)(j,{queue:e,paused:q.paused,busy:t,run:K}),(0,z.jsx)(N,{queue:e,busy:t,run:K},`${e}:limits`),(0,z.jsxs)(`div`,{className:`mb-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[R.stall?(0,z.jsx)(A,{queue:e,config:R.stall,onSaved:()=>{f({ok:!0,text:`Stall config saved ✓`}),s.success(`Stall config saved`,e)}},`${e}:stall`):(0,z.jsx)(M,{title:`Stall detection`,onRetry:P}),R.dlq?(0,z.jsx)(k,{queue:e,config:R.dlq,onSaved:()=>{f({ok:!0,text:`DLQ config saved ✓`}),s.success(`DLQ config saved`,e)}},`${e}:dlq`):(0,z.jsx)(M,{title:`DLQ policy`,onRetry:P})]})]})]})}export{W as QueueDetailPro};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,r,t as i}from"./react-vendor-CyjgmGTq.js";import{S as a,T as o,n as s}from"./icons-CIvFfU2b.js";import{t as c}from"./api-CQ5Z7xR7.js";import{n as l}from"./usePolledData-DzlUpBOO.js";import{i as u,r as d}from"./feedback-BnGE2oW2.js";import{t as f}from"./PageHeader-BXlZSBcc.js";import{s as p}from"./format-Cg7VCIZW.js";import{n as m}from"./index-Cui9IwWy.js";import{t as h}from"./Pagination-Q-vf4hsX.js";var g=e(n(),1),_=i(),v=20,y={ok:!1,queues:[],total:0,limit:v,offset:0,timestamp:0};function b(){let[e,n]=(0,g.useState)(``),[i,b]=(0,g.useState)(0),{data:x,error:S,loading:C,refetch:w}=l(()=>c.queues(v,i*v),[i]),{data:T}=l(()=>c.overview(),[]),E=x??y,D=(0,g.useMemo)(()=>{let t=E.queues,n=e.trim().toLowerCase();return n?t.filter(e=>e.name.toLowerCase().includes(n)):t},[E,e]);if(C&&!x&&!S)return(0,_.jsx)(d,{label:`Loading queues…`});let O=T?.stats;return(0,_.jsxs)(`div`,{children:[S&&(0,_.jsx)(u,{onRetry:w}),(0,_.jsx)(f,{title:`Queues`,description:x?`${E.total} queues`:`Queue inventory unavailable`,live:!!x&&!S}),(0,_.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,_.jsx)(m,{label:`Waiting`,value:O?p(O.waiting):`—`,tone:`amber`,compact:!0}),(0,_.jsx)(m,{label:`Active`,value:O?p(O.active):`—`,tone:`blue`,compact:!0}),(0,_.jsx)(m,{label:`Delayed`,value:O?p(O.delayed):`—`,tone:`default`,compact:!0}),(0,_.jsx)(m,{label:`DLQ`,value:O?p(O.dlq):`—`,tone:O?.dlq?`red`:`default`,compact:!0})]}),(0,_.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,_.jsx)(o,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,_.jsx)(`input`,{"aria-label":`Filter queues`,name:`classic-queue-filter`,autoComplete:`off`,value:e,onChange:e=>n(e.target.value),placeholder:`Search queues…`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,_.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,_.jsxs)(`table`,{className:`w-full min-w-[52rem] text-sm`,children:[(0,_.jsx)(`thead`,{children:(0,_.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Waiting`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Delayed`}),(0,_.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`DLQ`}),(0,_.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,_.jsx)(`th`,{className:`w-10 px-5 py-3`})]})}),(0,_.jsx)(`tbody`,{children:!x&&S?(0,_.jsx)(`tr`,{children:(0,_.jsxs)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-warning`,children:[`Could not load queues — `,S.message,`. Retry above.`]})}):D.length===0?(0,_.jsx)(`tr`,{children:(0,_.jsx)(`td`,{colSpan:7,className:`px-5 py-12 text-center text-sm text-faint`,children:e?`No queues match on this page.`:`No queues yet.`})}):D.map(e=>(0,_.jsxs)(`tr`,{className:`group border-b border-line last:border-0 transition-colors hover:bg-surface-2/50`,children:[(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsxs)(r,{to:`/queues-classic/${encodeURIComponent(e.name)}`,className:`flex items-center gap-2 rounded font-medium text-fg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[(0,_.jsx)(a,{className:`size-4 text-faint`}),e.name]})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:p(e.waiting)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:p(e.active)}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:p(e.delayed)}),(0,_.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,e.dlq?`text-red-400`:`text-muted`),children:p(e.dlq)}),(0,_.jsx)(`td`,{className:`px-5 py-3`,children:(0,_.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-emerald-400`),children:[(0,_.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e.paused?`Paused`:`Active`]})}),(0,_.jsx)(`td`,{className:`px-5 py-3 text-faint`,children:(0,_.jsx)(s,{className:`size-4 opacity-0 transition-opacity group-hover:opacity-100`})})]},e.name))})]})}),x&&(0,_.jsx)(h,{page:i,pageSize:v,total:E.total,onPageChange:b,label:`queues`})]})}export{b as Queues};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,r,t as i}from"./react-vendor-CyjgmGTq.js";import{t as a}from"./bq-BeBxa743.js";import{t as o}from"./toastStore-CS_9Xndn.js";import{S as s,T as c,b as l,n as u,x as d}from"./icons-CIvFfU2b.js";import{n as f}from"./usePolledData-DzlUpBOO.js";import{n as p,t as m}from"./Button-BPqpRZJD.js";import{i as h,n as g,r as _}from"./feedback-BnGE2oW2.js";import{t as v}from"./PageHeader-BXlZSBcc.js";import{s as y}from"./format-Cg7VCIZW.js";import{n as b}from"./index-Cui9IwWy.js";import{t as x}from"./Pagination-Q-vf4hsX.js";import{r as S,t as C}from"./useServerActionGuard-BlH-Kso1.js";import{t as w}from"./promisePool-BVfQ9n9Q.js";var T=e(n(),1),E=i(),D=[[`waiting`,`Waiting`],[`prioritized`,`Prioritized`],[`active`,`Active`],[`completed`,`Completed`],[`failed`,`Failed`],[`delayed`,`Delayed`]];function O({rows:e,hasData:n,error:i,search:a,sortCol:o,sortDir:c,bulkBusy:f,busy:m,onSort:h,onToggle:g}){return(0,E.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,E.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,E.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),D.map(([e,t])=>(0,E.jsx)(`th`,{"aria-sort":o===e?c===`desc`?`descending`:`ascending`:void 0,className:`px-5 py-3 text-right font-medium`,children:(0,E.jsxs)(`button`,{type:`button`,onClick:()=>h(e),className:`inline-flex items-center gap-1 rounded uppercase tracking-wider hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[t,o===e&&(0,E.jsx)(`span`,{"aria-hidden":`true`,children:c===`desc`?`↓`:`↑`})]})},e)),(0,E.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,E.jsx)(`th`,{className:`w-24 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,E.jsx)(`tbody`,{children:!n&&i?(0,E.jsx)(`tr`,{children:(0,E.jsxs)(`td`,{colSpan:9,className:`px-5 py-12 text-center text-sm text-warning`,children:[`Could not load queues — `,i.message,`. Retry above.`]})}):e.length===0?(0,E.jsx)(`tr`,{children:(0,E.jsx)(`td`,{colSpan:9,className:`px-5 py-12 text-center text-sm text-faint`,children:a?`No queues match your search.`:`No queues yet.`})}):e.map(e=>{let n=f||m.has(e.name);return(0,E.jsxs)(`tr`,{className:`group border-b border-line last:border-0 transition-colors hover:bg-surface-2/50`,children:[(0,E.jsx)(`td`,{className:`px-5 py-3`,children:(0,E.jsxs)(r,{to:`/queues/${encodeURIComponent(e.name)}`,className:`flex items-center gap-2 rounded font-medium text-fg hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50`,children:[(0,E.jsx)(s,{className:`size-4 text-faint`}),e.name]})}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-warning`,children:y(e.counts.waiting)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-orange-400`,children:y(e.counts.prioritized)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:y(e.counts.active)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-success`,children:y(e.counts.completed)}),(0,E.jsx)(`td`,{className:t(`px-5 py-3 text-right tnum`,e.counts.failed?`text-danger`:`text-muted`),children:y(e.counts.failed)}),(0,E.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:y(e.counts.delayed)}),(0,E.jsx)(`td`,{className:`px-5 py-3`,children:(0,E.jsxs)(`span`,{className:t(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium`,e.paused?`bg-orange-500/10 text-orange-400`:`bg-emerald-500/10 text-success`),children:[(0,E.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e.paused?`Paused`:`Active`]})}),(0,E.jsx)(`td`,{className:`px-5 py-3`,children:(0,E.jsxs)(`div`,{className:`flex items-center justify-end gap-1`,children:[(0,E.jsx)(p,{"aria-label":e.paused?`Resume queue`:`Pause queue`,disabled:n,onClick:t=>{t.stopPropagation(),g(e)},children:e.paused?(0,E.jsx)(d,{className:`size-3.5 text-success`}):(0,E.jsx)(l,{className:`size-3.5 text-warning`})}),(0,E.jsx)(u,{className:`size-4 text-faint opacity-0 transition-opacity group-hover:opacity-100`})]})})]},e.name)})})]})})}var k=6,A=15;function j(){let[e,n]=(0,T.useState)(``),[r,i]=(0,T.useState)(0),[s,u]=(0,T.useState)(new Set),[p,D]=(0,T.useState)(!1),[j,M]=(0,T.useState)(null),[N,P]=(0,T.useState)(null),[F,I]=(0,T.useState)(`desc`),L=S(`queues-overview`);(0,T.useEffect)(()=>{u(new Set),D(!1),M(null)},[L.scopeKey]);let{data:R,error:z,loading:B,refetch:V}=f(()=>a.queuesSummary(),[]),H=R??[],U=e=>{N===e?F===`desc`?I(`asc`):P(null):(P(e),I(`desc`)),i(0)},W=(0,T.useMemo)(()=>{let t=e.trim().toLowerCase(),n=[...t?H.filter(e=>e.name.toLowerCase().includes(t)):H].sort((e,t)=>e.name.localeCompare(t.name));if(N){let e=F===`desc`?-1:1;n.sort((t,n)=>e*(t.counts[N]-n.counts[N]))}return n},[H,e,N,F]),G=(0,T.useMemo)(()=>H.reduce((e,t)=>(e.waiting+=t.counts.waiting,e.prioritized+=t.counts.prioritized,e.active+=t.counts.active,e.failed+=t.counts.failed,e.paused+=+!!t.paused,e),{waiting:0,prioritized:0,active:0,failed:0,paused:0}),[H]),K=Math.max(1,Math.ceil(W.length/A)),q=Math.min(r,K-1),J=W.slice(q*A,q*A+A),Y=async e=>{let t=L.begin(`queue:${e.name}`);if(t){u(t=>new Set(t).add(e.name)),M(null);try{if(C(await(e.paused?a.resume(e.name):a.pause(e.name)),e.paused?`Resume queue`:`Pause queue`),!t.isCurrent())return;M({ok:!0,text:`${e.name} ${e.paused?`resumed`:`paused`} ✓`}),V()}catch(n){if(!t.isCurrent())return;M({ok:!1,text:n.message}),o.error(`Failed to ${e.paused?`resume`:`pause`} ${e.name}`,n.message)}finally{t.finish()&&u(t=>{let n=new Set(t);return n.delete(e.name),n})}}},X=async e=>{let t=H.filter(t=>e===`pause`?!t.paused:t.paused);if(t.length===0){o.info(`No queues to ${e}`);return}if(!window.confirm(`${e===`pause`?`Pause`:`Resume`} ${t.length} queue(s)?`))return;let n=L.begin([`bulk`,...H.map(e=>`queue:${e.name}`)]);if(n){D(!0),M(null);try{let r=await w(t,k,async t=>{if(!n.isCurrent())throw Error(`Queue action target changed`);C(e===`pause`?await a.pause(t.name):await a.resume(t.name),`${e===`pause`?`Pause`:`Resume`} ${t.name}`)});if(!n.isCurrent())return;let i=r.filter(e=>e.status===`rejected`).length,s=`${e===`pause`?`Paused`:`Resumed`} ${t.length-i}/${t.length} queues${i?`, ${i} failed`:``}`;M({ok:i===0,text:s}),i===0?o.success(s):o.error(s),V()}finally{n.finish()&&D(!1)}}};return B&&!R&&!z?(0,E.jsx)(_,{label:`Loading queues…`}):z&&!R?(0,E.jsxs)(`div`,{children:[(0,E.jsx)(v,{title:`Queues`,description:`Queue inventory unavailable`}),(0,E.jsx)(g,{error:z,onRetry:V})]}):(0,E.jsxs)(`div`,{children:[(0,E.jsx)(v,{title:`Queues`,description:R?`${H.length} queues`:`Queue inventory unavailable`,live:!!R&&!z,actions:H.length>0?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(m,{variant:`warning`,size:`sm`,disabled:p||s.size>0||G.paused>=H.length,onClick:()=>X(`pause`),children:[(0,E.jsx)(l,{className:`size-3.5`}),` Pause all`]}),(0,E.jsxs)(m,{variant:`success`,size:`sm`,disabled:p||s.size>0||G.paused===0,onClick:()=>X(`resume`),children:[(0,E.jsx)(d,{className:`size-3.5`}),` Resume all`]})]}):void 0}),z&&(0,E.jsx)(h,{message:`Queue refresh failed — showing the last successful inventory.`,onRetry:V}),(0,E.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-5`,children:[(0,E.jsx)(b,{label:`Waiting`,value:y(G.waiting),tone:`amber`,compact:!0}),(0,E.jsx)(b,{label:`Prioritized`,value:y(G.prioritized),tone:`amber`,compact:!0}),(0,E.jsx)(b,{label:`Active`,value:y(G.active),tone:`blue`,compact:!0}),(0,E.jsx)(b,{label:`Failed`,value:y(G.failed),tone:G.failed?`red`:`default`,compact:!0}),(0,E.jsx)(b,{label:`Paused`,value:y(G.paused),tone:G.paused?`amber`:`default`,compact:!0})]}),(0,E.jsxs)(`div`,{className:`relative mb-4 max-w-sm`,children:[(0,E.jsx)(c,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-faint`}),(0,E.jsx)(`input`,{value:e,onChange:e=>{n(e.target.value),i(0)},placeholder:`Search queues…`,"aria-label":`Filter queues`,name:`queue-filter`,autoComplete:`off`,className:`h-9 w-full rounded-lg border border-line bg-surface pl-9 pr-3 text-sm text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),j&&(0,E.jsx)(`div`,{role:`status`,className:t(`mb-3 text-sm`,j.ok?`text-success`:`text-danger`),children:j.text}),(0,E.jsx)(O,{rows:J,hasData:!!R,error:z,search:e,sortCol:N,sortDir:F,bulkBusy:p,busy:s,onSort:U,onToggle:e=>void Y(e)}),(0,E.jsx)(x,{page:q,pageSize:A,total:W.length,onPageChange:i,label:`queues`})]})}export{j as QueuesOverview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-vendor-CyjgmGTq.js";import{t}from"./api-CQ5Z7xR7.js";import{n}from"./usePolledData-DzlUpBOO.js";import{n as r,t as i}from"./Card-C7NMhqUt.js";import{i as a,n as o,r as s}from"./feedback-BnGE2oW2.js";import{t as c}from"./PageHeader-BXlZSBcc.js";var l=e(),u=[[`S3_BACKUP_ENABLED`,`Set to 1 to enable periodic backups`],[`S3_BUCKET`,`Target bucket name`],[`S3_REGION`,`Bucket region (default us-east-1)`],[`S3_ENDPOINT`,`Custom endpoint (for S3-compatible stores)`],[`S3_ACCESS_KEY_ID`,`Access key`],[`S3_SECRET_ACCESS_KEY`,`Secret key`],[`S3_BACKUP_INTERVAL`,`Interval in ms (default 21600000 = 6h)`],[`S3_BACKUP_RETENTION`,`Backups to keep (default 7)`]];function d(){let{data:e,error:d,loading:f,refetch:p}=n(async()=>{let e=await t.storage();if(!e?.data||typeof e.data.diskFull!=`boolean`)throw Error(`Storage status response is missing disk health data`);return e},[]);return(0,l.jsxs)(`div`,{children:[d&&e&&(0,l.jsx)(a,{message:`Storage refresh failed — showing the last successful status.`,onRetry:p}),(0,l.jsx)(c,{title:`S3 Backup`,description:`SQLite snapshot backups to object storage.`,live:!!e?.data&&!d}),(0,l.jsx)(`div`,{className:`mb-6 rounded-lg border border-line bg-surface/60 px-4 py-3 text-sm text-muted`,children:`S3 backup runs on the server and is configured via environment variables — it cannot be toggled from the dashboard. The status below reflects the connected server's storage.`}),(0,l.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,l.jsxs)(i,{children:[(0,l.jsx)(r,{title:`Storage status`}),d&&!e?(0,l.jsx)(o,{error:d,onRetry:p}):f&&!e?(0,l.jsx)(s,{}):(0,l.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,l.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,l.jsx)(`dt`,{className:`text-muted`,children:`Disk`}),(0,l.jsx)(`dd`,{className:e?.data?e.data.diskFull?`font-medium text-red-400`:`font-medium text-emerald-400`:`font-medium text-muted`,children:e?.data?e.data.diskFull?`Full`:`Healthy`:`Unavailable`})]}),(0,l.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,l.jsx)(`dt`,{className:`text-muted`,children:`Error`}),(0,l.jsx)(`dd`,{className:`font-mono text-xs text-fg`,children:e?.data?.error?String(e.data.error):`—`})]})]})]}),(0,l.jsxs)(i,{children:[(0,l.jsx)(r,{title:`Configuration (server env)`}),(0,l.jsx)(`dl`,{className:`divide-y divide-line text-sm`,children:u.map(([e,t])=>(0,l.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-2.5`,children:[(0,l.jsx)(`dt`,{className:`font-mono text-xs text-accent/90`,children:e}),(0,l.jsx)(`dd`,{className:`text-right text-xs text-faint`,children:t})]},e))})]})]})]})}export{d as S3Backup};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CyjgmGTq.js";import{c as r,i,l as a,o,u as s}from"./connectionStore-DbBYqHEY.js";import{o as c,t as l}from"./bq-BeBxa743.js";import{w as u}from"./icons-CIvFfU2b.js";import{n as d}from"./usePolledData-DzlUpBOO.js";import{t as f}from"./Button-BPqpRZJD.js";import{t as p}from"./Card-C7NMhqUt.js";import{t as m}from"./PageHeader-BXlZSBcc.js";import{a as h}from"./index-Cui9IwWy.js";import{a as g,n as _,r as v,t as y}from"./form-tC20r4Ma.js";var b=e(t(),1),ee=`bq-dash-s3`,x=2,S=[`disabled`,`6h`,`12h`,`24h`],C={endpoint:``,region:`us-east-1`,bucket:``,schedule:`disabled`,pathPrefix:``,virtualHostedStyle:`auto`,retention:7};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e,t,n){return typeof e==`string`&&e.length<=n?e:t}function E(e){return S.includes(e)?e:`disabled`}function D(e){return e===`virtual-hosted`||e===`path-style`?e:`auto`}function O(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=1&&e<=1e6?e:C.retention}function k(e){let t=w(e)?e:{};return{endpoint:T(t.endpoint,C.endpoint,2048),region:T(t.region,C.region,128),bucket:T(t.bucket,C.bucket,255),schedule:E(t.schedule),pathPrefix:T(t.pathPrefix,C.pathPrefix,1024),virtualHostedStyle:D(t.virtualHostedStyle),retention:O(t.retention)}}function A(e){return k(e)}function j(){try{return globalThis.localStorage??null}catch{return null}}function M(e){try{let t=JSON.parse(e),n=w(t)?t:{},r=k(`state`in n?n.state:n),i=typeof n.version==`number`?n.version:void 0;return{hydration:JSON.stringify({state:r,...i===void 0?{}:{version:i}}),canonical:JSON.stringify({state:r,version:x})}}catch{return null}}var te={getItem(e){let t=j();if(!t)return null;let n;try{n=t.getItem(e)}catch{return null}if(n===null||e!==`bq-dash-s3`)return n;let r=M(n);if(!r){try{t.removeItem(e)}catch{}return null}if(n!==r.canonical)try{t.setItem(e,r.canonical)}catch{try{t.removeItem(e)}catch{}}return r.hydration},setItem(e,t){try{j()?.setItem(e,t)}catch{}},removeItem(e){try{j()?.removeItem(e)}catch{}}},ne=s()(a(e=>({...C,accessKeyId:``,secretAccessKey:``,sessionToken:``,set:t=>e(e=>{let n={...e,...t};return{...k(n),accessKeyId:T(n.accessKeyId,``,512),secretAccessKey:T(n.secretAccessKey,``,2048),sessionToken:T(n.sessionToken,``,4096)}})}),{name:ee,version:x,storage:r(()=>te),partialize:A,migrate:k,merge:(e,t)=>({...t,...k(e),accessKeyId:``,secretAccessKey:``,sessionToken:``})})),N=new Set([`enabled`,`bucket`,`endpoint`,`interval`,`retention`]),P=new Set([`key`,`size`,`date`]);function F(e){let t=L(e,N,`Backup status`);return typeof t.enabled!=`boolean`&&B(`Backup status`),{enabled:t.enabled,bucket:R(t.bucket,`Backup status bucket`,1024),endpoint:R(t.endpoint,`Backup status endpoint`,4096),interval:R(t.interval,`Backup status interval`,128),retention:R(t.retention,`Backup status retention`,128)}}function I(e){(!Array.isArray(e)||e.length>2e4)&&B(`Backup list`);let t=new Set,n=0;return e.map((e,r)=>{let i=L(e,P,`Backup list item ${r}`),a=R(i.key,`Backup list item ${r} key`,2048),o=R(i.size,`Backup list item ${r} size`,128),s=R(i.date,`Backup list item ${r} date`,128);return n+=a.length+o.length+s.length,(n>2*1024*1024||t.has(a)||!z(s))&&B(`Backup list item ${r}`),t.add(a),{key:a,size:o,date:s}})}function L(e,t,n){(!e||typeof e!=`object`||Array.isArray(e))&&B(n);let r=e;return Object.keys(r).some(e=>!t.has(e))&&B(n),r}function R(e,t,n){return(typeof e!=`string`||e.length<1||e.length>n)&&B(t),e}function z(e){let t=Date.parse(e);return/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)&&Number.isFinite(t)&&new Date(t).toISOString()===e}function B(e){throw Error(`${e} returned an invalid Bunqueue 2.8.57 contract`)}function V(e){let t={};for(let n of e.split(`
|
|
2
|
+
`)){let e=n.indexOf(`=`);if(e<1)throw Error(`Generated backup environment is malformed`);let r=n.slice(0,e),i=n.slice(e+1);if(!/^S3_[A-Z0-9_]+$/.test(r))throw Error(`Unexpected backup key: ${r}`);let a;try{a=JSON.parse(i)}catch{if(i===`true`||i===`false`||/^\d+$/.test(i))a=i;else throw Error(`Generated backup value for ${r} is malformed`)}t[r]=String(a)}return t}var H=e=>`${e}?target=${encodeURIComponent(i())}`,U=e=>({method:`POST`,headers:e===void 0?void 0:{"Content-Type":`application/json`},body:e===void 0?void 0:JSON.stringify(e)}),W=async(e,t)=>(await c(H(e),t)).result,G={status:()=>W(`/backup/status`),list:()=>W(`/backup/list`),backupNow:()=>W(`/backup/now`,U()),restore:(e,t)=>W(`/backup/restore`,U({key:e,database:t})),configure:e=>W(`/backup/configure`,U({environment:e})),restoreContext:async()=>{let e=await c(`/control/status`);return{serverStatus:e.status,database:e.db??null}}},K=n();function q({environmentText:e,repository:t=G}){let n=d(()=>X(t),[t],{intervalMs:15e3}),[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)(``),l=(0,b.useRef)(!1),u=async(e,t)=>{if(!l.current){l.current=!0,i(e),o(``),c(``);try{let r=(await t())?.message;c(r??`${e} completed.`),await n.refetch()}catch(e){o(e instanceof Error?e.message:String(e))}finally{l.current=!1,i(``)}}},f=()=>{e&&window.confirm(`Apply this S3 configuration to the managed server? A restart is required.`)&&u(`Configuration`,()=>t.configure(V(e)))},p=()=>{window.confirm(`Create a transactionally consistent S3 backup now?`)&&u(`Backup`,()=>t.backupNow())},m=e=>{let r=n.data?.context?.database;!r||n.data?.context?.serverStatus!==`stopped`||window.prompt(`Type RESTORE to replace ${r.path} with ${e}`)===`RESTORE`&&u(`Restore`,()=>t.restore(e,r))},h=n.data;return(0,K.jsxs)(`section`,{className:`mt-6 overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,K.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Live backup operations`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Official Bunqueue 2.8.57 backup CLI, executed by the local control agent.`})]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsx)(`button`,{type:`button`,disabled:!e||!!r,onClick:f,className:`rounded-md border border-line px-3 py-2 text-xs text-muted disabled:opacity-40`,children:`Apply configuration`}),(0,K.jsx)(`button`,{type:`button`,disabled:!!r,onClick:p,className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:r===`Backup`?`Backing up…`:`Backup now`}),(0,K.jsx)(`button`,{type:`button`,disabled:n.loading,onClick:()=>void n.refetch(),className:`rounded-md border border-line px-3 py-2 text-xs text-muted disabled:opacity-40`,children:`Refresh`})]})]}),h?.status&&(0,K.jsx)(J,{status:h.status,context:h.context}),a||h?.errors.length?(0,K.jsx)(`div`,{role:`alert`,className:`border-b border-line px-4 py-3 text-xs text-danger`,children:a||h?.errors.join(` · `)}):null,s&&(0,K.jsx)(`div`,{role:`status`,className:`border-b border-line px-4 py-3 text-xs text-success`,children:s}),(0,K.jsx)(Y,{rows:h?.backups??[],canRestore:h?.context?.serverStatus===`stopped`&&!!h.context.database,busy:!!r,onRestore:m})]})}function J({status:e,context:t}){return(0,K.jsx)(`dl`,{className:`grid border-b border-line sm:grid-cols-2 xl:grid-cols-5`,children:[[`Scheduler`,e.enabled?`Enabled after restart`:`Disabled`],[`Bucket`,e.bucket||`—`],[`Endpoint`,e.endpoint],[`Retention`,e.retention],[`Server`,t?.serverStatus??`Unknown`]].map(([e,t])=>(0,K.jsxs)(`div`,{className:`border-b border-line px-4 py-3 last:border-b-0 xl:border-r xl:border-b-0`,children:[(0,K.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-faint`,children:e}),(0,K.jsx)(`dd`,{className:`mt-1 truncate text-xs text-fg`,title:t,children:t})]},e))})}function Y({rows:e,canRestore:t,busy:n,onRestore:r}){return e.length?(0,K.jsx)(`div`,{className:`overflow-x-auto`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[680px] text-left text-xs`,children:[(0,K.jsx)(`thead`,{className:`border-b border-line text-[10px] uppercase tracking-wider text-faint`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:`Object key`}),(0,K.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:`Size`}),(0,K.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:`Created`}),(0,K.jsx)(`th`,{className:`px-4 py-2 text-right font-medium`,children:`Restore`})]})}),(0,K.jsx)(`tbody`,{className:`divide-y divide-line`,children:e.map(e=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{className:`max-w-md truncate px-4 py-3 font-mono text-fg`,title:e.key,children:e.key}),(0,K.jsx)(`td`,{className:`px-4 py-3 text-muted`,children:e.size}),(0,K.jsx)(`td`,{className:`px-4 py-3 text-muted`,children:e.date}),(0,K.jsx)(`td`,{className:`px-4 py-3 text-right`,children:(0,K.jsx)(`button`,{type:`button`,disabled:!t||n,title:t?`Restore this backup`:`Stop the managed server before restore`,onClick:()=>r(e.key),className:`rounded-md border border-danger/40 px-2.5 py-1.5 text-danger disabled:opacity-35`,children:`Restore`})})]},e.key))})]})}):(0,K.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`No backup objects returned.`})}async function X(e){let[t,n,r]=await Promise.allSettled([e.status().then(e=>F(e.data)),e.list().then(e=>I(e.data)),e.restoreContext()]),i=[t,n,r].filter(e=>e.status===`rejected`).map(e=>e.reason instanceof Error?e.reason.message:String(e.reason));return{status:t.status===`fulfilled`?t.value:void 0,backups:n.status===`fulfilled`?n.value:[],context:r.status===`fulfilled`?r.value:void 0,errors:i}}function re(e){if(typeof e!=`object`||!e||Array.isArray(e)||typeof e.ok!=`boolean`)throw Error(`Malformed storage status response.`);let t=e.data;if(typeof t!=`object`||!t||Array.isArray(t)||typeof t.diskFull!=`boolean`)throw Error(`Storage status response is missing disk health data.`);return{diskFull:t.diskFull}}var Z=e=>JSON.stringify([e.baseUrl,e.token]),Q={"6h":360*60*1e3,"12h":720*60*1e3,"24h":1440*60*1e3};function $(e,t){return`${e}=${typeof t==`string`?JSON.stringify(t):String(t)}`}function ie(e){let t=[],n=e.endpoint.trim(),r=e.region.trim(),i=e.bucket.trim(),a=e.accessKeyId.trim(),o=e.secretAccessKey.trim(),s=e.sessionToken.trim(),c=e.pathPrefix.trim();if(e.schedule===`disabled`)return{ok:!0,value:$(`S3_BACKUP_ENABLED`,!1)};if((!r||r.length>128)&&t.push(`Region is required (maximum 128 characters).`),(!i||i.length>255)&&t.push(`Bucket is required (maximum 255 characters).`),(!a||a.length>512)&&t.push(`Access key ID is required (maximum 512 characters).`),(!o||o.length>2048)&&t.push(`Secret access key is required (maximum 2048 characters).`),s.length>4096&&t.push(`Session token is too long.`),(!Number.isSafeInteger(e.retention)||e.retention<1||e.retention>1e6)&&t.push(`Retention must be a whole number from 1 to 1000000.`),c.length>1024&&t.push(`Path prefix is too long.`),n)try{let e=new URL(n);(e.protocol!==`http:`&&e.protocol!==`https:`||e.username||e.password||n.length>2048)&&t.push(`Endpoint must be an http(s) URL without embedded credentials.`)}catch{t.push(`Endpoint must be a valid http(s) URL.`)}if(t.length)return{ok:!1,errors:t};let l=[$(`S3_BACKUP_ENABLED`,!0),$(`S3_ACCESS_KEY_ID`,a),$(`S3_SECRET_ACCESS_KEY`,o),$(`S3_BUCKET`,i),$(`S3_REGION`,r),$(`S3_BACKUP_RETENTION`,e.retention)];return s&&l.push($(`S3_SESSION_TOKEN`,s)),e.virtualHostedStyle!==`auto`&&l.push($(`S3_VIRTUAL_HOSTED_STYLE`,e.virtualHostedStyle===`virtual-hosted`)),n&&l.push($(`S3_ENDPOINT`,n)),c&&l.push($(`S3_BACKUP_PREFIX`,c)),l.push($(`S3_BACKUP_INTERVAL`,Q[e.schedule])),{ok:!0,value:l.join(`
|
|
3
|
+
`)}}function ae({environment:e}){return(0,K.jsxs)(p,{children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:`Server environment`}),(0,K.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Credentials stay in memory and are copied or applied only when you request it.`})]}),e.ok&&(0,K.jsx)(h,{value:e.value})]}),e.ok?(0,K.jsx)(`pre`,{className:`overflow-x-auto whitespace-pre-wrap break-all rounded-lg bg-surface-2 p-4 font-mono text-xs text-muted`,children:e.value.replace(/^S3_ACCESS_KEY_ID=.*$/m,`S3_ACCESS_KEY_ID="••••••••"`).replace(/^S3_SECRET_ACCESS_KEY=.*$/m,`S3_SECRET_ACCESS_KEY="••••••••"`).replace(/^S3_SESSION_TOKEN=.*$/m,`S3_SESSION_TOKEN="••••••••"`)}):(0,K.jsx)(`ul`,{className:`space-y-1 text-sm text-danger`,"aria-label":`Configuration errors`,children:e.errors.map(e=>(0,K.jsxs)(`li`,{children:[`• `,e]},e))})]})}function oe(){let e=ne(),t=o(Z),[n,r]=(0,b.useState)(null),[i,a]=(0,b.useState)(null),s=(0,b.useRef)(0),c=ie(e),d=n?.target===t?n:null,h=i===t;return(0,b.useEffect)(()=>(s.current++,r(null),a(null),()=>{s.current++}),[t]),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(m,{title:`S3 Backup Setup`,description:`Configure and operate Bunqueue 2.8.57 S3 backups.`}),(0,K.jsxs)(`div`,{className:`mb-6 flex items-center justify-between rounded-xl border border-line bg-surface px-5 py-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`flex size-10 items-center justify-center rounded-lg bg-surface-2 text-faint`,children:(0,K.jsx)(u,{className:`size-5`})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-semibold text-fg`,children:c.ok?`Configuration draft complete`:`Configuration draft incomplete`}),(0,K.jsx)(`div`,{className:`text-xs text-faint`,children:c.ok?e.schedule===`disabled`?`Safe disable settings ready to apply`:`Target: ${e.bucket.trim()} · ready to apply`:`Complete the required fields to generate server settings`})]})]}),(0,K.jsx)(`span`,{className:c.ok?`rounded-full bg-emerald-500/10 px-3 py-1 text-xs font-medium text-success`:`rounded-full bg-amber-500/10 px-3 py-1 text-xs font-medium text-warning`,children:c.ok?`Ready`:`Configure`})]}),(0,K.jsx)(`div`,{className:`mb-6 rounded-lg border border-line bg-surface/60 px-4 py-2.5 text-xs text-faint`,children:`Apply the generated settings through the local control agent below, then restart Bunqueue. Status, object listing, manual backups, and guarded restores use the official Bunqueue CLI. Non-secret draft fields are stored locally; credentials remain in memory.`}),(0,K.jsxs)(p,{className:`mb-6`,children:[(0,K.jsx)(`h2`,{className:`mb-1 text-base font-semibold text-fg`,children:`Connection Settings`}),(0,K.jsx)(`p`,{className:`mb-4 text-xs text-faint`,children:`Works with AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces, and any S3-compatible provider.`}),(0,K.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-2`,children:[(0,K.jsx)(y,{label:`Endpoint`,children:(0,K.jsx)(_,{name:`s3-endpoint`,value:e.endpoint,onChange:t=>e.set({endpoint:t.target.value}),placeholder:`https://s3.amazonaws.com`,maxLength:2048,autoComplete:`off`,inputMode:`url`})}),(0,K.jsx)(y,{label:`Region`,children:(0,K.jsx)(_,{name:`s3-region`,value:e.region,onChange:t=>e.set({region:t.target.value}),placeholder:`us-east-1`,maxLength:128,autoComplete:`off`,spellCheck:!1})}),(0,K.jsx)(`div`,{className:`md:col-span-2`,children:(0,K.jsx)(y,{label:`Bucket name`,children:(0,K.jsx)(_,{name:`s3-bucket`,value:e.bucket,onChange:t=>e.set({bucket:t.target.value}),placeholder:`my-bunqueue-backups`,maxLength:255,autoComplete:`off`,spellCheck:!1})})}),(0,K.jsx)(y,{label:`Access key ID`,children:(0,K.jsx)(_,{name:`s3-access-key-id`,value:e.accessKeyId,onChange:t=>e.set({accessKeyId:t.target.value}),placeholder:`AKIA…`,maxLength:512,autoComplete:`off`,spellCheck:!1})}),(0,K.jsx)(y,{label:`Secret access key`,children:(0,K.jsx)(_,{name:`s3-secret-access-key`,type:`password`,value:e.secretAccessKey,onChange:t=>e.set({secretAccessKey:t.target.value}),placeholder:`••••••••••••••••`,maxLength:2048,autoComplete:`off`,spellCheck:!1})}),(0,K.jsx)(`div`,{className:`md:col-span-2`,children:(0,K.jsx)(y,{label:`Session token (optional, for temporary STS credentials)`,children:(0,K.jsx)(_,{name:`s3-session-token`,type:`password`,value:e.sessionToken,onChange:t=>e.set({sessionToken:t.target.value}),placeholder:`Temporary AWS session token`,maxLength:4096,autoComplete:`off`,spellCheck:!1})})}),(0,K.jsx)(`p`,{className:`-mt-2 text-xs text-faint md:col-span-2`,children:`Keys are kept in memory only and cleared on reload.`}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(v,{htmlFor:`s3-backup-schedule`,children:`Backup interval`}),(0,K.jsxs)(g,{id:`s3-backup-schedule`,name:`s3-backup-schedule`,value:e.schedule,onChange:t=>e.set({schedule:t.target.value}),className:`mt-1.5`,title:`Written to S3_BACKUP_ENABLED and S3_BACKUP_INTERVAL in the generated config`,autoComplete:`off`,children:[(0,K.jsx)(`option`,{value:`disabled`,children:`Disabled`}),(0,K.jsx)(`option`,{value:`6h`,children:`Every 6 hours`}),(0,K.jsx)(`option`,{value:`12h`,children:`Every 12 hours`}),(0,K.jsx)(`option`,{value:`24h`,children:`Every 24 hours`})]})]}),(0,K.jsx)(y,{label:`Path prefix (optional)`,children:(0,K.jsx)(_,{name:`s3-path-prefix`,value:e.pathPrefix,onChange:t=>e.set({pathPrefix:t.target.value}),placeholder:`backups/production/`,maxLength:1024,autoComplete:`off`,spellCheck:!1})}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(v,{htmlFor:`s3-addressing-style`,children:`Addressing style`}),(0,K.jsxs)(g,{id:`s3-addressing-style`,name:`s3-addressing-style`,value:e.virtualHostedStyle,onChange:t=>e.set({virtualHostedStyle:t.target.value}),className:`mt-1.5`,children:[(0,K.jsx)(`option`,{value:`auto`,children:`Provider default`}),(0,K.jsx)(`option`,{value:`virtual-hosted`,children:`Virtual-hosted style`}),(0,K.jsx)(`option`,{value:`path-style`,children:`Path style`})]})]}),(0,K.jsx)(y,{label:`Backups to retain`,children:(0,K.jsx)(_,{name:`s3-retention`,type:`number`,min:1,max:1e6,step:1,value:e.retention,onChange:t=>e.set({retention:Number(t.target.value)}),inputMode:`numeric`})})]}),(0,K.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(f,{onClick:async()=>{let e=t,n=++s.current;r(null),a(e);try{let t=await l.storage();if(n!==s.current||Z(o.getState())!==e)return;let i=re(t);r({target:e,ok:!i.diskFull,msg:i.diskFull?`Server disk is full`:`Server disk healthy — this does not validate the S3 credentials`})}catch(t){if(n!==s.current||Z(o.getState())!==e)return;r({target:e,ok:!1,msg:t.message})}finally{n===s.current&&a(null)}},children:h?`Checking server storage…`:`Check server storage`}),(0,K.jsx)(`span`,{className:`text-xs text-faint`,children:`This checks SQLite disk health only, not S3 connectivity.`}),d&&(0,K.jsx)(`span`,{role:`status`,className:d.ok?`text-xs text-success`:`text-xs text-danger`,children:d.msg})]})]}),(0,K.jsx)(ae,{environment:c}),(0,K.jsx)(q,{environmentText:c.ok?c.value:void 0})]})}export{oe as S3BackupPro};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CyjgmGTq.js";import{t as i}from"./bq-BeBxa743.js";import{C as a,T as o,b as s,x as c}from"./icons-CIvFfU2b.js";import{n as l}from"./usePolledData-DzlUpBOO.js";import{t as u}from"./Button-BPqpRZJD.js";import{n as d,t as f}from"./Card-C7NMhqUt.js";import{i as p,n as m,r as h}from"./feedback-BnGE2oW2.js";import{t as g}from"./PageHeader-BXlZSBcc.js";import{f as _,i as v,l as y,n as b,u as x}from"./format-Cg7VCIZW.js";import{a as S}from"./index-Cui9IwWy.js";import{i as C,n as w,t as T}from"./form-tC20r4Ma.js";var E=e(n(),1),D=r();function O({children:e}){return(0,D.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs text-fg`,children:e})}function k({agentBase:e}){return(0,D.jsx)(f,{children:(0,D.jsxs)(`details`,{className:`group`,children:[(0,D.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2`,children:[(0,D.jsx)(`span`,{className:`text-base font-semibold text-fg`,children:`How server control works`}),(0,D.jsx)(`span`,{className:`text-xs text-muted transition-transform group-open:rotate-90`,children:`▶`})]}),(0,D.jsxs)(`div`,{className:`mt-4 space-y-4 text-sm leading-relaxed text-muted`,children:[(0,D.jsxs)(`p`,{children:[`A browser can't start or stop an OS process, so the dashboard talks to a small local`,` `,(0,D.jsx)(`span`,{className:`font-medium text-fg`,children:`control agent`}),` (`,(0,D.jsx)(O,{children:e}),`) that supervises the bunqueue server process — start, stop and restart — and streams its logs back here.`]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Launch & environment`}),(0,D.jsxs)(`p`,{children:[`The agent runs your `,(0,D.jsx)(`span`,{className:`text-fg`,children:`Command`}),` and injects`,` `,(0,D.jsx)(O,{children:`HTTP_PORT`}),`, `,(0,D.jsx)(O,{children:`TCP_PORT`}),` and `,(0,D.jsx)(O,{children:`BUNQUEUE_DATA_PATH`}),` — plus any `,(0,D.jsx)(`span`,{className:`text-fg`,children:`Environment variables`}),` you add — into its environment. The default `,(0,D.jsx)(O,{children:`bunx bunqueue@2.8.57 start`}),` resolves the verified release; pointing the command at a local entry (e.g.`,` `,(0,D.jsx)(O,{children:`bun run /path/to/bunqueue/src/main.ts`}),`) works without one.`]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`When changes apply`}),(0,D.jsxs)(`p`,{children:[`Config is editable any time, but `,(0,D.jsx)(`span`,{className:`text-fg`,children:`Command`}),`, ports and data path only take effect on the `,(0,D.jsx)(`span`,{className:`text-fg`,children:`next start/restart`}),` `,`— the running process keeps the config it launched with until then.`]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Data path`}),(0,D.jsxs)(`p`,{children:[`Relative paths resolve against the `,(0,D.jsx)(`span`,{className:`text-fg`,children:`agent's`}),` working directory. SQLite creates the database `,(0,D.jsx)(`span`,{className:`text-fg`,children:`file`}),` but not its parent `,(0,D.jsx)(`span`,{className:`text-fg`,children:`folder`}),` — if start fails with`,` `,(0,D.jsx)(O,{children:`SQLITE_CANTOPEN`}),`, create the directory first or use a path whose folder already exists.`]})]}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`div`,{className:`mb-1 font-medium text-fg`,children:`Security`}),(0,D.jsxs)(`p`,{children:[`The direct agent listener binds `,(0,D.jsx)(O,{children:`127.0.0.1`}),`, locks CORS to an allowlist (never `,(0,D.jsx)(O,{children:`*`}),`), and rejects a disallowed `,(0,D.jsx)(O,{children:`Origin`}),` or`,` `,(0,D.jsx)(O,{children:`Host`}),` with `,(0,D.jsx)(O,{children:`403`}),`. The all-in-one server's `,(0,D.jsx)(O,{children:`/agent`}),` `,`bridge treats LAN and reverse-proxy access as remote: `,(0,D.jsx)(O,{children:`AGENT_TOKEN`}),` is then mandatory for status, logs, database reads and changes alike. Without it, the bridge stays disabled.`]}),(0,D.jsxs)(`p`,{children:[`If you started the agent with `,(0,D.jsx)(O,{children:`AGENT_TOKEN`}),`, enter that token under`,` `,(0,D.jsx)(`span`,{className:`text-fg`,children:`Settings → Agent token`}),` (or when the lock screen prompts). It stays in memory for this browser session; never bake it into a public`,` `,(0,D.jsx)(O,{children:`VITE_*`}),` value.`]})]})]})]})})}var A=0,j=e=>Object.entries(e).map(([e,t])=>({id:A++,key:e,value:t})),M=e=>{let t={};for(let n of e){let e=n.key.trim();e&&(t[e]=n.value)}return t};function N(e){let t=e.map(e=>e.trim());return[...new Set(t.filter((e,t,n)=>e&&n.indexOf(e)!==t))]}var P=[`AUTH_TOKENS`,`LOG_LEVEL`,`S3_BACKUP_ENABLED`,`S3_BUCKET`,`METRICS_ENABLED`];function F({value:e,onChange:t,disabled:n}){let[r,i]=(0,E.useState)(()=>j(e)),a=e=>{i(e),t(M(e))},o=(e,t)=>a(r.map(n=>n.id===e?{...n,...t}:n)),s=(e=``)=>a([...r,{id:A++,key:e,value:``}]),c=e=>a(r.filter(t=>t.id!==e)),l=new Set(r.map(e=>e.key.trim()).filter(Boolean)),d=N(r.map(e=>e.key)),f=[...new Set(r.map(e=>e.key.trim()).filter(e=>e&&(/[\s=]/.test(e)||/[a-z]/.test(e))))];return(0,D.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[r.length===0&&(0,D.jsxs)(`p`,{className:`text-xs leading-relaxed text-faint`,children:[`No custom variables. The agent already injects`,` `,(0,D.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`HTTP_PORT`}),`,`,` `,(0,D.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`TCP_PORT`}),` and`,` `,(0,D.jsx)(`code`,{className:`rounded bg-surface-2 px-1 py-0.5`,children:`BUNQUEUE_DATA_PATH`}),`.`]}),r.map(e=>(0,D.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(`div`,{className:`w-2/5 shrink-0`,children:(0,D.jsx)(w,{id:`env-key-${e.id}`,name:`env-key-${e.id}`,"aria-label":`Variable name${e.key?` ${e.key}`:``}`,className:`font-mono`,placeholder:`KEY`,value:e.key,disabled:n,autoComplete:`off`,spellCheck:!1,onChange:t=>o(e.id,{key:t.target.value})})}),(0,D.jsx)(`span`,{className:`text-faint`,children:`=`}),(0,D.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,D.jsx)(w,{id:`env-value-${e.id}`,name:`env-value-${e.id}`,"aria-label":`Value for ${e.key||`variable`}`,className:`font-mono`,placeholder:`value`,value:e.value,disabled:n,autoComplete:`off`,spellCheck:!1,onChange:t=>o(e.id,{value:t.target.value})})}),(0,D.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.key||`variable`}`,disabled:n,onClick:()=>c(e.id),className:`shrink-0 rounded-md px-2 py-1 text-xs text-faint transition-colors hover:text-danger disabled:opacity-40`,children:`✕`})]},e.id)),d.length>0&&(0,D.jsxs)(`p`,{className:`text-xs text-warning`,children:[`Duplicate key`,d.length>1?`s`:``,` — the last value wins: `,d.join(`, `)]}),f.length>0&&(0,D.jsxs)(`p`,{className:`text-xs text-faint`,children:[`Unusual key`,f.length>1?`s`:``,` — env names are usually UPPER_SNAKE_CASE with no spaces or "=": `,f.join(`, `),`. Saved as-is.`]}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 pt-1`,children:[(0,D.jsx)(u,{size:`sm`,variant:`ghost`,disabled:n,onClick:()=>s(),children:`+ Add variable`}),P.filter(e=>!l.has(e)).map(e=>(0,D.jsxs)(`button`,{type:`button`,disabled:n,onClick:()=>s(e),className:`rounded-md border border-line bg-surface-2 px-2 py-1 font-mono text-[11px] text-muted transition-colors hover:border-line-strong hover:text-fg disabled:opacity-40`,children:[`+ `,e]},e))]})]})}function I({status:e,onSaved:t,running:n,transitioning:r}){let[o,s]=(0,E.useState)(null),[c,l]=(0,E.useState)(!1),[p,m]=(0,E.useState)(!1),[h,g]=(0,E.useState)(null);(0,E.useEffect)(()=>{e?.config&&!o&&s(e.config)},[e,o]);let _=o??e?.config??null;if(!_)return(0,D.jsx)(f,{children:`Loading…`});let v=e=>s({..._,...e}),y=e?.runningConfig??null,b=(e={})=>JSON.stringify(Object.keys(e).sort().map(t=>[t,e[t]])),x=[];y!=null&&(y.command!==_.command&&x.push(`command`),y.httpPort!==_.httpPort&&x.push(`HTTP port`),y.tcpPort!==_.tcpPort&&x.push(`TCP port`),y.dataPath!==_.dataPath&&x.push(`data path`),b(y.extraEnv)!==b(_.extraEnv)&&x.push(`environment variables`));let S=n&&x.length>0,C=r||p,O=()=>{l(!0),setTimeout(()=>l(!1),2e3)},k=()=>{let e=e=>Number.isInteger(e)&&e>=1&&e<=65535;return e(_.httpPort)?e(_.tcpPort)?_.httpPort===_.tcpPort?`HTTP and TCP ports must differ`:null:`TCP port must be an integer between 1 and 65535`:`HTTP port must be an integer between 1 and 65535`},A=async()=>{let e=k();if(e)return g(e);g(null);try{await i.control.setConfig(_),O(),t()}catch(e){g(e.message)}};return(0,D.jsxs)(f,{children:[(0,D.jsx)(d,{title:`Configuration`}),(0,D.jsx)(`p`,{className:`mb-3 text-xs text-muted`,children:n?`Ports and data path apply on the next restart — edit freely, then restart.`:`Edit and save; the config is used the next time the server starts.`}),(0,D.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,D.jsx)(T,{label:`Command`,hint:`The exact command the agent runs to launch bunqueue. It receives HTTP_PORT, TCP_PORT and BUNQUEUE_DATA_PATH in its environment. The default resolves Bunqueue 2.8.57 with bunx; offline installs can point at a local entry.`,children:(0,D.jsx)(w,{name:`server-command`,autoComplete:`off`,spellCheck:!1,value:_.command,disabled:C,onChange:e=>v({command:e.target.value}),placeholder:`bunx bunqueue@2.8.57 start`})}),(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,D.jsx)(T,{label:`HTTP port`,hint:`Dashboard API + SSE.`,children:(0,D.jsx)(w,{name:`server-http-port`,autoComplete:`off`,type:`number`,min:1,max:65535,value:_.httpPort,disabled:C,onChange:e=>v({httpPort:Number(e.target.value)})})}),(0,D.jsx)(T,{label:`TCP port`,hint:`Binary protocol. Must differ from HTTP.`,children:(0,D.jsx)(w,{name:`server-tcp-port`,autoComplete:`off`,type:`number`,min:1,max:65535,value:_.tcpPort,disabled:C,onChange:e=>v({tcpPort:Number(e.target.value)})})})]}),(0,D.jsx)(T,{label:`Data path`,hint:`SQLite database file, relative to the agent's working directory. The parent folder must already exist — SQLite creates the file, not the directory.`,children:(0,D.jsx)(w,{name:`server-data-path`,autoComplete:`off`,spellCheck:!1,value:_.dataPath,disabled:C,onChange:e=>v({dataPath:e.target.value})})}),(0,D.jsx)(T,{label:`Environment variables`,hint:`Injected into the server process on start, on top of the ports + data path. Applies on the next restart.`,children:(0,D.jsx)(F,{value:_.extraEnv??{},onChange:e=>v({extraEnv:e}),disabled:C})}),(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,D.jsx)(u,{type:`submit`,variant:`accent`,size:`sm`,disabled:C,children:`Save config`}),n&&(0,D.jsxs)(u,{variant:`warning`,size:`sm`,disabled:C,onClick:async()=>{let e=k();if(e)return g(e);let n=x.length>0?` Changed: ${x.join(`, `)}.`:``;if(window.confirm(`Save configuration and restart the server to apply it?${n}`)){g(null),m(!0);try{await i.control.setConfig(_),await i.control.restart(),O(),t()}catch(e){g(e.message)}finally{m(!1)}}},children:[(0,D.jsx)(a,{className:`size-3.5`}),` Save & restart`]}),S&&!c&&(0,D.jsx)(`span`,{className:`text-xs text-warning`,children:`Restart to apply changes`}),c&&(0,D.jsx)(`span`,{className:`text-xs text-success`,children:`Saved`}),h&&(0,D.jsx)(`span`,{className:`text-xs text-danger`,children:h})]})]})]})}var L=[`all`,`stdout`,`stderr`,`sys`],R=e=>`${new Date(e).toLocaleTimeString([],{hour12:!1})}.${String(e%1e3).padStart(3,`0`)}`,z=e=>e===`stderr`?`text-danger/90`:e===`sys`?`text-accent/80`:`text-muted`;function B(e,t=Date.now()){let n=new Blob([e],{type:`text/plain`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`bunqueue-logs-${t}.log`;try{document.body.appendChild(i),i.click()}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)}}function V(){let{data:e,error:n,loading:r,refetch:i}=U(),a=(0,E.useMemo)(()=>e?.lines??[],[e]),[s,c]=(0,E.useState)(`all`),[l,u]=(0,E.useState)(``),[d,g]=(0,E.useState)(!0),[v,y]=(0,E.useState)(!1),b=(0,E.useRef)(null),x=(0,E.useMemo)(()=>{let e=l.trim().toLowerCase();return a.map(e=>e.line.includes(`\x1B`)?{...e,line:_(e.line)}:e).filter(t=>(s===`all`||t.stream===s)&&(!e||t.line.toLowerCase().includes(e)))},[a,s,l]);(0,E.useEffect)(()=>{if(!d)return;let e=b.current;e&&(e.scrollTop=e.scrollHeight)},[x.length,d]);let w=(0,E.useMemo)(()=>x.map(e=>v?`${R(e.ts)} [${e.stream}] ${e.line}`:e.line).join(`
|
|
2
|
+
`),[x,v]);return(0,D.jsxs)(f,{padded:!1,className:`overflow-hidden`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line px-4 py-3`,children:[(0,D.jsx)(`h3`,{className:`mr-1 text-base font-semibold text-fg`,children:`Process logs`}),(0,D.jsx)(C,{options:L,value:s,onChange:c}),(0,D.jsxs)(`div`,{className:`relative min-w-40 flex-1`,children:[(0,D.jsx)(o,{className:`pointer-events-none absolute left-2.5 top-1/2 size-3.5 -translate-y-1/2 text-faint`}),(0,D.jsx)(`input`,{value:l,onChange:e=>u(e.target.value),"aria-label":`Filter log lines`,name:`process-log-filter`,autoComplete:`off`,placeholder:`Filter…`,className:`h-8 w-full rounded-lg border border-line bg-surface-2 pl-8 pr-2 text-xs text-fg placeholder:text-faint focus:border-accent/60 focus:outline-none focus:ring-2 focus:ring-accent/30`})]}),(0,D.jsx)(H,{on:d,onClick:()=>g(e=>!e),label:`Follow`}),(0,D.jsx)(H,{on:v,onClick:()=>y(e=>!e),label:`Times`}),(0,D.jsx)(S,{value:w}),(0,D.jsx)(`button`,{type:`button`,onClick:()=>{B(w)},disabled:x.length===0,className:`rounded-md border border-line bg-surface-2 px-2 py-1 text-xs text-muted transition-colors hover:text-fg disabled:opacity-40`,children:`Download`})]}),n&&e&&(0,D.jsx)(`div`,{className:`border-b border-line px-4 pt-3 font-sans`,children:(0,D.jsx)(p,{message:`Process-log refresh failed — showing the last received lines. ${n.message}`,onRetry:i})}),(0,D.jsx)(`div`,{ref:b,className:`max-h-80 min-h-40 overflow-y-auto p-4 font-mono text-xs leading-relaxed`,children:r&&!e&&!n?(0,D.jsx)(`div`,{className:`font-sans`,children:(0,D.jsx)(h,{label:`Loading process logs…`})}):n&&!e?(0,D.jsx)(`div`,{className:`font-sans`,children:(0,D.jsx)(m,{error:n,onRetry:i})}):x.length===0?(0,D.jsx)(`p`,{className:`text-faint`,children:a.length===0?`No output yet.`:`No lines match the current filter.`}):x.map(e=>(0,D.jsxs)(`div`,{className:t(`whitespace-pre-wrap`,z(e.stream)),children:[v&&(0,D.jsx)(`span`,{className:`mr-2 text-faint`,children:R(e.ts)}),e.line]},e.seq))}),(0,D.jsxs)(`div`,{className:`flex items-center justify-between border-t border-line px-4 py-2 text-[11px] text-faint`,children:[(0,D.jsx)(`span`,{children:n&&!e?`logs unavailable`:x.length===a.length?`${a.length} lines`:`${x.length} of ${a.length} lines`}),(0,D.jsx)(`span`,{children:n?`refresh failed`:d?`following tail`:`paused`})]})]})}function H({on:e,onClick:n,label:r}){return(0,D.jsx)(`button`,{type:`button`,onClick:n,"aria-pressed":e,className:t(`rounded-md border px-2 py-1 text-xs transition-colors`,e?`border-accent/40 bg-accent/10 text-accent`:`border-line bg-surface-2 text-muted hover:text-fg`),children:r})}function U(){return l(()=>i.control.logs(),[])}var W={running:{label:`Running`,tone:`text-success`,dot:`bg-emerald-400`},starting:{label:`Starting`,tone:`text-warning`,dot:`bg-amber-400`},stopping:{label:`Stopping`,tone:`text-warning`,dot:`bg-amber-400`},stopped:{label:`Stopped`,tone:`text-danger`,dot:`bg-red-400`}};function G({startedAt:e}){let[,t]=(0,E.useState)(0);return(0,E.useEffect)(()=>{let e=setInterval(()=>t(e=>e+1),1e3);return()=>clearInterval(e)},[]),(0,D.jsx)(D.Fragment,{children:x((Date.now()-e)/1e3)})}function K({label:e,children:t,title:n}){return(0,D.jsxs)(`div`,{className:`min-w-0`,title:n,children:[(0,D.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider text-faint`,children:e}),(0,D.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-sm text-fg`,children:t})]})}function q({status:e,agentBase:n,transitioning:r,stale:i=!1,vitals:o=null,busy:l,onStart:d,onStop:f,onRestart:p}){let m=e?.status??`stopped`,h=m===`running`,g=W[m]??W.stopped,_=!!e?.healthy&&!i,y=!h&&e?.exitCode!=null&&e.exitCode!==0,b=e?.runningConfig??e?.config??null,x=`http://localhost:${b?.httpPort??6790}`;return(0,D.jsxs)(`section`,{className:`mb-6 overflow-hidden rounded-xl border border-line bg-surface`,children:[(0,D.jsx)(`div`,{className:t(`h-0.5 bg-gradient-to-r to-transparent`,h&&_?`from-emerald-400/80 via-emerald-400/25`:h||r?`from-amber-400/80 via-amber-400/25`:`from-red-400/70 via-red-400/20`)}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-5 p-5 lg:flex-row lg:items-center lg:justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,D.jsxs)(`span`,{className:`relative flex size-3.5 shrink-0`,children:[h&&_&&(0,D.jsx)(`span`,{className:`absolute inline-flex size-full rounded-full bg-emerald-400 opacity-50 motion-safe:animate-ping`}),(0,D.jsx)(`span`,{className:t(`relative inline-flex size-3.5 rounded-full`,g.dot)})]}),(0,D.jsxs)(`div`,{className:`min-w-0`,children:[(0,D.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3 gap-y-1`,children:[(0,D.jsx)(`span`,{className:t(`text-2xl font-bold tracking-tight`,g.tone),children:r&&l?`${l}…`:g.label}),e?.version&&(0,D.jsxs)(`span`,{className:`font-mono text-xs text-muted`,children:[`bunqueue v`,e.version]}),y&&(0,D.jsxs)(`span`,{className:`rounded-full bg-red-500/15 px-2 py-0.5 font-mono text-[11px] font-medium text-danger`,children:[`crashed · exit `,e?.exitCode]})]}),(0,D.jsx)(`div`,{className:`mt-1 font-mono text-xs text-muted`,children:i?(0,D.jsxs)(`span`,{className:`text-warning`,children:[`last known: pid `,e?.pid??`—`,` — agent unreachable, state may have changed`]}):h?(0,D.jsxs)(D.Fragment,{children:[_?`healthy`:`waiting for health…`,` · pid `,e?.pid??`—`,` · up`,` `,e?.startedAt?(0,D.jsx)(G,{startedAt:e.startedAt}):`—`]}):`process not running — start it below or point the dashboard at an external server`})]})]}),(0,D.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,D.jsxs)(u,{variant:`success`,disabled:h||r||i,onClick:d,children:[(0,D.jsx)(c,{className:`size-4`}),` Start`]}),(0,D.jsxs)(u,{variant:`warning`,disabled:!h||r||i,onClick:f,children:[(0,D.jsx)(s,{className:`size-4`}),` Stop`]}),(0,D.jsxs)(u,{disabled:r||i,onClick:p,children:[(0,D.jsx)(a,{className:`size-4`}),` Restart`]})]})]}),(0,D.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 border-t border-line bg-surface-2/30 px-5 py-4 md:grid-cols-3 xl:grid-cols-7`,children:[(0,D.jsx)(K,{label:`Memory`,children:o?.memory?.rss==null?(0,D.jsx)(`span`,{className:`text-faint`,children:`—`}):(0,D.jsxs)(`span`,{title:`heap ${o.memory.heapUsed??`?`} / ${o.memory.heapTotal??`?`} MB`,children:[o.memory.rss,` MB rss`]})}),(0,D.jsx)(K,{label:`Connections`,children:o?.connections?`${o.connections.tcp??0} tcp · ${o.connections.ws??0} ws · ${o.connections.sse??0} sse`:(0,D.jsx)(`span`,{className:`text-faint`,children:`—`})}),(0,D.jsx)(K,{label:`API endpoint`,title:x,children:h?(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`a`,{href:`${x}/health`,target:`_blank`,rel:`noreferrer`,className:`truncate text-accent hover:underline`,children:x}),(0,D.jsx)(S,{value:x})]}):(0,D.jsx)(`span`,{className:`text-faint`,children:x})}),(0,D.jsx)(K,{label:`Ports`,children:b?`${b.httpPort} http · ${b.tcpPort} tcp`:`—`}),(0,D.jsx)(K,{label:`Started`,children:h&&e?.startedAt?v(e.startedAt):`—`}),(0,D.jsx)(K,{label:`Control agent`,title:n,children:n.replace(/^https?:\/\//,``)}),(0,D.jsx)(K,{label:`Launch command`,title:b?.command,children:b?.command??`—`})]})]})}var J=[{key:`size`,label:`Database`,color:`bg-accent`},{key:`walSize`,label:`WAL`,color:`bg-amber-400`},{key:`shmSize`,label:`SHM`,color:`bg-zinc-500`}];function Y({db:e}){let n=e.totalSize||0;return(0,D.jsxs)(f,{children:[(0,D.jsxs)(`div`,{className:`mb-1 flex items-baseline justify-between gap-2`,children:[(0,D.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:`Storage`}),(0,D.jsx)(`span`,{className:`font-mono text-xs text-muted`,children:e.exists?`${b(n)} on disk`:`not created yet`})]}),(0,D.jsxs)(`p`,{className:`mb-4 flex items-center gap-1.5 truncate font-mono text-xs text-faint`,title:e.path,children:[(0,D.jsx)(`span`,{className:`truncate`,children:e.path}),(0,D.jsx)(S,{value:e.path})]}),e.exists&&n>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`flex h-2.5 overflow-hidden rounded-full bg-surface-2`,children:J.map(r=>{let i=e[r.key];return i?(0,D.jsx)(`div`,{className:t(`h-full`,r.color),style:{width:`${i/n*100}%`},title:`${r.label}: ${b(i)}`},r.key):null})}),(0,D.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-5 gap-y-1.5 font-mono text-[11px] text-faint`,children:[J.map(n=>(0,D.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,D.jsx)(`span`,{className:t(`size-2 rounded-full`,n.color)}),n.label,` `,(0,D.jsx)(`span`,{className:`text-fg`,children:b(e[n.key])})]},n.key)),e.mtimeMs?(0,D.jsxs)(`span`,{className:`ml-auto`,children:[`written `,y(e.mtimeMs)]}):null]})]}):(0,D.jsx)(`p`,{className:`rounded-lg border border-dashed border-line px-4 py-6 text-center text-sm text-faint`,children:`The database appears here after the first start — SQLite creates the file at the configured data path.`})]})}function X(){let{data:e,error:t,refetch:n}=l(()=>i.control.status(),[]),[r,a]=(0,E.useState)(null),[o,s]=(0,E.useState)(null),c=e?.status===`running`,{data:u}=l(()=>c?i.health():Promise.resolve(null),[c]),m=c?u??null:null,h=m?.connections?` This drops ${m.connections.tcp??0} TCP / ${m.connections.ws??0} WS connections; in-flight jobs are interrupted.`:` In-flight jobs are interrupted.`,_=async(e,t,r)=>{if(!(r&&!window.confirm(r))){a(e),s(null);try{await t(),await n()}catch(e){s(e.message)}finally{a(null)}}};if(t&&!e)return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(g,{title:`Server`,description:`Start, stop and restart the bunqueue server.`}),(0,D.jsx)(p,{message:`Control agent unreachable — server lifecycle controls are unavailable.`,onRetry:n}),(0,D.jsxs)(f,{children:[(0,D.jsx)(d,{title:`Control agent not running`}),(0,D.jsxs)(`p`,{className:`text-sm text-muted`,children:[`The local control agent is unreachable at`,` `,(0,D.jsx)(`code`,{className:`rounded bg-surface-2 px-1.5 py-0.5 text-xs`,children:i.agentBase}),`. It manages the bunqueue server process (start / stop / restart). Start it with:`]}),(0,D.jsxs)(`pre`,{className:`mt-3 overflow-x-auto rounded-lg border border-line bg-surface-2 px-3 py-2 text-xs`,children:[`bun start`,` `,`# agent + dashboard together (recommended)`,`
|
|
3
|
+
`,`bun run agent`,` `,`# agent only, if the dashboard is already running`]}),(0,D.jsx)(`p`,{className:`mt-3 text-xs text-faint`,children:`This page reconnects automatically once the agent is up — no reload needed.`})]})]});let v=e?.status??`stopped`,y=v===`running`,b=v===`starting`||v===`stopping`||r!=null,x=t!=null&&e!=null;return(0,D.jsxs)(`div`,{children:[(0,D.jsx)(g,{title:`Server`,description:`Supervise the bunqueue server process — lifecycle, configuration, storage and logs.`}),o&&(0,D.jsx)(`div`,{role:`status`,className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:o}),x&&(0,D.jsx)(`div`,{className:`mb-4 rounded-lg border border-amber-500/20 bg-amber-500/5 px-4 py-2 text-sm text-warning`,children:`Control agent unreachable — showing last known state. Lifecycle actions are disabled until it responds again.`}),(0,D.jsx)(q,{status:e,agentBase:i.agentBase,stale:x,vitals:m,transitioning:b,busy:r,onStart:()=>_(`starting`,()=>i.control.start()),onStop:()=>_(`stopping`,()=>i.control.stop(),`Stop the bunqueue server?${h}`),onRestart:()=>_(`restarting`,()=>i.control.restart(),`Restart the bunqueue server?${h}`)}),(0,D.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,D.jsx)(I,{status:e,onSaved:n,running:y,transitioning:b}),(0,D.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e?.db&&(0,D.jsx)(Y,{db:e.db}),(0,D.jsx)(V,{})]})]}),(0,D.jsx)(`div`,{className:`mt-6`,children:(0,D.jsx)(k,{agentBase:i.agentBase})})]})}export{X as ServerControl};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CyjgmGTq.js";import{a as r,o as i,t as a}from"./connectionStore-DbBYqHEY.js";import{f as o}from"./icons-CIvFfU2b.js";import{n as s,t as c}from"./Button-BPqpRZJD.js";import{n as l,t as u}from"./Card-C7NMhqUt.js";import{t as d}from"./PageHeader-BXlZSBcc.js";import{o as f}from"./index-Cui9IwWy.js";import{a as p,n as m,t as h}from"./form-tC20r4Ma.js";var g=e(t(),1),_=n(),v=[[`1000`,`1 second`],[`2000`,`2 seconds`],[`3000`,`3 seconds`],[`5000`,`5 seconds`],[`10000`,`10 seconds`]];function y(){let{refreshMs:e,setRefreshMs:t}=i(),{theme:n,setTheme:r}=f();return(0,_.jsxs)(u,{children:[(0,_.jsx)(l,{title:`Appearance & refresh`}),(0,_.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,_.jsx)(h,{label:`Theme`,children:(0,_.jsxs)(p,{name:`theme`,autoComplete:`off`,value:n,onChange:e=>r(e.target.value),children:[(0,_.jsx)(`option`,{value:`dark`,children:`Dark`}),(0,_.jsx)(`option`,{value:`light`,children:`Light`})]})}),(0,_.jsx)(h,{label:`Refresh interval`,children:(0,_.jsx)(p,{name:`refresh-interval`,autoComplete:`off`,value:String(e),onChange:e=>t(Number(e.target.value)),children:v.map(([e,t])=>(0,_.jsx)(`option`,{value:e,children:t},e))})})]})]})}var b=1e4,x=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/u;async function S(e,t={},n=b){let r=new AbortController,i=t.signal,a=i?AbortSignal.any([i,r.signal]):r.signal,o=Error(`Connection test timed out after ${Math.ceil(n/1e3)} seconds.`),s,c,l=new Promise((e,t)=>{s=setTimeout(()=>{r.abort(o),t(o)},n)}),u=i?new Promise((e,t)=>{let n=()=>{t(i.reason??new DOMException(`Connection test aborted`,`AbortError`))};i.aborted?n():(i.addEventListener(`abort`,n,{once:!0}),c=()=>i.removeEventListener(`abort`,n))}):null;try{let n=(async()=>{let n=await fetch(e,{...t,signal:a});if(!n.ok&&n.status!==503)throw Error(`HTTP ${n.status}`);let r=await n.json();if(typeof r!=`object`||!r||Array.isArray(r))throw Error(`Malformed health response`);let i=r;if(typeof i.ok!=`boolean`||i.status!==`healthy`&&i.status!==`degraded`||!Number.isSafeInteger(i.uptime)||i.uptime<0||typeof i.version!=`string`||!x.test(i.version)||i.ok!==(i.status===`healthy`))throw Error(`Malformed health response`);return{response:n,health:i}})();return await Promise.race(u?[n,l,u]:[n,l])}catch(e){throw r.signal.aborted&&r.signal.reason===o?o:e}finally{s!==void 0&&clearTimeout(s),c?.()}}function C(){let{baseUrl:e,token:t,agentToken:n,saveConnection:f}=i(),[p,v]=(0,g.useState)(!1),[b,x]=(0,g.useState)(null),[C,w]=(0,g.useState)(e),[T,E]=(0,g.useState)(t),[D,O]=(0,g.useState)(n),[k,A]=(0,g.useState)(!1),[j,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)(null),[F,I]=(0,g.useState)(null),L=(0,g.useRef)(!0),R=(0,g.useRef)(0),z=(0,g.useRef)(null),B=(0,g.useRef)(null),V=(0,g.useCallback)(()=>{B.current!==null&&(clearTimeout(B.current),B.current=null),L.current&&I(null)},[]),H=(0,g.useCallback)(()=>{R.current+=1,z.current?.abort(new DOMException(`Connection test superseded`,`AbortError`)),z.current=null,L.current&&(v(!1),x(null))},[]);return(0,g.useEffect)(()=>(L.current=!0,()=>{L.current=!1,R.current+=1,z.current?.abort(new DOMException(`Settings unmounted`,`AbortError`)),z.current=null,B.current!==null&&(clearTimeout(B.current),B.current=null)}),[]),(0,g.useEffect)(()=>{w(e),E(t),O(n),H()},[n,e,H,t]),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(d,{title:`Settings`,description:`Connection and appearance.`}),(0,_.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,_.jsxs)(u,{children:[(0,_.jsx)(l,{title:`Connection`}),(0,_.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,_.jsx)(h,{label:`Server URL`,children:(0,_.jsx)(m,{name:`server-url`,value:C,onChange:e=>{H(),V(),w(e.target.value),P(null)},placeholder:`/api or https://queue.example.com`,autoComplete:`off`,inputMode:`url`,"aria-invalid":N?!0:void 0,"aria-describedby":N?`server-url-error`:`server-url-help`})}),N&&(0,_.jsx)(`p`,{id:`server-url-error`,className:`-mt-2 text-xs text-danger`,children:N}),(0,_.jsxs)(`p`,{id:`server-url-help`,className:`-mt-2 text-xs text-faint`,children:[`Use `,(0,_.jsx)(`code`,{className:`font-mono`,children:`/api`}),` in dev (proxied to localhost:6790), or the server origin in production.`]}),(0,_.jsx)(h,{label:`Bearer token (optional)`,hint:`Kept in memory only — re-enter after reload. Never bake secrets into VITE_* variables.`,htmlFor:`bearer-token`,children:(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsx)(m,{id:`bearer-token`,name:`bearer-token`,type:k?`text`:`password`,value:T,onChange:e=>{H(),V(),E(e.target.value)},placeholder:`only if AUTH_TOKENS is set`,className:`pr-10`,autoComplete:`off`,spellCheck:!1}),(0,_.jsx)(s,{"aria-label":k?`Hide token`:`Show token`,className:`absolute right-0.5 top-1/2 -translate-y-1/2`,onClick:()=>A(e=>!e),children:(0,_.jsx)(o,{className:`size-4`})})]})}),(0,_.jsx)(h,{label:`Agent token (optional)`,hint:`Only if the control agent runs with AGENT_TOKEN. Kept in memory; re-enter after reload.`,htmlFor:`agent-token`,children:(0,_.jsxs)(`div`,{className:`relative`,children:[(0,_.jsx)(m,{id:`agent-token`,name:`agent-token`,type:j?`text`:`password`,value:D,onChange:e=>{H(),V(),O(e.target.value)},placeholder:`only if AGENT_TOKEN is set`,className:`pr-10`,autoComplete:`off`,spellCheck:!1}),(0,_.jsx)(s,{"aria-label":j?`Hide agent token`:`Show agent token`,className:`absolute right-0.5 top-1/2 -translate-y-1/2`,onClick:()=>M(e=>!e),children:(0,_.jsx)(o,{className:`size-4`})})]})}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(c,{variant:`accent`,onClick:()=>{H();let e=r(C);if(!e){P(a);return}P(null),w(e);let t=f({baseUrl:e,token:T,agentToken:D});V(),I({persisted:t.persisted,message:t.persisted?`Saved ✓`:`Saved for this session only — browser storage unavailable${t.error?`: ${t.error}`:`.`}`}),B.current=setTimeout(()=>{B.current=null,L.current&&I(null)},4e3)},children:`Save`}),(0,_.jsx)(c,{onClick:async()=>{H();let e=r(C);if(!e){P(a),x({ok:!1,msg:a});return}P(null);let t=R.current,n=new AbortController,o=i.getState(),s=()=>{let e=i.getState();return L.current&&t===R.current&&!n.signal.aborted&&e.baseUrl===o.baseUrl&&e.token===o.token&&e.agentToken===o.agentToken};z.current=n,v(!0),x(null);let c=performance.now();try{let{response:t,health:r}=await S(`${e}/health`,{headers:T.trim()?{Authorization:`Bearer ${T.trim()}`}:void 0,signal:n.signal});if(!s())return;let i=Math.round(performance.now()-c),a=t.status===503||r.status===`degraded`;x({ok:!a,msg:`${a?`Server reachable`:`Connected`} in ${i}ms · bunqueue v${r.version}${a?` · degraded`:``}`})}catch(e){if(!s())return;x({ok:!1,msg:e.message})}finally{L.current&&t===R.current&&(z.current=null,v(!1))}},children:p?`Restart test`:`Test connection`}),F&&(0,_.jsx)(`span`,{role:`status`,className:F.persisted?`text-sm text-success`:`text-sm text-warning`,children:F.message}),b&&(0,_.jsx)(`span`,{role:`status`,className:b.ok?`text-sm text-success`:`text-sm text-danger`,children:b.msg})]}),(0,_.jsx)(`p`,{className:`-mt-1 text-xs text-faint`,children:`Test checks the values above as typed. Saving repoints every page at the new server immediately.`})]})]}),(0,_.jsx)(y,{})]})]})}export{C as Settings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cn-zFEt5SO8.js";import{t}from"./react-vendor-CyjgmGTq.js";var n=t(),r={completed:`text-success bg-emerald-500/10`,active:`text-blue-400 light:text-blue-700 bg-blue-500/10`,failed:`text-danger bg-red-500/10`,waiting:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,prioritized:`text-violet-400 light:text-violet-700 bg-violet-500/10`,delayed:`text-warning bg-amber-500/10`,paused:`text-orange-400 light:text-orange-700 bg-orange-500/10`,"waiting-children":`text-cyan-400 light:text-cyan-700 bg-cyan-500/10`,stalled:`text-orange-400 light:text-orange-700 bg-orange-500/10`,running:`text-blue-400 light:text-blue-700 bg-blue-500/10`,compensating:`text-violet-400 light:text-violet-700 bg-violet-500/10`,"compensation-stuck":`text-danger bg-red-500/10`,compensated:`text-success bg-emerald-500/10`,"compensation-failed":`text-danger bg-red-500/10`,"compensation-skipped":`text-warning bg-amber-500/10`,enqueued:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,started:`text-blue-400 light:text-blue-700 bg-blue-500/10`,finished:`text-success bg-emerald-500/10`,retry:`text-warning bg-amber-500/10`,cancelled:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`,default:`text-zinc-400 light:text-zinc-600 bg-zinc-500/10`};function i({status:t}){let i=(t||``).toLowerCase();return(0,n.jsxs)(`span`,{className:e(`inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs font-medium capitalize`,r[i]??r.default),children:[(0,n.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),t||`unknown`]})}function a({label:t,tone:r=`green`}){return(0,n.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-muted`,children:[(0,n.jsx)(`span`,{className:e(`size-1.5 rounded-full`,r===`green`?`bg-emerald-400`:r===`amber`?`bg-amber-400`:r===`red`?`bg-red-400`:`bg-zinc-400`)}),t]})}export{a as n,i as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-vendor-CyjgmGTq.js";import{t}from"./api-CQ5Z7xR7.js";import{n}from"./usePolledData-DzlUpBOO.js";import{n as r,t as i}from"./Card-C7NMhqUt.js";import{i as a,n as o,r as s}from"./feedback-BnGE2oW2.js";import{t as c}from"./PageHeader-BXlZSBcc.js";import{l,n as u,s as d,u as f}from"./format-Cg7VCIZW.js";import{n as p}from"./index-Cui9IwWy.js";var m=e(),h={stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},workers:{total:0,active:0},crons:{total:0},storage:{}};function g(){let{data:e,error:g,loading:v,refetch:y}=n(()=>t.overview(),[]);if(v&&!e&&!g)return(0,m.jsx)(s,{label:`Loading usage…`});if(g&&!e)return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(c,{title:`Usage`,description:`Cumulative resource usage is unavailable.`}),(0,m.jsx)(o,{error:g,onRetry:y})]});let{stats:b,memory:x,workers:S,crons:C,storage:w}=e??h,T=typeof w.diskFull==`boolean`;return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(c,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!!e&&!g&&T}),g&&(0,m.jsx)(a,{message:`Usage refresh failed — showing the last successful snapshot.`,onRetry:y}),(0,m.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,m.jsx)(p,{label:`Jobs Pushed`,value:d(b.totalPushed)}),(0,m.jsx)(p,{label:`Jobs Completed`,value:d(b.totalCompleted),tone:`green`}),(0,m.jsx)(p,{label:`Jobs Failed`,value:d(b.totalFailed),tone:b.totalFailed?`red`:`default`}),(0,m.jsx)(p,{label:`Jobs Pulled`,value:d(b.totalPulled),tone:`blue`})]}),(0,m.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,m.jsxs)(i,{children:[(0,m.jsx)(r,{title:`Runtime`}),(0,m.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,m.jsx)(_,{label:`Uptime`,value:f(b.uptime/1e3)}),(0,m.jsx)(_,{label:`Heap used`,value:u(x.heapUsed*1024*1024)}),(0,m.jsx)(_,{label:`RSS`,value:u(x.rss*1024*1024)}),(0,m.jsx)(_,{label:`Workers`,value:`${S.active} active / ${S.total}`}),(0,m.jsx)(_,{label:`Cron jobs`,value:String(C.total)})]})]}),(0,m.jsxs)(i,{children:[(0,m.jsx)(r,{title:`Storage`}),(0,m.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,m.jsx)(_,{label:`Status`,value:T?w.diskFull?`Disk full`:`Healthy`:`Unavailable`}),(0,m.jsx)(_,{label:`Disk full since`,value:w.diskFull?l(w.since):`—`}),w.error?(0,m.jsx)(_,{label:`Error`,value:String(w.error)}):null]})]})]})]})}function _({label:e,value:t,mono:n}){return(0,m.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,m.jsx)(`dt`,{className:`text-muted`,children:e}),(0,m.jsx)(`dd`,{className:n?`font-mono text-xs text-fg`:`font-medium text-fg`,children:t})]})}export{g as Usage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-vendor-CyjgmGTq.js";import{t}from"./bq-BeBxa743.js";import{n}from"./usePolledData-DzlUpBOO.js";import{n as r,t as i}from"./Card-C7NMhqUt.js";import{i as a,n as o,r as s}from"./feedback-BnGE2oW2.js";import{t as c}from"./PageHeader-BXlZSBcc.js";import{c as l,l as u,n as d,s as f,t as p,u as m}from"./format-Cg7VCIZW.js";import{n as h}from"./index-Cui9IwWy.js";var g=e(),_={overview:{stats:{waiting:0,active:0,delayed:0,completed:0,dlq:0,totalPushed:0,totalPulled:0,totalCompleted:0,totalFailed:0,uptime:0},memory:{heapUsed:0,heapTotal:0,rss:0},crons:{total:0}},storage:{},failedTotal:0};function v(){let{data:e,error:v,loading:b,refetch:x}=n(async()=>{let[e,n,r]=await Promise.all([t.overview(),t.storage(),t.queuesSummary()]);if(!n?.data||typeof n.data.diskFull!=`boolean`)throw Error(`Storage status response is missing disk health data`);let i=r.reduce((e,t)=>e+(t.counts?.failed??0),0);return{overview:e,storage:n.data,failedTotal:i}},[]);if(b&&!e&&!v)return(0,g.jsx)(s,{label:`Loading usage…`});if(v&&!e)return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(c,{title:`Usage`,description:`Cumulative resource usage is unavailable.`}),(0,g.jsx)(o,{error:v,onRetry:x})]});let S=e??_,{stats:C,memory:w,crons:T}=S.overview,{storage:E,failedTotal:D}=S,O=p(C.completed,D),k=C.uptime?m(C.uptime/1e3):`—`;return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(c,{title:`Usage`,description:`Cumulative resource usage on the connected server.`,live:!!e&&!v}),v&&(0,g.jsx)(a,{message:`Usage refresh failed — showing the last successful snapshot.`,onRetry:x}),(0,g.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 md:grid-cols-3 xl:grid-cols-6`,children:[(0,g.jsx)(h,{label:`Completed`,value:f(C.completed),tone:`green`}),(0,g.jsx)(h,{label:`Failed`,value:f(D),tone:D?`red`:`default`}),(0,g.jsx)(h,{label:`Waiting`,value:f(C.waiting),tone:`amber`}),(0,g.jsx)(h,{label:`Active`,value:f(C.active),tone:`blue`}),(0,g.jsx)(h,{label:`Error Rate`,value:O==null?`—`:l(O),tone:O==null?`default`:O>.05?`red`:`green`}),(0,g.jsx)(h,{label:`Uptime`,value:k})]}),(0,g.jsxs)(`div`,{className:`mt-6 grid grid-cols-1 gap-6 lg:grid-cols-2`,children:[(0,g.jsxs)(i,{children:[(0,g.jsx)(r,{title:`Runtime`}),(0,g.jsxs)(`dl`,{className:`divide-y divide-line text-sm`,children:[(0,g.jsx)(y,{label:`Jobs pushed (since restart)`,value:f(C.totalPushed)}),(0,g.jsx)(y,{label:`Jobs pulled (since restart)`,value:f(C.totalPulled)}),(0,g.jsx)(y,{label:`Heap used`,value:d(w.heapUsed*1024*1024)}),(0,g.jsx)(y,{label:`RSS`,value:d(w.rss*1024*1024)}),(0,g.jsx)(y,{label:`Cron jobs`,value:String(T.total)})]})]}),(0,g.jsxs)(i,{children:[(0,g.jsx)(r,{title:`Storage`}),E.diskFull?(0,g.jsxs)(`div`,{className:`rounded-lg border border-red-500/25 bg-red-500/[0.06] px-4 py-3`,children:[(0,g.jsx)(`div`,{className:`font-semibold text-danger`,children:`Disk full — writes suspended`}),E.error&&(0,g.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:E.error}),E.since!=null&&(0,g.jsxs)(`div`,{className:`mt-1 text-xs text-faint`,children:[`since `,u(E.since)]})]}):(0,g.jsxs)(`div`,{className:`rounded-lg border border-emerald-500/25 bg-emerald-500/[0.06] px-4 py-3`,children:[(0,g.jsx)(`div`,{className:`font-semibold text-success`,children:`Healthy`}),(0,g.jsx)(`div`,{className:`mt-1 text-xs text-faint`,children:`Disk writes are being accepted.`})]})]})]})]})}function y({label:e,value:t}){return(0,g.jsxs)(`div`,{className:`flex items-center justify-between py-2.5`,children:[(0,g.jsx)(`dt`,{className:`text-muted`,children:e}),(0,g.jsx)(`dd`,{className:`font-medium text-fg`,children:t})]})}export{v as UsagePro};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CyjgmGTq.js";import{t as r}from"./bq-BeBxa743.js";import{t as i}from"./toastStore-CS_9Xndn.js";import{O as a,m as o}from"./icons-CIvFfU2b.js";import{n as s}from"./usePolledData-DzlUpBOO.js";import{n as c,t as l}from"./Button-BPqpRZJD.js";import{n as u,t as d}from"./Card-C7NMhqUt.js";import{i as f,n as p,r as m,t as h}from"./feedback-BnGE2oW2.js";import{t as g}from"./PageHeader-BXlZSBcc.js";import{l as _,s as v}from"./format-Cg7VCIZW.js";import{n as y,o as b,t as x}from"./form-tC20r4Ma.js";import{t as S}from"./Pagination-Q-vf4hsX.js";import{r as C,t as w}from"./useServerActionGuard-BlH-Kso1.js";var T=[`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`],E=e(t(),1);function D(e){try{let t=new URL(e);return e.length<=2048&&/^https?:$/.test(t.protocol)&&t.username===``&&t.password===``}catch{return!1}}function O(e){try{let t=new URL(e);return!t.username&&!t.password?e:(t.username=`redacted`,t.password=`redacted`,t.toString())}catch{return e}}function k(e,t,n,r){let i=e.trim();if(!i||t.length===0)return{ok:!1,msg:`URL and at least one event are required`};if(!D(i))return{ok:!1,msg:`URL must be a valid http:// or https:// address without embedded credentials`};let a=n.trim();return a&&(a.length>256||!/^[a-zA-Z0-9_\-.:]+$/.test(a))?{ok:!1,msg:`Queue must be at most 256 characters using letters, numbers, _, -, . or :`}:{ok:!0,body:{url:i,events:t,queue:a||void 0,secret:r.trim()||void 0}}}var A=n();function j({onAdd:e,onAccepted:t,beginAdd:n,scopeKey:r}){let[i,a]=(0,E.useState)(``),[o,s]=(0,E.useState)(``),[c,u]=(0,E.useState)(``),[d,f]=(0,E.useState)([`job.completed`,`job.failed`]),[p,m]=(0,E.useState)(null),[h,g]=(0,E.useState)(!1);(0,E.useEffect)(()=>{g(!1),m(null)},[r]);let _=e=>f(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),v=async()=>{if(h)return;m(null);let r=k(i,d,o,c);if(!r.ok)return m(r.msg);let s=n();if(s){g(!0);try{if(w(await e(r.body),`Add webhook`),!s.isCurrent())return;a(``),u(``),t()}catch(e){s.isCurrent()&&m(e.message)}finally{s.finish()&&g(!1)}}};return(0,A.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),v()},children:[(0,A.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-3`,children:[(0,A.jsx)(`div`,{className:`md:col-span-1`,children:(0,A.jsx)(x,{label:`URL`,children:(0,A.jsx)(y,{value:i,onInput:e=>a(e.currentTarget.value),name:`webhook-url`,type:`url`,maxLength:2048,autoComplete:`url`,placeholder:`https://example.com/hook`})})}),(0,A.jsx)(x,{label:`Queue (optional)`,children:(0,A.jsx)(y,{value:o,onChange:e=>s(e.target.value),name:`webhook-queue`,maxLength:256,autoComplete:`off`,placeholder:`all queues`})}),(0,A.jsx)(x,{label:`Secret (optional)`,children:(0,A.jsx)(y,{type:`password`,autoComplete:`new-password`,name:`webhook-secret`,maxLength:65536,value:c,onChange:e=>u(e.target.value),placeholder:`HMAC signing secret`})})]}),(0,A.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:T.map(e=>(0,A.jsx)(`button`,{type:`button`,"aria-pressed":d.includes(e),onClick:()=>_(e),className:d.includes(e)?`rounded-full bg-accent/15 px-3 py-1 text-xs font-medium text-accent`:`rounded-full border border-line px-3 py-1 text-xs font-medium text-muted hover:text-fg`,children:e},e))}),(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(l,{type:`submit`,variant:`accent`,size:`sm`,disabled:h,children:h?`Adding…`:`Add webhook`}),p&&(0,A.jsx)(`span`,{className:`text-xs text-danger`,children:p})]})]})}function M(e){let[t,n]=(0,E.useState)(0);return(0,E.useEffect)(()=>{t>e-1&&n(e-1)},[t,e]),[Math.min(t,e-1),n]}function N(){let{data:e,error:t,loading:n,refetch:l}=s(()=>r.webhooks(),[]),y=e?.data?.webhooks??[],[x,T]=M(Math.max(1,Math.ceil(y.length/15))),[D,k]=(0,E.useState)(null),[N,P]=(0,E.useState)(new Set),F=C(`webhooks`),[I,L]=(0,E.useState)({}),R=(0,E.useRef)(new Map);(0,E.useEffect)(()=>{k(null),P(new Set),L({}),R.current.clear()},[F.scopeKey]);let z=async e=>{let t=F.begin([`registry-write`,`webhook:${e}`]);if(t){k(null),P(t=>new Set(t).add(e));try{if(w(await r.removeWebhook(e),`Remove webhook`),!t.isCurrent())return;l()}catch(e){if(!t.isCurrent())return;k(e.message)}finally{t.finish()&&P(t=>{let n=new Set(t);return n.delete(e),n})}}},B=(e,t)=>{let n=Symbol(`webhook-toggle`),a=R.current.get(e);if(a){a.desired=t,a.intent=n,L(r=>({...r,[e]:{value:t,intent:n}}));return}let o=F.begin(`webhook:${e}`);if(!o)return;let s={desired:t,intent:n,lease:o};R.current.set(e,s),L(r=>({...r,[e]:{value:t,intent:n}})),(async()=>{for(;o.isCurrent()&&R.current.get(e)===s;){let t=s.desired,n=null;try{w(await r.setWebhookEnabled(e,t),`Toggle webhook`)}catch(e){n=e instanceof Error?e:Error(String(e))}if(!o.isCurrent()||R.current.get(e)!==s)return;if(s.desired!==t)continue;if(await l(),!o.isCurrent()||R.current.get(e)!==s)return;if(s.desired!==t)continue;R.current.delete(e);let a=s.intent;L(t=>{if(t[e]?.intent!==a)return t;let{[e]:n,...r}=t;return r}),n&&i.error(`Webhook toggle failed`,n.message),o.finish();return}})()};return(0,A.jsxs)(`div`,{children:[(0,A.jsx)(g,{title:`Webhooks`,description:`HTTP callbacks fired on job events.`,live:!!e&&!t}),t&&e&&(0,A.jsx)(f,{message:`Webhook refresh failed — showing the last successful registry.`,onRetry:l}),D&&(0,A.jsx)(`div`,{role:`status`,className:`mb-4 rounded-lg border border-red-500/20 bg-red-500/5 px-4 py-2 text-sm text-danger`,children:D}),(0,A.jsxs)(d,{className:`mb-6`,children:[(0,A.jsx)(u,{title:`Add webhook`}),(0,A.jsx)(j,{onAdd:e=>r.addWebhook(e),onAccepted:()=>void l(),beginAdd:()=>F.begin([`registry-write`,`add`]),scopeKey:F.scopeKey})]}),t&&!e?(0,A.jsx)(p,{error:t,onRetry:l}):n&&!e?(0,A.jsx)(m,{label:`Loading webhooks…`}):y.length===0?(0,A.jsx)(h,{icon:(0,A.jsx)(o,{}),title:`No webhooks`,hint:`Add one above to receive job-event callbacks.`}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,A.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,A.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`URL`}),(0,A.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Events`}),(0,A.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queue`}),(0,A.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Success / Fail`}),(0,A.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last`}),(0,A.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Enabled`}),(0,A.jsx)(`th`,{className:`w-12 px-5 py-3`})]})}),(0,A.jsx)(`tbody`,{children:y.slice(x*15,x*15+15).map(e=>(0,A.jsxs)(`tr`,{className:`border-b border-line last:border-0 align-top hover:bg-surface-2/40`,children:[(0,A.jsx)(`td`,{className:`max-w-xs truncate px-5 py-3 font-mono text-xs text-fg`,children:O(e.url)}),(0,A.jsx)(`td`,{className:`px-5 py-3 text-xs text-muted`,children:e.events.join(`, `)}),(0,A.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queue??`all`}),(0,A.jsxs)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:[(0,A.jsx)(`span`,{className:`text-success`,children:v(e.successCount)}),` / `,(0,A.jsx)(`span`,{className:e.failureCount?`text-danger`:``,children:v(e.failureCount)})]}),(0,A.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:_(e.lastTriggered)}),(0,A.jsx)(`td`,{className:`px-5 py-3`,children:(0,A.jsx)(b,{checked:I[e.id]?.value??e.enabled,label:`${I[e.id]?.value??e.enabled?`Disable`:`Enable`} webhook`,onChange:t=>B(e.id,t)})}),(0,A.jsx)(`td`,{className:`px-5 py-3 text-right`,children:(0,A.jsx)(c,{"aria-label":`Remove webhook`,disabled:N.has(e.id),onClick:()=>window.confirm(`Remove webhook for ${O(e.url)}?`)&&z(e.id),children:(0,A.jsx)(a,{className:`size-3.5`})})})]},e.id))})]})}),(0,A.jsx)(S,{page:x,pageSize:15,total:y.length,onPageChange:T,label:`webhooks`})]})]})}export{N as Webhooks};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t,t as n}from"./react-vendor-CyjgmGTq.js";import{A as r}from"./icons-CIvFfU2b.js";import{t as i}from"./api-CQ5Z7xR7.js";import{n as a}from"./usePolledData-DzlUpBOO.js";import{i as o,n as s,r as c,t as l}from"./feedback-BnGE2oW2.js";import{t as u}from"./PageHeader-BXlZSBcc.js";import{l as d,s as f}from"./format-Cg7VCIZW.js";import{n as p}from"./index-Cui9IwWy.js";import{t as m}from"./Pagination-Q-vf4hsX.js";var h=e(t(),1),g=n(),_=20,v={workers:{total:0,active:0,list:[],truncated:!1}};function y(){let{data:e,error:t,loading:n,refetch:y}=a(()=>i.overview(),[]),[b,x]=(0,h.useState)(0);if(n&&!e&&!t)return(0,g.jsx)(c,{label:`Loading workers…`});if(t&&!e)return(0,g.jsxs)(`div`,{children:[(0,g.jsx)(u,{title:`Workers`,description:`Worker inventory is unavailable.`}),(0,g.jsx)(s,{error:t,onRetry:y})]});let{workers:S}=e??v,C=Math.max(1,Math.ceil(S.list.length/_)),w=Math.min(b,C-1),T=S.list.slice(w*_,w*_+_);return(0,g.jsxs)(`div`,{children:[t&&(0,g.jsx)(o,{message:`Worker refresh failed — showing the last successful inventory.`,onRetry:y}),(0,g.jsx)(u,{title:`Workers`,description:`Registered workers and their throughput.`,live:!!e&&!t}),(0,g.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-4`,children:[(0,g.jsx)(p,{label:`Total`,value:f(S.total),compact:!0}),(0,g.jsx)(p,{label:`Active`,value:f(S.active),tone:`green`,compact:!0})]}),S.list.length===0?(0,g.jsx)(l,{icon:(0,g.jsx)(r,{}),title:`No workers registered`,hint:`Workers appear here once they connect and register with the server.`}):(0,g.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,g.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,g.jsx)(`thead`,{children:(0,g.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,g.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Failed`}),(0,g.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Last Seen`})]})}),(0,g.jsx)(`tbody`,{children:T.map(e=>(0,g.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,g.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,g.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,g.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,g.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:f(e.activeJobs)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:f(e.processedJobs)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:f(e.failedJobs)}),(0,g.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:d(e.lastSeen)})]},e.id))})]})}),S.truncated&&(0,g.jsxs)(`p`,{className:`mt-3 text-xs text-amber-400`,children:[`Showing first `,f(S.list.length),` of `,f(S.total),` `,`workers.`]}),(0,g.jsx)(m,{page:w,pageSize:_,total:S.list.length,onPageChange:x,label:`workers`})]})}export{y as Workers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CyjgmGTq.js";import{t as i}from"./bq-BeBxa743.js";import{A as a,O as o}from"./icons-CIvFfU2b.js";import{n as s}from"./usePolledData-DzlUpBOO.js";import{n as c}from"./Button-BPqpRZJD.js";import{i as l,n as u,r as d,t as f}from"./feedback-BnGE2oW2.js";import{t as p}from"./PageHeader-BXlZSBcc.js";import{l as m,s as h}from"./format-Cg7VCIZW.js";import{n as g}from"./index-Cui9IwWy.js";import{r as _,t as v}from"./useServerActionGuard-BlH-Kso1.js";var y=e(n(),1),b=r(),x=100,S=`No heartbeat recently — derived from lastSeen`;function C(){let{data:e,error:n,loading:r,refetch:C}=s(async()=>(await i.workers()).data,[]),[T,E]=(0,y.useState)(new Set),[D,O]=(0,y.useState)(null),[k,A]=(0,y.useState)(null),j=_(`workers-pro`);if((0,y.useEffect)(()=>{E(new Set),O(null)},[j.scopeKey]),r&&!e&&!n)return(0,b.jsx)(d,{label:`Loading workers…`});if(n&&!e)return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(p,{title:`Workers`,description:`Worker inventory is unavailable.`}),(0,b.jsx)(u,{error:n,onRetry:C})]});let M=e?.workers??[],N=e?.quarantinedWorkers??[],P=(k?[...M].sort((e,t)=>{let n=k.key===`failed`?e.failedJobs??0:e.lastSeen??0,r=k.key===`failed`?t.failedJobs??0:t.lastSeen??0;return k.dir===`asc`?n-r:r-n}):M).slice(0,x),F=e=>A(t=>t?.key===e?{key:e,dir:t.dir===`desc`?`asc`:`desc`}:{key:e,dir:`desc`}),I=M.filter(e=>e.status===`active`).length,L=M.length-I,R=M.reduce((e,t)=>e+(t.activeJobs??0),0),z=async e=>{if(!window.confirm(`Remove the stale registry record for worker "${e}"? This does not stop the worker process. Continue only after confirming that process is stopped; Bunqueue v2.8.57 workers do not automatically re-register after their heartbeat record is removed.`))return;let t=j.begin(`worker:${e}`);if(t){E(t=>new Set(t).add(e)),O(null);try{if(v(await i.unregisterWorker(e),`Remove stale worker registry record`),!t.isCurrent())return;O({ok:!0,text:`Removed stale registry record for ${e} ✓`}),C()}catch(e){if(!t.isCurrent())return;O({ok:!1,text:`Removal failed: ${e.message}`})}finally{t.finish()&&E(t=>{let n=new Set(t);return n.delete(e),n})}}};return(0,b.jsxs)(`div`,{children:[(0,b.jsx)(p,{title:`Workers`,description:`Registered workers and their throughput.`,live:!!e&&!n}),n&&(0,b.jsx)(l,{message:`Worker refresh failed — showing the last successful inventory.`,onRetry:C}),(0,b.jsxs)(`div`,{className:`mb-6 grid grid-cols-2 gap-4 md:grid-cols-5`,children:[(0,b.jsx)(g,{label:`Total`,value:h(M.length+N.length),compact:!0}),(0,b.jsx)(g,{label:`Active`,value:h(I),tone:`green`,compact:!0}),(0,b.jsx)(`div`,{title:S,children:(0,b.jsx)(g,{label:`Stale`,value:h(L),tone:L?`amber`:`default`,compact:!0})}),(0,b.jsx)(g,{label:`Active Jobs`,value:h(R),tone:`blue`,compact:!0}),(0,b.jsx)(g,{label:`Quarantined`,value:h(N.length),tone:N.length?`red`:`default`,compact:!0})]}),N.length>0&&(0,b.jsxs)(`div`,{role:`alert`,className:`mb-4 rounded-lg border border-danger/30 bg-danger/5 p-4`,children:[(0,b.jsxs)(`p`,{className:`text-sm font-medium text-danger`,children:[N.length,` worker registration(s) contain values accepted by Bunqueue 2.8.57 but unsafe to render. Healthy workers remain available below.`]}),(0,b.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Their status and active-job count are unknown, so this dashboard will not offer the registry-only removal action for them.`}),(0,b.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-muted`,children:N.slice(0,20).map(e=>(0,b.jsxs)(`li`,{className:`truncate font-mono`,children:[`#`,e.index+1,` `,e.id??`(unaddressable id)`,` — `,e.reason]},`${e.index}:${e.id??`unknown`}`))})]}),D&&(0,b.jsx)(`div`,{className:t(`mb-3 text-sm`,D.ok?`text-success`:`text-danger`),children:D.text}),M.length===0?(0,b.jsx)(f,{icon:(0,b.jsx)(a,{}),title:N.length?`No renderable workers`:`No workers registered`,hint:N.length?`Malformed registrations are isolated above instead of taking down the inventory.`:`Workers appear here once they connect and register with the server.`}):(0,b.jsx)(`div`,{className:`overflow-x-auto rounded-xl border border-line bg-surface`,children:(0,b.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,b.jsx)(`thead`,{children:(0,b.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Worker`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Queues`}),(0,b.jsx)(`th`,{className:`px-5 py-3 font-medium`,children:`Status`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Active`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:`Processed`}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:(0,b.jsx)(w,{label:`Failed`,active:k?.key===`failed`?k.dir:null,onClick:()=>F(`failed`)})}),(0,b.jsx)(`th`,{className:`px-5 py-3 text-right font-medium`,children:(0,b.jsx)(w,{label:`Last Seen`,active:k?.key===`lastSeen`?k.dir:null,onClick:()=>F(`lastSeen`)})}),(0,b.jsx)(`th`,{className:`w-16 px-5 py-3 text-right font-medium`,children:`Actions`})]})}),(0,b.jsx)(`tbody`,{children:P.map(e=>(0,b.jsxs)(`tr`,{className:`border-b border-line last:border-0 hover:bg-surface-2/40`,children:[(0,b.jsxs)(`td`,{className:`px-5 py-3`,children:[(0,b.jsx)(`div`,{className:`font-medium text-fg`,children:e.name||`worker`}),(0,b.jsx)(`div`,{className:`font-mono text-[11px] text-faint`,children:e.id})]}),(0,b.jsx)(`td`,{className:`px-5 py-3 font-mono text-xs text-muted`,children:e.queues.join(`, `)||`—`}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`span`,{title:e.status===`active`?void 0:S,className:t(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.status===`active`?`bg-emerald-500/10 text-success`:`bg-amber-500/10 text-warning`),children:e.status})}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-blue-400`,children:h(e.activeJobs)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:h(e.processedJobs)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right tnum text-muted`,children:h(e.failedJobs)}),(0,b.jsx)(`td`,{className:`px-5 py-3 text-right text-faint`,children:m(e.lastSeen)}),(0,b.jsx)(`td`,{className:`px-5 py-3`,children:(0,b.jsx)(`div`,{className:`flex justify-end`,children:e.status===`stale`&&e.activeJobs===0?(0,b.jsx)(c,{"aria-label":`Remove stale registry record for worker ${e.id}`,title:`Registry cleanup only — does not stop the worker process`,disabled:T.has(e.id),onClick:()=>z(e.id),children:(0,b.jsx)(o,{className:`size-3.5`})}):(0,b.jsx)(`span`,{className:`text-xs text-faint`,title:e.status===`stale`?`Registry cleanup is blocked while active jobs are reported`:`Only stale, idle registry records can be removed`,children:`—`})})})]},e.id))})]})}),M.length>x&&(0,b.jsxs)(`p`,{className:`mt-3 text-xs text-warning`,children:[`Showing first `,h(x),` of `,h(M.length),` workers.`]})]})}function w({label:e,active:n,onClick:r}){return(0,b.jsxs)(`button`,{type:`button`,onClick:r,title:`Sort by ${e}`,className:t(`inline-flex items-center gap-1 uppercase tracking-wider transition-colors hover:text-fg`,n?`text-fg`:`text-faint`),children:[e,(0,b.jsx)(`span`,{"aria-hidden":`true`,children:n===`desc`?`↓`:n===`asc`?`↑`:``})]})}export{C as WorkersPro};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{f as n,g as r,l as i,t as a}from"./react-vendor-CyjgmGTq.js";import{i as o}from"./connectionStore-DbBYqHEY.js";import{t as s}from"./upstreamPaths-D_LPsv7b.js";import{o as c,t as l}from"./bq-BeBxa743.js";import{t as u}from"./toastStore-CS_9Xndn.js";import{n as d}from"./usePolledData-DzlUpBOO.js";import{t as f}from"./Card-C7NMhqUt.js";import{i as p,n as m,r as h,t as g}from"./feedback-BnGE2oW2.js";import{t as _}from"./StatusBadge-B0I7hNBX.js";import{t as v}from"./PageHeader-BXlZSBcc.js";import{a as y,i as b,l as x}from"./format-Cg7VCIZW.js";import{n as S,t as C}from"./controlConnectionEpoch-CFSO6237.js";var w={"/workflows":{id:`overview`,label:`Overview`,description:`The complete durable command center for Bunqueue Workflow Engine.`,kind:`active`,state:``},"/workflows/executions":{id:`executions`,label:`Executions`,description:`Inspect every active execution, step record, decision, and nested run.`,kind:`active`,state:``},"/workflows/waiting":{id:`waiting`,label:`Waiting & Signals`,description:`Focus on parked executions and their durable signal payloads.`,kind:`active`,state:`waiting`,lockKind:!0,lockState:!0},"/workflows/compensation":{id:`compensation`,label:`Compensation`,description:`See running, completed, skipped, failed, and parked saga compensation outcomes.`,kind:`active`,state:`compensation`,lockKind:!0,lockState:!0},"/workflows/archive":{id:`archive`,label:`Archive`,description:`Audit terminal executions retained by Workflow Engine archival.`,kind:`archive`,state:``,lockKind:!0}};function ee(e){return w[e]??w[`/workflows`]}function te(e,t){return e?.source===`link`||e&&t.some(t=>t.id===e.id)?e:t[0]?{id:t[0].id,source:`page`}:null}var T=e(r(),1),ne=[`waiting`,`failed`,`compensation-stuck`];async function re(e,t){let[n,r]=await Promise.all([e.stats(),e.list(t)]);return{stats:n,page:r}}async function ie(e,t){let[n,...r]=await Promise.all([e.stats(),...ne.map(n=>e.list({kind:`active`,state:n,limit:t,offset:0}))]),i=r.flatMap(e=>e.executions).sort(ae).slice(0,t);return{stats:n,page:{ok:r.every(e=>e.ok),available:r.every(e=>e.available),executions:i,total:r.reduce((e,t)=>e+t.total,0),limit:t,offset:0}}}function ae(e,t){return t.createdAt-e.createdAt||t.id.localeCompare(e.id)}var E=new Set([`summary`,`history`,`payloads`]),oe=new Set([`running`,`waiting`,`completed`,`failed`,`compensating`,`compensation-stuck`,`compensation`]);function D(e,t){let n=e.get(`kind`),r=t.id===`executions`&&(n===`active`||n===`archive`)?n:t.kind,i=t.id===`overview`?``:se(e.get(`workflow`)),a=le(e.get(`state`),t),o=t.id===`overview`?0:ce(e.get(`offset`)),c=e.get(`execution`),l=c&&s(c,`Workflow execution id`)===null?c:null,u=e.get(`tab`),d=t.id===`overview`||t.id===`executions`;return{kind:r,workflowName:i,state:a,offset:o,executionId:l,tab:l&&d&&E.has(u)?u:`summary`}}function O(e,t){let n=new URLSearchParams;return e.id===`executions`&&t.kind===`archive`&&n.set(`kind`,`archive`),e.id!==`overview`&&t.workflowName&&n.set(`workflow`,t.workflowName),j(e)&&t.state&&n.set(`state`,t.state),e.id!==`overview`&&t.offset>0&&n.set(`offset`,String(t.offset)),t.executionId&&n.set(`execution`,t.executionId),t.executionId&&t.tab!==`summary`&&(e.id===`overview`||e.id===`executions`)&&n.set(`tab`,t.tab),n}function k(e,t,n){return O(t,{...D(e,t),...n})}function A(e){return E.has(e)}function se(e){return e&&e.length<=256?e:``}function ce(e){if(!e||!/^(0|[1-9]\d*)$/.test(e))return 0;let t=Number(e);return Number.isSafeInteger(t)&&t<=1e6?Math.floor(t/25)*25:0}function le(e,t){return j(t)?e?t.id===`archive`?e===`completed`||e===`failed`?e:``:oe.has(e)?e:``:``:t.state}function j(e){return e.id===`executions`||e.id===`archive`}var ue=e=>`${e}?target=${encodeURIComponent(o())}`,M=e=>({method:`POST`,headers:e===void 0?void 0:{"Content-Type":`application/json`},body:e===void 0?void 0:JSON.stringify(e)});async function N(e,t){return(await c(ue(e),t)).result}var P={status:()=>N(`/workflows/runtime`),reload:()=>N(`/workflows/runtime/reload`,M()),start:async(e,t)=>(await N(`/workflows/start`,M({workflowName:e,input:t}))).run,signal:async(e,t,n)=>{await N(`/workflows/${encodeURIComponent(e)}/signal`,M({event:t,payload:n}))},recover:async()=>(await N(`/workflows/recover`,M())).recovered,resumeCompensation:async e=>{await N(`/workflows/${encodeURIComponent(e)}/resume-compensation`,M())},abandonCompensation:async e=>{await N(`/workflows/${encodeURIComponent(e)}/abandon-compensation`,M())},archive:async(e,t)=>(await N(`/workflows/archive`,M({maxAgeMs:e,states:t}))).affected,cleanup:async(e,t)=>(await N(`/workflows/cleanup`,M({maxAgeMs:e,states:t}))).affected},de={stats:()=>l.workflows.stats(),list:e=>l.workflows.list(e),get:(e,t)=>l.workflows.get(e,t)};function fe(e){let[t,r]=n(),i=t.toString(),a=(0,T.useMemo)(()=>D(new URLSearchParams(i),e),[i,e]),o=(0,T.useMemo)(()=>O(e,a).toString(),[e,a]),s=(0,T.useRef)(null);(0,T.useEffect)(()=>{o!==i&&r(o,{replace:!0})},[o,i,r]);let c=(0,T.useCallback)((t,n=!1)=>{r(n=>k(n,e,t),{replace:n})},[e,r]),l=(0,T.useCallback)((e,t=!1)=>{s.current=e,c({executionId:e?.id??null,tab:`summary`},t)},[c]),u=a.executionId?{id:a.executionId,source:s.current?.id===a.executionId?s.current.source:`link`}:null;return{...a,selected:u,update:c,select:l}}function F(e){let t=S(),n=(0,T.useMemo)(()=>({local:e.scopeKey,connectionEpoch:t}),[t,e.scopeKey]),r=(0,T.useRef)(e);r.current=e;let i=(0,T.useRef)(!1),a=(0,T.useRef)(!0),o=(0,T.useRef)(n),s=(0,T.useRef)(0);Object.is(o.current,n)||(o.current=n,s.current+=1,i.current=!1);let[c,l]=(0,T.useState)(()=>I(n));(0,T.useEffect)(()=>(a.current=!0,()=>{a.current=!1,s.current+=1,i.current=!1}),[]);let u=(e,t)=>a.current&&e===s.current&&t===C(),d=async(e,a)=>{if(i.current||t!==C())return;i.current=!0;let o=s.current,c=t,{onApplied:d,onSucceeded:f}=r.current;l({scope:n,busy:e,error:``,receipt:null});try{let t=await a();if(!u(o,c))return;l({scope:n,busy:e,error:``,receipt:{label:e,value:t}});try{f?.(e,t)}catch{}try{await d?.()}catch(e){u(o,c)&&l(t=>({...t,error:`Command succeeded; refresh failed: ${L(e)}`}))}}catch(t){u(o,c)&&l({scope:n,busy:e,error:L(t),receipt:null})}finally{u(o,c)&&(i.current=!1,l(e=>({...e,busy:``})))}},f=Object.is(c.scope,n)?c:I(n);return{busy:f.busy,error:f.error,result:f.receipt?.value,succeeded:f.receipt?.label??``,run:d,clearResult:()=>l(e=>({...e,receipt:null}))}}function I(e){return{scope:e,busy:``,error:``,receipt:null}}function L(e){return e instanceof Error?e.message:String(e)}var R=a(),z=e=>JSON.stringify(e,null,2)??`null`;function B({value:e,empty:t=`None`}){return e==null||typeof e==`object`&&Object.keys(e).length===0?(0,R.jsx)(`p`,{className:`text-xs text-faint`,children:t}):(0,R.jsx)(`pre`,{className:`max-h-80 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs leading-5 text-muted`,children:z(e)})}function V({label:e,value:t}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`dt`,{className:`text-faint`,children:e}),(0,R.jsx)(`dd`,{className:`mt-0.5 break-words text-muted`,children:t})]})}var pe=3600*1e3;function me({repository:e=P,onApplied:t}){let[n,r]=(0,T.useState)(`720`),[i,a]=(0,T.useState)(!0),[o,s]=(0,T.useState)(!0),c=F({scopeKey:(0,T.useMemo)(()=>Symbol(`workflow-maintenance:${n.length}:${i}:${o}`),[i,o,n]),onApplied:t}),l=[...i?[`completed`]:[],...o?[`failed`]:[]],u=Number(n),d=Number.isFinite(u)&&u>=0&&l.length>0,f=t=>{if(!d)return;let n=t===`archive`?`Archive ${l.join(` and `)} workflows at least ${u} hours old?`:`Permanently delete ${l.join(` and `)} workflows at least ${u} hours old from the active execution store? Archive records are not deleted.`;if(!window.confirm(n))return;let r=Math.round(u*pe);c.run(t,async()=>({operation:t,affected:t===`archive`?await e.archive(r,l):await e.cleanup(r,l)}))};return(0,R.jsxs)(`section`,{className:`mb-5 rounded-lg border border-line bg-surface p-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Retention operations`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-faint`,children:`Archive moves terminal runs into retention. Cleanup permanently deletes eligible terminal runs from the active store only; archive records remain intact.`})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Minimum age (hours)`,(0,R.jsx)(`input`,{"aria-label":`Workflow retention age hours`,type:`number`,min:`0`,step:`1`,value:n,onChange:e=>r(e.target.value),className:`mt-1 block h-9 w-32 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`})]}),(0,R.jsxs)(`label`,{className:`flex h-9 items-center gap-2 text-xs text-muted`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:i,onChange:e=>a(e.target.checked)}),`Completed`]}),(0,R.jsxs)(`label`,{className:`flex h-9 items-center gap-2 text-xs text-muted`,children:[(0,R.jsx)(`input`,{type:`checkbox`,checked:o,onChange:e=>s(e.target.checked)}),`Failed`]})]})]}),(0,R.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!d||!!c.busy,onClick:()=>f(`archive`),className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:`Archive eligible`}),(0,R.jsx)(`button`,{type:`button`,disabled:!d||!!c.busy,onClick:()=>f(`cleanup`),className:`rounded-md border border-danger/40 px-3 py-2 text-xs text-danger disabled:opacity-40`,children:`Delete eligible`})]}),c.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:c.error}),c.result!==void 0&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{value:c.result})})]})}var he=[[`Active`,`activeTotal`,`text-fg`],[`Running`,`running`,`text-blue-400`],[`Waiting`,`waiting`,`text-warning`],[`Completed`,`completed`,`text-success`],[`Failed`,`failed`,`text-danger`],[`Compensating`,`compensating`,`text-violet-400`],[`Stuck`,`compensation-stuck`,`text-danger`]];function ge({stats:e}){return(0,R.jsx)(`dl`,{className:`mb-4 grid grid-cols-2 divide-x divide-y divide-line overflow-hidden rounded-lg border border-line bg-surface sm:grid-cols-4 xl:grid-cols-7 xl:divide-y-0`,children:he.map(([n,r,i])=>(0,R.jsxs)(`div`,{className:`px-3 py-2.5 first:border-0`,children:[(0,R.jsx)(`dt`,{className:`text-[10px] font-medium uppercase tracking-wider text-faint`,children:n}),(0,R.jsx)(`dd`,{className:t(`mt-1 tnum font-mono text-lg font-semibold`,i),children:r===`activeTotal`?e.activeTotal:e.states[r]})]},r))})}function _e({repository:e=P,onApplied:t}){let[n,r]=(0,T.useState)(``),[i,a]=(0,T.useState)(`{}`),o=(0,T.useMemo)(()=>Symbol(`workflow-runtime:${n.length}:${i.length}`),[i,n]),s=d(()=>e.status(),[e],{intervalMs:5e3}),c=F({scopeKey:o,onApplied:async()=>{await s.refetch(),await t?.()}}),l=s.data?.ready===!0;return(0,R.jsxs)(`section`,{className:`mb-5 overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Workflow runtime`}),(0,R.jsx)(`p`,{className:`mt-0.5 text-xs text-faint`,children:`Registered application handlers stay in the agent-side runtime; commands never edit SQLite directly.`})]}),(0,R.jsx)(ve,{ready:l,configured:s.data?.configured===!0,unavailable:!!(s.error&&!s.data)})]}),s.data?.configured&&(0,R.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 border-b border-line px-4 py-2 text-[11px] text-faint`,children:[(0,R.jsxs)(`span`,{children:[`Module`,` `,(0,R.jsx)(`strong`,{className:`font-mono font-medium text-muted`,children:s.data.moduleName??`—`})]}),(0,R.jsxs)(`span`,{children:[`Queue`,` `,(0,R.jsx)(`strong`,{className:`font-mono font-medium text-muted`,children:s.data.queueName??`—`})]}),(0,R.jsxs)(`span`,{children:[`Concurrency`,` `,(0,R.jsx)(`strong`,{className:`font-mono font-medium text-muted`,children:s.data.concurrency??`—`})]})]}),s.error&&s.data&&(0,R.jsx)(p,{message:`Runtime status refresh failed; showing the last snapshot.`,onRetry:s.refetch}),s.error&&!s.data&&(0,R.jsx)(`div`,{className:`p-4`,children:(0,R.jsx)(m,{error:s.error,onRetry:s.refetch})}),(0,R.jsxs)(`div`,{className:`grid gap-5 p-4 lg:grid-cols-[minmax(0,1fr)_auto]`,children:[(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Registered workflow`,(0,R.jsx)(`input`,{"aria-label":`Registered workflow`,list:`workflow-runtime-names`,value:n,onChange:e=>r(e.target.value),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`}),(0,R.jsx)(`datalist`,{id:`workflow-runtime-names`,children:s.data?.workflowNames.map(e=>(0,R.jsx)(`option`,{value:e},e))})]}),(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Input JSON`,(0,R.jsx)(`textarea`,{"aria-label":`Workflow input JSON`,value:i,onChange:e=>a(e.target.value),className:`mt-1 min-h-20 w-full resize-y rounded-lg border border-line bg-surface-2 p-2 font-mono text-xs text-fg`})]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap content-start gap-2 lg:w-48 lg:flex-col`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!l||!n.trim()||!!c.busy,onClick:()=>{let t;try{t=JSON.parse(i)}catch{c.run(`start`,async()=>{throw Error(`Workflow input must be valid JSON.`)});return}c.run(`start`,()=>e.start(n.trim(),t))},className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:c.busy===`start`?`Starting…`:`Start execution`}),(0,R.jsx)(`button`,{type:`button`,disabled:!l||!!c.busy,onClick:()=>{window.confirm(`Recover every orphaned workflow using the registered idempotent handlers?`)&&c.run(`recover`,()=>e.recover())},className:`rounded-md border border-line px-3 py-2 text-xs text-muted disabled:opacity-40`,children:`Recover orphaned`}),(0,R.jsx)(`button`,{type:`button`,disabled:!s.data?.configured||!!c.busy,onClick:()=>void c.run(`reload`,()=>e.reload()),className:`rounded-md border border-line px-3 py-2 text-xs text-muted disabled:opacity-40`,children:`Reload definitions`})]})]}),!s.loading&&!s.error&&!s.data?.configured&&(0,R.jsxs)(`p`,{className:`border-t border-line px-4 py-3 text-xs text-warning`,children:[`Set `,(0,R.jsx)(`code`,{children:`BUNQUEUE_WORKFLOW_MODULE`}),` to an absolute module path in Server → Extra environment, then start the managed server.`]}),s.data?.error&&(0,R.jsx)(`p`,{role:`alert`,className:`border-t border-line px-4 py-3 text-xs text-danger`,children:s.data.error}),c.error&&(0,R.jsx)(`p`,{role:`alert`,className:`border-t border-line px-4 py-3 text-xs text-danger`,children:c.error}),c.result!==void 0&&(0,R.jsx)(`div`,{className:`border-t border-line p-4`,children:(0,R.jsx)(B,{value:c.result})})]})}function ve({ready:e,configured:t,unavailable:n}){return(0,R.jsx)(`span`,{className:e?`rounded-full bg-success/10 px-2 py-1 text-[11px] text-success`:`rounded-full bg-warning/10 px-2 py-1 text-[11px] text-warning`,children:e?`Handlers loaded`:n?`Status unavailable`:t?`Unavailable`:`Not configured`})}var ye=[``,`running`,`waiting`,`completed`,`failed`,`compensating`,`compensation-stuck`,`compensation`];function be({section:e,kind:t,workflowName:n,state:r,stats:i,total:a,onKind:o,onWorkflowName:s,onState:c}){return(0,R.jsx)(f,{className:`mb-5`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-end gap-3`,children:[e.lockKind?(0,R.jsx)(H,{label:`Store`,value:`${e.kind}${e.kind===`archive`&&i?` · ${i.archiveTotal}`:``}`,capitalize:!0}):(0,R.jsx)(xe,{kind:t,archiveTotal:i?.archiveTotal,onChange:o}),(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Workflow`,(0,R.jsxs)(`select`,{value:n,onChange:e=>s(e.target.value),className:`mt-1 block h-9 min-w-48 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:[(0,R.jsx)(`option`,{value:``,children:`All workflows`}),i?.workflowNames.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]}),e.lockState?(0,R.jsx)(H,{label:`State scope`,value:e.state===`compensation`?`Compensating + stuck`:e.state}):(0,R.jsx)(Se,{state:r,onChange:c}),a!==void 0&&(0,R.jsxs)(`span`,{className:`ml-auto text-xs text-faint`,children:[a,` execution`,a===1?``:`s`]})]})})}function xe({kind:e,archiveTotal:n,onChange:r}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mb-1 block text-xs text-faint`,children:`Store`}),(0,R.jsx)(`div`,{className:`flex rounded-lg border border-line p-0.5`,children:[`active`,`archive`].map(i=>(0,R.jsxs)(`button`,{type:`button`,"aria-pressed":e===i,onClick:()=>r(i),className:t(`rounded-md px-3 py-1.5 text-xs capitalize`,e===i?`bg-surface-2 text-fg`:`text-muted hover:text-fg`),children:[i,i===`archive`&&n!==void 0?` (${n})`:``]},i))})]})}function Se({state:e,onChange:t}){return(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`State`,(0,R.jsx)(`select`,{value:e,onChange:e=>t(e.target.value),className:`mt-1 block h-9 min-w-44 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:ye.map(e=>(0,R.jsx)(`option`,{value:e,children:e===`compensation`?`All compensation`:e||`All states`},e||`all`))})]})}function H({label:e,value:n,capitalize:r=!1}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`span`,{className:`mb-1 block text-xs text-faint`,children:e}),(0,R.jsx)(`span`,{className:t(`inline-flex h-9 items-center rounded-lg border border-line bg-surface-2 px-3 text-xs text-fg`,r&&`capitalize`),children:n})]})}function Ce({label:e=`Workflow`,value:t,stats:n,onChange:r}){return(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[e,(0,R.jsxs)(`select`,{value:t,onChange:e=>r(e.target.value),className:`mt-1 block h-9 min-w-52 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:[(0,R.jsx)(`option`,{value:``,children:`All workflows`}),n?.workflowNames.map(e=>(0,R.jsx)(`option`,{value:e,children:e},e))]})]})}function we(e){return e.section.id===`overview`?null:e.section.id===`executions`?(0,R.jsx)(be,{...e}):(0,R.jsxs)(`div`,{className:`mb-5 flex items-end gap-4 rounded-lg border border-line bg-surface px-4 py-3`,children:[(0,R.jsx)(Ce,{value:e.workflowName,stats:e.stats,onChange:e.onWorkflowName}),e.section.id===`archive`&&(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Outcome`,(0,R.jsxs)(`select`,{value:e.state,onChange:t=>e.onState(t.target.value),className:`mt-1 block h-9 min-w-36 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg`,children:[(0,R.jsx)(`option`,{value:``,children:`All outcomes`}),(0,R.jsx)(`option`,{value:`completed`,children:`Completed`}),(0,R.jsx)(`option`,{value:`failed`,children:`Failed`})]})]}),(0,R.jsxs)(`span`,{className:`ml-auto pb-2 text-xs text-faint`,children:[e.total??0,` `,e.section.id===`archive`?`records`:`executions`]})]})}function Te(e){let t=[{id:`execution-started`,at:e.createdAt,title:`Execution started`,detail:e.workflowName,status:`running`,category:`execution`}];for(let[n,r]of Object.entries(e.steps))t.push(...Ee(n,r));for(let n of Object.keys(e.signals))t.push({id:`signal:${n}`,title:`Signal persisted: ${n}`,detail:`The store does not expose an exact signal timestamp.`,category:`signal`});return e.state!==`running`&&e.state!==`waiting`&&t.push({id:`execution-settled`,at:e.updatedAt,title:`Execution ${e.state}`,detail:e.failureReason,status:e.state,category:`execution`}),t.sort(De)}function Ee(e,t){let n=[];return t.startedAt!==void 0&&n.push({id:`step:${e}:started`,at:t.startedAt,title:`Step started: ${e}`,detail:t.attempts?`Attempt ${t.attempts}`:void 0,status:`running`,category:`step`}),(t.completedAt!==void 0||t.status===`failed`)&&n.push({id:`step:${e}:settled`,at:t.completedAt,title:`Step ${t.status}: ${e}`,detail:t.error,status:t.status,category:`step`}),t.compensation&&n.push({id:`step:${e}:compensation`,at:t.compensation.at,title:`Compensation ${t.compensation.status}: ${e}`,detail:t.compensation.error,status:t.compensation.status,category:`compensation`}),n}function De(e,t){return e.at===void 0&&t.at===void 0?e.id.localeCompare(t.id):e.at===void 0?1:t.at===void 0?-1:e.at-t.at||e.id.localeCompare(t.id)}function U({execution:e}){let t=Te(e);return(0,R.jsx)(`ol`,{className:`divide-y divide-line/70 border-y border-line/70`,children:t.map((e,n)=>(0,R.jsxs)(`li`,{className:`grid grid-cols-[28px_minmax(0,1fr)] gap-3 py-3`,children:[(0,R.jsxs)(`div`,{className:`relative flex justify-center`,"aria-hidden":`true`,children:[(0,R.jsx)(`span`,{className:`mt-1.5 size-2 rounded-full border-2 border-surface bg-accent ring-1 ring-line`}),n<t.length-1&&(0,R.jsx)(`span`,{className:`absolute top-5 bottom-[-13px] w-px bg-line`})]}),(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,R.jsx)(`span`,{className:`break-words text-sm font-medium text-fg`,children:e.title}),e.status&&(0,R.jsx)(_,{status:e.status})]}),(0,R.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 text-xs text-faint`,children:[(0,R.jsx)(`span`,{className:`capitalize`,children:e.category}),(0,R.jsx)(`span`,{children:e.at===void 0?`Timestamp unavailable`:b(e.at)})]}),e.detail&&(0,R.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap text-xs text-muted`,children:e.detail})]})]},e.id))})}var W={now:Date.now,subscribe:e=>{let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)}};function Oe({since:e,clock:t=W}){let n=G(t);return(0,R.jsx)(R.Fragment,{children:y(Math.max(0,n-e))})}function G(e=W,t=!0){let[n,r]=(0,T.useState)(()=>e.now());return(0,T.useEffect)(()=>{if(r(e.now()),t)return e.subscribe(()=>r(e.now()))},[e,t]),n}function K({error:e,onRetry:t}){return e?(0,R.jsx)(p,{message:`Execution refresh failed; showing the last persisted snapshot.`,onRetry:t}):null}async function q(e,t){await Promise.all([e(),t?.()])}function ke({repository:e,id:t,pollIntervalMs:n=1e4}){let{data:r,error:i,loading:a,refetch:o}=d(()=>e.get(t,`archive`),[e,t],{intervalMs:n});if(a&&!r)return(0,R.jsx)(h,{label:`Loading audit record…`});if(i&&!r)return(0,R.jsx)(m,{error:i,onRetry:o});let s=r?.execution;return s?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{error:i,onRetry:o}),(0,R.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Immutable audit record`}),(0,R.jsx)(`h2`,{className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:s.id})]}),(0,R.jsx)(_,{status:s.state})]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 border-b border-line p-4 text-xs sm:grid-cols-3`,children:[(0,R.jsx)(V,{label:`Workflow`,value:s.workflowName}),(0,R.jsx)(V,{label:`Runtime`,value:y(s.updatedAt-s.createdAt)}),(0,R.jsx)(V,{label:`Archived`,value:s.archivedAt?b(s.archivedAt):`Unavailable`}),(0,R.jsx)(V,{label:`Definition hash`,value:s.definitionHash??`Unavailable`}),(0,R.jsx)(V,{label:`Final node`,value:String(s.currentNodeIndex)}),(0,R.jsx)(V,{label:`Final transition`,value:b(s.updatedAt)})]}),(0,R.jsx)(`div`,{className:`p-4`,children:(0,R.jsx)(U,{execution:s})})]})]}):null}function Ae({repository:e,executionId:t,stuck:n,onApplied:r}){let i=F({scopeKey:`${t}:${n}`,onApplied:r,onSucceeded:e=>u.success(e===`resume`?`Compensation resumed`:`Compensation abandoned`,t)});return n?(0,R.jsxs)(`div`,{className:`border-t border-line p-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-faint`,children:`Operator decision`}),(0,R.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Retry after fixing the reversal, or explicitly abandon the remaining compensation steps.`}),(0,R.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:!!i.busy,onClick:()=>{window.confirm(`Retry the stuck compensation for ${t}? Handlers must be idempotent.`)&&i.run(`resume`,()=>e.resumeCompensation(t))},className:`rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:`Resume compensation`}),(0,R.jsx)(`button`,{type:`button`,disabled:!!i.busy,onClick:()=>{window.confirm(`Abandon remaining compensation for ${t}? This is irreversible.`)&&i.run(`abandon`,()=>e.abandonCompensation(t))},className:`rounded-md border border-danger/40 px-3 py-2 text-xs text-danger disabled:opacity-40`,children:`Abandon remainder`})]}),i.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:i.error}),i.succeeded&&(0,R.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:i.succeeded===`resume`?`Resume command accepted; recovery state refreshed.`:`Abandon command accepted; recovery state refreshed.`}),i.result!==void 0&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{value:i.result})})]}):null}function je({repository:e,controlRepository:t,id:n,onApplied:r,pollIntervalMs:i=5e3}){let{data:a,error:o,loading:s,refetch:c}=d(()=>e.get(n,`active`),[e,n],{intervalMs:i});if(s&&!a)return(0,R.jsx)(h,{label:`Loading recovery plan…`});if(o&&!a)return(0,R.jsx)(m,{error:o,onRetry:c});let l=a?.execution;if(!l)return null;let u=Object.entries(l.steps).filter(([,e])=>e.compensatable||e.compensation);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{error:o,onRetry:c}),(0,R.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-line px-4 py-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-violet-400`,children:`Recovery plan`}),(0,R.jsx)(`h2`,{className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:l.id})]}),(0,R.jsx)(_,{status:l.state})]}),(0,R.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 border-b border-line p-4 text-xs`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-faint`,children:`Compensation pivot`}),(0,R.jsx)(`div`,{className:`mt-1 text-fg`,children:l.committedAt===void 0?`Not committed`:`Node ${l.committedAt}`})]}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-faint`,children:`Rollback state`}),(0,R.jsx)(`div`,{className:`mt-1 text-fg`,children:l.rollbackStatus??l.state})]})]}),l.failureReason&&(0,R.jsx)(`div`,{role:`alert`,className:`border-b border-danger/30 bg-danger/[0.06] px-4 py-3 text-xs text-danger`,children:l.failureReason}),(0,R.jsxs)(`div`,{className:`p-4`,children:[(0,R.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-faint`,children:`Compensation ledger`}),u.length?(0,R.jsx)(`ol`,{className:`space-y-2`,children:u.reverse().map(([e,t])=>(0,R.jsxs)(`li`,{className:`grid gap-2 rounded-md border border-line px-3 py-2 text-xs sm:grid-cols-[1fr_auto]`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`font-mono text-fg`,children:e}),(0,R.jsx)(`div`,{className:`mt-1 text-faint`,children:t.compensation?.error??`Compensation handler registered`})]}),(0,R.jsxs)(`div`,{className:`text-right text-muted`,children:[t.compensation?t.compensation.status:`pending`,t.compensation?.at?(0,R.jsx)(`div`,{className:`mt-1 text-[10px] text-faint`,children:b(t.compensation.at)}):null]})]},e))}):(0,R.jsx)(`p`,{className:`text-sm text-muted`,children:`No compensatable step was persisted.`})]}),(0,R.jsx)(Ae,{repository:t,executionId:n,stuck:l.state===`compensation-stuck`,onApplied:()=>q(c,r)},n)]})]})}function Me({execution:e}){return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsx)(J,{title:`Input`,value:e.input}),(0,R.jsx)(J,{title:`Signals`,value:e.signals}),(0,R.jsx)(J,{title:`Resolved steps`,value:e.resolvedSteps}),(0,R.jsx)(J,{title:`Decisions`,value:e.decisions})]})}function J({title:e,value:t}){return(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h3`,{className:`mb-2 text-xs font-semibold uppercase tracking-wider text-faint`,children:e}),(0,R.jsx)(B,{value:t})]})}function Ne({steps:e,onSelect:t}){let n=Object.entries(e);return n.length===0?(0,R.jsx)(`p`,{className:`text-xs text-faint`,children:`No persisted step records.`}):(0,R.jsx)(`ol`,{className:`space-y-3`,children:n.map(([e,r],i)=>(0,R.jsx)(Pe,{name:e,step:r,last:i===n.length-1,onSelect:t},e))})}function Pe({name:e,step:t,last:n,onSelect:r}){let i=t.startedAt!==void 0&&t.completedAt!==void 0?t.completedAt-t.startedAt:void 0;return(0,R.jsxs)(`li`,{className:`relative grid grid-cols-[18px_1fr] gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-col items-center`,"aria-hidden":`true`,children:[(0,R.jsx)(`span`,{className:`mt-1 size-2.5 rounded-full bg-current text-accent`}),!n&&(0,R.jsx)(`span`,{className:`mt-1 w-px flex-1 bg-line`})]}),(0,R.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-line bg-surface-2 p-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,R.jsx)(`span`,{translate:`no`,className:`break-all font-mono text-sm font-medium text-fg`,children:e}),(0,R.jsx)(_,{status:t.status})]}),(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-x-4 gap-y-1 text-xs text-faint`,children:[t.attempts!==void 0&&(0,R.jsxs)(`span`,{children:[t.attempts,` attempt`,t.attempts===1?``:`s`]}),i!==void 0&&(0,R.jsx)(`span`,{children:y(i)}),t.occurrence!==void 0&&(0,R.jsxs)(`span`,{children:[`Occurrence `,t.occurrence]}),t.loopIndex!==void 0&&(0,R.jsxs)(`span`,{children:[`Loop index `,t.loopIndex]}),t.compensatable&&(0,R.jsx)(`span`,{children:`Compensatable`})]}),t.idempotencyKey&&(0,R.jsxs)(`div`,{className:`mt-2 break-all font-mono text-[11px] text-faint`,children:[`Idempotency: `,t.idempotencyKey]}),t.childExecutionId&&(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r(t.childExecutionId),className:`mt-2 break-all font-mono text-xs text-accent hover:underline`,children:[`Child execution: `,t.childExecutionId]}),t.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-2 whitespace-pre-wrap text-xs text-danger`,children:t.error}),t.compensation&&(0,R.jsxs)(`div`,{className:`mt-3 rounded-md border border-line px-3 py-2 text-xs`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-faint`,children:`Compensation`}),(0,R.jsx)(_,{status:t.compensation.status}),(0,R.jsx)(`span`,{className:`text-faint`,children:b(t.compensation.at)})]}),t.compensation.error&&(0,R.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-danger`,children:t.compensation.error})]}),(0,R.jsx)(Fe,{step:t})]})]})}function Fe({step:e}){return(0,R.jsxs)(R.Fragment,{children:[Object.hasOwn(e,`result`)&&(0,R.jsx)(Y,{label:`Result`,value:e.result}),Object.hasOwn(e,`loopItem`)&&(0,R.jsx)(Y,{label:`Loop item`,value:e.loopItem})]})}function Y({label:e,value:t}){return(0,R.jsxs)(`details`,{className:`mt-3`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted`,children:e}),(0,R.jsx)(`div`,{className:`mt-2`,children:(0,R.jsx)(B,{value:t})})]})}function Ie({execution:e,onSelect:t}){let n=Object.values(e.steps),r=n.filter(e=>e.status===`completed`).length;return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsxs)(`dl`,{className:`grid grid-cols-2 gap-x-4 gap-y-3 border-b border-line pb-5 text-xs sm:grid-cols-3`,children:[(0,R.jsx)(V,{label:`Current node`,value:String(e.currentNodeIndex)}),(0,R.jsx)(V,{label:`Step progress`,value:`${r}/${n.length} completed`}),(0,R.jsx)(V,{label:`Duration`,value:y(e.updatedAt-e.createdAt)}),(0,R.jsx)(V,{label:`Started`,value:b(e.createdAt)}),(0,R.jsx)(V,{label:`Last transition`,value:b(e.updatedAt)}),(0,R.jsx)(V,{label:`Rollback`,value:e.rollbackStatus??`Not started`})]}),e.failureReason&&(0,R.jsxs)(`div`,{role:`alert`,className:`border-l-2 border-danger bg-danger/[0.06] px-3 py-2 text-xs text-danger`,children:[(0,R.jsx)(`div`,{className:`mb-1 font-medium`,children:`Failure`}),(0,R.jsx)(`p`,{className:`whitespace-pre-wrap`,children:e.failureReason})]}),(0,R.jsx)(Le,{execution:e,onSelect:t}),(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-faint`,children:`Step state`}),(0,R.jsx)(Ne,{steps:e.steps,onSelect:t})]})]})}function Le({execution:e,onSelect:t}){return!e.parentExecutionId&&!e.definitionHash&&e.committedAt===void 0?null:(0,R.jsxs)(`div`,{className:`grid gap-3 border-b border-line pb-5 text-xs sm:grid-cols-2`,children:[e.parentExecutionId&&(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-faint`,children:`Parent execution`}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>t(e.parentExecutionId),className:`mt-1 break-all font-mono text-accent hover:underline`,children:e.parentExecutionId})]}),e.definitionHash&&(0,R.jsx)(V,{label:`Definition hash`,value:e.definitionHash}),e.committedAt!==void 0&&(0,R.jsx)(V,{label:`Compensation pivot`,value:`Node ${e.committedAt}`}),(0,R.jsx)(`div`,{className:`flex items-end`,children:(0,R.jsx)(_,{status:e.state})})]})}var Re=[{id:`summary`,label:`Summary`},{id:`history`,label:`History`},{id:`payloads`,label:`Payloads`}];function X({repository:e,id:t,kind:n,onSelect:r}){return(0,R.jsx)(ze,{repository:e,id:t,kind:n,onSelect:r},`${n}:${t}`)}function ze({repository:e,id:r,kind:i,onSelect:a}){let[o,s]=n(),c=o.get(`tab`),l=A(c)?c:`summary`,{data:u,error:f,loading:g,refetch:v}=d(()=>e.get(r,i),[e,r,i],{intervalMs:5e3});if(g&&!u)return(0,R.jsx)(Z,{children:(0,R.jsx)(h,{label:`Loading execution…`})});if(f&&!u)return(0,R.jsx)(Z,{children:(0,R.jsx)(m,{error:f,onRetry:v})});let y=u?.execution;return y?(0,R.jsxs)(Z,{children:[f&&(0,R.jsx)(p,{message:`Execution refresh failed. Showing the last snapshot.`,onRetry:v}),(0,R.jsx)(`header`,{className:`border-b border-line px-4 py-3`,children:(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-faint`,children:`Execution`}),(0,R.jsx)(`h2`,{translate:`no`,className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:y.id}),(0,R.jsx)(`div`,{className:`mt-1 text-xs text-muted`,children:y.workflowName})]}),(0,R.jsx)(_,{status:y.state})]})}),(0,R.jsx)(`nav`,{"aria-label":`Execution detail`,className:`flex border-b border-line px-2`,children:Re.map(e=>(0,R.jsx)(`button`,{type:`button`,"aria-pressed":l===e.id,onClick:()=>{s(t=>{let n=new URLSearchParams(t);return e.id===`summary`?n.delete(`tab`):n.set(`tab`,e.id),n})},className:t(`border-b-2 px-3 py-2 text-xs font-medium`,l===e.id?`border-accent text-fg`:`border-transparent text-faint hover:text-muted`),children:e.label},e.id))}),(0,R.jsxs)(`div`,{className:`p-4`,"aria-live":`polite`,children:[l===`summary`&&(0,R.jsx)(Ie,{execution:y,onSelect:a}),l===`history`&&(0,R.jsx)(U,{execution:y}),l===`payloads`&&(0,R.jsx)(Me,{execution:y})]})]}):null}function Z({children:e}){return(0,R.jsx)(`section`,{className:`min-w-0 overflow-hidden rounded-lg border border-line bg-surface`,children:e})}function Q({total:e,offset:t,pageSize:n,count:r,onPage:i}){let a=r===0?0:t+1,o=Math.min(t+r,e);return(0,R.jsxs)(`nav`,{"aria-label":`Workflow execution pages`,className:`mt-3 flex items-center justify-between`,children:[(0,R.jsx)(`button`,{type:`button`,disabled:t===0,onClick:()=>i(Math.max(0,t-n)),className:`rounded-lg border border-line px-3 py-1.5 text-xs text-muted disabled:opacity-40`,children:`Previous`}),(0,R.jsxs)(`span`,{className:`text-xs text-faint`,children:[a,`–`,o,` of `,e]}),(0,R.jsx)(`button`,{type:`button`,disabled:t+n>=e,onClick:()=>i(t+n),className:`rounded-lg border border-line px-3 py-1.5 text-xs text-muted disabled:opacity-40`,children:`Next`})]})}var Be=e=>e.length>22?`${e.slice(0,12)}…${e.slice(-7)}`:e;function Ve({executions:e,total:t,offset:n,pageSize:r,selected:i,onSelect:a,onPage:o}){return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`overflow-x-auto rounded-lg border border-line bg-surface`,children:(0,R.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,R.jsx)(`thead`,{className:`bg-surface-2/80`,children:(0,R.jsxs)(`tr`,{className:`border-b border-line text-left text-[11px] uppercase tracking-wider text-faint`,children:[(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Workflow / execution`}),(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Status`}),(0,R.jsx)(`th`,{className:`hidden px-3 py-2 font-medium md:table-cell`,children:`Node`}),(0,R.jsx)(`th`,{className:`hidden px-3 py-2 font-medium lg:table-cell`,children:`Elapsed`}),(0,R.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:`Updated`})]})}),(0,R.jsx)(`tbody`,{children:e.map(e=>(0,R.jsx)(He,{execution:e,selected:i?.id===e.id,onSelect:a},e.id))})]})}),(0,R.jsx)(Q,{total:t,offset:n,pageSize:r,count:e.length,onPage:o})]})}function He({execution:e,selected:n,onSelect:r}){return(0,R.jsxs)(`tr`,{className:t(`border-b border-line/70 last:border-0`,n&&`bg-surface-2`),children:[(0,R.jsx)(`td`,{className:`p-0`,children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r({id:e.id,source:`page`}),className:`block w-full px-3 py-2.5 text-left focus-visible:outline-2 focus-visible:outline-inset focus-visible:outline-accent`,children:[(0,R.jsx)(`span`,{className:`block truncate font-medium text-fg`,children:e.workflowName}),(0,R.jsx)(`span`,{translate:`no`,title:e.id,className:`mt-0.5 block font-mono text-[11px] text-faint`,children:Be(e.id)})]})}),(0,R.jsx)(`td`,{className:`px-3 py-2.5`,children:(0,R.jsx)(_,{status:e.state})}),(0,R.jsx)(`td`,{className:`hidden px-3 py-2.5 font-mono text-xs text-muted md:table-cell`,children:e.currentNodeIndex}),(0,R.jsx)(`td`,{className:`hidden whitespace-nowrap px-3 py-2.5 font-mono text-xs text-muted lg:table-cell`,children:y(e.updatedAt-e.createdAt)}),(0,R.jsx)(`td`,{title:b(e.updatedAt),className:`whitespace-nowrap px-3 py-2.5 text-right text-xs text-muted`,children:x(e.updatedAt)})]})}function Ue({mode:e,rows:n,selected:r,onSelect:i,total:a,offset:o,pageSize:s,onPage:c,clock:l=W}){let u=G(l,e===`waiting`);return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`section`,{className:`overflow-x-auto rounded-lg border border-line bg-surface`,children:(0,R.jsxs)(`table`,{className:`w-full min-w-[560px] text-sm`,children:[(0,R.jsx)(`thead`,{className:`border-b border-line bg-surface-2/80 text-left text-[10px] uppercase tracking-wider text-faint`,children:(0,R.jsxs)(`tr`,{children:[(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:e===`archive`?`Execution record`:`Execution`}),(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:`Workflow`}),(0,R.jsx)(`th`,{className:`px-3 py-2 font-medium`,children:We(e)}),(0,R.jsx)(`th`,{className:`px-3 py-2 text-right font-medium`,children:Ge(e)})]})}),(0,R.jsx)(`tbody`,{children:n.map(n=>(0,R.jsxs)(`tr`,{className:t(`border-b border-line last:border-0`,r?.id===n.id&&`bg-surface-2`),children:[(0,R.jsx)(`td`,{className:`p-0`,children:(0,R.jsx)(`button`,{type:`button`,className:`block w-full px-3 py-3 text-left font-mono text-xs text-fg`,onClick:()=>i({id:n.id,source:`page`}),children:n.id})}),(0,R.jsx)(`td`,{className:`px-3 py-3 text-muted`,children:n.workflowName}),(0,R.jsx)(`td`,{className:`px-3 py-3`,children:(0,R.jsx)(Ke,{mode:e,row:n})}),(0,R.jsx)(`td`,{className:`whitespace-nowrap px-3 py-3 text-right text-xs text-muted`,children:qe(e,n,u)})]},n.id))})]})}),(0,R.jsx)(Q,{total:a,offset:o,pageSize:s,count:n.length,onPage:c})]})}var We=e=>e===`waiting`?`Resume node`:e===`compensation`?`Recovery state`:`Outcome`,Ge=e=>e===`archive`?`Archived`:e===`waiting`?`Waiting`:`Updated`;function Ke({mode:e,row:t}){return e===`waiting`?(0,R.jsxs)(`span`,{className:`font-mono text-xs text-warning`,children:[`Node `,t.currentNodeIndex]}):(0,R.jsx)(_,{status:t.state})}function qe(e,t,n){return e===`archive`?t.archivedAt?b(t.archivedAt):`Unavailable`:e===`waiting`?y(Math.max(0,n-t.updatedAt)):x(t.updatedAt)}function Je({stats:e,page:t,repository:n,kind:r,selected:i,onSelect:a}){let o=t.executions.filter(e=>[`waiting`,`failed`,`compensation-stuck`].includes(e.state));return(0,R.jsxs)(`div`,{className:`space-y-5`,children:[(0,R.jsx)($,{stats:e}),(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(320px,0.7fr)_minmax(0,1.3fr)]`,children:[(0,R.jsxs)(`section`,{className:`rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`border-b border-line px-4 py-3`,children:[(0,R.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Needs attention`}),(0,R.jsxs)(`p`,{className:`mt-0.5 text-xs text-faint`,children:[`Waiting, failed, and stuck executions · showing `,o.length,` of `,t.total,`.`]})]}),(0,R.jsx)(Ye,{rows:o,selected:i,onSelect:a})]}),i&&(0,R.jsx)(X,{repository:n,id:i.id,kind:r,onSelect:e=>a({id:e,source:`link`})})]})]})}function $({stats:e}){return(0,R.jsx)(`dl`,{className:`grid overflow-hidden rounded-lg border border-line bg-surface sm:grid-cols-2 xl:grid-cols-4`,children:[[`Open executions`,e.activeTotal],[`Waiting for signal`,e.states.waiting],[`Recovery required`,e.states[`compensation-stuck`]+e.states.failed],[`Retained in archive`,e.archiveTotal]].map(([e,t])=>(0,R.jsxs)(`div`,{className:`border-b border-line px-4 py-3 sm:border-r xl:border-b-0`,children:[(0,R.jsx)(`dt`,{className:`text-[10px] uppercase tracking-wider text-faint`,children:e}),(0,R.jsx)(`dd`,{className:`mt-1 font-mono text-xl font-semibold text-fg`,children:t})]},e))})}function Ye({rows:e,selected:t,onSelect:n}){return e.length?(0,R.jsx)(`ul`,{className:`divide-y divide-line`,children:e.map(e=>(0,R.jsx)(`li`,{className:t?.id===e.id?`bg-surface-2`:void 0,children:(0,R.jsxs)(`button`,{type:`button`,className:`w-full px-4 py-3 text-left`,onClick:()=>n({id:e.id,source:`page`}),children:[(0,R.jsxs)(`span`,{className:`flex items-center justify-between gap-3`,children:[(0,R.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.workflowName}),(0,R.jsx)(`span`,{className:`text-xs text-faint`,children:x(e.updatedAt)})]}),(0,R.jsxs)(`span`,{className:`mt-1 flex items-center justify-between gap-3 font-mono text-[11px] text-faint`,children:[(0,R.jsx)(`span`,{className:`truncate`,children:e.id}),(0,R.jsx)(`span`,{children:e.state})]})]})},e.id))}):(0,R.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-muted`,children:`No intervention required.`})}function Xe({repository:e,executionId:t,onApplied:n}){let[r,i]=(0,T.useState)(``),[a,o]=(0,T.useState)(`{}`),s=F({scopeKey:t,onApplied:n,onSucceeded:()=>u.success(`Workflow signal accepted`,`${r.trim()} · ${t}`)});return(0,R.jsxs)(`div`,{className:`border-t border-line p-4`,children:[(0,R.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wider text-faint`,children:`Send signal`}),(0,R.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Event name`,(0,R.jsx)(`input`,{"aria-label":`Workflow signal event`,value:r,onChange:e=>i(e.target.value),className:`mt-1 h-9 w-full rounded-lg border border-line bg-surface-2 px-3 font-mono text-sm text-fg`})]}),(0,R.jsxs)(`label`,{className:`text-xs text-faint`,children:[`Payload JSON`,(0,R.jsx)(`textarea`,{"aria-label":`Workflow signal payload`,value:a,onChange:e=>o(e.target.value),className:`mt-1 min-h-20 w-full resize-y rounded-lg border border-line bg-surface-2 p-2 font-mono text-xs text-fg`})]})]}),(0,R.jsx)(`button`,{type:`button`,disabled:!r.trim()||!!s.busy,onClick:()=>{let n;try{n=JSON.parse(a)}catch{s.run(`signal`,async()=>{throw Error(`Signal payload must be valid JSON.`)});return}window.confirm(`Send durable signal "${r.trim()}" to ${t}?`)&&s.run(`signal`,()=>e.signal(t,r.trim(),n))},className:`mt-3 rounded-md bg-accent px-3 py-2 text-xs font-medium text-accent-fg disabled:opacity-40`,children:s.busy?`Sending…`:`Send durable signal`}),s.error&&(0,R.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:s.error}),s.succeeded&&(0,R.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-success`,children:`Durable signal accepted; execution and list refreshed.`}),s.result!==void 0&&(0,R.jsx)(`div`,{className:`mt-3`,children:(0,R.jsx)(B,{value:s.result})})]})}function Ze({repository:e,controlRepository:t,id:n,onApplied:r,clock:i,pollIntervalMs:a=5e3}){let{data:o,error:s,loading:c,refetch:l}=d(()=>e.get(n,`active`),[e,n],{intervalMs:a});if(c&&!o)return(0,R.jsx)(h,{label:`Loading signal inbox…`});if(s&&!o)return(0,R.jsx)(m,{error:s,onRetry:l});let u=o?.execution;if(!u)return null;let f=Object.entries(u.signals);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(K,{error:s,onRetry:l}),(0,R.jsxs)(`section`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[(0,R.jsxs)(`header`,{className:`border-b border-line px-4 py-3`,children:[(0,R.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-warning`,children:`Signal inbox`}),(0,R.jsx)(`h2`,{className:`mt-1 break-all font-mono text-sm font-semibold text-fg`,children:u.id})]}),(0,R.jsxs)(`dl`,{className:`grid grid-cols-2 gap-3 border-b border-line p-4 text-xs sm:grid-cols-3`,children:[(0,R.jsx)(V,{label:`Waiting at node`,value:String(u.currentNodeIndex)}),(0,R.jsx)(V,{label:`Parked for`,value:(0,R.jsx)(Oe,{since:u.updatedAt,clock:i})}),(0,R.jsx)(V,{label:`Last transition`,value:b(u.updatedAt)})]}),(0,R.jsxs)(`div`,{className:`p-4`,children:[(0,R.jsx)(`h3`,{className:`mb-3 text-xs font-semibold uppercase tracking-wider text-faint`,children:`Durable signals`}),f.length?f.map(([e,t])=>(0,R.jsxs)(`div`,{className:`mb-3 last:mb-0`,children:[(0,R.jsx)(`div`,{className:`mb-1 font-mono text-xs text-warning`,children:e}),(0,R.jsx)(B,{value:t})]},e)):(0,R.jsx)(`p`,{className:`text-sm text-muted`,children:`No signal has been persisted yet. The execution remains parked.`})]}),(0,R.jsx)(Xe,{repository:t,executionId:n,onApplied:()=>q(l,r)},n)]})]})}function Qe(e){return e.section.id===`overview`?(0,R.jsx)(Je,{...e}):e.section.id===`executions`?(0,R.jsx)($e,{...e}):(0,R.jsx)(et,{...e})}function $e({repository:e,kind:t,page:n,selected:r,offset:i,pageSize:a,onSelect:o,onPage:s}){return(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(390px,0.8fr)_minmax(0,1.4fr)]`,children:[(0,R.jsx)(Ve,{executions:n.executions,total:n.total,offset:i,pageSize:a,selected:r,onSelect:o,onPage:s}),r&&(0,R.jsx)(X,{repository:e,id:r.id,kind:t,onSelect:e=>o({id:e,source:`link`})})]})}function et(e){let t=e.section.id;return(0,R.jsxs)(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(420px,0.95fr)_minmax(0,1.05fr)]`,children:[(0,R.jsx)(Ue,{mode:t,rows:e.page.executions,selected:e.selected,onSelect:e.onSelect,total:e.page.total,offset:e.offset,pageSize:e.pageSize,onPage:e.onPage}),e.selected&&(0,R.jsx)(tt,{...e,id:e.selected.id})]})}function tt({section:e,repository:t,controlRepository:n,onRefresh:r,id:i}){return e.id===`waiting`?(0,R.jsx)(Ze,{repository:t,controlRepository:n,id:i,onApplied:r}):e.id===`compensation`?(0,R.jsx)(je,{repository:t,controlRepository:n,id:i,onApplied:r}):(0,R.jsx)(ke,{repository:t,id:i})}function nt({repository:e=de,controlRepository:t=P}){let{pathname:n}=i(),r=ee(n),a=fe(r),{kind:o,workflowName:s,state:c,offset:l,selected:u}=a,f={kind:o,workflowName:s||void 0,state:c||void 0,limit:25,offset:l},{data:m,error:h,loading:g,refetch:_}=d(()=>r.id===`overview`?ie(e,25):re(e,f),[e,r.id,o,s,c,l],{intervalMs:5e3});(0,T.useEffect)(()=>{let e=m?.page.total;if(e===void 0||l===0)return;let t=e===0?0:Math.floor((e-1)/25)*25;l>t&&a.update({offset:t,executionId:null,tab:`summary`},!0)},[m?.page.total,l,a.update]),(0,T.useEffect)(()=>{let e=m?.page.executions;if(e){let t=r.id===`overview`?e.filter(e=>[`waiting`,`failed`,`compensation-stuck`].includes(e.state)):e,n=te(u,t);n?.id!==u?.id&&a.select(n,!0)}},[m?.page.executions,r.id,u,a.select]);let y=m?.stats,b=m?.page;return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(v,{title:(0,R.jsxs)(R.Fragment,{children:[`Workflow `,(0,R.jsxs)(`span`,{className:`text-faint`,children:[`/ `,r.label]})]}),description:r.description,live:!!(m&&!h),actions:(0,R.jsx)(`button`,{type:`button`,onClick:()=>void _(),className:`rounded-lg border border-line px-3 py-1.5 text-sm text-muted hover:bg-surface-2 hover:text-fg`,children:`Refresh`})}),r.id===`overview`&&(0,R.jsx)(_e,{repository:t,onApplied:_}),r.id===`archive`&&(0,R.jsx)(me,{repository:t,onApplied:_}),r.id===`executions`&&y&&(0,R.jsx)(ge,{stats:y}),(0,R.jsx)(we,{section:r,kind:o,workflowName:s,state:c,stats:y??void 0,total:b?.total,onKind:e=>{a.update({kind:e,offset:0,executionId:null,tab:`summary`},!1)},onWorkflowName:e=>{a.update({workflowName:e,offset:0,executionId:null,tab:`summary`},!1)},onState:e=>{a.update({state:e,offset:0,executionId:null,tab:`summary`},!1)}}),h&&m&&(0,R.jsx)(p,{message:`Workflow refresh failed — showing the last snapshot.`,onRetry:_}),(0,R.jsx)(rt,{repository:e,controlRepository:t,section:r,stats:y,kind:o,page:b,error:h,loading:g,dataPresent:!!m,selected:u,offset:l,onRetry:_,onSelect:e=>a.select(e),onPage:e=>{a.update({offset:e,executionId:null,tab:`summary`})}})]})}function rt({repository:e,controlRepository:t,section:n,stats:r,kind:i,page:a,error:o,loading:s,dataPresent:c,selected:l,offset:u,onRetry:d,onSelect:f,onPage:p}){return o&&!c?(0,R.jsx)(m,{error:o,onRetry:d}):s&&!c?(0,R.jsx)(h,{label:`Loading workflows…`}):a?.available?a.executions.length===0&&a.total>0&&u>0?(0,R.jsx)(h,{label:`Loading workflow page…`}):a.executions.length===0?(0,R.jsx)(g,{title:`No executions match these filters`,hint:`Change the store, workflow, or state filter.`}):r?(0,R.jsx)(Qe,{section:n,repository:e,controlRepository:t,kind:i,stats:r,page:a,selected:l,offset:u,pageSize:25,onSelect:f,onPage:p,onRefresh:d}):null:(0,R.jsx)(g,{title:`Workflow store not initialized`,hint:`Start a Bunqueue Workflow Engine with this server dataPath; its official workflow_executions tables will appear here automatically.`})}export{nt as Workflows};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./connectionStore-DbBYqHEY.js";import{a as n,n as r,r as i,s as a}from"./upstreamPaths-D_LPsv7b.js";var o=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`ApiError`}},s=3e4;async function c(n,r,i=!0,a=[],c=`json`){let l=AbortSignal.timeout(s),u=r?.signal?AbortSignal.any([r.signal,l]):l,d=new Headers(t());r?.headers&&new Headers(r.headers).forEach((e,t)=>{d.set(t,e)}),r?.body!=null&&!d.has(`Content-Type`)&&d.set(`Content-Type`,`application/json`);let f;try{f=await fetch(e()+n,{...r,headers:d,signal:u})}catch(e){throw l.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new o(`Request timed out`,0):e}if(!f.ok&&!a.includes(f.status)){let e=`HTTP ${f.status}`;try{let t=await f.json();t?.error&&(e=t.error)}catch{}throw new o(e,f.status)}if(f.status===204)return;let p;try{p=await f.text()}catch(e){throw l.aborted&&!r?.signal?.aborted?new o(`Request timed out`,0):e}if(!p)return;if(c===`text`)return p;let m;try{m=JSON.parse(p)}catch{throw new o(`Invalid JSON response (HTTP ${f.status})`,f.status)}if(i&&m&&typeof m==`object`&&m.ok===!1){let e=m.error;throw new o(e??`Operation failed`,f.status)}return m}var l=a,u=(e,t)=>c(e,{method:`POST`,body:t?JSON.stringify(t):void 0}),d=(e,t)=>c(e,{method:`PUT`,body:t?JSON.stringify(t):void 0}),f=e=>c(e,{method:`DELETE`}),p={overview:()=>c(`/dashboard`),queues:(e=200,t=0)=>c(`/dashboard/queues?limit=${e}&offset=${t}`),queueDetail:(e,t=!0)=>c(`/dashboard/queues/${l(e)}?includeJobs=${t}`),stats:()=>c(`/stats`),storage:()=>c(`/storage`,void 0,!1),health:()=>c(`/health`,void 0,!1,[503]),healthz:()=>c(`/healthz`,void 0,!0,[],`text`),live:()=>c(`/live`,void 0,!0,[],`text`),ready:()=>c(`/ready`,void 0,!1,[503]),metrics:()=>c(`/metrics`),jobsList:(e,t={})=>{let n=new URLSearchParams;return t.states?.length&&n.set(`states`,t.states.join(`,`)),n.set(`limit`,String(t.limit??50)),n.set(`offset`,String(t.offset??0)),c(`/queues/${l(e)}/jobs/list?${n.toString()}`)},job:e=>c(`/jobs/${n(e)}`),cancelJob:e=>f(`/jobs/${n(e)}`),promoteJob:e=>u(`/jobs/${n(e)}/promote`),retryJob:e=>u(`/jobs/${n(e)}/move-to-wait`),pause:e=>u(`/queues/${l(e)}/pause`),resume:e=>u(`/queues/${l(e)}/resume`),drain:e=>u(`/queues/${l(e)}/drain`),obliterate:e=>u(`/queues/${l(e)}/obliterate`),clean:(e,t=0,n=1e3)=>u(`/queues/${l(e)}/clean`,{grace:t,limit:n}),retryCompleted:e=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.8.57 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t)=>d(`/queues/${l(e)}/rate-limit`,{limit:t}),clearRateLimit:e=>f(`/queues/${l(e)}/rate-limit`),setConcurrency:(e,t)=>d(`/queues/${l(e)}/concurrency`,{concurrency:t}),clearConcurrency:e=>f(`/queues/${l(e)}/concurrency`),dlq:(e,t=50,n=0)=>c(`/queues/${l(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>c(`/queues/${l(e)}/dlq/stats`),retryDlq:e=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.8.57 because the endpoint has no atomic flow-safety precondition.`)},purgeDlq:e=>u(`/queues/${l(e)}/dlq/purge`),crons:()=>c(`/crons`),deleteCron:e=>f(`/crons/${r(e,`Cron name`,256)}`),workers:()=>c(`/workers`),eventsUrl:t=>e()+(t?`/events/queues/${i(t)}`:`/events`)};export{p as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r}from"./connectionStore-DbBYqHEY.js";import{a as i,i as a,n as o,r as s,s as c}from"./upstreamPaths-D_LPsv7b.js";var l=class extends Error{status;constructor(e,t){super(e),this.status=t,this.name=`BqError`}},u=3e4,d=()=>u;async function f(e,t,n,r,i=!0,a=`server`,o=[],s=u){let c=AbortSignal.timeout(s),d=r?.signal?AbortSignal.any([r.signal,c]):c,f=new Headers(n);r?.headers&&new Headers(r.headers).forEach((e,t)=>{f.set(t,e)}),r?.body!=null&&!f.has(`Content-Type`)&&f.set(`Content-Type`,`application/json`);let p;try{p=await fetch(e+t,{...r,headers:f,signal:d})}catch(e){throw c.aborted&&!r?.signal?.aborted||e?.name===`TimeoutError`?new l(`Request timed out`,0):e}if(!p.ok&&!o.includes(p.status)){let t=`HTTP ${p.status}`;try{let e=await p.json();e?.error&&(t=e.error)}catch{}throw p.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:a,auth:f.get(`Authorization`)??void 0,target:e}})),new l(t,p.status)}if(p.status===204)return;let m;try{m=await p.text()}catch(e){throw c.aborted&&!r?.signal?.aborted?new l(`Request timed out`,0):e}if(!m)return;let h;try{h=JSON.parse(m)}catch{throw new l(`Invalid JSON response (HTTP ${p.status})`,p.status)}if(i&&h&&typeof h==`object`&&h.ok===!1)throw new l(h.error??`Operation failed`,p.status);return h}var p=(e,n,i=!0,a=[],o=u)=>f(t(),e,r(),n,i,`server`,a,o);function m(t,n){return e(t)??e(n)??`http://localhost:6800`}function h(){try{return globalThis.__BUNQUEUE_AGENT_URL__}catch{return}}var g=m(h(),void 0),ee=()=>g,_=(e,t,r=u)=>f(g,e,n(),t,!0,`agent`,[],r),v=(e,t)=>({method:e,body:t===void 0?void 0:JSON.stringify(t)}),y=3e5,b=(e,t)=>v(e,t),x=new WeakMap,S=new WeakMap;function C(){let e=Object.freeze({baseUrl:t()});return x.set(e,Object.freeze({...r()})),e}function te(){let e=Object.freeze({baseUrl:g});return S.set(e,Object.freeze({...n()})),e}function w(e){let t=x.get(e);if(!t)throw TypeError(`Invalid server request target.`);return t}function T(e){let t=S.get(e);if(!t)throw TypeError(`Invalid agent request target.`);return t}function ne(e,t){let n=Object.entries(e);return n.length===Object.keys(t).length&&n.every(([e,n])=>t[e]===n)}function re(e){let n=w(e);if(e.baseUrl!==t()||!ne(n,r()))throw Error(`Server connection changed after confirmation was requested for ${e.baseUrl}; action refused.`)}async function E(e,t,n){n?.throwIfAborted();let r=await f(e.baseUrl,`/jobs/${i(t)}`,{...w(e)},n?{signal:n}:void 0);return n?.throwIfAborted(),r}var D=encodeURIComponent,ie={info:()=>_(`/db/info`),tables:()=>_(`/db/tables`),schema:e=>_(`/db/tables/${o(e,`Database table`)}/schema`),rows:(e,t=50,n=0,r,i=`asc`,a)=>_(`/db/tables/${o(e,`Database table`)}?limit=${t}&offset=${n}`+(r?`&orderBy=${D(r)}&dir=${i}`:``)+(a?.value?`&fcol=${D(a.column)}&fop=${a.op}&fval=${D(a.value)}`:``)),cell:(e,t,n)=>_(`/db/tables/${o(e,`Database table`)}/cell?rowid=${D(String(t))}&column=${D(n)}`),query:e=>_(`/db/query`,v(`POST`,{sql:e}))},ae={status:()=>_(`/control/status`),start:()=>_(`/control/start`,{method:`POST`}),stop:()=>_(`/control/stop`,{method:`POST`}),restart:()=>_(`/control/restart`,{method:`POST`}),logs:()=>_(`/control/logs`),getConfig:()=>_(`/control/config`),setConfig:e=>_(`/control/config`,v(`PUT`,e))},oe={stats:()=>_(`/workflows/stats`),list:(e={})=>{let t=new URLSearchParams;return e.kind&&t.set(`kind`,e.kind),e.workflowName&&t.set(`workflowName`,e.workflowName),e.state&&t.set(`state`,e.state),e.limit!==void 0&&t.set(`limit`,String(e.limit)),e.offset!==void 0&&t.set(`offset`,String(e.offset)),_(`/workflows${t.size?`?${t}`:``}`)},get:(e,t=`active`)=>_(`/workflows/${o(e,`Workflow execution id`)}?kind=${t}`)},se=2e5,O=16*1024*1024,ce=12e4,le=64*1024,k=encodeURIComponent;async function ue(e,t,n=50,r=0,i,a=`asc`,s,c){c?.throwIfAborted();let l=await f(e.baseUrl,`/db/tables/${o(t,`Database table`)}?limit=${n}&offset=${r}`+(i?`&orderBy=${k(i)}&dir=${a}`:``)+(s?.value?`&fcol=${k(s.column)}&fop=${s.op}&fval=${k(s.value)}`:``),{...T(e)},c?{signal:c}:void 0,!0,`agent`);return c?.throwIfAborted(),l}function A(e,t,n,r=!0){let i=e.get(t);if(!i||!/^\d+$/.test(i))throw new l(`Malformed database export response: invalid ${t} header.`,200);let a=Number(i);if(!Number.isSafeInteger(a)||a>n||!r&&a===0)throw new l(`Malformed database export response: invalid ${t} header.`,200);return a}async function de(e){if(!e.body)return``;let t=e.body.getReader(),n=new Uint8Array(le),r=0;try{for(;;){let e=await t.read();if(e.done)break;if(r+e.value.byteLength>n.byteLength)return t.cancel().catch(()=>void 0),``;n.set(e.value,r),r+=e.value.byteLength}}finally{t.releaseLock()}return new TextDecoder().decode(n.subarray(0,r))}async function fe(e,t,n){if(!e.body)throw new l(`Malformed database export response: missing CSV body.`,200);let r=new Uint8Array(t),i=e.body.getReader(),a=0;try{for(;;){n?.throwIfAborted();let e=await i.read();if(e.done)break;if(a+e.value.byteLength>t)throw i.cancel().catch(()=>void 0),new l(`Malformed database export response: body exceeds declared ${t} bytes.`,200);r.set(e.value,a),a+=e.value.byteLength}}finally{i.releaseLock()}if(n?.throwIfAborted(),a!==t)throw new l(`Malformed database export response: received ${a} of ${t} declared bytes.`,200);return r}function pe(e){if(!e||typeof e!=`object`||Array.isArray(e))throw TypeError(`Invalid database export request.`);if(typeof e.table!=`string`||!e.table)throw TypeError(`Database export table must not be empty.`);if(e.dir!==`asc`&&e.dir!==`desc`)throw TypeError(`Invalid database export sort direction.`);if(e.orderBy!==void 0&&(typeof e.orderBy!=`string`||!e.orderBy))throw TypeError(`Database export sort column must not be empty.`);let t=e.filter;if(t&&(typeof t!=`object`||Array.isArray(t)||typeof t.column!=`string`||!t.column||typeof t.value!=`string`||!t.value||![`contains`,`eq`,`ne`].includes(t.op)))throw TypeError(`Invalid database export filter.`);return Object.freeze({table:e.table,orderBy:e.orderBy,dir:e.dir,filter:t?Object.freeze({...t}):void 0})}async function me(e,t,n){e.status===401&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(`auth:required`,{detail:{scope:`agent`,auth:new Headers(n).get(`Authorization`)??void 0,target:t.baseUrl}}));let r=`HTTP ${e.status}`,i=await de(e);if(i)try{let e=JSON.parse(i);typeof e?.error==`string`&&(r=e.error)}catch{}return new l(r,e.status)}async function he(e,t,n){n?.throwIfAborted();let r={...T(e)},i=pe(t),a=new URLSearchParams;i.orderBy&&a.set(`orderBy`,i.orderBy),a.set(`dir`,i.dir),i.filter&&(a.set(`fcol`,i.filter.column),a.set(`fop`,i.filter.op),a.set(`fval`,i.filter.value));let s=`/db/tables/${o(i.table,`Database table`)}/export?${a}`,c=AbortSignal.timeout(ce),u=n?AbortSignal.any([n,c]):c;try{let t=await fetch(e.baseUrl+s,{headers:r,signal:u});if(!t.ok)throw await me(t,e,r);if(t.headers.get(`X-Bunqueue-Db-Export-Version`)!==`1`)throw new l(`Malformed database export response: unsupported contract version.`,200);if(!/^text\/csv(?:;|$)/i.test(t.headers.get(`Content-Type`)??``))throw new l(`Malformed database export response: expected CSV content.`,200);let a;try{let e=t.headers.get(`X-Bunqueue-Db-Export-Table`);if(!e)throw Error(`missing`);a=decodeURIComponent(e)}catch{throw new l(`Malformed database export response: invalid table identity.`,200)}if(a!==i.table)throw new l(`Database export target changed: requested "${i.table}", received "${a}".`,200);let o=A(t.headers,`X-Bunqueue-Db-Export-Rows`,se),c=A(t.headers,`X-Bunqueue-Db-Export-Bytes`,O,!1);if(A(t.headers,`Content-Length`,16777216,!1)!==c)throw new l(`Malformed database export response: Content-Length does not match X-Bunqueue-Db-Export-Bytes.`,200);let d=t.headers.get(`X-Bunqueue-Db-Export-Cap`);if(d!==`none`&&d!==`rows`&&d!==`bytes`)throw new l(`Malformed database export response: invalid export cap.`,200);if(d===`rows`&&o!==2e5)throw new l(`Malformed database export response: inconsistent row cap.`,200);let f=await fe(t,c,u);return n?.throwIfAborted(),{table:a,content:f,rowCount:o,bytes:c,cap:d===`none`?null:d}}catch(e){throw c.aborted&&!n?.aborted?new l(`Database export timed out`,0):e}}var ge={counts:e=>p(`/queues/${c(e)}/counts`),pause:e=>p(`/queues/${c(e)}/pause`,v(`POST`)),resume:e=>p(`/queues/${c(e)}/resume`,v(`POST`)),drain:e=>p(`/queues/${c(e)}/drain`,b(`POST`),!0,[],y),obliterate:e=>p(`/queues/${c(e)}/obliterate`,b(`POST`),!0,[],y),clean:(e,t={})=>p(`/queues/${c(e)}/clean`,v(`POST`,t)),promoteJobs:(e,t)=>p(`/queues/${c(e)}/promote-jobs`,v(`POST`,t==null?void 0:{count:t})),retryCompleted:(e,t)=>{throw TypeError(`Completed-job requeue is unavailable in Bunqueue v2.8.57 because flow dependency registration is not rebuilt.`)},setRateLimit:(e,t,n,r)=>p(`/queues/${c(e)}/rate-limit`,v(`PUT`,{limit:t,...n===void 0?{}:{duration:n},...r===void 0?{}:{ttl:r}})),clearRateLimit:e=>p(`/queues/${c(e)}/rate-limit`,{method:`DELETE`}),setConcurrency:(e,t)=>p(`/queues/${c(e)}/concurrency`,v(`PUT`,{concurrency:t})),clearConcurrency:e=>p(`/queues/${c(e)}/concurrency`,{method:`DELETE`}),getStallConfig:e=>p(`/queues/${c(e)}/stall-config`),setStallConfig:(e,t)=>p(`/queues/${c(e)}/stall-config`,v(`PUT`,{config:t})),getDlqConfig:e=>p(`/queues/${c(e)}/dlq-config`),setDlqConfig:(e,t)=>{if(t.autoRetry===!0)throw TypeError(`DLQ auto-retry is unavailable: Bunqueue v2.8.57 does not rebuild flow dependency registration.`);if(t.maxAge!==void 0||t.maxEntries!==void 0)throw TypeError(`DLQ retention is read-only: maxAge/maxEntries can destructively expire or evict flow jobs without an atomic dependency check.`);return p(`/queues/${c(e)}/dlq-config`,v(`PUT`,{config:t}))},dlq:(e,t=100,n=0)=>p(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),dlqStats:e=>p(`/queues/${c(e)}/dlq/stats`),retryDlq:(e,t)=>{throw TypeError(`DLQ retry is unavailable in Bunqueue v2.8.57 because the endpoint has no atomic job-generation, state, or flow-topology precondition.`)},purgeDlq:e=>p(`/queues/${c(e)}/dlq/purge`,v(`POST`))},j=()=>encodeURIComponent(t()),_e={limits:(e,t)=>{let n=t===void 0?``:`&maxJobs=${t}`;return _(`/queue-operations/${c(e)}/limits?target=${j()}${n}`)},deduplicationJobId:(e,n)=>_(`/queue-operations/${c(e)}/deduplication?${new URLSearchParams({target:t(),deduplicationId:n})}`),removeDeduplicationKey:(e,t)=>_(`/queue-operations/${c(e)}/deduplication/remove?target=${j()}`,v(`POST`,{deduplicationId:t})),metrics:(e,n,r,i)=>_(`/queue-operations/${c(e)}/metrics?${new URLSearchParams({target:t(),type:n,start:String(r),end:String(i)})}`),trimEvents:(e,t)=>_(`/queue-operations/${c(e)}/events/trim?target=${j()}`,v(`POST`,{maxLength:t}))},M=1e4,ve=1e3,ye=864e13,be=new Set([`job.pushed`,`job.started`,`job.completed`,`job.failed`,`job.progress`,`job.stalled`]);function N(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function P(e,t,n=!1){if(typeof e!=`string`||e.length>t||!n&&e.length===0)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return!1}return!0}function F(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function xe(e){return typeof e==`number`&&Number.isFinite(e)}function I(e){return F(e)&&e<=ye}function Se(e,t){return e===null||P(e,t)}function Ce(e,t,n){if(!Array.isArray(e)||e.length>t)return!1;let r=new Set;for(let t of e){if(!P(t,n)||r.has(t))return!1;r.add(t)}return!0}function L(e,t){let n=N(e),r=n&&N(n.data);if(n?.ok!==!0||!r)throw Error(`Malformed ${t} response.`);return r}function R(e){if(!Array.isArray(e))throw Error(`Malformed queue summary response.`);let t=new Set,n=[];for(let r of e){let e=N(r),i=e&&N(e.counts);if(!e||!P(e.name,256)||t.has(e.name)||typeof e.paused!=`boolean`||!i||!F(i.waiting)||!F(i.prioritized)||!F(i.active)||!F(i.completed)||!F(i.failed)||!F(i.delayed))throw Error(`Malformed queue summary response.`);t.add(e.name),n.push(r)}return n}function z(e){let t=L(e,`workers`);if(!Array.isArray(t.workers)||t.workers.length>M)throw Error(`Malformed workers response.`);let n=new Set,r=[],i=[];for(let e=0;e<t.workers.length;e++){let a=t.workers[e],o=N(a),s=o&&typeof o.id==`string`?o.id:null,c=[];if(o?(P(o.id,1024)?n.has(o.id)&&c.push(`duplicate id`):c.push(`id`),P(o.name,512,!0)||c.push(`name`),Ce(o.queues,ve,256)||c.push(`queues`),(!F(o.concurrency)||o.concurrency<1)&&c.push(`concurrency`),P(o.hostname,512,!0)||c.push(`hostname`),F(o.pid)||c.push(`pid`),o.status!==`active`&&o.status!==`stale`&&c.push(`status`),I(o.registeredAt)||c.push(`registeredAt`),I(o.lastSeen)||c.push(`lastSeen`),F(o.activeJobs)||c.push(`activeJobs`),F(o.processedJobs)||c.push(`processedJobs`),F(o.failedJobs)||c.push(`failedJobs`),Se(o.currentJob,1024)||c.push(`currentJob`),xe(o.uptime)||c.push(`uptime`)):c.push(`entry is not an object`),s&&n.add(s),c.length>0){i.push({index:e,id:s,reason:c.join(`, `)});continue}r.push(a)}return{ok:!0,data:{workers:r,quarantinedWorkers:i,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}function we(e){if(!P(e,2048))return!1;try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function Te(e){let t=L(e,`webhooks`);if(!Array.isArray(t.webhooks)||t.webhooks.length>M)throw Error(`Malformed webhooks response.`);let n=new Set,r=[];for(let e of t.webhooks){let t=N(e);if(!t||!P(t.id,1024)||n.has(t.id)||!we(t.url)||!Array.isArray(t.events)||!t.events.every(e=>be.has(e))||!(t.queue===null||typeof t.queue==`string`)||!I(t.createdAt)||!(t.lastTriggered===null||I(t.lastTriggered))||!F(t.successCount)||!F(t.failureCount)||typeof t.enabled!=`boolean`)throw Error(`Malformed webhooks response.`);n.add(t.id),r.push(e)}return{ok:!0,data:{webhooks:r,...Object.hasOwn(t,`stats`)?{stats:t.stats}:{}}}}var Ee={crons:()=>p(`/crons`),createCron:e=>p(`/crons`,v(`POST`,e)),deleteCron:e=>p(`/crons/${o(e,`Cron name`,256)}`,{method:`DELETE`}),webhooks:async()=>Te(await p(`/webhooks`)),addWebhook:e=>p(`/webhooks`,v(`POST`,e)),removeWebhook:e=>p(`/webhooks/${i(e)}`,{method:`DELETE`}),setWebhookEnabled:(e,t)=>p(`/webhooks/${i(e)}/enabled`,v(`PUT`,{enabled:t})),workers:async()=>z(await p(`/workers`)),unregisterWorker:e=>p(`/workers/${i(e)}`,{method:`DELETE`}),eventsUrl:e=>t()+(e?`/events/queues/${s(e)}`:`/events`)},B=365*24*60*60*1e3,V=64*1024*1024,H=1e4,De=[`childrenIds`,`parentId`,`failParentOnFailure`,`removeDependencyOnFailure`,`continueParentOnFailure`,`ignoreDependencyOnFailure`,`keepLogs`,`sizeLimit`,`debounceId`,`debounceTtl`];function U(e){if(e===void 0)return;if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(`Repeat must be an object with a positive "every" interval`);let t=Object.keys(e).filter(e=>e!==`every`&&e!==`limit`);if(t.length)throw TypeError(`Unsupported repeat option(s): ${t.join(`, `)}. bunqueue v2.8.57 pattern repeats are unsafe; use the Cron API instead.`);if(!Number.isSafeInteger(e.every)||e.every<1||e.every>B)throw TypeError(`Repeat "every" must be a whole number from 1 to ${B} ms`);if(e.limit!==void 0&&(!Number.isSafeInteger(e.limit)||e.limit<1))throw TypeError(`Repeat "limit" must be a whole number of at least 1`)}function W(e){if(e!==void 0&&(typeof e!=`string`||!e||e.length>256))throw TypeError(`Job name must be a non-empty string of at most 256 characters`)}function G(e){let t=e,n=De.filter(e=>t[e]!==void 0);if(n.length)throw TypeError(`Unsupported Bunqueue v2.8.57 enqueue option(s): ${n.join(`, `)}. Flow topology must use the atomic flow API; inert compatibility fields are not sent.`)}function K(e,t){let n=a(t);if(n)throw TypeError(`${e}: ${n}. The job would not be manageable through v2.8.57 HTTP.`)}function Oe(e){if(W(e.name),U(e.repeat),G(e),e.dependsOn!==void 0&&(!Array.isArray(e.dependsOn)||!e.dependsOn.every(e=>typeof e==`string`)))throw TypeError(`dependsOn must be an array of job ID strings`);e.jobId!==void 0&&K(`jobId`,e.jobId);for(let t of e.dependsOn??[])K(`dependsOn`,t)}function ke(e){let t;try{t=JSON.stringify(e)}catch{throw TypeError(`Job payload must be JSON serializable`)}if(t===void 0)throw TypeError(`Job payload must be JSON serializable`);let n;try{n=JSON.parse(t)}catch{throw TypeError(`Job payload encoding failed`)}if(typeof n!=`object`||!n||Array.isArray(n))throw TypeError(`Job payload must serialize to a JSON object`);return Oe(n),t}function Ae({jobId:e,...t}){return e===void 0?t:{...t,customId:e}}function je(e){let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw TypeError(`must serialize to a JSON object`);let n=t;if(n.jobId!==void 0)throw TypeError(`serialized jobId is invalid; the bulk transport requires customId`);if(W(n.name),U(n.repeat),G(n),n.customId!==void 0){if(typeof n.customId!=`string`)throw TypeError(`customId must be a string`);K(`customId`,n.customId)}if(n.dependsOn!==void 0){if(!Array.isArray(n.dependsOn)||!n.dependsOn.every(e=>typeof e==`string`))throw TypeError(`dependsOn must be an array of job ID strings`);for(let e of n.dependsOn)K(`dependsOn`,e)}}function Me(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i<=127?n+=1:i<=2047?n+=2:i>=55296&&i<=56319&&r+1<e.length&&e.charCodeAt(r+1)>=56320&&e.charCodeAt(r+1)<=57343?(n+=4,r+=1):n+=3,n>t)return n}return n}function q(e,t,n){if(!Array.isArray(e)||e.length>1e4)return{ok:!1,error:`Bulk request must contain at most ${H} jobs`};if(!Number.isSafeInteger(t)||t<0)return{ok:!1,error:`Bulk request payload limit is invalid`};let r=11,i=n?Array(e.length):null;for(let a=0;a<e.length;a++){if(a&&(r+=1),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};let o;try{o=JSON.stringify(Ae(e[a]))}catch{return{ok:!1,error:`Bulk request payload must be JSON serializable`}}if(o===void 0)return{ok:!1,error:`Bulk request payload must be JSON serializable`};if(r+=Me(o,t-r),r>t)return{ok:!1,error:`Bulk request payload exceeds the 64 MiB UTF-8 safety limit`};if(n)try{je(o)}catch(e){return{ok:!1,error:`Bulk job ${a+1}: ${e instanceof Error?e.message:String(e)}`}}i&&(i[a]=o)}return{ok:!0,bytes:r,body:i?`{"jobs":[${i.join(`,`)}]}`:void 0}}function Ne(e,t=V){let n=q(e,t,!1);return n.ok?null:n.error}function J(e){let t=q(e,V,!0);if(!t.ok)throw TypeError(t.error);if(t.body===void 0)throw TypeError(`Bulk request payload encoding failed`);return t.body}function Y(e){if(!Array.isArray(e)||e.length>1e4)throw TypeError(`Bulk request must contain at most ${H} jobs`)}var Pe={overview:e=>p(`/dashboard`,e),queues:(e=500,t=0)=>p(`/dashboard/queues?limit=${e}&offset=${t}`),queuesSummary:async()=>R(await p(`/queues/summary`)),queueDetail:(e,t=!0)=>p(`/dashboard/queues/${c(e)}?includeJobs=${t}`),stats:e=>p(`/stats`,e),storage:()=>p(`/storage`,void 0,!1),health:()=>p(`/health`,void 0,!1,[503]),ping:()=>p(`/ping`),prometheusUrl:()=>`${t()}/prometheus`,gc:()=>p(`/gc`,v(`POST`)),heapStats:()=>p(`/heapstats`)},Fe={jobsList:(e,t,n=50,r=0)=>{let i=new URLSearchParams;return t?.length&&i.set(`states`,t.join(`,`)),i.set(`limit`,String(n)),i.set(`offset`,String(r)),p(`/queues/${c(e)}/jobs/list?${i}`)},job:e=>p(`/jobs/${i(e)}`),jobByCustomId:e=>p(`/jobs/custom/${o(e,`Custom job ID`)}`),jobResult:e=>p(`/jobs/${i(e)}/result`),jobLogs:e=>p(`/jobs/${i(e)}/logs`),jobChildren:e=>p(`/jobs/${i(e)}/children`),addJob:async(e,t)=>p(`/queues/${c(e)}/jobs`,{method:`POST`,body:ke(t)}),addJobsBulk:async(e,t)=>(Y(t),p(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:J(t)},!0,[],y)),pullBatch:(e,t)=>p(`/queues/${c(e)}/jobs/pull-batch`,v(`POST`,{count:t})),ackBatch:e=>p(`/jobs/ack-batch`,v(`POST`,{ids:e})),cancelJob:e=>p(`/jobs/${i(e)}`,{method:`DELETE`}),promoteJob:e=>p(`/jobs/${i(e)}/promote`,v(`POST`)),discardJob:e=>p(`/jobs/${i(e)}/discard`,v(`POST`)),retryJob:e=>p(`/jobs/${i(e)}/move-to-wait`,v(`POST`)),failJob:(e,t,n={})=>p(`/jobs/${i(e)}/fail`,v(`POST`,{error:t,...n})),updateJobData:(e,t)=>p(`/jobs/${i(e)}/data`,v(`PUT`,{data:t})),changePriority:(e,t,n)=>p(`/jobs/${i(e)}/priority`,v(`PUT`,{priority:t,...n===void 0?{}:{lifo:n}})),changeDelay:(e,t)=>p(`/jobs/${i(e)}/delay`,v(`PUT`,{delay:t})),moveToDelayed:(e,t)=>p(`/jobs/${i(e)}/move-to-delayed`,v(`POST`,{delay:t})),addJobLog:(e,t,n)=>p(`/jobs/${i(e)}/logs`,v(`POST`,{message:t,level:n})),clearJobLogs:e=>p(`/jobs/${i(e)}/logs`,{method:`DELETE`}),setJobProgress:(e,t,n)=>p(`/jobs/${i(e)}/progress`,v(`POST`,{progress:t,message:n}))};function X(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new l(`Malformed ${t} response.`,200);return e}function Z(e,t){let n=X(e,t);if(n.ok!==!0)throw new l(`Malformed ${t} response.`,200);return n}var Q=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0;function $(e,t){if(e!==void 0)return Z(e,t)}function Ie(e,t){let n={...w(e)},r=(r,i,a=d())=>{let o=t?{...i,signal:i?.signal?AbortSignal.any([i.signal,t]):t}:i;return f(e.baseUrl,r,n,o,!0,`server`,[],a)};return Object.freeze({queuesSummary:async()=>R(await r(`/queues/summary`)),overview:()=>r(`/dashboard`),counts:async e=>{let t=X(Z(await r(`/queues/${c(e)}/counts`),`queue counts`).counts,`queue counts`);if(!Object.values(t).every(Q))throw new l(`Malformed queue counts response.`,200);return{ok:!0,counts:t}},jobsList:async(e,t,n=50,i=0)=>{let a=new URLSearchParams;t?.length&&a.set(`states`,t.join(`,`)),a.set(`limit`,String(n)),a.set(`offset`,String(i));let o=Z(await r(`/queues/${c(e)}/jobs/list?${a}`),`jobs list`);if(!Array.isArray(o.jobs)||!o.jobs.every(t=>{let n=t;return typeof n==`object`&&!!n&&!Array.isArray(n)&&typeof n.id==`string`&&n.id.length>0&&(n.queue===void 0||n.queue===e)}))throw new l(`Malformed jobs list response.`,200);return{ok:!0,jobs:o.jobs}},job:async e=>{let t=X(Z(await r(`/jobs/${i(e)}`),`job`).job,`job`);if(t.id!==e)throw new l(`Malformed job response.`,200);return{ok:!0,job:t}},dlqStats:async e=>{let t=X(Z(await r(`/queues/${c(e)}/dlq/stats`),`DLQ stats`).stats,`DLQ stats`);if(!Q(t.total))throw new l(`Malformed DLQ stats response.`,200);return{ok:!0,stats:t}},dlq:async(e,t=100,n=0)=>{let i=Z(await r(`/queues/${c(e)}/dlq?limit=${t}&offset=${n}`),`DLQ list`);if(!Array.isArray(i.entries)||!Q(i.total))throw new l(`Malformed DLQ list response.`,200);for(let e of i.entries){let t=X(X(e,`DLQ list`).job,`DLQ list`);if(typeof t.id!=`string`||!t.id)throw new l(`Malformed DLQ list response.`,200)}return{ok:!0,entries:i.entries,total:i.total}},health:async()=>X(await f(e.baseUrl,`/health`,n,t?{signal:t}:void 0,!1,`server`,[503]),`health`),stats:async()=>{let e=await r(`/stats`);return X(Z(e,`server stats`).stats,`server stats`),e},workers:async()=>z(await r(`/workers`)),crons:async()=>{let e=Z(await r(`/crons`),`crons`);if(!Array.isArray(e.crons)||!e.crons.every(e=>{let t=e;return typeof t==`object`&&!!t&&!Array.isArray(t)&&typeof t.name==`string`&&!!t.name&&typeof t.queue==`string`&&!!t.queue}))throw new l(`Malformed crons response.`,200);return{ok:!0,crons:e.crons}},addJobsBulk:async(e,t)=>(Y(t),r(`/queues/${c(e)}/jobs/bulk`,{method:`POST`,body:J(t)},y)),pullBatch:(e,t)=>r(`/queues/${c(e)}/jobs/pull-batch`,v(`POST`,{count:t})),heartbeatBatch:e=>r(`/jobs/heartbeat-batch`,v(`POST`,{ids:e})),ackBatch:e=>r(`/jobs/ack-batch`,v(`POST`,{ids:e})),retryJob:e=>r(`/jobs/${i(e)}/move-to-wait`,v(`POST`)),promoteJob:async e=>$(await r(`/jobs/${i(e)}/promote`,v(`POST`)),`promote job`),pause:async e=>$(await r(`/queues/${c(e)}/pause`,v(`POST`)),`pause queue`),resume:async e=>$(await r(`/queues/${c(e)}/resume`,v(`POST`)),`resume queue`),clean:(e,t={})=>r(`/queues/${c(e)}/clean`,v(`POST`,t))})}var Le={...Pe,captureServerRequestTarget:C,createServerTargetClient:Ie,getJobAtTarget:E,captureAgentRequestTarget:te,getDbRowsAtTarget:ue,getDbExportAtTarget:he,...Fe,...ge,queueOperations:_e,...Ee,db:ie,get agentBase(){return ee()},control:ae,workflows:oe};Object.defineProperty(Le,"agentBase",{configurable:!1});export{l as a,C as c,O as i,E as l,Ie as n,_ as o,Ne as r,re as s,Le as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));function u(...e){return e.filter(Boolean).join(` `)}export{l as i,o as n,s as r,u as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CyjgmGTq.js";var n=e(t(),1),r=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},i=(e=>e?r(e):r),a=e=>e;function o(e,t=a){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r}var s=e=>{let t=i(e),n=e=>o(t,e);return Object.assign(n,t),n},c=(e=>e?s(e):s);function l(e,t){let n;try{n=e()}catch{return}return{getItem:e=>{let r=e=>e===null?null:JSON.parse(e,t?.reviver),i=n.getItem(e)??null;return i instanceof Promise?i.then(r):r(i)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,t?.replacer)),removeItem:e=>n.removeItem(e)}}var u=e=>t=>{try{let n=e(t);return n instanceof Promise?n:{then(e){return u(e)(n)},catch(e){return this}}}catch(e){return{then(e){return this},catch(t){return u(t)(e)}}}},d=(e,t)=>(n,r,i)=>{let a={storage:l(()=>window.localStorage),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},o=!1,s=0,c=new Set,d=new Set,f=a.storage;if(!f)return e((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)},r,i);let p=()=>{let e=a.partialize({...r()});return f.setItem(a.name,{state:e,version:a.version})},m=i.setState;i.setState=(e,t)=>(m(e,t),p());let h=e((...e)=>(n(...e),p()),r,i);i.getInitialState=()=>h;let g,_=()=>{if(!f)return;let e=++s;o=!1,c.forEach(e=>e(r()??h));let t=a.onRehydrateStorage?.call(a,r()??h)||void 0;return u(f.getItem.bind(f))(a.name).then(e=>{if(e)if(typeof e.version==`number`&&e.version!==a.version){if(a.migrate){let t=a.migrate(e.state,e.version);return t instanceof Promise?t.then(e=>[!0,e]):[!0,t]}console.error(`State loaded from storage couldn't be migrated since no migrate function was provided`)}else return[!1,e.state];return[!1,void 0]}).then(t=>{if(e!==s)return;let[i,o]=t;if(g=a.merge(o,r()??h),n(g,!0),i)return p()}).then(()=>{e===s&&(t?.(r(),void 0),g=r(),o=!0,d.forEach(e=>e(g)))}).catch(n=>{e===s&&t?.(void 0,n)})};return i.persist={setOptions:e=>{a={...a,...e},e.storage&&(f=e.storage)},clearStorage:()=>{f?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>_(),hasHydrated:()=>o,onHydrate:e=>(c.add(e),()=>{c.delete(e)}),onFinishHydration:e=>(d.add(e),()=>{d.delete(e)})},a.skipHydration||_(),g||h},f=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function p(e,t=!1){try{let n=globalThis.localStorage??null;return!n&&t&&e.reportMissingWrites&&e.onError?.(Error(`localStorage is unavailable`)),n}catch(t){return e.onError?.(t),null}}function m(e,t){try{let n=JSON.parse(e),r=f(n)?n:{},i=t.sanitizeState(`state`in r?r.state:r),a=typeof r.version==`number`?r.version:void 0;return{hydration:JSON.stringify({state:i,...a===void 0?{}:{version:a}}),canonical:JSON.stringify({state:i,version:t.version})}}catch(e){return t.onError?.(e),null}}function h(e){let t=t=>e.onError?.(t);return{getItem(n){let r=p(e);if(!r)return null;let i;try{i=r.getItem(n)}catch(e){return t(e),null}if(i===null||n!==e.key)return i;let a=m(i,e);if(!a){try{r.removeItem(n)}catch(e){t(e)}return null}if(i!==a.canonical)try{r.setItem(n,a.canonical)}catch(e){t(e);try{r.removeItem(n)}catch(e){t(e)}}return a.hydration},setItem(n,r){let i=p(e,!0);if(i)try{i.setItem(n,r)}catch(e){t(e)}},removeItem(n){let r=p(e);if(r)try{r.removeItem(n)}catch(e){t(e)}}}}var g=`bq-dash-connection`,_=2,v=`Use an http(s) URL without credentials, query, or fragment, or a non-root path starting with '/'.`,y=`https://bunqueue-dashboard.invalid`,b=/\s/u;function x(e){return[...e].some(e=>{let t=e.charCodeAt(0);return e===`\\`||b.test(e)||t<32||t===127})}function S(e){if(typeof e!=`string`)return null;let t=e.trim();if(!t||t.includes(`?`)||t.includes(`#`)||x(t))return null;if(t.startsWith(`/`)){if(t.startsWith(`//`))return null;try{let e=new URL(t,y),n=e.pathname.replace(/\/+$/,``);return e.origin!==y||!n||n===`/`||n.startsWith(`//`)?null:n}catch{return null}}let n=t.match(/^https?:\/\//i)?.[0];if(!n)return null;let r=t.slice(n.length).split(`/`,1)[0];if(!r||r.includes(`@`))return null;try{let e=new URL(t);if(e.protocol!==`http:`&&e.protocol!==`https:`||!e.hostname||e.username||e.password)return null;let n=e.pathname.replace(/\/+$/,``);return n.startsWith(`//`)?null:`${e.origin}${n}`}catch{return null}}function C(e){return S(e)??`/api`}var w=C(void 0),T=3e3,E=500,D=6e4;function O(e){return S(e)??w}function k(e){return typeof e!=`number`||!Number.isFinite(e)?T:Math.min(D,Math.max(E,Math.round(e)))}function A(e){return typeof e==`string`?e.trim():``}function j(e){return{baseUrl:O(e.baseUrl),refreshMs:k(e.refreshMs)}}function M(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{baseUrl:O(t.baseUrl),refreshMs:k(t.refreshMs)}}var N=null;function P(e){return e instanceof Error?e:Error(String(e))}function F(e){N=P(e)}function I(){return N?{persisted:!1,error:`${N.name&&N.name!==`Error`?`${N.name}: `:``}${N.message}`}:{persisted:!0}}var L=h({key:g,version:_,sanitizeState:M,onError:F,reportMissingWrites:!0}),R=l(()=>L),z=c()(d(e=>({baseUrl:w,token:``,agentToken:``,refreshMs:T,saveConnection:t=>(N=null,e({baseUrl:O(t.baseUrl),token:A(t.token),agentToken:A(t.agentToken)}),I()),setBaseUrl:t=>e({baseUrl:O(t)}),setToken:t=>e({token:A(t)}),setAgentToken:t=>e({agentToken:A(t)}),setRefreshMs:t=>e({refreshMs:k(t)})}),{name:g,storage:R,version:_,partialize:j,migrate:M,merge:(e,t)=>({...t,...M(e),token:``,agentToken:``})}));function B(){return O(z.getState().baseUrl)}function V(){let e=A(z.getState().token);return e?{Authorization:`Bearer ${e}`}:{}}function H(){let e=A(z.getState().agentToken);return e?{Authorization:`Bearer ${e}`}:{}}export{S as a,l as c,B as i,d as l,H as n,z as o,V as r,h as s,v as t,c as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./cn-zFEt5SO8.js";import{g as t}from"./react-vendor-CyjgmGTq.js";import{o as n}from"./connectionStore-DbBYqHEY.js";var r=e(t(),1),i=0,a=new Set;n.subscribe((e,t)=>{if(!(e.baseUrl===t.baseUrl&&e.token===t.token&&e.agentToken===t.agentToken)){i+=1;for(let e of a)e()}});function o(){return i}function s(){return(0,r.useSyncExternalStore)(c,o,o)}function c(e){return a.add(e),()=>a.delete(e)}export{s as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./cn-zFEt5SO8.js";import{t}from"./react-vendor-CyjgmGTq.js";var n=t();function r({className:t,decorative:r=!1}){let i=e(`inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent`,t);return r?(0,n.jsx)(`span`,{className:i,"aria-hidden":`true`}):(0,n.jsx)(`span`,{className:i,role:`status`,"aria-label":`Loading`})}function i({label:e=`Loading…`}){return(0,n.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`flex items-center justify-center gap-3 py-16 text-sm text-muted`,children:[(0,n.jsx)(r,{decorative:!0}),e]})}function a({icon:e,title:t,hint:r,action:i}){return(0,n.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-line py-14 text-center`,children:[e&&(0,n.jsx)(`div`,{className:`text-faint [&>svg]:size-8`,children:e}),(0,n.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t}),r&&(0,n.jsx)(`div`,{className:`max-w-sm text-xs text-faint`,children:r}),i&&(0,n.jsx)(`div`,{className:`mt-2`,children:i})]})}function o({onRetry:e,message:t=`Could not refresh bunqueue data — the view may be unavailable or stale.`}){return(0,n.jsxs)(`div`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-500/25 bg-amber-500/[0.06] px-4 py-2.5 text-sm`,children:[(0,n.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,n.jsx)(`span`,{className:`text-amber-300/90 light:text-amber-700`,children:t}),e&&(0,n.jsx)(`button`,{type:`button`,onClick:e,className:`ml-auto shrink-0 rounded-md border border-amber-500/30 px-2.5 py-1 text-xs font-medium text-amber-200 light:text-amber-700 hover:border-amber-400/50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`Retry`})]})}function s({error:e,onRetry:t}){return(0,n.jsxs)(`div`,{role:`alert`,"aria-atomic":`true`,className:`flex flex-col items-center justify-center gap-3 rounded-xl border border-red-500/20 bg-red-500/5 py-14 text-center`,children:[(0,n.jsx)(`div`,{className:`text-sm font-medium text-danger`,children:`Something went wrong`}),(0,n.jsx)(`div`,{className:`max-w-md text-xs text-faint`,children:e.message}),t&&(0,n.jsx)(`button`,{type:`button`,onClick:t,className:`mt-1 rounded-lg border border-line bg-surface-2 px-3 py-1.5 text-xs font-medium text-fg hover:border-line-strong focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,children:`Retry`})]})}export{o as i,s as n,i as r,a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as e,t}from"./cn-zFEt5SO8.js";import{g as n,t as r}from"./react-vendor-CyjgmGTq.js";var i=e(n(),1),a=r();function o({children:e,htmlFor:t}){return(0,a.jsx)(`label`,{htmlFor:t,className:`text-[11px] font-medium uppercase tracking-wider text-faint`,children:e})}function s({label:e,hint:t,htmlFor:n,children:r}){let s=(0,i.useId)(),c=r,d=n;if(!n&&(0,i.isValidElement)(r)){let e=r;(typeof e.type==`string`&&[`input`,`select`,`textarea`].includes(e.type)||e.type===l||e.type===u)&&(d=e.props.id??s,c=e.props.id?e:(0,i.cloneElement)(e,{id:s}))}return(0,a.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,a.jsx)(o,{htmlFor:d,children:e}),c,t&&(0,a.jsx)(`p`,{className:`text-xs leading-relaxed text-faint`,children:t})]})}var c=`h-9 rounded-lg border border-line bg-surface-2 px-3 text-sm text-fg placeholder:text-faint transition-colors focus-visible:border-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`;function l({className:e,...n}){return(0,a.jsx)(`input`,{className:t(c,`w-full`,e),...n})}function u({className:e,children:n,...r}){return(0,a.jsx)(`select`,{className:t(c,`w-full cursor-pointer pr-8`,e),...r,children:n})}function d({checked:e,onChange:n,label:r,disabled:i}){return(0,a.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:i,onClick:()=>n(!e),className:t(`relative inline-flex h-6 w-11 items-center rounded-full transition-colors`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,e?`bg-accent`:`bg-surface-2 border border-line`,i&&`opacity-40`),children:(0,a.jsx)(`span`,{className:t(`inline-block size-4 transform rounded-full bg-white shadow transition-transform`,e?`translate-x-6`:`translate-x-1`)})})}function f({options:e,value:n,onChange:r,disabled:i,label:o=`View options`}){return(0,a.jsxs)(`fieldset`,{className:`inline-flex items-center gap-1 rounded-lg border border-line bg-surface p-1`,children:[(0,a.jsx)(`legend`,{className:`sr-only`,children:o}),e.map(e=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":n===e,disabled:i,onClick:()=>r(e),className:t(`rounded-md px-3 py-1 text-xs font-medium capitalize transition-colors`,`focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,n===e?`bg-surface-2 text-fg`:`text-muted hover:text-fg`,i&&`opacity-40`),children:e},e))]})}export{u as a,f as i,l as n,d as o,o as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=new Intl.NumberFormat(`de-DE`),t=new Intl.DateTimeFormat(`it-IT`,{day:`2-digit`,month:`2-digit`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`});function n(t){return t==null||!Number.isFinite(t)?`0`:e.format(t)}function r(e,t=2){return e==null||!Number.isFinite(e)?`0%`:`${(e*100).toFixed(t)}%`}function i(e,t){let n=e+t;return n>0?t/n:null}function a(e){if(e==null||!Number.isFinite(e))return`—`;let n=new Date(e);return Number.isNaN(n.getTime())?`—`:t.format(n)}function o(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=Math.max(0,t-e),r=Math.floor(n/1e3);if(r<60)return`${r}s ago`;let i=Math.floor(r/60);if(i<60)return`${i}m ago`;let a=Math.floor(i/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function s(e){if(e==null||!Number.isFinite(e)||e<0)return`—`;let t=Math.round(e);if(t<1e3)return`${t}ms`;let n=e/1e3;if(n<59.95)return`${n.toFixed(1)}s`;let r=Math.round(n);return`${Math.floor(r/60)}m ${r%60}s`}function c(e,t){if(e==null||t==null)return;let n=t-e;return n>=0?n:void 0}function l(e){if(e==null||!Number.isFinite(e))return`—`;let t=Math.max(0,Math.floor(e)),n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60),a=[];return n&&a.push(`${n}d`),(r||n)&&a.push(`${r}h`),a.push(`${i}m`),a.join(` `)}function u(e){return e==null||!Number.isFinite(e)?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?Number((e/1e3).toFixed(1))>=1e3?`${(e/1e6).toFixed(1)}M`:`${(e/1e3).toFixed(1)}K`:String(Math.round(e))}function d(e){if(e==null||!Number.isFinite(e))return`—`;if(e>=1e3)return`${(e/1e3).toFixed(2)}s`;let t=+(e<10);return Number(e.toFixed(t))>=1e3?`${(e/1e3).toFixed(2)}s`:`${e.toFixed(t)}ms`}var f=/(?:\u001b\[[0-9;?]*[ -/]*[@-~]|\u001b[@-Z\\^_])/g;function p(e){return e.replace(f,``)}function m(e){if(e==null||!Number.isFinite(e))return`—`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return r<t.length-1&&Number(n.toFixed(r===0?0:1))>=1024&&(n/=1024,r++),`${n.toFixed(r===0?0:1)} ${t[r]}`}export{s as a,r as c,c as d,p as f,a as i,o as l,m as n,d as o,u as r,n as s,i as t,l as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./react-vendor-CyjgmGTq.js";var t=e();function n({children:e,...n}){return(0,t.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`24`,height:`24`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.75`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,...n,children:e})}var r=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M3 3v18h18`}),(0,t.jsx)(`rect`,{x:`7`,y:`12`,width:`3`,height:`6`}),(0,t.jsx)(`rect`,{x:`12`,y:`8`,width:`3`,height:`10`}),(0,t.jsx)(`rect`,{x:`17`,y:`5`,width:`3`,height:`13`})]}),i=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,t.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3.01`,y2:`6`}),(0,t.jsx)(`line`,{x1:`3`,y1:`12`,x2:`3.01`,y2:`12`}),(0,t.jsx)(`line`,{x1:`3`,y1:`18`,x2:`3.01`,y2:`18`})]}),a=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`2`,y:`7`,width:`20`,height:`14`,rx:`2`}),(0,t.jsx)(`path`,{d:`M16 7V5a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`})]}),o=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z`}),(0,t.jsx)(`line`,{x1:`12`,y1:`9`,x2:`12`,y2:`13`}),(0,t.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12.01`,y2:`17`})]}),s=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,t.jsx)(`polyline`,{points:`12 7 12 12 15 14`})]}),c=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M3 3v18h18`}),(0,t.jsx)(`path`,{d:`m19 9-5 5-4-4-3 3`})]}),l=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`8`,rx:`2`}),(0,t.jsx)(`rect`,{x:`4`,y:`14`,width:`16`,height:`6`,rx:`2`}),(0,t.jsx)(`line`,{x1:`8`,y1:`8`,x2:`8.01`,y2:`8`}),(0,t.jsx)(`line`,{x1:`8`,y1:`17`,x2:`8.01`,y2:`17`})]}),u=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,t.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]}),d=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`8`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`8`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`8`,y1:`18`,x2:`21`,y2:`18`}),(0,t.jsx)(`path`,{d:`M3 6h.01M3 12h.01M3 18h.01`})]}),f=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M12 20V10`}),(0,t.jsx)(`path`,{d:`M18 20V4`}),(0,t.jsx)(`path`,{d:`M6 20v-4`})]}),p=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`ellipse`,{cx:`12`,cy:`5`,rx:`8`,ry:`3`}),(0,t.jsx)(`path`,{d:`M4 5v6c0 1.66 3.58 3 8 3s8-1.34 8-3V5`}),(0,t.jsx)(`path`,{d:`M4 11v6c0 1.66 3.58 3 8 3s8-1.34 8-3v-6`})]}),m=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`16`,rx:`2`}),(0,t.jsx)(`path`,{d:`M3 10h18`}),(0,t.jsx)(`path`,{d:`M9 10v10`})]}),h=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,t.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z`})]}),g=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,t.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`})]}),_=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79Z`})}),v=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`15 18 9 12 15 6`})}),y=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`9 18 15 12 9 6`})}),b=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})}),x=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`}),(0,t.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`})]}),S=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`polyline`,{points:`3 6 5 6 21 6`}),(0,t.jsx)(`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})]}),C=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`polyline`,{points:`23 4 23 10 17 10`}),(0,t.jsx)(`polyline`,{points:`1 20 1 14 7 14`}),(0,t.jsx)(`path`,{d:`M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15`})]}),w=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,t.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]}),T=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8Z`}),(0,t.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`})]}),E=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polygon`,{points:`13 2 3 14 12 14 11 22 21 10 12 10 13 2`})}),D=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,t.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]}),O=e=>(0,t.jsx)(n,{...e,children:(0,t.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}),k=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,t.jsx)(`polyline`,{points:`12 5 19 12 12 19`})]}),A=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`}),(0,t.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]}),j=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`line`,{x1:`3`,y1:`6`,x2:`21`,y2:`6`}),(0,t.jsx)(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),(0,t.jsx)(`line`,{x1:`3`,y1:`18`,x2:`21`,y2:`18`})]}),M=e=>(0,t.jsxs)(n,{...e,children:[(0,t.jsx)(`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}),(0,t.jsx)(`polyline`,{points:`7 10 12 15 17 10`}),(0,t.jsx)(`line`,{x1:`12`,y1:`15`,x2:`12`,y2:`3`})]});export{l as A,C,g as D,h as E,S as O,i as S,w as T,c as _,y as a,x as b,s as c,M as d,T as f,j as g,d as h,v as i,f as k,m as l,E as m,k as n,D as o,a as p,O as r,A as s,u as t,o as u,_ as v,p as w,b as x,r as y};
|