@lunora/studio 1.0.0-alpha.4 → 1.0.0-alpha.40

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 (187) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +33 -18
  4. package/dist/index.js +29 -29
  5. package/dist/mount.d.ts +1 -1
  6. package/dist/mount.js +3 -2
  7. package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
  8. package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
  9. package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
  10. package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
  12. package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
  13. package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
  14. package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
  15. package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
  16. package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
  17. package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
  18. package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
  19. package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
  20. package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
  21. package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
  22. package/dist/packem_chunks/SettingsPanel.js +391 -0
  23. package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +158 -387
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
  25. package/dist/packem_chunks/analytics-panel.js +261 -0
  26. package/dist/packem_chunks/auth-config-panel.js +365 -0
  27. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  28. package/dist/packem_chunks/containers-panel.js +247 -0
  29. package/dist/packem_chunks/dashboards-panel.js +780 -0
  30. package/dist/packem_chunks/fanout-panel.js +482 -0
  31. package/dist/packem_chunks/flags-panel.js +176 -0
  32. package/dist/packem_chunks/kv-browser.js +1896 -0
  33. package/dist/packem_chunks/log-drains-panel.js +273 -0
  34. package/dist/packem_chunks/organizations-panel.js +3178 -0
  35. package/dist/packem_chunks/payments-panel.js +186 -0
  36. package/dist/packem_chunks/permissions-panel.js +805 -0
  37. package/dist/packem_chunks/queues-panel.js +1075 -0
  38. package/dist/packem_chunks/rls-panel.js +315 -0
  39. package/dist/packem_chunks/schedule-panel.js +831 -0
  40. package/dist/packem_chunks/sparkline.js +79 -0
  41. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  42. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  43. package/dist/packem_chunks/users-panel.js +1731 -0
  44. package/dist/packem_chunks/vector-browser.js +281 -0
  45. package/dist/packem_chunks/workflows-panel.js +562 -0
  46. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-BHHJi3Gb.js} +7 -0
  47. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-CBma-lnp.js} +2 -2
  48. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-CQM3pPN7.js} +2 -1
  49. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-X2tkbyHk.js} +1 -1
  50. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-D2ywrdId.js} +198 -247
  51. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-BkTPLzAY.js} +37 -66
  52. package/dist/packem_shared/HomePanel-D1Q9LZgK.js +14 -0
  53. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-Dno-hfDb.js} +2 -1
  54. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-Ctw4jYtU.js} +163 -60
  55. package/dist/packem_shared/Studio-lJhzDAze.js +16 -0
  56. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-DiMkupvZ.js} +276 -11
  57. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-BX8OhG0w.js} +6 -6
  58. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  59. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CNLRTrWw.d.ts} +1 -1
  60. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  61. package/dist/packem_shared/browser-storage-BTrX4y3B.js +215 -0
  62. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  63. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-CdXztApG.js} +1 -1
  64. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  65. package/dist/packem_shared/error-alert-CXjqyGw9.js +114 -0
  66. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-BF-KBDFz.js} +131 -163
  67. package/dist/packem_shared/home-panel-TFcRf9Ui.js +1889 -0
  68. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-CYcbqMjX.js} +44 -3
  69. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  70. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUiJcILV.js} +6 -45
  71. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  72. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  73. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  74. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  75. package/dist/packem_shared/studio-Dh9UlaF_.js +4015 -0
  76. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  77. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-UVIXQJdU.js} +1 -1
  78. package/dist/packem_shared/use-admin-query-CfHYWx5n.js +106 -0
  79. package/dist/packem_shared/use-async-submit-DJQiPc-_.js +91 -0
  80. package/dist/standalone/chunk-23C4TCRO.js +1 -0
  81. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  82. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  83. package/dist/standalone/chunk-3CJW6NWG.js +4 -0
  84. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  85. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  86. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  87. package/dist/standalone/chunk-5ZAA2PVR.js +1 -0
  88. package/dist/standalone/chunk-676HEBIR.js +3 -0
  89. package/dist/standalone/chunk-6VO23MMW.js +4 -0
  90. package/dist/standalone/chunk-7RE5UW27.js +8 -0
  91. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  92. package/dist/standalone/chunk-7YXOPTWI.js +1 -0
  93. package/dist/standalone/chunk-AAVIFQ4Y.js +2 -0
  94. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  95. package/dist/standalone/chunk-AJFQ3LNM.js +1 -0
  96. package/dist/standalone/chunk-AJULNB46.js +4 -0
  97. package/dist/standalone/chunk-BGXOXASQ.js +1 -0
  98. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  99. package/dist/standalone/chunk-BKW7FFEO.js +1 -0
  100. package/dist/standalone/chunk-BOXSWNXZ.js +1 -0
  101. package/dist/standalone/chunk-BXOYVWJR.js +13 -0
  102. package/dist/standalone/chunk-C7WTJLC3.js +1 -0
  103. package/dist/standalone/chunk-CACB34RQ.js +1 -0
  104. package/dist/standalone/chunk-CICVBMEN.js +1 -0
  105. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  106. package/dist/standalone/chunk-CWEAJUHW.js +1 -0
  107. package/dist/standalone/chunk-DC72CQY4.js +76 -0
  108. package/dist/standalone/chunk-DECHEGIC.js +1 -0
  109. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  110. package/dist/standalone/chunk-E75ANNWX.js +19 -0
  111. package/dist/standalone/chunk-ERJNDIXC.js +1 -0
  112. package/dist/standalone/chunk-FKACHRWO.js +1 -0
  113. package/dist/standalone/chunk-FSGCANAU.js +1 -0
  114. package/dist/standalone/chunk-GLUNBZRI.js +1 -0
  115. package/dist/standalone/chunk-GMSGZDDH.js +13 -0
  116. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  117. package/dist/standalone/chunk-H6RKXQZU.js +1 -0
  118. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  119. package/dist/standalone/chunk-HZTGDL4L.js +1 -0
  120. package/dist/standalone/chunk-I7ZZRM7I.js +1 -0
  121. package/dist/standalone/chunk-IXDH4GL5.js +1 -0
  122. package/dist/standalone/chunk-J46WXQYL.js +1 -0
  123. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  124. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  125. package/dist/standalone/chunk-JVODY4EP.js +1 -0
  126. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  127. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  128. package/dist/standalone/chunk-KSKXW5PX.js +1 -0
  129. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  130. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  131. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  132. package/dist/standalone/chunk-LNZIB2MD.js +1 -0
  133. package/dist/standalone/chunk-LYB5L53X.js +1 -0
  134. package/dist/standalone/chunk-MJWVMKQ4.js +6 -0
  135. package/dist/standalone/chunk-MT2J3H7O.js +3 -0
  136. package/dist/standalone/chunk-N746FOQP.js +1 -0
  137. package/dist/standalone/chunk-NC6MBMSI.js +1 -0
  138. package/dist/standalone/chunk-NN27EDQB.js +1 -0
  139. package/dist/standalone/chunk-NY6GDADQ.js +1 -0
  140. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  141. package/dist/standalone/chunk-OY3HD7BJ.js +4 -0
  142. package/dist/standalone/chunk-P5HJXCZS.js +1 -0
  143. package/dist/standalone/chunk-PTS5TW3J.js +1 -0
  144. package/dist/standalone/chunk-Q52CHOSY.js +1 -0
  145. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  146. package/dist/standalone/chunk-QBAT52GB.js +1 -0
  147. package/dist/standalone/chunk-QDBOPDJ7.js +1 -0
  148. package/dist/standalone/chunk-QHFTGJPS.js +4 -0
  149. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  150. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  151. package/dist/standalone/chunk-SG3ALJJU.js +1 -0
  152. package/dist/standalone/chunk-SSI4G2MY.js +1 -0
  153. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  154. package/dist/standalone/chunk-TBMYIZIO.js +1 -0
  155. package/dist/standalone/chunk-TH45YG6Q.js +1 -0
  156. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  157. package/dist/standalone/chunk-UGUEC6BC.js +1 -0
  158. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  159. package/dist/standalone/chunk-UKDJ4H7I.js +1 -0
  160. package/dist/standalone/chunk-V6IWFYAQ.js +1 -0
  161. package/dist/standalone/chunk-V7SRH36W.js +1 -0
  162. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  163. package/dist/standalone/chunk-VON7JUPG.js +1 -0
  164. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  165. package/dist/standalone/chunk-WPNXY7IS.js +1 -0
  166. package/dist/standalone/chunk-X33MSJPP.js +1 -0
  167. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  168. package/dist/standalone/chunk-XRNXOIVZ.js +1 -0
  169. package/dist/standalone/chunk-YAECF5LW.js +1 -0
  170. package/dist/standalone/chunk-YBGC4PPD.js +1 -0
  171. package/dist/standalone/chunk-YNZ7ARWW.js +1 -0
  172. package/dist/standalone/chunk-YTO65GHS.js +1 -0
  173. package/dist/standalone/chunk-ZE6FT5Z3.js +1 -0
  174. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  175. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  176. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  177. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  178. package/dist/standalone/studio.js +104 -246
  179. package/dist/styles.css +2 -2
  180. package/package.json +15 -13
  181. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  182. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  183. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  184. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  185. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  186. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  187. 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-DSwcWIRy.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,140 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { E as ErrorAlert } from '../packem_shared/error-alert-CXjqyGw9.js';
3
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
4
+ import { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
5
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
6
+ 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';
7
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-CfHYWx5n.js';
8
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
9
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js';
10
+ import { jsxDEV } from 'react/jsx-dev-runtime';
11
+
12
+ const operationLabel = (t, operation) => ({
13
+ delete: t("Delete"),
14
+ list: t("List"),
15
+ read: t("Read"),
16
+ write: t("Write")
17
+ })[operation];
18
+ const OPERATION_ORDER = {
19
+ delete: 2,
20
+ list: 3,
21
+ read: 0,
22
+ write: 1
23
+ };
24
+ 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 ?? ""));
25
+ const StorageRulesPanel = () => {
26
+ const $ = c(14);
27
+ const t = useT();
28
+ let t0;
29
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
30
+ t0 = {};
31
+ $[0] = t0;
32
+ } else {
33
+ t0 = $[0];
34
+ }
35
+ const {
36
+ data,
37
+ error,
38
+ errorSource
39
+ } = useAdminQuery(ADMIN_FUNCTIONS.storageRules, t0);
40
+ const loaded = data !== void 0;
41
+ let t1;
42
+ if ($[1] !== data || $[2] !== error || $[3] !== errorSource || $[4] !== loaded || $[5] !== t) {
43
+ const rules = sortRules(Array.isArray(data?.rules) ? data.rules : []);
44
+ let t2;
45
+ if ($[7] !== error || $[8] !== errorSource) {
46
+ t2 = error !== null && /* @__PURE__ */ jsxDEV(ErrorAlert, {
47
+ error: errorSource,
48
+ testId: "storage-rules-error"
49
+ }, void 0, false);
50
+ $[7] = error;
51
+ $[8] = errorSource;
52
+ $[9] = t2;
53
+ } else {
54
+ t2 = $[9];
55
+ }
56
+ let t3;
57
+ if ($[10] !== t) {
58
+ t3 = t("Storage rules are declared in code with defineStorageRule and gate ctx.storage access per bucket. This view is read-only.");
59
+ $[10] = t;
60
+ $[11] = t3;
61
+ } else {
62
+ t3 = $[11];
63
+ }
64
+ let t4;
65
+ if ($[12] !== t3) {
66
+ t4 = /* @__PURE__ */ jsxDEV("p", {
67
+ className: "text-sm text-muted-foreground",
68
+ "data-testid": "storage-rules-note",
69
+ children: t3
70
+ }, void 0, false);
71
+ $[12] = t3;
72
+ $[13] = t4;
73
+ } else {
74
+ t4 = $[13];
75
+ }
76
+ t1 = /* @__PURE__ */ jsxDEV("div", {
77
+ className: "flex flex-col gap-4",
78
+ "data-testid": "lunora-storage-rules-panel",
79
+ children: [t2, t4, loaded && rules.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
80
+ description: t("No defineStorageRule is wired through .use(storageRules(...)) in this deployment. Add one to gate object access by key prefix."),
81
+ testId: "storage-rules-empty",
82
+ title: t("No storage rules defined")
83
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(Card, {
84
+ className: "overflow-hidden py-0",
85
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
86
+ className: "px-0",
87
+ children: /* @__PURE__ */ jsxDEV(Table, {
88
+ "data-testid": "storage-rules-table",
89
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
90
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
91
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
92
+ children: t("Bucket")
93
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
94
+ children: t("Operation")
95
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
96
+ children: t("Key prefix")
97
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
98
+ children: t("Guarded by")
99
+ }, void 0, false)]
100
+ }, void 0, true)
101
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
102
+ children: rules.map((rule) => /* @__PURE__ */ jsxDEV(TableRow, {
103
+ "data-testid": `storage-rule-${rule.bucket}-${rule.on}-${rule.prefix ?? ""}`,
104
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
105
+ className: "font-mono text-xs",
106
+ children: rule.bucket
107
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
108
+ children: /* @__PURE__ */ jsxDEV(Badge, {
109
+ variant: "secondary",
110
+ children: operationLabel(t, rule.on)
111
+ }, void 0, false)
112
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
113
+ className: "font-mono text-xs",
114
+ children: rule.prefix ?? /* @__PURE__ */ jsxDEV("span", {
115
+ className: "text-muted-foreground",
116
+ children: t("(whole bucket)")
117
+ }, void 0, false)
118
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
119
+ className: "font-mono text-xs text-muted-foreground",
120
+ children: rule.procedure
121
+ }, void 0, false)]
122
+ }, `${rule.bucket}:${rule.on}:${rule.prefix ?? ""}:${rule.procedure}`, true))
123
+ }, void 0, false)]
124
+ }, void 0, true)
125
+ }, void 0, false)
126
+ }, void 0, false)]
127
+ }, void 0, true);
128
+ $[1] = data;
129
+ $[2] = error;
130
+ $[3] = errorSource;
131
+ $[4] = loaded;
132
+ $[5] = t;
133
+ $[6] = t1;
134
+ } else {
135
+ t1 = $[6];
136
+ }
137
+ return t1;
138
+ };
139
+
140
+ export { StorageRulesPanel };
@@ -0,0 +1,238 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useState } from 'react';
3
+ import { E as ErrorAlert } from '../packem_shared/error-alert-CXjqyGw9.js';
4
+ import { ShardInput } from '../packem_shared/ShardInput-gx_DZXXn.js';
5
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
6
+ import { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
7
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
8
+ 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';
9
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-CfHYWx5n.js';
10
+ import { useAutoRefresh } from '../packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
11
+ import useDebounced from '../packem_shared/useDebounced-Dxncpg6z.js';
12
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
13
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-BHHJi3Gb.js';
14
+ import { jsxDEV } from 'react/jsx-dev-runtime';
15
+
16
+ const ARGS_MAX = 80;
17
+ const formatArguments = (args) => {
18
+ if (args === void 0) {
19
+ return "";
20
+ }
21
+ const json = JSON.stringify(args);
22
+ return json.length > ARGS_MAX ? `${json.slice(0, ARGS_MAX)}…` : json;
23
+ };
24
+ const toRows = (connections) => {
25
+ const rows = [];
26
+ for (const connection of connections) {
27
+ const connectionId = connection.id.toString();
28
+ if (connection.subscriptions.length === 0) {
29
+ rows.push({
30
+ admin: connection.admin,
31
+ connectionId: connection.id,
32
+ key: `c${connectionId}`,
33
+ subscription: null
34
+ });
35
+ continue;
36
+ }
37
+ connection.subscriptions.forEach((subscription, index) => {
38
+ rows.push({
39
+ admin: connection.admin,
40
+ connectionId: connection.id,
41
+ key: `c${connectionId}-s${index.toString()}`,
42
+ subscription
43
+ });
44
+ });
45
+ }
46
+ return rows;
47
+ };
48
+ const DASH = /* @__PURE__ */ jsxDEV("span", {
49
+ className: "text-muted-foreground",
50
+ children: "—"
51
+ }, void 0, false);
52
+ const SubscriptionsPanel = (t0) => {
53
+ const $ = c(22);
54
+ const {
55
+ initialShardKey
56
+ } = t0;
57
+ const t = useT();
58
+ const [shardKey, setShardKey] = useState(initialShardKey ?? "");
59
+ let t1;
60
+ if ($[0] !== shardKey) {
61
+ t1 = shardKey.trim();
62
+ $[0] = shardKey;
63
+ $[1] = t1;
64
+ } else {
65
+ t1 = $[1];
66
+ }
67
+ const debouncedShard = useDebounced(t1, 400);
68
+ let t2;
69
+ if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
70
+ t2 = {};
71
+ $[2] = t2;
72
+ } else {
73
+ t2 = $[2];
74
+ }
75
+ let t3;
76
+ if ($[3] !== debouncedShard) {
77
+ t3 = {
78
+ keepPreviousData: true,
79
+ shardKey: debouncedShard
80
+ };
81
+ $[3] = debouncedShard;
82
+ $[4] = t3;
83
+ } else {
84
+ t3 = $[4];
85
+ }
86
+ const {
87
+ data: result,
88
+ error,
89
+ errorSource,
90
+ refetch
91
+ } = useAdminQuery(ADMIN_FUNCTIONS.listSubscriptions, t2, t3);
92
+ useAutoRefresh(refetch, true);
93
+ let t4;
94
+ if ($[5] !== error || $[6] !== errorSource || $[7] !== result || $[8] !== shardKey || $[9] !== t) {
95
+ const rows = result === void 0 ? [] : toRows(result.connections);
96
+ let t5;
97
+ if ($[11] !== shardKey) {
98
+ t5 = /* @__PURE__ */ jsxDEV(ShardInput, {
99
+ onChange: setShardKey,
100
+ testId: "subs-shard-input",
101
+ value: shardKey
102
+ }, void 0, false);
103
+ $[11] = shardKey;
104
+ $[12] = t5;
105
+ } else {
106
+ t5 = $[12];
107
+ }
108
+ let t6;
109
+ if ($[13] !== result || $[14] !== t) {
110
+ t6 = result !== void 0 && /* @__PURE__ */ jsxDEV("div", {
111
+ className: "ml-auto flex items-center gap-2 text-sm text-muted-foreground",
112
+ "data-testid": "subs-count",
113
+ children: [/* @__PURE__ */ jsxDEV(Badge, {
114
+ variant: "secondary",
115
+ children: t("{count} connections", {
116
+ count: result.totalConnections
117
+ })
118
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Badge, {
119
+ variant: "secondary",
120
+ children: t("{count} subscriptions", {
121
+ count: result.totalSubscriptions
122
+ })
123
+ }, void 0, false)]
124
+ }, void 0, true);
125
+ $[13] = result;
126
+ $[14] = t;
127
+ $[15] = t6;
128
+ } else {
129
+ t6 = $[15];
130
+ }
131
+ let t7;
132
+ if ($[16] !== t5 || $[17] !== t6) {
133
+ t7 = /* @__PURE__ */ jsxDEV("div", {
134
+ className: "flex flex-wrap items-center gap-2",
135
+ children: [t5, t6]
136
+ }, void 0, true);
137
+ $[16] = t5;
138
+ $[17] = t6;
139
+ $[18] = t7;
140
+ } else {
141
+ t7 = $[18];
142
+ }
143
+ let t8;
144
+ if ($[19] !== error || $[20] !== errorSource) {
145
+ t8 = error !== null && /* @__PURE__ */ jsxDEV(ErrorAlert, {
146
+ error: errorSource,
147
+ testId: "subs-error"
148
+ }, void 0, false);
149
+ $[19] = error;
150
+ $[20] = errorSource;
151
+ $[21] = t8;
152
+ } else {
153
+ t8 = $[21];
154
+ }
155
+ t4 = /* @__PURE__ */ jsxDEV("div", {
156
+ className: "flex flex-col gap-4",
157
+ "data-testid": "subs-panel",
158
+ children: [t7, t8, error === null && result !== void 0 && rows.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
159
+ description: t("Active WebSocket subscriptions on this shard."),
160
+ icon: /* @__PURE__ */ jsxDEV("svg", {
161
+ "aria-hidden": "true",
162
+ fill: "none",
163
+ stroke: "currentColor",
164
+ strokeLinecap: "round",
165
+ strokeLinejoin: "round",
166
+ strokeWidth: 1.6,
167
+ viewBox: "0 0 24 24",
168
+ children: /* @__PURE__ */ jsxDEV("path", {
169
+ 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"
170
+ }, void 0, false)
171
+ }, void 0, false),
172
+ testId: "subs-empty",
173
+ title: t("No active subscriptions.")
174
+ }, void 0, false), error === null && rows.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
175
+ className: "overflow-hidden py-0",
176
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
177
+ className: "px-0",
178
+ children: /* @__PURE__ */ jsxDEV(Table, {
179
+ "data-testid": "subs-table",
180
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
181
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
182
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
183
+ children: t("Connection")
184
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
185
+ children: t("Function path")
186
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
187
+ children: t("Table")
188
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
189
+ children: t("Arguments")
190
+ }, void 0, false)]
191
+ }, void 0, true)
192
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
193
+ children: rows.map((row) => {
194
+ const {
195
+ subscription
196
+ } = row;
197
+ const args = formatArguments(subscription?.args);
198
+ return /* @__PURE__ */ jsxDEV(TableRow, {
199
+ "data-testid": "subs-row",
200
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
201
+ className: "font-medium tabular-nums",
202
+ children: /* @__PURE__ */ jsxDEV("span", {
203
+ className: "inline-flex items-center gap-1.5",
204
+ children: ["#", row.connectionId, row.admin && /* @__PURE__ */ jsxDEV(Badge, {
205
+ variant: "outline",
206
+ children: t("admin")
207
+ }, void 0, false)]
208
+ }, void 0, true)
209
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
210
+ className: "font-mono text-xs",
211
+ children: subscription?.functionPath ?? DASH
212
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
213
+ children: subscription?.table ?? DASH
214
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
215
+ className: "max-w-[32ch] truncate font-mono text-xs text-muted-foreground",
216
+ title: args || void 0,
217
+ children: args || DASH
218
+ }, void 0, false)]
219
+ }, row.key, true);
220
+ })
221
+ }, void 0, false)]
222
+ }, void 0, true)
223
+ }, void 0, false)
224
+ }, void 0, false)]
225
+ }, void 0, true);
226
+ $[5] = error;
227
+ $[6] = errorSource;
228
+ $[7] = result;
229
+ $[8] = shardKey;
230
+ $[9] = t;
231
+ $[10] = t4;
232
+ } else {
233
+ t4 = $[10];
234
+ }
235
+ return t4;
236
+ };
237
+
238
+ export { SubscriptionsPanel as default };