@lunora/studio 1.0.0-alpha.37 → 1.0.0-alpha.370
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/README.md +4 -4
- package/dist/index.d.mts +1626 -0
- package/dist/index.d.ts +1018 -809
- package/dist/index.mjs +1 -0
- package/dist/mount.d.mts +23 -0
- package/dist/mount.d.ts +13 -11
- 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.mjs +10 -0
- package/dist/packem_chunks/FileBrowser.mjs +4 -0
- 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.mjs +25 -0
- package/dist/packem_chunks/TableEditor.mjs +1 -0
- package/dist/packem_chunks/agents-panel.mjs +1 -0
- package/dist/packem_chunks/ai-knowledge.mjs +1 -0
- package/dist/packem_chunks/ai-usage-panel.mjs +1 -0
- package/dist/packem_chunks/analytics-panel.mjs +1 -0
- package/dist/packem_chunks/architecture-panel.mjs +1 -0
- package/dist/packem_chunks/assistant-panel.mjs +3 -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.mjs +4 -0
- 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/privacy-requests-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/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/theme-indicator.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/ADMIN_FUNCTIONS-DUXsXId1.mjs +1 -0
- package/dist/packem_shared/ApiDocsPanel-B9S9l1Ce.mjs +2 -0
- package/dist/packem_shared/ApiReferencePanel-CQxU1Ocx.mjs +1 -0
- package/dist/packem_shared/CommandPalette-BZCHLpst.mjs +1 -0
- package/dist/packem_shared/ConfirmButton-CIXYF6Mg.mjs +1 -0
- package/dist/packem_shared/ConnectionBadge-BfcoN-VE.mjs +1 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs +1 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-D5YMT0gM.mjs +1 -0
- package/dist/packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs +1 -0
- package/dist/packem_shared/DataBrowser-Dm-jhIUP.mjs +4 -0
- package/dist/packem_shared/DataFilters--ocFTVT2.mjs +1 -0
- package/dist/packem_shared/ErrorBoundary-BWNF98VF.mjs +1 -0
- package/dist/packem_shared/GlobalDataBrowser-C1Y8GUhe.mjs +1 -0
- package/dist/packem_shared/HomePanel-B5ytwPIo.mjs +1 -0
- package/dist/packem_shared/MigrationsPanel-CwLikxDT.mjs +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-BFDG91tn.mjs +1 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.mjs +1 -0
- package/dist/packem_shared/ScheduledJobs-QCTRdugp.mjs +1 -0
- package/dist/packem_shared/ShardInput-CoySruKZ.mjs +1 -0
- package/dist/packem_shared/Studio-wrwGcG7J.mjs +1 -0
- package/dist/packem_shared/StudioApp-D1XLXXe_.mjs +1 -0
- package/dist/packem_shared/StudioI18nProvider-CGXCPnQn.mjs +1 -0
- package/dist/packem_shared/advisor-view-CzieqKMe.mjs +5 -0
- package/dist/packem_shared/aggregateMetrics-DKFJc-o5.mjs +1 -0
- package/dist/packem_shared/alert-PB5W11MM.mjs +1 -0
- package/dist/packem_shared/app.d-jC98McBG.d.mts +358 -0
- package/dist/packem_shared/app.d-jC98McBG.d.ts +358 -0
- package/dist/packem_shared/assistant-provider-Bp72uWsq.mjs +1 -0
- package/dist/packem_shared/assistant-reason-D6EwMCxT.mjs +1 -0
- package/dist/packem_shared/auth-pager-DW77WeZw.mjs +1 -0
- package/dist/packem_shared/badge-r_5B4LHP.mjs +1 -0
- package/dist/packem_shared/bar-chart-BCsEIQoQ.mjs +6 -0
- package/dist/packem_shared/browser-storage-BH1MxLZs.mjs +1 -0
- package/dist/packem_shared/button-q0UYSmrn.mjs +1 -0
- package/dist/packem_shared/card-By2O8ULa.mjs +1 -0
- package/dist/packem_shared/cf-links-C4DVTr8A.mjs +1 -0
- package/dist/packem_shared/checkbox-CnS9cyCz.mjs +1 -0
- package/dist/packem_shared/control-button-BOZ5K-FC.mjs +1 -0
- package/dist/packem_shared/data-grid-B5m1OosL.mjs +1 -0
- package/dist/packem_shared/data-view-params-C-_G-biH.mjs +1 -0
- package/dist/packem_shared/diagram-export-panel-Vdt-DZnO.mjs +2 -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-DKXm5h19.mjs +6 -0
- package/dist/packem_shared/grid-features-Drvfswwy.mjs +6 -0
- package/dist/packem_shared/grid-pagination-DY2erU65.mjs +1 -0
- package/dist/packem_shared/home-panel-5fGktYeD.mjs +3 -0
- package/dist/packem_shared/input-CXhxesPC.mjs +1 -0
- package/dist/packem_shared/internal-hIuTpSbx.mjs +2 -0
- package/dist/packem_shared/label-DKFzyHq6.mjs +1 -0
- package/dist/packem_shared/live-status-D1GasNsH.mjs +1 -0
- package/dist/packem_shared/log-fields-BolUoZ9g.mjs +1 -0
- package/dist/packem_shared/log-line-BH0iWiBv.mjs +1 -0
- package/dist/packem_shared/metrics-format-1sNGG47R.mjs +1 -0
- package/dist/packem_shared/modal-shell-CDztwLnv.mjs +1 -0
- package/dist/packem_shared/operation-console-provider-DoloEvon.mjs +1 -0
- package/dist/packem_shared/recording-client-z4CBi0y8.mjs +1 -0
- package/dist/packem_shared/reference-view-DENugPcj.mjs +13 -0
- package/dist/packem_shared/schema-diagram-CtVPhOGj.mjs +2 -0
- package/dist/packem_shared/scroll-area-CXCQH7VT.mjs +2 -0
- package/dist/packem_shared/select-DPyS18Vy.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-DCwooMGW.mjs +1 -0
- package/dist/packem_shared/stat-card-BAv73QtB.mjs +1 -0
- package/dist/packem_shared/storage-tier-C2mKwYRj.mjs +1 -0
- package/dist/packem_shared/studio-Cm9ea8j7.mjs +2 -0
- package/dist/packem_shared/table-D0SBiDu-.mjs +2 -0
- package/dist/packem_shared/table-list-sidebar-kpHaDWjy.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-CaOm4JS3.mjs +1 -0
- package/dist/packem_shared/use-admin-spec-CK7mk3Ui.mjs +1 -0
- package/dist/packem_shared/use-assistant-rpc-GCUK2zPa.mjs +1 -0
- package/dist/packem_shared/use-async-submit-D0r7-m2J.mjs +1 -0
- package/dist/packem_shared/use-auth-config-CG7VvAvQ.mjs +1 -0
- package/dist/packem_shared/use-mirrored-ref-CVDf2z1M.mjs +1 -0
- package/dist/packem_shared/use-open-trace-BJKMJjeS.mjs +1 -0
- package/dist/packem_shared/use-shard-key-BsP3o5wT.mjs +1 -0
- package/dist/packem_shared/use-studio-client-DCA50tF2.mjs +1 -0
- package/dist/packem_shared/useDebounced-DVeQ5-oW.mjs +1 -0
- package/dist/packem_shared/utils-bhneXptQ.mjs +1 -0
- package/dist/packem_shared/virtual-rect-D_j7aLxX.mjs +1 -0
- package/dist/standalone/chunk-2DT3QG6Q.js +1 -0
- package/dist/standalone/chunk-2EB7FN5S.js +1 -0
- package/dist/standalone/chunk-2JD7ZSZV.js +4 -0
- package/dist/standalone/chunk-2TBMJ7XV.js +1 -0
- package/dist/standalone/chunk-2W4UO5BC.js +1 -0
- package/dist/standalone/chunk-36RORAX3.js +1 -0
- package/dist/standalone/chunk-3D67ZJRW.js +1 -0
- package/dist/standalone/chunk-3IMLG2OT.js +1 -0
- package/dist/standalone/chunk-4EPW63HS.js +1 -0
- package/dist/standalone/chunk-4NKJV7YX.js +1 -0
- package/dist/standalone/chunk-4PI2OSSP.js +1 -0
- package/dist/standalone/chunk-5BXW4BR6.js +1 -0
- package/dist/standalone/chunk-5KZIXB6E.js +1 -0
- package/dist/standalone/chunk-5PEAXTYQ.js +1 -0
- package/dist/standalone/chunk-5QUEED5Z.js +1 -0
- package/dist/standalone/chunk-5SKGLIO5.js +1 -0
- package/dist/standalone/chunk-5X6BEWUI.js +1 -0
- package/dist/standalone/chunk-5XN5GQP5.js +1 -0
- package/dist/standalone/chunk-62XXKQH3.js +1 -0
- package/dist/standalone/chunk-6FLYVL6K.js +1 -0
- package/dist/standalone/chunk-6FNFOTRR.js +1 -0
- package/dist/standalone/chunk-6FPV3EK2.js +1 -0
- package/dist/standalone/chunk-6G3E4PJ2.js +1 -0
- package/dist/standalone/chunk-6LLUZFDD.js +3 -0
- package/dist/standalone/chunk-6VLPJOPR.js +1 -0
- package/dist/standalone/chunk-6XL3EV2X.js +8 -0
- package/dist/standalone/chunk-7N2OPADC.js +5 -0
- package/dist/standalone/chunk-7TTX42IR.js +1 -0
- package/dist/standalone/chunk-7YZKGLGA.js +1 -0
- package/dist/standalone/chunk-A2Q3TGIQ.js +1 -0
- package/dist/standalone/chunk-AA3R3QNN.js +1 -0
- package/dist/standalone/chunk-AMOPLAX6.js +1 -0
- package/dist/standalone/chunk-ARGGBECJ.js +1 -0
- package/dist/standalone/chunk-B4K4IET7.js +1 -0
- package/dist/standalone/chunk-BG2CJOVS.js +1 -0
- package/dist/standalone/chunk-BKI3JMXQ.js +1 -0
- package/dist/standalone/chunk-CL3JOU6F.js +1 -0
- package/dist/standalone/chunk-CLYI7JF2.js +1 -0
- package/dist/standalone/chunk-CNQBTB5C.js +1 -0
- package/dist/standalone/chunk-CVSIFPI5.js +1 -0
- package/dist/standalone/chunk-D65UVZIA.js +1 -0
- package/dist/standalone/chunk-DA2CAFXI.js +1 -0
- package/dist/standalone/chunk-DBLSNTHL.js +1 -0
- package/dist/standalone/chunk-E5LR7G22.js +6 -0
- package/dist/standalone/chunk-E6FH3ZOB.js +1 -0
- package/dist/standalone/chunk-E6NWADUS.js +1 -0
- package/dist/standalone/chunk-F7EKRF7I.js +1 -0
- package/dist/standalone/chunk-FHKZP25N.js +1 -0
- package/dist/standalone/chunk-FTJ6RR64.js +4 -0
- package/dist/standalone/chunk-FWM5Z6CH.js +1 -0
- package/dist/standalone/chunk-G2Z7WFAT.js +1 -0
- package/dist/standalone/chunk-G6PUHYKD.js +1 -0
- package/dist/standalone/chunk-GM7MBMYI.js +1 -0
- package/dist/standalone/chunk-GWNGVKLG.js +1 -0
- package/dist/standalone/chunk-GXTSE66Z.js +1 -0
- package/dist/standalone/chunk-H6KIDQ6V.js +1 -0
- package/dist/standalone/chunk-HCOF7HOM.js +1 -0
- package/dist/standalone/chunk-HFBSWKJS.js +1 -0
- package/dist/standalone/chunk-HGNPJO7S.js +1 -0
- package/dist/standalone/chunk-HLWDT5VZ.js +1 -0
- package/dist/standalone/chunk-HWFV5UCF.js +1 -0
- package/dist/standalone/chunk-IDHU47FP.js +1 -0
- package/dist/standalone/chunk-IDNHNCZV.js +14 -0
- package/dist/standalone/chunk-IHWSRI72.js +1 -0
- package/dist/standalone/chunk-J45HAKBU.js +1 -0
- package/dist/standalone/chunk-J77YDVBD.js +3 -0
- package/dist/standalone/chunk-JG74C6DH.js +1 -0
- package/dist/standalone/chunk-JMZT3CEW.js +1 -0
- package/dist/standalone/chunk-JT7UYB6L.js +1 -0
- package/dist/standalone/chunk-JWQOB4EW.js +7 -0
- package/dist/standalone/chunk-K3DHV2YQ.js +1 -0
- package/dist/standalone/chunk-K5BAERB3.js +1 -0
- package/dist/standalone/chunk-KAK3HS5E.js +2 -0
- package/dist/standalone/chunk-KGLIQIZU.js +1 -0
- package/dist/standalone/chunk-KTK4NDWQ.js +1 -0
- package/dist/standalone/chunk-KZ6YQ234.js +1 -0
- package/dist/standalone/chunk-LZHT6UGJ.js +1 -0
- package/dist/standalone/chunk-MGJZKA6O.js +1 -0
- package/dist/standalone/chunk-MQBQBEGM.js +1 -0
- package/dist/standalone/chunk-NEFVDZHP.js +1 -0
- package/dist/standalone/chunk-NGVP66OH.js +1 -0
- package/dist/standalone/chunk-NHUEXULQ.js +1 -0
- package/dist/standalone/chunk-NSAQ3EDS.js +1 -0
- package/dist/standalone/chunk-NYJXRBOK.js +1 -0
- package/dist/standalone/chunk-O24UFHUY.js +1 -0
- package/dist/standalone/chunk-O3AZ7JKE.js +1 -0
- package/dist/standalone/chunk-O6W2YLME.js +1 -0
- package/dist/standalone/chunk-O7XG7DTU.js +1 -0
- package/dist/standalone/chunk-OBYE3IXP.js +1 -0
- package/dist/standalone/chunk-OCYIIOBX.js +1 -0
- package/dist/standalone/chunk-ONTGYVAN.js +1 -0
- package/dist/standalone/chunk-OOOT4H45.js +33 -0
- package/dist/standalone/chunk-OQOKF4LL.js +1 -0
- package/dist/standalone/chunk-OS5DOPZW.js +1 -0
- package/dist/standalone/chunk-P6VNMPWR.js +1 -0
- package/dist/standalone/chunk-PDBCAPP6.js +1 -0
- package/dist/standalone/chunk-PDBW6GTJ.js +1 -0
- package/dist/standalone/chunk-PFNK2MGW.js +1 -0
- package/dist/standalone/chunk-PMDLNIHA.js +1 -0
- package/dist/standalone/chunk-PZGLD7G7.js +5 -0
- package/dist/standalone/chunk-Q3WMP7OA.js +3 -0
- package/dist/standalone/chunk-Q65X2ZIP.js +1 -0
- package/dist/standalone/chunk-QAOZXPLU.js +1 -0
- package/dist/standalone/chunk-QBRBGDCL.js +1 -0
- package/dist/standalone/chunk-QR6RYVUD.js +1 -0
- package/dist/standalone/chunk-QRA7AKYO.js +1 -0
- package/dist/standalone/chunk-QSUQAWEP.js +1 -0
- package/dist/standalone/chunk-RIAOZECW.js +1 -0
- package/dist/standalone/chunk-RLJYW6TY.js +1 -0
- package/dist/standalone/chunk-RTS5G3ET.js +2 -0
- package/dist/standalone/chunk-S36FVTKK.js +1 -0
- package/dist/standalone/chunk-SGIBDCPB.js +59 -0
- package/dist/standalone/chunk-STK3KLLV.js +1 -0
- package/dist/standalone/chunk-TDPAITW5.js +1 -0
- package/dist/standalone/chunk-TW4O2BA5.js +159 -0
- package/dist/standalone/chunk-TZ5PSNZW.js +1 -0
- package/dist/standalone/chunk-UBX5ZPLV.js +1 -0
- package/dist/standalone/chunk-UCJWHNUJ.js +1 -0
- package/dist/standalone/chunk-V3SVDOVD.js +1 -0
- package/dist/standalone/chunk-V6YA4TAL.js +1 -0
- package/dist/standalone/chunk-VB2XDTVB.js +6 -0
- package/dist/standalone/chunk-VFB22IM2.js +1 -0
- package/dist/standalone/chunk-VGIDGJ5K.js +1 -0
- package/dist/standalone/chunk-VJC5PQ7D.js +1 -0
- package/dist/standalone/chunk-VNH4OBJS.js +1 -0
- package/dist/standalone/chunk-VUOEJJUH.js +1 -0
- package/dist/standalone/chunk-W42GZL6T.js +1 -0
- package/dist/standalone/chunk-WGGSW4E2.js +1 -0
- package/dist/standalone/chunk-XLYFGUEF.js +1 -0
- package/dist/standalone/chunk-XMOG3LIP.js +1 -0
- package/dist/standalone/chunk-Y2JFJP4B.js +1 -0
- package/dist/standalone/{chunk-BJGBHGK3.js → chunk-Y2YLTUMD.js} +1 -1
- package/dist/standalone/chunk-YLXNXB7E.js +1 -0
- package/dist/standalone/chunk-YORPLSI5.js +1 -0
- package/dist/standalone/chunk-YUVGMKHG.js +1 -0
- package/dist/standalone/chunk-YYIW5EKO.js +30 -0
- package/dist/standalone/chunk-ZCN4YUCA.js +1 -0
- package/dist/standalone/chunk-ZEWRYBCB.js +1 -0
- package/dist/standalone/chunk-ZGZSTTKN.js +10 -0
- package/dist/standalone/chunk-ZM3A5WO5.js +1 -0
- package/dist/standalone/chunk-ZPQBVYNN.js +1 -0
- package/dist/standalone/chunk-ZSWW2UGP.js +1 -0
- package/dist/standalone/chunk-ZYZ5ATT2.js +1 -0
- package/dist/standalone/studio.js +9 -214
- package/dist/styles.css +2 -2
- package/package.json +27 -22
- package/dist/index.js +0 -41
- package/dist/mount.js +0 -27
- package/dist/packem_chunks/ApiTab.js +0 -251
- package/dist/packem_chunks/AuditPanel.js +0 -200
- package/dist/packem_chunks/ExportImportPanel.js +0 -198
- package/dist/packem_chunks/FileBrowser.js +0 -2932
- package/dist/packem_chunks/FunctionRunner.js +0 -343
- package/dist/packem_chunks/FunctionStatsPanel.js +0 -377
- package/dist/packem_chunks/HealthPanel.js +0 -648
- package/dist/packem_chunks/InsightsPanel.js +0 -462
- package/dist/packem_chunks/LogsPanel.js +0 -827
- package/dist/packem_chunks/MailPanel.js +0 -353
- package/dist/packem_chunks/MetricsPanel.js +0 -1344
- package/dist/packem_chunks/MigrationsPanel.js +0 -239
- package/dist/packem_chunks/PitrPanel.js +0 -252
- package/dist/packem_chunks/SchemaViewer.js +0 -2513
- package/dist/packem_chunks/SecurityAdvisorPanel.js +0 -95
- package/dist/packem_chunks/SettingsPanel.js +0 -391
- package/dist/packem_chunks/SqlEditorPanel.js +0 -2323
- package/dist/packem_chunks/TableEditor.js +0 -313
- package/dist/packem_chunks/analytics-panel.js +0 -261
- package/dist/packem_chunks/auth-config-panel.js +0 -179
- package/dist/packem_chunks/auth-sessions-panel.js +0 -175
- package/dist/packem_chunks/containers-panel.js +0 -247
- package/dist/packem_chunks/dashboards-panel.js +0 -780
- package/dist/packem_chunks/fanout-panel.js +0 -482
- package/dist/packem_chunks/flags-panel.js +0 -176
- package/dist/packem_chunks/kv-browser.js +0 -1896
- package/dist/packem_chunks/log-drains-panel.js +0 -273
- package/dist/packem_chunks/organizations-panel.js +0 -670
- package/dist/packem_chunks/payments-panel.js +0 -186
- package/dist/packem_chunks/permissions-panel.js +0 -805
- package/dist/packem_chunks/queues-panel.js +0 -1052
- package/dist/packem_chunks/rls-panel.js +0 -315
- package/dist/packem_chunks/schedule-panel.js +0 -831
- package/dist/packem_chunks/sparkline.js +0 -79
- package/dist/packem_chunks/storage-rules-panel.js +0 -140
- package/dist/packem_chunks/subscriptions-panel.js +0 -238
- package/dist/packem_chunks/users-panel.js +0 -1265
- package/dist/packem_chunks/vector-browser.js +0 -281
- package/dist/packem_chunks/workflows-panel.js +0 -562
- package/dist/packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js +0 -52
- package/dist/packem_shared/ApiDocsPanel-D4CJf2ad.js +0 -842
- package/dist/packem_shared/ApiReferencePanel-Co_wpRF2.js +0 -230
- package/dist/packem_shared/CommandPalette-BUPpbpMc.js +0 -373
- package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +0 -59
- package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +0 -111
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +0 -50
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +0 -89
- package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +0 -27
- package/dist/packem_shared/DataBrowser-BeVNxSVm.js +0 -4493
- package/dist/packem_shared/DataFilters-FNquMaiu.js +0 -249
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
- package/dist/packem_shared/GlobalDataBrowser-ErfvIs1S.js +0 -289
- package/dist/packem_shared/HomePanel-D9MQk8I7.js +0 -14
- package/dist/packem_shared/OpenRpcReferencePanel-DLWzrIx9.js +0 -192
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
- package/dist/packem_shared/ScheduledJobs-ClaNpZsg.js +0 -262
- package/dist/packem_shared/ShardInput-gx_DZXXn.js +0 -107
- package/dist/packem_shared/Studio-C48P1K5W.js +0 -16
- package/dist/packem_shared/StudioApp-Cqh-SYm2.js +0 -657
- package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
- package/dist/packem_shared/advisor-view-D3-U4kRR.js +0 -159
- package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +0 -108
- package/dist/packem_shared/alert-CdAET2K_.js +0 -68
- package/dist/packem_shared/app.d-CNLRTrWw.d.ts +0 -300
- package/dist/packem_shared/badge-B2PKA1-5.js +0 -49
- package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
- package/dist/packem_shared/browser-storage-tLOxkIHd.js +0 -185
- package/dist/packem_shared/button-BhsN2uZH.js +0 -49
- package/dist/packem_shared/card-DURq3ElK.js +0 -175
- package/dist/packem_shared/cf-links-BZfRdxSE.js +0 -8
- package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
- package/dist/packem_shared/data-grid-Jz8FqQ2C.js +0 -183
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +0 -96
- package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +0 -280
- package/dist/packem_shared/empty-state-DY_oe0k6.js +0 -98
- package/dist/packem_shared/error-alert-BBT6D22d.js +0 -114
- package/dist/packem_shared/grid-features-CUr8Z1_O.js +0 -745
- package/dist/packem_shared/home-panel-CoGxi-oj.js +0 -1639
- package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
- package/dist/packem_shared/internal-DTsYVn-g.js +0 -97
- package/dist/packem_shared/label-D8ykjn5J.js +0 -46
- package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
- package/dist/packem_shared/reference-view-CSKyUyPl.js +0 -2141
- package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
- package/dist/packem_shared/select-UkNYCT3s.js +0 -273
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/packem_shared/skeleton-CGhL0p20.js +0 -45
- package/dist/packem_shared/sparkline-BnA1kC9X.js +0 -93
- package/dist/packem_shared/storage-tier-CL98eOvn.js +0 -85
- package/dist/packem_shared/studio-CPHA_-3I.js +0 -4015
- package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
- package/dist/packem_shared/table-list-sidebar-B5psdSV1.js +0 -832
- package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
- package/dist/packem_shared/use-admin-query-BHPKmPuj.js +0 -106
- package/dist/packem_shared/use-auth-capabilities-C-VH0oJJ.js +0 -32
- package/dist/packem_shared/useDebounced-Dxncpg6z.js +0 -32
- package/dist/packem_shared/utils-B05Dmz_H.js +0 -8
- package/dist/packem_shared/virtual-rect-CVMUskSm.js +0 -10
- package/dist/standalone/chunk-22W5VKZ6.js +0 -1
- package/dist/standalone/chunk-2GGMGPEP.js +0 -1
- package/dist/standalone/chunk-2K47A3P6.js +0 -1
- package/dist/standalone/chunk-2NGUNNGW.js +0 -1
- package/dist/standalone/chunk-2THHW7BC.js +0 -1
- package/dist/standalone/chunk-3CJW6NWG.js +0 -4
- package/dist/standalone/chunk-3OA7PECS.js +0 -6
- package/dist/standalone/chunk-46K3NKPA.js +0 -1
- package/dist/standalone/chunk-4QHKBC77.js +0 -1
- package/dist/standalone/chunk-5OH3VPZF.js +0 -1
- package/dist/standalone/chunk-5OIBXYZM.js +0 -1
- package/dist/standalone/chunk-6GFEVKJP.js +0 -1
- package/dist/standalone/chunk-6WRZP62V.js +0 -1
- package/dist/standalone/chunk-764T6X6X.js +0 -1
- package/dist/standalone/chunk-7SLSB2TS.js +0 -4
- package/dist/standalone/chunk-7TJJXVSE.js +0 -1
- package/dist/standalone/chunk-7VF3IAAW.js +0 -2
- package/dist/standalone/chunk-AHILM3ZP.js +0 -1
- package/dist/standalone/chunk-AJIUI7DD.js +0 -1
- package/dist/standalone/chunk-ATYUMPDM.js +0 -1
- package/dist/standalone/chunk-BACPICH6.js +0 -1
- package/dist/standalone/chunk-BI35RXKQ.js +0 -1
- package/dist/standalone/chunk-BOXSWNXZ.js +0 -1
- package/dist/standalone/chunk-BQUQS7QN.js +0 -1
- package/dist/standalone/chunk-CKSHCYGC.js +0 -2
- package/dist/standalone/chunk-DC72CQY4.js +0 -76
- package/dist/standalone/chunk-DORBUITF.js +0 -1
- package/dist/standalone/chunk-DVC6YWVP.js +0 -1
- package/dist/standalone/chunk-DVKPRFIJ.js +0 -1
- package/dist/standalone/chunk-DWDILV2E.js +0 -1
- package/dist/standalone/chunk-DWTBY343.js +0 -1
- package/dist/standalone/chunk-EUIHTPKI.js +0 -1
- package/dist/standalone/chunk-FCSPAJW4.js +0 -1
- package/dist/standalone/chunk-GMSGZDDH.js +0 -13
- package/dist/standalone/chunk-GTM65MVX.js +0 -1
- package/dist/standalone/chunk-HV7G6DFP.js +0 -5
- package/dist/standalone/chunk-ILCTSAOB.js +0 -1
- package/dist/standalone/chunk-IOFMK4D7.js +0 -1
- package/dist/standalone/chunk-J6J54MBP.js +0 -1
- package/dist/standalone/chunk-JE2YOAB7.js +0 -4
- package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
- package/dist/standalone/chunk-K3GNLVYK.js +0 -1
- package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
- package/dist/standalone/chunk-KJJ3WM6H.js +0 -4
- package/dist/standalone/chunk-KZ6INM5M.js +0 -1
- package/dist/standalone/chunk-LAK5VSPI.js +0 -1
- package/dist/standalone/chunk-LD2R263D.js +0 -1
- package/dist/standalone/chunk-LI43EKM6.js +0 -1
- package/dist/standalone/chunk-M55U7NHO.js +0 -1
- package/dist/standalone/chunk-MPTM7ZU3.js +0 -3
- package/dist/standalone/chunk-MPYFGAOW.js +0 -1
- package/dist/standalone/chunk-NKJDGOM3.js +0 -1
- package/dist/standalone/chunk-O3NAGRTR.js +0 -1
- package/dist/standalone/chunk-OCHNCAXJ.js +0 -1
- package/dist/standalone/chunk-OIZ4CHPN.js +0 -8
- package/dist/standalone/chunk-OY3GVYS7.js +0 -4
- package/dist/standalone/chunk-PACH5AHG.js +0 -1
- package/dist/standalone/chunk-PN5NCZDX.js +0 -1
- package/dist/standalone/chunk-PVZI3CXP.js +0 -19
- package/dist/standalone/chunk-PZ7HD5T2.js +0 -1
- package/dist/standalone/chunk-Q52CHOSY.js +0 -1
- package/dist/standalone/chunk-QAFAJBAW.js +0 -1
- package/dist/standalone/chunk-QBAT52GB.js +0 -1
- package/dist/standalone/chunk-QLM6FYZW.js +0 -2
- package/dist/standalone/chunk-RRAFQ5G2.js +0 -1
- package/dist/standalone/chunk-RRCPZMC2.js +0 -22
- package/dist/standalone/chunk-RSEEHNFI.js +0 -1
- package/dist/standalone/chunk-SEU5V7I6.js +0 -1
- package/dist/standalone/chunk-SG3ALJJU.js +0 -1
- package/dist/standalone/chunk-SLKF2L74.js +0 -1
- package/dist/standalone/chunk-TAD43CG5.js +0 -1
- package/dist/standalone/chunk-TBMYIZIO.js +0 -1
- package/dist/standalone/chunk-TDL7NEWA.js +0 -1
- package/dist/standalone/chunk-TO4JQX7W.js +0 -1
- package/dist/standalone/chunk-TOJ3TC35.js +0 -1
- package/dist/standalone/chunk-TQ36RWOP.js +0 -1
- package/dist/standalone/chunk-U4OAQPBT.js +0 -1
- package/dist/standalone/chunk-UK64ZSUW.js +0 -1
- package/dist/standalone/chunk-VLXV72QE.js +0 -1
- package/dist/standalone/chunk-VTGBPW24.js +0 -1
- package/dist/standalone/chunk-WI7GWFEG.js +0 -1
- package/dist/standalone/chunk-WXPWVBIY.js +0 -1
- package/dist/standalone/chunk-X5P2WRYI.js +0 -1
- package/dist/standalone/chunk-X7MMBSNW.js +0 -1
- package/dist/standalone/chunk-XLQ4BHBD.js +0 -1
- package/dist/standalone/chunk-XNJNSCLM.js +0 -1
- package/dist/standalone/chunk-XUGSA2NG.js +0 -1
- package/dist/standalone/chunk-Y2ZPNDL7.js +0 -4
- package/dist/standalone/chunk-YAECF5LW.js +0 -1
- package/dist/standalone/chunk-YEVCU7TB.js +0 -13
- package/dist/standalone/chunk-ZHVTQ37P.js +0 -1
- package/dist/standalone/chunk-ZIGWVHCS.js +0 -1
- package/dist/standalone/chunk-ZPP2KOR4.js +0 -1
- package/dist/standalone/chunk-ZPUO7FNI.js +0 -1
- package/dist/standalone/chunk-ZU4DZ6NK.js +0 -1
- package/dist/standalone/chunk-ZYRGPDZB.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as I}from"react/compiler-runtime";import{useMemo as A,useState as ne}from"react";import{useT as H}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as q}from"../packem_shared/utils-bhneXptQ.mjs";import{MigrationsPanel as oe}from"../packem_shared/MigrationsPanel-CwLikxDT.mjs";import{useNavigate as se,useSearch as re}from"@tanstack/react-router";import{E as ae}from"../packem_shared/error-alert-DKXm5h19.mjs";import{E as de}from"../packem_shared/empty-state-D7jEML_T.mjs";import{u as D}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{ADMIN_FUNCTIONS as L}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as ce,f as le}from"../packem_shared/internal-hIuTpSbx.mjs";import{S as fe}from"../packem_shared/schema-diagram-CtVPhOGj.mjs";import{jsx as l,jsxs as b}from"react/jsx-runtime";const J=1;function ue(t){const e={},i=Object.keys(t);i.sort();for(const n of i)e[n]=t[n];return e}const O=t=>typeof t=="object"&&t!==null,me=t=>O(t)&&O(t.fields)&&O(t.indexes)&&O(t.relations)&&typeof t.shardMode=="string",he=t=>{if(t===void 0||t.trim()==="")return{status:"absent"};let e;try{e=JSON.parse(t)}catch(n){return{error:`baseline is not valid JSON: ${n instanceof Error?n.message:String(n)}`,status:"invalid"}}if(!O(e)||e.version!==J||!O(e.tables))return{error:`baseline is malformed or written by an incompatible version (expected version ${String(J)})`,status:"invalid"};for(const[n,o]of Object.entries(e.tables))if(!me(o))return{error:`baseline table "${n}" has an invalid structure`,status:"invalid"};return{snapshot:{jurisdiction:typeof e.jurisdiction=="string"?e.jurisdiction:void 0,migrationIds:Array.isArray(e.migrationIds)?e.migrationIds:[],tables:e.tables,version:J},status:"ok"}},pe=(t,e)=>t.unique===e.unique&&t.fields.length===e.fields.length&&t.fields.every((i,n)=>i===e.fields[n]),Q=t=>t.unique!==void 0,M=({nullable:t,optional:e,refined:i,unique:n,...o})=>JSON.stringify(ue(o)),U=t=>({form:JSON.stringify([M(t),t.optional===!0,t.nullable===!0]),refined:t.refined===!0}),W=t=>t.kind==="union"&&t.members?t.members.map(e=>U(e)):[U({...t,nullable:!1,optional:!1})],ge=(t,e)=>{if(e.kind!=="union")return!1;const i=W(e);return W(t).every(n=>i.some(o=>o.form===n.form&&(n.refined||!o.refined)))},x=t=>{switch(t.kind){case"array":return`array(${t.of?x(t.of):"?"})`;case"from":return t.output===void 0?"from":`from(${t.output})`;case"id":return`id(${t.ref??"?"})`;case"literal":return`literal(${t.literal??"?"})`;case"object":return`object({ ${Object.keys(t.fields??{}).join(", ")} })`;case"record":return`record(${t.key?x(t.key):"?"}, ${t.of?x(t.of):"?"})`;case"union":return(t.members??[]).map(e=>x(e)).join(" | ");default:return t.kind}},T=(t,e,i)=>({remediation:"backfill",scope:"table",severity:"breaking",summary:i,table:t,type:e}),F=(t,e,i)=>({remediation:"none",scope:"table",severity:"safe",summary:i,table:t,type:e}),N=(t,e)=>{const i=JSON.stringify(t),n=JSON.stringify(e);return i===n?0:i<n?-1:1},S=t=>({...t,...t.kind==="from"?{output:void 0}:{},...t.fields?{fields:Object.fromEntries(Object.entries(t.fields).map(([e,i])=>[e,S(i)]))}:{},...t.key?{key:S(t.key)}:{},...t.of?{of:S(t.of)}:{},...t.members?{members:t.members.map(e=>S(e)).toSorted(N)}:{}}),B=t=>t.kind==="union"?t.members??[]:[t],ve=(t,e)=>{const i=[...t],n=[...e],o=new Set,r=new Set,s=(a,d)=>{for(const[f,m]of i.entries()){if(r.has(f))continue;const u=n.findIndex((g,p)=>!o.has(p)&&a(m,g));u!==-1&&(o.add(u),r.add(f),d&&([i[f],n[u]]=R(m,n[u])))}};return s((a,d)=>JSON.stringify(a)===JSON.stringify(d),!1),s((a,d)=>M(S(a))===M(S(d)),!0),[i,n]},R=(t,e)=>{if(t.kind==="union"||e.kind==="union"){const[o,r]=ve(B(t),B(e)),s=(a,d)=>a.kind==="union"?{...a,members:d.toSorted(N)}:d[0];return[s(t,o),s(e,r)]}if(t.kind!==e.kind)return[t,e];if(t.kind==="from")return t.output===void 0||e.output===void 0?[{...t,output:void 0},{...e,output:void 0}]:[t,e];const i={...t.fields?{fields:{...t.fields}}:{}},n={...e.fields?{fields:{...e.fields}}:{}};for(const o of["key","of"])t[o]&&e[o]&&([i[o],n[o]]=R(t[o],e[o]));for(const o of Object.keys(t.fields??{})){const r=t.fields?.[o],s=e.fields?.[o];r&&s&&i.fields&&n.fields&&([i.fields[o],n.fields[o]]=R(r,s))}return[{...t,...i},{...e,...n}]},be=(t,e,i,n,o)=>{const[r,s]=R(i,n);if(r.kind===s.kind&&(!o||M(r)===M(s)))return;if(o&&ge(r,s))return F(t,"widenedFieldShape",`field ${t}.${e} widened: ${x(r)} → ${x(s)} — every stored value stays valid`);if(r.kind!==s.kind)return T(t,"changedFieldKind",`field ${t}.${e} changed type: ${r.kind} → ${s.kind} — add a data migration to convert existing values`);const a=Object.values(s.fields??{});return o&&r.kind==="object"&&Object.keys(r.fields??{}).length===0&&a.length>0&&a.every(d=>d.optional)?F(t,"widenedFieldShape",`field ${t}.${e} now records its optional object shape — stored values stay valid`):T(t,"changedFieldShape",`field ${t}.${e} changed shape: ${x(r)} → ${x(s)} — stored values were written against the old shape; add a data migration to convert them`)},ye=(t,e,i,n,o)=>{const r=[];return i.unique!==n.unique&&r.push(n.unique===!0?{...T(t,"addedFieldConstraint",`field ${t}.${e} became unique — existing duplicates would violate it; add a data migration to de-duplicate first`),field:e,uniqueOn:[e]}:F(t,"relaxedFieldConstraint",`field ${t}.${e} is no longer unique`)),i.nullable!==n.nullable&&r.push(n.nullable===!0?F(t,"relaxedFieldConstraint",`field ${t}.${e} became nullable`):T(t,"addedFieldConstraint",`field ${t}.${e} is no longer nullable — rows holding NULL would be invalid; add a data migration to backfill them`)),o&&i.refined!==n.refined&&r.push(n.refined===!0?T(t,"addedFieldConstraint",`field ${t}.${e} gained a validation refinement — stored values were never checked against it; add a data migration if any could fail`):F(t,"relaxedFieldConstraint",`field ${t}.${e} dropped its validation refinement`)),r},ee=(t,e,i,n,o=!0)=>{const r=[],s=Q(i)&&Q(n),a=be(t,e,i,n,s);return a&&r.push(a),s&&r.push(...ye(t,e,i,n,o)),i.optional&&!n.optional?r.push({remediation:"backfill",severity:"breaking",summary:`field ${t}.${e} became required — rows missing it would be invalid; add a data migration to backfill it`,table:t,scope:"table",type:"fieldOptionalToRequired"}):!i.optional&&n.optional&&r.push({remediation:"none",scope:"table",severity:"safe",summary:`field ${t}.${e} became optional`,table:t,type:"fieldRequiredToOptional"}),r},xe=(t,e,i)=>i.optional?{remediation:"none",scope:"table",severity:"safe",summary:`added optional field ${t}.${e}`,table:t,type:"addedOptionalField"}:{remediation:"backfill",severity:"breaking",summary:`added required field ${t}.${e} — existing rows have no value; add a data migration to backfill it`,table:t,scope:"table",type:"addedRequiredField"},ke=(t,e)=>e.refinementsRecorded!==!0||t.refinementsRecorded===!0,$e=(t,e,i,n)=>{for(const[o,r]of Object.entries(i.fields)){const s=e.fields[o];s===void 0?n.push({...xe(t,o,r),field:o}):n.push(...ee(t,o,s,r,ke(e,i)).map(a=>({...a,field:o})))}for(const o of Object.keys(e.fields))i.fields[o]===void 0&&n.push({field:o,remediation:"backfill",severity:"breaking",summary:`removed field ${t}.${o} — add a data migration if stored data must be cleaned up`,table:t,scope:"table",type:"removedField"})},we=(t,e,i,n)=>{for(const[o,r]of Object.entries(i.indexes)){const s=e.indexes[o];if(s===void 0){n.push(r.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`added unique index ${o} on ${t} — existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"addedIndex",uniqueOn:r.fields}:{remediation:"none",scope:"table",severity:"safe",summary:`added index ${o} on ${t}`,table:t,type:"addedIndex"});continue}pe(s,r)||n.push(r.unique?{remediation:"backfill",scope:"table",severity:"breaking",summary:`index ${o} on ${t} changed shape and is unique — existing duplicates would violate it; add a data migration to de-duplicate first`,table:t,type:"changedIndex",uniqueOn:r.fields}:{remediation:"none",scope:"table",severity:"safe",summary:`index ${o} on ${t} changed shape — a query that relied on the old index may need updating`,table:t,type:"changedIndex"})}for(const o of Object.keys(e.indexes))i.indexes[o]===void 0&&n.push({remediation:"none",severity:"safe",index:o,summary:`removed index ${o} on ${t} — a query that used \`.withIndex("${o}")\` no longer compiles`,table:t,scope:"table",type:"removedIndex"})},Oe=(t,e,i,n)=>{for(const o of Object.keys(i.relations))e.relations[o]===void 0&&n.push({remediation:"none",scope:"schema",severity:"safe",summary:`added relation ${t}.${o}`,table:t,type:"addedRelation"});for(const o of Object.keys(e.relations))i.relations[o]===void 0&&n.push({remediation:"none",scope:"schema",severity:"safe",summary:`removed relation ${t}.${o} — the stored foreign-key values stay in place, but its \`onDelete\` action no longer runs and a \`with: { ${o} }\` read no longer compiles`,table:t,type:"removedRelation",warning:!0})},P="shardBy:_unknown_",C="global",Se=(t,e)=>t===C&&e.startsWith(`${C}:`)||e===C&&t.startsWith(`${C}:`),je=(t,e,i)=>{if(e===i)return i!==P?void 0:{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} declares a non-literal .shardBy(...) key, so codegen cannot read which column partitions it — every such key records as "${P}" and two DIFFERENT keys would compare equal. Pass the shard key as a string literal; until then this is reported on every run, because the alternative is a silent pass on a re-home that strands every row (export/import is the only way back).`,table:t,type:"changedShardMode"};if(!Se(e,i))return{remediation:"rehome",severity:"breaking",summary:`table ${t} changed shard mode: ${e} → ${i} — its physical storage moves, and existing rows do NOT follow the schema; re-home them with an export/import round trip (https://lunora.sh/docs/concepts/sharding#migrating-a-populated-table)`,table:t,scope:"table",type:"changedShardMode",...i===P?{}:{coverage:{shardMode:i,table:t}}}},K=t=>t.memory!==void 0,Y=t=>t.after??0,_=t=>t.after===void 0?`{ field: "${t.field}" }`:`{ after: ${String(t.after)}, field: "${t.field}" }`,w=t=>t.after===void 0?`.ttl("${t.field}")`:`.ttl("${t.field}", { after: ${String(t.after)} })`,Te=(t,e,i)=>{if(e===void 0&&i===void 0)return;const n=(a,d)=>({coverage:{table:t,ttl:{...d.after===void 0?{}:{after:d.after},field:d.field}},expiry:{...d.after===void 0?{}:{after:d.after},field:d.field,...e===void 0?{}:{previous:{...e.after===void 0?{}:{after:e.after},field:e.field}}},remediation:"backfill",scope:"table",severity:"breaking",summary:a,table:t,type:"changedTtlPolicy"}),o=a=>({remediation:"none",scope:"table",severity:"safe",summary:a,table:t,type:"changedTtlPolicy",warning:!0});if(i===void 0)return o(`table ${t} dropped its TTL policy — its rows are no longer swept, so they stay until something else deletes them`);if(e===void 0)return n(`table ${t} gained a TTL policy ${w(i)} — every row already past the cutoff is deleted on the next alarm sweep; refresh or clear "${i.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${_(i)} }`,i);if(e.field!==i.field)return n(`table ${t} moved its TTL to a different column: ${w(e)} → ${w(i)} — rows are now expired by a column they were never written against; populate "${i.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${_(i)} }`,i);const r=Y(e),s=Y(i);return s<r?n(`table ${t} shortened its TTL: ${w(e)} → ${w(i)} — rows that were not expired under the old offset are deleted on the next alarm sweep; refresh "${i.field}" on the rows that must survive, then declare a migration with covers: { table: "${t}", ttl: ${_(i)} }`,i):s>r?o(`table ${t} lengthened its TTL: ${w(e)} → ${w(i)} — every row stays, and expires later than it would have`):void 0},Fe=(t,e,i)=>{const n=[];return e.memory!==i.memory&&n.push(i.memory===!0?{remediation:"rehome",scope:"table",severity:"breaking",summary:`table ${t} became a .memory() table — every row is deleted in every shard on the next Durable Object cold start, and no data migration survives that; export the rows first if they must be kept, or revert`,table:t,type:"changedMemoryMode",coverage:{memory:!0,table:t}}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer a .memory() table — its rows now survive a cold start`,table:t,type:"changedMemoryMode"}),e.commitOrdered!==i.commitOrdered&&n.push(i.commitOrdered===!0?{remediation:"backfill",scope:"table",severity:"breaking",summary:`table ${t} became .commitOrdered() — rows written before it carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed never offers them; add a data migration over the table to stamp them (the rewrite allocates a sequence)`,table:t,type:"changedCommitOrdering",identityRewrites:!0}:{remediation:"none",scope:"table",severity:"safe",summary:`table ${t} is no longer .commitOrdered() — stored rows are untouched, but new rows carry no _commitSeq, so a \`_commitSeq > cursor\` changefeed stops advancing without erroring; update the consumers`,table:t,type:"changedCommitOrdering",warning:!0}),n},qe=(t,e,i,n)=>{const o=je(t,e.shardMode,i.shardMode);if(o&&n.push(o),K(e)&&K(i)){n.push(...Fe(t,e,i));const r=Te(t,e.ttl,i.ttl);r&&n.push(r)}$e(t,e,i,n),we(t,e,i,n),Oe(t,e,i,n)},Me=(t,e)=>{const i=[],n=t?.tables??{};for(const[o,r]of Object.entries(e.tables)){const s=n[o];if(s===void 0){i.push({remediation:"none",scope:"table",severity:"safe",summary:`added table ${o}`,table:o,type:"addedTable"});continue}qe(o,s,r,i)}for(const o of Object.keys(n))e.tables[o]===void 0&&i.push({remediation:"none",scope:"table",severity:"safe",summary:`removed table ${o} — its rows are left in place in each shard's SQLite (nothing deletes them) but are unreachable through the schema; export the shard first if the data must be kept, or declare the table again to reach it`,table:o,type:"removedTable",warning:!0});if(t!==void 0&&t.jurisdiction!==e.jurisdiction){const o=t.jurisdiction??"(none)",r=e.jurisdiction??"(none)";i.push({remediation:"rehome",scope:"schema",severity:"breaking",summary:`Durable Object jurisdiction changed from ${o} to ${r} — this re-homes every DO and strands all existing shard, scheduler, and session-DO data in the old region (export then import to move it). Revert the change, or declare a migration with covers: { jurisdiction: "${e.jurisdiction??"none"}" } once the data is moved.`,type:"changedJurisdiction",coverage:{jurisdiction:e.jurisdiction??"none"}})}return{changes:i}},z=t=>Object.entries(t.fields).map(([e,i])=>({name:e,optional:i.optional,ref:Object.values(t.relations).find(n=>n.field===e&&n.kind==="one")?.table,type:x(i)})),X=(t,e,i)=>{const n={},o=e?.fields??{},r=i?.fields??{};for(const[s,a]of Object.entries(r)){const d=o[s];d===void 0?n[s]=e===void 0?"unchanged":"added":n[s]=ee(t,s,d,a).length===0?"unchanged":"changed"}for(const s of Object.keys(o))r[s]===void 0&&(n[s]="removed");return n},Ce=(t,e)=>{const{changes:i}=Me(t,e),n=new Set(i.filter(s=>s.scope==="table"&&s.table!==void 0).map(s=>s.table)),o=[],r=(s,a)=>s?"added":n.has(a)?"changed":"context";for(const[s,a]of Object.entries(e.tables)){const d=t?.tables[s],f=r(d===void 0,s);o.push({columns:z(a),fieldStatus:X(s,d,a),name:s,shardMode:a.shardMode,status:f})}for(const[s,a]of Object.entries(t?.tables??{}))e.tables[s]===void 0&&o.push({columns:z(a),fieldStatus:X(s,a,void 0),name:s,shardMode:a.shardMode,status:"removed"});return o.sort((s,a)=>s.name.localeCompare(a.name)),{breakingCount:i.filter(s=>s.severity==="breaking").length,changes:i,tables:o}},Z=t=>{const e=he(t);return e.status==="ok"?e.snapshot:void 0},Re={added:"ring-2 ring-emerald-500/60",changed:"ring-2 ring-amber-500/70",context:"opacity-55",removed:"opacity-70 ring-2 ring-destructive/60"},Ie=t=>t==="global"||t.startsWith("global:")?"global":"shard",Ee=t=>{const e=I(24),{appliedAt:i,hash:n,onSelect:o,selected:r,seq:s}=t,a=r?"border-s-primary bg-accent/60 text-foreground":"border-s-transparent text-muted-foreground hover:bg-accent/30 hover:text-foreground";let d;e[0]!==a?(d=q("flex w-full flex-col items-start gap-1 border-s-2 px-4 py-3 text-start outline-none transition-colors",a),e[0]=a,e[1]=d):d=e[1];const f=`sh-version-${n}`;let m;e[2]!==n||e[3]!==o?(m=()=>{o(n)},e[2]=n,e[3]=o,e[4]=m):m=e[4];let u;e[5]!==s?(u=b("span",{className:"font-mono text-[13px] tabular-nums",children:["v",s]}),e[5]=s,e[6]=u):u=e[6];let g;e[7]!==n?(g=n.slice(0,7),e[7]=n,e[8]=g):g=e[8];let p;e[9]!==g?(p=l("span",{className:"ms-auto font-mono text-[10px] tracking-wider text-muted-foreground/70 uppercase",children:g}),e[9]=g,e[10]=p):p=e[10];let h;e[11]!==u||e[12]!==p?(h=b("span",{className:"flex w-full items-baseline gap-2",children:[u,p]}),e[11]=u,e[12]=p,e[13]=h):h=e[13];let v;e[14]!==i?(v=ce(i),e[14]=i,e[15]=v):v=e[15];let y;e[16]!==v?(y=l("span",{className:"font-mono text-[10px] tracking-wide text-muted-foreground/70",children:v}),e[16]=v,e[17]=y):y=e[17];let k;return e[18]!==y||e[19]!==d||e[20]!==f||e[21]!==m||e[22]!==h?(k=l("li",{children:b("button",{className:d,"data-testid":f,onClick:m,type:"button",children:[h,y]})}),e[18]=y,e[19]=d,e[20]=f,e[21]=m,e[22]=h,e[23]=k):k=e[23],k},Ae=t=>{const e=I(26),{breaking:i,count:n,first:o}=t,r=H();if(o){let p;e[0]!==n?(p=l("span",{className:"text-3xl leading-none font-light tracking-tight tabular-nums",children:n}),e[0]=n,e[1]=p):p=e[1];let h;e[2]!==r?(h=r("tables"),e[2]=r,e[3]=h):h=e[3];let v;e[4]!==h?(v=l("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:h}),e[4]=h,e[5]=v):v=e[5];let y;return e[6]!==p||e[7]!==v?(y=b("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[p,v]}),e[6]=p,e[7]=v,e[8]=y):y=e[8],y}const s=i>0&&"text-destructive";let a;e[9]!==s?(a=q("text-3xl leading-none font-light tracking-tight tabular-nums",s),e[9]=s,e[10]=a):a=e[10];let d;e[11]!==n||e[12]!==a?(d=l("span",{className:a,children:n}),e[11]=n,e[12]=a,e[13]=d):d=e[13];let f;e[14]!==n||e[15]!==r?(f=r(n===1?"change":"changes"),e[14]=n,e[15]=r,e[16]=f):f=e[16];let m;e[17]!==f?(m=l("span",{className:"font-mono text-[11px] tracking-widest text-muted-foreground uppercase",children:f}),e[17]=f,e[18]=m):m=e[18];let u;e[19]!==i||e[20]!==r?(u=i>0&&b("span",{className:"font-mono text-[11px] tracking-widest text-destructive uppercase",children:["· ",r("{count} breaking",{count:i})]}),e[19]=i,e[20]=r,e[21]=u):u=e[21];let g;return e[22]!==d||e[23]!==m||e[24]!==u?(g=b("div",{className:"flex items-baseline gap-3","data-testid":"sh-summary",children:[d,m,u]}),e[22]=d,e[23]=m,e[24]=u,e[25]=g):g=e[25],g},te={addedFieldConstraint:{action:"added",kind:"constraint"},addedIndex:{action:"added",kind:"index"},addedOptionalField:{action:"added",kind:"field?"},addedRelation:{action:"added",kind:"relation"},addedRequiredField:{action:"added",kind:"field"},addedTable:{action:"added",kind:"table"},changedCommitOrdering:{action:"changed",kind:"commit ordering"},changedFieldKind:{action:"changed",kind:"field kind"},changedFieldShape:{action:"changed",kind:"field shape"},changedIndex:{action:"changed",kind:"index"},changedJurisdiction:{action:"changed",kind:"jurisdiction"},changedMemoryMode:{action:"changed",kind:"memory mode"},changedShardMode:{action:"changed",kind:"shard mode"},changedTtlPolicy:{action:"changed",kind:"TTL policy"},fieldOptionalToRequired:{action:"changed",kind:"field → required"},fieldRequiredToOptional:{action:"changed",kind:"field → optional"},relaxedFieldConstraint:{action:"removed",kind:"constraint"},removedField:{action:"removed",kind:"field"},removedIndex:{action:"removed",kind:"index"},removedRelation:{action:"removed",kind:"relation"},removedTable:{action:"removed",kind:"table"},widenedFieldShape:{action:"changed",kind:"field → wider"}},De=(t,e)=>{const i=`${te[t.type].action} ${e} `;return t.summary.startsWith(i)?t.summary.slice(i.length):t.summary},Le=t=>{const e=new Map;for(const n of t){const o=n.table??"",r=e.get(o);r===void 0?e.set(o,[n]):r.push(n)}const i=[...e].map(([n,o])=>({changes:o,table:n}));return[...i.filter(n=>n.table!==""),...i.filter(n=>n.table==="")]},Je=t=>{const e=I(2),{children:i}=t;let n;return e[0]!==i?(n=l("div",{className:"px-4 pt-4 pb-2 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:i}),e[0]=i,e[1]=n):n=e[1],n},Pe=({pane:t,shardKey:e=""})=>{const i=H(),n=se(),r=re({strict:!1}).version,s=c=>{le(n({search:{version:c},to:"/migrations"}))},a=D(L.schemaHistory,{},{shardKey:e}),d=a.data?.versions??[],f=r!==void 0&&d.some(c=>c.hash===r)?r:d[0]?.hash,m=d.findIndex(c=>c.hash===f),u=m===-1?void 0:d[m+1]?.hash,g=D(L.schemaVersion,{hash:f??""},{enabled:f!==void 0,shardKey:e}),p=D(L.schemaVersion,{hash:u??""},{enabled:u!==void 0,shardKey:e}),h=A(()=>{const c=Z(g.data?.version?.snapshotJson);if(c!==void 0)return Ce(Z(p.data?.version?.snapshotJson),c)},[g.data,p.data]),v=A(()=>(h?.tables??[]).map(c=>({columns:c.columns,name:c.name,tier:Ie(c.shardMode)})),[h]),y=A(()=>{const c={};for(const j of h?.tables??[])c[j.name]=Re[j.status];return c},[h]);if(a.error!==null)return l(ae,{error:a.errorSource,testId:"sh-error"});if(d.length===0)return l(de,{description:i("Each distinct schema shape this shard runs is recorded here, so you can see what changed and when."),testId:"sh-empty",title:i("No schema versions recorded yet.")});const k=h?.changes??[];return b("div",{className:"flex min-h-0 flex-1 gap-4","data-testid":"lunora-schema-history",children:[b("nav",{className:"flex w-56 shrink-0 flex-col overflow-hidden border-e border-border","data-testid":"sh-timeline-rail",children:[l(Je,{children:i("Schema versions")}),l("ul",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-timeline",children:d.map(c=>l(Ee,{appliedAt:c.appliedAt,hash:c.hash,onSelect:s,selected:c.hash===f,seq:c.seq},c.hash))})]}),b("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4 pe-1 pt-4",children:[l(Ae,{breaking:h?.breakingCount??0,count:u===void 0?v.length:k.length,first:u===void 0}),t==="diagram"?l("div",{className:"flex min-h-0 flex-1 flex-col",children:l(fe,{fill:!0,nodeClasses:y,tables:v,testIdPrefix:"sh"})}):l("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"sh-changes",children:Le(k).map(c=>{const j=(h?.tables??[]).find($=>$.name===c.table);return b("section",{className:"mb-6",children:[b("div",{className:"flex items-baseline gap-3 border-b border-border/60 pb-1.5",children:[l("span",{className:"font-mono text-[13px] text-foreground",children:c.table===""?i("schema"):c.table}),j!==void 0&&l("span",{className:"font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums uppercase",children:i("{count} columns",{count:j.columns.length})}),c.changes.length>1&&l("span",{className:"ms-auto font-mono text-[10px] tracking-widest text-muted-foreground/70 tabular-nums",children:c.changes.length})]}),l("ul",{children:c.changes.map($=>{const{action:ie,kind:V}=te[$.type],E=$.severity==="breaking",G=De($,V);return b("li",{className:"flex items-baseline gap-4 border-s-2 py-1.5 ps-3 transition-colors hover:bg-accent/30",children:[l("span",{"aria-hidden":"true",className:q("-ms-3 h-3 w-0.5 shrink-0 self-center",E?"bg-destructive":"bg-transparent")}),b("span",{className:"w-44 shrink-0 font-mono text-[10px] tracking-widest text-muted-foreground/70 uppercase",children:[i(ie)," ",V]}),G!==c.table&&l("span",{className:q("min-w-0 font-mono text-[13px]",E?"text-destructive":"text-foreground"),children:G}),E&&l("span",{className:"ms-auto shrink-0 font-mono text-[10px] tracking-widest text-destructive uppercase",children:i("breaking")})]},`${$.type}-${$.summary}`)})})]},c.table)})})]})]})},_e=t=>q("-mb-px border-b-2 px-3 py-2.5 font-mono text-[11px] tracking-wider uppercase transition-colors outline-none","hover:bg-accent/40 focus-visible:bg-accent/40",t?"border-primary text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),et=t=>{const e=I(11),{initialShardKey:i}=t,n=H(),[o,r]=ne("diagram");let s;e[0]!==o?(s=(u,g,p,h)=>b("button",{"aria-selected":o===u,className:_e(o===u),"data-testid":p,onClick:()=>{r(u)},role:"tab",type:"button",children:[g,h!==void 0&&l("span",{className:"ms-2 tabular-nums text-muted-foreground/70",children:h})]}),e[0]=o,e[1]=s):s=e[1];const a=s;let d;e[2]!==n||e[3]!==a?(d=b("div",{className:"flex shrink-0 items-center gap-1 border-b border-border px-3","data-testid":"mg-panes",role:"tablist",children:[a("diagram",n("Diagram"),"mg-pane-diagram"),a("changes",n("Changes"),"mg-pane-changes"),a("data",n("Data migrations"),"mg-pane-data")]}),e[2]=n,e[3]=a,e[4]=d):d=e[4];let f;e[5]!==i||e[6]!==o?(f=l("div",{className:"flex min-h-0 flex-1 flex-col",children:o==="data"?l("div",{className:"min-h-0 flex-1 overflow-y-auto px-4",children:l(oe,{initialShardKey:i})}):l(Pe,{pane:o,shardKey:i})}),e[5]=i,e[6]=o,e[7]=f):f=e[7];let m;return e[8]!==d||e[9]!==f?(m=b("div",{className:"flex min-h-0 flex-1 flex-col pt-4","data-testid":"lunora-migrations-route",children:[d,f]}),e[8]=d,e[9]=f,e[10]=m):m=e[10],m};export{et as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as G}from"react/compiler-runtime";import{useState as P}from"react";import{B as L}from"../packem_shared/button-q0UYSmrn.mjs";import{a as _t,C as Tt}from"../packem_shared/card-By2O8ULa.mjs";import{E as Xe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as ce,a as $t,b as ht,e as fe,d as Mt,T as Rt}from"../packem_shared/table-D0SBiDu-.mjs";import{a as Ve}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as Bt}from"../packem_shared/use-auth-config-CG7VvAvQ.mjs";import{useAutoRefresh as We,settlePolls as Qt}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as ae}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as q}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{l as A,f as kt,b as Jt,h as Ut}from"../packem_shared/internal-hIuTpSbx.mjs";import{u as Gt,A as Et}from"../packem_shared/auth-pager-DW77WeZw.mjs";import{I as X}from"../packem_shared/input-CXhxesPC.mjs";import{L as Ht}from"../packem_shared/label-DKFzyHq6.mjs";import{M as Zt}from"../packem_shared/modal-shell-CDztwLnv.mjs";import{T as Ft}from"../packem_shared/textarea--40GKAyz.mjs";import{u as me}from"../packem_shared/use-async-submit-D0r7-m2J.mjs";import{jsx as s,jsxs as E,Fragment as bt}from"react/jsx-runtime";const Pt=t=>{const e=JSON.parse(t);if(typeof e!="object"||e===null||Array.isArray(e))throw new TypeError("Expected a JSON object");return e},qt=t=>{const e=Pt(t),l={};for(const[d,u]of Object.entries(e)){if(!Array.isArray(u)||u.some(n=>typeof n!="string"))throw new TypeError(`"${d}" must map to an array of action strings`);l[d]=u}return l},jt=t=>t==null||t===""?"":typeof t=="string"?t:JSON.stringify(t,null,2),W=t=>{const e=G(6),{children:l,htmlFor:d,label:u}=t;let n;e[0]!==d||e[1]!==u?(n=s(Ht,{htmlFor:d,children:u}),e[0]=d,e[1]=u,e[2]=n):n=e[2];let o;return e[3]!==l||e[4]!==n?(o=E("div",{className:"flex flex-col gap-1",children:[n,l]}),e[3]=l,e[4]=n,e[5]=o):o=e[5],o},de=({busy:t,canSubmit:e,children:l,destructive:d=!1,error:u,onClose:n,onSubmit:o,submitLabel:i,testId:r,title:m})=>{const a=q();return E(Zt,{label:m,onClose:n,panelTestId:`${r}-panel`,testId:`${r}-overlay`,variant:"dialog",children:[s("h2",{className:"text-sm font-semibold text-foreground",children:m}),l,u!==null&&s("p",{className:"text-sm text-destructive","data-testid":`${r}-error`,role:"alert",children:u}),E("div",{className:"flex justify-end gap-2 pt-1",children:[s(L,{"data-testid":`${r}-cancel`,onClick:n,size:"sm",type:"button",variant:"outline",children:a("Cancel")}),s(L,{"data-testid":`${r}-submit`,disabled:t||!e,onClick:o,size:"sm",type:"button",variant:d?"destructive":"default",children:t?a("Saving…"):i})]})]})},Dt=t=>{const e=G(79),{mode:l,onClose:d,onDone:u,org:n}=t,o=ae(),i=q(),{busy:r,error:m,run:a}=me();let h;e[0]!==n?(h=n?A(n.name):"",e[0]=n,e[1]=h):h=e[1];const[c,g]=P(h);let p;e[2]!==n?(p=n?A(n.slug):"",e[2]=n,e[3]=p):p=e[3];const[f,b]=P(p);let S;e[4]!==n?(S=n?A(n.logo):"",e[4]=n,e[5]=S):S=e[5];const[v,y]=P(S),[x,I]=P("");let C;e[6]!==l||e[7]!==n?.metadata?(C=l==="edit"?jt(n?.metadata):"",e[6]=l,e[7]=n?.metadata,e[8]=C):C=e[8];const[w,k]=P(C);let O;e[9]!==o||e[10]!==v||e[11]!==w||e[12]!==l||e[13]!==c||e[14]!==d||e[15]!==u||e[16]!==n?.id||e[17]!==x||e[18]!==a||e[19]!==f?(O=()=>{a(async()=>{const D=w.trim()===""?void 0:Pt(w);l==="create"?await o.createAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:D,name:c.trim(),ownerId:x.trim()===""?void 0:x.trim(),slug:f.trim()===""?void 0:f.trim()}):await o.updateAuthOrganization({logo:v.trim()===""?void 0:v.trim(),metadata:D,name:c.trim()===""?void 0:c.trim(),organizationId:A(n?.id),slug:f.trim()===""?void 0:f.trim()}),u(),d()})},e[9]=o,e[10]=v,e[11]=w,e[12]=l,e[13]=c,e[14]=d,e[15]=u,e[16]=n?.id,e[17]=x,e[18]=a,e[19]=f,e[20]=O):O=e[20];const z=O;let N;e[21]!==l||e[22]!==c?(N=c.trim()!==""||l==="edit",e[21]=l,e[22]=c,e[23]=N):N=e[23];let _;e[24]!==l||e[25]!==i?(_=i(l==="create"?"Create":"Save"),e[24]=l,e[25]=i,e[26]=_):_=e[26];let T;e[27]!==l||e[28]!==i?(T=i(l==="create"?"New organization":"Edit organization"),e[27]=l,e[28]=i,e[29]=T):T=e[29];let R;e[30]!==i?(R=i("name"),e[30]=i,e[31]=R):R=e[31];let H;e[32]===Symbol.for("react.memo_cache_sentinel")?(H=D=>{g(D.target.value)},e[32]=H):H=e[32];let B;e[33]!==c?(B=s(X,{"data-testid":"org-form-name",id:"org-form-name",onChange:H,value:c}),e[33]=c,e[34]=B):B=e[34];let U;e[35]!==B||e[36]!==R?(U=s(W,{htmlFor:"org-form-name",label:R,children:B}),e[35]=B,e[36]=R,e[37]=U):U=e[37];let Q;e[38]!==i?(Q=i("Slug (optional — derived from name)"),e[38]=i,e[39]=Q):Q=e[39];let F;e[40]===Symbol.for("react.memo_cache_sentinel")?(F=D=>{b(D.target.value)},e[40]=F):F=e[40];let J;e[41]!==f?(J=s(X,{"data-testid":"org-form-slug",id:"org-form-slug",onChange:F,value:f}),e[41]=f,e[42]=J):J=e[42];let j;e[43]!==Q||e[44]!==J?(j=s(W,{htmlFor:"org-form-slug",label:Q,children:J}),e[43]=Q,e[44]=J,e[45]=j):j=e[45];let Z;e[46]!==i?(Z=i("Logo URL (optional)"),e[46]=i,e[47]=Z):Z=e[47];let M;e[48]===Symbol.for("react.memo_cache_sentinel")?(M=D=>{y(D.target.value)},e[48]=M):M=e[48];let $;e[49]!==v?($=s(X,{"data-testid":"org-form-logo",id:"org-form-logo",onChange:M,value:v}),e[49]=v,e[50]=$):$=e[50];let K;e[51]!==Z||e[52]!==$?(K=s(W,{htmlFor:"org-form-logo",label:Z,children:$}),e[51]=Z,e[52]=$,e[53]=K):K=e[53];let Y;e[54]!==l||e[55]!==x||e[56]!==i?(Y=l==="create"&&s(W,{htmlFor:"org-form-owner",label:i("Owner user id (optional)"),children:s(X,{"data-testid":"org-form-owner",id:"org-form-owner",onChange:D=>{I(D.target.value)},value:x})}),e[54]=l,e[55]=x,e[56]=i,e[57]=Y):Y=e[57];let te;e[58]!==i?(te=i("Metadata (JSON, optional)"),e[58]=i,e[59]=te):te=e[59];let oe;e[60]===Symbol.for("react.memo_cache_sentinel")?(oe=D=>{k(D.target.value)},e[60]=oe):oe=e[60];let le;e[61]!==w?(le=s(Ft,{"data-testid":"org-form-metadata",id:"org-form-metadata",onChange:oe,value:w}),e[61]=w,e[62]=le):le=e[62];let ee;e[63]!==te||e[64]!==le?(ee=s(W,{htmlFor:"org-form-metadata",label:te,children:le}),e[63]=te,e[64]=le,e[65]=ee):ee=e[65];let ie;return e[66]!==r||e[67]!==m||e[68]!==d||e[69]!==z||e[70]!==U||e[71]!==j||e[72]!==K||e[73]!==Y||e[74]!==ee||e[75]!==N||e[76]!==_||e[77]!==T?(ie=E(de,{busy:r,canSubmit:N,error:m,onClose:d,onSubmit:z,submitLabel:_,testId:"org-form",title:T,children:[U,j,K,Y,ee]}),e[66]=r,e[67]=m,e[68]=d,e[69]=z,e[70]=U,e[71]=j,e[72]=K,e[73]=Y,e[74]=ee,e[75]=N,e[76]=_,e[77]=T,e[78]=ie):ie=e[78],ie},Kt=t=>{const e=G(40),{onClose:l,onDone:d,organizationId:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me(),[a,h]=P(""),[c,g]=P("");let p;e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==u||e[4]!==c||e[5]!==m||e[6]!==a?(p=()=>{m(async()=>{await n.addAuthOrgMember({organizationId:u,role:c.trim()===""?void 0:c.trim(),userId:a.trim()}),d(),l()})},e[0]=n,e[1]=l,e[2]=d,e[3]=u,e[4]=c,e[5]=m,e[6]=a,e[7]=p):p=e[7];const f=p;let b;e[8]!==a?(b=a.trim(),e[8]=a,e[9]=b):b=e[9];const S=b!=="";let v;e[10]!==o?(v=o("Add member"),e[10]=o,e[11]=v):v=e[11];let y;e[12]!==o?(y=o("Add member"),e[12]=o,e[13]=y):y=e[13];let x;e[14]!==o?(x=o("User id"),e[14]=o,e[15]=x):x=e[15];let I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=T=>{h(T.target.value)},e[16]=I):I=e[16];let C;e[17]!==a?(C=s(X,{"data-testid":"org-add-member-user",id:"org-add-member-user",onChange:I,value:a}),e[17]=a,e[18]=C):C=e[18];let w;e[19]!==x||e[20]!==C?(w=s(W,{htmlFor:"org-add-member-user",label:x,children:C}),e[19]=x,e[20]=C,e[21]=w):w=e[21];let k;e[22]!==o?(k=o("Role (optional)"),e[22]=o,e[23]=k):k=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=T=>{g(T.target.value)},e[24]=O):O=e[24];let z;e[25]!==c?(z=s(X,{"data-testid":"org-add-member-role",id:"org-add-member-role",onChange:O,value:c}),e[25]=c,e[26]=z):z=e[26];let N;e[27]!==k||e[28]!==z?(N=s(W,{htmlFor:"org-add-member-role",label:k,children:z}),e[27]=k,e[28]=z,e[29]=N):N=e[29];let _;return e[30]!==i||e[31]!==r||e[32]!==l||e[33]!==f||e[34]!==N||e[35]!==S||e[36]!==v||e[37]!==y||e[38]!==w?(_=E(de,{busy:i,canSubmit:S,error:r,onClose:l,onSubmit:f,submitLabel:v,testId:"org-add-member",title:y,children:[w,N]}),e[30]=i,e[31]=r,e[32]=l,e[33]=f,e[34]=N,e[35]=S,e[36]=v,e[37]=y,e[38]=w,e[39]=_):_=e[39],_},Vt=t=>{const e=G(40),{onClose:l,onDone:d,organizationId:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me(),[a,h]=P(""),[c,g]=P("");let p;e[0]!==n||e[1]!==a||e[2]!==l||e[3]!==d||e[4]!==u||e[5]!==c||e[6]!==m?(p=()=>{m(async()=>{await n.inviteAuthOrgMember({email:a.trim(),organizationId:u,role:c.trim()===""?void 0:c.trim()}),d(),l()})},e[0]=n,e[1]=a,e[2]=l,e[3]=d,e[4]=u,e[5]=c,e[6]=m,e[7]=p):p=e[7];const f=p;let b;e[8]!==a?(b=a.trim(),e[8]=a,e[9]=b):b=e[9];const S=b!=="";let v;e[10]!==o?(v=o("Send invitation"),e[10]=o,e[11]=v):v=e[11];let y;e[12]!==o?(y=o("Invite member"),e[12]=o,e[13]=y):y=e[13];let x;e[14]!==o?(x=o("email"),e[14]=o,e[15]=x):x=e[15];let I;e[16]===Symbol.for("react.memo_cache_sentinel")?(I=T=>{h(T.target.value)},e[16]=I):I=e[16];let C;e[17]!==a?(C=s(X,{"data-testid":"org-invite-member-email",id:"org-invite-member-email",onChange:I,type:"email",value:a}),e[17]=a,e[18]=C):C=e[18];let w;e[19]!==x||e[20]!==C?(w=s(W,{htmlFor:"org-invite-member-email",label:x,children:C}),e[19]=x,e[20]=C,e[21]=w):w=e[21];let k;e[22]!==o?(k=o("Role (optional)"),e[22]=o,e[23]=k):k=e[23];let O;e[24]===Symbol.for("react.memo_cache_sentinel")?(O=T=>{g(T.target.value)},e[24]=O):O=e[24];let z;e[25]!==c?(z=s(X,{"data-testid":"org-invite-member-role",id:"org-invite-member-role",onChange:O,value:c}),e[25]=c,e[26]=z):z=e[26];let N;e[27]!==k||e[28]!==z?(N=s(W,{htmlFor:"org-invite-member-role",label:k,children:z}),e[27]=k,e[28]=z,e[29]=N):N=e[29];let _;return e[30]!==i||e[31]!==r||e[32]!==l||e[33]!==f||e[34]!==N||e[35]!==S||e[36]!==v||e[37]!==y||e[38]!==w?(_=E(de,{busy:i,canSubmit:S,error:r,onClose:l,onSubmit:f,submitLabel:v,testId:"org-invite-member",title:y,children:[w,N]}),e[30]=i,e[31]=r,e[32]=l,e[33]=f,e[34]=N,e[35]=S,e[36]=v,e[37]=y,e[38]=w,e[39]=_):_=e[39],_},Wt=t=>{const e=G(32),{member:l,onClose:d,onDone:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me();let a;e[0]!==l.role?(a=()=>A(l.role),e[0]=l.role,e[1]=a):a=e[1];const[h,c]=P(a);let g;e[2]!==n||e[3]!==l.id||e[4]!==d||e[5]!==u||e[6]!==h||e[7]!==m?(g=()=>{m(async()=>{await n.setAuthOrgMemberRole({memberId:A(l.id),role:h.trim()}),u(),d()})},e[2]=n,e[3]=l.id,e[4]=d,e[5]=u,e[6]=h,e[7]=m,e[8]=g):g=e[8];const p=g;let f;e[9]!==h?(f=h.trim(),e[9]=h,e[10]=f):f=e[10];const b=f!=="";let S;e[11]!==o?(S=o("Save"),e[11]=o,e[12]=S):S=e[12];let v;e[13]!==o?(v=o("Change member role"),e[13]=o,e[14]=v):v=e[14];let y;e[15]!==o?(y=o("Role"),e[15]=o,e[16]=y):y=e[16];let x;e[17]===Symbol.for("react.memo_cache_sentinel")?(x=k=>{c(k.target.value)},e[17]=x):x=e[17];let I;e[18]!==h?(I=s(X,{"data-testid":"org-member-role-value",id:"org-member-role-value",onChange:x,value:h}),e[18]=h,e[19]=I):I=e[19];let C;e[20]!==y||e[21]!==I?(C=s(W,{htmlFor:"org-member-role-value",label:y,children:I}),e[20]=y,e[21]=I,e[22]=C):C=e[22];let w;return e[23]!==i||e[24]!==r||e[25]!==d||e[26]!==p||e[27]!==C||e[28]!==b||e[29]!==S||e[30]!==v?(w=s(de,{busy:i,canSubmit:b,error:r,onClose:d,onSubmit:p,submitLabel:S,testId:"org-member-role",title:v,children:C}),e[23]=i,e[24]=r,e[25]=d,e[26]=p,e[27]=C,e[28]=b,e[29]=S,e[30]=v,e[31]=w):w=e[31],w},zt=t=>{const e=G(36),{mode:l,onClose:d,onDone:u,organizationId:n,team:o}=t,i=ae(),r=q(),{busy:m,error:a,run:h}=me();let c;e[0]!==o?(c=o?A(o.name):"",e[0]=o,e[1]=c):c=e[1];const[g,p]=P(c);let f;e[2]!==i||e[3]!==l||e[4]!==g||e[5]!==d||e[6]!==u||e[7]!==n||e[8]!==h||e[9]!==o?.id?(f=()=>{h(async()=>{await(l==="create"?i.createAuthOrgTeam({name:g.trim(),organizationId:n}):i.updateAuthOrgTeam({name:g.trim(),teamId:A(o?.id)})),u(),d()})},e[2]=i,e[3]=l,e[4]=g,e[5]=d,e[6]=u,e[7]=n,e[8]=h,e[9]=o?.id,e[10]=f):f=e[10];const b=f;let S;e[11]!==g?(S=g.trim(),e[11]=g,e[12]=S):S=e[12];const v=S!=="";let y;e[13]!==l||e[14]!==r?(y=r(l==="create"?"Create":"Save"),e[13]=l,e[14]=r,e[15]=y):y=e[15];let x;e[16]!==l||e[17]!==r?(x=r(l==="create"?"New team":"Rename team"),e[16]=l,e[17]=r,e[18]=x):x=e[18];let I;e[19]!==r?(I=r("name"),e[19]=r,e[20]=I):I=e[20];let C;e[21]===Symbol.for("react.memo_cache_sentinel")?(C=z=>{p(z.target.value)},e[21]=C):C=e[21];let w;e[22]!==g?(w=s(X,{"data-testid":"org-team-form-name",id:"org-team-form-name",onChange:C,value:g}),e[22]=g,e[23]=w):w=e[23];let k;e[24]!==I||e[25]!==w?(k=s(W,{htmlFor:"org-team-form-name",label:I,children:w}),e[24]=I,e[25]=w,e[26]=k):k=e[26];let O;return e[27]!==m||e[28]!==a||e[29]!==d||e[30]!==b||e[31]!==k||e[32]!==v||e[33]!==y||e[34]!==x?(O=s(de,{busy:m,canSubmit:v,error:a,onClose:d,onSubmit:b,submitLabel:y,testId:"org-team-form",title:x,children:k}),e[27]=m,e[28]=a,e[29]=d,e[30]=b,e[31]=k,e[32]=v,e[33]=y,e[34]=x,e[35]=O):O=e[35],O},Xt=t=>{const e=G(30),{onClose:l,onDone:d,teamId:u}=t,n=ae(),o=q(),{busy:i,error:r,run:m}=me(),[a,h]=P("");let c;e[0]!==n||e[1]!==l||e[2]!==d||e[3]!==m||e[4]!==u||e[5]!==a?(c=()=>{m(async()=>{await n.addAuthOrgTeamMember({teamId:u,userId:a.trim()}),d(),l()})},e[0]=n,e[1]=l,e[2]=d,e[3]=m,e[4]=u,e[5]=a,e[6]=c):c=e[6];const g=c;let p;e[7]!==a?(p=a.trim(),e[7]=a,e[8]=p):p=e[8];const f=p!=="";let b;e[9]!==o?(b=o("Add member"),e[9]=o,e[10]=b):b=e[10];let S;e[11]!==o?(S=o("Add team member"),e[11]=o,e[12]=S):S=e[12];let v;e[13]!==o?(v=o("User id"),e[13]=o,e[14]=v):v=e[14];let y;e[15]===Symbol.for("react.memo_cache_sentinel")?(y=w=>{h(w.target.value)},e[15]=y):y=e[15];let x;e[16]!==a?(x=s(X,{"data-testid":"org-team-add-member-user",id:"org-team-add-member-user",onChange:y,value:a}),e[16]=a,e[17]=x):x=e[17];let I;e[18]!==v||e[19]!==x?(I=s(W,{htmlFor:"org-team-add-member-user",label:v,children:x}),e[18]=v,e[19]=x,e[20]=I):I=e[20];let C;return e[21]!==i||e[22]!==r||e[23]!==l||e[24]!==g||e[25]!==f||e[26]!==b||e[27]!==S||e[28]!==I?(C=s(de,{busy:i,canSubmit:f,error:r,onClose:l,onSubmit:g,submitLabel:b,testId:"org-team-add-member",title:S,children:I}),e[21]=i,e[22]=r,e[23]=l,e[24]=g,e[25]=f,e[26]=b,e[27]=S,e[28]=I,e[29]=C):C=e[29],C},At=t=>{const e=G(47),{mode:l,onClose:d,onDone:u,organizationId:n,role:o}=t,i=ae(),r=q(),{busy:m,error:a,run:h}=me();let c;e[0]!==o?(c=o?A(o.role):"",e[0]=o,e[1]=c):c=e[1];const[g,p]=P(c);let f;e[2]!==l||e[3]!==o?.permission?(f=l==="edit"?jt(o?.permission):"",e[2]=l,e[3]=o?.permission,e[4]=f):f=e[4];const[b,S]=P(f);let v;e[5]!==i||e[6]!==l||e[7]!==g||e[8]!==d||e[9]!==u||e[10]!==n||e[11]!==b||e[12]!==o?.id||e[13]!==h?(v=()=>{h(async()=>{const T=qt(b);await(l==="create"?i.createAuthOrgRole({organizationId:n,permission:T,role:g.trim()}):i.updateAuthOrgRole({permission:T,roleId:A(o?.id)})),u(),d()})},e[5]=i,e[6]=l,e[7]=g,e[8]=d,e[9]=u,e[10]=n,e[11]=b,e[12]=o?.id,e[13]=h,e[14]=v):v=e[14];const y=v;let x;e[15]!==l||e[16]!==g||e[17]!==b?(x=b.trim()!==""&&(l==="edit"||g.trim()!==""),e[15]=l,e[16]=g,e[17]=b,e[18]=x):x=e[18];let I;e[19]!==l||e[20]!==r?(I=r(l==="create"?"Create":"Save"),e[19]=l,e[20]=r,e[21]=I):I=e[21];let C;e[22]!==l||e[23]!==r?(C=r(l==="create"?"New role":"Edit role"),e[22]=l,e[23]=r,e[24]=C):C=e[24];let w;e[25]!==l||e[26]!==g||e[27]!==r?(w=l==="create"&&s(W,{htmlFor:"org-role-form-name",label:r("Role name"),children:s(X,{"data-testid":"org-role-form-name",id:"org-role-form-name",onChange:T=>{p(T.target.value)},value:g})}),e[25]=l,e[26]=g,e[27]=r,e[28]=w):w=e[28];let k;e[29]!==r?(k=r('Permission (JSON, e.g. {"project":["create","update"]})'),e[29]=r,e[30]=k):k=e[30];let O;e[31]===Symbol.for("react.memo_cache_sentinel")?(O=T=>{S(T.target.value)},e[31]=O):O=e[31];let z;e[32]!==b?(z=s(Ft,{"data-testid":"org-role-form-permission",id:"org-role-form-permission",onChange:O,value:b}),e[32]=b,e[33]=z):z=e[33];let N;e[34]!==z||e[35]!==k?(N=s(W,{htmlFor:"org-role-form-permission",label:k,children:z}),e[34]=z,e[35]=k,e[36]=N):N=e[36];let _;return e[37]!==m||e[38]!==a||e[39]!==d||e[40]!==y||e[41]!==N||e[42]!==x||e[43]!==I||e[44]!==C||e[45]!==w?(_=E(de,{busy:m,canSubmit:x,error:a,onClose:d,onSubmit:y,submitLabel:I,testId:"org-role-form",title:C,children:[w,N]}),e[37]=m,e[38]=a,e[39]=d,e[40]=y,e[41]=N,e[42]=x,e[43]=I,e[44]=C,e[45]=w,e[46]=_):_=e[46],_},Lt=t=>{const e=G(18),{action:l,message:d,onClose:u,onDone:n,testId:o,title:i}=t,r=q(),{busy:m,error:a,run:h}=me();let c;e[0]!==l||e[1]!==u||e[2]!==n||e[3]!==h?(c=()=>{h(async()=>{await l(),n(),u()})},e[0]=l,e[1]=u,e[2]=n,e[3]=h,e[4]=c):c=e[4];const g=c;let p;e[5]!==r?(p=r("Delete"),e[5]=r,e[6]=p):p=e[6];let f;e[7]!==d?(f=s("p",{className:"text-sm text-muted-foreground",children:d}),e[7]=d,e[8]=f):f=e[8];let b;return e[9]!==m||e[10]!==a||e[11]!==u||e[12]!==g||e[13]!==p||e[14]!==f||e[15]!==o||e[16]!==i?(b=s(de,{busy:m,canSubmit:!0,destructive:!0,error:a,onClose:u,onSubmit:g,submitLabel:p,testId:o,title:i,children:f}),e[9]=m,e[10]=a,e[11]=u,e[12]=g,e[13]=p,e[14]=f,e[15]=o,e[16]=i,e[17]=b):b=e[17],b},Ye=t=>{const e=G(13),{action:l,children:d,heading:u,testId:n}=t;let o;e[0]!==u?(o=s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:u}),e[0]=u,e[1]=o):o=e[1];let i;e[2]!==l?(i=l!==void 0&&s("div",{className:"flex items-center gap-2",children:l}),e[2]=l,e[3]=i):i=e[3];let r;e[4]!==o||e[5]!==i?(r=E("header",{className:"flex items-center justify-between gap-2 border-b border-border px-4 py-3",children:[o,i]}),e[4]=o,e[5]=i,e[6]=r):r=e[6];let m;e[7]!==d?(m=s(_t,{className:"px-0",children:d}),e[7]=d,e[8]=m):m=e[8];let a;return e[9]!==r||e[10]!==m||e[11]!==n?(a=E(Tt,{className:"overflow-hidden py-0","data-testid":n,children:[r,m]}),e[9]=r,e[10]=m,e[11]=n,e[12]=a):a=e[12],a},et=t=>{const e=G(23),{columns:l,rowActions:d,rowPrefix:u,rows:n}=t,o=q();let i;e[0]!==l?(i=l.map(Yt),e[0]=l,e[1]=i):i=e[1];let r;e[2]!==o?(r=o("Actions"),e[2]=o,e[3]=r):r=e[3];let m;e[4]!==r?(m=s(ce,{"aria-label":r}),e[4]=r,e[5]=m):m=e[5];let a;e[6]!==i||e[7]!==m?(a=s($t,{children:E(ht,{children:[i,m]})}),e[6]=i,e[7]=m,e[8]=a):a=e[8];let h;if(e[9]!==l||e[10]!==d||e[11]!==u||e[12]!==n){let p;e[14]!==l||e[15]!==d||e[16]!==u?(p=(f,b)=>{const S=A(f.id),v=S===""?`index-${b.toString()}`:S;return E(ht,{"data-testid":`${u}-${v}`,children:[l.map(y=>s(fe,{className:y.className,children:y.render(f)},y.head)),s(fe,{children:s("div",{className:"flex justify-end gap-1",children:d(f)})})]},v)},e[14]=l,e[15]=d,e[16]=u,e[17]=p):p=e[17],h=n.map(p),e[9]=l,e[10]=d,e[11]=u,e[12]=n,e[13]=h}else h=e[13];let c;e[18]!==h?(c=s(Mt,{children:h}),e[18]=h,e[19]=c):c=e[19];let g;return e[20]!==a||e[21]!==c?(g=E(Rt,{children:[a,c]}),e[20]=a,e[21]=c,e[22]=g):g=e[22],g};function Yt(t){return s(ce,{children:t.head},t.head)}const el=t=>{const e=G(30),{actionBusy:l,onRemoveMember:d,memberColumns:u,members:n,onDialog:o}=t,i=q();let r;e[0]!==o?(r=()=>{o({kind:"add-member"})},e[0]=o,e[1]=r):r=e[1];let m;e[2]!==i?(m=i("Add member"),e[2]=i,e[3]=m):m=e[3];let a;e[4]!==r||e[5]!==m?(a=s(L,{"data-testid":"org-open-add-member",onClick:r,size:"xs",type:"button",variant:"outline",children:m}),e[4]=r,e[5]=m,e[6]=a):a=e[6];let h;e[7]!==o?(h=()=>{o({kind:"invite-member"})},e[7]=o,e[8]=h):h=e[8];let c;e[9]!==i?(c=i("Invite member"),e[9]=i,e[10]=c):c=e[10];let g;e[11]!==h||e[12]!==c?(g=s(L,{"data-testid":"org-open-invite-member",onClick:h,size:"xs",type:"button",variant:"outline",children:c}),e[11]=h,e[12]=c,e[13]=g):g=e[13];let p;e[14]!==a||e[15]!==g?(p=E(bt,{children:[a,g]}),e[14]=a,e[15]=g,e[16]=p):p=e[16];let f;e[17]!==i?(f=i("Members"),e[17]=i,e[18]=f):f=e[18];let b;e[19]!==l||e[20]!==u||e[21]!==n||e[22]!==o||e[23]!==d||e[24]!==i?(b=n.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-members-empty",title:i("No members.")})}):s(et,{columns:u,rowActions:v=>E(bt,{children:[s(L,{"data-testid":`org-member-role-${A(v.id)}`,onClick:()=>{o({kind:"member-role",member:v})},size:"xs",type:"button",variant:"ghost",children:i("Change role")}),s(L,{"data-testid":`org-remove-member-${A(v.id)}`,disabled:l,onClick:()=>{d(A(v.id))},size:"xs",type:"button",variant:"ghost",children:i("Remove")})]}),rowPrefix:"org-member",rows:n}),e[19]=l,e[20]=u,e[21]=n,e[22]=o,e[23]=d,e[24]=i,e[25]=b):b=e[25];let S;return e[26]!==p||e[27]!==f||e[28]!==b?(S=s(Ye,{action:p,heading:f,testId:"org-members",children:b}),e[26]=p,e[27]=f,e[28]=b,e[29]=S):S=e[29],S},tl=t=>{const e=G(21),{onConfirmDeleteTeam:l,onDialog:d,onSelectTeam:u,selectedTeam:n,teamColumns:o,teams:i}=t,r=q();let m;e[0]!==d?(m=()=>{d({kind:"team-create"})},e[0]=d,e[1]=m):m=e[1];let a;e[2]!==r?(a=r("New team"),e[2]=r,e[3]=a):a=e[3];let h;e[4]!==m||e[5]!==a?(h=s(L,{"data-testid":"org-open-create-team",onClick:m,size:"xs",type:"button",variant:"outline",children:a}),e[4]=m,e[5]=a,e[6]=h):h=e[6];let c;e[7]!==r?(c=r("Teams"),e[7]=r,e[8]=c):c=e[8];let g;e[9]!==l||e[10]!==d||e[11]!==u||e[12]!==n||e[13]!==r||e[14]!==o||e[15]!==i?(g=i.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-teams-empty",title:r("No teams.")})}):s(et,{columns:o,rowActions:f=>E(bt,{children:[s(L,{"aria-pressed":n===A(f.id),"data-testid":`org-team-select-${A(f.id)}`,onClick:()=>{u(A(f.id))},size:"xs",type:"button",variant:"ghost",children:r("Members")}),s(L,{"data-testid":`org-team-rename-${A(f.id)}`,onClick:()=>{d({kind:"team-rename",team:f})},size:"xs",type:"button",variant:"ghost",children:r("Rename")}),s(L,{"data-testid":`org-team-delete-${A(f.id)}`,onClick:()=>{l(f)},size:"xs",type:"button",variant:"ghost",children:r("Delete")})]}),rowPrefix:"org-team",rows:i}),e[9]=l,e[10]=d,e[11]=u,e[12]=n,e[13]=r,e[14]=o,e[15]=i,e[16]=g):g=e[16];let p;return e[17]!==h||e[18]!==c||e[19]!==g?(p=s(Ye,{action:h,heading:c,testId:"org-teams",children:g}),e[17]=h,e[18]=c,e[19]=g,e[20]=p):p=e[20],p},ll=t=>{const e=G(20),{actionBusy:l,onRemoveTeamMember:d,onDialog:u,selectedTeam:n,teamMemberColumns:o,teamMembers:i}=t,r=q();let m;e[0]!==u||e[1]!==n?(m=()=>{u({kind:"team-add-member",teamId:n})},e[0]=u,e[1]=n,e[2]=m):m=e[2];let a;e[3]!==r?(a=r("Add member"),e[3]=r,e[4]=a):a=e[4];let h;e[5]!==m||e[6]!==a?(h=s(L,{"data-testid":"org-open-add-team-member",onClick:m,size:"xs",type:"button",variant:"outline",children:a}),e[5]=m,e[6]=a,e[7]=h):h=e[7];let c;e[8]!==r?(c=r("Team members"),e[8]=r,e[9]=c):c=e[9];let g;e[10]!==l||e[11]!==d||e[12]!==r||e[13]!==o||e[14]!==i?(g=i.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-team-members-empty",title:r("No team members.")})}):s(et,{columns:o,rowActions:f=>s(L,{"data-testid":`org-team-remove-member-${A(f.id)}`,disabled:l,onClick:()=>{d(A(f.id))},size:"xs",type:"button",variant:"ghost",children:r("Remove")}),rowPrefix:"org-team-member",rows:i}),e[10]=l,e[11]=d,e[12]=r,e[13]=o,e[14]=i,e[15]=g):g=e[15];let p;return e[16]!==h||e[17]!==c||e[18]!==g?(p=s(Ye,{action:h,heading:c,testId:"org-team-members",children:g}),e[16]=h,e[17]=c,e[18]=g,e[19]=p):p=e[19],p},ol=t=>{const e=G(19),{onConfirmDeleteRole:l,onDialog:d,roleColumns:u,roles:n}=t,o=q();let i;e[0]!==d?(i=()=>{d({kind:"role-create"})},e[0]=d,e[1]=i):i=e[1];let r;e[2]!==o?(r=o("New role"),e[2]=o,e[3]=r):r=e[3];let m;e[4]!==i||e[5]!==r?(m=s(L,{"data-testid":"org-open-create-role",onClick:i,size:"xs",type:"button",variant:"outline",children:r}),e[4]=i,e[5]=r,e[6]=m):m=e[6];let a;e[7]!==o?(a=o("Roles"),e[7]=o,e[8]=a):a=e[8];let h;e[9]!==l||e[10]!==d||e[11]!==u||e[12]!==n||e[13]!==o?(h=n.length===0?s("div",{className:"p-3",children:s(Xe,{testId:"org-roles-empty",title:o("No custom roles.")})}):s(et,{columns:u,rowActions:g=>E(bt,{children:[s(L,{"data-testid":`org-role-edit-${A(g.id)}`,onClick:()=>{d({kind:"role-edit",role:g})},size:"xs",type:"button",variant:"ghost",children:o("Edit")}),s(L,{"data-testid":`org-role-delete-${A(g.id)}`,onClick:()=>{l(A(g.id))},size:"xs",type:"button",variant:"ghost",children:o("Delete")})]}),rowPrefix:"org-role",rows:n}),e[9]=l,e[10]=d,e[11]=u,e[12]=n,e[13]=o,e[14]=h):h=e[14];let c;return e[15]!==m||e[16]!==a||e[17]!==h?(c=s(Ye,{action:m,heading:a,testId:"org-roles",children:h}),e[15]=m,e[16]=a,e[17]=h,e[18]=c):c=e[18],c},Nt=200,il=t=>{const e=G(217),{organizationId:l,rolesEnabled:d,teamsEnabled:u}=t,n=ae(),o=q(),[i,r]=P(null),[m,a]=P(null),[h,c]=P(!1),[g,p]=P(null),[f,b]=Gt(l);let S;e[0]!==f||e[1]!==l?(S=["lunora-auth-org-members",l,f],e[0]=f,e[1]=l,e[2]=S):S=e[2];let v;e[3]!==n||e[4]!==f||e[5]!==l?(v=()=>n.listAuthOrgMembers({limit:Nt,offset:f,organizationId:l}),e[3]=n,e[4]=f,e[5]=l,e[6]=v):v=e[6];const y=Ve(S,v);let x;e[7]!==l?(x=["lunora-auth-org-invitations",l],e[7]=l,e[8]=x):x=e[8];let I;e[9]!==n||e[10]!==l?(I=()=>n.listAuthOrgInvitations({limit:200,organizationId:l}),e[9]=n,e[10]=l,e[11]=I):I=e[11];const C=Ve(x,I);let w;e[12]!==l?(w=["lunora-auth-org-teams",l],e[12]=l,e[13]=w):w=e[13];let k;e[14]!==n||e[15]!==l?(k=()=>n.listAuthOrgTeams({limit:200,organizationId:l}),e[14]=n,e[15]=l,e[16]=k):k=e[16];let O;e[17]!==u?(O={enabled:u},e[17]=u,e[18]=O):O=e[18];const z=Ve(w,k,O);let N;e[19]!==l?(N=["lunora-auth-org-roles",l],e[19]=l,e[20]=N):N=e[20];let _;e[21]!==n||e[22]!==l?(_=()=>n.listAuthOrgRoles({limit:200,organizationId:l}),e[21]=n,e[22]=l,e[23]=_):_=e[23];let T;e[24]!==d?(T={enabled:d},e[24]=d,e[25]=T):T=e[25];const R=Ve(N,_,T);let H;e[26]!==m?(H=["lunora-auth-org-team-members",m],e[26]=m,e[27]=H):H=e[27];let B;e[28]!==n||e[29]!==m?(B=()=>n.listAuthOrgTeamMembers({limit:200,teamId:m??""}),e[28]=n,e[29]=m,e[30]=B):B=e[30];const U=m!==null;let Q;e[31]!==U?(Q={enabled:U},e[31]=U,e[32]=Q):Q=e[32];const F=Ve(H,B,Q);let J;e[33]!==y.data?.rows?(J=y.data?.rows??[],e[33]=y.data?.rows,e[34]=J):J=e[34];const j=J;let Z;e[35]!==C.data?.rows?(Z=C.data?.rows??[],e[35]=C.data?.rows,e[36]=Z):Z=e[36];const M=Z;let $;e[37]!==z.data?.rows?($=z.data?.rows??[],e[37]=z.data?.rows,e[38]=$):$=e[38];const K=$;let Y;e[39]!==R.data?.rows?(Y=R.data?.rows??[],e[39]=R.data?.rows,e[40]=Y):Y=e[40];const te=Y;let oe;e[41]!==m||e[42]!==F.data?.rows?(oe=m===null?[]:F.data?.rows??[],e[41]=m,e[42]=F.data?.rows,e[43]=oe):oe=e[43];const le=oe,ee=y.error??C.error??z.error??R.error??F.error;let ie;if(e[44]!==C||e[45]!==y||e[46]!==d||e[47]!==R||e[48]!==m||e[49]!==F||e[50]!==u||e[51]!==z){const V=()=>{const ne=[y.poll(),C.poll()];return u&&ne.push(z.poll()),d&&ne.push(R.poll()),m!==null&&ne.push(F.poll()),Qt(ne)};ie=()=>{kt(V())},e[44]=C,e[45]=y,e[46]=d,e[47]=R,e[48]=m,e[49]=F,e[50]=u,e[51]=z,e[52]=ie}else ie=e[52];const D=ie;let tt;e[53]!==y?(tt=()=>y.poll(),e[53]=y,e[54]=tt):tt=e[54],We(tt,!0);let lt;e[55]!==C?(lt=()=>C.poll(),e[55]=C,e[56]=lt):lt=e[56],We(lt,!0);let ot;e[57]!==z?(ot=()=>z.poll(),e[57]=z,e[58]=ot):ot=e[58],We(ot,u);let it;e[59]!==R?(it=()=>R.poll(),e[59]=R,e[60]=it):it=e[60],We(it,d);let rt;e[61]!==F?(rt=()=>F.poll(),e[61]=F,e[62]=rt):rt=e[62],We(rt,m!==null);let st;e[63]===Symbol.for("react.memo_cache_sentinel")?(st=()=>{r(null)},e[63]=st):st=e[63];const re=st;let nt;e[64]!==D?(nt=V=>{kt((async()=>{c(!0),p(null);try{await V(),D(),c(!1)}catch(ne){p(Jt(ne)),c(!1)}})())},e[64]=D,e[65]=nt):nt=e[65];const se=nt;let at;e[66]!==n||e[67]!==o?(at=V=>{const ne=A(V.id);r({action:async()=>{await n.removeAuthOrgTeam({teamId:ne}),a(wt=>wt===ne?null:wt)},kind:"confirm",message:o("Delete this team and its memberships? This cannot be undone."),testId:"org-team-delete",title:o("Delete team")})},e[66]=n,e[67]=o,e[68]=at):at=e[68];const pt=at;let ue;e[69]!==o?(ue=o("userId"),e[69]=o,e[70]=ue):ue=e[70];let ge;e[71]!==ue?(ge={head:ue,render:rl},e[71]=ue,e[72]=ge):ge=e[72];let he;e[73]!==o?(he=o("role"),e[73]=o,e[74]=he):he=e[74];let be;e[75]!==he?(be={head:he,render:sl},e[75]=he,e[76]=be):be=e[76];let mt;e[77]!==ge||e[78]!==be?(mt=[ge,be],e[77]=ge,e[78]=be,e[79]=mt):mt=e[79];const vt=mt;let pe;e[80]!==o?(pe=o("email"),e[80]=o,e[81]=pe):pe=e[81];let ve;e[82]!==pe?(ve={head:pe,render:nl},e[82]=pe,e[83]=ve):ve=e[83];let ye;e[84]!==o?(ye=o("role"),e[84]=o,e[85]=ye):ye=e[85];let Ce;e[86]!==ye?(Ce={head:ye,render:al},e[86]=ye,e[87]=Ce):Ce=e[87];let xe;e[88]!==o?(xe=o("status"),e[88]=o,e[89]=xe):xe=e[89];let Ie;e[90]!==xe?(Ie={head:xe,render:ml},e[90]=xe,e[91]=Ie):Ie=e[91];let dt;e[92]!==ve||e[93]!==Ce||e[94]!==Ie?(dt=[ve,Ce,Ie],e[92]=ve,e[93]=Ce,e[94]=Ie,e[95]=dt):dt=e[95];const yt=dt;let Se;e[96]!==o?(Se=o("id"),e[96]=o,e[97]=Se):Se=e[97];let we;e[98]!==Se?(we={className:"font-mono text-xs",head:Se,render:dl},e[98]=Se,e[99]=we):we=e[99];let ke;e[100]!==o?(ke=o("name"),e[100]=o,e[101]=ke):ke=e[101];let De;e[102]!==ke?(De={head:ke,render:cl},e[102]=ke,e[103]=De):De=e[103];let ct;e[104]!==we||e[105]!==De?(ct=[we,De],e[104]=we,e[105]=De,e[106]=ct):ct=e[106];const Ct=ct;let ze;e[107]!==o?(ze=o("userId"),e[107]=o,e[108]=ze):ze=e[108];let ft;e[109]!==ze?(ft=[{head:ze,render:fl}],e[109]=ze,e[110]=ft):ft=e[110];const xt=ft;let Ae;e[111]!==o?(Ae=o("role"),e[111]=o,e[112]=Ae):Ae=e[112];let Ne;e[113]!==Ae?(Ne={head:Ae,render:ul},e[113]=Ae,e[114]=Ne):Ne=e[114];let Oe;e[115]!==o?(Oe=o("Permission"),e[115]=o,e[116]=Oe):Oe=e[116];let _e;e[117]!==Oe?(_e={className:"font-mono text-xs whitespace-pre-wrap",head:Oe,render:gl},e[117]=Oe,e[118]=_e):_e=e[118];let ut;e[119]!==Ne||e[120]!==_e?(ut=[Ne,_e],e[119]=Ne,e[120]=_e,e[121]=ut):ut=e[121];const It=ut;let Te;e[122]!==ee?(Te=ee!==null&&s("p",{className:"text-sm text-destructive","data-testid":"org-detail-error",role:"alert",children:ee}),e[122]=ee,e[123]=Te):Te=e[123];let $e;e[124]!==g?($e=g!==null&&s("p",{className:"text-sm text-destructive","data-testid":"org-action-error",role:"alert",children:g}),e[124]=g,e[125]=$e):$e=e[125];let Me;e[126]!==n||e[127]!==se?(Me=V=>{se(()=>n.removeAuthOrgMember({memberId:V}))},e[126]=n,e[127]=se,e[128]=Me):Me=e[128];let Re;e[129]!==h||e[130]!==vt||e[131]!==j||e[132]!==Me?(Re=s(el,{actionBusy:h,memberColumns:vt,members:j,onDialog:r,onRemoveMember:Me}),e[129]=h,e[130]=vt,e[131]=j,e[132]=Me,e[133]=Re):Re=e[133];const St=y.data?.total;let Ee;e[134]!==j.length||e[135]!==f||e[136]!==b||e[137]!==St?(Ee=s(Et,{count:j.length,offset:f,onOffsetChange:b,pageSize:Nt,prefix:"org-members",total:St}),e[134]=j.length,e[135]=f,e[136]=b,e[137]=St,e[138]=Ee):Ee=e[138];let Fe;e[139]!==h||e[140]!==n||e[141]!==yt||e[142]!==M||e[143]!==se||e[144]!==o?(Fe=M.length>0&&s(Ye,{heading:o("Invitations"),testId:"org-invitations",children:s(et,{columns:yt,rowActions:V=>s(L,{"data-testid":`org-cancel-invitation-${A(V.id)}`,disabled:h,onClick:()=>{se(()=>n.cancelAuthOrgInvitation({invitationId:A(V.id)}))},size:"xs",type:"button",variant:"ghost",children:o("Cancel")}),rowPrefix:"org-invitation",rows:M})}),e[139]=h,e[140]=n,e[141]=yt,e[142]=M,e[143]=se,e[144]=o,e[145]=Fe):Fe=e[145];let Pe;e[146]!==pt||e[147]!==m||e[148]!==Ct||e[149]!==K||e[150]!==u?(Pe=u&&s(tl,{onConfirmDeleteTeam:pt,onDialog:r,onSelectTeam:a,selectedTeam:m,teamColumns:Ct,teams:K}),e[146]=pt,e[147]=m,e[148]=Ct,e[149]=K,e[150]=u,e[151]=Pe):Pe=e[151];let je;e[152]!==h||e[153]!==n||e[154]!==se||e[155]!==m||e[156]!==xt||e[157]!==le||e[158]!==u?(je=u&&m!==null&&s(ll,{actionBusy:h,onDialog:r,onRemoveTeamMember:V=>{se(()=>n.removeAuthOrgTeamMember({teamMemberId:V}))},selectedTeam:m,teamMemberColumns:xt,teamMembers:le}),e[152]=h,e[153]=n,e[154]=se,e[155]=m,e[156]=xt,e[157]=le,e[158]=u,e[159]=je):je=e[159];let Le;e[160]!==n||e[161]!==It||e[162]!==te||e[163]!==d||e[164]!==o?(Le=d&&s(ol,{onConfirmDeleteRole:V=>{r({action:()=>n.deleteAuthOrgRole({roleId:V}),kind:"confirm",message:o("Delete this custom role? Members keeping it will lose its grants."),testId:"org-role-delete",title:o("Delete role")})},onDialog:r,roleColumns:It,roles:te}),e[160]=n,e[161]=It,e[162]=te,e[163]=d,e[164]=o,e[165]=Le):Le=e[165];let Be;e[166]!==i?.kind||e[167]!==l||e[168]!==D?(Be=i?.kind==="add-member"&&s(Kt,{onClose:re,onDone:D,organizationId:l}),e[166]=i?.kind,e[167]=l,e[168]=D,e[169]=Be):Be=e[169];let Qe;e[170]!==i?.kind||e[171]!==l||e[172]!==D?(Qe=i?.kind==="invite-member"&&s(Vt,{onClose:re,onDone:D,organizationId:l}),e[170]=i?.kind,e[171]=l,e[172]=D,e[173]=Qe):Qe=e[173];let Je;e[174]!==i||e[175]!==D?(Je=i?.kind==="member-role"&&s(Wt,{member:i.member,onClose:re,onDone:D}),e[174]=i,e[175]=D,e[176]=Je):Je=e[176];let Ue;e[177]!==i?.kind||e[178]!==l||e[179]!==D?(Ue=i?.kind==="team-create"&&s(zt,{mode:"create",onClose:re,onDone:D,organizationId:l}),e[177]=i?.kind,e[178]=l,e[179]=D,e[180]=Ue):Ue=e[180];let Ge;e[181]!==i||e[182]!==l||e[183]!==D?(Ge=i?.kind==="team-rename"&&s(zt,{mode:"edit",onClose:re,onDone:D,organizationId:l,team:i.team}),e[181]=i,e[182]=l,e[183]=D,e[184]=Ge):Ge=e[184];let He;e[185]!==i||e[186]!==D?(He=i?.kind==="team-add-member"&&s(Xt,{onClose:re,onDone:D,teamId:i.teamId}),e[185]=i,e[186]=D,e[187]=He):He=e[187];let Ze;e[188]!==i?.kind||e[189]!==l||e[190]!==D?(Ze=i?.kind==="role-create"&&s(At,{mode:"create",onClose:re,onDone:D,organizationId:l}),e[188]=i?.kind,e[189]=l,e[190]=D,e[191]=Ze):Ze=e[191];let qe;e[192]!==i||e[193]!==l||e[194]!==D?(qe=i?.kind==="role-edit"&&s(At,{mode:"edit",onClose:re,onDone:D,organizationId:l,role:i.role}),e[192]=i,e[193]=l,e[194]=D,e[195]=qe):qe=e[195];let Ke;e[196]!==i||e[197]!==D?(Ke=i?.kind==="confirm"&&s(Lt,{action:i.action,message:i.message,onClose:re,onDone:D,testId:i.testId,title:i.title}),e[196]=i,e[197]=D,e[198]=Ke):Ke=e[198];let gt;return e[199]!==Te||e[200]!==$e||e[201]!==Re||e[202]!==Ee||e[203]!==Fe||e[204]!==Pe||e[205]!==je||e[206]!==Le||e[207]!==Be||e[208]!==Qe||e[209]!==Je||e[210]!==Ue||e[211]!==Ge||e[212]!==He||e[213]!==Ze||e[214]!==qe||e[215]!==Ke?(gt=E("div",{className:"flex flex-col gap-4","data-testid":"org-detail",children:[Te,$e,Re,Ee,Fe,Pe,je,Le,Be,Qe,Je,Ue,Ge,He,Ze,qe,Ke]}),e[199]=Te,e[200]=$e,e[201]=Re,e[202]=Ee,e[203]=Fe,e[204]=Pe,e[205]=je,e[206]=Le,e[207]=Be,e[208]=Qe,e[209]=Je,e[210]=Ue,e[211]=Ge,e[212]=He,e[213]=Ze,e[214]=qe,e[215]=Ke,e[216]=gt):gt=e[216],gt};function rl(t){return s("span",{className:"font-mono text-xs",children:A(t.userId)})}function sl(t){return A(t.role)}function nl(t){return A(t.email)}function al(t){return A(t.role)}function ml(t){return A(t.status)}function dl(t){return A(t.id)}function cl(t){return A(t.name)}function fl(t){return s("span",{className:"font-mono text-xs",children:A(t.userId)})}function ul(t){return A(t.role)}function gl(t){return A(t.permission)}const Ot=100,Ml=()=>{const t=G(69),e=ae(),l=q(),{config:d,ready:u}=Bt(),n=d.capabilities.organization,[o,i]=P(null),[r,m]=P(null),[a,h]=P(0);let c;t[0]!==a?(c=["lunora-auth-orgs",a],t[0]=a,t[1]=c):c=t[1];let g;t[2]!==e||t[3]!==a?(g=()=>e.listAuthOrganizations({limit:Ot,offset:a}),t[2]=e,t[3]=a,t[4]=g):g=t[4];let p;t[5]!==n?(p={enabled:n},t[5]=n,t[6]=p):p=t[6];const f=Ve(c,g,p),b=f.data?.rows??null;let S;t[7]!==f?(S=()=>f.poll(),t[7]=f,t[8]=S):S=t[8],We(S,n);let v;t[9]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{m(null)},t[9]=v):v=t[9];const y=v;let x;t[10]!==f?(x=()=>{f.refetch()},t[10]=f,t[11]=x):x=t[11];const I=x;let C;t[12]===Symbol.for("react.memo_cache_sentinel")?(C=M=>{i(M)},t[12]=C):C=t[12];const w=C;if(u&&!n){let M;t[13]!==l?(M=l("Enable the organization() plugin in your auth config to manage organizations here."),t[13]=l,t[14]=M):M=t[14];let $;t[15]!==l?($=l("Organizations are not enabled."),t[15]=l,t[16]=$):$=t[16];let K;return t[17]!==M||t[18]!==$?(K=s(Xe,{description:M,testId:"org-disabled",title:$}),t[17]=M,t[18]=$,t[19]=K):K=t[19],K}let k;t[20]!==l?(k=l("Organizations"),t[20]=l,t[21]=k):k=t[21];let O;t[22]!==k?(O=s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:k}),t[22]=k,t[23]=O):O=t[23];let z;t[24]===Symbol.for("react.memo_cache_sentinel")?(z=()=>{m({kind:"create"})},t[24]=z):z=t[24];let N;t[25]!==l?(N=l("New organization"),t[25]=l,t[26]=N):N=t[26];let _;t[27]!==N?(_=s(L,{"data-testid":"org-new",onClick:z,size:"sm",type:"button",children:N}),t[27]=N,t[28]=_):_=t[28];let T;t[29]!==_||t[30]!==O?(T=E("div",{className:"flex items-center justify-between",children:[O,_]}),t[29]=_,t[30]=O,t[31]=T):T=t[31];let R;t[32]!==f.error?(R=f.error!==null&&s("p",{className:"text-sm text-destructive","data-testid":"org-error",role:"alert",children:f.error}),t[32]=f.error,t[33]=R):R=t[33];let H;t[34]!==b||t[35]!==l?(H=b!==null&&b.length===0&&s(Xe,{testId:"org-empty",title:l("No organizations.")}),t[34]=b,t[35]=l,t[36]=H):H=t[36];let B;t[37]!==b||t[38]!==o||t[39]!==l?(B=b!==null&&b.length>0&&s(Tt,{className:"overflow-hidden py-0",children:s(_t,{className:"px-0",children:E(Rt,{"data-testid":"org-table",children:[s($t,{children:E(ht,{children:[s(ce,{children:l("id")}),s(ce,{children:l("name")}),s(ce,{children:l("slug")}),s(ce,{children:l("created")}),s(ce,{"aria-label":l("Actions")})]})}),s(Mt,{children:b.map(M=>{const $=A(M.id);return E(ht,{"data-testid":`org-row-${$}`,children:[s(fe,{className:"font-mono text-xs",children:$}),s(fe,{children:A(M.name)}),s(fe,{children:A(M.slug)}),s(fe,{className:"text-muted-foreground tabular-nums",children:Ut(M.createdAt)}),s(fe,{children:E("div",{className:"flex justify-end gap-1",children:[s(L,{"aria-pressed":o===$,"data-testid":`org-select-${$}`,onClick:()=>{w($)},size:"xs",type:"button",variant:"ghost",children:l("Manage")}),s(L,{"data-testid":`org-edit-${$}`,onClick:()=>{m({kind:"edit",org:M})},size:"xs",type:"button",variant:"ghost",children:l("Edit")}),s(L,{"data-testid":`org-delete-${$}`,onClick:()=>{m({kind:"delete",org:M})},size:"xs",type:"button",variant:"ghost",children:l("Delete")})]})})]},$)})})]})})}),t[37]=b,t[38]=o,t[39]=l,t[40]=B):B=t[40];let U;t[41]!==a||t[42]!==b||t[43]!==f.data?.total?(U=b!==null&&s(Et,{count:b.length,offset:a,onOffsetChange:h,pageSize:Ot,prefix:"org",total:f.data?.total}),t[41]=a,t[42]=b,t[43]=f.data?.total,t[44]=U):U=t[44];let Q;t[45]!==d.organization||t[46]!==o?(Q=o!==null&&s(il,{organizationId:o,rolesEnabled:d.organization.roles,teamsEnabled:d.organization.teams}),t[45]=d.organization,t[46]=o,t[47]=Q):Q=t[47];let F;t[48]!==r?.kind||t[49]!==I?(F=r?.kind==="create"&&s(Dt,{mode:"create",onClose:y,onDone:I}),t[48]=r?.kind,t[49]=I,t[50]=F):F=t[50];let J;t[51]!==r||t[52]!==I?(J=r?.kind==="edit"&&s(Dt,{mode:"edit",onClose:y,onDone:I,org:r.org}),t[51]=r,t[52]=I,t[53]=J):J=t[53];let j;t[54]!==e||t[55]!==r||t[56]!==I||t[57]!==l?(j=r?.kind==="delete"&&s(Lt,{action:async()=>{const M=A(r.org.id);await e.deleteAuthOrganization({organizationId:M}),i($=>$===M?null:$)},message:l("Delete this organization? Its members, invitations, teams, and custom roles are removed. This cannot be undone."),onClose:y,onDone:I,testId:"org-delete",title:l("Delete organization")}),t[54]=e,t[55]=r,t[56]=I,t[57]=l,t[58]=j):j=t[58];let Z;return t[59]!==T||t[60]!==R||t[61]!==H||t[62]!==B||t[63]!==U||t[64]!==Q||t[65]!==F||t[66]!==J||t[67]!==j?(Z=E("div",{className:"flex flex-col gap-4","data-testid":"lunora-organizations",children:[T,R,H,B,U,Q,F,J,j]}),t[59]=T,t[60]=R,t[61]=H,t[62]=B,t[63]=U,t[64]=Q,t[65]=F,t[66]=J,t[67]=j,t[68]=Z):Z=t[68],Z};export{Ml as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{decodeDocument as D}from"@lunora/wire";import{E as F}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as E}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as x,a as A}from"../packem_shared/card-By2O8ULa.mjs";import{E as I}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as P,a as V,b as g,c as m,d as C,e as o}from"../packem_shared/table-D0SBiDu-.mjs";import{u as h}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useAutoRefresh as H}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as M}from"../packem_shared/home-panel-5fGktYeD.mjs";import{useT as U}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as b}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as B}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsx as e,jsxs as d}from"react/jsx-runtime";const T="payment_subscriptions",R="payment_events",k=[T,R],G={},N=new Set(["active","trialing"]),Y=new Set(["past_due","unpaid"]),a=(n,r)=>{if(n[r]!==void 0)return n[r];const p=n.__doc__;return typeof p=="string"?D(p)?.[r]:void 0},s=n=>typeof n=="string"?n:typeof n=="number"||typeof n=="bigint"||typeof n=="boolean"?String(n):"",q=n=>N.has(n)?"default":Y.has(n)?"destructive":"outline",oe=({limit:n=100})=>{const r=U(),p=M(),{data:y}=h(b.listTables,G,{live:!0}),_=y!==void 0,w=Array.isArray(y)&&k.every(t=>y.some(c=>c.name===t)),l=p.payments&&w,i=h(b.readTablePage,{filters:[],limit:n,offset:0,orderBy:{column:"updatedAt",direction:"desc"},search:"",table:T},{enabled:l}),u=h(b.readTablePage,{filters:[],limit:25,offset:0,orderBy:{column:"processedAt",direction:"desc"},search:"",table:R},{enabled:l}),v=h(b.facetColumn,{column:"state",table:T},{enabled:l});H(()=>{if(l)return Promise.all([i.poll(),u.poll(),v.poll()])},!0);const f=i.data?.rows??[],L=u.data?.rows??[],O=i.error??u.error,Q=i.error===null?u.errorSource:i.errorSource,j=i.data?.total??f.length,S=v.data?.values===void 0?f.filter(t=>N.has(s(a(t,"state")))).length:v.data.values.reduce((t,c)=>t+(N.has(s(c.value))?c.count:0),0);return _&&!l?e("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:e(I,{description:r("No @lunora/payment tables found in this deployment. Add `.extend(paymentExtension)` to lunora/schema.ts and wire `payment` on createShardDO() to sync customers and subscriptions."),testId:"payments-unconfigured",title:r("No payments configured")})}):d("div",{className:"flex flex-col gap-4","data-testid":"payments-panel",children:[e("div",{className:"flex items-center gap-2","data-testid":"payments-summary",children:d(x,{className:"justify-between gap-0 py-0",children:[d("div",{className:"flex flex-col gap-2.5 p-4",children:[e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Subscriptions")}),d("div",{className:"flex items-center gap-2",children:[e("span",{className:"text-2xl font-semibold tabular-nums text-foreground",children:S}),e(E,{variant:"default",children:r("{count} active",{count:S})})]})]}),e("div",{className:"border-t border-border bg-muted/50 px-4 py-2.5 text-[11px] text-muted-foreground",children:r("{total} total",{total:j})})]})}),O===null?void 0:e(F,{error:Q}),f.length===0&&!i.isLoading?e(I,{testId:"payments-empty",title:r("No subscriptions yet")}):e(x,{className:"overflow-hidden py-0",children:e(A,{className:"px-0",children:d(P,{children:[e(V,{children:d(g,{children:[e(m,{children:r("Provider")}),e(m,{children:r("Reference")}),e(m,{children:r("Plan")}),e(m,{children:r("State")}),e(m,{children:r("Renews")})]})}),e(C,{children:f.map(t=>{const c=s(a(t,"state"));return d(g,{"data-testid":"payment-subscription-row",children:[e(o,{children:s(a(t,"provider"))}),e(o,{children:s(a(t,"referenceId"))}),e(o,{children:s(a(t,"priceId"))}),e(o,{children:e(E,{variant:q(c),children:c})}),e(o,{children:B(a(t,"currentPeriodEnd"))})]},s(a(t,"providerSubscriptionId")))})})]})})}),d(x,{className:"overflow-hidden py-0",children:[e("header",{className:"border-b border-border px-4 py-3",children:e("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:r("Recent webhook events")})}),e(A,{className:"px-0",children:e(P,{children:e(C,{children:L.map(t=>d(g,{"data-testid":"payment-event-row",children:[e(o,{children:s(a(t,"provider"))}),e(o,{className:"font-medium",children:s(a(t,"type"))}),e(o,{className:"text-muted-foreground",children:s(a(t,"providerEventId"))}),e(o,{children:B(a(t,"processedAt"))})]},s(a(t,"providerEventId"))))})})})]})]})};export{oe as PaymentsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as b,useRef as oe,useEffect as ie}from"react";import{c as xe,d as ge,b as be,a as fe,C as me}from"../packem_shared/card-By2O8ULa.mjs";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{c as te}from"react/compiler-runtime";import{E as ye}from"../packem_shared/error-alert-DKXm5h19.mjs";import{L as ve}from"../packem_shared/live-status-D1GasNsH.mjs";import{B as Q}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as j}from"../packem_shared/button-q0UYSmrn.mjs";import{E as pe}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as Ne,a as ke,b as ne,c as ae,d as Ce,e as se}from"../packem_shared/table-D0SBiDu-.mjs";import{u as le}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{ADMIN_FUNCTIONS as ee}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsxs as u,jsx as s}from"react/jsx-runtime";import{decodeWire as Se}from"@lunora/wire";import{ConfirmButton as we}from"../packem_shared/ConfirmButton-CIXYF6Mg.mjs";import{ShardInput as Pe}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{I as Y}from"../packem_shared/input-CXhxesPC.mjs";import{L as _}from"../packem_shared/label-DKFzyHq6.mjs";import{T as Ie}from"../packem_shared/textarea--40GKAyz.mjs";import{u as ue}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{d as Re,c as Te,b as Ae,f as re,k as Ee}from"../packem_shared/internal-hIuTpSbx.mjs";const ce=["read","insert","update","delete"],_e=(t,e)=>({delete:t("Delete"),insert:t("Insert"),read:t("Read"),update:t("Update")})[e],Fe=t=>t.file===""?t.procedure:`${t.file}:${t.procedure}`,Oe=t=>{const e=new Set;for(const l of t?.advisories??[])if(l.name==="rls_uncovered_table"){const{table:o}=l.metadata;typeof o=="string"&&o!==""&&e.add(o)}return e},De=(t,e,l)=>{const o=new Map,r=n=>{const i=o.get(n);if(i!==void 0)return i;const m={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:new Set,table:n,uncovered:l.has(n)};return o.set(n,m),m};for(const n of t)r(n.table).cells[n.on]={path:Fe(n),procedure:n.procedure};for(const n of e)r(n.table).maskedColumns.add(n.column);for(const n of l)r(n);return[...o.values()].toSorted((n,i)=>n.table.localeCompare(i.table))},Le=t=>{const e=te(17);let l;e[0]!==t?(l=t===void 0?{}:t,e[0]=t,e[1]=l):l=e[1];const{onProbe:o}=l,r=G();let n,i;e[2]===Symbol.for("react.memo_cache_sentinel")?(n={},i={live:!0},e[2]=n,e[3]=i):(n=e[2],i=e[3]);const m=le(ee.rlsPolicies,n,i);let a;e[4]===Symbol.for("react.memo_cache_sentinel")?(a={},e[4]=a):a=e[4];const f=le(ee.maskPolicies,a);let c;e[5]===Symbol.for("react.memo_cache_sentinel")?(c={},e[5]=c):c=e[5];const d=le(ee.getAdvisories,c);let h;if(e[6]!==d.data||e[7]!==f.data||e[8]!==o||e[9]!==m||e[10]!==r){let g=null;m.data!==void 0&&(g=Array.isArray(m.data.policies)?m.data.policies:[]);const F=Array.isArray(f.data?.columns)?f.data.columns:[],H=d.data??null,{error:w,errorSource:C,liveError:P}=m,R=g===null?[]:De(g,F,Oe(H));let k;e[12]!==P?(k=s("div",{className:"flex items-center justify-end",children:s(ve,{message:P,prefix:"pm"})}),e[12]=P,e[13]=k):k=e[13];let T;e[14]!==w||e[15]!==C?(T=w!==null&&s(ye,{error:C,testId:"pm-error"}),e[14]=w,e[15]=C,e[16]=T):T=e[16],h=u("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[k,T,g!==null&&R.length===0?s(pe,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):u(Ne,{"data-testid":"pm-table",children:[s(ke,{children:u(ne,{children:[s(ae,{children:r("Table")}),ce.map(x=>s(ae,{children:_e(r,x)},x)),s(ae,{children:r("Masked columns")})]})}),s(Ce,{children:R.map(x=>u(ne,{"data-testid":`pm-row-${x.table}`,children:[s(se,{className:"font-mono text-xs",children:u("span",{className:"flex items-center gap-1.5",children:[x.table,x.uncovered&&s(Q,{"data-testid":`pm-uncovered-${x.table}`,title:r("Uncovered — reachable without a policy"),variant:"destructive",children:r("Uncovered — reachable without a policy")})]})}),ce.map(I=>{const v=x.cells[I];return s(se,{"data-testid":`pm-cell-${x.table}-${I}`,children:v.procedure===void 0?s("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):u("span",{className:"flex flex-col gap-1",children:[s(Q,{variant:"secondary",children:r("Covered by {procedure}",{procedure:v.procedure})}),o!==void 0&&s(j,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${x.table}-${I}`,onClick:()=>{o(x.table,I,v.path??"")},size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},I)}),s(se,{children:x.maskedColumns.size===0?s("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):s("span",{className:"flex flex-wrap gap-1",children:[...x.maskedColumns].map($e)})})]},x.table))})]})]}),e[6]=d.data,e[7]=f.data,e[8]=o,e[9]=m,e[10]=r,e[11]=h}else h=e[11];return h};function $e(t){return s(Q,{variant:"outline",children:t},t)}const Ue=Te(ee.runAs),We=new Set(["FORBIDDEN","RLS_REQUIRED","UNAUTHORIZED"]),Me=t=>{const e=t?.code;return typeof e=="string"?e:void 0},ze=()=>{const t=ue();return async({args:e,functionPath:l,shardKey:o="",userId:r})=>{if(r.trim()==="")return{kind:"invalid",message:"No identity to probe: enter the userId whose access you want to test."};const n=Ue;try{return{kind:"allowed",value:await t.query(n,{args:e,functionPath:l,userId:r},Re(o))}}catch(i){const m=i instanceof Error?i.message:String(i),a=Me(i);return a!==void 0&&We.has(a)?{kind:"denied",message:m}:{kind:"errored",message:m}}}},qe=t=>t===void 0?"undefined":JSON.stringify(t,Ee,2),Be=t=>{const e=te(43),{outcome:l}=t,o=G();if(l.kind==="allowed"){let a;e[0]!==o?(a=o("Allowed"),e[0]=o,e[1]=a):a=e[1];let f;e[2]!==a?(f=s(Q,{variant:"secondary",children:a}),e[2]=a,e[3]=f):f=e[3];let c;e[4]!==l.value?(c=qe(l.value),e[4]=l.value,e[5]=c):c=e[5];let d;e[6]!==c?(d=s("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:c}),e[6]=c,e[7]=d):d=e[7];let h;return e[8]!==f||e[9]!==d?(h=u("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[f,d]}),e[8]=f,e[9]=d,e[10]=h):h=e[10],h}if(l.kind==="denied"){let a;e[11]!==o?(a=o("Denied"),e[11]=o,e[12]=a):a=e[12];let f;e[13]!==a?(f=s(Q,{variant:"destructive",children:a}),e[13]=a,e[14]=f):f=e[14];let c;e[15]!==l.message?(c=s("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:l.message}),e[15]=l.message,e[16]=c):c=e[16];let d;return e[17]!==f||e[18]!==c?(d=u("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[f,c]}),e[17]=f,e[18]=c,e[19]=d):d=e[19],d}if(l.kind==="errored"){let a;e[20]!==o?(a=o("Errored"),e[20]=o,e[21]=a):a=e[21];let f;e[22]!==a?(f=s(Q,{variant:"outline",children:a}),e[22]=a,e[23]=f):f=e[23];let c;e[24]!==o?(c=o("The call failed for a reason that is not an access verdict, so it says nothing about the policy."),e[24]=o,e[25]=c):c=e[25];let d;e[26]!==c?(d=s("p",{className:"text-sm text-muted-foreground",children:c}),e[26]=c,e[27]=d):d=e[27];let h;e[28]!==l.message?(h=s("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-errored",role:"alert",children:l.message}),e[28]=l.message,e[29]=h):h=e[29];let g;return e[30]!==f||e[31]!==d||e[32]!==h?(g=u("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-errored",children:[f,d,h]}),e[30]=f,e[31]=d,e[32]=h,e[33]=g):g=e[33],g}let r;e[34]!==o?(r=o("Not run"),e[34]=o,e[35]=r):r=e[35];let n;e[36]!==r?(n=s(Q,{variant:"outline",children:r}),e[36]=r,e[37]=n):n=e[37];let i;e[38]!==l.message?(i=s("p",{className:"text-sm text-muted-foreground","data-testid":"pp-invalid",role:"status",children:l.message}),e[38]=l.message,e[39]=i):i=e[39];let m;return e[40]!==n||e[41]!==i?(m=u("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-invalid",children:[n,i]}),e[40]=n,e[41]=i,e[42]=m):m=e[42],m},je=t=>{const e=te(17),{disabled:l,executesWrites:o,functionPath:r,onRun:n,running:i,userId:m}=t,a=G();let f;e[0]!==i||e[1]!==a?(f=a(i?"Probing…":"Run probe"),e[0]=i,e[1]=a,e[2]=f):f=e[2];const c=f;let d;e[3]!==l||e[4]!==o||e[5]!==r||e[6]!==c||e[7]!==n||e[8]!==a||e[9]!==m?(d=o?s(we,{confirmLabel:a("This will execute `{functionPath}` as user `{userId}`.",{functionPath:r,userId:m}),disabled:l,onConfirm:n,testId:"pp-run",children:c}):s(j,{"data-testid":"pp-run",disabled:l,onClick:n,type:"button",children:c}),e[3]=l,e[4]=o,e[5]=r,e[6]=c,e[7]=n,e[8]=a,e[9]=m,e[10]=d):d=e[10];let h;e[11]!==a||e[12]!==m?(h=m!==""&&s(Q,{"data-testid":"pp-as-badge",variant:"secondary",children:a("as {userId}",{userId:m})}),e[11]=a,e[12]=m,e[13]=h):h=e[13];let g;return e[14]!==d||e[15]!==h?(g=u("div",{className:"flex items-center gap-2",children:[d,h]}),e[14]=d,e[15]=h,e[16]=g):g=e[16],g},Qe=({functions:t,prefill:e,runAsIdentity:l=!1}={})=>{const o=ue(),r=G(),n=ze(),[i,m]=b(null),[a,f]=b(null),c=t??i??[],[d,h]=b(""),[g,F]=b("{}"),[H,w]=b(""),[C,P]=b(""),[R,k]=b(!1),[T,x]=b(null),[I,v]=b(null),[A,O]=b(!1),E=oe(-1),S=oe(0);ie(()=>{if(t!==void 0)return;let p=!1;return o.listFunctions().then(N=>(p||m(N),N)).catch(N=>{p||f(Ae(N))}),()=>{p=!0}},[o,t]),ie(()=>{if(e===void 0||E.current===e.nonce)return;E.current=e.nonce,S.current+=1;const p=e.functionPath;queueMicrotask(()=>{h(p),x(null)})},[e]);const J=A?c:c.filter(p=>p.kind==="query"||p.path===d),y=d===""?J[0]?.path??"":d,D=c.find(p=>p.path===y),K=y!==""&&D?.kind!=="query",L=async()=>{if(y==="")return;let p;try{p=g.trim()===""?{}:Se(JSON.parse(g))}catch(B){v(r("Invalid JSON args: {message}",{message:B.message})),x(null);return}S.current+=1;const N=S.current;v(null),k(!0);try{const B=await n({args:p,functionPath:y,shardKey:H.trim(),userId:C.trim()});N===S.current&&x(B)}finally{k(!1)}},$=()=>{re(L())},U=p=>{h(p.target.value)},W=p=>{F(p.target.value)},M=p=>{P(p.target.value)},z=p=>{O(p.target.checked),!p.target.checked&&K&&h("")},q=!l||R||y==="";return u("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[a!==null&&s("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:a}),!l&&s(pe,{description:r("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),testId:"pp-gate",title:r("Set `runAsIdentity` to forge an identity and probe access.")}),u("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[u("div",{className:"flex flex-col gap-1.5",children:[s(_,{htmlFor:"pp-function",children:r("Function")}),s("select",{"aria-label":r("Function"),className:"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50","data-testid":"pp-function",id:"pp-function",onChange:U,value:y,children:J.map(p=>u("option",{value:p.path,children:[p.path," (",p.kind,")"]},p.path))}),u(_,{className:"flex items-center gap-1.5 text-xs font-normal",htmlFor:"pp-include-writes",children:[s("input",{checked:A,className:"size-4 accent-primary","data-testid":"pp-include-writes",id:"pp-include-writes",onChange:z,type:"checkbox"}),r("Include mutations and actions")]})]}),u("div",{className:"flex flex-col gap-1.5",children:[s(_,{htmlFor:"pp-args",children:r("Arguments")}),s(Ie,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:W,value:g})]}),s(Pe,{onChange:w,testId:"pp-shard",value:H}),u("div",{className:"flex flex-col gap-1.5",children:[s(_,{htmlFor:"pp-user",children:r("Run as (userId)")}),s(Y,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:M,placeholder:r("Required — the identity to probe as"),value:C})]}),s(je,{disabled:q,executesWrites:K,functionPath:y,onRun:$,running:R,userId:C.trim()})]}),I!==null&&s("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:I}),T!==null&&s(Be,{outcome:T})]})},He="/__lunora/policy-scaffold",Je={"already-wired":"That procedure already has an rls(...) policy wired in.","file-exists":"A policy file with that name already exists — 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({…}) form — convert it to the builder form (c.use(…).query(…)) before wiring RLS."},Ke=async t=>{const e=await fetch(He,{body:JSON.stringify(t),headers:{"Content-Type":"application/json"},method:"POST"}),l=await e.json();if(l.needsManualEdit===!0)return{kind:"needs-manual-edit",message:l.message??"This change must be made by hand."};if(e.ok)return{diagnostics:l.diagnostics??[],kind:"ok",label:l.fileName??l.exportName??""};const o=l.error;return{kind:"error",message:o===void 0?`policy scaffold failed (${String(e.status)})`:Je[o]??o}},de={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},Ve=()=>{const t=te(69),e=G(),[l,o]=b(null),[r,n]=b(!1),[i,m]=b(null),[a,f]=b(de);let c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=X=>{const V=X.target.name,{value:Z}=X.target;f(he=>({...he,[V]:Z}))},t[0]=c):c=t[0];const d=c;let h;t[1]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(null),f(de)},t[1]=h):h=t[1];const g=h;let F;t[2]===Symbol.for("react.memo_cache_sentinel")?(F=async X=>{n(!0),m(null);try{const V=await Ke(X);m(V),V.kind==="ok"&&g()}catch(V){const Z=V;m({kind:"error",message:Z instanceof Error?Z.message:String(Z)})}n(!1)},t[2]=F):F=t[2];const H=F;let w;t[3]!==a.policyName||t[4]!==a.tableName?(w=()=>{re(H({kind:"scaffoldPolicy",name:a.policyName.trim(),table:a.tableName.trim()}))},t[3]=a.policyName,t[4]=a.tableName,t[5]=w):w=t[5];const C=w;let P;t[6]!==a.exportName||t[7]!==a.filePath||t[8]!==a.policies?(P=()=>{re(H({exportName:a.exportName.trim(),filePath:a.filePath.trim(),kind:"wireRls",policies:a.policies.trim()}))},t[6]=a.exportName,t[7]=a.filePath,t[8]=a.policies,t[9]=P):P=t[9];const R=P;let k;t[10]===Symbol.for("react.memo_cache_sentinel")?(k=()=>{m(null),o("scaffold")},t[10]=k):k=t[10];const T=k;let x;t[11]===Symbol.for("react.memo_cache_sentinel")?(x=()=>{m(null),o("wire")},t[11]=x):x=t[11];const I=x;let v;t[12]!==e?(v=e("Scaffold access rules"),t[12]=e,t[13]=v):v=t[13];let A;t[14]!==v?(A=s(xe,{children:v}),t[14]=v,t[15]=A):A=t[15];let O;t[16]!==e?(O=e("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only."),t[16]=e,t[17]=O):O=t[17];let E;t[18]!==O?(E=s(ge,{children:O}),t[18]=O,t[19]=E):E=t[19];let S;t[20]!==E||t[21]!==A?(S=u(be,{children:[A,E]}),t[20]=E,t[21]=A,t[22]=S):S=t[22];const J=l==="scaffold"?"default":"outline";let y;t[23]!==e?(y=e("New policy file"),t[23]=e,t[24]=y):y=t[24];let D;t[25]!==J||t[26]!==y?(D=s(j,{"data-testid":"policy-scaffolder-new",onClick:T,size:"xs",type:"button",variant:J,children:y}),t[25]=J,t[26]=y,t[27]=D):D=t[27];const K=l==="wire"?"default":"outline";let L;t[28]!==e?(L=e("Wire into a procedure"),t[28]=e,t[29]=L):L=t[29];let $;t[30]!==K||t[31]!==L?($=s(j,{"data-testid":"policy-scaffolder-wire",onClick:I,size:"xs",type:"button",variant:K,children:L}),t[30]=K,t[31]=L,t[32]=$):$=t[32];let U;t[33]!==D||t[34]!==$?(U=u("div",{className:"flex flex-wrap gap-2",children:[D,$]}),t[33]=D,t[34]=$,t[35]=U):U=t[35];let W;t[36]!==r||t[37]!==a.policyName||t[38]!==a.tableName||t[39]!==l||t[40]!==C||t[41]!==e?(W=l==="scaffold"&&u("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[u("div",{className:"flex flex-col gap-1 text-xs",children:[s(_,{htmlFor:"policy-scaffolder-name",children:e("Policy name")}),s(Y,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:d,value:a.policyName})]}),u("div",{className:"flex flex-col gap-1 text-xs",children:[s(_,{htmlFor:"policy-scaffolder-table",children:e("Table name")}),s(Y,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:d,value:a.tableName})]}),s(j,{"data-testid":"policy-scaffolder-create",disabled:r||a.policyName.trim()===""||a.tableName.trim()==="",onClick:C,size:"xs",type:"button",children:e(r?"Creating…":"Create policy file")}),s(j,{onClick:g,size:"xs",type:"button",variant:"ghost",children:e("Cancel")})]}),t[36]=r,t[37]=a.policyName,t[38]=a.tableName,t[39]=l,t[40]=C,t[41]=e,t[42]=W):W=t[42];let M;t[43]!==r||t[44]!==a.exportName||t[45]!==a.filePath||t[46]!==a.policies||t[47]!==l||t[48]!==R||t[49]!==e?(M=l==="wire"&&u("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[u("div",{className:"flex flex-col gap-1 text-xs",children:[s(_,{htmlFor:"policy-scaffolder-file",children:e("Procedure file path")}),s(Y,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:d,value:a.filePath})]}),u("div",{className:"flex flex-col gap-1 text-xs",children:[s(_,{htmlFor:"policy-scaffolder-export",children:e("Exported procedure")}),s(Y,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:d,value:a.exportName})]}),u("div",{className:"flex flex-col gap-1 text-xs",children:[s(_,{htmlFor:"policy-scaffolder-policies",children:e("Policy set identifier")}),s(Y,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:d,value:a.policies})]}),s(j,{"data-testid":"policy-scaffolder-apply",disabled:r||a.filePath.trim()===""||a.exportName.trim()===""||a.policies.trim()==="",onClick:R,size:"xs",type:"button",children:e(r?"Wiring…":"Wire RLS")}),s(j,{onClick:g,size:"xs",type:"button",variant:"ghost",children:e("Cancel")})]}),t[43]=r,t[44]=a.exportName,t[45]=a.filePath,t[46]=a.policies,t[47]=l,t[48]=R,t[49]=e,t[50]=M):M=t[50];let z;t[51]!==i?(z=i?.kind==="error"&&s("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:i.message}),t[51]=i,t[52]=z):z=t[52];let q;t[53]!==i?.kind||t[54]!==e?(q=i?.kind==="needs-manual-edit"&&s("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:e("This change must be made by hand — the scaffolder only adds new, deny-by-default rules.")}),t[53]=i?.kind,t[54]=e,t[55]=q):q=t[55];let p;t[56]!==i||t[57]!==e?(p=i?.kind==="ok"&&u("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[s("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:e("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:i.label})}),i.diagnostics.length>0&&s("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:i.diagnostics.map(Ye)})]}),t[56]=i,t[57]=e,t[58]=p):p=t[58];let N;t[59]!==U||t[60]!==W||t[61]!==M||t[62]!==z||t[63]!==q||t[64]!==p?(N=u(fe,{children:[U,W,M,z,q,p]}),t[59]=U,t[60]=W,t[61]=M,t[62]=z,t[63]=q,t[64]=p,t[65]=N):N=t[65];let B;return t[66]!==S||t[67]!==N?(B=u(me,{"data-testid":"policy-scaffolder",size:"sm",children:[S,N]}),t[66]=S,t[67]=N,t[68]=B):B=t[68],B};function Ye(t){return s("li",{className:"font-mono text-[11px] text-destructive",children:t},t)}const bt=({functions:t,runAsIdentity:e=!1,schemaEditable:l=!1}={})=>{const o=G(),[r,n]=b(void 0),i=(m,a,f)=>{f!==""&&n(c=>({functionPath:f,nonce:(c?.nonce??0)+1}))};return u("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[u("section",{className:"flex flex-col gap-3",children:[s("header",{className:"border-b border-border px-4 py-3",children:s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o("Permissions")})}),s(Le,{onProbe:i})]}),s("section",{className:"flex flex-col gap-3",children:u(me,{className:"gap-0 py-0",children:[s("header",{className:"border-b border-border px-4 py-3",children:s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:o("Probe")})}),u(fe,{className:"px-4 py-4",children:[s("p",{className:"mb-3 text-sm text-muted-foreground",children:o("Pick a function and an identity, then run it to see the access outcome.")}),s(Qe,{functions:t,prefill:r,runAsIdentity:e})]})]})}),l&&s("section",{className:"flex flex-col gap-2",children:s(Ve,{})})]})};export{bt as PermissionsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as W}from"react/compiler-runtime";import{useQueryClient as se,useQuery as ie,useMutation as re}from"@tanstack/react-query";import{useId as le}from"react";import{E as Z}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as G}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as ne}from"../packem_shared/button-q0UYSmrn.mjs";import{E as ee}from"../packem_shared/empty-state-D7jEML_T.mjs";import{c as w,a as ae,b as te,d as de,T as ce,e as O}from"../packem_shared/table-D0SBiDu-.mjs";import{useT as X}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{h as J}from"../packem_shared/internal-hIuTpSbx.mjs";import{c as oe}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as i,jsxs as z}from"react/jsx-runtime";const ue=new Set(["cancelled","completed","expired"]),fe=r=>ue.has(r),me=r=>r.extendedDueAt??r.dueAt,ve=r=>!fe(r)&&r!=="ready",pe=(r,e)=>ve(r.status)&&e.getTime()>me(r).getTime(),ye=(r,e)=>pe({dueAt:new Date(r.dueAt),status:r.status,...r.extendedDueAt===void 0||r.extendedDueAt===null?{}:{extendedDueAt:new Date(r.extendedDueAt)}},new Date(e)),he=["studio","privacy-requests"],xe={cancelled:"outline",completed:"success",expired:"outline",failed:"destructive",grace:"secondary",processing:"warning",ready:"success",received:"info"},Ae=r=>J(r??void 0,"—"),ge=r=>{const e=W(55),{asOf:o,retrying:t,row:s,onRetry:q}=r,a=X();let d,c,D;e[0]!==o||e[1]!==s?(c=ye(s,o),d=te,D=oe(c&&"bg-destructive/5"),e[0]=o,e[1]=s,e[2]=d,e[3]=c,e[4]=D):(d=e[2],c=e[3],D=e[4]);const S=c?"true":"false";let u;e[5]!==s.id?(u=i(O,{className:"font-mono text-xs",children:s.id}),e[5]=s.id,e[6]=u):u=e[6];let f;e[7]!==s.type||e[8]!==a?(f=s.type==="export"?a("Export"):a("Erasure"),e[7]=s.type,e[8]=a,e[9]=f):f=e[9];let E;e[10]!==f?(E=i(O,{children:i(G,{variant:"secondary",children:f})}),e[10]=f,e[11]=E):E=e[11];let n;e[12]!==s.subjectId?(n=i(O,{className:"font-mono text-xs",children:s.subjectId}),e[12]=s.subjectId,e[13]=n):n=e[13];const N=xe[s.status];let b;e[14]!==s.status||e[15]!==N?(b=i(O,{children:i(G,{variant:N,children:s.status})}),e[14]=s.status,e[15]=N,e[16]=b):b=e[16];let R;e[17]!==s.receivedAt?(R=J(s.receivedAt),e[17]=s.receivedAt,e[18]=R):R=e[18];let P;e[19]!==R?(P=i(O,{children:R}),e[19]=R,e[20]=P):P=e[20];let m;e[21]!==s.dueAt?(m=J(s.dueAt),e[21]=s.dueAt,e[22]=m):m=e[22];let v;e[23]!==m?(v=i(O,{children:m}),e[23]=m,e[24]=v):v=e[24];let p;e[25]!==s.extendedDueAt?(p=Ae(s.extendedDueAt),e[25]=s.extendedDueAt,e[26]=p):p=e[26];let y;e[27]!==p?(y=i(O,{children:p}),e[27]=p,e[28]=y):y=e[28];let h;e[29]!==c||e[30]!==a?(h=c&&i(G,{"data-testid":"privacy-overdue",variant:"destructive",children:a("Overdue")}),e[29]=c,e[30]=a,e[31]=h):h=e[31];let x;e[32]!==h?(x=i(O,{children:h}),e[32]=h,e[33]=x):x=e[33];let A;e[34]!==q||e[35]!==t||e[36]!==s.id||e[37]!==s.status||e[38]!==a?(A=s.status==="failed"&&i(ne,{disabled:t,onClick:()=>{q(s.id)},size:"xs",variant:"outline",children:a("Retry")}),e[34]=q,e[35]=t,e[36]=s.id,e[37]=s.status,e[38]=a,e[39]=A):A=e[39];let g;e[40]!==A?(g=i(O,{children:A}),e[40]=A,e[41]=g):g=e[41];let I;return e[42]!==d||e[43]!==D||e[44]!==P||e[45]!==v||e[46]!==y||e[47]!==x||e[48]!==g||e[49]!==S||e[50]!==u||e[51]!==E||e[52]!==n||e[53]!==b?(I=z(d,{className:D,"data-overdue":S,"data-testid":"privacy-request-row",children:[u,E,n,b,P,v,y,x,g]}),e[42]=d,e[43]=D,e[44]=P,e[45]=v,e[46]=y,e[47]=x,e[48]=g,e[49]=S,e[50]=u,e[51]=E,e[52]=n,e[53]=b,e[54]=I):I=e[54],I},Te=r=>{const e=W(95),{source:o}=r,t=X(),s=se(),q=le();let a;e[0]!==q?(a=[...he,q],e[0]=q,e[1]=a):a=e[1];const d=a;let c;e[2]!==o?(c=async()=>({asOf:Date.now(),requests:await o.listOpenPrivacyRequests()}),e[2]=o,e[3]=c):c=e[3];let D;e[4]!==d||e[5]!==c?(D={queryKey:d,refetchInterval:6e4,queryFn:c,staleTime:0},e[4]=d,e[5]=c,e[6]=D):D=e[6];const S=ie(D);let u;e[7]!==o?(u=l=>o.retryPrivacyRequest(l),e[7]=o,e[8]=u):u=e[8];let f;e[9]!==s||e[10]!==d?(f=async()=>{await s.invalidateQueries({queryKey:d})},e[9]=s,e[10]=d,e[11]=f):f=e[11];let E;e[12]!==u||e[13]!==f?(E={mutationFn:u,onSuccess:f},e[12]=u,e[13]=f,e[14]=E):E=e[14];const n=re(E);let N;e[15]!==n?(N=l=>{n.mutate(l)},e[15]=n,e[16]=N):N=e[16];const b=N;if(S.isPending){let l;e[17]!==t?(l=t("Loading privacy requests…"),e[17]=t,e[18]=l):l=e[18];let T;return e[19]!==l?(T=i("p",{className:"text-sm text-muted-foreground","data-testid":"privacy-requests-loading",role:"status",children:l}),e[19]=l,e[20]=T):T=e[20],T}if(S.isError){let l;return e[21]!==S.error?(l=i(Z,{error:S.error,testId:"privacy-requests-error"}),e[21]=S.error,e[22]=l):l=e[22],l}const{asOf:R,requests:P}=S.data;if(P.length===0){let l;e[23]!==t?(l=t("No open privacy requests."),e[23]=t,e[24]=l):l=e[24];let T;return e[25]!==l?(T=i(ee,{testId:"privacy-requests-empty",title:l}),e[25]=l,e[26]=T):T=e[26],T}let m;e[27]!==n.error||e[28]!==n.isError?(m=n.isError&&i(Z,{error:n.error,testId:"privacy-retry-error"}),e[27]=n.error,e[28]=n.isError,e[29]=m):m=e[29];let v;e[30]!==t?(v=t("ID"),e[30]=t,e[31]=v):v=e[31];let p;e[32]!==v?(p=i(w,{children:v}),e[32]=v,e[33]=p):p=e[33];let y;e[34]!==t?(y=t("Type"),e[34]=t,e[35]=y):y=e[35];let h;e[36]!==y?(h=i(w,{children:y}),e[36]=y,e[37]=h):h=e[37];let x;e[38]!==t?(x=t("Subject"),e[38]=t,e[39]=x):x=e[39];let A;e[40]!==x?(A=i(w,{children:x}),e[40]=x,e[41]=A):A=e[41];let g;e[42]!==t?(g=t("Status"),e[42]=t,e[43]=g):g=e[43];let I;e[44]!==g?(I=i(w,{children:g}),e[44]=g,e[45]=I):I=e[45];let j;e[46]!==t?(j=t("Received"),e[46]=t,e[47]=j):j=e[47];let B;e[48]!==j?(B=i(w,{children:j}),e[48]=j,e[49]=B):B=e[49];let C;e[50]!==t?(C=t("Due"),e[50]=t,e[51]=C):C=e[51];let Q;e[52]!==C?(Q=i(w,{children:C}),e[52]=C,e[53]=Q):Q=e[53];let U;e[54]!==t?(U=t("Extended due"),e[54]=t,e[55]=U):U=e[55];let V;e[56]!==U?(V=i(w,{children:U}),e[56]=U,e[57]=V):V=e[57];let _;e[58]!==t?(_=t("Overdue"),e[58]=t,e[59]=_):_=e[59];let $;e[60]!==_?($=i(w,{children:_}),e[60]=_,e[61]=$):$=e[61];let F;e[62]!==t?(F=t("Actions"),e[62]=t,e[63]=F):F=e[63];let H;e[64]!==F?(H=i(w,{children:F}),e[64]=F,e[65]=H):H=e[65];let K;e[66]!==p||e[67]!==h||e[68]!==A||e[69]!==I||e[70]!==B||e[71]!==Q||e[72]!==V||e[73]!==$||e[74]!==H?(K=i(ae,{children:z(te,{children:[p,h,A,I,B,Q,V,$,H]})}),e[66]=p,e[67]=h,e[68]=A,e[69]=I,e[70]=B,e[71]=Q,e[72]=V,e[73]=$,e[74]=H,e[75]=K):K=e[75];let L;if(e[76]!==R||e[77]!==b||e[78]!==P||e[79]!==n.isPending||e[80]!==n.variables){let l;e[82]!==R||e[83]!==b||e[84]!==n.isPending||e[85]!==n.variables?(l=T=>i(ge,{asOf:R,onRetry:b,retrying:n.isPending&&n.variables===T.id,row:T},T.id),e[82]=R,e[83]=b,e[84]=n.isPending,e[85]=n.variables,e[86]=l):l=e[86],L=P.map(l),e[76]=R,e[77]=b,e[78]=P,e[79]=n.isPending,e[80]=n.variables,e[81]=L}else L=e[81];let M;e[87]!==L?(M=i(de,{children:L}),e[87]=L,e[88]=M):M=e[88];let Y;e[89]!==K||e[90]!==M?(Y=z(ce,{children:[K,M]}),e[89]=K,e[90]=M,e[91]=Y):Y=e[91];let k;return e[92]!==Y||e[93]!==m?(k=z("div",{className:"flex flex-col gap-3",children:[m,Y]}),e[92]=Y,e[93]=m,e[94]=k):k=e[94],k},Be=r=>{const e=W(11);let o;e[0]!==r?(o=r===void 0?{}:r,e[0]=r,e[1]=o):o=e[1];const{source:t}=o,s=X();if(t===void 0){let a;e[2]!==s?(a=s("Pass privacyRequests to the Studio to list and retry data-subject requests."),e[2]=s,e[3]=a):a=e[3];let d;e[4]!==s?(d=s("Privacy requests not configured"),e[4]=s,e[5]=d):d=e[5];let c;return e[6]!==a||e[7]!==d?(c=i(ee,{description:a,testId:"privacy-requests-not-configured",title:d}),e[6]=a,e[7]=d,e[8]=c):c=e[8],c}let q;return e[9]!==t?(q=i(Te,{source:t}),e[9]=t,e[10]=q):q=e[10],q};export{Be as PrivacyRequestsPanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as B}from"react/compiler-runtime";import{useState as L,Fragment as Ze}from"react";import{ConfirmButton as et}from"../packem_shared/ConfirmButton-CIXYF6Mg.mjs";import{E as tt}from"../packem_shared/error-alert-DKXm5h19.mjs";import{A as st}from"../packem_shared/alert-PB5W11MM.mjs";import{B as Ae}from"../packem_shared/badge-r_5B4LHP.mjs";import{B as Le}from"../packem_shared/button-q0UYSmrn.mjs";import{C as We,a as Je}from"../packem_shared/card-By2O8ULa.mjs";import{E as Re}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as rt}from"../packem_shared/input-CXhxesPC.mjs";import{S as at}from"../packem_shared/scroll-area-CXCQH7VT.mjs";import{T as Pe,a as je,b as z,c as w,d as Ge,e as v}from"../packem_shared/table-D0SBiDu-.mjs";import{T as nt}from"../packem_shared/textarea--40GKAyz.mjs";import{u as Fe}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useAutoRefresh as ot}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as lt}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as H}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{c as De,b as ue,d as Ie,f as Qe,h as it,k as dt}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsx as s,jsxs as b,Fragment as ze}from"react/jsx-runtime";const ct=(a,e)=>{const t=new Set(a.map(n=>n.deadLetterQueue).filter(n=>typeof n=="string"&&n!=="")),i=a.filter(n=>(n.deadLetterQueue===void 0||n.deadLetterQueue==="")&&!t.has(n.name)),r=e.filter(n=>n.deadLettered).length;return{deadLetteredCount:r,queuesWithoutDlq:i,showReliabilityWarning:i.length>0||r>0}},Me="topic:",Be=a=>{const e=[],t=new Map;for(const i of a)i.topic===void 0?e.push(i):t.set(i.topic,[...t.get(i.topic)??[],i]);return{plain:e,topics:t}},He=a=>`${Me}${a}`,ut=(a,e)=>a.startsWith(Me)?(e.get(a.slice(Me.length))??[]).map(t=>t.exportName):[a],mt=200,pt=De(H.sendQueueMessage),ft=async(a,e,t)=>{const r=(await Promise.allSettled(e.map(async o=>a.query(pt,o,Ie(""))))).flatMap((o,l)=>o.status==="rejected"?[{exportName:e[l]?.exportName??"",message:ue(o.reason)}]:[]),[n]=r;return n===void 0?null:e.length===1?n.message:t("Not sent to {failed}",{failed:r.map(o=>`${o.exportName}: ${o.message}`).join("; ")})},ht=De(H.replayQueueMessage),gt=De(H.clearQueueMessages),Ue=96,xt=a=>{if(a===void 0)return"—";try{return JSON.stringify(a,dt)}catch{return"[unserializable]"}},yt=a=>a.length>Ue?`${a.slice(0,Ue)}…`:a,bt=a=>a==="error"?"destructive":a==="retry"?"outline":"secondary",Nt=(a,e)=>e(a==="messages"?"Messages":a==="send"?"Send":"Declared"),Ve=a=>{const e=B(17),{queue:t}=a,i=`queues-row-${t.exportName}`;let r;e[0]!==t.exportName?(r=s(v,{className:"font-mono text-xs",children:t.exportName}),e[0]=t.exportName,e[1]=r):r=e[1];let n;e[2]!==t.name?(n=s(v,{className:"font-mono text-xs text-muted-foreground",children:t.name}),e[2]=t.name,e[3]=n):n=e[3];let o;e[4]!==t.mode?(o=s(v,{className:"font-mono text-xs text-muted-foreground",children:t.mode}),e[4]=t.mode,e[5]=o):o=e[5];let l;e[6]!==t.binding?(l=s(v,{className:"font-mono text-xs text-muted-foreground",children:t.binding}),e[6]=t.binding,e[7]=l):l=e[7];const d=t.deadLetterQueue??"—";let c;e[8]!==d?(c=s(v,{className:"font-mono text-xs text-muted-foreground",children:d}),e[8]=d,e[9]=c):c=e[9];let m;return e[10]!==i||e[11]!==r||e[12]!==n||e[13]!==o||e[14]!==l||e[15]!==c?(m=b(z,{"data-testid":i,children:[r,n,o,l,c]}),e[10]=i,e[11]=r,e[12]=n,e[13]=o,e[14]=l,e[15]=c,e[16]=m):m=e[16],m},qt=a=>{const e=B(8),{loaded:t,queues:i}=a,r=G();let n;if(e[0]!==t||e[1]!==i||e[2]!==r){const{plain:o,topics:l}=Be(i);let d;e[4]!==r?(d=r("Queues are declared in code with defineQueue. Enqueue from a mutation or action with ctx.queues.<name>.send(...); push consumers process batches in the worker."),e[4]=r,e[5]=d):d=e[5];let c;e[6]!==d?(c=s("p",{className:"text-sm text-muted-foreground",children:d}),e[6]=d,e[7]=c):c=e[7],n=b("div",{className:"flex flex-col gap-4","data-testid":"queues-declared",children:[c,t&&i.length===0?s(Re,{description:r("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),testId:"queues-empty",title:r("No queues defined")}):s(We,{className:"overflow-hidden py-0",children:s(Je,{className:"px-0",children:b(Pe,{"data-testid":"queues-table",children:[s(je,{children:b(z,{children:[s(w,{children:r("Export")}),s(w,{children:r("Queue")}),s(w,{children:r("Mode")}),s(w,{children:r("Binding")}),s(w,{children:r("Dead-letter")})]})}),b(Ge,{children:[o.map(vt),[...l].map(m=>{const[h,g]=m;return b(Ze,{children:[s(z,{className:"bg-muted/40","data-testid":`queues-topic-${h}`,children:s(v,{className:"text-xs font-medium",colSpan:5,children:r("Topic {topic} · {count} subscriptions",{count:g.length,topic:h})})}),g.map(wt)]},h)})]})]})})})]}),e[0]=t,e[1]=i,e[2]=r,e[3]=n}else n=e[3];return n},St=a=>{const e=B(67),{message:t,onReplay:i,replayingId:r}=a,n=G();let o,l,d,c,m,h,g,u,p,y;if(e[0]!==t.attempts||e[1]!==t.body||e[2]!==t.deadLettered||e[3]!==t.exportName||e[4]!==t.id||e[5]!==t.messageId||e[6]!==t.outcome||e[7]!==t.queue||e[8]!==n){const $=xt(t.body);l=z,h=`queues-message-${t.id}`;const O=t.exportName??t.queue;e[19]!==O?(g=s(v,{className:"font-mono text-xs",children:O}),e[19]=O,e[20]=g):g=e[20],e[21]!==t.messageId?(u=s(v,{className:"max-w-[16ch] truncate font-mono text-xs text-muted-foreground",title:t.messageId,children:t.messageId}),e[21]=t.messageId,e[22]=u):u=e[22],e[23]!==t.attempts?(p=s(v,{className:"font-mono text-xs tabular-nums",children:t.attempts}),e[23]=t.attempts,e[24]=p):p=e[24];const R=`queues-outcome-${t.id}`;let C;e[25]!==t.outcome?(C=bt(t.outcome),e[25]=t.outcome,e[26]=C):C=e[26];let I;e[27]!==t.outcome||e[28]!==R||e[29]!==C?(I=s(Ae,{"data-testid":R,variant:C,children:t.outcome}),e[27]=t.outcome,e[28]=R,e[29]=C,e[30]=I):I=e[30];let _;e[31]!==t.deadLettered||e[32]!==t.id||e[33]!==n?(_=t.deadLettered&&s(Ae,{"data-testid":`queues-dlq-${t.id}`,variant:"destructive",children:n("DLQ")}),e[31]=t.deadLettered,e[32]=t.id,e[33]=n,e[34]=_):_=e[34],e[35]!==I||e[36]!==_?(y=s(v,{children:b("span",{className:"inline-flex items-center gap-1",children:[I,_]})}),e[35]=I,e[36]=_,e[37]=y):y=e[37],o=v,d="max-w-[32ch] truncate font-mono text-xs text-muted-foreground",c=$,m=yt($),e[0]=t.attempts,e[1]=t.body,e[2]=t.deadLettered,e[3]=t.exportName,e[4]=t.id,e[5]=t.messageId,e[6]=t.outcome,e[7]=t.queue,e[8]=n,e[9]=o,e[10]=l,e[11]=d,e[12]=c,e[13]=m,e[14]=h,e[15]=g,e[16]=u,e[17]=p,e[18]=y}else o=e[9],l=e[10],d=e[11],c=e[12],m=e[13],h=e[14],g=e[15],u=e[16],p=e[17],y=e[18];let x;e[38]!==o||e[39]!==d||e[40]!==c||e[41]!==m?(x=s(o,{className:d,title:c,children:m}),e[38]=o,e[39]=d,e[40]=c,e[41]=m,e[42]=x):x=e[42];let N;e[43]!==t.capturedAt?(N=it(t.capturedAt,"—"),e[43]=t.capturedAt,e[44]=N):N=e[44];let T;e[45]!==N?(T=s(v,{className:"text-xs text-muted-foreground tabular-nums",children:N}),e[45]=N,e[46]=T):T=e[46];const q=`queues-replay-${t.id}`,S=r!==null;let Q;e[47]!==t.id||e[48]!==r||e[49]!==n?(Q=r===t.id?n("Replaying…"):n("Replay"),e[47]=t.id,e[48]=r,e[49]=n,e[50]=Q):Q=e[50];let A;e[51]!==t.id||e[52]!==i||e[53]!==q||e[54]!==S||e[55]!==Q?(A=s(v,{children:s(Le,{"data-id":t.id,"data-testid":q,disabled:S,onClick:i,size:"xs",type:"button",variant:"outline",children:Q})}),e[51]=t.id,e[52]=i,e[53]=q,e[54]=S,e[55]=Q,e[56]=A):A=e[56];let M;return e[57]!==l||e[58]!==T||e[59]!==A||e[60]!==h||e[61]!==g||e[62]!==u||e[63]!==p||e[64]!==y||e[65]!==x?(M=b(l,{"data-testid":h,children:[g,u,p,y,x,T,A]}),e[57]=l,e[58]=T,e[59]=A,e[60]=h,e[61]=g,e[62]=u,e[63]=p,e[64]=y,e[65]=x,e[66]=M):M=e[66],M},Et=a=>{const e=B(29),{hasError:t,messages:i,onClear:r,onReplay:n,replayingId:o}=a,l=G();let d;e[0]!==l?(d=l("Cloudflare Queues have no peek API, so this is what push consumers actually processed — not pending depth."),e[0]=l,e[1]=d):d=e[1];let c;e[2]!==d?(c=s("p",{className:"text-sm text-muted-foreground",children:d}),e[2]=d,e[3]=c):c=e[3];let m;e[4]!==l?(m=l("Clear the whole message log?"),e[4]=l,e[5]=m):m=e[5];const h=i.length===0;let g;e[6]!==l?(g=l("Clear log"),e[6]=l,e[7]=g):g=e[7];let u;e[8]!==r||e[9]!==m||e[10]!==h||e[11]!==g?(u=s("div",{className:"ml-auto",children:s(et,{confirmLabel:m,disabled:h,onConfirm:r,testId:"queues-clear",children:g})}),e[8]=r,e[9]=m,e[10]=h,e[11]=g,e[12]=u):u=e[12];let p;e[13]!==i.length||e[14]!==l?(p=i.length>0&&s(Ae,{"data-testid":"queues-count",variant:"secondary",children:l("{count} messages",{count:i.length})}),e[13]=i.length,e[14]=l,e[15]=p):p=e[15];let y;e[16]!==c||e[17]!==u||e[18]!==p?(y=b("div",{className:"flex flex-wrap items-center gap-2",children:[c,u,p]}),e[16]=c,e[17]=u,e[18]=p,e[19]=y):y=e[19];let x;e[20]!==t||e[21]!==i||e[22]!==n||e[23]!==o||e[24]!==l?(x=!t&&i.length===0?s(Re,{description:l("Consumed messages appear here once a push consumer processes a batch in dev. Send one from the Send tab to see it captured."),testId:"queues-messages-empty",title:l("No consumed messages yet.")}):s(We,{className:"overflow-hidden py-0",children:s(Je,{className:"px-0",children:s(at,{className:"max-h-[32rem]","data-testid":"queues-messages-scroll",children:b(Pe,{"data-testid":"queues-messages-table",children:[s(je,{children:b(z,{children:[s(w,{children:l("Export")}),s(w,{children:l("Message")}),s(w,{children:l("Attempts")}),s(w,{children:l("Outcome")}),s(w,{children:l("Body")}),s(w,{children:l("Captured")}),s(w,{})]})}),s(Ge,{children:i.map(T=>s(St,{message:T,onReplay:n,replayingId:o},T.id))})]})})})}),e[20]=t,e[21]=i,e[22]=n,e[23]=o,e[24]=l,e[25]=x):x=e[25];let N;return e[26]!==y||e[27]!==x?(N=b("div",{className:"flex flex-col gap-4","data-testid":"queues-messages",children:[y,x]}),e[26]=y,e[27]=x,e[28]=N):N=e[28],N},Tt=a=>{const e=B(20),{batchMode:t,bodyText:i,delayText:r,onBatchModeChange:n,onBodyChange:o,onDelayChange:l,onSelectExport:d,onSend:c,queues:m,selectedExportName:h,sending:g}=a,u=G();let p;e[0]!==u?(p=u("Enqueue a JSON message to a declared producer to exercise its consumer. Nothing is captured until the consumer processes it."),e[0]=u,e[1]=p):p=e[1];let y;e[2]!==p?(y=s("p",{className:"text-sm text-muted-foreground",children:p}),e[2]=p,e[3]=y):y=e[3];let x;e[4]!==t||e[5]!==i||e[6]!==r||e[7]!==n||e[8]!==o||e[9]!==l||e[10]!==d||e[11]!==c||e[12]!==m||e[13]!==h||e[14]!==g||e[15]!==u?(x=m.length===0?s(Re,{description:u("Declare a queue with defineQueue in lunora/queues.ts to enqueue a test message."),testId:"queues-send-empty",title:u("No queues to send to")}):b(ze,{children:[b("div",{className:"flex flex-wrap items-center gap-2",children:[b("select",{"aria-label":u("Queue"),className:"h-8 rounded-md border border-input bg-transparent px-2.5 py-1 text-xs outline-none focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring/50","data-testid":"queues-send-select",onChange:d,value:h,children:[m.map(Qt),[...Be(m).topics].map(T=>{const[q,S]=T;return s("option",{value:He(q),children:u("{topic} (topic → {count} subscriptions)",{count:S.length,topic:q})},q)})]}),s(rt,{"aria-label":u("Delay (seconds)"),className:"max-w-36","data-testid":"queues-send-delay",min:0,onChange:l,placeholder:u("Delay (s)"),type:"number",value:r}),b("label",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",htmlFor:"queues-send-batch",children:[s("input",{checked:t,"data-testid":"queues-send-batch",id:"queues-send-batch",onChange:n,type:"checkbox"}),u("Send as batch (JSON array)")]}),s(Le,{className:"ml-auto","data-testid":"queues-send-button",disabled:g||h==="",onClick:c,type:"button",children:u(g?"Sending…":"Send message")})]}),s(nt,{"aria-label":u("Message body (JSON)"),className:"font-mono","data-testid":"queues-send-body",onChange:o,placeholder:t?'[ { "hello": "world" } ]':'{ "hello": "world" }',value:i})]}),e[4]=t,e[5]=i,e[6]=r,e[7]=n,e[8]=o,e[9]=l,e[10]=d,e[11]=c,e[12]=m,e[13]=h,e[14]=g,e[15]=u,e[16]=x):x=e[16];let N;return e[17]!==y||e[18]!==x?(N=b("div",{className:"flex flex-col gap-3","data-testid":"queues-send",children:[y,x]}),e[17]=y,e[18]=x,e[19]=N):N=e[19],N},Ct=(a,e,t,i)=>{let r=null;const n=a.trim();if(n!=="")try{r=JSON.parse(n)}catch{return{error:i("Body must be valid JSON.")}}let o;const l=e.trim();if(l!==""){const d=Number(l);if(!Number.isFinite(d)||d<0)return{error:i("Delay must be a non-negative number of seconds.")};o=d}return t&&!Array.isArray(r)?{error:i("Batch mode needs a JSON array body — each element is enqueued as one message.")}:{body:r,delaySeconds:o}},_t=a=>{const e=B(11),{deadLetteredCount:t,queuesWithoutDlq:i}=a,r=G();let n;e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s("span",{"aria-hidden":"true",className:"text-base leading-none",children:"⚠"}),e[0]=n):n=e[0];let o;e[1]!==i||e[2]!==r?(o=i.length>0&&b(ze,{children:[s("p",{className:"font-medium",children:r("No dead-letter queue on {queues}.",{queues:i.map(At).join(", ")})}),s("p",{className:"text-muted-foreground",children:r("Exhausted messages are dropped after retries. Add a deadLetterQueue to capture them.")})]}),e[1]=i,e[2]=r,e[3]=o):o=e[3];let l;e[4]!==t||e[5]!==i.length||e[6]!==r?(l=t>0&&s("p",{className:i.length>0?"text-muted-foreground":"font-medium",children:t===1?r("1 message was recently dead-lettered."):r("{count} messages were recently dead-lettered.",{count:t})}),e[4]=t,e[5]=i.length,e[6]=r,e[7]=l):l=e[7];let d;return e[8]!==o||e[9]!==l?(d=s(st,{icon:n,testId:"queues-dlq-warning",variant:"warning",children:b("div",{className:"flex flex-col gap-1",children:[o,l]})}),e[8]=o,e[9]=l,e[10]=d):d=e[10],d},ts=a=>{const e=B(76),{limit:t}=a,i=t??mt,r=lt(),n=G(),[o,l]=L("declared"),[d,c]=L(null);let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m={},e[0]=m):m=e[0];const{data:h,error:g,errorSource:u}=Fe(H.listQueues,m);let p;e[1]!==i?(p={limit:i},e[1]=i,e[2]=p):p=e[2];const{data:y,error:x,errorSource:N,poll:T,refetch:q}=Fe(H.getQueueMessages,p),S=Array.isArray(h?.queues)?[...h.queues].toSorted(It):[],Q=y?.entries??[],{deadLetteredCount:A,queuesWithoutDlq:M,showReliabilityWarning:$}=ct(S,Q),[O,R]=L(""),[C,I]=L(""),[_,me]=L(""),[D,pe]=L(!1),[fe,V]=L(!1),[he,X]=L(null),{topics:Y}=Be(S),$e=[...S.map(Mt),...[...Y.keys()].map(Lt)],k=$e.includes(O)?O:$e[0]??"",Oe=o==="messages"?x:g,Xe=o==="messages"?N:u,ge=Oe??d,xe=Oe===null?d:Xe;ot(T,o==="messages");let K;e[3]!==D||e[4]!==C||e[5]!==r||e[6]!==_||e[7]!==q||e[8]!==k||e[9]!==V||e[10]!==n||e[11]!==Y?(K=async()=>{c(null);const f=k;if(f==="")return;const E=Ct(C,_,D,n);if("error"in E){c(E.error);return}const{body:we,delaySeconds:ke}=E;V(!0);const Ke=ut(f,Y).map(ce=>D?{batch:we,delaySeconds:ke,exportName:ce}:{body:we,delaySeconds:ke,exportName:ce});try{c(await ft(r,Ke,n)),q()}catch(ce){c(ue(ce))}V(!1)},e[3]=D,e[4]=C,e[5]=r,e[6]=_,e[7]=q,e[8]=k,e[9]=V,e[10]=n,e[11]=Y,e[12]=K):K=e[12];const ye=K;let Z;e[13]!==r||e[14]!==q||e[15]!==X?(Z=async f=>{c(null),X(f);try{await r.query(ht,{id:f},Ie("")),q()}catch(E){c(ue(E))}X(null)},e[13]=r,e[14]=q,e[15]=X,e[16]=Z):Z=e[16];const be=Z;let ee;e[17]!==r||e[18]!==q?(ee=async()=>{c(null);try{await r.query(gt,{},Ie("")),q()}catch(f){c(ue(f))}},e[17]=r,e[18]=q,e[19]=ee):ee=e[19];const Ne=ee;let te;e[20]===Symbol.for("react.memo_cache_sentinel")?(te=f=>{const E=f.currentTarget.dataset.tab;(E==="declared"||E==="messages"||E==="send")&&l(E)},e[20]=te):te=e[20];const Ye=te;let se;e[21]!==R?(se=f=>{R(f.currentTarget.value)},e[21]=R,e[22]=se):se=e[22];const qe=se;let re;e[23]!==I?(re=f=>{I(f.currentTarget.value)},e[23]=I,e[24]=re):re=e[24];const Se=re;let ae;e[25]!==me?(ae=f=>{me(f.currentTarget.value)},e[25]=me,e[26]=ae):ae=e[26];const Ee=ae;let ne;e[27]!==pe?(ne=f=>{pe(f.currentTarget.checked)},e[27]=pe,e[28]=ne):ne=e[28];const Te=ne;let oe;e[29]!==ye?(oe=()=>{Qe(ye())},e[29]=ye,e[30]=oe):oe=e[30];const Ce=oe;let le;e[31]!==be?(le=f=>{const{id:E}=f.currentTarget.dataset;E!==void 0&&Qe(be(E))},e[31]=be,e[32]=le):le=e[32];const _e=le;let ie;e[33]!==Ne?(ie=()=>{Qe(Ne())},e[33]=Ne,e[34]=ie):ie=e[34];const ve=ie;let F;e[35]!==n||e[36]!==o?(F=s("div",{className:"flex items-center gap-1","data-testid":"queues-tabs",role:"tablist",children:["declared","messages","send"].map(f=>s(Le,{"aria-selected":o===f,"data-tab":f,"data-testid":`queues-tab-${f}`,onClick:Ye,role:"tab",size:"sm",type:"button",variant:o===f?"secondary":"ghost",children:Nt(f,n)},f))}),e[35]=n,e[36]=o,e[37]=F):F=e[37];let U;e[38]!==ge||e[39]!==xe?(U=ge!==null&&s(tt,{error:xe,testId:"queues-error"}),e[38]=ge,e[39]=xe,e[40]=U):U=e[40];let W;e[41]!==A||e[42]!==M||e[43]!==$?(W=$&&s(_t,{deadLetteredCount:A,queuesWithoutDlq:M}),e[41]=A,e[42]=M,e[43]=$,e[44]=W):W=e[44];let J;e[45]!==S||e[46]!==h||e[47]!==o?(J=o==="declared"&&s(qt,{loaded:h!==void 0,queues:S}),e[45]=S,e[46]=h,e[47]=o,e[48]=J):J=e[48];let P;e[49]!==Q||e[50]!==x||e[51]!==ve||e[52]!==_e||e[53]!==he||e[54]!==o?(P=o==="messages"&&s(Et,{hasError:x!==null,messages:Q,onClear:ve,onReplay:_e,replayingId:he}),e[49]=Q,e[50]=x,e[51]=ve,e[52]=_e,e[53]=he,e[54]=o,e[55]=P):P=e[55];let j;e[56]!==D||e[57]!==C||e[58]!==_||e[59]!==Te||e[60]!==Se||e[61]!==Ee||e[62]!==qe||e[63]!==Ce||e[64]!==S||e[65]!==k||e[66]!==fe||e[67]!==o?(j=o==="send"&&s(Tt,{batchMode:D,bodyText:C,delayText:_,onBatchModeChange:Te,onBodyChange:Se,onDelayChange:Ee,onSelectExport:qe,onSend:Ce,queues:S,selectedExportName:k,sending:fe}),e[56]=D,e[57]=C,e[58]=_,e[59]=Te,e[60]=Se,e[61]=Ee,e[62]=qe,e[63]=Ce,e[64]=S,e[65]=k,e[66]=fe,e[67]=o,e[68]=j):j=e[68];let de;return e[69]!==F||e[70]!==U||e[71]!==W||e[72]!==J||e[73]!==P||e[74]!==j?(de=b("div",{className:"flex flex-col gap-6","data-testid":"lunora-queues-panel",children:[F,U,W,J,P,j]}),e[69]=F,e[70]=U,e[71]=W,e[72]=J,e[73]=P,e[74]=j,e[75]=de):de=e[75],de};function vt(a){return s(Ve,{queue:a},a.exportName)}function wt(a){return s(Ve,{queue:a},a.exportName)}function Qt(a){return s("option",{value:a.exportName,children:a.exportName},a.exportName)}function At(a){return a.name}function It(a,e){return a.exportName.localeCompare(e.exportName)}function Mt(a){return a.exportName}function Lt(a){return He(a)}export{ts as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{E as g}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as N}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as v,a as b}from"../packem_shared/card-By2O8ULa.mjs";import{E as y}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T,a as w,b as m,c as s,d as A,e as n}from"../packem_shared/table-D0SBiDu-.mjs";import{u as E}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as S}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as C}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsx as e,jsxs as o}from"react/jsx-runtime";const R={active:"default",failing:"destructive",idle:"secondary"},I=a=>a===void 0?"—":`${new Date(a).toISOString().slice(0,19).replace("T"," ")} UTC`,$=a=>{const r=a.runs+a.suppressed;return r===0?void 0:Math.round(a.suppressed/r*100)},U=({initialShardKey:a=""})=>{const r=S(),{data:l,error:p,errorSource:u,liveError:f}=E(C.listReactors,{},{live:!0,shardKey:a}),x=l!==void 0,d=Array.isArray(l?.reactors)?l.reactors:[];let i;x&&d.length===0?i=e(y,{description:r("No reactor is declared in this deployment. Export an onQueryChange(select, handler) from lunora/ to run server-side logic when a query's result changes."),testId:"reactors-empty",title:r("No reactors declared")}):i=e(v,{className:"overflow-hidden py-0",children:e(b,{className:"px-0",children:o(T,{"data-testid":"reactors-table",children:[e(w,{children:o(m,{children:[e(s,{children:r("Reactor")}),e(s,{children:r("State")}),e(s,{children:r("Ran")}),e(s,{children:r("Suppressed")}),e(s,{children:r("Errors")}),e(s,{children:r("Watches")}),e(s,{children:r("Last dispatch")})]})}),e(A,{children:d.map(t=>{const h=$(t);return o(m,{"data-testid":`reactors-row-${t.path}`,children:[e(n,{className:"font-mono text-xs",children:t.path}),e(n,{children:e(N,{"data-testid":`reactors-state-${t.path}`,variant:R[t.state],children:t.state})}),e(n,{className:"font-mono text-xs",children:t.runs}),o(n,{className:"font-mono text-xs text-muted-foreground",children:[t.suppressed,h===void 0?"":` (${String(h)}%)`]}),e(n,{className:"font-mono text-xs",children:t.errors===0?e("span",{className:"text-muted-foreground",children:"0"}):e("span",{className:"text-destructive",children:t.errors})}),e(n,{className:"font-mono text-xs text-muted-foreground",children:t.tables===void 0||t.tables.length===0?"—":t.tables.join(", ")}),e(n,{className:"font-mono text-xs text-muted-foreground",children:I(t.lastRanAt)})]},t.path)})})]})})});const c=d.filter(t=>t.state==="failing");return o("div",{className:"flex flex-col gap-6","data-testid":"lunora-reactors-panel",children:[p!==null&&e(g,{error:u,shardKey:a,testId:"reactors-error"}),e("p",{className:"text-sm text-muted-foreground",children:r("A reactor runs after a write flush, but only when the result of the query it watches actually changed — a trigger fires on a row write, a reactor fires on a result changing. Suppressed dispatches are the ones where the read re-ran and nothing had moved.")}),c.length>0&&e("div",{className:"flex flex-col gap-2","data-testid":"reactors-failing",children:c.map(t=>o("p",{className:"text-xs text-destructive",role:"alert",children:[e("span",{className:"font-mono",children:t.path}),": ",t.lastError??r("last dispatch failed")]},t.path))}),f!==void 0&&e("p",{className:"text-xs text-amber-600 dark:text-amber-500","data-testid":"reactors-live-error",role:"alert",children:r("Live updates unavailable; showing the last reading.")}),i]})};export{U as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as W}from"react/compiler-runtime";import{u as G}from"../packem_shared/assistant-provider-Bp72uWsq.mjs";import{E as F}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as U}from"../packem_shared/badge-r_5B4LHP.mjs";import{a as B,C as M}from"../packem_shared/card-By2O8ULa.mjs";import{E as D}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as L,a as H,b as C,c as A,d as O,e as T}from"../packem_shared/table-D0SBiDu-.mjs";import{u as Q}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as X}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as q}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsx as s,jsxs as a}from"react/jsx-runtime";const _=["read","insert","update","delete"],P=30,z=(e,t)=>({delete:e("Delete"),insert:e("Insert"),read:e("Read"),update:e("Update")})[t],J=e=>{const t=new Map;for(const l of e){const r=t.get(l.table)??{operations:new Set,procedures:new Set,table:l.table};r.operations.add(l.on),r.procedures.add(l.procedure),t.set(l.table,r)}return[...t.values()].toSorted((l,r)=>l.table.localeCompare(r.table))},K=e=>{const t=e.slice(0,P).map(l=>`${l.table}: ${_.filter(r=>l.operations.has(r)).join("/")}`).join("; ");return e.length>P?`${t}; and ${String(e.length-P)} more tables`:t},ce=()=>{const e=W(45),t=X(),l=G(),r=l!==void 0&&!l.unavailable;let S;e[0]===Symbol.for("react.memo_cache_sentinel")?(S={},e[0]=S):S=e[0];const{data:i,error:E,errorSource:$}=Q(q.rlsPolicies,S),o=i!==void 0;let c;e[1]!==i?(c=Array.isArray(i?.policies)?i.policies:[],e[1]=i,e[2]=c):c=e[2];let v;e[3]!==c?(v=J(c),e[3]=c,e[4]=v):v=e[4];const n=v;let I;e[5]!==i?(I=Array.isArray(i?.roles)?i.roles:[],e[5]=i,e[6]=I):I=e[6];const R=I;let p;e[7]!==E||e[8]!==$?(p=E!==null&&s(F,{error:$,testId:"rls-error"}),e[7]=E,e[8]=$,e[9]=p):p=e[9];let m;e[10]!==t?(m=t("Policies"),e[10]=t,e[11]=m):m=e[11];let h;e[12]!==m?(h=s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:m}),e[12]=m,e[13]=h):h=e[13];let u;e[14]!==l||e[15]!==r||e[16]!==o||e[17]!==t||e[18]!==n?(u=o&&r&&s("button",{className:"ms-auto text-xs underline outline-none focus-visible:ring-1 focus-visible:ring-ring","data-testid":"rls-ask-assistant",onClick:()=>{l.openAssistant({ask:n.length===0?t("This app declares no row-level-security policies at all. Which tables most need one, and what policy should I write for them?"):t("The Lunora RLS inspector shows these declared policies — {coverage}. Which tables and operations are still unguarded, and what policy should I add?",{coverage:K(n)}),suggestions:[t("Which procedures still need .use(rls(...))?"),t("How do I test a policy?")],title:t("Access rules")})},type:"button",children:t("Ask the assistant")}),e[14]=l,e[15]=r,e[16]=o,e[17]=t,e[18]=n,e[19]=u):u=e[19];let f;e[20]!==h||e[21]!==u?(f=a("header",{className:"flex items-center gap-3 border-b border-border px-4 py-3",children:[h,u]}),e[20]=h,e[21]=u,e[22]=f):f=e[22];let b;e[23]!==o||e[24]!==t||e[25]!==n?(b=o&&n.length===0?s(D,{description:t("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),testId:"rls-policies-empty",title:t("No policies defined")}):s(B,{className:"px-0",children:a(L,{"data-testid":"rls-policies-table",children:[s(H,{children:a(C,{children:[s(A,{children:t("Table")}),_.map(d=>s(A,{children:z(t,d)},d)),s(A,{children:t("Guarded by")})]})}),s(O,{children:n.map(d=>a(C,{"data-testid":`rls-table-${d.table}`,children:[s(T,{className:"font-mono text-xs",children:d.table}),_.map(j=>s(T,{children:d.operations.has(j)?s(U,{variant:"secondary",children:t("Guarded")}):s("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"})},j)),s(T,{className:"font-mono text-xs text-muted-foreground",children:[...d.procedures].join(", ")})]},d.table))})]})}),e[23]=o,e[24]=t,e[25]=n,e[26]=b):b=e[26];let x;e[27]!==f||e[28]!==b?(x=s("section",{className:"flex flex-col gap-2",children:a(M,{className:"overflow-hidden py-0",children:[f,b]})}),e[27]=f,e[28]=b,e[29]=x):x=e[29];let g;e[30]!==t?(g=t("Roles"),e[30]=t,e[31]=g):g=e[31];let y;e[32]!==g?(y=s("header",{className:"border-b border-border px-4 py-3",children:s("span",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:g})}),e[32]=g,e[33]=y):y=e[33];let N;e[34]!==o||e[35]!==R||e[36]!==t?(N=o&&R.length===0?s(D,{description:t("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),testId:"rls-roles-empty",title:t("No roles defined")}):s(B,{className:"px-0",children:a(L,{"data-testid":"rls-roles-table",children:[s(H,{children:a(C,{children:[s(A,{children:t("Role")}),s(A,{children:t("Description")}),s(A,{children:t("Permissions")})]})}),s(O,{children:R.map(Y)})]})}),e[34]=o,e[35]=R,e[36]=t,e[37]=N):N=e[37];let w;e[38]!==y||e[39]!==N?(w=s("section",{className:"flex flex-col gap-2",children:a(M,{className:"overflow-hidden py-0",children:[y,N]})}),e[38]=y,e[39]=N,e[40]=w):w=e[40];let k;return e[41]!==x||e[42]!==w||e[43]!==p?(k=a("div",{className:"flex flex-col gap-6","data-testid":"lunora-rls-panel",children:[p,x,w]}),e[41]=x,e[42]=w,e[43]=p,e[44]=k):k=e[44],k};function V(e){return s(U,{variant:"outline",children:e},e)}function Y(e){return a(C,{"data-testid":`rls-role-${e.name}`,children:[s(T,{className:"font-mono text-xs",children:e.name}),s(T,{className:"text-muted-foreground",children:e.description??""}),s(T,{children:e.permissions.length===0?s("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):s("span",{className:"flex flex-wrap gap-1",children:e.permissions.map(V)})})]},e.name)}export{ce as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as z}from"react/compiler-runtime";import{useState as W}from"react";import{D as pe}from"../packem_shared/studio-Cm9ea8j7.mjs";import{B as ce}from"../packem_shared/button-q0UYSmrn.mjs";import{useT as G}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ConfirmButton as he}from"../packem_shared/ConfirmButton-CIXYF6Mg.mjs";import{B as Y}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as Z,a as j}from"../packem_shared/card-By2O8ULa.mjs";import{E as ne}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as se,c as R,a as le,b as U,d as re,e as D}from"../packem_shared/table-D0SBiDu-.mjs";import{a as ee}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useAutoRefresh as ie}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as oe}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{h as te,f as X,j as xe,b as ue}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsx as s,jsxs as C}from"react/jsx-runtime";import{I as ge}from"../packem_shared/input-CXhxesPC.mjs";import{u as ve}from"../packem_shared/use-assistant-rpc-GCUK2zPa.mjs";import{c as be}from"../packem_shared/utils-bhneXptQ.mjs";import{ScheduledJobs as Ne}from"../packem_shared/ScheduledJobs-QCTRdugp.mjs";const me={failed:"destructive",skipped:"warning",succeeded:"success"},ye=25,we=t=>t<1e3?`${String(t)} ms`:`${(t/1e3).toFixed(1)} s`,ke=t=>{const e=z(39),{inFlight:u,last:r}=t,a=G();if(u!==void 0){let c;e[0]!==a?(c=a("running"),e[0]=a,e[1]=c):c=e[1];let m;e[2]!==c?(m=s(Y,{variant:"info",children:c}),e[2]=c,e[3]=m):m=e[3];let b;e[4]!==u.startedAt?(b=te(u.startedAt,"—"),e[4]=u.startedAt,e[5]=b):b=e[5];let y;e[6]!==b?(y=s("span",{className:"text-xs text-muted-foreground tabular-nums",children:b}),e[6]=b,e[7]=y):y=e[7];let I;e[8]!==u.skipped||e[9]!==a?(I=u.skipped>0&&s("span",{className:"text-xs text-muted-foreground",children:a("{count} ticks skipped",{count:u.skipped})}),e[8]=u.skipped,e[9]=a,e[10]=I):I=e[10];let w;return e[11]!==m||e[12]!==y||e[13]!==I?(w=C("span",{className:"flex items-center gap-2",children:[m,y,I]}),e[11]=m,e[12]=y,e[13]=I,e[14]=w):w=e[14],w}if(r===void 0){let c;e[15]!==a?(c=a("never"),e[15]=a,e[16]=c):c=e[16];let m;return e[17]!==c?(m=s("span",{className:"text-xs text-muted-foreground",children:c}),e[17]=c,e[18]=m):m=e[18],m}let l;e[19]!==a?(l=a("failed"),e[19]=a,e[20]=l):l=e[20];let i;e[21]!==a?(i=a("skipped"),e[21]=a,e[22]=i):i=e[22];let n;e[23]!==a?(n=a("succeeded"),e[23]=a,e[24]=n):n=e[24];let N;e[25]!==l||e[26]!==i||e[27]!==n?(N={failed:l,skipped:i,succeeded:n},e[25]=l,e[26]=i,e[27]=n,e[28]=N):N=e[28];const v=N,d=me[r.status],f=v[r.status];let g;e[29]!==d||e[30]!==f?(g=s(Y,{variant:d,children:f}),e[29]=d,e[30]=f,e[31]=g):g=e[31];let x;e[32]!==r.startedAt?(x=te(r.startedAt,"—"),e[32]=r.startedAt,e[33]=x):x=e[33];let p;e[34]!==x?(p=s("span",{className:"text-xs text-muted-foreground tabular-nums",children:x}),e[34]=x,e[35]=p):p=e[35];let o;return e[36]!==g||e[37]!==p?(o=C("span",{className:"flex items-center gap-2",children:[g,p]}),e[36]=g,e[37]=p,e[38]=o):o=e[38],o},Ce=t=>{const e=z(80),{runs:u}=t,r=G();if(u.length===0)return;let a,l,i,n,N,v,d,f,g,x,p;if(e[0]!==u||e[1]!==r){const I=u.toSorted(Te).slice(0,ye);let w;e[13]!==r?(w=r("failed"),e[13]=r,e[14]=w):w=e[14];let A;e[15]!==r?(A=r("skipped"),e[15]=r,e[16]=A):A=e[16];let S;e[17]!==r?(S=r("succeeded"),e[17]=r,e[18]=S):S=e[18];let L;e[19]!==S||e[20]!==w||e[21]!==A?(L={failed:w,skipped:A,succeeded:S},e[19]=S,e[20]=w,e[21]=A,e[22]=L):L=e[22];const T=L;g="flex flex-col gap-2",x="cron-run-history";let k;e[23]!==r?(k=r("Recent runs"),e[23]=r,e[24]=k):k=e[24],e[25]!==k?(p=s("h3",{className:"text-sm font-medium",children:k}),e[25]=k,e[26]=p):p=e[26],n=Z,f="overflow-hidden py-0",i=j,d="px-0",l=se;let $;e[27]!==r?($=r("name"),e[27]=r,e[28]=$):$=e[28];let h;e[29]!==$?(h=s(R,{children:$}),e[29]=$,e[30]=h):h=e[30];let E;e[31]!==r?(E=r("status"),e[31]=r,e[32]=E):E=e[32];let F;e[33]!==E?(F=s(R,{children:E}),e[33]=E,e[34]=F):F=e[34];let J;e[35]!==r?(J=r("started"),e[35]=r,e[36]=J):J=e[36];let P;e[37]!==J?(P=s(R,{children:J}),e[37]=J,e[38]=P):P=e[38];let H;e[39]!==r?(H=r("duration"),e[39]=r,e[40]=H):H=e[40];let K;e[41]!==H?(K=s(R,{children:H}),e[41]=H,e[42]=K):K=e[42];let q;e[43]!==r?(q=r("skipped"),e[43]=r,e[44]=q):q=e[44];let V;e[45]!==q?(V=s(R,{children:q}),e[45]=q,e[46]=V):V=e[46];let Q;e[47]!==r?(Q=r("error"),e[47]=r,e[48]=Q):Q=e[48];let M;e[49]!==Q?(M=s(R,{children:Q}),e[49]=Q,e[50]=M):M=e[50],e[51]!==h||e[52]!==F||e[53]!==P||e[54]!==K||e[55]!==V||e[56]!==M?(v=s(le,{children:C(U,{children:[h,F,P,K,V,M]})}),e[51]=h,e[52]=F,e[53]=P,e[54]=K,e[55]=V,e[56]=M,e[57]=v):v=e[57],a=re;let B;e[58]!==T?(B=O=>C(U,{"data-testid":`cron-run-row-${O.runId}`,children:[s(D,{children:O.name}),s(D,{children:s(Y,{variant:me[O.status],children:T[O.status]})}),s(D,{className:"text-muted-foreground tabular-nums",children:te(O.startedAt,"—")}),s(D,{className:"tabular-nums",children:O.status==="skipped"?"":we(O.durationMs)}),s(D,{className:"tabular-nums",children:O.skipped>0?O.skipped:""}),s(D,{className:"text-xs text-destructive",children:O.error??""})]},O.runId),e[58]=T,e[59]=B):B=e[59],N=I.map(B),e[0]=u,e[1]=r,e[2]=a,e[3]=l,e[4]=i,e[5]=n,e[6]=N,e[7]=v,e[8]=d,e[9]=f,e[10]=g,e[11]=x,e[12]=p}else a=e[2],l=e[3],i=e[4],n=e[5],N=e[6],v=e[7],d=e[8],f=e[9],g=e[10],x=e[11],p=e[12];let o;e[60]!==a||e[61]!==N?(o=s(a,{children:N}),e[60]=a,e[61]=N,e[62]=o):o=e[62];let c;e[63]!==l||e[64]!==v||e[65]!==o?(c=C(l,{children:[v,o]}),e[63]=l,e[64]=v,e[65]=o,e[66]=c):c=e[66];let m;e[67]!==i||e[68]!==d||e[69]!==c?(m=s(i,{className:d,children:c}),e[67]=i,e[68]=d,e[69]=c,e[70]=m):m=e[70];let b;e[71]!==n||e[72]!==m||e[73]!==f?(b=s(n,{className:f,children:m}),e[71]=n,e[72]=m,e[73]=f,e[74]=b):b=e[74];let y;return e[75]!==b||e[76]!==g||e[77]!==x||e[78]!==p?(y=C("div",{className:g,"data-testid":x,children:[p,b]}),e[75]=b,e[76]=g,e[77]=x,e[78]=p,e[79]=y):y=e[79],y};function Te(t,e){return e.startedAt-t.startedAt}const Se=()=>{const t=z(50),e=G(),u=ve(""),[r,a]=W(""),[l,i]=W(void 0),[n,N]=W(!1);if(u.unavailable)return null;let v;t[0]!==u?(v=u.pending("cron"),t[0]=u,t[1]=v):v=t[1];const d=v;let f;t[2]!==u?(f=u.reason("cron"),t[2]=u,t[3]=f):f=t[3];const g=f;let x;t[4]!==r||t[5]!==u?(x=()=>{const J=r.trim();if(J==="")return;X((async()=>{const H=await u.suggestCron(J);N(!1),i(H)})())},t[4]=r,t[5]=u,t[6]=x):x=t[6];const p=x;let o;t[7]!==l?(o=()=>{const J="navigator"in globalThis?globalThis.navigator.clipboard:void 0;if(J===void 0||l===void 0)return;X((async()=>{try{await J.writeText(l),N(!0)}catch{N(!1)}})())},t[7]=l,t[8]=o):o=t[8];const c=o;let m;t[9]!==e?(m=e("Describe a schedule"),t[9]=e,t[10]=m):m=t[10];let b;t[11]===Symbol.for("react.memo_cache_sentinel")?(b=J=>{a(J.target.value)},t[11]=b):b=t[11];let y;t[12]!==p?(y=J=>{J.key==="Enter"&&(J.preventDefault(),p())},t[12]=p,t[13]=y):y=t[13];let I;t[14]!==e?(I=e("Describe a schedule"),t[14]=e,t[15]=I):I=t[15];let w;t[16]!==d||t[17]!==r||t[18]!==m||t[19]!==y||t[20]!==I?(w=s(ge,{"aria-label":m,className:"h-7 flex-1 text-xs","data-testid":"cron-assistant-prompt",disabled:d,onChange:b,onKeyDown:y,placeholder:I,value:r}),t[16]=d,t[17]=r,t[18]=m,t[19]=y,t[20]=I,t[21]=w):w=t[21];const A=d&&"opacity-60";let S;t[22]!==A?(S=be("rounded-md border border-border px-2 py-1 text-xs outline-none transition-colors hover:bg-accent focus-visible:bg-accent",A),t[22]=A,t[23]=S):S=t[23];let L;t[24]!==d||t[25]!==r?(L=d||r.trim()==="",t[24]=d,t[25]=r,t[26]=L):L=t[26];let T;t[27]!==d||t[28]!==e?(T=e(d?"Thinking…":"Suggest schedule"),t[27]=d,t[28]=e,t[29]=T):T=t[29];let k;t[30]!==p||t[31]!==S||t[32]!==L||t[33]!==T?(k=s("button",{className:S,"data-testid":"cron-assistant-generate",disabled:L,onClick:p,type:"button",children:T}),t[30]=p,t[31]=S,t[32]=L,t[33]=T,t[34]=k):k=t[34];let $;t[35]!==k||t[36]!==w?($=C("div",{className:"flex items-center gap-2",children:[w,k]}),t[35]=k,t[36]=w,t[37]=$):$=t[37];let h;t[38]!==n||t[39]!==c||t[40]!==l||t[41]!==e?(h=l!==void 0&&C("div",{className:"flex items-center gap-2",children:[s("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs tabular-nums","data-testid":"cron-assistant-result",children:l}),s("button",{className:"rounded-md border border-border px-2 py-0.5 text-[11px] outline-none transition-colors hover:bg-accent focus-visible:bg-accent","data-testid":"cron-assistant-copy",onClick:c,type:"button",children:e(n?"Copied":"Copy")}),s("span",{className:"text-[11px] text-muted-foreground",children:e("Add it to lunora/crons.ts — triggers are compiled into the worker.")})]}),t[38]=n,t[39]=c,t[40]=l,t[41]=e,t[42]=h):h=t[42];let E;t[43]!==g||t[44]!==e?(E=g!==void 0&&s("p",{className:"text-[11px] text-muted-foreground","data-testid":"cron-assistant-reason",role:"status",children:e(g==="ai-error"?"The model could not be reached.":"The model did not return a schedule Cron Triggers accept.")}),t[43]=g,t[44]=e,t[45]=E):E=t[45];let F;return t[46]!==$||t[47]!==h||t[48]!==E?(F=C("div",{className:"flex flex-col gap-1.5","data-testid":"cron-assistant",children:[$,h,E]}),t[46]=$,t[47]=h,t[48]=E,t[49]=F):F=t[49],F},$e={kind:"idle"},Ie="SCHEDULER_NOT_CONFIGURED",ae={inFlight:[],runs:[]},Ae=(t,e,u)=>u!==void 0?u:e===void 0?r=>t.runCronJob(r):void 0,Le=({loadCronJobs:t,loadCronRuns:e,runCronJob:u}={})=>{const r=oe(),a=G(),[l,i]=W({}),n=ee(["lunora-cron-jobs",t?"custom":"default"],()=>(t??(()=>r.getCronJobs()))()),{data:N,error:v}=n,d=e??(t===void 0?()=>r.listCronRuns():void 0),f=ee(["lunora-cron-runs",e?"custom":"default"],async()=>d===void 0?ae:d().catch(o=>{if(xe(o)===Ie)return ae;throw o})),g=f.data??ae;ie(()=>f.poll(),d!==void 0);const x=Ae(r,t,u),p=async o=>{if(x!==void 0){i(c=>({...c,[o]:{kind:"running"}}));try{await x(o),i(c=>({...c,[o]:{kind:"ok"}})),n.refetch(),f.refetch()}catch(c){i(m=>({...m,[o]:{kind:"error",message:ue(c)}}))}}};return C("div",{className:"flex flex-col gap-3","data-testid":"lunora-cron-triggers",children:[s(Se,{}),v!==null&&s("p",{className:"text-sm text-destructive","data-testid":"cron-error",role:"alert",children:v}),f.error!==null&&s("p",{className:"text-sm text-destructive","data-testid":"cron-runs-error",role:"alert",children:f.error}),N?.length===0&&s(ne,{description:a("Triggers declared with the cronJobs() builder appear here."),icon:C("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:[s("circle",{cx:"12",cy:"12",r:"9"}),s("path",{d:"M12 7.5V12l4 2"})]}),testId:"cron-empty",title:a("No cron triggers.")}),N!==void 0&&N.length>0&&s(Z,{className:"overflow-hidden py-0",children:s(j,{className:"px-0",children:C(se,{"data-testid":"cron-table",children:[s(le,{children:C(U,{children:[s(R,{children:a("name")}),s(R,{children:a("schedule")}),s(R,{children:a("target")}),s(R,{children:a("shard")}),s(R,{children:a("last run")}),x!==void 0&&s(R,{"aria-label":a("Actions")})]})}),s(re,{children:N.map(o=>{const c=l[o.name]??$e;return C(U,{"data-testid":`cron-row-${o.name}`,children:[s(D,{children:o.name}),s(D,{className:"font-mono text-xs tabular-nums",children:o.cron}),s(D,{children:C("span",{className:"flex items-center gap-2",children:[o.workflow===void 0?s(Y,{variant:"outline",children:a("function")}):s(Y,{variant:"secondary",children:a("workflow")}),s("span",{className:"font-mono text-xs",children:o.workflow??o.functionPath})]})}),s(D,{children:o.shardKey??""}),s(D,{"data-testid":`cron-last-run-${o.name}`,children:s(ke,{inFlight:g.inFlight.find(m=>m.name===o.name),last:g.runs.find(m=>m.name===o.name)})}),x!==void 0&&s(D,{className:"text-right",children:C("span",{className:"flex items-center justify-end gap-2",children:[c.kind==="ok"&&s("span",{className:"text-xs text-muted-foreground","data-testid":`cron-ran-${o.name}`,children:a("ran")}),c.kind==="error"&&s("span",{className:"text-xs text-destructive","data-testid":`cron-run-error-${o.name}`,role:"alert",children:c.message}),s(he,{confirmLabel:a("Run now?"),disabled:c.kind==="running",onConfirm:()=>{X(p(o.name))},testId:`cron-run-${o.name}`,children:c.kind==="running"?a("Running…"):a("Run now")})]})})]},`${o.cron}:${o.name}`)})})]})})}),s(Ce,{runs:g.runs})]})},Re=t=>Number.isFinite(t)?te(t,"—"):"—",De=t=>{const e=z(34);let u;e[0]!==t?(u=t===void 0?{}:t,e[0]=t,e[1]=u):u=e[1];const{loadJobs:r,removeJob:a,retryJob:l}=u,i=oe(),n=G();let N;e[2]===Symbol.for("react.memo_cache_sentinel")?(N=["lunora-dead-jobs"],e[2]=N):N=e[2];let v;e[3]!==i||e[4]!==r?(v=async()=>(await(r??(()=>i.listDeadJobs()))()).toSorted(Ee),e[3]=i,e[4]=r,e[5]=v):v=e[5];const d=ee(N,v),f=d.data,[g,x]=W(void 0),p=d.error??g,o=r===void 0;let c;e[6]!==i||e[7]!==o||e[8]!==l?(c=l??(o?h=>i.retryDeadJob(h):void 0),e[6]=i,e[7]=o,e[8]=l,e[9]=c):c=e[9];const m=c;let b;e[10]!==i||e[11]!==o||e[12]!==a?(b=a??(o?h=>i.removeDeadJob(h):void 0),e[10]=i,e[11]=o,e[12]=a,e[13]=b):b=e[13];const y=b;let I;e[14]!==d?(I=()=>d.poll(),e[14]=d,e[15]=I):I=e[15],ie(I,!0);let w;e[16]!==d?(w=async h=>{x(void 0);try{await h,d.refetch()}catch(E){x(ue(E))}},e[16]=d,e[17]=w):w=e[17];const A=w,S=m!==void 0||y!==void 0;let L;e[18]!==p?(L=p!==void 0&&s("p",{className:"text-sm text-destructive","data-testid":"dlq-error",role:"alert",children:p}),e[18]=p,e[19]=L):L=e[19];let T;e[20]!==f?.length||e[21]!==n?(T=f?.length===0&&s(ne,{description:n("Jobs that exhaust their retry budget are parked here instead of being dropped."),icon:s("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:s("path",{d:"M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14"})}),testId:"dlq-empty",title:n("No dead-letter jobs.")}),e[20]=f?.length,e[21]=n,e[22]=T):T=e[22];let k;e[23]!==A||e[24]!==S||e[25]!==f||e[26]!==y||e[27]!==m||e[28]!==n?(k=f!==void 0&&f.length>0&&s(Z,{className:"overflow-hidden py-0",children:s(j,{className:"px-0",children:C(se,{"data-testid":"dlq-table",children:[s(le,{children:C(U,{children:[s(R,{children:n("function")}),s(R,{children:n("attempts")}),s(R,{children:n("last tried")}),s(R,{children:n("pool")}),s(R,{children:n("shard")}),s(R,{children:n("id")}),S&&s(R,{"aria-label":n("Actions")})]})}),s(re,{children:f.map(h=>C(U,{"data-testid":`dlq-row-${h.id}`,children:[s(D,{className:"font-mono text-xs",children:h.workflow??h.functionPath}),s(D,{className:"tabular-nums",children:h.attempts??0}),s(D,{className:"text-muted-foreground tabular-nums",children:Re(h.scheduledFor)}),s(D,{className:"font-mono text-xs",children:h.pool??""}),s(D,{children:h.shardKey??""}),s(D,{className:"font-mono text-xs",children:h.id}),S&&s(D,{className:"text-right",children:C("div",{className:"flex justify-end gap-1.5",children:[m!==void 0&&s(ce,{"data-testid":`dlq-retry-${h.id}`,onClick:()=>{X(A(m(h.id)))},size:"sm",type:"button",variant:"outline",children:n("Retry")}),y!==void 0&&s(he,{confirmLabel:n("Drop job?"),onConfirm:()=>{X(A(y(h.id)))},testId:`dlq-remove-${h.id}`,children:n("Drop")})]})})]},h.id))})]})})}),e[23]=A,e[24]=S,e[25]=f,e[26]=y,e[27]=m,e[28]=n,e[29]=k):k=e[29];let $;return e[30]!==k||e[31]!==L||e[32]!==T?($=C("div",{className:"flex flex-col gap-3","data-testid":"lunora-dead-letter",children:[L,T,k]}),e[30]=k,e[31]=L,e[32]=T,e[33]=$):$=e[33],$};function Ee(t,e){return(e.attempts??0)-(t.attempts??0)}const _e={canceled:"secondary",failed:"destructive",pending:"outline",running:"info",succeeded:"success"},Je=t=>{const e=z(47);let u;e[0]!==t?(u=t===void 0?{}:t,e[0]=t,e[1]=u):u=e[1];const{loadJobs:r}=u,a=oe(),l=G();let i;e[2]!==a||e[3]!==r?(i=r??(async _=>a.listScheduledHistory(_===void 0?{}:{cursor:_})),e[2]=a,e[3]=r,e[4]=i):i=e[4];const n=i,N=r?"custom":"default";let v;e[5]!==N?(v=["lunora-job-history",N],e[5]=N,e[6]=v):v=e[6];let d;e[7]!==n?(d=async()=>n(),e[7]=n,e[8]=d):d=e[8];const f=ee(v,d),[g,x]=W(void 0),[p,o]=W(!1),[c,m]=W(void 0),b=f.data?.records;let y;e[9]!==b?(y=new Set(b?.map(Fe)),e[9]=b,e[10]=y):y=e[10];const I=y,w=b===void 0?void 0:[...b,...(g?.records??[]).filter(_=>!I.has(_.id))],A=g===void 0?f.data?.cursor:g.cursor;let S;e[11]!==n||e[12]!==A?(S=async()=>{o(!0),m(void 0);try{const _=await n(A);x(fe=>({cursor:_.cursor,records:[...fe?.records??[],..._.records]})),o(!1)}catch(_){m(ue(_)),o(!1)}},e[11]=n,e[12]=A,e[13]=S):S=e[13];const L=S;let T;e[14]!==l?(T=l("canceled"),e[14]=l,e[15]=T):T=e[15];let k;e[16]!==l?(k=l("failed"),e[16]=l,e[17]=k):k=e[17];let $;e[18]!==l?($=l("pending"),e[18]=l,e[19]=$):$=e[19];let h;e[20]!==l?(h=l("running"),e[20]=l,e[21]=h):h=e[21];let E;e[22]!==l?(E=l("succeeded"),e[22]=l,e[23]=E):E=e[23];let F;e[24]!==$||e[25]!==h||e[26]!==E||e[27]!==T||e[28]!==k?(F={canceled:T,failed:k,pending:$,running:h,succeeded:E},e[24]=$,e[25]=h,e[26]=E,e[27]=T,e[28]=k,e[29]=F):F=e[29];const J=F;let P;e[30]!==f?(P=()=>f.poll(),e[30]=f,e[31]=P):P=e[31],ie(P,g===void 0);const H="flex flex-col gap-3",K="lunora-job-history";let q;e[32]!==f.error?(q=f.error!==null&&s("p",{className:"text-sm text-destructive","data-testid":"job-history-error",role:"alert",children:f.error}),e[32]=f.error,e[33]=q):q=e[33];const V=w?.length===0&&s(ne,{description:l("Jobs that succeed, fail or are cancelled stay here for seven days."),testId:"job-history-empty",title:l("No finished jobs.")}),Q=w!==void 0&&w.length>0&&s(Z,{className:"overflow-hidden py-0",children:s(j,{className:"px-0",children:C(se,{"data-testid":"job-history-table",children:[s(le,{children:C(U,{children:[s(R,{children:l("function")}),s(R,{children:l("state")}),s(R,{children:l("finished")}),s(R,{children:l("error")}),s(R,{children:l("id")})]})}),s(re,{children:w.map(_=>C(U,{"data-testid":`job-history-row-${_.id}`,children:[s(D,{className:"font-mono text-xs",children:_.workflow??_.functionPath}),s(D,{children:s(Y,{"data-testid":`job-history-state-${_.id}`,variant:_e[_.state],children:J[_.state]})}),s(D,{className:"text-muted-foreground tabular-nums",children:te(_.completedAt,"—")}),s(D,{className:"text-xs text-destructive",children:_.error??""}),s(D,{className:"font-mono text-xs",children:_.id})]},_.id))})]})})});let M;e[34]!==c?(M=c!==void 0&&s("p",{className:"text-sm text-destructive",role:"alert",children:c}),e[34]=c,e[35]=M):M=e[35];let B;e[36]!==p||e[37]!==A||e[38]!==L||e[39]!==l?(B=A!==void 0&&s("div",{children:s(ce,{"data-testid":"job-history-load-more",disabled:p,onClick:()=>{X(L())},variant:"outline",children:l(p?"Loading…":"Load more")})}),e[36]=p,e[37]=A,e[38]=L,e[39]=l,e[40]=B):B=e[40];let O;return e[41]!==q||e[42]!==V||e[43]!==Q||e[44]!==M||e[45]!==B?(O=C("div",{className:H,"data-testid":K,children:[q,V,Q,M,B]}),e[41]=q,e[42]=V,e[43]=Q,e[44]=M,e[45]=B,e[46]=O):O=e[46],O};function Fe(t){return t.id}const de=t=>{const e=z(8),{label:u,testId:r,value:a}=t;let l;e[0]!==u?(l=s("span",{className:"text-xs text-muted-foreground",children:u}),e[0]=u,e[1]=l):l=e[1];let i;e[2]!==r||e[3]!==a?(i=s("span",{className:"text-2xl font-semibold tabular-nums","data-testid":r,children:a}),e[2]=r,e[3]=a,e[4]=i):i=e[4];let n;return e[5]!==l||e[6]!==i?(n=s(Z,{className:"flex-1 py-0",children:C(j,{className:"flex flex-col gap-1 p-4",children:[l,i]})}),e[5]=l,e[6]=i,e[7]=n):n=e[7],n},Oe=t=>{const e=z(25);let u;e[0]!==t?(u=t===void 0?{}:t,e[0]=t,e[1]=u):u=e[1];const{loadStatus:r}=u,a=oe(),l=G(),i=r===void 0;let n;e[2]!==i?(n=["lunora-scheduler-status",i],e[2]=i,e[3]=n):n=e[3];let N;e[4]!==a||e[5]!==r?(N=async()=>{const b=await(r??(()=>a.schedulerStatus()))();return{...b,pools:b.pools.toSorted(Pe)}},e[4]=a,e[5]=r,e[6]=N):N=e[6];const v=ee(n,N),{data:d,error:f}=v;let g;e[7]!==v?(g=()=>v.poll(),e[7]=v,e[8]=g):g=e[8],ie(g,!0);let x;e[9]!==f?(x=f!==null&&s("p",{className:"text-sm text-destructive","data-testid":"pools-error",role:"alert",children:f}),e[9]=f,e[10]=x):x=e[10];let p;e[11]!==d||e[12]!==l?(p=d!==void 0&&C("div",{className:"flex gap-3","data-testid":"pools-totals",children:[s(de,{label:l("backlog"),testId:"pools-backlog",value:d.backlog}),s(de,{label:l("in flight"),testId:"pools-inflight",value:d.inFlight}),s(de,{label:l("pools"),testId:"pools-count",value:d.pools.length})]}),e[11]=d,e[12]=l,e[13]=p):p=e[13];let o;e[14]!==d?.pools.length||e[15]!==l?(o=d?.pools.length===0&&s(ne,{description:l("Pools created with createWorkpool appear here once they have activity."),icon:s("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:s("path",{d:"M4 7h16M4 12h16M4 17h16"})}),testId:"pools-empty",title:l("No workpools.")}),e[14]=d?.pools.length,e[15]=l,e[16]=o):o=e[16];let c;e[17]!==d||e[18]!==l?(c=d!==void 0&&d.pools.length>0&&s(Z,{className:"overflow-hidden py-0",children:s(j,{className:"px-0",children:C(se,{"data-testid":"pools-table",children:[s(le,{children:C(U,{children:[s(R,{children:l("pool")}),s(R,{children:l("queued")}),s(R,{children:l("in flight")}),s(R,{children:l("max concurrency")})]})}),s(re,{children:d.pools.map(qe)})]})})}),e[17]=d,e[18]=l,e[19]=c):c=e[19];let m;return e[20]!==x||e[21]!==p||e[22]!==o||e[23]!==c?(m=C("div",{className:"flex flex-col gap-3","data-testid":"lunora-scheduler-pools",children:[x,p,o,c]}),e[20]=x,e[21]=p,e[22]=o,e[23]=c,e[24]=m):m=e[24],m};function Pe(t,e){return e.queued-t.queued}function qe(t){return C(U,{"data-testid":`pools-row-${t.name}`,children:[s(D,{className:"font-mono text-xs",children:t.name}),s(D,{className:"tabular-nums",children:t.queued}),C(D,{className:"tabular-nums",children:[t.inFlight," / ",t.maxConcurrency]}),s(D,{className:"tabular-nums",children:t.maxConcurrency})]},t.name)}const Me=["jobs","history","dead","pools","cron"],it=t=>{const e=z(48);let u;e[0]!==t?(u=t===void 0?{}:t,e[0]=t,e[1]=u):u=e[1];const{loadCronJobs:r,scheduledCancel:a,scheduledLoad:l}=u,i=G(),[n,N]=W("jobs");let v;e[2]!==i?(v=i("Cron triggers"),e[2]=i,e[3]=v):v=e[3];let d;e[4]!==i?(d=i("Dead letter"),e[4]=i,e[5]=d):d=e[5];let f;e[6]!==i?(f=i("History"),e[6]=i,e[7]=f):f=e[7];let g;e[8]!==i?(g=i("Scheduled jobs"),e[8]=i,e[9]=g):g=e[9];let x;e[10]!==i?(x=i("Pools"),e[10]=i,e[11]=x):x=e[11];let p;e[12]!==v||e[13]!==d||e[14]!==f||e[15]!==g||e[16]!==x?(p={cron:v,dead:d,history:f,jobs:g,pools:x},e[12]=v,e[13]=d,e[14]=f,e[15]=g,e[16]=x,e[17]=p):p=e[17];const o=p;let c;e[18]===Symbol.for("react.memo_cache_sentinel")?(c=h=>{N(h.currentTarget.dataset.view)},e[18]=c):c=e[18];const m=c;let b;e[19]===Symbol.for("react.memo_cache_sentinel")?(b=s(pe,{}),e[19]=b):b=e[19];let y;e[20]!==i?(y=i("Schedule view"),e[20]=i,e[21]=y):y=e[21];let I;e[22]!==n||e[23]!==o?(I=Me.map(h=>s(ce,{"aria-selected":n===h,"data-testid":`schedule-view-${h}`,"data-view":h,onClick:m,role:"tab",size:"sm",type:"button",variant:n===h?"default":"outline",children:o[h]},h)),e[22]=n,e[23]=o,e[24]=I):I=e[24];let w;e[25]!==y||e[26]!==I?(w=s("div",{"aria-label":y,className:"flex gap-1.5","data-testid":"schedule-view-toggle",role:"tablist",children:I}),e[25]=y,e[26]=I,e[27]=w):w=e[27];let A;e[28]!==a||e[29]!==l||e[30]!==n?(A=n==="jobs"&&s(Ne,{cancelJob:a,loadJobs:l}),e[28]=a,e[29]=l,e[30]=n,e[31]=A):A=e[31];let S;e[32]!==n?(S=n==="history"&&s(Je,{}),e[32]=n,e[33]=S):S=e[33];let L;e[34]!==n?(L=n==="dead"&&s(De,{}),e[34]=n,e[35]=L):L=e[35];let T;e[36]!==n?(T=n==="pools"&&s(Oe,{}),e[36]=n,e[37]=T):T=e[37];let k;e[38]!==r||e[39]!==n?(k=n==="cron"&&s(Le,{loadCronJobs:r}),e[38]=r,e[39]=n,e[40]=k):k=e[40];let $;return e[41]!==w||e[42]!==A||e[43]!==S||e[44]!==L||e[45]!==T||e[46]!==k?($=C("div",{className:"flex flex-col gap-4","data-testid":"lunora-schedule",children:[b,w,A,S,L,T,k]}),e[41]=w,e[42]=A,e[43]=S,e[44]=L,e[45]=T,e[46]=k,e[47]=$):$=e[47],$};export{it as SchedulePanel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as y}from"react/compiler-runtime";import{E as N}from"../packem_shared/error-alert-DKXm5h19.mjs";import{B as R}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as T,a as k}from"../packem_shared/card-By2O8ULa.mjs";import{E as S}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as w,a as C,b as g,c as f,d as $,e as p}from"../packem_shared/table-D0SBiDu-.mjs";import{u as A}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useT as E}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as v}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{jsxs as u,jsx as r}from"react/jsx-runtime";const I=(e,t)=>({delete:e("Delete"),list:e("List"),read:e("Read"),write:e("Write")})[t],b={delete:2,list:3,read:0,write:1},O=e=>[...e].toSorted((t,a)=>t.bucket.localeCompare(a.bucket)||b[t.on]-b[a.on]||(t.prefix??"").localeCompare(a.prefix??"")),M=()=>{const e=y(14),t=E();let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={},e[0]=a):a=e[0];const{data:l,error:d,errorSource:i}=A(v.storageRules,a),h=l!==void 0;let n;if(e[1]!==l||e[2]!==d||e[3]!==i||e[4]!==h||e[5]!==t){const x=O(Array.isArray(l?.rules)?l.rules:[]);let c;e[7]!==d||e[8]!==i?(c=d!==null&&r(N,{error:i,testId:"storage-rules-error"}),e[7]=d,e[8]=i,e[9]=c):c=e[9];let s;e[10]!==t?(s=t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only."),e[10]=t,e[11]=s):s=e[11];let m;e[12]!==s?(m=r("p",{className:"text-sm text-muted-foreground","data-testid":"storage-rules-note",children:s}),e[12]=s,e[13]=m):m=e[13],n=u("div",{className:"flex flex-col gap-4","data-testid":"lunora-storage-rules-panel",children:[c,m,h&&x.length===0?r(S,{description:t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),testId:"storage-rules-empty",title:t("No storage rules defined")}):r(T,{className:"overflow-hidden py-0",children:r(k,{className:"px-0",children:u(w,{"data-testid":"storage-rules-table",children:[r(C,{children:u(g,{children:[r(f,{children:t("Bucket")}),r(f,{children:t("Operation")}),r(f,{children:t("Key prefix")}),r(f,{children:t("Guarded by")})]})}),r($,{children:x.map(o=>u(g,{"data-testid":`storage-rule-${o.bucket}-${o.on}-${o.prefix??""}`,children:[r(p,{className:"font-mono text-xs",children:o.bucket}),r(p,{children:r(R,{variant:"secondary",children:I(t,o.on)})}),r(p,{className:"font-mono text-xs",children:o.prefix??r("span",{className:"text-muted-foreground",children:t("(whole bucket)")})}),r(p,{className:"font-mono text-xs text-muted-foreground",children:o.procedure})]},`${o.bucket}:${o.on}:${o.prefix??""}:${o.procedure}`))})]})})})]}),e[1]=l,e[2]=d,e[3]=i,e[4]=h,e[5]=t,e[6]=n}else n=e[6];return n};export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as R}from"react/compiler-runtime";import{E as j}from"../packem_shared/error-alert-DKXm5h19.mjs";import{ShardInput as E}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{B as A}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as M,a as $}from"../packem_shared/card-By2O8ULa.mjs";import{E as B}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as _,a as D,b as T,c as v,d as H,e as S}from"../packem_shared/table-D0SBiDu-.mjs";import{u as P}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useAutoRefresh as F}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as L}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as O}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as W}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{k as q}from"../packem_shared/internal-hIuTpSbx.mjs";import{jsxs as c,jsx as t}from"react/jsx-runtime";const w=80,G=l=>{if(l===void 0)return"";const e=JSON.stringify(l,q);return e.length>w?`${e.slice(0,w)}…`:e},J=l=>{const e=[];for(const r of l){const n=r.id.toString();if(r.subscriptions.length===0){e.push({admin:r.admin,connectionId:r.id,key:`c${n}`,subscription:null});continue}r.subscriptions.forEach((s,i)=>{e.push({admin:r.admin,connectionId:r.id,key:`c${n}-s${i.toString()}`,subscription:s})})}return e},C=t("span",{className:"text-muted-foreground",children:"—"}),ae=l=>{const e=R(24),{initialShardKey:r}=l,n=O(),{queryShardKey:s,setShardKey:i,shardKey:m}=L(r);let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p={},e[0]=p):p=e[0];let f;e[1]!==s?(f={keepPreviousData:!0,shardKey:s},e[1]=s,e[2]=f):f=e[2];const{data:o,error:a,errorSource:h,poll:K}=P(W.listSubscriptions,p,f);F(K,!0);let b;if(e[3]!==a||e[4]!==h||e[5]!==s||e[6]!==o||e[7]!==i||e[8]!==m||e[9]!==n){const N=o===void 0?[]:J(o.connections);let d;e[11]!==i||e[12]!==m?(d=t(E,{onChange:i,testId:"subs-shard-input",value:m}),e[11]=i,e[12]=m,e[13]=d):d=e[13];let u;e[14]!==o||e[15]!==n?(u=o!==void 0&&c("div",{className:"ml-auto flex items-center gap-2 text-sm text-muted-foreground","data-testid":"subs-count",children:[t(A,{variant:"secondary",children:n("{count} connections",{count:o.totalConnections})}),t(A,{variant:"secondary",children:n("{count} subscriptions",{count:o.totalSubscriptions})})]}),e[14]=o,e[15]=n,e[16]=u):u=e[16];let g;e[17]!==d||e[18]!==u?(g=c("div",{className:"flex flex-wrap items-center gap-2",children:[d,u]}),e[17]=d,e[18]=u,e[19]=g):g=e[19];let x;e[20]!==a||e[21]!==h||e[22]!==s?(x=a!==null&&t(j,{error:h,shardKey:s,testId:"subs-error"}),e[20]=a,e[21]=h,e[22]=s,e[23]=x):x=e[23],b=c("div",{className:"flex flex-col gap-4","data-testid":"subs-panel",children:[g,x,a===null&&o!==void 0&&N.length===0&&t(B,{description:n("Active WebSocket subscriptions on this shard."),icon:t("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:t("path",{d:"M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"})}),testId:"subs-empty",title:n("No active subscriptions.")}),a===null&&N.length>0&&t(M,{className:"overflow-hidden py-0",children:t($,{className:"px-0",children:c(_,{"data-testid":"subs-table",children:[t(D,{children:c(T,{children:[t(v,{children:n("Connection")}),t(v,{children:n("Function path")}),t(v,{children:n("Table")}),t(v,{children:n("Arguments")})]})}),t(H,{children:N.map(y=>{const{subscription:k}=y,I=G(k?.args);return c(T,{"data-testid":"subs-row",children:[t(S,{className:"font-medium tabular-nums",children:c("span",{className:"inline-flex items-center gap-1.5",children:["#",y.connectionId,y.admin&&t(A,{variant:"outline",children:n("admin")})]})}),t(S,{className:"font-mono text-xs",children:k?.functionPath??C}),t(S,{children:k?.table??C}),t(S,{className:"max-w-[32ch] truncate font-mono text-xs text-muted-foreground",title:I||void 0,children:I||C})]},y.key)})})]})})})]}),e[3]=a,e[4]=h,e[5]=s,e[6]=o,e[7]=i,e[8]=m,e[9]=n,e[10]=b}else b=e[10];return b};export{ae as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as q}from"react/compiler-runtime";import{B as _}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as R,a as H}from"../packem_shared/card-By2O8ULa.mjs";import{E as P}from"../packem_shared/empty-state-D7jEML_T.mjs";import{T as j,a as B,b as w,c as l,d as K,e as s}from"../packem_shared/table-D0SBiDu-.mjs";import{a as I}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{useAutoRefresh as Q}from"../packem_shared/DEFAULT_AUTO_REFRESH_MS-Py5Yx7rP.mjs";import{u as V}from"../packem_shared/use-studio-client-DCA50tF2.mjs";import{useT as Y}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{jsx as n,jsxs as r}from"react/jsx-runtime";const $=2e3,z=new Set(["open"]),ie=W=>{const e=q(41),{read:g}=W,t=Y(),A=V();let T;e[0]!==A||e[1]!==g?(T=()=>Promise.resolve(g?g():A.debug()),e[0]=A,e[1]=g,e[2]=T):T=e[2];const M=T,E=g?"injected":"live";let x;e[3]!==E?(x=["lunora-studio","sync-client-debug",E],e[3]=E,e[4]=x):x=e[4];const{data:c,poll:O}=I(x,M);if(Q(O,!0,$),!c){let i;e[5]!==t?(i=t("Reading the sync client's state…"),e[5]=t,e[6]=i):i=e[6];let S;e[7]!==t?(S=t("Sync client"),e[7]=t,e[8]=S):S=e[8];let k;return e[9]!==i||e[10]!==S?(k=n(R,{children:n(H,{children:n(P,{description:i,title:S})})}),e[9]=i,e[10]=S,e[11]=k):k=e[11],k}const{pendingWrites:C,shards:v,subscriptions:b}=c;let a;e[12]!==t?(a=t("This Studio session's sync client"),e[12]=t,e[13]=a):a=e[13];let o;e[14]!==a?(o=n("span",{className:"text-sm font-medium",children:a}),e[14]=a,e[15]=o):o=e[15];const L=c.connectionStatus==="connected"?"default":"secondary";let d;e[16]!==c.connectionStatus||e[17]!==L?(d=n(_,{variant:L,children:c.connectionStatus}),e[16]=c.connectionStatus,e[17]=L,e[18]=d):d=e[18];let h;e[19]!==C||e[20]!==t?(h=C>0?n(_,{variant:"secondary",children:t("{count} pending writes",{count:C})}):null,e[19]=C,e[20]=t,e[21]=h):h=e[21];let f;e[22]!==o||e[23]!==d||e[24]!==h?(f=r("div",{className:"flex flex-wrap items-center gap-2",children:[o,d,h]}),e[22]=o,e[23]=d,e[24]=h,e[25]=f):f=e[25];let m;e[26]!==t?(m=t("Reads client.debug() for the client running in this page — not your application's client. Call client.debug() in your app to diagnose a specific stuck overlay there."),e[26]=t,e[27]=m):m=e[27];let u;e[28]!==m?(u=n("p",{className:"text-muted-foreground text-xs",children:m}),e[28]=m,e[29]=u):u=e[29];let p;e[30]!==v||e[31]!==t?(p=v.length===0?n(P,{description:t("No shard connection has been opened yet."),title:t("No shards")}):r(j,{children:[n(B,{children:r(w,{children:[n(l,{children:t("Shard")}),n(l,{children:t("Socket")}),n(l,{children:t("Confirmed watermark")})]})}),n(K,{children:v.map(i=>r(w,{children:[n(s,{children:i.shardKey??t("(default)")}),n(s,{children:n(_,{variant:z.has(i.wsState)?"default":"secondary",children:i.wsState})}),n(s,{children:i.confirmedMutationWatermark})]},i.shardKey??"__default__"))})]}),e[30]=v,e[31]=t,e[32]=p):p=e[32];let y;e[33]!==b||e[34]!==t?(y=b.length===0?n(P,{description:t("This client holds no live queries or shapes."),title:t("No subscriptions")}):r(j,{children:[n(B,{children:r(w,{children:[n(l,{children:t("Subscription")}),n(l,{children:t("Kind")}),n(l,{children:t("Acked")}),n(l,{children:t("Cursor")}),n(l,{children:t("Pending overlays")})]})}),n(K,{children:b.map(i=>r(w,{children:[n(s,{className:"font-mono text-xs",children:i.functionPath}),n(s,{children:i.kind}),n(s,{children:n(_,{variant:i.acked?"default":"secondary",children:i.acked?t("yes"):t("no")})}),n(s,{children:i.serverCursor??"—"}),n(s,{children:i.pendingOptimisticLayers})]},i.id))})]}),e[33]=b,e[34]=t,e[35]=y):y=e[35];let N;return e[36]!==u||e[37]!==p||e[38]!==y||e[39]!==f?(N=n(R,{children:r(H,{className:"flex flex-col gap-4",children:[f,u,p,y]})}),e[36]=u,e[37]=p,e[38]=y,e[39]=f,e[40]=N):N=e[40],N};export{ie as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r}from"react/compiler-runtime";import{motion as s}from"motion/react";import{jsx as i}from"react/jsx-runtime";const a={bounce:.1,duration:.45,type:"spring"},u=n=>{const t=r(2),{className:e}=n;let o;return t[0]!==e?(o=i(s.span,{className:e,layoutId:"studio-theme-active",transition:a}),t[0]=e,t[1]=o):o=t[1],o};export{u as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as U}from"react/compiler-runtime";import{useState as ee,useEffect as le}from"react";import{E as ge}from"../packem_shared/error-alert-DKXm5h19.mjs";import{L as be}from"../packem_shared/live-status-D1GasNsH.mjs";import{ShardInput as xe}from"../packem_shared/ShardInput-CoySruKZ.mjs";import{B as fe}from"../packem_shared/badge-r_5B4LHP.mjs";import{C as ye}from"../packem_shared/checkbox-CnS9cyCz.mjs";import{E as Ne}from"../packem_shared/empty-state-D7jEML_T.mjs";import{I as ve}from"../packem_shared/input-CXhxesPC.mjs";import{u as oe}from"../packem_shared/use-admin-query-CaOm4JS3.mjs";import{u as we}from"../packem_shared/use-shard-key-BsP3o5wT.mjs";import{useT as Z}from"../packem_shared/DEFAULT_LOCALE-BQ3jRT74.mjs";import{ADMIN_FUNCTIONS as ie}from"../packem_shared/ADMIN_FUNCTIONS-DUXsXId1.mjs";import{h as me,k as Se}from"../packem_shared/internal-hIuTpSbx.mjs";import{r as _e}from"../packem_shared/shard-history-CaO3C4KQ.mjs";import{p as Ie,c as ke}from"../packem_shared/trace-handoff-BV3EWqy_.mjs";import{L as Me}from"../packem_shared/log-line-BH0iWiBv.mjs";import{f as $e}from"../packem_shared/log-fields-BolUoZ9g.mjs";import{c as ne}from"../packem_shared/utils-bhneXptQ.mjs";import{jsx as n,jsxs as k,Fragment as Te}from"react/jsx-runtime";const Le=.5,de=4,ce=a=>Math.min(100,Math.max(0,a)),Ce=(a,e)=>{if(!Number.isFinite(e)||e<=0)return{leftPercent:0,widthPercent:100};const t=ce(a.offsetMs/e*100),s=a.durationMs/e*100,l=Math.max(Le,Math.min(ce(s),100-t));return{leftPercent:t,widthPercent:l}},Ee=(a,e,t=!1)=>{const s=e.trim().toLowerCase(),l=t?a.filter(r=>!r.ok):a;return s===""?[...l]:l.filter(r=>r.rootName.toLowerCase().includes(s)||r.functionPath.toLowerCase().includes(s)||r.traceId.toLowerCase().includes(s)||r.spans.some(o=>o.name.toLowerCase().includes(s)||o.spanId.toLowerCase().includes(s)))},q=a=>Number.isFinite(a)?a>0&&a<1?`${a.toFixed(2)}ms`:`${String(Math.round(a))}ms`:"—",Pe=a=>!Number.isFinite(a)||a<=0?[]:Array.from({length:de},(e,t)=>{const s=(t+1)/de;return{label:q(a*s),percent:s*100}}),ue=a=>{if(typeof a=="string")return a;try{return JSON.stringify(a,Se)}catch{return String(a)}},Y=a=>{const e=U(7),{label:t,value:s}=a;let l;e[0]!==t?(l=n("dt",{className:"w-40 shrink-0 text-muted-foreground",children:t}),e[0]=t,e[1]=l):l=e[1];let r;e[2]!==s?(r=n("dd",{className:"min-w-0 break-all",children:s}),e[2]=s,e[3]=r):r=e[3];let o;return e[4]!==l||e[5]!==r?(o=k("div",{className:"flex gap-2",children:[l,r]}),e[4]=l,e[5]=r,e[6]=o):o=e[6],o},Ke=a=>{const e=U(68),{span:t}=a,s=Z();let l,r,o,i,d,f;if(e[0]!==t.attributes||e[1]!==t.durationMs||e[2]!==t.error||e[3]!==t.events||e[4]!==t.kind||e[5]!==t.offsetMs||e[6]!==t.parentSpanId||e[7]!==t.spanId||e[8]!==s){const $=Object.entries(t.attributes??{});let M;e[15]!==t.events?(M=t.events??[],e[15]=t.events,e[16]=M):M=e[16],l=M,r="border-t border-border bg-background/60 px-3 py-2 font-mono text-xs",o="tr-span-detail";let N;e[17]!==s?(N=s("Span ID"),e[17]=s,e[18]=N):N=e[18];let v;e[19]!==t.spanId||e[20]!==N?(v=n(Y,{label:N,value:t.spanId}),e[19]=t.spanId,e[20]=N,e[21]=v):v=e[21];let w;e[22]!==s?(w=s("Parent span ID"),e[22]=s,e[23]=w):w=e[23];let m;e[24]!==t.parentSpanId||e[25]!==s?(m=t.parentSpanId===""?s("— (trace root)"):t.parentSpanId,e[24]=t.parentSpanId,e[25]=s,e[26]=m):m=e[26];let u;e[27]!==m||e[28]!==w?(u=n(Y,{label:w,value:m}),e[27]=m,e[28]=w,e[29]=u):u=e[29];let h;e[30]!==s?(h=s("Kind"),e[30]=s,e[31]=h):h=e[31];const T=t.kind??"internal";let _;e[32]!==h||e[33]!==T?(_=n(Y,{label:h,value:T}),e[32]=h,e[33]=T,e[34]=_):_=e[34];let S;e[35]!==s?(S=s("Started at"),e[35]=s,e[36]=S):S=e[36];let g;e[37]!==t.offsetMs||e[38]!==s?(g=s("+{offset}",{offset:q(t.offsetMs)}),e[37]=t.offsetMs,e[38]=s,e[39]=g):g=e[39];let b;e[40]!==S||e[41]!==g?(b=n(Y,{label:S,value:g}),e[40]=S,e[41]=g,e[42]=b):b=e[42];let I;e[43]!==s?(I=s("Duration"),e[43]=s,e[44]=I):I=e[44];let p;e[45]!==t.durationMs?(p=q(t.durationMs),e[45]=t.durationMs,e[46]=p):p=e[46];let x;e[47]!==I||e[48]!==p?(x=n(Y,{label:I,value:p}),e[47]=I,e[48]=p,e[49]=x):x=e[49],e[50]!==u||e[51]!==_||e[52]!==b||e[53]!==x||e[54]!==v?(i=k("dl",{className:"flex flex-col gap-1",children:[v,u,_,b,x]}),e[50]=u,e[51]=_,e[52]=b,e[53]=x,e[54]=v,e[55]=i):i=e[55],e[56]!==t.error?(d=t.error!==void 0&&k("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 px-2 py-1.5","data-testid":"tr-detail-error",children:[n("span",{className:"font-semibold text-destructive",children:t.error.type}),n("p",{className:"whitespace-pre-wrap break-all text-destructive",children:t.error.message})]}),e[56]=t.error,e[57]=d):d=e[57],f=$.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-attributes",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Attributes")}),n("dl",{className:"flex flex-col gap-1",children:$.map(Fe)})]}),e[0]=t.attributes,e[1]=t.durationMs,e[2]=t.error,e[3]=t.events,e[4]=t.kind,e[5]=t.offsetMs,e[6]=t.parentSpanId,e[7]=t.spanId,e[8]=s,e[9]=l,e[10]=r,e[11]=o,e[12]=i,e[13]=d,e[14]=f}else l=e[9],r=e[10],o=e[11],i=e[12],d=e[13],f=e[14];let c;e[58]!==l||e[59]!==s?(c=l.length>0&&k("div",{className:"mt-2","data-testid":"tr-detail-events",children:[n("p",{className:"mb-1 text-muted-foreground",children:s("Events")}),n("ul",{className:"flex flex-col gap-1",children:l.map(Ae)})]}),e[58]=l,e[59]=s,e[60]=c):c=e[60];let y;return e[61]!==r||e[62]!==o||e[63]!==i||e[64]!==d||e[65]!==f||e[66]!==c?(y=k("div",{className:r,"data-testid":o,children:[i,d,f,c]}),e[61]=r,e[62]=o,e[63]=i,e[64]=d,e[65]=f,e[66]=c,e[67]=y):y=e[67],y};function Fe(a){const[e,t]=a;return n(Y,{label:e,value:ue(t)},e)}function Re(a){const[e,t]=a;return`${e}=${ue(t)}`}function Ae(a){return k("li",{className:"flex gap-2",children:[n("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:me(a.ts)}),n(fe,{variant:"secondary",children:a.name}),n("span",{className:"min-w-0 break-all text-muted-foreground",children:Object.entries(a.attributes??{}).map(Re).join(" ")})]},`${a.name}:${String(a.ts)}`)}const De=14,pe="grid grid-cols-[14rem_1fr_4rem_16rem_16rem] items-center gap-2 px-3",je=a=>{const e=U(17),{traceDurationMs:t}=a;let s,l,r,o,i,d;if(e[0]!==t){d=Symbol.for("react.early_return_sentinel");e:{const y=Pe(t);if(y.length===0){d=null;break e}e[7]===Symbol.for("react.memo_cache_sentinel")?(r=ne(pe,"border-b border-border py-1 font-mono text-[10px] text-muted-foreground"),e[7]=r):r=e[7],o="tr-ruler",e[8]===Symbol.for("react.memo_cache_sentinel")?(i=n("span",{}),e[8]=i):i=e[8],s="relative h-3",l=y.map(We)}e[0]=t,e[1]=s,e[2]=l,e[3]=r,e[4]=o,e[5]=i,e[6]=d}else s=e[1],l=e[2],r=e[3],o=e[4],i=e[5],d=e[6];if(d!==Symbol.for("react.early_return_sentinel"))return d;let f;e[9]!==s||e[10]!==l?(f=n("span",{className:s,children:l}),e[9]=s,e[10]=l,e[11]=f):f=e[11];let c;return e[12]!==r||e[13]!==o||e[14]!==i||e[15]!==f?(c=k("div",{className:r,"data-testid":o,children:[i,f]}),e[12]=r,e[13]=o,e[14]=i,e[15]=f,e[16]=c):c=e[16],c},Be=a=>{const e=U(60),{span:t,traceDurationMs:s}=a,l=Z(),[r,o]=ee(!1);let i;e[0]!==t||e[1]!==s?(i=Ce(t,s),e[0]=t,e[1]=s,e[2]=i):i=e[2];const{leftPercent:d,widthPercent:f}=i;let c;e[3]!==t.attributes?(c=$e(t.attributes),e[3]=t.attributes,e[4]=c):c=e[4];const y=c,$=t.depth*De;let M;e[5]!==$?(M={paddingLeft:$},e[5]=$,e[6]=M):M=e[6];const N=M,v=`${String(d)}%`,w=`${String(f)}%`;let m;e[7]!==v||e[8]!==w?(m={left:v,width:w},e[7]=v,e[8]=w,e[9]=m):m=e[9];const u=m;let h;e[10]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{o(Ue)},e[10]=h):h=e[10];const T=h,_=t.depth,S=`tr-span-detail-${t.spanId}`;let g;e[11]!==t.durationMs||e[12]!==t.error||e[13]!==t.name||e[14]!==t.offsetMs||e[15]!==l?(g=l("{name}, {duration}, starts {offset} in{failure}",{duration:q(t.durationMs),failure:t.error===void 0?"":l(", failed: {message}",{message:t.error.message}),name:t.name,offset:q(t.offsetMs)}),e[11]=t.durationMs,e[12]=t.error,e[13]=t.name,e[14]=t.offsetMs,e[15]=l,e[16]=g):g=e[16];let b;e[17]===Symbol.for("react.memo_cache_sentinel")?(b=ne(pe,"w-full border-b border-border py-1.5 text-left font-mono text-xs hover:bg-muted/50"),e[17]=b):b=e[17];const I=`tr-span-toggle-${t.spanId}`;let p;e[18]!==t.ok?(p=t.ok?null:n("span",{"aria-hidden":"true",className:"mr-1 text-destructive","data-testid":"tr-span-error",children:"●"}),e[18]=t.ok,e[19]=p):p=e[19];let x;e[20]!==N||e[21]!==t.name||e[22]!==p?(x=k("span",{className:"truncate",style:N,title:t.name,children:[p,t.name]}),e[20]=N,e[21]=t.name,e[22]=p,e[23]=x):x=e[23];const D=t.ok?"bg-primary/70":"bg-destructive";let L;e[24]!==D?(L=ne("absolute inset-y-0 rounded-sm",D),e[24]=D,e[25]=L):L=e[25];let A;e[26]!==u||e[27]!==d||e[28]!==L||e[29]!==f?(A=n("span",{"aria-hidden":"true",className:"relative h-3 overflow-hidden rounded-sm bg-muted",children:n("span",{className:L,"data-left":d,"data-testid":"tr-span-bar","data-width":f,style:u})}),e[26]=u,e[27]=d,e[28]=L,e[29]=f,e[30]=A):A=e[30];let j;e[31]!==t.durationMs?(j=q(t.durationMs),e[31]=t.durationMs,e[32]=j):j=e[32];let K;e[33]!==j?(K=n("span",{className:"text-right tabular-nums text-muted-foreground",children:j}),e[33]=j,e[34]=K):K=e[34];let B;e[35]!==t.error?(B=t.error===void 0?null:n("span",{className:"text-destructive","data-testid":"tr-span-error-message",title:t.error.message,children:`${t.error.type}: ${t.error.message}`}),e[35]=t.error,e[36]=B):B=e[36];let C;e[37]!==B?(C=n("span",{className:"truncate text-muted-foreground",children:B}),e[37]=B,e[38]=C):C=e[38];let O;e[39]!==y?(O=y===""?null:n("span",{"data-testid":"tr-span-attributes",title:y,children:y}),e[39]=y,e[40]=O):O=e[40];let E;e[41]!==O?(E=n("span",{className:"truncate text-muted-foreground",children:O}),e[41]=O,e[42]=E):E=e[42];let W;e[43]!==r||e[44]!==S||e[45]!==g||e[46]!==I||e[47]!==x||e[48]!==A||e[49]!==K||e[50]!==C||e[51]!==E?(W=k("button",{"aria-controls":S,"aria-expanded":r,"aria-label":g,className:b,"data-testid":I,onClick:T,type:"button",children:[x,A,K,C,E]}),e[43]=r,e[44]=S,e[45]=g,e[46]=I,e[47]=x,e[48]=A,e[49]=K,e[50]=C,e[51]=E,e[52]=W):W=e[52];let F;e[53]!==r||e[54]!==t?(F=r&&n("div",{id:`tr-span-detail-${t.spanId}`,children:n(Ke,{span:t})}),e[53]=r,e[54]=t,e[55]=F):F=e[55];let P;return e[56]!==t.depth||e[57]!==W||e[58]!==F?(P=k("li",{"data-depth":_,"data-testid":"tr-span-row",children:[W,F]}),e[56]=t.depth,e[57]=W,e[58]=F,e[59]=P):P=e[59],P},Oe=a=>{const e=U(15),{durationMs:t,spans:s}=a,l=Z();let r;e[0]!==t?(r=n(je,{traceDurationMs:t}),e[0]=t,e[1]=r):r=e[1];let o;e[2]!==l?(o=l("Trace waterfall"),e[2]=l,e[3]=o):o=e[3];let i;if(e[4]!==t||e[5]!==s){let c;e[7]!==t?(c=y=>n(Be,{span:y,traceDurationMs:t},y.spanId),e[7]=t,e[8]=c):c=e[8],i=s.map(c),e[4]=t,e[5]=s,e[6]=i}else i=e[6];let d;e[9]!==o||e[10]!==i?(d=n("ul",{"aria-label":o,children:i}),e[9]=o,e[10]=i,e[11]=d):d=e[11];let f;return e[12]!==r||e[13]!==d?(f=k(Te,{children:[r,d]}),e[12]=r,e[13]=d,e[14]=f):f=e[14],f};function We(a){return n("span",{className:ne("absolute inset-y-0 border-l border-border/70",a.percent===100?"-translate-x-full pr-1":"pl-1"),style:{left:`${String(a.percent)}%`},children:a.label},a.percent)}function Ue(a){return!a}const qe=a=>Array.isArray(a?.traces)?a.traces:[],ze=a=>{const e=U(12),{entries:t}=a,s=Z();let l;e[0]!==t.length||e[1]!==s?(l=s("Logs ({count})",{count:t.length}),e[0]=t.length,e[1]=s,e[2]=l):l=e[2];let r;e[3]!==l?(r=n("p",{className:"mb-1 font-mono text-xs text-muted-foreground",children:l}),e[3]=l,e[4]=r):r=e[4];let o;e[5]!==t?(o=t.map(He),e[5]=t,e[6]=o):o=e[6];let i;e[7]!==o?(i=n("div",{role:"grid",children:o}),e[7]=o,e[8]=i):i=e[8];let d;return e[9]!==r||e[10]!==i?(d=k("div",{className:"border-t border-border px-3 py-2","data-testid":"tr-logs",children:[r,i]}),e[9]=r,e[10]=i,e[11]=d):d=e[11],d},Ge=a=>{const e=U(50),{expanded:t,logs:s,onToggle:l,trace:r}=a,o=Z();let i;e[0]!==l||e[1]!==r.traceId?(i=()=>{l(r.traceId)},e[0]=l,e[1]=r.traceId,e[2]=i):i=e[2];const d=i,f=`tr-row-${r.traceId}`,c=`tr-waterfall-${r.traceId}`,y=`tr-toggle-${r.traceId}`,$=t?"▾":"▸";let M;e[3]!==$?(M=n("span",{"aria-hidden":"true",className:"w-3 shrink-0 text-xs text-muted-foreground",children:$}),e[3]=$,e[4]=M):M=e[4];let N;e[5]!==r.rootName?(N=n("span",{className:"w-56 shrink-0 truncate text-sm font-medium",title:r.rootName,children:r.rootName}),e[5]=r.rootName,e[6]=N):N=e[6];let v;e[7]!==r.functionPath?(v=n("span",{className:"w-48 shrink-0 truncate font-mono text-xs text-muted-foreground",title:r.functionPath,children:r.functionPath}),e[7]=r.functionPath,e[8]=v):v=e[8];let w;e[9]!==r.durationMs?(w=q(r.durationMs),e[9]=r.durationMs,e[10]=w):w=e[10];let m;e[11]!==w?(m=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:w}),e[11]=w,e[12]=m):m=e[12];let u;e[13]!==o||e[14]!==r.spans.length?(u=o("{count} spans",{count:r.spans.length}),e[13]=o,e[14]=r.spans.length,e[15]=u):u=e[15];let h;e[16]!==u?(h=n("span",{className:"w-20 shrink-0 text-right font-mono text-xs tabular-nums text-muted-foreground",children:u}),e[16]=u,e[17]=h):h=e[17];const T=r.ok?"secondary":"destructive";let _;e[18]!==o||e[19]!==r.ok?(_=r.ok?o("ok"):o("error"),e[18]=o,e[19]=r.ok,e[20]=_):_=e[20];let S;e[21]!==T||e[22]!==_?(S=n("span",{className:"shrink-0",children:n(fe,{variant:T,children:_})}),e[21]=T,e[22]=_,e[23]=S):S=e[23];let g;e[24]!==r.startTs?(g=me(r.startTs),e[24]=r.startTs,e[25]=g):g=e[25];let b;e[26]!==g?(b=n("span",{className:"flex-1 truncate text-right font-mono text-xs tabular-nums text-muted-foreground",children:g}),e[26]=g,e[27]=b):b=e[27];let I;e[28]!==t||e[29]!==d||e[30]!==m||e[31]!==h||e[32]!==S||e[33]!==b||e[34]!==c||e[35]!==y||e[36]!==M||e[37]!==N||e[38]!==v?(I=k("button",{"aria-controls":c,"aria-expanded":t,className:"flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50","data-testid":y,onClick:d,type:"button",children:[M,N,v,m,h,S,b]}),e[28]=t,e[29]=d,e[30]=m,e[31]=h,e[32]=S,e[33]=b,e[34]=c,e[35]=y,e[36]=M,e[37]=N,e[38]=v,e[39]=I):I=e[39];let p;e[40]!==t||e[41]!==s||e[42]!==r.durationMs||e[43]!==r.spans||e[44]!==r.traceId?(p=t&&k("div",{className:"bg-muted/20","data-testid":`tr-waterfall-${r.traceId}`,id:`tr-waterfall-${r.traceId}`,children:[n(Oe,{durationMs:r.durationMs,spans:r.spans}),s.length>0&&n(ze,{entries:s})]}),e[40]=t,e[41]=s,e[42]=r.durationMs,e[43]=r.spans,e[44]=r.traceId,e[45]=p):p=e[45];let x;return e[46]!==I||e[47]!==p||e[48]!==f?(x=k("div",{className:"border-b border-border last:border-b-0","data-testid":f,children:[I,p]}),e[46]=I,e[47]=p,e[48]=f,e[49]=x):x=e[49],x},bt=a=>{const e=U(60),{initialShardKey:t}=a,s=Z(),[l]=ee(Ie),{queryShardKey:r,setShardKey:o,shardKey:i}=we(l?.shardKey!==void 0&&l.shardKey!==""?l.shardKey:t??""),[d,f]=ee(l?.traceId??""),[c,y]=ee(!1),[$,M]=ee(Je);let N;e[0]===Symbol.for("react.memo_cache_sentinel")?(N=[],e[0]=N):N=e[0],le(Qe,N);let v;e[1]===Symbol.for("react.memo_cache_sentinel")?(v={},e[1]=v):v=e[1];let w;e[2]!==r?(w={live:!0,shardKey:r},e[2]=r,e[3]=w):w=e[3];const{data:m,error:u,errorSource:h,isLoading:T,liveError:_}=oe(ie.getTraces,v,w);let S;e[4]===Symbol.for("react.memo_cache_sentinel")?(S={},e[4]=S):S=e[4];const g=$.size>0;let b;e[5]!==r||e[6]!==g?(b={enabled:g,live:!0,shardKey:r},e[5]=r,e[6]=g,e[7]=b):b=e[7];const{data:I}=oe(ie.getLogs,S,b);let p,x;e[8]!==m||e[9]!==r?(p=()=>{m!==void 0&&_e(r)},x=[m,r],e[8]=m,e[9]=r,e[10]=p,e[11]=x):(p=e[10],x=e[11]),le(p,x);let D;if(e[12]!==m||e[13]!==u||e[14]!==h||e[15]!==$||e[16]!==T||e[17]!==_||e[18]!==I?.entries||e[19]!==c||e[20]!==r||e[21]!==d||e[22]!==o||e[23]!==i||e[24]!==s){const L=qe(m),A=m?.total??L.length,j=A>L.length,K=Ee(L,d,c),B=Map.groupBy((I?.entries??[]).toReversed(),Ve);let C;e[26]===Symbol.for("react.memo_cache_sentinel")?(C=R=>{f(R.target.value)},e[26]=C):C=e[26];const O=C;let E;e[27]===Symbol.for("react.memo_cache_sentinel")?(E=R=>{M(he=>{const ae=new Set(he);return ae.has(R)?ae.delete(R):ae.add(R),ae})},e[27]=E):E=e[27];const W=E,F=u===null&&K.length===0&&!T;let P;e[28]!==o||e[29]!==i?(P=n(xe,{onChange:o,testId:"tr-shard-input",value:i}),e[28]=o,e[29]=i,e[30]=P):P=e[30];let z;e[31]!==s?(z=s("Search traces"),e[31]=s,e[32]=z):z=e[32];let G;e[33]!==s?(G=s("search trace, span, or function"),e[33]=s,e[34]=G):G=e[34];let H;e[35]!==d||e[36]!==z||e[37]!==G?(H=n(ve,{"aria-label":z,className:"h-8 w-56","data-testid":"tr-search",onChange:O,placeholder:G,value:d}),e[35]=d,e[36]=z,e[37]=G,e[38]=H):H=e[38];let J;e[39]!==c?(J=n(ye,{checked:c,"data-testid":"tr-only-errors",id:"tr-only-errors",onCheckedChange:y}),e[39]=c,e[40]=J):J=e[40];let Q;e[41]!==s?(Q=s("Errors only"),e[41]=s,e[42]=Q):Q=e[42];let V;e[43]!==J||e[44]!==Q?(V=k("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",htmlFor:"tr-only-errors",children:[J,Q]}),e[43]=J,e[44]=Q,e[45]=V):V=e[45];let X;e[46]!==_?(X=n(be,{message:_,prefix:"tr"}),e[46]=_,e[47]=X):X=e[47];let te;e[48]!==P||e[49]!==H||e[50]!==V||e[51]!==X?(te=k("div",{className:"flex flex-wrap items-center gap-2",children:[P,H,V,X]}),e[48]=P,e[49]=H,e[50]=V,e[51]=X,e[52]=te):te=e[52];let re;e[53]!==u||e[54]!==h||e[55]!==r?(re=u!==null&&n(ge,{error:h,shardKey:r,testId:"tr-error"}),e[53]=u,e[54]=h,e[55]=r,e[56]=re):re=e[56];let se;e[57]!==F||e[58]!==s?(se=F&&n(Ne,{description:s("Traces recorded with ctx.trace show up here as your app handles traffic. The span buffer resets when the shard hibernates."),icon:n("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:n("path",{d:"M4 6h10M7 12h13M10 18h7"})}),testId:"tr-empty",title:s("No traces")}),e[57]=F,e[58]=s,e[59]=se):se=e[59],D=k("div",{className:"flex flex-col gap-4","data-testid":"lunora-traces-panel",children:[te,re,se,u===null&&j&&n("p",{className:"text-xs text-muted-foreground","data-testid":"tr-truncated",children:s("Showing the {shown} most recent of {total} traces in the buffer.",{shown:L.length,total:A})}),u===null&&K.length>0&&n("div",{"aria-label":s("Recent traces"),className:"overflow-hidden rounded-xl border border-border shadow-xs","data-testid":"tr-list",children:K.map(R=>n(Ge,{expanded:$.has(R.traceId),logs:B.get(R.traceId)??[],onToggle:W,trace:R},R.traceId))})]}),e[12]=m,e[13]=u,e[14]=h,e[15]=$,e[16]=T,e[17]=_,e[18]=I?.entries,e[19]=c,e[20]=r,e[21]=d,e[22]=o,e[23]=i,e[24]=s,e[25]=D}else D=e[25];return D};function He(a,e){return n("div",{className:"flex items-center border-b border-border py-1 font-mono text-xs last:border-b-0","data-testid":"tr-log-row",role:"row",children:n(Me,{entry:a})},`${String(e)}:${String(a.timestamp)}`)}function Je(){return new Set}function Qe(){ke()}function Ve(a){return a.traceId}export{bt as default};
|