@lunora/studio 1.0.0-alpha.144 → 1.0.0-alpha.145
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/analytics-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/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-l4DQX1Vq.mjs → ApiDocsPanel-CHCIjzZu.mjs} +1 -1
- package/dist/packem_shared/{ApiReferencePanel--YThTzHb.mjs → ApiReferencePanel-Cqy9Z7mO.mjs} +1 -1
- package/dist/packem_shared/{CommandPalette-C4UrhLxv.mjs → CommandPalette-DtLEYVhX.mjs} +1 -1
- package/dist/packem_shared/DataBrowser-Bf32rBcr.mjs +4 -0
- package/dist/packem_shared/{GlobalDataBrowser-DK4fgb7h.mjs → GlobalDataBrowser-CDpzXZxj.mjs} +1 -1
- package/dist/packem_shared/{HomePanel-B869m6wb.mjs → HomePanel-4gpRjcch.mjs} +1 -1
- package/dist/packem_shared/{MigrationsPanel-BZJ_Rv4t.mjs → MigrationsPanel-Cz0x3Pv6.mjs} +1 -1
- package/dist/packem_shared/{OpenRpcReferencePanel-Bn5UVD7s.mjs → OpenRpcReferencePanel-DZicbIOf.mjs} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Db0HZ8R9.mjs → ScheduledJobs-BWziDVZO.mjs} +1 -1
- package/dist/packem_shared/{Studio-UxOpDgEl.mjs → Studio-C_yEjXcG.mjs} +1 -1
- package/dist/packem_shared/StudioApp-BQAxVB3v.mjs +1 -0
- package/dist/packem_shared/{advisor-view-DoSv436g.mjs → advisor-view-DyXQCN4y.mjs} +1 -1
- package/dist/packem_shared/{app.d-DFjg4Uki.d.mts → app.d-BbmO2HA2.d.mts} +25 -8
- package/dist/packem_shared/{app.d-DFjg4Uki.d.ts → app.d-BbmO2HA2.d.ts} +25 -8
- package/dist/packem_shared/{data-grid-BqNXJ9PF.mjs → data-grid-B8WGnT-5.mjs} +1 -1
- package/dist/packem_shared/{error-alert-CWs6gA3I.mjs → error-alert-ClpDVYvo.mjs} +1 -1
- package/dist/packem_shared/{grid-features-D8w5isjt.mjs → grid-features-CGs2pKcr.mjs} +1 -1
- package/dist/packem_shared/{home-panel-ChKczU0I.mjs → home-panel-CHtt8k50.mjs} +1 -1
- package/dist/packem_shared/{internal-CwaF9YNk.mjs → internal-D4gBuklE.mjs} +1 -1
- package/dist/packem_shared/{log-line-Dzg4YZ-K.mjs → log-line-DpRfHaVQ.mjs} +1 -1
- package/dist/packem_shared/{recording-client-BGyq5_JP.mjs → recording-client-CMvFFEC0.mjs} +1 -1
- package/dist/packem_shared/{reference-view-CZxBZSRo.mjs → reference-view-DS7FFPpP.mjs} +1 -1
- package/dist/packem_shared/{schema-diagram-DU83ObYH.mjs → schema-diagram-C27ETi10.mjs} +1 -1
- package/dist/packem_shared/{sql-result-table-DysT8h5P.mjs → sql-result-table-BLIMecXM.mjs} +1 -1
- package/dist/packem_shared/{studio-DE8N0tIQ.mjs → studio-DF0GqQBP.mjs} +1 -1
- package/dist/packem_shared/{table-list-sidebar-T7--Fv-V.mjs → table-list-sidebar-DKpSAP6p.mjs} +1 -1
- package/dist/packem_shared/use-admin-query-BvZH4unR.mjs +1 -0
- package/dist/packem_shared/{use-async-submit-DAKymxcP.mjs → use-async-submit-C1A11ka9.mjs} +1 -1
- package/dist/packem_shared/{use-auth-config-o-FcIXzR.mjs → use-auth-config-DocoJ5uQ.mjs} +1 -1
- package/dist/packem_shared/{use-open-trace-B5LJ96_0.mjs → use-open-trace-CTQIPjo9.mjs} +1 -1
- package/dist/packem_shared/{use-sql-assistant-Ib7Ik6cw.mjs → use-sql-assistant-BGoWYcGL.mjs} +1 -1
- package/dist/packem_shared/{wire-codec-DGcjNTbZ.mjs → wire-codec-BE-vgg1L.mjs} +1 -1
- package/dist/standalone/{chunk-N6Q4ORVH.js → chunk-2IRZXHAZ.js} +1 -1
- package/dist/standalone/{chunk-WQWZR452.js → chunk-2IUHQB2Q.js} +1 -1
- package/dist/standalone/{chunk-MFXZDB7X.js → chunk-2KAH7DVZ.js} +1 -1
- package/dist/standalone/{chunk-JWORA33E.js → chunk-3BFUVYWS.js} +1 -1
- package/dist/standalone/{chunk-3ILVYCWG.js → chunk-3DL3MLWV.js} +1 -1
- package/dist/standalone/{chunk-X6GR3SDI.js → chunk-3HEXTCWR.js} +1 -1
- package/dist/standalone/{chunk-NBC6NJFJ.js → chunk-3JV5F5SY.js} +1 -1
- package/dist/standalone/{chunk-S6K7T563.js → chunk-447V2Q3F.js} +1 -1
- package/dist/standalone/{chunk-E3AFG6TS.js → chunk-46XX646F.js} +1 -1
- package/dist/standalone/{chunk-7QRRR3K6.js → chunk-5JEYBOS6.js} +1 -1
- package/dist/standalone/{chunk-DNNLYDKX.js → chunk-5L3SHBMK.js} +1 -1
- package/dist/standalone/{chunk-2WVC52MX.js → chunk-6NO6WOSN.js} +1 -1
- package/dist/standalone/{chunk-DEJLINCJ.js → chunk-6T3STPM7.js} +1 -1
- package/dist/standalone/chunk-7AU5QSY7.js +1 -0
- package/dist/standalone/{chunk-YBWZUB6A.js → chunk-7B3OQXWL.js} +1 -1
- package/dist/standalone/{chunk-ZQ2PIQE4.js → chunk-7MJY23GU.js} +1 -1
- package/dist/standalone/{chunk-MMSQ35RC.js → chunk-AJQKSUVQ.js} +1 -1
- package/dist/standalone/{chunk-4RPBRBOA.js → chunk-B5WPIRI3.js} +1 -1
- package/dist/standalone/{chunk-BAKGFOG4.js → chunk-BN5TOI5O.js} +1 -1
- package/dist/standalone/chunk-BQ4P3PLU.js +1 -0
- package/dist/standalone/{chunk-HD7R6NQT.js → chunk-CIQRB2ET.js} +1 -1
- package/dist/standalone/{chunk-KASQ7MFV.js → chunk-CKKZCUAV.js} +1 -1
- package/dist/standalone/{chunk-P3MCKI2S.js → chunk-CZU3LZ2O.js} +1 -1
- package/dist/standalone/{chunk-FSOA4SEY.js → chunk-DDI4VSJH.js} +1 -1
- package/dist/standalone/{chunk-SNHEWTJY.js → chunk-DMPVOWA7.js} +1 -1
- package/dist/standalone/{chunk-BOEMUL7H.js → chunk-E6LDY3TC.js} +1 -1
- package/dist/standalone/{chunk-IFLTA2OD.js → chunk-E723DEAW.js} +1 -1
- package/dist/standalone/{chunk-URVSYGSQ.js → chunk-EDYGNYP2.js} +1 -1
- package/dist/standalone/{chunk-WISI2EBQ.js → chunk-EX33M5EE.js} +1 -1
- package/dist/standalone/{chunk-24XD27OU.js → chunk-FZKQX74O.js} +1 -1
- package/dist/standalone/{chunk-YW3RHFAI.js → chunk-GMEE5NFG.js} +1 -1
- package/dist/standalone/{chunk-BGAQFHQC.js → chunk-H3UCYGKY.js} +1 -1
- package/dist/standalone/{chunk-VGGVQFKU.js → chunk-H5PZ7JXM.js} +1 -1
- package/dist/standalone/{chunk-6HKQM3CN.js → chunk-HDWOQTDN.js} +1 -1
- package/dist/standalone/{chunk-FOILW5QP.js → chunk-HLE46T7J.js} +1 -1
- package/dist/standalone/{chunk-VNK6MRM6.js → chunk-HQPQTWW4.js} +1 -1
- package/dist/standalone/{chunk-NK7VUSL2.js → chunk-IAWCSJRR.js} +1 -1
- package/dist/standalone/chunk-IB3MWLG4.js +1 -0
- package/dist/standalone/{chunk-Y3YXQ6EU.js → chunk-IDB7SMQU.js} +1 -1
- package/dist/standalone/{chunk-IYS3RM7B.js → chunk-IYYZMNOB.js} +1 -1
- package/dist/standalone/{chunk-DZVEJZ3C.js → chunk-JMNCMGSE.js} +1 -1
- package/dist/standalone/chunk-JOQUDV7F.js +1 -0
- package/dist/standalone/{chunk-V4EMZ3HJ.js → chunk-JRN7SEJN.js} +1 -1
- package/dist/standalone/{chunk-XDLUQ6RQ.js → chunk-JSXJND3V.js} +1 -1
- package/dist/standalone/{chunk-SOUQNAE7.js → chunk-KLQEN4KA.js} +1 -1
- package/dist/standalone/{chunk-S73X6JFA.js → chunk-L2OWXMYF.js} +1 -1
- package/dist/standalone/{chunk-2BN33A2H.js → chunk-L3JA4OKZ.js} +1 -1
- package/dist/standalone/{chunk-6DHQ3IIO.js → chunk-MDVH5C5A.js} +1 -1
- package/dist/standalone/{chunk-ADDPGZY7.js → chunk-MHLBCDVW.js} +1 -1
- package/dist/standalone/{chunk-V7665E6Y.js → chunk-MJG6GTPL.js} +1 -1
- package/dist/standalone/{chunk-Y4Q25F6X.js → chunk-NXKPFGOP.js} +1 -1
- package/dist/standalone/{chunk-LSRUM2JJ.js → chunk-OUD7BAWE.js} +1 -1
- package/dist/standalone/{chunk-DMAQKIMP.js → chunk-PEEGF7YA.js} +2 -2
- package/dist/standalone/{chunk-TFNVT4ZJ.js → chunk-PWHV7BUN.js} +1 -1
- package/dist/standalone/{chunk-H2GRI4BS.js → chunk-QPVND4TE.js} +1 -1
- package/dist/standalone/{chunk-2V436GDL.js → chunk-RFTFYKFL.js} +1 -1
- package/dist/standalone/{chunk-UODFNQOY.js → chunk-RIO2HPN7.js} +4 -4
- package/dist/standalone/{chunk-Q2Q4UUXS.js → chunk-RNZ7XXND.js} +1 -1
- package/dist/standalone/{chunk-SSNHCN4D.js → chunk-SMVAE2AQ.js} +1 -1
- package/dist/standalone/{chunk-I5OKDKON.js → chunk-TWXJF4C2.js} +1 -1
- package/dist/standalone/{chunk-OJN5A2JI.js → chunk-UKQTCLDK.js} +4 -4
- package/dist/standalone/{chunk-7MXYEEMC.js → chunk-UZ5QI3PB.js} +1 -1
- package/dist/standalone/{chunk-MZXZ2XVQ.js → chunk-V5M356X3.js} +1 -1
- package/dist/standalone/{chunk-2OLPNCFW.js → chunk-VHMOFAJT.js} +1 -1
- package/dist/standalone/{chunk-MFMUFECI.js → chunk-VSHZE77Y.js} +1 -1
- package/dist/standalone/{chunk-6VDI4D53.js → chunk-VXWAQW3F.js} +1 -1
- package/dist/standalone/chunk-W3Q32C24.js +11 -0
- package/dist/standalone/{chunk-KDELXUQD.js → chunk-XABVLLMA.js} +1 -1
- package/dist/standalone/{chunk-ESVQSHW2.js → chunk-XGPF7VOP.js} +1 -1
- package/dist/standalone/{chunk-XTMBNA4V.js → chunk-YL7OENDU.js} +1 -1
- package/dist/standalone/{chunk-VAMUCQ75.js → chunk-YWYJLVEP.js} +1 -1
- package/dist/standalone/{chunk-OOKV3V3X.js → chunk-ZZENQM5W.js} +1 -1
- package/dist/standalone/studio.js +2 -2
- package/package.json +6 -6
- package/dist/packem_shared/DataBrowser-C2B-HNOL.mjs +0 -4
- package/dist/packem_shared/StudioApp-BdisV3FN.mjs +0 -1
- package/dist/packem_shared/use-admin-query-C7JRlFIE.mjs +0 -1
- package/dist/standalone/chunk-5NCE6W7L.js +0 -1
- package/dist/standalone/chunk-HWBXHONF.js +0 -1
- package/dist/standalone/chunk-IP6LZ2OL.js +0 -1
- package/dist/standalone/chunk-OT4I4LMO.js +0 -1
- package/dist/standalone/chunk-PPNBTM7O.js +0 -11
|
@@ -139,8 +139,18 @@ interface StudioProps {
|
|
|
139
139
|
*/
|
|
140
140
|
readonly chrome?: StudioChrome;
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
142
|
+
* Show the data tab's write controls (insert/edit/delete rows). Off by
|
|
143
|
+
* default; see {@link TableEditor}.
|
|
144
|
+
*
|
|
145
|
+
* **This HIDES THE CONTROLS. It does not make anything read-only.** The
|
|
146
|
+
* write RPCs are gated server-side by `LUNORA_ADMIN_TOKEN` alone — one
|
|
147
|
+
* all-or-nothing check in `handleAdminRpc`, with no read/write scoping — and
|
|
148
|
+
* `renderStudioHtml({ adminToken })` already ships that bearer to the
|
|
149
|
+
* browser. So a viewer handed a studio deployed with `dataEditable: false`
|
|
150
|
+
* still holds a credential that can write; the buttons are simply absent
|
|
151
|
+
* from the page. Treat it as an affordance switch for a trusted operator,
|
|
152
|
+
* never as an authorization boundary. The same holds for
|
|
153
|
+
* {@link StudioProps.schemaEditable} and {@link StudioProps.runAsIdentity}.
|
|
144
154
|
*/
|
|
145
155
|
readonly dataEditable?: boolean;
|
|
146
156
|
/**
|
|
@@ -177,6 +187,10 @@ interface StudioProps {
|
|
|
177
187
|
* the host MUST set this only on a trusted loopback-dev gate (the same gate
|
|
178
188
|
* as `dataEditable`) — never in a production/static deploy. Off by default;
|
|
179
189
|
* see {@link FunctionRunner}.
|
|
190
|
+
*
|
|
191
|
+
* Like {@link StudioProps.dataEditable}, leaving it off only hides the tool.
|
|
192
|
+
* The RPC behind it stays reachable to anyone holding the admin token the
|
|
193
|
+
* page already carries — the gate is the token, not this flag.
|
|
180
194
|
*/
|
|
181
195
|
readonly runAsIdentity?: boolean;
|
|
182
196
|
/**
|
|
@@ -196,12 +210,15 @@ interface StudioProps {
|
|
|
196
210
|
*/
|
|
197
211
|
readonly scheduledLoad?: SchedulePanelProps["scheduledLoad"];
|
|
198
212
|
/**
|
|
199
|
-
*
|
|
200
|
-
* column / index, written back to `lunora/schema.ts` + codegen). Off by
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
213
|
+
* Show the visual schema editor overlay on the schema diagram (add table /
|
|
214
|
+
* column / index, written back to `lunora/schema.ts` + codegen). Off by
|
|
215
|
+
* default. Only the loopback-only dev hosts set this — the write path needs
|
|
216
|
+
* the project's filesystem + toolchain, so a static deploy leaves it off.
|
|
217
|
+
*
|
|
218
|
+
* Like {@link StudioProps.dataEditable}, it hides the overlay rather than
|
|
219
|
+
* making the diagram read-only: what actually stops a schema write in a
|
|
220
|
+
* static deploy is that the host has no filesystem to write to, not this
|
|
221
|
+
* flag.
|
|
205
222
|
*/
|
|
206
223
|
readonly schemaEditable?: boolean;
|
|
207
224
|
}
|
|
@@ -139,8 +139,18 @@ interface StudioProps {
|
|
|
139
139
|
*/
|
|
140
140
|
readonly chrome?: StudioChrome;
|
|
141
141
|
/**
|
|
142
|
-
*
|
|
143
|
-
*
|
|
142
|
+
* Show the data tab's write controls (insert/edit/delete rows). Off by
|
|
143
|
+
* default; see {@link TableEditor}.
|
|
144
|
+
*
|
|
145
|
+
* **This HIDES THE CONTROLS. It does not make anything read-only.** The
|
|
146
|
+
* write RPCs are gated server-side by `LUNORA_ADMIN_TOKEN` alone — one
|
|
147
|
+
* all-or-nothing check in `handleAdminRpc`, with no read/write scoping — and
|
|
148
|
+
* `renderStudioHtml({ adminToken })` already ships that bearer to the
|
|
149
|
+
* browser. So a viewer handed a studio deployed with `dataEditable: false`
|
|
150
|
+
* still holds a credential that can write; the buttons are simply absent
|
|
151
|
+
* from the page. Treat it as an affordance switch for a trusted operator,
|
|
152
|
+
* never as an authorization boundary. The same holds for
|
|
153
|
+
* {@link StudioProps.schemaEditable} and {@link StudioProps.runAsIdentity}.
|
|
144
154
|
*/
|
|
145
155
|
readonly dataEditable?: boolean;
|
|
146
156
|
/**
|
|
@@ -177,6 +187,10 @@ interface StudioProps {
|
|
|
177
187
|
* the host MUST set this only on a trusted loopback-dev gate (the same gate
|
|
178
188
|
* as `dataEditable`) — never in a production/static deploy. Off by default;
|
|
179
189
|
* see {@link FunctionRunner}.
|
|
190
|
+
*
|
|
191
|
+
* Like {@link StudioProps.dataEditable}, leaving it off only hides the tool.
|
|
192
|
+
* The RPC behind it stays reachable to anyone holding the admin token the
|
|
193
|
+
* page already carries — the gate is the token, not this flag.
|
|
180
194
|
*/
|
|
181
195
|
readonly runAsIdentity?: boolean;
|
|
182
196
|
/**
|
|
@@ -196,12 +210,15 @@ interface StudioProps {
|
|
|
196
210
|
*/
|
|
197
211
|
readonly scheduledLoad?: SchedulePanelProps["scheduledLoad"];
|
|
198
212
|
/**
|
|
199
|
-
*
|
|
200
|
-
* column / index, written back to `lunora/schema.ts` + codegen). Off by
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
213
|
+
* Show the visual schema editor overlay on the schema diagram (add table /
|
|
214
|
+
* column / index, written back to `lunora/schema.ts` + codegen). Off by
|
|
215
|
+
* default. Only the loopback-only dev hosts set this — the write path needs
|
|
216
|
+
* the project's filesystem + toolchain, so a static deploy leaves it off.
|
|
217
|
+
*
|
|
218
|
+
* Like {@link StudioProps.dataEditable}, it hides the overlay rather than
|
|
219
|
+
* making the diagram read-only: what actually stops a schema write in a
|
|
220
|
+
* static deploy is that the host has no filesystem to write to, not this
|
|
221
|
+
* flag.
|
|
205
222
|
*/
|
|
206
223
|
readonly schemaEditable?: boolean;
|
|
207
224
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as y}from"./internal-
|
|
1
|
+
import{c as x}from"react/compiler-runtime";import{useT as w}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as y}from"./internal-D4gBuklE.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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as j,a as q,b as E}from"./internal-
|
|
1
|
+
import{c as A}from"react/compiler-runtime";import{flattenHint as I}from"@lunora/errors";import{useT as O}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{e as j,a as q,b as E}from"./internal-D4gBuklE.mjs";import{o as H}from"./recording-client-CMvFFEC0.mjs";import{u as S}from"./operation-console-provider-DoloEvon.mjs";import{A as T}from"./alert-PB5W11MM.mjs";import{jsx as v,jsxs as U}from"react/jsx-runtime";const G=y=>{const e=A(38),{className:w,error:t,testId:N}=y,g=O(),o=S();let s,l,i,n,a,c,r,m;if(e[0]!==w||e[1]!==t||e[2]!==o||e[3]!==N){const k=j(t);let h;e[12]!==t?(h=q(t),e[12]=t,e[13]=h):h=e[13],l=h;let b;e[14]!==t?(b=H(t),e[14]=t,e[15]=b):b=e[15];const C=b;let x;e[16]!==o||e[17]!==C?(x=()=>{o?.openConsole({errorsOnly:!0,seq:C})},e[16]=o,e[17]=C,e[18]=x):x=e[18],i=x,s=T,n=w,a=N,c="destructive";let u;e[19]!==t?(u=E(t),e[19]=t,e[20]=u):u=e[20],e[21]!==u?(r=v("p",{className:"font-medium",children:u}),e[21]=u,e[22]=r):r=e[22],m=k===void 0?null:v("p",{className:"mt-1 whitespace-pre-wrap text-xs opacity-90",children:I(k)}),e[0]=w,e[1]=t,e[2]=o,e[3]=N,e[4]=s,e[5]=l,e[6]=i,e[7]=n,e[8]=a,e[9]=c,e[10]=r,e[11]=m}else s=e[4],l=e[5],i=e[6],n=e[7],a=e[8],c=e[9],r=e[10],m=e[11];let f;e[23]!==l?(f=l===void 0?null:v("a",{"aria-label":"View documentation for this error",className:"mt-1 inline-block text-xs underline",href:l,rel:"noreferrer",target:"_blank",children:"View error docs"}),e[23]=l,e[24]=f):f=e[24];let p;e[25]!==o||e[26]!==i||e[27]!==g?(p=o===void 0?null:v("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:i,type:"button",children:g("Show in console")}),e[25]=o,e[26]=i,e[27]=g,e[28]=p):p=e[28];let d;return e[29]!==s||e[30]!==n||e[31]!==a||e[32]!==c||e[33]!==r||e[34]!==m||e[35]!==f||e[36]!==p?(d=U(s,{className:n,testId:a,variant:c,children:[r,m,f,p]}),e[29]=s,e[30]=n,e[31]=a,e[32]=c,e[33]=r,e[34]=m,e[35]=f,e[36]=p,e[37]=d):d=e[37],d};export{G as E};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as R}from"react/compiler-runtime";import{useState as M,useEffect as K}from"react";import{ConfirmButton as Q}from"./ConfirmButton-DU4p72Er.mjs";import{D as J,a as A,b as D,c as F,d as G,e as I,f as v,g as U}from"./dropdown-menu-jLZenfWH.mjs";import{M as H}from"./modal-shell-CDztwLnv.mjs";import{useT as _}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as P,g as W,j as Y,f as z}from"./internal-
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{useState as M,useEffect as K}from"react";import{ConfirmButton as Q}from"./ConfirmButton-DU4p72Er.mjs";import{D as J,a as A,b as D,c as F,d as G,e as I,f as v,g as U}from"./dropdown-menu-jLZenfWH.mjs";import{M as H}from"./modal-shell-CDztwLnv.mjs";import{useT as _}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as P,g as W,j as Y,f as z}from"./internal-D4gBuklE.mjs";import{C as L}from"./control-button-BOZ5K-FC.mjs";import{jsx as d,jsxs as $}from"react/jsx-runtime";import{q as B}from"./quote-identifier-CGiYFBvY.mjs";const X=/["\n,]/u,Z=/^[=+\-@\t\r]/u,V=l=>{if(l==null)return"";let e;return typeof l=="string"?e=Z.test(l)?` ${l}`:l:typeof l=="number"||typeof l=="boolean"||typeof l=="bigint"?e=String(l):e=JSON.stringify(l),X.test(e)?`"${e.replaceAll('"','""')}"`:e},ee=(l,e)=>{const o=l.map(t=>V(t)).join(","),s=e.map(t=>l.map(n=>V(t[n])).join(","));return[o,...s].join(`
|
|
2
2
|
`)},te=l=>JSON.stringify(l,Y,2),q=500,le=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:JSON.stringify(l)).replaceAll("'","''")}'`,oe=(l,e,o)=>{if(e.length===0||o.length===0)return"";const s=e.map(n=>B(n)).join(", "),t=[];for(let n=0;n<o.length;n+=q){const r=o.slice(n,n+q).map(i=>` (${e.map(a=>le(i[a])).join(", ")})`).join(`,
|
|
3
3
|
`);t.push(`INSERT INTO ${B(l)} (${s}) VALUES
|
|
4
4
|
${r};`)}return t.join(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-
|
|
1
|
+
import{c as $}from"react/compiler-runtime";import{useNavigate as He}from"@tanstack/react-router";import{useState as Pe,useEffect as qe,Suspense as et,lazy as tt}from"react";import{B as Ge}from"./badge-r_5B4LHP.mjs";import{C as F,a as Je}from"./card--2hKx4L2.mjs";import{E as st}from"./empty-state-D7jEML_T.mjs";import{u as ve}from"./use-admin-query-BvZH4unR.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,r as at,g as ot,l as rt}from"./internal-D4gBuklE.mjs";import{c as Ye}from"./utils-bhneXptQ.mjs";import{deriveInsights as it}from"./DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs";import{useLunora as Ze}from"@lunora/react";import{jsx as l,jsxs as h}from"react/jsx-runtime";import{B as Ke}from"./button-q0UYSmrn.mjs";const ct=nt(ye.studioFeatures),Xe={analytics:!0,auth:!0,containers:!0,flags:!0,kv:!0,mail:!0,notifications:!0,payments:!0,queues:!0,scheduler:!0,storage:!0,vectors:!0,workflows:!0},dt=t=>{if(t===null||typeof t!="object")return Xe;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"),queues:n("queues"),scheduler:n("scheduler"),storage:n("storage"),vectors:n("vectors"),workflows:n("workflows")}},ut=()=>{const t=$(3),e=Ze(),[n,s]=Pe(Xe);let a,o;return t[0]!==e?(a=()=>{Ne((async()=>{try{s(dt(await e.query(ct,{},lt(""))))}catch{}})())},o=[e],t[0]=e,t[1]=a,t[2]=o):(a=t[1],o=t[2]),qe(a,o),n},mt=()=>{const t=$(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},ft=t=>{const e=$(24),{group:n}=t,s=I(),a=He();let o;e[0]!==n.tab||e[1]!==a?(o=()=>{Ne(a({to:`/${n.tab}`}))},e[0]=n.tab,e[1]=a,e[2]=o):o=e[2];const r=o,i=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 m;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=l(mt,{}),e[5]=m):m=e[5];let d;e[6]!==c?(d=h("div",{className:"flex items-center justify-between",children:[c,m]}),e[6]=c,e[7]=d):d=e[7];let f;e[8]!==i||e[9]!==s?(f=i===1?s("1 binding"):s("{count} bindings",{count:i}),e[8]=i,e[9]=s,e[10]=f):f=e[10];let u;e[11]!==f?(u=l("span",{className:"text-xs text-muted-foreground",children:f}),e[11]=f,e[12]=u):u=e[12];let p;e[13]!==i||e[14]!==n.bindings?(p=i>0&&l("div",{className:"flex flex-wrap gap-1.5",children:n.bindings.map(gt)}),e[13]=i,e[14]=n.bindings,e[15]=p):p=e[15];let g;e[16]!==d||e[17]!==u||e[18]!==p?(g=h(Je,{className:"flex flex-col gap-2 py-4",children:[d,u,p]}),e[16]=d,e[17]=u,e[18]=p,e[19]=g):g=e[19];let x;return e[20]!==n.testId||e[21]!==r||e[22]!==g?(x=l(F,{className:"cursor-pointer gap-0 py-0 transition-colors hover:bg-muted/40","data-testid":n.testId,onClick:r,children:g}),e[20]=n.testId,e[21]=r,e[22]=g,e[23]=x):x=e[23],x},ze=["kv","files","vectors"],pt=(t,e)=>[...t.filter(n=>n.tab!==e.tab),e].toSorted((n,s)=>ze.indexOf(n.tab)-ze.indexOf(s.tab)),ht=()=>{const t=$(19),e=Ze(),n=ut(),s=I();let a;t[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],t[0]=a):a=t[0];const[o,r]=Pe(a);let i,c;if(t[1]!==e||t[2]!==n.kv||t[3]!==n.storage||t[4]!==n.vectors||t[5]!==s?(i=()=>{const g={cancelled:!1},x=[{enabled:n.kv,label:s("KV Namespaces"),load:async()=>(await e.listKvNamespaces()).map(xt),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(bt),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};r(A=>pt(A,_))}}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]=i,t[7]=c):(i=t[6],c=t[7]),qe(i,c),o.length===0)return null;let m;t[8]!==s?(m=s("Bindings"),t[8]=s,t[9]=m):m=t[9];let d;t[10]!==m?(d=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:m}),t[10]=m,t[11]=d):d=t[11];let f;t[12]!==o?(f=o.map(yt),t[12]=o,t[13]=f):f=t[13];let u;t[14]!==f?(u=l("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:f}),t[14]=f,t[15]=u):u=t[15];let p;return t[16]!==d||t[17]!==u?(p=h("section",{className:"flex flex-col gap-3","data-testid":"home-bindings",children:[d,u]}),t[16]=d,t[17]=u,t[18]=p):p=t[18],p};function gt(t){return l(Ge,{variant:"secondary",children:t},t)}function xt(t){return t.binding}function bt(t){return t.name}function yt(t){return l(ft,{group:t},t.tab)}const vt=[{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"}],Nt=t=>JSON.stringify({mcpServers:{lunora:{args:["-y","@lunora/mcp"],command:"npx",env:{LUNORA_ADMIN_TOKEN:"<your-admin-token>",LUNORA_URL:t}}}},null,2),_t=t=>{const e=vt.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
|
`)},St=1500,kt=()=>{const t=$(35),e=I();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=at(),t[0]=n):n=t[0];const s=n,[a,o]=Pe(null);let r,i;t[1]!==a?(r=()=>{if(a===null)return;const L=globalThis.setTimeout(()=>{o(null)},St);return()=>{globalThis.clearTimeout(L)}},i=[a],t[1]=a,t[2]=r,t[3]=i):(r=t[2],i=t[3]),qe(r,i);let c;t[4]===Symbol.for("react.memo_cache_sentinel")?(c=(L,M)=>{ot(M)&&o(L)},t[4]=c):c=t[4];const m=c;let d;t[5]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{m("config",Nt(s))},t[5]=d):d=t[5];const f=d;let u;t[6]===Symbol.for("react.memo_cache_sentinel")?(u=()=>{m("prompt",_t(s))},t[6]=u):u=t[6];const p=u;let g;t[7]!==e?(g=e("Connect an AI agent"),t[7]=e,t[8]=g):g=t[8];let x;t[9]!==g?(x=l("span",{className:"text-sm font-medium text-foreground",children:g}),t[9]=g,t[10]=x):x=t[10];let b;t[11]!==e?(b=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[11]=e,t[12]=b):b=t[12];let v;t[13]!==b?(v=l("span",{className:"text-xs text-muted-foreground",children:b}),t[13]=b,t[14]=v):v=t[14];let _;t[15]!==x||t[16]!==v?(_=h("div",{className:"flex flex-col gap-1.5 p-4",children:[x,v]}),t[15]=x,t[16]=v,t[17]=_):_=t[17];let A;t[18]===Symbol.for("react.memo_cache_sentinel")?(A=l("code",{className:"font-mono text-xs text-muted-foreground","data-testid":"home-connect-agent-command",children:"npx -y @lunora/mcp"}),t[18]=A):A=t[18];let S;t[19]!==a||t[20]!==e?(S=e(a==="config"?"Copied":"Copy MCP config"),t[19]=a,t[20]=e,t[21]=S):S=t[21];let y;t[22]!==S?(y=l(Ke,{"data-testid":"home-connect-agent-copy-config",onClick:f,size:"xs",variant:"outline",children:S}),t[22]=S,t[23]=y):y=t[23];let k;t[24]!==a||t[25]!==e?(k=e(a==="prompt"?"Copied":"Copy agent prompt"),t[24]=a,t[25]=e,t[26]=k):k=t[26];let C;t[27]!==k?(C=l(Ke,{"data-testid":"home-connect-agent-copy-prompt",onClick:p,size:"xs",variant:"outline",children:k}),t[27]=k,t[28]=C):C=t[28];let w;t[29]!==y||t[30]!==C?(w=h("div",{className:"flex flex-col gap-3 border-t border-border bg-muted/50 px-4 py-3",children:[A,h("div",{className:"flex flex-wrap gap-2",children:[y,C]})]}),t[29]=y,t[30]=C,t[31]=w):w=t[31];let N;return t[32]!==_||t[33]!==w?(N=h(F,{className:"gap-0 py-0","data-testid":"home-connect-agent",children:[_,w]}),t[32]=_,t[33]=w,t[34]=N):N=t[34],N},Ct=tt(()=>import("../packem_chunks/sparkline.mjs")),wt=(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")}`},De=t=>{if(t<1e3)return`${String(Math.round(t))}ms`;const e=t>=1e4?0:1;return`${(t/1e3).toFixed(e)}s`},$t=(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`},Ve=(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)},We=(t,e=!0)=>{if(t.length<4)return null;const n=Math.floor(t.length/2),s=t.slice(0,n).reduce((r,i)=>r+i,0),a=t.slice(n).reduce((r,i)=>r+i,0);if(s===0)return null;const o=(a-s)/s*100;return{positive:e?o>=0:o<=0,text:`${o>=0?"+":""}${o.toFixed(1)}%`}},Te=t=>{const e=$(24),{delta:n,footer:s,label:a,trend:o,unit:r,value:i}=t,c=I();let m;e[0]!==a?(m=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[0]=a,e[1]=m):m=e[1];let d;e[2]!==i?(d=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[2]=i,e[3]=d):d=e[3];let f;e[4]!==r?(f=r!==void 0&&l("span",{className:"text-xs text-muted-foreground",children:r}),e[4]=r,e[5]=f):f=e[5];let u;e[6]!==d||e[7]!==f?(u=h("span",{className:"flex items-baseline gap-1.5",children:[d,f]}),e[6]=d,e[7]=f,e[8]=u):u=e[8];let p;e[9]!==o?(p=o!==void 0&&l(et,{fallback:l("div",{"aria-hidden":"true",className:"h-8 w-28"}),children:l(Ct,{data:o})}),e[9]=o,e[10]=p):p=e[10];let g;e[11]!==u||e[12]!==p?(g=h("div",{className:"flex items-center justify-between gap-3",children:[u,p]}),e[11]=u,e[12]=p,e[13]=g):g=e[13];let x;e[14]!==m||e[15]!==g?(x=h("div",{className:"flex flex-col gap-2.5 p-4",children:[m,g]}),e[14]=m,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:Ye("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(F,{className:"justify-between gap-0 py-0",children:[x,b]}),e[21]=x,e[22]=b,e[23]=v):v=e[23],v},At=()=>{const t=$(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},Be=t=>{const e=$(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 o;e[2]!==n?(o=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]=o):o=e[3];let r;return e[4]!==a||e[5]!==o?(r=h(F,{className:"justify-between gap-0 py-0",children:[a,o]}),e[4]=a,e[5]=o,e[6]=r):r=e[6],r},Qe=t=>{const e=$(18),{count:n,onView:s,testId:a,title:o}=t,r=I();let i;e[0]!==o?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o}),e[0]=o,e[1]=i):i=e[1];let c;e[2]!==n||e[3]!==r?(c=n===null?l("span",{className:"text-xs text-muted-foreground",children:r("No data yet")}):l(Ge,{variant:n>0?"destructive":"success",children:n>0?n:r("All clear")}),e[2]=n,e[3]=r,e[4]=c):c=e[4];let m;e[5]!==i||e[6]!==c?(m=h("div",{className:"flex items-start justify-between gap-2 p-4",children:[i,c]}),e[5]=i,e[6]=c,e[7]=m):m=e[7];let d;e[8]!==r?(d=r("View"),e[8]=r,e[9]=d):d=e[9];let f;e[10]===Symbol.for("react.memo_cache_sentinel")?(f=l(At,{}),e[10]=f):f=e[10];let u;e[11]!==s||e[12]!==d?(u=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:[d,f]}),e[11]=s,e[12]=d,e[13]=u):u=e[13];let p;return e[14]!==m||e[15]!==u||e[16]!==a?(p=h(F,{className:"justify-between gap-0 py-0","data-testid":a,children:[m,u]}),e[14]=m,e[15]=u,e[16]=a,e[17]=p):p=e[17],p},Lt=t=>{const e=$(7),{functions:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=[...n].toSorted(Ot).slice(0,5);let r;e[3]!==s?(r=s("Top functions"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=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:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-top-functions",children:[i,o.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")})]}),o.map(Rt)]})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Mt=t=>{const e=$(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 o;e[2]!==a?(o=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:a}),e[2]=a,e[3]=o):o=e[3];const r=n?.totalConnections??0;let i;e[4]!==r?(i=r.toLocaleString(),e[4]=r,e[5]=i):i=e[5];let c;e[6]!==i?(c=l("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:i}),e[6]=i,e[7]=c):c=e[7];let m;e[8]!==s?(m=s("sockets"),e[8]=s,e[9]=m):m=e[9];let d;e[10]!==m?(d=l("span",{className:"text-xs text-muted-foreground",children:m}),e[10]=m,e[11]=d):d=e[11];let f;e[12]!==c||e[13]!==d?(f=h("span",{className:"flex items-baseline gap-1.5",children:[c,d]}),e[12]=c,e[13]=d,e[14]=f):f=e[14];const u=n?.totalSubscriptions??0;let p;e[15]!==u?(p=u.toLocaleString(),e[15]=u,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]!==o||e[24]!==f?(b=l(F,{"data-testid":"home-live-connections",children:h(Je,{className:"flex flex-col gap-2.5 py-4",children:[o,f,x]})}),e[22]=x,e[23]=o,e[24]=f,e[25]=b):b=e[25],b},It=t=>{const e=$(7),{entries:n}=t,s=I();let a;if(e[0]!==n||e[1]!==s){const o=Date.now();let r;e[3]!==s?(r=s("Recent activity"),e[3]=s,e[4]=r):r=e[4];let i;e[5]!==r?(i=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:r})}),e[5]=r,e[6]=i):i=e[6],a=h(F,{className:"gap-0 py-0","data-testid":"home-recent-activity",children:[i,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:$t(c.ts,o)})]},c.seq))})]}),e[0]=n,e[1]=s,e[2]=a}else a=e[2];return a},Tt=t=>{const e=t.reduce((n,s)=>n+s.calls,0);return e===0?null:t.reduce((n,s)=>n+s.totalDurationMs,0)/e},Yt=t=>{const e=$(149),{initialShardKey:n}=t,s=I(),a=He(),o=n??"";let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];let i;e[1]!==o?(i={shardKey:o},e[1]=o,e[2]=i):i=e[2];const c=ve(ye.getMetrics,r,i);let m;e[3]===Symbol.for("react.memo_cache_sentinel")?(m={},e[3]=m):m=e[3];let d;e[4]!==o?(d={shardKey:o},e[4]=o,e[5]=d):d=e[5];const f=ve(ye.getFunctionStats,m,d);let u,p;e[6]===Symbol.for("react.memo_cache_sentinel")?(u={},p={shardKey:""},e[6]=u,e[7]=p):(u=e[6],p=e[7]);const g=ve(ye.getSecurityAudit,u,p);let x;e[8]===Symbol.for("react.memo_cache_sentinel")?(x={},e[8]=x):x=e[8];let b;e[9]!==o?(b={shardKey:o},e[9]=o,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 A;e[12]!==o?(A={shardKey:o},e[12]=o,e[13]=A):A=e[13];const S=ve(ye.getAuditLog,_,A),y=c.data??null;let k,C,w,N,L,M,j,T,O,B,D,P,R,E,q,U,K,z;if(e[14]!==S.data||e[15]!==g.data||e[16]!==y||e[17]!==c.data||e[18]!==a||e[19]!==f.data||e[20]!==v.data||e[21]!==s){N=Array.isArray(f.data?.functions)?f.data.functions:[],j=v.data??null;let Ce;e[40]!==S.data?(Ce=Array.isArray(S.data?.entries)?S.data.entries:[],e[40]=S.data,e[41]=Ce):Ce=e[41],C=Ce,L=c.data===void 0||f.data===void 0?null:it(y,N).length,M=Array.isArray(g.data?.findings)?g.data.findings.length:null;let we;e[42]!==a?(we=()=>{Ne(a({to:"/security"}))},e[42]=a,e[43]=we):we=e[43],z=we;let $e;e[44]!==a?($e=()=>{Ne(a({to:"/insights"}))},e[44]=a,e[45]=$e):$e=e[45],K=$e;const Ae=Ve(y?.history,"calls"),Le=Ve(y?.history,"errors"),Ue=Tt(N),Me=Math.max(0,...N.map(Et));let Ie;e[46]!==y||e[47]!==s?(Ie=y===null?void 0:wt(s,y.cache),e[46]=y,e[47]=s,e[48]=Ie):Ie=e[48],w=Ie,q="flex flex-col gap-6",U="lunora-home",D="grid gap-3 sm:grid-cols-2 xl:grid-cols-4",P="home-health";const Re=We(Ae);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]!==Ae||e[54]!==Re||e[55]!==he||e[56]!==ge?(R=l(Te,{delta:Re,label:he,trend:Ae,value:ge}),e[53]=Ae,e[54]=Re,e[55]=he,e[56]=ge,e[57]=R):R=e[57];const Fe=We(Le,!1);let xe;e[58]!==s?(xe=s("Errors"),e[58]=s,e[59]=xe):xe=e[59];const je=y?.errors??0;let be;e[60]!==je?(be=je.toLocaleString(),e[60]=je,e[61]=be):be=e[61],e[62]!==Le||e[63]!==Fe||e[64]!==xe||e[65]!==be?(E=l(Te,{delta:Fe,label:xe,trend:Le,value:be}),e[62]=Le,e[63]=Fe,e[64]=xe,e[65]=be,e[66]=E):E=e[66],k=Te,e[67]!==Me||e[68]!==s?(T=Me>0?`${s("max")} ${De(Me)}`:void 0,e[67]=Me,e[68]=s,e[69]=T):T=e[69],e[70]!==s?(O=s("Avg latency"),e[70]=s,e[71]=O):O=e[71],B=Ue===null?"—":De(Ue),e[14]=S.data,e[15]=g.data,e[16]=y,e[17]=c.data,e[18]=a,e[19]=f.data,e[20]=v.data,e[21]=s,e[22]=k,e[23]=C,e[24]=w,e[25]=N,e[26]=L,e[27]=M,e[28]=j,e[29]=T,e[30]=O,e[31]=B,e[32]=D,e[33]=P,e[34]=R,e[35]=E,e[36]=q,e[37]=U,e[38]=K,e[39]=z}else k=e[22],C=e[23],w=e[24],N=e[25],L=e[26],M=e[27],j=e[28],T=e[29],O=e[30],B=e[31],D=e[32],P=e[33],R=e[34],E=e[35],q=e[36],U=e[37],K=e[38],z=e[39];let V;e[72]!==k||e[73]!==T||e[74]!==O||e[75]!==B?(V=l(k,{footer:T,label:O,value:B}),e[72]=k,e[73]=T,e[74]=O,e[75]=B,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=rt(Oe),e[79]=Oe,e[80]=Q):Q=e[80];let H;e[81]!==w||e[82]!==W||e[83]!==Q?(H=l(Te,{footer:w,label:W,value:Q}),e[81]=w,e[82]=W,e[83]=Q,e[84]=H):H=e[84];let G;e[85]!==D||e[86]!==P||e[87]!==R||e[88]!==E||e[89]!==V||e[90]!==H?(G=h("div",{className:D,"data-testid":P,children:[R,E,V,H]}),e[85]=D,e[86]=P,e[87]=R,e[88]=E,e[89]=V,e[90]=H,e[91]=G):G=e[91];let _e;e[92]===Symbol.for("react.memo_cache_sentinel")?(_e=l(ht,{}),e[92]=_e):_e=e[92];let J;e[93]!==N?(J=l("div",{className:"lg:col-span-2",children:l(Lt,{functions:N})}),e[93]=N,e[94]=J):J=e[94];let Y;e[95]!==j?(Y=l(Mt,{subs:j}),e[95]=j,e[96]=Y):Y=e[96];let Z;e[97]!==C?(Z=l(It,{entries:C}),e[97]=C,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]!==L||e[110]!==M||e[111]!==s||e[112]!==K||e[113]!==z?(ne=M===0&&L===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(Qe,{count:M,onView:z,testId:"home-security",title:s("Security findings")}),l(Qe,{count:L,onView:K,testId:"home-performance",title:s("Performance issues")})]}),e[109]=L,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 oe;e[120]!==ae?(oe=l("h2",{className:"text-sm font-semibold tracking-tight text-foreground",children:ae}),e[120]=ae,e[121]=oe):oe=e[121];let re;e[122]!==s?(re=s("Client SDK"),e[122]=s,e[123]=re):re=e[123];let ie;e[124]!==re?(ie=l(Be,{command:"npm i @lunora/client",label:re}),e[124]=re,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(Be,{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(Be,{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(kt,{}),e[138]=Se):Se=e[138];let pe;e[139]!==oe||e[140]!==fe?(pe=h("section",{className:"flex flex-col gap-3","data-testid":"home-get-connected",children:[oe,fe,Se]}),e[139]=oe,e[140]=fe,e[141]=pe):pe=e[141];let ke;return e[142]!==q||e[143]!==U||e[144]!==G||e[145]!==ee||e[146]!==le||e[147]!==pe?(ke=h("div",{className:q,"data-testid":U,children:[G,_e,ee,le,pe]}),e[142]=q,e[143]=U,e[144]=G,e[145]=ee,e[146]=le,e[147]=pe,e[148]=ke):ke=e[148],ke};function Ot(t,e){return e.calls-t.calls}function Rt(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:De(t.calls>0?t.totalDurationMs/t.calls:0)}),l("span",{className:Ye("w-8 text-end tabular-nums",t.errors>0?"text-destructive":"text-muted-foreground"),children:t.errors})]},t.path)}function Et(t){return t.maxDurationMs}export{Yt as H,wt as c,ut as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const a=(t,n,r,o,i)=>{switch(n){case"action":return t.action(r,o,i);case"mutation":return t.mutation(r,o,i);default:return t.query(r,o,i)}},f=t=>({__lunoraRef:t}),u=t=>{const n=t.trim();return n===""?{}:{shardKey:n}},d=t=>t instanceof Error?t.message:String(t),l=t=>{if(t===null||typeof t!="object"||!("code"in t))return;const{code:n}=t;return typeof n=="string"?n:void 0},g=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},y=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}},s=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},e=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: ${s(t.byteLength)}>`:JSON.stringify(t)}},h=(t,n)=>typeof n=="bigint"||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?e(n):n,c=(t,n)=>{t.catch(r=>{})},m=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},p=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,g as e,c as f,p as g,e as h,b as i,h as j,a as k,s as l,l as m,m as r};
|
|
2
|
+
`):void 0},y=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}},s=t=>{if(t==null)return"—";if(t<1024)return`${t.toString()} B`;const n=["KB","MB","GB","TB"];let r=t/1024,o=0;for(;r>=1024&&o<n.length-1;)r/=1024,o+=1;return`${r.toFixed(1)} ${n[o]??"TB"}`},e=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: ${s(t.byteLength)}>`:JSON.stringify(t)}},h=(t,n)=>typeof n=="bigint"||n instanceof ArrayBuffer||ArrayBuffer.isView(n)?e(n):n,c=(t,n)=>{t.catch(r=>{n?.(r)})},m=t=>{if(t!==void 0&&t!=="")return t;const n=globalThis.location;return n?.origin!==void 0&&n.origin!==""?n.origin:"http://localhost:5173"},p=t=>{const n="navigator"in globalThis?globalThis.navigator.clipboard:void 0;return n===void 0?!1:(c(n.writeText(t)),!0)},b=(t,n="")=>{if(t==null||t==="")return n;const r=new Date(t);return Number.isNaN(r.getTime())?String(t):r.toLocaleString()};export{y as a,d as b,f as c,u as d,g as e,c as f,p as g,e as h,b as i,h as j,a as k,s as l,l as m,m as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.mjs";import{B as x}from"./badge-r_5B4LHP.mjs";import{i as L}from"./internal-
|
|
1
|
+
import{c as h}from"react/compiler-runtime";import{f as v}from"./log-fields-SBxKyBug.mjs";import{B as x}from"./badge-r_5B4LHP.mjs";import{i as L}from"./internal-D4gBuklE.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 i;e[9]!==u?(i=o("span",{className:"w-48 shrink-0 truncate text-muted-foreground",role:"gridcell",children:u}),e[9]=u,e[10]=i):i=e[10];let a;e[11]!==c?(a=c===""?null:o("span",{className:"ml-2 text-muted-foreground","data-testid":"lg-fields",children:c}),e[11]=c,e[12]=a):a=e[12];let n;e[13]!==t.message||e[14]!==a?(n=g("span",{className:"flex-1 truncate",role:"gridcell",children:[t.message,a]}),e[13]=t.message,e[14]=a,e[15]=n):n=e[15];let d;return e[16]!==s||e[17]!==r||e[18]!==i||e[19]!==n?(d=g(N,{children:[s,r,i,n]}),e[16]=s,e[17]=r,e[18]=i,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-BvZH4unR.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{useState as L,useEffect as ie,createContext as ae,use as le}from"react";import{b as z,g as X,f as de,k as ce,c as ue,d as fe}from"./internal-
|
|
1
|
+
import{c as P}from"react/compiler-runtime";import{useState as L,useEffect as ie,createContext as ae,use as le}from"react";import{b as z,g as X,f as de,k as ce,c as ue,d as fe}from"./internal-D4gBuklE.mjs";import{SentIcon as me,Copy01Icon as pe,Search01Icon as he}from"@hugeicons/core-free-icons";import{HugeiconsIcon as W}from"@hugeicons/react";import{I as ge}from"./input-CXhxesPC.mjs";import{useT as J}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{B as q}from"./button-q0UYSmrn.mjs";import{jsx as i,jsxs as N,Fragment as xe}from"react/jsx-runtime";import{B as be}from"./badge-r_5B4LHP.mjs";import{ShardInput as ve}from"./ShardInput-C6mjgAh4.mjs";import{L as U}from"./label-DKFzyHq6.mjs";import{T as ye}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 kt=function(t,e,r){const s=P(10);let n;s[0]===Symbol.for("react.memo_cache_sentinel")?(n={kind:"loading"},s[0]=n):n=s[0];const[o,l]=L(n);let a,m;s[1]!==r||s[2]!==e||s[3]!==t?(a=()=>{if(t!==void 0)return;let c=!1;return e().then(u=>(c||l(r(u)),u)).catch(u=>{c||l({kind:"error",message:z(u)})}),()=>{c=!0}},m=[r,e,t],s[1]=r,s[2]=e,s[3]=t,s[4]=a,s[5]=m):(a=s[4],m=s[5]),ie(a,m);let d;return s[6]!==r||s[7]!==o||s[8]!==t?(d=t===void 0?o:r(t),s[6]=r,s[7]=o,s[8]=t,s[9]=d):d=s[9],d},ke=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)},F=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=>F(e)).join(" | "):t.type==="array"?`array<${F(t.items)}>`:t.type??"any",we=t=>{const e=Q(t);return e!==void 0?t.type??ke(e[0]):F(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 m;e[2]!==n?(m=Oe(n),e[2]=n,e[3]=m):m=e[3];const d=m,c=n["x-lunora-table"],u=n.format!==void 0||a!==void 0||d!==void 0||c!==void 0;let v;e[4]!==n?(v=Te(n),e[4]=n,e[5]=v):v=e[5];const b=v,f=s?"*":"?";let p;e[6]!==f?(p=i("span",{className:"text-muted-foreground",children:f}),e[6]=f,e[7]=p):p=e[7];let y;e[8]!==r||e[9]!==p?(y=N("span",{className:"font-mono text-foreground",children:[r,p]}),e[8]=r,e[9]=p,e[10]=y):y=e[10];let k;e[11]!==n?(k=we(n),e[11]=n,e[12]=k):k=e[12];let h;e[13]!==k?(h=i("span",{className:"font-mono text-muted-foreground",children:k}),e[13]=k,e[14]=h):h=e[14];let g;e[15]!==y||e[16]!==h?(g=N("div",{className:"flex items-baseline gap-2",children:[y,h]}),e[15]=y,e[16]=h,e[17]=g):g=e[17];let x;e[18]!==n.description?(x=n.description!==void 0&&i("p",{className:"max-w-prose text-muted-foreground",children:n.description}),e[18]=n.description,e[19]=x):x=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]!==x||e[28]!==S||e[29]!==g?(O=N("div",{className:"flex flex-col gap-1 py-2",children:[g,x,S]}),e[27]=x,e[28]=S,e[29]=g,e[30]=O):O=e[30];const w=O;if(b===void 0){let $;return e[31]!==w?($=i("div",{className:"border-b border-border/50 last:border-b-0",children:w}),e[31]=w,e[32]=$):$=e[32],$}let T;e[33]!==w?(T=i("summary",{className:"cursor-pointer marker:text-muted-foreground",children:w}),e[33]=w,e[34]=T):T=e[34];let A;e[35]!==b?(A=i("div",{className:"mb-2 ml-2 border-l border-border pl-3",children:i(Z,{schema:b})}),e[35]=b,e[36]=A):A=e[36];let E;return e[37]!==T||e[38]!==A?(E=N("details",{className:"border-b border-border/50 last:border-b-0",children:[T,A]}),e[37]=T,e[38]=A,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(m=>{const[d,c]=m;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=F(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"],Ae={lunora:"Lunora",curl:"cURL",javascript:"JavaScript"},Ie=t=>`api.${t.replaceAll(/[/:]/g,".")}`,Re=t=>{const e=D(t.argsSchema)??{};return t.functionPath===void 0?e:{args:e,functionPath:t.functionPath}},je=(t,e,r)=>{const s=`${r}${e.httpPath}`,n=JSON.stringify(Re(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 v}from"react/compiler-runtime";import{Download01Icon as ne}from"@hugeicons/core-free-icons";import{HugeiconsIcon as se}from"@hugeicons/react";import{Handle as B,Position as G,getNodesBounds as re,getViewportForBounds as ae,useNodesState as le,useEdgesState as ie,ReactFlow as ce,Background as de,Panel as M,Controls as me,MiniMap as pe,useNodes as ue,useReactFlow as U,useNodesInitialized as fe}from"@xyflow/react";import{useState as k,useMemo as _,useRef as ge,useEffect as D}from"react";import{S as he,T as N}from"./storage-tier-C2mKwYRj.mjs";import{B as S}from"./badge-r_5B4LHP.mjs";import{B as j}from"./button-q0UYSmrn.mjs";import{d as be,D as xe,c as Ne,b as C}from"./dropdown-menu-jLZenfWH.mjs";import{I as ye}from"./input-CXhxesPC.mjs";import{useT as T}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as L}from"./internal-CwaF9YNk.mjs";import{c as y}from"./utils-bhneXptQ.mjs";import{jsx as i,jsxs as f}from"react/jsx-runtime";import{LunoraError as ve}from"@lunora/errors";import{toBlob as we,toSvg as Se}from"html-to-image";function Ee(o){const e=v(10);let t,a,s;e[0]!==o?({className:t,selected:s,...a}=o,e[0]=o,e[1]=t,e[2]=a,e[3]=s):(t=e[1],a=e[2],s=e[3]);const r=s===!0?"":void 0;let n;e[4]!==t?(n=y("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]=n):n=e[5];let l;return e[6]!==a||e[7]!==r||e[8]!==n?(l=i("div",{"data-slot":"base-node","data-selected":r,className:n,...a}),e[6]=a,e[7]=r,e[8]=n,e[9]=l):l=e[9],l}function Te(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}function $e(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex flex-col",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-content",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}const F=o=>{const e=o.ref===void 0?o.type:`${o.type} → ${o.ref}`;return o.optional===!0?`${e}?`:e},_e=o=>{const e=v(22),{data:t,selected:a}=o,s=T();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==s?(r=t.loadError===!0?i("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:s("Columns unavailable")}):i("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=s,e[3]=r):r=e[3];const n=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=i("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let m;e[6]!==t.tier?(m=i("span",{className:"ms-auto",children:i(he,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let c;e[8]!==d||e[9]!==m?(c=f(Te,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=c):c=e[10];let p;e[11]!==t.columns||e[12]!==t.label||e[13]!==n?(p=t.columns.length===0?n:t.columns.map(g=>f("div",{className:y("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",g.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${g.name}`,children:[i(B,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Left,type:"target"}),i("span",{className:"truncate font-mono",title:g.name,children:g.name}),g.pk===!0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),g.ref!==void 0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),i("span",{className:"ms-auto truncate text-muted-foreground",title:F(g),children:F(g)}),i(B,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Right,type:"source"})]},g.name)),e[11]=t.columns,e[12]=t.label,e[13]=n,e[14]=p):p=e[14];let u;e[15]!==p?(u=i($e,{children:p}),e[15]=p,e[16]=u):u=e[16];let b;return e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=f(Ee,{className:"w-64 overflow-hidden","data-testid":l,selected:a,children:[c,u]}),e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],b},x=1920,E=1080,K=32,R=(o,e)=>{const t=globalThis.document.createElement("a");t.href=o,t.download=e,globalThis.document.body.append(t),t.click(),t.remove()},Ce=(o,e,t="schema-diagram.json")=>{const a={edges:e,exportedAt:new Date().toISOString(),nodes:o},s=JSON.stringify(a,void 0,2),r=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));R(r,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(r)},0)},P=(o,e,t,a)=>{const s=re(o),{x:r,y:n,zoom:l}=ae(s,e,t,.1,2,a);return{transform:[r,n,l],zoom:l}},Me=async(o,e,t="schema-diagram.png")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await we(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});if(l===null)throw new ve("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(l);R(d,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},ke=async(o,e,t="schema-diagram.svg")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await Se(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});R(l,t)},W=256,q=112,I=36,w=24,De=480,Le=1.4,Re=o=>{const e=Math.max(1,Math.round(Math.sqrt(Le*o/(W+q))));return Math.max(De,o/e)},Ae=38,Oe=28,z=o=>Ae+Math.max(1,o)*Oe,He=(o,e)=>{const t=new Map;for(const n of o)t.set(n,[]);for(const n of e)n.to!==n.from&&t.has(n.from)&&t.has(n.to)&&t.get(n.from)?.push(n.to);const a=new Map,s=new Set,r=n=>{const l=a.get(n);if(l!==void 0)return l;if(s.has(n))return 0;s.add(n);let d=0;for(const m of t.get(n)??[])d=Math.max(d,r(m)+1);return s.delete(n),a.set(n,d),d};for(const n of o)r(n);return a},Be=(o,e,t)=>{const a=He(o,e),s=new Map;for(const m of o){const c=a.get(m)??0,p=s.get(c);p===void 0?s.set(c,[m]):p.push(m)}const r=o.reduce((m,c)=>m+z(t.get(c)??0)+I,0),n=Re(r),l=[];let d=0;for(const m of[...s.keys()].toSorted((c,p)=>c-p)){let c=0,p=w;for(const u of s.get(m)??[]){const b=z(t.get(u)??0);p>w&&p+b>n&&(c+=1,p=w),l.push({name:u,x:w+(d+c)*(W+q),y:p}),p+=b+I}d+=c+1}return l},Ge={databaseSchema:_e},J={backgroundColor:N.shard.color},V={backgroundColor:N.global.color},je={global:!0,shard:!0},Fe={},Ie=o=>{const e=o.find(t=>t.pk===!0)?.name;return e!==void 0?e:o.some(t=>t.name==="_id")?"_id":o.some(t=>t.name==="id")?"id":o[0]?.name??"_id"},Y=o=>o.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),ze=(o,e,t)=>{const a=o.map(l=>l.name),s=new Map(o.map(l=>[l.name,l.columns.length])),r=Be(a,Y(o),s),n=new Map(o.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const c=n.get(l);return c===void 0?[]:[{className:t[l],data:{columns:c.columns,label:l,loadError:e,tier:c.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Ue=o=>{const e=new Map(o.map(t=>[t.name,t.columns]));return Y(o).flatMap(t=>{const a=e.get(t.to)??[],s=e.get(t.from)??[],r=Ie(a);return!a.some(n=>n.name===r)||!s.some(n=>n.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ke=()=>{const o=v(15),e=T();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),o[0]=t):t=o[0];let a;o[1]===Symbol.for("react.memo_cache_sentinel")?(a=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]}),o[1]=a):a=o[1];let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),o[2]=s):s=o[2];let r;o[3]!==e?(r=e("Primary key"),o[3]=e,o[4]=r):r=o[4];let n;o[5]!==r?(n=f("span",{className:"flex items-center gap-1",children:[s,r]}),o[5]=r,o[6]=n):n=o[6];let l;o[7]===Symbol.for("react.memo_cache_sentinel")?(l=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),o[7]=l):l=o[7];let d;o[8]!==e?(d=e("Foreign key"),o[8]=e,o[9]=d):d=o[9];let m;o[10]!==d?(m=f("span",{className:"flex items-center gap-1",children:[l,d]}),o[10]=d,o[11]=m):m=o[11];let c;return o[12]!==n||o[13]!==m?(c=f("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,a,n,m]}),o[12]=n,o[13]=m,o[14]=c):c=o[14],c},Pe=12,We=o=>{const e=v(9),{containerRef:t,seedKey:a}=o,s=fe(),{fitView:r}=U();let n;e[0]!==t||e[1]!==r||e[2]!==s?(n=()=>{if(!s)return;const d=()=>{L(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const c=new ResizeObserver(()=>{d()});return c.observe(m),()=>{c.disconnect()}},e[0]=t,e[1]=r,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==a?(l=[t,r,s,a],e[4]=t,e[5]=r,e[6]=s,e[7]=a,e[8]=l):l=e[8],D(n,l),null},qe=({containerRef:o,testIdPrefix:e})=>{const t=T(),a=ue(),{getEdges:s}=U(),[r,n]=k(null),l=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("png");try{await Me(u,a,`${e}-schema-diagram.png`)}finally{n(null)}}},d=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("svg");try{await ke(u,a,`${e}-schema-diagram.svg`)}finally{n(null)}}},m=()=>{n("json");try{Ce(a,s(),`${e}-schema-diagram.json`)}finally{n(null)}},c=()=>{L(l())},p=()=>{L(d())};return i(M,{position:"top-right",children:f(be,{children:[f(xe,{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":`${e}-export-trigger`,disabled:r!==null,children:[i(se,{className:"size-3.5",icon:ne,strokeWidth:2}),t("Export")]}),f(Ne,{align:"end",children:[i(C,{"data-testid":`${e}-export-png`,disabled:r!==null,onClick:c,children:t("PNG")}),i(C,{"data-testid":`${e}-export-svg`,disabled:r!==null,onClick:p,children:t("SVG")}),i(C,{"data-testid":`${e}-export-json`,disabled:r!==null,onClick:m,children:t("JSON")})]})]})})},dt=({columnsError:o,fill:e=!1,nodeClasses:t,tables:a,testIdPrefix:s})=>{const r=T(),[n,l]=k(je),[d,m]=k(""),c=_(()=>{const h=d.trim().toLowerCase();return a.filter(H=>n[H.tier]&&H.name.toLowerCase().includes(h))},[a,n,d]),p=_(()=>ze(c,o??!1,t??Fe),[c,o,t]),u=_(()=>Ue(c),[c]),b=c.map(h=>h.name).join(","),[g,A,Q]=le(p),[Z,O,X]=ie(u),$=ge(null);D(()=>{A(p)},[p,A]),D(()=>{O(u)},[u,O]);const ee=h=>{m(h.target.value)},te=()=>{l(h=>({...h,shard:!h.shard}))},oe=()=>{l(h=>({...h,global:!h.global}))};return a.length===0?i("section",{className:"flex flex-col gap-2","data-testid":`${s}-section`,children:i("p",{className:"text-sm text-muted-foreground","data-testid":`${s}-empty`,children:r("No tables to graph.")})}):i("section",{className:y("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${s}-section`,children:i("div",{className:y("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${s}-canvas`,ref:$,children:f(ce,{edges:Z,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:g,nodesConnectable:!1,nodeTypes:Ge,onEdgesChange:X,onNodesChange:Q,children:[i(de,{}),i(M,{position:"top-left",children:f("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[i(ye,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${s}-find`,onChange:ee,placeholder:r("Find table…"),value:d}),f("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[f(j,{"aria-pressed":n.shard,className:"gap-1.5","data-testid":`${s}-tier-shard`,onClick:te,size:"xs",type:"button",variant:n.shard?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),f(j,{"aria-pressed":n.global,className:"gap-1.5","data-testid":`${s}-tier-global`,onClick:oe,size:"xs",type:"button",variant:n.global?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]})]})]})}),i(M,{position:"bottom-center",children:i(Ke,{})}),i(me,{showInteractive:!1}),c.length>Pe&&i(pe,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),i(qe,{containerRef:$,testIdPrefix:s}),i(We,{containerRef:$,seedKey:b})]})})})};export{dt as S};
|
|
2
|
+
import{c as v}from"react/compiler-runtime";import{Download01Icon as ne}from"@hugeicons/core-free-icons";import{HugeiconsIcon as se}from"@hugeicons/react";import{Handle as B,Position as G,getNodesBounds as re,getViewportForBounds as ae,useNodesState as le,useEdgesState as ie,ReactFlow as ce,Background as de,Panel as M,Controls as me,MiniMap as pe,useNodes as ue,useReactFlow as U,useNodesInitialized as fe}from"@xyflow/react";import{useState as k,useMemo as _,useRef as ge,useEffect as D}from"react";import{S as he,T as N}from"./storage-tier-C2mKwYRj.mjs";import{B as S}from"./badge-r_5B4LHP.mjs";import{B as j}from"./button-q0UYSmrn.mjs";import{d as be,D as xe,c as Ne,b as C}from"./dropdown-menu-jLZenfWH.mjs";import{I as ye}from"./input-CXhxesPC.mjs";import{useT as T}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{f as L}from"./internal-D4gBuklE.mjs";import{c as y}from"./utils-bhneXptQ.mjs";import{jsx as i,jsxs as f}from"react/jsx-runtime";import{LunoraError as ve}from"@lunora/errors";import{toBlob as we,toSvg as Se}from"html-to-image";function Ee(o){const e=v(10);let t,a,s;e[0]!==o?({className:t,selected:s,...a}=o,e[0]=o,e[1]=t,e[2]=a,e[3]=s):(t=e[1],a=e[2],s=e[3]);const r=s===!0?"":void 0;let n;e[4]!==t?(n=y("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]=n):n=e[5];let l;return e[6]!==a||e[7]!==r||e[8]!==n?(l=i("div",{"data-slot":"base-node","data-selected":r,className:n,...a}),e[6]=a,e[7]=r,e[8]=n,e[9]=l):l=e[9],l}function Te(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex items-center gap-2 rounded-t-md bg-muted/50 px-3 py-1.5",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-header",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}function $e(o){const e=v(8);let t,a;e[0]!==o?({className:t,...a}=o,e[0]=o,e[1]=t,e[2]=a):(t=e[1],a=e[2]);let s;e[3]!==t?(s=y("flex flex-col",t),e[3]=t,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=i("div",{"data-slot":"base-node-content",className:s,...a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r}const F=o=>{const e=o.ref===void 0?o.type:`${o.type} → ${o.ref}`;return o.optional===!0?`${e}?`:e},_e=o=>{const e=v(22),{data:t,selected:a}=o,s=T();let r;e[0]!==t.label||e[1]!==t.loadError||e[2]!==s?(r=t.loadError===!0?i("span",{className:"px-3 py-1.5 text-xs text-destructive","data-testid":`sd-node-${t.label}-error`,children:s("Columns unavailable")}):i("span",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:"—"}),e[0]=t.label,e[1]=t.loadError,e[2]=s,e[3]=r):r=e[3];const n=r,l=`sd-node-${t.label}`;let d;e[4]!==t.label?(d=i("span",{className:"truncate font-mono text-xs font-semibold",title:t.label,children:t.label}),e[4]=t.label,e[5]=d):d=e[5];let m;e[6]!==t.tier?(m=i("span",{className:"ms-auto",children:i(he,{tier:t.tier})}),e[6]=t.tier,e[7]=m):m=e[7];let c;e[8]!==d||e[9]!==m?(c=f(Te,{children:[d,m]}),e[8]=d,e[9]=m,e[10]=c):c=e[10];let p;e[11]!==t.columns||e[12]!==t.label||e[13]!==n?(p=t.columns.length===0?n:t.columns.map(g=>f("div",{className:y("relative flex items-center gap-2 border-t border-border px-3 py-1.5 text-xs first:border-t-0",g.pk===!0&&"bg-muted/30"),"data-testid":`sd-col-${t.label}-${g.name}`,children:[i(B,{className:"!h-2 !w-2 !-left-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Left,type:"target"}),i("span",{className:"truncate font-mono",title:g.name,children:g.name}),g.pk===!0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),g.ref!==void 0&&i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),i("span",{className:"ms-auto truncate text-muted-foreground",title:F(g),children:F(g)}),i(B,{className:"!h-2 !w-2 !-right-1 !border-border !bg-muted-foreground/70",id:g.name,isConnectable:!1,position:G.Right,type:"source"})]},g.name)),e[11]=t.columns,e[12]=t.label,e[13]=n,e[14]=p):p=e[14];let u;e[15]!==p?(u=i($e,{children:p}),e[15]=p,e[16]=u):u=e[16];let b;return e[17]!==a||e[18]!==l||e[19]!==c||e[20]!==u?(b=f(Ee,{className:"w-64 overflow-hidden","data-testid":l,selected:a,children:[c,u]}),e[17]=a,e[18]=l,e[19]=c,e[20]=u,e[21]=b):b=e[21],b},x=1920,E=1080,K=32,R=(o,e)=>{const t=globalThis.document.createElement("a");t.href=o,t.download=e,globalThis.document.body.append(t),t.click(),t.remove()},Ce=(o,e,t="schema-diagram.json")=>{const a={edges:e,exportedAt:new Date().toISOString(),nodes:o},s=JSON.stringify(a,void 0,2),r=globalThis.URL.createObjectURL(new globalThis.Blob([s],{type:"application/json"}));R(r,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(r)},0)},P=(o,e,t,a)=>{const s=re(o),{x:r,y:n,zoom:l}=ae(s,e,t,.1,2,a);return{transform:[r,n,l],zoom:l}},Me=async(o,e,t="schema-diagram.png")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await we(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});if(l===null)throw new ve("INTERNAL","html-to-image produced no blob");const d=globalThis.URL.createObjectURL(l);R(d,t),globalThis.setTimeout(()=>{globalThis.URL.revokeObjectURL(d)},0)},ke=async(o,e,t="schema-diagram.svg")=>{const{transform:a}=P(e,x,E,K),[s,r,n]=a,l=await Se(o,{backgroundColor:"#ffffff",height:E,style:{transform:`translate(${s.toString()}px, ${r.toString()}px) scale(${n.toString()})`,transformOrigin:"top left",width:`${x.toString()}px`},width:x});R(l,t)},W=256,q=112,I=36,w=24,De=480,Le=1.4,Re=o=>{const e=Math.max(1,Math.round(Math.sqrt(Le*o/(W+q))));return Math.max(De,o/e)},Ae=38,Oe=28,z=o=>Ae+Math.max(1,o)*Oe,He=(o,e)=>{const t=new Map;for(const n of o)t.set(n,[]);for(const n of e)n.to!==n.from&&t.has(n.from)&&t.has(n.to)&&t.get(n.from)?.push(n.to);const a=new Map,s=new Set,r=n=>{const l=a.get(n);if(l!==void 0)return l;if(s.has(n))return 0;s.add(n);let d=0;for(const m of t.get(n)??[])d=Math.max(d,r(m)+1);return s.delete(n),a.set(n,d),d};for(const n of o)r(n);return a},Be=(o,e,t)=>{const a=He(o,e),s=new Map;for(const m of o){const c=a.get(m)??0,p=s.get(c);p===void 0?s.set(c,[m]):p.push(m)}const r=o.reduce((m,c)=>m+z(t.get(c)??0)+I,0),n=Re(r),l=[];let d=0;for(const m of[...s.keys()].toSorted((c,p)=>c-p)){let c=0,p=w;for(const u of s.get(m)??[]){const b=z(t.get(u)??0);p>w&&p+b>n&&(c+=1,p=w),l.push({name:u,x:w+(d+c)*(W+q),y:p}),p+=b+I}d+=c+1}return l},Ge={databaseSchema:_e},J={backgroundColor:N.shard.color},V={backgroundColor:N.global.color},je={global:!0,shard:!0},Fe={},Ie=o=>{const e=o.find(t=>t.pk===!0)?.name;return e!==void 0?e:o.some(t=>t.name==="_id")?"_id":o.some(t=>t.name==="id")?"id":o[0]?.name??"_id"},Y=o=>o.flatMap(e=>e.columns.filter(t=>t.ref!==void 0).map(t=>({column:t.name,from:e.name,to:t.ref}))),ze=(o,e,t)=>{const a=o.map(l=>l.name),s=new Map(o.map(l=>[l.name,l.columns.length])),r=Be(a,Y(o),s),n=new Map(o.map(l=>[l.name,l]));return r.flatMap(({name:l,x:d,y:m})=>{const c=n.get(l);return c===void 0?[]:[{className:t[l],data:{columns:c.columns,label:l,loadError:e,tier:c.tier},id:l,position:{x:d,y:m},type:"databaseSchema"}]})},Ue=o=>{const e=new Map(o.map(t=>[t.name,t.columns]));return Y(o).flatMap(t=>{const a=e.get(t.to)??[],s=e.get(t.from)??[],r=Ie(a);return!a.some(n=>n.name===r)||!s.some(n=>n.name===t.column)?[]:[{id:`${t.from}.${t.column}->${t.to}`,source:t.to,sourceHandle:r,target:t.from,targetHandle:t.column}]})},Ke=()=>{const o=v(15),e=T();let t;o[0]===Symbol.for("react.memo_cache_sentinel")?(t=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),o[0]=t):t=o[0];let a;o[1]===Symbol.for("react.memo_cache_sentinel")?(a=f("span",{className:"flex items-center gap-1",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]}),o[1]=a):a=o[1];let s;o[2]===Symbol.for("react.memo_cache_sentinel")?(s=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"secondary",children:"PK"}),o[2]=s):s=o[2];let r;o[3]!==e?(r=e("Primary key"),o[3]=e,o[4]=r):r=o[4];let n;o[5]!==r?(n=f("span",{className:"flex items-center gap-1",children:[s,r]}),o[5]=r,o[6]=n):n=o[6];let l;o[7]===Symbol.for("react.memo_cache_sentinel")?(l=i(S,{className:"px-1 py-0 text-[10px] leading-tight",variant:"outline",children:"FK"}),o[7]=l):l=o[7];let d;o[8]!==e?(d=e("Foreign key"),o[8]=e,o[9]=d):d=o[9];let m;o[10]!==d?(m=f("span",{className:"flex items-center gap-1",children:[l,d]}),o[10]=d,o[11]=m):m=o[11];let c;return o[12]!==n||o[13]!==m?(c=f("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,a,n,m]}),o[12]=n,o[13]=m,o[14]=c):c=o[14],c},Pe=12,We=o=>{const e=v(9),{containerRef:t,seedKey:a}=o,s=fe(),{fitView:r}=U();let n;e[0]!==t||e[1]!==r||e[2]!==s?(n=()=>{if(!s)return;const d=()=>{L(r({duration:0,maxZoom:1.6,padding:.14}))};d();const m=t.current;if(m===null)return;const c=new ResizeObserver(()=>{d()});return c.observe(m),()=>{c.disconnect()}},e[0]=t,e[1]=r,e[2]=s,e[3]=n):n=e[3];let l;return e[4]!==t||e[5]!==r||e[6]!==s||e[7]!==a?(l=[t,r,s,a],e[4]=t,e[5]=r,e[6]=s,e[7]=a,e[8]=l):l=e[8],D(n,l),null},qe=({containerRef:o,testIdPrefix:e})=>{const t=T(),a=ue(),{getEdges:s}=U(),[r,n]=k(null),l=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("png");try{await Me(u,a,`${e}-schema-diagram.png`)}finally{n(null)}}},d=async()=>{const u=o.current?.querySelector(".react-flow__viewport");if(u){n("svg");try{await ke(u,a,`${e}-schema-diagram.svg`)}finally{n(null)}}},m=()=>{n("json");try{Ce(a,s(),`${e}-schema-diagram.json`)}finally{n(null)}},c=()=>{L(l())},p=()=>{L(d())};return i(M,{position:"top-right",children:f(be,{children:[f(xe,{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":`${e}-export-trigger`,disabled:r!==null,children:[i(se,{className:"size-3.5",icon:ne,strokeWidth:2}),t("Export")]}),f(Ne,{align:"end",children:[i(C,{"data-testid":`${e}-export-png`,disabled:r!==null,onClick:c,children:t("PNG")}),i(C,{"data-testid":`${e}-export-svg`,disabled:r!==null,onClick:p,children:t("SVG")}),i(C,{"data-testid":`${e}-export-json`,disabled:r!==null,onClick:m,children:t("JSON")})]})]})})},dt=({columnsError:o,fill:e=!1,nodeClasses:t,tables:a,testIdPrefix:s})=>{const r=T(),[n,l]=k(je),[d,m]=k(""),c=_(()=>{const h=d.trim().toLowerCase();return a.filter(H=>n[H.tier]&&H.name.toLowerCase().includes(h))},[a,n,d]),p=_(()=>ze(c,o??!1,t??Fe),[c,o,t]),u=_(()=>Ue(c),[c]),b=c.map(h=>h.name).join(","),[g,A,Q]=le(p),[Z,O,X]=ie(u),$=ge(null);D(()=>{A(p)},[p,A]),D(()=>{O(u)},[u,O]);const ee=h=>{m(h.target.value)},te=()=>{l(h=>({...h,shard:!h.shard}))},oe=()=>{l(h=>({...h,global:!h.global}))};return a.length===0?i("section",{className:"flex flex-col gap-2","data-testid":`${s}-section`,children:i("p",{className:"text-sm text-muted-foreground","data-testid":`${s}-empty`,children:r("No tables to graph.")})}):i("section",{className:y("flex flex-col",e&&"min-h-0 flex-1"),"data-testid":`${s}-section`,children:i("div",{className:y("w-full overflow-hidden border border-border bg-muted/20",e?"min-h-0 flex-1":"h-[560px]"),"data-testid":`${s}-canvas`,ref:$,children:f(ce,{edges:Z,elementsSelectable:!0,fitView:!0,minZoom:.2,nodes:g,nodesConnectable:!1,nodeTypes:Ge,onEdgesChange:X,onNodesChange:Q,children:[i(de,{}),i(M,{position:"top-left",children:f("div",{className:"flex flex-col gap-2 rounded-xl border border-border bg-card/95 p-2 shadow-xs",children:[i(ye,{"aria-label":r("Find table…"),className:"h-7 w-44 text-xs","data-testid":`${s}-find`,onChange:ee,placeholder:r("Find table…"),value:d}),f("div",{"aria-label":r("Storage tiers"),className:"flex items-center gap-1.5",role:"group",children:[f(j,{"aria-pressed":n.shard,className:"gap-1.5","data-testid":`${s}-tier-shard`,onClick:te,size:"xs",type:"button",variant:n.shard?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:J}),N.shard.label]}),f(j,{"aria-pressed":n.global,className:"gap-1.5","data-testid":`${s}-tier-global`,onClick:oe,size:"xs",type:"button",variant:n.global?"default":"outline",children:[i("span",{"aria-hidden":"true",className:"size-1.5 rounded-full",style:V}),N.global.label]})]})]})}),i(M,{position:"bottom-center",children:i(Ke,{})}),i(me,{showInteractive:!1}),c.length>Pe&&i(pe,{className:"!border !border-border !bg-card",maskColor:"var(--color-muted)",nodeColor:"var(--color-muted-foreground)",nodeStrokeWidth:0,pannable:!0,zoomable:!0}),i(qe,{containerRef:$,testIdPrefix:s}),i(We,{containerRef:$,seedKey:b})]})})})};export{dt as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as k}from"react/compiler-runtime";import{AreaChart as R,CartesianGrid as g,XAxis as N,Area as B,LineChart as X,Line as $}from"recharts";import{useT as S}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as E}from"./internal-
|
|
1
|
+
import{c as k}from"react/compiler-runtime";import{AreaChart as R,CartesianGrid as g,XAxis as N,Area as B,LineChart as X,Line as $}from"recharts";import{useT as S}from"./DEFAULT_LOCALE-A1Yg5ORA.mjs";import{h as E}from"./internal-D4gBuklE.mjs";import{E as H,X as _,B as j,T as G,C as O,a as A,b as K}from"./bar-chart-BCsEIQoQ.mjs";import{jsx as l,jsxs as T}from"react/jsx-runtime";import{c as V,a as z,b as L,e as F,d as I,T as M}from"./table-D0SBiDu-.mjs";import{C as U}from"./data-grid-B8WGnT-5.mjs";const W=50,q={value:{colors:{dark:["var(--chart-1)"],light:["var(--chart-1)"]},label:"value"}},D=o=>{const e=o.columns.find(n=>o.rows.length>0&&o.rows.every(a=>typeof a[n]=="number"))??null;return{label:o.columns.find(n=>n!==e)??null,value:e}},J=o=>{const e=k(3),{data:t,kind:n}=o;let a;return e[0]!==t||e[1]!==n?(a=l(O,{className:"h-full w-full",config:q,children:n==="area"?T(R,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l(B,{dataKey:"value",fill:"var(--color-value-0)",fillOpacity:.2,stroke:"var(--color-value-0)",type:"monotone"})]}):T(X,{data:t,children:[l(g,{vertical:!1}),l(N,{axisLine:!1,dataKey:"label",tickLine:!1}),l(A,{content:l(K,{})}),l($,{dataKey:"value",dot:!1,stroke:"var(--color-value-0)",strokeWidth:2,type:"monotone"})]})}),e[0]=t,e[1]=n,e[2]=a):a=e[2],a},oe=o=>{const e=k(21),{axes:t,kind:n,result:a}=o,u=S();let r;e[0]!==a?(r=D(a),e[0]=a,e[1]=r):r=e[1];const d=r;let m;e[2]!==a.columns?(m=new Set(a.columns),e[2]=a.columns,e[3]=m):m=e[3];const s=m,i=t!==void 0&&s.has(t.x)?t.x:d.label;let h;e[4]!==t?.y||e[5]!==s?(h=t?.y.find(c=>s.has(c)),e[4]=t?.y,e[5]=s,e[6]=h):h=e[6];const b=h,C=b??d.value;let w;e[7]!==i||e[8]!==a.rows||e[9]!==C?(w=C===null?[]:a.rows.slice(0,W).map((c,v)=>({label:i===null?`#${(v+1).toString()}`:E(c[i]),value:Number(c[C])||0})),e[7]=i,e[8]=a.rows,e[9]=C,e[10]=w):w=e[10];const x=w;if(C===null){let c;e[11]!==u?(c=u("No numeric column to chart."),e[11]=u,e[12]=c):c=e[12];let v;return e[13]!==c?(v=l("p",{className:"p-4 text-sm text-muted-foreground","data-testid":"sql-chart-empty",children:c}),e[13]=c,e[14]=v):v=e[14],v}const f=n??(t!==void 0&&b!==void 0?t.kind:"bar");let p;e[15]!==x||e[16]!==f?(p=f==="bar"?T(H,{className:"h-full w-full",config:q,data:x,children:[l(_,{dataKey:"label"}),l(j,{dataKey:"value"}),l(G,{})]}):l(J,{data:x,kind:f}),e[15]=x,e[16]=f,e[17]=p):p=e[17];let y;return e[18]!==f||e[19]!==p?(y=l("div",{className:"h-80 w-full p-3","data-chart-kind":f,"data-testid":"sql-chart",children:p}),e[18]=f,e[19]=p,e[20]=y):y=e[20],y},ne=o=>{const e=k(19),{result:t}=o,n=S();if(t.columns.length===0){let s;e[0]!==t.rowCount||e[1]!==n?(s=n("{count} rows",{count:t.rowCount}),e[0]=t.rowCount,e[1]=n,e[2]=s):s=e[2];let i;return e[3]!==s?(i=l("p",{className:"p-4 text-sm text-muted-foreground",children:s}),e[3]=s,e[4]=i):i=e[4],i}let a;e[5]!==t.columns?(a=t.columns.map(P),e[5]=t.columns,e[6]=a):a=e[6];let u;e[7]!==a?(u=l(z,{className:"sticky top-0 z-10 bg-muted",children:l(L,{children:a})}),e[7]=a,e[8]=u):u=e[8];let r;if(e[9]!==t.columns||e[10]!==t.rows){let s;e[12]!==t.columns?(s=(i,h)=>l(L,{"data-testid":"sql-row",children:t.columns.map(b=>l(F,{className:"max-w-md truncate font-mono text-xs",children:l(U,{value:i[b]})},b))},h),e[12]=t.columns,e[13]=s):s=e[13],r=t.rows.map(s),e[9]=t.columns,e[10]=t.rows,e[11]=r}else r=e[11];let d;e[14]!==r?(d=l(I,{children:r}),e[14]=r,e[15]=d):d=e[15];let m;return e[16]!==u||e[17]!==d?(m=T(M,{"data-testid":"sql-rows",children:[u,d]}),e[16]=u,e[17]=d,e[18]=m):m=e[18],m};function P(o){return l(V,{children:o},o)}export{oe as S,ne as a};
|