@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,481 @@
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 } 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, Fragment } from 'react/jsx-dev-runtime';
14
+
15
+ const formatMs = (ms) => `${ms.toString()} ms`;
16
+ const isFanoutIdle = (result) => result.totalConnections === 0 && result.shapePoke.passes === 0 && result.whisper.passes === 0;
17
+ const StatCard = (t0) => {
18
+ const $ = c(8);
19
+ const {
20
+ label,
21
+ testId,
22
+ value
23
+ } = t0;
24
+ let t1;
25
+ if ($[0] !== label) {
26
+ t1 = /* @__PURE__ */ jsxDEV("span", {
27
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
28
+ children: label
29
+ }, void 0, false);
30
+ $[0] = label;
31
+ $[1] = t1;
32
+ } else {
33
+ t1 = $[1];
34
+ }
35
+ let t2;
36
+ if ($[2] !== testId || $[3] !== value) {
37
+ t2 = /* @__PURE__ */ jsxDEV("span", {
38
+ className: "truncate text-2xl font-semibold tabular-nums text-foreground",
39
+ "data-testid": testId,
40
+ children: value
41
+ }, void 0, false);
42
+ $[2] = testId;
43
+ $[3] = value;
44
+ $[4] = t2;
45
+ } else {
46
+ t2 = $[4];
47
+ }
48
+ let t3;
49
+ if ($[5] !== t1 || $[6] !== t2) {
50
+ t3 = /* @__PURE__ */ jsxDEV(Card, {
51
+ className: "gap-0 py-0",
52
+ children: /* @__PURE__ */ jsxDEV("div", {
53
+ className: "flex flex-col gap-2.5 p-4",
54
+ children: [t1, t2]
55
+ }, void 0, true)
56
+ }, void 0, false);
57
+ $[5] = t1;
58
+ $[6] = t2;
59
+ $[7] = t3;
60
+ } else {
61
+ t3 = $[7];
62
+ }
63
+ return t3;
64
+ };
65
+ const PathCounters = (t0) => {
66
+ const $ = c(48);
67
+ const {
68
+ counters,
69
+ includeTiming,
70
+ prefix,
71
+ t,
72
+ title
73
+ } = t0;
74
+ const t1 = `${prefix}-section`;
75
+ let t2;
76
+ if ($[0] !== title) {
77
+ t2 = /* @__PURE__ */ jsxDEV("h3", {
78
+ className: "text-sm font-medium text-foreground",
79
+ children: title
80
+ }, void 0, false);
81
+ $[0] = title;
82
+ $[1] = t2;
83
+ } else {
84
+ t2 = $[1];
85
+ }
86
+ const t3 = `${prefix}-stats`;
87
+ let t4;
88
+ if ($[2] !== t) {
89
+ t4 = t("Passes");
90
+ $[2] = t;
91
+ $[3] = t4;
92
+ } else {
93
+ t4 = $[3];
94
+ }
95
+ const t5 = `${prefix}-passes`;
96
+ let t6;
97
+ if ($[4] !== counters.passes || $[5] !== t4 || $[6] !== t5) {
98
+ t6 = /* @__PURE__ */ jsxDEV(StatCard, {
99
+ label: t4,
100
+ testId: t5,
101
+ value: counters.passes
102
+ }, void 0, false);
103
+ $[4] = counters.passes;
104
+ $[5] = t4;
105
+ $[6] = t5;
106
+ $[7] = t6;
107
+ } else {
108
+ t6 = $[7];
109
+ }
110
+ let t7;
111
+ if ($[8] !== t) {
112
+ t7 = t("Sockets iterated");
113
+ $[8] = t;
114
+ $[9] = t7;
115
+ } else {
116
+ t7 = $[9];
117
+ }
118
+ const t8 = `${prefix}-iterated`;
119
+ let t9;
120
+ if ($[10] !== counters.socketsIterated || $[11] !== t7 || $[12] !== t8) {
121
+ t9 = /* @__PURE__ */ jsxDEV(StatCard, {
122
+ label: t7,
123
+ testId: t8,
124
+ value: counters.socketsIterated
125
+ }, void 0, false);
126
+ $[10] = counters.socketsIterated;
127
+ $[11] = t7;
128
+ $[12] = t8;
129
+ $[13] = t9;
130
+ } else {
131
+ t9 = $[13];
132
+ }
133
+ let t10;
134
+ if ($[14] !== t) {
135
+ t10 = t("Delivered");
136
+ $[14] = t;
137
+ $[15] = t10;
138
+ } else {
139
+ t10 = $[15];
140
+ }
141
+ const t11 = `${prefix}-delivered`;
142
+ let t12;
143
+ if ($[16] !== counters.socketsDelivered || $[17] !== t10 || $[18] !== t11) {
144
+ t12 = /* @__PURE__ */ jsxDEV(StatCard, {
145
+ label: t10,
146
+ testId: t11,
147
+ value: counters.socketsDelivered
148
+ }, void 0, false);
149
+ $[16] = counters.socketsDelivered;
150
+ $[17] = t10;
151
+ $[18] = t11;
152
+ $[19] = t12;
153
+ } else {
154
+ t12 = $[19];
155
+ }
156
+ let t13;
157
+ if ($[20] !== t) {
158
+ t13 = t("Peak width");
159
+ $[20] = t;
160
+ $[21] = t13;
161
+ } else {
162
+ t13 = $[21];
163
+ }
164
+ const t14 = `${prefix}-peak`;
165
+ let t15;
166
+ if ($[22] !== counters.peakSocketsIterated || $[23] !== t13 || $[24] !== t14) {
167
+ t15 = /* @__PURE__ */ jsxDEV(StatCard, {
168
+ label: t13,
169
+ testId: t14,
170
+ value: counters.peakSocketsIterated
171
+ }, void 0, false);
172
+ $[22] = counters.peakSocketsIterated;
173
+ $[23] = t13;
174
+ $[24] = t14;
175
+ $[25] = t15;
176
+ } else {
177
+ t15 = $[25];
178
+ }
179
+ let t16;
180
+ if ($[26] !== counters.totalMs || $[27] !== includeTiming || $[28] !== prefix || $[29] !== t) {
181
+ t16 = includeTiming && /* @__PURE__ */ jsxDEV(StatCard, {
182
+ label: t("Total time"),
183
+ testId: `${prefix}-total-ms`,
184
+ value: formatMs(counters.totalMs)
185
+ }, void 0, false);
186
+ $[26] = counters.totalMs;
187
+ $[27] = includeTiming;
188
+ $[28] = prefix;
189
+ $[29] = t;
190
+ $[30] = t16;
191
+ } else {
192
+ t16 = $[30];
193
+ }
194
+ let t17;
195
+ if ($[31] !== counters.maxMs || $[32] !== includeTiming || $[33] !== prefix || $[34] !== t) {
196
+ t17 = includeTiming && /* @__PURE__ */ jsxDEV(StatCard, {
197
+ label: t("Max time"),
198
+ testId: `${prefix}-max-ms`,
199
+ value: formatMs(counters.maxMs)
200
+ }, void 0, false);
201
+ $[31] = counters.maxMs;
202
+ $[32] = includeTiming;
203
+ $[33] = prefix;
204
+ $[34] = t;
205
+ $[35] = t17;
206
+ } else {
207
+ t17 = $[35];
208
+ }
209
+ let t18;
210
+ if ($[36] !== t12 || $[37] !== t15 || $[38] !== t16 || $[39] !== t17 || $[40] !== t3 || $[41] !== t6 || $[42] !== t9) {
211
+ t18 = /* @__PURE__ */ jsxDEV("dl", {
212
+ className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3",
213
+ "data-testid": t3,
214
+ children: [t6, t9, t12, t15, t16, t17]
215
+ }, void 0, true);
216
+ $[36] = t12;
217
+ $[37] = t15;
218
+ $[38] = t16;
219
+ $[39] = t17;
220
+ $[40] = t3;
221
+ $[41] = t6;
222
+ $[42] = t9;
223
+ $[43] = t18;
224
+ } else {
225
+ t18 = $[43];
226
+ }
227
+ let t19;
228
+ if ($[44] !== t1 || $[45] !== t18 || $[46] !== t2) {
229
+ t19 = /* @__PURE__ */ jsxDEV("section", {
230
+ className: "flex flex-col gap-2",
231
+ "data-testid": t1,
232
+ children: [t2, t18]
233
+ }, void 0, true);
234
+ $[44] = t1;
235
+ $[45] = t18;
236
+ $[46] = t2;
237
+ $[47] = t19;
238
+ } else {
239
+ t19 = $[47];
240
+ }
241
+ return t19;
242
+ };
243
+ const FanoutPanel = (t0) => {
244
+ const $ = c(31);
245
+ const {
246
+ initialShardKey
247
+ } = t0;
248
+ const t = useT();
249
+ const [shardKey, setShardKey] = useState(initialShardKey ?? "");
250
+ let t1;
251
+ if ($[0] !== shardKey) {
252
+ t1 = shardKey.trim();
253
+ $[0] = shardKey;
254
+ $[1] = t1;
255
+ } else {
256
+ t1 = $[1];
257
+ }
258
+ const debouncedShard = useDebounced(t1, 400);
259
+ let t2;
260
+ if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
261
+ t2 = {};
262
+ $[2] = t2;
263
+ } else {
264
+ t2 = $[2];
265
+ }
266
+ let t3;
267
+ if ($[3] !== debouncedShard) {
268
+ t3 = {
269
+ keepPreviousData: true,
270
+ shardKey: debouncedShard
271
+ };
272
+ $[3] = debouncedShard;
273
+ $[4] = t3;
274
+ } else {
275
+ t3 = $[4];
276
+ }
277
+ const {
278
+ data: result,
279
+ error,
280
+ refetch
281
+ } = useAdminQuery(ADMIN_FUNCTIONS.getFanoutMetrics, t2, t3);
282
+ useAutoRefresh(refetch, true);
283
+ let t4;
284
+ if ($[5] !== result) {
285
+ t4 = result !== void 0 && isFanoutIdle(result);
286
+ $[5] = result;
287
+ $[6] = t4;
288
+ } else {
289
+ t4 = $[6];
290
+ }
291
+ const isIdle = t4;
292
+ let t5;
293
+ if ($[7] !== shardKey) {
294
+ t5 = /* @__PURE__ */ jsxDEV(ShardInput, {
295
+ onChange: setShardKey,
296
+ testId: "fanout-shard-input",
297
+ value: shardKey
298
+ }, void 0, false);
299
+ $[7] = shardKey;
300
+ $[8] = t5;
301
+ } else {
302
+ t5 = $[8];
303
+ }
304
+ let t6;
305
+ if ($[9] !== result || $[10] !== t) {
306
+ t6 = result !== void 0 && /* @__PURE__ */ jsxDEV("div", {
307
+ className: "ml-auto flex items-center gap-2 text-sm text-muted-foreground",
308
+ "data-testid": "fanout-count",
309
+ children: [result.promoted && /* @__PURE__ */ jsxDEV(Badge, {
310
+ "data-testid": "fanout-promoted",
311
+ variant: result.relayCount >= result.maxRelays ? "destructive" : "default",
312
+ children: result.relayCount >= result.maxRelays ? t("auto-scaled: {relayCount}/{maxRelays} relays (at ceiling)", {
313
+ maxRelays: result.maxRelays,
314
+ relayCount: result.relayCount
315
+ }) : t("auto-scaled: {relayCount}/{maxRelays} relays", {
316
+ maxRelays: result.maxRelays,
317
+ relayCount: result.relayCount
318
+ })
319
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Badge, {
320
+ variant: "secondary",
321
+ children: t("{count} connections", {
322
+ count: result.totalConnections
323
+ })
324
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Badge, {
325
+ variant: "secondary",
326
+ children: t("peak {count} subscribers", {
327
+ count: result.peakSubscribers
328
+ })
329
+ }, void 0, false)]
330
+ }, void 0, true);
331
+ $[9] = result;
332
+ $[10] = t;
333
+ $[11] = t6;
334
+ } else {
335
+ t6 = $[11];
336
+ }
337
+ let t7;
338
+ if ($[12] !== t5 || $[13] !== t6) {
339
+ t7 = /* @__PURE__ */ jsxDEV("div", {
340
+ className: "flex flex-wrap items-center gap-2",
341
+ children: [t5, t6]
342
+ }, void 0, true);
343
+ $[12] = t5;
344
+ $[13] = t6;
345
+ $[14] = t7;
346
+ } else {
347
+ t7 = $[14];
348
+ }
349
+ let t8;
350
+ if ($[15] !== error) {
351
+ t8 = error !== null && /* @__PURE__ */ jsxDEV("p", {
352
+ className: "text-sm text-destructive",
353
+ "data-testid": "fanout-error",
354
+ role: "alert",
355
+ children: error
356
+ }, void 0, false);
357
+ $[15] = error;
358
+ $[16] = t8;
359
+ } else {
360
+ t8 = $[16];
361
+ }
362
+ let t9;
363
+ if ($[17] !== error || $[18] !== isIdle || $[19] !== t) {
364
+ t9 = error === null && isIdle && /* @__PURE__ */ jsxDEV(EmptyState, {
365
+ description: t("Realtime fan-out cost and per-topic subscriber counts for this shard."),
366
+ icon: /* @__PURE__ */ jsxDEV("svg", {
367
+ "aria-hidden": "true",
368
+ fill: "none",
369
+ stroke: "currentColor",
370
+ strokeLinecap: "round",
371
+ strokeLinejoin: "round",
372
+ strokeWidth: 1.6,
373
+ viewBox: "0 0 24 24",
374
+ children: /* @__PURE__ */ jsxDEV("path", {
375
+ d: "M4 12h4l3 7 4-14 3 7h2"
376
+ }, void 0, false)
377
+ }, void 0, false),
378
+ testId: "fanout-empty",
379
+ title: t("No fan-out activity yet.")
380
+ }, void 0, false);
381
+ $[17] = error;
382
+ $[18] = isIdle;
383
+ $[19] = t;
384
+ $[20] = t9;
385
+ } else {
386
+ t9 = $[20];
387
+ }
388
+ let t10;
389
+ if ($[21] !== error || $[22] !== isIdle || $[23] !== result || $[24] !== t) {
390
+ t10 = error === null && result !== void 0 && !isIdle && /* @__PURE__ */ jsxDEV(Fragment, {
391
+ children: [result.topics.length > 0 && /* @__PURE__ */ jsxDEV("section", {
392
+ className: "flex flex-col gap-2",
393
+ "data-testid": "fanout-topics-section",
394
+ children: [/* @__PURE__ */ jsxDEV("h3", {
395
+ className: "text-sm font-medium text-foreground",
396
+ children: t("Hot topics")
397
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Card, {
398
+ className: "overflow-hidden py-0",
399
+ children: /* @__PURE__ */ jsxDEV(Table, {
400
+ "data-testid": "fanout-topics-table",
401
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
402
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
403
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
404
+ children: t("Topic")
405
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
406
+ children: t("Kind")
407
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
408
+ className: "text-right",
409
+ children: t("Subscribers")
410
+ }, void 0, false)]
411
+ }, void 0, true)
412
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
413
+ children: result.topics.map(_temp)
414
+ }, void 0, false)]
415
+ }, void 0, true)
416
+ }, void 0, false)]
417
+ }, void 0, true), /* @__PURE__ */ jsxDEV("section", {
418
+ className: "flex flex-col gap-3",
419
+ "data-testid": "fanout-cost",
420
+ children: [/* @__PURE__ */ jsxDEV("h2", {
421
+ className: "text-sm font-medium text-muted-foreground",
422
+ children: t("Fan-out cost since this instance woke")
423
+ }, void 0, false), /* @__PURE__ */ jsxDEV(PathCounters, {
424
+ counters: result.shapePoke,
425
+ includeTiming: true,
426
+ prefix: "fanout-poke",
427
+ t,
428
+ title: t("Shape pokes")
429
+ }, void 0, false), /* @__PURE__ */ jsxDEV(PathCounters, {
430
+ counters: result.whisper,
431
+ includeTiming: false,
432
+ prefix: "fanout-whisper",
433
+ t,
434
+ title: t("Whisper broadcasts")
435
+ }, void 0, false)]
436
+ }, void 0, true)]
437
+ }, void 0, true);
438
+ $[21] = error;
439
+ $[22] = isIdle;
440
+ $[23] = result;
441
+ $[24] = t;
442
+ $[25] = t10;
443
+ } else {
444
+ t10 = $[25];
445
+ }
446
+ let t11;
447
+ if ($[26] !== t10 || $[27] !== t7 || $[28] !== t8 || $[29] !== t9) {
448
+ t11 = /* @__PURE__ */ jsxDEV("div", {
449
+ className: "flex flex-col gap-4",
450
+ "data-testid": "fanout-panel",
451
+ children: [t7, t8, t9, t10]
452
+ }, void 0, true);
453
+ $[26] = t10;
454
+ $[27] = t7;
455
+ $[28] = t8;
456
+ $[29] = t9;
457
+ $[30] = t11;
458
+ } else {
459
+ t11 = $[30];
460
+ }
461
+ return t11;
462
+ };
463
+ function _temp(topic) {
464
+ return /* @__PURE__ */ jsxDEV(TableRow, {
465
+ "data-testid": "fanout-topic-row",
466
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
467
+ className: "font-mono text-xs",
468
+ children: topic.topic
469
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
470
+ children: /* @__PURE__ */ jsxDEV(Badge, {
471
+ variant: "outline",
472
+ children: topic.kind
473
+ }, void 0, false)
474
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
475
+ className: "text-right font-medium tabular-nums",
476
+ children: topic.subscribers
477
+ }, void 0, false)]
478
+ }, `${topic.kind}:${topic.topic}`, true);
479
+ }
480
+
481
+ export { FanoutPanel as default };
@@ -0,0 +1,176 @@
1
+ import { useState, useMemo } from 'react';
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 { L as Label } from '../packem_shared/label-D8ykjn5J.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 { T as Textarea } from '../packem_shared/textarea-D3gaCU_-.js';
8
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
9
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
10
+ import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-CdaxLGkE.js';
11
+ import { jsxDEV } from 'react/jsx-dev-runtime';
12
+
13
+ const parseContext = (raw) => {
14
+ const trimmed = raw.trim();
15
+ if (trimmed.length === 0) {
16
+ return {
17
+ context: void 0,
18
+ error: null
19
+ };
20
+ }
21
+ try {
22
+ const parsed = JSON.parse(trimmed);
23
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
24
+ return {
25
+ context: void 0,
26
+ error: "Targeting context must be a JSON object."
27
+ };
28
+ }
29
+ return {
30
+ context: parsed,
31
+ error: null
32
+ };
33
+ } catch {
34
+ return {
35
+ context: void 0,
36
+ error: "Targeting context is not valid JSON."
37
+ };
38
+ }
39
+ };
40
+ const CONTEXT_PLACEHOLDER = '{ "targetingKey": "user-123", "plan": "premium" }';
41
+ const formatValue = (evaluation) => {
42
+ if (evaluation.type === "object") {
43
+ return JSON.stringify(evaluation.value);
44
+ }
45
+ return String(evaluation.value);
46
+ };
47
+ const FlagsPanel = ({
48
+ initialShardKey = ""
49
+ }) => {
50
+ const t = useT();
51
+ const [contextText, setContextText] = useState("");
52
+ const {
53
+ context,
54
+ error: contextError
55
+ } = parseContext(contextText);
56
+ const args = useMemo(() => context === void 0 ? {} : {
57
+ context
58
+ }, [context]);
59
+ const {
60
+ data,
61
+ error,
62
+ liveError
63
+ } = useAdminQuery(ADMIN_FUNCTIONS.listFlags, args, {
64
+ live: true,
65
+ shardKey: initialShardKey
66
+ });
67
+ const loaded = data !== void 0;
68
+ const configured = data?.configured ?? false;
69
+ const flags = useMemo(() => Array.isArray(data?.flags) ? [...data.flags].toSorted((a, b) => a.key.localeCompare(b.key)) : [], [data]);
70
+ let body;
71
+ if (loaded && !configured) {
72
+ body = /* @__PURE__ */ jsxDEV(EmptyState, {
73
+ description: t("No @lunora/flags provider is wired in this deployment. Add lunora/flags.ts with defineFlags({ provider }) to gate code paths on feature flags."),
74
+ testId: "flags-unconfigured",
75
+ title: t("No flags provider configured")
76
+ }, void 0, false);
77
+ } else if (loaded && flags.length === 0) {
78
+ body = /* @__PURE__ */ jsxDEV(EmptyState, {
79
+ description: t('A flags provider is configured, but no handler reads a flag yet. Call ctx.flags.boolean("key", false) in a query, mutation, or action.'),
80
+ testId: "flags-empty",
81
+ title: t("No flags read")
82
+ }, void 0, false);
83
+ } else {
84
+ body = /* @__PURE__ */ jsxDEV(Card, {
85
+ className: "overflow-hidden py-0",
86
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
87
+ className: "px-0",
88
+ children: /* @__PURE__ */ jsxDEV(Table, {
89
+ "data-testid": "flags-table",
90
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
91
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
92
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
93
+ children: t("Key")
94
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
95
+ children: t("Type")
96
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
97
+ children: t("Value")
98
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
99
+ children: t("Reason")
100
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
101
+ children: t("Variant")
102
+ }, void 0, false)]
103
+ }, void 0, true)
104
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
105
+ children: flags.map((flag) => /* @__PURE__ */ jsxDEV(TableRow, {
106
+ "data-testid": `flags-row-${flag.key}`,
107
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
108
+ className: "font-mono text-xs",
109
+ children: flag.key
110
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
111
+ className: "font-mono text-xs text-muted-foreground",
112
+ children: flag.type
113
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
114
+ className: "font-mono text-xs",
115
+ children: formatValue(flag)
116
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
117
+ children: flag.errorCode === void 0 ? /* @__PURE__ */ jsxDEV("span", {
118
+ className: "font-mono text-xs text-muted-foreground",
119
+ children: flag.reason ?? "—"
120
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(Badge, {
121
+ "data-testid": `flags-error-${flag.key}`,
122
+ variant: "destructive",
123
+ children: flag.errorCode
124
+ }, void 0, false)
125
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
126
+ className: "font-mono text-xs text-muted-foreground",
127
+ children: flag.variant ?? "—"
128
+ }, void 0, false)]
129
+ }, flag.key, true))
130
+ }, void 0, false)]
131
+ }, void 0, true)
132
+ }, void 0, false)
133
+ }, void 0, false);
134
+ }
135
+ return /* @__PURE__ */ jsxDEV("div", {
136
+ className: "flex flex-col gap-6",
137
+ "data-testid": "lunora-flags-panel",
138
+ children: [error !== null && /* @__PURE__ */ jsxDEV("p", {
139
+ className: "text-sm text-destructive",
140
+ "data-testid": "flags-error",
141
+ role: "alert",
142
+ children: error
143
+ }, void 0, false), /* @__PURE__ */ jsxDEV("p", {
144
+ className: "text-sm text-muted-foreground",
145
+ children: t('Feature flags are read in code with ctx.flags.<type>("key", default). They evaluate through the OpenFeature provider configured in lunora/flags.ts; edit the targeting context below to see how each flag resolves for a given audience.')
146
+ }, void 0, false), /* @__PURE__ */ jsxDEV("div", {
147
+ className: "flex flex-col gap-2",
148
+ children: [/* @__PURE__ */ jsxDEV(Label, {
149
+ htmlFor: "flags-targeting-context",
150
+ children: t("Targeting context (JSON)")
151
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Textarea, {
152
+ className: "font-mono text-xs",
153
+ "data-testid": "flags-context-input",
154
+ id: "flags-targeting-context",
155
+ onChange: (event) => {
156
+ setContextText(event.target.value);
157
+ },
158
+ placeholder: CONTEXT_PLACEHOLDER,
159
+ rows: 3,
160
+ value: contextText
161
+ }, void 0, false), contextError !== null && /* @__PURE__ */ jsxDEV("p", {
162
+ className: "text-xs text-destructive",
163
+ "data-testid": "flags-context-error",
164
+ role: "alert",
165
+ children: t(contextError)
166
+ }, void 0, false), liveError !== void 0 && /* @__PURE__ */ jsxDEV("p", {
167
+ className: "text-xs text-amber-600 dark:text-amber-500",
168
+ "data-testid": "flags-live-error",
169
+ role: "alert",
170
+ children: t("Live updates unavailable; showing the last evaluation.")
171
+ }, void 0, false)]
172
+ }, void 0, true), body]
173
+ }, void 0, true);
174
+ };
175
+
176
+ export { FlagsPanel };