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

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 (176) 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/containers-panel.js +247 -0
  28. package/dist/packem_chunks/dashboards-panel.js +779 -0
  29. package/dist/packem_chunks/fanout-panel.js +481 -0
  30. package/dist/packem_chunks/flags-panel.js +176 -0
  31. package/dist/packem_chunks/kv-browser.js +1896 -0
  32. package/dist/packem_chunks/log-drains-panel.js +273 -0
  33. package/dist/packem_chunks/organizations-panel.js +670 -0
  34. package/dist/packem_chunks/payments-panel.js +185 -0
  35. package/dist/packem_chunks/permissions-panel.js +804 -0
  36. package/dist/packem_chunks/queues-panel.js +147 -0
  37. package/dist/packem_chunks/rls-panel.js +313 -0
  38. package/dist/packem_chunks/schedule-panel.js +831 -0
  39. package/dist/packem_chunks/sparkline.js +79 -0
  40. package/dist/packem_chunks/storage-rules-panel.js +138 -0
  41. package/dist/packem_chunks/subscriptions-panel.js +236 -0
  42. package/dist/packem_chunks/users-panel.js +1265 -0
  43. package/dist/packem_chunks/vector-browser.js +281 -0
  44. package/dist/packem_chunks/workflows-panel.js +562 -0
  45. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-CdaxLGkE.js} +3 -0
  46. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-B6u_wnz-.js} +2 -2
  47. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Drz4UO0a.js} +2 -1
  48. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-B5BertvU.js} +1 -1
  49. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-ANTHLWWh.js} +198 -247
  50. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CjgTG_wa.js} +37 -66
  51. package/dist/packem_shared/HomePanel-BRcQVDby.js +14 -0
  52. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CspFdbUT.js} +2 -1
  53. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-BEJXtsBn.js} +163 -60
  54. package/dist/packem_shared/Studio-B1V0GxTz.js +16 -0
  55. package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-CR0Tvy81.js} +277 -3
  56. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-DzqyvUU3.js} +1 -1
  57. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CNLRTrWw.d.ts} +1 -1
  58. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-Bb__F5-u.js} +1 -1
  59. package/dist/packem_shared/browser-storage-d03UsV7v.js +249 -0
  60. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  61. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-Dsg6nRjo.js} +1 -1
  62. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  63. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-D7nNzBYm.js} +4 -99
  64. package/dist/packem_shared/{HomePanel-Cw16stjq.js → home-panel-CRIs6x2j.js} +835 -469
  65. package/dist/packem_shared/{internal-rXJEAhXS.js → internal-FcNZ3beb.js} +1 -1
  66. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  67. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-Doy1XlQq.js} +4 -44
  68. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  69. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  70. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-KgMPHS4u.js} +1 -1
  71. package/dist/packem_shared/studio-CQ-rtNhn.js +4013 -0
  72. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  73. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-VMo0ftxD.js} +1 -1
  74. package/dist/packem_shared/use-admin-query-BViPA3US.js +105 -0
  75. package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +32 -0
  76. package/dist/standalone/chunk-2DS7JLWL.js +13 -0
  77. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  78. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  79. package/dist/standalone/chunk-2PDQ4KZ6.js +1 -0
  80. package/dist/standalone/chunk-3BP4BTLR.js +4 -0
  81. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  82. package/dist/standalone/chunk-45QK5ZPN.js +1 -0
  83. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  84. package/dist/standalone/chunk-57LYXHXH.js +1 -0
  85. package/dist/standalone/chunk-5NSZVXCS.js +1 -0
  86. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  87. package/dist/standalone/chunk-63XKJQTQ.js +1 -0
  88. package/dist/standalone/chunk-6RC6L33K.js +4 -0
  89. package/dist/standalone/chunk-6VTGE3WJ.js +1 -0
  90. package/dist/standalone/chunk-7PBZKXYA.js +1 -0
  91. package/dist/standalone/chunk-7POIIWC5.js +3 -0
  92. package/dist/standalone/chunk-7RYIQKZA.js +1 -0
  93. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  94. package/dist/standalone/chunk-AB6QGMBF.js +1 -0
  95. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  96. package/dist/standalone/chunk-AQGOX5DK.js +1 -0
  97. package/dist/standalone/chunk-ASLGNHAX.js +1 -0
  98. package/dist/standalone/chunk-BHTPZS7L.js +4 -0
  99. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  100. package/dist/standalone/chunk-D6ORSB24.js +1 -0
  101. package/dist/standalone/chunk-DGWTR4G7.js +1 -0
  102. package/dist/standalone/chunk-DSX53PBM.js +1 -0
  103. package/dist/standalone/chunk-DV2MNASX.js +1 -0
  104. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  105. package/dist/standalone/chunk-EGJX34WM.js +1 -0
  106. package/dist/standalone/chunk-FCR3HKFV.js +1 -0
  107. package/dist/standalone/chunk-FKO3HO6I.js +4 -0
  108. package/dist/standalone/chunk-FQKNJSRA.js +76 -0
  109. package/dist/standalone/chunk-G2TFEWEQ.js +4 -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-HG7Q5B3H.js +1 -0
  114. package/dist/standalone/chunk-HTQL7AXU.js +1 -0
  115. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  116. package/dist/standalone/chunk-ITLLHEVG.js +1 -0
  117. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  118. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  119. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  120. package/dist/standalone/chunk-KG3QTFWE.js +1 -0
  121. package/dist/standalone/chunk-KGS7KM4A.js +2 -0
  122. package/dist/standalone/chunk-KNRVPCFX.js +1 -0
  123. package/dist/standalone/chunk-KODWGUAB.js +1 -0
  124. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  125. package/dist/standalone/chunk-LZWPCZLE.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-W5LWN6IP.js +1 -0
  159. package/dist/standalone/chunk-W7PCVQTE.js +1 -0
  160. package/dist/standalone/chunk-W7SQVLBH.js +1 -0
  161. package/dist/standalone/chunk-XLILSHPE.js +1 -0
  162. package/dist/standalone/chunk-XURNGQSS.js +1 -0
  163. package/dist/standalone/chunk-YJGANMU7.js +18 -0
  164. package/dist/standalone/chunk-YQQJ4N6U.js +1 -0
  165. package/dist/standalone/chunk-ZH7UES4T.js +2 -0
  166. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  167. package/dist/standalone/chunk-ZQCVDXDL.js +1 -0
  168. package/dist/standalone/studio.js +104 -246
  169. package/dist/styles.css +1 -1
  170. package/package.json +13 -12
  171. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  172. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  173. package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
  174. package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
  175. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  176. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -0,0 +1,179 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
4
+ import { a as CardContent, C as Card } from '../packem_shared/card-DURq3ElK.js';
5
+ import { a as useClientQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
6
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
7
+ import { jsxDEV } from 'react/jsx-dev-runtime';
8
+
9
+ const CAPABILITY_ROWS = [{
10
+ key: "accounts",
11
+ label: "Accounts"
12
+ }, {
13
+ key: "admin",
14
+ label: "Admin"
15
+ }, {
16
+ key: "organization",
17
+ label: "Organizations"
18
+ }, {
19
+ key: "passkey",
20
+ label: "Passkeys"
21
+ }, {
22
+ key: "twoFactor",
23
+ label: "Two-factor"
24
+ }];
25
+ const AuthConfigPanel = () => {
26
+ const $ = c(29);
27
+ const client = useLunora();
28
+ const t = useT();
29
+ let t0;
30
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
31
+ t0 = ["lunora-auth-capabilities"];
32
+ $[0] = t0;
33
+ } else {
34
+ t0 = $[0];
35
+ }
36
+ let t1;
37
+ if ($[1] !== client) {
38
+ t1 = () => client.getAuthCapabilities();
39
+ $[1] = client;
40
+ $[2] = t1;
41
+ } else {
42
+ t1 = $[2];
43
+ }
44
+ const {
45
+ data: capabilities,
46
+ error
47
+ } = useClientQuery(t0, t1);
48
+ let t2;
49
+ if ($[3] !== t) {
50
+ t2 = t("Enabled capabilities");
51
+ $[3] = t;
52
+ $[4] = t2;
53
+ } else {
54
+ t2 = $[4];
55
+ }
56
+ let t3;
57
+ if ($[5] !== t2) {
58
+ t3 = /* @__PURE__ */ jsxDEV("header", {
59
+ className: "border-b border-border px-4 py-3",
60
+ children: /* @__PURE__ */ jsxDEV("span", {
61
+ className: "font-mono text-[11px] tracking-wide text-muted-foreground uppercase",
62
+ children: t2
63
+ }, void 0, false)
64
+ }, void 0, false);
65
+ $[5] = t2;
66
+ $[6] = t3;
67
+ } else {
68
+ t3 = $[6];
69
+ }
70
+ let t4;
71
+ if ($[7] !== error) {
72
+ t4 = error !== null && /* @__PURE__ */ jsxDEV("p", {
73
+ className: "px-4 py-8 text-center text-sm text-destructive",
74
+ "data-testid": "auth-config-error",
75
+ role: "alert",
76
+ children: error
77
+ }, void 0, false);
78
+ $[7] = error;
79
+ $[8] = t4;
80
+ } else {
81
+ t4 = $[8];
82
+ }
83
+ let t5;
84
+ if ($[9] !== capabilities || $[10] !== error || $[11] !== t) {
85
+ t5 = error === null && capabilities === void 0 && /* @__PURE__ */ jsxDEV("p", {
86
+ className: "px-4 py-8 text-center text-sm text-muted-foreground",
87
+ "data-testid": "auth-config-loading",
88
+ children: t("Loading auth configuration…")
89
+ }, void 0, false);
90
+ $[9] = capabilities;
91
+ $[10] = error;
92
+ $[11] = t;
93
+ $[12] = t5;
94
+ } else {
95
+ t5 = $[12];
96
+ }
97
+ let t6;
98
+ if ($[13] !== capabilities || $[14] !== error || $[15] !== t) {
99
+ t6 = error === null && capabilities !== void 0 && /* @__PURE__ */ jsxDEV(CardContent, {
100
+ className: "p-3",
101
+ children: /* @__PURE__ */ jsxDEV("ul", {
102
+ className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
103
+ children: CAPABILITY_ROWS.map((row) => {
104
+ const enabled = capabilities[row.key];
105
+ return /* @__PURE__ */ jsxDEV("li", {
106
+ className: "flex items-center justify-between gap-2 rounded-xl border border-border bg-card p-2 shadow-xs",
107
+ "data-testid": `auth-config-cap-${row.key}`,
108
+ children: [/* @__PURE__ */ jsxDEV("span", {
109
+ className: "text-sm",
110
+ children: t(row.label)
111
+ }, void 0, false), /* @__PURE__ */ jsxDEV(Badge, {
112
+ variant: enabled ? "success" : "outline",
113
+ children: enabled ? t("Enabled") : t("Disabled")
114
+ }, void 0, false)]
115
+ }, row.key, true);
116
+ })
117
+ }, void 0, false)
118
+ }, void 0, false);
119
+ $[13] = capabilities;
120
+ $[14] = error;
121
+ $[15] = t;
122
+ $[16] = t6;
123
+ } else {
124
+ t6 = $[16];
125
+ }
126
+ let t7;
127
+ if ($[17] !== t3 || $[18] !== t4 || $[19] !== t5 || $[20] !== t6) {
128
+ t7 = /* @__PURE__ */ jsxDEV(Card, {
129
+ className: "gap-0 py-0",
130
+ children: [t3, t4, t5, t6]
131
+ }, void 0, true);
132
+ $[17] = t3;
133
+ $[18] = t4;
134
+ $[19] = t5;
135
+ $[20] = t6;
136
+ $[21] = t7;
137
+ } else {
138
+ t7 = $[21];
139
+ }
140
+ let t8;
141
+ if ($[22] !== t) {
142
+ t8 = t("OAuth providers, email templates, and rate limits are configured at deploy time in the better-auth setup and aren't editable here. See the Mail tab for email output.");
143
+ $[22] = t;
144
+ $[23] = t8;
145
+ } else {
146
+ t8 = $[23];
147
+ }
148
+ let t9;
149
+ if ($[24] !== t8) {
150
+ t9 = /* @__PURE__ */ jsxDEV(Card, {
151
+ className: "gap-0 py-0",
152
+ children: /* @__PURE__ */ jsxDEV("p", {
153
+ className: "px-4 py-3 text-xs text-muted-foreground",
154
+ "data-testid": "auth-config-note",
155
+ children: t8
156
+ }, void 0, false)
157
+ }, void 0, false);
158
+ $[24] = t8;
159
+ $[25] = t9;
160
+ } else {
161
+ t9 = $[25];
162
+ }
163
+ let t10;
164
+ if ($[26] !== t7 || $[27] !== t9) {
165
+ t10 = /* @__PURE__ */ jsxDEV("div", {
166
+ className: "flex flex-col gap-4",
167
+ "data-testid": "auth-config",
168
+ children: [t7, t9]
169
+ }, void 0, true);
170
+ $[26] = t7;
171
+ $[27] = t9;
172
+ $[28] = t10;
173
+ } else {
174
+ t10 = $[28];
175
+ }
176
+ return t10;
177
+ };
178
+
179
+ export { AuthConfigPanel };
@@ -0,0 +1,175 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { B as Button } from '../packem_shared/button-BhsN2uZH.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 { a as useClientQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
8
+ import { useAutoRefresh } from '../packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
9
+ import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
10
+ import { g as formatTimestamp, f as fireAndForget } from '../packem_shared/internal-FcNZ3beb.js';
11
+ import { jsxDEV } from 'react/jsx-dev-runtime';
12
+
13
+ const SESSION_LIMIT = 200;
14
+ const AuthSessionsPanel = () => {
15
+ const $ = c(21);
16
+ const client = useLunora();
17
+ const t = useT();
18
+ let t0;
19
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
20
+ t0 = ["lunora-auth-sessions", SESSION_LIMIT];
21
+ $[0] = t0;
22
+ } else {
23
+ t0 = $[0];
24
+ }
25
+ let t1;
26
+ if ($[1] !== client) {
27
+ t1 = () => client.listAuthSessions({
28
+ limit: SESSION_LIMIT
29
+ });
30
+ $[1] = client;
31
+ $[2] = t1;
32
+ } else {
33
+ t1 = $[2];
34
+ }
35
+ const sessionsQuery = useClientQuery(t0, t1);
36
+ const {
37
+ error
38
+ } = sessionsQuery;
39
+ const sessions = sessionsQuery.data?.rows ?? null;
40
+ let t2;
41
+ if ($[3] !== sessionsQuery) {
42
+ t2 = () => {
43
+ sessionsQuery.refetch();
44
+ };
45
+ $[3] = sessionsQuery;
46
+ $[4] = t2;
47
+ } else {
48
+ t2 = $[4];
49
+ }
50
+ useAutoRefresh(t2, true);
51
+ let t3;
52
+ if ($[5] !== client || $[6] !== sessionsQuery) {
53
+ t3 = (sessionId) => {
54
+ fireAndForget((async () => {
55
+ await client.revokeAuthSession({
56
+ sessionId
57
+ });
58
+ sessionsQuery.refetch();
59
+ })());
60
+ };
61
+ $[5] = client;
62
+ $[6] = sessionsQuery;
63
+ $[7] = t3;
64
+ } else {
65
+ t3 = $[7];
66
+ }
67
+ const onRevoke = t3;
68
+ let t4;
69
+ if ($[8] !== error) {
70
+ t4 = error !== null && /* @__PURE__ */ jsxDEV("p", {
71
+ className: "text-sm text-destructive",
72
+ "data-testid": "auth-sessions-error",
73
+ role: "alert",
74
+ children: error
75
+ }, void 0, false);
76
+ $[8] = error;
77
+ $[9] = t4;
78
+ } else {
79
+ t4 = $[9];
80
+ }
81
+ let t5;
82
+ if ($[10] !== sessions || $[11] !== t) {
83
+ t5 = sessions !== null && sessions.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
84
+ testId: "auth-sessions-empty",
85
+ title: t("No active sessions.")
86
+ }, void 0, false);
87
+ $[10] = sessions;
88
+ $[11] = t;
89
+ $[12] = t5;
90
+ } else {
91
+ t5 = $[12];
92
+ }
93
+ let t6;
94
+ if ($[13] !== onRevoke || $[14] !== sessions || $[15] !== t) {
95
+ t6 = sessions !== null && sessions.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
96
+ className: "overflow-hidden py-0",
97
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
98
+ className: "px-0",
99
+ children: /* @__PURE__ */ jsxDEV(Table, {
100
+ "data-testid": "auth-sessions-table",
101
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
102
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
103
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
104
+ children: t("user")
105
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
106
+ children: t("expires")
107
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
108
+ children: t("ip")
109
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
110
+ children: t("user agent")
111
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
112
+ children: t("impersonated by")
113
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
114
+ "aria-label": t("Actions")
115
+ }, void 0, false)]
116
+ }, void 0, true)
117
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
118
+ children: sessions.map((session) => /* @__PURE__ */ jsxDEV(TableRow, {
119
+ "data-testid": `auth-session-${session.id}`,
120
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
121
+ className: "font-mono text-xs",
122
+ children: session.userId
123
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
124
+ className: "text-muted-foreground tabular-nums",
125
+ children: formatTimestamp(session.expiresAt)
126
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
127
+ children: session.ipAddress ?? ""
128
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
129
+ className: "max-w-40 truncate",
130
+ children: session.userAgent ?? ""
131
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
132
+ className: "font-mono text-xs",
133
+ children: session.impersonatedBy ?? ""
134
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
135
+ children: /* @__PURE__ */ jsxDEV(Button, {
136
+ "data-testid": `auth-session-revoke-${session.id}`,
137
+ onClick: () => {
138
+ onRevoke(session.id);
139
+ },
140
+ size: "xs",
141
+ type: "button",
142
+ variant: "ghost",
143
+ children: t("Revoke")
144
+ }, void 0, false)
145
+ }, void 0, false)]
146
+ }, session.id, true))
147
+ }, void 0, false)]
148
+ }, void 0, true)
149
+ }, void 0, false)
150
+ }, void 0, false);
151
+ $[13] = onRevoke;
152
+ $[14] = sessions;
153
+ $[15] = t;
154
+ $[16] = t6;
155
+ } else {
156
+ t6 = $[16];
157
+ }
158
+ let t7;
159
+ if ($[17] !== t4 || $[18] !== t5 || $[19] !== t6) {
160
+ t7 = /* @__PURE__ */ jsxDEV("div", {
161
+ className: "flex flex-col gap-4",
162
+ "data-testid": "auth-sessions",
163
+ children: [t4, t5, t6]
164
+ }, void 0, true);
165
+ $[17] = t4;
166
+ $[18] = t5;
167
+ $[19] = t6;
168
+ $[20] = t7;
169
+ } else {
170
+ t7 = $[20];
171
+ }
172
+ return t7;
173
+ };
174
+
175
+ export { AuthSessionsPanel };
@@ -0,0 +1,247 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import 'react';
3
+ import { L as LiveError } from '../packem_shared/live-status-FZ0psC1z.js';
4
+ import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
5
+ import { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
6
+ import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
7
+ import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from '../packem_shared/table-DsCa9Qp9.js';
8
+ import { u as useAdminQuery } from '../packem_shared/use-admin-query-BViPA3US.js';
9
+ import { 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 CONTAINER_LOG_PREFIX = "container:";
14
+ const EVENT_STATE = {
15
+ error: "error",
16
+ sleep: "sleeping",
17
+ start: "running",
18
+ stop: "stopped"
19
+ };
20
+ const parseContainerMessage = (message) => {
21
+ const separator = message.indexOf(":");
22
+ if (separator === -1) {
23
+ return {
24
+ event: message.trim()
25
+ };
26
+ }
27
+ const detail = message.slice(separator + 1).trim();
28
+ const event = message.slice(0, separator).trim();
29
+ return detail === "" ? {
30
+ event
31
+ } : {
32
+ detail,
33
+ event
34
+ };
35
+ };
36
+ const foldContainerInstances = (entries) => {
37
+ const latest = /* @__PURE__ */ new Map();
38
+ for (const entry of entries) {
39
+ const path = entry.functionPath ?? "";
40
+ if (!path.startsWith(CONTAINER_LOG_PREFIX)) {
41
+ continue;
42
+ }
43
+ const name = path.slice(CONTAINER_LOG_PREFIX.length);
44
+ if (name === "") {
45
+ continue;
46
+ }
47
+ const previous = latest.get(name);
48
+ if (previous !== void 0 && previous.timestamp >= entry.timestamp) {
49
+ continue;
50
+ }
51
+ const {
52
+ detail,
53
+ event
54
+ } = parseContainerMessage(entry.message);
55
+ latest.set(name, {
56
+ detail,
57
+ event,
58
+ level: entry.level,
59
+ name,
60
+ state: EVENT_STATE[event] ?? "unknown",
61
+ timestamp: entry.timestamp
62
+ });
63
+ }
64
+ return [...latest.values()].toSorted((a, b) => a.name.localeCompare(b.name));
65
+ };
66
+
67
+ const STATE_VARIANT = {
68
+ error: "destructive",
69
+ running: "success",
70
+ sleeping: "info",
71
+ stopped: "outline",
72
+ unknown: "secondary"
73
+ };
74
+ const entriesOf = (result) => {
75
+ const {
76
+ entries
77
+ } = result ?? {};
78
+ return Array.isArray(entries) ? entries : [];
79
+ };
80
+ const ContainersPanel = () => {
81
+ const $ = c(23);
82
+ const t = useT();
83
+ let t0;
84
+ let t1;
85
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
86
+ t0 = {};
87
+ t1 = {
88
+ live: true,
89
+ shardKey: ""
90
+ };
91
+ $[0] = t0;
92
+ $[1] = t1;
93
+ } else {
94
+ t0 = $[0];
95
+ t1 = $[1];
96
+ }
97
+ const {
98
+ data,
99
+ error,
100
+ liveError
101
+ } = useAdminQuery(ADMIN_FUNCTIONS.getLogs, t0, t1);
102
+ const loaded = data !== void 0;
103
+ let t2;
104
+ if ($[2] !== data) {
105
+ t2 = foldContainerInstances(entriesOf(data));
106
+ $[2] = data;
107
+ $[3] = t2;
108
+ } else {
109
+ t2 = $[3];
110
+ }
111
+ const rows = t2;
112
+ let t3;
113
+ if ($[4] !== error) {
114
+ t3 = error !== null && /* @__PURE__ */ jsxDEV("p", {
115
+ className: "text-sm text-destructive",
116
+ "data-testid": "containers-error",
117
+ role: "alert",
118
+ children: error
119
+ }, void 0, false);
120
+ $[4] = error;
121
+ $[5] = t3;
122
+ } else {
123
+ t3 = $[5];
124
+ }
125
+ let t4;
126
+ if ($[6] !== t) {
127
+ t4 = t("Cloudflare Containers are observed from their lifecycle log stream. This shows the current state per container — ports and health checks aren't carried in that stream.");
128
+ $[6] = t;
129
+ $[7] = t4;
130
+ } else {
131
+ t4 = $[7];
132
+ }
133
+ let t5;
134
+ if ($[8] !== t4) {
135
+ t5 = /* @__PURE__ */ jsxDEV("p", {
136
+ className: "text-sm text-muted-foreground",
137
+ children: t4
138
+ }, void 0, false);
139
+ $[8] = t4;
140
+ $[9] = t5;
141
+ } else {
142
+ t5 = $[9];
143
+ }
144
+ let t6;
145
+ if ($[10] !== liveError) {
146
+ t6 = /* @__PURE__ */ jsxDEV(LiveError, {
147
+ message: liveError,
148
+ prefix: "containers"
149
+ }, void 0, false);
150
+ $[10] = liveError;
151
+ $[11] = t6;
152
+ } else {
153
+ t6 = $[11];
154
+ }
155
+ let t7;
156
+ if ($[12] !== t5 || $[13] !== t6) {
157
+ t7 = /* @__PURE__ */ jsxDEV("div", {
158
+ className: "flex flex-wrap items-center gap-2",
159
+ children: [t5, t6]
160
+ }, void 0, true);
161
+ $[12] = t5;
162
+ $[13] = t6;
163
+ $[14] = t7;
164
+ } else {
165
+ t7 = $[14];
166
+ }
167
+ let t8;
168
+ if ($[15] !== loaded || $[16] !== rows || $[17] !== t) {
169
+ t8 = loaded && rows.length === 0 ? /* @__PURE__ */ jsxDEV(EmptyState, {
170
+ description: t("No container lifecycle activity yet. Instances declared with defineContainer show up here once they start, sleep, stop, or error."),
171
+ testId: "containers-empty",
172
+ title: t("No container activity")
173
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(Card, {
174
+ className: "overflow-hidden py-0",
175
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
176
+ className: "px-0",
177
+ children: /* @__PURE__ */ jsxDEV(Table, {
178
+ "data-testid": "containers-table",
179
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
180
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
181
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
182
+ children: t("Container")
183
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
184
+ children: t("State")
185
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
186
+ children: t("Last event")
187
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
188
+ children: t("Detail")
189
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
190
+ children: t("When")
191
+ }, void 0, false)]
192
+ }, void 0, true)
193
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
194
+ children: rows.map(_temp)
195
+ }, void 0, false)]
196
+ }, void 0, true)
197
+ }, void 0, false)
198
+ }, void 0, false);
199
+ $[15] = loaded;
200
+ $[16] = rows;
201
+ $[17] = t;
202
+ $[18] = t8;
203
+ } else {
204
+ t8 = $[18];
205
+ }
206
+ let t9;
207
+ if ($[19] !== t3 || $[20] !== t7 || $[21] !== t8) {
208
+ t9 = /* @__PURE__ */ jsxDEV("div", {
209
+ className: "flex flex-col gap-6",
210
+ "data-testid": "lunora-containers-panel",
211
+ children: [t3, t7, t8]
212
+ }, void 0, true);
213
+ $[19] = t3;
214
+ $[20] = t7;
215
+ $[21] = t8;
216
+ $[22] = t9;
217
+ } else {
218
+ t9 = $[22];
219
+ }
220
+ return t9;
221
+ };
222
+ function _temp(row) {
223
+ return /* @__PURE__ */ jsxDEV(TableRow, {
224
+ "data-testid": `containers-row-${row.name}`,
225
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
226
+ className: "font-mono text-xs",
227
+ children: row.name
228
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
229
+ children: /* @__PURE__ */ jsxDEV(Badge, {
230
+ variant: STATE_VARIANT[row.state],
231
+ children: row.state
232
+ }, void 0, false)
233
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
234
+ className: "font-mono text-xs text-muted-foreground",
235
+ children: row.event
236
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
237
+ className: "max-w-64 truncate text-xs text-muted-foreground",
238
+ title: row.detail,
239
+ children: row.detail ?? "—"
240
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
241
+ className: "text-xs tabular-nums text-muted-foreground",
242
+ children: new Date(row.timestamp).toLocaleString()
243
+ }, void 0, false)]
244
+ }, row.name, true);
245
+ }
246
+
247
+ export { ContainersPanel };