@lunora/studio 1.0.0-alpha.3 → 1.0.0-alpha.30
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/__assets__/package-og.svg +1 -1
- package/dist/index.d.ts +29 -18
- package/dist/index.js +29 -29
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +1 -1
- package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
- package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +24 -36
- package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +13 -9
- package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +15 -15
- package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +10 -10
- package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +147 -204
- package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
- package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +107 -69
- package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +41 -53
- package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +37 -44
- package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
- package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +39 -46
- package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
- package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +15 -15
- package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +44 -31
- package/dist/packem_chunks/SettingsPanel.js +390 -0
- package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +12 -252
- package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +10 -68
- package/dist/packem_chunks/analytics-panel.js +261 -0
- package/dist/packem_chunks/auth-config-panel.js +179 -0
- package/dist/packem_chunks/auth-sessions-panel.js +175 -0
- package/dist/packem_chunks/dashboards-panel.js +779 -0
- package/dist/packem_chunks/fanout-panel.js +481 -0
- package/dist/packem_chunks/flags-panel.js +176 -0
- package/dist/packem_chunks/kv-browser.js +1896 -0
- package/dist/packem_chunks/log-drains-panel.js +273 -0
- package/dist/packem_chunks/organizations-panel.js +670 -0
- package/dist/packem_chunks/payments-panel.js +185 -0
- package/dist/packem_chunks/permissions-panel.js +804 -0
- package/dist/packem_chunks/queues-panel.js +147 -0
- package/dist/packem_chunks/rls-panel.js +313 -0
- package/dist/packem_chunks/schedule-panel.js +831 -0
- package/dist/packem_chunks/sparkline.js +79 -0
- package/dist/packem_chunks/storage-rules-panel.js +138 -0
- package/dist/packem_chunks/subscriptions-panel.js +236 -0
- package/dist/packem_chunks/users-panel.js +1265 -0
- package/dist/packem_chunks/vector-browser.js +281 -0
- package/dist/packem_chunks/workflows-panel.js +562 -0
- package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-CdaxLGkE.js} +3 -0
- package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-B6u_wnz-.js} +2 -2
- package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Drz4UO0a.js} +2 -1
- package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-B5BertvU.js} +1 -1
- package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-ANTHLWWh.js} +198 -247
- package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CjgTG_wa.js} +37 -66
- package/dist/packem_shared/HomePanel-c2FodE9t.js +14 -0
- package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CspFdbUT.js} +2 -1
- package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-BEJXtsBn.js} +163 -60
- package/dist/packem_shared/Studio-CVTtA_sB.js +16 -0
- package/dist/packem_shared/{StudioApp-CHOZA-z-.js → StudioApp-BSYV2fz6.js} +277 -3
- package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-DzqyvUU3.js} +1 -1
- package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-B6MyY_al.d.ts} +1 -1
- package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-Bb__F5-u.js} +1 -1
- package/dist/packem_shared/browser-storage-d03UsV7v.js +249 -0
- package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
- package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-Dsg6nRjo.js} +1 -1
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
- package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-D7nNzBYm.js} +4 -99
- package/dist/packem_shared/{HomePanel-Cw16stjq.js → home-panel-aOR_drVv.js} +833 -469
- package/dist/packem_shared/{internal-rXJEAhXS.js → internal-FcNZ3beb.js} +1 -1
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
- package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-Doy1XlQq.js} +4 -44
- package/dist/packem_shared/select-UkNYCT3s.js +273 -0
- package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
- package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-KgMPHS4u.js} +1 -1
- package/dist/packem_shared/studio-dMTJ-kRR.js +3987 -0
- package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
- package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-VMo0ftxD.js} +1 -1
- package/dist/packem_shared/use-admin-query-BViPA3US.js +105 -0
- package/dist/packem_shared/use-auth-capabilities-BHkoBnbZ.js +32 -0
- package/dist/standalone/chunk-2DS7JLWL.js +13 -0
- package/dist/standalone/chunk-2K47A3P6.js +1 -0
- package/dist/standalone/chunk-2NGUNNGW.js +1 -0
- package/dist/standalone/chunk-2PDQ4KZ6.js +1 -0
- package/dist/standalone/chunk-3BP4BTLR.js +4 -0
- package/dist/standalone/chunk-3OA7PECS.js +6 -0
- package/dist/standalone/chunk-4QHKBC77.js +1 -0
- package/dist/standalone/chunk-57LYXHXH.js +1 -0
- package/dist/standalone/chunk-5NSZVXCS.js +1 -0
- package/dist/standalone/chunk-5OIBXYZM.js +1 -0
- package/dist/standalone/chunk-63XKJQTQ.js +1 -0
- package/dist/standalone/chunk-6RC6L33K.js +4 -0
- package/dist/standalone/chunk-6VTGE3WJ.js +1 -0
- package/dist/standalone/chunk-7PBZKXYA.js +1 -0
- package/dist/standalone/chunk-7POIIWC5.js +3 -0
- package/dist/standalone/chunk-7RYIQKZA.js +1 -0
- package/dist/standalone/chunk-7TJJXVSE.js +1 -0
- package/dist/standalone/chunk-AB6QGMBF.js +1 -0
- package/dist/standalone/chunk-AHILM3ZP.js +1 -0
- package/dist/standalone/chunk-AQGOX5DK.js +1 -0
- package/dist/standalone/chunk-ASLGNHAX.js +1 -0
- package/dist/standalone/chunk-BHTPZS7L.js +4 -0
- package/dist/standalone/chunk-BJGBHGK3.js +1 -0
- package/dist/standalone/chunk-D7HKX4DI.js +1 -0
- package/dist/standalone/chunk-DGWTR4G7.js +1 -0
- package/dist/standalone/chunk-DSX53PBM.js +1 -0
- package/dist/standalone/chunk-DV2MNASX.js +1 -0
- package/dist/standalone/chunk-DWDILV2E.js +1 -0
- package/dist/standalone/chunk-E7AVZZKO.js +1 -0
- package/dist/standalone/chunk-EGJX34WM.js +1 -0
- package/dist/standalone/chunk-FCR3HKFV.js +1 -0
- package/dist/standalone/chunk-FKO3HO6I.js +4 -0
- package/dist/standalone/chunk-FQKNJSRA.js +76 -0
- package/dist/standalone/chunk-G2TFEWEQ.js +4 -0
- package/dist/standalone/chunk-GABMIICA.js +1 -0
- package/dist/standalone/chunk-GTM65MVX.js +1 -0
- package/dist/standalone/chunk-GZXPPJVK.js +1 -0
- package/dist/standalone/chunk-HFBRE65A.js +1 -0
- package/dist/standalone/chunk-HFMQNUBC.js +1 -0
- package/dist/standalone/chunk-HG7Q5B3H.js +1 -0
- package/dist/standalone/chunk-HTQL7AXU.js +1 -0
- package/dist/standalone/chunk-HV7G6DFP.js +5 -0
- package/dist/standalone/chunk-ITLLHEVG.js +1 -0
- package/dist/standalone/chunk-J6J54MBP.js +1 -0
- package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
- package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
- package/dist/standalone/chunk-KG3QTFWE.js +1 -0
- package/dist/standalone/chunk-KGS7KM4A.js +2 -0
- package/dist/standalone/chunk-KODWGUAB.js +1 -0
- package/dist/standalone/chunk-KZ6INM5M.js +1 -0
- package/dist/standalone/chunk-MGFEVTRI.js +1 -0
- package/dist/standalone/chunk-N2QDG3MW.js +1 -0
- package/dist/standalone/chunk-N4JI6VQD.js +1 -0
- package/dist/standalone/chunk-NNISYDNI.js +1 -0
- package/dist/standalone/chunk-O4PXDNR3.js +1 -0
- package/dist/standalone/chunk-O77VNUFD.js +1 -0
- package/dist/standalone/chunk-OD2POGPJ.js +1 -0
- package/dist/standalone/chunk-OXCK3ZUG.js +1 -0
- package/dist/standalone/chunk-P7DSVO4U.js +1 -0
- package/dist/standalone/chunk-PKAM3N5C.js +1 -0
- package/dist/standalone/chunk-QGXGBHQO.js +1 -0
- package/dist/standalone/chunk-QHA3TAEJ.js +1 -0
- package/dist/standalone/chunk-QQWC62X7.js +1 -0
- package/dist/standalone/chunk-RMYA7NAH.js +1 -0
- package/dist/standalone/chunk-RRCPZMC2.js +22 -0
- package/dist/standalone/chunk-S53RUBW5.js +1 -0
- package/dist/standalone/chunk-SB4GT6PK.js +1 -0
- package/dist/standalone/chunk-SEU5V7I6.js +1 -0
- package/dist/standalone/chunk-SHIOUDOT.js +1 -0
- package/dist/standalone/chunk-SIDRSX7Y.js +1 -0
- package/dist/standalone/chunk-SVR644RF.js +1 -0
- package/dist/standalone/chunk-TAD43CG5.js +1 -0
- package/dist/standalone/chunk-TBMYIZIO.js +1 -0
- package/dist/standalone/chunk-TICVNLPM.js +1 -0
- package/dist/standalone/chunk-TQ36RWOP.js +1 -0
- package/dist/standalone/chunk-UGMRUEBU.js +1 -0
- package/dist/standalone/chunk-UII66UVF.js +1 -0
- package/dist/standalone/chunk-VJPQUBN6.js +8 -0
- package/dist/standalone/chunk-VLXV72QE.js +1 -0
- package/dist/standalone/chunk-VMJKJWG6.js +1 -0
- package/dist/standalone/chunk-VPDPN5RR.js +2 -0
- package/dist/standalone/chunk-VSEGZA3J.js +1 -0
- package/dist/standalone/chunk-VXBZQIGY.js +4 -0
- package/dist/standalone/chunk-W7PCVQTE.js +1 -0
- package/dist/standalone/chunk-XLILSHPE.js +1 -0
- package/dist/standalone/chunk-XURNGQSS.js +1 -0
- package/dist/standalone/chunk-YJGANMU7.js +18 -0
- package/dist/standalone/chunk-YQQJ4N6U.js +1 -0
- package/dist/standalone/chunk-ZH7UES4T.js +2 -0
- package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
- package/dist/standalone/chunk-ZQCVDXDL.js +1 -0
- package/dist/standalone/studio.js +104 -246
- package/dist/styles.css +1 -1
- package/package.json +13 -12
- package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
- package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
- package/dist/packem_shared/Studio-DFWAlcuf.js +0 -33
- package/dist/packem_shared/studio-Bj8psK1c.js +0 -10303
- package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
- package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
|
@@ -3,12 +3,14 @@ import { LunoraClient } from '@lunora/client';
|
|
|
3
3
|
import { LunoraProvider } from '@lunora/react';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import { ErrorBoundary } from './ErrorBoundary-BzAApI7J.js';
|
|
6
|
-
import {
|
|
6
|
+
import { u as useTheme, B as BrandMark, T as ThemeProvider, a as TooltipProvider, S as Studio } from './studio-dMTJ-kRR.js';
|
|
7
7
|
import useDebounced from './useDebounced-Dxncpg6z.js';
|
|
8
|
-
import {
|
|
8
|
+
import { useT, createStudioI18n } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
9
9
|
import { StudioI18nProvider } from './StudioI18nProvider-B-tDCZIi.js';
|
|
10
10
|
import STUDIO_ROOT_CLASS from './STUDIO_ROOT_CLASS-D12gX2dV.js';
|
|
11
11
|
import { c as cn } from './utils-B05Dmz_H.js';
|
|
12
|
+
import { B as Button } from './button-BhsN2uZH.js';
|
|
13
|
+
import { I as Input } from './input-XH4r1Pt1.js';
|
|
12
14
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
13
15
|
|
|
14
16
|
const STORAGE_KEY = "lunora-studio-admin-token";
|
|
@@ -41,6 +43,275 @@ const saveToken = (token) => {
|
|
|
41
43
|
}
|
|
42
44
|
};
|
|
43
45
|
|
|
46
|
+
const StudioLoginForm = (t0) => {
|
|
47
|
+
const $ = c(42);
|
|
48
|
+
const {
|
|
49
|
+
onSubmit
|
|
50
|
+
} = t0;
|
|
51
|
+
const t = useT();
|
|
52
|
+
const [value, setValue] = useState("");
|
|
53
|
+
let t1;
|
|
54
|
+
if ($[0] !== value) {
|
|
55
|
+
t1 = value.trim();
|
|
56
|
+
$[0] = value;
|
|
57
|
+
$[1] = t1;
|
|
58
|
+
} else {
|
|
59
|
+
t1 = $[1];
|
|
60
|
+
}
|
|
61
|
+
const trimmed = t1;
|
|
62
|
+
let t2;
|
|
63
|
+
if ($[2] !== onSubmit || $[3] !== trimmed) {
|
|
64
|
+
t2 = (event) => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
if (trimmed !== "") {
|
|
67
|
+
onSubmit(trimmed);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
$[2] = onSubmit;
|
|
71
|
+
$[3] = trimmed;
|
|
72
|
+
$[4] = t2;
|
|
73
|
+
} else {
|
|
74
|
+
t2 = $[4];
|
|
75
|
+
}
|
|
76
|
+
const submit = t2;
|
|
77
|
+
let t3;
|
|
78
|
+
if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
79
|
+
t3 = /* @__PURE__ */ jsxDEV("div", {
|
|
80
|
+
className: "h-10 w-10 text-foreground",
|
|
81
|
+
children: /* @__PURE__ */ jsxDEV(BrandMark, {}, void 0, false)
|
|
82
|
+
}, void 0, false);
|
|
83
|
+
$[5] = t3;
|
|
84
|
+
} else {
|
|
85
|
+
t3 = $[5];
|
|
86
|
+
}
|
|
87
|
+
let t4;
|
|
88
|
+
if ($[6] !== t) {
|
|
89
|
+
t4 = t("Connect to Lunora Studio");
|
|
90
|
+
$[6] = t;
|
|
91
|
+
$[7] = t4;
|
|
92
|
+
} else {
|
|
93
|
+
t4 = $[7];
|
|
94
|
+
}
|
|
95
|
+
let t5;
|
|
96
|
+
if ($[8] !== t4) {
|
|
97
|
+
t5 = /* @__PURE__ */ jsxDEV("h1", {
|
|
98
|
+
className: "text-base font-semibold text-foreground",
|
|
99
|
+
children: t4
|
|
100
|
+
}, void 0, false);
|
|
101
|
+
$[8] = t4;
|
|
102
|
+
$[9] = t5;
|
|
103
|
+
} else {
|
|
104
|
+
t5 = $[9];
|
|
105
|
+
}
|
|
106
|
+
let t6;
|
|
107
|
+
if ($[10] !== t) {
|
|
108
|
+
t6 = t("Enter your admin token to access the studio.");
|
|
109
|
+
$[10] = t;
|
|
110
|
+
$[11] = t6;
|
|
111
|
+
} else {
|
|
112
|
+
t6 = $[11];
|
|
113
|
+
}
|
|
114
|
+
let t7;
|
|
115
|
+
if ($[12] !== t6) {
|
|
116
|
+
t7 = /* @__PURE__ */ jsxDEV("p", {
|
|
117
|
+
className: "text-[13px] text-muted-foreground",
|
|
118
|
+
children: t6
|
|
119
|
+
}, void 0, false);
|
|
120
|
+
$[12] = t6;
|
|
121
|
+
$[13] = t7;
|
|
122
|
+
} else {
|
|
123
|
+
t7 = $[13];
|
|
124
|
+
}
|
|
125
|
+
let t8;
|
|
126
|
+
if ($[14] !== t5 || $[15] !== t7) {
|
|
127
|
+
t8 = /* @__PURE__ */ jsxDEV("div", {
|
|
128
|
+
className: "flex flex-col items-center gap-3 text-center",
|
|
129
|
+
children: [t3, /* @__PURE__ */ jsxDEV("div", {
|
|
130
|
+
className: "flex flex-col gap-1",
|
|
131
|
+
children: [t5, t7]
|
|
132
|
+
}, void 0, true)]
|
|
133
|
+
}, void 0, true);
|
|
134
|
+
$[14] = t5;
|
|
135
|
+
$[15] = t7;
|
|
136
|
+
$[16] = t8;
|
|
137
|
+
} else {
|
|
138
|
+
t8 = $[16];
|
|
139
|
+
}
|
|
140
|
+
let t9;
|
|
141
|
+
if ($[17] !== t) {
|
|
142
|
+
t9 = t("admin token");
|
|
143
|
+
$[17] = t;
|
|
144
|
+
$[18] = t9;
|
|
145
|
+
} else {
|
|
146
|
+
t9 = $[18];
|
|
147
|
+
}
|
|
148
|
+
let t10;
|
|
149
|
+
if ($[19] !== t9) {
|
|
150
|
+
t10 = /* @__PURE__ */ jsxDEV("label", {
|
|
151
|
+
className: "text-xs font-medium text-foreground",
|
|
152
|
+
htmlFor: "lunora-studio-login-token",
|
|
153
|
+
children: t9
|
|
154
|
+
}, void 0, false);
|
|
155
|
+
$[19] = t9;
|
|
156
|
+
$[20] = t10;
|
|
157
|
+
} else {
|
|
158
|
+
t10 = $[20];
|
|
159
|
+
}
|
|
160
|
+
let t11;
|
|
161
|
+
if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
162
|
+
t11 = (event_0) => {
|
|
163
|
+
setValue(event_0.target.value);
|
|
164
|
+
};
|
|
165
|
+
$[21] = t11;
|
|
166
|
+
} else {
|
|
167
|
+
t11 = $[21];
|
|
168
|
+
}
|
|
169
|
+
let t12;
|
|
170
|
+
if ($[22] !== value) {
|
|
171
|
+
t12 = /* @__PURE__ */ jsxDEV(Input, {
|
|
172
|
+
autoComplete: "off",
|
|
173
|
+
autoFocus: true,
|
|
174
|
+
"data-testid": "lunora-studio-login-token",
|
|
175
|
+
id: "lunora-studio-login-token",
|
|
176
|
+
onChange: t11,
|
|
177
|
+
placeholder: "LUNORA_ADMIN_TOKEN",
|
|
178
|
+
type: "password",
|
|
179
|
+
value
|
|
180
|
+
}, void 0, false);
|
|
181
|
+
$[22] = value;
|
|
182
|
+
$[23] = t12;
|
|
183
|
+
} else {
|
|
184
|
+
t12 = $[23];
|
|
185
|
+
}
|
|
186
|
+
let t13;
|
|
187
|
+
if ($[24] !== t) {
|
|
188
|
+
t13 = t("From your worker's LUNORA_ADMIN_TOKEN — your project's .dev.vars in dev, or a deployment secret in production.");
|
|
189
|
+
$[24] = t;
|
|
190
|
+
$[25] = t13;
|
|
191
|
+
} else {
|
|
192
|
+
t13 = $[25];
|
|
193
|
+
}
|
|
194
|
+
let t14;
|
|
195
|
+
if ($[26] !== t13) {
|
|
196
|
+
t14 = /* @__PURE__ */ jsxDEV("p", {
|
|
197
|
+
className: "text-[11px] text-muted-foreground",
|
|
198
|
+
children: t13
|
|
199
|
+
}, void 0, false);
|
|
200
|
+
$[26] = t13;
|
|
201
|
+
$[27] = t14;
|
|
202
|
+
} else {
|
|
203
|
+
t14 = $[27];
|
|
204
|
+
}
|
|
205
|
+
let t15;
|
|
206
|
+
if ($[28] !== t10 || $[29] !== t12 || $[30] !== t14) {
|
|
207
|
+
t15 = /* @__PURE__ */ jsxDEV("div", {
|
|
208
|
+
className: "flex flex-col gap-1.5",
|
|
209
|
+
children: [t10, t12, t14]
|
|
210
|
+
}, void 0, true);
|
|
211
|
+
$[28] = t10;
|
|
212
|
+
$[29] = t12;
|
|
213
|
+
$[30] = t14;
|
|
214
|
+
$[31] = t15;
|
|
215
|
+
} else {
|
|
216
|
+
t15 = $[31];
|
|
217
|
+
}
|
|
218
|
+
const t16 = trimmed === "";
|
|
219
|
+
let t17;
|
|
220
|
+
if ($[32] !== t) {
|
|
221
|
+
t17 = t("Connect");
|
|
222
|
+
$[32] = t;
|
|
223
|
+
$[33] = t17;
|
|
224
|
+
} else {
|
|
225
|
+
t17 = $[33];
|
|
226
|
+
}
|
|
227
|
+
let t18;
|
|
228
|
+
if ($[34] !== t16 || $[35] !== t17) {
|
|
229
|
+
t18 = /* @__PURE__ */ jsxDEV(Button, {
|
|
230
|
+
"data-testid": "lunora-studio-login-submit",
|
|
231
|
+
disabled: t16,
|
|
232
|
+
type: "submit",
|
|
233
|
+
children: t17
|
|
234
|
+
}, void 0, false);
|
|
235
|
+
$[34] = t16;
|
|
236
|
+
$[35] = t17;
|
|
237
|
+
$[36] = t18;
|
|
238
|
+
} else {
|
|
239
|
+
t18 = $[36];
|
|
240
|
+
}
|
|
241
|
+
let t19;
|
|
242
|
+
if ($[37] !== submit || $[38] !== t15 || $[39] !== t18 || $[40] !== t8) {
|
|
243
|
+
t19 = /* @__PURE__ */ jsxDEV("form", {
|
|
244
|
+
className: "flex w-full max-w-sm flex-col gap-5 rounded-xl border border-border bg-card p-7 shadow-lg",
|
|
245
|
+
"data-testid": "lunora-studio-login",
|
|
246
|
+
onSubmit: submit,
|
|
247
|
+
children: [t8, t15, t18]
|
|
248
|
+
}, void 0, true);
|
|
249
|
+
$[37] = submit;
|
|
250
|
+
$[38] = t15;
|
|
251
|
+
$[39] = t18;
|
|
252
|
+
$[40] = t8;
|
|
253
|
+
$[41] = t19;
|
|
254
|
+
} else {
|
|
255
|
+
t19 = $[41];
|
|
256
|
+
}
|
|
257
|
+
return t19;
|
|
258
|
+
};
|
|
259
|
+
const StudioLogin = (t0) => {
|
|
260
|
+
const $ = c(10);
|
|
261
|
+
const {
|
|
262
|
+
i18n,
|
|
263
|
+
onSubmit
|
|
264
|
+
} = t0;
|
|
265
|
+
const {
|
|
266
|
+
resolvedTheme
|
|
267
|
+
} = useTheme();
|
|
268
|
+
const t1 = resolvedTheme === "dark" && "dark";
|
|
269
|
+
let t2;
|
|
270
|
+
if ($[0] !== t1) {
|
|
271
|
+
t2 = cn(STUDIO_ROOT_CLASS, t1, "flex h-dvh items-center justify-center bg-sidebar p-6 text-sm text-foreground");
|
|
272
|
+
$[0] = t1;
|
|
273
|
+
$[1] = t2;
|
|
274
|
+
} else {
|
|
275
|
+
t2 = $[1];
|
|
276
|
+
}
|
|
277
|
+
let t3;
|
|
278
|
+
if ($[2] !== onSubmit) {
|
|
279
|
+
t3 = /* @__PURE__ */ jsxDEV(StudioLoginForm, {
|
|
280
|
+
onSubmit
|
|
281
|
+
}, void 0, false);
|
|
282
|
+
$[2] = onSubmit;
|
|
283
|
+
$[3] = t3;
|
|
284
|
+
} else {
|
|
285
|
+
t3 = $[3];
|
|
286
|
+
}
|
|
287
|
+
let t4;
|
|
288
|
+
if ($[4] !== i18n || $[5] !== t3) {
|
|
289
|
+
t4 = /* @__PURE__ */ jsxDEV(StudioI18nProvider, {
|
|
290
|
+
i18n,
|
|
291
|
+
children: t3
|
|
292
|
+
}, void 0, false);
|
|
293
|
+
$[4] = i18n;
|
|
294
|
+
$[5] = t3;
|
|
295
|
+
$[6] = t4;
|
|
296
|
+
} else {
|
|
297
|
+
t4 = $[6];
|
|
298
|
+
}
|
|
299
|
+
let t5;
|
|
300
|
+
if ($[7] !== t2 || $[8] !== t4) {
|
|
301
|
+
t5 = /* @__PURE__ */ jsxDEV("div", {
|
|
302
|
+
className: t2,
|
|
303
|
+
"data-testid": "lunora-studio-login-root",
|
|
304
|
+
children: t4
|
|
305
|
+
}, void 0, false);
|
|
306
|
+
$[7] = t2;
|
|
307
|
+
$[8] = t4;
|
|
308
|
+
$[9] = t5;
|
|
309
|
+
} else {
|
|
310
|
+
t5 = $[9];
|
|
311
|
+
}
|
|
312
|
+
return t5;
|
|
313
|
+
};
|
|
314
|
+
|
|
44
315
|
const resolveBaseUrl = (explicit) => {
|
|
45
316
|
if (explicit !== void 0 && explicit !== "") {
|
|
46
317
|
return explicit;
|
|
@@ -356,7 +627,10 @@ const StudioApp = (t0) => {
|
|
|
356
627
|
let t11;
|
|
357
628
|
if ($[18] !== basePath || $[19] !== client || $[20] !== i18n || $[21] !== rulesInstalled || $[22] !== studio || $[23] !== token) {
|
|
358
629
|
t11 = /* @__PURE__ */ jsxDEV(ThemeProvider, {
|
|
359
|
-
children: /* @__PURE__ */ jsxDEV(
|
|
630
|
+
children: token === "" ? /* @__PURE__ */ jsxDEV(StudioLogin, {
|
|
631
|
+
i18n,
|
|
632
|
+
onSubmit: setToken
|
|
633
|
+
}, void 0, false) : /* @__PURE__ */ jsxDEV(StudioShell, {
|
|
360
634
|
basePath,
|
|
361
635
|
clearToken,
|
|
362
636
|
client,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useMemo } from 'react';
|
|
2
2
|
import { C as Card, a as CardContent } from './card-DURq3ElK.js';
|
|
3
|
-
import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from './table-
|
|
3
|
+
import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from './table-DsCa9Qp9.js';
|
|
4
4
|
import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
5
5
|
import { c as cn } from './utils-B05Dmz_H.js';
|
|
6
6
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
@@ -115,7 +115,7 @@ interface FunctionDescriptor {
|
|
|
115
115
|
/** Outcome of a single `FunctionRunner` invocation. */
|
|
116
116
|
type RunStatus = "error" | "idle" | "running" | "success";
|
|
117
117
|
/** Identifier for each built-in studio tab. */
|
|
118
|
-
type StudioTab = "analytics" | "api" | "audit" | "authConfig" | "authSessions" | "dashboards" | "data" | "drains" | "export" | "files" | "functions" | "health" | "home" | "insights" | "logs" | "mail" | "metrics" | "migrations" | "organizations" | "payments" | "permissions" | "pitr" | "realtime" | "rls" | "schedule" | "schema" | "security" | "settings" | "sql" | "storageRules" | "users" | "vectors" | "workflows";
|
|
118
|
+
type StudioTab = "analytics" | "api" | "audit" | "authConfig" | "authSessions" | "dashboards" | "data" | "drains" | "export" | "fanout" | "files" | "flags" | "functions" | "health" | "home" | "insights" | "kv" | "logs" | "mail" | "metrics" | "migrations" | "organizations" | "payments" | "permissions" | "pitr" | "queues" | "realtime" | "rls" | "schedule" | "schema" | "security" | "settings" | "sql" | "storageRules" | "users" | "vectors" | "workflows";
|
|
119
119
|
interface StudioProps {
|
|
120
120
|
/**
|
|
121
121
|
* URL path prefix the studio is mounted under, passed to the router as its
|
|
@@ -4,7 +4,7 @@ import { useMotionValue, useSpring, useTransform, useMotionValueEvent, motion, u
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useId, useEffect, useState, use, createContext, useRef } from 'react';
|
|
6
6
|
import * as RechartsPrimitive from 'recharts';
|
|
7
|
-
import { ZIndexLayer, ResponsiveContainer, LineChart, Line, BarChart, Bar as Bar$1, AreaChart, Area, XAxis as XAxis$1
|
|
7
|
+
import { ZIndexLayer, ResponsiveContainer, LineChart, Line, BarChart, Bar as Bar$1, AreaChart, Area, ReferenceLine, Rectangle, XAxis as XAxis$1 } from 'recharts';
|
|
8
8
|
import { jsxDEV, Fragment } from 'react/jsx-dev-runtime';
|
|
9
9
|
import { c as cn } from './utils-B05Dmz_H.js';
|
|
10
10
|
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
3
|
+
import { d as formatCell } from './internal-FcNZ3beb.js';
|
|
4
|
+
import { X as XAxis, B as Bar, T as Tooltip, E as EvilBarChart } from './bar-chart-Bb__F5-u.js';
|
|
5
|
+
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
6
|
+
import { cva } from 'class-variance-authority';
|
|
7
|
+
import { c as cn } from './utils-B05Dmz_H.js';
|
|
8
|
+
import { useState, useEffect } from 'react';
|
|
9
|
+
|
|
10
|
+
const MAX_BARS = 50;
|
|
11
|
+
const RESULT_CHART_CONFIG = {
|
|
12
|
+
value: {
|
|
13
|
+
colors: {
|
|
14
|
+
dark: ["var(--chart-1)"],
|
|
15
|
+
light: ["var(--chart-1)"]
|
|
16
|
+
},
|
|
17
|
+
label: "value"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const pickColumns = (result) => {
|
|
21
|
+
const value = result.columns.find((column) => result.rows.length > 0 && result.rows.every((row) => typeof row[column] === "number")) ?? null;
|
|
22
|
+
const label = result.columns.find((column) => column !== value) ?? null;
|
|
23
|
+
return {
|
|
24
|
+
label,
|
|
25
|
+
value
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const SqlResultChart = (t0) => {
|
|
29
|
+
const $ = c(15);
|
|
30
|
+
const {
|
|
31
|
+
result
|
|
32
|
+
} = t0;
|
|
33
|
+
const t = useT();
|
|
34
|
+
let t1;
|
|
35
|
+
if ($[0] !== result) {
|
|
36
|
+
t1 = pickColumns(result);
|
|
37
|
+
$[0] = result;
|
|
38
|
+
$[1] = t1;
|
|
39
|
+
} else {
|
|
40
|
+
t1 = $[1];
|
|
41
|
+
}
|
|
42
|
+
const {
|
|
43
|
+
label,
|
|
44
|
+
value
|
|
45
|
+
} = t1;
|
|
46
|
+
let t2;
|
|
47
|
+
if ($[2] !== label || $[3] !== result || $[4] !== value) {
|
|
48
|
+
t2 = value === null ? [] : result.rows.slice(0, MAX_BARS).map((row, index) => ({
|
|
49
|
+
label: label === null ? `#${(index + 1).toString()}` : formatCell(row[label]),
|
|
50
|
+
value: Number(row[value]) || 0
|
|
51
|
+
}));
|
|
52
|
+
$[2] = label;
|
|
53
|
+
$[3] = result;
|
|
54
|
+
$[4] = value;
|
|
55
|
+
$[5] = t2;
|
|
56
|
+
} else {
|
|
57
|
+
t2 = $[5];
|
|
58
|
+
}
|
|
59
|
+
const data = t2;
|
|
60
|
+
if (value === null) {
|
|
61
|
+
let t32;
|
|
62
|
+
if ($[6] !== t) {
|
|
63
|
+
t32 = t("No numeric column to chart.");
|
|
64
|
+
$[6] = t;
|
|
65
|
+
$[7] = t32;
|
|
66
|
+
} else {
|
|
67
|
+
t32 = $[7];
|
|
68
|
+
}
|
|
69
|
+
let t42;
|
|
70
|
+
if ($[8] !== t32) {
|
|
71
|
+
t42 = /* @__PURE__ */ jsxDEV("p", {
|
|
72
|
+
className: "p-4 text-sm text-muted-foreground",
|
|
73
|
+
"data-testid": "sql-chart-empty",
|
|
74
|
+
children: t32
|
|
75
|
+
}, void 0, false);
|
|
76
|
+
$[8] = t32;
|
|
77
|
+
$[9] = t42;
|
|
78
|
+
} else {
|
|
79
|
+
t42 = $[9];
|
|
80
|
+
}
|
|
81
|
+
return t42;
|
|
82
|
+
}
|
|
83
|
+
let t3;
|
|
84
|
+
let t4;
|
|
85
|
+
let t5;
|
|
86
|
+
if ($[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
87
|
+
t3 = /* @__PURE__ */ jsxDEV(XAxis, {
|
|
88
|
+
dataKey: "label"
|
|
89
|
+
}, void 0, false);
|
|
90
|
+
t4 = /* @__PURE__ */ jsxDEV(Bar, {
|
|
91
|
+
dataKey: "value"
|
|
92
|
+
}, void 0, false);
|
|
93
|
+
t5 = /* @__PURE__ */ jsxDEV(Tooltip, {}, void 0, false);
|
|
94
|
+
$[10] = t3;
|
|
95
|
+
$[11] = t4;
|
|
96
|
+
$[12] = t5;
|
|
97
|
+
} else {
|
|
98
|
+
t3 = $[10];
|
|
99
|
+
t4 = $[11];
|
|
100
|
+
t5 = $[12];
|
|
101
|
+
}
|
|
102
|
+
let t6;
|
|
103
|
+
if ($[13] !== data) {
|
|
104
|
+
t6 = /* @__PURE__ */ jsxDEV("div", {
|
|
105
|
+
className: "h-80 w-full p-3",
|
|
106
|
+
"data-testid": "sql-chart",
|
|
107
|
+
children: /* @__PURE__ */ jsxDEV(EvilBarChart, {
|
|
108
|
+
className: "h-full w-full",
|
|
109
|
+
config: RESULT_CHART_CONFIG,
|
|
110
|
+
data,
|
|
111
|
+
children: [t3, t4, t5]
|
|
112
|
+
}, void 0, true)
|
|
113
|
+
}, void 0, false);
|
|
114
|
+
$[13] = data;
|
|
115
|
+
$[14] = t6;
|
|
116
|
+
} else {
|
|
117
|
+
t6 = $[14];
|
|
118
|
+
}
|
|
119
|
+
return t6;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const alertVariants = cva("flex items-start gap-2 rounded-md border px-3 py-2 text-sm [&>svg]:mt-0.5 [&>svg]:size-4 [&>svg]:shrink-0", {
|
|
123
|
+
defaultVariants: {
|
|
124
|
+
variant: "default"
|
|
125
|
+
},
|
|
126
|
+
variants: {
|
|
127
|
+
variant: {
|
|
128
|
+
default: "border-border bg-muted/40 text-foreground",
|
|
129
|
+
destructive: "border-destructive/40 bg-destructive/5 text-destructive",
|
|
130
|
+
warning: "border-amber-500/40 bg-amber-500/5 text-amber-700 dark:text-amber-400"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
const Alert = (t0) => {
|
|
135
|
+
const $ = c(10);
|
|
136
|
+
const {
|
|
137
|
+
children,
|
|
138
|
+
className,
|
|
139
|
+
icon,
|
|
140
|
+
testId,
|
|
141
|
+
variant
|
|
142
|
+
} = t0;
|
|
143
|
+
let t1;
|
|
144
|
+
if ($[0] !== className || $[1] !== variant) {
|
|
145
|
+
t1 = cn(alertVariants({
|
|
146
|
+
variant
|
|
147
|
+
}), className);
|
|
148
|
+
$[0] = className;
|
|
149
|
+
$[1] = variant;
|
|
150
|
+
$[2] = t1;
|
|
151
|
+
} else {
|
|
152
|
+
t1 = $[2];
|
|
153
|
+
}
|
|
154
|
+
let t2;
|
|
155
|
+
if ($[3] !== children) {
|
|
156
|
+
t2 = /* @__PURE__ */ jsxDEV("div", {
|
|
157
|
+
className: "min-w-0 flex-1",
|
|
158
|
+
children
|
|
159
|
+
}, void 0, false);
|
|
160
|
+
$[3] = children;
|
|
161
|
+
$[4] = t2;
|
|
162
|
+
} else {
|
|
163
|
+
t2 = $[4];
|
|
164
|
+
}
|
|
165
|
+
let t3;
|
|
166
|
+
if ($[5] !== icon || $[6] !== t1 || $[7] !== t2 || $[8] !== testId) {
|
|
167
|
+
t3 = /* @__PURE__ */ jsxDEV("div", {
|
|
168
|
+
className: t1,
|
|
169
|
+
"data-testid": testId,
|
|
170
|
+
role: "alert",
|
|
171
|
+
children: [icon, t2]
|
|
172
|
+
}, void 0, true);
|
|
173
|
+
$[5] = icon;
|
|
174
|
+
$[6] = t1;
|
|
175
|
+
$[7] = t2;
|
|
176
|
+
$[8] = testId;
|
|
177
|
+
$[9] = t3;
|
|
178
|
+
} else {
|
|
179
|
+
t3 = $[9];
|
|
180
|
+
}
|
|
181
|
+
return t3;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
const store = () => {
|
|
185
|
+
try {
|
|
186
|
+
return globalThis.localStorage;
|
|
187
|
+
} catch {
|
|
188
|
+
return void 0;
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const loadJsonArray = function(key) {
|
|
192
|
+
try {
|
|
193
|
+
const raw = store()?.getItem(key) ?? void 0;
|
|
194
|
+
const parsed = raw === void 0 ? [] : JSON.parse(raw);
|
|
195
|
+
return Array.isArray(parsed) ? parsed : [];
|
|
196
|
+
} catch {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
const saveJson = (key, value) => {
|
|
201
|
+
const storage = store();
|
|
202
|
+
if (storage === void 0) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
try {
|
|
206
|
+
storage.setItem(key, JSON.stringify(value));
|
|
207
|
+
} catch {
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const usePersistedList = function(key) {
|
|
211
|
+
const $ = c(8);
|
|
212
|
+
let t0;
|
|
213
|
+
if ($[0] !== key) {
|
|
214
|
+
t0 = () => loadJsonArray(key);
|
|
215
|
+
$[0] = key;
|
|
216
|
+
$[1] = t0;
|
|
217
|
+
} else {
|
|
218
|
+
t0 = $[1];
|
|
219
|
+
}
|
|
220
|
+
const [value, setValue] = useState(t0);
|
|
221
|
+
let t1;
|
|
222
|
+
let t2;
|
|
223
|
+
if ($[2] !== key || $[3] !== value) {
|
|
224
|
+
t1 = () => {
|
|
225
|
+
saveJson(key, value);
|
|
226
|
+
};
|
|
227
|
+
t2 = [key, value];
|
|
228
|
+
$[2] = key;
|
|
229
|
+
$[3] = value;
|
|
230
|
+
$[4] = t1;
|
|
231
|
+
$[5] = t2;
|
|
232
|
+
} else {
|
|
233
|
+
t1 = $[4];
|
|
234
|
+
t2 = $[5];
|
|
235
|
+
}
|
|
236
|
+
useEffect(t1, t2);
|
|
237
|
+
let t3;
|
|
238
|
+
if ($[6] !== value) {
|
|
239
|
+
t3 = [value, setValue];
|
|
240
|
+
$[6] = value;
|
|
241
|
+
$[7] = t3;
|
|
242
|
+
} else {
|
|
243
|
+
t3 = $[7];
|
|
244
|
+
}
|
|
245
|
+
return t3;
|
|
246
|
+
};
|
|
247
|
+
const newId = (prefix) => globalThis.crypto?.randomUUID?.() ?? `${prefix}-${globalThis.performance.now().toString(36)}`;
|
|
248
|
+
|
|
249
|
+
export { Alert as A, SqlResultChart as S, newId as n, usePersistedList as u };
|
|
@@ -5,4 +5,4 @@ const CLOUDFLARE_R2_URL = `${CLOUDFLARE_DASH}/r2`;
|
|
|
5
5
|
const CLOUDFLARE_D1_URL = `${CLOUDFLARE_DASH}/workers/d1`;
|
|
6
6
|
const CLOUDFLARE_DURABLE_OBJECTS_URL = `${CLOUDFLARE_DASH}/workers/durable-objects`;
|
|
7
7
|
|
|
8
|
-
export {
|
|
8
|
+
export { CLOUDFLARE_D1_URL as C, CLOUDFLARE_OBSERVABILITY_URL as a, CLOUDFLARE_WORKERS_URL as b, CLOUDFLARE_DURABLE_OBJECTS_URL as c, CLOUDFLARE_R2_URL as d };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { useT } from './DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
3
|
-
import {
|
|
3
|
+
import { d as formatCell } from './internal-FcNZ3beb.js';
|
|
4
4
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
5
5
|
|
|
6
6
|
const CellValue = (t0) => {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const VALID_OPERATORS = /* @__PURE__ */ new Set(["contains", "eq", "gt", "gte", "lt", "lte", "ne"]);
|
|
2
|
+
const stringParameter = (raw) => {
|
|
3
|
+
if (typeof raw !== "string") {
|
|
4
|
+
return void 0;
|
|
5
|
+
}
|
|
6
|
+
const value = raw.trim();
|
|
7
|
+
return value === "" ? void 0 : value;
|
|
8
|
+
};
|
|
9
|
+
const isFilterClause = (entry) => {
|
|
10
|
+
if (entry === null || typeof entry !== "object") {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
const candidate = entry;
|
|
14
|
+
return typeof candidate.column === "string" && typeof candidate.operator === "string" && VALID_OPERATORS.has(candidate.operator);
|
|
15
|
+
};
|
|
16
|
+
const parseFilters = (raw) => {
|
|
17
|
+
if (typeof raw !== "string" || raw === "") {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const parsed = JSON.parse(raw);
|
|
22
|
+
return Array.isArray(parsed) ? parsed.filter(isFilterClause) : [];
|
|
23
|
+
} catch {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const parseOrder = (raw) => {
|
|
28
|
+
if (typeof raw !== "string" || raw === "") {
|
|
29
|
+
return void 0;
|
|
30
|
+
}
|
|
31
|
+
const separator = raw.lastIndexOf(":");
|
|
32
|
+
if (separator <= 0) {
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
const column = raw.slice(0, separator);
|
|
36
|
+
const direction = raw.slice(separator + 1);
|
|
37
|
+
if (direction !== "asc" && direction !== "desc") {
|
|
38
|
+
return void 0;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
column,
|
|
42
|
+
direction
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const validateDataViewSearch = (search) => {
|
|
46
|
+
const validated = {};
|
|
47
|
+
if (search["schema"] === "global") {
|
|
48
|
+
validated.schema = "global";
|
|
49
|
+
}
|
|
50
|
+
const table = stringParameter(search["table"]);
|
|
51
|
+
if (table !== void 0) {
|
|
52
|
+
validated.table = table;
|
|
53
|
+
}
|
|
54
|
+
const shard = stringParameter(search["shard"]);
|
|
55
|
+
if (shard !== void 0) {
|
|
56
|
+
validated.shard = shard;
|
|
57
|
+
}
|
|
58
|
+
const searchText = stringParameter(search["search"]);
|
|
59
|
+
if (searchText !== void 0) {
|
|
60
|
+
validated.search = searchText;
|
|
61
|
+
}
|
|
62
|
+
const order = stringParameter(search["order"]);
|
|
63
|
+
if (order !== void 0 && parseOrder(order) !== void 0) {
|
|
64
|
+
validated.order = order;
|
|
65
|
+
}
|
|
66
|
+
const filters = stringParameter(search["filters"]);
|
|
67
|
+
if (filters !== void 0 && parseFilters(filters).length > 0) {
|
|
68
|
+
validated.filters = filters;
|
|
69
|
+
}
|
|
70
|
+
return validated;
|
|
71
|
+
};
|
|
72
|
+
const searchToDataView = (search) => {
|
|
73
|
+
const filters = parseFilters(search["filters"]);
|
|
74
|
+
const orderBy = parseOrder(search["order"]);
|
|
75
|
+
return {
|
|
76
|
+
filters: filters.length > 0 ? filters : void 0,
|
|
77
|
+
orderBy,
|
|
78
|
+
search: typeof search["search"] === "string" && search["search"] !== "" ? search["search"] : void 0,
|
|
79
|
+
shard: typeof search["shard"] === "string" && search["shard"] !== "" ? search["shard"] : void 0,
|
|
80
|
+
table: typeof search["table"] === "string" && search["table"] !== "" ? search["table"] : void 0,
|
|
81
|
+
tier: search["schema"] === "global" ? "global" : "shard"
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
const dataViewToSearch = (view) => {
|
|
85
|
+
const filters = view.filters ?? [];
|
|
86
|
+
return {
|
|
87
|
+
filters: filters.length > 0 ? JSON.stringify(filters) : void 0,
|
|
88
|
+
order: view.orderBy === void 0 ? void 0 : `${view.orderBy.column}:${view.orderBy.direction}`,
|
|
89
|
+
schema: view.tier === "global" ? "global" : void 0,
|
|
90
|
+
search: view.search !== void 0 && view.search !== "" ? view.search : void 0,
|
|
91
|
+
shard: view.shard !== void 0 && view.shard !== "" ? view.shard : void 0,
|
|
92
|
+
table: view.table !== void 0 && view.table !== "" ? view.table : void 0
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export { dataViewToSearch as d, searchToDataView as s, validateDataViewSearch as v };
|