@lunora/studio 1.0.0-alpha.2 → 1.0.0-alpha.21

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 (60) hide show
  1. package/__assets__/package-og.svg +1 -1
  2. package/dist/index.d.ts +23 -17
  3. package/dist/index.js +34 -34
  4. package/dist/mount.d.ts +1 -1
  5. package/dist/mount.js +1 -1
  6. package/dist/packem_shared/{ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js → ADMIN_FUNCTIONS-CdaxLGkE.js} +3 -0
  7. package/dist/packem_shared/{ApiDocsPanel-DpRjJhG5.js → ApiDocsPanel-BgrN4kml.js} +3 -3
  8. package/dist/packem_shared/{ApiReferencePanel-DMIUp-kK.js → ApiReferencePanel-1vubqG5s.js} +2 -2
  9. package/dist/packem_shared/{ApiTab-DURGU15e.js → ApiTab-CHkX49o_.js} +4 -4
  10. package/dist/packem_shared/{AuditPanel-BC59Nhst.js → AuditPanel-CP9HM9nq.js} +19 -31
  11. package/dist/packem_shared/{CommandPalette-Dx_CoB9i.js → CommandPalette-BtgkBzZI.js} +2 -2
  12. package/dist/packem_shared/{ConfirmButton-WQVUoGFb.js → ConfirmButton-C2eVi2Qv.js} +1 -1
  13. package/dist/packem_shared/{ConnectionBadge-Bxagrip8.js → ConnectionBadge-B2DDM2Tn.js} +1 -1
  14. package/dist/packem_shared/{createStudioI18n-CgvlmDkN.js → DEFAULT_LOCALE-CiX4W7Kr.js} +1 -1
  15. package/dist/packem_shared/{DataBrowser-Coz6jJE6.js → DataBrowser-Bb1gTQ6c.js} +182 -249
  16. package/dist/packem_shared/{ExportImportPanel-WO34fJxy.js → ExportImportPanel-Dj87tRa5.js} +9 -5
  17. package/dist/packem_shared/{FileBrowser-Zcr-Qgxo.js → FileBrowser-CWvxp_is.js} +7 -7
  18. package/dist/packem_shared/{FunctionRunner-j0Rd5m9t.js → FunctionRunner-DlWApMCH.js} +4 -4
  19. package/dist/packem_shared/{FunctionStatsPanel-DboBl-XL.js → FunctionStatsPanel-CuO2Tmw-.js} +141 -198
  20. package/dist/packem_shared/{GlobalDataBrowser-9MhPEfgN.js → GlobalDataBrowser-3X9uRfdO.js} +37 -66
  21. package/dist/packem_shared/{HealthPanel-DOIgbUtx.js → HealthPanel-Dj0GRo5P.js} +31 -23
  22. package/dist/packem_shared/{HomePanel-bdOCNA-p.js → HomePanel-BewOCuag.js} +450 -389
  23. package/dist/packem_shared/{InsightsPanel-DaZPnSgt.js → InsightsPanel-y_Q-xdPY.js} +104 -66
  24. package/dist/packem_shared/{LogsPanel-CWdqAGpQ.js → LogsPanel-C7crgYoS.js} +35 -47
  25. package/dist/packem_shared/{MailPanel-D_EGtDnS.js → MailPanel-PILidruz.js} +31 -38
  26. package/dist/packem_shared/{MetricsPanel-E4Gv6wTO.js → MetricsPanel-DioILzgf.js} +34 -48
  27. package/dist/packem_shared/{MigrationsPanel-DQdPY9io.js → MigrationsPanel-DkIcRoE5.js} +31 -38
  28. package/dist/packem_shared/{OpenRpcReferencePanel-j2p3HB0s.js → OpenRpcReferencePanel-vbcYbv3V.js} +2 -2
  29. package/dist/packem_shared/{PitrPanel-BbBkQR6t.js → PitrPanel-yKJ1JPPk.js} +4 -4
  30. package/dist/packem_shared/{ScheduledJobs-Ok1CYYwI.js → ScheduledJobs-BWNwIN3I.js} +164 -61
  31. package/dist/packem_shared/{SchemaViewer-D8XGnp-X.js → SchemaViewer-CNr8Wame.js} +4 -4
  32. package/dist/packem_shared/{SecurityAdvisorPanel-Cdm2IxLW.js → SecurityAdvisorPanel-BBzv7L3c.js} +44 -31
  33. package/dist/packem_shared/SettingsPanel-BKSKl8tl.js +390 -0
  34. package/dist/packem_shared/{ShardInput-DNCsT1KW.js → ShardInput-gx_DZXXn.js} +1 -1
  35. package/dist/packem_shared/SqlEditorPanel-CkemCQvy.js +13 -0
  36. package/dist/packem_shared/Studio-QkOjc2NS.js +33 -0
  37. package/dist/packem_shared/{StudioApp-dvywkJ8I.js → StudioApp-TEElspKL.js} +278 -4
  38. package/dist/packem_shared/{StudioI18nProvider-Dcajsznk.js → StudioI18nProvider-B-tDCZIi.js} +1 -1
  39. package/dist/packem_shared/TableEditor-JS3sXYgS.js +11 -0
  40. package/dist/packem_shared/{advisor-view-DBlzJi6C.js → advisor-view-CGcfMiPq.js} +1 -1
  41. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-Cnij4Zp5.d.ts} +1 -1
  42. package/dist/packem_shared/{cf-links-BZfRdxSE.js → cf-links-2cktDedA.js} +1 -1
  43. package/dist/packem_shared/{data-grid-CCh2Couo.js → data-grid-B5CaV3wS.js} +2 -2
  44. package/dist/packem_shared/{grid-features-DTjG6Sex.js → grid-features-CzUfqgsM.js} +3 -3
  45. package/dist/packem_shared/{internal-BBZYexre.js → internal-rXJEAhXS.js} +1 -1
  46. package/dist/packem_shared/{live-status-bPff1O7Y.js → live-status-FZ0psC1z.js} +1 -1
  47. package/dist/packem_shared/{reference-view-BCKIoai7.js → reference-view-B4E49Lip.js} +3 -3
  48. package/dist/packem_shared/{sql-editor-panel-CW2y2x9h.js → sql-editor-panel-CUJoYF1Z.js} +6 -6
  49. package/dist/packem_shared/{studio-BDVd7rIV.js → studio-c5Vf7kSh.js} +2897 -1668
  50. package/dist/packem_shared/{TableEditor-DIVDk3vT.js → table-editor-9fhJ4hMJ.js} +43 -7
  51. package/dist/packem_shared/{table-list-sidebar-aZHLq70w.js → table-list-sidebar-Bg7uzbvC.js} +2 -2
  52. package/dist/packem_shared/use-admin-query-BkbdNFNz.js +105 -0
  53. package/dist/standalone/studio.js +198 -176
  54. package/dist/styles.css +1 -1
  55. package/package.json +13 -12
  56. package/dist/packem_shared/SettingsPanel-D3WF2mBU.js +0 -176
  57. package/dist/packem_shared/SqlEditorPanel-BuQ7f2Hs.js +0 -13
  58. package/dist/packem_shared/Studio-D36od9Oz.js +0 -33
  59. package/dist/packem_shared/use-live-admin-D1h1Fzsd.js +0 -73
  60. package/dist/packem_shared/use-live-shard-seed-B74RYcOy.js +0 -76
@@ -1,8 +1,8 @@
1
1
  import { useLunora } from '@lunora/react';
2
- import { useState } from 'react';
3
- import { ConfirmButton } from './ConfirmButton-WQVUoGFb.js';
4
- import { L as LiveError } from './live-status-bPff1O7Y.js';
5
- import { ShardInput } from './ShardInput-DNCsT1KW.js';
2
+ import { useState, useEffect } from 'react';
3
+ import { ConfirmButton } from './ConfirmButton-C2eVi2Qv.js';
4
+ import { L as LiveError } from './live-status-FZ0psC1z.js';
5
+ import { ShardInput } from './ShardInput-gx_DZXXn.js';
6
6
  import { B as Badge } from './badge-B2PKA1-5.js';
7
7
  import { B as Button } from './button-BhsN2uZH.js';
8
8
  import { C as Card, a as CardContent } from './card-DURq3ElK.js';
@@ -10,15 +10,14 @@ import { E as EmptyState } from './empty-state-DY_oe0k6.js';
10
10
  import { I as Input } from './input-XH4r1Pt1.js';
11
11
  import { L as Label } from './label-D8ykjn5J.js';
12
12
  import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from './table-_RzNvy3R.js';
13
- import { u as useLiveAdmin } from './use-live-admin-D1h1Fzsd.js';
14
- import { useT } from './createStudioI18n-CgvlmDkN.js';
15
- import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js';
16
- import { d as formatTimestamp, f as fireAndForget, c as callOptions, e as errorMessage, a as adminRef } from './internal-BBZYexre.js';
13
+ import { u as useAdminQuery } from './use-admin-query-BkbdNFNz.js';
14
+ import useDebounced from './useDebounced-Dxncpg6z.js';
15
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
16
+ import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTIONS-CdaxLGkE.js';
17
+ import { b as formatTimestamp, f as fireAndForget, c as callOptions, e as errorMessage, a as adminRef } from './internal-rXJEAhXS.js';
17
18
  import { r as recordShard } from './shard-history-DyebH1R5.js';
18
- import { u as useLiveShardSeed } from './use-live-shard-seed-B74RYcOy.js';
19
19
  import { jsxDEV } from 'react/jsx-dev-runtime';
20
20
 
21
- const MIGRATION_STATUS = adminRef(ADMIN_FUNCTIONS.migrationStatus);
22
21
  const RUN_MIGRATION = adminRef(ADMIN_FUNCTIONS.runMigration);
23
22
  const MigrationsPanel = ({
24
23
  initialShardKey
@@ -26,33 +25,28 @@ const MigrationsPanel = ({
26
25
  const client = useLunora();
27
26
  const t = useT();
28
27
  const [shardKey, setShardKey] = useState(initialShardKey ?? "");
29
- const [rows, setRows] = useState(null);
30
- const [statusError, setStatusError] = useState(null);
31
- const [liveError, setLiveError] = useState(void 0);
32
28
  const [migrationId, setMigrationId] = useState("");
33
29
  const [direction, setDirection] = useState("up");
34
30
  const [dryRun, setDryRun] = useState(true);
35
31
  const [running, setRunning] = useState(false);
36
32
  const [runResult, setRunResult] = useState(null);
37
33
  const [runError, setRunError] = useState(null);
38
- const refresh = async (shard) => {
39
- setStatusError(null);
40
- try {
41
- const result = await client.query(MIGRATION_STATUS, {}, callOptions(shard));
42
- recordShard(shard);
43
- setRows(result.migrations);
44
- } catch (error) {
45
- setRows(null);
46
- setStatusError(errorMessage(error));
47
- throw error;
34
+ const debouncedShard = useDebounced(shardKey.trim(), 400);
35
+ const shardSettled = shardKey.trim() === debouncedShard;
36
+ const statusQuery = useAdminQuery(ADMIN_FUNCTIONS.migrationStatus, {}, {
37
+ live: true,
38
+ shardKey: debouncedShard
39
+ });
40
+ const rows = statusQuery.data?.migrations ?? null;
41
+ const statusError = statusQuery.error;
42
+ const {
43
+ liveError
44
+ } = statusQuery;
45
+ useEffect(() => {
46
+ if (statusQuery.data !== void 0) {
47
+ recordShard(debouncedShard);
48
48
  }
49
- };
50
- const committedShard = useLiveShardSeed(shardKey, refresh);
51
- useLiveAdmin(ADMIN_FUNCTIONS.migrationStatus, {}, committedShard ?? "", (result_0) => {
52
- setStatusError(null);
53
- setLiveError(void 0);
54
- setRows(result_0.migrations);
55
- }, committedShard !== void 0, setLiveError);
49
+ }, [statusQuery.data, debouncedShard]);
56
50
  const run = async () => {
57
51
  const id = migrationId.trim();
58
52
  if (id === "") {
@@ -63,17 +57,16 @@ const MigrationsPanel = ({
63
57
  setRunning(true);
64
58
  setRunError(null);
65
59
  try {
66
- const result_1 = await client.query(RUN_MIGRATION, {
60
+ const result = await client.query(RUN_MIGRATION, {
67
61
  direction,
68
62
  dryRun,
69
63
  id
70
64
  }, callOptions(shardKey));
71
- setRunResult(result_1);
72
- await refresh(shardKey).catch(() => {
73
- });
74
- } catch (error_0) {
65
+ setRunResult(result);
66
+ statusQuery.refetch();
67
+ } catch (error) {
75
68
  setRunResult(null);
76
- setRunError(errorMessage(error_0));
69
+ setRunError(errorMessage(error));
77
70
  } finally {
78
71
  setRunning(false);
79
72
  }
@@ -212,7 +205,7 @@ const MigrationsPanel = ({
212
205
  }, void 0, false), t("Dry run")]
213
206
  }, void 0, true), dryRun ? /* @__PURE__ */ jsxDEV(Button, {
214
207
  "data-testid": "mg-run",
215
- disabled: running,
208
+ disabled: running || !shardSettled,
216
209
  onClick: runMigration,
217
210
  size: "sm",
218
211
  type: "button",
@@ -221,7 +214,7 @@ const MigrationsPanel = ({
221
214
  // A real (non-dry-run) migration mutates rows — guard it.
222
215
  /* @__PURE__ */ jsxDEV(ConfirmButton, {
223
216
  confirmLabel: running ? t("Running…") : t("Run migration?"),
224
- disabled: running,
217
+ disabled: running || !shardSettled,
225
218
  onConfirm: runMigration,
226
219
  testId: "mg-run",
227
220
  children: t("Run")
@@ -1,8 +1,8 @@
1
1
  import { c } from 'react/compiler-runtime';
2
2
  import { useLunora } from '@lunora/react';
3
3
  import { E as EmptyState } from './empty-state-DY_oe0k6.js';
4
- import { u as useAdminSpec, S as Skeleton, R as ReferenceView } from './reference-view-BCKIoai7.js';
5
- import { useT } from './createStudioI18n-CgvlmDkN.js';
4
+ import { u as useAdminSpec, S as Skeleton, R as ReferenceView } from './reference-view-B4E49Lip.js';
5
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
6
6
  import { jsxDEV } from 'react/jsx-dev-runtime';
7
7
 
8
8
  const argsParameterOf = (method) => (method.params ?? []).find((parameter) => parameter.name === "args") ?? (method.params ?? [])[0];
@@ -1,14 +1,14 @@
1
1
  import { useLunora } from '@lunora/react';
2
2
  import { useState, useCallback, useEffect } from 'react';
3
- import { ConfirmButton } from './ConfirmButton-WQVUoGFb.js';
3
+ import { ConfirmButton } from './ConfirmButton-C2eVi2Qv.js';
4
4
  import { B as Badge } from './badge-B2PKA1-5.js';
5
5
  import { B as Button } from './button-BhsN2uZH.js';
6
6
  import { I as Input } from './input-XH4r1Pt1.js';
7
7
  import { L as Label } from './label-D8ykjn5J.js';
8
8
  import { useAutoRefresh } from './DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
9
- import { useT } from './createStudioI18n-CgvlmDkN.js';
10
- import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js';
11
- import { c as callOptions, e as errorMessage, f as fireAndForget, a as adminRef } from './internal-BBZYexre.js';
9
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
10
+ import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTIONS-CdaxLGkE.js';
11
+ import { c as callOptions, e as errorMessage, f as fireAndForget, a as adminRef } from './internal-rXJEAhXS.js';
12
12
  import { jsxDEV } from 'react/jsx-dev-runtime';
13
13
 
14
14
  const GET_BOOKMARK = adminRef(ADMIN_FUNCTIONS.getPitrBookmark);
@@ -1,79 +1,151 @@
1
+ import { c } from 'react/compiler-runtime';
1
2
  import { useLunora } from '@lunora/react';
2
- import { useState, useMemo, useEffect } from 'react';
3
- import { ConfirmButton } from './ConfirmButton-WQVUoGFb.js';
3
+ import { useState, useEffect } from 'react';
4
+ import { ConfirmButton } from './ConfirmButton-C2eVi2Qv.js';
4
5
  import { C as Card, a as CardContent } from './card-DURq3ElK.js';
5
6
  import { E as EmptyState } from './empty-state-DY_oe0k6.js';
6
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-BkbdNFNz.js';
7
9
  import { useAutoRefresh } from './DEFAULT_AUTO_REFRESH_MS-Vxwaxx51.js';
8
- import { useT } from './createStudioI18n-CgvlmDkN.js';
9
- import { f as fireAndForget, e as errorMessage, d as formatTimestamp } from './internal-BBZYexre.js';
10
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
11
+ import { f as fireAndForget, b as formatTimestamp, e as errorMessage } from './internal-rXJEAhXS.js';
10
12
  import { jsxDEV } from 'react/jsx-dev-runtime';
11
13
 
12
14
  const formatScheduledFor = (value) => Number.isFinite(value) ? formatTimestamp(value, "—") : "—";
13
- const ScheduledJobs = ({
14
- cancelJob,
15
- loadJobs
16
- } = {}) => {
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;
17
30
  const client = useLunora();
18
31
  const t = useT();
19
- const [jobs, setJobs] = useState(null);
20
- const [error, setError] = useState(null);
21
- const load = loadJobs ?? (() => client.listScheduledJobs());
22
- const cancelImpl = useMemo(() => {
23
- if (cancelJob !== void 0) {
24
- return cancelJob;
25
- }
26
- return loadJobs === void 0 ? (id) => client.cancelScheduledJob(id) : void 0;
27
- }, [cancelJob, client, loadJobs]);
28
- const refresh = async () => {
29
- setError(null);
30
- try {
31
- const records = await load();
32
- setJobs(records.toSorted((a, b) => a.scheduledFor - b.scheduledFor));
33
- } catch (error_) {
34
- setJobs(null);
35
- setError(errorMessage(error_));
36
- }
37
- };
38
- useEffect(() => {
39
- fireAndForget(refresh());
40
- }, []);
41
32
  const livePush = loadJobs === void 0;
42
- useEffect(() => {
43
- if (!livePush) {
44
- return void 0;
45
- }
46
- return client.subscribeScheduledJobs((records) => {
47
- setError(null);
48
- setJobs(records.toSorted((a, b) => a.scheduledFor - b.scheduledFor));
49
- });
50
- }, [livePush, client]);
51
- useAutoRefresh(() => {
52
- fireAndForget(refresh());
53
- }, !livePush);
54
- const cancel = async (id) => {
55
- if (cancelImpl === void 0) {
56
- return;
57
- }
58
- setError(null);
59
- try {
60
- await cancelImpl(id);
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 = () => {
61
59
  if (!livePush) {
62
- await refresh();
60
+ return;
63
61
  }
64
- } catch (error_) {
65
- setError(errorMessage(error_));
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];
66
102
  }
67
- };
68
- return /* @__PURE__ */ jsxDEV("div", {
69
- className: "flex flex-col gap-3",
70
- "data-testid": "lunora-scheduled-jobs",
71
- children: [error !== null && /* @__PURE__ */ jsxDEV("p", {
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", {
72
136
  className: "text-sm text-destructive",
73
137
  "data-testid": "sj-error",
74
138
  role: "alert",
75
139
  children: error
76
- }, void 0, false), jobs !== null && jobs.length === 0 && /* @__PURE__ */ jsxDEV(EmptyState, {
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, {
77
149
  description: t("Jobs queued with runAfter / runAt will appear here."),
78
150
  icon: /* @__PURE__ */ jsxDEV("svg", {
79
151
  "aria-hidden": "true",
@@ -93,7 +165,16 @@ const ScheduledJobs = ({
93
165
  }, void 0, true),
94
166
  testId: "sj-empty",
95
167
  title: t("No scheduled jobs.")
96
- }, void 0, false), jobs !== null && jobs.length > 0 && /* @__PURE__ */ jsxDEV(Card, {
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, {
97
178
  className: "overflow-hidden py-0",
98
179
  children: /* @__PURE__ */ jsxDEV(CardContent, {
99
180
  className: "px-0",
@@ -152,8 +233,30 @@ const ScheduledJobs = ({
152
233
  }, void 0, false)]
153
234
  }, void 0, true)
154
235
  }, void 0, false)
155
- }, void 0, false)]
156
- }, void 0, true);
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;
157
260
  };
158
261
 
159
262
  export { ScheduledJobs };
@@ -2,7 +2,7 @@
2
2
  import { c } from 'react/compiler-runtime';
3
3
  import { useLunora } from '@lunora/react';
4
4
  import { useState, useRef, useEffect } from 'react';
5
- import { ShardInput } from './ShardInput-DNCsT1KW.js';
5
+ import { ShardInput } from './ShardInput-gx_DZXXn.js';
6
6
  import { S as StorageTierBadge, T as TIER_META } from './storage-tier-CL98eOvn.js';
7
7
  import { B as Badge } from './badge-B2PKA1-5.js';
8
8
  import { B as Button } from './button-BhsN2uZH.js';
@@ -10,9 +10,9 @@ import { C as Card, b as CardHeader, c as CardTitle, d as CardDescription, a as
10
10
  import { E as EmptyState } from './empty-state-DY_oe0k6.js';
11
11
  import { I as Input } from './input-XH4r1Pt1.js';
12
12
  import useDebounced from './useDebounced-Dxncpg6z.js';
13
- import { useT } from './createStudioI18n-CgvlmDkN.js';
14
- import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js';
15
- import { f as fireAndForget, c as callOptions, e as errorMessage, a as adminRef } from './internal-BBZYexre.js';
13
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
14
+ import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTIONS-CdaxLGkE.js';
15
+ import { f as fireAndForget, c as callOptions, e as errorMessage, a as adminRef } from './internal-rXJEAhXS.js';
16
16
  import { r as recordShard } from './shard-history-DyebH1R5.js';
17
17
  import { c as cn } from './utils-B05Dmz_H.js';
18
18
  import { Download01Icon } from '@hugeicons/core-free-icons';
@@ -1,12 +1,10 @@
1
- import { useLunora } from '@lunora/react';
2
- import { useState, useEffect } from 'react';
3
- import { useT } from './createStudioI18n-CgvlmDkN.js';
4
- import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTION_PREFIX-DmBqMZ-z.js';
5
- import { f as fireAndForget, c as callOptions, e as errorMessage, a as adminRef } from './internal-BBZYexre.js';
6
- import { A as AdvisorView } from './advisor-view-DBlzJi6C.js';
1
+ import { c } from 'react/compiler-runtime';
2
+ import { u as useAdminQuery } from './use-admin-query-BkbdNFNz.js';
3
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
4
+ import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTIONS-CdaxLGkE.js';
5
+ import { A as AdvisorView } from './advisor-view-CGcfMiPq.js';
7
6
  import { jsxDEV } from 'react/jsx-dev-runtime';
8
7
 
9
- const GET_SECURITY_AUDIT = adminRef(ADMIN_FUNCTIONS.getSecurityAudit);
10
8
  const findingTitle = (t, finding) => ({
11
9
  "admin-token-weak": t("Weak admin token"),
12
10
  "auth-secret-weak": t("Weak auth secret"),
@@ -17,6 +15,7 @@ const findingTitle = (t, finding) => ({
17
15
  "security-headers-disabled": t("Security headers are off"),
18
16
  "ws-gate-open": t("Live admin subscriptions are ungated")
19
17
  })[finding.kind];
18
+ const toFindings = (result) => Array.isArray(result.findings) ? result.findings : [];
20
19
  const findingEntity = (finding) => ({
21
20
  "admin-token-weak": "LUNORA_ADMIN_TOKEN",
22
21
  "auth-secret-weak": "AUTH_SECRET",
@@ -44,36 +43,50 @@ const findingDetail = (t, finding) => ({
44
43
  "ws-gate-open": t("LUNORA_WS_BEARER is unset, so the WebSocket upgrade gate is open: live admin subscriptions need no credential. Set it to gate them like the HTTP admin RPCs.")
45
44
  })[finding.kind];
46
45
  const SecurityAdvisorPanel = () => {
47
- const client = useLunora();
46
+ const $ = c(7);
48
47
  const t = useT();
49
- const [findings, setFindings] = useState(null);
50
- const [error, setError] = useState(null);
51
- const refresh = async () => {
52
- try {
53
- const result = await client.query(GET_SECURITY_AUDIT, {}, callOptions(""));
54
- setFindings(Array.isArray(result.findings) ? result.findings : []);
55
- setError(null);
56
- } catch (error_) {
57
- setError(errorMessage(error_));
58
- }
59
- };
60
- useEffect(() => {
61
- fireAndForget(refresh());
62
- }, [refresh]);
63
- const rows = findings === null ? null : findings.map((finding) => {
64
- return {
48
+ let t0;
49
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
50
+ t0 = {};
51
+ $[0] = t0;
52
+ } else {
53
+ t0 = $[0];
54
+ }
55
+ const {
56
+ data,
57
+ error
58
+ } = useAdminQuery(ADMIN_FUNCTIONS.getSecurityAudit, t0);
59
+ let t1;
60
+ if ($[1] !== data || $[2] !== t) {
61
+ const findings = data === void 0 ? null : toFindings(data);
62
+ t1 = findings === null ? null : findings.map((finding) => ({
65
63
  description: findingDetail(t, finding),
66
64
  entity: findingEntity(finding),
67
65
  issueType: findingTitle(t, finding),
68
66
  key: finding.kind,
69
67
  level: finding.level
70
- };
71
- });
72
- return /* @__PURE__ */ jsxDEV(AdvisorView, {
73
- error,
74
- rows,
75
- testId: "lunora-security-advisor"
76
- }, void 0, false);
68
+ }));
69
+ $[1] = data;
70
+ $[2] = t;
71
+ $[3] = t1;
72
+ } else {
73
+ t1 = $[3];
74
+ }
75
+ const rows = t1;
76
+ let t2;
77
+ if ($[4] !== error || $[5] !== rows) {
78
+ t2 = /* @__PURE__ */ jsxDEV(AdvisorView, {
79
+ error,
80
+ rows,
81
+ testId: "lunora-security-advisor"
82
+ }, void 0, false);
83
+ $[4] = error;
84
+ $[5] = rows;
85
+ $[6] = t2;
86
+ } else {
87
+ t2 = $[6];
88
+ }
89
+ return t2;
77
90
  };
78
91
 
79
92
  export { SecurityAdvisorPanel as default };