@lunora/studio 1.0.0-alpha.5 → 1.0.0-alpha.51

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 (198) hide show
  1. package/LICENSE.md +6 -0
  2. package/__assets__/package-og.svg +1 -1
  3. package/dist/index.d.ts +45 -23
  4. package/dist/index.js +31 -31
  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} +55 -32
  11. package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +15 -32
  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} +179 -401
  24. package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +13 -94
  25. package/dist/packem_chunks/agents-panel.js +326 -0
  26. package/dist/packem_chunks/analytics-panel.js +261 -0
  27. package/dist/packem_chunks/auth-config-panel.js +365 -0
  28. package/dist/packem_chunks/auth-sessions-panel.js +175 -0
  29. package/dist/packem_chunks/containers-panel.js +261 -0
  30. package/dist/packem_chunks/dashboards-panel.js +781 -0
  31. package/dist/packem_chunks/fanout-panel.js +482 -0
  32. package/dist/packem_chunks/flags-panel.js +176 -0
  33. package/dist/packem_chunks/issues-panel.js +188 -0
  34. package/dist/packem_chunks/kv-browser.js +1896 -0
  35. package/dist/packem_chunks/log-drains-panel.js +273 -0
  36. package/dist/packem_chunks/organizations-panel.js +3178 -0
  37. package/dist/packem_chunks/payments-panel.js +186 -0
  38. package/dist/packem_chunks/permissions-panel.js +805 -0
  39. package/dist/packem_chunks/queues-panel.js +1075 -0
  40. package/dist/packem_chunks/rls-panel.js +315 -0
  41. package/dist/packem_chunks/schedule-panel.js +831 -0
  42. package/dist/packem_chunks/sparkline.js +79 -0
  43. package/dist/packem_chunks/storage-rules-panel.js +140 -0
  44. package/dist/packem_chunks/subscriptions-panel.js +238 -0
  45. package/dist/packem_chunks/users-panel.js +1731 -0
  46. package/dist/packem_chunks/vector-browser.js +281 -0
  47. package/dist/packem_chunks/workflows-panel.js +562 -0
  48. package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-DNeyYtUN.js} +8 -0
  49. package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-_aEZxAMX.js} +2 -2
  50. package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Dd8pcswz.js} +2 -1
  51. package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-BXV4eKf5.js} +1 -1
  52. package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-C8hejnub.js} +201 -250
  53. package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
  54. package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-f5Ll2AQK.js} +43 -68
  55. package/dist/packem_shared/HomePanel-Ye8PaqQL.js +14 -0
  56. package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CWaf0ZtX.js} +2 -1
  57. package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-dHMgnJbx.js} +163 -60
  58. package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
  59. package/dist/packem_shared/Studio-BNGjxLVo.js +16 -0
  60. package/dist/packem_shared/{StudioApp-D4azxYBu.js → StudioApp-K9dn1Q9d.js} +75 -24
  61. package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-Cx21PS_T.js} +6 -6
  62. package/dist/packem_shared/alert-CdAET2K_.js +68 -0
  63. package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CGdOmLTm.d.ts} +1 -1
  64. package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
  65. package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
  66. package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
  67. package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-C9I16KWr.js} +1 -1
  68. package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
  69. package/dist/packem_shared/error-alert-vIPQoN3Y.js +114 -0
  70. package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-B_fZH4iQ.js} +133 -164
  71. package/dist/packem_shared/home-panel-D62G8108.js +1889 -0
  72. package/dist/packem_shared/internal-zwBoOv24.js +122 -0
  73. package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
  74. package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUULLuOi.js} +8 -61
  75. package/dist/packem_shared/result-chart-DZradBAS.js +119 -0
  76. package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
  77. package/dist/packem_shared/select-UkNYCT3s.js +273 -0
  78. package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
  79. package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
  80. package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
  81. package/dist/packem_shared/studio-Cd21fp4v.js +4090 -0
  82. package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
  83. package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-huX4VmgI.js} +19 -9
  84. package/dist/packem_shared/use-admin-query-BGJ010yZ.js +106 -0
  85. package/dist/packem_shared/use-async-submit-DGCtuDyz.js +91 -0
  86. package/dist/standalone/chunk-22C6COGE.js +13 -0
  87. package/dist/standalone/chunk-2K47A3P6.js +1 -0
  88. package/dist/standalone/chunk-2MLA6WFH.js +1 -0
  89. package/dist/standalone/chunk-2NGUNNGW.js +1 -0
  90. package/dist/standalone/chunk-2ZL6MXBC.js +4 -0
  91. package/dist/standalone/chunk-3GXGLNKW.js +1 -0
  92. package/dist/standalone/chunk-3OA7PECS.js +6 -0
  93. package/dist/standalone/chunk-4PC7IXNY.js +1 -0
  94. package/dist/standalone/chunk-4QA5TWYJ.js +1 -0
  95. package/dist/standalone/chunk-4QHKBC77.js +1 -0
  96. package/dist/standalone/chunk-5OIBXYZM.js +1 -0
  97. package/dist/standalone/chunk-6TYT447C.js +1 -0
  98. package/dist/standalone/chunk-7SN6J4DZ.js +1 -0
  99. package/dist/standalone/chunk-7TJJXVSE.js +1 -0
  100. package/dist/standalone/chunk-A3ZJACVT.js +4 -0
  101. package/dist/standalone/chunk-AHILM3ZP.js +1 -0
  102. package/dist/standalone/chunk-AITOCPML.js +1 -0
  103. package/dist/standalone/chunk-AJ2B326V.js +1 -0
  104. package/dist/standalone/chunk-APSSZB6Z.js +1 -0
  105. package/dist/standalone/chunk-AVONJCNY.js +4 -0
  106. package/dist/standalone/chunk-BE24FXAK.js +1 -0
  107. package/dist/standalone/chunk-BJGBHGK3.js +1 -0
  108. package/dist/standalone/chunk-CKSHCYGC.js +2 -0
  109. package/dist/standalone/chunk-CP2EQVLU.js +1 -0
  110. package/dist/standalone/chunk-DTPFXYHG.js +1 -0
  111. package/dist/standalone/chunk-DWDILV2E.js +1 -0
  112. package/dist/standalone/chunk-E3FVNRH7.js +1 -0
  113. package/dist/standalone/chunk-EEWKIQUE.js +1 -0
  114. package/dist/standalone/chunk-EOE5NDMK.js +1 -0
  115. package/dist/standalone/chunk-FJV4UNYY.js +1 -0
  116. package/dist/standalone/chunk-FWTZYHX4.js +1 -0
  117. package/dist/standalone/chunk-G465LTLD.js +1 -0
  118. package/dist/standalone/chunk-G6URLCRC.js +3 -0
  119. package/dist/standalone/chunk-G7ZBM54M.js +1 -0
  120. package/dist/standalone/chunk-GTM65MVX.js +1 -0
  121. package/dist/standalone/chunk-HV7G6DFP.js +5 -0
  122. package/dist/standalone/chunk-IMZKGRPW.js +1 -0
  123. package/dist/standalone/chunk-ITQKVEP7.js +19 -0
  124. package/dist/standalone/chunk-IZN4TYMN.js +1 -0
  125. package/dist/standalone/chunk-J6J54MBP.js +1 -0
  126. package/dist/standalone/chunk-JM7XBQVK.js +1 -0
  127. package/dist/standalone/chunk-JPILGFXT.js +1 -0
  128. package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
  129. package/dist/standalone/chunk-KDZJ5A3R.js +1 -0
  130. package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
  131. package/dist/standalone/chunk-KGQGNJJ2.js +1 -0
  132. package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
  133. package/dist/standalone/chunk-KKJZL75J.js +1 -0
  134. package/dist/standalone/chunk-KZ6INM5M.js +1 -0
  135. package/dist/standalone/chunk-L2YBC2BV.js +11 -0
  136. package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
  137. package/dist/standalone/chunk-LAK5VSPI.js +1 -0
  138. package/dist/standalone/chunk-LDEVBRDZ.js +1 -0
  139. package/dist/standalone/chunk-LUP4YTBS.js +1 -0
  140. package/dist/standalone/chunk-LVH4KLXS.js +13 -0
  141. package/dist/standalone/chunk-MDTNVR3G.js +1 -0
  142. package/dist/standalone/chunk-N4NG7HGI.js +1 -0
  143. package/dist/standalone/chunk-O3NAGRTR.js +1 -0
  144. package/dist/standalone/chunk-ONSKQCYN.js +3 -0
  145. package/dist/standalone/chunk-OQE56NBE.js +1 -0
  146. package/dist/standalone/chunk-OSPEOESV.js +8 -0
  147. package/dist/standalone/chunk-Q7PYLDZU.js +1 -0
  148. package/dist/standalone/chunk-Q7TKOAGT.js +1 -0
  149. package/dist/standalone/chunk-QAFAJBAW.js +1 -0
  150. package/dist/standalone/chunk-RRCPZMC2.js +22 -0
  151. package/dist/standalone/chunk-RXVQJ4DO.js +1 -0
  152. package/dist/standalone/chunk-S5NTGHCG.js +1 -0
  153. package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
  154. package/dist/standalone/chunk-SEU5V7I6.js +1 -0
  155. package/dist/standalone/chunk-SHERR7ZP.js +1 -0
  156. package/dist/standalone/chunk-T3UCZ5PJ.js +1 -0
  157. package/dist/standalone/chunk-TAD43CG5.js +1 -0
  158. package/dist/standalone/chunk-TAQM5WML.js +1 -0
  159. package/dist/standalone/chunk-TO6D2PJC.js +6 -0
  160. package/dist/standalone/chunk-TQ36RWOP.js +1 -0
  161. package/dist/standalone/chunk-TSLR3ZU2.js +1 -0
  162. package/dist/standalone/chunk-UK64ZSUW.js +1 -0
  163. package/dist/standalone/chunk-UX53GWGU.js +1 -0
  164. package/dist/standalone/chunk-V43BLH4J.js +1 -0
  165. package/dist/standalone/chunk-VC5RNEHU.js +1 -0
  166. package/dist/standalone/chunk-VL23Y44O.js +4 -0
  167. package/dist/standalone/chunk-VLIRTNLA.js +4 -0
  168. package/dist/standalone/chunk-VLXV72QE.js +1 -0
  169. package/dist/standalone/chunk-VN2PDOMK.js +1 -0
  170. package/dist/standalone/chunk-VZFJI6XE.js +1 -0
  171. package/dist/standalone/chunk-W6JKUZKD.js +1 -0
  172. package/dist/standalone/chunk-WI7GWFEG.js +1 -0
  173. package/dist/standalone/chunk-WJ6OBCUM.js +1 -0
  174. package/dist/standalone/chunk-WUFVFVHJ.js +1 -0
  175. package/dist/standalone/chunk-WVTPZ6CM.js +1 -0
  176. package/dist/standalone/chunk-X4QFAAZ5.js +76 -0
  177. package/dist/standalone/chunk-XNJNSCLM.js +1 -0
  178. package/dist/standalone/chunk-XOANGJJP.js +1 -0
  179. package/dist/standalone/chunk-YA6POZJD.js +1 -0
  180. package/dist/standalone/chunk-ZECNJ4FG.js +1 -0
  181. package/dist/standalone/chunk-ZETIKSQJ.js +1 -0
  182. package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
  183. package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
  184. package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
  185. package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
  186. package/dist/standalone/chunk-ZZMGCPXE.js +2 -0
  187. package/dist/standalone/studio.js +104 -246
  188. package/dist/styles.css +2 -2
  189. package/package.json +17 -15
  190. package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
  191. package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
  192. package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
  193. package/dist/packem_shared/Studio-BmSGSIuY.js +0 -33
  194. package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
  195. package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
  196. package/dist/packem_shared/studio-H9fuQgSj.js +0 -10303
  197. package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
  198. package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
@@ -32,7 +32,7 @@ function Table(t0) {
32
32
  if ($[5] !== props || $[6] !== t1) {
33
33
  t2 = /* @__PURE__ */ jsxDEV("div", {
34
34
  "data-slot": "table-container",
35
- className: "relative w-full overflow-x-auto",
35
+ className: "relative w-full overflow-x-auto overflow-y-clip",
36
36
  children: /* @__PURE__ */ jsxDEV("table", {
37
37
  "data-slot": "table",
38
38
  className: t1,
@@ -2,7 +2,7 @@ import { c } from 'react/compiler-runtime';
2
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-rXJEAhXS.js';
5
+ import { f as fireAndForget, e as errorMessage } from './internal-zwBoOv24.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';
@@ -565,7 +565,10 @@ const useFacets = () => {
565
565
  const [facets, setFacets] = useState({});
566
566
  const facetsRef = useRef(facets);
567
567
  facetsRef.current = facets;
568
+ const fetchSeq = useRef({});
568
569
  const fetchFacet = async (column, fetcher) => {
570
+ const seq = (fetchSeq.current[column] ?? 0) + 1;
571
+ fetchSeq.current[column] = seq;
569
572
  setFacets((current) => column in current ? {
570
573
  ...current,
571
574
  [column]: {
@@ -576,6 +579,9 @@ const useFacets = () => {
576
579
  } : current);
577
580
  try {
578
581
  const result = await fetcher(column);
582
+ if (fetchSeq.current[column] !== seq) {
583
+ return;
584
+ }
579
585
  setFacets((current_1) => column in current_1 ? {
580
586
  ...current_1,
581
587
  [column]: {
@@ -585,6 +591,9 @@ const useFacets = () => {
585
591
  }
586
592
  } : current_1);
587
593
  } catch (error) {
594
+ if (fetchSeq.current[column] !== seq) {
595
+ return;
596
+ }
588
597
  setFacets((current_0) => column in current_0 ? {
589
598
  ...current_0,
590
599
  [column]: {
@@ -596,15 +605,13 @@ const useFacets = () => {
596
605
  }
597
606
  };
598
607
  const toggleFacet = (column_0, fetcher_0) => {
599
- setFacets((current_2) => {
600
- if (column_0 in current_2) {
601
- return Object.fromEntries(Object.entries(current_2).filter(([name]) => name !== column_0));
602
- }
603
- if (fetcher_0 !== null) {
604
- fireAndForget(fetchFacet(column_0, fetcher_0));
605
- }
608
+ if (column_0 in facetsRef.current) {
609
+ setFacets((current_2) => Object.fromEntries(Object.entries(current_2).filter(([name]) => name !== column_0)));
610
+ return;
611
+ }
612
+ setFacets((current_3) => {
606
613
  return {
607
- ...current_2,
614
+ ...current_3,
608
615
  [column_0]: {
609
616
  error: null,
610
617
  loading: true,
@@ -612,6 +619,9 @@ const useFacets = () => {
612
619
  }
613
620
  };
614
621
  });
622
+ if (fetcher_0 !== null) {
623
+ fireAndForget(fetchFacet(column_0, fetcher_0));
624
+ }
615
625
  };
616
626
  const refetchFacets = (fetcher_1) => {
617
627
  for (const column_1 of Object.keys(facetsRef.current)) {
@@ -0,0 +1,106 @@
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-zwBoOv24.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
+ errorSource: query.error ?? void 0,
42
+ isLoading: query.isLoading,
43
+ liveError: void 0,
44
+ refetch: () => {
45
+ fireAndForget(query.refetch());
46
+ }
47
+ };
48
+ }
49
+ function useAdminQuery(path, args, options = {}) {
50
+ const client = useLunora();
51
+ const queryClient = useQueryClient();
52
+ const {
53
+ enabled = true,
54
+ keepPreviousData = false,
55
+ live = false,
56
+ shardKey = "",
57
+ staleTime
58
+ } = options;
59
+ const queryKey = adminQueryKey(path, args, shardKey);
60
+ const base = useClientQuery(queryKey, () => client.query(adminRef(path), args, callOptions(shardKey)), {
61
+ enabled,
62
+ keepPreviousData,
63
+ staleTime: staleTime ?? (live ? Number.POSITIVE_INFINITY : 0)
64
+ });
65
+ const [liveError, setLiveError] = useState(void 0);
66
+ const keySignature = JSON.stringify(queryKey);
67
+ useEffect(() => {
68
+ if (!enabled || !live) {
69
+ return void 0;
70
+ }
71
+ setLiveError(void 0);
72
+ return client.subscribe(adminRef(path), args, (value) => {
73
+ setLiveError(void 0);
74
+ queryClient.setQueryData(queryKey, value);
75
+ }, {
76
+ ...callOptions(shardKey),
77
+ onError: (error) => {
78
+ setLiveError(error.message);
79
+ }
80
+ });
81
+ }, [keySignature, enabled, live]);
82
+ return {
83
+ ...base,
84
+ liveError: enabled && live ? liveError : void 0
85
+ };
86
+ }
87
+ const useInvalidateAdmin = () => {
88
+ const $ = c(2);
89
+ const queryClient = useQueryClient();
90
+ let t0;
91
+ if ($[0] !== queryClient) {
92
+ t0 = (path, args, shardKey) => {
93
+ const queryKey = args === void 0 ? ["lunora-admin", path] : adminQueryKey(path, args, shardKey ?? "");
94
+ fireAndForget(queryClient.invalidateQueries({
95
+ queryKey
96
+ }));
97
+ };
98
+ $[0] = queryClient;
99
+ $[1] = t0;
100
+ } else {
101
+ t0 = $[1];
102
+ }
103
+ return t0;
104
+ };
105
+
106
+ export { useClientQuery as a, useInvalidateAdmin as b, useAdminQuery as u };
@@ -0,0 +1,91 @@
1
+ import { c } from 'react/compiler-runtime';
2
+ import { useLunora } from '@lunora/react';
3
+ import { a as useClientQuery } from './use-admin-query-BGJ010yZ.js';
4
+ import { useState } from 'react';
5
+ import { f as fireAndForget, e as errorMessage } from './internal-zwBoOv24.js';
6
+
7
+ const DEFAULT_AUTH_CONFIG = {
8
+ capabilities: {
9
+ accounts: true,
10
+ admin: true,
11
+ organization: false,
12
+ passkey: false,
13
+ twoFactor: false
14
+ },
15
+ emailAndPassword: false,
16
+ organization: {
17
+ enabled: false,
18
+ roles: false,
19
+ teams: false
20
+ },
21
+ plugins: [],
22
+ rateLimit: {
23
+ enabled: false
24
+ },
25
+ session: {},
26
+ socialProviders: [],
27
+ userFields: []
28
+ };
29
+ const useAuthConfig = () => {
30
+ const $ = c(6);
31
+ const client = useLunora();
32
+ let t0;
33
+ if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
34
+ t0 = ["lunora-auth-config"];
35
+ $[0] = t0;
36
+ } else {
37
+ t0 = $[0];
38
+ }
39
+ let t1;
40
+ if ($[1] !== client) {
41
+ t1 = () => client.getAuthConfig();
42
+ $[1] = client;
43
+ $[2] = t1;
44
+ } else {
45
+ t1 = $[2];
46
+ }
47
+ const {
48
+ data,
49
+ isLoading
50
+ } = useClientQuery(t0, t1);
51
+ const t2 = data ?? DEFAULT_AUTH_CONFIG;
52
+ const t3 = !isLoading;
53
+ let t4;
54
+ if ($[3] !== t2 || $[4] !== t3) {
55
+ t4 = {
56
+ config: t2,
57
+ ready: t3
58
+ };
59
+ $[3] = t2;
60
+ $[4] = t3;
61
+ $[5] = t4;
62
+ } else {
63
+ t4 = $[5];
64
+ }
65
+ return t4;
66
+ };
67
+
68
+ const useAsyncSubmit = () => {
69
+ const [busy, setBusy] = useState(false);
70
+ const [error, setError] = useState(null);
71
+ const run = (action) => {
72
+ fireAndForget((async () => {
73
+ setBusy(true);
74
+ setError(null);
75
+ try {
76
+ await action();
77
+ } catch (error_) {
78
+ setError(errorMessage(error_));
79
+ } finally {
80
+ setBusy(false);
81
+ }
82
+ })());
83
+ };
84
+ return {
85
+ busy,
86
+ error,
87
+ run
88
+ };
89
+ };
90
+
91
+ export { useAuthConfig as a, useAsyncSubmit as u };
@@ -0,0 +1,13 @@
1
+ import{a as t}from"./chunk-RRCPZMC2.js";var r={BAD_REQUEST:{status:400,title:"Bad request"},UNAUTHORIZED:{status:401,title:"Unauthorized"},FORBIDDEN:{status:403,title:"Forbidden"},NOT_FOUND:{status:404,title:"Not found"},CONFLICT:{hint:["Another write changed this row while your mutation was running (optimistic concurrency conflict).","","Re-read the row and retry the mutation with the fresh value. Lunora serializes a DO's mutations, so a persistent conflict usually means the handler conflicts **with itself** (e.g. a trigger or cascade touching the same row) \u2014 split that work rather than adding a retry loop."],status:409,title:"Conflict"},NOT_UNIQUE:{hint:["`.unique()` matched more than one document \u2014 it expects the query to identify at most one row.","","- If several matches are legitimate, use `.first()` (take one) or `.collect()` (take all) instead.","- Otherwise tighten the query (e.g. filter on a unique/indexed field) so it can only match one row."],status:400,title:"Query matched more than one document"},VALIDATION_ERROR:{status:400,title:"Validation failed"},TOO_MANY_REQUESTS:{status:429,title:"Too many requests"},UNPROCESSABLE:{status:422,title:"Unprocessable"},NOT_IMPLEMENTED:{status:501,title:"Not implemented"},FUNCTION_NOT_FOUND:{status:404,title:"Function not found"},METHOD_NOT_ALLOWED:{status:405,title:"Method not allowed"},PAYLOAD_TOO_LARGE:{status:413,title:"Payload too large"},INTERNAL:{internal:!0,status:500,title:"Internal error"},INTERNAL_SERVER_ERROR:{internal:!0,status:500,title:"Internal error"},RPC_FAILED:{internal:!0,status:500,title:"Internal error"},COUNT_RLS_UNSUPPORTED:{status:422,title:"count() is unsupported under an RLS policy"},MASK_UNSUPPORTED:{status:422,title:"Aggregation over a masked column is unsupported"},RELATION_PREDICATE_UNSUPPORTED:{status:422,title:"Relation predicate is unsupported in a write policy"},RLS_REQUIRED:{hint:["This table is secure-by-default: it has no `.public()` marker and no RLS policy resolved for the caller, so the read fails closed.","","Add a read policy with `.rls(...)`, or mark the table `.public()` if it is intentionally world-readable."],status:403,title:"RLS policy required"},RUN_DEPTH_EXCEEDED:{internal:!0,status:500,title:"Run depth exceeded"},MIGRATION_NOT_FOUND:{status:404,title:"Data migration not found"},UNKNOWN_TABLE:{status:404,title:"Unknown table"},GLOBAL_TABLE_NOT_EDITABLE:{status:400,title:"Global table is not editable"},SHARD_ERROR:{status:503,title:"Shard error"},SHARD_UNAVAILABLE:{status:503,title:"Shard unavailable"},OFFLINE_IDENTITY_CHANGED:{status:409,title:"Offline identity changed"},CODEGEN_DIAGNOSTIC:{status:500,title:"Codegen diagnostic"},SCHEMA_SNAPSHOT_PARSE:{status:500,title:"Schema snapshot parse error"},ENV_INVALID:{internal:!0,status:500,title:"Invalid environment"},AUTH_HEADERS_MISSING:{internal:!0,status:500,title:"Auth headers missing"},ANALYTICS_SQL_ERROR:{status:502,title:"Analytics Engine SQL API error"},R2_SQL_ERROR:{status:502,title:"R2 SQL API error"},WORKFLOWS_REST_ERROR:{status:502,title:"Cloudflare Workflows REST API error"}},s=t(e=>Object.hasOwn(r,e)?r[e]:void 0,"getCatalogEntry");var d=[{body:["Lunora codegen couldn't find a schema to generate from.","","Create `lunora/schema.ts` exporting a `defineSchema(...)` call:","","```ts",'import { defineSchema, defineTable, v } from "@lunora/server";',"","export default defineSchema({"," messages: defineTable({ body: v.string() }),","});","```","","Or run `lunora init` to scaffold Lunora (a sample `lunora/schema.ts` included) into your app."].join(`
2
+ `),header:"No Lunora schema found",id:"lunora-schema-missing",test:t(e=>e.includes("defineSchema() not found")||e.includes("schema.ts not found at"),"test")},{body:["`defineSchema(...)` must be called with an **inline object literal** mapping table names to `defineTable(...)`:","","```ts","export default defineSchema({"," todos: defineTable({ title: v.string(), done: v.boolean() }),","});","```","","Codegen reads the schema statically, so it can't follow a variable or a spread \u2014 pass the object literal directly."].join(`
3
+ `),header:"`defineSchema()` needs an inline object literal",id:"lunora-schema-not-object-literal",test:t(e=>e.includes("defineSchema() expects an object literal"),"test")},{body:["This table name collides with a built-in `ctx.db` member, so the generated client can't expose it.","","Rename the table to anything that isn't a reserved name (the error lists them) \u2014 e.g. `userAccounts` instead of `insert`."].join(`
4
+ `),header:"Table name is reserved",id:"lunora-table-reserved",test:t(e=>e.includes("is reserved")&&e.includes("ctx.db"),"test")},{body:["Two tables resolve to the same name \u2014 usually a base table and a schema **extension** both defining it.","","Rename one of them, or drop the duplicate from the extension. Each table name must be unique across `defineSchema(...)` and every `.extend(...)`."].join(`
5
+ `),header:"Duplicate table name",id:"lunora-table-duplicate",test:t(e=>e.includes("already exists")&&e.includes(".extend("),"test")},{body:['`.jurisdiction(...)` accepts only a **string literal** of `"eu"`, `"us"`, or `"fedramp"`:',"","```ts",'defineSchema({ /* \u2026 */ }).jurisdiction("eu");',"```"].join(`
6
+ `),header:"Invalid `.jurisdiction(...)` value",id:"lunora-jurisdiction",test:t(e=>e.includes("unknown jurisdiction")||e.includes("jurisdiction")&&e.includes('"eu", "us", or "fedramp"'),"test")},{body:["The `unique` flag on an index must be a **literal** `true` or `false`, not a computed value \u2014 codegen needs to read it statically:","","```ts",'defineTable({ email: v.string() }).index("by_email", ["email"], { unique: true });',"```"].join(`
7
+ `),header:"`unique` must be a literal",id:"lunora-unique-literal",test:t(e=>e.includes("must be a literal")&&e.includes("unique"),"test")},{body:["A declared container/workflow class isn't re-exported by your worker entry, so `wrangler deploy` would reject it.","","Add the generated re-export shown in the error to your worker entry (e.g. `src/index.ts`):","","```ts",'export * from "./lunora/_generated/containers";',"```"].join(`
8
+ `),header:"Binding not exported by your worker entry",id:"lunora-worker-entry-export-gap",test:t(e=>e.includes("not exported by your worker entry"),"test")},{body:["A row with the same value already exists in a `unique` index.","","- If you meant to upsert, use `ctx.db.<table>().upsert(...)` (or `.patch(...)` an existing row) instead of `.insert(...)`.",`- Otherwise pick a value that isn't already taken, and consider surfacing a friendly "already exists" message to the user.`].join(`
9
+ `),header:"Unique constraint violation",id:"lunora-runtime-unique",test:t(e=>e.includes("unique constraint violation on"),"test")},{body:r.CONFLICT.hint.join(`
10
+ `),header:"Optimistic concurrency conflict",id:"lunora-runtime-occ",test:t(e=>e.includes("optimistic concurrency conflict"),"test")}],u=t(e=>(Array.isArray(e)?e.join(`
11
+ `):e).split(`
12
+ `).filter(a=>!a.startsWith("```")).join(`
13
+ `).replaceAll(/\*\*(.+?)\*\*/gu,"$1").replaceAll(/`([^`]+)`/gu,"$1"),"flattenHint");var o=class extends Error{static{t(this,"LunoraError")}type="VisulimaError";hint;title;loc;code;status;docsUrl;data;constructor(a,l,n={}){let i=s(a);super(l??a,n.cause===void 0?void 0:{cause:n.cause}),this.name=n.name??"LunoraError",this.hint=n.hint??i?.hint,this.title=n.title??i?.title,this.loc=n.location,this.code=a,this.status=n.status??i?.status??500,this.docsUrl=n.docsUrl??i?.docsUrl,this.data=n.data}};export{u as a,o as b};
@@ -0,0 +1 @@
1
+ import{a as r,e as i,f as p,g as l}from"./chunk-RRCPZMC2.js";var u=i(l(),1),n=i(p(),1);var D=r(function(e,d){let t=(0,u.c)(4),o=d===void 0?300:d,[f,m]=(0,n.useState)(e),s,c;return t[0]!==o||t[1]!==e?(s=r(()=>{let b=setTimeout(()=>{m(e)},o);return()=>{clearTimeout(b)}},"t1"),c=[e,o],t[0]=o,t[1]=e,t[2]=s,t[3]=c):(s=t[2],c=t[3]),(0,n.useEffect)(s,c),f},"useDebounced");export{D as a};
@@ -0,0 +1 @@
1
+ import{a as r,e as d,f as S,g as I}from"./chunk-RRCPZMC2.js";var g=d(I(),1),u=d(S(),1);var m=r((e="local")=>{try{return e==="local"?globalThis.localStorage:globalThis.sessionStorage}catch{return}},"storageOf"),p=r(function(e,t="local"){try{let s=m(t)?.getItem(e)??void 0,o=s===void 0?[]:JSON.parse(s);return Array.isArray(o)?o:[]}catch{return[]}},"loadJsonArray"),J=r((e,t,s="local")=>{let o=m(s);if(o!==void 0)try{o.setItem(e,JSON.stringify(t))}catch{}},"saveJson"),T=r(function(e){let t=(0,g.c)(8),s;t[0]!==e?(s=r(()=>p(e),"t0"),t[0]=e,t[1]=s):s=t[1];let[o,l]=(0,u.useState)(s),i=(0,u.useRef)(e),c,a;t[2]!==e||t[3]!==o?(c=r(()=>{if(i.current!==e){i.current=e,l(p(e));return}J(e,o)},"t1"),a=[e,o],t[2]=e,t[3]=o,t[4]=c,t[5]=a):(c=t[4],a=t[5]),(0,u.useEffect)(c,a);let n;return t[6]!==o?(n=[o,l],t[6]=o,t[7]=n):n=t[7],n},"usePersistedList"),$=r(function(e,t){let s=(0,g.c)(6),[o,l]=T(e),i;s[0]!==t||s[1]!==l?(i=r(f=>{l(h=>{let v=h[0]??t;return[typeof f=="function"?f(v):f]})},"t0"),s[0]=t,s[1]=l,s[2]=i):i=s[2];let c=i,a=o[0]??t,n;return s[3]!==c||s[4]!==a?(n=[a,c],s[3]=c,s[4]=a,s[5]=n):n=s[5],n},"usePersistedValue"),w=r(e=>globalThis.crypto?.randomUUID?.()??`${e}-${globalThis.performance.now().toString(36)}`,"newId");export{m as a,p as b,J as c,T as d,$ as e,w as f};
@@ -0,0 +1 @@
1
+ import{a as i,e as n,g as c,h as p}from"./chunk-RRCPZMC2.js";var b=n(c(),1),d=n(p(),1);var S={alignItems:"center",border:"1px solid",borderRadius:4,display:"inline-flex",fontFamily:"var(--font-mono, ui-monospace, monospace)",fontSize:11,fontWeight:400,gap:6,letterSpacing:"0.06em",lineHeight:1.4,padding:"1px 8px",textTransform:"uppercase"},g={borderRadius:"50%",display:"inline-block",height:7,width:7},h=i((r,e,a,t)=>({badgeStyle:{...S,borderColor:r,color:r},color:r,dotStyle:{...g,backgroundColor:r},hint:t,label:e,title:a}),"makeTier"),y={global:h("var(--royal-amethyst)","Global \xB7 D1","Global table \u2014 a single D1 table shared across all shards","Declared .global() and stored once in Cloudflare D1, shared across every shard and tenant. Auth tables (user, session, \u2026) live here too."),shard:h("var(--sky-sapphire)","Shard-local","Shard-local table \u2014 per-shard SQLite inside a Durable Object","Stored per shard key in a Durable Object's SQLite (.shardBy(...)). You are viewing one shard at a time \u2014 change the shard key to inspect another.")},m=i(r=>{let e=(0,b.c)(9),{tier:a}=r,t=y[a],o=`storage-tier-${a}`,l;e[0]!==t.dotStyle?(l=(0,d.jsxDEV)("span",{"aria-hidden":"true",style:t.dotStyle},void 0,!1),e[0]=t.dotStyle,e[1]=l):l=e[1];let s;return e[2]!==t.badgeStyle||e[3]!==t.label||e[4]!==t.title||e[5]!==o||e[6]!==l||e[7]!==a?(s=(0,d.jsxDEV)("span",{"data-testid":o,"data-tier":a,style:t.badgeStyle,title:t.title,children:[l,t.label]},void 0,!0),e[2]=t.badgeStyle,e[3]=t.label,e[4]=t.title,e[5]=o,e[6]=l,e[7]=a,e[8]=s):s=e[8],s},"StorageTierBadge");export{y as a,m as b};