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

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