@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,79 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { B as Bar, E as EvilBarChart } from '../packem_shared/bar-chart-Bb__F5-u.js';
3
+ import { jsxDEV } from 'react/jsx-dev-runtime';
4
+
5
+ const SPARKLINE_CONFIG = {
6
+ value: {
7
+ colors: {
8
+ dark: ["var(--foreground)"],
9
+ light: ["var(--foreground)"]
10
+ },
11
+ label: ""
12
+ }
13
+ };
14
+ const Sparkline = (t0) => {
15
+ const $ = c(6);
16
+ const {
17
+ data
18
+ } = t0;
19
+ let t1;
20
+ let t2;
21
+ if ($[0] !== data) {
22
+ t2 = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
23
+ bb0: {
24
+ const bars = data.slice(-16);
25
+ if (bars.length < 3) {
26
+ t2 = null;
27
+ break bb0;
28
+ }
29
+ t1 = bars.map(_temp);
30
+ }
31
+ $[0] = data;
32
+ $[1] = t1;
33
+ $[2] = t2;
34
+ } else {
35
+ t1 = $[1];
36
+ t2 = $[2];
37
+ }
38
+ if (t2 !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel")) {
39
+ return t2;
40
+ }
41
+ const rows = t1;
42
+ let t3;
43
+ if ($[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
44
+ t3 = /* @__PURE__ */ jsxDEV(Bar, {
45
+ dataKey: "value"
46
+ }, void 0, false);
47
+ $[3] = t3;
48
+ } else {
49
+ t3 = $[3];
50
+ }
51
+ let t4;
52
+ if ($[4] !== rows) {
53
+ t4 = /* @__PURE__ */ jsxDEV("div", {
54
+ "aria-hidden": "true",
55
+ className: "h-8 w-28",
56
+ children: /* @__PURE__ */ jsxDEV(EvilBarChart, {
57
+ animationType: "none",
58
+ barCategoryGap: 1,
59
+ className: "h-8 w-full",
60
+ config: SPARKLINE_CONFIG,
61
+ data: rows,
62
+ children: t3
63
+ }, void 0, false)
64
+ }, void 0, false);
65
+ $[4] = rows;
66
+ $[5] = t4;
67
+ } else {
68
+ t4 = $[5];
69
+ }
70
+ return t4;
71
+ };
72
+ function _temp(value, index) {
73
+ return {
74
+ index,
75
+ value
76
+ };
77
+ }
78
+
79
+ export { Sparkline };
@@ -0,0 +1,138 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
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 operationLabel = (t, operation) => ({
12
+ delete: t("Delete"),
13
+ list: t("List"),
14
+ read: t("Read"),
15
+ write: t("Write")
16
+ })[operation];
17
+ const OPERATION_ORDER = {
18
+ delete: 2,
19
+ list: 3,
20
+ read: 0,
21
+ write: 1
22
+ };
23
+ const sortRules = (rules) => [...rules].toSorted((a, b) => a.bucket.localeCompare(b.bucket) || OPERATION_ORDER[a.on] - OPERATION_ORDER[b.on] || (a.prefix ?? "").localeCompare(b.prefix ?? ""));
24
+ const StorageRulesPanel = () => {
25
+ const $ = c(12);
26
+ const t = useT();
27
+ let t0;
28
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
29
+ t0 = {};
30
+ $[0] = t0;
31
+ } else {
32
+ t0 = $[0];
33
+ }
34
+ const {
35
+ data,
36
+ error
37
+ } = useAdminQuery(ADMIN_FUNCTIONS.storageRules, t0);
38
+ const loaded = data !== void 0;
39
+ let t1;
40
+ if ($[1] !== data || $[2] !== error || $[3] !== loaded || $[4] !== t) {
41
+ const rules = sortRules(Array.isArray(data?.rules) ? data.rules : []);
42
+ let t2;
43
+ if ($[6] !== error) {
44
+ t2 = error !== null && /* @__PURE__ */ jsxDEV("p", {
45
+ className: "text-sm text-destructive",
46
+ "data-testid": "storage-rules-error",
47
+ role: "alert",
48
+ children: error
49
+ }, void 0, false);
50
+ $[6] = error;
51
+ $[7] = t2;
52
+ } else {
53
+ t2 = $[7];
54
+ }
55
+ let t3;
56
+ if ($[8] !== t) {
57
+ t3 = t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only.");
58
+ $[8] = t;
59
+ $[9] = t3;
60
+ } else {
61
+ t3 = $[9];
62
+ }
63
+ let t4;
64
+ if ($[10] !== t3) {
65
+ t4 = /* @__PURE__ */ jsxDEV("p", {
66
+ className: "text-sm text-muted-foreground",
67
+ "data-testid": "storage-rules-note",
68
+ children: t3
69
+ }, void 0, false);
70
+ $[10] = t3;
71
+ $[11] = t4;
72
+ } else {
73
+ t4 = $[11];
74
+ }
75
+ t1 = /* @__PURE__ */ jsxDEV("div", {
76
+ className: "flex flex-col gap-4",
77
+ "data-testid": "lunora-storage-rules-panel",
78
+ children: [t2, t4, loaded && rules.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
79
+ description: t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),
80
+ testId: "storage-rules-empty",
81
+ title: t("No storage rules defined")
82
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(Card, {
83
+ className: "overflow-hidden py-0",
84
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
85
+ className: "px-0",
86
+ children: /* @__PURE__ */ jsxDEV(Table, {
87
+ "data-testid": "storage-rules-table",
88
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
89
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
90
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
91
+ children: t("Bucket")
92
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
93
+ children: t("Operation")
94
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
95
+ children: t("Key prefix")
96
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
97
+ children: t("Guarded by")
98
+ }, void 0, false)]
99
+ }, void 0, true)
100
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
101
+ children: rules.map((rule) => /* @__PURE__ */ jsxDEV(TableRow, {
102
+ "data-testid": `storage-rule-${rule.bucket}-${rule.on}-${rule.prefix ?? ""}`,
103
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
104
+ className: "font-mono text-xs",
105
+ children: rule.bucket
106
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
107
+ children: /* @__PURE__ */ jsxDEV(Badge, {
108
+ variant: "secondary",
109
+ children: operationLabel(t, rule.on)
110
+ }, void 0, false)
111
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
112
+ className: "font-mono text-xs",
113
+ children: rule.prefix ?? /* @__PURE__ */ jsxDEV("span", {
114
+ className: "text-muted-foreground",
115
+ children: t("(whole bucket)")
116
+ }, void 0, false)
117
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
118
+ className: "font-mono text-xs text-muted-foreground",
119
+ children: rule.procedure
120
+ }, void 0, false)]
121
+ }, `${rule.bucket}:${rule.on}:${rule.prefix ?? ""}:${rule.procedure}`, true))
122
+ }, void 0, false)]
123
+ }, void 0, true)
124
+ }, void 0, false)
125
+ }, void 0, false)]
126
+ }, void 0, true);
127
+ $[1] = data;
128
+ $[2] = error;
129
+ $[3] = loaded;
130
+ $[4] = t;
131
+ $[5] = t1;
132
+ } else {
133
+ t1 = $[5];
134
+ }
135
+ return t1;
136
+ };
137
+
138
+ export { StorageRulesPanel };
@@ -0,0 +1,236 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useState } from 'react';
3
+ import { ShardInput } from '../packem_shared/ShardInput-gx_DZXXn.js';
4
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
5
+ import { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
6
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
7
+ 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';
8
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
9
+ import { useAutoRefresh } from '../packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
10
+ import useDebounced from '../packem_shared/useDebounced-Dxncpg6z.js';
11
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
12
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js';
13
+ import { jsxDEV } from 'react/jsx-dev-runtime';
14
+
15
+ const ARGS_MAX = 80;
16
+ const formatArguments = (args) => {
17
+ if (args === void 0) {
18
+ return "";
19
+ }
20
+ const json = JSON.stringify(args);
21
+ return json.length > ARGS_MAX ? `${json.slice(0, ARGS_MAX)}…` : json;
22
+ };
23
+ const toRows = (connections) => {
24
+ const rows = [];
25
+ for (const connection of connections) {
26
+ const connectionId = connection.id.toString();
27
+ if (connection.subscriptions.length === 0) {
28
+ rows.push({
29
+ admin: connection.admin,
30
+ connectionId: connection.id,
31
+ key: `c${connectionId}`,
32
+ subscription: null
33
+ });
34
+ continue;
35
+ }
36
+ connection.subscriptions.forEach((subscription, index) => {
37
+ rows.push({
38
+ admin: connection.admin,
39
+ connectionId: connection.id,
40
+ key: `c${connectionId}-s${index.toString()}`,
41
+ subscription
42
+ });
43
+ });
44
+ }
45
+ return rows;
46
+ };
47
+ const DASH = /* @__PURE__ */ jsxDEV("span", {
48
+ className: "text-muted-foreground",
49
+ children: "—"
50
+ }, void 0, false);
51
+ const SubscriptionsPanel = (t0) => {
52
+ const $ = c(20);
53
+ const {
54
+ initialShardKey
55
+ } = t0;
56
+ const t = useT();
57
+ const [shardKey, setShardKey] = useState(initialShardKey ?? "");
58
+ let t1;
59
+ if ($[0] !== shardKey) {
60
+ t1 = shardKey.trim();
61
+ $[0] = shardKey;
62
+ $[1] = t1;
63
+ } else {
64
+ t1 = $[1];
65
+ }
66
+ const debouncedShard = useDebounced(t1, 400);
67
+ let t2;
68
+ if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
69
+ t2 = {};
70
+ $[2] = t2;
71
+ } else {
72
+ t2 = $[2];
73
+ }
74
+ let t3;
75
+ if ($[3] !== debouncedShard) {
76
+ t3 = {
77
+ keepPreviousData: true,
78
+ shardKey: debouncedShard
79
+ };
80
+ $[3] = debouncedShard;
81
+ $[4] = t3;
82
+ } else {
83
+ t3 = $[4];
84
+ }
85
+ const {
86
+ data: result,
87
+ error,
88
+ refetch
89
+ } = useAdminQuery(ADMIN_FUNCTIONS.listSubscriptions, t2, t3);
90
+ useAutoRefresh(refetch, true);
91
+ let t4;
92
+ if ($[5] !== error || $[6] !== result || $[7] !== shardKey || $[8] !== t) {
93
+ const rows = result === void 0 ? [] : toRows(result.connections);
94
+ let t5;
95
+ if ($[10] !== shardKey) {
96
+ t5 = /* @__PURE__ */ jsxDEV(ShardInput, {
97
+ onChange: setShardKey,
98
+ testId: "subs-shard-input",
99
+ value: shardKey
100
+ }, void 0, false);
101
+ $[10] = shardKey;
102
+ $[11] = t5;
103
+ } else {
104
+ t5 = $[11];
105
+ }
106
+ let t6;
107
+ if ($[12] !== result || $[13] !== t) {
108
+ t6 = result !== void 0 && /* @__PURE__ */ jsxDEV("div", {
109
+ className: "ml-auto flex items-center gap-2 text-sm text-muted-foreground",
110
+ "data-testid": "subs-count",
111
+ children: [/* @__PURE__ */ jsxDEV(Badge, {
112
+ variant: "secondary",
113
+ children: t("{count} connections", {
114
+ count: result.totalConnections
115
+ })
116
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Badge, {
117
+ variant: "secondary",
118
+ children: t("{count} subscriptions", {
119
+ count: result.totalSubscriptions
120
+ })
121
+ }, void 0, false)]
122
+ }, void 0, true);
123
+ $[12] = result;
124
+ $[13] = t;
125
+ $[14] = t6;
126
+ } else {
127
+ t6 = $[14];
128
+ }
129
+ let t7;
130
+ if ($[15] !== t5 || $[16] !== t6) {
131
+ t7 = /* @__PURE__ */ jsxDEV("div", {
132
+ className: "flex flex-wrap items-center gap-2",
133
+ children: [t5, t6]
134
+ }, void 0, true);
135
+ $[15] = t5;
136
+ $[16] = t6;
137
+ $[17] = t7;
138
+ } else {
139
+ t7 = $[17];
140
+ }
141
+ let t8;
142
+ if ($[18] !== error) {
143
+ t8 = error !== null && /* @__PURE__ */ jsxDEV("p", {
144
+ className: "text-sm text-destructive",
145
+ "data-testid": "subs-error",
146
+ role: "alert",
147
+ children: error
148
+ }, void 0, false);
149
+ $[18] = error;
150
+ $[19] = t8;
151
+ } else {
152
+ t8 = $[19];
153
+ }
154
+ t4 = /* @__PURE__ */ jsxDEV("div", {
155
+ className: "flex flex-col gap-4",
156
+ "data-testid": "subs-panel",
157
+ children: [t7, t8, error === null && result !== void 0 && rows.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
158
+ description: t("Active WebSocket subscriptions on this shard."),
159
+ icon: /* @__PURE__ */ jsxDEV("svg", {
160
+ "aria-hidden": "true",
161
+ fill: "none",
162
+ stroke: "currentColor",
163
+ strokeLinecap: "round",
164
+ strokeLinejoin: "round",
165
+ strokeWidth: 1.6,
166
+ viewBox: "0 0 24 24",
167
+ children: /* @__PURE__ */ jsxDEV("path", {
168
+ d: "M5 12a7 7 0 0 1 14 0M8 12a4 4 0 0 1 8 0M12 12v8m0-8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z"
169
+ }, void 0, false)
170
+ }, void 0, false),
171
+ testId: "subs-empty",
172
+ title: t("No active subscriptions.")
173
+ }, void 0, false), error === null && rows.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
174
+ className: "overflow-hidden py-0",
175
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
176
+ className: "px-0",
177
+ children: /* @__PURE__ */ jsxDEV(Table, {
178
+ "data-testid": "subs-table",
179
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
180
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
181
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
182
+ children: t("Connection")
183
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
184
+ children: t("Function path")
185
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
186
+ children: t("Table")
187
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
188
+ children: t("Arguments")
189
+ }, void 0, false)]
190
+ }, void 0, true)
191
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
192
+ children: rows.map((row) => {
193
+ const {
194
+ subscription
195
+ } = row;
196
+ const args = formatArguments(subscription?.args);
197
+ return /* @__PURE__ */ jsxDEV(TableRow, {
198
+ "data-testid": "subs-row",
199
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
200
+ className: "font-medium tabular-nums",
201
+ children: /* @__PURE__ */ jsxDEV("span", {
202
+ className: "inline-flex items-center gap-1.5",
203
+ children: ["#", row.connectionId, row.admin && /* @__PURE__ */ jsxDEV(Badge, {
204
+ variant: "outline",
205
+ children: t("admin")
206
+ }, void 0, false)]
207
+ }, void 0, true)
208
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
209
+ className: "font-mono text-xs",
210
+ children: subscription?.functionPath ?? DASH
211
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
212
+ children: subscription?.table ?? DASH
213
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
214
+ className: "max-w-[32ch] truncate font-mono text-xs text-muted-foreground",
215
+ title: args || void 0,
216
+ children: args || DASH
217
+ }, void 0, false)]
218
+ }, row.key, true);
219
+ })
220
+ }, void 0, false)]
221
+ }, void 0, true)
222
+ }, void 0, false)
223
+ }, void 0, false)]
224
+ }, void 0, true);
225
+ $[5] = error;
226
+ $[6] = result;
227
+ $[7] = shardKey;
228
+ $[8] = t;
229
+ $[9] = t4;
230
+ } else {
231
+ t4 = $[9];
232
+ }
233
+ return t4;
234
+ };
235
+
236
+ export { SubscriptionsPanel as default };