@lunora/studio 1.0.0-alpha.45 → 1.0.0-alpha.47
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.
- package/dist/index.d.ts +5 -3
- package/dist/index.js +12 -12
- package/dist/mount.js +1 -1
- package/dist/packem_chunks/ApiTab.js +3 -3
- package/dist/packem_chunks/AuditPanel.js +4 -4
- package/dist/packem_chunks/ExportImportPanel.js +4 -4
- package/dist/packem_chunks/FileBrowser.js +43 -20
- package/dist/packem_chunks/FunctionRunner.js +8 -25
- package/dist/packem_chunks/FunctionStatsPanel.js +4 -4
- package/dist/packem_chunks/HealthPanel.js +3 -3
- package/dist/packem_chunks/InsightsPanel.js +5 -5
- package/dist/packem_chunks/LogsPanel.js +4 -4
- package/dist/packem_chunks/MailPanel.js +3 -3
- package/dist/packem_chunks/MetricsPanel.js +4 -4
- package/dist/packem_chunks/MigrationsPanel.js +5 -5
- package/dist/packem_chunks/PitrPanel.js +1 -1
- package/dist/packem_chunks/SchemaViewer.js +3 -3
- package/dist/packem_chunks/SecurityAdvisorPanel.js +2 -2
- package/dist/packem_chunks/SettingsPanel.js +2 -2
- package/dist/packem_chunks/SqlEditorPanel.js +7 -6
- package/dist/packem_chunks/TableEditor.js +6 -29
- package/dist/packem_chunks/analytics-panel.js +1 -1
- package/dist/packem_chunks/auth-config-panel.js +1 -1
- package/dist/packem_chunks/auth-sessions-panel.js +2 -2
- package/dist/packem_chunks/containers-panel.js +1 -1
- package/dist/packem_chunks/dashboards-panel.js +3 -2
- package/dist/packem_chunks/fanout-panel.js +3 -3
- package/dist/packem_chunks/flags-panel.js +2 -2
- package/dist/packem_chunks/kv-browser.js +2 -2
- package/dist/packem_chunks/log-drains-panel.js +1 -1
- package/dist/packem_chunks/organizations-panel.js +3 -3
- package/dist/packem_chunks/payments-panel.js +3 -3
- package/dist/packem_chunks/permissions-panel.js +4 -4
- package/dist/packem_chunks/queues-panel.js +3 -3
- package/dist/packem_chunks/rls-panel.js +2 -2
- package/dist/packem_chunks/schedule-panel.js +3 -3
- package/dist/packem_chunks/storage-rules-panel.js +2 -2
- package/dist/packem_chunks/subscriptions-panel.js +3 -3
- package/dist/packem_chunks/users-panel.js +3 -3
- package/dist/packem_chunks/vector-browser.js +1 -1
- package/dist/packem_chunks/workflows-panel.js +2 -2
- package/dist/packem_shared/{ApiDocsPanel-CBma-lnp.js → ApiDocsPanel-B2Rc7nOF.js} +1 -1
- package/dist/packem_shared/{ApiReferencePanel-CQM3pPN7.js → ApiReferencePanel-Dd8pcswz.js} +1 -1
- package/dist/packem_shared/{CommandPalette-X2tkbyHk.js → CommandPalette-BXV4eKf5.js} +1 -1
- package/dist/packem_shared/{DataBrowser-D2ywrdId.js → DataBrowser-Cc197zke.js} +8 -8
- package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
- package/dist/packem_shared/{GlobalDataBrowser-BkTPLzAY.js → GlobalDataBrowser-CxJxRRf2.js} +3 -3
- package/dist/packem_shared/{HomePanel-D1Q9LZgK.js → HomePanel-CjDlJzzs.js} +3 -3
- package/dist/packem_shared/{OpenRpcReferencePanel-Dno-hfDb.js → OpenRpcReferencePanel-CWaf0ZtX.js} +1 -1
- package/dist/packem_shared/{ScheduledJobs-Ctw4jYtU.js → ScheduledJobs-dHMgnJbx.js} +2 -2
- package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
- package/dist/packem_shared/{Studio-lJhzDAze.js → Studio-sfBFghzO.js} +4 -4
- package/dist/packem_shared/{StudioApp-DiMkupvZ.js → StudioApp-Ism1gXfJ.js} +5 -11
- package/dist/packem_shared/{advisor-view-BX8OhG0w.js → advisor-view-Cx21PS_T.js} +1 -1
- package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
- package/dist/packem_shared/{data-grid-CdXztApG.js → data-grid-C9I16KWr.js} +1 -1
- package/dist/packem_shared/{error-alert-CXjqyGw9.js → error-alert-vIPQoN3Y.js} +1 -1
- package/dist/packem_shared/{grid-features-BF-KBDFz.js → grid-features-B_fZH4iQ.js} +3 -2
- package/dist/packem_shared/{home-panel-TFcRf9Ui.js → home-panel-BohxdqDb.js} +2 -2
- package/dist/packem_shared/{internal-CYcbqMjX.js → internal-zwBoOv24.js} +14 -1
- package/dist/packem_shared/{reference-view-DUiJcILV.js → reference-view-DUULLuOi.js} +3 -17
- package/dist/packem_shared/{browser-storage-BTrX4y3B.js → result-chart-DZradBAS.js} +2 -98
- package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
- package/dist/packem_shared/{studio-Dh9UlaF_.js → studio-CFC_pv0f.js} +3 -3
- package/dist/packem_shared/{table-list-sidebar-UVIXQJdU.js → table-list-sidebar-huX4VmgI.js} +19 -9
- package/dist/packem_shared/{use-admin-query-CfHYWx5n.js → use-admin-query-BGJ010yZ.js} +1 -1
- package/dist/packem_shared/{use-async-submit-DJQiPc-_.js → use-async-submit-DGCtuDyz.js} +2 -2
- package/dist/standalone/{chunk-J75M4LTW.js → chunk-22C6COGE.js} +4 -4
- package/dist/standalone/{chunk-7XTR7BWT.js → chunk-2CQ2YNER.js} +1 -1
- package/dist/standalone/chunk-2MLA6WFH.js +1 -0
- package/dist/standalone/{chunk-2BBENYBY.js → chunk-37HPVOYP.js} +1 -1
- package/dist/standalone/{chunk-B4TTGYIX.js → chunk-3HS3ZXFB.js} +1 -1
- package/dist/standalone/{chunk-T4XWXBKR.js → chunk-3OZDR3RM.js} +1 -1
- package/dist/standalone/chunk-4KSX53SI.js +4 -0
- package/dist/standalone/chunk-4PC7IXNY.js +1 -0
- package/dist/standalone/{chunk-7KR346F4.js → chunk-5UKRVDFD.js} +1 -1
- package/dist/standalone/{chunk-4WGGEF73.js → chunk-ADP5UEHQ.js} +1 -1
- package/dist/standalone/{chunk-WKWKAU22.js → chunk-AITOCPML.js} +1 -1
- package/dist/standalone/{chunk-ZSNXQT4N.js → chunk-AYANIT5P.js} +1 -1
- package/dist/standalone/chunk-BIBCC7EE.js +6 -0
- package/dist/standalone/{chunk-XFPHUG7M.js → chunk-CGGZAYGG.js} +1 -1
- package/dist/standalone/chunk-CJTT4TBP.js +1 -0
- package/dist/standalone/{chunk-73BV73BI.js → chunk-CLMGPTAI.js} +1 -1
- package/dist/standalone/{chunk-MP5MTWY5.js → chunk-CTPCJNOP.js} +1 -1
- package/dist/standalone/chunk-DDE62TRL.js +1 -0
- package/dist/standalone/{chunk-ATG3655M.js → chunk-DH4K2OLM.js} +1 -1
- package/dist/standalone/{chunk-KMNEQEHM.js → chunk-EEWKIQUE.js} +1 -1
- package/dist/standalone/{chunk-3JO76DWI.js → chunk-EYSL7KEQ.js} +1 -1
- package/dist/standalone/{chunk-I4RSHYDW.js → chunk-F4HDP4XW.js} +1 -1
- package/dist/standalone/chunk-F5I22A4W.js +1 -0
- package/dist/standalone/chunk-FKVCHCYV.js +4 -0
- package/dist/standalone/{chunk-6HW2RKAX.js → chunk-FNQQ3B5G.js} +1 -1
- package/dist/standalone/{chunk-PXR5E7AX.js → chunk-GSCV2N3F.js} +5 -5
- package/dist/standalone/{chunk-ICIQ2GWQ.js → chunk-H27CRIP3.js} +1 -1
- package/dist/standalone/{chunk-YSF43KIJ.js → chunk-HROXYAZT.js} +1 -1
- package/dist/standalone/{chunk-EOSXQTSQ.js → chunk-HVRDZZHL.js} +1 -1
- package/dist/standalone/{chunk-245TEXSO.js → chunk-IRSIK3HT.js} +2 -2
- package/dist/standalone/{chunk-2GMEK2W3.js → chunk-ITQKVEP7.js} +9 -9
- package/dist/standalone/{chunk-34B5ECBI.js → chunk-IZN4TYMN.js} +1 -1
- package/dist/standalone/{chunk-7JOVXGO4.js → chunk-JM7XBQVK.js} +1 -1
- package/dist/standalone/{chunk-S6JKSFSO.js → chunk-JPILGFXT.js} +1 -1
- package/dist/standalone/{chunk-QQH2YTBW.js → chunk-JQ4WOPMF.js} +1 -1
- package/dist/standalone/chunk-K2CB2CHL.js +1 -0
- package/dist/standalone/{chunk-3IJLM4GF.js → chunk-KCMKEMUL.js} +1 -1
- package/dist/standalone/{chunk-WKUGR7ER.js → chunk-KKD46QVN.js} +1 -1
- package/dist/standalone/chunk-L7WR3C4Z.js +1 -0
- package/dist/standalone/chunk-LRYLU6EY.js +1 -0
- package/dist/standalone/{chunk-I34RPZ7P.js → chunk-MDTNVR3G.js} +1 -1
- package/dist/standalone/chunk-PL2KY6IG.js +1 -0
- package/dist/standalone/{chunk-KFNNMXUZ.js → chunk-S3Q6R7BA.js} +1 -1
- package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
- package/dist/standalone/chunk-SEQ43UW2.js +1 -0
- package/dist/standalone/{chunk-5KUKYIU6.js → chunk-SHK6RAFG.js} +1 -1
- package/dist/standalone/chunk-TXTJPS5F.js +1 -0
- package/dist/standalone/chunk-V4ECZI2R.js +1 -0
- package/dist/standalone/{chunk-6CRKDJNL.js → chunk-WD2LBHJZ.js} +1 -1
- package/dist/standalone/{chunk-PBXQ5QS4.js → chunk-WMWDJLRO.js} +4 -4
- package/dist/standalone/{chunk-ZTOATVB7.js → chunk-WOXVMXSQ.js} +1 -1
- package/dist/standalone/{chunk-JEVKZIHN.js → chunk-WUFVFVHJ.js} +1 -1
- package/dist/standalone/{chunk-ERUIC6WI.js → chunk-X4QFAAZ5.js} +1 -1
- package/dist/standalone/{chunk-P7AMKXU2.js → chunk-XVR74IFC.js} +1 -1
- package/dist/standalone/chunk-Y2GJJVS5.js +1 -0
- package/dist/standalone/chunk-YFA7NUCL.js +1 -0
- package/dist/standalone/chunk-YSPZSTDI.js +1 -0
- package/dist/standalone/studio.js +43 -43
- package/package.json +6 -6
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/standalone/chunk-3SKIYIBN.js +0 -1
- package/dist/standalone/chunk-AFCBRDRQ.js +0 -1
- package/dist/standalone/chunk-AX7GYUQC.js +0 -1
- package/dist/standalone/chunk-BGHGKAOM.js +0 -1
- package/dist/standalone/chunk-BL45HXOJ.js +0 -1
- package/dist/standalone/chunk-ERXJPMCU.js +0 -1
- package/dist/standalone/chunk-GNMTLLGB.js +0 -1
- package/dist/standalone/chunk-M5OMEMQ3.js +0 -1
- package/dist/standalone/chunk-O4YNKFCZ.js +0 -1
- package/dist/standalone/chunk-OLUEBOHS.js +0 -1
- package/dist/standalone/chunk-OOETIPAO.js +0 -1
- package/dist/standalone/chunk-OQPT2BEZ.js +0 -6
- package/dist/standalone/chunk-PKIPNNRD.js +0 -4
- package/dist/standalone/chunk-QB3QUTSJ.js +0 -1
- package/dist/standalone/chunk-TBMYIZIO.js +0 -1
- package/dist/standalone/chunk-TU5ZNEZ4.js +0 -1
- package/dist/standalone/chunk-WATFBATD.js +0 -1
- package/dist/standalone/chunk-WSMZLZWM.js +0 -4
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const storageOf = (kind = "local") => {
|
|
5
|
+
try {
|
|
6
|
+
return kind === "local" ? globalThis.localStorage : globalThis.sessionStorage;
|
|
7
|
+
} catch {
|
|
8
|
+
return void 0;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
const loadJsonArray = function(key, kind = "local") {
|
|
12
|
+
try {
|
|
13
|
+
const raw = storageOf(kind)?.getItem(key) ?? void 0;
|
|
14
|
+
const parsed = raw === void 0 ? [] : JSON.parse(raw);
|
|
15
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
16
|
+
} catch {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const saveJson = (key, value, kind = "local") => {
|
|
21
|
+
const storage = storageOf(kind);
|
|
22
|
+
if (storage === void 0) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
storage.setItem(key, JSON.stringify(value));
|
|
27
|
+
} catch {
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const usePersistedList = function(key) {
|
|
31
|
+
const $ = c(8);
|
|
32
|
+
let t0;
|
|
33
|
+
if ($[0] !== key) {
|
|
34
|
+
t0 = () => loadJsonArray(key);
|
|
35
|
+
$[0] = key;
|
|
36
|
+
$[1] = t0;
|
|
37
|
+
} else {
|
|
38
|
+
t0 = $[1];
|
|
39
|
+
}
|
|
40
|
+
const [value, setValue] = useState(t0);
|
|
41
|
+
const keyRef = useRef(key);
|
|
42
|
+
let t1;
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[2] !== key || $[3] !== value) {
|
|
45
|
+
t1 = () => {
|
|
46
|
+
if (keyRef.current !== key) {
|
|
47
|
+
keyRef.current = key;
|
|
48
|
+
setValue(loadJsonArray(key));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
saveJson(key, value);
|
|
52
|
+
};
|
|
53
|
+
t2 = [key, value];
|
|
54
|
+
$[2] = key;
|
|
55
|
+
$[3] = value;
|
|
56
|
+
$[4] = t1;
|
|
57
|
+
$[5] = t2;
|
|
58
|
+
} else {
|
|
59
|
+
t1 = $[4];
|
|
60
|
+
t2 = $[5];
|
|
61
|
+
}
|
|
62
|
+
useEffect(t1, t2);
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[6] !== value) {
|
|
65
|
+
t3 = [value, setValue];
|
|
66
|
+
$[6] = value;
|
|
67
|
+
$[7] = t3;
|
|
68
|
+
} else {
|
|
69
|
+
t3 = $[7];
|
|
70
|
+
}
|
|
71
|
+
return t3;
|
|
72
|
+
};
|
|
73
|
+
const usePersistedValue = function(key, fallback) {
|
|
74
|
+
const $ = c(6);
|
|
75
|
+
const [list, setList] = usePersistedList(key);
|
|
76
|
+
let t0;
|
|
77
|
+
if ($[0] !== fallback || $[1] !== setList) {
|
|
78
|
+
t0 = (action) => {
|
|
79
|
+
setList((current) => {
|
|
80
|
+
const previous = current[0] ?? fallback;
|
|
81
|
+
return [typeof action === "function" ? action(previous) : action];
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
$[0] = fallback;
|
|
85
|
+
$[1] = setList;
|
|
86
|
+
$[2] = t0;
|
|
87
|
+
} else {
|
|
88
|
+
t0 = $[2];
|
|
89
|
+
}
|
|
90
|
+
const setValue = t0;
|
|
91
|
+
const t1 = list[0] ?? fallback;
|
|
92
|
+
let t2;
|
|
93
|
+
if ($[3] !== setValue || $[4] !== t1) {
|
|
94
|
+
t2 = [t1, setValue];
|
|
95
|
+
$[3] = setValue;
|
|
96
|
+
$[4] = t1;
|
|
97
|
+
$[5] = t2;
|
|
98
|
+
} else {
|
|
99
|
+
t2 = $[5];
|
|
100
|
+
}
|
|
101
|
+
return t2;
|
|
102
|
+
};
|
|
103
|
+
const newId = (prefix) => globalThis.crypto?.randomUUID?.() ?? `${prefix}-${globalThis.performance.now().toString(36)}`;
|
|
104
|
+
|
|
105
|
+
export { storageOf as a, usePersistedValue as b, loadJsonArray as l, newId as n, saveJson as s, usePersistedList as u };
|
|
@@ -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-
|
|
3
|
+
import { h as formatCell } from './internal-zwBoOv24.js';
|
|
4
4
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
5
5
|
|
|
6
6
|
const CellValue = (t0) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { flattenHint } from '@lunora/errors';
|
|
3
|
-
import { b as errorHint, d as errorDocumentationUrl, e as errorMessage } from './internal-
|
|
3
|
+
import { b as errorHint, d as errorDocumentationUrl, e as errorMessage } from './internal-zwBoOv24.js';
|
|
4
4
|
import { A as Alert } from './alert-CdAET2K_.js';
|
|
5
5
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
6
6
|
|
|
@@ -4,18 +4,19 @@ import { ConfirmButton } from './ConfirmButton-C2eVi2Qv.js';
|
|
|
4
4
|
import { D as DropdownMenuTrigger, a as DropdownMenuLabel, b as DropdownMenuItem, c as DropdownMenuContent, d as DropdownMenu, e as DropdownMenuCheckboxItem, f as DropdownMenuSeparator, g as DropdownMenuGroup } from './dropdown-menu-WY4B_eJO.js';
|
|
5
5
|
import { M as ModalShell } from './modal-shell-hyaJvIJ6.js';
|
|
6
6
|
import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
7
|
-
import { h as formatCell, g as copyToClipboard } from './internal-
|
|
7
|
+
import { h as formatCell, g as copyToClipboard } from './internal-zwBoOv24.js';
|
|
8
8
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
9
9
|
|
|
10
10
|
const CONTROL_BTN = "inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground outline-none transition-colors hover:bg-accent focus-visible:bg-accent disabled:pointer-events-none disabled:opacity-50";
|
|
11
11
|
const CSV_QUOTE_RE = /["\n,]/u;
|
|
12
|
+
const CSV_FORMULA_RE = /^[=+\-@\t\r]/u;
|
|
12
13
|
const csvCell = (value) => {
|
|
13
14
|
if (value === null || value === void 0) {
|
|
14
15
|
return "";
|
|
15
16
|
}
|
|
16
17
|
let text;
|
|
17
18
|
if (typeof value === "string") {
|
|
18
|
-
text = value;
|
|
19
|
+
text = CSV_FORMULA_RE.test(value) ? ` ${value}` : value;
|
|
19
20
|
} else if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") {
|
|
20
21
|
text = String(value);
|
|
21
22
|
} else {
|
|
@@ -4,10 +4,10 @@ import { useState, useEffect, Suspense, lazy } from 'react';
|
|
|
4
4
|
import { B as Badge } from './badge-B2PKA1-5.js';
|
|
5
5
|
import { a as CardContent, C as Card } from './card-DURq3ElK.js';
|
|
6
6
|
import { E as EmptyState } from './empty-state-DY_oe0k6.js';
|
|
7
|
-
import { u as useAdminQuery } from './use-admin-query-
|
|
7
|
+
import { u as useAdminQuery } from './use-admin-query-BGJ010yZ.js';
|
|
8
8
|
import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
9
9
|
import { ADMIN_FUNCTIONS } from './ADMIN_FUNCTIONS-BHHJi3Gb.js';
|
|
10
|
-
import { f as fireAndForget, c as callOptions, a as adminRef, r as resolveOrigin, g as copyToClipboard,
|
|
10
|
+
import { f as fireAndForget, c as callOptions, a as adminRef, r as resolveOrigin, g as copyToClipboard, k as formatBytes } from './internal-zwBoOv24.js';
|
|
11
11
|
import { c as cn } from './utils-B05Dmz_H.js';
|
|
12
12
|
import { deriveInsights } from './DEFAULT_INSIGHT_THRESHOLDS-DjF0h-gA.js';
|
|
13
13
|
import { useLunora } from '@lunora/react';
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
const dispatchByKind = (client, kind, reference, args, options) => {
|
|
2
|
+
switch (kind) {
|
|
3
|
+
case "action": {
|
|
4
|
+
return client.action(reference, args, options);
|
|
5
|
+
}
|
|
6
|
+
case "mutation": {
|
|
7
|
+
return client.mutation(reference, args, options);
|
|
8
|
+
}
|
|
9
|
+
default: {
|
|
10
|
+
return client.query(reference, args, options);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
1
14
|
const adminRef = (path) => {
|
|
2
15
|
return {
|
|
3
16
|
__lunoraRef: path
|
|
@@ -106,4 +119,4 @@ const formatTimestamp = (value, fallback = "") => {
|
|
|
106
119
|
return Number.isNaN(date.getTime()) ? String(value) : date.toLocaleString();
|
|
107
120
|
};
|
|
108
121
|
|
|
109
|
-
export { adminRef as a, errorHint as b, callOptions as c, errorDocumentationUrl as d, errorMessage as e, fireAndForget as f, copyToClipboard as g, formatCell as h, formatTimestamp as i,
|
|
122
|
+
export { adminRef as a, errorHint as b, callOptions as c, errorDocumentationUrl as d, errorMessage as e, fireAndForget as f, copyToClipboard as g, formatCell as h, formatTimestamp as i, dispatchByKind as j, formatBytes as k, resolveOrigin as r };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { useState, useEffect, createContext, use } from 'react';
|
|
3
|
-
import { e as errorMessage, g as copyToClipboard, f as fireAndForget, c as callOptions, a as adminRef } from './internal-
|
|
3
|
+
import { e as errorMessage, g as copyToClipboard, f as fireAndForget, j as dispatchByKind, c as callOptions, a as adminRef } from './internal-zwBoOv24.js';
|
|
4
4
|
import { SentIcon, Copy01Icon, Search01Icon } from '@hugeicons/core-free-icons';
|
|
5
5
|
import { HugeiconsIcon } from '@hugeicons/react';
|
|
6
6
|
import { I as Input } from './input-XH4r1Pt1.js';
|
|
@@ -8,7 +8,7 @@ import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
|
8
8
|
import { B as Button } from './button-BhsN2uZH.js';
|
|
9
9
|
import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
|
|
10
10
|
import { B as Badge$1 } from './badge-B2PKA1-5.js';
|
|
11
|
-
import { ShardInput } from './ShardInput-
|
|
11
|
+
import { ShardInput } from './ShardInput-CZnpHILL.js';
|
|
12
12
|
import { L as Label } from './label-D8ykjn5J.js';
|
|
13
13
|
import { T as Textarea } from './textarea-D3gaCU_-.js';
|
|
14
14
|
import { LunoraError } from '@lunora/errors';
|
|
@@ -866,21 +866,7 @@ const OperationRunProvider = ({
|
|
|
866
866
|
value = text;
|
|
867
867
|
}
|
|
868
868
|
} else {
|
|
869
|
-
|
|
870
|
-
const options = callOptions(shardKey);
|
|
871
|
-
switch (operation.kind) {
|
|
872
|
-
case "action": {
|
|
873
|
-
value = await client.action(reference, parsedArgs, options);
|
|
874
|
-
break;
|
|
875
|
-
}
|
|
876
|
-
case "mutation": {
|
|
877
|
-
value = await client.mutation(reference, parsedArgs, options);
|
|
878
|
-
break;
|
|
879
|
-
}
|
|
880
|
-
default: {
|
|
881
|
-
value = await client.query(reference, parsedArgs, options);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
869
|
+
value = await dispatchByKind(client, operation.kind, adminRef(operation.functionPath), parsedArgs, callOptions(shardKey));
|
|
884
870
|
}
|
|
885
871
|
setResponse(value);
|
|
886
872
|
setDurationMs(Math.round(performance.now() - startedAt));
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
3
|
-
import { h as formatCell } from './internal-
|
|
3
|
+
import { h as formatCell } from './internal-zwBoOv24.js';
|
|
4
4
|
import { X as XAxis, B as Bar, T as Tooltip, E as EvilBarChart } from './bar-chart-DSwcWIRy.js';
|
|
5
5
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
6
|
-
import { useState, useEffect } from 'react';
|
|
7
6
|
|
|
8
7
|
const MAX_BARS = 50;
|
|
9
8
|
const RESULT_CHART_CONFIG = {
|
|
@@ -117,99 +116,4 @@ const SqlResultChart = (t0) => {
|
|
|
117
116
|
return t6;
|
|
118
117
|
};
|
|
119
118
|
|
|
120
|
-
|
|
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 };
|
|
119
|
+
export { SqlResultChart as S };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { s as saveJson, l as loadJsonArray } from './browser-storage-L4gOP5gJ.js';
|
|
2
|
+
|
|
3
|
+
const STORAGE_KEY = "lunora-studio-recent-shards";
|
|
4
|
+
const MAX_RECENTS = 10;
|
|
5
|
+
const loadRecentShards = () => loadJsonArray(STORAGE_KEY, "session").filter((entry) => typeof entry === "string");
|
|
6
|
+
const recordShard = (shardKey) => {
|
|
7
|
+
const trimmed = shardKey.trim();
|
|
8
|
+
if (trimmed === "") {
|
|
9
|
+
return loadRecentShards();
|
|
10
|
+
}
|
|
11
|
+
const next = [trimmed, ...loadRecentShards().filter((entry) => entry !== trimmed)].slice(0, MAX_RECENTS);
|
|
12
|
+
saveJson(STORAGE_KEY, next, "session");
|
|
13
|
+
return next;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { loadRecentShards as l, recordShard as r };
|
|
@@ -21,11 +21,11 @@ import { B as Button } from './button-BhsN2uZH.js';
|
|
|
21
21
|
import { Dialog } from '@base-ui/react/dialog';
|
|
22
22
|
import { Tooltip as Tooltip$1 } from '@base-ui/react/tooltip';
|
|
23
23
|
import { S as Skeleton } from './skeleton-CGhL0p20.js';
|
|
24
|
-
import { u as useStudioFeatures, H as HomePanel } from './home-panel-
|
|
24
|
+
import { u as useStudioFeatures, H as HomePanel } from './home-panel-BohxdqDb.js';
|
|
25
25
|
import { StudioI18nProvider } from './StudioI18nProvider-B-tDCZIi.js';
|
|
26
26
|
import { v as validateDataViewSearch } from './data-view-params-Cd6yRVbv.js';
|
|
27
|
-
import { f as fireAndForget } from './internal-
|
|
28
|
-
import { CommandPalette, openCommandPalette } from './CommandPalette-
|
|
27
|
+
import { f as fireAndForget } from './internal-zwBoOv24.js';
|
|
28
|
+
import { CommandPalette, openCommandPalette } from './CommandPalette-BXV4eKf5.js';
|
|
29
29
|
|
|
30
30
|
const DARK_MEDIA_QUERY = "(prefers-color-scheme: dark)";
|
|
31
31
|
const store = () => {
|
package/dist/packem_shared/{table-list-sidebar-UVIXQJdU.js → table-list-sidebar-huX4VmgI.js}
RENAMED
|
@@ -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-
|
|
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
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
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
|
-
...
|
|
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)) {
|
|
@@ -2,7 +2,7 @@ import { c } from 'react/compiler-runtime';
|
|
|
2
2
|
import { useLunora } from '@lunora/react';
|
|
3
3
|
import { useQueryClient, useQuery, keepPreviousData } from '@tanstack/react-query';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
|
-
import { a as adminRef, c as callOptions, f as fireAndForget, e as errorMessage } from './internal-
|
|
5
|
+
import { a as adminRef, c as callOptions, f as fireAndForget, e as errorMessage } from './internal-zwBoOv24.js';
|
|
6
6
|
|
|
7
7
|
const adminQueryKey = (path, args, shardKey) => ["lunora-admin", path, args, shardKey.trim()];
|
|
8
8
|
const RPC_LOOP_WINDOW_MS = 1e3;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { useLunora } from '@lunora/react';
|
|
3
|
-
import { a as useClientQuery } from './use-admin-query-
|
|
3
|
+
import { a as useClientQuery } from './use-admin-query-BGJ010yZ.js';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import { f as fireAndForget, e as errorMessage } from './internal-
|
|
5
|
+
import { f as fireAndForget, e as errorMessage } from './internal-zwBoOv24.js';
|
|
6
6
|
|
|
7
7
|
const DEFAULT_AUTH_CONFIG = {
|
|
8
8
|
capabilities: {
|
|
@@ -1,4 +1,4 @@
|
|
|
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"}};var
|
|
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
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
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
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(`
|
|
@@ -7,7 +7,7 @@ import{a as t}from"./chunk-RRCPZMC2.js";var r={BAD_REQUEST:{status:400,title:"Ba
|
|
|
7
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
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
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")}],
|
|
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
11
|
`):e).split(`
|
|
12
|
-
`).filter(
|
|
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(
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R}from"./chunk-TQ36RWOP.js";import{R as C}from"./chunk-3CJW6NWG.js";import{c as k}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as w,e as N}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b,
|
|
1
|
+
import{a as R}from"./chunk-TQ36RWOP.js";import{R as C}from"./chunk-3CJW6NWG.js";import{c as k}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as w,e as N}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as b,h as S,l as T,n as L}from"./chunk-ITQKVEP7.js";import{a as f,e as y,f as W,g as j,h as D}from"./chunk-RRCPZMC2.js";var O=y(j(),1),v=y(W(),1);var t=y(D(),1);var I=f(s=>{let e=(0,O.c)(23),{destination:o}=s,h=b(),m;e[0]!==o.snippet?(m=f(()=>{L(o.snippet)},"t1"),e[0]=o.snippet,e[1]=m):m=e[1];let u=m,r;e[2]!==o.title?(r=(0,t.jsxDEV)("h4",{className:"text-sm font-semibold",children:o.title},void 0,!1),e[2]=o.title,e[3]=r):r=e[3];let a;e[4]!==o.description?(a=(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground",children:o.description},void 0,!1),e[4]=o.description,e[5]=a):a=e[5];let l;e[6]!==r||e[7]!==a?(l=(0,t.jsxDEV)("div",{children:[r,a]},void 0,!0),e[6]=r,e[7]=a,e[8]=l):l=e[8];let g=`drain-copy-${o.id}`,d;e[9]!==h?(d=h("Copy"),e[9]=h,e[10]=d):d=e[10];let i;e[11]!==u||e[12]!==g||e[13]!==d?(i=(0,t.jsxDEV)(k,{"data-testid":g,onClick:u,size:"sm",variant:"outline",children:d},void 0,!1),e[11]=u,e[12]=g,e[13]=d,e[14]=i):i=e[14];let n;e[15]!==l||e[16]!==i?(n=(0,t.jsxDEV)("div",{className:"flex items-start justify-between gap-3",children:[l,i]},void 0,!0),e[15]=l,e[16]=i,e[17]=n):n=e[17];let c;e[18]!==o.snippet?(c=(0,t.jsxDEV)("pre",{className:"mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-xs",children:o.snippet},void 0,!1),e[18]=o.snippet,e[19]=c):c=e[19];let p;return e[20]!==n||e[21]!==c?(p=(0,t.jsxDEV)(w,{className:"py-0","data-testid":"drain-card",children:(0,t.jsxDEV)(N,{className:"p-3",children:[n,c]},void 0,!0)},void 0,!1),e[20]=n,e[21]=c,e[22]=p):p=e[22],p},"DestinationRow"),F=f(()=>{let s=b(),e=[{description:s("Stream every request log to R2, a SIEM, or a third-party log service."),id:"logpush",snippet:["{",' "logpush": true',"}"].join(`
|
|
2
2
|
`),title:s("Logpush")},{description:s("Send logs programmatically to a Worker for custom capture and forwarding."),id:"tail-worker",snippet:["{",' "tail_consumers": [{ "service": "my-log-forwarder" }]',"}"].join(`
|
|
3
3
|
`),title:s("Tail Workers")},{description:s("Retain and query recent request logs directly in Cloudflare's dashboard."),id:"workers-logs",snippet:["{",' "observability": { "enabled": true }',"}"].join(`
|
|
4
4
|
`),title:s("Workers Logs")}],[o,h]=(0,v.useState)(""),[m,u]=(0,v.useState)(!1),[r,a]=(0,v.useState)(null),l=f(async()=>{let i=o.trim();if(i==="")return;let n="fetch"in globalThis?globalThis.fetch:void 0;if(n===void 0){a({kind:"error",message:s("fetch is unavailable in this environment.")});return}let c={durationMs:12,function:"messages:list",outcome:"ok",shard:"root",source:"lunora",tablesRead:["messages"],tablesWritten:[],ts:new Date().toISOString(),type:"request"};u(!0),a(null);let p=performance.now();try{let x=await n(i,{body:JSON.stringify(c),headers:{"Content-Type":"application/json"},method:"POST"});a({kind:"success",latencyMs:Math.round(performance.now()-p),status:x.status})}catch(x){a({kind:"error",message:S(x)})}finally{u(!1)}},"sendTest"),g=f(()=>{T(l())},"onSendTest"),d=f(i=>{h(i.target.value)},"onWebhookUrlChange");return(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"log-drains",children:[(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-3",children:(0,t.jsxDEV)("a",{className:"text-sm text-primary underline-offset-4 hover:underline","data-testid":"drain-cf-link",href:R,rel:"noreferrer",target:"_blank",children:s("Open in Cloudflare")},void 0,!1)},void 0,!1),(0,t.jsxDEV)("p",{className:"text-sm text-muted-foreground","data-testid":"drain-readonly-note",children:s("Lunora does not ship logs itself \u2014 forwarding is handled by Cloudflare. Configure a destination below, then test your collector.")},void 0,!1),(0,t.jsxDEV)("section",{className:"flex flex-col gap-3","data-testid":"drain-destinations",children:[(0,t.jsxDEV)("h3",{className:"font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Cloudflare destinations")},void 0,!1),e.map(i=>(0,t.jsxDEV)(I,{destination:i},i.id,!1))]},void 0,!0),(0,t.jsxDEV)(w,{className:"py-0",children:(0,t.jsxDEV)(N,{className:"p-3",children:(0,t.jsxDEV)("section",{"data-testid":"drain-webhook",children:[(0,t.jsxDEV)("h3",{className:"mb-1 font-mono text-[11px] tracking-wide text-muted-foreground uppercase",children:s("Webhook test")},void 0,!1),(0,t.jsxDEV)("p",{className:"mb-2 text-sm text-muted-foreground",children:s("POST a sample Lunora request-log envelope to your collector to confirm it is reachable.")},void 0,!1),(0,t.jsxDEV)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsxDEV)(C,{className:"min-w-[20rem] flex-1","data-testid":"drain-webhook-url",onChange:d,placeholder:s("https://example.com/logs"),type:"url",value:o},void 0,!1),(0,t.jsxDEV)(k,{"data-testid":"drain-webhook-test",disabled:m||o.trim()==="",onClick:g,children:s(m?"Sending\u2026":"Send test event")},void 0,!1)]},void 0,!0),r!==null&&(0,t.jsxDEV)("p",{className:r.kind==="success"?"mt-2 text-sm text-muted-foreground":"mt-2 text-sm text-destructive","data-testid":"drain-webhook-result",role:r.kind==="error"?"alert":void 0,children:r.kind==="success"?s("Delivered \u2014 status {status} in {latency}ms",{latency:r.latencyMs,status:r.status}):s("Failed: {message}",{message:r.message})},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)},"LogDrainsPanel");export{F as LogDrainsPanel};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as H}from"./chunk-J6J54MBP.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as w}from"./chunk-TAD43CG5.js";import{a as E}from"./chunk-
|
|
1
|
+
import{a as H}from"./chunk-J6J54MBP.js";import{a as R,b as _,c as $,d as N,e as o,f as r}from"./chunk-GTM65MVX.js";import{c as S}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import{a as w}from"./chunk-TAD43CG5.js";import{a as E}from"./chunk-HVRDZZHL.js";import{a as C,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as A}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as g,l as I,p as B}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as m,e as T,g as j,h as z}from"./chunk-RRCPZMC2.js";var Q=T(j(),1);var t=T(z(),1);var L=200,K=m(()=>{let e=(0,Q.c)(21),d=A(),s=g(),u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=["lunora-auth-sessions",L],e[0]=u):u=e[0];let h;e[1]!==d?(h=m(()=>d.listAuthSessions({limit:L}),"t1"),e[1]=d,e[2]=h):h=e[2];let l=E(u,h),{error:v}=l,i=l.data?.rows??null,p;e[3]!==l?(p=m(()=>{l.refetch()},"t2"),e[3]=l,e[4]=p):p=e[4],H(p,!0);let x;e[5]!==d||e[6]!==l?(x=m(a=>{I((async()=>{await d.revokeAuthSession({sessionId:a}),l.refetch()})())},"t3"),e[5]=d,e[6]=l,e[7]=x):x=e[7];let y=x,n;e[8]!==v?(n=v!==null&&(0,t.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"auth-sessions-error",role:"alert",children:v},void 0,!1),e[8]=v,e[9]=n):n=e[9];let c;e[10]!==i||e[11]!==s?(c=i!==null&&i.length===0&&(0,t.jsxDEV)(w,{testId:"auth-sessions-empty",title:s("No active sessions.")},void 0,!1),e[10]=i,e[11]=s,e[12]=c):c=e[12];let f;e[13]!==y||e[14]!==i||e[15]!==s?(f=i!==null&&i.length>0&&(0,t.jsxDEV)(C,{className:"overflow-hidden py-0",children:(0,t.jsxDEV)(k,{className:"px-0",children:(0,t.jsxDEV)(R,{"data-testid":"auth-sessions-table",children:[(0,t.jsxDEV)(_,{children:(0,t.jsxDEV)(N,{children:[(0,t.jsxDEV)(o,{children:s("user")},void 0,!1),(0,t.jsxDEV)(o,{children:s("expires")},void 0,!1),(0,t.jsxDEV)(o,{children:s("ip")},void 0,!1),(0,t.jsxDEV)(o,{children:s("user agent")},void 0,!1),(0,t.jsxDEV)(o,{children:s("impersonated by")},void 0,!1),(0,t.jsxDEV)(o,{"aria-label":s("Actions")},void 0,!1)]},void 0,!0)},void 0,!1),(0,t.jsxDEV)($,{children:i.map(a=>(0,t.jsxDEV)(N,{"data-testid":`auth-session-${a.id}`,children:[(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.userId},void 0,!1),(0,t.jsxDEV)(r,{className:"text-muted-foreground tabular-nums",children:B(a.expiresAt)},void 0,!1),(0,t.jsxDEV)(r,{children:a.ipAddress??""},void 0,!1),(0,t.jsxDEV)(r,{className:"max-w-40 truncate",children:a.userAgent??""},void 0,!1),(0,t.jsxDEV)(r,{className:"font-mono text-xs",children:a.impersonatedBy??""},void 0,!1),(0,t.jsxDEV)(r,{children:(0,t.jsxDEV)(S,{"data-testid":`auth-session-revoke-${a.id}`,onClick:m(()=>{y(a.id)},"onClick"),size:"xs",type:"button",variant:"ghost",children:s("Revoke")},void 0,!1)},void 0,!1)]},a.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),e[13]=y,e[14]=i,e[15]=s,e[16]=f):f=e[16];let b;return e[17]!==n||e[18]!==c||e[19]!==f?(b=(0,t.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"auth-sessions",children:[n,c,f]},void 0,!0),e[17]=n,e[18]=c,e[19]=f,e[20]=b):b=e[20],b},"AuthSessionsPanel");export{K as AuthSessionsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{R as $}from"./chunk-3CJW6NWG.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-TAD43CG5.js";import{a as S,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-
|
|
1
|
+
import{a as q,b as B,c as V,d as p,e as d,f as n}from"./chunk-GTM65MVX.js";import{R as $}from"./chunk-3CJW6NWG.js";import{c as A}from"./chunk-UK64ZSUW.js";import"./chunk-O3NAGRTR.js";import"./chunk-HV7G6DFP.js";import{a as H}from"./chunk-TAD43CG5.js";import{a as S,e as k}from"./chunk-SEU5V7I6.js";import"./chunk-CKSHCYGC.js";import{f as F}from"./chunk-LRYLU6EY.js";import"./chunk-ZHVTQ37P.js";import"./chunk-3OA7PECS.js";import{d as Q,h as E,k as K,l as I}from"./chunk-ITQKVEP7.js";import"./chunk-22C6COGE.js";import{a as f,e as C,f as Z,g as G,h as J}from"./chunk-RRCPZMC2.js";var z=C(G(),1);var s=C(Z(),1);var e=C(J(),1);var X=10,g=f(x=>{let l=(0,z.c)(7),{label:m,value:a}=x,r;l[0]!==m?(r=(0,e.jsxDEV)("span",{className:"font-mono text-[11px] uppercase tracking-wide text-muted-foreground",children:m},void 0,!1),l[0]=m,l[1]=r):r=l[1];let v=a??"\u2014",o;l[2]!==v?(o=(0,e.jsxDEV)("span",{className:"font-mono text-sm",children:v},void 0,!1),l[2]=v,l[3]=o):o=l[3];let u;return l[4]!==r||l[5]!==o?(u=(0,e.jsxDEV)("div",{className:"flex flex-col gap-0.5",children:[r,o]},void 0,!0),l[4]=r,l[5]=o,l[6]=u):u=l[6],u},"Detail"),oe=f(({loadIndexes:x,runQuery:l}={})=>{let m=F(),a=Q(),[r,v]=(0,s.useState)(null),[o,u]=(0,s.useState)(null),[b,L]=(0,s.useState)(null),[N,O]=(0,s.useState)(""),[h,y]=(0,s.useState)(null),[M,w]=(0,s.useState)(null),[j,D]=(0,s.useState)(!1);(0,s.useEffect)(()=>{let t={cancelled:!1};return I((async()=>{try{let c=await(x??(()=>m.listVectorIndexes()))();t.cancelled||(v(c),u(null),L(T=>T??c[0]?.name??null))}catch(c){t.cancelled||(v(null),u(E(c)))}})()),()=>{t.cancelled=!0}},[m,x]);let i=r?.find(t=>t.name===b)??null,P=f(t=>{L(t.currentTarget.dataset.index??null),y(null),w(null)},"onSelect"),R=f(t=>{O(t.target.value)},"onQueryTextChange"),U=f(async()=>{let t=N.trim();if(!(b===null||t==="")){D(!0),w(null);try{let c=await(l??(T=>m.queryVectorIndex(T)))({name:b,text:t,topK:X});y(c)}catch(c){y(null),w(E(c))}finally{D(!1)}}},"search"),W=f(()=>{I(U())},"onSearch");return(0,e.jsxDEV)("div",{className:"flex flex-col gap-4","data-testid":"lunora-vector-browser",children:[o!==null&&(0,e.jsxDEV)("p",{className:"text-sm text-destructive","data-testid":"vector-error",role:"alert",children:o},void 0,!1),r!==null&&r.length===0&&(0,e.jsxDEV)(H,{description:a("Indexes declared with .vectorize() or defineVectorIndex() appear here."),icon:(0,e.jsxDEV)("svg",{"aria-hidden":"true",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.6,viewBox:"0 0 24 24",children:(0,e.jsxDEV)("path",{d:"M4 7l8-4 8 4-8 4-8-4Zm0 5 8 4 8-4M4 17l8 4 8-4"},void 0,!1)},void 0,!1),testId:"vector-empty",title:a("No vector indexes.")},void 0,!1),r!==null&&r.length>0&&(0,e.jsxDEV)(S,{className:"overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-table",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("name")},void 0,!1),(0,e.jsxDEV)(d,{children:a("table")},void 0,!1),(0,e.jsxDEV)(d,{children:a("dimensions")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metric")},void 0,!1),(0,e.jsxDEV)(d,{children:a("vectors")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:r.map(t=>(0,e.jsxDEV)(p,{className:t.name===b?"border-l-2 border-l-royal-amethyst bg-muted/50":"cursor-pointer","data-index":t.name,"data-testid":`vector-row-${t.name}`,onClick:P,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.name},void 0,!1),(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.table},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.dimensions??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{children:t.metric??"\u2014"},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.vectorsCount??"\u2014"},void 0,!1)]},t.name,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1),i!==null&&(0,e.jsxDEV)("section",{className:"border border-border bg-card p-3","data-testid":"vector-detail",children:[(0,e.jsxDEV)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,e.jsxDEV)(g,{label:a("field"),value:i.field},void 0,!1),(0,e.jsxDEV)(g,{label:a("dimensions"),value:i.dimensions},void 0,!1),(0,e.jsxDEV)(g,{label:a("metric"),value:i.metric},void 0,!1),(0,e.jsxDEV)(g,{label:a("vectors"),value:i.vectorsCount},void 0,!1)]},void 0,!0),i.metadata!==void 0&&i.metadata.length>0&&(0,e.jsxDEV)("p",{className:"mt-3 text-xs text-muted-foreground","data-testid":"vector-metadata",children:[a("metadata"),": ",(0,e.jsxDEV)("span",{className:"font-mono",children:i.metadata.join(", ")},void 0,!1)]},void 0,!0),(0,e.jsxDEV)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,e.jsxDEV)($,{className:"min-w-[18rem] flex-1","data-testid":"vector-query-input",onChange:R,placeholder:a("Search by similarity\u2026"),value:N},void 0,!1),(0,e.jsxDEV)(A,{"data-testid":"vector-search",disabled:j||N.trim()==="",onClick:W,children:a(j?"Searching\u2026":"Search")},void 0,!1)]},void 0,!0),M!==null&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-destructive","data-testid":"vector-query-error",role:"alert",children:M},void 0,!1),h!==null&&h.length===0&&(0,e.jsxDEV)("p",{className:"mt-2 text-sm text-muted-foreground","data-testid":"vector-no-matches",children:a("No matches.")},void 0,!1),h!==null&&h.length>0&&(0,e.jsxDEV)(S,{className:"mt-3 overflow-hidden py-0",children:(0,e.jsxDEV)(k,{className:"px-0",children:(0,e.jsxDEV)(q,{"data-testid":"vector-matches",children:[(0,e.jsxDEV)(B,{children:(0,e.jsxDEV)(p,{children:[(0,e.jsxDEV)(d,{children:a("id")},void 0,!1),(0,e.jsxDEV)(d,{children:a("score")},void 0,!1),(0,e.jsxDEV)(d,{children:a("metadata")},void 0,!1)]},void 0,!0)},void 0,!1),(0,e.jsxDEV)(V,{children:h.map(t=>(0,e.jsxDEV)(p,{"data-testid":`vector-match-${t.id}`,children:[(0,e.jsxDEV)(n,{className:"font-mono text-xs",children:t.id},void 0,!1),(0,e.jsxDEV)(n,{className:"tabular-nums",children:t.score.toFixed(4)},void 0,!1),(0,e.jsxDEV)(n,{className:"max-w-md truncate font-mono text-xs",children:t.metadata===void 0?"\u2014":K(t.metadata)},void 0,!1)]},t.id,!0))},void 0,!1)]},void 0,!0)},void 0,!1)},void 0,!1)]},void 0,!0)]},void 0,!0)},"VectorBrowser");export{oe as VectorBrowser};
|