@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
|
@@ -0,0 +1 @@
|
|
|
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-I1uILsUP.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DvhNw0BI.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,h as O,b as U}from"./internal-BXEjuLPN.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.poll(),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 +1 @@
|
|
|
1
|
-
import{S as b}from"./studio-
|
|
1
|
+
import{S as b}from"./studio-BcHsk7mT.mjs";import"./ErrorBoundary-BWNF98VF.mjs";import"./operation-console-provider-DoloEvon.mjs";import"./badge-r_5B4LHP.mjs";import"./input-CXhxesPC.mjs";import"./skeleton-DX1gfixl.mjs";import"./home-panel-CF-MfsnH.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-DhYmAkcj.mjs";import"./internal-BXEjuLPN.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-CM1hqAOD.mjs";export{b as Studio};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as $}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-
|
|
1
|
+
import{c as O}from"react/compiler-runtime";import{LunoraClient as G}from"@lunora/client";import{LunoraProvider as H}from"@lunora/react";import{useState as B,useEffect as $}from"react";import{ErrorBoundary as z}from"./ErrorBoundary-BWNF98VF.mjs";import{u as U,B as V,T as Y,a as q,S as J}from"./studio-BcHsk7mT.mjs";import Q from"./useDebounced-DVeQ5-oW.mjs";import{useT as j,createStudioI18n as X}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{StudioI18nProvider as D}from"./StudioI18nProvider-fVsCSs5L.mjs";import{r as Z}from"./internal-BXEjuLPN.mjs";import{w as R}from"./recording-client-CFBkH4uZ.mjs";import F from"./STUDIO_ROOT_CLASS-C6MccdVk.mjs";import{a as K}from"./browser-storage-BH1MxLZs.mjs";import{c as W}from"./utils-bhneXptQ.mjs";import{B as ee}from"./button-q0UYSmrn.mjs";import{I as te}from"./input-CXhxesPC.mjs";import{jsx as f,jsxs as C}from"react/jsx-runtime";const M="lunora-studio-admin-token",oe=()=>{try{return K("session")?.getItem(M)??""}catch{return""}},ne=m=>{const e=K("session");if(e!==void 0)try{m===""?e.removeItem(M):e.setItem(M,m)}catch{}},ie="/_lunora/admin/ws-token",se=1e4,le=m=>{const e=m;return typeof e?.token=="string"&&e.token.length>0&&typeof e.expiresAtMs=="number"},re=m=>{const{adminToken:e,baseUrl:a}=m,o=m.fetchImpl??fetch;let l=a;for(;l.endsWith("/");)l=l.slice(0,-1);const r=`${l}${ie}`;let t,n;const i=async()=>{const s=await o(r,{headers:{authorization:`Bearer ${e}`},method:"POST"});if(!s.ok)throw new Error(`ws-token mint failed: ${String(s.status)}`);const u=await s.json().catch(()=>{});if(!le(u))throw new Error("ws-token mint failed: malformed response body");return t=u,u.token};return{getToken:async()=>t!==void 0&&t.expiresAtMs-se>Date.now()?t.token:(n??=i().finally(()=>{n=void 0}),n),invalidate:()=>{t=void 0}}},ae=m=>{const e=O(42),{onSubmit:a}=m,o=j(),[l,r]=B("");let t;e[0]!==l?(t=l.trim(),e[0]=l,e[1]=t):t=e[1];const n=t;let i;e[2]!==a||e[3]!==n?(i=_=>{_.preventDefault(),n!==""&&a(n)},e[2]=a,e[3]=n,e[4]=i):i=e[4];const s=i;let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=f("div",{className:"h-10 w-10 text-foreground",children:f(V,{})}),e[5]=u):u=e[5];let d;e[6]!==o?(d=o("Connect to Lunora Studio"),e[6]=o,e[7]=d):d=e[7];let v;e[8]!==d?(v=f("h1",{className:"text-base font-semibold text-foreground",children:d}),e[8]=d,e[9]=v):v=e[9];let k;e[10]!==o?(k=o("Enter your admin token to access the studio."),e[10]=o,e[11]=k):k=e[11];let p;e[12]!==k?(p=f("p",{className:"text-[13px] text-muted-foreground",children:k}),e[12]=k,e[13]=p):p=e[13];let h;e[14]!==v||e[15]!==p?(h=C("div",{className:"flex flex-col items-center gap-3 text-center",children:[u,C("div",{className:"flex flex-col gap-1",children:[v,p]})]}),e[14]=v,e[15]=p,e[16]=h):h=e[16];let g;e[17]!==o?(g=o("admin token"),e[17]=o,e[18]=g):g=e[18];let c;e[19]!==g?(c=f("label",{className:"text-xs font-medium text-foreground",htmlFor:"lunora-studio-login-token",children:g}),e[19]=g,e[20]=c):c=e[20];let b;e[21]===Symbol.for("react.memo_cache_sentinel")?(b=_=>{r(_.target.value)},e[21]=b):b=e[21];let x;e[22]!==l?(x=f(te,{autoComplete:"off",autoFocus:!0,"data-testid":"lunora-studio-login-token",id:"lunora-studio-login-token",onChange:b,placeholder:"LUNORA_ADMIN_TOKEN",type:"password",value:l}),e[22]=l,e[23]=x):x=e[23];let T;e[24]!==o?(T=o("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production."),e[24]=o,e[25]=T):T=e[25];let I;e[26]!==T?(I=f("p",{className:"text-[11px] text-muted-foreground",children:T}),e[26]=T,e[27]=I):I=e[27];let S;e[28]!==c||e[29]!==x||e[30]!==I?(S=C("div",{className:"flex flex-col gap-1.5",children:[c,x,I]}),e[28]=c,e[29]=x,e[30]=I,e[31]=S):S=e[31];const E=n==="";let y;e[32]!==o?(y=o("Connect"),e[32]=o,e[33]=y):y=e[33];let w;e[34]!==E||e[35]!==y?(w=f(ee,{"data-testid":"lunora-studio-login-submit",disabled:E,type:"submit",children:y}),e[34]=E,e[35]=y,e[36]=w):w=e[36];let N;return e[37]!==s||e[38]!==S||e[39]!==w||e[40]!==h?(N=C("form",{className:"flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg","data-testid":"lunora-studio-login",onSubmit:s,children:[h,S,w]}),e[37]=s,e[38]=S,e[39]=w,e[40]=h,e[41]=N):N=e[41],N},de=m=>{const e=O(10),{i18n:a,onSubmit:o}=m,{resolvedTheme:l}=U(),r=l==="dark"&&"dark";let t;e[0]!==r?(t=W(F,r,"flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground"),e[0]=r,e[1]=t):t=e[1];let n;e[2]!==o?(n=f(ae,{onSubmit:o}),e[2]=o,e[3]=n):n=e[3];let i;e[4]!==a||e[5]!==n?(i=f(D,{i18n:a,children:n}),e[4]=a,e[5]=n,e[6]=i):i=e[6];let s;return e[7]!==t||e[8]!==i?(s=f("div",{className:t,"data-testid":"lunora-studio-login-root",children:i}),e[7]=t,e[8]=i,e[9]=s):s=e[9],s},ce=m=>{const e=O(15),{basePath:a,chrome:o,studio:l}=m,r=j();let t;e[0]!==r?(t=r("Studio failed"),e[0]=r,e[1]=t):t=e[1];let n;e[2]!==r?(n=r("Studio"),e[2]=r,e[3]=n):n=e[3];let i;e[4]!==r?(i=r("Try again"),e[4]=r,e[5]=i):i=e[5];let s;e[6]!==a||e[7]!==o||e[8]!==l?(s=f(J,{...l,basePath:a,chrome:o}),e[6]=a,e[7]=o,e[8]=l,e[9]=s):s=e[9];let u;return e[10]!==t||e[11]!==n||e[12]!==i||e[13]!==s?(u=f(z,{fallbackTitle:t,label:n,retryLabel:i,children:s}),e[10]=t,e[11]=n,e[12]=i,e[13]=s,e[14]=u):u=e[14],u},fe=m=>{const e=O(20),{basePath:a,clearToken:o,client:l,i18n:r,onTokenChange:t,rulesInstalled:n,studio:i,token:s}=m,{resolvedTheme:u}=U();let d;e[0]!==o||e[1]!==t||e[2]!==n||e[3]!==s?(d={clearToken:o,onTokenChange:t,rulesInstalled:n,token:s},e[0]=o,e[1]=t,e[2]=n,e[3]=s,e[4]=d):d=e[4];const v=d,k=u==="dark"&&"dark";let p;e[5]!==k?(p=W(F,k,"flex h-dvh flex-col overflow-hidden bg-sidebar text-sm text-foreground"),e[5]=k,e[6]=p):p=e[6];let h;e[7]!==a||e[8]!==v||e[9]!==i?(h=f(q,{children:f(ce,{basePath:a,chrome:v,studio:i})}),e[7]=a,e[8]=v,e[9]=i,e[10]=h):h=e[10];let g;e[11]!==r||e[12]!==h?(g=f(D,{i18n:r,children:h}),e[11]=r,e[12]=h,e[13]=g):g=e[13];let c;e[14]!==l||e[15]!==g?(c=f(H,{client:l,children:g}),e[14]=l,e[15]=g,e[16]=c):c=e[16];let b;return e[17]!==p||e[18]!==c?(b=f("div",{className:p,"data-testid":"lunora-studio-app",children:c}),e[17]=p,e[18]=c,e[19]=b):b=e[19],b},Ee=m=>{const e=O(28);let a;e[0]!==m?(a=m===void 0?{}:m,e[0]=m,e[1]=a):a=e[1];const{adminToken:o,basePath:l,baseUrl:r,client:t,rulesInstalled:n,studio:i,locale:s}=a;let u;e[2]!==o?(u=()=>o??oe(),e[2]=o,e[3]=u):u=e[3];const[d,v]=B(u);let k,p;e[4]!==d?(k=()=>{ne(d)},p=[d],e[4]=d,e[5]=k,e[6]=p):(k=e[5],p=e[6]),$(k,p);const h=Q(d,300,d==="");let g;e:{if(t!==void 0){let A;e[7]!==t?(A=R(t),e[7]=t,e[8]=A):A=e[8],g=A;break e}let _;if(e[9]!==r||e[10]!==h){const A=Z(r),P=h===""?void 0:re({adminToken:h,baseUrl:A}),L=new G({url:A,...P===void 0?{}:{wsToken:P.getToken}});P!==void 0&&(L.setAuthToken(h),L.onTokenExpired(P.invalidate)),_=R(L),e[9]=r,e[10]=h,e[11]=_}else _=e[11];g=_}const c=g;let b,x;e[12]!==c||e[13]!==t?(b=()=>()=>{t===void 0&&c.close()},x=[c,t],e[12]=c,e[13]=t,e[14]=b,e[15]=x):(b=e[14],x=e[15]),$(b,x);let T;e[16]===Symbol.for("react.memo_cache_sentinel")?(T=_=>{v(_.target.value)},e[16]=T):T=e[16];const I=T;let S;e[17]===Symbol.for("react.memo_cache_sentinel")?(S=()=>{v("")},e[17]=S):S=e[17];const E=S;let y;e[18]!==s?(y=X(s),e[18]=s,e[19]=y):y=e[19];const w=y;let N;return e[20]!==l||e[21]!==c||e[22]!==w||e[23]!==t||e[24]!==n||e[25]!==i||e[26]!==d?(N=f(Y,{children:d===""&&t===void 0?f(de,{i18n:w,onSubmit:v}):f(fe,{basePath:l,clearToken:E,client:c,i18n:w,onTokenChange:I,rulesInstalled:n,studio:i,token:d})}),e[20]=l,e[21]=c,e[22]=w,e[23]=t,e[24]=n,e[25]=i,e[26]=d,e[27]=N):N=e[27],N};export{Ee as StudioApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useState as g}from"react";import{E as x}from"./error-alert-
|
|
1
|
+
import{useState as g}from"react";import{E as x}from"./error-alert-D-ftqyo-.mjs";import{C as N,a as y}from"./card-By2O8ULa.mjs";import{T as v,a as T,b as d,c as m,d as w,e as l}from"./table-D0SBiDu-.mjs";import{useT as E}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{c as L}from"./utils-bhneXptQ.mjs";import{jsxs as o,jsx as t}from"react/jsx-runtime";const C={ERROR:"error",INFO:"info",WARN:"warning"},z=e=>{const a=typeof e.metadata.table=="string"?e.metadata.table:void 0;return{description:`${e.detail} ${e.remediation}`,entity:a,issueType:e.title,key:e.cacheKey,level:C[e.level]}},R=["error","warning","info"],A={error:"bg-destructive",info:"bg-info",warning:"bg-warning"},$=(e,a)=>({error:e("Errors"),info:e("Info"),warning:e("Warnings")})[a],k=(e,a,n)=>({error:e("{count} errors",{count:n}),info:e("{count} suggestions",{count:n}),warning:e("{count} warnings",{count:n})})[a],V=(e,a)=>({error:e("No errors detected"),info:e("No suggestions"),warning:e("No warnings detected")})[a],O=e=>{const a={error:0,info:0,warning:0};for(const n of e??[])a[n.level]+=1;return a},F=({error:e=null,errorSource:a,rows:n,testId:i,toolbar:p})=>{const s=E(),[c,f]=g("error"),b=O(n),u=(n??[]).filter(r=>r.level===c),h=r=>{f(r.currentTarget.dataset.level)};return o("div",{className:"flex flex-col gap-3","data-testid":i,children:[t("div",{className:"flex border-b border-border",role:"tablist",children:R.map(r=>o("button",{"aria-selected":c===r,className:"flex min-w-32 flex-col gap-0.5 border-b-2 border-transparent px-4 py-2 text-start outline-none transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 aria-selected:border-foreground","data-level":r,"data-testid":`${i}-tab-${r}`,onClick:h,role:"tab",type:"button",children:[o("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[t("span",{"aria-hidden":"true",className:L("size-2 rounded-sm",A[r])}),$(s,r)]}),t("span",{className:"ps-4 text-xs text-muted-foreground",children:k(s,r,b[r])})]},r))}),p!==void 0&&t("div",{className:"flex flex-wrap items-center gap-2",children:p}),e!==null&&t(x,{error:a??e,testId:`${i}-error`}),t(N,{className:"overflow-hidden py-0",children:t(y,{className:"px-0",children:o(v,{children:[t(T,{children:o(d,{children:[t(m,{children:s("Issue type")}),t(m,{children:s("Entity/item")}),t(m,{children:s("Description")})]})}),t(w,{children:u.length===0?t(d,{children:o(l,{className:"h-40 text-center align-middle text-muted-foreground",colSpan:3,"data-testid":`${i}-empty`,children:[t("span",{className:"block text-sm font-medium text-foreground",children:V(s,c)}),t("span",{className:"block text-sm",children:s("Nothing to report for this deployment.")})]})}):u.map(r=>o(d,{children:[t(l,{className:"font-medium text-foreground",children:r.issueType}),t(l,{className:"font-mono text-xs text-muted-foreground",children:r.entity??"—"}),o(l,{className:"text-muted-foreground",children:[t("span",{children:r.description}),r.action!==void 0&&t("span",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:r.action})]})]},r.key))})]})})})]})};export{F as A,z as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{
|
|
1
|
+
import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{l as y}from"./internal-BXEjuLPN.mjs";import{jsx as i,jsxs as u}from"react/jsx-runtime";const N=(l,e)=>{if(e==="")return[{match:!1,offset:0,text:l}];const a=[],s=l.toLowerCase(),o=e.toLowerCase();let t=0;for(let r=s.indexOf(o);r!==-1;r=s.indexOf(o,t))r>t&&a.push({match:!1,offset:t,text:l.slice(t,r)}),a.push({match:!0,offset:r,text:l.slice(r,r+e.length)}),t=r+e.length;return t<l.length&&a.push({match:!1,offset:t,text:l.slice(t)}),a},v=l=>{const e=x(9),{highlight:a,value:s}=l;if(s==null){let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=i("span",{className:"text-muted-foreground/50 italic",children:"NULL"}),e[0]=n):n=e[0],n}let o,t,r;if(e[1]!==a||e[2]!==s){r=Symbol.for("react.early_return_sentinel");e:{const n=y(s);if(a===void 0||a===""){r=i("span",{title:n,children:n});break e}o=n,t=N(n,a).map(_)}e[1]=a,e[2]=s,e[3]=o,e[4]=t,e[5]=r}else o=e[3],t=e[4],r=e[5];if(r!==Symbol.for("react.early_return_sentinel"))return r;let d;return e[6]!==o||e[7]!==t?(d=i("span",{title:o,children:t}),e[6]=o,e[7]=t,e[8]=d):d=e[8],d},T=l=>{const e=x(22),{columns:a,rows:s}=l,o=w();let t;e[0]!==o?(t=o("Field"),e[0]=o,e[1]=t):t=e[1];let r;e[2]!==t?(r=i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase text-muted-foreground",children:t}),e[2]=t,e[3]=r):r=e[3];let d;if(e[4]!==s||e[5]!==o){let c;e[7]!==o?(c=(b,p)=>i("th",{className:"border-b border-border px-3 py-1.5 text-start font-mono text-[11px] tracking-wide uppercase tabular-nums text-muted-foreground",children:o("Row {n}",{n:p+1})},p),e[7]=o,e[8]=c):c=e[8],d=s.map(c),e[4]=s,e[5]=o,e[6]=d}else d=e[6];let n;e[9]!==r||e[10]!==d?(n=i("thead",{className:"sticky top-0 z-10 bg-muted",children:u("tr",{children:[r,d]})}),e[9]=r,e[10]=d,e[11]=n):n=e[11];let f;if(e[12]!==a||e[13]!==s){let c;e[15]!==s?(c=b=>u("tr",{className:"hover:bg-muted/40",children:[i("th",{className:"border-b border-e border-border px-3 py-1.5 text-start font-mono font-medium whitespace-nowrap",scope:"row",children:b}),s.map((p,g)=>i("td",{className:"max-w-md truncate border-b border-border px-3 py-1.5 font-mono",children:i(v,{value:p[b]})},g))]},b),e[15]=s,e[16]=c):c=e[16],f=a.map(c),e[12]=a,e[13]=s,e[14]=f}else f=e[14];let m;e[17]!==f?(m=i("tbody",{children:f}),e[17]=f,e[18]=m):m=e[18];let h;return e[19]!==n||e[20]!==m?(h=i("div",{className:"min-h-0 flex-1 overflow-auto","data-testid":"db-transposed",children:u("table",{className:"border-collapse text-xs",children:[n,m]})}),e[19]=n,e[20]=m,e[21]=h):h=e[21],h},j=({children:l,layout:e="card",testId:a})=>i("div",{className:e==="fill"?"flex min-h-0 flex-1 flex-col overflow-hidden border-t border-border":"overflow-x-auto border border-border bg-card","data-testid":a,children:l});function _(l){return i("mark",{className:l.match?"rounded-sm bg-warning/40 text-foreground":"bg-transparent text-inherit",children:l.text},l.offset)}export{v as C,j as G,T};
|
package/dist/packem_shared/{diagram-export-panel-DrYRni_b.mjs → diagram-export-panel-BMLzao0Y.mjs}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{Download01Icon as k}from"@hugeicons/core-free-icons";import{HugeiconsIcon as j}from"@hugeicons/react";import{getNodesBounds as N,getViewportForBounds as A,useNodes as L,useReactFlow as O,Panel as R}from"@xyflow/react";import{useState as x}from"react";import{LunoraError as U}from"@lunora/errors";import{toBlob as C,toSvg as M}from"html-to-image";import{useT as _}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as w,b as G}from"./internal-
|
|
2
|
+
import{Download01Icon as k}from"@hugeicons/core-free-icons";import{HugeiconsIcon as j}from"@hugeicons/react";import{getNodesBounds as N,getViewportForBounds as A,useNodes as L,useReactFlow as O,Panel as R}from"@xyflow/react";import{useState as x}from"react";import{LunoraError as U}from"@lunora/errors";import{toBlob as C,toSvg as M}from"html-to-image";import{useT as _}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as w,b as G}from"./internal-BXEjuLPN.mjs";import{d as I,D as F,c as H,b as f}from"./dropdown-menu-jLZenfWH.mjs";import{jsxs as p,jsx as g}from"react/jsx-runtime";const c=1920,m=1080,y=32,h=(e,r)=>{const o=globalThis.document.createElement("a");o.href=e,o.download=r,globalThis.document.body.append(o),o.click(),o.remove()},J=(e,r,o="schema-diagram.json")=>{const n={edges:r,exportedAt:new Date().toISOString(),nodes:e},s=JSON.stringify(n,void 0,2),a=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));h(a,o),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(a)},0)},v=(e,r,o,n)=>{const s=N(e),{x:a,y:i,zoom:t}=A(s,r,o,.1,2,n);return{transform:[a,i,t],zoom:t}},P=async(e,r,o="schema-diagram.png")=>{const{transform:n}=v(r,c,m,y),[s,a,i]=n,t=await C(e,{backgroundColor:"#ffffff",height:m,style:{transform:`translate(${s.toString()}px, ${a.toString()}px) scale(${i.toString()})`,transformOrigin:"top left",width:`${c.toString()}px`},width:c});if(t===null)throw new U("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(t);h(d,o),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},q=async(e,r,o="schema-diagram.svg")=>{const{transform:n}=v(r,c,m,y),[s,a,i]=n,t=await M(e,{backgroundColor:"#ffffff",height:m,style:{transform:`translate(${s.toString()}px, ${a.toString()}px) scale(${i.toString()})`,transformOrigin:"top left",width:`${c.toString()}px`},width:c});h(t,o)},to=({containerRef:e,filenameBase:r,testIdPrefix:o})=>{const n=_(),s=L(),{getEdges:a}=O(),[i,t]=x(null),[d,u]=x(null),b=l=>{u(n("Export failed: {message}",{message:G(l)}))},S=async()=>{const l=e.current?.querySelector(".react-flow__viewport");if(l){t("png");try{await P(l,s,`${r}.png`)}finally{t(null)}}},E=async()=>{const l=e.current?.querySelector(".react-flow__viewport");if(l){t("svg");try{await q(l,s,`${r}.svg`)}finally{t(null)}}},D=()=>{t("json");try{J(s,a(),`${r}.json`)}finally{t(null)}},T=()=>{u(null),w(S(),b)},$=()=>{u(null),w(E(),b)};return p(R,{position:"top-right",children:[p(I,{children:[p(F,{className:"group/button inline-flex shrink-0 cursor-pointer items-center justify-center gap-1 rounded-md border border-border bg-background px-2 text-xs font-medium whitespace-nowrap hover:bg-muted disabled:pointer-events-none disabled:opacity-50","data-testid":`${o}-export-trigger`,disabled:i!==null,children:[g(j,{className:"size-3.5",icon:k,strokeWidth:2}),n("Export")]}),p(H,{align:"end",children:[g(f,{"data-testid":`${o}-export-png`,disabled:i!==null,onClick:T,children:n("PNG")}),g(f,{"data-testid":`${o}-export-svg`,disabled:i!==null,onClick:$,children:n("SVG")}),g(f,{"data-testid":`${o}-export-json`,disabled:i!==null,onClick:D,children:n("JSON")})]})]}),d!==null&&g("p",{className:"mt-1 max-w-64 text-right text-xs text-destructive","data-testid":`${o}-export-error`,role:"alert",children:d})]})};export{to as D};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as O}from"react/compiler-runtime";import{flattenHint as j}from"@lunora/errors";import{useT as q}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as E,a as H,b as S}from"./internal-
|
|
1
|
+
import{c as O}from"react/compiler-runtime";import{flattenHint as j}from"@lunora/errors";import{useT as q}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as E,a as H,b as S}from"./internal-BXEjuLPN.mjs";import{o as T}from"./recording-client-CFBkH4uZ.mjs";import{u as U}from"./operation-console-provider-DoloEvon.mjs";import{A as V}from"./alert-PB5W11MM.mjs";import{jsx as h,jsxs as D}from"react/jsx-runtime";const K=I=>{const e=O(42),{className:N,error:t,testId:g}=I,C=q(),o=U();let i,s,n,a,c,m,r,l,f;if(e[0]!==N||e[1]!==t||e[2]!==o||e[3]!==g){const A=E(t);let b;e[13]!==t?(b=H(t),e[13]=t,e[14]=b):b=e[14],s=b;let w;e[15]!==t?(w=T(t),e[15]=t,e[16]=w):w=e[16];const k=w,v=t?.why;let y;e[17]!==o||e[18]!==k?(y=()=>{o?.openConsole({errorsOnly:!0,seq:k})},e[17]=o,e[18]=k,e[19]=y):y=e[19],n=y,i=V,a=N,c=g,m="destructive";let d;e[20]!==t?(d=S(t),e[20]=t,e[21]=d):d=e[21],e[22]!==d?(r=h("p",{className:"font-medium",children:d}),e[22]=d,e[23]=r):r=e[23],e[24]!==v?(l=typeof v=="string"?h("p",{className:"mt-1 text-xs opacity-90",children:v}):null,e[24]=v,e[25]=l):l=e[25],f=A===void 0?null:h("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:j(A)}),e[0]=N,e[1]=t,e[2]=o,e[3]=g,e[4]=i,e[5]=s,e[6]=n,e[7]=a,e[8]=c,e[9]=m,e[10]=r,e[11]=l,e[12]=f}else i=e[4],s=e[5],n=e[6],a=e[7],c=e[8],m=e[9],r=e[10],l=e[11],f=e[12];let p;e[26]!==s?(p=s===void 0?null:h("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:s,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[26]=s,e[27]=p):p=e[27];let u;e[28]!==o||e[29]!==n||e[30]!==C?(u=o===void 0?null:h("button",{className:"mt-1 block text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"error-show-in-console",onClick:n,type:"button",children:C("Show in console")}),e[28]=o,e[29]=n,e[30]=C,e[31]=u):u=e[31];let x;return e[32]!==i||e[33]!==a||e[34]!==c||e[35]!==m||e[36]!==r||e[37]!==l||e[38]!==f||e[39]!==p||e[40]!==u?(x=D(i,{className:a,testId:c,variant:m,children:[r,l,f,p,u]}),e[32]=i,e[33]=a,e[34]=c,e[35]=m,e[36]=r,e[37]=l,e[38]=f,e[39]=p,e[40]=u,e[41]=x):x=e[41],x};export{K as E};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as E}from"react/compiler-runtime";import{useState as A,useEffect as Y}from"react";import{ConfirmButton as z}from"./ConfirmButton-DU4p72Er.mjs";import{D as Q,a as I,b as v,c as H,d as P,e as V,f as U,g as q}from"./dropdown-menu-jLZenfWH.mjs";import{M as X}from"./modal-shell-CDztwLnv.mjs";import{useT as R}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{
|
|
1
|
+
import{c as E}from"react/compiler-runtime";import{useState as A,useEffect as Y}from"react";import{ConfirmButton as z}from"./ConfirmButton-DU4p72Er.mjs";import{D as Q,a as I,b as v,c as H,d as P,e as V,f as U,g as q}from"./dropdown-menu-jLZenfWH.mjs";import{M as X}from"./modal-shell-CDztwLnv.mjs";import{useT as R}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{l as B,g as Z,k as W,f as ee}from"./internal-BXEjuLPN.mjs";import{C as L}from"./control-button-BOZ5K-FC.mjs";import{jsx as u,jsxs as $}from"react/jsx-runtime";const F=l=>`"${l.replaceAll('"','""')}"`,te=/["\n\r,]/u,le=/^[=+\-@\t\r]/u,J=l=>{if(l==null)return"";let e;return typeof l=="string"?e=le.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=B(l),te.test(e)?`"${e.replaceAll('"','""')}"`:e},ne=(l,e)=>{const n=l.map(t=>J(t)).join(","),o=e.map(t=>l.map(r=>J(t[r])).join(","));return[n,...o].join(`
|
|
2
2
|
`)},oe=l=>JSON.stringify(l,W,2),G=500,K=l=>l==null?"NULL":typeof l=="number"?Number.isFinite(l)?String(l):"NULL":typeof l=="bigint"?String(l):typeof l=="boolean"?l?"1":"0":`'${(typeof l=="string"?l:B(l)).replaceAll("'","''")}'`,D="__doc__",se=(l,e,n,o)=>{if(e.length===0||n.length===0)return"";const t=o?.includes(D)===!0&&!e.includes(D)?e.filter(c=>!o.includes(c)):void 0,r=t===void 0?e:o,i=(c,m)=>K(t===void 0||m!==D?c[m]:JSON.stringify(Object.fromEntries(t.map(a=>[a,c[a]])),W)),s=r.map(c=>F(c)).join(", "),f=[];for(let c=0;c<n.length;c+=G){const m=n.slice(c,c+G).map(a=>` (${r.map(d=>i(a,d)).join(", ")})`).join(`,
|
|
3
3
|
`);f.push(`INSERT INTO ${F(l)} (${s}) VALUES
|
|
4
4
|
${m};`)}return f.join(`
|
|
5
5
|
|
|
6
|
-
`)},M=(l,e,n)=>{if(!("document"in globalThis))return;const o=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),t=globalThis.document.createElement("a");t.href=o,t.download=l,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(o)},ie=l=>{const e=E(37),{columns:n,name:o,rows:t,sqlColumns:r}=l,i=R();let s;e[0]!==n||e[1]!==o||e[2]!==t?(s=()=>{M(`${o}.csv`,ne(n,t),"text/csv;charset=utf-8")},e[0]=n,e[1]=o,e[2]=t,e[3]=s):s=e[3];const f=s;let c;e[4]!==o||e[5]!==t?(c=()=>{M(`${o}.json`,oe(t),"application/json")},e[4]=o,e[5]=t,e[6]=c):c=e[6];const m=c;let a;e[7]!==n||e[8]!==o||e[9]!==t||e[10]!==r?(a=()=>{M(`${o}.sql`,se(o,n,t,r),"application/sql;charset=utf-8")},e[7]=n,e[8]=o,e[9]=t,e[10]=r,e[11]=a):a=e[11];const d=a,k=t.length===0;let p;e[12]!==k?(p=u(Q,{className:L,"data-testid":"grid-export",disabled:k,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[12]=k,e[13]=p):p=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=u(I,{children:"Export loaded rows"}),e[14]=C):C=e[14];let g;e[15]!==i?(g=i("CSV"),e[15]=i,e[16]=g):g=e[16];let y;e[17]!==f||e[18]!==g?(y=u(v,{"data-testid":"grid-export-csv",onClick:f,children:g}),e[17]=f,e[18]=g,e[19]=y):y=e[19];let N;e[20]!==i?(N=i("JSON"),e[20]=i,e[21]=N):N=e[21];let x;e[22]!==m||e[23]!==N?(x=u(v,{"data-testid":"grid-export-json",onClick:m,children:N}),e[22]=m,e[23]=N,e[24]=x):x=e[24];let S;e[25]!==i?(S=i("SQL"),e[25]=i,e[26]=S):S=e[26];let h;e[27]!==d||e[28]!==S?(h=u(v,{"data-testid":"grid-export-sql",onClick:d,children:S}),e[27]=d,e[28]=S,e[29]=h):h=e[29];let b;e[30]!==x||e[31]!==h||e[32]!==y?(b=$(H,{align:"end",children:[C,y,x,h]}),e[30]=x,e[31]=h,e[32]=y,e[33]=b):b=e[33];let w;return e[34]!==b||e[35]!==p?(w=$(P,{children:[p,b]}),e[34]=b,e[35]=p,e[36]=w):w=e[36],w},re=l=>{const e=E(9),{column:n}=l;let o;e[0]!==n?(o=()=>{n.toggleVisibility()},e[0]=n,e[1]=o):o=e[1];const t=o;let r;e[2]!==n?(r=n.getIsVisible(),e[2]=n,e[3]=r):r=e[3];const i=`grid-column-${n.id}`;let s;return e[4]!==n.id||e[5]!==t||e[6]!==r||e[7]!==i?(s=u(U,{checked:r,closeOnClick:!1,"data-testid":i,onCheckedChange:t,children:n.id}),e[4]=n.id,e[5]=t,e[6]=r,e[7]=i,e[8]=s):s=e[8],s},ce=[],ae=({backRelations:l=ce,enabledBackRelations:e,onToggleBackRelation:n,table:o})=>{const t=R(),r=o.getIsAllColumnsVisible(),i=()=>{o.toggleAllColumnsVisible(!r)};return $(P,{children:[u(Q,{className:L,"data-testid":"grid-columns",children:t("Columns")}),$(H,{align:"end",className:"max-h-80 overflow-y-auto",children:[$(V,{children:[u(I,{children:t("Columns")}),u(U,{checked:r,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:t(r?"Hide all":"Show all")}),u(q,{}),o.getAllLeafColumns().filter(s=>!s.id.startsWith("__back__:")).map(s=>u(re,{column:s},s.id))]}),l.length>0&&n!==void 0&&$(V,{children:[u(q,{}),u(I,{children:t("Related")}),l.map(s=>{const f=`${s.table}.${s.column}`;return u(U,{checked:e?.has(f)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${f}`,onCheckedChange:()=>{n(f)},children:`← ${s.table}.${s.column}`},f)})]})]})]})},de=l=>{const e=E(19),{count:n,editable:o,onClear:t,onDelete:r}=l,i=R();let s;e[0]!==n||e[1]!==i?(s=i("{count} selected",{count:n}),e[0]=n,e[1]=i,e[2]=s):s=e[2];let f;e[3]!==s?(f=u("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:s}),e[3]=s,e[4]=f):f=e[4];let c;e[5]!==i?(c=i("Clear"),e[5]=i,e[6]=c):c=e[6];let m;e[7]!==t||e[8]!==c?(m=u("button",{className:L,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:c}),e[7]=t,e[8]=c,e[9]=m):m=e[9];let a;e[10]!==n||e[11]!==o||e[12]!==r||e[13]!==i?(a=o&&u(z,{confirmLabel:i("Delete {count} rows and everything that cascades?",{count:n}),onConfirm:r,testId:"grid-selection-delete",children:i("Delete {count}",{count:n})}),e[10]=n,e[11]=o,e[12]=r,e[13]=i,e[14]=a):a=e[14];let d;return e[15]!==f||e[16]!==m||e[17]!==a?(d=$("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[f,m,a]}),e[15]=f,e[16]=m,e[17]=a,e[18]=d):d=e[18],d},fe=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,me=l=>{const e=E(9),{bucket:n,objectKey:o,resolveUrl:t}=l,[r,i]=A(null),[s,f]=A(!1);let c,m;e[0]!==n||e[1]!==o||e[2]!==t?(c=()=>{const p={cancelled:!1};return ee((async()=>{try{const C=await t(o,n);p.cancelled||i(C)}catch{p.cancelled||f(!0)}})()),()=>{p.cancelled=!0}},m=[n,o,t],e[0]=n,e[1]=o,e[2]=t,e[3]=c,e[4]=m):(c=e[3],m=e[4]),Y(c,m);let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{f(!0)},e[5]=a):a=e[5];const d=a;if(r===null||s)return null;let k;return e[6]!==o||e[7]!==r?(k=u("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u("img",{alt:o,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:d,src:r})}),e[6]=o,e[7]=r,e[8]=k):k=e[8],k},Se=l=>{const e=E(37),{bucket:n,column:o,onClose:t,resolveUrl:r,value:i}=l,s=R(),[f,c]=A(!1);let m;e[0]!==i?(m=B(i),e[0]=i,e[1]=m):m=e[1];const a=m;let d;e[2]!==a?(d=()=>{Z(a)&&c(!0)},e[2]=a,e[3]=d):d=e[3];const k=d;let p;e[4]!==s?(p=s("Cell value"),e[4]=s,e[5]=p):p=e[5];let C;e[6]!==o?(C=u("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=C):C=e[7];let g;e[8]!==f||e[9]!==s?(g=s(f?"Copied":"Copy"),e[8]=f,e[9]=s,e[10]=g):g=e[10];let y;e[11]!==k||e[12]!==g?(y=u("button",{className:L,"data-testid":"grid-cell-copy",onClick:k,type:"button",children:g}),e[11]=k,e[12]=g,e[13]=y):y=e[13];let N;e[14]!==s?(N=s("Close"),e[14]=s,e[15]=N):N=e[15];let x;e[16]!==t||e[17]!==N?(x=u("button",{className:L,"data-testid":"grid-cell-close",onClick:t,type:"button",children:N}),e[16]=t,e[17]=N,e[18]=x):x=e[18];let S;e[19]!==y||e[20]!==x?(S=$("div",{className:"flex items-center gap-1.5",children:[y,x]}),e[19]=y,e[20]=x,e[21]=S):S=e[21];let h;e[22]!==C||e[23]!==S?(h=$("div",{className:"flex items-center justify-between",children:[C,S]}),e[22]=C,e[23]=S,e[24]=h):h=e[24];let b;e[25]!==n||e[26]!==r||e[27]!==i?(b=r!==void 0&&typeof i=="string"&&fe.test(i)&&u(me,{bucket:n,objectKey:i,resolveUrl:r}),e[25]=n,e[26]=r,e[27]=i,e[28]=b):b=e[28];let w;e[29]!==a?(w=u("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:a}),e[29]=a,e[30]=w):w=e[30];let _;return e[31]!==t||e[32]!==h||e[33]!==b||e[34]!==w||e[35]!==p?(_=$(X,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:p,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[h,b,w]}),e[31]=t,e[32]=h,e[33]=b,e[34]=w,e[35]=p,e[36]=_):_=e[36],_},ke=l=>{const e=E(37),{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,columns:r,editable:i,name:s,onBulkDelete:f,onToggleTranspose:c,rows:m,sqlColumns:a,table:d,transposed:k}=l,p=R();let C;e[0]!==d?(C=d.getSelectedRowModel(),e[0]=d,e[1]=C):C=e[1];const g=C.rows;let y;e[2]!==d?(y=()=>{d.resetRowSelection()},e[2]=d,e[3]=y):y=e[3];const N=y;let x;e[4]!==f||e[5]!==g||e[6]!==d?(x=()=>{f(g.map(ue)),d.resetRowSelection()},e[4]=f,e[5]=g,e[6]=d,e[7]=x):x=e[7];const S=x;let h;e[8]!==r||e[9]!==s||e[10]!==m||e[11]!==a?(h=u(ie,{columns:r,name:s,rows:m,sqlColumns:a}),e[8]=r,e[9]=s,e[10]=m,e[11]=a,e[12]=h):h=e[12];let b;e[13]!==n||e[14]!==o||e[15]!==t||e[16]!==d?(b=u(ae,{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,table:d}),e[13]=n,e[14]=o,e[15]=t,e[16]=d,e[17]=b):b=e[17];let w;e[18]!==p?(w=p("Swap rows and columns"),e[18]=p,e[19]=w):w=e[19];let _;e[20]!==p?(_=p("Transpose"),e[20]=p,e[21]=_):_=e[21];let
|
|
6
|
+
`)},M=(l,e,n)=>{if(!("document"in globalThis))return;const o=globalThis.URL.createObjectURL(new globalThis.Blob([e],{type:n})),t=globalThis.document.createElement("a");t.href=o,t.download=l,globalThis.document.body.append(t),t.click(),t.remove(),globalThis.URL.revokeObjectURL(o)},ie=l=>{const e=E(37),{columns:n,name:o,rows:t,sqlColumns:r}=l,i=R();let s;e[0]!==n||e[1]!==o||e[2]!==t?(s=()=>{M(`${o}.csv`,ne(n,t),"text/csv;charset=utf-8")},e[0]=n,e[1]=o,e[2]=t,e[3]=s):s=e[3];const f=s;let c;e[4]!==o||e[5]!==t?(c=()=>{M(`${o}.json`,oe(t),"application/json")},e[4]=o,e[5]=t,e[6]=c):c=e[6];const m=c;let a;e[7]!==n||e[8]!==o||e[9]!==t||e[10]!==r?(a=()=>{M(`${o}.sql`,se(o,n,t,r),"application/sql;charset=utf-8")},e[7]=n,e[8]=o,e[9]=t,e[10]=r,e[11]=a):a=e[11];const d=a,k=t.length===0;let p;e[12]!==k?(p=u(Q,{className:L,"data-testid":"grid-export",disabled:k,title:"Exports only the rows loaded on the current page, not the whole table",children:"Export page"}),e[12]=k,e[13]=p):p=e[13];let C;e[14]===Symbol.for("react.memo_cache_sentinel")?(C=u(I,{children:"Export loaded rows"}),e[14]=C):C=e[14];let g;e[15]!==i?(g=i("CSV"),e[15]=i,e[16]=g):g=e[16];let y;e[17]!==f||e[18]!==g?(y=u(v,{"data-testid":"grid-export-csv",onClick:f,children:g}),e[17]=f,e[18]=g,e[19]=y):y=e[19];let N;e[20]!==i?(N=i("JSON"),e[20]=i,e[21]=N):N=e[21];let x;e[22]!==m||e[23]!==N?(x=u(v,{"data-testid":"grid-export-json",onClick:m,children:N}),e[22]=m,e[23]=N,e[24]=x):x=e[24];let S;e[25]!==i?(S=i("SQL"),e[25]=i,e[26]=S):S=e[26];let h;e[27]!==d||e[28]!==S?(h=u(v,{"data-testid":"grid-export-sql",onClick:d,children:S}),e[27]=d,e[28]=S,e[29]=h):h=e[29];let b;e[30]!==x||e[31]!==h||e[32]!==y?(b=$(H,{align:"end",children:[C,y,x,h]}),e[30]=x,e[31]=h,e[32]=y,e[33]=b):b=e[33];let w;return e[34]!==b||e[35]!==p?(w=$(P,{children:[p,b]}),e[34]=b,e[35]=p,e[36]=w):w=e[36],w},re=l=>{const e=E(9),{column:n}=l;let o;e[0]!==n?(o=()=>{n.toggleVisibility()},e[0]=n,e[1]=o):o=e[1];const t=o;let r;e[2]!==n?(r=n.getIsVisible(),e[2]=n,e[3]=r):r=e[3];const i=`grid-column-${n.id}`;let s;return e[4]!==n.id||e[5]!==t||e[6]!==r||e[7]!==i?(s=u(U,{checked:r,closeOnClick:!1,"data-testid":i,onCheckedChange:t,children:n.id}),e[4]=n.id,e[5]=t,e[6]=r,e[7]=i,e[8]=s):s=e[8],s},ce=[],ae=({backRelations:l=ce,enabledBackRelations:e,onToggleBackRelation:n,table:o})=>{const t=R(),r=o.getIsAllColumnsVisible(),i=()=>{o.toggleAllColumnsVisible(!r)};return $(P,{children:[u(Q,{className:L,"data-testid":"grid-columns",children:t("Columns")}),$(H,{align:"end",className:"max-h-80 overflow-y-auto",children:[$(V,{children:[u(I,{children:t("Columns")}),u(U,{checked:r,closeOnClick:!1,"data-testid":"grid-columns-all",onCheckedChange:i,children:t(r?"Hide all":"Show all")}),u(q,{}),o.getAllLeafColumns().filter(s=>!s.id.startsWith("__back__:")).map(s=>u(re,{column:s},s.id))]}),l.length>0&&n!==void 0&&$(V,{children:[u(q,{}),u(I,{children:t("Related")}),l.map(s=>{const f=`${s.table}.${s.column}`;return u(U,{checked:e?.has(f)===!0,closeOnClick:!1,"data-testid":`grid-back-relation-${f}`,onCheckedChange:()=>{n(f)},children:`← ${s.table}.${s.column}`},f)})]})]})]})},de=l=>{const e=E(19),{count:n,editable:o,onClear:t,onDelete:r}=l,i=R();let s;e[0]!==n||e[1]!==i?(s=i("{count} selected",{count:n}),e[0]=n,e[1]=i,e[2]=s):s=e[2];let f;e[3]!==s?(f=u("span",{className:"font-medium tabular-nums","data-testid":"grid-selection-count",children:s}),e[3]=s,e[4]=f):f=e[4];let c;e[5]!==i?(c=i("Clear"),e[5]=i,e[6]=c):c=e[6];let m;e[7]!==t||e[8]!==c?(m=u("button",{className:L,"data-testid":"grid-selection-clear",onClick:t,type:"button",children:c}),e[7]=t,e[8]=c,e[9]=m):m=e[9];let a;e[10]!==n||e[11]!==o||e[12]!==r||e[13]!==i?(a=o&&u(z,{confirmLabel:i("Delete {count} rows and everything that cascades?",{count:n}),onConfirm:r,testId:"grid-selection-delete",children:i("Delete {count}",{count:n})}),e[10]=n,e[11]=o,e[12]=r,e[13]=i,e[14]=a):a=e[14];let d;return e[15]!==f||e[16]!==m||e[17]!==a?(d=$("div",{className:"flex items-center gap-2 rounded-md border border-border bg-accent/40 px-3 py-1.5 text-xs","data-testid":"grid-selection-bar",children:[f,m,a]}),e[15]=f,e[16]=m,e[17]=a,e[18]=d):d=e[18],d},fe=/\.(?:avif|bmp|gif|ico|jpe?g|png|svg|webp)$/iu,me=l=>{const e=E(9),{bucket:n,objectKey:o,resolveUrl:t}=l,[r,i]=A(null),[s,f]=A(!1);let c,m;e[0]!==n||e[1]!==o||e[2]!==t?(c=()=>{const p={cancelled:!1};return ee((async()=>{try{const C=await t(o,n);p.cancelled||i(C)}catch{p.cancelled||f(!0)}})()),()=>{p.cancelled=!0}},m=[n,o,t],e[0]=n,e[1]=o,e[2]=t,e[3]=c,e[4]=m):(c=e[3],m=e[4]),Y(c,m);let a;e[5]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{f(!0)},e[5]=a):a=e[5];const d=a;if(r===null||s)return null;let k;return e[6]!==o||e[7]!==r?(k=u("div",{className:"flex max-h-64 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/30",children:u("img",{alt:o,className:"max-h-64 object-contain","data-testid":"grid-cell-image",onError:d,src:r})}),e[6]=o,e[7]=r,e[8]=k):k=e[8],k},Se=l=>{const e=E(37),{bucket:n,column:o,onClose:t,resolveUrl:r,value:i}=l,s=R(),[f,c]=A(!1);let m;e[0]!==i?(m=B(i),e[0]=i,e[1]=m):m=e[1];const a=m;let d;e[2]!==a?(d=()=>{Z(a)&&c(!0)},e[2]=a,e[3]=d):d=e[3];const k=d;let p;e[4]!==s?(p=s("Cell value"),e[4]=s,e[5]=p):p=e[5];let C;e[6]!==o?(C=u("h2",{className:"truncate font-mono text-sm font-semibold text-foreground",children:o}),e[6]=o,e[7]=C):C=e[7];let g;e[8]!==f||e[9]!==s?(g=s(f?"Copied":"Copy"),e[8]=f,e[9]=s,e[10]=g):g=e[10];let y;e[11]!==k||e[12]!==g?(y=u("button",{className:L,"data-testid":"grid-cell-copy",onClick:k,type:"button",children:g}),e[11]=k,e[12]=g,e[13]=y):y=e[13];let N;e[14]!==s?(N=s("Close"),e[14]=s,e[15]=N):N=e[15];let x;e[16]!==t||e[17]!==N?(x=u("button",{className:L,"data-testid":"grid-cell-close",onClick:t,type:"button",children:N}),e[16]=t,e[17]=N,e[18]=x):x=e[18];let S;e[19]!==y||e[20]!==x?(S=$("div",{className:"flex items-center gap-1.5",children:[y,x]}),e[19]=y,e[20]=x,e[21]=S):S=e[21];let h;e[22]!==C||e[23]!==S?(h=$("div",{className:"flex items-center justify-between",children:[C,S]}),e[22]=C,e[23]=S,e[24]=h):h=e[24];let b;e[25]!==n||e[26]!==r||e[27]!==i?(b=r!==void 0&&typeof i=="string"&&fe.test(i)&&u(me,{bucket:n,objectKey:i,resolveUrl:r}),e[25]=n,e[26]=r,e[27]=i,e[28]=b):b=e[28];let w;e[29]!==a?(w=u("pre",{className:"min-h-0 flex-1 overflow-auto rounded-md border border-border bg-muted/30 p-3 font-mono text-xs whitespace-pre-wrap","data-testid":"grid-cell-value",children:a}),e[29]=a,e[30]=w):w=e[30];let _;return e[31]!==t||e[32]!==h||e[33]!==b||e[34]!==w||e[35]!==p?(_=$(X,{className:"max-h-[70vh] w-[min(40rem,90vw)]",label:p,onClose:t,panelTestId:"grid-cell-dialog",testId:"grid-cell-dialog-overlay",variant:"dialog",children:[h,b,w]}),e[31]=t,e[32]=h,e[33]=b,e[34]=w,e[35]=p,e[36]=_):_=e[36],_},ke=l=>{const e=E(37),{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,columns:r,editable:i,name:s,onBulkDelete:f,onToggleTranspose:c,rows:m,sqlColumns:a,table:d,transposed:k}=l,p=R();let C;e[0]!==d?(C=d.getSelectedRowModel(),e[0]=d,e[1]=C):C=e[1];const g=C.rows;let y;e[2]!==d?(y=()=>{d.resetRowSelection()},e[2]=d,e[3]=y):y=e[3];const N=y;let x;e[4]!==f||e[5]!==g||e[6]!==d?(x=()=>{f(g.map(ue)),d.resetRowSelection()},e[4]=f,e[5]=g,e[6]=d,e[7]=x):x=e[7];const S=x;let h;e[8]!==r||e[9]!==s||e[10]!==m||e[11]!==a?(h=u(ie,{columns:r,name:s,rows:m,sqlColumns:a}),e[8]=r,e[9]=s,e[10]=m,e[11]=a,e[12]=h):h=e[12];let b;e[13]!==n||e[14]!==o||e[15]!==t||e[16]!==d?(b=u(ae,{backRelations:n,enabledBackRelations:o,onToggleBackRelation:t,table:d}),e[13]=n,e[14]=o,e[15]=t,e[16]=d,e[17]=b):b=e[17];let w;e[18]!==p?(w=p("Swap rows and columns"),e[18]=p,e[19]=w):w=e[19];let _;e[20]!==p?(_=p("Transpose"),e[20]=p,e[21]=_):_=e[21];let T;e[22]!==c||e[23]!==w||e[24]!==_||e[25]!==k?(T=u("button",{"aria-pressed":k,className:L,"data-testid":"grid-transpose",onClick:c,title:w,type:"button",children:_}),e[22]=c,e[23]=w,e[24]=_,e[25]=k,e[26]=T):T=e[26];let j;e[27]!==i||e[28]!==N||e[29]!==S||e[30]!==g.length?(j=g.length>0&&u(de,{count:g.length,editable:i,onClear:N,onDelete:S}),e[27]=i,e[28]=N,e[29]=S,e[30]=g.length,e[31]=j):j=e[31];let O;return e[32]!==h||e[33]!==b||e[34]!==T||e[35]!==j?(O=$("div",{className:"flex flex-wrap items-center gap-1.5","data-testid":"grid-actions",children:[h,b,T,j]}),e[32]=h,e[33]=b,e[34]=T,e[35]=j,e[36]=O):O=e[36],O};function ue(l){return l.id}export{Se as C,ie as E,ke as G,de as S,M as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as A}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Fe,useEffect as Ue,Suspense as et,lazy as tt}from"react";import{B as Ye}from"./badge-r_5B4LHP.mjs";import{C as B,a as Ze}from"./card-By2O8ULa.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-
|
|
1
|
+
import{c as A}from"react/compiler-runtime";import{useNavigate as Je}from"@tanstack/react-router";import{useState as Fe,useEffect as Ue,Suspense as et,lazy as tt}from"react";import{B as Ye}from"./badge-r_5B4LHP.mjs";import{C as B,a as Ze}from"./card-By2O8ULa.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-I1uILsUP.mjs";import{useT as I}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{ADMIN_FUNCTIONS as ye}from"./ADMIN_FUNCTIONS-B8yyk5BX.mjs";import{c as nt,f as Ne,d as lt,w as at,g as rt,n as ot}from"./internal-BXEjuLPN.mjs";import{c as Xe}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as qe}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ve}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Ke={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,privacy:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return;const{id:e,name:n,unsupported:s}=t;if(!(typeof e!="string"||typeof n!="string"||!Array.isArray(s)))return{id:e,name:n,unsupported:s.filter(a=>typeof a=="string")}},ut=t=>{if(t===null||typeof t!="object")return Ke;const e=t,n=s=>typeof e[s]=="boolean"?e[s]:!0;return{analytics:n("analytics"),auth:n("auth"),containers:n("containers"),flags:n("flags"),kv:n("kv"),mail:n("mail"),notifications:n("notifications"),payments:n("payments"),privacy:n("privacy"),platform:dt(e.platform),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},mt={...Ke,settled:!1},ft=()=>{const t=A(3),e=qe(),[n,s]=Fe(void 0);let a,r;return t[0]!==e?(a=()=>{const i=new AbortController;return Ne((async()=>{let o;try{o={...ut(await e.query(ct,{},lt(""))),settled:!0}}catch{o={...Ke,settled:!0}}i.signal.aborted||s({client:e,features:o})})()),()=>{i.abort()}},r=[e],t[0]=e,t[1]=a,t[2]=r):(a=t[1],r=t[2]),Ue(a,r),n?.client===e?n.features:mt},pt=()=>{const t=A(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-4 text-muted-foreground",fill:"none",stroke:"currentColor",strokeWidth:1.6,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6",strokeLinecap:"round",strokeLinejoin:"round"})}),t[0]=e):e=t[0],e},ht=t=>{const e=A(24),{group:n}=t,s=I(),a=Je();let r;e[0]!==n.tab||e[1]!==a?(r=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=r):r=e[2];const i=r,o=n.bindings.length;let c;e[3]!==n.label?(c=l("span",{className:"text-sm font-medium text-foreground",children:n.label}),e[3]=n.label,e[4]=c):c=e[4];let u;e[5]===Symbol.for("react.memo_cache_sentinel")?(u=l(pt,{}),e[5]=u):u=e[5];let m;e[6]!==c?(m=h("div",{className:"flex items-center justify-between",children:[c,u]}),e[6]=c,e[7]=m):m=e[7];let d;e[8]!==o||e[9]!==s?(d=o===1?s("1 binding"):s("{count} bindings",{count:o}),e[8]=o,e[9]=s,e[10]=d):d=e[10];let f;e[11]!==d?(f=l("span",{className:"text-xs text-muted-foreground",children:d}),e[11]=d,e[12]=f):f=e[12];let p;e[13]!==o||e[14]!==n.bindings?(p=o>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(bt)}),e[13]=o,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==m||e[17]!==f||e[18]!==p?(g=h(Ze,{className:"flex flex-col gap-2 py-4",children:[m,f,p]}),e[16]=m,e[17]=f,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==i||e[22]!==g?(x=l(B,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:i,children:g}),e[20]=n.testId,e[21]=i,e[22]=g,e[23]=x):x=e[23],x},We=["kv","files","vectors"],gt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>We.indexOf(n.tab)-We.indexOf(s.tab)),xt=()=>{const t=A(19),e=qe(),n=ft(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[r,i]=Fe(a);let o,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(o=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(yt),tab:"kv",testId:"home-binding-kv"},{enabled:n.storage,label:s("R2 Buckets"),load:()=>e.listStorageBuckets(),tab:"files",testId:"home-binding-r2"},{enabled:n.vectors,label:s("Vectorize Indexes"),load:async()=>(await e.listVectorIndexes()).map(vt),tab:"vectors",testId:"home-binding-vectors"}];for(const b of x)b.enabled&&Ne((async()=>{try{const v=await b.load();if(!g.cancelled){const _={bindings:v,label:b.label,tab:b.tab,testId:b.testId};i(S=>gt(S,_))}}catch{}})());return()=>{g.cancelled=!0}},c=[e,n.kv,n.storage,n.vectors,s],t[1]=e,t[2]=n.kv,t[3]=n.storage,t[4]=n.vectors,t[5]=s,t[6]=o,t[7]=c):(o=t[6],c=t[7]),Ue(o,c),r.length===0)return null;let u;t[8]!==s?(u=s("Bindings"),t[8]=s,t[9]=u):u=t[9];let m;t[10]!==u?(m=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:u}),t[10]=u,t[11]=m):m=t[11];let d;t[12]!==r?(d=r.map(Nt),t[12]=r,t[13]=d):d=t[13];let f;t[14]!==d?(f=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:d}),t[14]=d,t[15]=f):f=t[15];let p;return t[16]!==m||t[17]!==f?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[m,f]}),t[16]=m,t[17]=f,t[18]=p):p=t[18],p};function bt(t){return l(Ye,{variant:"secondary",children:t},t)}function yt(t){return t.binding}function vt(t){return t.name}function Nt(t){return l(ht,{group:t},t.tab)}const _t=[{name:"lunora_list_functions",summary:"list every query, mutation, and action with its path"},{name:"lunora_list_tables",summary:"list the schema's tables"},{name:"lunora_get_function_schema",summary:"read a function's argument JSON Schema before calling it"},{name:"lunora_run_query",summary:"run a read-only query"},{name:"lunora_run_mutation",summary:"run a mutation — writes; only when LUNORA_MCP_ALLOW_WRITES is set"},{name:"lunora_run_action",summary:"run an action — writes/effects; only when LUNORA_MCP_ALLOW_WRITES is set"}],St=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),kt=t=>{const e=_t.map(n=>`- ${n.name} — ${n.summary}`).join(`
|
|
2
2
|
`);return[`You have a Lunora MCP server connected to the deployment at ${t}.`,"It exposes this backend's functions and schema so you can inspect and operate it:",e,"",`Start by calling lunora_list_functions and lunora_list_tables to learn what exists, then lunora_get_function_schema before any run call. The full HTTP API is also documented at ${t}/_lunora/admin/openapi (that endpoint needs the same admin token the MCP server is configured with).`].join(`
|
|
3
3
|
`)},wt=1500,Ct=()=>{const t=A(40),e=I(),{url:n}=qe();let s;t[0]!==n?(s=at(n),t[0]=n,t[1]=s):s=t[1];const a=s,[r,i]=Fe(null);let o,c;t[2]!==r?(o=()=>{if(r===null)return;const M=globalThis.setTimeout(()=>{i(null)},wt);return()=>{globalThis.clearTimeout(M)}},c=[r],t[2]=r,t[3]=o,t[4]=c):(o=t[3],c=t[4]),Ue(o,c);let u;t[5]===Symbol.for("react.memo_cache_sentinel")?(u=(M,T)=>{rt(T)&&i(M)},t[5]=u):u=t[5];const m=u;let d;t[6]!==a?(d=()=>{m("config",St(a))},t[6]=a,t[7]=d):d=t[7];const f=d;let p;t[8]!==a?(p=()=>{m("prompt",kt(a))},t[8]=a,t[9]=p):p=t[9];const g=p;let x;t[10]!==e?(x=e("Connect an AI agent"),t[10]=e,t[11]=x):x=t[11];let b;t[12]!==x?(b=l("span",{className:"text-sm font-medium text-foreground",children:x}),t[12]=x,t[13]=b):b=t[13];let v;t[14]!==e?(v=e("Drive this deployment from an AI agent over the Model Context Protocol — it can list functions and tables, read schemas, and run read-only queries. Writes stay off unless you opt in."),t[14]=e,t[15]=v):v=t[15];let _;t[16]!==v?(_=l("span",{className:"text-xs text-muted-foreground",children:v}),t[16]=v,t[17]=_):_=t[17];let S;t[18]!==b||t[19]!==_?(S=h("div",{className:"flex flex-col gap-1.5 p-4",children:[b,_]}),t[18]=b,t[19]=_,t[20]=S):S=t[20];let L;t[21]===Symbol.for("react.memo_cache_sentinel")?(L=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[21]=L):L=t[21];let y;t[22]!==r||t[23]!==e?(y=e(r==="config"?"Copied":"Copy MCP config"),t[22]=r,t[23]=e,t[24]=y):y=t[24];let k;t[25]!==f||t[26]!==y?(k=l(Ve,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:y}),t[25]=f,t[26]=y,t[27]=k):k=t[27];let w;t[28]!==r||t[29]!==e?(w=e(r==="prompt"?"Copied":"Copy agent prompt"),t[28]=r,t[29]=e,t[30]=w):w=t[30];let C;t[31]!==g||t[32]!==w?(C=l(Ve,{"data-testid":"home-connect-agent-copy-prompt",onClick:g,size:"xs",variant:"outline",children:w}),t[31]=g,t[32]=w,t[33]=C):C=t[33];let N;t[34]!==k||t[35]!==C?(N=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[L,h("div",{className:"flex flex-wrap gap-2",children:[k,C]})]}),t[34]=k,t[35]=C,t[36]=N):N=t[36];let $;return t[37]!==S||t[38]!==N?($=h(B,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[S,N]}),t[37]=S,t[38]=N,t[39]=$):$=t[39],$},At=tt(()=>import("../packem_chunks/sparkline.mjs")),$t=(t,e)=>{if(e==null)return t("cache not enabled");const n=e.hits+e.misses;return n===0?t("no cache traffic yet"):`${Math.round(e.hits/n*100).toString()}% ${t("cache hit")}`},Pe=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},Lt=(t,e)=>{const n=Math.max(0,Math.round((e-t)/1e3));if(n<60)return`${String(n)}s ago`;const s=Math.round(n/60);if(s<60)return`${String(s)}m ago`;const a=Math.round(s/60);return a<24?`${String(a)}h ago`:`${String(Math.round(a/24))}d ago`},Qe=(t,e)=>{if(t===void 0||t.length===0)return[];const n=new Map;for(const s of t)n.set(s.bucketMs,(n.get(s.bucketMs)??0)+s[e]);return[...n.entries()].toSorted(([s],[a])=>s-a).map(([,s])=>s)},He=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((i,o)=>i+o,0),a=t.slice(n).reduce((i,o)=>i+o,0);if(s===0)return null;const r=(a-s)/s*100;return{positive:e?r>=0:r<=0,text:`${r>=0?"+":""}${r.toFixed(1)}%`}},Te=t=>{const e=A(24),{delta:n,footer:s,label:a,trend:r,unit:i,value:o}=t,c=I();let u;e[0]!==a?(u=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=u):u=e[1];let m;e[2]!==o?(m=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[2]=o,e[3]=m):m=e[3];let d;e[4]!==i?(d=i!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:i}),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==m||e[7]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[m,d]}),e[6]=m,e[7]=d,e[8]=f):f=e[8];let p;e[9]!==r?(p=r!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(At,{data:r})}),e[9]=r,e[10]=p):p=e[10];let g;e[11]!==f||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[f,p]}),e[11]=f,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==u||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[u,g]}),e[14]=u,e[15]=g,e[16]=x):x=e[16];let b;e[17]!==n||e[18]!==s||e[19]!==c?(b=n==null?s!=null&&l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:s}):h("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px]",children:[l("span",{className:Xe("font-semibold",n.positive?"text-success":"text-destructive"),children:n.text})," ",l("span",{className:"text-muted-foreground",children:c("vs. prev.")})]}),e[17]=n,e[18]=s,e[19]=c,e[20]=b):b=e[20];let v;return e[21]!==x||e[22]!==b?(v=h(B,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},Mt=()=>{const t=A(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=l("svg",{"aria-hidden":"true",className:"size-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.8,viewBox:"0 0 24 24",children:l("path",{d:"m9 6 6 6-6 6"})}),t[0]=e):e=t[0],e},De=t=>{const e=A(7),{command:n,label:s}=t;let a;e[0]!==s?(a=l("div",{className:"p-4",children:l("span",{className:"text-sm font-medium text-foreground",children:s})}),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==n?(r=l("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5",children:l("code",{className:"font-mono text-xs text-muted-foreground",children:n})}),e[2]=n,e[3]=r):r=e[3];let i;return e[4]!==a||e[5]!==r?(i=h(B,{className:"justify-between gap-0 py-0",children:[a,r]}),e[4]=a,e[5]=r,e[6]=i):i=e[6],i},Ge=t=>{const e=A(18),{count:n,onView:s,testId:a,title:r}=t,i=I();let o;e[0]!==r?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r}),e[0]=r,e[1]=o):o=e[1];let c;e[2]!==n||e[3]!==i?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:i("No data yet")}):l(Ye,{variant:n>0?"destructive":"success",children:n>0?n:i("All clear")}),e[2]=n,e[3]=i,e[4]=c):c=e[4];let u;e[5]!==o||e[6]!==c?(u=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[o,c]}),e[5]=o,e[6]=c,e[7]=u):u=e[7];let m;e[8]!==i?(m=i("View"),e[8]=i,e[9]=m):m=e[9];let d;e[10]===Symbol.for("react.memo_cache_sentinel")?(d=l(Mt,{}),e[10]=d):d=e[10];let f;e[11]!==s||e[12]!==m?(f=h("button",{className:"flex items-center gap-1 border-t border-border bg-muted/50 px-4 py-2.5 text-[12px] font-medium text-foreground outline-none transition-colors hover:bg-muted focus-visible:bg-muted",onClick:s,type:"button",children:[m,d]}),e[11]=s,e[12]=m,e[13]=f):f=e[13];let p;return e[14]!==u||e[15]!==f||e[16]!==a?(p=h(B,{className:"justify-between gap-0 py-0","data-testid":a,children:[u,f]}),e[14]=u,e[15]=f,e[16]=a,e[17]=p):p=e[17],p},It=t=>{const e=A(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=[...n].toSorted(Et).slice(0,5);let i;e[3]!==s?(i=s("Top functions"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[o,r.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No functions called yet.")}):h("div",{className:"divide-y divide-border",children:[h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] gap-4 px-4 py-1.5 font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:[l("span",{children:s("Function")}),l("span",{className:"text-end",children:s("Calls")}),l("span",{className:"w-12 text-end",children:s("Avg")}),l("span",{className:"w-8 text-end",children:s("Err")})]}),r.map(jt)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Tt=t=>{const e=A(26),{subs:n}=t,s=I();let a;e[0]!==s?(a=s("Live connections"),e[0]=s,e[1]=a):a=e[1];let r;e[2]!==a?(r=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=r):r=e[3];const i=n?.totalConnections??0;let o;e[4]!==i?(o=i.toLocaleString(),e[4]=i,e[5]=o):o=e[5];let c;e[6]!==o?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:o}),e[6]=o,e[7]=c):c=e[7];let u;e[8]!==s?(u=s("sockets"),e[8]=s,e[9]=u):u=e[9];let m;e[10]!==u?(m=l("span",{className:"text-xs text-muted-foreground",children:u}),e[10]=u,e[11]=m):m=e[11];let d;e[12]!==c||e[13]!==m?(d=h("span",{className:"flex items-baseline gap-1.5",children:[c,m]}),e[12]=c,e[13]=m,e[14]=d):d=e[14];const f=n?.totalSubscriptions??0;let p;e[15]!==f?(p=f.toLocaleString(),e[15]=f,e[16]=p):p=e[16];let g;e[17]!==s?(g=s("active subscriptions"),e[17]=s,e[18]=g):g=e[18];let x;e[19]!==p||e[20]!==g?(x=h("span",{className:"text-[11px] text-muted-foreground",children:[p," ",g]}),e[19]=p,e[20]=g,e[21]=x):x=e[21];let b;return e[22]!==x||e[23]!==r||e[24]!==d?(b=l(B,{"data-testid":"home-live-connections",children:h(Ze,{className:"flex flex-col gap-2.5 py-4",children:[r,d,x]})}),e[22]=x,e[23]=r,e[24]=d,e[25]=b):b=e[25],b},Ot=t=>{const e=A(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const r=Date.now();let i;e[3]!==s?(i=s("Recent activity"),e[3]=s,e[4]=i):i=e[4];let o;e[5]!==i?(o=l("div",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:i})}),e[5]=i,e[6]=o):o=e[6],a=h(B,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[o,n.length===0?l("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",children:s("No recent activity.")}):l("ul",{className:"divide-y divide-border",children:n.slice(0,5).map(c=>h("li",{className:"flex items-center justify-between gap-3 px-4 py-2 text-[13px]",children:[h("span",{className:"flex min-w-0 items-center gap-2",children:[l("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-muted-foreground/40"}),h("span",{className:"truncate text-foreground",children:[c.op,c.table!==void 0&&h("span",{className:"text-muted-foreground",children:[" · ",c.table,c.id===void 0?"":`#${c.id}`]})]})]}),l("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:Lt(c.ts,r)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Rt=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Xt=t=>{const e=A(149),{initialShardKey:n}=t,s=I(),a=Je(),r=n??"";let i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i={},e[0]=i):i=e[0];let o;e[1]!==r?(o={shardKey:r},e[1]=r,e[2]=o):o=e[2];const c=ve(ye.getMetrics,i,o);let u;e[3]===Symbol.for("react.memo_cache_sentinel")?(u={},e[3]=u):u=e[3];let m;e[4]!==r?(m={shardKey:r},e[4]=r,e[5]=m):m=e[5];const d=ve(ye.getFunctionStats,u,m);let f,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(f={},p={shardKey:""},e[6]=f,e[7]=p):(f=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,f,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==r?(b={shardKey:r},e[9]=r,e[10]=b):b=e[10];const v=ve(ye.listSubscriptions,x,b);let _;e[11]===Symbol.for("react.memo_cache_sentinel")?(_={},e[11]=_):_=e[11];let S;e[12]!==r?(S={shardKey:r},e[12]=r,e[13]=S):S=e[13];const L=ve(ye.getAuditLog,_,S),y=c.data??null;let k,w,C,N,$,M,T,O,R,D,P,F,E,j,U,q,K,z;if(e[14]!==L.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==a||e[19]!==d.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(d.data?.functions)?d.data.functions:[],T=v.data??null;let we;e[40]!==L.data?(we=Array.isArray(L.data?.entries)?L.data.entries:[],e[40]=L.data,e[41]=we):we=e[41],w=we,$=c.data===void 0||d.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let Ce;e[42]!==a?(Ce=()=>{Ne(a({to:"/security"}))},e[42]=a,e[43]=Ce):Ce=e[43],z=Ce;let Ae;e[44]!==a?(Ae=()=>{Ne(a({to:"/insights"}))},e[44]=a,e[45]=Ae):Ae=e[45],K=Ae;const $e=Qe(y?.history,"calls"),Le=Qe(y?.history,"errors"),ze=Rt(N),Me=Math.max(0,...N.map(Bt));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:$t(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],C=Ie,U="flex flex-col gap-6",q="lunora-home",P="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",F="home-health";const Re=He($e);let he;e[49]!==s?(he=s("Requests"),e[49]=s,e[50]=he):he=e[50];const Ee=y?.requests??0;let ge;e[51]!==Ee?(ge=Ee.toLocaleString(),e[51]=Ee,e[52]=ge):ge=e[52],e[53]!==$e||e[54]!==Re||e[55]!==he||e[56]!==ge?(E=l(Te,{delta:Re,label:he,trend:$e,value:ge}),e[53]=$e,e[54]=Re,e[55]=he,e[56]=ge,e[57]=E):E=e[57];const je=He(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const Be=y?.errors??0;let be;e[60]!==Be?(be=Be.toLocaleString(),e[60]=Be,e[61]=be):be=e[61],e[62]!==Le||e[63]!==je||e[64]!==xe||e[65]!==be?(j=l(Te,{delta:je,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=je,e[64]=xe,e[65]=be,e[66]=j):j=e[66],k=Te,e[67]!==Me||e[68]!==s?(O=Me>0?`${s("max")} ${Pe(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=O):O=e[69],e[70]!==s?(R=s("Avg latency"),e[70]=s,e[71]=R):R=e[71],D=ze===null?"—":Pe(ze),e[14]=L.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=a,e[19]=d.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=w,e[24]=C,e[25]=N,e[26]=$,e[27]=M,e[28]=T,e[29]=O,e[30]=R,e[31]=D,e[32]=P,e[33]=F,e[34]=E,e[35]=j,e[36]=U,e[37]=q,e[38]=K,e[39]=z}else k=e[22],w=e[23],C=e[24],N=e[25],$=e[26],M=e[27],T=e[28],O=e[29],R=e[30],D=e[31],P=e[32],F=e[33],E=e[34],j=e[35],U=e[36],q=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==O||e[74]!==R||e[75]!==D?(V=l(k,{footer:O,label:R,value:D}),e[72]=k,e[73]=O,e[74]=R,e[75]=D,e[76]=V):V=e[76];let W;e[77]!==s?(W=s("Database size"),e[77]=s,e[78]=W):W=e[78];const Oe=y?.databaseSize??null;let Q;e[79]!==Oe?(Q=ot(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==C||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:C,label:W,value:Q}),e[81]=C,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==P||e[86]!==F||e[87]!==E||e[88]!==j||e[89]!==V||e[90]!==H?(G=h("div",{className:P,"data-testid":F,children:[E,j,V,H]}),e[85]=P,e[86]=F,e[87]=E,e[88]=j,e[89]=V,e[90]=H,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=l(xt,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=l("div",{className:"lg:col-span-2",children:l(It,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==T?(Y=l(Tt,{subs:T}),e[95]=T,e[96]=Y):Y=e[96];let Z;e[97]!==w?(Z=l(Ot,{entries:w}),e[97]=w,e[98]=Z):Z=e[98];let X;e[99]!==Y||e[100]!==Z?(X=h("div",{className:"flex flex-col gap-3",children:[Y,Z]}),e[99]=Y,e[100]=Z,e[101]=X):X=e[101];let ee;e[102]!==J||e[103]!==X?(ee=h("div",{className:"grid gap-3 lg:grid-cols-3",children:[J,X]}),e[102]=J,e[103]=X,e[104]=ee):ee=e[104];let te;e[105]!==s?(te=s("Advisors"),e[105]=s,e[106]=te):te=e[106];let se;e[107]!==te?(se=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:te}),e[107]=te,e[108]=se):se=e[108];let ne;e[109]!==$||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&$===0?l(st,{description:s("No security or performance issues detected."),icon:h("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[l("path",{d:"M12 3 4 6v5c0 5 3.4 8.5 8 10 4.6-1.5 8-5 8-10V6l-8-3Z"}),l("path",{d:"m9 12 2 2 4-4"})]}),testId:"home-advisors-clear",title:s("No issues found")}):h("div",{className:"grid gap-3 sm:grid-cols-2",children:[l(Ge,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(Ge,{count:$,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=$,e[110]=M,e[111]=s,e[112]=K,e[113]=z,e[114]=ne):ne=e[114];let le;e[115]!==se||e[116]!==ne?(le=h("section",{className:"flex flex-col gap-3","data-testid":"home-advisors",children:[se,ne]}),e[115]=se,e[116]=ne,e[117]=le):le=e[117];let ae;e[118]!==s?(ae=s("Get connected"),e[118]=s,e[119]=ae):ae=e[119];let re;e[120]!==ae?(re=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=re):re=e[121];let oe;e[122]!==s?(oe=s("Client SDK"),e[122]=s,e[123]=oe):oe=e[123];let ie;e[124]!==oe?(ie=l(De,{command:"npm i @lunora/client",label:oe}),e[124]=oe,e[125]=ie):ie=e[125];let ce;e[126]!==s?(ce=s("React"),e[126]=s,e[127]=ce):ce=e[127];let de;e[128]!==ce?(de=l(De,{command:"npm i @lunora/react",label:ce}),e[128]=ce,e[129]=de):de=e[129];let ue;e[130]!==s?(ue=s("CLI"),e[130]=s,e[131]=ue):ue=e[131];let me;e[132]!==ue?(me=l(De,{command:"lunora dev",label:ue}),e[132]=ue,e[133]=me):me=e[133];let fe;e[134]!==ie||e[135]!==de||e[136]!==me?(fe=h("div",{className:"grid gap-3 sm:grid-cols-3",children:[ie,de,me]}),e[134]=ie,e[135]=de,e[136]=me,e[137]=fe):fe=e[137];let Se;e[138]===Symbol.for("react.memo_cache_sentinel")?(Se=l(Ct,{}),e[138]=Se):Se=e[138];let pe;e[139]!==re||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[re,fe,Se]}),e[139]=re,e[140]=fe,e[141]=pe):pe=e[141];let ke;return e[142]!==U||e[143]!==q||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(ke=h("div",{className:U,"data-testid":q,children:[G,_e,ee,le,pe]}),e[142]=U,e[143]=q,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=ke):ke=e[148],ke};function Et(t,e){return e.calls-t.calls}function jt(t){return h("div",{className:"grid grid-cols-[1fr_auto_auto_auto] items-center gap-4 px-4 py-2 text-[13px]",children:[l("span",{className:"truncate font-mono text-xs text-foreground",children:t.path}),l("span",{className:"text-end tabular-nums",children:t.calls.toLocaleString()}),l("span",{className:"w-12 text-end tabular-nums text-muted-foreground",children:Pe(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Xe("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Bt(t){return t.maxDurationMs}export{Xt as H,$t as c,ft as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const s=new Set(["ADMIN_FORBIDDEN","FORBIDDEN","UNAUTHORIZED"]),d=(t,n,r,o,i)=>{switch(n){case"action":return t.action(r,o,i);case"mutation":return t.mutation(r,o,{...i,onlineOnly:!0});default:return t.query(r,o,i)}},l=t=>({__lunoraRef:t}),g=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},y=t=>t instanceof Error?t.message:String(t),c=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},h=t=>{const n=c(t);return n!==void 0&&s.has(n)},m=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},p=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,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},a=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${e(n.byteLength)}>`:n,b=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,a)}},f=(t,n)=>{t.catch(r=>{n?.(r)})},u=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},w=t=>{let n=u(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},T=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(f(n.writeText(t)),!0)},S=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{p as a,y as b,l as c,g as d,m as e,f,T as g,S as h,h as i,c as j,a as k,B as l,d as m,e as n,b as o,u as r,w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-BolUoZ9g.mjs";import{B as x}from"./badge-r_5B4LHP.mjs";import{h as L}from"./internal-
|
|
1
|
+
import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-BolUoZ9g.mjs";import{B as x}from"./badge-r_5B4LHP.mjs";import{h as L}from"./internal-BXEjuLPN.mjs";import{jsx as o,jsxs as g,Fragment as N}from"react/jsx-runtime";const w={debug:"secondary",error:"destructive",fatal:"destructive",info:"outline",log:"outline",trace:"outline",warn:"secondary"},B=p=>{const e=h(21),{entry:t}=p;let m;e[0]!==t.fields?(m=v(t.fields),e[0]=t.fields,e[1]=m):m=e[1];const c=m;let l;e[2]!==t.timestamp?(l=L(t.timestamp),e[2]=t.timestamp,e[3]=l):l=e[3];let s;e[4]!==l?(s=o("span",{className:"w-44 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:l}),e[4]=l,e[5]=s):s=e[5];const f=w[t.level];let r;e[6]!==t.level||e[7]!==f?(r=o("span",{className:"w-20 shrink-0",role:"gridcell",children:o(x,{variant:f,children:t.level})}),e[6]=t.level,e[7]=f,e[8]=r):r=e[8];const u=t.functionPath??"—";let a;e[9]!==u?(a=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=a):a=e[10];let i;e[11]!==c?(i=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=i):i=e[12];let n;e[13]!==t.message||e[14]!==i?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,i]}),e[13]=t.message,e[14]=i,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==a||e[19]!==n?(d=g(N,{children:[s,r,a,n]}),e[16]=s,e[17]=r,e[18]=a,e[19]=n,e[20]=d):d=e[20],d};export{B as L,w as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as u}from"./use-admin-query-
|
|
1
|
+
import{o as u}from"./use-admin-query-I1uILsUP.mjs";const b="__lunora_admin__:",d=new Set(["action","mutation","query"]),r=Symbol("lunora.operationSeq"),g=t=>{if(typeof t!="object"||t===null)return;const n=t[r];return typeof n=="number"?n:void 0},h=(t,n)=>{if(!(typeof t!="object"||t===null||!Object.isExtensible(t)))try{Object.defineProperty(t,r,{configurable:!0,enumerable:!1,value:n,writable:!0})}catch{}},p=t=>{if(typeof t!="object"||t===null)return;const n=t.__lunoraRef;return typeof n=="string"&&n.startsWith(b)?n:void 0},O=t=>{if(typeof t!="object"||t===null)return"";const{shardKey:n}=t;return typeof n=="string"?n:""},E=t=>new Proxy(t,{get(n,c,a){const i=Reflect.get(n,c,a);if(typeof i!="function"||typeof c!="string"||!d.has(c))return typeof i=="function"?i.bind(n):i;const f=i;return async(...e)=>{const l=p(e[0]);if(l===void 0)return f.apply(n,e);const y=typeof e[1]=="object"&&e[1]!==null?e[1]:{},s=u.start(l,y,O(e[2]));try{const o=await f.apply(n,e);return u.settle(s,{result:o}),o}catch(o){throw u.settle(s,{error:o instanceof Error?o.message:String(o)}),h(o,s),o}}}});export{g as o,E as w};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{c as P}from"react/compiler-runtime";import{SentIcon as ie,Copy01Icon as ae,Search01Icon as le}from"@hugeicons/core-free-icons";import{HugeiconsIcon as F}from"@hugeicons/react";import{useState as B,createContext as de,use as ce}from"react";import{I as ue}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as W}from"./button-q0UYSmrn.mjs";import{g as X,f as fe,b as H,
|
|
1
|
+
import{c as P}from"react/compiler-runtime";import{SentIcon as ie,Copy01Icon as ae,Search01Icon as le}from"@hugeicons/core-free-icons";import{HugeiconsIcon as F}from"@hugeicons/react";import{useState as B,createContext as de,use as ce}from"react";import{I as ue}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as W}from"./button-q0UYSmrn.mjs";import{g as X,f as fe,b as H,m as me,c as pe,d as he,k as ge}from"./internal-BXEjuLPN.mjs";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as ye}from"./badge-r_5B4LHP.mjs";import{ShardInput as be}from"./ShardInput-C6mjgAh4.mjs";import{L as U}from"./label-DKFzyHq6.mjs";import{T as ve}from"./textarea--40GKAyz.mjs";import{LunoraError as Ne}from"@lunora/errors";import{useLunora as Se}from"@lunora/react";import{c as Y}from"./utils-bhneXptQ.mjs";const we=t=>typeof t=="number"?"number":typeof t=="boolean"?"boolean":"string",Q=t=>{if(t.enum!==void 0&&t.enum.length>0)return t.enum;if(t.anyOf!==void 0&&t.anyOf.length>0&&t.anyOf.every(e=>e.const!==void 0))return t.anyOf.map(e=>e.const)},z=t=>t===void 0?"any":t.const!==void 0?JSON.stringify(t.const):t.enum!==void 0&&t.enum.length>0?t.enum.map(e=>JSON.stringify(e)).join(" | "):t.anyOf!==void 0&&t.anyOf.length>0?t.anyOf.map(e=>z(e)).join(" | "):t.type==="array"?`array<${z(t.items)}>`:t.type??"any",ke=t=>{const e=Q(t);return e!==void 0?t.type??we(e[0]):z(t)},Oe=t=>{const e=Q(t);return e===void 0?void 0:e.map(r=>JSON.stringify(r)).join(" | ")},$e=t=>{const e=[];t.minimum!==void 0?e.push(`${String(t.minimum)} ≤`):t.exclusiveMinimum!==void 0&&e.push(`${String(t.exclusiveMinimum)} <`);const r=e.length>0;e.push("value"),t.maximum!==void 0?e.push(`≤ ${String(t.maximum)}`):t.exclusiveMaximum!==void 0&&e.push(`< ${String(t.exclusiveMaximum)}`);const s=e.length>(r?2:1);return r||s?e.join(" "):void 0},Te=t=>{if(t.type==="object"&&t.properties!==void 0)return t;if(t.type==="array"&&t.items?.type==="object"&&t.items.properties!==void 0)return t.items},D=t=>{if(t===void 0)return null;if(t.const!==void 0)return t.const;if(t.enum!==void 0&&t.enum.length>0)return t.enum[0];if(t.anyOf!==void 0&&t.anyOf.length>0)return D(t.anyOf[0]);switch(t.type){case"array":return[];case"boolean":return!1;case"number":return 0;case"object":{const e={};for(const[r,s]of Object.entries(t.properties??{}))e[r]=D(s);return e}case"string":return"";default:return null}},K=t=>{const e=P(7),{label:r,value:s}=t;let n;e[0]!==r?(n=i("span",{className:"text-muted-foreground",children:r}),e[0]=r,e[1]=n):n=e[1];let o;e[2]!==s?(o=i("span",{className:"text-foreground",children:s}),e[2]=s,e[3]=o):o=e[3];let l;return e[4]!==n||e[5]!==o?(l=N("span",{className:"inline-flex items-center gap-1 rounded border border-border px-1.5 py-0.5 font-mono text-[10px]",children:[n,o]}),e[4]=n,e[5]=o,e[6]=l):l=e[6],l},Ee=t=>{const e=P(40),{name:r,required:s,schema:n}=t,o=J();let l;e[0]!==n?(l=$e(n),e[0]=n,e[1]=l):l=e[1];const a=l;let y;e[2]!==n?(y=Oe(n),e[2]=n,e[3]=y):y=e[3];const d=y,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let b;e[4]!==n?(b=Te(n),e[4]=n,e[5]=b):b=e[5];const x=b,f=s?"*":"?";let m;e[6]!==f?(m=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=m):m=e[7];let v;e[8]!==r||e[9]!==m?(v=N("span",{className:"font-mono text-foreground",children:[r,m]}),e[8]=r,e[9]=m,e[10]=v):v=e[10];let w;e[11]!==n?(w=ke(n),e[11]=n,e[12]=w):w=e[12];let p;e[13]!==w?(p=i("span",{className:"font-mono text-muted-foreground",children:w}),e[13]=w,e[14]=p):p=e[14];let h;e[15]!==v||e[16]!==p?(h=N("div",{className:"flex items-baseline gap-2",children:[v,p]}),e[15]=v,e[16]=p,e[17]=h):h=e[17];let g;e[18]!==n.description?(g=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=g):g=e[19];let S;e[20]!==u||e[21]!==a||e[22]!==c||e[23]!==n.format||e[24]!==o||e[25]!==d?(S=u&&N("div",{className:"flex flex-wrap gap-1",children:[n.format!==void 0&&i(K,{label:o("Format"),value:n.format}),a!==void 0&&i(K,{label:o("Range"),value:a}),d!==void 0&&i(K,{label:o("Value in"),value:d}),c!==void 0&&i(K,{label:o("relation"),value:c})]}),e[20]=u,e[21]=a,e[22]=c,e[23]=n.format,e[24]=o,e[25]=d,e[26]=S):S=e[26];let O;e[27]!==g||e[28]!==S||e[29]!==h?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[h,g,S]}),e[27]=g,e[28]=S,e[29]=h,e[30]=O):O=e[30];const k=O;if(x===void 0){let $;return e[31]!==k?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:k}),e[31]=k,e[32]=$):$=e[32],$}let T;e[33]!==k?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:k}),e[33]=k,e[34]=T):T=e[34];let R;e[35]!==x?(R=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:x})}),e[35]=x,e[36]=R):R=e[36];let E;return e[37]!==T||e[38]!==R?(E=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,R]}),e[37]=T,e[38]=R,e[39]=E):E=e[39],E},Z=t=>{const e=P(7),{schema:r}=t;let s;e[0]!==r.required?(s=new Set(r.required),e[0]=r.required,e[1]=s):s=e[1];const n=s;let o;e[2]!==r.properties?(o=Object.entries(r.properties??{}),e[2]=r.properties,e[3]=o):o=e[3];const l=o;let a;return e[4]!==n||e[5]!==l?(a=i("div",{className:"flex flex-col",children:l.map(y=>{const[d,c]=y;return i(Ee,{name:d,required:n.has(d),schema:c},d)})}),e[4]=n,e[5]=l,e[6]=a):a=e[6],a},V=t=>{const e=P(10),{schema:r,testId:s}=t;if(r?.type!=="object"||Object.keys(r.properties??{}).length===0){let l;e[0]!==r?(l=z(r),e[0]=r,e[1]=l):l=e[1];let a;return e[2]!==l||e[3]!==s?(a=i("p",{className:"font-mono text-xs text-muted-foreground","data-testid":s,children:l}),e[2]=l,e[3]=s,e[4]=a):a=e[4],a}let n;e[5]!==r?(n=i(Z,{schema:r}),e[5]=r,e[6]=n):n=e[6];let o;return e[7]!==n||e[8]!==s?(o=i("div",{className:"text-xs","data-testid":s,children:n}),e[7]=n,e[8]=s,e[9]=o):o=e[9],o},Ce=["curl","javascript","lunora"],Re={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ae=t=>`api.${t.replaceAll(/[/:]/g,".")}`,je=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},Ie=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(je(e),void 0,2),o=JSON.stringify(D(e.argsSchema)??{},void 0,2);switch(t){case"curl":{const l=e.method!=="GET"&&e.method!=="HEAD",a=[`curl -X ${e.method} ${JSON.stringify(s)}`];return l&&a.push(' -H "Content-Type: application/json"',` -d '${n}'`),a.join(` \\
|
|
2
2
|
`)}case"lunora":return e.functionPath===void 0?`await fetch(${JSON.stringify(e.httpPath)}, { method: ${JSON.stringify(e.method)} });`:`import { useLunora } from "@lunora/react";
|
|
3
3
|
import { api } from "./_generated/api";
|
|
4
4
|
|
|
5
5
|
const client = useLunora();
|
|
6
|
-
await client.${e.kind??"query"}(${
|
|
6
|
+
await client.${e.kind??"query"}(${Ae(e.functionPath)}, ${o});`;default:{const a=e.method!=="GET"&&e.method!=="HEAD"?`{
|
|
7
7
|
method: ${JSON.stringify(e.method)},
|
|
8
8
|
headers: { "Content-Type": "application/json" },
|
|
9
9
|
body: JSON.stringify(${n}),
|
|
10
10
|
}`:`{ method: ${JSON.stringify(e.method)} }`;return`const response = await fetch(${JSON.stringify(s)}, ${a});
|
|
11
11
|
const data = await response.json();`}}},Pe=t=>{const e=P(24),{operation:r,server:s}=t,n=J(),[o,l]=B("curl");let a;e[0]!==r||e[1]!==o||e[2]!==s?(a=Ie(o,r,s),e[0]=r,e[1]=o,e[2]=s,e[3]=a):a=e[3];const y=a;let d;e[4]!==y?(d=()=>{X(y)},e[4]=y,e[5]=d):d=e[5];const c=d;let u;e[6]===Symbol.for("react.memo_cache_sentinel")?(u=g=>{l(g.currentTarget.dataset.sample)},e[6]=u):u=e[6];const b=u;let x;e[7]!==o?(x=Ce.map(g=>i("button",{"aria-selected":o===g,className:"rounded px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium aria-selected:text-foreground","data-sample":g,"data-testid":`api-sample-${g}`,onClick:b,role:"tab",type:"button",children:Re[g]},g)),e[7]=o,e[8]=x):x=e[8];let f;e[9]!==x?(f=i("div",{className:"flex gap-1",role:"tablist",children:x}),e[9]=x,e[10]=f):f=e[10];let m;e[11]!==n?(m=n("Copy"),e[11]=n,e[12]=m):m=e[12];let v;e[13]!==c||e[14]!==m?(v=i(W,{"data-testid":"api-sample-copy",onClick:c,size:"xs",type:"button",variant:"ghost",children:m}),e[13]=c,e[14]=m,e[15]=v):v=e[15];let w;e[16]!==f||e[17]!==v?(w=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[f,v]}),e[16]=f,e[17]=v,e[18]=w):w=e[18];let p;e[19]!==y?(p=i("pre",{className:"overflow-auto px-3 pb-3 font-mono text-xs","data-testid":"api-sample-source",children:y}),e[19]=y,e[20]=p):p=e[20];let h;return e[21]!==w||e[22]!==p?(h=N("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card","data-testid":"api-code-samples",children:[w,p]}),e[21]=w,e[22]=p,e[23]=h):h=e[23],h},Le={blue:"text-info",emerald:"text-success",neutral:"text-muted-foreground",orange:"text-warning",red:"text-destructive",violet:"text-royal-amethyst"},_e=t=>{switch(t.toUpperCase()){case"DELETE":return"red";case"GET":return"emerald";case"PATCH":return"orange";case"POST":return"blue";case"PUT":return"orange";default:return"neutral"}},Be=t=>{switch(t){case"action":return"violet";case"mutation":return"orange";case"query":return"emerald";default:return"neutral"}},q=t=>{const e=P(7),{kind:r,method:s,testId:n}=t;let o;e[0]!==r||e[1]!==s?(o=r??s.toUpperCase(),e[0]=r,e[1]=s,e[2]=o):o=e[2];const l=o,a=r===void 0?_e(s):Be(r),y=`${Le[a]} font-mono text-[10px] tracking-wide uppercase`;let d;return e[3]!==l||e[4]!==y||e[5]!==n?(d=i(ye,{className:y,"data-testid":n,variant:"ghost",children:l}),e[3]=l,e[4]=y,e[5]=n,e[6]=d):d=e[6],d},ee=t=>t.startsWith("2")?"text-emerald-600 dark:text-emerald-400":t==="default"||t.startsWith("4")||t.startsWith("5")?"text-red-600 dark:text-red-400":"text-muted-foreground",te=t=>t.startsWith("2")?"bg-emerald-500":t==="default"||t.startsWith("4")||t.startsWith("5")?"bg-red-500":"bg-muted-foreground",Me=new Set([" ",`
|
|
12
12
|
`,"\r"]),G=" ",Je=t=>{let e="";for(const n of t)Me.has(n)||(e+=n);let r=0,s=e.length;for(;r<s&&(e[r]??"")<=G;)r+=1;for(;s>r&&(e[s-1]??"")<=G;)s-=1;return e.slice(r,s)},De=/^(?:[a-z][\d+.a-z-]*:)?\/\//i,Ke=(t,e)=>{const r=globalThis.location?.origin??"",s=e===""?r:e,n=Je(t);if(s===""){if(De.test(n))throw new Error(`restDispatch: refusing to send the admin token off-origin (${n} names its own host and there is no origin to check it against)`);return n}const o=new URL(n,s);if(o.origin!==new URL(s).origin)throw new Error(`restDispatch: refusing to send the admin token off-origin (${o.origin} is not ${s})`);return o.toString()},ze=async(t,e,r,s)=>{const n=t.method!=="GET"&&t.method!=="HEAD",o=Ke(t.httpPath,r),a=await(await fetch(o,{body:n?JSON.stringify(e):void 0,headers:{...n?{"content-type":"application/json"}:{},...s===null||s===""?{}:{authorization:`Bearer ${s}`}},method:t.method})).text();try{return JSON.parse(a)}catch{return a}},Fe=t=>JSON.stringify(D(t.argsSchema)??{},void 0,2),re=de(null),se=()=>{const t=ce(re);if(t===null)throw new Ne("INTERNAL","useOperationRun must be used within an OperationRunProvider");return t},We=({children:t,operation:e})=>{const r=J(),s=Se(),[n,o]=B(()=>Fe(e)),[l,a]=B(""),[y,d]=B("idle"),[c,u]=B(void 0),[b,x]=B(null),[f,m]=B(null),v=async()=>{let h;try{h=n.trim()===""?{}:JSON.parse(n)}catch(S){d("error"),u(void 0),m(null),x(r("Invalid JSON args: {message}",{message:H(S)}));return}d("running"),x(null);const g=performance.now();try{const S=await(e.functionPath===void 0?ze(e,h,s.url,s.getAuthToken()):me(s,e.kind,pe(e.functionPath),h,he(l)));u(S),m(Math.round(performance.now()-g)),d("success")}catch(S){u(void 0),m(Math.round(performance.now()-g)),x(H(S)),d("error")}};return i(re,{value:{argsText:n,durationMs:f,error:b,operation:e,response:c,send:()=>{fe(v())},setArgsText:o,setShardKey:a,shardKey:l,status:y},children:t})},qe=()=>{const t=P(48),e=J(),{argsText:r,operation:s,send:n,setArgsText:o,setShardKey:l,shardKey:a,status:y}=se();let d;t[0]!==o?(d=C=>{o(C.target.value)},t[0]=o,t[1]=d):d=t[1];const c=d;let u;t[2]!==n?(u=C=>{C.key==="Enter"&&(C.metaKey||C.ctrlKey)&&(C.preventDefault(),n())},t[2]=n,t[3]=u):u=t[3];const b=u,x=y==="running";let f;t[4]!==s.kind||t[5]!==s.method?(f=i(q,{kind:s.kind,method:s.method,testId:"api-try-method"}),t[4]=s.kind,t[5]=s.method,t[6]=f):f=t[6];const m=s.functionPath??s.httpPath;let v;t[7]!==m?(v=i("code",{className:"min-w-0 flex-1 truncate font-mono text-xs text-foreground",children:m}),t[7]=m,t[8]=v):v=t[8];const w=x?"animate-pulse":void 0;let p;t[9]!==w?(p=i(F,{className:w,icon:ie,strokeWidth:2}),t[9]=w,t[10]=p):p=t[10];let h;t[11]!==x||t[12]!==e?(h=e(x?"Sending…":"Send"),t[11]=x,t[12]=e,t[13]=h):h=t[13];let g;t[14]!==x||t[15]!==n||t[16]!==p||t[17]!==h?(g=N(W,{"data-testid":"api-try-send",disabled:x,onClick:n,size:"sm",type:"button",children:[p,h]}),t[14]=x,t[15]=n,t[16]=p,t[17]=h,t[18]=g):g=t[18];let S;t[19]!==f||t[20]!==v||t[21]!==g?(S=N("div",{className:"flex items-center gap-2 border-b border-border bg-muted px-3 py-2",children:[f,v,g]}),t[19]=f,t[20]=v,t[21]=g,t[22]=S):S=t[22];let O;t[23]!==e?(O=e("Arguments (JSON)"),t[23]=e,t[24]=O):O=t[24];let k;t[25]!==O?(k=i(U,{htmlFor:"api-try-args",children:O}),t[25]=O,t[26]=k):k=t[26];let T;t[27]!==r?(T=r.split(`
|
|
13
|
-
`),t[27]=r,t[28]=T):T=t[28];const R=Math.min(12,Math.max(3,T.length));let E;t[29]!==r||t[30]!==c||t[31]!==b||t[32]!==R?(E=i(ve,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:b,rows:R,spellCheck:!1,value:r}),t[29]=r,t[30]=c,t[31]=b,t[32]=R,t[33]=E):E=t[33];let $;t[34]!==k||t[35]!==E?($=N("div",{className:"flex flex-col gap-1.5",children:[k,E]}),t[34]=k,t[35]=E,t[36]=$):$=t[36];let j;t[37]!==s.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(j=s.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(U,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(be,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=s.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=j):j=t[41];let A;t[42]!==$||t[43]!==j?(A=N("div",{className:"flex flex-col gap-3 p-3",children:[$,j]}),t[42]=$,t[43]=j,t[44]=A):A=t[44];let I;return t[45]!==A||t[46]!==S?(I=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,A]}),t[45]=A,t[46]=S,t[47]=I):I=t[47],I},He=t=>{const e=P(51),{operation:r}=t,s=J(),n=`api-operation-${r.operationId}`,o=r.key;let l;e[0]!==r.kind||e[1]!==r.method?(l=i(q,{kind:r.kind,method:r.method,testId:"api-operation-method"}),e[0]=r.kind,e[1]=r.method,e[2]=l):l=e[2];const a=r.functionPath??r.httpPath;let y;e[3]!==a?(y=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=y):y=e[4];let d;e[5]!==l||e[6]!==y?(d=N("div",{className:"flex items-center gap-2",children:[l,y]}),e[5]=l,e[6]=y,e[7]=d):d=e[7];let c;e[8]!==r.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:r.title}),e[8]=r.title,e[9]=c):c=e[9];let u;e[10]!==r.description?(u=r.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:r.description}),e[10]=r.description,e[11]=u):u=e[11];let b;e[12]!==d||e[13]!==c||e[14]!==u?(b=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=b):b=e[15];let x;e[16]!==s?(x=s("Try it"),e[16]=s,e[17]=x):x=e[17];let f;e[18]!==x?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),e[18]=x,e[19]=f):f=e[19];let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=i(qe,{}),e[20]=m):m=e[20];let v;e[21]!==f?(v=N("section",{className:"flex flex-col gap-2",children:[f,m]}),e[21]=f,e[22]=v):v=e[22];let w;e[23]!==s?(w=s("Request arguments"),e[23]=s,e[24]=w):w=e[24];let p;e[25]!==w?(p=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:w}),e[25]=w,e[26]=p):p=e[26];let h;e[27]!==r.argsSchema?(h=i(V,{schema:r.argsSchema,testId:"api-operation-args"}),e[27]=r.argsSchema,e[28]=h):h=e[28];let g;e[29]!==p||e[30]!==h?(g=N("section",{className:"flex flex-col gap-2",children:[p,h]}),e[29]=p,e[30]=h,e[31]=g):g=e[31];let S;e[32]!==s?(S=s("Response body"),e[32]=s,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let k;if(e[36]!==r.responses||e[37]!==s){let E;e[39]!==s?(E=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${ee($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${te($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(V,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=s,e[40]=E):E=e[40],k=r.responses.map(E),e[36]=r.responses,e[37]=s,e[38]=k}else k=e[38];let T;e[41]!==O||e[42]!==k?(T=N("section",{className:"flex flex-col gap-3",children:[O,k]}),e[41]=O,e[42]=k,e[43]=T):T=e[43];let R;return e[44]!==r.key||e[45]!==n||e[46]!==v||e[47]!==g||e[48]!==T||e[49]!==b?(R=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[b,v,g,T]},o),e[44]=r.key,e[45]=n,e[46]=v,e[47]=g,e[48]=T,e[49]=b,e[50]=R):R=e[50],R},Ue={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Ve=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Ge=/^\s*:/,Xe=(t,e,r)=>r.startsWith('"')?Ge.test(t.slice(e))?"key":"string":r==="true"||r==="false"||r==="null"?"boolean":"number",Ye=t=>{const e=[];let r=0;for(const s of t.matchAll(Ve)){const{index:n}=s,o=s[0],l=n+o.length;n>r&&e.push({kind:"plain",start:r,text:t.slice(r,n)}),e.push({kind:Xe(t,l,o),start:n,text:o}),r=l}return r<t.length&&e.push({kind:"plain",start:r,text:t.slice(r)}),e},Qe=t=>{const e=P(4),{code:r}=t;let s;e[0]!==r?(s=Ye(r).map(Ze),e[0]=r,e[1]=s):s=e[1];let n;return e[2]!==s?(n=i(xe,{children:s}),e[2]=s,e[3]=n):n=e[3],n};function Ze(t){return i("span",{className:Ue[t.kind],children:t.text},t.start)}const ne="__live__",et=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),tt=(t,e,r)=>r?t??"":e===void 0?"":JSON.stringify(e,ge,2),rt=t=>{const e=P(18),{active:r,running:s,showError:n}=t,o=J();if(s){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let b;return e[2]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=b):b=e[3],b}if(r===void 0||r.body===""){let u;e[4]!==r?.live||e[5]!==o?(u=r?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=r?.live,e[5]=o,e[6]=u):u=e[6];let b;return e[7]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=b):b=e[8],b}const l=n&&"text-destructive";let a;e[9]!==l?(a=Y("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const y=n?"api-response-error":"api-response-body";let d;e[11]!==r.body||e[12]!==n?(d=n?r.body:i(Qe,{code:r.body}),e[11]=r.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==y||e[16]!==d?(c=i("pre",{className:a,"data-testid":y,children:d}),e[14]=a,e[15]=y,e[16]=d,e[17]=c):c=e[17],c},st=({durationMs:t,error:e,failed:r,operation:s,ran:n,response:o,t:l})=>{const a=s.responses.map(d=>({body:et(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:tt(e,o,r),durationMs:t,id:ne,label:l("Live"),live:!0,status:r?"error":"200"},...a]:a},nt=()=>{const t=P(19),e=J(),{durationMs:r,error:s,operation:n,response:o,status:l}=se(),a=l==="running",y=l==="error",d=l==="success"||y,c=st({durationMs:r,error:s,failed:y,operation:n,ran:d,response:o,t:e}),u=d?ne:c.find(ot)?.id??c[0]?.id??"",[b,x]=B(null),f=c.find(C=>C.id===(b??u))??c[0];let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=C=>{const{id:L}=C.currentTarget.dataset;L!==void 0&&x(L)},t[0]=m):m=t[0];const v=m,w=()=>{f!==void 0&&X(f.body)},p=f?.live===!0?f.durationMs:null,h=f?.live===!0&&f.status==="error",g="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let k;t[3]!==O?(k=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=k):k=t[4];const T=p!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:p})}),R=f!==void 0&&f.body!==""&&i(W,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:w,size:"icon-xs",type:"button",variant:"ghost",children:i(F,{icon:ae,strokeWidth:2})});let E;t[5]!==T||t[6]!==R?(E=N("div",{className:"flex items-center gap-2",children:[T,R]}),t[5]=T,t[6]=R,t[7]=E):E=t[7];let $;t[8]!==k||t[9]!==E?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[k,E]}),t[8]=k,t[9]=E,t[10]=$):$=t[10];const j=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(C=>{const L=C.id===f?.id;return N("button",{"aria-selected":L,className:Y("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",L?ee(C.status):"text-muted-foreground"),"data-id":C.id,"data-testid":C.live?"api-response-tab-live":`api-response-tab-${C.status}`,onClick:v,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${te(C.status)}`}),C.label]},C.id)})});let A;t[11]!==f||t[12]!==a||t[13]!==h?(A=i(rt,{active:f,running:a,showError:h}),t[11]=f,t[12]=a,t[13]=h,t[14]=A):A=t[14];let I;return t[15]!==A||t[16]!==$||t[17]!==j?(I=N("div",{className:g,"data-testid":S,children:[$,j,A]}),t[15]=A,t[16]=$,t[17]=j,t[18]=I):I=t[18],I};function ot(t){return t.status.startsWith("2")}const it=(t,e)=>{const r=e.trim().toLowerCase();return r===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(r))})).filter(s=>s.operations.length>0)},wt=t=>{const e=P(53),{model:r}=t,s=J(),n=r.groups[0]?.operations[0]?.key??"",[o,l]=B(n),[a,y]=B("");let d;e[0]!==n||e[1]!==r.operationByKey||e[2]!==o?(d=r.operationByKey.get(o)??r.operationByKey.get(n),e[0]=n,e[1]=r.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,b,x,f,m,v,w,p,h,g;if(e[4]!==a||e[5]!==r.groups||e[6]!==r.server||e[7]!==c?.key||e[8]!==s){u=it(r.groups,a);let E;e[19]===Symbol.for("react.memo_cache_sentinel")?(E=M=>{const{key:_}=M.currentTarget.dataset;_!==void 0&&l(_)},e[19]=E):E=e[19];const $=E;let j;e[20]===Symbol.for("react.memo_cache_sentinel")?(j=M=>{y(M.target.value)},e[20]=j):j=e[20];const A=j;b=r.server??"",h="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",g="api-reference",e[21]!==s?(m=s("API operations"),e[21]=s,e[22]=m):m=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",w="api-reference-nav";let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=i(F,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:le,strokeWidth:2}),e[23]=I):I=e[23];let C;e[24]!==s?(C=s("Filter operations"),e[24]=s,e[25]=C):C=e[25],e[26]!==a||e[27]!==C?(p=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[I,i(ue,{className:"h-7 pl-7","data-testid":"api-filter",onChange:A,placeholder:C,value:a})]})}),e[26]=a,e[27]=C,e[28]=p):p=e[28],x="flex flex-col gap-4 p-2";let L;e[29]!==c?.key||e[30]!==s?(L=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||s("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(_=>{const oe=_.key===c?.key;return N("button",{"aria-current":oe?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":_.key,"data-testid":`api-nav-${_.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:_.summary}),i(q,{kind:_.kind,method:_.method})]},_.key)})]},M.name),e[29]=c?.key,e[30]=s,e[31]=L):L=e[31],f=u.map(L),e[4]=a,e[5]=r.groups,e[6]=r.server,e[7]=c?.key,e[8]=s,e[9]=u,e[10]=b,e[11]=x,e[12]=f,e[13]=m,e[14]=v,e[15]=w,e[16]=p,e[17]=h,e[18]=g}else u=e[9],b=e[10],x=e[11],f=e[12],m=e[13],v=e[14],w=e[15],p=e[16],h=e[17],g=e[18];let S;e[32]!==u.length||e[33]!==s?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")}),e[32]=u.length,e[33]=s,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==x||e[37]!==f?(O=N("div",{className:x,children:[f,S]}),e[35]=S,e[36]=x,e[37]=f,e[38]=O):O=e[38];let k;e[39]!==O||e[40]!==m||e[41]!==v||e[42]!==w||e[43]!==p?(k=N("nav",{"aria-label":m,className:v,"data-testid":w,children:[p,O]}),e[39]=O,e[40]=m,e[41]=v,e[42]=w,e[43]=p,e[44]=k):k=e[44];let T;e[45]!==c||e[46]!==b?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(We,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(He,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(Pe,{operation:c,server:b}),i(nt,{})]})]},c.key),e[45]=c,e[46]=b,e[47]=T):T=e[47];let R;return e[48]!==k||e[49]!==T||e[50]!==h||e[51]!==g?(R=N("div",{className:h,"data-testid":g,children:[k,T]}),e[48]=k,e[49]=T,e[50]=h,e[51]=g,e[52]=R):R=e[52],R};export{wt as R};
|
|
13
|
+
`),t[27]=r,t[28]=T):T=t[28];const R=Math.min(12,Math.max(3,T.length));let E;t[29]!==r||t[30]!==c||t[31]!==b||t[32]!==R?(E=i(ve,{className:"font-mono text-xs","data-testid":"api-try-args",id:"api-try-args",onChange:c,onKeyDown:b,rows:R,spellCheck:!1,value:r}),t[29]=r,t[30]=c,t[31]=b,t[32]=R,t[33]=E):E=t[33];let $;t[34]!==k||t[35]!==E?($=N("div",{className:"flex flex-col gap-1.5",children:[k,E]}),t[34]=k,t[35]=E,t[36]=$):$=t[36];let A;t[37]!==s.functionPath||t[38]!==l||t[39]!==a||t[40]!==e?(A=s.functionPath!==void 0&&N("div",{className:"flex flex-col gap-1.5",children:[i(U,{htmlFor:"shard-input",children:e("Shard key (optional)")}),i(be,{id:"shard-input",onChange:l,testId:"shard-input",value:a})]}),t[37]=s.functionPath,t[38]=l,t[39]=a,t[40]=e,t[41]=A):A=t[41];let j;t[42]!==$||t[43]!==A?(j=N("div",{className:"flex flex-col gap-3 p-3",children:[$,A]}),t[42]=$,t[43]=A,t[44]=j):j=t[44];let I;return t[45]!==j||t[46]!==S?(I=N("div",{className:"overflow-hidden rounded-xl border border-border bg-card","data-testid":"api-try-it",children:[S,j]}),t[45]=j,t[46]=S,t[47]=I):I=t[47],I},He=t=>{const e=P(51),{operation:r}=t,s=J(),n=`api-operation-${r.operationId}`,o=r.key;let l;e[0]!==r.kind||e[1]!==r.method?(l=i(q,{kind:r.kind,method:r.method,testId:"api-operation-method"}),e[0]=r.kind,e[1]=r.method,e[2]=l):l=e[2];const a=r.functionPath??r.httpPath;let y;e[3]!==a?(y=i("code",{className:"truncate font-mono text-xs text-muted-foreground",children:a}),e[3]=a,e[4]=y):y=e[4];let d;e[5]!==l||e[6]!==y?(d=N("div",{className:"flex items-center gap-2",children:[l,y]}),e[5]=l,e[6]=y,e[7]=d):d=e[7];let c;e[8]!==r.title?(c=i("h1",{className:"text-lg font-semibold text-foreground","data-testid":"api-operation-title",children:r.title}),e[8]=r.title,e[9]=c):c=e[9];let u;e[10]!==r.description?(u=r.description!==void 0&&i("p",{className:"text-sm text-muted-foreground",children:r.description}),e[10]=r.description,e[11]=u):u=e[11];let b;e[12]!==d||e[13]!==c||e[14]!==u?(b=N("header",{className:"sticky top-0 z-10 -mx-6 -mt-6 flex flex-col gap-2 border-b border-border bg-background px-6 pt-6 pb-3",children:[d,c,u]}),e[12]=d,e[13]=c,e[14]=u,e[15]=b):b=e[15];let x;e[16]!==s?(x=s("Try it"),e[16]=s,e[17]=x):x=e[17];let f;e[18]!==x?(f=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:x}),e[18]=x,e[19]=f):f=e[19];let m;e[20]===Symbol.for("react.memo_cache_sentinel")?(m=i(qe,{}),e[20]=m):m=e[20];let v;e[21]!==f?(v=N("section",{className:"flex flex-col gap-2",children:[f,m]}),e[21]=f,e[22]=v):v=e[22];let w;e[23]!==s?(w=s("Request arguments"),e[23]=s,e[24]=w):w=e[24];let p;e[25]!==w?(p=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:w}),e[25]=w,e[26]=p):p=e[26];let h;e[27]!==r.argsSchema?(h=i(V,{schema:r.argsSchema,testId:"api-operation-args"}),e[27]=r.argsSchema,e[28]=h):h=e[28];let g;e[29]!==p||e[30]!==h?(g=N("section",{className:"flex flex-col gap-2",children:[p,h]}),e[29]=p,e[30]=h,e[31]=g):g=e[31];let S;e[32]!==s?(S=s("Response body"),e[32]=s,e[33]=S):S=e[33];let O;e[34]!==S?(O=i("h2",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:S}),e[34]=S,e[35]=O):O=e[35];let k;if(e[36]!==r.responses||e[37]!==s){let E;e[39]!==s?(E=$=>N("div",{className:"flex flex-col gap-1.5 rounded-xl border border-border bg-card p-3",children:[N("div",{className:"flex items-center justify-between gap-2",children:[N("span",{className:`inline-flex items-center gap-1.5 font-mono text-xs font-semibold ${ee($.status)}`,children:[i("span",{className:`size-1.5 rounded-full ${te($.status)}`}),$.status]}),$.schema!==void 0&&i("span",{className:"rounded border border-border px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:s("application/json")})]}),$.description!==void 0&&i("p",{className:"text-xs text-muted-foreground",children:$.description}),$.schema!==void 0&&i(V,{schema:$.schema,testId:`api-response-${$.status}`})]},$.status),e[39]=s,e[40]=E):E=e[40],k=r.responses.map(E),e[36]=r.responses,e[37]=s,e[38]=k}else k=e[38];let T;e[41]!==O||e[42]!==k?(T=N("section",{className:"flex flex-col gap-3",children:[O,k]}),e[41]=O,e[42]=k,e[43]=T):T=e[43];let R;return e[44]!==r.key||e[45]!==n||e[46]!==v||e[47]!==g||e[48]!==T||e[49]!==b?(R=N("div",{className:"flex flex-col gap-6 duration-200 animate-in fade-in-0 slide-in-from-bottom-1","data-testid":n,children:[b,v,g,T]},o),e[44]=r.key,e[45]=n,e[46]=v,e[47]=g,e[48]=T,e[49]=b,e[50]=R):R=e[50],R},Ue={boolean:"text-royal-amethyst",key:"text-sky-sapphire",number:"text-warning",plain:"",string:"text-success"},Ve=/"(?:[^"\\]|\\.)*"|\b(?:true|false|null)\b|-?\d+(?:\.\d+)?/g,Ge=/^\s*:/,Xe=(t,e,r)=>r.startsWith('"')?Ge.test(t.slice(e))?"key":"string":r==="true"||r==="false"||r==="null"?"boolean":"number",Ye=t=>{const e=[];let r=0;for(const s of t.matchAll(Ve)){const{index:n}=s,o=s[0],l=n+o.length;n>r&&e.push({kind:"plain",start:r,text:t.slice(r,n)}),e.push({kind:Xe(t,l,o),start:n,text:o}),r=l}return r<t.length&&e.push({kind:"plain",start:r,text:t.slice(r)}),e},Qe=t=>{const e=P(4),{code:r}=t;let s;e[0]!==r?(s=Ye(r).map(Ze),e[0]=r,e[1]=s):s=e[1];let n;return e[2]!==s?(n=i(xe,{children:s}),e[2]=s,e[3]=n):n=e[3],n};function Ze(t){return i("span",{className:Ue[t.kind],children:t.text},t.start)}const ne="__live__",et=t=>t.schema===void 0?"":JSON.stringify(D(t.schema),void 0,2),tt=(t,e,r)=>r?t??"":e===void 0?"":JSON.stringify(e,ge,2),rt=t=>{const e=P(18),{active:r,running:s,showError:n}=t,o=J();if(s){let u;e[0]!==o?(u=o("Sending…"),e[0]=o,e[1]=u):u=e[1];let b;return e[2]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-running",children:u}),e[2]=u,e[3]=b):b=e[3],b}if(r===void 0||r.body===""){let u;e[4]!==r?.live||e[5]!==o?(u=r?.live===!0?o("Send a request to see the response."):o("No example for this response."),e[4]=r?.live,e[5]=o,e[6]=u):u=e[6];let b;return e[7]!==u?(b=i("p",{className:"px-3 py-3 text-xs text-muted-foreground","data-testid":"api-response-idle",children:u}),e[7]=u,e[8]=b):b=e[8],b}const l=n&&"text-destructive";let a;e[9]!==l?(a=Y("max-h-[28rem] overflow-auto px-3 py-3 font-mono text-xs",l),e[9]=l,e[10]=a):a=e[10];const y=n?"api-response-error":"api-response-body";let d;e[11]!==r.body||e[12]!==n?(d=n?r.body:i(Qe,{code:r.body}),e[11]=r.body,e[12]=n,e[13]=d):d=e[13];let c;return e[14]!==a||e[15]!==y||e[16]!==d?(c=i("pre",{className:a,"data-testid":y,children:d}),e[14]=a,e[15]=y,e[16]=d,e[17]=c):c=e[17],c},st=({durationMs:t,error:e,failed:r,operation:s,ran:n,response:o,t:l})=>{const a=s.responses.map(d=>({body:et(d),durationMs:null,id:d.status,label:d.status,live:!1,status:d.status}));return n?[{body:tt(e,o,r),durationMs:t,id:ne,label:l("Live"),live:!0,status:r?"error":"200"},...a]:a},nt=()=>{const t=P(19),e=J(),{durationMs:r,error:s,operation:n,response:o,status:l}=se(),a=l==="running",y=l==="error",d=l==="success"||y,c=st({durationMs:r,error:s,failed:y,operation:n,ran:d,response:o,t:e}),u=d?ne:c.find(ot)?.id??c[0]?.id??"",[b,x]=B(null),f=c.find(C=>C.id===(b??u))??c[0];let m;t[0]===Symbol.for("react.memo_cache_sentinel")?(m=C=>{const{id:L}=C.currentTarget.dataset;L!==void 0&&x(L)},t[0]=m):m=t[0];const v=m,w=()=>{f!==void 0&&X(f.body)},p=f?.live===!0?f.durationMs:null,h=f?.live===!0&&f.status==="error",g="flex min-h-0 flex-col rounded-xl border border-border bg-card",S="api-response-panel";let O;t[1]!==e?(O=e("Response"),t[1]=e,t[2]=O):O=t[2];let k;t[3]!==O?(k=i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:O}),t[3]=O,t[4]=k):k=t[4];const T=p!==null&&i("span",{className:"font-mono text-[10px] text-muted-foreground",children:e("{ms} ms",{ms:p})}),R=f!==void 0&&f.body!==""&&i(W,{"aria-label":e("Copy"),"data-testid":"api-response-copy",onClick:w,size:"icon-xs",type:"button",variant:"ghost",children:i(F,{icon:ae,strokeWidth:2})});let E;t[5]!==T||t[6]!==R?(E=N("div",{className:"flex items-center gap-2",children:[T,R]}),t[5]=T,t[6]=R,t[7]=E):E=t[7];let $;t[8]!==k||t[9]!==E?($=N("div",{className:"flex items-center justify-between gap-2 border-b border-border px-3 py-2",children:[k,E]}),t[8]=k,t[9]=E,t[10]=$):$=t[10];const A=c.length>0&&i("div",{className:"flex gap-1 overflow-x-auto border-b border-border px-2 py-1.5",role:"tablist",children:c.map(C=>{const L=C.id===f?.id;return N("button",{"aria-selected":L,className:Y("inline-flex items-center gap-1.5 rounded px-2 py-0.5 font-mono text-xs transition-colors hover:text-foreground aria-selected:bg-muted aria-selected:font-medium",L?ee(C.status):"text-muted-foreground"),"data-id":C.id,"data-testid":C.live?"api-response-tab-live":`api-response-tab-${C.status}`,onClick:v,role:"tab",type:"button",children:[i("span",{className:`size-1.5 rounded-full ${te(C.status)}`}),C.label]},C.id)})});let j;t[11]!==f||t[12]!==a||t[13]!==h?(j=i(rt,{active:f,running:a,showError:h}),t[11]=f,t[12]=a,t[13]=h,t[14]=j):j=t[14];let I;return t[15]!==j||t[16]!==$||t[17]!==A?(I=N("div",{className:g,"data-testid":S,children:[$,A,j]}),t[15]=j,t[16]=$,t[17]=A,t[18]=I):I=t[18],I};function ot(t){return t.status.startsWith("2")}const it=(t,e)=>{const r=e.trim().toLowerCase();return r===""?t:t.map(s=>({...s,operations:s.operations.filter(n=>`${n.summary} ${n.operationId}`.toLowerCase().includes(r))})).filter(s=>s.operations.length>0)},wt=t=>{const e=P(53),{model:r}=t,s=J(),n=r.groups[0]?.operations[0]?.key??"",[o,l]=B(n),[a,y]=B("");let d;e[0]!==n||e[1]!==r.operationByKey||e[2]!==o?(d=r.operationByKey.get(o)??r.operationByKey.get(n),e[0]=n,e[1]=r.operationByKey,e[2]=o,e[3]=d):d=e[3];const c=d;let u,b,x,f,m,v,w,p,h,g;if(e[4]!==a||e[5]!==r.groups||e[6]!==r.server||e[7]!==c?.key||e[8]!==s){u=it(r.groups,a);let E;e[19]===Symbol.for("react.memo_cache_sentinel")?(E=M=>{const{key:_}=M.currentTarget.dataset;_!==void 0&&l(_)},e[19]=E):E=e[19];const $=E;let A;e[20]===Symbol.for("react.memo_cache_sentinel")?(A=M=>{y(M.target.value)},e[20]=A):A=e[20];const j=A;b=r.server??"",h="grid min-h-0 flex-1 grid-cols-1 overflow-hidden lg:grid-cols-[16rem_minmax(0,1fr)_22rem]",g="api-reference",e[21]!==s?(m=s("API operations"),e[21]=s,e[22]=m):m=e[22],v="flex min-h-0 flex-col overflow-y-auto border-r border-border",w="api-reference-nav";let I;e[23]===Symbol.for("react.memo_cache_sentinel")?(I=i(F,{className:"pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-muted-foreground",icon:le,strokeWidth:2}),e[23]=I):I=e[23];let C;e[24]!==s?(C=s("Filter operations"),e[24]=s,e[25]=C):C=e[25],e[26]!==a||e[27]!==C?(p=i("div",{className:"sticky top-0 z-10 border-b border-border bg-sidebar p-2",children:N("div",{className:"relative",children:[I,i(ue,{className:"h-7 pl-7","data-testid":"api-filter",onChange:j,placeholder:C,value:a})]})}),e[26]=a,e[27]=C,e[28]=p):p=e[28],x="flex flex-col gap-4 p-2";let L;e[29]!==c?.key||e[30]!==s?(L=M=>N("div",{className:"flex flex-col gap-1",children:[N("div",{className:"flex items-center justify-between px-2",children:[i("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:M.name||s("(root)")}),i("span",{className:"font-mono text-[10px] text-muted-foreground/70",children:M.operations.length})]}),M.operations.map(_=>{const oe=_.key===c?.key;return N("button",{"aria-current":oe?"page":void 0,className:"flex items-center justify-between gap-2 rounded-md border-l-2 border-transparent px-2 py-1 text-start text-xs text-muted-foreground transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground aria-[current=page]:border-primary aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-medium aria-[current=page]:text-foreground","data-key":_.key,"data-testid":`api-nav-${_.operationId}`,onClick:$,type:"button",children:[i("span",{className:"truncate",children:_.summary}),i(q,{kind:_.kind,method:_.method})]},_.key)})]},M.name),e[29]=c?.key,e[30]=s,e[31]=L):L=e[31],f=u.map(L),e[4]=a,e[5]=r.groups,e[6]=r.server,e[7]=c?.key,e[8]=s,e[9]=u,e[10]=b,e[11]=x,e[12]=f,e[13]=m,e[14]=v,e[15]=w,e[16]=p,e[17]=h,e[18]=g}else u=e[9],b=e[10],x=e[11],f=e[12],m=e[13],v=e[14],w=e[15],p=e[16],h=e[17],g=e[18];let S;e[32]!==u.length||e[33]!==s?(S=u.length===0&&i("p",{className:"px-2 py-1 text-xs text-muted-foreground","data-testid":"api-nav-empty",children:s("No operations match your filter.")}),e[32]=u.length,e[33]=s,e[34]=S):S=e[34];let O;e[35]!==S||e[36]!==x||e[37]!==f?(O=N("div",{className:x,children:[f,S]}),e[35]=S,e[36]=x,e[37]=f,e[38]=O):O=e[38];let k;e[39]!==O||e[40]!==m||e[41]!==v||e[42]!==w||e[43]!==p?(k=N("nav",{"aria-label":m,className:v,"data-testid":w,children:[p,O]}),e[39]=O,e[40]=m,e[41]=v,e[42]=w,e[43]=p,e[44]=k):k=e[44];let T;e[45]!==c||e[46]!==b?(T=c===void 0?i("div",{className:"lg:col-span-2"}):N(We,{operation:c,children:[i("div",{className:"min-w-0 overflow-y-auto p-6","data-testid":"api-reference-main",children:i(He,{operation:c})}),N("aside",{className:"flex min-w-0 flex-col gap-4 overflow-y-auto border-border p-4 lg:border-l","data-testid":"api-reference-aside",children:[i(Pe,{operation:c,server:b}),i(nt,{})]})]},c.key),e[45]=c,e[46]=b,e[47]=T):T=e[47];let R;return e[48]!==k||e[49]!==T||e[50]!==h||e[51]!==g?(R=N("div",{className:h,"data-testid":g,children:[k,T]}),e[48]=k,e[49]=T,e[50]=h,e[51]=g,e[52]=R):R=e[52],R};export{wt as R};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{c as y}from"react/compiler-runtime";import{Handle as k,Position as D,useNodesState as U,useEdgesState as V,ReactFlow as Z,Background as J,Panel as L,Controls as X,MiniMap as ee,useNodesInitialized as te,useReactFlow as se}from"@xyflow/react";import{useState as R,useMemo as _,useRef as ae,useEffect as w}from"react";import{D as oe}from"./diagram-export-panel-DrYRni_b.mjs";import{S as re,T as x}from"./storage-tier-C2mKwYRj.mjs";import{B as E}from"./badge-r_5B4LHP.mjs";import{B as H}from"./button-q0UYSmrn.mjs";import{I as ne}from"./input-CXhxesPC.mjs";import{useT as C}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as le}from"./internal-S7SDbbPa.mjs";import{c as N}from"./utils-bhneXptQ.mjs";import{jsx as d,jsxs as g}from"react/jsx-runtime";function ie(s){const e=y(10);let t,r,a;e[0]!==s?({className:t,selected:a,...r}=s,e[0]=s,e[1]=t,e[2]=r,e[3]=a):(t=e[1],r=e[2],a=e[3]);const n=a===!0?"":void 0;let o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let l;return e[6]!==r||e[7]!==n||e[8]!==o?(l=d("div",{"data-slot":"base-node","data-selected":n,className:o,...r}),e[6]=r,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function de(s){const e=y(8);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=a):a=e[4];let n;return e[5]!==r||e[6]!==a?(n=d("div",{"data-slot":"base-node-header",className:a,...r}),e[5]=r,e[6]=a,e[7]=n):n=e[7],n}function ce(s){const e=y(8);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=N("flex flex-col",t),e[3]=t,e[4]=a):a=e[4];let n;return e[5]!==r||e[6]!==a?(n=d("div",{"data-slot":"base-node-content",className:a,...r}),e[5]=r,e[6]=a,e[7]=n):n=e[7],n}const A=s=>{const e=s.ref===void 0?s.type:`${s.type} → ${s.ref}`;return s.optional===!0?`${e}?`:e},me=s=>{const e=y(22),{data:t,selected:r}=s,a=C();let n;e[0]!==t.label||e[1]!==t.loadError||e[2]!==a?(n=t.loadError===!0?d("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:a("Columns unavailable")}):d("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=a,e[3]=n):n=e[3];const o=n,l=`sd-node-${t.label}`;let c;e[4]!==t.label?(c=d("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=d("span",{className:"ms-auto",children:d(re,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=g(de,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o?(f=t.columns.length===0?o:t.columns.map(p=>g("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",p.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${p.name}`,children:[d(k,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:D.Left,type:"target"}),d("span",{className:"truncate font-mono",title:p.name,children:p.name}),p.pk===!0&&d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),p.ref!==void 0&&d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),d("span",{className:"ms-auto truncate text-muted-foreground",title:A(p),children:A(p)}),d(k,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:D.Right,type:"source"})]},p.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=f):f=e[14];let u;e[15]!==f?(u=d(ce,{children:f}),e[15]=f,e[16]=u):u=e[16];let b;return e[17]!==r||e[18]!==l||e[19]!==i||e[20]!==u?(b=g(ie,{className:"w-64 overflow-hidden","data-testid":l,selected:r,children:[i,u]}),e[17]=r,e[18]=l,e[19]=i,e[20]=u,e[21]=b):b=e[21],b},F=256,z=112,O=36,v=24,fe=480,ue=1.4,pe=s=>{const e=Math.max(1,Math.round(Math.sqrt(ue*s/(F+z))));return Math.max(fe,s/e)},ge=38,he=28,B=s=>ge+Math.max(1,s)*he,be=(s,e)=>{const t=new Map;for(const o of s)t.set(o,[]);for(const o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);const r=new Map,a=new Set,n=o=>{const l=r.get(o);if(l!==void 0)return l;if(a.has(o))return 0;a.add(o);let c=0;for(const m of t.get(o)??[])c=Math.max(c,n(m)+1);return a.delete(o),r.set(o,c),c};for(const o of s)n(o);return r},xe=(s,e,t)=>{const r=be(s,e),a=new Map;for(const m of s){const i=r.get(m)??0,f=a.get(i);f===void 0?a.set(i,[m]):f.push(m)}const n=s.reduce((m,i)=>m+B(t.get(i)??0)+O,0),o=pe(n),l=[];let c=0;for(const m of[...a.keys()].toSorted((i,f)=>i-f)){let i=0,f=v;for(const u of a.get(m)??[]){const b=B(t.get(u)??0);f>v&&f+b>o&&(i+=1,f=v),l.push({name:u,x:v+(c+i)*(F+z),y:f}),f+=b+O}c+=i+1}return l},Ne={databaseSchema:me},G={backgroundColor:x.shard.color},I={backgroundColor:x.global.color},ye={global:!0,shard:!0},ve={},Ee=s=>{const e=s.find(t=>t.pk===!0)?.name;return e!==void 0?e:s.some(t=>t.name==="_id")?"_id":s.some(t=>t.name==="id")?"id":s[0]?.name??"_id"},K=s=>s.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),Se=(s,e,t)=>{const r=s.map(l=>l.name),a=new Map(s.map(l=>[l.name,l.columns.length])),n=xe(r,K(s),a),o=new Map(s.map(l=>[l.name,l]));return n.flatMap(({name:l,x:c,y:m})=>{const i=o.get(l);return i===void 0?[]:[{className:t[l],data:{columns:i.columns,label:l,loadError:e,tier:i.tier},id:l,position:{x:c,y:m},type:"databaseSchema"}]})},_e=s=>{const e=new Map(s.map(t=>[t.name,t.columns]));return K(s).flatMap(t=>{const r=e.get(t.to)??[],a=e.get(t.from)??[],n=Ee(r);return!r.some(o=>o.name===n)||!a.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:n,target:t.from,targetHandle:t.column}]})},we=()=>{const s=y(15),e=C();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=g("span",{className:"flex items-center gap-1",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),s[0]=t):t=s[0];let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=g("span",{className:"flex items-center gap-1",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]}),s[1]=r):r=s[1];let a;s[2]===Symbol.for("react.memo_cache_sentinel")?(a=d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),s[2]=a):a=s[2];let n;s[3]!==e?(n=e("Primary key"),s[3]=e,s[4]=n):n=s[4];let o;s[5]!==n?(o=g("span",{className:"flex items-center gap-1",children:[a,n]}),s[5]=n,s[6]=o):o=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),s[7]=l):l=s[7];let c;s[8]!==e?(c=e("Foreign key"),s[8]=e,s[9]=c):c=s[9];let m;s[10]!==c?(m=g("span",{className:"flex items-center gap-1",children:[l,c]}),s[10]=c,s[11]=m):m=s[11];let i;return s[12]!==o||s[13]!==m?(i=g("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,r,o,m]}),s[12]=o,s[13]=m,s[14]=i):i=s[14],i},Ce=12,Me=s=>{const e=y(9),{containerRef:t,seedKey:r}=s,a=te(),{fitView:n}=se();let o;e[0]!==t||e[1]!==n||e[2]!==a?(o=()=>{if(!a)return;const c=()=>{le(n({duration:0,maxZoom:1.6,padding:.14}))};c();const m=t.current;if(m===null)return;const i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},e[0]=t,e[1]=n,e[2]=a,e[3]=o):o=e[3];let l;return e[4]!==t||e[5]!==n||e[6]!==a||e[7]!==r?(l=[t,n,a,r],e[4]=t,e[5]=n,e[6]=a,e[7]=r,e[8]=l):l=e[8],w(o,l),null},Ge=({columnsError:s,fill:e=!1,nodeClasses:t,tables:r,testIdPrefix:a})=>{const n=C(),[o,l]=R(ye),[c,m]=R(""),i=_(()=>{const h=c.trim().toLowerCase();return r.filter($=>o[$.tier]&&$.name.toLowerCase().includes(h))},[r,o,c]),f=_(()=>Se(i,s??!1,t??ve),[i,s,t]),u=_(()=>_e(i),[i]),b=i.map(h=>h.name).join(","),[p,M,P]=U(f),[W,T,Y]=V(u),S=ae(null);w(()=>{M(f)},[f,M]),w(()=>{T(u)},[u,T]);const j=h=>{m(h.target.value)},q=()=>{l(h=>({...h,shard:!h.shard}))},Q=()=>{l(h=>({...h,global:!h.global}))};return r.length===0?d("section",{className:"flex flex-col gap-2","data-testid":`${a}-section`,children:d("p",{className:"text-sm text-muted-foreground","data-testid":`${a}-empty`,children:n("No tables to graph.")})}):d("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${a}-section`,children:d("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${a}-canvas`,ref:S,children:g(Z,{edges:W,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:p,nodesConnectable:!1,nodeTypes:Ne,onEdgesChange:Y,onNodesChange:P,children:[d(J,{}),d(L,{position:"top-left",children:g("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[d(ne,{"aria-label":n("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${a}-find`,onChange:j,placeholder:n("Find table…"),value:c}),g("div",{"aria-label":n("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[g(H,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${a}-tier-shard`,onClick:q,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),g(H,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${a}-tier-global`,onClick:Q,size:"xs",type:"button",variant:o.global?"default":"outline",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]})]})]})}),d(L,{position:"bottom-center",children:d(we,{})}),d(X,{showInteractive:!1}),i.length>Ce&&d(ee,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),d(oe,{containerRef:S,filenameBase:`${a}-schema-diagram`,testIdPrefix:a}),d(Me,{containerRef:S,seedKey:b})]})})})};export{Ge as S};
|
|
2
|
+
import{c as y}from"react/compiler-runtime";import{Handle as k,Position as D,useNodesState as U,useEdgesState as V,ReactFlow as Z,Background as J,Panel as L,Controls as X,MiniMap as ee,useNodesInitialized as te,useReactFlow as se}from"@xyflow/react";import{useState as R,useMemo as _,useRef as ae,useEffect as w}from"react";import{D as oe}from"./diagram-export-panel-BMLzao0Y.mjs";import{S as re,T as x}from"./storage-tier-C2mKwYRj.mjs";import{B as E}from"./badge-r_5B4LHP.mjs";import{B as H}from"./button-q0UYSmrn.mjs";import{I as ne}from"./input-CXhxesPC.mjs";import{useT as C}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as le}from"./internal-BXEjuLPN.mjs";import{c as N}from"./utils-bhneXptQ.mjs";import{jsx as d,jsxs as g}from"react/jsx-runtime";function ie(s){const e=y(10);let t,r,a;e[0]!==s?({className:t,selected:a,...r}=s,e[0]=s,e[1]=t,e[2]=r,e[3]=a):(t=e[1],r=e[2],a=e[3]);const n=a===!0?"":void 0;let o;e[4]!==t?(o=N("rounded-md border border-border bg-card text-card-foreground shadow-sm transition-colors","data-[selected]:border-ring data-[selected]:ring-[3px] data-[selected]:ring-ring/30",t),e[4]=t,e[5]=o):o=e[5];let l;return e[6]!==r||e[7]!==n||e[8]!==o?(l=d("div",{"data-slot":"base-node","data-selected":n,className:o,...r}),e[6]=r,e[7]=n,e[8]=o,e[9]=l):l=e[9],l}function de(s){const e=y(8);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=N("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=a):a=e[4];let n;return e[5]!==r||e[6]!==a?(n=d("div",{"data-slot":"base-node-header",className:a,...r}),e[5]=r,e[6]=a,e[7]=n):n=e[7],n}function ce(s){const e=y(8);let t,r;e[0]!==s?({className:t,...r}=s,e[0]=s,e[1]=t,e[2]=r):(t=e[1],r=e[2]);let a;e[3]!==t?(a=N("flex flex-col",t),e[3]=t,e[4]=a):a=e[4];let n;return e[5]!==r||e[6]!==a?(n=d("div",{"data-slot":"base-node-content",className:a,...r}),e[5]=r,e[6]=a,e[7]=n):n=e[7],n}const A=s=>{const e=s.ref===void 0?s.type:`${s.type} → ${s.ref}`;return s.optional===!0?`${e}?`:e},me=s=>{const e=y(22),{data:t,selected:r}=s,a=C();let n;e[0]!==t.label||e[1]!==t.loadError||e[2]!==a?(n=t.loadError===!0?d("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:a("Columns unavailable")}):d("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=a,e[3]=n):n=e[3];const o=n,l=`sd-node-${t.label}`;let c;e[4]!==t.label?(c=d("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=c):c=e[5];let m;e[6]!==t.tier?(m=d("span",{className:"ms-auto",children:d(re,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let i;e[8]!==c||e[9]!==m?(i=g(de,{children:[c,m]}),e[8]=c,e[9]=m,e[10]=i):i=e[10];let f;e[11]!==t.columns||e[12]!==t.label||e[13]!==o?(f=t.columns.length===0?o:t.columns.map(p=>g("div",{className:N("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",p.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${p.name}`,children:[d(k,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:D.Left,type:"target"}),d("span",{className:"truncate font-mono",title:p.name,children:p.name}),p.pk===!0&&d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),p.ref!==void 0&&d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),d("span",{className:"ms-auto truncate text-muted-foreground",title:A(p),children:A(p)}),d(k,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:p.name,isConnectable:!1,position:D.Right,type:"source"})]},p.name)),e[11]=t.columns,e[12]=t.label,e[13]=o,e[14]=f):f=e[14];let u;e[15]!==f?(u=d(ce,{children:f}),e[15]=f,e[16]=u):u=e[16];let b;return e[17]!==r||e[18]!==l||e[19]!==i||e[20]!==u?(b=g(ie,{className:"w-64 overflow-hidden","data-testid":l,selected:r,children:[i,u]}),e[17]=r,e[18]=l,e[19]=i,e[20]=u,e[21]=b):b=e[21],b},F=256,z=112,O=36,v=24,fe=480,ue=1.4,pe=s=>{const e=Math.max(1,Math.round(Math.sqrt(ue*s/(F+z))));return Math.max(fe,s/e)},ge=38,he=28,B=s=>ge+Math.max(1,s)*he,be=(s,e)=>{const t=new Map;for(const o of s)t.set(o,[]);for(const o of e)o.to!==o.from&&t.has(o.from)&&t.has(o.to)&&t.get(o.from)?.push(o.to);const r=new Map,a=new Set,n=o=>{const l=r.get(o);if(l!==void 0)return l;if(a.has(o))return 0;a.add(o);let c=0;for(const m of t.get(o)??[])c=Math.max(c,n(m)+1);return a.delete(o),r.set(o,c),c};for(const o of s)n(o);return r},xe=(s,e,t)=>{const r=be(s,e),a=new Map;for(const m of s){const i=r.get(m)??0,f=a.get(i);f===void 0?a.set(i,[m]):f.push(m)}const n=s.reduce((m,i)=>m+B(t.get(i)??0)+O,0),o=pe(n),l=[];let c=0;for(const m of[...a.keys()].toSorted((i,f)=>i-f)){let i=0,f=v;for(const u of a.get(m)??[]){const b=B(t.get(u)??0);f>v&&f+b>o&&(i+=1,f=v),l.push({name:u,x:v+(c+i)*(F+z),y:f}),f+=b+O}c+=i+1}return l},Ne={databaseSchema:me},G={backgroundColor:x.shard.color},I={backgroundColor:x.global.color},ye={global:!0,shard:!0},ve={},Ee=s=>{const e=s.find(t=>t.pk===!0)?.name;return e!==void 0?e:s.some(t=>t.name==="_id")?"_id":s.some(t=>t.name==="id")?"id":s[0]?.name??"_id"},K=s=>s.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),Se=(s,e,t)=>{const r=s.map(l=>l.name),a=new Map(s.map(l=>[l.name,l.columns.length])),n=xe(r,K(s),a),o=new Map(s.map(l=>[l.name,l]));return n.flatMap(({name:l,x:c,y:m})=>{const i=o.get(l);return i===void 0?[]:[{className:t[l],data:{columns:i.columns,label:l,loadError:e,tier:i.tier},id:l,position:{x:c,y:m},type:"databaseSchema"}]})},_e=s=>{const e=new Map(s.map(t=>[t.name,t.columns]));return K(s).flatMap(t=>{const r=e.get(t.to)??[],a=e.get(t.from)??[],n=Ee(r);return!r.some(o=>o.name===n)||!a.some(o=>o.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:n,target:t.from,targetHandle:t.column}]})},we=()=>{const s=y(15),e=C();let t;s[0]===Symbol.for("react.memo_cache_sentinel")?(t=g("span",{className:"flex items-center gap-1",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),s[0]=t):t=s[0];let r;s[1]===Symbol.for("react.memo_cache_sentinel")?(r=g("span",{className:"flex items-center gap-1",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]}),s[1]=r):r=s[1];let a;s[2]===Symbol.for("react.memo_cache_sentinel")?(a=d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),s[2]=a):a=s[2];let n;s[3]!==e?(n=e("Primary key"),s[3]=e,s[4]=n):n=s[4];let o;s[5]!==n?(o=g("span",{className:"flex items-center gap-1",children:[a,n]}),s[5]=n,s[6]=o):o=s[6];let l;s[7]===Symbol.for("react.memo_cache_sentinel")?(l=d(E,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),s[7]=l):l=s[7];let c;s[8]!==e?(c=e("Foreign key"),s[8]=e,s[9]=c):c=s[9];let m;s[10]!==c?(m=g("span",{className:"flex items-center gap-1",children:[l,c]}),s[10]=c,s[11]=m):m=s[11];let i;return s[12]!==o||s[13]!==m?(i=g("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-xl border border-border bg-card/95 px-2.5 py-1.5 text-[11px] text-muted-foreground shadow-xs",children:[t,r,o,m]}),s[12]=o,s[13]=m,s[14]=i):i=s[14],i},Ce=12,Me=s=>{const e=y(9),{containerRef:t,seedKey:r}=s,a=te(),{fitView:n}=se();let o;e[0]!==t||e[1]!==n||e[2]!==a?(o=()=>{if(!a)return;const c=()=>{le(n({duration:0,maxZoom:1.6,padding:.14}))};c();const m=t.current;if(m===null)return;const i=new ResizeObserver(()=>{c()});return i.observe(m),()=>{i.disconnect()}},e[0]=t,e[1]=n,e[2]=a,e[3]=o):o=e[3];let l;return e[4]!==t||e[5]!==n||e[6]!==a||e[7]!==r?(l=[t,n,a,r],e[4]=t,e[5]=n,e[6]=a,e[7]=r,e[8]=l):l=e[8],w(o,l),null},Ge=({columnsError:s,fill:e=!1,nodeClasses:t,tables:r,testIdPrefix:a})=>{const n=C(),[o,l]=R(ye),[c,m]=R(""),i=_(()=>{const h=c.trim().toLowerCase();return r.filter($=>o[$.tier]&&$.name.toLowerCase().includes(h))},[r,o,c]),f=_(()=>Se(i,s??!1,t??ve),[i,s,t]),u=_(()=>_e(i),[i]),b=i.map(h=>h.name).join(","),[p,M,P]=U(f),[W,T,Y]=V(u),S=ae(null);w(()=>{M(f)},[f,M]),w(()=>{T(u)},[u,T]);const j=h=>{m(h.target.value)},q=()=>{l(h=>({...h,shard:!h.shard}))},Q=()=>{l(h=>({...h,global:!h.global}))};return r.length===0?d("section",{className:"flex flex-col gap-2","data-testid":`${a}-section`,children:d("p",{className:"text-sm text-muted-foreground","data-testid":`${a}-empty`,children:n("No tables to graph.")})}):d("section",{className:N("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${a}-section`,children:d("div",{className:N("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${a}-canvas`,ref:S,children:g(Z,{edges:W,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:p,nodesConnectable:!1,nodeTypes:Ne,onEdgesChange:Y,onNodesChange:P,children:[d(J,{}),d(L,{position:"top-left",children:g("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[d(ne,{"aria-label":n("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${a}-find`,onChange:j,placeholder:n("Find table…"),value:c}),g("div",{"aria-label":n("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[g(H,{"aria-pressed":o.shard,className:"gap-1.5","data-testid":`${a}-tier-shard`,onClick:q,size:"xs",type:"button",variant:o.shard?"default":"outline",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:G}),x.shard.label]}),g(H,{"aria-pressed":o.global,className:"gap-1.5","data-testid":`${a}-tier-global`,onClick:Q,size:"xs",type:"button",variant:o.global?"default":"outline",children:[d("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:I}),x.global.label]})]})]})}),d(L,{position:"bottom-center",children:d(we,{})}),d(X,{showInteractive:!1}),i.length>Ce&&d(ee,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),d(oe,{containerRef:S,filenameBase:`${a}-schema-diagram`,testIdPrefix:a}),d(Me,{containerRef:S,seedKey:b})]})})})};export{Ge as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as k}from"react/compiler-runtime";import{AreaChart as R,CartesianGrid as g,XAxis as N,Area as B,LineChart as X,Line as $}from"recharts";import{useT as S}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{l as E}from"./internal-BXEjuLPN.mjs";import{E as H,X as _,B as j,T as G,C as O,a as A,b as K}from"./bar-chart-BCsEIQoQ.mjs";import{jsx as l,jsxs as T}from"react/jsx-runtime";import{c as V,a as z,b as L,e as F,d as I,T as M}from"./table-D0SBiDu-.mjs";import{C as U}from"./data-grid-BHTuvSI7.mjs";const W=50,q={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},D=o=>{const e=o.columns.find(n=>o.rows.length>0&&o.rows.every(a=>typeof a[n]=="number"))??null;return{label:o.columns.find(n=>n!==e)??null,value:e}},J=o=>{const e=k(3),{data:t,kind:n}=o;let a;return e[0]!==t||e[1]!==n?(a=l(O,{className:"h-full w-full",config:q,children:n==="area"?T(R,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l(B,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):T(X,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l($,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),e[0]=t,e[1]=n,e[2]=a):a=e[2],a},oe=o=>{const e=k(21),{axes:t,kind:n,result:a}=o,u=S();let r;e[0]!==a?(r=D(a),e[0]=a,e[1]=r):r=e[1];const d=r;let m;e[2]!==a.columns?(m=new Set(a.columns),e[2]=a.columns,e[3]=m):m=e[3];const s=m,i=t!==void 0&&s.has(t.x)?t.x:d.label;let h;e[4]!==t?.y||e[5]!==s?(h=t?.y.find(c=>s.has(c)),e[4]=t?.y,e[5]=s,e[6]=h):h=e[6];const b=h,C=b??d.value;let w;e[7]!==i||e[8]!==a.rows||e[9]!==C?(w=C===null?[]:a.rows.slice(0,W).map((c,v)=>({label:i===null?`#${(v+1).toString()}`:E(c[i]),value:Number(c[C])||0})),e[7]=i,e[8]=a.rows,e[9]=C,e[10]=w):w=e[10];const x=w;if(C===null){let c;e[11]!==u?(c=u("No numeric column to chart."),e[11]=u,e[12]=c):c=e[12];let v;return e[13]!==c?(v=l("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:c}),e[13]=c,e[14]=v):v=e[14],v}const f=n??(t!==void 0&&b!==void 0?t.kind:"bar");let p;e[15]!==x||e[16]!==f?(p=f==="bar"?T(H,{className:"h-full w-full",config:q,data:x,children:[l(_,{dataKey:"label"}),l(j,{dataKey:"value"}),l(G,{})]}):l(J,{data:x,kind:f}),e[15]=x,e[16]=f,e[17]=p):p=e[17];let y;return e[18]!==f||e[19]!==p?(y=l("div",{className:"h-80 w-full p-3","data-chart-kind":f,"data-testid":"sql-chart",children:p}),e[18]=f,e[19]=p,e[20]=y):y=e[20],y},ne=o=>{const e=k(19),{result:t}=o,n=S();if(t.columns.length===0){let s;e[0]!==t.rowCount||e[1]!==n?(s=n("{count} rows",{count:t.rowCount}),e[0]=t.rowCount,e[1]=n,e[2]=s):s=e[2];let i;return e[3]!==s?(i=l("p",{className:"p-4 text-sm text-muted-foreground",children:s}),e[3]=s,e[4]=i):i=e[4],i}let a;e[5]!==t.columns?(a=t.columns.map(P),e[5]=t.columns,e[6]=a):a=e[6];let u;e[7]!==a?(u=l(z,{className:"sticky top-0 z-10 bg-muted",children:l(L,{children:a})}),e[7]=a,e[8]=u):u=e[8];let r;if(e[9]!==t.columns||e[10]!==t.rows){let s;e[12]!==t.columns?(s=(i,h)=>l(L,{"data-testid":"sql-row",children:t.columns.map(b=>l(F,{className:"max-w-md truncate font-mono text-xs",children:l(U,{value:i[b]})},b))},h),e[12]=t.columns,e[13]=s):s=e[13],r=t.rows.map(s),e[9]=t.columns,e[10]=t.rows,e[11]=r}else r=e[11];let d;e[14]!==r?(d=l(I,{children:r}),e[14]=r,e[15]=d):d=e[15];let m;return e[16]!==u||e[17]!==d?(m=T(M,{"data-testid":"sql-rows",children:[u,d]}),e[16]=u,e[17]=d,e[18]=m):m=e[18],m};function P(o){return l(V,{children:o},o)}export{oe as S,ne as a};
|