@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
@@ -3,13 +3,20 @@ import { useLunora } from '@lunora/react';
3
3
  import { useNavigate, useRouter, useSearch } from '@tanstack/react-router';
4
4
  import { useRef, useState, useEffect } from 'react';
5
5
  import { T as TIER_META } from './storage-tier-CL98eOvn.js';
6
- import { useT } from './createStudioI18n-CgvlmDkN.js';
7
- import { f as fireAndForget } from './internal-BBZYexre.js';
8
- import { DataBrowser } from './DataBrowser-Coz6jJE6.js';
9
- import { GlobalDataBrowser } from './GlobalDataBrowser-9MhPEfgN.js';
6
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
7
+ import { f as fireAndForget } from './internal-rXJEAhXS.js';
8
+ import { DataBrowser } from './DataBrowser-Bb1gTQ6c.js';
9
+ import { GlobalDataBrowser } from './GlobalDataBrowser-3X9uRfdO.js';
10
10
  import { jsxDEV } from 'react/jsx-dev-runtime';
11
11
 
12
12
  const VALID_OPERATORS = /* @__PURE__ */ new Set(["contains", "eq", "gt", "gte", "lt", "lte", "ne"]);
13
+ const stringParameter = (raw) => {
14
+ if (typeof raw !== "string") {
15
+ return void 0;
16
+ }
17
+ const value = raw.trim();
18
+ return value === "" ? void 0 : value;
19
+ };
13
20
  const isFilterClause = (entry) => {
14
21
  if (entry === null || typeof entry !== "object") {
15
22
  return false;
@@ -46,6 +53,33 @@ const parseOrder = (raw) => {
46
53
  direction
47
54
  };
48
55
  };
56
+ const validateDataViewSearch = (search) => {
57
+ const validated = {};
58
+ if (search["schema"] === "global") {
59
+ validated.schema = "global";
60
+ }
61
+ const table = stringParameter(search["table"]);
62
+ if (table !== void 0) {
63
+ validated.table = table;
64
+ }
65
+ const shard = stringParameter(search["shard"]);
66
+ if (shard !== void 0) {
67
+ validated.shard = shard;
68
+ }
69
+ const searchText = stringParameter(search["search"]);
70
+ if (searchText !== void 0) {
71
+ validated.search = searchText;
72
+ }
73
+ const order = stringParameter(search["order"]);
74
+ if (order !== void 0 && parseOrder(order) !== void 0) {
75
+ validated.order = order;
76
+ }
77
+ const filters = stringParameter(search["filters"]);
78
+ if (filters !== void 0 && parseFilters(filters).length > 0) {
79
+ validated.filters = filters;
80
+ }
81
+ return validated;
82
+ };
49
83
  const searchToDataView = (search) => {
50
84
  const filters = parseFilters(search["filters"]);
51
85
  const orderBy = parseOrder(search["order"]);
@@ -260,14 +294,16 @@ const TableEditor = ({
260
294
  to: "/data"
261
295
  }));
262
296
  };
263
- const onSelectTable = (table_0) => {
297
+ const onSelectTable = (table_0, options) => {
264
298
  if (!onDataRoute()) {
265
299
  return;
266
300
  }
267
301
  fireAndForget(navigate({
268
302
  search: (previous_1) => {
269
303
  return {
270
- ...previous_1,
304
+ schema: previous_1["schema"],
305
+ search: options?.search,
306
+ shard: previous_1["shard"],
271
307
  table: table_0
272
308
  };
273
309
  },
@@ -368,4 +404,4 @@ const TableEditor = ({
368
404
  }, void 0, false);
369
405
  };
370
406
 
371
- export { TableEditor };
407
+ export { TableEditor as T, validateDataViewSearch as v };
@@ -1,8 +1,8 @@
1
1
  import { c } from 'react/compiler-runtime';
2
- import { useT } from './createStudioI18n-CgvlmDkN.js';
2
+ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
3
3
  import { jsxDEV } from 'react/jsx-dev-runtime';
4
4
  import { useState, useRef, useMemo } from 'react';
5
- import { f as fireAndForget, e as errorMessage } from './internal-BBZYexre.js';
5
+ import { f as fireAndForget, e as errorMessage } from './internal-rXJEAhXS.js';
6
6
  import { useVirtualizer } from '@tanstack/react-virtual';
7
7
  import { c as cn } from './utils-B05Dmz_H.js';
8
8
  import { f as flooredRectObserver } from './virtual-rect-CVMUskSm.js';
@@ -0,0 +1,105 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { useQueryClient, useQuery, keepPreviousData } from '@tanstack/react-query';
4
+ import { useState, useEffect } from 'react';
5
+ import { a as adminRef, c as callOptions, f as fireAndForget, e as errorMessage } from './internal-rXJEAhXS.js';
6
+
7
+ const adminQueryKey = (path, args, shardKey) => ["lunora-admin", path, args, shardKey.trim()];
8
+ const RPC_LOOP_WINDOW_MS = 1e3;
9
+ const RPC_LOOP_THRESHOLD = 25;
10
+ const rpcCallTimes = /* @__PURE__ */ new Map();
11
+ const noteQueryFetch = (key) => {
12
+ const now = Date.now();
13
+ const recent = (rpcCallTimes.get(key) ?? []).filter((time) => now - time < RPC_LOOP_WINDOW_MS);
14
+ recent.push(now);
15
+ rpcCallTimes.set(key, recent);
16
+ if (recent.length === RPC_LOOP_THRESHOLD) {
17
+ console.error(`[lunora-studio] possible request loop: ${key} fired ${String(RPC_LOOP_THRESHOLD)}× in <1s — a render/effect is re-issuing this read unbounded.`);
18
+ console.trace("[lunora-studio] request-loop call site");
19
+ }
20
+ };
21
+ function useClientQuery(queryKey, queryFunction, options = {}) {
22
+ const {
23
+ enabled = true,
24
+ keepPreviousData: keepPreviousData$1 = false,
25
+ staleTime = 0
26
+ } = options;
27
+ const trackedQueryFunction = () => {
28
+ noteQueryFetch(JSON.stringify(queryKey));
29
+ return queryFunction();
30
+ } ;
31
+ const query = useQuery({
32
+ enabled,
33
+ queryFn: trackedQueryFunction,
34
+ placeholderData: keepPreviousData$1 ? keepPreviousData : void 0,
35
+ queryKey,
36
+ staleTime
37
+ });
38
+ return {
39
+ data: query.data,
40
+ error: query.error ? errorMessage(query.error) : query.error,
41
+ isLoading: query.isLoading,
42
+ liveError: void 0,
43
+ refetch: () => {
44
+ fireAndForget(query.refetch());
45
+ }
46
+ };
47
+ }
48
+ function useAdminQuery(path, args, options = {}) {
49
+ const client = useLunora();
50
+ const queryClient = useQueryClient();
51
+ const {
52
+ enabled = true,
53
+ keepPreviousData = false,
54
+ live = false,
55
+ shardKey = "",
56
+ staleTime
57
+ } = options;
58
+ const queryKey = adminQueryKey(path, args, shardKey);
59
+ const base = useClientQuery(queryKey, () => client.query(adminRef(path), args, callOptions(shardKey)), {
60
+ enabled,
61
+ keepPreviousData,
62
+ staleTime: staleTime ?? (live ? Number.POSITIVE_INFINITY : 0)
63
+ });
64
+ const [liveError, setLiveError] = useState(void 0);
65
+ const keySignature = JSON.stringify(queryKey);
66
+ useEffect(() => {
67
+ if (!enabled || !live) {
68
+ return void 0;
69
+ }
70
+ setLiveError(void 0);
71
+ return client.subscribe(adminRef(path), args, (value) => {
72
+ setLiveError(void 0);
73
+ queryClient.setQueryData(queryKey, value);
74
+ }, {
75
+ ...callOptions(shardKey),
76
+ onError: (error) => {
77
+ setLiveError(error.message);
78
+ }
79
+ });
80
+ }, [keySignature, enabled, live]);
81
+ return {
82
+ ...base,
83
+ liveError: enabled && live ? liveError : void 0
84
+ };
85
+ }
86
+ const useInvalidateAdmin = () => {
87
+ const $ = c(2);
88
+ const queryClient = useQueryClient();
89
+ let t0;
90
+ if ($[0] !== queryClient) {
91
+ t0 = (path, args, shardKey) => {
92
+ const queryKey = args === void 0 ? ["lunora-admin", path] : adminQueryKey(path, args, shardKey ?? "");
93
+ fireAndForget(queryClient.invalidateQueries({
94
+ queryKey
95
+ }));
96
+ };
97
+ $[0] = queryClient;
98
+ $[1] = t0;
99
+ } else {
100
+ t0 = $[1];
101
+ }
102
+ return t0;
103
+ };
104
+
105
+ export { useInvalidateAdmin as a, useClientQuery as b, useAdminQuery as u };