@lunora/studio 1.0.0-alpha.59 → 1.0.0-alpha.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -43
- package/dist/mount.js +1 -27
- package/dist/packem_chunks/ApiTab.js +1 -251
- package/dist/packem_chunks/AuditPanel.js +1 -200
- package/dist/packem_chunks/DeploymentHealthPanel.js +1 -664
- package/dist/packem_chunks/ExportImportPanel.js +3 -198
- package/dist/packem_chunks/FileBrowser.js +4 -2955
- package/dist/packem_chunks/FunctionRunner.js +1 -326
- package/dist/packem_chunks/FunctionStatsPanel.js +1 -377
- package/dist/packem_chunks/HealthPanel.js +1 -648
- package/dist/packem_chunks/InsightsPanel.js +1 -462
- package/dist/packem_chunks/LogsPanel.js +1 -1303
- package/dist/packem_chunks/MailPanel.js +2 -353
- package/dist/packem_chunks/MetricsPanel.js +1 -1960
- package/dist/packem_chunks/MigrationsPanel.js +1 -239
- package/dist/packem_chunks/NotificationsPanel.js +1 -306
- package/dist/packem_chunks/PitrPanel.js +1 -252
- package/dist/packem_chunks/SchemaViewer.js +1 -2512
- package/dist/packem_chunks/SecurityAdvisorPanel.js +1 -95
- package/dist/packem_chunks/SettingsPanel.js +1 -391
- package/dist/packem_chunks/SqlEditorPanel.js +4 -2340
- package/dist/packem_chunks/TableEditor.js +1 -290
- package/dist/packem_chunks/agents-panel.js +1 -326
- package/dist/packem_chunks/analytics-panel.js +1 -261
- package/dist/packem_chunks/auth-audit-panel.js +1 -247
- package/dist/packem_chunks/auth-config-panel.js +1 -365
- package/dist/packem_chunks/auth-sessions-panel.js +1 -175
- package/dist/packem_chunks/containers-panel.js +1 -261
- package/dist/packem_chunks/dashboards-panel.js +1 -781
- package/dist/packem_chunks/fanout-panel.js +1 -482
- package/dist/packem_chunks/flags-panel.js +1 -176
- package/dist/packem_chunks/issues-panel.js +1 -427
- package/dist/packem_chunks/kv-browser.js +1 -1896
- package/dist/packem_chunks/log-drains-panel.js +4 -273
- package/dist/packem_chunks/organizations-panel.js +1 -3209
- package/dist/packem_chunks/payments-panel.js +1 -213
- package/dist/packem_chunks/permissions-panel.js +1 -805
- package/dist/packem_chunks/queues-panel.js +1 -1075
- package/dist/packem_chunks/rls-panel.js +1 -315
- package/dist/packem_chunks/schedule-panel.js +1 -831
- package/dist/packem_chunks/sparkline.js +1 -79
- package/dist/packem_chunks/storage-rules-panel.js +1 -140
- package/dist/packem_chunks/subscriptions-panel.js +1 -238
- package/dist/packem_chunks/sync-client-panel.js +1 -0
- package/dist/packem_chunks/traces-panel.js +1 -747
- package/dist/packem_chunks/users-panel.js +1 -1731
- package/dist/packem_chunks/vector-browser.js +1 -281
- package/dist/packem_chunks/workflows-panel.js +1 -562
- package/dist/packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js +1 -0
- package/dist/packem_shared/ApiDocsPanel-eJYZlylw.js +2 -0
- package/dist/packem_shared/ApiReferencePanel-C42v1jr6.js +1 -0
- package/dist/packem_shared/CommandPalette-CVIaY3j8.js +1 -0
- package/dist/packem_shared/ConfirmButton-CTL3f3kr.js +1 -0
- package/dist/packem_shared/ConnectionBadge-DOk0CQWo.js +1 -0
- package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-BCC8_4BQ.js +1 -0
- package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-B-hcFVoi.js +1 -0
- package/dist/packem_shared/DEFAULT_LOCALE-BZ4NojpD.js +1 -0
- package/dist/packem_shared/DataBrowser-B8J5lHjP.js +1 -0
- package/dist/packem_shared/DataFilters-Csb30F0C.js +1 -0
- package/dist/packem_shared/ErrorBoundary-DvzYskH7.js +1 -0
- package/dist/packem_shared/GlobalDataBrowser-RLJ6NvOs.js +1 -0
- package/dist/packem_shared/HomePanel-DL1HupAN.js +1 -0
- package/dist/packem_shared/OpenRpcReferencePanel-sGsIgYWj.js +1 -0
- package/dist/packem_shared/STUDIO_ROOT_CLASS-C6MccdVk.js +1 -0
- package/dist/packem_shared/ScheduledJobs-DUbo6epc.js +1 -0
- package/dist/packem_shared/ShardInput-BVn2iCU0.js +1 -0
- package/dist/packem_shared/Studio-BWBclm_C.js +1 -0
- package/dist/packem_shared/StudioApp-BFm73yVr.js +1 -0
- package/dist/packem_shared/StudioI18nProvider-CZ5h4nrV.js +1 -0
- package/dist/packem_shared/advisor-view-DaCX9Jy5.js +1 -0
- package/dist/packem_shared/aggregateMetrics-BNfajLa2.js +1 -0
- package/dist/packem_shared/alert-CVcOFuDR.js +1 -0
- package/dist/packem_shared/badge-BbuuAio7.js +1 -0
- package/dist/packem_shared/bar-chart-AryFCeoa.js +9 -0
- package/dist/packem_shared/browser-storage-xjTyMKY0.js +1 -0
- package/dist/packem_shared/button-BkCrNcAs.js +1 -0
- package/dist/packem_shared/card-CIDGUN6K.js +1 -0
- package/dist/packem_shared/cf-links-gbDy51nR.js +1 -0
- package/dist/packem_shared/checkbox-StT4Gob6.js +1 -0
- package/dist/packem_shared/data-grid-BMBKzMEJ.js +1 -0
- package/dist/packem_shared/data-view-params-C8T3bW1z.js +1 -0
- package/dist/packem_shared/dropdown-menu-C3RQ_HlW.js +2 -0
- package/dist/packem_shared/empty-state-Cg7t_8qu.js +1 -0
- package/dist/packem_shared/error-alert-B59DnrDI.js +1 -0
- package/dist/packem_shared/grid-features-uZCUj955.js +6 -0
- package/dist/packem_shared/home-panel-B-8BCffw.js +3 -0
- package/dist/packem_shared/input-JHu63lTv.js +1 -0
- package/dist/packem_shared/internal-AtZ4bTal.js +2 -0
- package/dist/packem_shared/label-6uP1obNF.js +1 -0
- package/dist/packem_shared/live-status-CGW2JHf_.js +1 -0
- package/dist/packem_shared/log-fields-CoL3hsIQ.js +1 -0
- package/dist/packem_shared/modal-shell-CUwwWC2o.js +1 -0
- package/dist/packem_shared/reference-view-KvhektwF.js +12 -0
- package/dist/packem_shared/result-chart-CwKhhKM0.js +1 -0
- package/dist/packem_shared/scroll-area-DTEq6Jec.js +2 -0
- package/dist/packem_shared/select-Bul-DeII.js +2 -0
- package/dist/packem_shared/shard-history-DMEW5VBE.js +1 -0
- package/dist/packem_shared/skeleton-C1wQ9M5t.js +1 -0
- package/dist/packem_shared/sparkline-DtcZoU48.js +1 -0
- package/dist/packem_shared/storage-tier-DznqOf-q.js +1 -0
- package/dist/packem_shared/studio-BHA7hnI3.js +2 -0
- package/dist/packem_shared/table-DdJBrClo.js +2 -0
- package/dist/packem_shared/table-list-sidebar-CMCcNALK.js +1 -0
- package/dist/packem_shared/textarea-Bu2-jKAs.js +1 -0
- package/dist/packem_shared/trace-handoff-Dw7mwjxu.js +1 -0
- package/dist/packem_shared/use-admin-query-Di3fLE8H.js +1 -0
- package/dist/packem_shared/use-async-submit-H68GHPz8.js +1 -0
- package/dist/packem_shared/useDebounced-Ihdiid_k.js +1 -0
- package/dist/packem_shared/utils-bhneXptQ.js +1 -0
- package/dist/packem_shared/virtual-rect-1o1veP7R.js +1 -0
- package/dist/standalone/chunk-23HKRH5H.js +13 -0
- package/dist/standalone/chunk-2A4RKII2.js +1 -0
- package/dist/standalone/chunk-3DTM4GI5.js +1 -0
- package/dist/standalone/chunk-3MHKT76P.js +1 -0
- package/dist/standalone/chunk-46IB4C4Q.js +1 -0
- package/dist/standalone/chunk-4AYEV5UN.js +1 -0
- package/dist/standalone/chunk-4FNHHFWR.js +1 -0
- package/dist/standalone/chunk-6CLVIOCB.js +1 -0
- package/dist/standalone/chunk-6I62RSI5.js +1 -0
- package/dist/standalone/chunk-6OKDCV7J.js +1 -0
- package/dist/standalone/chunk-6P7HIPUE.js +1 -0
- package/dist/standalone/chunk-6UYILUSX.js +1 -0
- package/dist/standalone/chunk-725RLB7D.js +1 -0
- package/dist/standalone/chunk-7AZZ7OJO.js +1 -0
- package/dist/standalone/chunk-7CRLAMGB.js +1 -0
- package/dist/standalone/chunk-7Z5QEFR4.js +2 -0
- package/dist/standalone/chunk-AGVJJQFL.js +1 -0
- package/dist/standalone/chunk-AKTGRZXN.js +1 -0
- package/dist/standalone/chunk-BAIN7UJ4.js +1 -0
- package/dist/standalone/chunk-BHWSIIDT.js +1 -0
- package/dist/standalone/{chunk-L7SK4ZZD.js → chunk-C4O5UR4Y.js} +1 -1
- package/dist/standalone/chunk-C4VURT57.js +1 -0
- package/dist/standalone/chunk-CKO3F55C.js +4 -0
- package/dist/standalone/chunk-CVMRZUF5.js +4 -0
- package/dist/standalone/chunk-CWWGDW4V.js +1 -0
- package/dist/standalone/chunk-CYET4BRZ.js +1 -0
- package/dist/standalone/chunk-CZEUVNCQ.js +1 -0
- package/dist/standalone/chunk-FXFK4M4E.js +1 -0
- package/dist/standalone/chunk-FYAJPWE7.js +1 -0
- package/dist/standalone/chunk-GS7OBQO5.js +1 -0
- package/dist/standalone/chunk-GTXVH7I5.js +1 -0
- package/dist/standalone/chunk-H6SIM4BT.js +1 -0
- package/dist/standalone/chunk-H6WOFY6A.js +8 -0
- package/dist/standalone/chunk-HA34GYEX.js +1 -0
- package/dist/standalone/chunk-HMIOF5GV.js +1 -0
- package/dist/standalone/chunk-HY46NTNW.js +6 -0
- package/dist/standalone/chunk-IBCKC2BO.js +1 -0
- package/dist/standalone/chunk-ICKBVXPP.js +1 -0
- package/dist/standalone/chunk-IE4ROTQD.js +1 -0
- package/dist/standalone/chunk-IYYTWZ2E.js +2 -0
- package/dist/standalone/chunk-J2LMP2A7.js +1 -0
- package/dist/standalone/chunk-JC6WYIHM.js +1 -0
- package/dist/standalone/chunk-JKPK25JO.js +1 -0
- package/dist/standalone/chunk-JLFCXBNQ.js +1 -0
- package/dist/standalone/chunk-JRWBGR5B.js +1 -0
- package/dist/standalone/chunk-K5PFWU5J.js +1 -0
- package/dist/standalone/chunk-KJTLW5W2.js +11 -0
- package/dist/standalone/{chunk-HBGS4SEX.js → chunk-KLLYGWNF.js} +9 -9
- package/dist/standalone/chunk-KNN3ZEQ7.js +1 -0
- package/dist/standalone/{chunk-4QHKBC77.js → chunk-KOC5KV3E.js} +1 -1
- package/dist/standalone/chunk-KSRXMTBV.js +1 -0
- package/dist/standalone/chunk-KYCAYNXM.js +1 -0
- package/dist/standalone/chunk-KZ2YUNMR.js +1 -0
- package/dist/standalone/chunk-LKHUVEHX.js +1 -0
- package/dist/standalone/chunk-LPOKAJT4.js +4 -0
- package/dist/standalone/chunk-MZEK4SGD.js +1 -0
- package/dist/standalone/chunk-NCCUM26H.js +1 -0
- package/dist/standalone/chunk-O62HJZV3.js +1 -0
- package/dist/standalone/chunk-OTJOI23O.js +62 -0
- package/dist/standalone/chunk-P2NBOUGZ.js +1 -0
- package/dist/standalone/chunk-P4J6XNG3.js +1 -0
- package/dist/standalone/chunk-PGDWFWH5.js +1 -0
- package/dist/standalone/chunk-PR2SE2MD.js +1 -0
- package/dist/standalone/chunk-PTTDIYGP.js +1 -0
- package/dist/standalone/chunk-PWDMXMRD.js +1 -0
- package/dist/standalone/chunk-Q34MSC2F.js +1 -0
- package/dist/standalone/chunk-Q5WXTZWX.js +1 -0
- package/dist/standalone/chunk-QC5HCNJZ.js +4 -0
- package/dist/standalone/chunk-QJKRHZYV.js +1 -0
- package/dist/standalone/chunk-R43KHQDA.js +1 -0
- package/dist/standalone/chunk-RC2K5RBE.js +1 -0
- package/dist/standalone/chunk-RE6UWCMG.js +1 -0
- package/dist/standalone/chunk-RUP3M2GF.js +3 -0
- package/dist/standalone/chunk-SA6MBPBL.js +1 -0
- package/dist/standalone/{chunk-BJGBHGK3.js → chunk-SEDZDNQF.js} +1 -1
- package/dist/standalone/chunk-SKHEGARW.js +1 -0
- package/dist/standalone/chunk-SKJZDOHG.js +1 -0
- package/dist/standalone/chunk-SNDYNCAA.js +1 -0
- package/dist/standalone/chunk-SZUHZ2OG.js +1 -0
- package/dist/standalone/chunk-TAE2H7PU.js +1 -0
- package/dist/standalone/chunk-TEIBKU46.js +1 -0
- package/dist/standalone/chunk-TO6NLVFD.js +1 -0
- package/dist/standalone/chunk-TYTJDFX2.js +1 -0
- package/dist/standalone/{chunk-LXULVPEM.js → chunk-UDZY7MKE.js} +3 -3
- package/dist/standalone/chunk-UHHTEBC3.js +1 -0
- package/dist/standalone/chunk-UNDFOYRI.js +1 -0
- package/dist/standalone/chunk-UNN4CESU.js +1 -0
- package/dist/standalone/chunk-UNXX5GQH.js +1 -0
- package/dist/standalone/{chunk-ZHVTQ37P.js → chunk-UREY4GLG.js} +1 -1
- package/dist/standalone/chunk-UWF5DOGV.js +1 -0
- package/dist/standalone/chunk-UY2Y5CXB.js +1 -0
- package/dist/standalone/{chunk-VLXV72QE.js → chunk-UZYGEOWY.js} +1 -1
- package/dist/standalone/chunk-V66TSUKV.js +1 -0
- package/dist/standalone/chunk-VEFNSN7P.js +1 -0
- package/dist/standalone/chunk-VUJGR4PB.js +1 -0
- package/dist/standalone/chunk-VUXJER3D.js +1 -0
- package/dist/standalone/chunk-W572365D.js +1 -0
- package/dist/standalone/chunk-WYFLGXZ3.js +3 -0
- package/dist/standalone/chunk-XDKFPBIL.js +1 -0
- package/dist/standalone/chunk-XRKCGQM2.js +1 -0
- package/dist/standalone/chunk-YNBJ6ICE.js +1 -0
- package/dist/standalone/chunk-YQ5PILIJ.js +1 -0
- package/dist/standalone/chunk-YT7VXQVX.js +1 -0
- package/dist/standalone/chunk-Z7MUQMLE.js +1 -0
- package/dist/standalone/chunk-ZFWEPGWG.js +1 -0
- package/dist/standalone/chunk-ZMFZRGAN.js +1 -0
- package/dist/standalone/studio.js +9 -214
- package/package.json +4 -4
- package/dist/packem_shared/ADMIN_FUNCTIONS-P2UzJscH.js +0 -62
- package/dist/packem_shared/ApiDocsPanel-DNDpeR5O.js +0 -842
- package/dist/packem_shared/ApiReferencePanel-ChlRsAXU.js +0 -230
- package/dist/packem_shared/CommandPalette-BpkopP5f.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-obTn4sKX.js +0 -4493
- package/dist/packem_shared/DataFilters-B1Q7mrt7.js +0 -253
- package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +0 -66
- package/dist/packem_shared/GlobalDataBrowser-BCaohHZ5.js +0 -293
- package/dist/packem_shared/HomePanel-DCRj3hGB.js +0 -14
- package/dist/packem_shared/OpenRpcReferencePanel-CIeQE1aE.js +0 -192
- package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +0 -3
- package/dist/packem_shared/ScheduledJobs-BQzQo84k.js +0 -262
- package/dist/packem_shared/ShardInput-CZnpHILL.js +0 -107
- package/dist/packem_shared/Studio-DnlPCbID.js +0 -16
- package/dist/packem_shared/StudioApp-CzqlB4zO.js +0 -708
- package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +0 -48
- package/dist/packem_shared/advisor-view-D95sN-wO.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/badge-B2PKA1-5.js +0 -49
- package/dist/packem_shared/bar-chart-DSwcWIRy.js +0 -3246
- package/dist/packem_shared/browser-storage-L4gOP5gJ.js +0 -105
- package/dist/packem_shared/button-BhsN2uZH.js +0 -49
- package/dist/packem_shared/card-F2vH_aj2.js +0 -175
- package/dist/packem_shared/cf-links-SIbyi4Y1.js +0 -8
- package/dist/packem_shared/checkbox-UNkzAxl-.js +0 -63
- package/dist/packem_shared/data-grid-BywzWfek.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-D9uIFJUS.js +0 -114
- package/dist/packem_shared/grid-features-ZOLhHKrR.js +0 -809
- package/dist/packem_shared/home-panel-BRAA2UlM.js +0 -1889
- package/dist/packem_shared/input-XH4r1Pt1.js +0 -53
- package/dist/packem_shared/internal-DzHCc2Rq.js +0 -131
- package/dist/packem_shared/label-D8ykjn5J.js +0 -46
- package/dist/packem_shared/live-status-FZ0psC1z.js +0 -44
- package/dist/packem_shared/log-fields-jEH83H2G.js +0 -18
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +0 -100
- package/dist/packem_shared/reference-view-DfXN7oWP.js +0 -2127
- package/dist/packem_shared/result-chart-Bf9mbCIo.js +0 -119
- package/dist/packem_shared/scroll-area-DLhcy-ml.js +0 -93
- package/dist/packem_shared/select-D9OwHEch.js +0 -273
- package/dist/packem_shared/shard-history-AxiJ1WPP.js +0 -16
- 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-8QSXbZ98.js +0 -4192
- package/dist/packem_shared/table-DsCa9Qp9.js +0 -246
- package/dist/packem_shared/table-list-sidebar-gCE17v9B.js +0 -842
- package/dist/packem_shared/textarea-D3gaCU_-.js +0 -46
- package/dist/packem_shared/trace-handoff-CGolF3KS.js +0 -38
- package/dist/packem_shared/use-admin-query-C7JNuQp-.js +0 -106
- package/dist/packem_shared/use-async-submit-rnSk_jXl.js +0 -91
- 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-2K47A3P6.js +0 -1
- package/dist/standalone/chunk-2MLA6WFH.js +0 -1
- package/dist/standalone/chunk-2NGUNNGW.js +0 -1
- package/dist/standalone/chunk-2TJVFKD2.js +0 -1
- package/dist/standalone/chunk-2YTF6LJ6.js +0 -1
- package/dist/standalone/chunk-3GXGLNKW.js +0 -1
- package/dist/standalone/chunk-3HGNPZBN.js +0 -1
- package/dist/standalone/chunk-3LJEGSMK.js +0 -11
- package/dist/standalone/chunk-3OA7PECS.js +0 -6
- package/dist/standalone/chunk-4PC7IXNY.js +0 -1
- package/dist/standalone/chunk-56XQYNUJ.js +0 -1
- package/dist/standalone/chunk-5OIBXYZM.js +0 -1
- package/dist/standalone/chunk-5QT5JRXD.js +0 -3
- package/dist/standalone/chunk-6RLPR7PL.js +0 -1
- package/dist/standalone/chunk-6V74EUPK.js +0 -1
- package/dist/standalone/chunk-7EE33WLB.js +0 -1
- package/dist/standalone/chunk-7TJJXVSE.js +0 -1
- package/dist/standalone/chunk-AHILM3ZP.js +0 -1
- package/dist/standalone/chunk-AN4RKMKW.js +0 -1
- package/dist/standalone/chunk-APSSZB6Z.js +0 -1
- package/dist/standalone/chunk-AXNGWSBM.js +0 -1
- package/dist/standalone/chunk-AXZILWRM.js +0 -1
- package/dist/standalone/chunk-C7RHEBOH.js +0 -1
- package/dist/standalone/chunk-CKSHCYGC.js +0 -2
- package/dist/standalone/chunk-CSWIYOB3.js +0 -1
- package/dist/standalone/chunk-D3VAON25.js +0 -1
- package/dist/standalone/chunk-DDLQN67F.js +0 -1
- package/dist/standalone/chunk-DGHW5JG5.js +0 -1
- package/dist/standalone/chunk-DMCSOTAE.js +0 -3
- package/dist/standalone/chunk-E3BKETAS.js +0 -1
- package/dist/standalone/chunk-E3OXNN6O.js +0 -1
- package/dist/standalone/chunk-E6BOGDIS.js +0 -1
- package/dist/standalone/chunk-F2YMCQ6B.js +0 -1
- package/dist/standalone/chunk-F7GE4X2U.js +0 -1
- package/dist/standalone/chunk-FAVUOGJR.js +0 -1
- package/dist/standalone/chunk-FXP6256Q.js +0 -1
- package/dist/standalone/chunk-G6CTAYHJ.js +0 -1
- package/dist/standalone/chunk-GTM65MVX.js +0 -1
- package/dist/standalone/chunk-H42W62SE.js +0 -1
- package/dist/standalone/chunk-HTF5ZX4I.js +0 -8
- package/dist/standalone/chunk-HV7G6DFP.js +0 -5
- package/dist/standalone/chunk-I2PS4L74.js +0 -1
- package/dist/standalone/chunk-IYHPYY4A.js +0 -1
- package/dist/standalone/chunk-J6J54MBP.js +0 -1
- package/dist/standalone/chunk-J7OGP4NN.js +0 -1
- package/dist/standalone/chunk-JSEXCW5Q.js +0 -1
- package/dist/standalone/chunk-JZLGLG4T.js +0 -1
- package/dist/standalone/chunk-KEGAWN6Y.js +0 -1
- package/dist/standalone/chunk-KZ6INM5M.js +0 -1
- package/dist/standalone/chunk-L2LN3MK4.js +0 -4
- package/dist/standalone/chunk-LT3FH6MW.js +0 -1
- package/dist/standalone/chunk-LZUWZBPE.js +0 -1
- package/dist/standalone/chunk-M4JM3TOY.js +0 -1
- package/dist/standalone/chunk-MLA5ZAEB.js +0 -1
- package/dist/standalone/chunk-MRBI5HNQ.js +0 -1
- package/dist/standalone/chunk-N5XX4HOL.js +0 -6
- package/dist/standalone/chunk-N7SVJOHN.js +0 -1
- package/dist/standalone/chunk-NKFXMDOD.js +0 -1
- package/dist/standalone/chunk-NPSNKFHE.js +0 -1
- package/dist/standalone/chunk-O3NAGRTR.js +0 -1
- package/dist/standalone/chunk-O7FVPUCO.js +0 -1
- package/dist/standalone/chunk-OKQXTLFX.js +0 -1
- package/dist/standalone/chunk-OXHHSUXO.js +0 -1
- package/dist/standalone/chunk-QAFAJBAW.js +0 -1
- package/dist/standalone/chunk-QAIM6KWT.js +0 -1
- package/dist/standalone/chunk-QCPMTB6W.js +0 -1
- package/dist/standalone/chunk-QQ2LOSZL.js +0 -1
- package/dist/standalone/chunk-QVIPA6UJ.js +0 -1
- package/dist/standalone/chunk-QVUQXJCT.js +0 -4
- package/dist/standalone/chunk-R2GMHLJY.js +0 -1
- package/dist/standalone/chunk-RD5UG2YL.js +0 -1
- package/dist/standalone/chunk-RJTIP3WF.js +0 -1
- package/dist/standalone/chunk-RRCPZMC2.js +0 -22
- package/dist/standalone/chunk-SHERR7ZP.js +0 -1
- package/dist/standalone/chunk-SOC5CY3F.js +0 -1
- package/dist/standalone/chunk-SS7JLF2I.js +0 -4
- package/dist/standalone/chunk-SWWYUGPL.js +0 -2
- package/dist/standalone/chunk-TAD43CG5.js +0 -1
- package/dist/standalone/chunk-TTXRHJUP.js +0 -4
- package/dist/standalone/chunk-UK64ZSUW.js +0 -1
- package/dist/standalone/chunk-UKDHGVOC.js +0 -1
- package/dist/standalone/chunk-UPNTMJFF.js +0 -1
- package/dist/standalone/chunk-V43BLH4J.js +0 -1
- package/dist/standalone/chunk-VL23Y44O.js +0 -4
- package/dist/standalone/chunk-VXM5H542.js +0 -4
- package/dist/standalone/chunk-WMDH2CIZ.js +0 -1
- package/dist/standalone/chunk-WVTPZ6CM.js +0 -1
- package/dist/standalone/chunk-XN6QYJQ6.js +0 -13
- package/dist/standalone/chunk-XNJNSCLM.js +0 -1
- package/dist/standalone/chunk-Y4U6CC22.js +0 -1
- package/dist/standalone/chunk-Y572GMZE.js +0 -1
- package/dist/standalone/chunk-Y7PD5KP4.js +0 -76
- package/dist/standalone/chunk-YFIPHCEC.js +0 -1
- package/dist/standalone/chunk-YJXOWLFJ.js +0 -1
- package/dist/standalone/chunk-YNN6NFRZ.js +0 -1
- package/dist/standalone/chunk-YUGHRVPD.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-TEWVD66F.js → chunk-GXZAXNZI.js} +0 -0
|
@@ -1,805 +1 @@
|
|
|
1
|
-
import { useState, useRef, useEffect } from 'react';
|
|
2
|
-
import { C as Card, c as CardHeader, b as CardTitle, d as CardDescription, a as CardContent } from '../packem_shared/card-F2vH_aj2.js';
|
|
3
|
-
import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
4
|
-
import { c } from 'react/compiler-runtime';
|
|
5
|
-
import { E as ErrorAlert } from '../packem_shared/error-alert-D9uIFJUS.js';
|
|
6
|
-
import { L as LiveError } from '../packem_shared/live-status-FZ0psC1z.js';
|
|
7
|
-
import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
|
|
8
|
-
import { B as Button } from '../packem_shared/button-BhsN2uZH.js';
|
|
9
|
-
import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
|
|
10
|
-
import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from '../packem_shared/table-DsCa9Qp9.js';
|
|
11
|
-
import { u as useAdminQuery } from '../packem_shared/use-admin-query-C7JNuQp-.js';
|
|
12
|
-
import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-P2UzJscH.js';
|
|
13
|
-
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
14
|
-
import { useLunora } from '@lunora/react';
|
|
15
|
-
import { ShardInput } from '../packem_shared/ShardInput-CZnpHILL.js';
|
|
16
|
-
import { I as Input } from '../packem_shared/input-XH4r1Pt1.js';
|
|
17
|
-
import { L as Label } from '../packem_shared/label-D8ykjn5J.js';
|
|
18
|
-
import { T as Textarea } from '../packem_shared/textarea-D3gaCU_-.js';
|
|
19
|
-
import { c as callOptions, a as adminRef, e as errorMessage, f as fireAndForget } from '../packem_shared/internal-DzHCc2Rq.js';
|
|
20
|
-
|
|
21
|
-
const OPERATIONS = ["read", "insert", "update", "delete"];
|
|
22
|
-
const operationLabel = (t, operation) => ({
|
|
23
|
-
delete: t("Delete"),
|
|
24
|
-
insert: t("Insert"),
|
|
25
|
-
read: t("Read"),
|
|
26
|
-
update: t("Update")
|
|
27
|
-
})[operation];
|
|
28
|
-
const uncoveredTables = (advisories) => {
|
|
29
|
-
const set = /* @__PURE__ */ new Set();
|
|
30
|
-
for (const advisory of advisories?.advisories ?? []) {
|
|
31
|
-
if (advisory.name === "rls_uncovered_table") {
|
|
32
|
-
const {
|
|
33
|
-
table
|
|
34
|
-
} = advisory.metadata;
|
|
35
|
-
if (typeof table === "string" && table !== "") {
|
|
36
|
-
set.add(table);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return set;
|
|
41
|
-
};
|
|
42
|
-
const buildRows = (policies, maskColumns, uncovered) => {
|
|
43
|
-
const byTable = /* @__PURE__ */ new Map();
|
|
44
|
-
const ensure = (table) => {
|
|
45
|
-
const existing = byTable.get(table);
|
|
46
|
-
if (existing !== void 0) {
|
|
47
|
-
return existing;
|
|
48
|
-
}
|
|
49
|
-
const row = {
|
|
50
|
-
cells: {
|
|
51
|
-
delete: {},
|
|
52
|
-
insert: {},
|
|
53
|
-
read: {},
|
|
54
|
-
update: {}
|
|
55
|
-
},
|
|
56
|
-
maskedColumns: [],
|
|
57
|
-
table,
|
|
58
|
-
uncovered: uncovered.has(table)
|
|
59
|
-
};
|
|
60
|
-
byTable.set(table, row);
|
|
61
|
-
return row;
|
|
62
|
-
};
|
|
63
|
-
for (const policy of policies) {
|
|
64
|
-
ensure(policy.table).cells[policy.on] = {
|
|
65
|
-
procedure: policy.procedure
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
for (const column of maskColumns) {
|
|
69
|
-
const row = ensure(column.table);
|
|
70
|
-
if (!row.maskedColumns.includes(column.column)) {
|
|
71
|
-
row.maskedColumns.push(column.column);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
for (const table of uncovered) {
|
|
75
|
-
ensure(table);
|
|
76
|
-
}
|
|
77
|
-
return [...byTable.values()].toSorted((a, b) => a.table.localeCompare(b.table));
|
|
78
|
-
};
|
|
79
|
-
const PermissionsMatrix = (t0) => {
|
|
80
|
-
const $ = c(17);
|
|
81
|
-
let t1;
|
|
82
|
-
if ($[0] !== t0) {
|
|
83
|
-
t1 = t0 === void 0 ? {} : t0;
|
|
84
|
-
$[0] = t0;
|
|
85
|
-
$[1] = t1;
|
|
86
|
-
} else {
|
|
87
|
-
t1 = $[1];
|
|
88
|
-
}
|
|
89
|
-
const {
|
|
90
|
-
onProbe
|
|
91
|
-
} = t1;
|
|
92
|
-
const t = useT();
|
|
93
|
-
let t2;
|
|
94
|
-
let t3;
|
|
95
|
-
if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
96
|
-
t2 = {};
|
|
97
|
-
t3 = {
|
|
98
|
-
live: true
|
|
99
|
-
};
|
|
100
|
-
$[2] = t2;
|
|
101
|
-
$[3] = t3;
|
|
102
|
-
} else {
|
|
103
|
-
t2 = $[2];
|
|
104
|
-
t3 = $[3];
|
|
105
|
-
}
|
|
106
|
-
const policiesQuery = useAdminQuery(ADMIN_FUNCTIONS.rlsPolicies, t2, t3);
|
|
107
|
-
let t4;
|
|
108
|
-
if ($[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
109
|
-
t4 = {};
|
|
110
|
-
$[4] = t4;
|
|
111
|
-
} else {
|
|
112
|
-
t4 = $[4];
|
|
113
|
-
}
|
|
114
|
-
const masksQuery = useAdminQuery(ADMIN_FUNCTIONS.maskPolicies, t4);
|
|
115
|
-
let t5;
|
|
116
|
-
if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
117
|
-
t5 = {};
|
|
118
|
-
$[5] = t5;
|
|
119
|
-
} else {
|
|
120
|
-
t5 = $[5];
|
|
121
|
-
}
|
|
122
|
-
const advisoriesQuery = useAdminQuery(ADMIN_FUNCTIONS.getAdvisories, t5);
|
|
123
|
-
let t6;
|
|
124
|
-
if ($[6] !== advisoriesQuery.data || $[7] !== masksQuery.data || $[8] !== onProbe || $[9] !== policiesQuery || $[10] !== t) {
|
|
125
|
-
let policies = null;
|
|
126
|
-
if (policiesQuery.data !== void 0) {
|
|
127
|
-
policies = Array.isArray(policiesQuery.data.policies) ? policiesQuery.data.policies : [];
|
|
128
|
-
}
|
|
129
|
-
const maskColumns = Array.isArray(masksQuery.data?.columns) ? masksQuery.data.columns : [];
|
|
130
|
-
const advisories = advisoriesQuery.data ?? null;
|
|
131
|
-
const {
|
|
132
|
-
error,
|
|
133
|
-
errorSource,
|
|
134
|
-
liveError
|
|
135
|
-
} = policiesQuery;
|
|
136
|
-
const rows = policies === null ? [] : buildRows(policies, maskColumns, uncoveredTables(advisories));
|
|
137
|
-
let t7;
|
|
138
|
-
if ($[12] !== liveError) {
|
|
139
|
-
t7 = /* @__PURE__ */ jsxDEV("div", {
|
|
140
|
-
className: "flex items-center justify-end",
|
|
141
|
-
children: /* @__PURE__ */ jsxDEV(LiveError, {
|
|
142
|
-
message: liveError,
|
|
143
|
-
prefix: "pm"
|
|
144
|
-
}, void 0, false)
|
|
145
|
-
}, void 0, false);
|
|
146
|
-
$[12] = liveError;
|
|
147
|
-
$[13] = t7;
|
|
148
|
-
} else {
|
|
149
|
-
t7 = $[13];
|
|
150
|
-
}
|
|
151
|
-
let t8;
|
|
152
|
-
if ($[14] !== error || $[15] !== errorSource) {
|
|
153
|
-
t8 = error !== null && /* @__PURE__ */ jsxDEV(ErrorAlert, {
|
|
154
|
-
error: errorSource,
|
|
155
|
-
testId: "pm-error"
|
|
156
|
-
}, void 0, false);
|
|
157
|
-
$[14] = error;
|
|
158
|
-
$[15] = errorSource;
|
|
159
|
-
$[16] = t8;
|
|
160
|
-
} else {
|
|
161
|
-
t8 = $[16];
|
|
162
|
-
}
|
|
163
|
-
t6 = /* @__PURE__ */ jsxDEV("div", {
|
|
164
|
-
className: "flex flex-col gap-3",
|
|
165
|
-
"data-testid": "lunora-permissions-matrix",
|
|
166
|
-
children: [t7, t8, policies !== null && rows.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
167
|
-
description: t("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),
|
|
168
|
-
testId: "pm-empty",
|
|
169
|
-
title: t("No policy")
|
|
170
|
-
}, void 0, false) : /* @__PURE__ */ jsxDEV(Table, {
|
|
171
|
-
"data-testid": "pm-table",
|
|
172
|
-
children: [/* @__PURE__ */ jsxDEV(TableHeader, {
|
|
173
|
-
children: /* @__PURE__ */ jsxDEV(TableRow, {
|
|
174
|
-
children: [/* @__PURE__ */ jsxDEV(TableHead, {
|
|
175
|
-
children: t("Table")
|
|
176
|
-
}, void 0, false), OPERATIONS.map((operation) => /* @__PURE__ */ jsxDEV(TableHead, {
|
|
177
|
-
children: operationLabel(t, operation)
|
|
178
|
-
}, operation, false)), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
179
|
-
children: t("Masked columns")
|
|
180
|
-
}, void 0, false)]
|
|
181
|
-
}, void 0, true)
|
|
182
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
|
|
183
|
-
children: rows.map((row) => /* @__PURE__ */ jsxDEV(TableRow, {
|
|
184
|
-
"data-testid": `pm-row-${row.table}`,
|
|
185
|
-
children: [/* @__PURE__ */ jsxDEV(TableCell, {
|
|
186
|
-
className: "font-mono text-xs",
|
|
187
|
-
children: /* @__PURE__ */ jsxDEV("span", {
|
|
188
|
-
className: "flex items-center gap-1.5",
|
|
189
|
-
children: [row.table, row.uncovered && /* @__PURE__ */ jsxDEV(Badge, {
|
|
190
|
-
"data-testid": `pm-uncovered-${row.table}`,
|
|
191
|
-
title: t("Uncovered — reachable without a policy"),
|
|
192
|
-
variant: "destructive",
|
|
193
|
-
children: t("Uncovered — reachable without a policy")
|
|
194
|
-
}, void 0, false)]
|
|
195
|
-
}, void 0, true)
|
|
196
|
-
}, void 0, false), OPERATIONS.map((operation_0) => {
|
|
197
|
-
const cell = row.cells[operation_0];
|
|
198
|
-
return /* @__PURE__ */ jsxDEV(TableCell, {
|
|
199
|
-
"data-testid": `pm-cell-${row.table}-${operation_0}`,
|
|
200
|
-
children: cell.procedure === void 0 ? /* @__PURE__ */ jsxDEV("span", {
|
|
201
|
-
className: "text-xs text-muted-foreground",
|
|
202
|
-
children: t("No policy")
|
|
203
|
-
}, void 0, false) : /* @__PURE__ */ jsxDEV("span", {
|
|
204
|
-
className: "flex flex-col gap-1",
|
|
205
|
-
children: [/* @__PURE__ */ jsxDEV(Badge, {
|
|
206
|
-
variant: "secondary",
|
|
207
|
-
children: t("Covered by {procedure}", {
|
|
208
|
-
procedure: cell.procedure
|
|
209
|
-
})
|
|
210
|
-
}, void 0, false), onProbe !== void 0 && /* @__PURE__ */ jsxDEV(Button, {
|
|
211
|
-
className: "h-auto justify-start p-0 text-[11px]",
|
|
212
|
-
"data-testid": `pm-probe-${row.table}-${operation_0}`,
|
|
213
|
-
onClick: () => {
|
|
214
|
-
onProbe(row.table, operation_0, cell.procedure ?? "");
|
|
215
|
-
},
|
|
216
|
-
size: "xs",
|
|
217
|
-
type: "button",
|
|
218
|
-
variant: "ghost",
|
|
219
|
-
children: t("Probe this")
|
|
220
|
-
}, void 0, false)]
|
|
221
|
-
}, void 0, true)
|
|
222
|
-
}, operation_0, false);
|
|
223
|
-
}), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
224
|
-
children: row.maskedColumns.length === 0 ? /* @__PURE__ */ jsxDEV("span", {
|
|
225
|
-
"aria-hidden": "true",
|
|
226
|
-
className: "text-muted-foreground",
|
|
227
|
-
children: "—"
|
|
228
|
-
}, void 0, false) : /* @__PURE__ */ jsxDEV("span", {
|
|
229
|
-
className: "flex flex-wrap gap-1",
|
|
230
|
-
children: row.maskedColumns.map(_temp)
|
|
231
|
-
}, void 0, false)
|
|
232
|
-
}, void 0, false)]
|
|
233
|
-
}, row.table, true))
|
|
234
|
-
}, void 0, false)]
|
|
235
|
-
}, void 0, true)]
|
|
236
|
-
}, void 0, true);
|
|
237
|
-
$[6] = advisoriesQuery.data;
|
|
238
|
-
$[7] = masksQuery.data;
|
|
239
|
-
$[8] = onProbe;
|
|
240
|
-
$[9] = policiesQuery;
|
|
241
|
-
$[10] = t;
|
|
242
|
-
$[11] = t6;
|
|
243
|
-
} else {
|
|
244
|
-
t6 = $[11];
|
|
245
|
-
}
|
|
246
|
-
return t6;
|
|
247
|
-
};
|
|
248
|
-
function _temp(column) {
|
|
249
|
-
return /* @__PURE__ */ jsxDEV(Badge, {
|
|
250
|
-
variant: "outline",
|
|
251
|
-
children: column
|
|
252
|
-
}, column, false);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
const RUN_AS = adminRef(ADMIN_FUNCTIONS.runAs);
|
|
256
|
-
const useRunAsProbe = () => {
|
|
257
|
-
const client = useLunora();
|
|
258
|
-
return async ({
|
|
259
|
-
args,
|
|
260
|
-
functionPath,
|
|
261
|
-
shardKey = "",
|
|
262
|
-
userId
|
|
263
|
-
}) => {
|
|
264
|
-
const reference = RUN_AS;
|
|
265
|
-
try {
|
|
266
|
-
const value = await client.query(reference, {
|
|
267
|
-
args,
|
|
268
|
-
functionPath,
|
|
269
|
-
userId
|
|
270
|
-
}, callOptions(shardKey));
|
|
271
|
-
return {
|
|
272
|
-
kind: "allowed",
|
|
273
|
-
value
|
|
274
|
-
};
|
|
275
|
-
} catch (error) {
|
|
276
|
-
return {
|
|
277
|
-
kind: "denied",
|
|
278
|
-
message: error instanceof Error ? error.message : String(error)
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
const formatValue = (value) => value === void 0 ? "undefined" : JSON.stringify(value, null, 2);
|
|
285
|
-
const PermissionsPlayground = ({
|
|
286
|
-
functions: functionsProp,
|
|
287
|
-
prefill,
|
|
288
|
-
runAsIdentity = false
|
|
289
|
-
} = {}) => {
|
|
290
|
-
const client = useLunora();
|
|
291
|
-
const t = useT();
|
|
292
|
-
const probe = useRunAsProbe();
|
|
293
|
-
const [discovered, setDiscovered] = useState(null);
|
|
294
|
-
const [discoverError, setDiscoverError] = useState(null);
|
|
295
|
-
const functions = functionsProp ?? discovered ?? [];
|
|
296
|
-
const [selectedPath, setSelectedPath] = useState("");
|
|
297
|
-
const [argsText, setArgsText] = useState("{}");
|
|
298
|
-
const [shardKey, setShardKey] = useState("");
|
|
299
|
-
const [runAsUserId, setRunAsUserId] = useState("");
|
|
300
|
-
const [running, setRunning] = useState(false);
|
|
301
|
-
const [outcome, setOutcome] = useState(null);
|
|
302
|
-
const [argsError, setArgsError] = useState(null);
|
|
303
|
-
const appliedNonce = useRef(-1);
|
|
304
|
-
useEffect(() => {
|
|
305
|
-
if (functionsProp !== void 0) {
|
|
306
|
-
return void 0;
|
|
307
|
-
}
|
|
308
|
-
let cancelled = false;
|
|
309
|
-
client.listFunctions().then((list) => {
|
|
310
|
-
if (!cancelled) {
|
|
311
|
-
setDiscovered(list);
|
|
312
|
-
}
|
|
313
|
-
return list;
|
|
314
|
-
}).catch((error_) => {
|
|
315
|
-
if (!cancelled) {
|
|
316
|
-
setDiscoverError(errorMessage(error_));
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
return () => {
|
|
320
|
-
cancelled = true;
|
|
321
|
-
};
|
|
322
|
-
}, [client, functionsProp]);
|
|
323
|
-
useEffect(() => {
|
|
324
|
-
if (prefill === void 0 || appliedNonce.current === prefill.nonce) {
|
|
325
|
-
return;
|
|
326
|
-
}
|
|
327
|
-
appliedNonce.current = prefill.nonce;
|
|
328
|
-
const target = prefill.functionPath;
|
|
329
|
-
queueMicrotask(() => {
|
|
330
|
-
setSelectedPath(target);
|
|
331
|
-
setOutcome(null);
|
|
332
|
-
});
|
|
333
|
-
}, [prefill]);
|
|
334
|
-
const effectivePath = selectedPath === "" ? functions[0]?.path ?? "" : selectedPath;
|
|
335
|
-
const run = async () => {
|
|
336
|
-
if (effectivePath === "") {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
let parsedArgs;
|
|
340
|
-
try {
|
|
341
|
-
parsedArgs = argsText.trim() === "" ? {} : JSON.parse(argsText);
|
|
342
|
-
} catch (parseError) {
|
|
343
|
-
setArgsError(t("Invalid JSON args: {message}", {
|
|
344
|
-
message: parseError.message
|
|
345
|
-
}));
|
|
346
|
-
setOutcome(null);
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
setArgsError(null);
|
|
350
|
-
setRunning(true);
|
|
351
|
-
try {
|
|
352
|
-
const result = await probe({
|
|
353
|
-
args: parsedArgs,
|
|
354
|
-
functionPath: effectivePath,
|
|
355
|
-
shardKey: shardKey.trim(),
|
|
356
|
-
userId: runAsUserId.trim()
|
|
357
|
-
});
|
|
358
|
-
setOutcome(result);
|
|
359
|
-
} finally {
|
|
360
|
-
setRunning(false);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
const runOnce = () => {
|
|
364
|
-
fireAndForget(run());
|
|
365
|
-
};
|
|
366
|
-
const onSelectChange = (event) => {
|
|
367
|
-
setSelectedPath(event.target.value);
|
|
368
|
-
};
|
|
369
|
-
const onArgsChange = (event_0) => {
|
|
370
|
-
setArgsText(event_0.target.value);
|
|
371
|
-
};
|
|
372
|
-
const onUserIdChange = (event_1) => {
|
|
373
|
-
setRunAsUserId(event_1.target.value);
|
|
374
|
-
};
|
|
375
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
376
|
-
className: "flex flex-col gap-3",
|
|
377
|
-
"data-testid": "lunora-permissions-playground",
|
|
378
|
-
children: [discoverError !== null && /* @__PURE__ */ jsxDEV("p", {
|
|
379
|
-
className: "text-sm text-destructive",
|
|
380
|
-
"data-testid": "pp-discover-error",
|
|
381
|
-
role: "alert",
|
|
382
|
-
children: discoverError
|
|
383
|
-
}, void 0, false), !runAsIdentity && /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
384
|
-
description: t("Dev only: runs the selected function as this user over the admin gate so you can test auth and RLS."),
|
|
385
|
-
testId: "pp-gate",
|
|
386
|
-
title: t("Set `runAsIdentity` to forge an identity and probe access.")
|
|
387
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV("div", {
|
|
388
|
-
className: "flex flex-col gap-3 rounded-md border border-border p-3",
|
|
389
|
-
children: [/* @__PURE__ */ jsxDEV("div", {
|
|
390
|
-
className: "flex flex-col gap-1.5",
|
|
391
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
392
|
-
htmlFor: "pp-function",
|
|
393
|
-
children: t("Function")
|
|
394
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV("select", {
|
|
395
|
-
"aria-label": t("Function"),
|
|
396
|
-
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",
|
|
397
|
-
"data-testid": "pp-function",
|
|
398
|
-
id: "pp-function",
|
|
399
|
-
onChange: onSelectChange,
|
|
400
|
-
value: effectivePath,
|
|
401
|
-
children: functions.map((descriptor) => /* @__PURE__ */ jsxDEV("option", {
|
|
402
|
-
value: descriptor.path,
|
|
403
|
-
children: [descriptor.path, " (", descriptor.kind, ")"]
|
|
404
|
-
}, descriptor.path, true))
|
|
405
|
-
}, void 0, false)]
|
|
406
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV("div", {
|
|
407
|
-
className: "flex flex-col gap-1.5",
|
|
408
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
409
|
-
htmlFor: "pp-args",
|
|
410
|
-
children: t("Arguments")
|
|
411
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Textarea, {
|
|
412
|
-
"aria-label": t("Arguments"),
|
|
413
|
-
className: "font-mono text-xs",
|
|
414
|
-
"data-testid": "pp-args",
|
|
415
|
-
id: "pp-args",
|
|
416
|
-
onChange: onArgsChange,
|
|
417
|
-
value: argsText
|
|
418
|
-
}, void 0, false)]
|
|
419
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV(ShardInput, {
|
|
420
|
-
onChange: setShardKey,
|
|
421
|
-
testId: "pp-shard",
|
|
422
|
-
value: shardKey
|
|
423
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV("div", {
|
|
424
|
-
className: "flex flex-col gap-1.5",
|
|
425
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
426
|
-
htmlFor: "pp-user",
|
|
427
|
-
children: t("Run as (userId)")
|
|
428
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
|
|
429
|
-
"aria-label": t("Identity (userId) to run as"),
|
|
430
|
-
className: "font-mono text-xs",
|
|
431
|
-
"data-testid": "pp-user",
|
|
432
|
-
id: "pp-user",
|
|
433
|
-
onChange: onUserIdChange,
|
|
434
|
-
placeholder: t("Leave empty to run as admin"),
|
|
435
|
-
value: runAsUserId
|
|
436
|
-
}, void 0, false)]
|
|
437
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV("div", {
|
|
438
|
-
className: "flex items-center gap-2",
|
|
439
|
-
children: [/* @__PURE__ */ jsxDEV(Button, {
|
|
440
|
-
"data-testid": "pp-run",
|
|
441
|
-
disabled: !runAsIdentity || running || effectivePath === "",
|
|
442
|
-
onClick: runOnce,
|
|
443
|
-
type: "button",
|
|
444
|
-
children: running ? t("Probing…") : t("Run probe")
|
|
445
|
-
}, void 0, false), runAsUserId.trim() !== "" && /* @__PURE__ */ jsxDEV(Badge, {
|
|
446
|
-
"data-testid": "pp-as-badge",
|
|
447
|
-
variant: "secondary",
|
|
448
|
-
children: t("as {userId}", {
|
|
449
|
-
userId: runAsUserId.trim()
|
|
450
|
-
})
|
|
451
|
-
}, void 0, false)]
|
|
452
|
-
}, void 0, true)]
|
|
453
|
-
}, void 0, true), argsError !== null && /* @__PURE__ */ jsxDEV("p", {
|
|
454
|
-
className: "text-sm text-destructive",
|
|
455
|
-
"data-testid": "pp-args-error",
|
|
456
|
-
role: "alert",
|
|
457
|
-
children: argsError
|
|
458
|
-
}, void 0, false), outcome !== null && outcome.kind === "allowed" && /* @__PURE__ */ jsxDEV("div", {
|
|
459
|
-
className: "flex flex-col gap-2",
|
|
460
|
-
"data-testid": "pp-outcome-allowed",
|
|
461
|
-
children: [/* @__PURE__ */ jsxDEV(Badge, {
|
|
462
|
-
variant: "secondary",
|
|
463
|
-
children: t("Allowed")
|
|
464
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV("pre", {
|
|
465
|
-
className: "overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs",
|
|
466
|
-
"data-testid": "pp-result",
|
|
467
|
-
children: formatValue(outcome.value)
|
|
468
|
-
}, void 0, false)]
|
|
469
|
-
}, void 0, true), outcome !== null && outcome.kind === "denied" && /* @__PURE__ */ jsxDEV("div", {
|
|
470
|
-
className: "flex flex-col gap-2",
|
|
471
|
-
"data-testid": "pp-outcome-denied",
|
|
472
|
-
children: [/* @__PURE__ */ jsxDEV(Badge, {
|
|
473
|
-
variant: "destructive",
|
|
474
|
-
children: t("Denied")
|
|
475
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV("pre", {
|
|
476
|
-
className: "overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs text-destructive",
|
|
477
|
-
"data-testid": "pp-denied",
|
|
478
|
-
role: "alert",
|
|
479
|
-
children: outcome.message
|
|
480
|
-
}, void 0, false)]
|
|
481
|
-
}, void 0, true)]
|
|
482
|
-
}, void 0, true);
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
const POLICY_SCAFFOLD_ENDPOINT = "/__lunora/policy-scaffold";
|
|
486
|
-
const FAILURE_MESSAGES = {
|
|
487
|
-
"already-wired": "That procedure already has an rls(...) policy wired in.",
|
|
488
|
-
"file-exists": "A policy file with that name already exists — pick another name or edit it by hand.",
|
|
489
|
-
"invalid-identifier": "Name, table, and policy-set must be plain identifiers (letters, digits, _ or $).",
|
|
490
|
-
"unknown-procedure": "No exported procedure was found at that file path.",
|
|
491
|
-
"unsupported-procedure-shape": "That procedure uses the bare query({…}) form — convert it to the builder form (c.use(…).query(…)) before wiring RLS."
|
|
492
|
-
};
|
|
493
|
-
const applyPolicyScaffold = async (request) => {
|
|
494
|
-
const response = await fetch(POLICY_SCAFFOLD_ENDPOINT, {
|
|
495
|
-
body: JSON.stringify(request),
|
|
496
|
-
headers: {
|
|
497
|
-
"Content-Type": "application/json"
|
|
498
|
-
},
|
|
499
|
-
method: "POST"
|
|
500
|
-
});
|
|
501
|
-
const body = await response.json();
|
|
502
|
-
if (body.needsManualEdit === true) {
|
|
503
|
-
return {
|
|
504
|
-
kind: "needs-manual-edit",
|
|
505
|
-
message: body.message ?? "This change must be made by hand."
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
if (response.ok) {
|
|
509
|
-
return {
|
|
510
|
-
diagnostics: body.diagnostics ?? [],
|
|
511
|
-
kind: "ok",
|
|
512
|
-
label: body.fileName ?? body.exportName ?? ""
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
const token = body.error;
|
|
516
|
-
const message = token === void 0 ? `policy scaffold failed (${String(response.status)})` : FAILURE_MESSAGES[token] ?? token;
|
|
517
|
-
return {
|
|
518
|
-
kind: "error",
|
|
519
|
-
message
|
|
520
|
-
};
|
|
521
|
-
};
|
|
522
|
-
|
|
523
|
-
const EMPTY_FORM = {
|
|
524
|
-
exportName: "",
|
|
525
|
-
filePath: "",
|
|
526
|
-
policyName: "",
|
|
527
|
-
policies: "",
|
|
528
|
-
tableName: ""
|
|
529
|
-
};
|
|
530
|
-
const PolicyScaffolder = () => {
|
|
531
|
-
const t = useT();
|
|
532
|
-
const [mode, setMode] = useState(null);
|
|
533
|
-
const [busy, setBusy] = useState(false);
|
|
534
|
-
const [result, setResult] = useState(null);
|
|
535
|
-
const [form, setForm] = useState(EMPTY_FORM);
|
|
536
|
-
const onFieldChange = (event) => {
|
|
537
|
-
const field = event.target.name;
|
|
538
|
-
const {
|
|
539
|
-
value
|
|
540
|
-
} = event.target;
|
|
541
|
-
setForm((previous) => {
|
|
542
|
-
return {
|
|
543
|
-
...previous,
|
|
544
|
-
[field]: value
|
|
545
|
-
};
|
|
546
|
-
});
|
|
547
|
-
};
|
|
548
|
-
const reset = () => {
|
|
549
|
-
setMode(null);
|
|
550
|
-
setForm(EMPTY_FORM);
|
|
551
|
-
};
|
|
552
|
-
const submit = async (request) => {
|
|
553
|
-
setBusy(true);
|
|
554
|
-
setResult(null);
|
|
555
|
-
try {
|
|
556
|
-
const outcome = await applyPolicyScaffold(request);
|
|
557
|
-
setResult(outcome);
|
|
558
|
-
if (outcome.kind === "ok") {
|
|
559
|
-
reset();
|
|
560
|
-
}
|
|
561
|
-
} catch (error) {
|
|
562
|
-
setResult({
|
|
563
|
-
kind: "error",
|
|
564
|
-
message: error instanceof Error ? error.message : String(error)
|
|
565
|
-
});
|
|
566
|
-
} finally {
|
|
567
|
-
setBusy(false);
|
|
568
|
-
}
|
|
569
|
-
};
|
|
570
|
-
const onSubmitScaffold = () => {
|
|
571
|
-
fireAndForget(submit({
|
|
572
|
-
kind: "scaffoldPolicy",
|
|
573
|
-
name: form.policyName.trim(),
|
|
574
|
-
table: form.tableName.trim()
|
|
575
|
-
}));
|
|
576
|
-
};
|
|
577
|
-
const onSubmitWire = () => {
|
|
578
|
-
fireAndForget(submit({
|
|
579
|
-
exportName: form.exportName.trim(),
|
|
580
|
-
filePath: form.filePath.trim(),
|
|
581
|
-
kind: "wireRls",
|
|
582
|
-
policies: form.policies.trim()
|
|
583
|
-
}));
|
|
584
|
-
};
|
|
585
|
-
const openScaffold = () => {
|
|
586
|
-
setResult(null);
|
|
587
|
-
setMode("scaffold");
|
|
588
|
-
};
|
|
589
|
-
const openWire = () => {
|
|
590
|
-
setResult(null);
|
|
591
|
-
setMode("wire");
|
|
592
|
-
};
|
|
593
|
-
return /* @__PURE__ */ jsxDEV(Card, {
|
|
594
|
-
"data-testid": "policy-scaffolder",
|
|
595
|
-
size: "sm",
|
|
596
|
-
children: [/* @__PURE__ */ jsxDEV(CardHeader, {
|
|
597
|
-
children: [/* @__PURE__ */ jsxDEV(CardTitle, {
|
|
598
|
-
children: t("Scaffold access rules")
|
|
599
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(CardDescription, {
|
|
600
|
-
children: t("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")
|
|
601
|
-
}, void 0, false)]
|
|
602
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV(CardContent, {
|
|
603
|
-
children: [/* @__PURE__ */ jsxDEV("div", {
|
|
604
|
-
className: "flex flex-wrap gap-2",
|
|
605
|
-
children: [/* @__PURE__ */ jsxDEV(Button, {
|
|
606
|
-
"data-testid": "policy-scaffolder-new",
|
|
607
|
-
onClick: openScaffold,
|
|
608
|
-
size: "xs",
|
|
609
|
-
type: "button",
|
|
610
|
-
variant: mode === "scaffold" ? "default" : "outline",
|
|
611
|
-
children: t("New policy file")
|
|
612
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
|
|
613
|
-
"data-testid": "policy-scaffolder-wire",
|
|
614
|
-
onClick: openWire,
|
|
615
|
-
size: "xs",
|
|
616
|
-
type: "button",
|
|
617
|
-
variant: mode === "wire" ? "default" : "outline",
|
|
618
|
-
children: t("Wire into a procedure")
|
|
619
|
-
}, void 0, false)]
|
|
620
|
-
}, void 0, true), mode === "scaffold" && /* @__PURE__ */ jsxDEV("div", {
|
|
621
|
-
className: "mt-3 flex flex-wrap items-end gap-2",
|
|
622
|
-
"data-testid": "policy-scaffolder-new-form",
|
|
623
|
-
children: [/* @__PURE__ */ jsxDEV("div", {
|
|
624
|
-
className: "flex flex-col gap-1 text-xs",
|
|
625
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
626
|
-
htmlFor: "policy-scaffolder-name",
|
|
627
|
-
children: t("Policy name")
|
|
628
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
|
|
629
|
-
"data-testid": "policy-scaffolder-name",
|
|
630
|
-
id: "policy-scaffolder-name",
|
|
631
|
-
name: "policyName",
|
|
632
|
-
onChange: onFieldChange,
|
|
633
|
-
value: form.policyName
|
|
634
|
-
}, void 0, false)]
|
|
635
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV("div", {
|
|
636
|
-
className: "flex flex-col gap-1 text-xs",
|
|
637
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
638
|
-
htmlFor: "policy-scaffolder-table",
|
|
639
|
-
children: t("Table name")
|
|
640
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
|
|
641
|
-
"data-testid": "policy-scaffolder-table",
|
|
642
|
-
id: "policy-scaffolder-table",
|
|
643
|
-
name: "tableName",
|
|
644
|
-
onChange: onFieldChange,
|
|
645
|
-
value: form.tableName
|
|
646
|
-
}, void 0, false)]
|
|
647
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV(Button, {
|
|
648
|
-
"data-testid": "policy-scaffolder-create",
|
|
649
|
-
disabled: busy || form.policyName.trim() === "" || form.tableName.trim() === "",
|
|
650
|
-
onClick: onSubmitScaffold,
|
|
651
|
-
size: "xs",
|
|
652
|
-
type: "button",
|
|
653
|
-
children: busy ? t("Creating…") : t("Create policy file")
|
|
654
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
|
|
655
|
-
onClick: reset,
|
|
656
|
-
size: "xs",
|
|
657
|
-
type: "button",
|
|
658
|
-
variant: "ghost",
|
|
659
|
-
children: t("Cancel")
|
|
660
|
-
}, void 0, false)]
|
|
661
|
-
}, void 0, true), mode === "wire" && /* @__PURE__ */ jsxDEV("div", {
|
|
662
|
-
className: "mt-3 flex flex-wrap items-end gap-2",
|
|
663
|
-
"data-testid": "policy-scaffolder-wire-form",
|
|
664
|
-
children: [/* @__PURE__ */ jsxDEV("div", {
|
|
665
|
-
className: "flex flex-col gap-1 text-xs",
|
|
666
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
667
|
-
htmlFor: "policy-scaffolder-file",
|
|
668
|
-
children: t("Procedure file path")
|
|
669
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
|
|
670
|
-
"data-testid": "policy-scaffolder-file",
|
|
671
|
-
id: "policy-scaffolder-file",
|
|
672
|
-
name: "filePath",
|
|
673
|
-
onChange: onFieldChange,
|
|
674
|
-
value: form.filePath
|
|
675
|
-
}, void 0, false)]
|
|
676
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV("div", {
|
|
677
|
-
className: "flex flex-col gap-1 text-xs",
|
|
678
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
679
|
-
htmlFor: "policy-scaffolder-export",
|
|
680
|
-
children: t("Exported procedure")
|
|
681
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
|
|
682
|
-
"data-testid": "policy-scaffolder-export",
|
|
683
|
-
id: "policy-scaffolder-export",
|
|
684
|
-
name: "exportName",
|
|
685
|
-
onChange: onFieldChange,
|
|
686
|
-
value: form.exportName
|
|
687
|
-
}, void 0, false)]
|
|
688
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV("div", {
|
|
689
|
-
className: "flex flex-col gap-1 text-xs",
|
|
690
|
-
children: [/* @__PURE__ */ jsxDEV(Label, {
|
|
691
|
-
htmlFor: "policy-scaffolder-policies",
|
|
692
|
-
children: t("Policy set identifier")
|
|
693
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Input, {
|
|
694
|
-
"data-testid": "policy-scaffolder-policies",
|
|
695
|
-
id: "policy-scaffolder-policies",
|
|
696
|
-
name: "policies",
|
|
697
|
-
onChange: onFieldChange,
|
|
698
|
-
value: form.policies
|
|
699
|
-
}, void 0, false)]
|
|
700
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV(Button, {
|
|
701
|
-
"data-testid": "policy-scaffolder-apply",
|
|
702
|
-
disabled: busy || form.filePath.trim() === "" || form.exportName.trim() === "" || form.policies.trim() === "",
|
|
703
|
-
onClick: onSubmitWire,
|
|
704
|
-
size: "xs",
|
|
705
|
-
type: "button",
|
|
706
|
-
children: busy ? t("Wiring…") : t("Wire RLS")
|
|
707
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(Button, {
|
|
708
|
-
onClick: reset,
|
|
709
|
-
size: "xs",
|
|
710
|
-
type: "button",
|
|
711
|
-
variant: "ghost",
|
|
712
|
-
children: t("Cancel")
|
|
713
|
-
}, void 0, false)]
|
|
714
|
-
}, void 0, true), result?.kind === "error" && /* @__PURE__ */ jsxDEV("p", {
|
|
715
|
-
className: "mt-3 text-sm text-destructive",
|
|
716
|
-
"data-testid": "policy-scaffolder-error",
|
|
717
|
-
role: "alert",
|
|
718
|
-
children: result.message
|
|
719
|
-
}, void 0, false), result?.kind === "needs-manual-edit" && /* @__PURE__ */ jsxDEV("p", {
|
|
720
|
-
className: "mt-3 text-sm text-amber-600 dark:text-amber-500",
|
|
721
|
-
"data-testid": "policy-scaffolder-manual",
|
|
722
|
-
role: "alert",
|
|
723
|
-
children: t("This change must be made by hand — the scaffolder only adds new, deny-by-default rules.")
|
|
724
|
-
}, void 0, false), result?.kind === "ok" && /* @__PURE__ */ jsxDEV("div", {
|
|
725
|
-
className: "mt-3 flex flex-col gap-1",
|
|
726
|
-
"data-testid": "policy-scaffolder-ok",
|
|
727
|
-
children: [/* @__PURE__ */ jsxDEV("p", {
|
|
728
|
-
className: "text-sm text-emerald-600 dark:text-emerald-500",
|
|
729
|
-
children: t("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.", {
|
|
730
|
-
label: result.label
|
|
731
|
-
})
|
|
732
|
-
}, void 0, false), result.diagnostics.length > 0 && /* @__PURE__ */ jsxDEV("ul", {
|
|
733
|
-
className: "flex flex-col gap-0.5",
|
|
734
|
-
"data-testid": "policy-scaffolder-diagnostics",
|
|
735
|
-
children: result.diagnostics.map((diagnostic) => /* @__PURE__ */ jsxDEV("li", {
|
|
736
|
-
className: "font-mono text-[11px] text-destructive",
|
|
737
|
-
children: diagnostic
|
|
738
|
-
}, diagnostic, false))
|
|
739
|
-
}, void 0, false)]
|
|
740
|
-
}, void 0, true)]
|
|
741
|
-
}, void 0, true)]
|
|
742
|
-
}, void 0, true);
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
const PermissionsPanel = ({
|
|
746
|
-
functions,
|
|
747
|
-
runAsIdentity = false,
|
|
748
|
-
schemaEditable = false
|
|
749
|
-
} = {}) => {
|
|
750
|
-
const t = useT();
|
|
751
|
-
const [prefill, setPrefill] = useState(void 0);
|
|
752
|
-
const onProbe = (_table, _operation, procedure) => {
|
|
753
|
-
if (procedure !== "") {
|
|
754
|
-
setPrefill((previous) => {
|
|
755
|
-
return {
|
|
756
|
-
functionPath: procedure,
|
|
757
|
-
nonce: (previous?.nonce ?? 0) + 1
|
|
758
|
-
};
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
return /* @__PURE__ */ jsxDEV("div", {
|
|
763
|
-
className: "flex flex-col gap-8",
|
|
764
|
-
"data-testid": "lunora-permissions",
|
|
765
|
-
children: [/* @__PURE__ */ jsxDEV("section", {
|
|
766
|
-
className: "flex flex-col gap-3",
|
|
767
|
-
children: [/* @__PURE__ */ jsxDEV("header", {
|
|
768
|
-
className: "border-b border-border px-4 py-3",
|
|
769
|
-
children: /* @__PURE__ */ jsxDEV("span", {
|
|
770
|
-
className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
|
|
771
|
-
children: t("Permissions")
|
|
772
|
-
}, void 0, false)
|
|
773
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(PermissionsMatrix, {
|
|
774
|
-
onProbe
|
|
775
|
-
}, void 0, false)]
|
|
776
|
-
}, void 0, true), /* @__PURE__ */ jsxDEV("section", {
|
|
777
|
-
className: "flex flex-col gap-3",
|
|
778
|
-
children: /* @__PURE__ */ jsxDEV(Card, {
|
|
779
|
-
className: "gap-0 py-0",
|
|
780
|
-
children: [/* @__PURE__ */ jsxDEV("header", {
|
|
781
|
-
className: "border-b border-border px-4 py-3",
|
|
782
|
-
children: /* @__PURE__ */ jsxDEV("span", {
|
|
783
|
-
className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
|
|
784
|
-
children: t("Probe")
|
|
785
|
-
}, void 0, false)
|
|
786
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(CardContent, {
|
|
787
|
-
className: "px-4 py-4",
|
|
788
|
-
children: [/* @__PURE__ */ jsxDEV("p", {
|
|
789
|
-
className: "mb-3 text-sm text-muted-foreground",
|
|
790
|
-
children: t("Pick a function and an identity, then run it to see the access outcome.")
|
|
791
|
-
}, void 0, false), /* @__PURE__ */ jsxDEV(PermissionsPlayground, {
|
|
792
|
-
functions,
|
|
793
|
-
prefill,
|
|
794
|
-
runAsIdentity
|
|
795
|
-
}, void 0, false)]
|
|
796
|
-
}, void 0, true)]
|
|
797
|
-
}, void 0, true)
|
|
798
|
-
}, void 0, false), schemaEditable && /* @__PURE__ */ jsxDEV("section", {
|
|
799
|
-
className: "flex flex-col gap-2",
|
|
800
|
-
children: /* @__PURE__ */ jsxDEV(PolicyScaffolder, {}, void 0, false)
|
|
801
|
-
}, void 0, false)]
|
|
802
|
-
}, void 0, true);
|
|
803
|
-
};
|
|
804
|
-
|
|
805
|
-
export { PermissionsPanel };
|
|
1
|
+
import{useState as u,useRef as te,useEffect as J}from"react";import{c as G,n as ae,f as re,m as le,u as H}from"../packem_shared/card-CIDGUN6K.js";import{useT as z}from"../packem_shared/DEFAULT_LOCALE-BZ4NojpD.js";import{c as ie}from"react/compiler-runtime";import{E as se}from"../packem_shared/error-alert-B59DnrDI.js";import{L as oe}from"../packem_shared/live-status-CGW2JHf_.js";import{g as T}from"../packem_shared/badge-BbuuAio7.js";import{u as P}from"../packem_shared/button-BkCrNcAs.js";import{E as Y}from"../packem_shared/empty-state-Cg7t_8qu.js";import{n as ne,d as de,m as U,p as M,f as ce,u as O}from"../packem_shared/table-DdJBrClo.js";import{K as j}from"../packem_shared/use-admin-query-Di3fLE8H.js";import{ADMIN_FUNCTIONS as R}from"../packem_shared/ADMIN_FUNCTIONS-BYNSbBVE.js";import{jsx as e,jsxs as i}from"react/jsx-runtime";import{useLunora as B}from"@lunora/react";import{ShardInput as pe}from"../packem_shared/ShardInput-BVn2iCU0.js";import{u as E}from"../packem_shared/input-JHu63lTv.js";import{p as C}from"../packem_shared/label-6uP1obNF.js";import{l as me}from"../packem_shared/textarea-Bu2-jKAs.js";import{c as fe,a as ue,e as he,f as q}from"../packem_shared/internal-AtZ4bTal.js";const W=["read","insert","update","delete"],xe=(a,t)=>({delete:a("Delete"),insert:a("Insert"),read:a("Read"),update:a("Update")})[t],ye=a=>{const t=new Set;for(const o of a?.advisories??[])if(o.name==="rls_uncovered_table"){const{table:s}=o.metadata;typeof s=="string"&&s!==""&&t.add(s)}return t},ge=(a,t,o)=>{const s=new Map,r=l=>{const d=s.get(l);if(d!==void 0)return d;const n={cells:{delete:{},insert:{},read:{},update:{}},maskedColumns:[],table:l,uncovered:o.has(l)};return s.set(l,n),n};for(const l of a)r(l.table).cells[l.on]={procedure:l.procedure};for(const l of t){const d=r(l.table);d.maskedColumns.includes(l.column)||d.maskedColumns.push(l.column)}for(const l of o)r(l);return[...s.values()].toSorted((l,d)=>l.table.localeCompare(d.table))},be=a=>{const t=ie(17);let o;t[0]!==a?(o=a===void 0?{}:a,t[0]=a,t[1]=o):o=t[1];const{onProbe:s}=o,r=z();let l,d;t[2]===Symbol.for("react.memo_cache_sentinel")?(l={},d={live:!0},t[2]=l,t[3]=d):(l=t[2],d=t[3]);const n=j(R.rlsPolicies,l,d);let y;t[4]===Symbol.for("react.memo_cache_sentinel")?(y={},t[4]=y):y=t[4];const f=j(R.maskPolicies,y);let h;t[5]===Symbol.for("react.memo_cache_sentinel")?(h={},t[5]=h):h=t[5];const v=j(R.getAdvisories,h);let N;if(t[6]!==v.data||t[7]!==f.data||t[8]!==s||t[9]!==n||t[10]!==r){let b=null;n.data!==void 0&&(b=Array.isArray(n.data.policies)?n.data.policies:[]);const _=Array.isArray(f.data?.columns)?f.data.columns:[],A=v.data??null,{error:x,errorSource:m,liveError:S}=n,I=b===null?[]:ge(b,_,ye(A));let $;t[12]!==S?($=e("div",{className:"flex items-center justify-end",children:e(oe,{message:S,prefix:"pm"})}),t[12]=S,t[13]=$):$=t[13];let g;t[14]!==x||t[15]!==m?(g=x!==null&&e(se,{error:m,testId:"pm-error"}),t[14]=x,t[15]=m,t[16]=g):g=t[16],N=i("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-matrix",children:[$,g,b!==null&&I.length===0?e(Y,{description:r("Add a `definePolicy` and wire it through `.use(rls(...))` to populate this matrix."),testId:"pm-empty",title:r("No policy")}):i(ne,{"data-testid":"pm-table",children:[e(de,{children:i(U,{children:[e(M,{children:r("Table")}),W.map(p=>e(M,{children:xe(r,p)},p)),e(M,{children:r("Masked columns")})]})}),e(ce,{children:I.map(p=>i(U,{"data-testid":`pm-row-${p.table}`,children:[e(O,{className:"font-mono text-xs",children:i("span",{className:"flex items-center gap-1.5",children:[p.table,p.uncovered&&e(T,{"data-testid":`pm-uncovered-${p.table}`,title:r("Uncovered — reachable without a policy"),variant:"destructive",children:r("Uncovered — reachable without a policy")})]})}),W.map(w=>{const F=p.cells[w];return e(O,{"data-testid":`pm-cell-${p.table}-${w}`,children:F.procedure===void 0?e("span",{className:"text-xs text-muted-foreground",children:r("No policy")}):i("span",{className:"flex flex-col gap-1",children:[e(T,{variant:"secondary",children:r("Covered by {procedure}",{procedure:F.procedure})}),s!==void 0&&e(P,{className:"h-auto justify-start p-0 text-[11px]","data-testid":`pm-probe-${p.table}-${w}`,onClick:()=>{s(p.table,w,F.procedure??"")},size:"xs",type:"button",variant:"ghost",children:r("Probe this")})]})},w)}),e(O,{children:p.maskedColumns.length===0?e("span",{"aria-hidden":"true",className:"text-muted-foreground",children:"—"}):e("span",{className:"flex flex-wrap gap-1",children:p.maskedColumns.map(ve)})})]},p.table))})]})]}),t[6]=v.data,t[7]=f.data,t[8]=s,t[9]=n,t[10]=r,t[11]=N}else N=t[11];return N};function ve(a){return e(T,{variant:"outline",children:a},a)}const Ne=ue(R.runAs),we=()=>{const a=B();return async({args:t,functionPath:o,shardKey:s="",userId:r})=>{const l=Ne;try{return{kind:"allowed",value:await a.query(l,{args:t,functionPath:o,userId:r},fe(s))}}catch(d){return{kind:"denied",message:d instanceof Error?d.message:String(d)}}}},ke=a=>a===void 0?"undefined":JSON.stringify(a,null,2),Pe=({functions:a,prefill:t,runAsIdentity:o=!1}={})=>{const s=B(),r=z(),l=we(),[d,n]=u(null),[y,f]=u(null),h=a??d??[],[v,N]=u(""),[b,_]=u("{}"),[A,x]=u(""),[m,S]=u(""),[I,$]=u(!1),[g,p]=u(null),[w,F]=u(null),D=te(-1);J(()=>{if(a!==void 0)return;let c=!1;return s.listFunctions().then(k=>(c||n(k),k)).catch(k=>{c||f(he(k))}),()=>{c=!0}},[s,a]),J(()=>{if(t===void 0||D.current===t.nonce)return;D.current=t.nonce;const c=t.functionPath;queueMicrotask(()=>{N(c),p(null)})},[t]);const L=v===""?h[0]?.path??"":v,Q=async()=>{if(L==="")return;let c;try{c=b.trim()===""?{}:JSON.parse(b)}catch(k){F(r("Invalid JSON args: {message}",{message:k.message})),p(null);return}F(null),$(!0);try{const k=await l({args:c,functionPath:L,shardKey:A.trim(),userId:m.trim()});p(k)}finally{$(!1)}},V=()=>{q(Q())},X=c=>{N(c.target.value)},Z=c=>{_(c.target.value)},ee=c=>{S(c.target.value)};return i("div",{className:"flex flex-col gap-3","data-testid":"lunora-permissions-playground",children:[y!==null&&e("p",{className:"text-sm text-destructive","data-testid":"pp-discover-error",role:"alert",children:y}),!o&&e(Y,{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.")}),i("div",{className:"flex flex-col gap-3 rounded-md border border-border p-3",children:[i("div",{className:"flex flex-col gap-1.5",children:[e(C,{htmlFor:"pp-function",children:r("Function")}),e("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:X,value:L,children:h.map(c=>i("option",{value:c.path,children:[c.path," (",c.kind,")"]},c.path))})]}),i("div",{className:"flex flex-col gap-1.5",children:[e(C,{htmlFor:"pp-args",children:r("Arguments")}),e(me,{"aria-label":r("Arguments"),className:"font-mono text-xs","data-testid":"pp-args",id:"pp-args",onChange:Z,value:b})]}),e(pe,{onChange:x,testId:"pp-shard",value:A}),i("div",{className:"flex flex-col gap-1.5",children:[e(C,{htmlFor:"pp-user",children:r("Run as (userId)")}),e(E,{"aria-label":r("Identity (userId) to run as"),className:"font-mono text-xs","data-testid":"pp-user",id:"pp-user",onChange:ee,placeholder:r("Leave empty to run as admin"),value:m})]}),i("div",{className:"flex items-center gap-2",children:[e(P,{"data-testid":"pp-run",disabled:!o||I||L==="",onClick:V,type:"button",children:r(I?"Probing…":"Run probe")}),m.trim()!==""&&e(T,{"data-testid":"pp-as-badge",variant:"secondary",children:r("as {userId}",{userId:m.trim()})})]})]}),w!==null&&e("p",{className:"text-sm text-destructive","data-testid":"pp-args-error",role:"alert",children:w}),g!==null&&g.kind==="allowed"&&i("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-allowed",children:[e(T,{variant:"secondary",children:r("Allowed")}),e("pre",{className:"overflow-auto rounded-md border border-border bg-muted/50 p-3 font-mono text-xs","data-testid":"pp-result",children:ke(g.value)})]}),g!==null&&g.kind==="denied"&&i("div",{className:"flex flex-col gap-2","data-testid":"pp-outcome-denied",children:[e(T,{variant:"destructive",children:r("Denied")}),e("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:g.message})]})]})},Ce="/__lunora/policy-scaffold",Se={"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."},Ie=async a=>{const t=await fetch(Ce,{body:JSON.stringify(a),headers:{"Content-Type":"application/json"},method:"POST"}),o=await t.json();if(o.needsManualEdit===!0)return{kind:"needs-manual-edit",message:o.message??"This change must be made by hand."};if(t.ok)return{diagnostics:o.diagnostics??[],kind:"ok",label:o.fileName??o.exportName??""};const s=o.error;return{kind:"error",message:s===void 0?`policy scaffold failed (${String(t.status)})`:Se[s]??s}},K={exportName:"",filePath:"",policyName:"",policies:"",tableName:""},$e=()=>{const a=z(),[t,o]=u(null),[s,r]=u(!1),[l,d]=u(null),[n,y]=u(K),f=x=>{const m=x.target.name,{value:S}=x.target;y(I=>({...I,[m]:S}))},h=()=>{o(null),y(K)},v=async x=>{r(!0),d(null);try{const m=await Ie(x);d(m),m.kind==="ok"&&h()}catch(m){d({kind:"error",message:m instanceof Error?m.message:String(m)})}finally{r(!1)}},N=()=>{q(v({kind:"scaffoldPolicy",name:n.policyName.trim(),table:n.tableName.trim()}))},b=()=>{q(v({exportName:n.exportName.trim(),filePath:n.filePath.trim(),kind:"wireRls",policies:n.policies.trim()}))},_=()=>{d(null),o("scaffold")},A=()=>{d(null),o("wire")};return i(G,{"data-testid":"policy-scaffolder",size:"sm",children:[i(ae,{children:[e(re,{children:a("Scaffold access rules")}),e(le,{children:a("Writes a new deny-by-default policy file under lunora/, or wires one into a procedure, then reruns codegen. Local dev only.")})]}),i(H,{children:[i("div",{className:"flex flex-wrap gap-2",children:[e(P,{"data-testid":"policy-scaffolder-new",onClick:_,size:"xs",type:"button",variant:t==="scaffold"?"default":"outline",children:a("New policy file")}),e(P,{"data-testid":"policy-scaffolder-wire",onClick:A,size:"xs",type:"button",variant:t==="wire"?"default":"outline",children:a("Wire into a procedure")})]}),t==="scaffold"&&i("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-new-form",children:[i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-name",children:a("Policy name")}),e(E,{"data-testid":"policy-scaffolder-name",id:"policy-scaffolder-name",name:"policyName",onChange:f,value:n.policyName})]}),i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-table",children:a("Table name")}),e(E,{"data-testid":"policy-scaffolder-table",id:"policy-scaffolder-table",name:"tableName",onChange:f,value:n.tableName})]}),e(P,{"data-testid":"policy-scaffolder-create",disabled:s||n.policyName.trim()===""||n.tableName.trim()==="",onClick:N,size:"xs",type:"button",children:a(s?"Creating…":"Create policy file")}),e(P,{onClick:h,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),t==="wire"&&i("div",{className:"mt-3 flex flex-wrap items-end gap-2","data-testid":"policy-scaffolder-wire-form",children:[i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-file",children:a("Procedure file path")}),e(E,{"data-testid":"policy-scaffolder-file",id:"policy-scaffolder-file",name:"filePath",onChange:f,value:n.filePath})]}),i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-export",children:a("Exported procedure")}),e(E,{"data-testid":"policy-scaffolder-export",id:"policy-scaffolder-export",name:"exportName",onChange:f,value:n.exportName})]}),i("div",{className:"flex flex-col gap-1 text-xs",children:[e(C,{htmlFor:"policy-scaffolder-policies",children:a("Policy set identifier")}),e(E,{"data-testid":"policy-scaffolder-policies",id:"policy-scaffolder-policies",name:"policies",onChange:f,value:n.policies})]}),e(P,{"data-testid":"policy-scaffolder-apply",disabled:s||n.filePath.trim()===""||n.exportName.trim()===""||n.policies.trim()==="",onClick:b,size:"xs",type:"button",children:a(s?"Wiring…":"Wire RLS")}),e(P,{onClick:h,size:"xs",type:"button",variant:"ghost",children:a("Cancel")})]}),l?.kind==="error"&&e("p",{className:"mt-3 text-sm text-destructive","data-testid":"policy-scaffolder-error",role:"alert",children:l.message}),l?.kind==="needs-manual-edit"&&e("p",{className:"mt-3 text-sm text-amber-600 dark:text-amber-500","data-testid":"policy-scaffolder-manual",role:"alert",children:a("This change must be made by hand — the scaffolder only adds new, deny-by-default rules.")}),l?.kind==="ok"&&i("div",{className:"mt-3 flex flex-col gap-1","data-testid":"policy-scaffolder-ok",children:[e("p",{className:"text-sm text-emerald-600 dark:text-emerald-500",children:a("Scaffolded {label} and reran codegen. Fill in the `when` predicates before relying on it.",{label:l.label})}),l.diagnostics.length>0&&e("ul",{className:"flex flex-col gap-0.5","data-testid":"policy-scaffolder-diagnostics",children:l.diagnostics.map(x=>e("li",{className:"font-mono text-[11px] text-destructive",children:x},x))})]})]})]})},Ye=({functions:a,runAsIdentity:t=!1,schemaEditable:o=!1}={})=>{const s=z(),[r,l]=u(void 0),d=(n,y,f)=>{f!==""&&l(h=>({functionPath:f,nonce:(h?.nonce??0)+1}))};return i("div",{className:"flex flex-col gap-8","data-testid":"lunora-permissions",children:[i("section",{className:"flex flex-col gap-3",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:s("Permissions")})}),e(be,{onProbe:d})]}),e("section",{className:"flex flex-col gap-3",children:i(G,{className:"gap-0 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:s("Probe")})}),i(H,{className:"px-4 py-4",children:[e("p",{className:"mb-3 text-sm text-muted-foreground",children:s("Pick a function and an identity, then run it to see the access outcome.")}),e(Pe,{functions:a,prefill:r,runAsIdentity:t})]})]})}),o&&e("section",{className:"flex flex-col gap-2",children:e($e,{})})]})};export{Ye as PermissionsPanel};
|