@lunora/studio 1.0.0-alpha.330 → 1.0.0-alpha.332
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +26 -12
- package/dist/index.d.ts +26 -12
- package/dist/index.mjs +1 -1
- package/dist/mount.mjs +1 -1
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ApiTab.mjs +1 -1
- package/dist/packem_chunks/AuditPanel.mjs +1 -1
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -1
- package/dist/packem_chunks/ExportImportPanel.mjs +6 -3
- package/dist/packem_chunks/FileBrowser.mjs +4 -4
- package/dist/packem_chunks/FunctionRunner.mjs +1 -1
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -1
- package/dist/packem_chunks/HealthPanel.mjs +1 -1
- package/dist/packem_chunks/InsightsPanel.mjs +1 -1
- package/dist/packem_chunks/LogsPanel.mjs +1 -1
- package/dist/packem_chunks/MailPanel.mjs +1 -1
- package/dist/packem_chunks/MetricsPanel.mjs +1 -1
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -1
- package/dist/packem_chunks/PitrPanel.mjs +1 -1
- package/dist/packem_chunks/SchemaViewer.mjs +1 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -1
- package/dist/packem_chunks/SettingsPanel.mjs +1 -1
- package/dist/packem_chunks/SqlEditorPanel.mjs +2 -2
- package/dist/packem_chunks/TableEditor.mjs +1 -1
- package/dist/packem_chunks/agents-panel.mjs +1 -1
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -1
- package/dist/packem_chunks/analytics-panel.mjs +1 -1
- package/dist/packem_chunks/architecture-panel.mjs +1 -1
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -1
- package/dist/packem_chunks/auth-config-panel.mjs +1 -1
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -1
- package/dist/packem_chunks/containers-panel.mjs +1 -1
- package/dist/packem_chunks/dashboards-panel.mjs +1 -1
- package/dist/packem_chunks/evals-panel.mjs +1 -1
- package/dist/packem_chunks/fanout-panel.mjs +1 -1
- package/dist/packem_chunks/flags-panel.mjs +1 -1
- package/dist/packem_chunks/issues-panel.mjs +1 -1
- package/dist/packem_chunks/kv-browser.mjs +1 -1
- package/dist/packem_chunks/log-drains-panel.mjs +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -1
- package/dist/packem_chunks/organizations-panel.mjs +1 -1
- package/dist/packem_chunks/payments-panel.mjs +1 -1
- package/dist/packem_chunks/permissions-panel.mjs +1 -1
- package/dist/packem_chunks/privacy-requests-panel.mjs +1 -1
- package/dist/packem_chunks/queues-panel.mjs +1 -1
- package/dist/packem_chunks/reactors-panel.mjs +1 -1
- package/dist/packem_chunks/rls-panel.mjs +1 -1
- package/dist/packem_chunks/schedule-panel.mjs +1 -1
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -1
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -1
- package/dist/packem_chunks/sync-client-panel.mjs +1 -1
- package/dist/packem_chunks/traces-panel.mjs +1 -1
- package/dist/packem_chunks/users-panel.mjs +1 -1
- package/dist/packem_chunks/vector-browser.mjs +1 -1
- package/dist/packem_chunks/workflows-panel.mjs +1 -1
- package/dist/packem_shared/{ApiDocsPanel-6yZaaxch.mjs → ApiDocsPanel-Py7C4ibM.mjs} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-mwEK_vL7.mjs → ApiReferencePanel-DlYVADAy.mjs} +1 -1
- package/dist/packem_shared/{CommandPalette-CcTVGQvw.mjs → CommandPalette-CM1hqAOD.mjs} +1 -1
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs +1 -0
- package/dist/packem_shared/{DataBrowser-B6xr6S3s.mjs → DataBrowser-DxlLv5x1.mjs} +2 -2
- package/dist/packem_shared/GlobalDataBrowser-TFTQpSVj.mjs +1 -0
- package/dist/packem_shared/{HomePanel-DBUgY2yE.mjs → HomePanel-BVz2sDQ4.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-_H327LDl.mjs → MigrationsPanel-fUyhbt0w.mjs} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-DJg4AbuZ.mjs → OpenRpcReferencePanel-CPIr-u-J.mjs} +1 -1
- package/dist/packem_shared/ScheduledJobs-zSeU_6cN.mjs +1 -0
- package/dist/packem_shared/{Studio-s4EbmwaL.mjs → Studio-CNqMkRmB.mjs} +1 -1
- package/dist/packem_shared/{StudioApp-D1e2uc7_.mjs → StudioApp-BG3kyQ-I.mjs} +1 -1
- package/dist/packem_shared/{advisor-view-kg9uZT7H.mjs → advisor-view-CXiPdw4B.mjs} +1 -1
- package/dist/packem_shared/{data-grid-XIuWrWDy.mjs → data-grid-BHTuvSI7.mjs} +1 -1
- package/dist/packem_shared/{diagram-export-panel-DrYRni_b.mjs → diagram-export-panel-BMLzao0Y.mjs} +1 -1
- package/dist/packem_shared/{error-alert-Dr4RMEID.mjs → error-alert-D-ftqyo-.mjs} +1 -1
- package/dist/packem_shared/{grid-features-6mTvrzgT.mjs → grid-features-CIdZ8Dqo.mjs} +2 -2
- package/dist/packem_shared/{home-panel-CKbpgpz9.mjs → home-panel-CF-MfsnH.mjs} +1 -1
- package/dist/packem_shared/internal-BXEjuLPN.mjs +2 -0
- package/dist/packem_shared/{log-line-DP0b3YT5.mjs → log-line-BWDt_F56.mjs} +1 -1
- package/dist/packem_shared/{recording-client-BbX9ql7w.mjs → recording-client-CFBkH4uZ.mjs} +1 -1
- package/dist/packem_shared/{reference-view-DNdYDPow.mjs → reference-view-BrsL8UGn.mjs} +3 -3
- package/dist/packem_shared/{schema-diagram-DKBYRWsL.mjs → schema-diagram-LRfchcoA.mjs} +1 -1
- package/dist/packem_shared/{sql-result-table-B7g48CHO.mjs → sql-result-table-COsfUSGc.mjs} +1 -1
- package/dist/packem_shared/{studio-BTM7dITm.mjs → studio-BcHsk7mT.mjs} +1 -1
- package/dist/packem_shared/table-list-sidebar-DwqtHSHU.mjs +1 -0
- package/dist/packem_shared/{use-admin-query-B2jU5P5u.mjs → use-admin-query-I1uILsUP.mjs} +1 -1
- package/dist/packem_shared/{use-admin-spec-CISwmdXM.mjs → use-admin-spec-BdNLZbTO.mjs} +1 -1
- package/dist/packem_shared/{use-async-submit-CgvRHgaD.mjs → use-async-submit-2eBBD0-m.mjs} +1 -1
- package/dist/packem_shared/{use-auth-config-B9w5-1-p.mjs → use-auth-config-DQ8tNyBh.mjs} +1 -1
- package/dist/packem_shared/{use-open-trace-CUyoDXjN.mjs → use-open-trace-B_0LbTD7.mjs} +1 -1
- package/dist/packem_shared/{use-sql-assistant-CK6G1ycr.mjs → use-sql-assistant-DetnUyFf.mjs} +1 -1
- package/dist/standalone/chunk-22MSJQDH.js +1 -0
- package/dist/standalone/chunk-2GYGUDJS.js +2 -0
- package/dist/standalone/chunk-34HRTSIP.js +1 -0
- package/dist/standalone/{chunk-A4R7GZQS.js → chunk-3O4QTTSY.js} +3 -3
- package/dist/standalone/{chunk-X472RKFD.js → chunk-4CGBMYO3.js} +3 -3
- package/dist/standalone/chunk-4DPZVEBK.js +1 -0
- package/dist/standalone/{chunk-NA7GP6EE.js → chunk-4NSXTCPY.js} +1 -1
- package/dist/standalone/{chunk-PLVFYL6L.js → chunk-4ZPDCXIA.js} +1 -1
- package/dist/standalone/chunk-5QXC7TAH.js +1 -0
- package/dist/standalone/{chunk-C5KBRXQG.js → chunk-5XSZGYSM.js} +1 -1
- package/dist/standalone/{chunk-3RSD3XAG.js → chunk-5ZCMUHYK.js} +1 -1
- package/dist/standalone/chunk-6UKEJNM5.js +1 -0
- package/dist/standalone/{chunk-5OMZCVRF.js → chunk-74IYYDDI.js} +9 -9
- package/dist/standalone/{chunk-D6ZXOSCM.js → chunk-7FTJLXZH.js} +1 -1
- package/dist/standalone/{chunk-2EYOYWS2.js → chunk-7Q256NLI.js} +1 -1
- package/dist/standalone/{chunk-DQSV2OFA.js → chunk-AH56E26M.js} +1 -1
- package/dist/standalone/{chunk-BPBEVNUM.js → chunk-B3SX5SBI.js} +2 -2
- package/dist/standalone/{chunk-D3HPOVEQ.js → chunk-B475OGG2.js} +1 -1
- package/dist/standalone/{chunk-QBTZMN5E.js → chunk-BDAZK3QX.js} +1 -1
- package/dist/standalone/{chunk-KRVD6WPH.js → chunk-BOGUQHYU.js} +1 -1
- package/dist/standalone/{chunk-DS2DTZFS.js → chunk-CHF23IX6.js} +3 -3
- package/dist/standalone/{chunk-OU56VN3R.js → chunk-CLXX5RVY.js} +1 -1
- package/dist/standalone/{chunk-G3NIGELJ.js → chunk-E75V5AEB.js} +1 -1
- package/dist/standalone/{chunk-2PNG3QHQ.js → chunk-EFXC3EHZ.js} +1 -1
- package/dist/standalone/{chunk-S63L3TCR.js → chunk-ENRGUWYC.js} +1 -1
- package/dist/standalone/{chunk-D746I7ZX.js → chunk-EWMBX5N2.js} +1 -1
- package/dist/standalone/{chunk-ULW7I6FO.js → chunk-F4HMMGVL.js} +1 -1
- package/dist/standalone/{chunk-V3RAWH63.js → chunk-FZJY5QLO.js} +1 -1
- package/dist/standalone/{chunk-K7OJ77CA.js → chunk-G3ZNPPY3.js} +1 -1
- package/dist/standalone/{chunk-X2YHVCMH.js → chunk-GUDC24NJ.js} +1 -1
- package/dist/standalone/{chunk-FCVKROK5.js → chunk-HIJGQX6F.js} +1 -1
- package/dist/standalone/chunk-HQPW3EZF.js +6 -0
- package/dist/standalone/chunk-HXO6YGKL.js +1 -0
- package/dist/standalone/{chunk-AQFI2GWT.js → chunk-IKT6EYHN.js} +1 -1
- package/dist/standalone/{chunk-MRFJSQBZ.js → chunk-IVZT3XO6.js} +1 -1
- package/dist/standalone/chunk-J2OLAMJR.js +1 -0
- package/dist/standalone/{chunk-I5RZUA4J.js → chunk-J4BVPEXN.js} +1 -1
- package/dist/standalone/{chunk-ZBRLJQ46.js → chunk-JKOBTLQU.js} +2 -2
- package/dist/standalone/{chunk-CVPVFONU.js → chunk-JYPEPARL.js} +1 -1
- package/dist/standalone/{chunk-ZQ4C2DMJ.js → chunk-K2EHRNYW.js} +1 -1
- package/dist/standalone/{chunk-SZIEPXZM.js → chunk-K3ST3XOT.js} +1 -1
- package/dist/standalone/{chunk-PDF22AMX.js → chunk-K73JDHTM.js} +1 -1
- package/dist/standalone/{chunk-P6UD4I65.js → chunk-KDF7XOVW.js} +1 -1
- package/dist/standalone/{chunk-CYWRJGWD.js → chunk-LVCMJJQO.js} +1 -1
- package/dist/standalone/{chunk-I23ULEUU.js → chunk-LXCVA5SP.js} +1 -1
- package/dist/standalone/{chunk-WMPXMPVF.js → chunk-M45NNDDU.js} +1 -1
- package/dist/standalone/{chunk-HYKN42SO.js → chunk-MC44447W.js} +1 -1
- package/dist/standalone/{chunk-DXYCOA4Y.js → chunk-NBYAGXMZ.js} +1 -1
- package/dist/standalone/{chunk-WS7WNXF3.js → chunk-NRAAYZ4C.js} +3 -3
- package/dist/standalone/{chunk-TM5C7YPO.js → chunk-NSNRU3CH.js} +1 -1
- package/dist/standalone/{chunk-VASJTDMU.js → chunk-PSMQQV6S.js} +1 -1
- package/dist/standalone/chunk-QMECH2OK.js +1 -0
- package/dist/standalone/{chunk-PH4VNMUO.js → chunk-QMENQICE.js} +1 -1
- package/dist/standalone/{chunk-QJACMRR5.js → chunk-RC6CRS3F.js} +1 -1
- package/dist/standalone/{chunk-LXBSXLLK.js → chunk-RFRFJ6GK.js} +1 -1
- package/dist/standalone/chunk-RNVXXJBN.js +1 -0
- package/dist/standalone/{chunk-YGNPACVK.js → chunk-SHY25BCU.js} +1 -1
- package/dist/standalone/{chunk-J5NS6XO4.js → chunk-T6XTWQC2.js} +1 -1
- package/dist/standalone/{chunk-AFX6YYGP.js → chunk-TBEEPT5P.js} +1 -1
- package/dist/standalone/{chunk-74WMPCOL.js → chunk-TRUA26Q4.js} +1 -1
- package/dist/standalone/{chunk-Y57U7WES.js → chunk-U2ACS5ID.js} +1 -1
- package/dist/standalone/{chunk-2W67FQCF.js → chunk-VDC6JP4A.js} +1 -1
- package/dist/standalone/chunk-VESZYIB4.js +1 -0
- package/dist/standalone/{chunk-MCHTZFX6.js → chunk-VFAP6A6G.js} +1 -1
- package/dist/standalone/{chunk-LSEISHAB.js → chunk-VNBONC2Q.js} +1 -1
- package/dist/standalone/{chunk-OMN44W6V.js → chunk-VQRCJJXS.js} +1 -1
- package/dist/standalone/{chunk-DVX5J34S.js → chunk-W4CQMJH3.js} +1 -1
- package/dist/standalone/{chunk-6XIDYONR.js → chunk-WAJZ4QKG.js} +1 -1
- package/dist/standalone/{chunk-3CBQDJ4S.js → chunk-WDGITBC6.js} +1 -1
- package/dist/standalone/{chunk-2G3B5PAO.js → chunk-WVWCUB4S.js} +1 -1
- package/dist/standalone/{chunk-GPNP4QSZ.js → chunk-X4MAMXRE.js} +1 -1
- package/dist/standalone/chunk-X6XAMP4E.js +7 -0
- package/dist/standalone/{chunk-6B7YJY6X.js → chunk-XDWPHAV6.js} +1 -1
- package/dist/standalone/{chunk-2QXJTBVX.js → chunk-XKISL2CG.js} +1 -1
- package/dist/standalone/chunk-XVE6WFB4.js +1 -0
- package/dist/standalone/chunk-YCQP3TYK.js +5 -0
- package/dist/standalone/chunk-ZBHXISOD.js +1 -0
- package/dist/standalone/{chunk-FBGCQYRO.js → chunk-ZFW3QEVE.js} +1 -1
- package/dist/standalone/{chunk-TSNDFT5D.js → chunk-ZVXBXVS3.js} +1 -1
- package/dist/standalone/{chunk-FGVGIVB6.js → chunk-ZWLIXZWR.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +5 -5
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs +0 -1
- package/dist/packem_shared/GlobalDataBrowser-DlBYI85g.mjs +0 -1
- package/dist/packem_shared/ScheduledJobs-CscRWLW-.mjs +0 -1
- package/dist/packem_shared/internal-S7SDbbPa.mjs +0 -2
- package/dist/packem_shared/table-list-sidebar-DcvrtBkE.mjs +0 -1
- package/dist/standalone/chunk-3ADTLIRI.js +0 -1
- package/dist/standalone/chunk-5LEVE36K.js +0 -1
- package/dist/standalone/chunk-7XYNQ3JS.js +0 -1
- package/dist/standalone/chunk-AJSSEAMP.js +0 -1
- package/dist/standalone/chunk-DSXEICMD.js +0 -1
- package/dist/standalone/chunk-GV2QZP42.js +0 -2
- package/dist/standalone/chunk-GV6O3NPO.js +0 -1
- package/dist/standalone/chunk-GXYXVKOM.js +0 -1
- package/dist/standalone/chunk-HHT7X6VO.js +0 -1
- package/dist/standalone/chunk-HKQSHNFB.js +0 -1
- package/dist/standalone/chunk-JQXA2OYK.js +0 -1
- package/dist/standalone/chunk-KXYSX2SV.js +0 -1
- package/dist/standalone/chunk-NXVOCK3P.js +0 -5
- package/dist/standalone/chunk-PAAYRW3Q.js +0 -9
- package/dist/standalone/chunk-YPY2NU35.js +0 -3
- package/dist/standalone/chunk-YQQTRX55.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as T,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-DU4p72Er.mjs";import{C as P,a as Q}from"./card-By2O8ULa.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-B2jU5P5u.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,h as O,b as U}from"./internal-S7SDbbPa.mjs";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",F=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return F(r)}),[L,j]=T(void 0),[k,w]=T(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{w(void 0),j(F(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=L??d.data,N=k??d.error,A=async r=>{if(C!==void 0){w(void 0);try{await C(r),c||d.refetch()}catch(_){w(U(_))}}},E="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const S=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.workflow??r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(A(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==S||e[13]!==m||e[14]!==h?(g=p("div",{className:E,"data-testid":B,children:[m,h,S]}),e[12]=S,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const f=(t,n,r,i,o)=>{switch(n){case"action":return t.action(r,i,o);case"mutation":return t.mutation(r,i,{...o,onlineOnly:!0});default:return t.query(r,i,o)}},u=t=>({__lunoraRef:t}),d=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},l=t=>t instanceof Error?t.message:String(t),g=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},y=t=>{if(t===null||typeof t!="object"||!("hint"in t))return;const{hint:n}=t;return typeof n=="string"?n:Array.isArray(n)?n.filter(r=>typeof r=="string").join(`
|
|
2
|
-
`):void 0},h=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},e=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i+=1;return`${r.toFixed(1)} ${n[i]??"TB"}`},s=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${e(n.byteLength)}>`:n,p=t=>typeof t=="bigint"?t.toString():t,b=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${e(t.byteLength)}>`:JSON.stringify(t,s)}},c=(t,n)=>{t.catch(r=>{n?.(r)})},a=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},m=t=>{let n=a(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},B=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},w=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{h as a,l as b,u as c,d,y as e,c as f,B as g,w as h,g as i,s as j,b as k,f as l,e as m,p as n,a as r,m as w};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as $}from"react/compiler-runtime";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{k as H,f as L,b as Q}from"./internal-S7SDbbPa.mjs";import{jsx as p,jsxs as S}from"react/jsx-runtime";import{useState as E,useRef as U,useMemo as Y}from"react";import{u as G}from"./use-mirrored-ref-CVDf2z1M.mjs";import{u as J}from"./use-admin-query-B2jU5P5u.mjs";import{ADMIN_FUNCTIONS as K}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{useVirtualizer as Z}from"@tanstack/react-virtual";import{c as X}from"./utils-bhneXptQ.mjs";import{f as ee}from"./virtual-rect-D_j7aLxX.mjs";const te=2166136261,re=16777619,I=(s,e=te)=>{let t=e;for(let r=0;r<s.length;r+=1)t^=s.charCodeAt(r),t=Math.imul(t,re);return(t>>>0).toString(16).padStart(8,"0")},se=/([a-z\d])([A-Z])/gu,ne=/[\s_-]+/u,oe=new Set(["access_token","api_key","apikey","card_number","client_secret","credit_card","cvv","passwd","password","private_key","pwd","refresh_token","secret","ssn","token"]),le=s=>{const e=s.replaceAll(se,"$1 $2").split(ne).map(r=>r.toLowerCase()).filter(r=>r.length>0),t=new Set(e);for(let r=0;r<e.length-1;r+=1){const n=e[r],u=e[r+1];n===void 0||u===void 0||(t.add(`${n}${u}`),t.add(`${n}_${u}`))}return[...t]},V="•••",W=(s,e)=>{try{return e==="redact"?null:e==="hash"?s==null?s:I(typeof s=="bigint"?s.toString():typeof s=="string"?s:JSON.stringify(s)):V}catch{return V}},j=(s,e)=>{const t=new Map;for(const r of s)r.table===e&&t.set(r.column,r.strategy);return t},ae=s=>{for(const e of le(s))if(oe.has(e))return!0;return!1},z=(s,e)=>{const t=e.filter(n=>!s.has(n)&&ae(n));if(t.length===0)return s;const r=new Map(s);for(const n of t)r.set(n,"redact");return r},Ce=(s,e,t)=>{if(!t.enabled)return s;const r=t.columns.get(e);return r===void 0?s:W(s,r)},ce=(s,e)=>{if(!e.enabled||e.columns.size===0)return s;const t={...s};for(const[r,n]of e.columns)r in t&&(t[r]=W(t[r],n));return t},Fe=(s,e)=>!e.enabled||e.columns.size===0?s:s.map(t=>ce(t,e)),B=s=>s==null?"∅":s===""?"(empty)":H(s),ie=s=>{const e=$(32),{column:t,onFacetFilter:r,state:n}=s,u=O();let x;e[0]!==t||e[1]!==r||e[2]!==n.result?.values?(x=c=>{const m=Number(c.currentTarget.dataset.index),k=n.result?.values[m];k!==void 0&&r(t,k.value)},e[0]=t,e[1]=r,e[2]=n.result?.values,e[3]=x):x=e[3];const g=x,o=`db-facet-${t}`;let d;e[4]!==t?(d=p("span",{className:"font-medium text-foreground",children:t}),e[4]=t,e[5]=d):d=e[5];let a;e[6]!==n.loading||e[7]!==n.result||e[8]!==u?(a=n.loading&&n.result===null&&p("span",{className:"text-muted-foreground",children:u("Loading…")}),e[6]=n.loading,e[7]=n.result,e[8]=u,e[9]=a):a=e[9];let l;e[10]!==n.error?(l=n.error!==null&&p("span",{className:"text-destructive",role:"alert",children:n.error}),e[10]=n.error,e[11]=l):l=e[11];let i;e[12]!==n.result?.values?(i=n.result?.values??[],e[12]=n.result?.values,e[13]=i):i=e[13];let f;if(e[14]!==t||e[15]!==g||e[16]!==i){let c;e[18]!==t||e[19]!==g?(c=(m,k)=>S("button",{className:"flex items-center justify-between gap-2 rounded px-1 py-0.5 text-left text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground","data-index":k,"data-testid":`db-facet-value-${t}`,onClick:g,type:"button",children:[p("span",{className:"truncate",children:B(m.value)}),p("span",{className:"shrink-0 tabular-nums text-foreground/70",children:m.count})]},B(m.value)),e[18]=t,e[19]=g,e[20]=c):c=e[20],f=i.map(c),e[14]=t,e[15]=g,e[16]=i,e[17]=f}else f=e[17];let b;e[21]!==t||e[22]!==n.result||e[23]!==u?(b=n.result?.truncated===!0&&p("span",{className:"text-muted-foreground","data-testid":`db-facet-truncated-${t}`,children:u("Showing the {n} most common values.",{n:n.result.values.length})}),e[21]=t,e[22]=n.result,e[23]=u,e[24]=b):b=e[24];let h;return e[25]!==o||e[26]!==d||e[27]!==a||e[28]!==l||e[29]!==f||e[30]!==b?(h=S("section",{className:"flex flex-col gap-1","data-testid":o,children:[d,a,l,f,b]}),e[25]=o,e[26]=d,e[27]=a,e[28]=l,e[29]=f,e[30]=b,e[31]=h):h=e[31],h},_e=s=>{const e=$(44),{columns:t,facets:r,mask:n,onFacetFilter:u,onToggleFacet:x}=s,g=O();let o;e[0]!==x?(o=y=>{const{column:v}=y.currentTarget.dataset;v!==void 0&&x(v)},e[0]=x,e[1]=o):o=e[1];const d=o;let a;e[2]!==n?(a=y=>n.enabled&&n.columns.has(y),e[2]=n,e[3]=a):a=e[3];const l=a;let i,f,b,h,c,m,k,w;if(e[4]!==t||e[5]!==r||e[6]!==l||e[7]!==g||e[8]!==d){w=Symbol.for("react.early_return_sentinel");e:{let y;e[17]!==l?(y=N=>!l(N),e[17]=l,e[18]=y):y=e[18];const v=t.filter(y);let M;if(e[19]!==r||e[20]!==l?(M=Object.entries(r).filter(N=>{const[q]=N;return!l(q)}),e[19]=r,e[20]=l,e[21]=M):M=e[21],i=M,v.length===0){w=null;break e}m="flex w-56 shrink-0 flex-col gap-3 overflow-auto border-l border-border p-3 text-xs",k="db-facets",h="flex flex-col gap-1.5";let T;e[22]!==g?(T=g("Facets"),e[22]=g,e[23]=T):T=e[23],e[24]!==T?(c=p("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:T}),e[24]=T,e[25]=c):c=e[25],f="flex flex-wrap gap-1";let A;e[26]!==r||e[27]!==d?(A=N=>p("button",{"aria-pressed":N in r,className:"rounded border border-border px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent aria-pressed:bg-accent aria-pressed:text-accent-foreground","data-column":N,"data-testid":`db-facet-toggle-${N}`,onClick:d,type:"button",children:N},N),e[26]=r,e[27]=d,e[28]=A):A=e[28],b=v.map(A)}e[4]=t,e[5]=r,e[6]=l,e[7]=g,e[8]=d,e[9]=i,e[10]=f,e[11]=b,e[12]=h,e[13]=c,e[14]=m,e[15]=k,e[16]=w}else i=e[9],f=e[10],b=e[11],h=e[12],c=e[13],m=e[14],k=e[15],w=e[16];if(w!==Symbol.for("react.early_return_sentinel"))return w;let C;e[29]!==f||e[30]!==b?(C=p("div",{className:f,children:b}),e[29]=f,e[30]=b,e[31]=C):C=e[31];let F;e[32]!==C||e[33]!==h||e[34]!==c?(F=S("div",{className:h,children:[c,C]}),e[32]=C,e[33]=h,e[34]=c,e[35]=F):F=e[35];let _;e[36]!==u||e[37]!==i?(_=i.map(y=>{const[v,M]=y;return p(ie,{column:v,onFacetFilter:u,state:M},v)}),e[36]=u,e[37]=i,e[38]=_):_=e[38];let R;return e[39]!==F||e[40]!==_||e[41]!==m||e[42]!==k?(R=S("aside",{className:m,"data-testid":k,children:[F,_]}),e[39]=F,e[40]=_,e[41]=m,e[42]=k,e[43]=R):R=e[43],R},Me=()=>{const[s,e]=E({}),t=G(s),r=U({}),n=async(o,d)=>{const a=(r.current[o]??0)+1;r.current[o]=a,e(l=>o in l?{...l,[o]:{error:null,loading:!0,result:l[o]?.result??null}}:l);try{const l=await d(o);if(r.current[o]!==a)return;e(i=>o in i?{...i,[o]:{error:null,loading:!1,result:l}}:i)}catch(l){if(r.current[o]!==a)return;e(i=>o in i?{...i,[o]:{error:Q(l),loading:!1,result:null}}:i)}};return{clearFacets:()=>{e({})},facets:s,facetsRef:t,refetchFacets:o=>{for(const d of Object.keys(t.current))L(n(d,o))},toggleFacet:(o,d)=>{if(o in t.current){e(a=>Object.fromEntries(Object.entries(a).filter(([l])=>l!==o)));return}e(a=>({...a,[o]:{error:null,loading:!0,result:null}})),d!==null&&L(n(o,d))}}},ue=[],de=()=>{const s=$(1);let e;s[0]===Symbol.for("react.memo_cache_sentinel")?(e={},s[0]=e):e=s[0];const{data:t}=J(K.maskPolicies,e);return Array.isArray(t?.columns)?t.columns:ue},Te=s=>{const e=$(16),{columns:t,selectedTable:r}=s,n=de(),[u,x]=E(!0);let g;e[0]===Symbol.for("react.memo_cache_sentinel")?(g=()=>{x(fe)},e[0]=g):g=e[0];const o=g;let d;if(e[1]!==t||e[2]!==n||e[3]!==r){const h=j(n,r??"");d=z(h,t),e[1]=t,e[2]=n,e[3]=r,e[4]=d}else d=e[4];const a=d;let l;e[5]!==u||e[6]!==n?(l=(h,c)=>({columns:z(j(n,h),c),enabled:u}),e[5]=u,e[6]=n,e[7]=l):l=e[7];const i=l;let f;e[8]!==a||e[9]!==u?(f={columns:a,enabled:u},e[8]=a,e[9]=u,e[10]=f):f=e[10];let b;return e[11]!==a||e[12]!==u||e[13]!==i||e[14]!==f?(b={maskColumns:a,maskOn:u,maskView:f,maskViewFor:i,onToggleMask:o},e[11]=a,e[12]=u,e[13]=i,e[14]=f,e[15]=b):b=e[15],b};function fe(s){return!s}const P=34,D=600,me=s=>{const e=$(21),{item:t,onSelect:r,prefix:n,selected:u,start:x}=s;let g;e[0]!==t.name||e[1]!==r?(g=()=>{r(t.name)},e[0]=t.name,e[1]=r,e[2]=g):g=e[2];const o=g,d=`translateY(${String(x)}px)`;let a;e[3]!==d?(a={insetInline:0,position:"absolute",top:0,transform:d},e[3]=d,e[4]=a):a=e[4];const l=a,i=u?"bg-accent font-medium text-accent-foreground":"text-foreground";let f;e[5]!==i?(f=X("flex w-full items-center justify-between gap-2 rounded-md px-2 py-1.5 text-start text-sm outline-none transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent",i),e[5]=i,e[6]=f):f=e[6];const b=`${n}-table-${t.name}`;let h;e[7]!==t.name?(h=p("span",{className:"truncate",children:t.name}),e[7]=t.name,e[8]=h):h=e[8];let c;e[9]!==t.rowCount?(c=p("span",{className:"shrink-0 rounded bg-muted px-1.5 text-xs tabular-nums text-muted-foreground",children:t.rowCount}),e[9]=t.rowCount,e[10]=c):c=e[10];let m;e[11]!==o||e[12]!==u||e[13]!==f||e[14]!==b||e[15]!==h||e[16]!==c?(m=S("button",{"aria-pressed":u,className:f,"data-testid":b,onClick:o,type:"button",children:[h,c]}),e[11]=o,e[12]=u,e[13]=f,e[14]=b,e[15]=h,e[16]=c,e[17]=m):m=e[17];let k;return e[18]!==l||e[19]!==m?(k=p("li",{style:l,children:m}),e[18]=l,e[19]=m,e[20]=k):k=e[20],k},$e=({header:s,onReload:e,onSelect:t,prefix:r,reloadLabel:n,selected:u,tables:x})=>{const g=O(),[o,d]=E(""),a=U(null),l=c=>{d(c.target.value)},i=Y(()=>{const c=o.trim().toLowerCase();return c===""?x:x.filter(m=>m.name.toLowerCase().includes(c))},[o,x]),b=Z({count:i.length,estimateSize:()=>P,getScrollElement:()=>a.current,initialRect:{height:D,width:240},observeElementRect:(c,m)=>ee(c,m,D),overscan:12}).getVirtualItems(),h={height:i.length*P};return S("aside",{className:"flex h-full w-60 shrink-0 flex-col border-e border-border bg-sidebar","data-testid":`${r}-table-list`,children:[s,S("div",{className:"flex h-9 shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[p("span",{className:"font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:g("Tables")}),e!==void 0&&p("button",{"aria-label":n??g("Refresh"),className:"flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:bg-accent","data-testid":`${r}-load-tables`,onClick:e,title:n??g("Refresh"),type:"button",children:p("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:p("path",{d:"M4 12a8 8 0 0 1 13.7-5.6L20 8M20 4v4h-4M20 12a8 8 0 0 1-13.7 5.6L4 16m0 4v-4h4"})})})]}),p("div",{className:"shrink-0 border-b border-border p-2",children:p("input",{className:"h-7 w-full rounded-md border border-border bg-background px-2 text-xs outline-none placeholder:text-muted-foreground focus-visible:border-ring","data-testid":`${r}-table-search`,onChange:l,placeholder:g("search table…"),type:"search",value:o})}),S("ul",{className:"relative flex-1 overflow-y-auto p-1.5","data-testid":`${r}-table-list-rows`,ref:a,children:[p("li",{"aria-hidden":"true",style:h}),b.map(c=>{const m=i[c.index];return m===void 0?null:p(me,{item:m,onSelect:t,prefix:r,selected:u===m.name,start:c.start},m.name)})]})]})};export{_e as D,$e as T,Te as a,ce as b,Fe as c,Ce as m,Me as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Se}from"./chunk-FPI7AMQJ.js";import{a as $}from"./chunk-37WYCOQ2.js";import{a as Ce}from"./chunk-D746I7ZX.js";import{a as ve}from"./chunk-2EYOYWS2.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as M}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as E}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as F}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ne}from"./chunk-PLVFYL6L.js";import"./chunk-NCPW7WHO.js";import"./chunk-OU56VN3R.js";import"./chunk-55UGUCQ6.js";import{a as X}from"./chunk-4ZEL6BYL.js";import{c as ae}from"./chunk-GXYXVKOM.js";import{d as me,l as oe}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as de}from"./chunk-RWVIV3U7.js";import{a as ke,b as we,c as Pe,d as ce,e as re,f as le}from"./chunk-HCTJKP5J.js";import{a as se,b as fe,c as ue,d as he,e as ne}from"./chunk-2IKDEUCX.js";import{d as V,f as xe,g as ye,h as ge,m as be,p as te}from"./chunk-5OMZCVRF.js";import{a as n,d as ie,e as Re,f as Te,g as Fe}from"./chunk-I26MS5PJ.js";var f=ie(Re(),1);var pe=ie(Te(),1);var t=ie(Fe(),1);var Ie=["read","insert","update","delete"],Ee=n((e,a)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[a],"Ie"),$e=n(e=>e.file===""?e.procedure:`${e.file}:${e.procedure}`,"Re"),ze=n(e=>{let a=new Set;for(let i of e?.advisories??[])if(i.name==="rls_uncovered_table"){let{table:d}=i.metadata;typeof d=="string"&&d!==""&&a.add(d)}return a},"Fe"),De=n((e,a,i)=>{let d=new Map,r=n(s=>{let o=d.get(s);if(o!==void 0)return o;let m={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:s,uncovered:i.has(s)};return d.set(s,m),m},"r");for(let s of e)r(s.table).cells[s.on]={path:$e(s),procedure:s.procedure};for(let s of a)r(s.table).maskedColumns.add(s.column);for(let s of i)r(s);return[...d.values()].toSorted((s,o)=>s.table.localeCompare(o.table))},"Oe"),Oe=n(e=>{let a=(0,pe.c)(17),i;a[0]!==e?(i=e===void 0?{}:e,a[0]=e,a[1]=i):i=a[1];let{onProbe:d}=i,r=V(),s,o;a[2]===Symbol.for("react.memo_cache_sentinel")?(s={},o={live:!0},a[2]=s,a[3]=o):(s=a[2],o=a[3]);let m=ae(X.rlsPolicies,s,o),l;a[4]===Symbol.for("react.memo_cache_sentinel")?(l={},a[4]=l):l=a[4];let g=ae(X.maskPolicies,l),h;a[5]===Symbol.for("react.memo_cache_sentinel")?(h={},a[5]=h):h=a[5];let b=ae(X.getAdvisories,h),v;if(a[6]!==b.data||a[7]!==g.data||a[8]!==d||a[9]!==m||a[10]!==r){let N=null;m.data!==void 0&&(N=Array.isArray(m.data.policies)?m.data.policies:[]);let z=Array.isArray(g.data?.columns)?g.data.columns:[],j=b.data??null,{error:C,errorSource:k,liveError:I}=m,R=N===null?[]:De(N,z,ze(j)),w;a[12]!==I?(w=(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(Ce,{message:I,prefix:"pm"})}),a[12]=I,a[13]=w):w=a[13];let u;a[14]!==C||a[15]!==k?(u=C!==null&&(0,t.jsx)(Ne,{error:k,testId:"pm-error"}),a[14]=C,a[15]=k,a[16]=u):u=a[16],v=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[w,u,N!==null&&R.length===0?(0,t.jsx)(de,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):(0,t.jsxs)(ke,{"data-testid":"pm-table",children:[(0,t.jsx)(we,{children:(0,t.jsxs)(ce,{children:[(0,t.jsx)(re,{children:r("Table")}),Ie.map(p=>(0,t.jsx)(re,{children:Ee(r,p)},p)),(0,t.jsx)(re,{children:r("Masked columns")})]})}),(0,t.jsx)(Pe,{children:R.map(p=>(0,t.jsxs)(ce,{"data-testid":`pm-row-${p.table}`,children:[(0,t.jsx)(le,{className:"font-mono text-xs",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[p.table,p.uncovered&&(0,t.jsx)(F,{"data-testid":`pm-uncovered-${p.table}`,title:r("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:r("Uncovered \u2014 reachable without a policy")})]})}),Ie.map(_=>{let x=p.cells[_];return(0,t.jsx)(le,{"data-testid":`pm-cell-${p.table}-${_}`,children:x.procedure===void 0?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsx)(F,{variant:"secondary",children:r("Covered by {procedure}",{procedure:x.procedure})}),d!==void 0&&(0,t.jsx)(E,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${p.table}-${_}`,onClick:n(()=>{d(p.table,_,x.path??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},_)}),(0,t.jsx)(le,{children:p.maskedColumns.size===0?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)("span",{className:"flex flex-wrap gap-1",children:[...p.maskedColumns].map(Le)})})]},p.table))})]})]}),a[6]=b.data,a[7]=g.data,a[8]=d,a[9]=m,a[10]=r,a[11]=v}else v=a[11];return v},"De");function Le(e){return(0,t.jsx)(F,{variant:"outline",children:e},e)}n(Le,"Le");var je=xe(X.runAs),Me=new Set(["FORBIDDEN","RLS_REQUIRED","UNAUTHORIZED"]),Ue=n(e=>{let a=e?.code;return typeof a=="string"?a:void 0},"Me"),qe=n(()=>{let e=oe();return async({args:a,functionPath:i,shardKey:d="",userId:r})=>{if(r.trim()==="")return{kind:"invalid",message:"No identity to probe: enter the userId whose access you want to test."};let s=je;try{return{kind:"allowed",value:await e.query(s,{args:a,functionPath:i,userId:r},ye(d))}}catch(o){let m=o instanceof Error?o.message:String(o),l=Ue(o);return l!==void 0&&Me.has(l)?{kind:"denied",message:m}:{kind:"errored",message:m}}}},"ze"),We=n(e=>e===void 0?"undefined":JSON.stringify(e,be,2),"je"),Je=n(({functions:e,prefill:a,runAsIdentity:i=!1}={})=>{let d=oe(),r=V(),s=qe(),[o,m]=(0,f.useState)(null),[l,g]=(0,f.useState)(null),h=e??o??[],[b,v]=(0,f.useState)(""),[N,z]=(0,f.useState)("{}"),[j,C]=(0,f.useState)(""),[k,I]=(0,f.useState)(""),[R,w]=(0,f.useState)(!1),[u,p]=(0,f.useState)(null),[_,x]=(0,f.useState)(null),T=(0,f.useRef)(-1),P=(0,f.useRef)(0);(0,f.useEffect)(()=>{if(e!==void 0)return;let c=!1;return d.listFunctions().then(y=>(c||m(y),y)).catch(y=>{c||g(ge(y))}),()=>{c=!0}},[d,e]),(0,f.useEffect)(()=>{if(a===void 0||T.current===a.nonce)return;T.current=a.nonce,P.current+=1;let c=a.functionPath;queueMicrotask(()=>{v(c),p(null)})},[a]);let S=b===""?h[0]?.path??"":b,D=n(async()=>{if(S==="")return;let c;try{c=N.trim()===""?{}:me(JSON.parse(N))}catch(A){x(r("Invalid JSON args: {message}",{message:A.message})),p(null);return}P.current+=1;let y=P.current;x(null),w(!0);try{let A=await s({args:c,functionPath:S,shardKey:j.trim(),userId:k.trim()});y===P.current&&p(A)}finally{w(!1)}},"F"),Q=n(()=>{te(D())},"K"),O=n(c=>{v(c.target.value)},"O"),L=n(c=>{z(c.target.value)},"D"),G=n(c=>{I(c.target.value)},"Y");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[l!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:l}),!i&&(0,t.jsx)(de,{description:r("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:r("Set `runAsIdentity` to forge an identity and probe access.")}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)($,{htmlFor:"pp-function",children:r("Function")}),(0,t.jsx)("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:O,value:S,children:h.map(c=>(0,t.jsxs)("option",{value:c.path,children:[c.path," (",c.kind,")"]},c.path))})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)($,{htmlFor:"pp-args",children:r("Arguments")}),(0,t.jsx)(Se,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:L,value:N})]}),(0,t.jsx)(ve,{onChange:C,testId:"pp-shard",value:j}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)($,{htmlFor:"pp-user",children:r("Run as (userId)")}),(0,t.jsx)(M,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:G,placeholder:r("Required \u2014 the identity to probe as"),value:k})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(E,{"data-testid":"pp-run",disabled:!i||R||S==="",onClick:Q,type:"button",children:r(R?"Probing\u2026":"Run probe")}),k.trim()!==""&&(0,t.jsx)(F,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:k.trim()})})]})]}),_!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:_}),u!==null&&u.kind==="allowed"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,t.jsx)(F,{variant:"secondary",children:r("Allowed")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:We(u.value)})]}),u!==null&&u.kind==="invalid"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-invalid",children:[(0,t.jsx)(F,{variant:"outline",children:r("Not run")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pp-invalid",role:"status",children:u.message})]}),u!==null&&u.kind==="errored"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-errored",children:[(0,t.jsx)(F,{variant:"outline",children:r("Errored")}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:r("The call failed for a reason that is not an access verdict, so it says nothing about the policy.")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-errored",role:"alert",children:u.message})]}),u!==null&&u.kind==="denied"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,t.jsx)(F,{variant:"destructive",children:r("Denied")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:u.message})]})]})},"qe"),Be="/__lunora/policy-scaffold",He={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},Ke=n(async e=>{let a=await fetch(Be,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),i=await a.json();if(i.needsManualEdit===!0)return{kind:"needs-manual-edit",message:i.message??"This change must be made by hand."};if(a.ok)return{diagnostics:i.diagnostics??[],kind:"ok",label:i.fileName??i.exportName??""};let d=i.error;return{kind:"error",message:d===void 0?`policy scaffold failed (${String(a.status)})`:He[d]??d}},"Qe"),_e={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Qe=n(()=>{let e=(0,pe.c)(69),a=V(),[i,d]=(0,f.useState)(null),[r,s]=(0,f.useState)(!1),[o,m]=(0,f.useState)(null),[l,g]=(0,f.useState)(_e),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=n(ee=>{let K=ee.target.name,{value:Y}=ee.target;g(Ae=>({...Ae,[K]:Y}))},"u"),e[0]=h):h=e[0];let b=h,v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v=n(()=>{d(null),g(_e)},"v"),e[1]=v):v=e[1];let N=v,z;e[2]===Symbol.for("react.memo_cache_sentinel")?(z=n(async ee=>{s(!0),m(null);try{let K=await Ke(ee);m(K),K.kind==="ok"&&N()}catch(K){let Y=K;m({kind:"error",message:Y instanceof Error?Y.message:String(Y)})}s(!1)},"R"),e[2]=z):z=e[2];let j=z,C;e[3]!==l.policyName||e[4]!==l.tableName?(C=n(()=>{te(j({kind:"scaffoldPolicy",name:l.policyName.trim(),table:l.tableName.trim()}))},"P"),e[3]=l.policyName,e[4]=l.tableName,e[5]=C):C=e[5];let k=C,I;e[6]!==l.exportName||e[7]!==l.filePath||e[8]!==l.policies?(I=n(()=>{te(j({exportName:l.exportName.trim(),filePath:l.filePath.trim(),kind:"wireRls",policies:l.policies.trim()}))},"A"),e[6]=l.exportName,e[7]=l.filePath,e[8]=l.policies,e[9]=I):I=e[9];let R=I,w;e[10]===Symbol.for("react.memo_cache_sentinel")?(w=n(()=>{m(null),d("scaffold")},"S"),e[10]=w):w=e[10];let u=w,p;e[11]===Symbol.for("react.memo_cache_sentinel")?(p=n(()=>{m(null),d("wire")},"m"),e[11]=p):p=e[11];let _=p,x;e[12]!==a?(x=a("Scaffold access rules"),e[12]=a,e[13]=x):x=e[13];let T;e[14]!==x?(T=(0,t.jsx)(ue,{children:x}),e[14]=x,e[15]=T):T=e[15];let P;e[16]!==a?(P=a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=a,e[17]=P):P=e[17];let S;e[18]!==P?(S=(0,t.jsx)(he,{children:P}),e[18]=P,e[19]=S):S=e[19];let D;e[20]!==S||e[21]!==T?(D=(0,t.jsxs)(fe,{children:[T,S]}),e[20]=S,e[21]=T,e[22]=D):D=e[22];let Q=i==="scaffold"?"default":"outline",O;e[23]!==a?(O=a("New policy file"),e[23]=a,e[24]=O):O=e[24];let L;e[25]!==Q||e[26]!==O?(L=(0,t.jsx)(E,{"data-testid":"policy-scaffolder-new",onClick:u,size:"xs",type:"button",variant:Q,children:O}),e[25]=Q,e[26]=O,e[27]=L):L=e[27];let G=i==="wire"?"default":"outline",c;e[28]!==a?(c=a("Wire into a procedure"),e[28]=a,e[29]=c):c=e[29];let y;e[30]!==G||e[31]!==c?(y=(0,t.jsx)(E,{"data-testid":"policy-scaffolder-wire",onClick:_,size:"xs",type:"button",variant:G,children:c}),e[30]=G,e[31]=c,e[32]=y):y=e[32];let A;e[33]!==L||e[34]!==y?(A=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[L,y]}),e[33]=L,e[34]=y,e[35]=A):A=e[35];let U;e[36]!==r||e[37]!==l.policyName||e[38]!==l.tableName||e[39]!==i||e[40]!==k||e[41]!==a?(U=i==="scaffold"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)($,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:b,value:l.policyName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)($,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:b,value:l.tableName})]}),(0,t.jsx)(E,{"data-testid":"policy-scaffolder-create",disabled:r||l.policyName.trim()===""||l.tableName.trim()==="",onClick:k,size:"xs",type:"button",children:a(r?"Creating\u2026":"Create policy file")}),(0,t.jsx)(E,{onClick:N,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[36]=r,e[37]=l.policyName,e[38]=l.tableName,e[39]=i,e[40]=k,e[41]=a,e[42]=U):U=e[42];let q;e[43]!==r||e[44]!==l.exportName||e[45]!==l.filePath||e[46]!==l.policies||e[47]!==i||e[48]!==R||e[49]!==a?(q=i==="wire"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)($,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:b,value:l.filePath})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)($,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:b,value:l.exportName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)($,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:b,value:l.policies})]}),(0,t.jsx)(E,{"data-testid":"policy-scaffolder-apply",disabled:r||l.filePath.trim()===""||l.exportName.trim()===""||l.policies.trim()==="",onClick:R,size:"xs",type:"button",children:a(r?"Wiring\u2026":"Wire RLS")}),(0,t.jsx)(E,{onClick:N,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[43]=r,e[44]=l.exportName,e[45]=l.filePath,e[46]=l.policies,e[47]=i,e[48]=R,e[49]=a,e[50]=q):q=e[50];let W;e[51]!==o?(W=o?.kind==="error"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:o.message}),e[51]=o,e[52]=W):W=e[52];let J;e[53]!==o?.kind||e[54]!==a?(J=o?.kind==="needs-manual-edit"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),e[53]=o?.kind,e[54]=a,e[55]=J):J=e[55];let B;e[56]!==o||e[57]!==a?(B=o?.kind==="ok"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:o.label})}),o.diagnostics.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:o.diagnostics.map(Ge)})]}),e[56]=o,e[57]=a,e[58]=B):B=e[58];let H;e[59]!==A||e[60]!==U||e[61]!==q||e[62]!==W||e[63]!==J||e[64]!==B?(H=(0,t.jsxs)(ne,{children:[A,U,q,W,J,B]}),e[59]=A,e[60]=U,e[61]=q,e[62]=W,e[63]=J,e[64]=B,e[65]=H):H=e[65];let Z;return e[66]!==D||e[67]!==H?(Z=(0,t.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[D,H]}),e[66]=D,e[67]=H,e[68]=Z):Z=e[68],Z},"He");function Ge(e){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}n(Ge,"Je");var ft=n(({functions:e,runAsIdentity:a=!1,schemaEditable:i=!1}={})=>{let d=V(),[r,s]=(0,f.useState)(void 0),o=n((m,l,g)=>{g!==""&&s(h=>({functionPath:g,nonce:(h?.nonce??0)+1}))},"o");return(0,t.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Permissions")})}),(0,t.jsx)(Oe,{onProbe:o})]}),(0,t.jsx)("section",{className:"flex flex-col gap-3",children:(0,t.jsxs)(se,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d("Probe")})}),(0,t.jsxs)(ne,{className:"px-4 py-4",children:[(0,t.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:d("Pick a function and an identity, then run it to see the access outcome.")}),(0,t.jsx)(Je,{functions:e,prefill:r,runAsIdentity:a})]})]})}),i&&(0,t.jsx)("section",{className:"flex flex-col gap-2",children:(0,t.jsx)(Qe,{})})]})},"ut");export{ft as PermissionsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as H}from"./chunk-OMN44W6V.js";import"./chunk-VASJTDMU.js";import{a as F}from"./chunk-JQXA2OYK.js";import{a as I}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as $}from"./chunk-GXYXVKOM.js";import{l as S}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as B}from"./chunk-RWVIV3U7.js";import{a as L,b as O,c as E,d as k,e as n,f as l}from"./chunk-HCTJKP5J.js";import{a as j,e as z}from"./chunk-2IKDEUCX.js";import{d as C,p as R,t as T}from"./chunk-5OMZCVRF.js";import{a as f,d as y,e as D,f as G,g as J}from"./chunk-I26MS5PJ.js";var P=y(G(),1);var Q=y(D(),1);var s=y(J(),1);var w=200,se=f(()=>{let e=(0,P.c)(28),d=S(),a=C(),[i,q]=(0,Q.useState)(0),p;e[0]!==i?(p=["lunora-auth-sessions",w,i],e[0]=i,e[1]=p):p=e[1];let x;e[2]!==d||e[3]!==i?(x=f(()=>d.listAuthSessions({limit:w,offset:i}),"p"),e[2]=d,e[3]=i,e[4]=x):x=e[4];let r=$(p,x),{error:g}=r,t=r.data?.rows??null,N;e[5]!==r?(N=f(()=>{r.refetch()},"b"),e[5]=r,e[6]=N):N=e[6],F(N,!0);let v;e[7]!==d||e[8]!==r?(v=f(o=>{R((async()=>{await d.revokeAuthSession({sessionId:o}),r.refetch()})())},"g"),e[7]=d,e[8]=r,e[9]=v):v=e[9];let b=v,c;e[10]!==g?(c=g!==null&&(0,s.jsx)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:g}),e[10]=g,e[11]=c):c=e[11];let m;e[12]!==t||e[13]!==a?(m=t!==null&&t.length===0&&(0,s.jsx)(B,{testId:"auth-sessions-empty",title:a("No active sessions.")}),e[12]=t,e[13]=a,e[14]=m):m=e[14];let h;e[15]!==b||e[16]!==t||e[17]!==a?(h=t!==null&&t.length>0&&(0,s.jsx)(j,{className:"overflow-hidden py-0",children:(0,s.jsx)(z,{className:"px-0",children:(0,s.jsxs)(L,{"data-testid":"auth-sessions-table",children:[(0,s.jsx)(O,{children:(0,s.jsxs)(k,{children:[(0,s.jsx)(n,{children:a("user")}),(0,s.jsx)(n,{children:a("expires")}),(0,s.jsx)(n,{children:a("ip")}),(0,s.jsx)(n,{children:a("user agent")}),(0,s.jsx)(n,{children:a("impersonated by")}),(0,s.jsx)(n,{"aria-label":a("Actions")})]})}),(0,s.jsx)(E,{children:t.map(o=>(0,s.jsxs)(k,{"data-testid":`auth-session-${o.id}`,children:[(0,s.jsx)(l,{className:"font-mono text-xs",children:o.userId}),(0,s.jsx)(l,{className:"text-muted-foreground tabular-nums",children:T(o.expiresAt)}),(0,s.jsx)(l,{children:o.ipAddress??""}),(0,s.jsx)(l,{className:"max-w-40 truncate",children:o.userAgent??""}),(0,s.jsx)(l,{className:"font-mono text-xs",children:o.impersonatedBy??""}),(0,s.jsx)(l,{children:(0,s.jsx)(I,{"data-testid":`auth-session-revoke-${o.id}`,onClick:f(()=>{b(o.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:a("Revoke")})})]},o.id))})]})})}),e[15]=b,e[16]=t,e[17]=a,e[18]=h):h=e[18];let u;e[19]!==i||e[20]!==t||e[21]!==r.data?.total?(u=t!==null&&(0,s.jsx)(H,{count:t.length,offset:i,onOffsetChange:q,pageSize:w,prefix:"auth-sessions",total:r.data?.total}),e[19]=i,e[20]=t,e[21]=r.data?.total,e[22]=u):u=e[22];let A;return e[23]!==c||e[24]!==m||e[25]!==h||e[26]!==u?(A=(0,s.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[c,m,h,u]}),e[23]=c,e[24]=m,e[25]=h,e[26]=u,e[27]=A):A=e[27],A},"ee");export{se as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as He}from"./chunk-CGQMJYCW.js";import{a as Se}from"./chunk-37WYCOQ2.js";import{a as Ge}from"./chunk-JQXA2OYK.js";import{a as ze}from"./chunk-I23ULEUU.js";import{i as Ue}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as $e}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Ze}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as qe}from"./chunk-4ZEL6BYL.js";import{l as Ke}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{d as Pe,f as Fe,g as ce,h as Re,i as Oe,p as me}from"./chunk-5OMZCVRF.js";import{a as s,d as Me,e as ot,f as at,g as lt}from"./chunk-I26MS5PJ.js";var Ee=Me(at(),1);var c=Me(ot(),1);var r=Me(lt(),1);var De=Fe(qe.getPitrBookmark),st=Fe(qe.pitrRestore),nt=/^\d+$/u,Je=s(ie=>{let e=ie.trim(),h=nt.test(e)?Number(e):Date.parse(e),l=new Date(h);return Number.isNaN(l.getTime())?void 0:{epochMs:h,iso:l.toISOString()}},"$e"),it=s(ie=>{let e=(0,Ee.c)(9),{text:h}=ie,l=Pe();if(h.trim()==="")return null;let t,o,p;if(e[0]!==l||e[1]!==h){let y=Je(h);t="font-mono text-xs text-muted-foreground",o="pitr-time-resolved",p=y===void 0?l("Not a time \u2014 use epoch-ms or ISO 8601."):l("Resolves to {instant} (a date-time without an offset is read in this browser's time zone; a bare date is UTC)",{instant:y.iso}),e[0]=l,e[1]=h,e[2]=t,e[3]=o,e[4]=p}else t=e[2],o=e[3],p=e[4];let N;return e[5]!==t||e[6]!==o||e[7]!==p?(N=(0,r.jsx)("p",{className:t,"data-testid":o,children:p}),e[5]=t,e[6]=o,e[7]=p,e[8]=N):N=e[8],N},"lt"),vt=s(ie=>{let e=(0,Ee.c)(140),{initialShardKey:h}=ie,l=Ke(),t=Pe(),o=h??"",p=He(o),[N,y]=(0,c.useState)(null),[f,Qe]=(0,c.useState)(""),[ue,je]=(0,c.useState)(null),[m,We]=(0,c.useState)(""),[b,Xe]=(0,c.useState)(!1),[i,Ye]=(0,c.useState)(null),[pe,w]=(0,c.useState)(null),[de,I]=(0,c.useState)(!1),[C,Ve]=(0,c.useState)(!1),he;e[0]!==l||e[1]!==o?(he=s(async a=>{I(!0),w(null);let d;try{d={current:(await l.query(De,{},ce(o))).current,error:null,unavailable:!1}}catch(n){let g=n;d={current:null,error:Re(g),unavailable:Oe(g)==="PITR_UNAVAILABLE"}}a?.aborted!==!0&&(d.error===null?y(d.current):w(d.error),Ve(d.unavailable),I(!1))},"fe"),e[0]=l,e[1]=o,e[2]=he):he=e[2];let x=he,fe,be;e[3]!==x?(fe=s(()=>{let a=new AbortController;return me(x(a.signal)),()=>{a.abort()}},"ue"),be=[x],e[3]=x,e[4]=fe,e[5]=be):(fe=e[4],be=e[5]),(0,c.useEffect)(fe,be);let xe;e[6]!==l||e[7]!==o?(xe=s(()=>{me((async()=>{try{let a=await l.query(De,{},ce(o));y(a.current)}catch{}})())},"he"),e[6]=l,e[7]=o,e[8]=xe):xe=e[8],Ge(xe,!C);let ke;e[9]===Symbol.for("react.memo_cache_sentinel")?(ke=s(a=>{Qe(a.target.value)},"be"),e[9]=ke):ke=e[9];let et=ke,Ne;e[10]===Symbol.for("react.memo_cache_sentinel")?(Ne=s(a=>{We(a.target.value)},"xe"),e[10]=Ne):Ne=e[10];let tt=Ne,ve;e[11]===Symbol.for("react.memo_cache_sentinel")?(ve=s(a=>{Xe(a.target.checked)},"ke"),e[11]=ve):ve=e[11];let rt=ve,ge,R,u,k,v,ye;if(e[12]!==m||e[13]!==l||e[14]!==ue||e[15]!==x||e[16]!==o||e[17]!==p||e[18]!==t||e[19]!==f){u=Je(f),R=s(()=>{if(u===void 0)return;let d=o;me((async()=>{I(!0),w(null);let n;try{n={result:await l.query(De,{time:u.epochMs},ce(d))}}catch(g){n={error:Re(g)}}p.current===d&&("result"in n?(je(n.result.forTime===void 0?null:{bookmark:n.result.forTime,shard:d}),y(n.result.current)):(je(null),w(n.error)),I(!1))})())},"C"),v=ue?.shard===o?ue.bookmark:null;let a;e[26]!==l||e[27]!==x||e[28]!==o?(a=s(d=>{me((async()=>{I(!0),w(null);try{let n=await l.mutation(st,d,ce(o));Ye(n),await x()}catch(n){let g=n;w(Re(g)),Oe(g)==="PITR_UNAVAILABLE"&&Ve(!0)}I(!1)})())},"o"),e[26]=l,e[27]=x,e[28]=o,e[29]=a):a=e[29],k=a,ge=m.trim()!==""||u!==void 0,ye=t("Restore {shard} to {target}?",{shard:o===""?t("root"):o,target:m.trim()===""?u?.iso??"":t("the given bookmark")}),e[12]=m,e[13]=l,e[14]=ue,e[15]=x,e[16]=o,e[17]=p,e[18]=t,e[19]=f,e[20]=ge,e[21]=R,e[22]=u,e[23]=k,e[24]=v,e[25]=ye}else ge=e[20],R=e[21],u=e[22],k=e[23],v=e[24],ye=e[25];let Te=ye,we;e[30]!==m||e[31]!==u?.epochMs||e[32]!==b||e[33]!==k?(we=s(()=>{let a=b?{restart:!0}:{};m.trim()===""?a.time=u?.epochMs:a.bookmark=m.trim(),k(a)},"Ne"),e[30]=m,e[31]=u?.epochMs,e[32]=b,e[33]=k,e[34]=we):we=e[34];let Be=we,Ie;e[35]!==b||e[36]!==i||e[37]!==k?(Ie=s(()=>{i!==null&&k(b?{bookmark:i.undoBookmark,restart:!0}:{bookmark:i.undoBookmark})},"ye"),e[35]=b,e[36]=i,e[37]=k,e[38]=Ie):Ie=e[38];let Ae=Ie,S;e[39]!==t?(S=t("Shard"),e[39]=t,e[40]=S):S=e[40];let T;e[41]!==o||e[42]!==t?(T=o===""?t("root"):o,e[41]=o,e[42]=t,e[43]=T):T=e[43];let B;e[44]!==T?(B=(0,r.jsx)("span",{className:"font-mono",children:T}),e[44]=T,e[45]=B):B=e[45];let A;e[46]!==S||e[47]!==B?(A=(0,r.jsx)("div",{className:"flex flex-wrap items-center gap-3",children:(0,r.jsxs)("span",{className:"text-xs text-muted-foreground",children:[S,": ",B]})}),e[46]=S,e[47]=B,e[48]=A):A=e[48];let _;e[49]!==t?(_=t("In-place recovery to any moment in the last 30 days. For older or portable recovery, use the snapshot backup tier."),e[49]=t,e[50]=_):_=e[50];let L;e[51]!==_?(L=(0,r.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"pitr-note",children:_}),e[51]=_,e[52]=L):L=e[52];let M;e[53]!==pe?(M=pe!==null&&(0,r.jsx)("p",{className:"text-sm text-destructive","data-testid":"pitr-error",role:"alert",children:pe}),e[53]=pe,e[54]=M):M=e[54];let P;e[55]!==t?(P=t("Current bookmark"),e[55]=t,e[56]=P):P=e[56];let U;e[57]!==P?(U=(0,r.jsx)("h3",{className:"mb-2 text-sm font-semibold",children:P}),e[57]=P,e[58]=U):U=e[58];let F;e[59]!==N?(F=N??(0,r.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),e[59]=N,e[60]=F):F=e[60];let O;e[61]!==F?(O=(0,r.jsx)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-current",children:F}),e[61]=F,e[62]=O):O=e[62];let q;e[63]!==U||e[64]!==O?(q=(0,r.jsxs)("section",{className:"rounded-xl border border-border bg-card p-3 shadow-xs",children:[U,O]}),e[63]=U,e[64]=O,e[65]=q):q=e[65];let z;e[66]!==t?(z=t("Restore"),e[66]=t,e[67]=z):z=e[67];let D;e[68]!==z?(D=(0,r.jsx)("h3",{className:"text-sm font-semibold",children:z}),e[68]=z,e[69]=D):D=e[69];let E;e[70]!==t?(E=t("Time (ISO or epoch-ms, last 30 days)"),e[70]=t,e[71]=E):E=e[71];let j;e[72]!==E?(j=(0,r.jsx)(Se,{htmlFor:"pitr-time",children:E}),e[72]=E,e[73]=j):j=e[73];let V;e[74]!==f?(V=(0,r.jsx)(Ue,{"data-testid":"pitr-time",id:"pitr-time",onChange:et,placeholder:"2026-06-01T00:00:00.000Z",value:f}),e[74]=f,e[75]=V):V=e[75];let _e=de||C||u===void 0,K;e[76]!==t?(K=t("Preview"),e[76]=t,e[77]=K):K=e[77];let Z;e[78]!==R||e[79]!==_e||e[80]!==K?(Z=(0,r.jsx)($e,{"data-testid":"pitr-preview",disabled:_e,onClick:R,size:"sm",type:"button",variant:"outline",children:K}),e[78]=R,e[79]=_e,e[80]=K,e[81]=Z):Z=e[81];let $;e[82]!==V||e[83]!==Z?($=(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[V,Z]}),e[82]=V,e[83]=Z,e[84]=$):$=e[84];let G;e[85]!==f?(G=(0,r.jsx)(it,{text:f}),e[85]=f,e[86]=G):G=e[86];let H;e[87]!==v||e[88]!==t?(H=v!==null&&(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-preview-bookmark",children:[t("Bookmark for that time"),": ",v]}),e[87]=v,e[88]=t,e[89]=H):H=e[89];let J;e[90]!==j||e[91]!==$||e[92]!==G||e[93]!==H?(J=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[j,$,G,H]}),e[90]=j,e[91]=$,e[92]=G,e[93]=H,e[94]=J):J=e[94];let Q;e[95]!==t?(Q=t("Or an explicit bookmark (wins over time)"),e[95]=t,e[96]=Q):Q=e[96];let W;e[97]!==Q?(W=(0,r.jsx)(Se,{htmlFor:"pitr-bookmark",children:Q}),e[97]=Q,e[98]=W):W=e[98];let X;e[99]!==t?(X=t("bookmark string"),e[99]=t,e[100]=X):X=e[100];let Y;e[101]!==m||e[102]!==X?(Y=(0,r.jsx)(Ue,{"data-testid":"pitr-bookmark",id:"pitr-bookmark",onChange:tt,placeholder:X,value:m}),e[101]=m,e[102]=X,e[103]=Y):Y=e[103];let ee;e[104]!==W||e[105]!==Y?(ee=(0,r.jsxs)("div",{className:"flex flex-col gap-1",children:[W,Y]}),e[104]=W,e[105]=Y,e[106]=ee):ee=e[106];let te;e[107]!==b?(te=(0,r.jsx)("input",{checked:b,className:"size-4 accent-primary","data-testid":"pitr-restart",id:"pitr-restart",onChange:rt,type:"checkbox"}),e[107]=b,e[108]=te):te=e[108];let re;e[109]!==t?(re=t("Restart the shard now so recovery applies immediately"),e[109]=t,e[110]=re):re=e[110];let oe;e[111]!==te||e[112]!==re?(oe=(0,r.jsxs)(Se,{className:"flex items-center gap-2 text-xs font-normal text-muted-foreground",htmlFor:"pitr-restart",children:[te,re]}),e[111]=te,e[112]=re,e[113]=oe):oe=e[113];let Le=de||C||!ge,ae;e[114]!==t?(ae=t("Restore"),e[114]=t,e[115]=ae):ae=e[115];let le;e[116]!==Te||e[117]!==Be||e[118]!==Le||e[119]!==ae?(le=(0,r.jsx)("div",{children:(0,r.jsx)(ze,{confirmLabel:Te,disabled:Le,onConfirm:Be,testId:"pitr-restore",children:ae})}),e[116]=Te,e[117]=Be,e[118]=Le,e[119]=ae,e[120]=le):le=e[120];let se;e[121]!==D||e[122]!==J||e[123]!==ee||e[124]!==oe||e[125]!==le?(se=(0,r.jsxs)("section",{className:"flex flex-col gap-3 rounded-xl border border-border bg-card p-3 shadow-xs",children:[D,J,ee,oe,le]}),e[121]=D,e[122]=J,e[123]=ee,e[124]=oe,e[125]=le,e[126]=se):se=e[126];let ne;e[127]!==de||e[128]!==Ae||e[129]!==i||e[130]!==t||e[131]!==C?(ne=i!==null&&(0,r.jsxs)("section",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card p-3 shadow-xs","data-testid":"pitr-result",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold",children:t("Restore armed")}),(0,r.jsx)(Ze,{variant:i.restarted?"destructive":"secondary",children:i.restarted?t("restarted now"):t("on next restart")})]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground",children:[t("Restored to"),": ",i.restoredTo]}),(0,r.jsxs)("p",{className:"font-mono text-xs break-all text-muted-foreground","data-testid":"pitr-undo-bookmark",children:[t("Undo bookmark"),": ",i.undoBookmark]}),(0,r.jsx)("div",{children:(0,r.jsx)(ze,{confirmLabel:t("Confirm undo"),disabled:de||C,onConfirm:Ae,testId:"pitr-undo",children:t("Undo restore")})})]}),e[127]=de,e[128]=Ae,e[129]=i,e[130]=t,e[131]=C,e[132]=ne):ne=e[132];let Ce;return e[133]!==A||e[134]!==L||e[135]!==M||e[136]!==q||e[137]!==se||e[138]!==ne?(Ce=(0,r.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-pitr",children:[A,L,M,q,se,ne]}),e[133]=A,e[134]=L,e[135]=M,e[136]=q,e[137]=se,e[138]=ne,e[139]=Ce):Ce=e[139],Ce},"Nt");export{vt as PitrPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Y}from"./chunk-FPI7AMQJ.js";import{a as A}from"./chunk-37WYCOQ2.js";import{a as X}from"./chunk-2EYOYWS2.js";import{b as Q}from"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import{i as U}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as w}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as j}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as H}from"./chunk-4ZEL6BYL.js";import{c as O,d as D,l as E}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{d as M,e as P,f as W,h as I,m as q,p as V,t as G}from"./chunk-5OMZCVRF.js";import{a as o,d as K,e as fe,g as pe}from"./chunk-I26MS5PJ.js";var u=K(fe(),1);var n=K(pe(),1);var he=o(t=>t.kind==="id"?t.table===void 0?"id":`id<${t.table}>`:t.kind==="array"?t.element===void 0?"array":`${t.element}[]`:t.kind,"fe"),me=o(t=>t===void 0||t.length===0?"()":`(${t.map(e=>`${e.name}${e.optional?"?":""}: ${he(e)}`).join(", ")})`,"pe"),ge=o(t=>{switch(t){case"array":return[];case"bigint":return O(0n);case"boolean":return!1;case"bytes":return O(new ArrayBuffer(0));case"number":return 0;case"object":case"record":return{};default:return""}},"he"),xe=o(t=>{let e={};for(let r of t??[])r.optional||(e[r.name]=ge(r.kind));return JSON.stringify(e,void 0,2)},"me"),be=W(H.runAs),m="\xABsensitive\xBB",ye=o(t=>(t??[]).filter(e=>e.sensitive===!0).map(e=>e.name),"be"),ve=o((t,e)=>{if(e.length===0)return t;try{let r=JSON.parse(t);if(typeof r!="object"||r===null||Array.isArray(r))return"";let l={...r};for(let i of e)Object.hasOwn(l,i)&&(l[i]=m);return JSON.stringify(l,null,2)}catch{return""}},"xe"),Ne=4,we=o(t=>{let e=t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength);try{return new TextDecoder("utf-8",{fatal:!0}).decode(e)}catch{return}},"ve"),Ae=o(t=>Array.isArray(t)?[]:Object.keys(t).filter(e=>e.length>0),"Ne"),Se=o(t=>{let e=[],r=new Set,l=[t];for(;l.length>0;){let i=l.pop();if(typeof i=="string")i.length>0&&e.push(i);else if(typeof i=="number"||typeof i=="bigint")e.push(String(i));else if(i instanceof ArrayBuffer||ArrayBuffer.isView(i)){let d=we(i);d!==void 0&&d.length>0&&e.push(d)}else typeof i=="object"&&i!==null&&!r.has(i)&&(r.add(i),e.push(...Ae(i)),l.push(...Object.values(i)))}return e},"Ae"),$e=o((t,e)=>{let r=[],l=new Set,i=[[t,e]];for(;i.length>0;){let[d,s]=i.pop()??[void 0,void 0];typeof s=="boolean"?r.push({key:d,text:s?"true":"false"}):typeof s=="object"&&s!==null&&!l.has(s)&&(l.add(s),Array.isArray(s)?i.push(...s.map(p=>[void 0,p])):i.push(...Object.entries(s)))}return r},"Se"),ee=o(t=>t.replaceAll(/[$()*+.?[\\\]^{|}]/gu,String.raw`\$&`),"z"),ke=o((t,e)=>e.length>=Ne?t.replaceAll(e,m):t.replaceAll(new RegExp(`(?<![A-Za-z0-9])${ee(e)}(?![A-Za-z0-9])`,"gu"),m),"we"),Oe=o((t,e)=>{let r=t.replaceAll(`"${e.text}"`,m);if(e.key===void 0)return r;let l=ee(e.key);return r.replaceAll(new RegExp(`(?<![A-Za-z0-9_])${l}=${e.text}(?![A-Za-z0-9_])`,"gu"),`${e.key}=${m}`).replaceAll(new RegExp(String.raw`"${l}":\s*${e.text}(?![A-Za-z0-9_])`,"gu"),`"${e.key}":${m}`)},"Re"),je=o((t,e,r)=>{if(r.length===0||typeof e!="object"||e===null)return t;let l=r.flatMap(s=>$e(s,e[s])),i=r.flatMap(s=>Se(e[s])).flatMap(s=>{let p=JSON.stringify(s).slice(1,-1);return p===s?[s]:[s,p]}).toSorted((s,p)=>p.length-s.length),d=t;for(let s of l)d=Oe(d,s);for(let s of i)d=ke(d,s);return d},"ke"),Ie=10,Re=o(t=>t===void 0?"undefined":JSON.stringify(t,q,2),"$e"),Fe=o((t,e)=>[{argsText:ve(e.argsText,e.sensitive),at:Date.now(),id:(t[0]?.id??0)+1,kind:e.selected.kind,path:e.selected.path,redacted:e.sensitive.length>0,shardKey:e.shardKey,status:e.runStatus},...t].slice(0,Ie),"Ie"),Ue=o(({functions:t,runAsIdentity:e=!1}={})=>{let r=M(),l=E(),[i,d]=(0,u.useState)(null),[s,p]=(0,u.useState)(null),S=t??i??[],[R,F]=(0,u.useState)(""),[b,$]=(0,u.useState)("{}"),[g,C]=(0,u.useState)(""),[y,te]=(0,u.useState)(""),[k,x]=(0,u.useState)("idle"),[re,v]=(0,u.useState)(void 0),[T,N]=(0,u.useState)(null),[z,ae]=(0,u.useState)([]);(0,u.useEffect)(()=>{if(t!==void 0)return;let a=!1;return l.listFunctions().then(f=>(a||d(f),f)).catch(f=>{a||p(I(f))}),()=>{a=!0}},[l,t]);let J=R===""?S[0]?.path??"":R,c=S.find(a=>a.path===J),ne=o(async()=>{if(!c)return;let a;try{a=b.trim()===""?{}:D(JSON.parse(b))}catch(h){x("error"),v(void 0),N(r("Invalid JSON args: {message}",{message:h.message}));return}let f={__lunoraRef:c.path},B=g.trim()===""?{}:{shardKey:g.trim()},L=e?y.trim():"",Z=ye(c.args),_=o(h=>{ae(ue=>Fe(ue,{argsText:b,runStatus:h,selected:c,sensitive:Z,shardKey:g}))},"L");x("running"),N(null);try{let h=L===""?await P(l,c.kind,f,a,B):await l.query(be,{args:a,functionPath:c.path,userId:L},B);Q(g),v(h),x("success"),_("success")}catch(h){v(void 0),N(je(I(h),a,Z)),x("error"),_("error")}},"Z"),se=o(a=>{if(F(a.path),C(a.shardKey),a.redacted){v(void 0),N(r("Re-enter the sensitive values before running this again.")),x("error");return}$(a.argsText)},"P"),ie=o(a=>{F(a.target.value)},"H"),oe=o(a=>{$(a.target.value)},"q"),le=o(a=>{te(a.target.value)},"G"),de=o(()=>{V(ne())},"W"),ce=o(()=>{$(xe(c?.args))},"X");return(0,n.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[s!==null&&(0,n.jsx)("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:s}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsx)(A,{htmlFor:"function-select",children:r("Function")}),(0,n.jsx)("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:ie,value:J,children:S.map(a=>(0,n.jsxs)("option",{value:a.path,children:[a.path," (",a.kind,")"]},a.path))}),c!==void 0&&(0,n.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,n.jsx)("span",{className:"mr-1.5 font-medium",children:r("Signature")}),(0,n.jsx)("code",{className:"font-mono","data-testid":"function-signature",children:me(c.args)})]})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,n.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,n.jsx)(A,{htmlFor:"args-input",children:r("Arguments")}),(0,n.jsx)(w,{"data-testid":"prefill-button",disabled:c===void 0,onClick:ce,size:"xs",type:"button",variant:"ghost",children:r("Prefill")})]}),(0,n.jsx)(Y,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:oe,value:b})]}),(0,n.jsx)(X,{onChange:C,testId:"shard-input",value:g}),e&&(0,n.jsxs)("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[(0,n.jsx)(A,{htmlFor:"run-as-input",children:r("Run as identity (userId)")}),(0,n.jsx)(U,{"aria-label":r("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:le,placeholder:r("Leave empty to run as admin"),value:y}),(0,n.jsx)("p",{className:"text-[11px] text-muted-foreground",children:r("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,n.jsx)(w,{"data-testid":"run-button",disabled:k==="running"||c===void 0,onClick:de,type:"button",children:r("Run")}),c!==void 0&&(0,n.jsx)(j,{variant:"outline",children:c.kind}),e&&y.trim()!==""&&(0,n.jsx)(j,{"data-testid":"run-as-badge",variant:"secondary",children:r("as {userId}",{userId:y.trim()})})]})]}),k==="error"&&T!==null&&(0,n.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:T}),k==="success"&&(0,n.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:Re(re)}),z.length>0&&(0,n.jsx)("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:z.map((a,f)=>(0,n.jsxs)("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[(0,n.jsx)("span",{className:a.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${f.toString()}`,children:a.status==="success"?"\u2713":"\u2717"})," ",(0,n.jsxs)("span",{className:"font-mono text-xs",children:[a.path," (",a.kind,")"]})," ",(0,n.jsx)("time",{className:"text-xs text-muted-foreground",children:G(a.at)})," ",(0,n.jsx)(w,{className:"ml-auto","data-testid":`fn-history-load-${f.toString()}`,onClick:o(()=>{se(a)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Load")})]},a.id))})]})},"Ze");export{Ue as FunctionRunner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as q}from"./chunk-JQXA2OYK.js";import{a as F}from"./chunk-R6U22RSY.js";import{a as D}from"./chunk-2EYOYWS2.js";import"./chunk-ZKJS6EBE.js";import"./chunk-RGMVGZV4.js";import"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import"./chunk-AUAECCXB.js";import{b as S}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as L}from"./chunk-PLVFYL6L.js";import"./chunk-NCPW7WHO.js";import"./chunk-OU56VN3R.js";import"./chunk-55UGUCQ6.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as _}from"./chunk-GXYXVKOM.js";import"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as $}from"./chunk-RWVIV3U7.js";import{a as O,b as P,c as W,d as C,e as h,f as p}from"./chunk-HCTJKP5J.js";import{a as M,e as T}from"./chunk-2IKDEUCX.js";import{d as A,m as E}from"./chunk-5OMZCVRF.js";import{a as N,d as j,f as H,g as U}from"./chunk-I26MS5PJ.js";var R=j(H(),1);var t=j(U(),1);var J=80,Z=N(a=>{if(a===void 0)return"";let e=JSON.stringify(a,E);return e.length>J?`${e.slice(0,J)}\u2026`:e},"G"),z=N(a=>{let e=[];for(let r of a){let n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((l,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:l})})}return e},"J"),w=(0,t.jsx)("span",{className:"text-muted-foreground",children:"\u2014"}),ce=N(a=>{let e=(0,R.c)(22),{initialShardKey:r}=a,n=A(),{queryShardKey:l,setShardKey:i,shardKey:m}=F(r),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f={},e[0]=f):f=e[0];let b;e[1]!==l?(b={keepPreviousData:!0,shardKey:l},e[1]=l,e[2]=b):b=e[2];let{data:s,error:o,errorSource:u,refetch:G}=_(B.listSubscriptions,f,b);q(G,!0);let x;if(e[3]!==o||e[4]!==u||e[5]!==s||e[6]!==i||e[7]!==m||e[8]!==n){let k=s===void 0?[]:z(s.connections),c;e[10]!==i||e[11]!==m?(c=(0,t.jsx)(D,{onChange:i,testId:"subs-shard-input",value:m}),e[10]=i,e[11]=m,e[12]=c):c=e[12];let d;e[13]!==s||e[14]!==n?(d=s!==void 0&&(0,t.jsxs)("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[(0,t.jsx)(S,{variant:"secondary",children:n("{count} connections",{count:s.totalConnections})}),(0,t.jsx)(S,{variant:"secondary",children:n("{count} subscriptions",{count:s.totalSubscriptions})})]}),e[13]=s,e[14]=n,e[15]=d):d=e[15];let g;e[16]!==c||e[17]!==d?(g=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[c,d]}),e[16]=c,e[17]=d,e[18]=g):g=e[18];let v;e[19]!==o||e[20]!==u?(v=o!==null&&(0,t.jsx)(L,{error:u,testId:"subs-error"}),e[19]=o,e[20]=u,e[21]=v):v=e[21],x=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,v,o===null&&s!==void 0&&k.length===0&&(0,t.jsx)($,{description:n("Active WebSocket subscriptions on this shard."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),o===null&&k.length>0&&(0,t.jsx)(M,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(O,{"data-testid":"subs-table",children:[(0,t.jsx)(P,{children:(0,t.jsxs)(C,{children:[(0,t.jsx)(h,{children:n("Connection")}),(0,t.jsx)(h,{children:n("Function path")}),(0,t.jsx)(h,{children:n("Table")}),(0,t.jsx)(h,{children:n("Arguments")})]})}),(0,t.jsx)(W,{children:k.map(y=>{let{subscription:I}=y,K=Z(I?.args);return(0,t.jsxs)(C,{"data-testid":"subs-row",children:[(0,t.jsx)(p,{className:"font-medium tabular-nums",children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&(0,t.jsx)(S,{variant:"outline",children:n("admin")})]})}),(0,t.jsx)(p,{className:"font-mono text-xs",children:I?.functionPath??w}),(0,t.jsx)(p,{children:I?.table??w}),(0,t.jsx)(p,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:K||void 0,children:K||w})]},y.key)})})]})})})]}),e[3]=o,e[4]=u,e[5]=s,e[6]=i,e[7]=m,e[8]=n,e[9]=x}else x=e[9];return x},"ae");export{ce as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as fe}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as ie}from"./chunk-Y3AYVFTK.js";import{a as pe}from"./chunk-JQXA2OYK.js";import"./chunk-UC7MNI2F.js";import{i as de}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as b}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as ne}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as he}from"./chunk-PLVFYL6L.js";import"./chunk-NCPW7WHO.js";import"./chunk-OU56VN3R.js";import"./chunk-55UGUCQ6.js";import{a as B}from"./chunk-4ZEL6BYL.js";import{c as ue}from"./chunk-GXYXVKOM.js";import{l as le}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as ce}from"./chunk-RWVIV3U7.js";import{d as oe,f as Z,g as ee,h as te,p as ae,s as me,t as re}from"./chunk-5OMZCVRF.js";import{a as i,d as Y,e as ge,f as ve,g as Ne,i as se}from"./chunk-I26MS5PJ.js";var t=Y(Ne(),1);var be=Y(ve(),1);var N=Y(ge(),1);function ye({className:a,orientation:e="horizontal",...s}){return(0,t.jsx)(ie,{"data-slot":"separator",orientation:e,className:se("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",a),...s})}i(ye,"ge");var we=/https?:\/\/[^\s"'<>)]+/i,xe=i(a=>a===void 0?void 0:we.exec(a)?.[0],"re"),y=i(a=>a===void 0?"":Array.isArray(a)?a.join(", "):a,"N"),Ce=/<a\s(?:[^>]*?\s)?href\s*=\s*["'](https?:\/\/[^"'\s]+)["']/iu,ke=/&(?:amp|#0*38|#x0*26);/giu,Se=i(a=>a===void 0?void 0:((a.html===void 0?void 0:Ce.exec(a.html)?.[1])??xe(a.text)??xe(a.html))?.replaceAll(ke,"&"),"ye"),Te=i((a,e)=>{let s=e.trim().toLowerCase();return s===""?a:a.filter(o=>`${o.subject} ${y(o.to)} ${y(o.cc)}`.toLowerCase().includes(s))},"Ce"),Le=i((a,e)=>{if(a.length!==0)return a.find(s=>s.id===e)??a[0]},"Se"),je=Z(B.clearCapturedMail),Me=Z(B.sendTestMail),_e=i(a=>{let e=(0,be.c)(38),{limit:s}=a,o=le(),p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];let{data:q,error:w,errorSource:C,isLoading:g,refetch:n}=ue(B.getCapturedMail,p),[k,f]=(0,N.useState)(null),[P,S]=(0,N.useState)(null),[v,l]=(0,N.useState)("html"),[c,D]=(0,N.useState)(""),x=q?.entries??[],r=w??k,u=w===null?k:C,T;e[2]!==o||e[3]!==n?(T=i(async()=>{f(null);try{await o.query(je,{},ee("")),S(null),n()}catch(m){f(te(m))}},"T"),e[2]=o,e[3]=n,e[4]=T):T=e[4];let Q=T,L;e[5]!==o||e[6]!==n?(L=i(async()=>{f(null);try{await o.query(Me,{},ee("")),n()}catch(m){f(te(m))}},"k"),e[5]=o,e[6]=n,e[7]=L):L=e[7];let R=L,j;e[8]!==n?(j=i(()=>{n()},"A"),e[8]=n,e[9]=j):j=e[9],pe(j,!0);let M;e[10]!==Q?(M=i(()=>{ae(Q())},"E"),e[10]=Q,e[11]=M):M=e[11];let U=M,_;e[12]!==R?(_=i(()=>{ae(R())},"L"),e[12]=R,e[13]=_):_=e[13];let W=_,z;e[14]===Symbol.for("react.memo_cache_sentinel")?(z=i(m=>{D(m.currentTarget.value)},"_"),e[14]=z):z=e[14];let G=z,$;e[15]===Symbol.for("react.memo_cache_sentinel")?($=i(m=>{let{id:h}=m.currentTarget.dataset;h!==void 0&&S(h)},"M"),e[15]=$):$=e[15];let J=$,A;e[16]===Symbol.for("react.memo_cache_sentinel")?(A=i(m=>{let h=m.currentTarget.dataset.tab;(h==="headers"||h==="html"||h==="text")&&l(h)},"I"),e[16]=A):A=e[16];let K=A,O=Te(x,c),F=Le(O,P),d=Se(F),E;e[17]!==d?(E=i(()=>{d!==void 0&&me(d)},"z"),e[17]=d,e[18]=E):E=e[18];let V=E,H;e[19]!==d?(H=i(()=>{d!==void 0&&"window"in globalThis&&globalThis.window.open(d,"_blank","noopener")},"F"),e[19]=d,e[20]=H):H=e[20];let X=H,I;return e[21]!==x||e[22]!==r||e[23]!==u||e[24]!==c||e[25]!==g||e[26]!==d||e[27]!==U||e[28]!==V||e[29]!==G||e[30]!==X||e[31]!==J||e[32]!==K||e[33]!==W||e[34]!==F||e[35]!==v||e[36]!==O?(I={entries:x,error:r,errorSource:u,filter:c,isLoading:g,link:d,onClear:U,onCopyLink:V,onFilterChange:G,onOpenLink:X,onSelectMessage:J,onSelectTab:K,onSendTest:W,selected:F,tab:v,visible:O},e[21]=x,e[22]=r,e[23]=u,e[24]=c,e[25]=g,e[26]=d,e[27]=U,e[28]=V,e[29]=G,e[30]=X,e[31]=J,e[32]=K,e[33]=W,e[34]=F,e[35]=v,e[36]=O,e[37]=I):I=e[37],I},"Ae"),ze=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,$e=i(a=>`${ze}${a}`,"Le"),Ke=i(({limit:a=100})=>{let e=oe(),{entries:s,error:o,errorSource:p,filter:q,isLoading:w,link:C,onClear:g,onCopyLink:n,onFilterChange:k,onOpenLink:f,onSelectMessage:P,onSelectTab:S,onSendTest:v,selected:l,tab:c,visible:D}=_e({limit:a}),x=i(r=>e(r==="html"?"HTML":r==="text"?"Plain text":"Headers"),"x");return(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(b,{"data-testid":"mail-send-test",onClick:v,size:"sm",type:"button",variant:"outline",children:e("Send test")}),(0,t.jsx)(b,{"data-testid":"mail-clear",disabled:s.length===0,onClick:g,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&(0,t.jsx)(ne,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&(0,t.jsx)(he,{error:p,testId:"mail-error"}),o===null&&!w&&s.length===0&&(0,t.jsx)(ce,{description:e("Email your app sends in dev is captured here \u2014 nothing is delivered."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("path",{d:"M4 5h16v14H4z"}),(0,t.jsx)("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(de,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:k,placeholder:e("Filter messages"),type:"search",value:q}),(0,t.jsx)(fe,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:(0,t.jsx)("ul",{className:"divide-y",children:D.map(r=>{let u=r.id===l?.id;return(0,t.jsx)("li",{children:(0,t.jsxs)("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${u?"bg-muted":""}`,"data-active":u,"data-id":r.id,"data-testid":"mail-list-item",onClick:P,type:"button",children:[(0,t.jsx)("span",{className:"w-full truncate font-medium",children:r.subject||e("(no subject)")}),(0,t.jsx)("span",{className:"w-full truncate text-xs text-muted-foreground",children:y(r.to)}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums",children:re(r.capturedAt,"\u2014")})]})},r.id)})})})]}),l!==void 0&&(0,t.jsxs)("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:l.subject||e("(no subject)")}),(0,t.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[(0,t.jsx)("dt",{children:e("From")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:l.from??"\u2014"}),(0,t.jsx)("dt",{children:e("To")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.to)}),l.cc!==void 0&&l.cc.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("dt",{children:e("Cc")}),(0,t.jsx)("dd",{className:"truncate font-mono",children:y(l.cc)})]}),(0,t.jsx)("dt",{children:e("Sent")}),(0,t.jsx)("dd",{className:"tabular-nums",children:re(l.capturedAt,"\u2014")})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[(0,t.jsx)(b,{"data-testid":"mail-copy-link",disabled:C===void 0,onClick:n,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),(0,t.jsx)(b,{"data-testid":"mail-open-link",disabled:C===void 0,onClick:f,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),(0,t.jsx)(ye,{}),(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(r=>(0,t.jsx)(b,{"aria-selected":c===r,"data-tab":r,"data-testid":`mail-tab-${r}`,onClick:S,role:"tab",size:"sm",type:"button",variant:c===r?"secondary":"ghost",children:x(r)},r))}),(0,t.jsxs)("div",{className:"min-h-[12rem]",children:[c==="html"&&(l.html===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):(0,t.jsx)("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:$e(l.html),title:e("Email preview")})),c==="text"&&(l.text===void 0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:l.text})),c==="headers"&&(l.headers===void 0||Object.keys(l.headers).length===0?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):(0,t.jsx)("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(l.headers).map(([r,u])=>`${r}: ${u}`).join(`
|
|
2
|
-
`)}))]})]})]})]})},"Qe");export{Ke as MailPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as wt}from"./chunk-FPI7AMQJ.js";import{a as Tt}from"./chunk-3RSD3XAG.js";import{a as se}from"./chunk-2G3B5PAO.js";import{a as $t}from"./chunk-QJLHH3ET.js";import{a as Ot}from"./chunk-37WYCOQ2.js";import{a as zt,b as _t}from"./chunk-OMN44W6V.js";import"./chunk-VASJTDMU.js";import{a as kt}from"./chunk-JQXA2OYK.js";import{i as V}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as j}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import"./chunk-BOMPSVRC.js";import{b as ge}from"./chunk-GXYXVKOM.js";import{l as oe}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as ue}from"./chunk-RWVIV3U7.js";import{a as Ct,b as It,c as xt,d as Ve,e as me,f as de}from"./chunk-HCTJKP5J.js";import{a as vt,e as yt}from"./chunk-2IKDEUCX.js";import{d as Q,h as Nt,o as A,p as At,t as Dt}from"./chunk-5OMZCVRF.js";import{a as c,d as pt,e as Jt,f as Ut,g as Ht}from"./chunk-I26MS5PJ.js";var H=pt(Ut(),1);var F=pt(Jt(),1);var a=pt(Ht(),1);var Lt=c(t=>{let e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},"Tt"),Kt=c(t=>{let e=Lt(t),r={};for(let[d,h]of Object.entries(e)){if(!Array.isArray(h)||h.some(i=>typeof i!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);r[d]=h}return r},"Qt"),Pt=c(t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),"$t"),G=c(t=>{let e=(0,H.c)(6),{children:r,htmlFor:d,label:h}=t,i;e[0]!==d||e[1]!==h?(i=(0,a.jsx)(Ot,{htmlFor:d,children:h}),e[0]=d,e[1]=h,e[2]=i):i=e[2];let o;return e[3]!==r||e[4]!==i?(o=(0,a.jsxs)("div",{className:"flex flex-col gap-1",children:[i,r]}),e[3]=r,e[4]=i,e[5]=o):o=e[5],o},"V"),ce=c(({busy:t,canSubmit:e,children:r,destructive:d=!1,error:h,onClose:i,onSubmit:o,submitLabel:l,testId:n,title:m})=>{let s=Q();return(0,a.jsxs)($t,{label:m,onClose:i,panelTestId:`${n}-panel`,testId:`${n}-overlay`,variant:"dialog",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:m}),r,h!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":`${n}-error`,role:"alert",children:h}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,a.jsx)(j,{"data-testid":`${n}-cancel`,onClick:i,size:"sm",type:"button",variant:"outline",children:s("Cancel")}),(0,a.jsx)(j,{"data-testid":`${n}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?s("Saving\u2026"):l})]})]})},"me"),Rt=c(t=>{let e=(0,H.c)(79),{mode:r,onClose:d,onDone:h,org:i}=t,o=oe(),l=Q(),{busy:n,error:m,run:s}=se(),f;e[0]!==i?(f=i?A(i.name):"",e[0]=i,e[1]=f):f=e[1];let[u,b]=(0,F.useState)(f),v;e[2]!==i?(v=i?A(i.slug):"",e[2]=i,e[3]=v):v=e[3];let[g,p]=(0,F.useState)(v),k;e[4]!==i?(k=i?A(i.logo):"",e[4]=i,e[5]=k):k=e[5];let[y,I]=(0,F.useState)(k),[C,w]=(0,F.useState)(""),x;e[6]!==r||e[7]!==i?.metadata?(x=r==="edit"?Pt(i?.metadata):"",e[6]=r,e[7]=i?.metadata,e[8]=x):x=e[8];let[z,N]=(0,F.useState)(x),_;e[9]!==o||e[10]!==y||e[11]!==z||e[12]!==r||e[13]!==u||e[14]!==d||e[15]!==h||e[16]!==i?.id||e[17]!==C||e[18]!==s||e[19]!==g?(_=c(()=>{s(async()=>{let S=z.trim()===""?void 0:Lt(z);r==="create"?await o.createAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim(),ownerId:C.trim()===""?void 0:C.trim(),slug:g.trim()===""?void 0:g.trim()}):await o.updateAuthOrganization({logo:y.trim()===""?void 0:y.trim(),metadata:S,name:u.trim()===""?void 0:u.trim(),organizationId:A(i?.id),slug:g.trim()===""?void 0:g.trim()}),h(),d()})},"O"),e[9]=o,e[10]=y,e[11]=z,e[12]=r,e[13]=u,e[14]=d,e[15]=h,e[16]=i?.id,e[17]=C,e[18]=s,e[19]=g,e[20]=_):_=e[20];let D=_,O;e[21]!==r||e[22]!==u?(O=u.trim()!==""||r==="edit",e[21]=r,e[22]=u,e[23]=O):O=e[23];let T;e[24]!==r||e[25]!==l?(T=l(r==="create"?"Create":"Save"),e[24]=r,e[25]=l,e[26]=T):T=e[26];let $;e[27]!==r||e[28]!==l?($=l(r==="create"?"New organization":"Edit organization"),e[27]=r,e[28]=l,e[29]=$):$=e[29];let E;e[30]!==l?(E=l("name"),e[30]=l,e[31]=E):E=e[31];let Z;e[32]===Symbol.for("react.memo_cache_sentinel")?(Z=c(S=>{b(S.target.value)},"H"),e[32]=Z):Z=e[32];let B;e[33]!==u?(B=(0,a.jsx)(V,{"data-testid":"org-form-name",id:"org-form-name",onChange:Z,value:u}),e[33]=u,e[34]=B):B=e[34];let K;e[35]!==B||e[36]!==E?(K=(0,a.jsx)(G,{htmlFor:"org-form-name",label:E,children:B}),e[35]=B,e[36]=E,e[37]=K):K=e[37];let J;e[38]!==l?(J=l("Slug (optional \u2014 derived from name)"),e[38]=l,e[39]=J):J=e[39];let P;e[40]===Symbol.for("react.memo_cache_sentinel")?(P=c(S=>{p(S.target.value)},"P"),e[40]=P):P=e[40];let U;e[41]!==g?(U=(0,a.jsx)(V,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:P,value:g}),e[41]=g,e[42]=U):U=e[42];let L;e[43]!==J||e[44]!==U?(L=(0,a.jsx)(G,{htmlFor:"org-form-slug",label:J,children:U}),e[43]=J,e[44]=U,e[45]=L):L=e[45];let Y;e[46]!==l?(Y=l("Logo URL (optional)"),e[46]=l,e[47]=Y):Y=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=c(S=>{I(S.target.value)},"M"),e[48]=M):M=e[48];let R;e[49]!==y?(R=(0,a.jsx)(V,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:y}),e[49]=y,e[50]=R):R=e[50];let q;e[51]!==Y||e[52]!==R?(q=(0,a.jsx)(G,{htmlFor:"org-form-logo",label:Y,children:R}),e[51]=Y,e[52]=R,e[53]=q):q=e[53];let W;e[54]!==r||e[55]!==C||e[56]!==l?(W=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-form-owner",label:l("Owner user id (optional)"),children:(0,a.jsx)(V,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:c(S=>{w(S.target.value)},"onChange"),value:C})}),e[54]=r,e[55]=C,e[56]=l,e[57]=W):W=e[57];let te;e[58]!==l?(te=l("Metadata (JSON, optional)"),e[58]=l,e[59]=te):te=e[59];let ae;e[60]===Symbol.for("react.memo_cache_sentinel")?(ae=c(S=>{N(S.target.value)},"oe"),e[60]=ae):ae=e[60];let re;e[61]!==z?(re=(0,a.jsx)(wt,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:ae,value:z}),e[61]=z,e[62]=re):re=e[62];let ee;e[63]!==te||e[64]!==re?(ee=(0,a.jsx)(G,{htmlFor:"org-form-metadata",label:te,children:re}),e[63]=te,e[64]=re,e[65]=ee):ee=e[65];let le;return e[66]!==n||e[67]!==m||e[68]!==d||e[69]!==D||e[70]!==K||e[71]!==L||e[72]!==q||e[73]!==W||e[74]!==ee||e[75]!==O||e[76]!==T||e[77]!==$?(le=(0,a.jsxs)(ce,{busy:n,canSubmit:O,error:m,onClose:d,onSubmit:D,submitLabel:T,testId:"org-form",title:$,children:[K,L,q,W,ee]}),e[66]=n,e[67]=m,e[68]=d,e[69]=D,e[70]=K,e[71]=L,e[72]=q,e[73]=W,e[74]=ee,e[75]=O,e[76]=T,e[77]=$,e[78]=le):le=e[78],le},"yt"),Qt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==h||e[4]!==u||e[5]!==m||e[6]!==s?(v=c(()=>{m(async()=>{await i.addAuthOrgMember({organizationId:h,role:u.trim()===""?void 0:u.trim(),userId:s.trim()}),d(),r()})},"p"),e[0]=i,e[1]=r,e[2]=d,e[3]=h,e[4]=u,e[5]=m,e[6]=s,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Add member"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Add member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("User id"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:w,value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-add-member-user",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-add-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-add-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Jt"),Zt=c(t=>{let e=(0,H.c)(40),{onClose:r,onDone:d,organizationId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),[u,b]=(0,F.useState)(""),v;e[0]!==i||e[1]!==s||e[2]!==r||e[3]!==d||e[4]!==h||e[5]!==u||e[6]!==m?(v=c(()=>{m(async()=>{await i.inviteAuthOrgMember({email:s.trim(),organizationId:h,role:u.trim()===""?void 0:u.trim()}),d(),r()})},"p"),e[0]=i,e[1]=s,e[2]=r,e[3]=d,e[4]=h,e[5]=u,e[6]=m,e[7]=v):v=e[7];let g=v,p;e[8]!==s?(p=s.trim(),e[8]=s,e[9]=p):p=e[9];let k=p!=="",y;e[10]!==o?(y=o("Send invitation"),e[10]=o,e[11]=y):y=e[11];let I;e[12]!==o?(I=o("Invite member"),e[12]=o,e[13]=I):I=e[13];let C;e[14]!==o?(C=o("email"),e[14]=o,e[15]=C):C=e[15];let w;e[16]===Symbol.for("react.memo_cache_sentinel")?(w=c($=>{f($.target.value)},"I"),e[16]=w):w=e[16];let x;e[17]!==s?(x=(0,a.jsx)(V,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:w,type:"email",value:s}),e[17]=s,e[18]=x):x=e[18];let z;e[19]!==C||e[20]!==x?(z=(0,a.jsx)(G,{htmlFor:"org-invite-member-email",label:C,children:x}),e[19]=C,e[20]=x,e[21]=z):z=e[21];let N;e[22]!==o?(N=o("Role (optional)"),e[22]=o,e[23]=N):N=e[23];let _;e[24]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{b($.target.value)},"O"),e[24]=_):_=e[24];let D;e[25]!==u?(D=(0,a.jsx)(V,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:_,value:u}),e[25]=u,e[26]=D):D=e[26];let O;e[27]!==N||e[28]!==D?(O=(0,a.jsx)(G,{htmlFor:"org-invite-member-role",label:N,children:D}),e[27]=N,e[28]=D,e[29]=O):O=e[29];let T;return e[30]!==l||e[31]!==n||e[32]!==r||e[33]!==g||e[34]!==O||e[35]!==k||e[36]!==y||e[37]!==I||e[38]!==z?(T=(0,a.jsxs)(ce,{busy:l,canSubmit:k,error:n,onClose:r,onSubmit:g,submitLabel:y,testId:"org-invite-member",title:I,children:[z,O]}),e[30]=l,e[31]=n,e[32]=r,e[33]=g,e[34]=O,e[35]=k,e[36]=y,e[37]=I,e[38]=z,e[39]=T):T=e[39],T},"Ut"),Yt=c(t=>{let e=(0,H.c)(32),{member:r,onClose:d,onDone:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),s;e[0]!==r.role?(s=c(()=>A(r.role),"a"),e[0]=r.role,e[1]=s):s=e[1];let[f,u]=(0,F.useState)(s),b;e[2]!==i||e[3]!==r.id||e[4]!==d||e[5]!==h||e[6]!==f||e[7]!==m?(b=c(()=>{m(async()=>{await i.setAuthOrgMemberRole({memberId:A(r.id),role:f.trim()}),h(),d()})},"g"),e[2]=i,e[3]=r.id,e[4]=d,e[5]=h,e[6]=f,e[7]=m,e[8]=b):b=e[8];let v=b,g;e[9]!==f?(g=f.trim(),e[9]=f,e[10]=g):g=e[10];let p=g!=="",k;e[11]!==o?(k=o("Save"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("Change member role"),e[13]=o,e[14]=y):y=e[14];let I;e[15]!==o?(I=o("Role"),e[15]=o,e[16]=I):I=e[16];let C;e[17]===Symbol.for("react.memo_cache_sentinel")?(C=c(N=>{u(N.target.value)},"y"),e[17]=C):C=e[17];let w;e[18]!==f?(w=(0,a.jsx)(V,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:C,value:f}),e[18]=f,e[19]=w):w=e[19];let x;e[20]!==I||e[21]!==w?(x=(0,a.jsx)(G,{htmlFor:"org-member-role-value",label:I,children:w}),e[20]=I,e[21]=w,e[22]=x):x=e[22];let z;return e[23]!==l||e[24]!==n||e[25]!==d||e[26]!==v||e[27]!==x||e[28]!==p||e[29]!==k||e[30]!==y?(z=(0,a.jsx)(ce,{busy:l,canSubmit:p,error:n,onClose:d,onSubmit:v,submitLabel:k,testId:"org-member-role",title:y,children:x}),e[23]=l,e[24]=n,e[25]=d,e[26]=v,e[27]=x,e[28]=p,e[29]=k,e[30]=y,e[31]=z):z=e[31],z},"Gt"),Mt=c(t=>{let e=(0,H.c)(36),{mode:r,onClose:d,onDone:h,organizationId:i,team:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.name):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==l||e[3]!==r||e[4]!==b||e[5]!==d||e[6]!==h||e[7]!==i||e[8]!==f||e[9]!==o?.id?(g=c(()=>{f(async()=>{await(r==="create"?l.createAuthOrgTeam({name:b.trim(),organizationId:i}):l.updateAuthOrgTeam({name:b.trim(),teamId:A(o?.id)})),h(),d()})},"f"),e[2]=l,e[3]=r,e[4]=b,e[5]=d,e[6]=h,e[7]=i,e[8]=f,e[9]=o?.id,e[10]=g):g=e[10];let p=g,k;e[11]!==b?(k=b.trim(),e[11]=b,e[12]=k):k=e[12];let y=k!=="",I;e[13]!==r||e[14]!==n?(I=n(r==="create"?"Create":"Save"),e[13]=r,e[14]=n,e[15]=I):I=e[15];let C;e[16]!==r||e[17]!==n?(C=n(r==="create"?"New team":"Rename team"),e[16]=r,e[17]=n,e[18]=C):C=e[18];let w;e[19]!==n?(w=n("name"),e[19]=n,e[20]=w):w=e[20];let x;e[21]===Symbol.for("react.memo_cache_sentinel")?(x=c(D=>{v(D.target.value)},"x"),e[21]=x):x=e[21];let z;e[22]!==b?(z=(0,a.jsx)(V,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:x,value:b}),e[22]=b,e[23]=z):z=e[23];let N;e[24]!==w||e[25]!==z?(N=(0,a.jsx)(G,{htmlFor:"org-team-form-name",label:w,children:z}),e[24]=w,e[25]=z,e[26]=N):N=e[26];let _;return e[27]!==m||e[28]!==s||e[29]!==d||e[30]!==p||e[31]!==N||e[32]!==y||e[33]!==I||e[34]!==C?(_=(0,a.jsx)(ce,{busy:m,canSubmit:y,error:s,onClose:d,onSubmit:p,submitLabel:I,testId:"org-team-form",title:C,children:N}),e[27]=m,e[28]=s,e[29]=d,e[30]=p,e[31]=N,e[32]=y,e[33]=I,e[34]=C,e[35]=_):_=e[35],_},"Ct"),qt=c(t=>{let e=(0,H.c)(30),{onClose:r,onDone:d,teamId:h}=t,i=oe(),o=Q(),{busy:l,error:n,run:m}=se(),[s,f]=(0,F.useState)(""),u;e[0]!==i||e[1]!==r||e[2]!==d||e[3]!==m||e[4]!==h||e[5]!==s?(u=c(()=>{m(async()=>{await i.addAuthOrgTeamMember({teamId:h,userId:s.trim()}),d(),r()})},"c"),e[0]=i,e[1]=r,e[2]=d,e[3]=m,e[4]=h,e[5]=s,e[6]=u):u=e[6];let b=u,v;e[7]!==s?(v=s.trim(),e[7]=s,e[8]=v):v=e[8];let g=v!=="",p;e[9]!==o?(p=o("Add member"),e[9]=o,e[10]=p):p=e[10];let k;e[11]!==o?(k=o("Add team member"),e[11]=o,e[12]=k):k=e[12];let y;e[13]!==o?(y=o("User id"),e[13]=o,e[14]=y):y=e[14];let I;e[15]===Symbol.for("react.memo_cache_sentinel")?(I=c(z=>{f(z.target.value)},"C"),e[15]=I):I=e[15];let C;e[16]!==s?(C=(0,a.jsx)(V,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:I,value:s}),e[16]=s,e[17]=C):C=e[17];let w;e[18]!==y||e[19]!==C?(w=(0,a.jsx)(G,{htmlFor:"org-team-add-member-user",label:y,children:C}),e[18]=y,e[19]=C,e[20]=w):w=e[20];let x;return e[21]!==l||e[22]!==n||e[23]!==r||e[24]!==b||e[25]!==g||e[26]!==p||e[27]!==k||e[28]!==w?(x=(0,a.jsx)(ce,{busy:l,canSubmit:g,error:n,onClose:r,onSubmit:b,submitLabel:p,testId:"org-team-add-member",title:k,children:w}),e[21]=l,e[22]=n,e[23]=r,e[24]=b,e[25]=g,e[26]=p,e[27]=k,e[28]=w,e[29]=x):x=e[29],x},"Ht"),Ft=c(t=>{let e=(0,H.c)(47),{mode:r,onClose:d,onDone:h,organizationId:i,role:o}=t,l=oe(),n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==o?(u=o?A(o.role):"",e[0]=o,e[1]=u):u=e[1];let[b,v]=(0,F.useState)(u),g;e[2]!==r||e[3]!==o?.permission?(g=r==="edit"?Pt(o?.permission):"",e[2]=r,e[3]=o?.permission,e[4]=g):g=e[4];let[p,k]=(0,F.useState)(g),y;e[5]!==l||e[6]!==r||e[7]!==b||e[8]!==d||e[9]!==h||e[10]!==i||e[11]!==p||e[12]!==o?.id||e[13]!==f?(y=c(()=>{f(async()=>{let $=Kt(p);await(r==="create"?l.createAuthOrgRole({organizationId:i,permission:$,role:b.trim()}):l.updateAuthOrgRole({permission:$,roleId:A(o?.id)})),h(),d()})},"v"),e[5]=l,e[6]=r,e[7]=b,e[8]=d,e[9]=h,e[10]=i,e[11]=p,e[12]=o?.id,e[13]=f,e[14]=y):y=e[14];let I=y,C;e[15]!==r||e[16]!==b||e[17]!==p?(C=p.trim()!==""&&(r==="edit"||b.trim()!==""),e[15]=r,e[16]=b,e[17]=p,e[18]=C):C=e[18];let w;e[19]!==r||e[20]!==n?(w=n(r==="create"?"Create":"Save"),e[19]=r,e[20]=n,e[21]=w):w=e[21];let x;e[22]!==r||e[23]!==n?(x=n(r==="create"?"New role":"Edit role"),e[22]=r,e[23]=n,e[24]=x):x=e[24];let z;e[25]!==r||e[26]!==b||e[27]!==n?(z=r==="create"&&(0,a.jsx)(G,{htmlFor:"org-role-form-name",label:n("Role name"),children:(0,a.jsx)(V,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:c($=>{v($.target.value)},"onChange"),value:b})}),e[25]=r,e[26]=b,e[27]=n,e[28]=z):z=e[28];let N;e[29]!==n?(N=n('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=n,e[30]=N):N=e[30];let _;e[31]===Symbol.for("react.memo_cache_sentinel")?(_=c($=>{k($.target.value)},"O"),e[31]=_):_=e[31];let D;e[32]!==p?(D=(0,a.jsx)(wt,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:_,value:p}),e[32]=p,e[33]=D):D=e[33];let O;e[34]!==D||e[35]!==N?(O=(0,a.jsx)(G,{htmlFor:"org-role-form-permission",label:N,children:D}),e[34]=D,e[35]=N,e[36]=O):O=e[36];let T;return e[37]!==m||e[38]!==s||e[39]!==d||e[40]!==I||e[41]!==O||e[42]!==C||e[43]!==w||e[44]!==x||e[45]!==z?(T=(0,a.jsxs)(ce,{busy:m,canSubmit:C,error:s,onClose:d,onSubmit:I,submitLabel:w,testId:"org-role-form",title:x,children:[z,O]}),e[37]=m,e[38]=s,e[39]=d,e[40]=I,e[41]=O,e[42]=C,e[43]=w,e[44]=x,e[45]=z,e[46]=T):T=e[46],T},"xt"),Bt=c(t=>{let e=(0,H.c)(18),{action:r,message:d,onClose:h,onDone:i,testId:o,title:l}=t,n=Q(),{busy:m,error:s,run:f}=se(),u;e[0]!==r||e[1]!==h||e[2]!==i||e[3]!==f?(u=c(()=>{f(async()=>{await r(),i(),h()})},"c"),e[0]=r,e[1]=h,e[2]=i,e[3]=f,e[4]=u):u=e[4];let b=u,v;e[5]!==n?(v=n("Delete"),e[5]=n,e[6]=v):v=e[6];let g;e[7]!==d?(g=(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=g):g=e[8];let p;return e[9]!==m||e[10]!==s||e[11]!==h||e[12]!==b||e[13]!==v||e[14]!==g||e[15]!==o||e[16]!==l?(p=(0,a.jsx)(ce,{busy:m,canSubmit:!0,destructive:!0,error:s,onClose:h,onSubmit:b,submitLabel:v,testId:o,title:l,children:g}),e[9]=m,e[10]=s,e[11]=h,e[12]=b,e[13]=v,e[14]=g,e[15]=o,e[16]=l,e[17]=p):p=e[17],p},"Mt"),Xe=c(t=>{let e=(0,H.c)(13),{action:r,children:d,heading:h,testId:i}=t,o;e[0]!==h?(o=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:h}),e[0]=h,e[1]=o):o=e[1];let l;e[2]!==r?(l=r!==void 0&&(0,a.jsx)("div",{className:"flex items-center gap-2",children:r}),e[2]=r,e[3]=l):l=e[3];let n;e[4]!==o||e[5]!==l?(n=(0,a.jsxs)("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,l]}),e[4]=o,e[5]=l,e[6]=n):n=e[6];let m;e[7]!==d?(m=(0,a.jsx)(yt,{className:"px-0",children:d}),e[7]=d,e[8]=m):m=e[8];let s;return e[9]!==n||e[10]!==m||e[11]!==i?(s=(0,a.jsxs)(vt,{className:"overflow-hidden py-0","data-testid":i,children:[n,m]}),e[9]=n,e[10]=m,e[11]=i,e[12]=s):s=e[12],s},"We"),We=c(t=>{let e=(0,H.c)(23),{columns:r,rowActions:d,rowPrefix:h,rows:i}=t,o=Q(),l;e[0]!==r?(l=r.map(Gt),e[0]=r,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("Actions"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==n?(m=(0,a.jsx)(me,{"aria-label":n}),e[4]=n,e[5]=m):m=e[5];let s;e[6]!==l||e[7]!==m?(s=(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[l,m]})}),e[6]=l,e[7]=m,e[8]=s):s=e[8];let f;if(e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i){let v;e[14]!==r||e[15]!==d||e[16]!==h?(v=c((g,p)=>{let k=A(g.id),y=k===""?`index-${p.toString()}`:k;return(0,a.jsxs)(Ve,{"data-testid":`${h}-${y}`,children:[r.map(I=>(0,a.jsx)(de,{className:I.className,children:I.render(g)},I.head)),(0,a.jsx)(de,{children:(0,a.jsx)("div",{className:"flex justify-end gap-1",children:d(g)})})]},y)},"p"),e[14]=r,e[15]=d,e[16]=h,e[17]=v):v=e[17],f=i.map(v),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=f}else f=e[13];let u;e[18]!==f?(u=(0,a.jsx)(xt,{children:f}),e[18]=f,e[19]=u):u=e[19];let b;return e[20]!==s||e[21]!==u?(b=(0,a.jsxs)(Ct,{children:[s,u]}),e[20]=s,e[21]=u,e[22]=b):b=e[22],b},"Xe");function Gt(t){return(0,a.jsx)(me,{children:t.head},t.head)}c(Gt,"Zt");var Vt=c(t=>{let e=(0,H.c)(30),{actionBusy:r,onRemoveMember:d,memberColumns:h,members:i,onDialog:o}=t,l=Q(),n;e[0]!==o?(n=c(()=>{o({kind:"add-member"})},"r"),e[0]=o,e[1]=n):n=e[1];let m;e[2]!==l?(m=l("Add member"),e[2]=l,e[3]=m):m=e[3];let s;e[4]!==n||e[5]!==m?(s=(0,a.jsx)(j,{"data-testid":"org-open-add-member",onClick:n,size:"xs",type:"button",variant:"outline",children:m}),e[4]=n,e[5]=m,e[6]=s):s=e[6];let f;e[7]!==o?(f=c(()=>{o({kind:"invite-member"})},"h"),e[7]=o,e[8]=f):f=e[8];let u;e[9]!==l?(u=l("Invite member"),e[9]=l,e[10]=u):u=e[10];let b;e[11]!==f||e[12]!==u?(b=(0,a.jsx)(j,{"data-testid":"org-open-invite-member",onClick:f,size:"xs",type:"button",variant:"outline",children:u}),e[11]=f,e[12]=u,e[13]=b):b=e[13];let v;e[14]!==s||e[15]!==b?(v=(0,a.jsxs)(a.Fragment,{children:[s,b]}),e[14]=s,e[15]=b,e[16]=v):v=e[16];let g;e[17]!==l?(g=l("Members"),e[17]=l,e[18]=g):g=e[18];let p;e[19]!==r||e[20]!==h||e[21]!==i||e[22]!==o||e[23]!==d||e[24]!==l?(p=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-members-empty",title:l("No members.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(y=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-member-role-${A(y.id)}`,onClick:c(()=>{o({kind:"member-role",member:y})},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Change role")}),(0,a.jsx)(j,{"data-testid":`org-remove-member-${A(y.id)}`,disabled:r,onClick:c(()=>{d(A(y.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Remove")})]}),"rowActions"),rowPrefix:"org-member",rows:i}),e[19]=r,e[20]=h,e[21]=i,e[22]=o,e[23]=d,e[24]=l,e[25]=p):p=e[25];let k;return e[26]!==v||e[27]!==g||e[28]!==p?(k=(0,a.jsx)(Xe,{action:v,heading:g,testId:"org-members",children:p}),e[26]=v,e[27]=g,e[28]=p,e[29]=k):k=e[29],k},"qt"),Xt=c(t=>{let e=(0,H.c)(21),{onConfirmDeleteTeam:r,onDialog:d,onSelectTeam:h,selectedTeam:i,teamColumns:o,teams:l}=t,n=Q(),m;e[0]!==d?(m=c(()=>{d({kind:"team-create"})},"m"),e[0]=d,e[1]=m):m=e[1];let s;e[2]!==n?(s=n("New team"),e[2]=n,e[3]=s):s=e[3];let f;e[4]!==m||e[5]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-create-team",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[4]=m,e[5]=s,e[6]=f):f=e[6];let u;e[7]!==n?(u=n("Teams"),e[7]=n,e[8]=u):u=e[8];let b;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==n||e[14]!==o||e[15]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-teams-empty",title:n("No teams.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"aria-pressed":i===A(g.id),"data-testid":`org-team-select-${A(g.id)}`,onClick:c(()=>{h(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Members")}),(0,a.jsx)(j,{"data-testid":`org-team-rename-${A(g.id)}`,onClick:c(()=>{d({kind:"team-rename",team:g})},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Rename")}),(0,a.jsx)(j,{"data-testid":`org-team-delete-${A(g.id)}`,onClick:c(()=>{r(g)},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Delete")})]}),"rowActions"),rowPrefix:"org-team",rows:l}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=n,e[14]=o,e[15]=l,e[16]=b):b=e[16];let v;return e[17]!==f||e[18]!==u||e[19]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-teams",children:b}),e[17]=f,e[18]=u,e[19]=b,e[20]=v):v=e[20],v},"Kt"),Wt=c(t=>{let e=(0,H.c)(20),{actionBusy:r,onRemoveTeamMember:d,onDialog:h,selectedTeam:i,teamMemberColumns:o,teamMembers:l}=t,n=Q(),m;e[0]!==h||e[1]!==i?(m=c(()=>{h({kind:"team-add-member",teamId:i})},"m"),e[0]=h,e[1]=i,e[2]=m):m=e[2];let s;e[3]!==n?(s=n("Add member"),e[3]=n,e[4]=s):s=e[4];let f;e[5]!==m||e[6]!==s?(f=(0,a.jsx)(j,{"data-testid":"org-open-add-team-member",onClick:m,size:"xs",type:"button",variant:"outline",children:s}),e[5]=m,e[6]=s,e[7]=f):f=e[7];let u;e[8]!==n?(u=n("Team members"),e[8]=n,e[9]=u):u=e[9];let b;e[10]!==r||e[11]!==d||e[12]!==n||e[13]!==o||e[14]!==l?(b=l.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-team-members-empty",title:n("No team members.")})}):(0,a.jsx)(We,{columns:o,rowActions:c(g=>(0,a.jsx)(j,{"data-testid":`org-team-remove-member-${A(g.id)}`,disabled:r,onClick:c(()=>{d(A(g.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:n("Remove")}),"rowActions"),rowPrefix:"org-team-member",rows:l}),e[10]=r,e[11]=d,e[12]=n,e[13]=o,e[14]=l,e[15]=b):b=e[15];let v;return e[16]!==f||e[17]!==u||e[18]!==b?(v=(0,a.jsx)(Xe,{action:f,heading:u,testId:"org-team-members",children:b}),e[16]=f,e[17]=u,e[18]=b,e[19]=v):v=e[19],v},"Vt"),er=c(t=>{let e=(0,H.c)(19),{onConfirmDeleteRole:r,onDialog:d,roleColumns:h,roles:i}=t,o=Q(),l;e[0]!==d?(l=c(()=>{d({kind:"role-create"})},"i"),e[0]=d,e[1]=l):l=e[1];let n;e[2]!==o?(n=o("New role"),e[2]=o,e[3]=n):n=e[3];let m;e[4]!==l||e[5]!==n?(m=(0,a.jsx)(j,{"data-testid":"org-open-create-role",onClick:l,size:"xs",type:"button",variant:"outline",children:n}),e[4]=l,e[5]=n,e[6]=m):m=e[6];let s;e[7]!==o?(s=o("Roles"),e[7]=o,e[8]=s):s=e[8];let f;e[9]!==r||e[10]!==d||e[11]!==h||e[12]!==i||e[13]!==o?(f=i.length===0?(0,a.jsx)("div",{className:"p-3",children:(0,a.jsx)(ue,{testId:"org-roles-empty",title:o("No custom roles.")})}):(0,a.jsx)(We,{columns:h,rowActions:c(b=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(j,{"data-testid":`org-role-edit-${A(b.id)}`,onClick:c(()=>{d({kind:"role-edit",role:b})},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Edit")}),(0,a.jsx)(j,{"data-testid":`org-role-delete-${A(b.id)}`,onClick:c(()=>{r(A(b.id))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),"rowActions"),rowPrefix:"org-role",rows:i}),e[9]=r,e[10]=d,e[11]=h,e[12]=i,e[13]=o,e[14]=f):f=e[14];let u;return e[15]!==m||e[16]!==s||e[17]!==f?(u=(0,a.jsx)(Xe,{action:m,heading:s,testId:"org-roles",children:f}),e[15]=m,e[16]=s,e[17]=f,e[18]=u):u=e[18],u},"Wt"),Et=200,tr=c(t=>{let e=(0,H.c)(207),{organizationId:r,rolesEnabled:d,teamsEnabled:h}=t,i=oe(),o=Q(),[l,n]=(0,F.useState)(null),[m,s]=(0,F.useState)(null),[f,u]=(0,F.useState)(!1),[b,v]=(0,F.useState)(null),[g,p]=_t(r),k;e[0]!==g||e[1]!==r?(k=["lunora-auth-org-members",r,g],e[0]=g,e[1]=r,e[2]=k):k=e[2];let y;e[3]!==i||e[4]!==g||e[5]!==r?(y=c(()=>i.listAuthOrgMembers({limit:Et,offset:g,organizationId:r}),"v"),e[3]=i,e[4]=g,e[5]=r,e[6]=y):y=e[6];let I=ge(k,y),C;e[7]!==r?(C=["lunora-auth-org-invitations",r],e[7]=r,e[8]=C):C=e[8];let w;e[9]!==i||e[10]!==r?(w=c(()=>i.listAuthOrgInvitations({limit:200,organizationId:r}),"I"),e[9]=i,e[10]=r,e[11]=w):w=e[11];let x=ge(C,w),z;e[12]!==r?(z=["lunora-auth-org-teams",r],e[12]=r,e[13]=z):z=e[13];let N;e[14]!==i||e[15]!==r?(N=c(()=>i.listAuthOrgTeams({limit:200,organizationId:r}),"D"),e[14]=i,e[15]=r,e[16]=N):N=e[16];let _;e[17]!==h?(_={enabled:h},e[17]=h,e[18]=_):_=e[18];let D=ge(z,N,_),O;e[19]!==r?(O=["lunora-auth-org-roles",r],e[19]=r,e[20]=O):O=e[20];let T;e[21]!==i||e[22]!==r?(T=c(()=>i.listAuthOrgRoles({limit:200,organizationId:r}),"_"),e[21]=i,e[22]=r,e[23]=T):T=e[23];let $;e[24]!==d?($={enabled:d},e[24]=d,e[25]=$):$=e[25];let E=ge(O,T,$),Z;e[26]!==m?(Z=["lunora-auth-org-team-members",m],e[26]=m,e[27]=Z):Z=e[27];let B;e[28]!==i||e[29]!==m?(B=c(()=>i.listAuthOrgTeamMembers({limit:200,teamId:m??""}),"B"),e[28]=i,e[29]=m,e[30]=B):B=e[30];let K=m!==null,J;e[31]!==K?(J={enabled:K},e[31]=K,e[32]=J):J=e[32];let P=ge(Z,B,J),U;e[33]!==I.data?.rows?(U=I.data?.rows??[],e[33]=I.data?.rows,e[34]=U):U=e[34];let L=U,Y;e[35]!==x.data?.rows?(Y=x.data?.rows??[],e[35]=x.data?.rows,e[36]=Y):Y=e[36];let M=Y,R;e[37]!==D.data?.rows?(R=D.data?.rows??[],e[37]=D.data?.rows,e[38]=R):R=e[38];let q=R,W;e[39]!==E.data?.rows?(W=E.data?.rows??[],e[39]=E.data?.rows,e[40]=W):W=e[40];let te=W,ae;e[41]!==m||e[42]!==P?(ae=m===null?[]:P.data?.rows??[],e[41]=m,e[42]=P,e[43]=ae):ae=e[43];let re=ae,ee=I.error??x.error??D.error??E.error??P.error,le;e[44]!==x||e[45]!==I||e[46]!==d||e[47]!==E||e[48]!==m||e[49]!==P||e[50]!==h||e[51]!==D?(le=c(()=>{I.refetch(),x.refetch(),h&&D.refetch(),d&&E.refetch(),m!==null&&P.refetch()},"ie"),e[44]=x,e[45]=I,e[46]=d,e[47]=E,e[48]=m,e[49]=P,e[50]=h,e[51]=D,e[52]=le):le=e[52];let S=le;kt(S,!0);let et;e[53]===Symbol.for("react.memo_cache_sentinel")?(et=c(()=>{n(null)},"Ye"),e[53]=et):et=e[53];let ne=et,tt;e[54]!==S?(tt=c(X=>{At((async()=>{u(!0),v(null);try{await X(),S(),u(!1)}catch(mt){v(Nt(mt)),u(!1)}})())},"et"),e[54]=S,e[55]=tt):tt=e[55];let ie=tt,rt;e[56]!==i||e[57]!==o?(rt=c(X=>{let mt=A(X.id);n({action:c(async()=>{await i.removeAuthOrgTeam({teamId:mt}),s(St=>St===mt?null:St)},"action"),kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},"tt"),e[56]=i,e[57]=o,e[58]=rt):rt=e[58];let dt=rt,he;e[59]!==o?(he=o("userId"),e[59]=o,e[60]=he):he=e[60];let be;e[61]!==he?(be={head:he,render:rr},e[61]=he,e[62]=be):be=e[62];let fe;e[63]!==o?(fe=o("role"),e[63]=o,e[64]=fe):fe=e[64];let pe;e[65]!==fe?(pe={head:fe,render:or},e[65]=fe,e[66]=pe):pe=e[66];let ot;e[67]!==be||e[68]!==pe?(ot=[be,pe],e[67]=be,e[68]=pe,e[69]=ot):ot=e[69];let ct=ot,ve;e[70]!==o?(ve=o("email"),e[70]=o,e[71]=ve):ve=e[71];let ye;e[72]!==ve?(ye={head:ve,render:ar},e[72]=ve,e[73]=ye):ye=e[73];let Ce;e[74]!==o?(Ce=o("role"),e[74]=o,e[75]=Ce):Ce=e[75];let Ie;e[76]!==Ce?(Ie={head:Ce,render:lr},e[76]=Ce,e[77]=Ie):Ie=e[77];let xe;e[78]!==o?(xe=o("status"),e[78]=o,e[79]=xe):xe=e[79];let we;e[80]!==xe?(we={head:xe,render:nr},e[80]=xe,e[81]=we):we=e[81];let at;e[82]!==ye||e[83]!==Ie||e[84]!==we?(at=[ye,Ie,we],e[82]=ye,e[83]=Ie,e[84]=we,e[85]=at):at=e[85];let ut=at,ke;e[86]!==o?(ke=o("id"),e[86]=o,e[87]=ke):ke=e[87];let ze;e[88]!==ke?(ze={className:"font-mono text-xs",head:ke,render:ir},e[88]=ke,e[89]=ze):ze=e[89];let Se;e[90]!==o?(Se=o("name"),e[90]=o,e[91]=Se):Se=e[91];let Ne;e[92]!==Se?(Ne={head:Se,render:sr},e[92]=Se,e[93]=Ne):Ne=e[93];let lt;e[94]!==ze||e[95]!==Ne?(lt=[ze,Ne],e[94]=ze,e[95]=Ne,e[96]=lt):lt=e[96];let gt=lt,Ae;e[97]!==o?(Ae=o("userId"),e[97]=o,e[98]=Ae):Ae=e[98];let nt;e[99]!==Ae?(nt=[{head:Ae,render:mr}],e[99]=Ae,e[100]=nt):nt=e[100];let ht=nt,De;e[101]!==o?(De=o("role"),e[101]=o,e[102]=De):De=e[102];let Oe;e[103]!==De?(Oe={head:De,render:dr},e[103]=De,e[104]=Oe):Oe=e[104];let _e;e[105]!==o?(_e=o("Permission"),e[105]=o,e[106]=_e):_e=e[106];let Te;e[107]!==_e?(Te={className:"font-mono text-xs whitespace-pre-wrap",head:_e,render:cr},e[107]=_e,e[108]=Te):Te=e[108];let it;e[109]!==Oe||e[110]!==Te?(it=[Oe,Te],e[109]=Oe,e[110]=Te,e[111]=it):it=e[111];let bt=it,$e;e[112]!==ee?($e=ee!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[112]=ee,e[113]=$e):$e=e[113];let Re;e[114]!==b?(Re=b!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:b}),e[114]=b,e[115]=Re):Re=e[115];let Me;e[116]!==i||e[117]!==ie?(Me=c(X=>{ie(()=>i.removeAuthOrgMember({memberId:X}))},"$e"),e[116]=i,e[117]=ie,e[118]=Me):Me=e[118];let Fe;e[119]!==f||e[120]!==ct||e[121]!==L||e[122]!==Me?(Fe=(0,a.jsx)(Vt,{actionBusy:f,memberColumns:ct,members:L,onDialog:n,onRemoveMember:Me}),e[119]=f,e[120]=ct,e[121]=L,e[122]=Me,e[123]=Fe):Fe=e[123];let ft=I.data?.total,Ee;e[124]!==L.length||e[125]!==g||e[126]!==p||e[127]!==ft?(Ee=(0,a.jsx)(zt,{count:L.length,offset:g,onOffsetChange:p,pageSize:Et,prefix:"org-members",total:ft}),e[124]=L.length,e[125]=g,e[126]=p,e[127]=ft,e[128]=Ee):Ee=e[128];let je;e[129]!==f||e[130]!==i||e[131]!==ut||e[132]!==M||e[133]!==ie||e[134]!==o?(je=M.length>0&&(0,a.jsx)(Xe,{heading:o("Invitations"),testId:"org-invitations",children:(0,a.jsx)(We,{columns:ut,rowActions:c(X=>(0,a.jsx)(j,{"data-testid":`org-cancel-invitation-${A(X.id)}`,disabled:f,onClick:c(()=>{ie(()=>i.cancelAuthOrgInvitation({invitationId:A(X.id)}))},"onClick"),size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),"rowActions"),rowPrefix:"org-invitation",rows:M})}),e[129]=f,e[130]=i,e[131]=ut,e[132]=M,e[133]=ie,e[134]=o,e[135]=je):je=e[135];let Le;e[136]!==dt||e[137]!==m||e[138]!==gt||e[139]!==q||e[140]!==h?(Le=h&&(0,a.jsx)(Xt,{onConfirmDeleteTeam:dt,onDialog:n,onSelectTeam:s,selectedTeam:m,teamColumns:gt,teams:q}),e[136]=dt,e[137]=m,e[138]=gt,e[139]=q,e[140]=h,e[141]=Le):Le=e[141];let Pe;e[142]!==f||e[143]!==i||e[144]!==ie||e[145]!==m||e[146]!==ht||e[147]!==re||e[148]!==h?(Pe=h&&m!==null&&(0,a.jsx)(Wt,{actionBusy:f,onDialog:n,onRemoveTeamMember:c(X=>{ie(()=>i.removeAuthOrgTeamMember({teamMemberId:X}))},"onRemoveTeamMember"),selectedTeam:m,teamMemberColumns:ht,teamMembers:re}),e[142]=f,e[143]=i,e[144]=ie,e[145]=m,e[146]=ht,e[147]=re,e[148]=h,e[149]=Pe):Pe=e[149];let Be;e[150]!==i||e[151]!==bt||e[152]!==te||e[153]!==d||e[154]!==o?(Be=d&&(0,a.jsx)(er,{onConfirmDeleteRole:c(X=>{n({action:c(()=>i.deleteAuthOrgRole({roleId:X}),"action"),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},"onConfirmDeleteRole"),onDialog:n,roleColumns:bt,roles:te}),e[150]=i,e[151]=bt,e[152]=te,e[153]=d,e[154]=o,e[155]=Be):Be=e[155];let Je;e[156]!==l?.kind||e[157]!==r||e[158]!==S?(Je=l?.kind==="add-member"&&(0,a.jsx)(Qt,{onClose:ne,onDone:S,organizationId:r}),e[156]=l?.kind,e[157]=r,e[158]=S,e[159]=Je):Je=e[159];let Ue;e[160]!==l?.kind||e[161]!==r||e[162]!==S?(Ue=l?.kind==="invite-member"&&(0,a.jsx)(Zt,{onClose:ne,onDone:S,organizationId:r}),e[160]=l?.kind,e[161]=r,e[162]=S,e[163]=Ue):Ue=e[163];let He;e[164]!==l||e[165]!==S?(He=l?.kind==="member-role"&&(0,a.jsx)(Yt,{member:l.member,onClose:ne,onDone:S}),e[164]=l,e[165]=S,e[166]=He):He=e[166];let Ke;e[167]!==l?.kind||e[168]!==r||e[169]!==S?(Ke=l?.kind==="team-create"&&(0,a.jsx)(Mt,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[167]=l?.kind,e[168]=r,e[169]=S,e[170]=Ke):Ke=e[170];let Qe;e[171]!==l||e[172]!==r||e[173]!==S?(Qe=l?.kind==="team-rename"&&(0,a.jsx)(Mt,{mode:"edit",onClose:ne,onDone:S,organizationId:r,team:l.team}),e[171]=l,e[172]=r,e[173]=S,e[174]=Qe):Qe=e[174];let Ze;e[175]!==l||e[176]!==S?(Ze=l?.kind==="team-add-member"&&(0,a.jsx)(qt,{onClose:ne,onDone:S,teamId:l.teamId}),e[175]=l,e[176]=S,e[177]=Ze):Ze=e[177];let Ye;e[178]!==l?.kind||e[179]!==r||e[180]!==S?(Ye=l?.kind==="role-create"&&(0,a.jsx)(Ft,{mode:"create",onClose:ne,onDone:S,organizationId:r}),e[178]=l?.kind,e[179]=r,e[180]=S,e[181]=Ye):Ye=e[181];let qe;e[182]!==l||e[183]!==r||e[184]!==S?(qe=l?.kind==="role-edit"&&(0,a.jsx)(Ft,{mode:"edit",onClose:ne,onDone:S,organizationId:r,role:l.role}),e[182]=l,e[183]=r,e[184]=S,e[185]=qe):qe=e[185];let Ge;e[186]!==l||e[187]!==S?(Ge=l?.kind==="confirm"&&(0,a.jsx)(Bt,{action:l.action,message:l.message,onClose:ne,onDone:S,testId:l.testId,title:l.title}),e[186]=l,e[187]=S,e[188]=Ge):Ge=e[188];let st;return e[189]!==$e||e[190]!==Re||e[191]!==Fe||e[192]!==Ee||e[193]!==je||e[194]!==Le||e[195]!==Pe||e[196]!==Be||e[197]!==Je||e[198]!==Ue||e[199]!==He||e[200]!==Ke||e[201]!==Qe||e[202]!==Ze||e[203]!==Ye||e[204]!==qe||e[205]!==Ge?(st=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[$e,Re,Fe,Ee,je,Le,Pe,Be,Je,Ue,He,Ke,Qe,Ze,Ye,qe,Ge]}),e[189]=$e,e[190]=Re,e[191]=Fe,e[192]=Ee,e[193]=je,e[194]=Le,e[195]=Pe,e[196]=Be,e[197]=Je,e[198]=Ue,e[199]=He,e[200]=Ke,e[201]=Qe,e[202]=Ze,e[203]=Ye,e[204]=qe,e[205]=Ge,e[206]=st):st=e[206],st},"Xt");function rr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(rr,"Yt");function or(t){return A(t.role)}c(or,"el");function ar(t){return A(t.email)}c(ar,"tl");function lr(t){return A(t.role)}c(lr,"ll");function nr(t){return A(t.status)}c(nr,"ol");function ir(t){return A(t.id)}c(ir,"il");function sr(t){return A(t.name)}c(sr,"rl");function mr(t){return(0,a.jsx)("span",{className:"font-mono text-xs",children:A(t.userId)})}c(mr,"nl");function dr(t){return A(t.role)}c(dr,"sl");function cr(t){return A(t.permission)}c(cr,"al");var jt=100,Ar=c(()=>{let t=(0,H.c)(69),e=oe(),r=Q(),{config:d,ready:h}=Tt(),i=d.capabilities.organization,[o,l]=(0,F.useState)(null),[n,m]=(0,F.useState)(null),[s,f]=(0,F.useState)(0),u;t[0]!==s?(u=["lunora-auth-orgs",s],t[0]=s,t[1]=u):u=t[1];let b;t[2]!==e||t[3]!==s?(b=c(()=>e.listAuthOrganizations({limit:jt,offset:s}),"g"),t[2]=e,t[3]=s,t[4]=b):b=t[4];let v;t[5]!==i?(v={enabled:i},t[5]=i,t[6]=v):v=t[6];let g=ge(u,b,v),p=g.data?.rows??null,k;t[7]!==g?(k=c(()=>{g.refetch()},"S"),t[7]=g,t[8]=k):k=t[8],kt(k,i);let y;t[9]===Symbol.for("react.memo_cache_sentinel")?(y=c(()=>{m(null)},"v"),t[9]=y):y=t[9];let I=y,C;t[10]!==g?(C=c(()=>{g.refetch()},"y"),t[10]=g,t[11]=C):C=t[11];let w=C,x;t[12]===Symbol.for("react.memo_cache_sentinel")?(x=c(M=>{l(M)},"x"),t[12]=x):x=t[12];let z=x;if(h&&!i){let M;t[13]!==r?(M=r("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=r,t[14]=M):M=t[14];let R;t[15]!==r?(R=r("Organizations are not enabled."),t[15]=r,t[16]=R):R=t[16];let q;return t[17]!==M||t[18]!==R?(q=(0,a.jsx)(ue,{description:M,testId:"org-disabled",title:R}),t[17]=M,t[18]=R,t[19]=q):q=t[19],q}let N;t[20]!==r?(N=r("Organizations"),t[20]=r,t[21]=N):N=t[21];let _;t[22]!==N?(_=(0,a.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:N}),t[22]=N,t[23]=_):_=t[23];let D;t[24]===Symbol.for("react.memo_cache_sentinel")?(D=c(()=>{m({kind:"create"})},"A"),t[24]=D):D=t[24];let O;t[25]!==r?(O=r("New organization"),t[25]=r,t[26]=O):O=t[26];let T;t[27]!==O?(T=(0,a.jsx)(j,{"data-testid":"org-new",onClick:D,size:"sm",type:"button",children:O}),t[27]=O,t[28]=T):T=t[28];let $;t[29]!==T||t[30]!==_?($=(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[_,T]}),t[29]=T,t[30]=_,t[31]=$):$=t[31];let E;t[32]!==g.error?(E=g.error!==null&&(0,a.jsx)("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:g.error}),t[32]=g.error,t[33]=E):E=t[33];let Z;t[34]!==p||t[35]!==r?(Z=p!==null&&p.length===0&&(0,a.jsx)(ue,{testId:"org-empty",title:r("No organizations.")}),t[34]=p,t[35]=r,t[36]=Z):Z=t[36];let B;t[37]!==p||t[38]!==o||t[39]!==r?(B=p!==null&&p.length>0&&(0,a.jsx)(vt,{className:"overflow-hidden py-0",children:(0,a.jsx)(yt,{className:"px-0",children:(0,a.jsxs)(Ct,{"data-testid":"org-table",children:[(0,a.jsx)(It,{children:(0,a.jsxs)(Ve,{children:[(0,a.jsx)(me,{children:r("id")}),(0,a.jsx)(me,{children:r("name")}),(0,a.jsx)(me,{children:r("slug")}),(0,a.jsx)(me,{children:r("created")}),(0,a.jsx)(me,{"aria-label":r("Actions")})]})}),(0,a.jsx)(xt,{children:p.map(M=>{let R=A(M.id);return(0,a.jsxs)(Ve,{"data-testid":`org-row-${R}`,children:[(0,a.jsx)(de,{className:"font-mono text-xs",children:R}),(0,a.jsx)(de,{children:A(M.name)}),(0,a.jsx)(de,{children:A(M.slug)}),(0,a.jsx)(de,{className:"text-muted-foreground tabular-nums",children:Dt(M.createdAt)}),(0,a.jsx)(de,{children:(0,a.jsxs)("div",{className:"flex justify-end gap-1",children:[(0,a.jsx)(j,{"aria-pressed":o===R,"data-testid":`org-select-${R}`,onClick:c(()=>{z(R)},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Manage")}),(0,a.jsx)(j,{"data-testid":`org-edit-${R}`,onClick:c(()=>{m({kind:"edit",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Edit")}),(0,a.jsx)(j,{"data-testid":`org-delete-${R}`,onClick:c(()=>{m({kind:"delete",org:M})},"onClick"),size:"xs",type:"button",variant:"ghost",children:r("Delete")})]})})]},R)})})]})})}),t[37]=p,t[38]=o,t[39]=r,t[40]=B):B=t[40];let K;t[41]!==s||t[42]!==p||t[43]!==g.data?.total?(K=p!==null&&(0,a.jsx)(zt,{count:p.length,offset:s,onOffsetChange:f,pageSize:jt,prefix:"org",total:g.data?.total}),t[41]=s,t[42]=p,t[43]=g.data?.total,t[44]=K):K=t[44];let J;t[45]!==d.organization||t[46]!==o?(J=o!==null&&(0,a.jsx)(tr,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[45]=d.organization,t[46]=o,t[47]=J):J=t[47];let P;t[48]!==n?.kind||t[49]!==w?(P=n?.kind==="create"&&(0,a.jsx)(Rt,{mode:"create",onClose:I,onDone:w}),t[48]=n?.kind,t[49]=w,t[50]=P):P=t[50];let U;t[51]!==n||t[52]!==w?(U=n?.kind==="edit"&&(0,a.jsx)(Rt,{mode:"edit",onClose:I,onDone:w,org:n.org}),t[51]=n,t[52]=w,t[53]=U):U=t[53];let L;t[54]!==e||t[55]!==n||t[56]!==w||t[57]!==r?(L=n?.kind==="delete"&&(0,a.jsx)(Bt,{action:c(async()=>{let M=A(n.org.id);await e.deleteAuthOrganization({organizationId:M}),l(R=>R===M?null:R)},"action"),message:r("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:I,onDone:w,testId:"org-delete",title:r("Delete organization")}),t[54]=e,t[55]=n,t[56]=w,t[57]=r,t[58]=L):L=t[58];let Y;return t[59]!==$||t[60]!==E||t[61]!==Z||t[62]!==B||t[63]!==K||t[64]!==J||t[65]!==P||t[66]!==U||t[67]!==L?(Y=(0,a.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[$,E,Z,B,K,J,P,U,L]}),t[59]=$,t[60]=E,t[61]=Z,t[62]=B,t[63]=K,t[64]=J,t[65]=P,t[66]=U,t[67]=L,t[68]=Y):Y=t[68],Y},"Al");export{Ar as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as j,h as v,i as D,l as g}from"./chunk-PAAYRW3Q.js";import{f as S,g as w,h as P,p as q}from"./chunk-5OMZCVRF.js";import{a as i,d as A,e as x,f as M}from"./chunk-I26MS5PJ.js";var E=A(M(),1);var p=A(x(),1);var I=300,l=i(t=>typeof t=="string"?t===""?void 0:t:typeof t=="number"||typeof t=="boolean"?String(t):void 0,"a"),u=i(t=>t.filter(r=>r!==void 0).join(" "),"c"),T=i(t=>{let r=Array.isArray(t.filters)?t.filters.length:0,e=typeof t.search=="string"&&t.search!=="";return r===0&&!e?"no predicate":u([r===0?void 0:`${String(r)} filters`,e?"search":void 0])},"q"),N={clearTable:i(t=>u([l(t.table),"whole table"]),"clearTable"),deleteRows:i(t=>u([l(t.table),T(t)]),"deleteRows"),facetColumn:i(t=>u([l(t.table),l(t.column)]),"facetColumn"),importShard:i(t=>{if(!Array.isArray(t.rows))return"";let r=[...new Set(t.rows.filter(e=>typeof e=="object"&&e!==null).map(e=>e.table).filter(e=>typeof e=="string"))].toSorted((e,s)=>e.localeCompare(s));return u([`${String(t.rows.length)} rows`,r.length===0?void 0:`into ${r.join(", ")}`])},"importShard"),lintSql:i(()=>"sql","lintSql"),patchRows:i(t=>u([l(t.table),typeof t.doc=="object"&&t.doc!==null?`set ${Object.keys(t.doc).join(", ")}`:void 0,T(t)]),"patchRows"),pitrRestore:i(t=>u([l(t.time)===void 0?void 0:`to ${String(t.time)}`,typeof t.bookmark=="string"&&t.bookmark!==""?"from bookmark":void 0,t.restart===!0?"restart now":void 0]),"pitrRestore"),readTablePage:i(t=>u([l(t.table),Array.isArray(t.filters)&&t.filters.length>0?`${String(t.filters.length)} filters`:void 0,typeof t.search=="string"&&t.search!==""?"search":void 0,typeof t.limit=="number"?`limit ${String(t.limit)}`:void 0]),"readTablePage"),runMigration:i(t=>u([l(t.id),l(t.direction),t.dryRun===!0?"dry-run":void 0]),"runMigration"),runSql:i(t=>typeof t.sql=="string"?`${String(t.sql.length)} chars`:"","runSql"),schemaVersion:i(t=>typeof t.hash=="string"?t.hash.slice(0,8):"","schemaVersion"),writeRow:i(t=>u([l(t.table),"1 row"]),"writeRow")},$="__lunora_admin__:",F=i((t,r)=>{let e=t.startsWith($)?t.slice($.length):t,s=N[e];if(s!==void 0)return s(r);let n=Object.keys(r);return n.length===0?"":n.join(", ")},"M"),V=i(t=>{if(Array.isArray(t))return t.length;if(!(typeof t!="object"||t===null)){for(let r of Object.values(t))if(Array.isArray(r))return r.length}},"K"),k=class{static{i(this,"x")}entries=[];listeners=new Set;nextSeq=1;getSnapshot=i(()=>this.entries,"getSnapshot");subscribe=i(r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}),"subscribe");start(r,e,s){return this.append(r,e,s,"call","pending")}startSubscription(r,e,s){return this.append(r,e,s,"subscription","live")}recordPush(r){if(this.listeners.size===0){let e=this.entries.find(s=>s.seq===r);e!==void 0&&(e.pushes=(e.pushes??0)+1);return}this.patch(r,e=>({...e,pushes:(e.pushes??0)+1}))}failSubscription(r,e){this.patch(r,s=>({...s,error:e,status:"error"}))}endSubscription(r){this.patch(r,e=>e.status==="error"?e:{...e,durationMs:Date.now()-e.startedAt,status:"closed"})}lastErrorSeq(){return this.entries.findLast(r=>r.status==="error")?.seq}settle(r,e){this.patch(r,s=>({...s,durationMs:Date.now()-s.startedAt,...e.error===void 0?{resultCount:V(e.result),status:"ok"}:{error:e.error,status:"error"}}))}clear(){this.entries=[],this.emit()}append(r,e,s,n,a){let d=this.nextSeq;this.nextSeq+=1;let c={functionPath:r,kind:n,seq:d,shardKey:s,startedAt:Date.now(),status:a,summary:F(r,e),...n==="subscription"?{pushes:0}:{}},o=[...this.entries,c];return this.entries=o.length>I?o.slice(o.length-I):o,this.emit(),d}patch(r,e){let s=this.entries.findIndex(n=>n.seq===r);s!==-1&&(this.entries=this.entries.with(s,e(this.entries[s])),this.emit())}emit(){for(let r of this.listeners)r()}},f=new k,_=i((t,r,e)=>["lunora-admin",t,r,e.trim()],"j"),O=i((t,r)=>[...t,r],"E");function W(t,r,e={}){let s=g(),{enabled:n=!0,keepPreviousData:a=!1,staleTime:d=0}=e,c=O(t,s.clientIdentifier()),o=D({enabled:n,queryFn:r,placeholderData:a?j:void 0,queryKey:c,staleTime:d});return{data:o.data,error:o.error?P(o.error):o.error,errorSource:o.error??void 0,isLoading:o.isLoading,liveError:void 0,refetch:i(()=>{q(o.refetch())},"refetch")}}i(W,"F");function Y(t,r,e={}){let s=g(),n=v(),{enabled:a=!0,keepPreviousData:d=!1,live:c=!1,shardKey:o="",staleTime:R}=e,m=_(t,r,o),C=W(m,()=>s.query(S(t),r,w(o)),{enabled:a,keepPreviousData:d,staleTime:R??(c?Number.POSITIVE_INFINITY:0)}),[K,b]=(0,p.useState)(void 0),L=JSON.stringify(m);return(0,p.useEffect)(()=>{if(!a||!c)return;b(void 0);let y=f.startSubscription(t,r,o),Q=s.subscribe(S(t),r,h=>{f.recordPush(y),b(void 0),n.setQueryData(O(m,s.clientIdentifier()),h)},{...w(o),onError:i(h=>{f.failSubscription(y,h.message),b(h.message)},"onError")});return()=>{f.endSubscription(y),Q()}},[s,L,a,c]),{...C,liveError:a&&c?K:void 0}}i(Y,"U");var B=i(()=>{let t=(0,E.c)(2),r=v(),e;return t[0]!==r?(e=i((s,n,a)=>{let d=n===void 0?["lunora-admin",s]:_(s,n,a??"");q(r.invalidateQueries({queryKey:d}))},"r"),t[0]=r,t[1]=e):e=t[1],e},"W");export{f as a,W as b,Y as c,B as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Ze}from"./chunk-ECY2JC5F.js";import"./chunk-NRP22GKC.js";import{a as Xe}from"./chunk-FPI7AMQJ.js";import{a as Ye}from"./chunk-JQXA2OYK.js";import"./chunk-UC7MNI2F.js";import{a as Ve}from"./chunk-I23ULEUU.js";import{i as Pe}from"./chunk-E4PXACVL.js";import"./chunk-MVWZMWPD.js";import"./chunk-7Y3SY37W.js";import{a as le}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as de}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{a as Ke}from"./chunk-PLVFYL6L.js";import{a as He}from"./chunk-NCPW7WHO.js";import"./chunk-OU56VN3R.js";import"./chunk-55UGUCQ6.js";import{a as W}from"./chunk-4ZEL6BYL.js";import{c as Le}from"./chunk-GXYXVKOM.js";import{l as ze}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as ie}from"./chunk-RWVIV3U7.js";import{a as Te,b as _e,c as Be,d as z,e as C,f as w}from"./chunk-HCTJKP5J.js";import{a as Me,e as Ae}from"./chunk-2IKDEUCX.js";import{d as F,f as ce,g as ue,h as H,m as Ue,p as me,t as Ge}from"./chunk-5OMZCVRF.js";import{a as c,d as Ee,e as ct,f as ut,g as mt}from"./chunk-I26MS5PJ.js";var D=Ee(ut(),1);var Q=Ee(ct(),1);var t=Ee(mt(),1);var pt=c((n,e)=>{let a=new Set(n.map(s=>s.deadLetterQueue).filter(s=>typeof s=="string"&&s!=="")),d=n.filter(s=>(s.deadLetterQueue===void 0||s.deadLetterQueue==="")&&!a.has(s.name)),r=e.filter(s=>s.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:d,showReliabilityWarning:d.length>0||r>0}},"ut"),De="topic:",$e=c(n=>{let e=[],a=new Map;for(let d of n)d.topic===void 0?e.push(d):a.set(d.topic,[...a.get(d.topic)??[],d]);return{plain:e,topics:a}},"Ae"),tt=c(n=>`${De}${n}`,"We"),ht=c((n,e)=>n.startsWith(De)?(e.get(n.slice(De.length))??[]).map(a=>a.exportName):[n],"mt"),gt=200,ft=ce(W.sendQueueMessage),xt=c(async(n,e,a)=>{let d=(await Promise.allSettled(e.map(async s=>n.query(ft,s,ue(""))))).flatMap((s,l)=>s.status==="rejected"?[{exportName:e[l]?.exportName??"",message:H(s.reason)}]:[]),[r]=d;return r===void 0?null:e.length===1?r.message:a("Not sent to {failed}",{failed:d.map(s=>`${s.exportName}: ${s.message}`).join("; ")})},"ht"),yt=ce(W.replayQueueMessage),Nt=ce(W.clearQueueMessages),et=96,bt=c(n=>{if(n===void 0)return"\u2014";try{return JSON.stringify(n,Ue)}catch{return"[unserializable]"}},"yt"),qt=c(n=>n.length>et?`${n.slice(0,et)}\u2026`:n,"bt"),vt=c(n=>n==="error"?"destructive":n==="retry"?"outline":"secondary","Nt"),St=c((n,e)=>e(n==="messages"?"Messages":n==="send"?"Send":"Declared"),"qt"),at=c(n=>{let e=(0,D.c)(17),{queue:a}=n,d=`queues-row-${a.exportName}`,r;e[0]!==a.exportName?(r=(0,t.jsx)(w,{className:"font-mono text-xs",children:a.exportName}),e[0]=a.exportName,e[1]=r):r=e[1];let s;e[2]!==a.name?(s=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.name}),e[2]=a.name,e[3]=s):s=e[3];let l;e[4]!==a.mode?(l=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.mode}),e[4]=a.mode,e[5]=l):l=e[5];let o;e[6]!==a.binding?(o=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:a.binding}),e[6]=a.binding,e[7]=o):o=e[7];let m=a.deadLetterQueue??"\u2014",i;e[8]!==m?(i=(0,t.jsx)(w,{className:"font-mono text-xs text-muted-foreground",children:m}),e[8]=m,e[9]=i):i=e[9];let p;return e[10]!==d||e[11]!==r||e[12]!==s||e[13]!==l||e[14]!==o||e[15]!==i?(p=(0,t.jsxs)(z,{"data-testid":d,children:[r,s,l,o,i]}),e[10]=d,e[11]=r,e[12]=s,e[13]=l,e[14]=o,e[15]=i,e[16]=p):p=e[16],p},"Ge"),wt=c(n=>{let e=(0,D.c)(8),{loaded:a,queues:d}=n,r=F(),s;if(e[0]!==a||e[1]!==d||e[2]!==r){let{plain:l,topics:o}=$e(d),m;e[4]!==r?(m=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=m):m=e[5];let i;e[6]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[6]=m,e[7]=i):i=e[7],s=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[i,a&&d.length===0?(0,t.jsx)(ie,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsxs)(Te,{"data-testid":"queues-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:r("Export")}),(0,t.jsx)(C,{children:r("Queue")}),(0,t.jsx)(C,{children:r("Mode")}),(0,t.jsx)(C,{children:r("Binding")}),(0,t.jsx)(C,{children:r("Dead-letter")})]})}),(0,t.jsxs)(Be,{children:[l.map(Et),[...o].map(p=>{let[f,x]=p;return(0,t.jsxs)(Q.Fragment,{children:[(0,t.jsx)(z,{className:"bg-muted/40","data-testid":`queues-topic-${f}`,children:(0,t.jsx)(w,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} \xB7 {count} subscriptions",{count:x.length,topic:f})})}),x.map(Mt)]},f)})]})]})})})]}),e[0]=a,e[1]=d,e[2]=r,e[3]=s}else s=e[3];return s},"St"),Ct=c(n=>{let e=(0,D.c)(67),{message:a,onReplay:d,replayingId:r}=n,s=F(),l,o,m,i,p,f,x,u,h,N;if(e[0]!==a.attempts||e[1]!==a.body||e[2]!==a.deadLettered||e[3]!==a.exportName||e[4]!==a.id||e[5]!==a.messageId||e[6]!==a.outcome||e[7]!==a.queue||e[8]!==s){let P=bt(a.body);o=z,f=`queues-message-${a.id}`;let U=a.exportName??a.queue;e[19]!==U?(x=(0,t.jsx)(w,{className:"font-mono text-xs",children:U}),e[19]=U,e[20]=x):x=e[20],e[21]!==a.messageId?(u=(0,t.jsx)(w,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:a.messageId,children:a.messageId}),e[21]=a.messageId,e[22]=u):u=e[22],e[23]!==a.attempts?(h=(0,t.jsx)(w,{className:"font-mono text-xs tabular-nums",children:a.attempts}),e[23]=a.attempts,e[24]=h):h=e[24];let L=`queues-outcome-${a.id}`,T;e[25]!==a.outcome?(T=vt(a.outcome),e[25]=a.outcome,e[26]=T):T=e[26];let I;e[27]!==a.outcome||e[28]!==L||e[29]!==T?(I=(0,t.jsx)(de,{"data-testid":L,variant:T,children:a.outcome}),e[27]=a.outcome,e[28]=L,e[29]=T,e[30]=I):I=e[30];let _;e[31]!==a.deadLettered||e[32]!==a.id||e[33]!==s?(_=a.deadLettered&&(0,t.jsx)(de,{"data-testid":`queues-dlq-${a.id}`,variant:"destructive",children:s("DLQ")}),e[31]=a.deadLettered,e[32]=a.id,e[33]=s,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(N=(0,t.jsx)(w,{children:(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=N):N=e[37],l=w,m="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",i=P,p=qt(P),e[0]=a.attempts,e[1]=a.body,e[2]=a.deadLettered,e[3]=a.exportName,e[4]=a.id,e[5]=a.messageId,e[6]=a.outcome,e[7]=a.queue,e[8]=s,e[9]=l,e[10]=o,e[11]=m,e[12]=i,e[13]=p,e[14]=f,e[15]=x,e[16]=u,e[17]=h,e[18]=N}else l=e[9],o=e[10],m=e[11],i=e[12],p=e[13],f=e[14],x=e[15],u=e[16],h=e[17],N=e[18];let y;e[38]!==l||e[39]!==m||e[40]!==i||e[41]!==p?(y=(0,t.jsx)(l,{className:m,title:i,children:p}),e[38]=l,e[39]=m,e[40]=i,e[41]=p,e[42]=y):y=e[42];let q;e[43]!==a.capturedAt?(q=Ge(a.capturedAt,"\u2014"),e[43]=a.capturedAt,e[44]=q):q=e[44];let b;e[45]!==q?(b=(0,t.jsx)(w,{className:"text-xs text-muted-foreground tabular-nums",children:q}),e[45]=q,e[46]=b):b=e[46];let v=`queues-replay-${a.id}`,E=r!==null,M;e[47]!==a.id||e[48]!==r||e[49]!==s?(M=r===a.id?s("Replaying\u2026"):s("Replay"),e[47]=a.id,e[48]=r,e[49]=s,e[50]=M):M=e[50];let A;e[51]!==a.id||e[52]!==d||e[53]!==v||e[54]!==E||e[55]!==M?(A=(0,t.jsx)(w,{children:(0,t.jsx)(le,{"data-id":a.id,"data-testid":v,disabled:E,onClick:d,size:"xs",type:"button",variant:"outline",children:M})}),e[51]=a.id,e[52]=d,e[53]=v,e[54]=E,e[55]=M,e[56]=A):A=e[56];let $;return e[57]!==o||e[58]!==b||e[59]!==A||e[60]!==f||e[61]!==x||e[62]!==u||e[63]!==h||e[64]!==N||e[65]!==y?($=(0,t.jsxs)(o,{"data-testid":f,children:[x,u,h,N,y,b,A]}),e[57]=o,e[58]=b,e[59]=A,e[60]=f,e[61]=x,e[62]=u,e[63]=h,e[64]=N,e[65]=y,e[66]=$):$=e[66],$},"Et"),It=c(n=>{let e=(0,D.c)(29),{hasError:a,messages:d,onClear:r,onReplay:s,replayingId:l}=n,o=F(),m;e[0]!==o?(m=o("Cloudflare Queues have no peek API, so this is what push consumers actually processed \u2014 not pending depth."),e[0]=o,e[1]=m):m=e[1];let i;e[2]!==m?(i=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:m}),e[2]=m,e[3]=i):i=e[3];let p;e[4]!==o?(p=o("Clear the whole message log?"),e[4]=o,e[5]=p):p=e[5];let f=d.length===0,x;e[6]!==o?(x=o("Clear log"),e[6]=o,e[7]=x):x=e[7];let u;e[8]!==r||e[9]!==p||e[10]!==f||e[11]!==x?(u=(0,t.jsx)("div",{className:"ml-auto",children:(0,t.jsx)(Ve,{confirmLabel:p,disabled:f,onConfirm:r,testId:"queues-clear",children:x})}),e[8]=r,e[9]=p,e[10]=f,e[11]=x,e[12]=u):u=e[12];let h;e[13]!==d.length||e[14]!==o?(h=d.length>0&&(0,t.jsx)(de,{"data-testid":"queues-count",variant:"secondary",children:o("{count} messages",{count:d.length})}),e[13]=d.length,e[14]=o,e[15]=h):h=e[15];let N;e[16]!==i||e[17]!==u||e[18]!==h?(N=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[i,u,h]}),e[16]=i,e[17]=u,e[18]=h,e[19]=N):N=e[19];let y;e[20]!==a||e[21]!==d||e[22]!==s||e[23]!==l||e[24]!==o?(y=!a&&d.length===0?(0,t.jsx)(ie,{description:o("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:o("No consumed messages yet.")}):(0,t.jsx)(Me,{className:"overflow-hidden py-0",children:(0,t.jsx)(Ae,{className:"px-0",children:(0,t.jsx)(Ze,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:(0,t.jsxs)(Te,{"data-testid":"queues-messages-table",children:[(0,t.jsx)(_e,{children:(0,t.jsxs)(z,{children:[(0,t.jsx)(C,{children:o("Export")}),(0,t.jsx)(C,{children:o("Message")}),(0,t.jsx)(C,{children:o("Attempts")}),(0,t.jsx)(C,{children:o("Outcome")}),(0,t.jsx)(C,{children:o("Body")}),(0,t.jsx)(C,{children:o("Captured")}),(0,t.jsx)(C,{})]})}),(0,t.jsx)(Be,{children:d.map(b=>(0,t.jsx)(Ct,{message:b,onReplay:s,replayingId:l},b.id))})]})})})}),e[20]=a,e[21]=d,e[22]=s,e[23]=l,e[24]=o,e[25]=y):y=e[25];let q;return e[26]!==N||e[27]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[N,y]}),e[26]=N,e[27]=y,e[28]=q):q=e[28],q},"Tt"),Qt=c(n=>{let e=(0,D.c)(20),{batchMode:a,bodyText:d,delayText:r,onBatchModeChange:s,onBodyChange:l,onDelayChange:o,onSelectExport:m,onSend:i,queues:p,selectedExportName:f,sending:x}=n,u=F(),h;e[0]!==u?(h=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=h):h=e[1];let N;e[2]!==h?(N=(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:h}),e[2]=h,e[3]=N):N=e[3];let y;e[4]!==a||e[5]!==d||e[6]!==r||e[7]!==s||e[8]!==l||e[9]!==o||e[10]!==m||e[11]!==i||e[12]!==p||e[13]!==f||e[14]!==x||e[15]!==u?(y=p.length===0?(0,t.jsx)(ie,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxs)("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:m,value:f,children:[p.map(At),[...$e(p).topics].map(b=>{let[v,E]=b;return(0,t.jsx)("option",{value:tt(v),children:u("{topic} (topic \u2192 {count} subscriptions)",{count:E.length,topic:v})},v)})]}),(0,t.jsx)(Pe,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:o,placeholder:u("Delay (s)"),type:"number",value:r}),(0,t.jsxs)("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[(0,t.jsx)("input",{checked:a,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:s,type:"checkbox"}),u("Send as batch (JSON array)")]}),(0,t.jsx)(le,{className:"ml-auto","data-testid":"queues-send-button",disabled:x||f==="",onClick:i,type:"button",children:u(x?"Sending\u2026":"Send message")})]}),(0,t.jsx)(Xe,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:l,placeholder:a?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:d})]}),e[4]=a,e[5]=d,e[6]=r,e[7]=s,e[8]=l,e[9]=o,e[10]=m,e[11]=i,e[12]=p,e[13]=f,e[14]=x,e[15]=u,e[16]=y):y=e[16];let q;return e[17]!==N||e[18]!==y?(q=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[N,y]}),e[17]=N,e[18]=y,e[19]=q):q=e[19],q},"_t"),Yt=c(n=>{let e=(0,D.c)(57),{limit:a}=n,d=a??gt,r=ze(),s=F(),[l,o]=(0,Q.useState)("declared"),[m,i]=(0,Q.useState)(null),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let{data:f,error:x,errorSource:u}=Le(W.listQueues,p),h;e[1]!==d?(h={limit:d},e[1]=d,e[2]=h):h=e[2];let{data:N,error:y,errorSource:q,refetch:b}=Le(W.getQueueMessages,h),v=Array.isArray(f?.queues)?[...f.queues].toSorted(Lt):[],E=N?.entries??[],{deadLetteredCount:M,queuesWithoutDlq:A,showReliabilityWarning:$}=pt(v,E),[P,U]=(0,Q.useState)(""),[L,T]=(0,Q.useState)(""),[I,_]=(0,Q.useState)(""),[G,st]=(0,Q.useState)(!1),[pe,ke]=(0,Q.useState)(!1),[he,Oe]=(0,Q.useState)(null),{topics:Re}=$e(v),Je=[...v.map(Tt),...[...Re.keys()].map(_t)],K=Je.includes(P)?P:Je[0]??"",je=l==="messages"?y:x,nt=l==="messages"?q:u,ge=je??m,fe=je===null?m:nt,V;e[3]!==b?(V=c(()=>{b()},"V"),e[3]=b,e[4]=V):V=e[4],Ye(V,l==="messages");let rt=c(async()=>{i(null);let g=K;if(g==="")return;let S=null,Fe=L.trim();if(Fe!=="")try{S=JSON.parse(Fe)}catch{i(s("Body must be valid JSON."));return}let Qe,We=I.trim();if(We!==""){let B=Number(We);if(!Number.isFinite(B)||B<0){i(s("Delay must be a non-negative number of seconds."));return}Qe=B}if(G&&!Array.isArray(S)){i(s("Batch mode needs a JSON array body \u2014 each element is enqueued as one message."));return}ke(!0);let it=ht(g,Re).map(B=>G?{batch:S,delaySeconds:Qe,exportName:B}:{body:S,delaySeconds:Qe,exportName:B});try{i(await xt(r,it,s)),b()}catch(B){i(H(B))}ke(!1)},"Ve"),X;e[5]!==r||e[6]!==b?(X=c(async g=>{i(null),Oe(g);try{await r.query(yt,{id:g},ue("")),b()}catch(S){i(H(S))}Oe(null)},"X"),e[5]=r,e[6]=b,e[7]=X):X=e[7];let xe=X,Y;e[8]!==r||e[9]!==b?(Y=c(async()=>{i(null);try{await r.query(Nt,{},ue("")),b()}catch(g){i(H(g))}},"Y"),e[8]=r,e[9]=b,e[10]=Y):Y=e[10];let ye=Y,Z;e[11]===Symbol.for("react.memo_cache_sentinel")?(Z=c(g=>{let S=g.currentTarget.dataset.tab;(S==="declared"||S==="messages"||S==="send")&&o(S)},"K"),e[11]=Z):Z=e[11];let ot=Z,ee;e[12]===Symbol.for("react.memo_cache_sentinel")?(ee=c(g=>{U(g.currentTarget.value)},"Z"),e[12]=ee):ee=e[12];let Ne=ee,te;e[13]===Symbol.for("react.memo_cache_sentinel")?(te=c(g=>{T(g.currentTarget.value)},"ee"),e[13]=te):te=e[13];let be=te,ae;e[14]===Symbol.for("react.memo_cache_sentinel")?(ae=c(g=>{_(g.currentTarget.value)},"te"),e[14]=ae):ae=e[14];let qe=ae,se;e[15]===Symbol.for("react.memo_cache_sentinel")?(se=c(g=>{st(g.currentTarget.checked)},"se"),e[15]=se):se=e[15];let ve=se,Se=c(()=>{me(rt())},"xe"),ne;e[16]!==xe?(ne=c(g=>{let{id:S}=g.currentTarget.dataset;S!==void 0&&me(xe(S))},"ae"),e[16]=xe,e[17]=ne):ne=e[17];let we=ne,re;e[18]!==ye?(re=c(()=>{me(ye())},"re"),e[18]=ye,e[19]=re):re=e[19];let Ce=re,dt="flex flex-col gap-6",lt="lunora-queues-panel",k;e[20]!==s||e[21]!==l?(k=(0,t.jsx)("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(g=>(0,t.jsx)(le,{"aria-selected":l===g,"data-tab":g,"data-testid":`queues-tab-${g}`,onClick:ot,role:"tab",size:"sm",type:"button",variant:l===g?"secondary":"ghost",children:St(g,s)},g))}),e[20]=s,e[21]=l,e[22]=k):k=e[22];let O;e[23]!==ge||e[24]!==fe?(O=ge!==null&&(0,t.jsx)(Ke,{error:fe,testId:"queues-error"}),e[23]=ge,e[24]=fe,e[25]=O):O=e[25];let Ie=$&&(0,t.jsx)(He,{icon:(0,t.jsx)("span",{"aria-hidden":"true",className:"text-base leading-none",children:"\u26A0"}),testId:"queues-dlq-warning",variant:"warning",children:(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[A.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{className:"font-medium",children:s("No dead-letter queue on {queues}.",{queues:A.map(Bt).join(", ")})}),(0,t.jsx)("p",{className:"text-muted-foreground",children:s("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),M>0&&(0,t.jsx)("p",{className:A.length>0?"text-muted-foreground":"font-medium",children:M===1?s("1 message was recently dead-lettered."):s("{count} messages were recently dead-lettered.",{count:M})})]})}),R;e[26]!==v||e[27]!==f||e[28]!==l?(R=l==="declared"&&(0,t.jsx)(wt,{loaded:f!==void 0,queues:v}),e[26]=v,e[27]=f,e[28]=l,e[29]=R):R=e[29];let J;e[30]!==E||e[31]!==y||e[32]!==Ce||e[33]!==we||e[34]!==he||e[35]!==l?(J=l==="messages"&&(0,t.jsx)(It,{hasError:y!==null,messages:E,onClear:Ce,onReplay:we,replayingId:he}),e[30]=E,e[31]=y,e[32]=Ce,e[33]=we,e[34]=he,e[35]=l,e[36]=J):J=e[36];let j;e[37]!==G||e[38]!==L||e[39]!==I||e[40]!==ve||e[41]!==be||e[42]!==qe||e[43]!==Ne||e[44]!==Se||e[45]!==v||e[46]!==K||e[47]!==pe||e[48]!==l?(j=l==="send"&&(0,t.jsx)(Qt,{batchMode:G,bodyText:L,delayText:I,onBatchModeChange:ve,onBodyChange:be,onDelayChange:qe,onSelectExport:Ne,onSend:Se,queues:v,selectedExportName:K,sending:pe}),e[37]=G,e[38]=L,e[39]=I,e[40]=ve,e[41]=be,e[42]=qe,e[43]=Ne,e[44]=Se,e[45]=v,e[46]=K,e[47]=pe,e[48]=l,e[49]=j):j=e[49];let oe;return e[50]!==k||e[51]!==O||e[52]!==Ie||e[53]!==R||e[54]!==J||e[55]!==j?(oe=(0,t.jsxs)("div",{className:dt,"data-testid":lt,children:[k,O,Ie,R,J,j]}),e[50]=k,e[51]=O,e[52]=Ie,e[53]=R,e[54]=J,e[55]=j,e[56]=oe):oe=e[56],oe},"es");function Et(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Et,"Ct");function Mt(n){return(0,t.jsx)(at,{queue:n},n.exportName)}c(Mt,"vt");function At(n){return(0,t.jsx)("option",{value:n.exportName,children:n.exportName},n.exportName)}c(At,"wt");function Lt(n,e){return n.exportName.localeCompare(e.exportName)}c(Lt,"Qt");function Tt(n){return n.exportName}c(Tt,"At");function _t(n){return tt(n)}c(_t,"It");function Bt(n){return n.name}c(Bt,"Mt");export{Yt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as O}from"./chunk-JQXA2OYK.js";import{a as H}from"./chunk-I23ULEUU.js";import{a as ee}from"./chunk-7G4Z6Q7X.js";import"./chunk-3YXASVTP.js";import"./chunk-AUAECCXB.js";import{b as Z}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as E}from"./chunk-GXYXVKOM.js";import{l as R}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as _}from"./chunk-RWVIV3U7.js";import{a as K,b as V,c as z,d as F,e as u,f as p}from"./chunk-HCTJKP5J.js";import{a as A,e as T}from"./chunk-2IKDEUCX.js";import{d as M,h as G,p as W,t as X}from"./chunk-5OMZCVRF.js";import{a as c,d as P,e as oe,f as re,g as ae}from"./chunk-I26MS5PJ.js";var U=P(re(),1),Y=P(oe(),1);var t=P(ae(),1);var se=P(re(),1);var Q=P(oe(),1);var h=P(ae(),1);var ie=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","X"),le=c(a=>a.toSorted((e,i)=>e.scheduledFor-i.scheduledFor),"F"),ce=c((a,e,i)=>e!==void 0?e:i===void 0?d=>a.cancelScheduledJob(d):void 0,"Y"),de=c(a=>{let e=(0,se.c)(16),{cancelJob:i,loadJobs:d}=a===void 0?{}:a,f=R(),r=M(),l=d===void 0,o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=["lunora-scheduled-jobs"],e[0]=o):o=e[0];let N=E(o,async()=>{let v=await(d??(()=>f.listScheduledJobs()))();return le(v)}),[x,n]=(0,Q.useState)(void 0),[s,m]=(0,Q.useState)(void 0),y,k;e[1]!==f||e[2]!==l?(y=c(()=>{if(l)return f.subscribeScheduledJobs(v=>{m(void 0),n(le(v))})},"v"),k=[l,f],e[1]=f,e[2]=l,e[3]=y,e[4]=k):(y=e[3],k=e[4]),(0,Q.useEffect)(y,k);let g;e[5]!==N?(g=c(()=>{N.refetch()},"y"),e[5]=N,e[6]=g):g=e[6],O(g,!l);let J=ce(f,i,d),b=x??N.data,j=s??N.error,I=c(async v=>{if(J!==void 0){m(void 0);try{await J(v),l||N.refetch()}catch(D){m(G(D))}}},"A"),q="flex flex-col gap-3",B="lunora-scheduled-jobs",S;e[7]!==j?(S=j!==null&&(0,h.jsx)("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:j}),e[7]=j,e[8]=S):S=e[8];let L;e[9]!==b?.length||e[10]!==r?(L=b?.length===0&&(0,h.jsx)(_,{description:r("Jobs queued with runAfter / runAt will appear here."),icon:(0,h.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,h.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,h.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:r("No scheduled jobs.")}),e[9]=b?.length,e[10]=r,e[11]=L):L=e[11];let $=b!==void 0&&b.length>0&&(0,h.jsx)(A,{className:"overflow-hidden py-0",children:(0,h.jsx)(T,{className:"px-0",children:(0,h.jsxs)(K,{"data-testid":"sj-table",children:[(0,h.jsx)(V,{children:(0,h.jsxs)(F,{children:[(0,h.jsx)(u,{children:r("function")}),(0,h.jsx)(u,{children:r("scheduled for")}),(0,h.jsx)(u,{children:r("pool")}),(0,h.jsx)(u,{children:r("attempts")}),(0,h.jsx)(u,{children:r("shard")}),(0,h.jsx)(u,{children:r("id")}),J!==void 0&&(0,h.jsx)(u,{"aria-label":r("Actions")})]})}),(0,h.jsx)(z,{children:b.map(v=>(0,h.jsxs)(F,{"data-testid":`sj-row-${v.id}`,children:[(0,h.jsx)(p,{className:"font-mono text-xs",children:v.workflow??v.functionPath}),(0,h.jsx)(p,{className:"text-muted-foreground tabular-nums",children:ie(v.scheduledFor)}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.pool??""}),(0,h.jsx)(p,{className:"tabular-nums",children:v.attempts??0}),(0,h.jsx)(p,{children:v.shardKey??""}),(0,h.jsx)(p,{className:"font-mono text-xs",children:v.id}),J!==void 0&&(0,h.jsx)(p,{className:"text-right",children:(0,h.jsx)(H,{confirmLabel:r("Cancel job?"),onConfirm:c(()=>{W(I(v.id))},"onConfirm"),testId:`sj-cancel-${v.id}`,children:r("Cancel")})})]},v.id))})]})})}),w;return e[12]!==$||e[13]!==S||e[14]!==L?(w=(0,h.jsxs)("div",{className:q,"data-testid":B,children:[S,L,$]}),e[12]=$,e[13]=S,e[14]=L,e[15]=w):w=e[15],w},"he");var he={kind:"idle"},me=c((a,e,i)=>i!==void 0?i:e===void 0?d=>a.runCronJob(d):void 0,"re"),ue=c(({loadCronJobs:a,runCronJob:e}={})=>{let i=R(),d=M(),[f,r]=(0,Y.useState)({}),l=E(["lunora-cron-jobs",a?"custom":"default"],()=>(a??(()=>i.getCronJobs()))()),{data:o,error:N}=l,x=me(i,a,e),n=c(async s=>{if(x!==void 0){r(m=>({...m,[s]:{kind:"running"}}));try{await x(s),r(m=>({...m,[s]:{kind:"ok"}})),l.refetch()}catch(m){r(y=>({...y,[s]:{kind:"error",message:G(m)}}))}}},"i");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[N!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:N}),o?.length===0&&(0,t.jsx)(_,{description:d("Triggers declared with the cronJobs() builder appear here."),icon:(0,t.jsxs)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"9"}),(0,t.jsx)("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:d("No cron triggers.")}),o!==void 0&&o.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"cron-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:d("name")}),(0,t.jsx)(u,{children:d("schedule")}),(0,t.jsx)(u,{children:d("target")}),(0,t.jsx)(u,{children:d("shard")}),x!==void 0&&(0,t.jsx)(u,{"aria-label":d("Actions")})]})}),(0,t.jsx)(z,{children:o.map(s=>{let m=f[s.name]??he;return(0,t.jsxs)(F,{"data-testid":`cron-row-${s.name}`,children:[(0,t.jsx)(p,{children:s.name}),(0,t.jsx)(p,{className:"font-mono text-xs tabular-nums",children:s.cron}),(0,t.jsx)(p,{children:(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[s.workflow===void 0?(0,t.jsx)(Z,{variant:"outline",children:d("function")}):(0,t.jsx)(Z,{variant:"secondary",children:d("workflow")}),(0,t.jsx)("span",{className:"font-mono text-xs",children:s.workflow??s.functionPath})]})}),(0,t.jsx)(p,{children:s.shardKey??""}),x!==void 0&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("span",{className:"flex items-center justify-end gap-2",children:[m.kind==="ok"&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${s.name}`,children:d("ran")}),m.kind==="error"&&(0,t.jsx)("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${s.name}`,role:"alert",children:m.message}),(0,t.jsx)(H,{confirmLabel:d("Run now?"),disabled:m.kind==="running",onConfirm:c(()=>{W(n(s.name))},"onConfirm"),testId:`cron-run-${s.name}`,children:m.kind==="running"?d("Running\u2026"):d("Run now")})]})})]},`${s.cron}:${s.name}`)})})]})})})]})},"le"),pe=c(a=>Number.isFinite(a)?X(a,"\u2014"):"\u2014","se"),fe=c(a=>{let e=(0,U.c)(34),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadJobs:d,removeJob:f,retryJob:r}=i,l=R(),o=M(),N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let x;e[3]!==l||e[4]!==d?(x=c(async()=>(await(d??(()=>l.listDeadJobs()))()).toSorted(be),"h"),e[3]=l,e[4]=d,e[5]=x):x=e[5];let n=E(N,x),s=n.data,[m,y]=(0,Y.useState)(void 0),k=n.error??m,g=d===void 0,J;e[6]!==l||e[7]!==g||e[8]!==r?(J=r??(g?C=>l.retryDeadJob(C):void 0),e[6]=l,e[7]=g,e[8]=r,e[9]=J):J=e[9];let b=J,j;e[10]!==l||e[11]!==g||e[12]!==f?(j=f??(g?C=>l.removeDeadJob(C):void 0),e[10]=l,e[11]=g,e[12]=f,e[13]=j):j=e[13];let I=j,q;e[14]!==n?(q=c(()=>{n.refetch()},"$"),e[14]=n,e[15]=q):q=e[15],O(q,!0);let B;e[16]!==n?(B=c(async C=>{y(void 0);try{await C,n.refetch()}catch(ne){y(G(ne))}},"I"),e[16]=n,e[17]=B):B=e[17];let S=B,L=b!==void 0||I!==void 0,$;e[18]!==k?($=k!==void 0&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:k}),e[18]=k,e[19]=$):$=e[19];let w;e[20]!==s?.length||e[21]!==o?(w=s?.length===0&&(0,t.jsx)(_,{description:o("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:o("No dead-letter jobs.")}),e[20]=s?.length,e[21]=o,e[22]=w):w=e[22];let v;e[23]!==S||e[24]!==L||e[25]!==s||e[26]!==I||e[27]!==b||e[28]!==o?(v=s!==void 0&&s.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"dlq-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:o("function")}),(0,t.jsx)(u,{children:o("attempts")}),(0,t.jsx)(u,{children:o("last tried")}),(0,t.jsx)(u,{children:o("pool")}),(0,t.jsx)(u,{children:o("shard")}),(0,t.jsx)(u,{children:o("id")}),L&&(0,t.jsx)(u,{"aria-label":o("Actions")})]})}),(0,t.jsx)(z,{children:s.map(C=>(0,t.jsxs)(F,{"data-testid":`dlq-row-${C.id}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:C.workflow??C.functionPath}),(0,t.jsx)(p,{className:"tabular-nums",children:C.attempts??0}),(0,t.jsx)(p,{className:"text-muted-foreground tabular-nums",children:pe(C.scheduledFor)}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.pool??""}),(0,t.jsx)(p,{children:C.shardKey??""}),(0,t.jsx)(p,{className:"font-mono text-xs",children:C.id}),L&&(0,t.jsx)(p,{className:"text-right",children:(0,t.jsxs)("div",{className:"flex justify-end gap-1.5",children:[b!==void 0&&(0,t.jsx)(ee,{"data-testid":`dlq-retry-${C.id}`,onClick:c(()=>{W(S(b(C.id)))},"onClick"),size:"sm",type:"button",variant:"outline",children:o("Retry")}),I!==void 0&&(0,t.jsx)(H,{confirmLabel:o("Drop job?"),onConfirm:c(()=>{W(S(I(C.id)))},"onConfirm"),testId:`dlq-remove-${C.id}`,children:o("Drop")})]})})]},C.id))})]})})}),e[23]=S,e[24]=L,e[25]=s,e[26]=I,e[27]=b,e[28]=o,e[29]=v):v=e[29];let D;return e[30]!==v||e[31]!==$||e[32]!==w?(D=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[$,w,v]}),e[30]=v,e[31]=$,e[32]=w,e[33]=D):D=e[33],D},"ne");function be(a,e){return(e.attempts??0)-(a.attempts??0)}c(be,"oe");var te=c(a=>{let e=(0,U.c)(8),{label:i,testId:d,value:f}=a,r;e[0]!==i?(r=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),e[0]=i,e[1]=r):r=e[1];let l;e[2]!==d||e[3]!==f?(l=(0,t.jsx)("span",{className:"text-2xl font-semibold tabular-nums","data-testid":d,children:f}),e[2]=d,e[3]=f,e[4]=l):l=e[4];let o;return e[5]!==r||e[6]!==l?(o=(0,t.jsx)(A,{className:"flex-1 py-0",children:(0,t.jsxs)(T,{className:"flex flex-col gap-1 p-4",children:[r,l]})}),e[5]=r,e[6]=l,e[7]=o):o=e[7],o},"E"),ve=c(a=>{let e=(0,U.c)(25),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadStatus:d}=i,f=R(),r=M(),l=d===void 0,o;e[2]!==l?(o=["lunora-scheduler-status",l],e[2]=l,e[3]=o):o=e[3];let N;e[4]!==f||e[5]!==d?(N=c(async()=>{let j=await(d??(()=>f.schedulerStatus()))();return{...j,pools:j.pools.toSorted(xe)}},"y"),e[4]=f,e[5]=d,e[6]=N):N=e[6];let x=E(o,N),{data:n,error:s}=x,m;e[7]!==x?(m=c(()=>{x.refetch()},"d"),e[7]=x,e[8]=m):m=e[8],O(m,!0);let y;e[9]!==s?(y=s!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:s}),e[9]=s,e[10]=y):y=e[10];let k;e[11]!==n||e[12]!==r?(k=n!==void 0&&(0,t.jsxs)("div",{className:"flex gap-3","data-testid":"pools-totals",children:[(0,t.jsx)(te,{label:r("backlog"),testId:"pools-backlog",value:n.backlog}),(0,t.jsx)(te,{label:r("in flight"),testId:"pools-inflight",value:n.inFlight}),(0,t.jsx)(te,{label:r("pools"),testId:"pools-count",value:n.pools.length})]}),e[11]=n,e[12]=r,e[13]=k):k=e[13];let g;e[14]!==n?.pools.length||e[15]!==r?(g=n?.pools.length===0&&(0,t.jsx)(_,{description:r("Pools created with createWorkpool appear here once they have activity."),icon:(0,t.jsx)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,t.jsx)("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:r("No workpools.")}),e[14]=n?.pools.length,e[15]=r,e[16]=g):g=e[16];let J;e[17]!==n||e[18]!==r?(J=n!==void 0&&n.pools.length>0&&(0,t.jsx)(A,{className:"overflow-hidden py-0",children:(0,t.jsx)(T,{className:"px-0",children:(0,t.jsxs)(K,{"data-testid":"pools-table",children:[(0,t.jsx)(V,{children:(0,t.jsxs)(F,{children:[(0,t.jsx)(u,{children:r("pool")}),(0,t.jsx)(u,{children:r("queued")}),(0,t.jsx)(u,{children:r("in flight")}),(0,t.jsx)(u,{children:r("max concurrency")})]})}),(0,t.jsx)(z,{children:n.pools.map(ge)})]})})}),e[17]=n,e[18]=r,e[19]=J):J=e[19];let b;return e[20]!==y||e[21]!==k||e[22]!==g||e[23]!==J?(b=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[y,k,g,J]}),e[20]=y,e[21]=k,e[22]=g,e[23]=J,e[24]=b):b=e[24],b},"ae");function xe(a,e){return e.queued-a.queued}c(xe,"ie");function ge(a){return(0,t.jsxs)(F,{"data-testid":`pools-row-${a.name}`,children:[(0,t.jsx)(p,{className:"font-mono text-xs",children:a.name}),(0,t.jsx)(p,{className:"tabular-nums",children:a.queued}),(0,t.jsxs)(p,{className:"tabular-nums",children:[a.inFlight," / ",a.maxConcurrency]}),(0,t.jsx)(p,{className:"tabular-nums",children:a.maxConcurrency})]},a.name)}c(ge,"de");var Ne=["jobs","dead","pools","cron"],Ve=c(a=>{let e=(0,U.c)(41),i;e[0]!==a?(i=a===void 0?{}:a,e[0]=a,e[1]=i):i=e[1];let{loadCronJobs:d,scheduledCancel:f,scheduledLoad:r}=i,l=M(),[o,N]=(0,Y.useState)("jobs"),x;e[2]!==l?(x=l("Cron triggers"),e[2]=l,e[3]=x):x=e[3];let n;e[4]!==l?(n=l("Dead letter"),e[4]=l,e[5]=n):n=e[5];let s;e[6]!==l?(s=l("Scheduled jobs"),e[6]=l,e[7]=s):s=e[7];let m;e[8]!==l?(m=l("Pools"),e[8]=l,e[9]=m):m=e[9];let y;e[10]!==x||e[11]!==n||e[12]!==s||e[13]!==m?(y={cron:x,dead:n,jobs:s,pools:m},e[10]=x,e[11]=n,e[12]=s,e[13]=m,e[14]=y):y=e[14];let k=y,g;e[15]===Symbol.for("react.memo_cache_sentinel")?(g=c(w=>{N(w.currentTarget.dataset.view)},"f"),e[15]=g):g=e[15];let J=g,b;e[16]!==l?(b=l("Schedule view"),e[16]=l,e[17]=b):b=e[17];let j;e[18]!==o||e[19]!==k?(j=Ne.map(w=>(0,t.jsx)(ee,{"aria-selected":o===w,"data-testid":`schedule-view-${w}`,"data-view":w,onClick:J,role:"tab",size:"sm",type:"button",variant:o===w?"default":"outline",children:k[w]},w)),e[18]=o,e[19]=k,e[20]=j):j=e[20];let I;e[21]!==b||e[22]!==j?(I=(0,t.jsx)("div",{"aria-label":b,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:j}),e[21]=b,e[22]=j,e[23]=I):I=e[23];let q;e[24]!==f||e[25]!==r||e[26]!==o?(q=o==="jobs"&&(0,t.jsx)(de,{cancelJob:f,loadJobs:r}),e[24]=f,e[25]=r,e[26]=o,e[27]=q):q=e[27];let B;e[28]!==o?(B=o==="dead"&&(0,t.jsx)(fe,{}),e[28]=o,e[29]=B):B=e[29];let S;e[30]!==o?(S=o==="pools"&&(0,t.jsx)(ve,{}),e[30]=o,e[31]=S):S=e[31];let L;e[32]!==d||e[33]!==o?(L=o==="cron"&&(0,t.jsx)(ue,{loadCronJobs:d}),e[32]=d,e[33]=o,e[34]=L):L=e[34];let $;return e[35]!==I||e[36]!==q||e[37]!==B||e[38]!==S||e[39]!==L?($=(0,t.jsxs)("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[I,q,B,S,L]}),e[35]=I,e[36]=q,e[37]=B,e[38]=S,e[39]=L,e[40]=$):$=e[40],$},"Ie");export{Ve as SchedulePanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as f,d as i,e as d,f as h}from"./chunk-I26MS5PJ.js";var m=i(h(),1),e=i(d(),1);var E=5e3,p=f((s,r,l)=>{let t=(0,m.c)(6),o=l===void 0?E:l,u=(0,e.useRef)(s),n;t[0]!==s?(n=f(()=>{u.current=s},"s"),t[0]=s,t[1]=n):n=t[1],(0,e.useEffect)(n);let a,c;t[2]!==r||t[3]!==o?(a=f(()=>{if(!r)return;let R=setInterval(()=>{globalThis.document?.hidden!==!0&&u.current()},o);return()=>{clearInterval(R)}},"c"),c=[r,o],t[2]=r,t[3]=o,t[4]=a,t[5]=c):(a=t[4],c=t[5]),(0,e.useEffect)(a,c)},"h");export{p as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as H}from"./chunk-JQXA2OYK.js";import{b as x}from"./chunk-Q6ED4KUL.js";import"./chunk-BOMPSVRC.js";import{b as z}from"./chunk-GXYXVKOM.js";import{l as O}from"./chunk-PAAYRW3Q.js";import"./chunk-QAQDMS6R.js";import"./chunk-WS7WNXF3.js";import{a as _}from"./chunk-RWVIV3U7.js";import{a as q,b as B,c as E,d as S,e as i,f as s}from"./chunk-HCTJKP5J.js";import{a as A,e as L}from"./chunk-2IKDEUCX.js";import{d as W}from"./chunk-5OMZCVRF.js";import{a as R,d as M,f as $,g as D}from"./chunk-I26MS5PJ.js";var I=M($(),1);var n=M(D(),1);var F=2e3,G=new Set(["open"]),ie=R(Q=>{let e=(0,I.c)(41),{read:y}=Q,t=W(),j=O(),v;e[0]!==j||e[1]!==y?(v=R(()=>Promise.resolve(y?y():j.debug()),"T"),e[0]=j,e[1]=y,e[2]=v):v=e[2];let V=v,K=y?"injected":"live",b;e[3]!==K?(b=["lunora-studio","sync-client-debug",K],e[3]=K,e[4]=b):b=e[4];let{data:c,refetch:Y}=z(b,V);if(H(Y,!0,F),!c){let r;e[5]!==t?(r=t("Reading the sync client's state\u2026"),e[5]=t,e[6]=r):r=e[6];let g;e[7]!==t?(g=t("Sync client"),e[7]=t,e[8]=g):g=e[8];let T;return e[9]!==r||e[10]!==g?(T=(0,n.jsx)(A,{children:(0,n.jsx)(L,{children:(0,n.jsx)(_,{description:r,title:g})})}),e[9]=r,e[10]=g,e[11]=T):T=e[11],T}let{pendingWrites:k,shards:N,subscriptions:w}=c,a;e[12]!==t?(a=t("This Studio session's sync client"),e[12]=t,e[13]=a):a=e[13];let l;e[14]!==a?(l=(0,n.jsx)("span",{className:"text-sm font-medium",children:a}),e[14]=a,e[15]=l):l=e[15];let P=c.connectionStatus==="connected"?"default":"secondary",o;e[16]!==c.connectionStatus||e[17]!==P?(o=(0,n.jsx)(x,{variant:P,children:c.connectionStatus}),e[16]=c.connectionStatus,e[17]=P,e[18]=o):o=e[18];let d;e[19]!==k||e[20]!==t?(d=k>0?(0,n.jsx)(x,{variant:"secondary",children:t("{count} pending writes",{count:k})}):null,e[19]=k,e[20]=t,e[21]=d):d=e[21];let h;e[22]!==l||e[23]!==o||e[24]!==d?(h=(0,n.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[l,o,d]}),e[22]=l,e[23]=o,e[24]=d,e[25]=h):h=e[25];let u;e[26]!==t?(u=t("Reads client.debug() for the client running in this page \u2014 not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=t,e[27]=u):u=e[27];let m;e[28]!==u?(m=(0,n.jsx)("p",{className:"text-muted-foreground text-xs",children:u}),e[28]=u,e[29]=m):m=e[29];let p;e[30]!==N||e[31]!==t?(p=N.length===0?(0,n.jsx)(_,{description:t("No shard connection has been opened yet."),title:t("No shards")}):(0,n.jsxs)(q,{children:[(0,n.jsx)(B,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(i,{children:t("Shard")}),(0,n.jsx)(i,{children:t("Socket")}),(0,n.jsx)(i,{children:t("Confirmed watermark")})]})}),(0,n.jsx)(E,{children:N.map(r=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{children:r.shardKey??t("(default)")}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:G.has(r.wsState)?"default":"secondary",children:r.wsState})}),(0,n.jsx)(s,{children:r.confirmedMutationWatermark})]},r.shardKey??"__default__"))})]}),e[30]=N,e[31]=t,e[32]=p):p=e[32];let f;e[33]!==w||e[34]!==t?(f=w.length===0?(0,n.jsx)(_,{description:t("This client holds no live queries or shapes."),title:t("No subscriptions")}):(0,n.jsxs)(q,{children:[(0,n.jsx)(B,{children:(0,n.jsxs)(S,{children:[(0,n.jsx)(i,{children:t("Subscription")}),(0,n.jsx)(i,{children:t("Kind")}),(0,n.jsx)(i,{children:t("Acked")}),(0,n.jsx)(i,{children:t("Cursor")}),(0,n.jsx)(i,{children:t("Pending overlays")})]})}),(0,n.jsx)(E,{children:w.map(r=>(0,n.jsxs)(S,{children:[(0,n.jsx)(s,{className:"font-mono text-xs",children:r.functionPath}),(0,n.jsx)(s,{children:r.kind}),(0,n.jsx)(s,{children:(0,n.jsx)(x,{variant:r.acked?"default":"secondary",children:r.acked?t("yes"):t("no")})}),(0,n.jsx)(s,{children:r.serverCursor??"\u2014"}),(0,n.jsx)(s,{children:r.pendingOptimisticLayers})]},r.id))})]}),e[33]=w,e[34]=t,e[35]=f):f=e[35];let C;return e[36]!==m||e[37]!==p||e[38]!==f||e[39]!==h?(C=(0,n.jsx)(A,{children:(0,n.jsxs)(L,{className:"flex flex-col gap-4",children:[h,m,p,f]})}),e[36]=m,e[37]=p,e[38]=f,e[39]=h,e[40]=C):C=e[40],C},"ie");export{ie as default};
|