@lunora/studio 0.0.0 → 1.0.0-alpha.10

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 (80) hide show
  1. package/LICENSE.md +105 -0
  2. package/README.md +123 -9
  3. package/__assets__/package-og.svg +14 -0
  4. package/dist/index.d.ts +1403 -0
  5. package/dist/index.js +41 -0
  6. package/dist/mount.d.ts +21 -0
  7. package/dist/mount.js +26 -0
  8. package/dist/packem_shared/ADMIN_FUNCTIONS-DjXgvJb6.js +46 -0
  9. package/dist/packem_shared/ApiDocsPanel-yVSGHK3H.js +842 -0
  10. package/dist/packem_shared/ApiReferencePanel-1vubqG5s.js +229 -0
  11. package/dist/packem_shared/ApiTab-rwttyQ1-.js +251 -0
  12. package/dist/packem_shared/AuditPanel-D9Eh7j7E.js +200 -0
  13. package/dist/packem_shared/CommandPalette-BtgkBzZI.js +373 -0
  14. package/dist/packem_shared/ConfirmButton-C2eVi2Qv.js +59 -0
  15. package/dist/packem_shared/ConnectionBadge-B2DDM2Tn.js +111 -0
  16. package/dist/packem_shared/DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js +50 -0
  17. package/dist/packem_shared/DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js +89 -0
  18. package/dist/packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js +27 -0
  19. package/dist/packem_shared/DataBrowser-CyckZRwj.js +4480 -0
  20. package/dist/packem_shared/DataFilters-FNquMaiu.js +249 -0
  21. package/dist/packem_shared/ErrorBoundary-BzAApI7J.js +66 -0
  22. package/dist/packem_shared/ExportImportPanel-BGJqFK9X.js +197 -0
  23. package/dist/packem_shared/FileBrowser-0pCpdKPE.js +2932 -0
  24. package/dist/packem_shared/FunctionRunner-7NH3KcTg.js +343 -0
  25. package/dist/packem_shared/FunctionStatsPanel-CXynSuqT.js +375 -0
  26. package/dist/packem_shared/GlobalDataBrowser-DAxzB-Br.js +289 -0
  27. package/dist/packem_shared/HealthPanel-CyLs7qZm.js +648 -0
  28. package/dist/packem_shared/HomePanel-BOkFRbuj.js +1334 -0
  29. package/dist/packem_shared/InsightsPanel-CvXMoZuv.js +461 -0
  30. package/dist/packem_shared/LogsPanel-BrUstOk6.js +827 -0
  31. package/dist/packem_shared/MailPanel-GnnrNqL6.js +440 -0
  32. package/dist/packem_shared/MetricsPanel-BN_uUU-_.js +1611 -0
  33. package/dist/packem_shared/MigrationsPanel-DaZuUHje.js +239 -0
  34. package/dist/packem_shared/OpenRpcReferencePanel-vbcYbv3V.js +191 -0
  35. package/dist/packem_shared/PitrPanel-LJGNP_IX.js +252 -0
  36. package/dist/packem_shared/STUDIO_ROOT_CLASS-D12gX2dV.js +3 -0
  37. package/dist/packem_shared/ScheduledJobs-UmVaMbJy.js +262 -0
  38. package/dist/packem_shared/SchemaViewer-Bam6ylvw.js +2512 -0
  39. package/dist/packem_shared/SecurityAdvisorPanel-DTmjUNqt.js +92 -0
  40. package/dist/packem_shared/SettingsPanel-C2wDK-8F.js +390 -0
  41. package/dist/packem_shared/ShardInput-gx_DZXXn.js +107 -0
  42. package/dist/packem_shared/SqlEditorPanel-D5wMIxcg.js +13 -0
  43. package/dist/packem_shared/Studio-DpgYe4qt.js +33 -0
  44. package/dist/packem_shared/StudioApp-C7aaizqc.js +657 -0
  45. package/dist/packem_shared/StudioI18nProvider-B-tDCZIi.js +48 -0
  46. package/dist/packem_shared/TableEditor-DzK3Z6rL.js +371 -0
  47. package/dist/packem_shared/advisor-view-CGcfMiPq.js +159 -0
  48. package/dist/packem_shared/aggregateMetrics-D4nUHEKU.js +108 -0
  49. package/dist/packem_shared/app.d-Nbhpihxv.d.ts +300 -0
  50. package/dist/packem_shared/badge-B2PKA1-5.js +49 -0
  51. package/dist/packem_shared/bar-chart-CzJAgqkp.js +3245 -0
  52. package/dist/packem_shared/button-BhsN2uZH.js +49 -0
  53. package/dist/packem_shared/card-DURq3ElK.js +175 -0
  54. package/dist/packem_shared/cf-links-2cktDedA.js +8 -0
  55. package/dist/packem_shared/checkbox-UNkzAxl-.js +63 -0
  56. package/dist/packem_shared/data-grid-B5CaV3wS.js +183 -0
  57. package/dist/packem_shared/dropdown-menu-WY4B_eJO.js +280 -0
  58. package/dist/packem_shared/empty-state-DY_oe0k6.js +98 -0
  59. package/dist/packem_shared/grid-features-CzUfqgsM.js +840 -0
  60. package/dist/packem_shared/input-XH4r1Pt1.js +53 -0
  61. package/dist/packem_shared/internal-rXJEAhXS.js +68 -0
  62. package/dist/packem_shared/label-D8ykjn5J.js +46 -0
  63. package/dist/packem_shared/live-status-FZ0psC1z.js +44 -0
  64. package/dist/packem_shared/reference-view-B4E49Lip.js +2180 -0
  65. package/dist/packem_shared/shard-history-DyebH1R5.js +38 -0
  66. package/dist/packem_shared/sparkline-10dG-_f0.js +93 -0
  67. package/dist/packem_shared/sql-editor-panel-Smfl_FDF.js +2562 -0
  68. package/dist/packem_shared/storage-tier-CL98eOvn.js +85 -0
  69. package/dist/packem_shared/studio-9Mq0PdMi.js +10831 -0
  70. package/dist/packem_shared/table-_RzNvy3R.js +246 -0
  71. package/dist/packem_shared/table-list-sidebar-Bg7uzbvC.js +832 -0
  72. package/dist/packem_shared/textarea-D3gaCU_-.js +46 -0
  73. package/dist/packem_shared/use-admin-query-4JQW2rr1.js +88 -0
  74. package/dist/packem_shared/useDebounced-Dxncpg6z.js +32 -0
  75. package/dist/packem_shared/utils-B05Dmz_H.js +8 -0
  76. package/dist/packem_shared/virtual-rect-CVMUskSm.js +10 -0
  77. package/dist/standalone/studio.js +378 -0
  78. package/dist/styles.css +2 -0
  79. package/package.json +78 -17
  80. package/src/theme.css +59 -0
@@ -0,0 +1,262 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { useState, useEffect } from 'react';
4
+ import { ConfirmButton } from './ConfirmButton-C2eVi2Qv.js';
5
+ import { C as Card, a as CardContent } from './card-DURq3ElK.js';
6
+ import { E as EmptyState } from './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 './table-_RzNvy3R.js';
8
+ import { b as useClientQuery } from './use-admin-query-4JQW2rr1.js';
9
+ import { useAutoRefresh } from './DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
10
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
11
+ import { f as fireAndForget, b as formatTimestamp, e as errorMessage } from './internal-rXJEAhXS.js';
12
+ import { jsxDEV } from 'react/jsx-dev-runtime';
13
+
14
+ const formatScheduledFor = (value) => Number.isFinite(value) ? formatTimestamp(value, "—") : "—";
15
+ const sortByDue = (records) => records.toSorted((a, b) => a.scheduledFor - b.scheduledFor);
16
+ const ScheduledJobs = (t0) => {
17
+ const $ = c(33);
18
+ let t1;
19
+ if ($[0] !== t0) {
20
+ t1 = t0 === void 0 ? {} : t0;
21
+ $[0] = t0;
22
+ $[1] = t1;
23
+ } else {
24
+ t1 = $[1];
25
+ }
26
+ const {
27
+ cancelJob,
28
+ loadJobs
29
+ } = t1;
30
+ const client = useLunora();
31
+ const t = useT();
32
+ const livePush = loadJobs === void 0;
33
+ let t2;
34
+ if ($[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
35
+ t2 = ["lunora-scheduled-jobs"];
36
+ $[2] = t2;
37
+ } else {
38
+ t2 = $[2];
39
+ }
40
+ let t3;
41
+ if ($[3] !== client || $[4] !== loadJobs) {
42
+ t3 = async () => {
43
+ const records = await (loadJobs ?? (() => client.listScheduledJobs()))();
44
+ return sortByDue(records);
45
+ };
46
+ $[3] = client;
47
+ $[4] = loadJobs;
48
+ $[5] = t3;
49
+ } else {
50
+ t3 = $[5];
51
+ }
52
+ const jobsQuery = useClientQuery(t2, t3);
53
+ const [liveJobs, setLiveJobs] = useState(void 0);
54
+ const [liveError, setLiveError] = useState(void 0);
55
+ let t4;
56
+ let t5;
57
+ if ($[6] !== client || $[7] !== livePush) {
58
+ t4 = () => {
59
+ if (!livePush) {
60
+ return;
61
+ }
62
+ return client.subscribeScheduledJobs((records_0) => {
63
+ setLiveError(void 0);
64
+ setLiveJobs(sortByDue(records_0));
65
+ });
66
+ };
67
+ t5 = [livePush, client];
68
+ $[6] = client;
69
+ $[7] = livePush;
70
+ $[8] = t4;
71
+ $[9] = t5;
72
+ } else {
73
+ t4 = $[8];
74
+ t5 = $[9];
75
+ }
76
+ useEffect(t4, t5);
77
+ let t6;
78
+ if ($[10] !== jobsQuery) {
79
+ t6 = () => {
80
+ jobsQuery.refetch();
81
+ };
82
+ $[10] = jobsQuery;
83
+ $[11] = t6;
84
+ } else {
85
+ t6 = $[11];
86
+ }
87
+ useAutoRefresh(t6, !livePush);
88
+ let t7;
89
+ bb0: {
90
+ if (cancelJob !== void 0) {
91
+ t7 = cancelJob;
92
+ break bb0;
93
+ }
94
+ let t82;
95
+ if ($[12] !== client || $[13] !== loadJobs) {
96
+ t82 = loadJobs === void 0 ? (id) => client.cancelScheduledJob(id) : void 0;
97
+ $[12] = client;
98
+ $[13] = loadJobs;
99
+ $[14] = t82;
100
+ } else {
101
+ t82 = $[14];
102
+ }
103
+ t7 = t82;
104
+ }
105
+ const cancelImpl = t7;
106
+ const jobs = liveJobs ?? jobsQuery.data;
107
+ const error = liveError ?? jobsQuery.error;
108
+ let t8;
109
+ if ($[15] !== cancelImpl || $[16] !== jobsQuery || $[17] !== livePush) {
110
+ t8 = async (id_0) => {
111
+ if (cancelImpl === void 0) {
112
+ return;
113
+ }
114
+ setLiveError(void 0);
115
+ try {
116
+ await cancelImpl(id_0);
117
+ if (!livePush) {
118
+ jobsQuery.refetch();
119
+ }
120
+ } catch (t92) {
121
+ const error_ = t92;
122
+ setLiveError(errorMessage(error_));
123
+ }
124
+ };
125
+ $[15] = cancelImpl;
126
+ $[16] = jobsQuery;
127
+ $[17] = livePush;
128
+ $[18] = t8;
129
+ } else {
130
+ t8 = $[18];
131
+ }
132
+ const cancel = t8;
133
+ let t9;
134
+ if ($[19] !== error) {
135
+ t9 = error !== null && /* @__PURE__ */ jsxDEV("p", {
136
+ className: "text-sm text-destructive",
137
+ "data-testid": "sj-error",
138
+ role: "alert",
139
+ children: error
140
+ }, void 0, false);
141
+ $[19] = error;
142
+ $[20] = t9;
143
+ } else {
144
+ t9 = $[20];
145
+ }
146
+ let t10;
147
+ if ($[21] !== jobs?.length || $[22] !== t) {
148
+ t10 = jobs?.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
149
+ description: t("Jobs queued with runAfter / runAt will appear here."),
150
+ icon: /* @__PURE__ */ jsxDEV("svg", {
151
+ "aria-hidden": "true",
152
+ fill: "none",
153
+ stroke: "currentColor",
154
+ strokeLinecap: "round",
155
+ strokeLinejoin: "round",
156
+ strokeWidth: 1.6,
157
+ viewBox: "0 0 24 24",
158
+ children: [/* @__PURE__ */ jsxDEV("circle", {
159
+ cx: "12",
160
+ cy: "12",
161
+ r: "9"
162
+ }, void 0, false), /* @__PURE__ */ jsxDEV("path", {
163
+ d: "M12 7.5V12l4 2"
164
+ }, void 0, false)]
165
+ }, void 0, true),
166
+ testId: "sj-empty",
167
+ title: t("No scheduled jobs.")
168
+ }, void 0, false);
169
+ $[21] = jobs?.length;
170
+ $[22] = t;
171
+ $[23] = t10;
172
+ } else {
173
+ t10 = $[23];
174
+ }
175
+ let t11;
176
+ if ($[24] !== cancel || $[25] !== cancelImpl || $[26] !== jobs || $[27] !== t) {
177
+ t11 = jobs !== void 0 && jobs.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
178
+ className: "overflow-hidden py-0",
179
+ children: /* @__PURE__ */ jsxDEV(CardContent, {
180
+ className: "px-0",
181
+ children: /* @__PURE__ */ jsxDEV(Table, {
182
+ "data-testid": "sj-table",
183
+ children: [/* @__PURE__ */ jsxDEV(TableHeader, {
184
+ children: /* @__PURE__ */ jsxDEV(TableRow, {
185
+ children: [/* @__PURE__ */ jsxDEV(TableHead, {
186
+ children: t("function")
187
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
188
+ children: t("scheduled for")
189
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
190
+ children: t("pool")
191
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
192
+ children: t("attempts")
193
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
194
+ children: t("shard")
195
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
196
+ children: t("id")
197
+ }, void 0, false), cancelImpl !== void 0 && /* @__PURE__ */ jsxDEV(TableHead, {
198
+ "aria-label": t("Actions")
199
+ }, void 0, false)]
200
+ }, void 0, true)
201
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
202
+ children: jobs.map((job) => /* @__PURE__ */ jsxDEV(TableRow, {
203
+ "data-testid": `sj-row-${job.id}`,
204
+ children: [/* @__PURE__ */ jsxDEV(TableCell, {
205
+ className: "font-mono text-xs",
206
+ children: job.functionPath
207
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
208
+ className: "text-muted-foreground tabular-nums",
209
+ children: formatScheduledFor(job.scheduledFor)
210
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
211
+ className: "font-mono text-xs",
212
+ children: job.pool ?? ""
213
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
214
+ className: "tabular-nums",
215
+ children: job.attempts ?? 0
216
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
217
+ children: job.shardKey ?? ""
218
+ }, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
219
+ className: "font-mono text-xs",
220
+ children: job.id
221
+ }, void 0, false), cancelImpl !== void 0 && /* @__PURE__ */ jsxDEV(TableCell, {
222
+ className: "text-right",
223
+ children: /* @__PURE__ */ jsxDEV(ConfirmButton, {
224
+ confirmLabel: t("Cancel job?"),
225
+ onConfirm: () => {
226
+ fireAndForget(cancel(job.id));
227
+ },
228
+ testId: `sj-cancel-${job.id}`,
229
+ children: t("Cancel")
230
+ }, void 0, false)
231
+ }, void 0, false)]
232
+ }, job.id, true))
233
+ }, void 0, false)]
234
+ }, void 0, true)
235
+ }, void 0, false)
236
+ }, void 0, false);
237
+ $[24] = cancel;
238
+ $[25] = cancelImpl;
239
+ $[26] = jobs;
240
+ $[27] = t;
241
+ $[28] = t11;
242
+ } else {
243
+ t11 = $[28];
244
+ }
245
+ let t12;
246
+ if ($[29] !== t10 || $[30] !== t11 || $[31] !== t9) {
247
+ t12 = /* @__PURE__ */ jsxDEV("div", {
248
+ className: "flex flex-col gap-3",
249
+ "data-testid": "lunora-scheduled-jobs",
250
+ children: [t9, t10, t11]
251
+ }, void 0, true);
252
+ $[29] = t10;
253
+ $[30] = t11;
254
+ $[31] = t9;
255
+ $[32] = t12;
256
+ } else {
257
+ t12 = $[32];
258
+ }
259
+ return t12;
260
+ };
261
+
262
+ export { ScheduledJobs };