@lunora/studio 1.0.0-alpha.3 → 1.0.0-alpha.30

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.
Files changed (174) hide show
  1. package/__assets__/package-og.svg +1 -1
  2. package/dist/index.d.ts +29 -18
  3. package/dist/index.js +29 -29
  4. package/dist/mount.d.ts +1 -1
  5. package/dist/mount.js +1 -1
  6. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  7. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +24 -36
  8. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +13 -9
  9. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
  10. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
  11. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +147 -204
  12. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  13. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +107 -69
  14. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +41 -53
  15. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +37 -44
  16. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  17. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +39 -46
  18. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  19. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +15 -15
  20. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +44 -31
  21. package/dist/packem_chunks/SettingsPanel.js +390 -0
  22. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +12 -252
  23. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
  24. package/dist/packem_chunks/analytics-panel.js +261 -0
  25. package/dist/packem_chunks/auth-config-panel.js +179 -0
  26. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  27. package/dist/packem_chunks/dashboards-panel.js +779 -0
  28. package/dist/packem_chunks/fanout-panel.js +481 -0
  29. package/dist/packem_chunks/flags-panel.js +176 -0
  30. package/dist/packem_chunks/kv-browser.js +1896 -0
  31. package/dist/packem_chunks/log-drains-panel.js +273 -0
  32. package/dist/packem_chunks/organizations-panel.js +670 -0
  33. package/dist/packem_chunks/payments-panel.js +185 -0
  34. package/dist/packem_chunks/permissions-panel.js +804 -0
  35. package/dist/packem_chunks/queues-panel.js +147 -0
  36. package/dist/packem_chunks/rls-panel.js +313 -0
  37. package/dist/packem_chunks/schedule-panel.js +831 -0
  38. package/dist/packem_chunks/sparkline.js +79 -0
  39. package/dist/packem_chunks/storage-rules-panel.js +138 -0
  40. package/dist/packem_chunks/subscriptions-panel.js +236 -0
  41. package/dist/packem_chunks/users-panel.js +1265 -0
  42. package/dist/packem_chunks/vector-browser.js +281 -0
  43. package/dist/packem_chunks/workflows-panel.js +562 -0
  44. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-CdaxLGkE.js} +3 -0
  45. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-B6u_wnz-.js} +2 -2
  46. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Drz4UO0a.js} +2 -1
  47. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-B5BertvU.js} +1 -1
  48. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-ANTHLWWh.js} +198 -247
  49. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CjgTG_wa.js} +37 -66
  50. package/dist/packem_shared/HomePanel-c2FodE9t.js +14 -0
  51. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CspFdbUT.js} +2 -1
  52. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-BEJXtsBn.js} +163 -60
  53. package/dist/packem_shared/Studio-CVTtA_sB.js +16 -0
  54. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-BSYV2fz6.js} +277 -3
  55. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-DzqyvUU3.js} +1 -1
  56. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-B6MyY_al.d.ts} +1 -1
  57. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-Bb__F5-u.js} +1 -1
  58. package/dist/packem_shared/browser-storage-d03UsV7v.js +249 -0
  59. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  60. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-Dsg6nRjo.js} +1 -1
  61. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  62. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-D7nNzBYm.js} +4 -99
  63. package/dist/packem_shared/{HomePanel-Cw16stjq.js → home-panel-aOR_drVv.js} +833 -469
  64. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-FcNZ3beb.js} +1 -1
  65. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  66. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-Doy1XlQq.js} +4 -44
  67. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  68. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  69. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-KgMPHS4u.js} +1 -1
  70. package/dist/packem_shared/studio-dMTJ-kRR.js +3987 -0
  71. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  72. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-VMo0ftxD.js} +1 -1
  73. package/dist/packem_shared/use-admin-query-BViPA3US.js +105 -0
  74. package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +32 -0
  75. package/dist/standalone/chunk-2DS7JLWL.js +13 -0
  76. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  77. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  78. package/dist/standalone/chunk-2PDQ4KZ6.js +1 -0
  79. package/dist/standalone/chunk-3BP4BTLR.js +4 -0
  80. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  81. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  82. package/dist/standalone/chunk-57LYXHXH.js +1 -0
  83. package/dist/standalone/chunk-5NSZVXCS.js +1 -0
  84. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  85. package/dist/standalone/chunk-63XKJQTQ.js +1 -0
  86. package/dist/standalone/chunk-6RC6L33K.js +4 -0
  87. package/dist/standalone/chunk-6VTGE3WJ.js +1 -0
  88. package/dist/standalone/chunk-7PBZKXYA.js +1 -0
  89. package/dist/standalone/chunk-7POIIWC5.js +3 -0
  90. package/dist/standalone/chunk-7RYIQKZA.js +1 -0
  91. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  92. package/dist/standalone/chunk-AB6QGMBF.js +1 -0
  93. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  94. package/dist/standalone/chunk-AQGOX5DK.js +1 -0
  95. package/dist/standalone/chunk-ASLGNHAX.js +1 -0
  96. package/dist/standalone/chunk-BHTPZS7L.js +4 -0
  97. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  98. package/dist/standalone/chunk-D7HKX4DI.js +1 -0
  99. package/dist/standalone/chunk-DGWTR4G7.js +1 -0
  100. package/dist/standalone/chunk-DSX53PBM.js +1 -0
  101. package/dist/standalone/chunk-DV2MNASX.js +1 -0
  102. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  103. package/dist/standalone/chunk-E7AVZZKO.js +1 -0
  104. package/dist/standalone/chunk-EGJX34WM.js +1 -0
  105. package/dist/standalone/chunk-FCR3HKFV.js +1 -0
  106. package/dist/standalone/chunk-FKO3HO6I.js +4 -0
  107. package/dist/standalone/chunk-FQKNJSRA.js +76 -0
  108. package/dist/standalone/chunk-G2TFEWEQ.js +4 -0
  109. package/dist/standalone/chunk-GABMIICA.js +1 -0
  110. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  111. package/dist/standalone/chunk-GZXPPJVK.js +1 -0
  112. package/dist/standalone/chunk-HFBRE65A.js +1 -0
  113. package/dist/standalone/chunk-HFMQNUBC.js +1 -0
  114. package/dist/standalone/chunk-HG7Q5B3H.js +1 -0
  115. package/dist/standalone/chunk-HTQL7AXU.js +1 -0
  116. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  117. package/dist/standalone/chunk-ITLLHEVG.js +1 -0
  118. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  119. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  120. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  121. package/dist/standalone/chunk-KG3QTFWE.js +1 -0
  122. package/dist/standalone/chunk-KGS7KM4A.js +2 -0
  123. package/dist/standalone/chunk-KODWGUAB.js +1 -0
  124. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  125. package/dist/standalone/chunk-MGFEVTRI.js +1 -0
  126. package/dist/standalone/chunk-N2QDG3MW.js +1 -0
  127. package/dist/standalone/chunk-N4JI6VQD.js +1 -0
  128. package/dist/standalone/chunk-NNISYDNI.js +1 -0
  129. package/dist/standalone/chunk-O4PXDNR3.js +1 -0
  130. package/dist/standalone/chunk-O77VNUFD.js +1 -0
  131. package/dist/standalone/chunk-OD2POGPJ.js +1 -0
  132. package/dist/standalone/chunk-OXCK3ZUG.js +1 -0
  133. package/dist/standalone/chunk-P7DSVO4U.js +1 -0
  134. package/dist/standalone/chunk-PKAM3N5C.js +1 -0
  135. package/dist/standalone/chunk-QGXGBHQO.js +1 -0
  136. package/dist/standalone/chunk-QHA3TAEJ.js +1 -0
  137. package/dist/standalone/chunk-QQWC62X7.js +1 -0
  138. package/dist/standalone/chunk-RMYA7NAH.js +1 -0
  139. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  140. package/dist/standalone/chunk-S53RUBW5.js +1 -0
  141. package/dist/standalone/chunk-SB4GT6PK.js +1 -0
  142. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  143. package/dist/standalone/chunk-SHIOUDOT.js +1 -0
  144. package/dist/standalone/chunk-SIDRSX7Y.js +1 -0
  145. package/dist/standalone/chunk-SVR644RF.js +1 -0
  146. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  147. package/dist/standalone/chunk-TBMYIZIO.js +1 -0
  148. package/dist/standalone/chunk-TICVNLPM.js +1 -0
  149. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  150. package/dist/standalone/chunk-UGMRUEBU.js +1 -0
  151. package/dist/standalone/chunk-UII66UVF.js +1 -0
  152. package/dist/standalone/chunk-VJPQUBN6.js +8 -0
  153. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  154. package/dist/standalone/chunk-VMJKJWG6.js +1 -0
  155. package/dist/standalone/chunk-VPDPN5RR.js +2 -0
  156. package/dist/standalone/chunk-VSEGZA3J.js +1 -0
  157. package/dist/standalone/chunk-VXBZQIGY.js +4 -0
  158. package/dist/standalone/chunk-W7PCVQTE.js +1 -0
  159. package/dist/standalone/chunk-XLILSHPE.js +1 -0
  160. package/dist/standalone/chunk-XURNGQSS.js +1 -0
  161. package/dist/standalone/chunk-YJGANMU7.js +18 -0
  162. package/dist/standalone/chunk-YQQJ4N6U.js +1 -0
  163. package/dist/standalone/chunk-ZH7UES4T.js +2 -0
  164. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  165. package/dist/standalone/chunk-ZQCVDXDL.js +1 -0
  166. package/dist/standalone/studio.js +104 -246
  167. package/dist/styles.css +1 -1
  168. package/package.json +13 -12
  169. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  170. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  171. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  172. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  173. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  174. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -0,0 +1,147 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import 'react';
3
+ import { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
4
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
5
+ 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';
6
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
7
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
8
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js';
9
+ import { jsxDEV } from 'react/jsx-dev-runtime';
10
+
11
+ const QueuesPanel = () => {
12
+ const $ = c(17);
13
+ const t = useT();
14
+ let t0;
15
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
16
+ t0 = {};
17
+ $[0] = t0;
18
+ } else {
19
+ t0 = $[0];
20
+ }
21
+ const {
22
+ data,
23
+ error
24
+ } = useAdminQuery(ADMIN_FUNCTIONS.listQueues, t0);
25
+ const loaded = data !== void 0;
26
+ let t1;
27
+ if ($[1] !== data) {
28
+ t1 = Array.isArray(data?.queues) ? [...data.queues].toSorted(_temp) : [];
29
+ $[1] = data;
30
+ $[2] = t1;
31
+ } else {
32
+ t1 = $[2];
33
+ }
34
+ const queues = t1;
35
+ let t2;
36
+ if ($[3] !== error) {
37
+ t2 = error !== null && /* @__PURE__ */ jsxDEV("p", {
38
+ className: "text-sm text-destructive",
39
+ "data-testid": "queues-error",
40
+ role: "alert",
41
+ children: error
42
+ }, void 0, false);
43
+ $[3] = error;
44
+ $[4] = t2;
45
+ } else {
46
+ t2 = $[4];
47
+ }
48
+ let t3;
49
+ if ($[5] !== t) {
50
+ t3 = t("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.");
51
+ $[5] = t;
52
+ $[6] = t3;
53
+ } else {
54
+ t3 = $[6];
55
+ }
56
+ let t4;
57
+ if ($[7] !== t3) {
58
+ t4 = /* @__PURE__ */ jsxDEV("p", {
59
+ className: "text-sm text-muted-foreground",
60
+ children: t3
61
+ }, void 0, false);
62
+ $[7] = t3;
63
+ $[8] = t4;
64
+ } else {
65
+ t4 = $[8];
66
+ }
67
+ let t5;
68
+ if ($[9] !== loaded || $[10] !== queues || $[11] !== t) {
69
+ t5 = loaded && queues.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
70
+ description: t("No defineQueue is declared in lunora/queues.ts in this deployment. Add one to offload async work to a Cloudflare Queue."),
71
+ testId: "queues-empty",
72
+ title: t("No queues defined")
73
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(Card, {
74
+ className: "overflow-hidden py-0",
75
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
76
+ className: "px-0",
77
+ children: /* @__PURE__ */ jsxDEV(Table, {
78
+ "data-testid": "queues-table",
79
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
80
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
81
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
82
+ children: t("Export")
83
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
84
+ children: t("Queue")
85
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
86
+ children: t("Mode")
87
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
88
+ children: t("Binding")
89
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
90
+ children: t("Dead-letter")
91
+ }, void 0, false)]
92
+ }, void 0, true)
93
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
94
+ children: queues.map(_temp2)
95
+ }, void 0, false)]
96
+ }, void 0, true)
97
+ }, void 0, false)
98
+ }, void 0, false);
99
+ $[9] = loaded;
100
+ $[10] = queues;
101
+ $[11] = t;
102
+ $[12] = t5;
103
+ } else {
104
+ t5 = $[12];
105
+ }
106
+ let t6;
107
+ if ($[13] !== t2 || $[14] !== t4 || $[15] !== t5) {
108
+ t6 = /* @__PURE__ */ jsxDEV("div", {
109
+ className: "flex flex-col gap-6",
110
+ "data-testid": "lunora-queues-panel",
111
+ children: [t2, t4, t5]
112
+ }, void 0, true);
113
+ $[13] = t2;
114
+ $[14] = t4;
115
+ $[15] = t5;
116
+ $[16] = t6;
117
+ } else {
118
+ t6 = $[16];
119
+ }
120
+ return t6;
121
+ };
122
+ function _temp(a, b) {
123
+ return a.exportName.localeCompare(b.exportName);
124
+ }
125
+ function _temp2(queue) {
126
+ return /* @__PURE__ */ jsxDEV(TableRow, {
127
+ "data-testid": `queues-row-${queue.exportName}`,
128
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
129
+ className: "font-mono text-xs",
130
+ children: queue.exportName
131
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
132
+ className: "font-mono text-xs text-muted-foreground",
133
+ children: queue.name
134
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
135
+ className: "font-mono text-xs text-muted-foreground",
136
+ children: queue.mode
137
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
138
+ className: "font-mono text-xs text-muted-foreground",
139
+ children: queue.binding
140
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
141
+ className: "font-mono text-xs text-muted-foreground",
142
+ children: queue.deadLetterQueue ?? "—"
143
+ }, void 0, false)]
144
+ }, queue.exportName, true);
145
+ }
146
+
147
+ export { QueuesPanel as default };
@@ -0,0 +1,313 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
3
+ import { a as CardContent, C as Card } from '../packem_shared/card-DURq3ElK.js';
4
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
5
+ 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';
6
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
7
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
8
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js';
9
+ import { jsxDEV } from 'react/jsx-dev-runtime';
10
+
11
+ const OPERATIONS = ["read", "insert", "update", "delete"];
12
+ const operationLabel = (t, operation) => ({
13
+ delete: t("Delete"),
14
+ insert: t("Insert"),
15
+ read: t("Read"),
16
+ update: t("Update")
17
+ })[operation];
18
+ const groupByTable = (policies) => {
19
+ const byTable = /* @__PURE__ */ new Map();
20
+ for (const policy of policies) {
21
+ const coverage = byTable.get(policy.table) ?? {
22
+ operations: /* @__PURE__ */ new Set(),
23
+ procedures: [],
24
+ table: policy.table
25
+ };
26
+ coverage.operations.add(policy.on);
27
+ if (!coverage.procedures.includes(policy.procedure)) {
28
+ coverage.procedures.push(policy.procedure);
29
+ }
30
+ byTable.set(policy.table, coverage);
31
+ }
32
+ return [...byTable.values()].toSorted((a, b) => a.table.localeCompare(b.table));
33
+ };
34
+ const RlsPanel = () => {
35
+ const $ = c(47);
36
+ const t = useT();
37
+ let t0;
38
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
39
+ t0 = {};
40
+ $[0] = t0;
41
+ } else {
42
+ t0 = $[0];
43
+ }
44
+ const {
45
+ data,
46
+ error
47
+ } = useAdminQuery(ADMIN_FUNCTIONS.rlsPolicies, t0);
48
+ const loaded = data !== void 0;
49
+ let T0;
50
+ let roles;
51
+ let t1;
52
+ let t2;
53
+ let t3;
54
+ let t4;
55
+ let t5;
56
+ let t6;
57
+ let t7;
58
+ if ($[1] !== data || $[2] !== error || $[3] !== loaded || $[4] !== t) {
59
+ const tables = groupByTable(Array.isArray(data?.policies) ? data.policies : []);
60
+ let t82;
61
+ if ($[14] !== data) {
62
+ t82 = Array.isArray(data?.roles) ? data.roles : [];
63
+ $[14] = data;
64
+ $[15] = t82;
65
+ } else {
66
+ t82 = $[15];
67
+ }
68
+ roles = t82;
69
+ t5 = "flex flex-col gap-6";
70
+ t6 = "lunora-rls-panel";
71
+ if ($[16] !== error) {
72
+ t7 = error !== null && /* @__PURE__ */ jsxDEV("p", {
73
+ className: "px-4 py-8 text-center text-sm text-destructive",
74
+ "data-testid": "rls-error",
75
+ role: "alert",
76
+ children: error
77
+ }, void 0, false);
78
+ $[16] = error;
79
+ $[17] = t7;
80
+ } else {
81
+ t7 = $[17];
82
+ }
83
+ t4 = "flex flex-col gap-2";
84
+ T0 = Card;
85
+ t1 = "overflow-hidden py-0";
86
+ let t92;
87
+ if ($[18] !== t) {
88
+ t92 = t("Policies");
89
+ $[18] = t;
90
+ $[19] = t92;
91
+ } else {
92
+ t92 = $[19];
93
+ }
94
+ if ($[20] !== t92) {
95
+ t2 = /* @__PURE__ */ jsxDEV("header", {
96
+ className: "border-b border-border px-4 py-3",
97
+ children: /* @__PURE__ */ jsxDEV("span", {
98
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
99
+ children: t92
100
+ }, void 0, false)
101
+ }, void 0, false);
102
+ $[20] = t92;
103
+ $[21] = t2;
104
+ } else {
105
+ t2 = $[21];
106
+ }
107
+ t3 = loaded && tables.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
108
+ description: t("No `definePolicy` is wired through `.use(rls(...))` in this deployment. Add one to guard a table's rows."),
109
+ testId: "rls-policies-empty",
110
+ title: t("No policies defined")
111
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(CardContent, {
112
+ className: "px-0",
113
+ children: /* @__PURE__ */ jsxDEV(Table, {
114
+ "data-testid": "rls-policies-table",
115
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
116
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
117
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
118
+ children: t("Table")
119
+ }, void 0, false), OPERATIONS.map((operation) => /* @__PURE__ */ jsxDEV(TableHead, {
120
+ children: operationLabel(t, operation)
121
+ }, operation, false)), /* @__PURE__ */ jsxDEV(TableHead, {
122
+ children: t("Guarded by")
123
+ }, void 0, false)]
124
+ }, void 0, true)
125
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
126
+ children: tables.map((coverage) => /* @__PURE__ */ jsxDEV(TableRow, {
127
+ "data-testid": `rls-table-${coverage.table}`,
128
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
129
+ className: "font-mono text-xs",
130
+ children: coverage.table
131
+ }, void 0, false), OPERATIONS.map((operation_0) => /* @__PURE__ */ jsxDEV(TableCell, {
132
+ children: coverage.operations.has(operation_0) ? /* @__PURE__ */ jsxDEV(Badge, {
133
+ variant: "secondary",
134
+ children: t("Guarded")
135
+ }, void 0, false) : /* @__PURE__ */ jsxDEV("span", {
136
+ "aria-hidden": "true",
137
+ className: "text-muted-foreground",
138
+ children: "—"
139
+ }, void 0, false)
140
+ }, operation_0, false)), /* @__PURE__ */ jsxDEV(TableCell, {
141
+ className: "font-mono text-xs text-muted-foreground",
142
+ children: coverage.procedures.join(", ")
143
+ }, void 0, false)]
144
+ }, coverage.table, true))
145
+ }, void 0, false)]
146
+ }, void 0, true)
147
+ }, void 0, false);
148
+ $[1] = data;
149
+ $[2] = error;
150
+ $[3] = loaded;
151
+ $[4] = t;
152
+ $[5] = T0;
153
+ $[6] = roles;
154
+ $[7] = t1;
155
+ $[8] = t2;
156
+ $[9] = t3;
157
+ $[10] = t4;
158
+ $[11] = t5;
159
+ $[12] = t6;
160
+ $[13] = t7;
161
+ } else {
162
+ T0 = $[5];
163
+ roles = $[6];
164
+ t1 = $[7];
165
+ t2 = $[8];
166
+ t3 = $[9];
167
+ t4 = $[10];
168
+ t5 = $[11];
169
+ t6 = $[12];
170
+ t7 = $[13];
171
+ }
172
+ let t8;
173
+ if ($[22] !== T0 || $[23] !== t1 || $[24] !== t2 || $[25] !== t3) {
174
+ t8 = /* @__PURE__ */ jsxDEV(T0, {
175
+ className: t1,
176
+ children: [t2, t3]
177
+ }, void 0, true);
178
+ $[22] = T0;
179
+ $[23] = t1;
180
+ $[24] = t2;
181
+ $[25] = t3;
182
+ $[26] = t8;
183
+ } else {
184
+ t8 = $[26];
185
+ }
186
+ let t9;
187
+ if ($[27] !== t4 || $[28] !== t8) {
188
+ t9 = /* @__PURE__ */ jsxDEV("section", {
189
+ className: t4,
190
+ children: t8
191
+ }, void 0, false);
192
+ $[27] = t4;
193
+ $[28] = t8;
194
+ $[29] = t9;
195
+ } else {
196
+ t9 = $[29];
197
+ }
198
+ let t10;
199
+ if ($[30] !== t) {
200
+ t10 = t("Roles");
201
+ $[30] = t;
202
+ $[31] = t10;
203
+ } else {
204
+ t10 = $[31];
205
+ }
206
+ let t11;
207
+ if ($[32] !== t10) {
208
+ t11 = /* @__PURE__ */ jsxDEV("header", {
209
+ className: "border-b border-border px-4 py-3",
210
+ children: /* @__PURE__ */ jsxDEV("span", {
211
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
212
+ children: t10
213
+ }, void 0, false)
214
+ }, void 0, false);
215
+ $[32] = t10;
216
+ $[33] = t11;
217
+ } else {
218
+ t11 = $[33];
219
+ }
220
+ let t12;
221
+ if ($[34] !== loaded || $[35] !== roles || $[36] !== t) {
222
+ t12 = loaded && roles.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
223
+ description: t("No `defineRole` is registered via `rls(policies, { roles })`. Roles back `ctx.auth.can(...)` permission checks."),
224
+ testId: "rls-roles-empty",
225
+ title: t("No roles defined")
226
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(CardContent, {
227
+ className: "px-0",
228
+ children: /* @__PURE__ */ jsxDEV(Table, {
229
+ "data-testid": "rls-roles-table",
230
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
231
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
232
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
233
+ children: t("Role")
234
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
235
+ children: t("Description")
236
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
237
+ children: t("Permissions")
238
+ }, void 0, false)]
239
+ }, void 0, true)
240
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
241
+ children: roles.map(_temp2)
242
+ }, void 0, false)]
243
+ }, void 0, true)
244
+ }, void 0, false);
245
+ $[34] = loaded;
246
+ $[35] = roles;
247
+ $[36] = t;
248
+ $[37] = t12;
249
+ } else {
250
+ t12 = $[37];
251
+ }
252
+ let t13;
253
+ if ($[38] !== t11 || $[39] !== t12) {
254
+ t13 = /* @__PURE__ */ jsxDEV("section", {
255
+ className: "flex flex-col gap-2",
256
+ children: /* @__PURE__ */ jsxDEV(Card, {
257
+ className: "overflow-hidden py-0",
258
+ children: [t11, t12]
259
+ }, void 0, true)
260
+ }, void 0, false);
261
+ $[38] = t11;
262
+ $[39] = t12;
263
+ $[40] = t13;
264
+ } else {
265
+ t13 = $[40];
266
+ }
267
+ let t14;
268
+ if ($[41] !== t13 || $[42] !== t5 || $[43] !== t6 || $[44] !== t7 || $[45] !== t9) {
269
+ t14 = /* @__PURE__ */ jsxDEV("div", {
270
+ className: t5,
271
+ "data-testid": t6,
272
+ children: [t7, t9, t13]
273
+ }, void 0, true);
274
+ $[41] = t13;
275
+ $[42] = t5;
276
+ $[43] = t6;
277
+ $[44] = t7;
278
+ $[45] = t9;
279
+ $[46] = t14;
280
+ } else {
281
+ t14 = $[46];
282
+ }
283
+ return t14;
284
+ };
285
+ function _temp(permission) {
286
+ return /* @__PURE__ */ jsxDEV(Badge, {
287
+ variant: "outline",
288
+ children: permission
289
+ }, permission, false);
290
+ }
291
+ function _temp2(role) {
292
+ return /* @__PURE__ */ jsxDEV(TableRow, {
293
+ "data-testid": `rls-role-${role.name}`,
294
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
295
+ className: "font-mono text-xs",
296
+ children: role.name
297
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
298
+ className: "text-muted-foreground",
299
+ children: role.description ?? ""
300
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
301
+ children: role.permissions.length === 0 ? /* @__PURE__ */ jsxDEV("span", {
302
+ "aria-hidden": "true",
303
+ className: "text-muted-foreground",
304
+ children: "—"
305
+ }, void 0, false) : /* @__PURE__ */ jsxDEV("span", {
306
+ className: "flex flex-wrap gap-1",
307
+ children: role.permissions.map(_temp)
308
+ }, void 0, false)
309
+ }, void 0, false)]
310
+ }, role.name, true);
311
+ }
312
+
313
+ export { RlsPanel as default };