@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
@@ -3,12 +3,15 @@ import { LunoraClient } from '@lunora/client';
3
3
  import { LunoraProvider } from '@lunora/react';
4
4
  import { useState, useEffect } from 'react';
5
5
  import { ErrorBoundary } from './ErrorBoundary-BzAApI7J.js';
6
- import { T as ThemeProvider, u as useTheme, a as TooltipProvider, S as Studio } from './studio-Bj8psK1c.js';
6
+ import { u as useTheme, B as BrandMark, T as ThemeProvider, a as TooltipProvider, S as Studio } from './studio-Dh9UlaF_.js';
7
7
  import useDebounced from './useDebounced-Dxncpg6z.js';
8
- import { createStudioI18n, useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
8
+ import { useT, createStudioI18n } from './DEFAULT_LOCALE-CiX4W7Kr.js';
9
9
  import { StudioI18nProvider } from './StudioI18nProvider-B-tDCZIi.js';
10
+ import { r as resolveOrigin } from './internal-CYcbqMjX.js';
10
11
  import STUDIO_ROOT_CLASS from './STUDIO_ROOT_CLASS-D12gX2dV.js';
11
12
  import { c as cn } from './utils-B05Dmz_H.js';
13
+ import { B as Button } from './button-BhsN2uZH.js';
14
+ import { I as Input } from './input-XH4r1Pt1.js';
12
15
  import { jsxDEV } from 'react/jsx-dev-runtime';
13
16
 
14
17
  const STORAGE_KEY = "lunora-studio-admin-token";
@@ -41,16 +44,275 @@ const saveToken = (token) => {
41
44
  }
42
45
  };
43
46
 
44
- const resolveBaseUrl = (explicit) => {
45
- if (explicit !== void 0 && explicit !== "") {
46
- return explicit;
47
+ const StudioLoginForm = (t0) => {
48
+ const $ = c(42);
49
+ const {
50
+ onSubmit
51
+ } = t0;
52
+ const t = useT();
53
+ const [value, setValue] = useState("");
54
+ let t1;
55
+ if ($[0] !== value) {
56
+ t1 = value.trim();
57
+ $[0] = value;
58
+ $[1] = t1;
59
+ } else {
60
+ t1 = $[1];
61
+ }
62
+ const trimmed = t1;
63
+ let t2;
64
+ if ($[2] !== onSubmit || $[3] !== trimmed) {
65
+ t2 = (event) => {
66
+ event.preventDefault();
67
+ if (trimmed !== "") {
68
+ onSubmit(trimmed);
69
+ }
70
+ };
71
+ $[2] = onSubmit;
72
+ $[3] = trimmed;
73
+ $[4] = t2;
74
+ } else {
75
+ t2 = $[4];
76
+ }
77
+ const submit = t2;
78
+ let t3;
79
+ if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
80
+ t3 = /* @__PURE__ */ jsxDEV("div", {
81
+ className: "h-10 w-10 text-foreground",
82
+ children: /* @__PURE__ */ jsxDEV(BrandMark, {}, void 0, false)
83
+ }, void 0, false);
84
+ $[5] = t3;
85
+ } else {
86
+ t3 = $[5];
87
+ }
88
+ let t4;
89
+ if ($[6] !== t) {
90
+ t4 = t("Connect to Lunora Studio");
91
+ $[6] = t;
92
+ $[7] = t4;
93
+ } else {
94
+ t4 = $[7];
95
+ }
96
+ let t5;
97
+ if ($[8] !== t4) {
98
+ t5 = /* @__PURE__ */ jsxDEV("h1", {
99
+ className: "text-base font-semibold text-foreground",
100
+ children: t4
101
+ }, void 0, false);
102
+ $[8] = t4;
103
+ $[9] = t5;
104
+ } else {
105
+ t5 = $[9];
106
+ }
107
+ let t6;
108
+ if ($[10] !== t) {
109
+ t6 = t("Enter your admin token to access the studio.");
110
+ $[10] = t;
111
+ $[11] = t6;
112
+ } else {
113
+ t6 = $[11];
47
114
  }
48
- const loc = globalThis.location;
49
- if (loc?.origin !== void 0 && loc.origin !== "") {
50
- return loc.origin;
115
+ let t7;
116
+ if ($[12] !== t6) {
117
+ t7 = /* @__PURE__ */ jsxDEV("p", {
118
+ className: "text-[13px] text-muted-foreground",
119
+ children: t6
120
+ }, void 0, false);
121
+ $[12] = t6;
122
+ $[13] = t7;
123
+ } else {
124
+ t7 = $[13];
125
+ }
126
+ let t8;
127
+ if ($[14] !== t5 || $[15] !== t7) {
128
+ t8 = /* @__PURE__ */ jsxDEV("div", {
129
+ className: "flex flex-col items-center gap-3 text-center",
130
+ children: [t3, /* @__PURE__ */ jsxDEV("div", {
131
+ className: "flex flex-col gap-1",
132
+ children: [t5, t7]
133
+ }, void 0, true)]
134
+ }, void 0, true);
135
+ $[14] = t5;
136
+ $[15] = t7;
137
+ $[16] = t8;
138
+ } else {
139
+ t8 = $[16];
140
+ }
141
+ let t9;
142
+ if ($[17] !== t) {
143
+ t9 = t("admin token");
144
+ $[17] = t;
145
+ $[18] = t9;
146
+ } else {
147
+ t9 = $[18];
148
+ }
149
+ let t10;
150
+ if ($[19] !== t9) {
151
+ t10 = /* @__PURE__ */ jsxDEV("label", {
152
+ className: "text-xs font-medium text-foreground",
153
+ htmlFor: "lunora-studio-login-token",
154
+ children: t9
155
+ }, void 0, false);
156
+ $[19] = t9;
157
+ $[20] = t10;
158
+ } else {
159
+ t10 = $[20];
160
+ }
161
+ let t11;
162
+ if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
163
+ t11 = (event_0) => {
164
+ setValue(event_0.target.value);
165
+ };
166
+ $[21] = t11;
167
+ } else {
168
+ t11 = $[21];
51
169
  }
52
- return "http://localhost:5173";
170
+ let t12;
171
+ if ($[22] !== value) {
172
+ t12 = /* @__PURE__ */ jsxDEV(Input, {
173
+ autoComplete: "off",
174
+ autoFocus: true,
175
+ "data-testid": "lunora-studio-login-token",
176
+ id: "lunora-studio-login-token",
177
+ onChange: t11,
178
+ placeholder: "LUNORA_ADMIN_TOKEN",
179
+ type: "password",
180
+ value
181
+ }, void 0, false);
182
+ $[22] = value;
183
+ $[23] = t12;
184
+ } else {
185
+ t12 = $[23];
186
+ }
187
+ let t13;
188
+ if ($[24] !== t) {
189
+ t13 = t("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production.");
190
+ $[24] = t;
191
+ $[25] = t13;
192
+ } else {
193
+ t13 = $[25];
194
+ }
195
+ let t14;
196
+ if ($[26] !== t13) {
197
+ t14 = /* @__PURE__ */ jsxDEV("p", {
198
+ className: "text-[11px] text-muted-foreground",
199
+ children: t13
200
+ }, void 0, false);
201
+ $[26] = t13;
202
+ $[27] = t14;
203
+ } else {
204
+ t14 = $[27];
205
+ }
206
+ let t15;
207
+ if ($[28] !== t10 || $[29] !== t12 || $[30] !== t14) {
208
+ t15 = /* @__PURE__ */ jsxDEV("div", {
209
+ className: "flex flex-col gap-1.5",
210
+ children: [t10, t12, t14]
211
+ }, void 0, true);
212
+ $[28] = t10;
213
+ $[29] = t12;
214
+ $[30] = t14;
215
+ $[31] = t15;
216
+ } else {
217
+ t15 = $[31];
218
+ }
219
+ const t16 = trimmed === "";
220
+ let t17;
221
+ if ($[32] !== t) {
222
+ t17 = t("Connect");
223
+ $[32] = t;
224
+ $[33] = t17;
225
+ } else {
226
+ t17 = $[33];
227
+ }
228
+ let t18;
229
+ if ($[34] !== t16 || $[35] !== t17) {
230
+ t18 = /* @__PURE__ */ jsxDEV(Button, {
231
+ "data-testid": "lunora-studio-login-submit",
232
+ disabled: t16,
233
+ type: "submit",
234
+ children: t17
235
+ }, void 0, false);
236
+ $[34] = t16;
237
+ $[35] = t17;
238
+ $[36] = t18;
239
+ } else {
240
+ t18 = $[36];
241
+ }
242
+ let t19;
243
+ if ($[37] !== submit || $[38] !== t15 || $[39] !== t18 || $[40] !== t8) {
244
+ t19 = /* @__PURE__ */ jsxDEV("form", {
245
+ className: "flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg",
246
+ "data-testid": "lunora-studio-login",
247
+ onSubmit: submit,
248
+ children: [t8, t15, t18]
249
+ }, void 0, true);
250
+ $[37] = submit;
251
+ $[38] = t15;
252
+ $[39] = t18;
253
+ $[40] = t8;
254
+ $[41] = t19;
255
+ } else {
256
+ t19 = $[41];
257
+ }
258
+ return t19;
53
259
  };
260
+ const StudioLogin = (t0) => {
261
+ const $ = c(10);
262
+ const {
263
+ i18n,
264
+ onSubmit
265
+ } = t0;
266
+ const {
267
+ resolvedTheme
268
+ } = useTheme();
269
+ const t1 = resolvedTheme === "dark" && "dark";
270
+ let t2;
271
+ if ($[0] !== t1) {
272
+ t2 = cn(STUDIO_ROOT_CLASS, t1, "flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground");
273
+ $[0] = t1;
274
+ $[1] = t2;
275
+ } else {
276
+ t2 = $[1];
277
+ }
278
+ let t3;
279
+ if ($[2] !== onSubmit) {
280
+ t3 = /* @__PURE__ */ jsxDEV(StudioLoginForm, {
281
+ onSubmit
282
+ }, void 0, false);
283
+ $[2] = onSubmit;
284
+ $[3] = t3;
285
+ } else {
286
+ t3 = $[3];
287
+ }
288
+ let t4;
289
+ if ($[4] !== i18n || $[5] !== t3) {
290
+ t4 = /* @__PURE__ */ jsxDEV(StudioI18nProvider, {
291
+ i18n,
292
+ children: t3
293
+ }, void 0, false);
294
+ $[4] = i18n;
295
+ $[5] = t3;
296
+ $[6] = t4;
297
+ } else {
298
+ t4 = $[6];
299
+ }
300
+ let t5;
301
+ if ($[7] !== t2 || $[8] !== t4) {
302
+ t5 = /* @__PURE__ */ jsxDEV("div", {
303
+ className: t2,
304
+ "data-testid": "lunora-studio-login-root",
305
+ children: t4
306
+ }, void 0, false);
307
+ $[7] = t2;
308
+ $[8] = t4;
309
+ $[9] = t5;
310
+ } else {
311
+ t5 = $[9];
312
+ }
313
+ return t5;
314
+ };
315
+
54
316
  const StudioAppBody = (t0) => {
55
317
  const $ = c(23);
56
318
  const {
@@ -289,7 +551,7 @@ const StudioApp = (t0) => {
289
551
  let created;
290
552
  if ($[7] !== baseUrl || $[8] !== debouncedToken) {
291
553
  created = new LunoraClient({
292
- url: resolveBaseUrl(baseUrl),
554
+ url: resolveOrigin(baseUrl),
293
555
  ...debouncedToken === "" ? {} : {
294
556
  wsToken: debouncedToken
295
557
  }
@@ -356,7 +618,10 @@ const StudioApp = (t0) => {
356
618
  let t11;
357
619
  if ($[18] !== basePath || $[19] !== client || $[20] !== i18n || $[21] !== rulesInstalled || $[22] !== studio || $[23] !== token) {
358
620
  t11 = /* @__PURE__ */ jsxDEV(ThemeProvider, {
359
- children: /* @__PURE__ */ jsxDEV(StudioShell, {
621
+ children: token === "" ? /* @__PURE__ */ jsxDEV(StudioLogin, {
622
+ i18n,
623
+ onSubmit: setToken
624
+ }, void 0, false) : /* @__PURE__ */ jsxDEV(StudioShell, {
360
625
  basePath,
361
626
  clearToken,
362
627
  client,
@@ -1,6 +1,7 @@
1
1
  import { useState, useMemo } from 'react';
2
+ import { E as ErrorAlert } from './error-alert-CXjqyGw9.js';
2
3
  import { C as Card, a as CardContent } from './card-DURq3ElK.js';
3
- import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from './table-_RzNvy3R.js';
4
+ import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from './table-DsCa9Qp9.js';
4
5
  import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
5
6
  import { c as cn } from './utils-B05Dmz_H.js';
6
7
  import { jsxDEV } from 'react/jsx-dev-runtime';
@@ -49,6 +50,7 @@ const emptyTitle = (t, level) => ({
49
50
  })[level];
50
51
  const AdvisorView = ({
51
52
  error = null,
53
+ errorSource,
52
54
  rows,
53
55
  testId,
54
56
  toolbar
@@ -98,11 +100,9 @@ const AdvisorView = ({
98
100
  }, void 0, false), toolbar !== void 0 && /* @__PURE__ */ jsxDEV("div", {
99
101
  className: "flex flex-wrap items-center gap-2",
100
102
  children: toolbar
101
- }, void 0, false), error !== null && /* @__PURE__ */ jsxDEV("p", {
102
- className: "text-sm text-destructive",
103
- "data-testid": `${testId}-error`,
104
- role: "alert",
105
- children: error
103
+ }, void 0, false), error !== null && /* @__PURE__ */ jsxDEV(ErrorAlert, {
104
+ error: errorSource ?? error,
105
+ testId: `${testId}-error`
106
106
  }, void 0, false), /* @__PURE__ */ jsxDEV(Card, {
107
107
  className: "overflow-hidden py-0",
108
108
  children: /* @__PURE__ */ jsxDEV(CardContent, {
@@ -0,0 +1,68 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { cva } from 'class-variance-authority';
3
+ import { c as cn } from './utils-B05Dmz_H.js';
4
+ import { jsxDEV } from 'react/jsx-dev-runtime';
5
+
6
+ const alertVariants = cva("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0", {
7
+ defaultVariants: {
8
+ variant: "default"
9
+ },
10
+ variants: {
11
+ variant: {
12
+ default: "border-border bg-muted/40 text-foreground",
13
+ destructive: "border-destructive/40 bg-destructive/5 text-destructive",
14
+ warning: "border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"
15
+ }
16
+ }
17
+ });
18
+ const Alert = (t0) => {
19
+ const $ = c(10);
20
+ const {
21
+ children,
22
+ className,
23
+ icon,
24
+ testId,
25
+ variant
26
+ } = t0;
27
+ let t1;
28
+ if ($[0] !== className || $[1] !== variant) {
29
+ t1 = cn(alertVariants({
30
+ variant
31
+ }), className);
32
+ $[0] = className;
33
+ $[1] = variant;
34
+ $[2] = t1;
35
+ } else {
36
+ t1 = $[2];
37
+ }
38
+ let t2;
39
+ if ($[3] !== children) {
40
+ t2 = /* @__PURE__ */ jsxDEV("div", {
41
+ className: "min-w-0 flex-1",
42
+ children
43
+ }, void 0, false);
44
+ $[3] = children;
45
+ $[4] = t2;
46
+ } else {
47
+ t2 = $[4];
48
+ }
49
+ let t3;
50
+ if ($[5] !== icon || $[6] !== t1 || $[7] !== t2 || $[8] !== testId) {
51
+ t3 = /* @__PURE__ */ jsxDEV("div", {
52
+ className: t1,
53
+ "data-testid": testId,
54
+ role: "alert",
55
+ children: [icon, t2]
56
+ }, void 0, true);
57
+ $[5] = icon;
58
+ $[6] = t1;
59
+ $[7] = t2;
60
+ $[8] = testId;
61
+ $[9] = t3;
62
+ } else {
63
+ t3 = $[9];
64
+ }
65
+ return t3;
66
+ };
67
+
68
+ export { Alert as A };
@@ -115,7 +115,7 @@ interface FunctionDescriptor {
115
115
  /** Outcome of a single `FunctionRunner` invocation. */
116
116
  type RunStatus = "error" | "idle" | "running" | "success";
117
117
  /** Identifier for each built-in studio tab. */
118
- type StudioTab = "analytics" | "api" | "audit" | "authConfig" | "authSessions" | "dashboards" | "data" | "drains" | "export" | "files" | "functions" | "health" | "home" | "insights" | "logs" | "mail" | "metrics" | "migrations" | "organizations" | "payments" | "permissions" | "pitr" | "realtime" | "rls" | "schedule" | "schema" | "security" | "settings" | "sql" | "storageRules" | "users" | "vectors" | "workflows";
118
+ type StudioTab = "analytics" | "api" | "audit" | "authConfig" | "authSessions" | "containers" | "dashboards" | "data" | "drains" | "export" | "fanout" | "files" | "flags" | "functions" | "health" | "home" | "insights" | "kv" | "logs" | "mail" | "metrics" | "migrations" | "organizations" | "payments" | "permissions" | "pitr" | "queues" | "realtime" | "rls" | "schedule" | "schema" | "security" | "settings" | "sql" | "storageRules" | "users" | "vectors" | "workflows";
119
119
  interface StudioProps {
120
120
  /**
121
121
  * URL path prefix the studio is mounted under, passed to the router as its
@@ -1,10 +1,11 @@
1
1
  'use client';
2
2
  import { c } from 'react/compiler-runtime';
3
+ import { LunoraError } from '@lunora/errors';
3
4
  import { useMotionValue, useSpring, useTransform, useMotionValueEvent, motion, useReducedMotion } from 'motion/react';
4
5
  import * as React from 'react';
5
6
  import { useId, useEffect, useState, use, createContext, useRef } from 'react';
6
7
  import * as RechartsPrimitive from 'recharts';
7
- import { ZIndexLayer, ResponsiveContainer, LineChart, Line, BarChart, Bar as Bar$1, AreaChart, Area, XAxis as XAxis$1, ReferenceLine, Rectangle } from 'recharts';
8
+ import { ZIndexLayer, ResponsiveContainer, LineChart, Line, BarChart, Bar as Bar$1, AreaChart, Area, ReferenceLine, Rectangle, XAxis as XAxis$1 } from 'recharts';
8
9
  import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
9
10
  import { c as cn } from './utils-B05Dmz_H.js';
10
11
 
@@ -554,7 +555,7 @@ function validateChartConfigColors(config) {
554
555
  if (value.colors) {
555
556
  const hasValidThemeKey = VALID_THEME_KEYS.some((themeKey) => value.colors?.[themeKey] !== void 0);
556
557
  if (!hasValidThemeKey) {
557
- throw new Error(`[EvilCharts] Invalid chart config for "${key}": colors object must have at least one theme key (${VALID_THEME_KEYS.join(", ")}). Received empty object or invalid keys.`);
558
+ throw new LunoraError("INTERNAL", `[EvilCharts] Invalid chart config for "${key}": colors object must have at least one theme key (${VALID_THEME_KEYS.join(", ")}). Received empty object or invalid keys.`);
558
559
  }
559
560
  }
560
561
  }
@@ -563,7 +564,7 @@ const ChartContext = /* @__PURE__ */ React.createContext(null);
563
564
  function useChart() {
564
565
  const context = React.useContext(ChartContext);
565
566
  if (!context) {
566
- throw new Error("useChart must be used within a <ChartContainer />");
567
+ throw new LunoraError("INTERNAL", "useChart must be used within a <ChartContainer />");
567
568
  }
568
569
  return context;
569
570
  }
@@ -1521,7 +1522,7 @@ const BarChartContext = /* @__PURE__ */ createContext(null);
1521
1522
  function useBarChart() {
1522
1523
  const context = use(BarChartContext);
1523
1524
  if (!context) {
1524
- throw new Error("Bar chart parts (<Bar />, <XAxis />, …) must be used within <EvilBarChart />");
1525
+ throw new LunoraError("INTERNAL", "Bar chart parts (<Bar />, <XAxis />, …) must be used within <EvilBarChart />");
1525
1526
  }
1526
1527
  return context;
1527
1528
  }
@@ -0,0 +1,215 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
3
+ import { h as formatCell } from './internal-CYcbqMjX.js';
4
+ import { X as XAxis, B as Bar, T as Tooltip, E as EvilBarChart } from './bar-chart-DSwcWIRy.js';
5
+ import { jsxDEV } from 'react/jsx-dev-runtime';
6
+ import { useState, useEffect } from 'react';
7
+
8
+ const MAX_BARS = 50;
9
+ const RESULT_CHART_CONFIG = {
10
+ value: {
11
+ colors: {
12
+ dark: ["var(--chart-1)"],
13
+ light: ["var(--chart-1)"]
14
+ },
15
+ label: "value"
16
+ }
17
+ };
18
+ const pickColumns = (result) => {
19
+ const value = result.columns.find((column) => result.rows.length > 0 && result.rows.every((row) => typeof row[column] === "number")) ?? null;
20
+ const label = result.columns.find((column) => column !== value) ?? null;
21
+ return {
22
+ label,
23
+ value
24
+ };
25
+ };
26
+ const SqlResultChart = (t0) => {
27
+ const $ = c(15);
28
+ const {
29
+ result
30
+ } = t0;
31
+ const t = useT();
32
+ let t1;
33
+ if ($[0] !== result) {
34
+ t1 = pickColumns(result);
35
+ $[0] = result;
36
+ $[1] = t1;
37
+ } else {
38
+ t1 = $[1];
39
+ }
40
+ const {
41
+ label,
42
+ value
43
+ } = t1;
44
+ let t2;
45
+ if ($[2] !== label || $[3] !== result || $[4] !== value) {
46
+ t2 = value === null ? [] : result.rows.slice(0, MAX_BARS).map((row, index) => ({
47
+ label: label === null ? `#${(index + 1).toString()}` : formatCell(row[label]),
48
+ value: Number(row[value]) || 0
49
+ }));
50
+ $[2] = label;
51
+ $[3] = result;
52
+ $[4] = value;
53
+ $[5] = t2;
54
+ } else {
55
+ t2 = $[5];
56
+ }
57
+ const data = t2;
58
+ if (value === null) {
59
+ let t32;
60
+ if ($[6] !== t) {
61
+ t32 = t("No numeric column to chart.");
62
+ $[6] = t;
63
+ $[7] = t32;
64
+ } else {
65
+ t32 = $[7];
66
+ }
67
+ let t42;
68
+ if ($[8] !== t32) {
69
+ t42 = /* @__PURE__ */ jsxDEV("p", {
70
+ className: "p-4 text-sm text-muted-foreground",
71
+ "data-testid": "sql-chart-empty",
72
+ children: t32
73
+ }, void 0, false);
74
+ $[8] = t32;
75
+ $[9] = t42;
76
+ } else {
77
+ t42 = $[9];
78
+ }
79
+ return t42;
80
+ }
81
+ let t3;
82
+ let t4;
83
+ let t5;
84
+ if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
85
+ t3 = /* @__PURE__ */ jsxDEV(XAxis, {
86
+ dataKey: "label"
87
+ }, void 0, false);
88
+ t4 = /* @__PURE__ */ jsxDEV(Bar, {
89
+ dataKey: "value"
90
+ }, void 0, false);
91
+ t5 = /* @__PURE__ */ jsxDEV(Tooltip, {}, void 0, false);
92
+ $[10] = t3;
93
+ $[11] = t4;
94
+ $[12] = t5;
95
+ } else {
96
+ t3 = $[10];
97
+ t4 = $[11];
98
+ t5 = $[12];
99
+ }
100
+ let t6;
101
+ if ($[13] !== data) {
102
+ t6 = /* @__PURE__ */ jsxDEV("div", {
103
+ className: "h-80 w-full p-3",
104
+ "data-testid": "sql-chart",
105
+ children: /* @__PURE__ */ jsxDEV(EvilBarChart, {
106
+ className: "h-full w-full",
107
+ config: RESULT_CHART_CONFIG,
108
+ data,
109
+ children: [t3, t4, t5]
110
+ }, void 0, true)
111
+ }, void 0, false);
112
+ $[13] = data;
113
+ $[14] = t6;
114
+ } else {
115
+ t6 = $[14];
116
+ }
117
+ return t6;
118
+ };
119
+
120
+ const store = () => {
121
+ try {
122
+ return globalThis.localStorage;
123
+ } catch {
124
+ return void 0;
125
+ }
126
+ };
127
+ const loadJsonArray = function(key) {
128
+ try {
129
+ const raw = store()?.getItem(key) ?? void 0;
130
+ const parsed = raw === void 0 ? [] : JSON.parse(raw);
131
+ return Array.isArray(parsed) ? parsed : [];
132
+ } catch {
133
+ return [];
134
+ }
135
+ };
136
+ const saveJson = (key, value) => {
137
+ const storage = store();
138
+ if (storage === void 0) {
139
+ return;
140
+ }
141
+ try {
142
+ storage.setItem(key, JSON.stringify(value));
143
+ } catch {
144
+ }
145
+ };
146
+ const usePersistedList = function(key) {
147
+ const $ = c(8);
148
+ let t0;
149
+ if ($[0] !== key) {
150
+ t0 = () => loadJsonArray(key);
151
+ $[0] = key;
152
+ $[1] = t0;
153
+ } else {
154
+ t0 = $[1];
155
+ }
156
+ const [value, setValue] = useState(t0);
157
+ let t1;
158
+ let t2;
159
+ if ($[2] !== key || $[3] !== value) {
160
+ t1 = () => {
161
+ saveJson(key, value);
162
+ };
163
+ t2 = [key, value];
164
+ $[2] = key;
165
+ $[3] = value;
166
+ $[4] = t1;
167
+ $[5] = t2;
168
+ } else {
169
+ t1 = $[4];
170
+ t2 = $[5];
171
+ }
172
+ useEffect(t1, t2);
173
+ let t3;
174
+ if ($[6] !== value) {
175
+ t3 = [value, setValue];
176
+ $[6] = value;
177
+ $[7] = t3;
178
+ } else {
179
+ t3 = $[7];
180
+ }
181
+ return t3;
182
+ };
183
+ const usePersistedValue = function(key, fallback) {
184
+ const $ = c(6);
185
+ const [list, setList] = usePersistedList(key);
186
+ let t0;
187
+ if ($[0] !== fallback || $[1] !== setList) {
188
+ t0 = (action) => {
189
+ setList((current) => {
190
+ const previous = current[0] ?? fallback;
191
+ return [typeof action === "function" ? action(previous) : action];
192
+ });
193
+ };
194
+ $[0] = fallback;
195
+ $[1] = setList;
196
+ $[2] = t0;
197
+ } else {
198
+ t0 = $[2];
199
+ }
200
+ const setValue = t0;
201
+ const t1 = list[0] ?? fallback;
202
+ let t2;
203
+ if ($[3] !== setValue || $[4] !== t1) {
204
+ t2 = [t1, setValue];
205
+ $[3] = setValue;
206
+ $[4] = t1;
207
+ $[5] = t2;
208
+ } else {
209
+ t2 = $[5];
210
+ }
211
+ return t2;
212
+ };
213
+ const newId = (prefix) => globalThis.crypto?.randomUUID?.() ?? `${prefix}-${globalThis.performance.now().toString(36)}`;
214
+
215
+ export { SqlResultChart as S, usePersistedValue as a, newId as n, usePersistedList as u };
@@ -5,4 +5,4 @@ const CLOUDFLARE_R2_URL = `${CLOUDFLARE_DASH}/r2`;
5
5
  const CLOUDFLARE_D1_URL = `${CLOUDFLARE_DASH}/workers/d1`;
6
6
  const CLOUDFLARE_DURABLE_OBJECTS_URL = `${CLOUDFLARE_DASH}/workers/durable-objects`;
7
7
 
8
- export { CLOUDFLARE_OBSERVABILITY_URL as C, CLOUDFLARE_WORKERS_URL as a, CLOUDFLARE_D1_URL as b, CLOUDFLARE_DURABLE_OBJECTS_URL as c, CLOUDFLARE_R2_URL as d };
8
+ export { CLOUDFLARE_D1_URL as C, CLOUDFLARE_OBSERVABILITY_URL as a, CLOUDFLARE_WORKERS_URL as b, CLOUDFLARE_DURABLE_OBJECTS_URL as c, CLOUDFLARE_R2_URL as d };
@@ -1,6 +1,6 @@
1
1
  import { c } from 'react/compiler-runtime';
2
2
  import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
3
- import { h as formatCell } from './internal-rXJEAhXS.js';
3
+ import { h as formatCell } from './internal-CYcbqMjX.js';
4
4
  import { jsxDEV } from 'react/jsx-dev-runtime';
5
5
 
6
6
  const CellValue = (t0) => {