@lunora/studio 1.0.0-alpha.136 → 1.0.0-alpha.138
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 +1515 -0
- package/dist/index.d.ts +20 -7
- package/dist/index.mjs +1 -0
- package/dist/mount.d.mts +21 -0
- package/dist/mount.mjs +1 -0
- package/dist/packem_chunks/AdvisorHealthPanel.mjs +1 -0
- package/dist/packem_chunks/ApiTab.mjs +1 -0
- package/dist/packem_chunks/AuditPanel.mjs +1 -0
- package/dist/packem_chunks/DeploymentHealthPanel.mjs +1 -0
- package/dist/packem_chunks/{ExportImportPanel.js → ExportImportPanel.mjs} +1 -1
- package/dist/packem_chunks/{FileBrowser.js → FileBrowser.mjs} +1 -1
- package/dist/packem_chunks/FunctionRunner.mjs +1 -0
- package/dist/packem_chunks/FunctionStatsPanel.mjs +1 -0
- package/dist/packem_chunks/HealthPanel.mjs +1 -0
- package/dist/packem_chunks/InsightsPanel.mjs +1 -0
- package/dist/packem_chunks/LogsPanel.mjs +1 -0
- package/dist/packem_chunks/MailPanel.mjs +2 -0
- package/dist/packem_chunks/MetricsPanel.mjs +1 -0
- package/dist/packem_chunks/NotificationsPanel.mjs +1 -0
- package/dist/packem_chunks/PitrPanel.mjs +1 -0
- package/dist/packem_chunks/SchemaViewer.mjs +1 -0
- package/dist/packem_chunks/SecurityAdvisorPanel.mjs +1 -0
- package/dist/packem_chunks/SettingsPanel.mjs +1 -0
- package/dist/packem_chunks/{SqlEditorPanel.js → SqlEditorPanel.mjs} +1 -1
- package/dist/packem_chunks/TableEditor.mjs +1 -0
- package/dist/packem_chunks/agents-panel.mjs +1 -0
- package/dist/packem_chunks/analytics-panel.mjs +1 -0
- package/dist/packem_chunks/auth-audit-panel.mjs +1 -0
- package/dist/packem_chunks/auth-config-panel.mjs +1 -0
- package/dist/packem_chunks/auth-sessions-panel.mjs +1 -0
- package/dist/packem_chunks/containers-panel.mjs +1 -0
- package/dist/packem_chunks/dashboards-panel.mjs +1 -0
- package/dist/packem_chunks/evals-panel.mjs +1 -0
- package/dist/packem_chunks/fanout-panel.mjs +1 -0
- package/dist/packem_chunks/flags-panel.mjs +1 -0
- package/dist/packem_chunks/issues-panel.mjs +1 -0
- package/dist/packem_chunks/kv-browser.mjs +1 -0
- package/dist/packem_chunks/{log-drains-panel.js → log-drains-panel.mjs} +1 -1
- package/dist/packem_chunks/migrations-route.mjs +1 -0
- package/dist/packem_chunks/organizations-panel.mjs +1 -0
- package/dist/packem_chunks/payments-panel.mjs +1 -0
- package/dist/packem_chunks/permissions-panel.mjs +1 -0
- package/dist/packem_chunks/queues-panel.mjs +1 -0
- package/dist/packem_chunks/reactors-panel.mjs +1 -0
- package/dist/packem_chunks/rls-panel.mjs +1 -0
- package/dist/packem_chunks/schedule-panel.mjs +1 -0
- package/dist/packem_chunks/sparkline.mjs +1 -0
- package/dist/packem_chunks/storage-rules-panel.mjs +1 -0
- package/dist/packem_chunks/subscriptions-panel.mjs +1 -0
- package/dist/packem_chunks/sync-client-panel.mjs +1 -0
- package/dist/packem_chunks/traces-panel.mjs +1 -0
- package/dist/packem_chunks/users-panel.mjs +1 -0
- package/dist/packem_chunks/vector-browser.mjs +1 -0
- package/dist/packem_chunks/workflows-panel.mjs +1 -0
- package/dist/packem_shared/{ApiDocsPanel-Du1L7Ysj.js → ApiDocsPanel-BOxViKDM.mjs} +1 -1
- package/dist/packem_shared/ApiReferencePanel--YThTzHb.mjs +1 -0
- package/dist/packem_shared/CommandPalette-C4UrhLxv.mjs +1 -0
- package/dist/packem_shared/ConfirmButton-DU4p72Er.mjs +1 -0
- package/dist/packem_shared/ConnectionBadge-B_8fcft2.mjs +1 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
- package/dist/packem_shared/{DataBrowser-W5TxvLB8.js → DataBrowser-CDzwqq4b.mjs} +1 -1
- package/dist/packem_shared/GlobalDataBrowser-BKm77TNC.mjs +1 -0
- package/dist/packem_shared/HomePanel-T_fBZTEM.mjs +1 -0
- package/dist/packem_shared/MigrationsPanel-CYe0ygT8.mjs +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-Bn5UVD7s.mjs +1 -0
- package/dist/packem_shared/ScheduledJobs-DN0yQoo6.mjs +1 -0
- package/dist/packem_shared/ShardInput-C6mjgAh4.mjs +1 -0
- package/dist/packem_shared/Studio-CHCAslfi.mjs +1 -0
- package/dist/packem_shared/StudioApp-DVl_E-VZ.mjs +1 -0
- package/dist/packem_shared/StudioI18nProvider-fVsCSs5L.mjs +1 -0
- package/dist/packem_shared/advisor-view-5mZH6453.mjs +1 -0
- package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
- package/dist/packem_shared/app.d-D1bPR8FO.d.mts +252 -0
- package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
- package/dist/packem_shared/{bar-chart-B6gzp_f9.js → bar-chart-BCsEIQoQ.mjs} +1 -1
- package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
- package/dist/packem_shared/card--2hKx4L2.mjs +1 -0
- package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
- package/dist/packem_shared/data-grid-BqNXJ9PF.mjs +1 -0
- package/dist/packem_shared/dropdown-menu-jLZenfWH.mjs +2 -0
- package/dist/packem_shared/empty-state-D7jEML_T.mjs +1 -0
- package/dist/packem_shared/error-alert-CczbAfst.mjs +1 -0
- package/dist/packem_shared/{grid-features-jBzZGauv.js → grid-features-D8w5isjt.mjs} +1 -1
- package/dist/packem_shared/home-panel-CSENDmoB.mjs +3 -0
- package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
- package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
- package/dist/packem_shared/live-status-BuJdUZFU.mjs +1 -0
- package/dist/packem_shared/log-line-Dzg4YZ-K.mjs +1 -0
- package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
- package/dist/packem_shared/recording-client-BEZ6tVgo.mjs +1 -0
- package/dist/packem_shared/{reference-view-BU2dNK9Z.js → reference-view-CZxBZSRo.mjs} +1 -1
- package/dist/packem_shared/schema-diagram-DU83ObYH.mjs +2 -0
- package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
- package/dist/packem_shared/select-Cx8-CokP.mjs +2 -0
- package/dist/packem_shared/shard-history-CaO3C4KQ.mjs +1 -0
- package/dist/packem_shared/shortcuts-B9gDaXmw.mjs +1 -0
- package/dist/packem_shared/skeleton-DX1gfixl.mjs +1 -0
- package/dist/packem_shared/sparkline-B_sPPO_8.mjs +1 -0
- package/dist/packem_shared/sql-result-table-DysT8h5P.mjs +1 -0
- package/dist/packem_shared/stat-card-D0Fe04cX.mjs +1 -0
- package/dist/packem_shared/studio-DRHuKwbt.mjs +2 -0
- package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
- package/dist/packem_shared/table-list-sidebar-BxZm3sBJ.mjs +1 -0
- package/dist/packem_shared/textarea--40GKAyz.mjs +1 -0
- package/dist/packem_shared/trace-handoff-BV3EWqy_.mjs +1 -0
- package/dist/packem_shared/use-admin-query-Cbj2GuHu.mjs +1 -0
- package/dist/packem_shared/use-async-submit-DAKymxcP.mjs +1 -0
- package/dist/packem_shared/use-auth-config-gxJL0E1r.mjs +1 -0
- package/dist/packem_shared/use-open-trace-B5LJ96_0.mjs +1 -0
- package/dist/packem_shared/use-sql-assistant-CFRzdA9E.mjs +1 -0
- package/dist/standalone/{chunk-7PIHTTND.js → chunk-25NFR6EB.js} +1 -1
- package/dist/standalone/{chunk-R7S3ICRW.js → chunk-2AFIMJPZ.js} +1 -1
- package/dist/standalone/{chunk-ENLQ6CZE.js → chunk-2DO5EQCU.js} +1 -1
- package/dist/standalone/{chunk-XZBLPJZN.js → chunk-2QSOSRNW.js} +1 -1
- package/dist/standalone/{chunk-F7JOSNAT.js → chunk-35DM4JJG.js} +1 -1
- package/dist/standalone/{chunk-EHQU74ST.js → chunk-3FFEVZUV.js} +1 -1
- package/dist/standalone/{chunk-OE4KGVJW.js → chunk-3ILVYCWG.js} +1 -1
- package/dist/standalone/{chunk-TRS5ABTX.js → chunk-3PKWDMXA.js} +1 -1
- package/dist/standalone/{chunk-2KR32476.js → chunk-3ZKYTFKY.js} +1 -1
- package/dist/standalone/{chunk-XLU6W4LI.js → chunk-43Y54D7O.js} +1 -1
- package/dist/standalone/{chunk-AOAJGSYZ.js → chunk-46ZJ3TM4.js} +1 -1
- package/dist/standalone/{chunk-2SFSTQS4.js → chunk-4GTO7FL5.js} +1 -1
- package/dist/standalone/{chunk-TFMQSCGC.js → chunk-4L4WTGN5.js} +1 -1
- package/dist/standalone/{chunk-HOQ2PFO6.js → chunk-56AFJWER.js} +1 -1
- package/dist/standalone/chunk-5AUOM7FK.js +1 -0
- package/dist/standalone/{chunk-XQS7KSHL.js → chunk-5GFSKIB2.js} +1 -1
- package/dist/standalone/{chunk-JV7KTJPY.js → chunk-5JDWLCSH.js} +1 -1
- package/dist/standalone/{chunk-WSNONR2E.js → chunk-5PCGB55O.js} +1 -1
- package/dist/standalone/{chunk-MCLM2QJI.js → chunk-5WJXVZMZ.js} +1 -1
- package/dist/standalone/{chunk-WUW4ZHRL.js → chunk-66UGPQVC.js} +1 -1
- package/dist/standalone/{chunk-QHQTOESO.js → chunk-7EYQVAUQ.js} +1 -1
- package/dist/standalone/{chunk-AVBOVXQK.js → chunk-7QMV55PO.js} +1 -1
- package/dist/standalone/{chunk-JURAVSE7.js → chunk-7QRRR3K6.js} +1 -1
- package/dist/standalone/{chunk-EDHW2EEG.js → chunk-7RIRJD2P.js} +1 -1
- package/dist/standalone/{chunk-ITNXWR5K.js → chunk-B5FXTB7H.js} +1 -1
- package/dist/standalone/{chunk-NNJW6LZK.js → chunk-BFXBBUU6.js} +1 -1
- package/dist/standalone/{chunk-DBMUPDVJ.js → chunk-BX3F7MXP.js} +1 -1
- package/dist/standalone/{chunk-ZSOLGJFC.js → chunk-C3TOZ4LG.js} +1 -1
- package/dist/standalone/{chunk-54TELYX4.js → chunk-C5L4BSYY.js} +1 -1
- package/dist/standalone/{chunk-U5D3ABAW.js → chunk-CKZQXAZE.js} +1 -1
- package/dist/standalone/{chunk-7SROZWKL.js → chunk-CSUROWL2.js} +1 -1
- package/dist/standalone/{chunk-DUDQV6XJ.js → chunk-D27D4UUI.js} +1 -1
- package/dist/standalone/chunk-DEJLINCJ.js +1 -0
- package/dist/standalone/{chunk-KZ5V7F4W.js → chunk-DQHYNFE4.js} +1 -1
- package/dist/standalone/{chunk-METRMDIQ.js → chunk-EA2JKR5D.js} +1 -1
- package/dist/standalone/{chunk-BWEXJENB.js → chunk-EBWXFG4H.js} +1 -1
- package/dist/standalone/{chunk-4U5PYZLE.js → chunk-ECQTVV2J.js} +1 -1
- package/dist/standalone/{chunk-JUWOEHDD.js → chunk-EG6XHY7N.js} +1 -1
- package/dist/standalone/{chunk-MOVUB3HI.js → chunk-EIKBBMM4.js} +1 -1
- package/dist/standalone/{chunk-5BEXGGHV.js → chunk-EILTQDXX.js} +1 -1
- package/dist/standalone/{chunk-XYD65F6K.js → chunk-ERWZGAOA.js} +1 -1
- package/dist/standalone/{chunk-ZPGNTTQ3.js → chunk-F7UC63UN.js} +1 -1
- package/dist/standalone/{chunk-UANVABQG.js → chunk-FKVZRPV5.js} +1 -1
- package/dist/standalone/{chunk-DKSLOJDQ.js → chunk-FO26ZU7E.js} +1 -1
- package/dist/standalone/{chunk-RCZTUWG3.js → chunk-FSRSK4LY.js} +1 -1
- package/dist/standalone/{chunk-IS2BTYON.js → chunk-GD3ZRVZH.js} +1 -1
- package/dist/standalone/{chunk-L4EZAHCD.js → chunk-HEAQVSNS.js} +1 -1
- package/dist/standalone/{chunk-GD4GUF75.js → chunk-HODZXHVK.js} +1 -1
- package/dist/standalone/chunk-HPUOZHDA.js +1 -0
- package/dist/standalone/{chunk-AFKLFS74.js → chunk-I52I2DJG.js} +1 -1
- package/dist/standalone/{chunk-OG57FC7W.js → chunk-I5OKDKON.js} +1 -1
- package/dist/standalone/{chunk-TB5N24CM.js → chunk-IFLTA2OD.js} +1 -1
- package/dist/standalone/{chunk-NXXGISFB.js → chunk-IMOHEGMV.js} +1 -1
- package/dist/standalone/{chunk-5U6757U7.js → chunk-JAZCU2PP.js} +1 -1
- package/dist/standalone/{chunk-CG5OTGTR.js → chunk-JBIN7W2B.js} +1 -1
- package/dist/standalone/{chunk-BA6TK2PS.js → chunk-JHEUUNXM.js} +1 -1
- package/dist/standalone/chunk-JJA7KHJK.js +1 -0
- package/dist/standalone/{chunk-4YTSKL4R.js → chunk-JVUZEYKQ.js} +1 -1
- package/dist/standalone/{chunk-INFALEU6.js → chunk-JYMXJUJ2.js} +1 -1
- package/dist/standalone/chunk-K7AJEMKE.js +1 -0
- package/dist/standalone/{chunk-ZZBE7O77.js → chunk-KDWJAKFX.js} +1 -1
- package/dist/standalone/{chunk-EQFBG7TB.js → chunk-KEZZGUYY.js} +1 -1
- package/dist/standalone/{chunk-6DAH3SMG.js → chunk-KTTYWH6A.js} +1 -1
- package/dist/standalone/{chunk-LVZKEWNM.js → chunk-LC3XGRNU.js} +1 -1
- package/dist/standalone/{chunk-LJFIXPDF.js → chunk-LJC5BM3X.js} +1 -1
- package/dist/standalone/{chunk-6XME7G3Q.js → chunk-LWYAZ2H7.js} +1 -1
- package/dist/standalone/{chunk-B3QSXX4O.js → chunk-M6MCQSPI.js} +1 -1
- package/dist/standalone/{chunk-AFH3KSFW.js → chunk-MIVYBFY3.js} +1 -1
- package/dist/standalone/{chunk-BQK2C2Z4.js → chunk-MNAASONZ.js} +1 -1
- package/dist/standalone/{chunk-BGOEMFLU.js → chunk-MRJNT4OH.js} +1 -1
- package/dist/standalone/{chunk-OQOBY6X3.js → chunk-N6KHKQJH.js} +1 -1
- package/dist/standalone/{chunk-V6QPVFDL.js → chunk-NBC6NJFJ.js} +1 -1
- package/dist/standalone/{chunk-SPDZUX4P.js → chunk-NCCAMFB6.js} +1 -1
- package/dist/standalone/{chunk-NGQTRDBQ.js → chunk-NE7AR3N3.js} +1 -1
- package/dist/standalone/chunk-NPERN4YF.js +1 -0
- package/dist/standalone/{chunk-YNZQSHFG.js → chunk-O2FV34ZD.js} +1 -1
- package/dist/standalone/{chunk-KVSQKUWD.js → chunk-OGUKYRFM.js} +1 -1
- package/dist/standalone/{chunk-ZHPDAJBM.js → chunk-OKG3HWSJ.js} +1 -1
- package/dist/standalone/{chunk-FUVCG23X.js → chunk-OOESPRIZ.js} +1 -1
- package/dist/standalone/{chunk-443UDYWL.js → chunk-OOKV3V3X.js} +1 -1
- package/dist/standalone/{chunk-ATES7QMQ.js → chunk-PAUQAU23.js} +1 -1
- package/dist/standalone/{chunk-Q7ZPWO67.js → chunk-PKCC4J5W.js} +1 -1
- package/dist/standalone/{chunk-DPNEFSEC.js → chunk-PYT4RZJH.js} +1 -1
- package/dist/standalone/{chunk-W7ETXRN4.js → chunk-Q3HF6P2M.js} +1 -1
- package/dist/standalone/{chunk-TPAZM36C.js → chunk-Q4CAKBWN.js} +1 -1
- package/dist/standalone/{chunk-M3NNNOD5.js → chunk-QKEJLVC5.js} +1 -1
- package/dist/standalone/{chunk-U6RNLNVU.js → chunk-QSOJFV42.js} +1 -1
- package/dist/standalone/{chunk-K6O3UDLX.js → chunk-RK3WWWTT.js} +1 -1
- package/dist/standalone/{chunk-XJSWM47N.js → chunk-RLLKECZT.js} +1 -1
- package/dist/standalone/{chunk-CAOUXOL7.js → chunk-RPQL45FL.js} +1 -1
- package/dist/standalone/{chunk-CKTKI4IY.js → chunk-S3CRZLGS.js} +1 -1
- package/dist/standalone/{chunk-L6DNHL3L.js → chunk-S63ID2FC.js} +1 -1
- package/dist/standalone/{chunk-VZCS5GXZ.js → chunk-SB35BJ7A.js} +1 -1
- package/dist/standalone/{chunk-26VREVWU.js → chunk-SSNHCN4D.js} +1 -1
- package/dist/standalone/{chunk-3KLX63D7.js → chunk-T2IE5GKA.js} +1 -1
- package/dist/standalone/{chunk-74ASA4WU.js → chunk-TGHH7ZFA.js} +1 -1
- package/dist/standalone/{chunk-FJ6G6FNE.js → chunk-TJRQUJFS.js} +1 -1
- package/dist/standalone/{chunk-EYGF6TQS.js → chunk-TQCXJX4I.js} +1 -1
- package/dist/standalone/{chunk-EYENA7HZ.js → chunk-TRL7AHZK.js} +1 -1
- package/dist/standalone/{chunk-CP4ZFBVW.js → chunk-TWTNWOJU.js} +1 -1
- package/dist/standalone/{chunk-UUO257GV.js → chunk-TZI3JW3Q.js} +1 -1
- package/dist/standalone/{chunk-M3PFFLSD.js → chunk-UBVWMMQG.js} +1 -1
- package/dist/standalone/{chunk-CYX3OHJ3.js → chunk-UDCVU3Z5.js} +1 -1
- package/dist/standalone/{chunk-BNNRPK47.js → chunk-UKL4FSKP.js} +1 -1
- package/dist/standalone/{chunk-PZ4QDWTI.js → chunk-ULIQFBZU.js} +1 -1
- package/dist/standalone/{chunk-XVJIEJ5R.js → chunk-USC5APTS.js} +1 -1
- package/dist/standalone/{chunk-QO645HJU.js → chunk-UWDFH35E.js} +1 -1
- package/dist/standalone/{chunk-YN4VXWMW.js → chunk-VPPKG2IW.js} +1 -1
- package/dist/standalone/{chunk-NIX2QSSN.js → chunk-VVOVVU53.js} +1 -1
- package/dist/standalone/{chunk-BSACLUQK.js → chunk-WLGZOFKE.js} +2 -2
- package/dist/standalone/{chunk-CN2AINNY.js → chunk-WQYWA7U6.js} +1 -1
- package/dist/standalone/{chunk-ZJK2XCP3.js → chunk-WR675JUF.js} +1 -1
- package/dist/standalone/{chunk-IYWVSMAY.js → chunk-WUWBZPUK.js} +1 -1
- package/dist/standalone/{chunk-K76OQSTQ.js → chunk-X43AA6RX.js} +1 -1
- package/dist/standalone/{chunk-EGSG64TS.js → chunk-XSLMHPP2.js} +1 -1
- package/dist/standalone/{chunk-5JLIP2HH.js → chunk-XZMOZFE6.js} +1 -1
- package/dist/standalone/{chunk-6ZPTNC34.js → chunk-Y4Q25F6X.js} +1 -1
- package/dist/standalone/{chunk-INQICZYC.js → chunk-Y6CXU7T4.js} +1 -1
- package/dist/standalone/{chunk-VR3UJA7B.js → chunk-YEBHHIAY.js} +1 -1
- package/dist/standalone/{chunk-MSXT3KG5.js → chunk-YFLOZILV.js} +1 -1
- package/dist/standalone/{chunk-MIGH67EO.js → chunk-YFPU55K4.js} +1 -1
- package/dist/standalone/{chunk-2I2F6IEF.js → chunk-ZE2Q22OK.js} +1 -1
- package/dist/standalone/studio.js +1 -1
- package/package.json +11 -9
- package/dist/index.js +0 -1
- package/dist/mount.js +0 -1
- package/dist/packem_chunks/AdvisorHealthPanel.js +0 -1
- package/dist/packem_chunks/ApiTab.js +0 -1
- package/dist/packem_chunks/AuditPanel.js +0 -1
- package/dist/packem_chunks/DeploymentHealthPanel.js +0 -1
- package/dist/packem_chunks/FunctionRunner.js +0 -1
- package/dist/packem_chunks/FunctionStatsPanel.js +0 -1
- package/dist/packem_chunks/HealthPanel.js +0 -1
- package/dist/packem_chunks/InsightsPanel.js +0 -1
- package/dist/packem_chunks/LogsPanel.js +0 -1
- package/dist/packem_chunks/MailPanel.js +0 -2
- package/dist/packem_chunks/MetricsPanel.js +0 -1
- package/dist/packem_chunks/NotificationsPanel.js +0 -1
- package/dist/packem_chunks/PitrPanel.js +0 -1
- package/dist/packem_chunks/SchemaViewer.js +0 -1
- package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -1
- package/dist/packem_chunks/SettingsPanel.js +0 -1
- package/dist/packem_chunks/TableEditor.js +0 -1
- package/dist/packem_chunks/agents-panel.js +0 -1
- package/dist/packem_chunks/analytics-panel.js +0 -1
- package/dist/packem_chunks/auth-audit-panel.js +0 -1
- package/dist/packem_chunks/auth-config-panel.js +0 -1
- package/dist/packem_chunks/auth-sessions-panel.js +0 -1
- package/dist/packem_chunks/containers-panel.js +0 -1
- package/dist/packem_chunks/dashboards-panel.js +0 -1
- package/dist/packem_chunks/evals-panel.js +0 -1
- package/dist/packem_chunks/fanout-panel.js +0 -1
- package/dist/packem_chunks/flags-panel.js +0 -1
- package/dist/packem_chunks/issues-panel.js +0 -1
- package/dist/packem_chunks/kv-browser.js +0 -1
- package/dist/packem_chunks/migrations-route.js +0 -1
- package/dist/packem_chunks/organizations-panel.js +0 -1
- package/dist/packem_chunks/payments-panel.js +0 -1
- package/dist/packem_chunks/permissions-panel.js +0 -1
- package/dist/packem_chunks/queues-panel.js +0 -1
- package/dist/packem_chunks/reactors-panel.js +0 -1
- package/dist/packem_chunks/rls-panel.js +0 -1
- package/dist/packem_chunks/schedule-panel.js +0 -1
- package/dist/packem_chunks/sparkline.js +0 -1
- package/dist/packem_chunks/storage-rules-panel.js +0 -1
- package/dist/packem_chunks/subscriptions-panel.js +0 -1
- package/dist/packem_chunks/sync-client-panel.js +0 -1
- package/dist/packem_chunks/traces-panel.js +0 -1
- package/dist/packem_chunks/users-panel.js +0 -1
- package/dist/packem_chunks/vector-browser.js +0 -1
- package/dist/packem_chunks/workflows-panel.js +0 -1
- package/dist/packem_shared/ApiReferencePanel-uGgGOBYj.js +0 -1
- package/dist/packem_shared/CommandPalette-HqiXrWIm.js +0 -1
- package/dist/packem_shared/ConfirmButton-Cj2SOapE.js +0 -1
- package/dist/packem_shared/ConnectionBadge-Bh16X9-u.js +0 -1
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js +0 -1
- package/dist/packem_shared/GlobalDataBrowser-LFznuyGe.js +0 -1
- package/dist/packem_shared/HomePanel-DmB0EKjl.js +0 -1
- package/dist/packem_shared/MigrationsPanel-BDNt136v.js +0 -1
- package/dist/packem_shared/OpenRpcReferencePanel-DgrpASYD.js +0 -1
- package/dist/packem_shared/ScheduledJobs-CiO3eXgI.js +0 -1
- package/dist/packem_shared/ShardInput-CdawpUiS.js +0 -1
- package/dist/packem_shared/Studio-CkNE_tEy.js +0 -1
- package/dist/packem_shared/StudioApp-BZP_0E2n.js +0 -1
- package/dist/packem_shared/StudioI18nProvider-Bl547evf.js +0 -1
- package/dist/packem_shared/advisor-view-C1KFTXSH.js +0 -1
- package/dist/packem_shared/alert-C2SEhYS9.js +0 -1
- package/dist/packem_shared/badge-cAk9Di1Q.js +0 -1
- package/dist/packem_shared/button-BOPLD1un.js +0 -1
- package/dist/packem_shared/card-BGlQzQY-.js +0 -1
- package/dist/packem_shared/checkbox-C5w53W-E.js +0 -1
- package/dist/packem_shared/data-grid-BFTQnkXq.js +0 -1
- package/dist/packem_shared/dropdown-menu-U7Tjg1Nb.js +0 -2
- package/dist/packem_shared/empty-state-B939z6K2.js +0 -1
- package/dist/packem_shared/error-alert-TYdKetJd.js +0 -1
- package/dist/packem_shared/home-panel-DHOa3sxt.js +0 -3
- package/dist/packem_shared/input-CY5W3wzv.js +0 -1
- package/dist/packem_shared/label-BOUo-DP0.js +0 -1
- package/dist/packem_shared/live-status-Bf7rR8o8.js +0 -1
- package/dist/packem_shared/log-line-UnE93Ovi.js +0 -1
- package/dist/packem_shared/modal-shell-wGW4CKEW.js +0 -1
- package/dist/packem_shared/recording-client-CKn4-vUx.js +0 -1
- package/dist/packem_shared/schema-diagram-DOaIh1y6.js +0 -2
- package/dist/packem_shared/scroll-area-DSJftwu_.js +0 -2
- package/dist/packem_shared/select-BPISLTcv.js +0 -2
- package/dist/packem_shared/shard-history-DU5b3QDI.js +0 -1
- package/dist/packem_shared/shortcuts-lH4Vaqjc.js +0 -1
- package/dist/packem_shared/skeleton-DFBBaJU6.js +0 -1
- package/dist/packem_shared/sparkline-CYbJzfA1.js +0 -1
- package/dist/packem_shared/sql-result-table-CqlZo2QN.js +0 -1
- package/dist/packem_shared/stat-card-B9uIvAHg.js +0 -1
- package/dist/packem_shared/studio-CXai1O2K.js +0 -2
- package/dist/packem_shared/table-BMsuYFhk.js +0 -2
- package/dist/packem_shared/table-list-sidebar-BWq_-gtu.js +0 -1
- package/dist/packem_shared/textarea-DpO3i-Qo.js +0 -1
- package/dist/packem_shared/trace-handoff-z9sy89Ci.js +0 -1
- package/dist/packem_shared/use-admin-query-P0RJrjsD.js +0 -1
- package/dist/packem_shared/use-async-submit-DdLd0MdK.js +0 -1
- package/dist/packem_shared/use-auth-config-z3KRWAqD.js +0 -1
- package/dist/packem_shared/use-open-trace-4mqqFWrn.js +0 -1
- package/dist/packem_shared/use-sql-assistant-D1K2LqpO.js +0 -1
- package/dist/standalone/chunk-35O3VETX.js +0 -1
- package/dist/standalone/chunk-57VX76PR.js +0 -1
- package/dist/standalone/chunk-76YLMHR3.js +0 -1
- package/dist/standalone/chunk-N5OS5NUG.js +0 -1
- package/dist/standalone/chunk-O5MAFDY2.js +0 -1
- package/dist/standalone/chunk-TNKECJW4.js +0 -1
- /package/dist/packem_shared/{ADMIN_FUNCTIONS-B6z7VLYt.js → ADMIN_FUNCTIONS-B6z7VLYt.mjs} +0 -0
- /package/dist/packem_shared/{DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js → DEFAULT_AUTO_REFRESH_MS-DuULO4XM.mjs} +0 -0
- /package/dist/packem_shared/{DEFAULT_LOCALE-A1Yg5ORA.js → DEFAULT_LOCALE-A1Yg5ORA.mjs} +0 -0
- /package/dist/packem_shared/{DataFilters-3nbW0uax.js → DataFilters-3nbW0uax.mjs} +0 -0
- /package/dist/packem_shared/{ErrorBoundary-BWNF98VF.js → ErrorBoundary-BWNF98VF.mjs} +0 -0
- /package/dist/packem_shared/{STUDIO_ROOT_CLASS-C6MccdVk.js → STUDIO_ROOT_CLASS-C6MccdVk.mjs} +0 -0
- /package/dist/packem_shared/{aggregateMetrics-A-Y7OH6R.js → aggregateMetrics-A-Y7OH6R.mjs} +0 -0
- /package/dist/packem_shared/{browser-storage-BH1MxLZs.js → browser-storage-BH1MxLZs.mjs} +0 -0
- /package/dist/packem_shared/{cf-links-CBJ5SywP.js → cf-links-CBJ5SywP.mjs} +0 -0
- /package/dist/packem_shared/{control-button-BOZ5K-FC.js → control-button-BOZ5K-FC.mjs} +0 -0
- /package/dist/packem_shared/{data-view-params-qoSTqjAj.js → data-view-params-qoSTqjAj.mjs} +0 -0
- /package/dist/packem_shared/{internal-CwaF9YNk.js → internal-CwaF9YNk.mjs} +0 -0
- /package/dist/packem_shared/{log-fields-SBxKyBug.js → log-fields-SBxKyBug.mjs} +0 -0
- /package/dist/packem_shared/{operation-console-provider-DoloEvon.js → operation-console-provider-DoloEvon.mjs} +0 -0
- /package/dist/packem_shared/{quote-identifier-CGiYFBvY.js → quote-identifier-CGiYFBvY.mjs} +0 -0
- /package/dist/packem_shared/{storage-tier-C2mKwYRj.js → storage-tier-C2mKwYRj.mjs} +0 -0
- /package/dist/packem_shared/{use-shard-key-BsP3o5wT.js → use-shard-key-BsP3o5wT.mjs} +0 -0
- /package/dist/packem_shared/{useDebounced-DVeQ5-oW.js → useDebounced-DVeQ5-oW.mjs} +0 -0
- /package/dist/packem_shared/{utils-bhneXptQ.js → utils-bhneXptQ.mjs} +0 -0
- /package/dist/packem_shared/{virtual-rect-D_j7aLxX.js → virtual-rect-D_j7aLxX.mjs} +0 -0
- /package/dist/packem_shared/{wire-codec-Dl3VeNrd.js → wire-codec-Dl3VeNrd.mjs} +0 -0
- /package/dist/standalone/{chunk-DZGOHOOE.js → chunk-CXNZVJ3S.js} +0 -0
- /package/dist/standalone/{chunk-W2JBKQNU.js → chunk-UYEZR3BI.js} +0 -0
- /package/dist/standalone/{chunk-R5ZTCHCE.js → chunk-YKXDMIHQ.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ke}from"./chunk-METRMDIQ.js";import{a as A}from"./chunk-NXXGISFB.js";import{a as Pe}from"./chunk-JURAVSE7.js";import{a as be}from"./chunk-TB5N24CM.js";import"./chunk-KVSQKUWD.js";import"./chunk-ZHPDAJBM.js";import{P as M}from"./chunk-AOAJGSYZ.js";import"./chunk-TFMQSCGC.js";import{a as T}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import{b as j}from"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{a as ge}from"./chunk-5U6757U7.js";import"./chunk-PZ4QDWTI.js";import"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import{a as Z}from"./chunk-DZGOHOOE.js";import{c as ae}from"./chunk-4U5PYZLE.js";import{f as oe}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import{a as de}from"./chunk-UANVABQG.js";import{a as Ne,b as ve,c as we,d as ce,e as le,f as re}from"./chunk-L4EZAHCD.js";import{a as se,b as pe,c as fe,d as ue,e as ne}from"./chunk-IYWVSMAY.js";import{d as V,f as he,g as xe,h as ye,o as te}from"./chunk-6ZPTNC34.js";import"./chunk-3KLX63D7.js";import{a as d,d as ie,e as _e,f as Fe,g as Te}from"./chunk-R5ZTCHCE.js";var p=ie(_e(),1);var me=ie(Fe(),1);var t=ie(Te(),1);var Ce=["read","insert","update","delete"],Ae=d((e,a)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[a],"_e"),Ee=d(e=>{let a=new Set;for(let i of e?.advisories??[])if(i.name==="rls_uncovered_table"){let{table:s}=i.metadata;typeof s=="string"&&s!==""&&a.add(s)}return a},"Ie"),$e=d((e,a,i)=>{let s=new Map,l=d(n=>{let o=s.get(n);if(o!==void 0)return o;let f={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:n,uncovered:i.has(n)};return s.set(n,f),f},"l");for(let n of e)l(n.table).cells[n.on]={procedure:n.procedure};for(let n of a)l(n.table).maskedColumns.add(n.column);for(let n of i)l(n);return[...s.values()].toSorted((n,o)=>n.table.localeCompare(o.table))},"Ee"),ze=d(e=>{let a=(0,me.c)(17),i;a[0]!==e?(i=e===void 0?{}:e,a[0]=e,a[1]=i):i=a[1];let{onProbe:s}=i,l=V(),n,o;a[2]===Symbol.for("react.memo_cache_sentinel")?(n={},o={live:!0},a[2]=n,a[3]=o):(n=a[2],o=a[3]);let f=ae(Z.rlsPolicies,n,o),r;a[4]===Symbol.for("react.memo_cache_sentinel")?(r={},a[4]=r):r=a[4];let b=ae(Z.maskPolicies,r),h;a[5]===Symbol.for("react.memo_cache_sentinel")?(h={},a[5]=h):h=a[5];let g=ae(Z.getAdvisories,h),N;if(a[6]!==g.data||a[7]!==b.data||a[8]!==s||a[9]!==f||a[10]!==l){let v=null;f.data!==void 0&&(v=Array.isArray(f.data.policies)?f.data.policies:[]);let E=Array.isArray(b.data?.columns)?b.data.columns:[],O=g.data??null,{error:C,errorSource:w,liveError:S}=f,_=v===null?[]:$e(v,E,Ee(O)),k;a[12]!==S?(k=(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(Pe,{message:S,prefix:"pm"})}),a[12]=S,a[13]=k):k=a[13];let x;a[14]!==C||a[15]!==w?(x=C!==null&&(0,t.jsx)(ge,{error:w,testId:"pm-error"}),a[14]=C,a[15]=w,a[16]=x):x=a[16],N=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[k,x,v!==null&&_.length===0?(0,t.jsx)(de,{description:l("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:l("No policy")}):(0,t.jsxs)(Ne,{"data-testid":"pm-table",children:[(0,t.jsx)(ve,{children:(0,t.jsxs)(ce,{children:[(0,t.jsx)(le,{children:l("Table")}),Ce.map(c=>(0,t.jsx)(le,{children:Ae(l,c)},c)),(0,t.jsx)(le,{children:l("Masked columns")})]})}),(0,t.jsx)(we,{children:_.map(c=>(0,t.jsxs)(ce,{"data-testid":`pm-row-${c.table}`,children:[(0,t.jsx)(re,{className:"font-mono text-xs",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[c.table,c.uncovered&&(0,t.jsx)(j,{"data-testid":`pm-uncovered-${c.table}`,title:l("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:l("Uncovered \u2014 reachable without a policy")})]})}),Ce.map(I=>{let y=c.cells[I];return(0,t.jsx)(re,{"data-testid":`pm-cell-${c.table}-${I}`,children:y.procedure===void 0?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("No policy")}):(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsx)(j,{variant:"secondary",children:l("Covered by {procedure}",{procedure:y.procedure})}),s!==void 0&&(0,t.jsx)(T,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${c.table}-${I}`,onClick:d(()=>{s(c.table,I,y.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Probe this")})]})},I)}),(0,t.jsx)(re,{children:c.maskedColumns.size===0?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)("span",{className:"flex flex-wrap gap-1",children:[...c.maskedColumns].map(Re)})})]},c.table))})]})]}),a[6]=g.data,a[7]=b.data,a[8]=s,a[9]=f,a[10]=l,a[11]=N}else N=a[11];return N},"Fe");function Re(e){return(0,t.jsx)(j,{variant:"outline",children:e},e)}d(Re,"Re");var Le=he(Z.runAs),Oe=d(()=>{let e=oe();return async({args:a,functionPath:i,shardKey:s="",userId:l})=>{let n=Le;try{return{kind:"allowed",value:await e.query(n,{args:a,functionPath:i,userId:l},xe(s))}}catch(o){return{kind:"denied",message:o instanceof Error?o.message:String(o)}}}},"Le"),je=d(e=>e===void 0?"undefined":JSON.stringify(e,null,2),"Me"),Me=d(({functions:e,prefill:a,runAsIdentity:i=!1}={})=>{let s=oe(),l=V(),n=Oe(),[o,f]=(0,p.useState)(null),[r,b]=(0,p.useState)(null),h=e??o??[],[g,N]=(0,p.useState)(""),[v,E]=(0,p.useState)("{}"),[O,C]=(0,p.useState)(""),[w,S]=(0,p.useState)(""),[_,k]=(0,p.useState)(!1),[x,c]=(0,p.useState)(null),[I,y]=(0,p.useState)(null),F=(0,p.useRef)(-1);(0,p.useEffect)(()=>{if(e!==void 0)return;let m=!1;return s.listFunctions().then(u=>(m||f(u),u)).catch(u=>{m||b(ye(u))}),()=>{m=!0}},[s,e]),(0,p.useEffect)(()=>{if(a===void 0||F.current===a.nonce)return;F.current=a.nonce;let m=a.functionPath;queueMicrotask(()=>{N(m),c(null)})},[a]);let P=g===""?h[0]?.path??"":g,$=d(async()=>{if(P==="")return;let m;try{m=v.trim()===""?{}:JSON.parse(v)}catch(u){y(l("Invalid JSON args: {message}",{message:u.message})),c(null);return}y(null),k(!0);try{let u=await n({args:m,functionPath:P,shardKey:O.trim(),userId:w.trim()});c(u)}finally{k(!1)}},"E"),z=d(()=>{te($())},"F"),Y=d(m=>{N(m.target.value)},"Y"),R=d(m=>{E(m.target.value)},"R"),L=d(m=>{S(m.target.value)},"O");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[r!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:r}),!i&&(0,t.jsx)(de,{description:l("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:l("Set `runAsIdentity` to forge an identity and probe access.")}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-function",children:l("Function")}),(0,t.jsx)("select",{"aria-label":l("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:Y,value:P,children:h.map(m=>(0,t.jsxs)("option",{value:m.path,children:[m.path," (",m.kind,")"]},m.path))})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-args",children:l("Arguments")}),(0,t.jsx)(ke,{"aria-label":l("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:R,value:v})]}),(0,t.jsx)(be,{onChange:C,testId:"pp-shard",value:O}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-user",children:l("Run as (userId)")}),(0,t.jsx)(M,{"aria-label":l("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:L,placeholder:l("Leave empty to run as admin"),value:w})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T,{"data-testid":"pp-run",disabled:!i||_||P==="",onClick:z,type:"button",children:l(_?"Probing\u2026":"Run probe")}),w.trim()!==""&&(0,t.jsx)(j,{"data-testid":"pp-as-badge",variant:"secondary",children:l("as {userId}",{userId:w.trim()})})]})]}),I!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:I}),x!==null&&x.kind==="allowed"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,t.jsx)(j,{variant:"secondary",children:l("Allowed")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:je(x.value)})]}),x!==null&&x.kind==="denied"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,t.jsx)(j,{variant:"destructive",children:l("Denied")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:x.message})]})]})},"$e"),De="/__lunora/policy-scaffold",Ue={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},qe=d(async e=>{let a=await fetch(De,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),i=await a.json();if(i.needsManualEdit===!0)return{kind:"needs-manual-edit",message:i.message??"This change must be made by hand."};if(a.ok)return{diagnostics:i.diagnostics??[],kind:"ok",label:i.fileName??i.exportName??""};let s=i.error;return{kind:"error",message:s===void 0?`policy scaffold failed (${String(a.status)})`:Ue[s]??s}},"Ue"),Se={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Je=d(()=>{let e=(0,me.c)(69),a=V(),[i,s]=(0,p.useState)(null),[l,n]=(0,p.useState)(!1),[o,f]=(0,p.useState)(null),[r,b]=(0,p.useState)(Se),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d(ee=>{let G=ee.target.name,{value:H}=ee.target;b(Ie=>({...Ie,[G]:H}))},"u"),e[0]=h):h=e[0];let g=h,N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=d(()=>{s(null),b(Se)},"v"),e[1]=N):N=e[1];let v=N,E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E=d(async ee=>{n(!0),f(null);try{let G=await qe(ee);f(G),G.kind==="ok"&&v()}catch(G){let H=G;f({kind:"error",message:H instanceof Error?H.message:String(H)})}n(!1)},"I"),e[2]=E):E=e[2];let O=E,C;e[3]!==r.policyName||e[4]!==r.tableName?(C=d(()=>{te(O({kind:"scaffoldPolicy",name:r.policyName.trim(),table:r.tableName.trim()}))},"P"),e[3]=r.policyName,e[4]=r.tableName,e[5]=C):C=e[5];let w=C,S;e[6]!==r.exportName||e[7]!==r.filePath||e[8]!==r.policies?(S=d(()=>{te(O({exportName:r.exportName.trim(),filePath:r.filePath.trim(),kind:"wireRls",policies:r.policies.trim()}))},"w"),e[6]=r.exportName,e[7]=r.filePath,e[8]=r.policies,e[9]=S):S=e[9];let _=S,k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=d(()=>{f(null),s("scaffold")},"S"),e[10]=k):k=e[10];let x=k,c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=d(()=>{f(null),s("wire")},"d"),e[11]=c):c=e[11];let I=c,y;e[12]!==a?(y=a("Scaffold access rules"),e[12]=a,e[13]=y):y=e[13];let F;e[14]!==y?(F=(0,t.jsx)(fe,{children:y}),e[14]=y,e[15]=F):F=e[15];let P;e[16]!==a?(P=a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=a,e[17]=P):P=e[17];let $;e[18]!==P?($=(0,t.jsx)(ue,{children:P}),e[18]=P,e[19]=$):$=e[19];let z;e[20]!==$||e[21]!==F?(z=(0,t.jsxs)(pe,{children:[F,$]}),e[20]=$,e[21]=F,e[22]=z):z=e[22];let Y=i==="scaffold"?"default":"outline",R;e[23]!==a?(R=a("New policy file"),e[23]=a,e[24]=R):R=e[24];let L;e[25]!==Y||e[26]!==R?(L=(0,t.jsx)(T,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:Y,children:R}),e[25]=Y,e[26]=R,e[27]=L):L=e[27];let m=i==="wire"?"default":"outline",u;e[28]!==a?(u=a("Wire into a procedure"),e[28]=a,e[29]=u):u=e[29];let D;e[30]!==m||e[31]!==u?(D=(0,t.jsx)(T,{"data-testid":"policy-scaffolder-wire",onClick:I,size:"xs",type:"button",variant:m,children:u}),e[30]=m,e[31]=u,e[32]=D):D=e[32];let U;e[33]!==L||e[34]!==D?(U=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[L,D]}),e[33]=L,e[34]=D,e[35]=U):U=e[35];let q;e[36]!==l||e[37]!==r.policyName||e[38]!==r.tableName||e[39]!==i||e[40]!==w||e[41]!==a?(q=i==="scaffold"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:g,value:r.policyName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:g,value:r.tableName})]}),(0,t.jsx)(T,{"data-testid":"policy-scaffolder-create",disabled:l||r.policyName.trim()===""||r.tableName.trim()==="",onClick:w,size:"xs",type:"button",children:a(l?"Creating\u2026":"Create policy file")}),(0,t.jsx)(T,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[36]=l,e[37]=r.policyName,e[38]=r.tableName,e[39]=i,e[40]=w,e[41]=a,e[42]=q):q=e[42];let J;e[43]!==l||e[44]!==r.exportName||e[45]!==r.filePath||e[46]!==r.policies||e[47]!==i||e[48]!==_||e[49]!==a?(J=i==="wire"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:g,value:r.filePath})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:g,value:r.exportName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:g,value:r.policies})]}),(0,t.jsx)(T,{"data-testid":"policy-scaffolder-apply",disabled:l||r.filePath.trim()===""||r.exportName.trim()===""||r.policies.trim()==="",onClick:_,size:"xs",type:"button",children:a(l?"Wiring\u2026":"Wire RLS")}),(0,t.jsx)(T,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[43]=l,e[44]=r.exportName,e[45]=r.filePath,e[46]=r.policies,e[47]=i,e[48]=_,e[49]=a,e[50]=J):J=e[50];let W;e[51]!==o?(W=o?.kind==="error"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:o.message}),e[51]=o,e[52]=W):W=e[52];let B;e[53]!==o?.kind||e[54]!==a?(B=o?.kind==="needs-manual-edit"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),e[53]=o?.kind,e[54]=a,e[55]=B):B=e[55];let K;e[56]!==o||e[57]!==a?(K=o?.kind==="ok"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:o.label})}),o.diagnostics.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:o.diagnostics.map(We)})]}),e[56]=o,e[57]=a,e[58]=K):K=e[58];let Q;e[59]!==U||e[60]!==q||e[61]!==J||e[62]!==W||e[63]!==B||e[64]!==K?(Q=(0,t.jsxs)(ne,{children:[U,q,J,W,B,K]}),e[59]=U,e[60]=q,e[61]=J,e[62]=W,e[63]=B,e[64]=K,e[65]=Q):Q=e[65];let X;return e[66]!==z||e[67]!==Q?(X=(0,t.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[z,Q]}),e[66]=z,e[67]=Q,e[68]=X):X=e[68],X},"je");function We(e){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}d(We,"Be");var st=d(({functions:e,runAsIdentity:a=!1,schemaEditable:i=!1}={})=>{let s=V(),[l,n]=(0,p.useState)(void 0),o=d((f,r,b)=>{b!==""&&n(h=>({functionPath:b,nonce:(h?.nonce??0)+1}))},"o");return(0,t.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Permissions")})}),(0,t.jsx)(ze,{onProbe:o})]}),(0,t.jsx)("section",{className:"flex flex-col gap-3",children:(0,t.jsxs)(se,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Probe")})}),(0,t.jsxs)(ne,{className:"px-4 py-4",children:[(0,t.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:s("Pick a function and an identity, then run it to see the access outcome.")}),(0,t.jsx)(Me,{functions:e,prefill:l,runAsIdentity:a})]})]})}),i&&(0,t.jsx)("section",{className:"flex flex-col gap-2",children:(0,t.jsx)(Je,{})})]})},"nt");export{st as PermissionsPanel};
|
|
1
|
+
import{a as ke}from"./chunk-EA2JKR5D.js";import{a as A}from"./chunk-IMOHEGMV.js";import{a as Pe}from"./chunk-7QRRR3K6.js";import{a as be}from"./chunk-IFLTA2OD.js";import"./chunk-OGUKYRFM.js";import"./chunk-OKG3HWSJ.js";import{P as M}from"./chunk-46ZJ3TM4.js";import"./chunk-4L4WTGN5.js";import{a as T}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import{b as j}from"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{a as ge}from"./chunk-JAZCU2PP.js";import"./chunk-ULIQFBZU.js";import"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import{a as Z}from"./chunk-CXNZVJ3S.js";import{c as ae}from"./chunk-ECQTVV2J.js";import{f as oe}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import{a as de}from"./chunk-FKVZRPV5.js";import{a as Ne,b as ve,c as we,d as ce,e as le,f as re}from"./chunk-HEAQVSNS.js";import{a as se,b as pe,c as fe,d as ue,e as ne}from"./chunk-WUWBZPUK.js";import{d as V,f as he,g as xe,h as ye,o as te}from"./chunk-Y4Q25F6X.js";import"./chunk-T2IE5GKA.js";import{a as d,d as ie,e as _e,f as Fe,g as Te}from"./chunk-YKXDMIHQ.js";var p=ie(_e(),1);var me=ie(Fe(),1);var t=ie(Te(),1);var Ce=["read","insert","update","delete"],Ae=d((e,a)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[a],"_e"),Ee=d(e=>{let a=new Set;for(let i of e?.advisories??[])if(i.name==="rls_uncovered_table"){let{table:s}=i.metadata;typeof s=="string"&&s!==""&&a.add(s)}return a},"Ie"),$e=d((e,a,i)=>{let s=new Map,l=d(n=>{let o=s.get(n);if(o!==void 0)return o;let f={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:n,uncovered:i.has(n)};return s.set(n,f),f},"l");for(let n of e)l(n.table).cells[n.on]={procedure:n.procedure};for(let n of a)l(n.table).maskedColumns.add(n.column);for(let n of i)l(n);return[...s.values()].toSorted((n,o)=>n.table.localeCompare(o.table))},"Ee"),ze=d(e=>{let a=(0,me.c)(17),i;a[0]!==e?(i=e===void 0?{}:e,a[0]=e,a[1]=i):i=a[1];let{onProbe:s}=i,l=V(),n,o;a[2]===Symbol.for("react.memo_cache_sentinel")?(n={},o={live:!0},a[2]=n,a[3]=o):(n=a[2],o=a[3]);let f=ae(Z.rlsPolicies,n,o),r;a[4]===Symbol.for("react.memo_cache_sentinel")?(r={},a[4]=r):r=a[4];let b=ae(Z.maskPolicies,r),h;a[5]===Symbol.for("react.memo_cache_sentinel")?(h={},a[5]=h):h=a[5];let g=ae(Z.getAdvisories,h),N;if(a[6]!==g.data||a[7]!==b.data||a[8]!==s||a[9]!==f||a[10]!==l){let v=null;f.data!==void 0&&(v=Array.isArray(f.data.policies)?f.data.policies:[]);let E=Array.isArray(b.data?.columns)?b.data.columns:[],O=g.data??null,{error:C,errorSource:w,liveError:S}=f,_=v===null?[]:$e(v,E,Ee(O)),k;a[12]!==S?(k=(0,t.jsx)("div",{className:"flex items-center justify-end",children:(0,t.jsx)(Pe,{message:S,prefix:"pm"})}),a[12]=S,a[13]=k):k=a[13];let x;a[14]!==C||a[15]!==w?(x=C!==null&&(0,t.jsx)(ge,{error:w,testId:"pm-error"}),a[14]=C,a[15]=w,a[16]=x):x=a[16],N=(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[k,x,v!==null&&_.length===0?(0,t.jsx)(de,{description:l("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:l("No policy")}):(0,t.jsxs)(Ne,{"data-testid":"pm-table",children:[(0,t.jsx)(ve,{children:(0,t.jsxs)(ce,{children:[(0,t.jsx)(le,{children:l("Table")}),Ce.map(c=>(0,t.jsx)(le,{children:Ae(l,c)},c)),(0,t.jsx)(le,{children:l("Masked columns")})]})}),(0,t.jsx)(we,{children:_.map(c=>(0,t.jsxs)(ce,{"data-testid":`pm-row-${c.table}`,children:[(0,t.jsx)(re,{className:"font-mono text-xs",children:(0,t.jsxs)("span",{className:"flex items-center gap-1.5",children:[c.table,c.uncovered&&(0,t.jsx)(j,{"data-testid":`pm-uncovered-${c.table}`,title:l("Uncovered \u2014 reachable without a policy"),variant:"destructive",children:l("Uncovered \u2014 reachable without a policy")})]})}),Ce.map(I=>{let y=c.cells[I];return(0,t.jsx)(re,{"data-testid":`pm-cell-${c.table}-${I}`,children:y.procedure===void 0?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:l("No policy")}):(0,t.jsxs)("span",{className:"flex flex-col gap-1",children:[(0,t.jsx)(j,{variant:"secondary",children:l("Covered by {procedure}",{procedure:y.procedure})}),s!==void 0&&(0,t.jsx)(T,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${c.table}-${I}`,onClick:d(()=>{s(c.table,I,y.procedure??"")},"onClick"),size:"xs",type:"button",variant:"ghost",children:l("Probe this")})]})},I)}),(0,t.jsx)(re,{children:c.maskedColumns.size===0?(0,t.jsx)("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"\u2014"}):(0,t.jsx)("span",{className:"flex flex-wrap gap-1",children:[...c.maskedColumns].map(Re)})})]},c.table))})]})]}),a[6]=g.data,a[7]=b.data,a[8]=s,a[9]=f,a[10]=l,a[11]=N}else N=a[11];return N},"Fe");function Re(e){return(0,t.jsx)(j,{variant:"outline",children:e},e)}d(Re,"Re");var Le=he(Z.runAs),Oe=d(()=>{let e=oe();return async({args:a,functionPath:i,shardKey:s="",userId:l})=>{let n=Le;try{return{kind:"allowed",value:await e.query(n,{args:a,functionPath:i,userId:l},xe(s))}}catch(o){return{kind:"denied",message:o instanceof Error?o.message:String(o)}}}},"Le"),je=d(e=>e===void 0?"undefined":JSON.stringify(e,null,2),"Me"),Me=d(({functions:e,prefill:a,runAsIdentity:i=!1}={})=>{let s=oe(),l=V(),n=Oe(),[o,f]=(0,p.useState)(null),[r,b]=(0,p.useState)(null),h=e??o??[],[g,N]=(0,p.useState)(""),[v,E]=(0,p.useState)("{}"),[O,C]=(0,p.useState)(""),[w,S]=(0,p.useState)(""),[_,k]=(0,p.useState)(!1),[x,c]=(0,p.useState)(null),[I,y]=(0,p.useState)(null),F=(0,p.useRef)(-1);(0,p.useEffect)(()=>{if(e!==void 0)return;let m=!1;return s.listFunctions().then(u=>(m||f(u),u)).catch(u=>{m||b(ye(u))}),()=>{m=!0}},[s,e]),(0,p.useEffect)(()=>{if(a===void 0||F.current===a.nonce)return;F.current=a.nonce;let m=a.functionPath;queueMicrotask(()=>{N(m),c(null)})},[a]);let P=g===""?h[0]?.path??"":g,$=d(async()=>{if(P==="")return;let m;try{m=v.trim()===""?{}:JSON.parse(v)}catch(u){y(l("Invalid JSON args: {message}",{message:u.message})),c(null);return}y(null),k(!0);try{let u=await n({args:m,functionPath:P,shardKey:O.trim(),userId:w.trim()});c(u)}finally{k(!1)}},"E"),z=d(()=>{te($())},"F"),Y=d(m=>{N(m.target.value)},"Y"),R=d(m=>{E(m.target.value)},"R"),L=d(m=>{S(m.target.value)},"O");return(0,t.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[r!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:r}),!i&&(0,t.jsx)(de,{description:l("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:l("Set `runAsIdentity` to forge an identity and probe access.")}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-function",children:l("Function")}),(0,t.jsx)("select",{"aria-label":l("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:Y,value:P,children:h.map(m=>(0,t.jsxs)("option",{value:m.path,children:[m.path," (",m.kind,")"]},m.path))})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-args",children:l("Arguments")}),(0,t.jsx)(ke,{"aria-label":l("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:R,value:v})]}),(0,t.jsx)(be,{onChange:C,testId:"pp-shard",value:O}),(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,t.jsx)(A,{htmlFor:"pp-user",children:l("Run as (userId)")}),(0,t.jsx)(M,{"aria-label":l("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:L,placeholder:l("Leave empty to run as admin"),value:w})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(T,{"data-testid":"pp-run",disabled:!i||_||P==="",onClick:z,type:"button",children:l(_?"Probing\u2026":"Run probe")}),w.trim()!==""&&(0,t.jsx)(j,{"data-testid":"pp-as-badge",variant:"secondary",children:l("as {userId}",{userId:w.trim()})})]})]}),I!==null&&(0,t.jsx)("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:I}),x!==null&&x.kind==="allowed"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[(0,t.jsx)(j,{variant:"secondary",children:l("Allowed")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:je(x.value)})]}),x!==null&&x.kind==="denied"&&(0,t.jsxs)("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[(0,t.jsx)(j,{variant:"destructive",children:l("Denied")}),(0,t.jsx)("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"pp-denied",role:"alert",children:x.message})]})]})},"$e"),De="/__lunora/policy-scaffold",Ue={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists \u2014 pick another name or edit it by hand.","invalid-identifier":"Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).","unknown-procedure":"No exported procedure was found at that file path.","unsupported-procedure-shape":"That procedure uses the bare query({\u2026}) form \u2014 convert it to the builder form (c.use(\u2026).query(\u2026)) before wiring RLS."},qe=d(async e=>{let a=await fetch(De,{body:JSON.stringify(e),headers:{"Content-Type":"application/json"},method:"POST"}),i=await a.json();if(i.needsManualEdit===!0)return{kind:"needs-manual-edit",message:i.message??"This change must be made by hand."};if(a.ok)return{diagnostics:i.diagnostics??[],kind:"ok",label:i.fileName??i.exportName??""};let s=i.error;return{kind:"error",message:s===void 0?`policy scaffold failed (${String(a.status)})`:Ue[s]??s}},"Ue"),Se={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Je=d(()=>{let e=(0,me.c)(69),a=V(),[i,s]=(0,p.useState)(null),[l,n]=(0,p.useState)(!1),[o,f]=(0,p.useState)(null),[r,b]=(0,p.useState)(Se),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=d(ee=>{let G=ee.target.name,{value:H}=ee.target;b(Ie=>({...Ie,[G]:H}))},"u"),e[0]=h):h=e[0];let g=h,N;e[1]===Symbol.for("react.memo_cache_sentinel")?(N=d(()=>{s(null),b(Se)},"v"),e[1]=N):N=e[1];let v=N,E;e[2]===Symbol.for("react.memo_cache_sentinel")?(E=d(async ee=>{n(!0),f(null);try{let G=await qe(ee);f(G),G.kind==="ok"&&v()}catch(G){let H=G;f({kind:"error",message:H instanceof Error?H.message:String(H)})}n(!1)},"I"),e[2]=E):E=e[2];let O=E,C;e[3]!==r.policyName||e[4]!==r.tableName?(C=d(()=>{te(O({kind:"scaffoldPolicy",name:r.policyName.trim(),table:r.tableName.trim()}))},"P"),e[3]=r.policyName,e[4]=r.tableName,e[5]=C):C=e[5];let w=C,S;e[6]!==r.exportName||e[7]!==r.filePath||e[8]!==r.policies?(S=d(()=>{te(O({exportName:r.exportName.trim(),filePath:r.filePath.trim(),kind:"wireRls",policies:r.policies.trim()}))},"w"),e[6]=r.exportName,e[7]=r.filePath,e[8]=r.policies,e[9]=S):S=e[9];let _=S,k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=d(()=>{f(null),s("scaffold")},"S"),e[10]=k):k=e[10];let x=k,c;e[11]===Symbol.for("react.memo_cache_sentinel")?(c=d(()=>{f(null),s("wire")},"d"),e[11]=c):c=e[11];let I=c,y;e[12]!==a?(y=a("Scaffold access rules"),e[12]=a,e[13]=y):y=e[13];let F;e[14]!==y?(F=(0,t.jsx)(fe,{children:y}),e[14]=y,e[15]=F):F=e[15];let P;e[16]!==a?(P=a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),e[16]=a,e[17]=P):P=e[17];let $;e[18]!==P?($=(0,t.jsx)(ue,{children:P}),e[18]=P,e[19]=$):$=e[19];let z;e[20]!==$||e[21]!==F?(z=(0,t.jsxs)(pe,{children:[F,$]}),e[20]=$,e[21]=F,e[22]=z):z=e[22];let Y=i==="scaffold"?"default":"outline",R;e[23]!==a?(R=a("New policy file"),e[23]=a,e[24]=R):R=e[24];let L;e[25]!==Y||e[26]!==R?(L=(0,t.jsx)(T,{"data-testid":"policy-scaffolder-new",onClick:x,size:"xs",type:"button",variant:Y,children:R}),e[25]=Y,e[26]=R,e[27]=L):L=e[27];let m=i==="wire"?"default":"outline",u;e[28]!==a?(u=a("Wire into a procedure"),e[28]=a,e[29]=u):u=e[29];let D;e[30]!==m||e[31]!==u?(D=(0,t.jsx)(T,{"data-testid":"policy-scaffolder-wire",onClick:I,size:"xs",type:"button",variant:m,children:u}),e[30]=m,e[31]=u,e[32]=D):D=e[32];let U;e[33]!==L||e[34]!==D?(U=(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[L,D]}),e[33]=L,e[34]=D,e[35]=U):U=e[35];let q;e[36]!==l||e[37]!==r.policyName||e[38]!==r.tableName||e[39]!==i||e[40]!==w||e[41]!==a?(q=i==="scaffold"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:g,value:r.policyName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:g,value:r.tableName})]}),(0,t.jsx)(T,{"data-testid":"policy-scaffolder-create",disabled:l||r.policyName.trim()===""||r.tableName.trim()==="",onClick:w,size:"xs",type:"button",children:a(l?"Creating\u2026":"Create policy file")}),(0,t.jsx)(T,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[36]=l,e[37]=r.policyName,e[38]=r.tableName,e[39]=i,e[40]=w,e[41]=a,e[42]=q):q=e[42];let J;e[43]!==l||e[44]!==r.exportName||e[45]!==r.filePath||e[46]!==r.policies||e[47]!==i||e[48]!==_||e[49]!==a?(J=i==="wire"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:g,value:r.filePath})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:g,value:r.exportName})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1 text-xs",children:[(0,t.jsx)(A,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),(0,t.jsx)(M,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:g,value:r.policies})]}),(0,t.jsx)(T,{"data-testid":"policy-scaffolder-apply",disabled:l||r.filePath.trim()===""||r.exportName.trim()===""||r.policies.trim()==="",onClick:_,size:"xs",type:"button",children:a(l?"Wiring\u2026":"Wire RLS")}),(0,t.jsx)(T,{onClick:v,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),e[43]=l,e[44]=r.exportName,e[45]=r.filePath,e[46]=r.policies,e[47]=i,e[48]=_,e[49]=a,e[50]=J):J=e[50];let W;e[51]!==o?(W=o?.kind==="error"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:o.message}),e[51]=o,e[52]=W):W=e[52];let B;e[53]!==o?.kind||e[54]!==a?(B=o?.kind==="needs-manual-edit"&&(0,t.jsx)("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand \u2014 the scaffolder only adds new, deny-by-default rules.")}),e[53]=o?.kind,e[54]=a,e[55]=B):B=e[55];let K;e[56]!==o||e[57]!==a?(K=o?.kind==="ok"&&(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[(0,t.jsx)("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:o.label})}),o.diagnostics.length>0&&(0,t.jsx)("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:o.diagnostics.map(We)})]}),e[56]=o,e[57]=a,e[58]=K):K=e[58];let Q;e[59]!==U||e[60]!==q||e[61]!==J||e[62]!==W||e[63]!==B||e[64]!==K?(Q=(0,t.jsxs)(ne,{children:[U,q,J,W,B,K]}),e[59]=U,e[60]=q,e[61]=J,e[62]=W,e[63]=B,e[64]=K,e[65]=Q):Q=e[65];let X;return e[66]!==z||e[67]!==Q?(X=(0,t.jsxs)(se,{"data-testid":"policy-scaffolder",size:"sm",children:[z,Q]}),e[66]=z,e[67]=Q,e[68]=X):X=e[68],X},"je");function We(e){return(0,t.jsx)("li",{className:"font-mono text-[11px] text-destructive",children:e},e)}d(We,"Be");var st=d(({functions:e,runAsIdentity:a=!1,schemaEditable:i=!1}={})=>{let s=V(),[l,n]=(0,p.useState)(void 0),o=d((f,r,b)=>{b!==""&&n(h=>({functionPath:b,nonce:(h?.nonce??0)+1}))},"o");return(0,t.jsxs)("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[(0,t.jsxs)("section",{className:"flex flex-col gap-3",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Permissions")})}),(0,t.jsx)(ze,{onProbe:o})]}),(0,t.jsx)("section",{className:"flex flex-col gap-3",children:(0,t.jsxs)(se,{className:"gap-0 py-0",children:[(0,t.jsx)("header",{className:"border-b border-border px-4 py-3",children:(0,t.jsx)("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Probe")})}),(0,t.jsxs)(ne,{className:"px-4 py-4",children:[(0,t.jsx)("p",{className:"mb-3 text-sm text-muted-foreground",children:s("Pick a function and an identity, then run it to see the access outcome.")}),(0,t.jsx)(Me,{functions:e,prefill:l,runAsIdentity:a})]})]})}),i&&(0,t.jsx)("section",{className:"flex flex-col gap-2",children:(0,t.jsx)(Je,{})})]})},"nt");export{st as PermissionsPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-EHQU74ST.js";import"./chunk-TPAZM36C.js";import"./chunk-BSACLUQK.js";import"./chunk-XJSWM47N.js";import"./chunk-EDHW2EEG.js";import"./chunk-ZSOLGJFC.js";import"./chunk-DUDQV6XJ.js";import{a as Ci}from"./chunk-M3NNNOD5.js";import"./chunk-VZCS5GXZ.js";import"./chunk-DKSLOJDQ.js";import"./chunk-MCLM2QJI.js";import"./chunk-DPNEFSEC.js";import"./chunk-TNKECJW4.js";import"./chunk-4YTSKL4R.js";import{a as Le}from"./chunk-ZHPDAJBM.js";import{P as Xi}from"./chunk-AOAJGSYZ.js";import"./chunk-INQICZYC.js";import{a as zd}from"./chunk-TFMQSCGC.js";import{a as Gi}from"./chunk-BWEXJENB.js";import"./chunk-74ASA4WU.js";import"./chunk-XQS7KSHL.js";import"./chunk-SPDZUX4P.js";import"./chunk-7PIHTTND.js";import{b as Ke}from"./chunk-FUVCG23X.js";import"./chunk-F7JOSNAT.js";import"./chunk-DZGOHOOE.js";import"./chunk-4U5PYZLE.js";import{a as Hi,e as qi}from"./chunk-CG5OTGTR.js";import"./chunk-RCZTUWG3.js";import"./chunk-UANVABQG.js";import"./chunk-IYWVSMAY.js";import{a as Qi,d as je,p as pi}from"./chunk-6ZPTNC34.js";import{c as _i}from"./chunk-3KLX63D7.js";import{a as c,b as vn,d as fu,e as Ni,f as Ad,g as Bi,i as xe}from"./chunk-R5ZTCHCE.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,ga||(ga=!0,oa());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var ga=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,ga){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?oa():ga=!1}}}c(we,"performWorkUntilDeadline");var oa;typeof Ki=="function"?oa=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,oa=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):oa=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,ga||(ga=!0,oa()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((e2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
|
|
1
|
+
import{a as Yi,b as Ve,c as Ri,d as Je,e as Zi,f as xi,k as ji}from"./chunk-3FFEVZUV.js";import"./chunk-Q4CAKBWN.js";import"./chunk-WLGZOFKE.js";import"./chunk-RLLKECZT.js";import"./chunk-7RIRJD2P.js";import"./chunk-C3TOZ4LG.js";import"./chunk-D27D4UUI.js";import{a as Ci}from"./chunk-QKEJLVC5.js";import"./chunk-SB35BJ7A.js";import"./chunk-FO26ZU7E.js";import"./chunk-5WJXVZMZ.js";import"./chunk-PYT4RZJH.js";import"./chunk-K7AJEMKE.js";import"./chunk-JVUZEYKQ.js";import{a as Le}from"./chunk-OKG3HWSJ.js";import{P as Xi}from"./chunk-46ZJ3TM4.js";import"./chunk-Y6CXU7T4.js";import{a as zd}from"./chunk-4L4WTGN5.js";import{a as Gi}from"./chunk-EBWXFG4H.js";import"./chunk-TGHH7ZFA.js";import"./chunk-5GFSKIB2.js";import"./chunk-NCCAMFB6.js";import"./chunk-25NFR6EB.js";import{b as Ke}from"./chunk-OOESPRIZ.js";import"./chunk-35DM4JJG.js";import"./chunk-CXNZVJ3S.js";import"./chunk-ECQTVV2J.js";import{a as Hi,e as qi}from"./chunk-JBIN7W2B.js";import"./chunk-FSRSK4LY.js";import"./chunk-FKVZRPV5.js";import"./chunk-WUWBZPUK.js";import{a as Qi,d as je,p as pi}from"./chunk-Y4Q25F6X.js";import{c as _i}from"./chunk-T2IE5GKA.js";import{a as c,b as vn,d as fu,e as Ni,f as Ad,g as Bi,i as xe}from"./chunk-YKXDMIHQ.js";var ri=vn(w=>{"use strict";function $e(l,t){var a=l.length;l.push(t);l:for(;0<a;){var u=a-1>>>1,n=l[u];if(0<dn(n,t))l[u]=t,l[a]=n,a=u;else break l}}c($e,"push");function wl(l){return l.length===0?null:l[0]}c(wl,"peek");function hn(l){if(l.length===0)return null;var t=l[0],a=l.pop();if(a!==t){l[0]=a;l:for(var u=0,n=l.length,e=n>>>1;u<e;){var f=2*(u+1)-1,i=l[f],m=f+1,y=l[m];if(0>dn(i,a))m<n&&0>dn(y,i)?(l[u]=y,l[m]=a,u=m):(l[u]=i,l[f]=a,u=f);else if(m<n&&0>dn(y,a))l[u]=y,l[m]=a,u=m;else break l}}return t}c(hn,"pop");function dn(l,t){var a=l.sortIndex-t.sortIndex;return a!==0?a:l.id-t.id}c(dn,"compare");w.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(Vi=performance,w.unstable_now=function(){return Vi.now()}):(We=Date,Li=We.now(),w.unstable_now=function(){return We.now()-Li});var Vi,We,Li,tt=[],Et=[],Td=1,Ql=null,Sl=3,ke=!1,iu=!1,mu=!1,re=!1,Wi=typeof setTimeout=="function"?setTimeout:null,wi=typeof clearTimeout=="function"?clearTimeout:null,Ki=typeof setImmediate<"u"?setImmediate:null;function yn(l){for(var t=wl(Et);t!==null;){if(t.callback===null)hn(Et);else if(t.startTime<=l)hn(Et),t.sortIndex=t.expirationTime,$e(tt,t);else break;t=wl(Et)}}c(yn,"advanceTimers");function Ie(l){if(mu=!1,yn(l),!iu)if(wl(tt)!==null)iu=!0,ga||(ga=!0,oa());else{var t=wl(Et);t!==null&&Pe(Ie,t.startTime-l)}}c(Ie,"handleTimeout");var ga=!1,vu=-1,Fi=5,$i=-1;function ki(){return re?!0:!(w.unstable_now()-$i<Fi)}c(ki,"shouldYieldToHost");function we(){if(re=!1,ga){var l=w.unstable_now();$i=l;var t=!0;try{l:{iu=!1,mu&&(mu=!1,wi(vu),vu=-1),ke=!0;var a=Sl;try{t:{for(yn(l),Ql=wl(tt);Ql!==null&&!(Ql.expirationTime>l&&ki());){var u=Ql.callback;if(typeof u=="function"){Ql.callback=null,Sl=Ql.priorityLevel;var n=u(Ql.expirationTime<=l);if(l=w.unstable_now(),typeof n=="function"){Ql.callback=n,yn(l),t=!0;break t}Ql===wl(tt)&&hn(tt),yn(l)}else hn(tt);Ql=wl(tt)}if(Ql!==null)t=!0;else{var e=wl(Et);e!==null&&Pe(Ie,e.startTime-l),t=!1}}break l}finally{Ql=null,Sl=a,ke=!1}t=void 0}}finally{t?oa():ga=!1}}}c(we,"performWorkUntilDeadline");var oa;typeof Ki=="function"?oa=c(function(){Ki(we)},"schedulePerformWorkUntilDeadline"):typeof MessageChannel<"u"?(Fe=new MessageChannel,Ji=Fe.port2,Fe.port1.onmessage=we,oa=c(function(){Ji.postMessage(null)},"schedulePerformWorkUntilDeadline")):oa=c(function(){Wi(we,0)},"schedulePerformWorkUntilDeadline");var Fe,Ji;function Pe(l,t){vu=Wi(function(){l(w.unstable_now())},t)}c(Pe,"requestHostTimeout");w.unstable_IdlePriority=5;w.unstable_ImmediatePriority=1;w.unstable_LowPriority=4;w.unstable_NormalPriority=3;w.unstable_Profiling=null;w.unstable_UserBlockingPriority=2;w.unstable_cancelCallback=function(l){l.callback=null};w.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Fi=0<l?Math.floor(1e3/l):5};w.unstable_getCurrentPriorityLevel=function(){return Sl};w.unstable_next=function(l){switch(Sl){case 1:case 2:case 3:var t=3;break;default:t=Sl}var a=Sl;Sl=t;try{return l()}finally{Sl=a}};w.unstable_requestPaint=function(){re=!0};w.unstable_runWithPriority=function(l,t){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var a=Sl;Sl=l;try{return t()}finally{Sl=a}};w.unstable_scheduleCallback=function(l,t,a){var u=w.unstable_now();switch(typeof a=="object"&&a!==null?(a=a.delay,a=typeof a=="number"&&0<a?u+a:u):a=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=a+n,l={id:Td++,callback:t,priorityLevel:l,startTime:a,expirationTime:n,sortIndex:-1},a>u?(l.sortIndex=a,$e(Et,l),wl(tt)===null&&l===wl(Et)&&(mu?(wi(vu),vu=-1):mu=!0,Pe(Ie,a-u))):(l.sortIndex=n,$e(tt,l),iu||ke||(iu=!0,ga||(ga=!0,oa()))),l};w.unstable_shouldYield=ki;w.unstable_wrapCallback=function(l){var t=Sl;return function(){var a=Sl;Sl=t;try{return l.apply(this,arguments)}finally{Sl=a}}}});var Pi=vn((e2,Ii)=>{"use strict";Ii.exports=ri()});var dd=vn(Re=>{"use strict";var el=Pi(),U1=Ni(),Ed=zd();function z(l){var t="https://react.dev/errors/"+l;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+l+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}c(z,"formatProdErrorMessage");function D1(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}c(D1,"isValidContainer");function ku(l){var t=l,a=l;if(l.alternate)for(;t.return;)t=t.return;else{l=t;do t=l,(t.flags&4098)!==0&&(a=t.return),l=t.return;while(l)}return t.tag===3?a:null}c(ku,"getNearestMountedFiber");function _1(l){if(l.tag===13){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(_1,"getSuspenseInstanceFromFiber");function N1(l){if(l.tag===31){var t=l.memoizedState;if(t===null&&(l=l.alternate,l!==null&&(t=l.memoizedState)),t!==null)return t.dehydrated}return null}c(N1,"getActivityInstanceFromFiber");function l0(l){if(ku(l)!==l)throw Error(z(188))}c(l0,"assertIsMounted");function Md(l){var t=l.alternate;if(!t){if(t=ku(l),t===null)throw Error(z(188));return t!==l?null:l}for(var a=l,u=t;;){var n=a.return;if(n===null)break;var e=n.alternate;if(e===null){if(u=n.return,u!==null){a=u;continue}break}if(n.child===e.child){for(e=n.child;e;){if(e===a)return l0(n),l;if(e===u)return l0(n),t;e=e.sibling}throw Error(z(188))}if(a.return!==u.return)a=n,u=e;else{for(var f=!1,i=n.child;i;){if(i===a){f=!0,a=n,u=e;break}if(i===u){f=!0,u=n,a=e;break}i=i.sibling}if(!f){for(i=e.child;i;){if(i===a){f=!0,a=e,u=n;break}if(i===u){f=!0,u=e,a=n;break}i=i.sibling}if(!f)throw Error(z(189))}}if(a.alternate!==u)throw Error(z(190))}if(a.tag!==3)throw Error(z(188));return a.stateNode.current===a?l:t}c(Md,"findCurrentFiberUsingSlowPath");function H1(l){var t=l.tag;if(t===5||t===26||t===27||t===6)return l;for(l=l.child;l!==null;){if(t=H1(l),t!==null)return t;l=l.sibling}return null}c(H1,"findCurrentHostFiberImpl");var W=Object.assign,Od=Symbol.for("react.element"),Sn=Symbol.for("react.transitional.element"),su=Symbol.for("react.portal"),Ea=Symbol.for("react.fragment"),B1=Symbol.for("react.strict_mode"),Qc=Symbol.for("react.profiler"),q1=Symbol.for("react.consumer"),mt=Symbol.for("react.context"),Hf=Symbol.for("react.forward_ref"),Xc=Symbol.for("react.suspense"),Gc=Symbol.for("react.suspense_list"),Bf=Symbol.for("react.memo"),Mt=Symbol.for("react.lazy"),pc=Symbol.for("react.activity"),Ud=Symbol.for("react.memo_cache_sentinel"),t0=Symbol.iterator;function du(l){return l===null||typeof l!="object"?null:(l=t0&&l[t0]||l["@@iterator"],typeof l=="function"?l:null)}c(du,"getIteratorFn");var Dd=Symbol.for("react.client.reference");function Cc(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Dd?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case Ea:return"Fragment";case Qc:return"Profiler";case B1:return"StrictMode";case Xc:return"Suspense";case Gc:return"SuspenseList";case pc:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case su:return"Portal";case mt:return l.displayName||"Context";case q1:return(l._context.displayName||"Context")+".Consumer";case Hf:var t=l.render;return l=l.displayName,l||(l=t.displayName||t.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case Bf:return t=l.displayName||null,t!==null?t:Cc(l.type)||"Memo";case Mt:t=l._payload,l=l._init;try{return Cc(l(t))}catch{}}return null}c(Cc,"getComponentNameFromType");var zu=Array.isArray,_=U1.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,p=Ed.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,la={pending:!1,data:null,method:null,action:null},Rc=[],Ma=-1;function Il(l){return{current:l}}c(Il,"createCursor");function il(l){0>Ma||(l.current=Rc[Ma],Rc[Ma]=null,Ma--)}c(il,"pop");function L(l,t){Ma++,Rc[Ma]=l.current,l.current=t}c(L,"push");var rl=Il(null),pu=Il(null),Xt=Il(null),wn=Il(null);function Fn(l,t){switch(L(Xt,t),L(pu,l),L(rl,null),t.nodeType){case 9:case 11:l=(l=t.documentElement)&&(l=l.namespaceURI)?i1(l):0;break;default:if(l=t.tagName,t=t.namespaceURI)t=i1(t),l=rv(t,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}il(rl),L(rl,l)}c(Fn,"pushHostContainer");function ja(){il(rl),il(pu),il(Xt)}c(ja,"popHostContainer");function Zc(l){l.memoizedState!==null&&L(wn,l);var t=rl.current,a=rv(t,l.type);t!==a&&(L(pu,l),L(rl,a))}c(Zc,"pushHostContext");function $n(l){pu.current===l&&(il(rl),il(pu)),wn.current===l&&(il(wn),wu._currentValue=la)}c($n,"popHostContext");var lc,a0;function kt(l){if(lc===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);lc=t&&t[1]||"",a0=-1<a.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+lc+l+a0}c(kt,"describeBuiltInComponentFrame");var tc=!1;function ac(l,t){if(!l||tc)return"";tc=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:c(function(){try{if(t){var b=c(function(){throw Error()},"Fake");if(Object.defineProperty(b.prototype,"props",{set:c(function(){throw Error()},"set")}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(o){var S=o}Reflect.construct(l,[],b)}else{try{b.call()}catch(o){S=o}l.call(b.prototype)}}else{try{throw Error()}catch(o){S=o}(b=l())&&typeof b.catch=="function"&&b.catch(function(){})}}catch(o){if(o&&S&&typeof o.stack=="string")return[o.stack,S.stack]}return[null,null]},"DetermineComponentFrameRoot")};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var e=u.DetermineComponentFrameRoot(),f=e[0],i=e[1];if(f&&i){var m=f.split(`
|
|
4
4
|
`),y=i.split(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/studio",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.138",
|
|
4
4
|
"description": "The Lunora Studio: a local admin UI for your schema, data, logs, and advisors",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin-ui",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
],
|
|
34
34
|
"type": "module",
|
|
35
35
|
"sideEffects": false,
|
|
36
|
-
"module": "./dist/index.
|
|
36
|
+
"module": "./dist/index.mjs",
|
|
37
37
|
"types": "./dist/index.d.ts",
|
|
38
38
|
"exports": {
|
|
39
39
|
".": {
|
|
40
40
|
"types": "./dist/index.d.ts",
|
|
41
|
-
"import": "./dist/index.
|
|
41
|
+
"import": "./dist/index.mjs"
|
|
42
42
|
},
|
|
43
43
|
"./mount": {
|
|
44
44
|
"types": "./dist/mount.d.ts",
|
|
45
|
-
"import": "./dist/mount.
|
|
45
|
+
"import": "./dist/mount.mjs"
|
|
46
46
|
},
|
|
47
47
|
"./styles.css": "./dist/styles.css",
|
|
48
48
|
"./standalone/studio.js": "./dist/standalone/studio.js",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"@hugeicons/react": "^1.1.9",
|
|
59
59
|
"@lingui/core": "^6.6.0",
|
|
60
60
|
"@lingui/message-utils": "^6.6.0",
|
|
61
|
-
"@lunora/advisor": "1.0.0-alpha.
|
|
62
|
-
"@lunora/bindings": "1.0.0-alpha.
|
|
63
|
-
"@lunora/client": "1.0.0-alpha.
|
|
64
|
-
"@lunora/errors": "1.0.0-alpha.
|
|
65
|
-
"@lunora/react": "1.0.0-alpha.
|
|
61
|
+
"@lunora/advisor": "1.0.0-alpha.99",
|
|
62
|
+
"@lunora/bindings": "1.0.0-alpha.42",
|
|
63
|
+
"@lunora/client": "1.0.0-alpha.64",
|
|
64
|
+
"@lunora/errors": "1.0.0-alpha.26",
|
|
65
|
+
"@lunora/react": "1.0.0-alpha.69",
|
|
66
66
|
"@tanstack/react-query": "^5.101.4",
|
|
67
67
|
"@tanstack/react-router": "^1.170.25",
|
|
68
68
|
"@tanstack/react-table": "^8.21.3",
|
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
"tailwind-merge": "^3.6.0"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
|
+
"@lunora/mail": ">=1.0.0-alpha.53 <2.0.0-0",
|
|
80
|
+
"@lunora/runtime": ">=1.0.0-alpha.78 <2.0.0-0",
|
|
79
81
|
"react": "^19.2.7",
|
|
80
82
|
"react-dom": "^19.2.7"
|
|
81
83
|
},
|
package/dist/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{StudioApp as r}from"./packem_shared/StudioApp-BZP_0E2n.js";import{CommandPalette as a,openCommandPalette as f}from"./packem_shared/CommandPalette-HqiXrWIm.js";import{S as m}from"./packem_shared/studio-CXai1O2K.js";import{ConfirmButton as l}from"./packem_shared/ConfirmButton-Cj2SOapE.js";import{default as s}from"./packem_shared/ConnectionBadge-Bh16X9-u.js";import{ErrorBoundary as d}from"./packem_shared/ErrorBoundary-BWNF98VF.js";import{ShardInput as P}from"./packem_shared/ShardInput-CdawpUiS.js";import{default as A}from"./packem_chunks/AdvisorHealthPanel.js";import{DEFAULT_INSIGHT_THRESHOLDS as I,deriveInsights as T}from"./packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{InsightsPanel as g}from"./packem_chunks/InsightsPanel.js";import{default as F}from"./packem_chunks/SecurityAdvisorPanel.js";import{default as h}from"./packem_shared/ApiDocsPanel-Du1L7Ysj.js";import{default as C}from"./packem_shared/ApiReferencePanel-uGgGOBYj.js";import{default as O}from"./packem_chunks/ApiTab.js";import{default as N}from"./packem_shared/OpenRpcReferencePanel-DgrpASYD.js";import{DataBrowser as U}from"./packem_shared/DataBrowser-W5TxvLB8.js";import{DataFilters as b,toFilterClauses as v}from"./packem_shared/DataFilters-3nbW0uax.js";import{GlobalDataBrowser as y}from"./packem_shared/GlobalDataBrowser-LFznuyGe.js";import{TableEditor as q}from"./packem_chunks/TableEditor.js";import{ExportImportPanel as V}from"./packem_chunks/ExportImportPanel.js";import{MigrationsPanel as j}from"./packem_shared/MigrationsPanel-BDNt136v.js";import{PitrPanel as z}from"./packem_chunks/PitrPanel.js";import{FunctionRunner as Q}from"./packem_chunks/FunctionRunner.js";import{FunctionStatsPanel as Y}from"./packem_chunks/FunctionStatsPanel.js";import{DeploymentHealthPanel as $}from"./packem_chunks/DeploymentHealthPanel.js";import{H as oe}from"./packem_shared/home-panel-DHOa3sxt.js";import{AuditPanel as te}from"./packem_chunks/AuditPanel.js";import{LogsPanel as fe}from"./packem_chunks/LogsPanel.js";import{MailPanel as me}from"./packem_chunks/MailPanel.js";import{ScheduledJobs as le}from"./packem_shared/ScheduledJobs-CiO3eXgI.js";import{default as se}from"./packem_chunks/NotificationsPanel.js";import{HealthPanel as de}from"./packem_chunks/HealthPanel.js";import{aggregateMetrics as Pe,shardsToAggregate as Se}from"./packem_shared/aggregateMetrics-A-Y7OH6R.js";import{MetricsPanel as ce}from"./packem_chunks/MetricsPanel.js";import{SchemaViewer as Te}from"./packem_chunks/SchemaViewer.js";import{SettingsPanel as ge}from"./packem_chunks/SettingsPanel.js";import{SqlEditorPanel as Fe}from"./packem_chunks/SqlEditorPanel.js";import{FileBrowser as he}from"./packem_chunks/FileBrowser.js";import{DEFAULT_AUTO_REFRESH_MS as Ce,useAutoRefresh as He}from"./packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{default as Le}from"./packem_shared/useDebounced-DVeQ5-oW.js";import{DEFAULT_LOCALE as Me,createStudioI18n as Ue,studioI18n as Be,useT as be}from"./packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{StudioI18nProvider as we}from"./packem_shared/StudioI18nProvider-Bl547evf.js";import{ADMIN_FUNCTIONS as Ge,ADMIN_FUNCTION_PREFIX as qe}from"./packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{default as Ve}from"./packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js";export{Ge as ADMIN_FUNCTIONS,qe as ADMIN_FUNCTION_PREFIX,A as AdvisorHealthPanel,h as ApiDocsPanel,C as ApiReferencePanel,O as ApiTab,te as AuditPanel,a as CommandPalette,l as ConfirmButton,s as ConnectionBadge,Ce as DEFAULT_AUTO_REFRESH_MS,I as DEFAULT_INSIGHT_THRESHOLDS,Me as DEFAULT_LOCALE,U as DataBrowser,b as DataFilters,$ as DeploymentHealthPanel,d as ErrorBoundary,V as ExportImportPanel,he as FileBrowser,Q as FunctionRunner,Y as FunctionStatsPanel,y as GlobalDataBrowser,de as HealthPanel,oe as HomePanel,g as InsightsPanel,fe as LogsPanel,me as MailPanel,ce as MetricsPanel,j as MigrationsPanel,se as NotificationsPanel,N as OpenRpcReferencePanel,z as PitrPanel,Ve as STUDIO_ROOT_CLASS,le as ScheduledJobs,Te as SchemaViewer,F as SecurityAdvisorPanel,ge as SettingsPanel,P as ShardInput,Fe as SqlEditorPanel,m as Studio,r as StudioApp,we as StudioI18nProvider,q as TableEditor,Pe as aggregateMetrics,Ue as createStudioI18n,T as deriveInsights,f as openCommandPalette,Se as shardsToAggregate,Be as studioI18n,v as toFilterClauses,He as useAutoRefresh,Le as useDebounced,be as useT};
|
package/dist/mount.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as s}from"@lunora/errors";import{createRoot as a}from"react-dom/client";import{StudioApp as l}from"./packem_shared/StudioApp-BZP_0E2n.js";import{jsx as i}from"react/jsx-runtime";const c=(n={})=>{const{container:t="#root",...o}=n,e=typeof t=="string"?document.querySelector(t):t;if(e===null)throw new s("INTERNAL",`mountStudio: container ${typeof t=="string"?t:"element"} not found`);const r=a(e);return r.render(i(l,{adminToken:o.adminToken,basePath:o.basePath,baseUrl:o.baseUrl,locale:o.locale,rulesInstalled:o.rulesInstalled,studio:o.studio})),r};export{c as mountStudio};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{scoreAdvisor as T}from"@lunora/advisor";import{E as A}from"../packem_shared/error-alert-TYdKetJd.js";import{C as c,a as o}from"../packem_shared/card-BGlQzQY-.js";import{T as j,a as R,b as f,c as i,d as $,e as m}from"../packem_shared/table-BMsuYFhk.js";import{u as v}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as C}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as N}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{c as u}from"../packem_shared/utils-bhneXptQ.js";import{jsx as e,jsxs as r}from"react/jsx-runtime";const n={clean:"text-emerald-600 dark:text-emerald-400",exempt:"text-muted-foreground",failing:"text-red-600 dark:text-red-400",warned:"text-amber-600 dark:text-amber-400"},b={"at-risk":"text-red-600 dark:text-red-400",excellent:"text-emerald-600 dark:text-emerald-400",good:"text-emerald-600 dark:text-emerald-400","needs-work":"text-amber-600 dark:text-amber-400"},E=(s,a)=>`exempt: ${s.exemptReason===void 0||s.exemptReason===""?a:s.exemptReason}`,S=s=>s.toSorted((a,l)=>a.coverage==="clean"&&l.coverage!=="clean"?1:l.coverage==="clean"&&a.coverage!=="clean"?-1:a.score-l.score),Y=({testId:s="advisor-health"})=>{const a=C(),l=v(N.getAdvisories,{},{live:!0}),x=v(N.getAdvisorProcedures,{},{live:!0}),p=l.data?.advisories??null,h=x.data?.procedures??null,t=p===null||h===null?null:T(h,p),g=x.error??l.error;if(g!==null)return e(A,{error:g,testId:`${s}-error`});if(t===null)return e(c,{children:e(o,{className:"py-8 text-center text-muted-foreground","data-testid":`${s}-loading`,children:a("Loading…")})});const k=S(t.procedures);return r("div",{className:"space-y-4","data-testid":s,children:[e(c,{children:r(o,{className:"flex flex-wrap items-baseline gap-x-6 gap-y-2 py-6",children:[r("div",{children:[e("span",{className:u("text-4xl font-semibold tabular-nums",b[t.grade]),"data-testid":`${s}-score`,children:t.score}),e("span",{className:"text-muted-foreground text-lg",children:"/100"})]}),e("span",{className:u("text-sm font-medium uppercase tracking-wide",b[t.grade]),"data-testid":`${s}-grade`,children:t.grade}),r("div",{className:"text-muted-foreground flex gap-4 text-sm tabular-nums","data-testid":`${s}-summary`,children:[r("span",{className:n.clean,children:[t.summary.clean," ",a("clean")]}),r("span",{className:n.warned,children:[t.summary.warned," ",a("warned")]}),r("span",{className:n.failing,children:[t.summary.failing," ",a("failing")]}),r("span",{className:n.exempt,children:[t.summary.exempt," ",a("exempt")]})]})]})}),t.project.checks.length>0&&e(c,{children:r(o,{className:"py-4 text-sm","data-testid":`${s}-project`,children:[r("span",{className:"font-medium",children:[a("Schema & config")," ",t.project.score,"/100"]}),r("span",{className:"text-muted-foreground",children:[" — ",t.project.checks.map(d=>d.name).join(", ")]})]})}),e(c,{children:e(o,{className:"p-0",children:r(j,{children:[e(R,{children:r(f,{children:[e(i,{className:"w-20",children:a("Score")}),e(i,{children:a("Procedure")}),e(i,{className:"w-32",children:a("Kind")}),e(i,{children:a("Rules fired")})]})}),e($,{children:k.map(d=>r(f,{"data-testid":`${s}-row`,children:[e(m,{className:u("tabular-nums font-medium",n[d.coverage]),children:d.coverage==="exempt"?"—":d.score}),e(m,{className:"font-mono text-xs",children:d.id}),r(m,{className:"text-muted-foreground text-xs",children:[d.visibility," ",d.kind,d.sensitivity.level==="high"&&e("span",{className:"ml-1 text-amber-600 dark:text-amber-400",children:a("sensitive")})]}),e(m,{className:"text-muted-foreground text-xs",children:d.coverage==="exempt"?E(d,a("no reason given")):d.checks.map(w=>w.name).join(", ")})]},d.id))})]})})})]})};export{Y as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as L}from"react/compiler-runtime";import{useState as F}from"react";import{B as K}from"../packem_shared/button-BOPLD1un.js";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import D from"../packem_shared/ApiDocsPanel-Du1L7Ysj.js";import M from"../packem_shared/ApiReferencePanel-uGgGOBYj.js";import W from"../packem_shared/OpenRpcReferencePanel-DgrpASYD.js";import{jsx as r,jsxs as E}from"react/jsx-runtime";const _=["reference","snippets"],q=["openapi","openrpc"],k=V=>{const e=L(51),{functions:R,initialShardKey:N,openApiSpec:T,openRpcSpec:I}=V,t=Y(),[i,$]=F("reference"),[a,j]=F("openapi");let s;e[0]!==t?(s=t("Reference"),e[0]=t,e[1]=s):s=e[1];let o;e[2]!==t?(o=t("Snippets"),e[2]=t,e[3]=o):o=e[3];let w;e[4]!==s||e[5]!==o?(w={reference:s,snippets:o},e[4]=s,e[5]=o,e[6]=w):w=e[6];const O=w;let n;e[7]!==t?(n=t("OpenAPI"),e[7]=t,e[8]=n):n=e[8];let c;e[9]!==t?(c=t("OpenRPC"),e[9]=t,e[10]=c):c=e[10];let g;e[11]!==n||e[12]!==c?(g={openapi:n,openrpc:c},e[11]=n,e[12]=c,e[13]=g):g=e[13];const C=g;let S;e[14]===Symbol.for("react.memo_cache_sentinel")?(S=l=>{$(l.currentTarget.dataset.view)},e[14]=S):S=e[14];const z=S;let A;e[15]===Symbol.for("react.memo_cache_sentinel")?(A=l=>{j(l.currentTarget.dataset.format)},e[15]=A):A=e[15];const B=A;let p;e[16]!==t?(p=t("API view"),e[16]=t,e[17]=p):p=e[17];let f;e[18]!==i||e[19]!==O?(f=_.map(l=>r(K,{"aria-selected":i===l,"data-testid":`api-view-${l}`,"data-view":l,onClick:z,role:"tab",size:"sm",type:"button",variant:i===l?"default":"outline",children:O[l]},l)),e[18]=i,e[19]=O,e[20]=f):f=e[20];let m;e[21]!==f||e[22]!==p?(m=r("div",{"aria-label":p,className:"flex gap-1.5","data-testid":"api-view-toggle",role:"tablist",children:f}),e[21]=f,e[22]=p,e[23]=m):m=e[23];let d;e[24]!==a||e[25]!==C||e[26]!==t||e[27]!==i?(d=i==="reference"&&r("div",{"aria-label":t("API spec format"),className:"flex gap-1.5","data-testid":"api-format-toggle",role:"tablist",children:q.map(l=>r(K,{"aria-selected":a===l,"data-format":l,"data-testid":`api-format-${l}`,onClick:B,role:"tab",size:"sm",type:"button",variant:a===l?"default":"outline",children:C[l]},l))}),e[24]=a,e[25]=C,e[26]=t,e[27]=i,e[28]=d):d=e[28];let b;e[29]!==m||e[30]!==d?(b=E("div",{className:"flex shrink-0 flex-wrap items-center gap-3 border-b border-border px-6 py-3",children:[m,d]}),e[29]=m,e[30]=d,e[31]=b):b=e[31];let v;e[32]!==R||e[33]!==N||e[34]!==i?(v=i==="snippets"&&r("div",{className:"min-h-0 flex-1 overflow-y-auto p-6",children:r(D,{functions:R,initialShardKey:N})}),e[32]=R,e[33]=N,e[34]=i,e[35]=v):v=e[35];let h;e[36]!==a||e[37]!==T||e[38]!==i?(h=i==="reference"&&a==="openapi"&&r(M,{spec:T}),e[36]=a,e[37]=T,e[38]=i,e[39]=h):h=e[39];let u;e[40]!==a||e[41]!==I||e[42]!==i?(u=i==="reference"&&a==="openrpc"&&r(W,{spec:I}),e[40]=a,e[41]=I,e[42]=i,e[43]=u):u=e[43];let x;e[44]!==v||e[45]!==h||e[46]!==u?(x=E("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[v,h,u]}),e[44]=v,e[45]=h,e[46]=u,e[47]=x):x=e[47];let P;return e[48]!==b||e[49]!==x?(P=E("div",{className:"flex min-h-0 flex-1 flex-col","data-testid":"lunora-api-tab",children:[b,x]}),e[48]=b,e[49]=x,e[50]=P):P=e[50],P};export{k as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useVirtualizer as z,observeElementRect as B}from"@tanstack/react-virtual";import{useState as K,useMemo as N,useRef as V}from"react";import{E as j}from"../packem_shared/error-alert-TYdKetJd.js";import{L as k}from"../packem_shared/live-status-Bf7rR8o8.js";import{ShardInput as D}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as U}from"../packem_shared/badge-cAk9Di1Q.js";import{C as q,a as F}from"../packem_shared/card-BGlQzQY-.js";import{E as G}from"../packem_shared/empty-state-B939z6K2.js";import{I as W}from"../packem_shared/input-CY5W3wzv.js";import{T as J,a as P,b,c as s,d as Q,e as l}from"../packem_shared/table-BMsuYFhk.js";import{u as X}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as Z}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as $}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as Y}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as ee}from"../packem_shared/internal-CwaF9YNk.js";import{jsxs as i,jsx as e}from"react/jsx-runtime";const w=80,te=o=>{if(o===void 0)return"";const t=JSON.stringify(o);return t.length>w?`${t.slice(0,w)}…`:t},re=41,y=480,C=5,ae=(o,t)=>B(o,n=>{t(n.height>0?n:{height:y,width:n.width})}),Ne=({initialShardKey:o})=>{const t=$(),{queryShardKey:n,setShardKey:T,shardKey:L}=Z(o),[c,E]=K(""),{data:u,error:p,errorSource:I,isLoading:R,liveError:A}=X(Y.getAuditLog,{},{live:!0,shardKey:n}),m=N(()=>u?.entries??[],[u]),d=N(()=>{const a=c.trim().toLowerCase();return a===""?m:m.filter(r=>r.op.toLowerCase().includes(a)||(r.table??"").toLowerCase().includes(a)||(r.id??"").toLowerCase().includes(a))},[m,c]),f=V(null),g=z({count:d.length,estimateSize:()=>re,getScrollElement:()=>f.current,initialRect:{height:y,width:800},observeElementRect:ae,overscan:8}),h=g.getVirtualItems(),H=g.getTotalSize(),v=h[0]?.start??0,x=H-(h.at(-1)?.end??0),M={height:v},O={height:x},_=a=>{E(a.target.value)};return i("div",{className:"flex flex-col gap-4","data-testid":"lunora-audit",children:[i("div",{className:"flex flex-wrap items-center gap-2",children:[e(D,{onChange:T,testId:"au-shard-input",value:L}),e(k,{message:A,prefix:"au"}),e(W,{"aria-label":t("Filter audit log"),className:"h-8 w-48","data-testid":"au-search",onChange:_,placeholder:t("filter op, table, id"),value:c})]}),p!==null&&e(j,{error:I,testId:"au-error"}),p===null&&!R&&d.length===0&&e(G,{description:t("State-changing admin operations are recorded here."),icon:e("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:e("path",{d:"M8 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2h-2M9 3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V3Zm-1 9h8m-8 4h5"})}),testId:"au-empty",title:t("No audit entries.")}),d.length>0&&e(q,{className:"overflow-hidden py-0",children:e(F,{className:"max-h-[30rem] overflow-auto px-0",ref:f,children:i(J,{"data-testid":"au-table",children:[e(P,{children:i(b,{children:[e(s,{children:t("time")}),e(s,{children:t("op")}),e(s,{children:t("table")}),e(s,{children:t("id")}),e(s,{children:t("detail")})]})}),i(Q,{children:[v>0&&e("tr",{"aria-hidden":"true",children:e("td",{colSpan:C,style:M})}),h.map(a=>{const r=d[a.index],S=te(r.detail);return i(b,{"data-testid":"au-row",children:[e(l,{className:"text-muted-foreground tabular-nums",children:ee(r.ts,"—")}),e(l,{children:e(U,{variant:"secondary",children:r.op})}),e(l,{className:"font-medium",children:r.table??e("span",{className:"text-muted-foreground",children:"—"})}),e(l,{className:"max-w-[20ch] truncate font-mono text-xs",children:r.id??e("span",{className:"text-muted-foreground",children:"—"})}),e(l,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:S||void 0,children:S||e("span",{className:"text-muted-foreground",children:"—"})})]},r.seq)}),x>0&&e("tr",{"aria-hidden":"true",children:e("td",{colSpan:C,style:O})})]})]})})})]})};export{Ne as AuditPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as ee}from"react/compiler-runtime";import{useLunora as te}from"@lunora/react";import{useQuery as re}from"@tanstack/react-query";import{B as M}from"../packem_shared/badge-cAk9Di1Q.js";import{C as J}from"../packem_shared/card-BGlQzQY-.js";import{E as ne}from"../packem_shared/empty-state-B939z6K2.js";import{S as X}from"../packem_shared/skeleton-DFBBaJU6.js";import{useT as ie}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{i as oe}from"../packem_shared/internal-CwaF9YNk.js";import{c as se}from"../packem_shared/utils-bhneXptQ.js";import{jsxs as p,jsx as a}from"react/jsx-runtime";const de="/_lunora/health",ce="/_lunora/health/ready",me=(r,e)=>(r.endsWith("/")?r.slice(0,-1):r)+e,pe=()=>{const r=te();return async e=>{const w=e==="ready"?ce:de,t=r.getAuthToken(),y=me(r.url,w);try{const i=await fetch(y,{headers:t===null?{}:{authorization:`Bearer ${t}`}});let u=null;try{u=await i.json()}catch{u=null}return{body:u,ok:i.ok,status:i.status}}catch(i){return{body:null,error:i instanceof Error?i.message:String(i),ok:!1,status:0}}}},ue={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},fe=r=>r==="unhealthy"?"crit":r==="degraded"?"warn":"ok",Z=r=>{const e=ee(13),{label:w,level:t,testId:y,value:i}=r,u=ue[t];let o;e[0]!==u?(o=se("size-1.5 shrink-0 rounded-full",u),e[0]=u,e[1]=o):o=e[1];let d;e[2]!==o?(d=a("span",{"aria-hidden":"true",className:o}),e[2]=o,e[3]=d):d=e[3];let c;e[4]!==w||e[5]!==d?(c=p("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[d,w]}),e[4]=w,e[5]=d,e[6]=c):c=e[6];let f;e[7]!==y||e[8]!==i?(f=a("span",{className:"text-lg font-semibold text-foreground","data-testid":y,children:i}),e[7]=y,e[8]=i,e[9]=f):f=e[9];let H;return e[10]!==c||e[11]!==f?(H=a(J,{className:"gap-0 py-0",children:p("div",{className:"flex flex-col gap-2.5 p-4",children:[c,f]})}),e[10]=c,e[11]=f,e[12]=H):H=e[12],H},Pe=r=>{const e=ee(107),{probe:w}=r,t=ie(),y=te(),i=pe(),u=w??i;let o;e[0]!==u?(o=async()=>{const[s,n]=await Promise.all([u("live"),u("ready")]);return{live:s,ready:n}},e[0]=u,e[1]=o):o=e[1];let d;e[2]!==y?(d=y.clientIdentifier(),e[2]=y,e[3]=d):d=e[3];let c;e[4]!==d?(c=["deployment-health",d],e[4]=d,e[5]=c):c=e[5];let f;e[6]!==o||e[7]!==c?(f={queryFn:o,queryKey:c},e[6]=o,e[7]=c,e[8]=f):f=e[8];const{data:H,isPending:le}=re(f),K=H?.live??null,ae=H?.ready??null;if(le){let s;return e[9]===Symbol.for("react.memo_cache_sentinel")?(s=p("div",{className:"flex flex-col gap-4","data-testid":"deployment-health-loading",children:[a(X,{className:"h-16 w-full"}),a(X,{className:"h-40 w-full"})]}),e[9]=s):s=e[9],s}const l=K?.body??null;if(l===null){const s=K?.status===403;let n;e[10]!==s||e[11]!==K?.error||e[12]!==t?(n=s?t("The health endpoint is in the admin posture. Paste a valid admin token in the connect popover, or set its auth to public."):t("Couldn't reach the health endpoint: {message}",{message:K?.error??t("no response")}),e[10]=s,e[11]=K?.error,e[12]=t,e[13]=n):n=e[13];let m;e[14]!==t?(m=t("Health endpoint unavailable"),e[14]=t,e[15]=m):m=e[15];let g;return e[16]!==n||e[17]!==m?(g=a(ne,{description:n,testId:"deployment-health-error",title:m}),e[16]=n,e[17]=m,e[18]=g):g=e[18],g}let Y;e[19]!==l.status?(Y=fe(l.status),e[19]=l.status,e[20]=Y):Y=e[20];const Q=Y;let h;if(l.status==="unhealthy"){let s;e[21]!==t?(s=t("Unhealthy"),e[21]=t,e[22]=s):s=e[22],h=s}else if(l.status==="degraded"){let s;e[23]!==t?(s=t("Degraded"),e[23]=t,e[24]=s):s=e[24],h=s}else{let s;e[25]!==t?(s=t("Healthy"),e[25]=t,e[26]=s):s=e[26],h=s}const T=ae?.ok??!1,W=T?"ok":"crit";let L,P,_,N,v,b,C,E,k,S;if(e[27]!==l.appName||e[28]!==l.appVersion||e[29]!==l.checks||e[30]!==l.timestamp||e[31]!==Q||e[32]!==W||e[33]!==T||e[34]!==h||e[35]!==t){const s=[...l.checks].toSorted(he);P="flex flex-col gap-6",_="deployment-health";let n;e[46]!==t?(n=t("Live liveness, readiness, and per-binding health from the deployment's /_lunora/health endpoint — wire an uptime monitor or a Cloudflare Health Check at it."),e[46]=t,e[47]=n):n=e[47],e[48]!==n?(N=a("p",{className:"text-sm text-muted-foreground",children:n}),e[48]=n,e[49]=N):N=e[49];let m;e[50]!==h?(m=a("span",{className:"text-sm font-semibold text-foreground","data-testid":"dh-status",children:h}),e[50]=h,e[51]=m):m=e[51];let g;e[52]!==l.appName||e[53]!==l.appVersion?(g=p("span",{className:"font-mono text-[13px] text-muted-foreground","data-testid":"dh-app",children:[l.appName," · ",l.appVersion]}),e[52]=l.appName,e[53]=l.appVersion,e[54]=g):g=e[54];let A;e[55]!==m||e[56]!==g?(A=a("div",{className:"flex items-center gap-3",children:p("div",{className:"grid leading-tight",children:[m,g]})}),e[55]=m,e[56]=g,e[57]=A):A=e[57];let D;e[58]!==t?(D=t("Checked"),e[58]=t,e[59]=D):D=e[59];let V;e[60]!==D?(V=a("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:D}),e[60]=D,e[61]=V):V=e[61];let I;e[62]!==l.timestamp?(I=oe(l.timestamp),e[62]=l.timestamp,e[63]=I):I=e[63];let R;e[64]!==I?(R=a("time",{className:"text-[13px] text-muted-foreground","data-testid":"dh-timestamp",children:I}),e[64]=I,e[65]=R):R=e[65];let $;e[66]!==V||e[67]!==R?($=p("div",{className:"text-end",children:[V,R]}),e[66]=V,e[67]=R,e[68]=$):$=e[68],e[69]!==A||e[70]!==$?(v=a(J,{className:"gap-0 py-0",children:p("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[A,$]})}),e[69]=A,e[70]=$,e[71]=v):v=e[71];let z;e[72]!==t?(z=t("Liveness"),e[72]=t,e[73]=z):z=e[73];let B;e[74]!==Q||e[75]!==h||e[76]!==z?(B=a(Z,{label:z,level:Q,testId:"dh-liveness",value:h}),e[74]=Q,e[75]=h,e[76]=z,e[77]=B):B=e[77];let U;e[78]!==t?(U=t("Readiness"),e[78]=t,e[79]=U):U=e[79];let q;e[80]!==T||e[81]!==t?(q=t(T?"Ready":"Not ready"),e[80]=T,e[81]=t,e[82]=q):q=e[82];let O;e[83]!==W||e[84]!==U||e[85]!==q?(O=a(Z,{label:U,level:W,testId:"dh-readiness",value:q}),e[83]=W,e[84]=U,e[85]=q,e[86]=O):O=e[86],e[87]!==B||e[88]!==O?(b=p("div",{className:"grid gap-3 sm:grid-cols-2","data-testid":"dh-probes",children:[B,O]}),e[87]=B,e[88]=O,e[89]=b):b=e[89],L=J,C="gap-0 py-0",E="dh-checks";let F;e[90]!==t?(F=t("Subsystem checks"),e[90]=t,e[91]=F):F=e[91],e[92]!==F?(k=a("header",{className:"border-b border-border px-4 py-3",children:a("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:F})}),e[92]=F,e[93]=k):k=e[93],S=s.length===0?a("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"dh-checks-empty",children:t("No checks reported.")}):a("ul",{className:"divide-y divide-border",children:s.map(x=>p("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs","data-testid":`dh-check-${x.name}`,children:[p("span",{className:"flex items-center gap-2",children:[a("span",{"aria-hidden":"true",className:se("size-1.5 shrink-0 rounded-full",x.status==="up"?"bg-success":"bg-destructive")}),a("span",{className:"font-mono text-foreground",children:x.name}),x.critical&&a(M,{variant:"outline",children:t("Critical")})]}),p("span",{className:"flex shrink-0 items-center gap-2",children:[x.message!==void 0&&a("span",{className:"text-muted-foreground",children:x.message}),a(M,{"data-testid":`dh-check-status-${x.name}`,variant:x.status==="up"?"secondary":"destructive",children:x.status==="up"?t("Up"):t("Down")})]})]},x.name))}),e[27]=l.appName,e[28]=l.appVersion,e[29]=l.checks,e[30]=l.timestamp,e[31]=Q,e[32]=W,e[33]=T,e[34]=h,e[35]=t,e[36]=L,e[37]=P,e[38]=_,e[39]=N,e[40]=v,e[41]=b,e[42]=C,e[43]=E,e[44]=k,e[45]=S}else L=e[36],P=e[37],_=e[38],N=e[39],v=e[40],b=e[41],C=e[42],E=e[43],k=e[44],S=e[45];let j;e[94]!==L||e[95]!==C||e[96]!==E||e[97]!==k||e[98]!==S?(j=p(L,{className:C,"data-testid":E,children:[k,S]}),e[94]=L,e[95]=C,e[96]=E,e[97]=k,e[98]=S,e[99]=j):j=e[99];let G;return e[100]!==P||e[101]!==_||e[102]!==N||e[103]!==v||e[104]!==b||e[105]!==j?(G=p("div",{className:P,"data-testid":_,children:[N,v,b,j]}),e[100]=P,e[101]=_,e[102]=N,e[103]=v,e[104]=b,e[105]=j,e[106]=G):G=e[106],G};function he(r,e){return r.name.localeCompare(e.name)}export{Pe as DeploymentHealthPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useLunora as X}from"@lunora/react";import{useState as i,useEffect as Y}from"react";import{ShardInput as G}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as E}from"../packem_shared/badge-cAk9Di1Q.js";import{B as N}from"../packem_shared/button-BOPLD1un.js";import{I as Q}from"../packem_shared/input-CY5W3wzv.js";import{L as y}from"../packem_shared/label-BOUo-DP0.js";import{T as W}from"../packem_shared/textarea-DpO3i-Qo.js";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as _}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{b as ee,i as te,f as re,k as se,c as ae}from"../packem_shared/internal-CwaF9YNk.js";import{r as ne}from"../packem_shared/shard-history-DU5b3QDI.js";import{jsxs as n,jsx as r}from"react/jsx-runtime";const oe=t=>t.kind==="id"?t.table===void 0?"id":`id<${t.table}>`:t.kind==="array"?t.element===void 0?"array":`${t.element}[]`:t.kind,ie=t=>t===void 0||t.length===0?"()":`(${t.map(o=>`${o.name}${o.optional?"?":""}: ${oe(o)}`).join(", ")})`,de=t=>{switch(t){case"array":return[];case"bigint":case"number":return 0;case"boolean":return!1;case"object":case"record":return{};default:return""}},le=t=>{const o={};for(const s of t??[])s.optional||(o[s.name]=de(s.kind));return JSON.stringify(o,void 0,2)},ce=ae(_.runAs),ue=10,me=t=>t===void 0?"undefined":JSON.stringify(t,null,2),Ae=({functions:t,runAsIdentity:o=!1}={})=>{const s=Z(),u=X(),[L,j]=i(null),[S,B]=i(null),p=t??L??[],[w,R]=i(""),[m,g]=i("{}"),[c,k]=i(""),[f,D]=i(""),[x,h]=i("idle"),[K,b]=i(void 0),[I,v]=i(null),[A,U]=i([]);Y(()=>{if(t!==void 0)return;let e=!1;return u.listFunctions().then(d=>(e||j(d),d)).catch(d=>{e||B(ee(d))}),()=>{e=!0}},[u,t]);const C=w===""?p[0]?.path??"":w,a=p.find(e=>e.path===C),J=async()=>{if(!a)return;let e;try{e=m.trim()===""?{}:JSON.parse(m)}catch(l){h("error"),b(void 0),v(s("Invalid JSON args: {message}",{message:l.message}));return}const d={__lunoraRef:a.path},T=c.trim()===""?{}:{shardKey:c.trim()},F=o?f.trim():"",$=l=>{U(O=>[{argsText:m,at:Date.now(),id:(O[0]?.id??0)+1,kind:a.kind,path:a.path,shardKey:c,status:l},...O].slice(0,ue))};h("running"),v(null);try{const l=F===""?await se(u,a.kind,d,e,T):await u.query(ce,{args:e,functionPath:a.path,userId:F},T);ne(c),b(l),h("success"),$("success")}catch(l){b(void 0),v(l.message),h("error"),$("error")}},M=e=>{R(e.path),g(e.argsText),k(e.shardKey)},P=e=>{R(e.target.value)},z=e=>{g(e.target.value)},q=e=>{D(e.target.value)},H=()=>{re(J())},V=()=>{g(le(a?.args))};return n("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-runner",children:[S!==null&&r("p",{className:"text-sm text-destructive","data-testid":"function-discover-error",role:"alert",children:S}),n("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4",children:[n("div",{className:"flex flex-col gap-1.5",children:[r(y,{htmlFor:"function-select",children:s("Function")}),r("select",{"aria-label":s("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50","data-testid":"function-select",id:"function-select",onChange:P,value:C,children:p.map(e=>n("option",{value:e.path,children:[e.path," (",e.kind,")"]},e.path))}),a!==void 0&&n("p",{className:"text-xs text-muted-foreground",children:[r("span",{className:"mr-1.5 font-medium",children:s("Signature")}),r("code",{className:"font-mono","data-testid":"function-signature",children:ie(a.args)})]})]}),n("div",{className:"flex flex-col gap-1.5",children:[n("div",{className:"flex items-center justify-between gap-2",children:[r(y,{htmlFor:"args-input",children:s("Arguments")}),r(N,{"data-testid":"prefill-button",disabled:a===void 0,onClick:V,size:"xs",type:"button",variant:"ghost",children:s("Prefill")})]}),r(W,{"aria-label":s("Arguments"),className:"font-mono text-xs","data-testid":"args-input",id:"args-input",onChange:z,value:m})]}),r(G,{onChange:k,testId:"shard-input",value:c}),o&&n("div",{className:"flex flex-col gap-1.5","data-testid":"run-as-field",children:[r(y,{htmlFor:"run-as-input",children:s("Run as identity (userId)")}),r(Q,{"aria-label":s("Run as identity (userId)"),className:"font-mono text-xs","data-testid":"run-as-input",id:"run-as-input",onChange:q,placeholder:s("Leave empty to run as admin"),value:f}),r("p",{className:"text-[11px] text-muted-foreground",children:s("Dev only: runs the function as this user so you can test auth and RLS. Forged over the admin gate.")})]}),n("div",{className:"flex flex-wrap items-center gap-2",children:[r(N,{"data-testid":"run-button",disabled:x==="running"||a===void 0,onClick:H,type:"button",children:s("Run")}),a!==void 0&&r(E,{variant:"outline",children:a.kind}),o&&f.trim()!==""&&r(E,{"data-testid":"run-as-badge",variant:"secondary",children:s("as {userId}",{userId:f.trim()})})]})]}),x==="error"&&I!==null&&r("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive","data-testid":"error",role:"alert",children:I}),x==="success"&&r("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"result",children:me(K)}),A.length>0&&r("ul",{className:"flex flex-col overflow-hidden rounded-xl border border-border","data-testid":"fn-history",children:A.map((e,d)=>n("li",{className:"flex flex-wrap items-center gap-2 border-b border-border px-3 py-2 text-sm last:border-b-0","data-testid":"fn-history-row",children:[r("span",{className:e.status==="success"?"text-success":"text-destructive","data-testid":`fn-history-status-${d.toString()}`,children:e.status==="success"?"✓":"✗"})," ",n("span",{className:"font-mono text-xs",children:[e.path," (",e.kind,")"]})," ",r("time",{className:"text-xs text-muted-foreground",children:te(e.at)})," ",r(N,{className:"ml-auto","data-testid":`fn-history-load-${d.toString()}`,onClick:()=>{M(e)},size:"xs",type:"button",variant:"ghost",children:s("Load")})]},e.id))})]})};export{Ae as FunctionRunner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as Q}from"react/compiler-runtime";import{useState as U}from"react";import{E as V}from"../packem_shared/error-alert-TYdKetJd.js";import{L as W}from"../packem_shared/live-status-Bf7rR8o8.js";import{ShardInput as G}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as J}from"../packem_shared/badge-cAk9Di1Q.js";import{B as X}from"../packem_shared/button-BOPLD1un.js";import{C as Y,a as Z}from"../packem_shared/card-BGlQzQY-.js";import{E as ee}from"../packem_shared/empty-state-B939z6K2.js";import{T as te,a as re,b as L,c as a,d as le,e as n}from"../packem_shared/table-BMsuYFhk.js";import{u as se}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as ae}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as ne}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as oe}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as ie}from"../packem_shared/internal-CwaF9YNk.js";import{c as j}from"../packem_shared/utils-bhneXptQ.js";import{jsx as t,jsxs as y}from"react/jsx-runtime";const ce={action:"outline",mutation:"default",query:"secondary"},q=r=>r<1e3?`${r<10?r.toFixed(1):Math.round(r).toString()}ms`:`${(r/1e3).toFixed(2)}s`,de=r=>r.calls===0?"—":r.errors===0?"0":`${r.errors.toString()} (${(r.errors/r.calls*100).toFixed(1)}%)`,me=r=>{const e=r.conflicts??0;return r.calls===0?"—":e===0?"0":`${e.toString()} (${(e/r.calls*100).toFixed(1)}%)`},ue={calls:(r,e)=>e.calls-r.calls,recent:(r,e)=>e.lastCalledAt-r.lastCalledAt,slowest:(r,e)=>e.maxDurationMs-r.maxDurationMs},Ae=r=>{const e=Q(47),{functions:I,initialShardKey:P}=r,s=ne(),{queryShardKey:F,setShardKey:N,shardKey:S}=ae(P),[o,H]=U("recent");let M;e[0]===Symbol.for("react.memo_cache_sentinel")?(M={},e[0]=M):M=e[0];let T;e[1]!==F?(T={live:!0,shardKey:F},e[1]=F,e[2]=T):T=e[2];const{data:O,error:i,errorSource:b,liveError:v}=se(oe.getFunctionStats,M,T),k=O?.functions??null;let w;e[3]!==I?(w=new Map((I??[]).map(fe)),e[3]=I,e[4]=w):w=e[4];const _=w;let E;e[5]===Symbol.for("react.memo_cache_sentinel")?(E=C=>{H(C.currentTarget.dataset.sort)},e[5]=E):E=e[5];const z=E;let K;if(e[6]!==i||e[7]!==b||e[8]!==_||e[9]!==v||e[10]!==N||e[11]!==S||e[12]!==o||e[13]!==k||e[14]!==s){const C=k===null?[]:k.toSorted(ue[o]);let c;e[16]!==s?(c=s("Recent"),e[16]=s,e[17]=c):c=e[17];let d;e[18]!==c?(d={key:"recent",label:c},e[18]=c,e[19]=d):d=e[19];let m;e[20]!==s?(m=s("Most called"),e[20]=s,e[21]=m):m=e[21];let u;e[22]!==m?(u={key:"calls",label:m},e[22]=m,e[23]=u):u=e[23];let f;e[24]!==s?(f=s("Slowest"),e[24]=s,e[25]=f):f=e[25];let h;e[26]!==f?(h={key:"slowest",label:f},e[26]=f,e[27]=h):h=e[27];let $;e[28]!==h||e[29]!==d||e[30]!==u?($=[d,u,h],e[28]=h,e[29]=d,e[30]=u,e[31]=$):$=e[31];const D=$;let p;e[32]!==N||e[33]!==S?(p=t(G,{onChange:N,testId:"fs-shard-input",value:S}),e[32]=N,e[33]=S,e[34]=p):p=e[34];let x;e[35]!==v?(x=t(W,{message:v,prefix:"fs"}),e[35]=v,e[36]=x):x=e[36];let g;e[37]!==D||e[38]!==o?(g=t("div",{className:"ml-auto flex items-center gap-1",role:"group",children:D.map(l=>t(X,{"data-sort":l.key,"data-testid":`fs-sort-${l.key}`,onClick:z,size:"sm",type:"button",variant:o===l.key?"secondary":"ghost",children:l.label},l.key))}),e[37]=D,e[38]=o,e[39]=g):g=e[39];let A;e[40]!==p||e[41]!==x||e[42]!==g?(A=y("div",{className:"flex flex-wrap items-center gap-2",children:[p,x,g]}),e[40]=p,e[41]=x,e[42]=g,e[43]=A):A=e[43];let B;e[44]!==i||e[45]!==b?(B=i!==null&&t(V,{error:b,testId:"fs-error"}),e[44]=i,e[45]=b,e[46]=B):B=e[46],K=y("div",{className:"flex flex-col gap-4","data-testid":"lunora-function-stats",children:[A,B,k!==null&&C.length===0&&i===null&&t(ee,{description:s("Per-function call counts, error rates, and latency land here after your first request."),icon:y("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("path",{d:"M3 3v18h18"}),t("path",{d:"M7 14l4-4 3 3 5-6"})]}),testId:"fs-empty",title:s("No functions have run on this shard yet.")}),C.length>0&&t(Y,{className:"overflow-hidden py-0",children:t(Z,{className:"px-0",children:y(te,{"data-testid":"fs-table",children:[t(re,{children:y(L,{children:[t(a,{children:s("function")}),t(a,{children:s("kind")}),t(a,{className:"text-right",children:s("calls")}),t(a,{className:"text-right",children:s("errors")}),t(a,{className:"text-right",children:s("conflicts")}),t(a,{className:"text-right",children:s("avg")}),t(a,{className:"text-right",children:s("max")}),t(a,{children:s("last run")}),t(a,{children:s("last error")})]})}),t(le,{children:C.map(l=>{const R=_.get(l.path);return y(L,{"data-testid":`fs-row-${l.path}`,children:[t(n,{className:"font-medium",children:l.path}),t(n,{children:R===void 0?t("span",{className:"text-muted-foreground",children:"—"}):t(J,{variant:ce[R],children:R})}),t(n,{className:"text-right tabular-nums",children:l.calls}),t(n,{className:j("text-right tabular-nums",l.errors>0&&"text-destructive"),children:de(l)}),t(n,{className:j("text-right tabular-nums",(l.conflicts??0)>0&&"text-warning"),children:me(l)}),t(n,{className:"text-right tabular-nums",children:l.calls===0?"—":q(l.totalDurationMs/l.calls)}),t(n,{className:"text-right tabular-nums",children:l.calls===0?"—":q(l.maxDurationMs)}),t(n,{className:"text-muted-foreground",children:ie(l.lastCalledAt,"—")}),t(n,{className:"max-w-[24ch] truncate text-destructive",title:l.lastErrorMessage??void 0,children:l.lastErrorMessage??t("span",{className:"text-muted-foreground",children:"—"})})]},l.path)})})]})})})]}),e[6]=i,e[7]=b,e[8]=_,e[9]=v,e[10]=N,e[11]=S,e[12]=o,e[13]=k,e[14]=s,e[15]=K}else K=e[15];return K};function fe(r){return[r.path,r.kind]}export{Ae as FunctionStatsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as ae}from"react/compiler-runtime";import{useLunora as pe}from"@lunora/react";import{useState as E,useRef as D,useEffect as j,useCallback as ge}from"react";import xe from"../packem_shared/ConnectionBadge-Bh16X9-u.js";import{L as ve}from"../packem_shared/live-status-Bf7rR8o8.js";import{B as G}from"../packem_shared/badge-cAk9Di1Q.js";import{C as M}from"../packem_shared/card-BGlQzQY-.js";import{u as Ne}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useT as le}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as A}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{i as be,f as $,d as ee,b as te,c as _}from"../packem_shared/internal-CwaF9YNk.js";import{l as we}from"../packem_shared/shard-history-DU5b3QDI.js";import{c as R}from"../packem_shared/utils-bhneXptQ.js";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{shardsToAggregate as Ee}from"../packem_shared/aggregateMetrics-A-Y7OH6R.js";import{S as z}from"../packem_shared/sparkline-CYbJzfA1.js";const Se={crit:"destructive",ok:"secondary",warn:"default"},P=(s,e)=>e===0?"—":`${(s/e*100).toFixed(1)}%`,Q=(s,e,r)=>Number.isNaN(s)?"ok":s>=r?"crit":s>=e?"warn":"ok",ne=.01,oe=.05,ye=s=>{const e=ae(36),{errorCount:r,logsError:t,topErrors:a,worstFunctions:f}=s,o=le();let n;e[0]!==o?(n=o("Functions by error rate"),e[0]=o,e[1]=n):n=e[1];let h;e[2]!==n?(h=l("header",{className:"border-b border-border px-4 py-3",children:l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:n})}),e[2]=n,e[3]=h):h=e[3];let m;e[4]!==o||e[5]!==f?(m=f.length===0?l("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-functions-empty",children:o("No function activity yet.")}):l("ul",{className:"divide-y divide-border",children:f.map(b=>u("li",{className:"flex flex-wrap items-center justify-between gap-2 px-4 py-2 text-xs","data-testid":"hl-fn-row",children:[l("span",{className:"truncate font-mono text-foreground",children:b.path}),u("span",{className:"flex shrink-0 items-center gap-2",children:[l("span",{className:"tabular-nums text-muted-foreground",children:o("{count} calls",{count:b.calls.toString()})}),l(G,{variant:Se[Q(b.errors/b.calls,ne,oe)],children:P(b.errors,b.calls)})]})]},b.path))}),e[4]=o,e[5]=f,e[6]=m):m=e[6];let p;e[7]!==h||e[8]!==m?(p=u(M,{className:"gap-0 py-0","data-testid":"hl-functions",children:[h,m]}),e[7]=h,e[8]=m,e[9]=p):p=e[9];let v;e[10]!==o?(v=o("Recent errors"),e[10]=o,e[11]=v):v=e[11];let i;e[12]!==v?(i=l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:v}),e[12]=v,e[13]=i):i=e[13];const c=r>0?"destructive":"outline";let g;e[14]!==r||e[15]!==c?(g=l(G,{"data-testid":"hl-error-count",variant:c,children:r}),e[14]=r,e[15]=c,e[16]=g):g=e[16];let x;e[17]!==i||e[18]!==g?(x=u("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[i,g]}),e[17]=i,e[18]=g,e[19]=x):x=e[19];let S;e[20]!==t?(S=t!==null&&l("p",{className:"px-4 py-8 text-center text-sm text-destructive","data-testid":"hl-logs-error",role:"alert",children:t}),e[20]=t,e[21]=S):S=e[21];let y;e[22]!==t||e[23]!==o||e[24]!==a.length?(y=t===null&&a.length===0&&l("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground","data-testid":"hl-errors-empty",children:o("No recent errors.")}),e[22]=t,e[23]=o,e[24]=a.length,e[25]=y):y=e[25];let T;e[26]!==a?(T=a.length>0&&l("ul",{className:"divide-y divide-border",children:a.map(Te)}),e[26]=a,e[27]=T):T=e[27];let N;e[28]!==S||e[29]!==y||e[30]!==T||e[31]!==x?(N=u(M,{className:"gap-0 py-0",children:[x,S,y,T]}),e[28]=S,e[29]=y,e[30]=T,e[31]=x,e[32]=N):N=e[32];let w;return e[33]!==N||e[34]!==p?(w=u("div",{className:"grid gap-3 lg:grid-cols-2",children:[p,N]}),e[33]=N,e[34]=p,e[35]=w):w=e[35],w};function Te(s,e){return u("li",{className:"flex flex-col gap-0.5 px-4 py-2 text-xs","data-testid":"hl-error-row",children:[u("span",{className:"flex items-center gap-2",children:[l("time",{className:"shrink-0 text-muted-foreground",children:be(s.timestamp)}),s.functionPath!==void 0&&l("span",{className:"truncate font-mono text-foreground",children:s.functionPath})]}),l("span",{className:"text-destructive",children:s.message})]},`${s.timestamp.toString()}-${e.toString()}`)}const re={completed:0,failed:2,in_progress:1},Ae=s=>{let e=0,r=0,t=0,a=0,f=!1;const o=[];for(const{metrics:n}of s){if(n===null){a+=1;continue}t+=1,e+=n.requests,r+=n.errors,o.push(...n.history??[]),f||=n.historyTruncated===!0}return{errors:r,failed:a,history:o,historyTruncated:f,reachable:t,requests:e}},ke=s=>{const e=new Map;for(const r of s)for(const t of r){const a=e.get(t.path);if(a===void 0){e.set(t.path,{...t});continue}a.calls+=t.calls,a.errors+=t.errors,a.totalDurationMs+=t.totalDurationMs,a.scans=(a.scans??0)+(t.scans??0),a.maxDurationMs=Math.max(a.maxDurationMs,t.maxDurationMs),a.lastCalledAt=Math.max(a.lastCalledAt,t.lastCalledAt),(t.lastErrorAt??0)>(a.lastErrorAt??0)&&(a.lastErrorAt=t.lastErrorAt,a.lastErrorMessage=t.lastErrorMessage)}return[...e.values()]},Re=s=>{const e=new Map;for(const r of s)for(const t of r){const a=e.get(t.id);if(a===void 0){e.set(t.id,t);continue}const f=re[t.status]-re[a.status];(f>0||f===0&&(t.updatedAt??0)>(a.updatedAt??0))&&e.set(t.id,t)}return[...e.values()]},Me=_(A.getAuthMetrics),_e=_(A.getFunctionStats),Le=_(A.getLogs),Ie=_(A.getMetrics),Ce=_(A.migrationStatus),qe=5,se=2e3,Oe=5,Fe=.1,De=.3,je=1,Ue=50,Pe=(s,e,r)=>s>=r?"crit":s>=e?"warn":"ok",Ge=s=>{const e=new Map;for(const t of s??[]){const a=e.get(t.bucketMs)??{calls:0,errors:0};a.calls+=t.calls,a.errors+=t.errors,e.set(t.bucketMs,a)}const r=[...e.entries()].toSorted((t,a)=>t[0]-a[0]);return{errors:r.map(([,t])=>t.errors),requests:r.map(([,t])=>t.calls)}},Ve=s=>{let e=0,r=0;for(const a of s)a.status==="failed"?e+=1:a.status==="in_progress"&&(r+=1);let t="ok";return e>0?t="crit":r>0&&(t="warn"),{failed:e,level:t,running:r}},Be=(s,e)=>s.failed>0?e("{count} failed",{count:s.failed.toString()}):s.running>0?e("{count} running",{count:s.running.toString()}):e("OK"),ie={crit:"bg-destructive",ok:"bg-success",warn:"bg-warning"},ce={crit:"text-destructive",ok:"text-foreground",warn:"text-warning"},He={crit:"bg-destructive/10 text-destructive",ok:"bg-success/10 text-success",warn:"bg-warning/10 text-warning"},Ke=s=>s.includes("crit")?"crit":s.includes("warn")?"warn":"ok",U=s=>{const e=ae(19),{chart:r,label:t,level:a,testId:f,value:o}=s,n=ie[a];let h;e[0]!==n?(h=R("size-1.5 shrink-0 rounded-full",n),e[0]=n,e[1]=h):h=e[1];let m;e[2]!==h?(m=l("span",{"aria-hidden":"true",className:h}),e[2]=h,e[3]=m):m=e[3];let p;e[4]!==t||e[5]!==m?(p=u("span",{className:"flex items-center gap-1.5 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:[m,t]}),e[4]=t,e[5]=m,e[6]=p):p=e[6];const v=ce[a];let i;e[7]!==v?(i=R("truncate text-2xl font-semibold tabular-nums",v),e[7]=v,e[8]=i):i=e[8];let c;e[9]!==i||e[10]!==f||e[11]!==o?(c=l("span",{className:i,"data-testid":f,children:o}),e[9]=i,e[10]=f,e[11]=o,e[12]=c):c=e[12];let g;e[13]!==r||e[14]!==c?(g=u("div",{className:"flex items-center justify-between gap-3",children:[c,r]}),e[13]=r,e[14]=c,e[15]=g):g=e[15];let x;return e[16]!==p||e[17]!==g?(x=l(M,{className:"gap-0 py-0",children:u("div",{className:"flex flex-col gap-2.5 p-4",children:[p,g]})}),e[16]=p,e[17]=g,e[18]=x):x=e[18],x},$e=async(s,e,r)=>{const t=await Promise.all(r.map(i=>{const c=ee(i);return Promise.allSettled([s.query(Ie,{},c),s.query(_e,{},c),s.query(Ce,{},c)])})),a=ee(e),f=typeof s.schedulerStatus=="function"?s.schedulerStatus():Promise.reject(new Error("scheduler status unavailable")),[o,n,h]=await Promise.allSettled([s.query(Le,{},a),s.query(Me,{},a),f]),m=t.map(([i,c,g])=>({functions:c.status==="fulfilled"?c.value.functions:[],metrics:i.status==="fulfilled"?i.value:null,migrations:g.status==="fulfilled"?g.value.migrations:[]})),p=Ae(m),v=t[0]?.[0];return{auth:n.status==="fulfilled"?n.value:null,entries:o.status==="fulfilled"?o.value.entries:[],functions:ke(m.map(i=>i.functions)),logsError:o.status==="rejected"?te(o.reason):null,metricsError:p.reachable===0&&v?.status==="rejected"?te(v.reason):null,migrations:Re(m.map(i=>i.migrations)),scheduler:h.status==="fulfilled"?h.value:null,totals:p}},ze=s=>{const e=s?.history??[];return{attempts:e.map(r=>r.attempts),failures:e.map(r=>r.failures)}},ut=({initialShardKey:s})=>{const e=pe(),r=le(),[t,a]=E([]),[f,o]=E(null),[n,h]=E(null),[m,p]=E(null),[v,i]=E([]),[c,g]=E(null),[x,S]=E(null),[y,T]=E([]),[N]=E(we),w=D(!1),b=D(!0);j(()=>(b.current=!0,()=>{b.current=!1}),[]);const L=s??"",I=ge(async()=>{if(w.current)return;w.current=!0;const d=await $e(e,L,Ee(L,N));if(!b.current){w.current=!1;return}h(d.totals),p(d.metricsError),i(d.functions),T(d.migrations),a(d.entries),o(d.logsError),g(d.auth),S(d.scheduler),w.current=!1},[e,N,L]);j(()=>{$(I())},[I]);const V=D(0),k=D(null),ue=()=>{const d=Date.now()-V.current;if(d>=se){V.current=Date.now(),$(I());return}k.current===null&&(k.current=setTimeout(()=>{k.current=null,V.current=Date.now(),$(I())},se-d))};j(()=>()=>{k.current!==null&&clearTimeout(k.current)},[]);const{data:W,liveError:de}=Ne(A.getMetrics,{},{live:!0,shardKey:L});j(()=>{W!==void 0&&ue()},[W]);const X=t.filter(d=>d.level==="error"),me=X.slice(0,qe),C=Ge(n?.history),J=ze(c),fe=v.filter(d=>d.calls>0).toSorted((d,K)=>K.errors/K.calls-d.errors/d.calls||K.calls-d.calls).slice(0,Oe),B=Ve(y),he=n===null||n.requests===0?0:n.errors/n.requests,H=Q(he,ne,oe),Y=c===null?"ok":Q(c.failureRate,Fe,De),Z=x===null?"ok":Pe(x.backlog,je,Ue),q=Ke([H,Y,Z,B.level]);let O,F;return q==="crit"?(O=r("Critical"),F=r("One or more service levels are breached.")):q==="warn"?(O=r("Degraded"),F=r("Some service levels need attention.")):(O=r("All systems healthy"),F=r("All service levels are within target.")),u("div",{className:"flex flex-col gap-6","data-testid":"lunora-health",children:[u(M,{className:"gap-0 py-0",children:[u("div",{className:"flex flex-wrap items-center justify-between gap-4 p-4",children:[u("div",{className:"flex items-center gap-3",children:[l("span",{"aria-hidden":"true",className:R("flex size-10 shrink-0 items-center justify-center rounded-full",He[q]),children:l("span",{className:R("size-3 rounded-full",ie[q])})}),u("div",{className:"grid leading-tight",children:[l("span",{className:"text-sm font-semibold text-foreground","data-testid":"hl-status",children:O}),l("span",{className:"text-[13px] text-muted-foreground",children:F})]})]}),u("div",{className:"flex flex-wrap items-center gap-4",children:[u("div",{className:"text-end",children:[l("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:r("Requests")}),u("div",{className:"flex items-center justify-end gap-2",children:[C.requests.length>=2&&l(z,{ariaLabel:r("Requests over time"),className:"h-6 w-20 text-foreground",series:C.requests,testId:"hl-spark-requests"}),l("span",{className:"text-lg font-semibold tabular-nums text-foreground","data-testid":"hl-requests",children:(n?.requests??0).toString()})]})]}),l("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),u("div",{className:"text-end",children:[l("div",{className:"font-mono text-[10px] tracking-wide text-muted-foreground uppercase",children:r("Error rate")}),l("div",{className:R("text-lg font-semibold tabular-nums",ce[H]),"data-testid":"hl-error-rate",children:n===null?"—":P(n.errors,n.requests)})]}),l("span",{"aria-hidden":"true",className:"h-9 w-px bg-border"}),u("div",{className:"flex items-center gap-2",children:[l(xe,{}),l(ve,{message:de,prefix:"hl"})]})]})]}),m!==null&&l("div",{className:"border-t border-border bg-destructive/5 px-4 py-2 text-sm text-destructive","data-testid":"hl-metrics-error",role:"alert",children:m}),m===null&&n?.historyTruncated===!0&&l("div",{className:"border-t border-border bg-warning/5 px-4 py-2 text-sm text-muted-foreground","data-testid":"hl-history-truncated",children:r("Showing a partial request/error history — one or more shards have more data than the trend chart can display.")})]}),u("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-4","data-testid":"hl-slo",children:[l(U,{chart:C.errors.length>=2?l(z,{ariaLabel:r("Errors over time"),className:"h-7 w-20 text-destructive",series:C.errors,testId:"hl-spark-errors"}):void 0,label:r("Error rate"),level:H,testId:"hl-slo-errorrate",value:n===null?"—":P(n.errors,n.requests)}),l(U,{chart:J.failures.length>=2?l(z,{ariaLabel:r("Auth failures over time"),className:"h-7 w-20 text-destructive",series:J.failures,testId:"hl-spark-auth"}):void 0,label:r("Auth failures"),level:Y,testId:"hl-slo-auth",value:c===null?"—":P(c.failures,c.attempts)}),l(U,{label:r("Scheduler backlog"),level:Z,testId:"hl-slo-backlog",value:x===null?"—":x.backlog.toString()}),l(U,{label:r("Migrations"),level:B.level,testId:"hl-slo-migrations",value:Be(B,r)})]}),l(ye,{errorCount:X.length,logsError:f,topErrors:me,worstFunctions:fe}),u(M,{className:"gap-0 py-0",children:[u("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[l("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Shards seen")}),l(G,{"data-testid":"hl-shard-count",variant:"outline",children:N.length})]}),N.length>0&&l("ul",{className:"flex flex-wrap gap-1.5 p-4",children:N.map(d=>l("li",{"data-testid":"hl-shard",children:l(G,{variant:"secondary",children:d})},d))})]})]})};export{ut as HealthPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as J}from"react/compiler-runtime";import{useLunora as se}from"@lunora/react";import{useNavigate as re}from"@tanstack/react-router";import{useState as q,useRef as ae,useEffectEvent as O,useEffect as Q,useCallback as oe,useMemo as ie}from"react";import{ShardInput as ce}from"../packem_shared/ShardInput-CdawpUiS.js";import{B as le}from"../packem_shared/button-BOPLD1un.js";import{u as N}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as de}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as K}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as A}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{f as E,d as L,c as R}from"../packem_shared/internal-CwaF9YNk.js";import{r as ue}from"../packem_shared/shard-history-DU5b3QDI.js";import{a as U,A as fe}from"../packem_shared/advisor-view-C1KFTXSH.js";import{ConfirmButton as me}from"../packem_shared/ConfirmButton-Cj2SOapE.js";import{q as k}from"../packem_shared/quote-identifier-CGiYFBvY.js";import{jsx as g}from"react/jsx-runtime";import{deriveInsights as he}from"../packem_shared/DEFAULT_INSIGHT_THRESHOLDS-1Lrg55IV.js";import{runAdvisor as pe,RUNTIME_LINTS as be}from"@lunora/advisor";const xe=t=>{const{suggestedIndex:e,table:r}=t;return!(typeof r!="string"||r.length===0||typeof e!="object"||e===null||!Array.isArray(e.fields)||e.fields.length===0)},ye=(t,e,r)=>{const n=k(t),s=k(e),i=r.map(c=>k(c)).join(", ");return`CREATE INDEX IF NOT EXISTS ${s} ON ${n} (${i});`},ve=t=>{const e=J(19),{fields:r,indexName:n,table:s,testId:i}=t,c=K(),[v,h]=q(!1);let u;e[0]!==r||e[1]!==n||e[2]!==s?(u=()=>{const y="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(y===void 0)return;const x=ye(s,n,r);E(y.writeText(x)),h(!0)},e[0]=r,e[1]=n,e[2]=s,e[3]=u):u=e[3];const I=u;if(v){const y=`${i}-applied`;let x;e[4]!==c?(x=c("CREATE INDEX SQL copied to clipboard."),e[4]=c,e[5]=x):x=e[5];let w;return e[6]!==y||e[7]!==x?(w=g("span",{className:"text-xs text-muted-foreground","data-testid":y,children:x}),e[6]=y,e[7]=x,e[8]=w):w=e[8],w}let d;e[9]!==c?(d=c("Apply?"),e[9]=c,e[10]=d):d=e[10];let f;e[11]!==c||e[12]!==s?(f=c("Apply index on {table}",{table:s}),e[11]=c,e[12]=s,e[13]=f):f=e[13];let b;return e[14]!==I||e[15]!==d||e[16]!==f||e[17]!==i?(b=g(me,{confirmLabel:d,onConfirm:I,testId:i,children:f}),e[14]=I,e[15]=d,e[16]=f,e[17]=i,e[18]=b):b=e[18],b},Se=(t,e)=>{const r=new Map;for(const n of e){const s=`${n.table} ${n.index}`;r.set(s,(r.get(s)??0)+n.reads)}return t.map(n=>({index:n.index,reads:r.get(`${n.table} ${n.index}`)??0,table:n.table}))},Te=t=>{const e=new Map;for(const r of t)for(const n of r.scannedTables??[])e.set(n.table,(e.get(n.table)??0)+n.scans);return[...e].map(([r,n])=>({scans:n,table:r}))},X=(t,e)=>e.map(r=>({index:r.name,table:t})),ge=t=>{const e=Se(t.declaredIndexes??[],t.indexHits??[]),r=Te(t.functions??[]),n=t.shardTraffic??[],s=t.analyticsMetrics,i=s&&s.indexHits.length>0?s.indexHits:e,c=s&&s.tableScans.length>0?s.tableScans:r,v=s&&s.shardTraffic.length>0?s.shardTraffic:n,h=pe({indexHits:i,schema:{tables:[]},shardTraffic:v,tableScans:c},{lints:be,source:"runtime"}),u=t.suppressHotScanTables;return(u===void 0?h:h.filter(d=>!(d.metadata.kind==="hot_scan"&&typeof d.metadata.table=="string"&&u.has(d.metadata.table)))).map(d=>U(d))},Ie=R(A.listTables),we=R(A.listTableIndexes),Ae=R(A.listTablesIndexes),H=t=>`${(t*100).toFixed(1)}%`,P=t=>`${(t/1e3).toFixed(2)}s`,Ee=t=>{if(t.length<=1)return t[0]??"";const e=t[t.length-1]??"";return`${t.slice(0,-1).join(", ")} and ${e}`},$e=(t,e)=>({"high-error-rate":t("High error rate"),"high-evictions":t("High cache eviction rate"),"high-write-contention":t("High write contention"),"low-cache-hit-rate":t("Low cache hit rate"),"missing-index":t("Missing index"),"slow-function":t("Slow function")})[e.kind],V=(t,e)=>({"high-error-rate":t("{rate} of calls failed.",{rate:H(e.value)}),"high-evictions":t("{count} entries evicted recently.",{count:e.value}),"high-write-contention":t("{rate} of calls hit a write conflict — consider sharding to cut contention.",{rate:H(e.value)}),"low-cache-hit-rate":t("{rate} hit rate over recent traffic.",{rate:H(e.value)}),"missing-index":t("Slowest call took {duration} — it full-scanned {tables} with no index.",{duration:P(e.value),tables:Ee(e.tables??[])}),"slow-function":t("Slowest call took {duration}.",{duration:P(e.value)})})[e.kind],Ne=t=>{const e=J(10),{onJump:r,table:n}=t,s=K();let i;e[0]!==r||e[1]!==n?(i=()=>{r(n)},e[0]=r,e[1]=n,e[2]=i):i=e[2];const c=i,v=`in-add-index-${n}`;let h;e[3]!==s||e[4]!==n?(h=s("Add index on {table}",{table:n}),e[3]=s,e[4]=n,e[5]=h):h=e[5];let u;return e[6]!==c||e[7]!==v||e[8]!==h?(u=g(le,{"data-testid":v,onClick:c,size:"sm",type:"button",variant:"outline",children:h}),e[6]=c,e[7]=v,e[8]=h,e[9]=u):u=e[9],u},Ue=({initialShardKey:t,loadShardTraffic:e})=>{const r=se(),n=re(),s=K(),{queryShardKey:i,setShardKey:c,shardKey:v}=de(t),[h,u]=q(null),[I,d]=q(null),f=ae(""),b=N(A.getMetrics,{},{live:!0,shardKey:i}),y=N(A.getFunctionStats,{},{live:!0,shardKey:i}),x=N(A.getAdvisories,{},{live:!0,shardKey:i}),w=b.data??null,B=y.data?.functions??null,D=x.data?.advisories??null,z=b.data?.indexHits??null,M=b.error!==null&&y.error!==null?b.error:null,G=e??(a=>r.shardTraffic(a)),W=async(a,p)=>{const S=a[0];if(S===void 0||S===""){f.current===p&&d(null);return}try{const o=await G(S);if(f.current!==p)return;const l=new Map;for(const m of o.shards)l.has(m.shardKey)||l.set(m.shardKey,{requests:m.requests,shardKey:m.shardKey});d([...l.values()])}catch{f.current===p&&d(null)}},Y=async(a,p)=>{const S=await Promise.allSettled(a.map(async l=>[l,await r.query(we,{table:l},L(p))])),o=[];for(const l of S)if(l.status==="fulfilled"){const[m,T]=l.value;o.push(...X(m,T.indexes))}return o},C=O(async a=>{f.current=a;let p=[];try{const S=await r.query(Ie,{},L(a));if(f.current!==a)return;ue(a),p=S.map(l=>l.name);let o=[];if(p.length>0)try{const l=await r.query(Ae,{tables:p},L(a));if(f.current!==a)return;for(const[m,T]of Object.entries(l.indexesByTable))o.push(...X(m,T))}catch{if(o=await Y(p,a),f.current!==a)return}u(o)}catch{f.current===a&&u(null)}await W(p,a)});Q(()=>{E(C(i))},[i]);const Z=O(()=>{b.refetch(),y.refetch(),x.refetch(),E(C(i))});Q(()=>{const a=()=>{document.visibilityState==="visible"&&Z()};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a)}},[]);const F=oe(a=>{E(n({search:{table:a},to:"/schema"}))},[n]),$=he(w,B),_=new Set($.filter(a=>a.kind==="missing-index").flatMap(a=>a.tables??[])),j=ge({declaredIndexes:h??[],functions:B,indexHits:z,shardTraffic:I,suppressHotScanTables:_}),ee=ie(()=>{const a=$.map(o=>{const l=o.kind==="missing-index"?o.tables??[]:[];return{action:l.length>0?l.map(m=>g(Ne,{onJump:F,table:m},m)):void 0,description:o.message===void 0?V(s,o):`${V(s,o)} — ${o.message}`,entity:o.fn,issueType:$e(s,o),key:`${o.kind}:${o.fn??""}`,level:o.severity}}),p=new Set(["unindexed_foreign_key","unindexed_relation_target"]);return[...(D??[]).map(o=>{const l=U(o);if(p.has(o.name)&&xe(o.metadata)){const{table:m,suggestedIndex:T}=o.metadata,ne=`in-apply-index-${m}-${T.name}`;return{...l,action:g(ve,{fields:T.fields,indexName:T.name,table:m,testId:ne})}}return l}),...j,...a]},[D,$,F,j,s]),te=g(ce,{onChange:c,testId:"in-shard-input",value:v});return g(fe,{error:M,errorSource:M===null?void 0:b.errorSource,rows:ee,testId:"lunora-insights",toolbar:te})};export{Ue as InsightsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as q}from"react/compiler-runtime";import{useVirtualizer as Ce}from"@tanstack/react-virtual";import{useState as F,useReducer as Le,useRef as ue,useEffect as me,useMemo as Ne}from"react";import{f as fe}from"../packem_shared/log-fields-SBxKyBug.js";import{E as Se}from"../packem_shared/error-alert-TYdKetJd.js";import{B as he}from"../packem_shared/badge-cAk9Di1Q.js";import{E as ee}from"../packem_shared/empty-state-B939z6K2.js";import{u as le}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{u as Te}from"../packem_shared/use-open-trace-4mqqFWrn.js";import{u as Ie}from"../packem_shared/use-shard-key-BsP3o5wT.js";import{useT as Q}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{ADMIN_FUNCTIONS as oe}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";import{r as Re}from"../packem_shared/shard-history-DU5b3QDI.js";import{f as ke}from"../packem_shared/virtual-rect-D_j7aLxX.js";import{useLunora as Pe}from"@lunora/react";import{B as Ee}from"../packem_shared/button-BOPLD1un.js";import{I as D}from"../packem_shared/input-CY5W3wzv.js";import{T as Oe,a as _e,b as ge,c as B,d as Fe,e as V}from"../packem_shared/table-BMsuYFhk.js";import ae from"../packem_shared/useDebounced-DVeQ5-oW.js";import{a as pe}from"../packem_shared/cf-links-CBJ5SywP.js";import{f as ne,m as qe,b as ie}from"../packem_shared/internal-CwaF9YNk.js";import{a as Ae,L as Me}from"../packem_shared/log-line-UnE93Ovi.js";import{jsx as r,jsxs as E,Fragment as $e}from"react/jsx-runtime";import{c as H}from"../packem_shared/utils-bhneXptQ.js";import{L as Ue}from"../packem_shared/live-status-Bf7rR8o8.js";import{ShardInput as Ke}from"../packem_shared/ShardInput-CdawpUiS.js";const re=["trace","debug","log","info","warn","error","fatal"],Be="LOG_ARCHIVE_NOT_CONFIGURED",Ve={cursor:void 0,error:null,loading:!1,notConfigured:!1,rows:null},De=(i,e)=>{switch(e.type){case"append":return{...i,cursor:e.cursor,error:null,loading:!1,rows:[...i.rows??[],...e.rows]};case"failed":return{cursor:void 0,error:e.message,loading:!1,notConfigured:!1,rows:null};case"loaded":return{cursor:e.cursor,error:null,loading:!1,notConfigured:!1,rows:e.rows};case"loading":return{...i,error:null,loading:!0,notConfigured:!1};case"notConfigured":return{cursor:void 0,error:null,loading:!1,notConfigured:!0,rows:null};case"pageFailed":return{...i,error:e.message,loading:!1};default:return i}},Qe=i=>{const e=q(33),{row:t}=i;let a;e[0]!==t.fields?(a=fe(t.fields),e[0]=t.fields,e[1]=a):a=e[1];const n=a,o=`lg-archive-row-${String(t.ts)}`;let d;e[2]!==t.ts?(d=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=d):d=e[3];let p;e[4]!==d?(p=r(V,{className:"tabular-nums whitespace-nowrap text-xs text-muted-foreground",children:d}),e[4]=d,e[5]=p):p=e[5];const m=Ae[t.level];let c;e[6]!==t.level||e[7]!==m?(c=r(V,{children:r(he,{variant:m,children:t.level})}),e[6]=t.level,e[7]=m,e[8]=c):c=e[8];let s;e[9]!==t.functionPath?(s=r(V,{className:"font-mono text-xs",children:t.functionPath}),e[9]=t.functionPath,e[10]=s):s=e[10];let f;e[11]!==t.message?(f=r("div",{className:"truncate",title:t.message,children:t.message}),e[11]=t.message,e[12]=f):f=e[12];let l;e[13]!==n?(l=n!==""&&r("div",{className:"truncate font-mono text-[11px] text-muted-foreground",title:n,children:n}),e[13]=n,e[14]=l):l=e[14];let u;e[15]!==f||e[16]!==l?(u=E(V,{className:"max-w-md",children:[f,l]}),e[15]=f,e[16]=l,e[17]=u):u=e[17];const h=t.traceId??"—";let v;e[18]!==h?(v=r(V,{className:"font-mono text-[11px] text-muted-foreground",children:h}),e[18]=h,e[19]=v):v=e[19];const b=t.shardKey??"—";let y;e[20]!==b?(y=r(V,{className:"font-mono text-[11px] text-muted-foreground",children:b}),e[20]=b,e[21]=y):y=e[21];const w=t.userId??"—";let x;e[22]!==w?(x=r(V,{className:"font-mono text-[11px] text-muted-foreground",children:w}),e[22]=w,e[23]=x):x=e[23];let T;return e[24]!==u||e[25]!==v||e[26]!==y||e[27]!==x||e[28]!==o||e[29]!==p||e[30]!==c||e[31]!==s?(T=E(ge,{"data-testid":o,children:[p,c,s,u,v,y,x]}),e[24]=u,e[25]=v,e[26]=y,e[27]=x,e[28]=o,e[29]=p,e[30]=c,e[31]=s,e[32]=T):T=e[32],T},ze=({shardKey:i})=>{const e=Pe(),t=Q(),[a,n]=F(""),[o,d]=F(""),[p,m]=F(""),[{cursor:c,error:s,loading:f,notConfigured:l,rows:u},h]=Le(De,Ve),v=ae(a.trim(),400),b=ae(o.trim(),400),y={...v===""?{}:{functionPathPrefix:v},...p===""?{}:{minLevel:p},...i===""?{}:{shardKey:i},...b===""?{}:{userId:b}},w=JSON.stringify(y),x=ue(w);me(()=>{const g={cancelled:!1};return x.current=w,ne((async()=>{h({type:"loading"});try{const C=await e.queryLogArchive(y);g.cancelled||h({cursor:C.nextCursor,rows:C.rows,type:"loaded"})}catch(C){g.cancelled||h(qe(C)===Be?{type:"notConfigured"}:{message:ie(C),type:"failed"})}})()),()=>{g.cancelled=!0}},[e,w]);const T=async()=>{if(c===void 0)return;const g=w;h({type:"loading"});try{const C=await e.queryLogArchive({...y,cursor:c});x.current===g&&h({cursor:C.nextCursor,rows:C.rows,type:"append"})}catch(C){x.current===g&&h({message:ie(C),type:"pageFailed"})}},R=g=>{n(g.target.value)},N=g=>{d(g.target.value)},L=g=>{m(g.target.value)},S=()=>{ne(T())};return l?r(ee,{action:r("a",{className:"text-sm text-primary underline-offset-4 hover:underline",href:pe,rel:"noreferrer",target:"_blank",children:t("Open in Cloudflare")}),description:t("Wire pipelineLogSink to a Cloudflare Pipeline → R2 Data Catalog table and set R2_SQL_ACCOUNT_ID, R2_SQL_TOKEN, R2_SQL_BUCKET to browse the durable log archive here."),testId:"lg-archive-not-configured",title:t("Log archive not configured")}):E("div",{className:"flex flex-col gap-4","data-testid":"lg-archive",children:[E("div",{className:"flex flex-wrap items-center gap-2",children:[r(D,{"aria-label":t("Function path prefix"),className:"h-8 w-48","data-testid":"lg-archive-path",onChange:R,placeholder:t("function path…"),value:a}),r(D,{"aria-label":t("User id"),className:"h-8 w-40","data-testid":"lg-archive-user",onChange:N,placeholder:t("user id…"),value:o}),E("select",{"aria-label":t("Minimum level"),className:"h-8 rounded-md border border-border bg-background px-2 text-sm","data-testid":"lg-archive-min-level",onChange:L,value:p,children:[r("option",{value:"",children:t("min level")}),re.map(g=>r("option",{value:g,children:g},g))]})]}),s!==null&&r("p",{className:"text-sm text-destructive","data-testid":"lg-archive-error",role:"alert",children:s}),f&&u===null&&s===null&&r("p",{className:"text-sm text-muted-foreground","data-testid":"lg-archive-loading",children:t("Loading…")}),u!==null&&u.length===0&&r(ee,{description:t("No archived logs match these filters. The durable archive fills as pipelineLogSink flushes records to R2."),testId:"lg-archive-empty",title:t("No archived logs.")}),u!==null&&u.length>0&&r("div",{className:"overflow-hidden rounded-xl border border-border shadow-xs",children:E(Oe,{"data-testid":"lg-archive-table",children:[r(_e,{children:E(ge,{children:[r(B,{children:t("Time")}),r(B,{children:t("Level")}),r(B,{children:t("Function")}),r(B,{children:t("Message")}),r(B,{children:t("Trace")}),r(B,{children:t("Shard")}),r(B,{children:t("User")})]})}),r(Fe,{children:u.map((g,C)=>r(Qe,{row:g},`${String(g.ts)}-${String(C)}`))})]})}),c!==void 0&&r("div",{children:r(Ee,{"data-testid":"lg-archive-more",disabled:f,onClick:S,size:"sm",variant:"outline",children:t(f?"Loading…":"Load more")})})]})},Ge=i=>{const e=q(11),{level:t,onToggle:a,selected:n}=i;let o;e[0]!==t||e[1]!==a?(o=()=>{a(t)},e[0]=t,e[1]=a,e[2]=o):o=e[2];const d=o,p=n?"border-border bg-muted font-medium":"border-input text-muted-foreground";let m;e[3]!==p?(m=H("rounded-md border px-2 py-1 text-xs",p),e[3]=p,e[4]=m):m=e[4];const c=`logs-level-${t}`;let s;return e[5]!==t||e[6]!==d||e[7]!==n||e[8]!==m||e[9]!==c?(s=r("button",{"aria-pressed":n,className:m,"data-testid":c,onClick:d,type:"button",children:t}),e[5]=t,e[6]=d,e[7]=n,e[8]=m,e[9]=c,e[10]=s):s=e[10],s},He=i=>{const e=q(68),{levelFilter:t,onLogPathChange:a,onSearchChange:n,onTimeRangeChange:o,onToggleLevel:d,onToggleSummary:p,pathFilter:m,search:c,showSummary:s,timeRange:f}=i,l=Q();let u;e[0]!==l?(u=l("Search messages"),e[0]=l,e[1]=u):u=e[1];let h;e[2]!==l?(h=l("search message"),e[2]=l,e[3]=h):h=e[3];let v;e[4]!==n||e[5]!==c||e[6]!==u||e[7]!==h?(v=r(D,{"aria-label":u,className:"h-8 w-48","data-testid":"lg-search",onChange:n,placeholder:h,value:c}),e[4]=n,e[5]=c,e[6]=u,e[7]=h,e[8]=v):v=e[8];let b;e[9]!==l?(b=l("Function path"),e[9]=l,e[10]=b):b=e[10];let y;e[11]!==l?(y=l("filter path"),e[11]=l,e[12]=y):y=e[12];let w;e[13]!==a||e[14]!==m||e[15]!==b||e[16]!==y?(w=r(D,{"aria-label":b,className:"h-8 w-40","data-testid":"logs-path-filter",onChange:a,placeholder:y,value:m}),e[13]=a,e[14]=m,e[15]=b,e[16]=y,e[17]=w):w=e[17];let x;e[18]!==l?(x=l("Level filter"),e[18]=l,e[19]=x):x=e[19];let T;e[20]!==t||e[21]!==d?(T=re.map(G=>r(Ge,{level:G,onToggle:d,selected:t.has(G)},G)),e[20]=t,e[21]=d,e[22]=T):T=e[22];let R;e[23]!==x||e[24]!==T?(R=r("div",{"aria-label":x,className:"inline-flex items-center gap-1","data-testid":"logs-level-filter",role:"group",children:T}),e[23]=x,e[24]=T,e[25]=R):R=e[25];let N;e[26]!==l?(N=l("Time range"),e[26]=l,e[27]=N):N=e[27];let L;e[28]!==l?(L=l("All time"),e[28]=l,e[29]=L):L=e[29];let S;e[30]!==L?(S=r("option",{value:"all",children:L}),e[30]=L,e[31]=S):S=e[31];let g;e[32]!==l?(g=l("Last 5m"),e[32]=l,e[33]=g):g=e[33];let C;e[34]!==g?(C=r("option",{value:"5m",children:g}),e[34]=g,e[35]=C):C=e[35];let k;e[36]!==l?(k=l("Last 15m"),e[36]=l,e[37]=k):k=e[37];let P;e[38]!==k?(P=r("option",{value:"15m",children:k}),e[38]=k,e[39]=P):P=e[39];let O;e[40]!==l?(O=l("Last hour"),e[40]=l,e[41]=O):O=e[41];let _;e[42]!==O?(_=r("option",{value:"1h",children:O}),e[42]=O,e[43]=_):_=e[43];let A;e[44]!==o||e[45]!==N||e[46]!==S||e[47]!==C||e[48]!==P||e[49]!==_||e[50]!==f?(A=E("select",{"aria-label":N,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"logs-time-range",onChange:o,value:f,children:[S,C,P,_]}),e[44]=o,e[45]=N,e[46]=S,e[47]=C,e[48]=P,e[49]=_,e[50]=f,e[51]=A):A=e[51];const z=s?"border-border bg-muted font-medium":"border-input text-muted-foreground";let M;e[52]!==z?(M=H("h-8 rounded-md border px-3 text-sm",z),e[52]=z,e[53]=M):M=e[53];let U;e[54]!==s||e[55]!==l?(U=l(s?"List":"Summary"),e[54]=s,e[55]=l,e[56]=U):U=e[56];let $;e[57]!==p||e[58]!==s||e[59]!==M||e[60]!==U?($=r("button",{"aria-pressed":s,className:M,"data-testid":"logs-summary-toggle",onClick:p,type:"button",children:U}),e[57]=p,e[58]=s,e[59]=M,e[60]=U,e[61]=$):$=e[61];let K;return e[62]!==A||e[63]!==$||e[64]!==v||e[65]!==w||e[66]!==R?(K=E("div",{className:"flex flex-wrap items-center gap-2",children:[v,w,R,A,$]}),e[62]=A,e[63]=$,e[64]=v,e[65]=w,e[66]=R,e[67]=K):K=e[67],K},We=i=>{const e=q(53),{onOutcomeChange:t,onPathChange:a,onTableChange:n,onUserChange:o,outcomeFilter:d,pathPrefix:p,tableFilter:m,userIdFilter:c}=i,s=Q();let f;e[0]!==s?(f=s("Function path"),e[0]=s,e[1]=f):f=e[1];let l;e[2]!==s?(l=s("file:function"),e[2]=s,e[3]=l):l=e[3];let u;e[4]!==a||e[5]!==p||e[6]!==f||e[7]!==l?(u=r(D,{"aria-label":f,className:"h-8 w-44","data-testid":"lg-req-path",onChange:a,placeholder:l,value:p}),e[4]=a,e[5]=p,e[6]=f,e[7]=l,e[8]=u):u=e[8];let h;e[9]!==s?(h=s("User id"),e[9]=s,e[10]=h):h=e[10];let v;e[11]!==s?(v=s("userId"),e[11]=s,e[12]=v):v=e[12];let b;e[13]!==o||e[14]!==h||e[15]!==v||e[16]!==c?(b=r(D,{"aria-label":h,className:"h-8 w-32","data-testid":"lg-req-user",onChange:o,placeholder:v,value:c}),e[13]=o,e[14]=h,e[15]=v,e[16]=c,e[17]=b):b=e[17];let y;e[18]!==s?(y=s("Table touched"),e[18]=s,e[19]=y):y=e[19];let w;e[20]!==s?(w=s("table"),e[20]=s,e[21]=w):w=e[21];let x;e[22]!==n||e[23]!==y||e[24]!==w||e[25]!==m?(x=r(D,{"aria-label":y,className:"h-8 w-32","data-testid":"lg-req-table",onChange:n,placeholder:w,value:m}),e[22]=n,e[23]=y,e[24]=w,e[25]=m,e[26]=x):x=e[26];let T;e[27]!==s?(T=s("Outcome filter"),e[27]=s,e[28]=T):T=e[28];let R;e[29]!==s?(R=s("all"),e[29]=s,e[30]=R):R=e[30];let N;e[31]!==R?(N=r("option",{value:"all",children:R}),e[31]=R,e[32]=N):N=e[32];let L;e[33]!==s?(L=s("ok"),e[33]=s,e[34]=L):L=e[34];let S;e[35]!==L?(S=r("option",{value:"ok",children:L}),e[35]=L,e[36]=S):S=e[36];let g;e[37]!==s?(g=s("error"),e[37]=s,e[38]=g):g=e[38];let C;e[39]!==g?(C=r("option",{value:"error",children:g}),e[39]=g,e[40]=C):C=e[40];let k;e[41]!==t||e[42]!==d||e[43]!==T||e[44]!==N||e[45]!==S||e[46]!==C?(k=E("select",{"aria-label":T,className:"h-8 rounded-md border border-input bg-transparent px-2 text-sm shadow-xs focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none","data-testid":"lg-req-outcome",onChange:t,value:d,children:[N,S,C]}),e[41]=t,e[42]=d,e[43]=T,e[44]=N,e[45]=S,e[46]=C,e[47]=k):k=e[47];let P;return e[48]!==k||e[49]!==u||e[50]!==b||e[51]!==x?(P=E("div",{className:"flex flex-wrap items-center gap-2",children:[u,b,x,k]}),e[48]=k,e[49]=u,e[50]=b,e[51]=x,e[52]=P):P=e[52],P},ve=i=>{const e=q(7),{bucket:t}=i;let a;e[0]!==t.key?(a=r("span",{className:"truncate text-muted-foreground",role:"gridcell",children:t.key}),e[0]=t.key,e[1]=a):a=e[1];let n;e[2]!==t.count?(n=r("span",{className:"shrink-0 tabular-nums",role:"gridcell",children:t.count}),e[2]=t.count,e[3]=n):n=e[3];let o;return e[4]!==a||e[5]!==n?(o=E("div",{className:"flex items-center justify-between gap-4 px-3 py-1 font-mono text-xs","data-testid":"logs-summary-row",role:"row",children:[a,n]}),e[4]=a,e[5]=n,e[6]=o):o=e[6],o},Ye=i=>{const e=q(31),{summary:t}=i,a=Q();let n;e[0]!==t.total||e[1]!==a?(n=a("{count} entries",{count:t.total}),e[0]=t.total,e[1]=a,e[2]=n):n=e[2];let o;e[3]!==n?(o=r("p",{className:"text-xs text-muted-foreground","data-testid":"logs-summary-total",children:n}),e[3]=n,e[4]=o):o=e[4];let d;e[5]!==a?(d=a("By level"),e[5]=a,e[6]=d):d=e[6];let p;e[7]!==d?(p=r("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:d}),e[7]=d,e[8]=p):p=e[8];let m;e[9]!==t.byLevel?(m=t.byLevel.map(je),e[9]=t.byLevel,e[10]=m):m=e[10];let c;e[11]!==m?(c=r("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-levels",role:"grid",children:m}),e[11]=m,e[12]=c):c=e[12];let s;e[13]!==p||e[14]!==c?(s=E("div",{children:[p,c]}),e[13]=p,e[14]=c,e[15]=s):s=e[15];let f;e[16]!==a?(f=a("By function"),e[16]=a,e[17]=f):f=e[17];let l;e[18]!==f?(l=r("h4",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:f}),e[18]=f,e[19]=l):l=e[19];let u;e[20]!==t.byPath?(u=t.byPath.map(Je),e[20]=t.byPath,e[21]=u):u=e[21];let h;e[22]!==u?(h=r("div",{className:"overflow-hidden rounded-lg border border-border","data-testid":"logs-summary-paths",role:"grid",children:u}),e[22]=u,e[23]=h):h=e[23];let v;e[24]!==h||e[25]!==l?(v=E("div",{children:[l,h]}),e[24]=h,e[25]=l,e[26]=v):v=e[26];let b;return e[27]!==v||e[28]!==o||e[29]!==s?(b=E("div",{className:"flex flex-col gap-4 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"logs-summary",children:[o,s,v]}),e[27]=v,e[28]=o,e[29]=s,e[30]=b):b=e[30],b};function je(i){return r(ve,{bucket:i},i.key)}function Je(i){return r(ve,{bucket:i},i.key)}const Xe=i=>{const e=q(46),{liveError:t,onShardKeyChange:a,onShowArchive:n,onShowErrors:o,onShowRequests:d,shardKey:p,view:m}=i,c=Q(),s=m==="requests",f=m==="requests"?"bg-muted font-medium":"text-muted-foreground";let l;e[0]!==f?(l=H("px-3 py-1 text-sm",f),e[0]=f,e[1]=l):l=e[1];let u;e[2]!==c?(u=c("Requests"),e[2]=c,e[3]=u):u=e[3];let h;e[4]!==d||e[5]!==s||e[6]!==l||e[7]!==u?(h=r("button",{"aria-selected":s,className:l,"data-testid":"lg-view-requests",onClick:d,role:"tab",type:"button",children:u}),e[4]=d,e[5]=s,e[6]=l,e[7]=u,e[8]=h):h=e[8];const v=m==="errors",b=m==="errors"?"bg-muted font-medium":"text-muted-foreground";let y;e[9]!==b?(y=H("px-3 py-1 text-sm",b),e[9]=b,e[10]=y):y=e[10];let w;e[11]!==c?(w=c("Errors"),e[11]=c,e[12]=w):w=e[12];let x;e[13]!==o||e[14]!==v||e[15]!==y||e[16]!==w?(x=r("button",{"aria-selected":v,className:y,"data-testid":"lg-view-errors",onClick:o,role:"tab",type:"button",children:w}),e[13]=o,e[14]=v,e[15]=y,e[16]=w,e[17]=x):x=e[17];const T=m==="archive",R=m==="archive"?"bg-muted font-medium":"text-muted-foreground";let N;e[18]!==R?(N=H("px-3 py-1 text-sm",R),e[18]=R,e[19]=N):N=e[19];let L;e[20]!==c?(L=c("Archive"),e[20]=c,e[21]=L):L=e[21];let S;e[22]!==n||e[23]!==T||e[24]!==N||e[25]!==L?(S=r("button",{"aria-selected":T,className:N,"data-testid":"lg-view-archive",onClick:n,role:"tab",type:"button",children:L}),e[22]=n,e[23]=T,e[24]=N,e[25]=L,e[26]=S):S=e[26];let g;e[27]!==x||e[28]!==S||e[29]!==h?(g=E("div",{className:"inline-flex overflow-hidden rounded-lg border border-border",role:"tablist",children:[h,x,S]}),e[27]=x,e[28]=S,e[29]=h,e[30]=g):g=e[30];let C;e[31]!==a||e[32]!==p?(C=r(Ke,{onChange:a,testId:"lg-shard-input",value:p}),e[31]=a,e[32]=p,e[33]=C):C=e[33];let k;e[34]!==t||e[35]!==m?(k=m!=="archive"&&r(Ue,{message:t,prefix:"lg"}),e[34]=t,e[35]=m,e[36]=k):k=e[36];let P;e[37]!==c?(P=c("Open in Cloudflare"),e[37]=c,e[38]=P):P=e[38];let O;e[39]!==P?(O=r("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"lg-cf-link",href:pe,rel:"noreferrer",target:"_blank",children:P}),e[39]=P,e[40]=O):O=e[40];let _;return e[41]!==g||e[42]!==C||e[43]!==k||e[44]!==O?(_=E("div",{className:"flex flex-wrap items-center gap-2",children:[g,C,k,O]}),e[41]=g,e[42]=C,e[43]=k,e[44]=O,e[45]=_):_=e[45],_},te=400,Ze=36,et={height:te,overflow:"auto"},be={left:0,position:"absolute",top:0,width:"100%"},tt={error:"destructive",ok:"secondary"},xe=i=>{const e=q(6),{onOpenTrace:t,traceId:a}=i,n=Q();let o;e[0]!==t||e[1]!==n||e[2]!==a?(o=a===void 0?null:r("button",{className:"text-primary underline-offset-2 hover:underline","data-testid":"lg-trace-link",onClick:()=>{t(a)},type:"button",children:n("Trace")}),e[0]=t,e[1]=n,e[2]=a,e[3]=o):o=e[3];let d;return e[4]!==o?(d=r("span",{className:"w-16 shrink-0 text-right",role:"gridcell",children:o}),e[4]=o,e[5]=d):d=e[5],d},rt=i=>{const e=q(13),{entry:t,index:a,measureRef:n,onOpenTrace:o,start:d}=i,p=`translateY(${String(d)}px)`;let m;e[0]!==p?(m={...be,transform:p},e[0]=p,e[1]=m):m=e[1];const c=m;let s;e[2]!==t?(s=r(Me,{entry:t}),e[2]=t,e[3]=s):s=e[3];let f;e[4]!==t.traceId||e[5]!==o?(f=r(xe,{onOpenTrace:o,traceId:t.traceId}),e[4]=t.traceId,e[5]=o,e[6]=f):f=e[6];let l;return e[7]!==a||e[8]!==n||e[9]!==c||e[10]!==s||e[11]!==f?(l=E("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":a,"data-testid":"lg-row",ref:n,role:"row",style:c,children:[s,f]}),e[7]=a,e[8]=n,e[9]=c,e[10]=s,e[11]=f,e[12]=l):l=e[12],l},ce=i=>i.length===0?"—":i.join(", "),st=i=>{const e=q(41),{entry:t,index:a,measureRef:n,onOpenTrace:o,start:d}=i,p=`translateY(${String(d)}px)`;let m;e[0]!==p?(m={...be,transform:p},e[0]=p,e[1]=m):m=e[1];const c=m;let s;e[2]!==t.ts?(s=new Date(t.ts).toLocaleString(),e[2]=t.ts,e[3]=s):s=e[3];let f;e[4]!==s?(f=r("span",{className:"w-40 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:s}),e[4]=s,e[5]=f):f=e[5];const l=tt[t.outcome];let u;e[6]!==t.outcome||e[7]!==l?(u=r("span",{className:"w-16 shrink-0",role:"gridcell",children:r(he,{variant:l,children:t.outcome})}),e[6]=t.outcome,e[7]=l,e[8]=u):u=e[8];let h;e[9]!==t.functionPath?(h=r("span",{className:"w-44 shrink-0 truncate",role:"gridcell",title:t.functionPath,children:t.functionPath}),e[9]=t.functionPath,e[10]=h):h=e[10];const v=t.shardKey??"—";let b;e[11]!==v?(b=r("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:v}),e[11]=v,e[12]=b):b=e[12];const y=t.userId??"—";let w;e[13]!==y?(w=r("span",{className:"w-24 shrink-0 truncate text-muted-foreground",role:"gridcell",children:y}),e[13]=y,e[14]=w):w=e[14];let x;e[15]!==t.durationMs?(x=Math.round(t.durationMs),e[15]=t.durationMs,e[16]=x):x=e[16];const T=`${String(x)}ms`;let R;e[17]!==T?(R=r("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",role:"gridcell",children:T}),e[17]=T,e[18]=R):R=e[18];let N;e[19]!==t.errorMessage||e[20]!==t.outcome||e[21]!==t.tablesRead||e[22]!==t.tablesWritten?(N=t.outcome==="error"&&t.errorMessage!==void 0?t.errorMessage:`r:${ce(t.tablesRead)} · w:${ce(t.tablesWritten)}`,e[19]=t.errorMessage,e[20]=t.outcome,e[21]=t.tablesRead,e[22]=t.tablesWritten,e[23]=N):N=e[23];let L;e[24]!==N?(L=r("span",{className:"flex-1 truncate text-muted-foreground",role:"gridcell",children:N}),e[24]=N,e[25]=L):L=e[25];let S;e[26]!==t.traceId||e[27]!==o?(S=r(xe,{onOpenTrace:o,traceId:t.traceId}),e[26]=t.traceId,e[27]=o,e[28]=S):S=e[28];let g;return e[29]!==a||e[30]!==n||e[31]!==c||e[32]!==w||e[33]!==R||e[34]!==L||e[35]!==S||e[36]!==f||e[37]!==u||e[38]!==h||e[39]!==b?(g=E("div",{className:"flex items-center border-b border-border px-3 py-1.5 font-mono text-xs hover:bg-muted/50","data-index":a,"data-testid":"lg-req-row",ref:n,role:"row",style:c,children:[f,u,h,b,w,R,L,S]}),e[29]=a,e[30]=n,e[31]=c,e[32]=w,e[33]=R,e[34]=L,e[35]=S,e[36]=f,e[37]=u,e[38]=h,e[39]=b,e[40]=g):g=e[40],g},de=i=>{const{entries:e}=i??{};return Array.isArray(e)?e:[]},lt=i=>{const e={};return i.functionPathPrefix.trim()!==""&&(e.functionPathPrefix=i.functionPathPrefix.trim()),i.userId.trim()!==""&&(e.userId=i.userId.trim()),i.tableTouched.trim()!==""&&(e.tableTouched=i.tableTouched.trim()),(i.outcome==="ok"||i.outcome==="error")&&(e.outcome=i.outcome),e},ot={"5m":300*1e3,"15m":900*1e3,"1h":3600*1e3},at=(i,e)=>{const t=e.search.trim().toLowerCase(),a=e.path.trim().toLowerCase(),n=e.range==="all"?Number.NEGATIVE_INFINITY:e.now-ot[e.range];return i.filter(o=>e.levels.size>0&&!e.levels.has(o.level)||o.timestamp<n||a!==""&&!(o.functionPath??"").toLowerCase().includes(a)?!1:t===""||o.message.toLowerCase().includes(t)||fe(o.fields).toLowerCase().includes(t))},nt="—",it=i=>{const e=new Map,t=new Map;for(const o of i){e.set(o.level,(e.get(o.level)??0)+1);const d=o.functionPath??nt;t.set(d,(t.get(d)??0)+1)}const a=re.filter(o=>e.has(o)).map(o=>({count:e.get(o)??0,key:o})),n=[...t.entries()].map(([o,d])=>({count:d,key:o})).toSorted((o,d)=>d.count===o.count?o.key.localeCompare(d.key):d.count-o.count);return{byLevel:a,byPath:n,total:i.length}},Wt=({initialShardKey:i})=>{const e=Q(),[t,a]=F("requests"),{queryShardKey:n,setShardKey:o,shardKey:d}=Ie(i),[p,m]=F(""),[c,s]=F(()=>new Set),[f,l]=F(""),[u,h]=F("all"),[v,b]=F(!1),[y,w]=F(""),[x,T]=F(""),[R,N]=F(""),[L,S]=F("all"),g=lt({functionPathPrefix:y,outcome:L,tableTouched:R,userId:x}),C=le(oe.getRequestLog,g,{enabled:t==="requests",live:!0,shardKey:n}),k=le(oe.getLogs,{},{enabled:t==="errors",live:!0,shardKey:n}),P=t==="requests"?C:k,{error:O,errorSource:_,isLoading:A,liveError:z}=P,M=Te(n),U=de(k.data),$=de(C.data);me(()=>{P.data!==void 0&&Re(n)},[P.data,n]);const K=at(U,{levels:c,now:Date.now(),path:f,range:u,search:p}),G=it(K),J=t==="requests"?$.length:K.length,X=t==="errors"&&v,W=Ne(()=>O!==null?"error":J===0?A?X?"summary":"list":"empty":X?"summary":"list",[J,A,O,X]),se=ue(null),Y=Ce({count:J,estimateSize:()=>Ze,getScrollElement:()=>se.current,initialRect:{height:te,width:800},observeElementRect:(I,Z)=>ke(I,Z,te),overscan:8}),ye=Y.getVirtualItems(),we={height:Y.getTotalSize(),position:"relative",width:"100%"};return E("div",{className:"flex flex-col gap-4","data-testid":"lunora-logs",children:[r(Xe,{liveError:z,onShardKeyChange:o,onShowArchive:()=>{a("archive"),b(!1)},onShowErrors:()=>{a("errors"),b(!1)},onShowRequests:()=>{a("requests"),b(!1)},shardKey:d,view:t}),t==="errors"&&r(He,{levelFilter:c,onLogPathChange:I=>{l(I.target.value)},onSearchChange:I=>{m(I.target.value)},onTimeRangeChange:I=>{h(I.target.value)},onToggleLevel:I=>{s(Z=>{const j=new Set(Z);return j.has(I)?j.delete(I):j.add(I),j})},onToggleSummary:()=>{b(I=>!I)},pathFilter:f,search:p,showSummary:v,timeRange:u}),t==="requests"&&r(We,{onOutcomeChange:I=>{S(I.target.value)},onPathChange:I=>{w(I.target.value)},onTableChange:I=>{N(I.target.value)},onUserChange:I=>{T(I.target.value)},outcomeFilter:L,pathPrefix:y,tableFilter:R,userIdFilter:x}),t==="archive"?r(ze,{shardKey:n}):E($e,{children:[W==="error"&&r(Se,{error:_,testId:"lg-error"}),W==="empty"&&r(ee,{description:e("Function and request logs for this shard show up here as your app handles traffic."),icon:r("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:r("path",{d:"M4 5h16M4 12h16M4 19h10"})}),testId:"lg-empty",title:e("No logs.")}),W==="summary"&&r(Ye,{summary:G}),W==="list"&&r("div",{className:"rounded-xl border border-border shadow-xs","data-testid":"lg-scroll",ref:se,style:et,children:r("div",{"aria-label":e("Recent logs"),"data-testid":"lg-table",role:"grid",style:we,children:ye.map(I=>t==="requests"?r(st,{entry:$[I.index],index:I.index,measureRef:Y.measureElement,onOpenTrace:M,start:I.start},I.key):r(rt,{entry:K[I.index],index:I.index,measureRef:Y.measureElement,onOpenTrace:M,start:I.start},I.key))})})]})]})};export{Wt as LogsPanel,at as filterLogs,it as summarizeLogs};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{E as ie}from"../packem_shared/error-alert-TYdKetJd.js";import{B as se}from"../packem_shared/badge-cAk9Di1Q.js";import{B as v}from"../packem_shared/button-BOPLD1un.js";import{E as oe}from"../packem_shared/empty-state-B939z6K2.js";import{I as ne}from"../packem_shared/input-CY5W3wzv.js";import{S as le}from"../packem_shared/scroll-area-DSJftwu_.js";import{Separator as de}from"@base-ui/react/separator";import{c as ce}from"../packem_shared/utils-bhneXptQ.js";import{jsx as t,jsxs as n,Fragment as me}from"react/jsx-runtime";import{useT as ue}from"../packem_shared/DEFAULT_LOCALE-A1Yg5ORA.js";import{c as ae,d as Y,b as Z,f as ee,g as he,i as te}from"../packem_shared/internal-CwaF9YNk.js";import{c as pe}from"react/compiler-runtime";import{useLunora as fe}from"@lunora/react";import{useState as O}from"react";import{u as be}from"../packem_shared/use-admin-query-P0RJrjsD.js";import{useAutoRefresh as xe}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-DuULO4XM.js";import{ADMIN_FUNCTIONS as X}from"../packem_shared/ADMIN_FUNCTIONS-B6z7VLYt.js";function ge({className:r,orientation:e="horizontal",...s}){return t(de,{"data-slot":"separator",orientation:e,className:ce("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",r),...s})}const ve=/https?:\/\/[^\s"'<>)]+/i,re=r=>r===void 0?void 0:ve.exec(r)?.[0],N=r=>r===void 0?"":Array.isArray(r)?r.join(", "):r,Ne=r=>{if(r!==void 0)return re(r.html)??re(r.text)},we=(r,e)=>{const s=e.trim().toLowerCase();return s===""?r:r.filter(o=>`${o.subject} ${N(o.to)} ${N(o.cc)}`.toLowerCase().includes(s))},ye=(r,e)=>{if(r.length!==0)return r.find(s=>s.id===e)??r[0]},Ce=ae(X.clearCapturedMail),Se=ae(X.sendTestMail),Te=r=>{const e=pe(38),{limit:s}=r,o=fe();let p;e[0]!==s?(p={limit:s},e[0]=s,e[1]=p):p=e[1];const{data:R,error:w,errorSource:y,isLoading:x,refetch:l}=be(X.getCapturedMail,p),[C,f]=O(null),[B,S]=O(null),[g,i]=O("html"),[c,D]=O(""),b=R?.entries??[],a=w??C,h=w===null?C:y;let T;e[2]!==o||e[3]!==l?(T=async()=>{f(null);try{await o.query(Ce,{},Y("")),S(null),l()}catch(m){f(Z(m))}},e[2]=o,e[3]=l,e[4]=T):T=e[4];const H=T;let k;e[5]!==o||e[6]!==l?(k=async()=>{f(null);try{await o.query(Se,{},Y("")),l()}catch(m){f(Z(m))}},e[5]=o,e[6]=l,e[7]=k):k=e[7];const q=k;let L;e[8]!==l?(L=()=>{l()},e[8]=l,e[9]=L):L=e[9],xe(L,!0);let A;e[10]!==H?(A=()=>{ee(H())},e[10]=H,e[11]=A):A=e[11];const U=A;let E;e[12]!==q?(E=()=>{ee(q())},e[12]=q,e[13]=E):E=e[13];const W=E;let _;e[14]===Symbol.for("react.memo_cache_sentinel")?(_=m=>{D(m.currentTarget.value)},e[14]=_):_=e[14];const K=_;let M;e[15]===Symbol.for("react.memo_cache_sentinel")?(M=m=>{const{id:u}=m.currentTarget.dataset;u!==void 0&&S(u)},e[15]=M):M=e[15];const Q=M;let j;e[16]===Symbol.for("react.memo_cache_sentinel")?(j=m=>{const u=m.currentTarget.dataset.tab;(u==="headers"||u==="html"||u==="text")&&i(u)},e[16]=j):j=e[16];const V=j,I=we(b,c),$=ye(I,B),d=Ne($);let z;e[17]!==d?(z=()=>{d!==void 0&&he(d)},e[17]=d,e[18]=z):z=e[18];const G=z;let F;e[19]!==d?(F=()=>{d!==void 0&&"window"in globalThis&&globalThis.window.open(d,"_blank","noopener")},e[19]=d,e[20]=F):F=e[20];const J=F;let P;return e[21]!==b||e[22]!==a||e[23]!==h||e[24]!==c||e[25]!==x||e[26]!==d||e[27]!==U||e[28]!==G||e[29]!==K||e[30]!==J||e[31]!==Q||e[32]!==V||e[33]!==W||e[34]!==$||e[35]!==g||e[36]!==I?(P={entries:b,error:a,errorSource:h,filter:c,isLoading:x,link:d,onClear:U,onCopyLink:G,onFilterChange:K,onOpenLink:J,onSelectMessage:Q,onSelectTab:V,onSendTest:W,selected:$,tab:g,visible:I},e[21]=b,e[22]=a,e[23]=h,e[24]=c,e[25]=x,e[26]=d,e[27]=U,e[28]=G,e[29]=K,e[30]=J,e[31]=Q,e[32]=V,e[33]=W,e[34]=$,e[35]=g,e[36]=I,e[37]=P):P=e[37],P},ke=`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,Le=r=>`${ke}${r}`,We=({limit:r=100})=>{const e=ue(),{entries:s,error:o,errorSource:p,filter:R,isLoading:w,link:y,onClear:x,onCopyLink:l,onFilterChange:C,onOpenLink:f,onSelectMessage:B,onSelectTab:S,onSendTest:g,selected:i,tab:c,visible:D}=Te({limit:r}),b=a=>e(a==="html"?"HTML":a==="text"?"Plain text":"Headers");return n("div",{className:"flex flex-col gap-4","data-testid":"mail-panel",children:[n("div",{className:"flex flex-wrap items-center gap-2",children:[t(v,{"data-testid":"mail-send-test",onClick:g,size:"sm",type:"button",variant:"outline",children:e("Send test")}),t(v,{"data-testid":"mail-clear",disabled:s.length===0,onClick:x,size:"sm",type:"button",variant:"outline",children:e("Clear inbox")}),s.length>0&&t(se,{className:"ml-auto","data-testid":"mail-count",variant:"secondary",children:e("{count} messages",{count:s.length})})]}),o!==null&&t(ie,{error:p,testId:"mail-error"}),o===null&&!w&&s.length===0&&t(oe,{description:e("Email your app sends in dev is captured here — nothing is delivered."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[t("path",{d:"M4 5h16v14H4z"}),t("path",{d:"m4 6 8 6 8-6"})]}),testId:"mail-empty",title:e("No captured email.")}),s.length>0&&n("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-[minmax(0,22rem)_1fr]","data-testid":"mail-reader",children:[n("div",{className:"flex flex-col gap-2",children:[t(ne,{"aria-label":e("Search messages"),"data-testid":"mail-search",onChange:C,placeholder:e("Filter messages"),type:"search",value:R}),t(le,{className:"max-h-[32rem] rounded-xl border border-border bg-card shadow-xs","data-testid":"mail-list",children:t("ul",{className:"divide-y",children:D.map(a=>{const h=a.id===i?.id;return t("li",{children:n("button",{className:`flex w-full flex-col items-start gap-0.5 px-3 py-2 text-left text-sm hover:bg-muted/60 ${h?"bg-muted":""}`,"data-active":h,"data-id":a.id,"data-testid":"mail-list-item",onClick:B,type:"button",children:[t("span",{className:"w-full truncate font-medium",children:a.subject||e("(no subject)")}),t("span",{className:"w-full truncate text-xs text-muted-foreground",children:N(a.to)}),t("span",{className:"text-xs text-muted-foreground tabular-nums",children:te(a.capturedAt,"—")})]})},a.id)})})})]}),i!==void 0&&n("div",{className:"flex min-w-0 flex-col gap-3 rounded-xl border border-border bg-card p-4 shadow-xs","data-testid":"mail-detail",children:[n("div",{className:"flex flex-col gap-1",children:[t("h2",{className:"truncate text-base font-semibold","data-testid":"mail-subject",children:i.subject||e("(no subject)")}),n("dl",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs text-muted-foreground",children:[t("dt",{children:e("From")}),t("dd",{className:"truncate font-mono",children:i.from??"—"}),t("dt",{children:e("To")}),t("dd",{className:"truncate font-mono",children:N(i.to)}),i.cc!==void 0&&i.cc.length>0&&n(me,{children:[t("dt",{children:e("Cc")}),t("dd",{className:"truncate font-mono",children:N(i.cc)})]}),t("dt",{children:e("Sent")}),t("dd",{className:"tabular-nums",children:te(i.capturedAt,"—")})]})]}),n("div",{className:"flex flex-wrap items-center gap-2","data-testid":"mail-actions",children:[t(v,{"data-testid":"mail-copy-link",disabled:y===void 0,onClick:l,size:"sm",type:"button",variant:"outline",children:e("Copy link")}),t(v,{"data-testid":"mail-open-link",disabled:y===void 0,onClick:f,size:"sm",type:"button",variant:"outline",children:e("Open in new tab")})]}),t(ge,{}),t("div",{className:"flex items-center gap-1","data-testid":"mail-tabs",role:"tablist",children:["html","text","headers"].map(a=>t(v,{"aria-selected":c===a,"data-tab":a,"data-testid":`mail-tab-${a}`,onClick:S,role:"tab",size:"sm",type:"button",variant:c===a?"secondary":"ghost",children:b(a)},a))}),n("div",{className:"min-h-[12rem]",children:[c==="html"&&(i.html===void 0?t("p",{className:"text-sm text-muted-foreground",children:e("No HTML body.")}):t("iframe",{className:"h-[24rem] w-full rounded-md border bg-white","data-testid":"mail-preview-html",sandbox:"",srcDoc:Le(i.html),title:e("Email preview")})),c==="text"&&(i.text===void 0?t("p",{className:"text-sm text-muted-foreground",children:e("No text body.")}):t("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-text",children:i.text})),c==="headers"&&(i.headers===void 0||Object.keys(i.headers).length===0?t("p",{className:"text-sm text-muted-foreground",children:e("No headers.")}):t("pre",{className:"overflow-auto whitespace-pre-wrap rounded-md border bg-muted/30 p-3 text-xs","data-testid":"mail-preview-headers",children:Object.entries(i.headers).map(([a,h])=>`${a}: ${h}`).join(`
|
|
2
|
-
`)}))]})]})]})]})};export{We as MailPanel};
|