@lunora/studio 1.0.0-alpha.325 → 1.0.0-alpha.327
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 +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +1 -1
- package/dist/mount.d.mts +1 -1
- package/dist/mount.d.ts +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 +1 -1
- package/dist/packem_chunks/FileBrowser.mjs +1 -1
- 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 +1 -1
- 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-fhDlZGE4.mjs → ApiDocsPanel-6yZaaxch.mjs} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-nAf8tNRr.mjs → ApiReferencePanel-mwEK_vL7.mjs} +1 -1
- package/dist/packem_shared/{CommandPalette-D9ZY-qQd.mjs → CommandPalette-CcTVGQvw.mjs} +1 -1
- package/dist/packem_shared/{DataBrowser-E68QfaST.mjs → DataBrowser-B6xr6S3s.mjs} +1 -1
- package/dist/packem_shared/{GlobalDataBrowser-DhObcZDY.mjs → GlobalDataBrowser-DlBYI85g.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-CUuYsApa.mjs → HomePanel-DBUgY2yE.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-C2kb3oL-.mjs → MigrationsPanel-_H327LDl.mjs} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-BxEr49D9.mjs → OpenRpcReferencePanel-DJg4AbuZ.mjs} +1 -1
- package/dist/packem_shared/{ScheduledJobs-BZNcYWBP.mjs → ScheduledJobs-CscRWLW-.mjs} +1 -1
- package/dist/packem_shared/{Studio-CZjQXFHC.mjs → Studio-s4EbmwaL.mjs} +1 -1
- package/dist/packem_shared/{StudioApp-C9ENwcOH.mjs → StudioApp-D1e2uc7_.mjs} +1 -1
- package/dist/packem_shared/{advisor-view-y4cW5JcX.mjs → advisor-view-kg9uZT7H.mjs} +1 -1
- package/dist/packem_shared/{app.d-D7vL0y8y.d.mts → app.d-D45VvUTx.d.mts} +2 -0
- package/dist/packem_shared/{app.d-D7vL0y8y.d.ts → app.d-D45VvUTx.d.ts} +2 -0
- package/dist/packem_shared/{data-grid-DIiNmDR9.mjs → data-grid-XIuWrWDy.mjs} +1 -1
- package/dist/packem_shared/{diagram-export-panel-D5CVNJkp.mjs → diagram-export-panel-DrYRni_b.mjs} +1 -1
- package/dist/packem_shared/{error-alert-DAsOWnCL.mjs → error-alert-Dr4RMEID.mjs} +1 -1
- package/dist/packem_shared/{grid-features-OVIMIQan.mjs → grid-features-6mTvrzgT.mjs} +1 -1
- package/dist/packem_shared/{home-panel-BcE8S2Nn.mjs → home-panel-CKbpgpz9.mjs} +1 -1
- package/dist/packem_shared/{internal-Df43vQI0.mjs → internal-S7SDbbPa.mjs} +2 -2
- package/dist/packem_shared/{log-line-CICyJ_kc.mjs → log-line-DP0b3YT5.mjs} +1 -1
- package/dist/packem_shared/{recording-client-CyFiAE2l.mjs → recording-client-BbX9ql7w.mjs} +1 -1
- package/dist/packem_shared/{reference-view-CIHyURU6.mjs → reference-view-DNdYDPow.mjs} +1 -1
- package/dist/packem_shared/{schema-diagram-C5oilX7l.mjs → schema-diagram-DKBYRWsL.mjs} +1 -1
- package/dist/packem_shared/{sql-result-table-DyK762_A.mjs → sql-result-table-B7g48CHO.mjs} +1 -1
- package/dist/packem_shared/{studio-fK2DTLde.mjs → studio-BTM7dITm.mjs} +1 -1
- package/dist/packem_shared/{table-list-sidebar-DkPO_Qtz.mjs → table-list-sidebar-DcvrtBkE.mjs} +1 -1
- package/dist/packem_shared/{use-admin-query-tlBof8Yg.mjs → use-admin-query-B2jU5P5u.mjs} +1 -1
- package/dist/packem_shared/{use-admin-spec-Bir7V68L.mjs → use-admin-spec-CISwmdXM.mjs} +1 -1
- package/dist/packem_shared/{use-async-submit-CZqCMTJ_.mjs → use-async-submit-CgvRHgaD.mjs} +1 -1
- package/dist/packem_shared/{use-auth-config-Z_n4ABCI.mjs → use-auth-config-B9w5-1-p.mjs} +1 -1
- package/dist/packem_shared/{use-open-trace-DMVhpnyG.mjs → use-open-trace-CUyoDXjN.mjs} +1 -1
- package/dist/packem_shared/{use-sql-assistant-CZydTzd5.mjs → use-sql-assistant-CK6G1ycr.mjs} +1 -1
- package/dist/standalone/{chunk-YVR4SEPU.js → chunk-2EYOYWS2.js} +1 -1
- package/dist/standalone/{chunk-OSGXNEFA.js → chunk-2G3B5PAO.js} +1 -1
- package/dist/standalone/{chunk-2VA5S3IA.js → chunk-2QXJTBVX.js} +1 -1
- package/dist/standalone/{chunk-6HLARDYO.js → chunk-2W67FQCF.js} +1 -1
- package/dist/standalone/{chunk-CGYVHQAD.js → chunk-3G52JQDE.js} +1 -1
- package/dist/standalone/{chunk-ZRB4HPDU.js → chunk-4OPMHED5.js} +1 -1
- package/dist/standalone/{chunk-SR2FQOVJ.js → chunk-4WVVQII7.js} +1 -1
- package/dist/standalone/{chunk-HJHSQPHW.js → chunk-5OMZCVRF.js} +1 -1
- package/dist/standalone/{chunk-ASA7UJIH.js → chunk-6LAOOCDD.js} +1 -1
- package/dist/standalone/{chunk-MK4H5D3L.js → chunk-7ULZKZQQ.js} +1 -1
- package/dist/standalone/{chunk-QPZG3NV6.js → chunk-7XM3Z7IQ.js} +1 -1
- package/dist/standalone/{chunk-R2GYDPPC.js → chunk-ABBJRINK.js} +1 -1
- package/dist/standalone/{chunk-QLKZIBWQ.js → chunk-AQFI2GWT.js} +1 -1
- package/dist/standalone/{chunk-7VJPXCOU.js → chunk-ARXLF43Z.js} +1 -1
- package/dist/standalone/{chunk-R73OPTTE.js → chunk-B6ATVGZY.js} +1 -1
- package/dist/standalone/{chunk-XEKXUZWX.js → chunk-BBJAUO6Q.js} +1 -1
- package/dist/standalone/{chunk-ZNVNSNDU.js → chunk-BKAIQ3EW.js} +1 -1
- package/dist/standalone/chunk-BZSLOCHA.js +1 -0
- package/dist/standalone/{chunk-QUXXMJPZ.js → chunk-C4ZPJ4KT.js} +1 -1
- package/dist/standalone/{chunk-4HBHTD3A.js → chunk-CJXS7ZFK.js} +1 -1
- package/dist/standalone/{chunk-VBUNOAPR.js → chunk-D6ZXOSCM.js} +1 -1
- package/dist/standalone/{chunk-SV764LKQ.js → chunk-D746I7ZX.js} +1 -1
- package/dist/standalone/chunk-DTFIEXYN.js +9 -0
- package/dist/standalone/{chunk-WHDFMKYB.js → chunk-DVX5J34S.js} +1 -1
- package/dist/standalone/{chunk-UMHLRQOR.js → chunk-EKKX6QM5.js} +1 -1
- package/dist/standalone/{chunk-LLN6LEHZ.js → chunk-EYX7T7D6.js} +1 -1
- package/dist/standalone/{chunk-4UKHYUNB.js → chunk-F2632QSD.js} +1 -1
- package/dist/standalone/{chunk-CY7FSXYX.js → chunk-FBGCQYRO.js} +1 -1
- package/dist/standalone/{chunk-JZGTSH2C.js → chunk-FCVKROK5.js} +1 -1
- package/dist/standalone/{chunk-X4JXFRIZ.js → chunk-FZHX4SU4.js} +1 -1
- package/dist/standalone/{chunk-U6IDPJGC.js → chunk-G7HELO37.js} +1 -1
- package/dist/standalone/{chunk-SUTA66KR.js → chunk-GAW73INZ.js} +1 -1
- package/dist/standalone/{chunk-5QYM3MYE.js → chunk-GIE6BF2N.js} +2 -2
- package/dist/standalone/{chunk-JSGD6M6E.js → chunk-GWN7ZBB6.js} +1 -1
- package/dist/standalone/{chunk-LJIMLABC.js → chunk-GXJA7VNB.js} +1 -1
- package/dist/standalone/{chunk-QZRACAES.js → chunk-HAAMTGU2.js} +1 -1
- package/dist/standalone/{chunk-XXMXVSAN.js → chunk-HCM7G3LJ.js} +1 -1
- package/dist/standalone/{chunk-P2OIRN2O.js → chunk-HM6K7CGB.js} +1 -1
- package/dist/standalone/{chunk-3T4K7XUT.js → chunk-HPXALQPF.js} +1 -1
- package/dist/standalone/{chunk-UPO3FC7D.js → chunk-HYKN42SO.js} +1 -1
- package/dist/standalone/{chunk-XHRKNCCI.js → chunk-I23ULEUU.js} +1 -1
- package/dist/standalone/{chunk-WTNHJS56.js → chunk-J7UN5TFS.js} +1 -1
- package/dist/standalone/chunk-JLACL25R.js +1 -0
- package/dist/standalone/{chunk-7UQC3B6P.js → chunk-JW5LYFFK.js} +1 -1
- package/dist/standalone/{chunk-VNHJSWBS.js → chunk-KQZL4DGC.js} +1 -1
- package/dist/standalone/{chunk-EOE2E73Q.js → chunk-L7D3XUSL.js} +1 -1
- package/dist/standalone/{chunk-LU6UOZWK.js → chunk-LCA6DK6F.js} +1 -1
- package/dist/standalone/{chunk-CDB3QQA6.js → chunk-LS37O7PT.js} +1 -1
- package/dist/standalone/{chunk-7Q6GOHAD.js → chunk-NP3PMKD7.js} +1 -1
- package/dist/standalone/{chunk-JN2DUGT5.js → chunk-NRJY6XLS.js} +1 -1
- package/dist/standalone/{chunk-HXR3HVAR.js → chunk-OBIZNIQG.js} +1 -1
- package/dist/standalone/{chunk-Y2DTPEO4.js → chunk-OCCAELSS.js} +1 -1
- package/dist/standalone/{chunk-Y2O72Z46.js → chunk-OIX2HXFZ.js} +1 -1
- package/dist/standalone/{chunk-4WD4XGC3.js → chunk-OMN44W6V.js} +1 -1
- package/dist/standalone/{chunk-7PER26LF.js → chunk-OP5AKUEV.js} +1 -1
- package/dist/standalone/{chunk-WY5WGFM3.js → chunk-P32XL2PD.js} +1 -1
- package/dist/standalone/{chunk-CVBWPFHY.js → chunk-PUOC4Q55.js} +1 -1
- package/dist/standalone/{chunk-HY7DUJVI.js → chunk-PWNGXOCF.js} +1 -1
- package/dist/standalone/{chunk-KHCM76LG.js → chunk-SWRJFAMY.js} +1 -1
- package/dist/standalone/{chunk-RI6LCPJQ.js → chunk-TYDCG5RQ.js} +1 -1
- package/dist/standalone/{chunk-IZ3OOKZL.js → chunk-UBZRQ3Z6.js} +1 -1
- package/dist/standalone/{chunk-CZKN2SRN.js → chunk-UYLNH4SJ.js} +1 -1
- package/dist/standalone/{chunk-3S4PZ7KQ.js → chunk-VA2K2MGN.js} +1 -1
- package/dist/standalone/{chunk-Z22BDS6N.js → chunk-VASJTDMU.js} +1 -1
- package/dist/standalone/{chunk-SYPUVLW6.js → chunk-VKQCSJMV.js} +1 -1
- package/dist/standalone/{chunk-FSXPV7YQ.js → chunk-W5CE7LGU.js} +1 -1
- package/dist/standalone/{chunk-PLPA2F6L.js → chunk-WCTMLOQC.js} +1 -1
- package/dist/standalone/{chunk-WHJDJ4OD.js → chunk-WQSX6BFJ.js} +1 -1
- package/dist/standalone/chunk-WS7WNXF3.js +15 -0
- package/dist/standalone/{chunk-PIMTWCRD.js → chunk-X2YHVCMH.js} +1 -1
- package/dist/standalone/{chunk-NDTQTKDX.js → chunk-X472RKFD.js} +1 -1
- package/dist/standalone/{chunk-NTZX6RJQ.js → chunk-X7UBUDG2.js} +1 -1
- package/dist/standalone/{chunk-SMCCFWX3.js → chunk-XBPVXRYQ.js} +1 -1
- package/dist/standalone/{chunk-A5U37V2S.js → chunk-XDSDUCPP.js} +1 -1
- package/dist/standalone/{chunk-5LBBEWDQ.js → chunk-XUBHW2IG.js} +1 -1
- package/dist/standalone/{chunk-5BLNLZXF.js → chunk-YUNCGMB2.js} +1 -1
- package/dist/standalone/{chunk-CQ23LQGY.js → chunk-ZCC25Q2H.js} +1 -1
- package/dist/standalone/{chunk-6QTAHSDD.js → chunk-ZQ4C2DMJ.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +6 -6
- package/dist/standalone/chunk-BWKZ6FFW.js +0 -9
- package/dist/standalone/chunk-DYR23C3V.js +0 -15
- package/dist/standalone/chunk-VRG5BACA.js +0 -1
- package/dist/standalone/chunk-ZCQJFVF2.js +0 -1
|
@@ -1 +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-
|
|
1
|
+
import{c as I}from"react/compiler-runtime";import{useLunora as $}from"@lunora/react";import{useState as T,useEffect as H}from"react";import{ConfirmButton as M}from"./ConfirmButton-DU4p72Er.mjs";import{C as P,a as Q}from"./card-By2O8ULa.mjs";import{E as R}from"./empty-state-D7jEML_T.mjs";import{T as q,a as D,b as J,c as l,d as K,e as i}from"./table-D0SBiDu-.mjs";import{b as V}from"./use-admin-query-B2jU5P5u.mjs";import{useAutoRefresh as W}from"./DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs";import{useT as z}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as G,h as O,b as U}from"./internal-S7SDbbPa.mjs";import{jsx as t,jsxs as p}from"react/jsx-runtime";const X=s=>Number.isFinite(s)?O(s,"—"):"—",F=s=>s.toSorted((e,u)=>e.scheduledFor-u.scheduledFor),Y=(s,e,u)=>e!==void 0?e:u===void 0?f=>s.cancelScheduledJob(f):void 0,he=s=>{const e=I(16),{cancelJob:u,loadJobs:f}=s===void 0?{}:s,n=$(),o=z(),c=f===void 0;let b;e[0]===Symbol.for("react.memo_cache_sentinel")?(b=["lunora-scheduled-jobs"],e[0]=b):b=e[0];const d=V(b,async()=>{const r=await(f??(()=>n.listScheduledJobs()))();return F(r)}),[L,j]=T(void 0),[k,w]=T(void 0);let v,x;e[1]!==n||e[2]!==c?(v=()=>{if(c)return n.subscribeScheduledJobs(r=>{w(void 0),j(F(r))})},x=[c,n],e[1]=n,e[2]=c,e[3]=v,e[4]=x):(v=e[3],x=e[4]),H(v,x);let y;e[5]!==d?(y=()=>{d.refetch()},e[5]=d,e[6]=y):y=e[6],W(y,!c);const C=Y(n,u,f),a=L??d.data,N=k??d.error,A=async r=>{if(C!==void 0){w(void 0);try{await C(r),c||d.refetch()}catch(_){w(U(_))}}},E="flex flex-col gap-3",B="lunora-scheduled-jobs";let m;e[7]!==N?(m=N!==null&&t("p",{className:"text-sm text-destructive","data-testid":"sj-error",role:"alert",children:N}),e[7]=N,e[8]=m):m=e[8];let h;e[9]!==a?.length||e[10]!==o?(h=a?.length===0&&t(R,{description:o("Jobs queued with runAfter / runAt will appear here."),icon:p("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("circle",{cx:"12",cy:"12",r:"9"}),t("path",{d:"M12 7.5V12l4 2"})]}),testId:"sj-empty",title:o("No scheduled jobs.")}),e[9]=a?.length,e[10]=o,e[11]=h):h=e[11];const S=a!==void 0&&a.length>0&&t(P,{className:"overflow-hidden py-0",children:t(Q,{className:"px-0",children:p(q,{"data-testid":"sj-table",children:[t(D,{children:p(J,{children:[t(l,{children:o("function")}),t(l,{children:o("scheduled for")}),t(l,{children:o("pool")}),t(l,{children:o("attempts")}),t(l,{children:o("shard")}),t(l,{children:o("id")}),C!==void 0&&t(l,{"aria-label":o("Actions")})]})}),t(K,{children:a.map(r=>p(J,{"data-testid":`sj-row-${r.id}`,children:[t(i,{className:"font-mono text-xs",children:r.workflow??r.functionPath}),t(i,{className:"text-muted-foreground tabular-nums",children:X(r.scheduledFor)}),t(i,{className:"font-mono text-xs",children:r.pool??""}),t(i,{className:"tabular-nums",children:r.attempts??0}),t(i,{children:r.shardKey??""}),t(i,{className:"font-mono text-xs",children:r.id}),C!==void 0&&t(i,{className:"text-right",children:t(M,{confirmLabel:o("Cancel job?"),onConfirm:()=>{G(A(r.id))},testId:`sj-cancel-${r.id}`,children:o("Cancel")})})]},r.id))})]})})});let g;return e[12]!==S||e[13]!==m||e[14]!==h?(g=p("div",{className:E,"data-testid":B,children:[m,h,S]}),e[12]=S,e[13]=m,e[14]=h,e[15]=g):g=e[15],g};export{he as ScheduledJobs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{S as b}from"./studio-
|
|
1
|
+
import{S as b}from"./studio-BTM7dITm.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-CKbpgpz9.mjs";import"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import"./StudioI18nProvider-fVsCSs5L.mjs";import"./data-view-params-DhYmAkcj.mjs";import"./internal-S7SDbbPa.mjs";import"./utils-bhneXptQ.mjs";import"./CommandPalette-CcTVGQvw.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-BTM7dITm.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-S7SDbbPa.mjs";import{w as R}from"./recording-client-BbX9ql7w.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-Dr4RMEID.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};
|
|
@@ -120,6 +120,8 @@ interface FunctionArgumentDescriptor {
|
|
|
120
120
|
name: string;
|
|
121
121
|
/** True when the arg is wrapped in `v.optional(...)`. */
|
|
122
122
|
optional: boolean;
|
|
123
|
+
/** True when the arg is marked `v.sensitive`: its value is never kept in run history. */
|
|
124
|
+
sensitive?: true;
|
|
123
125
|
/** Target table for an `id` arg (`v.id("table")`). */
|
|
124
126
|
table?: string;
|
|
125
127
|
}
|
|
@@ -120,6 +120,8 @@ interface FunctionArgumentDescriptor {
|
|
|
120
120
|
name: string;
|
|
121
121
|
/** True when the arg is wrapped in `v.optional(...)`. */
|
|
122
122
|
optional: boolean;
|
|
123
|
+
/** True when the arg is marked `v.sensitive`: its value is never kept in run history. */
|
|
124
|
+
sensitive?: true;
|
|
123
125
|
/** Target table for an `id` arg (`v.id("table")`). */
|
|
124
126
|
table?: string;
|
|
125
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{k as y}from"./internal-
|
|
1
|
+
import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{k as y}from"./internal-S7SDbbPa.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-D5CVNJkp.mjs → diagram-export-panel-DrYRni_b.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-S7SDbbPa.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-S7SDbbPa.mjs";import{o as T}from"./recording-client-BbX9ql7w.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,4 +1,4 @@
|
|
|
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{k as B,g as Z,j as W,f as ee}from"./internal-
|
|
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{k as B,g as Z,j as W,f as ee}from"./internal-S7SDbbPa.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(`
|
|
@@ -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-B2jU5P5u.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,m as ot}from"./internal-S7SDbbPa.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const f=(t,n,r,i,o)=>{switch(n){case"action":return t.action(r,i,o);case"mutation":return t.mutation(r,i,o);default:return t.query(r,i,o)}},u=t=>({__lunoraRef:t}),d=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},
|
|
2
|
-
`):void 0},h=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},e=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i+=1;return`${r.toFixed(1)} ${n[i]??"TB"}`},s=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${e(n.byteLength)}>`:n,p=t=>typeof t=="bigint"?t.toString():t,b=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${e(t.byteLength)}>`:JSON.stringify(t,s)}},c=(t,n)=>{t.catch(r=>{n?.(r)})},a=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},m=t=>{let n=a(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},B=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},w=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{h as a,
|
|
1
|
+
const f=(t,n,r,i,o)=>{switch(n){case"action":return t.action(r,i,o);case"mutation":return t.mutation(r,i,{...o,onlineOnly:!0});default:return t.query(r,i,o)}},u=t=>({__lunoraRef:t}),d=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},l=t=>t instanceof Error?t.message:String(t),g=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},y=t=>{if(t===null||typeof t!="object"||!("hint"in t))return;const{hint:n}=t;return typeof n=="string"?n:Array.isArray(n)?n.filter(r=>typeof r=="string").join(`
|
|
2
|
+
`):void 0},h=t=>{if(t===null||typeof t!="object"||!("docsUrl"in t))return;const n=t.docsUrl;if(typeof n=="string")try{const{protocol:r}=new URL(n);return r==="http:"||r==="https:"?n:void 0}catch{return}},e=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,i=0;for(;r>=1024&&i<n.length-1;)r/=1024,i+=1;return`${r.toFixed(1)} ${n[i]??"TB"}`},s=(t,n)=>typeof n=="bigint"?n.toString():n instanceof ArrayBuffer||ArrayBuffer.isView(n)?`<bytes: ${e(n.byteLength)}>`:n,p=t=>typeof t=="bigint"?t.toString():t,b=t=>{if(t==null)return"";switch(typeof t){case"bigint":case"boolean":case"number":return t.toString();case"string":return t;case"symbol":return t.toString();default:return t instanceof ArrayBuffer||ArrayBuffer.isView(t)?`<bytes: ${e(t.byteLength)}>`:JSON.stringify(t,s)}},c=(t,n)=>{t.catch(r=>{n?.(r)})},a=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},m=t=>{let n=a(t);for(;n.endsWith("/");)n=n.slice(0,-1);return n},B=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},w=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{h as a,l as b,u as c,d,y as e,c as f,B as g,w as h,g as i,s as j,b as k,f as l,e as m,p as n,a as r,m as w};
|
|
@@ -1 +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-S7SDbbPa.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-B2jU5P5u.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,4 +1,4 @@
|
|
|
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,l as me,c as pe,d as he,j as ge}from"./internal-
|
|
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,l as me,c as pe,d as he,j as ge}from"./internal-S7SDbbPa.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"},je=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Ae=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(Ae(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
|
|
|
@@ -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-D5CVNJkp.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-Df43vQI0.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-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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as T}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{k as E}from"./internal-
|
|
1
|
+
import{c as T}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{k as E}from"./internal-S7SDbbPa.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 k}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-XIuWrWDy.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=T(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"?k(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"})]}):k(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=T(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"?k(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=T(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=k(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};
|