@crvouga/mockingbird-service-pharmetika 1.6.0 → 1.7.0
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/CHANGELOG.md +19 -1
- package/dist/{chunk-DBLOMLMC.js → chunk-JVKOLQ3A.js} +2 -2
- package/dist/{chunk-MWEFWJWB.js → chunk-ZAUHRESG.js} +355 -22
- package/dist/chunk-ZAUHRESG.js.map +7 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +1 -1
- package/dist/server.js +2 -2
- package/package.json +2 -2
- package/dist/chunk-MWEFWJWB.js.map +0 -7
- /package/dist/{chunk-DBLOMLMC.js.map → chunk-JVKOLQ3A.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-pharmetika
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.7.0 (2026-10-01)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
- record SQL timelines and serve the admin explorer ([8ced17a](https://github.com/crvouga/mockingbird/commit/8ced17ac398e386ef4e9d7e01fc7744c34b95d07))
|
|
8
|
+
|
|
9
|
+
### Dependencies
|
|
10
|
+
|
|
11
|
+
- `@crvouga/mockingbird-service-sqlite`
|
|
12
|
+
|
|
13
|
+
## 1.6.1 (2026-09-30)
|
|
14
|
+
|
|
15
|
+
### Fixes and improvements
|
|
16
|
+
|
|
17
|
+
- keep admin buttons pressed until the action finishes ([0aabfcb](https://github.com/crvouga/mockingbird/commit/0aabfcb5f392aa51e193f9c3f817d5877d92bc6a))
|
|
18
|
+
- size admin select fields like the text inputs beside them ([0fb3ef2](https://github.com/crvouga/mockingbird/commit/0fb3ef2ddbf43376c93a2ae6d87c6c9bf890dafc))
|
|
19
|
+
- keep admin section tabs wired when boot is renamed ([4eda25e](https://github.com/crvouga/mockingbird/commit/4eda25eacd59da048d196f7cc8369d7a02b47bfc))
|
|
20
|
+
|
|
21
|
+
## 1.6.0 (2026-09-29)
|
|
4
22
|
|
|
5
23
|
### Features
|
|
6
24
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZAUHRESG.js";
|
|
4
4
|
|
|
5
5
|
// ../../adapters/node/dist/cli.js
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
@@ -396,4 +396,4 @@ export {
|
|
|
396
396
|
createServer2 as createServer,
|
|
397
397
|
serveTarget
|
|
398
398
|
};
|
|
399
|
-
//# sourceMappingURL=chunk-
|
|
399
|
+
//# sourceMappingURL=chunk-JVKOLQ3A.js.map
|
|
@@ -1916,6 +1916,167 @@ function faultPresetList(value) {
|
|
|
1916
1916
|
})
|
|
1917
1917
|
};
|
|
1918
1918
|
}
|
|
1919
|
+
function mountSqlExplorer(root, api) {
|
|
1920
|
+
const cell = (value) => {
|
|
1921
|
+
if (value === null || value === void 0)
|
|
1922
|
+
return "";
|
|
1923
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1924
|
+
return String(value);
|
|
1925
|
+
}
|
|
1926
|
+
return JSON.stringify(value) ?? "";
|
|
1927
|
+
};
|
|
1928
|
+
root.replaceChildren();
|
|
1929
|
+
const layout = document.createElement("div");
|
|
1930
|
+
layout.className = "sql-layout";
|
|
1931
|
+
const tables = document.createElement("div");
|
|
1932
|
+
tables.className = "sql-tables";
|
|
1933
|
+
const stack = document.createElement("div");
|
|
1934
|
+
stack.className = "stack";
|
|
1935
|
+
const banner = document.createElement("p");
|
|
1936
|
+
banner.className = "banner";
|
|
1937
|
+
const grid = document.createElement("div");
|
|
1938
|
+
const input = document.createElement("textarea");
|
|
1939
|
+
input.className = "sql-input";
|
|
1940
|
+
input.spellcheck = false;
|
|
1941
|
+
input.placeholder = "SELECT * FROM ...";
|
|
1942
|
+
const actions = document.createElement("div");
|
|
1943
|
+
actions.className = "row-actions";
|
|
1944
|
+
const run = document.createElement("button");
|
|
1945
|
+
run.type = "button";
|
|
1946
|
+
run.textContent = "Run";
|
|
1947
|
+
actions.append(run);
|
|
1948
|
+
const result = document.createElement("pre");
|
|
1949
|
+
stack.append(banner, grid, input, actions, result);
|
|
1950
|
+
layout.append(tables, stack);
|
|
1951
|
+
root.append(layout);
|
|
1952
|
+
const showError = (error2) => {
|
|
1953
|
+
banner.textContent = error2 instanceof Error ? error2.message : String(error2);
|
|
1954
|
+
banner.classList.add("show");
|
|
1955
|
+
};
|
|
1956
|
+
const clearError = () => {
|
|
1957
|
+
banner.textContent = "";
|
|
1958
|
+
banner.classList.remove("show");
|
|
1959
|
+
};
|
|
1960
|
+
const renderGrid = (columns, rows) => {
|
|
1961
|
+
grid.replaceChildren();
|
|
1962
|
+
if (columns.length === 0) {
|
|
1963
|
+
const empty = document.createElement("p");
|
|
1964
|
+
empty.className = "empty";
|
|
1965
|
+
empty.textContent = "No rows.";
|
|
1966
|
+
grid.append(empty);
|
|
1967
|
+
return;
|
|
1968
|
+
}
|
|
1969
|
+
const table = document.createElement("table");
|
|
1970
|
+
const head = document.createElement("thead");
|
|
1971
|
+
const headRow = document.createElement("tr");
|
|
1972
|
+
for (const column of columns) {
|
|
1973
|
+
const th = document.createElement("th");
|
|
1974
|
+
th.textContent = column;
|
|
1975
|
+
headRow.append(th);
|
|
1976
|
+
}
|
|
1977
|
+
head.append(headRow);
|
|
1978
|
+
const body = document.createElement("tbody");
|
|
1979
|
+
for (const row of rows) {
|
|
1980
|
+
const tr = document.createElement("tr");
|
|
1981
|
+
for (const column of columns) {
|
|
1982
|
+
const td = document.createElement("td");
|
|
1983
|
+
td.dataset.label = column;
|
|
1984
|
+
td.textContent = cell(row[column]);
|
|
1985
|
+
tr.append(td);
|
|
1986
|
+
}
|
|
1987
|
+
body.append(tr);
|
|
1988
|
+
}
|
|
1989
|
+
table.append(head, body);
|
|
1990
|
+
grid.append(table);
|
|
1991
|
+
};
|
|
1992
|
+
const rowsOf = (value) => {
|
|
1993
|
+
if (!isRecord2(value) || !Array.isArray(value.rows))
|
|
1994
|
+
return [];
|
|
1995
|
+
return value.rows.flatMap((row) => isRecord2(row) ? [row] : []);
|
|
1996
|
+
};
|
|
1997
|
+
const columnsOf = (value, rows) => {
|
|
1998
|
+
if (isRecord2(value) && Array.isArray(value.columns)) {
|
|
1999
|
+
const named = value.columns.flatMap((column) => typeof column === "string" ? [column] : []);
|
|
2000
|
+
if (named.length > 0)
|
|
2001
|
+
return named;
|
|
2002
|
+
}
|
|
2003
|
+
const first = rows[0];
|
|
2004
|
+
return first === void 0 ? [] : Object.keys(first);
|
|
2005
|
+
};
|
|
2006
|
+
let selected = "";
|
|
2007
|
+
const loadPage = async (schema, name) => {
|
|
2008
|
+
selected = `${schema}.${name}`;
|
|
2009
|
+
const page = await api.get(`/sql/tables/${encodeURIComponent(schema)}/${encodeURIComponent(name)}?limit=50`);
|
|
2010
|
+
const rows = rowsOf(page);
|
|
2011
|
+
renderGrid(columnsOf(page, rows), rows);
|
|
2012
|
+
const total = isRecord2(page) && typeof page.total === "number" ? page.total : rows.length;
|
|
2013
|
+
result.textContent = `${selected} \xB7 ${total} rows`;
|
|
2014
|
+
for (const button of tables.querySelectorAll("button")) {
|
|
2015
|
+
if (!(button instanceof HTMLButtonElement))
|
|
2016
|
+
continue;
|
|
2017
|
+
button.setAttribute("aria-current", button.dataset.schema === schema && button.dataset.table === name ? "true" : "false");
|
|
2018
|
+
}
|
|
2019
|
+
};
|
|
2020
|
+
const loadTables = async () => {
|
|
2021
|
+
const payload = await api.get("/sql/tables");
|
|
2022
|
+
const listed = isRecord2(payload) && Array.isArray(payload.tables) ? payload.tables : [];
|
|
2023
|
+
tables.replaceChildren();
|
|
2024
|
+
if (listed.length === 0) {
|
|
2025
|
+
const empty = document.createElement("p");
|
|
2026
|
+
empty.className = "empty";
|
|
2027
|
+
empty.textContent = "No tables.";
|
|
2028
|
+
tables.append(empty);
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
for (const item of listed) {
|
|
2032
|
+
if (!isRecord2(item) || typeof item.schema !== "string" || typeof item.name !== "string")
|
|
2033
|
+
continue;
|
|
2034
|
+
const button = document.createElement("button");
|
|
2035
|
+
button.type = "button";
|
|
2036
|
+
button.dataset.schema = item.schema;
|
|
2037
|
+
button.dataset.table = item.name;
|
|
2038
|
+
button.textContent = `${item.schema}.${item.name}`;
|
|
2039
|
+
tables.append(button);
|
|
2040
|
+
}
|
|
2041
|
+
};
|
|
2042
|
+
tables.addEventListener("click", (event) => {
|
|
2043
|
+
const target = event.target;
|
|
2044
|
+
if (!(target instanceof Element))
|
|
2045
|
+
return;
|
|
2046
|
+
const button = target.closest("button");
|
|
2047
|
+
if (!(button instanceof HTMLButtonElement))
|
|
2048
|
+
return;
|
|
2049
|
+
const schema = button.dataset.schema;
|
|
2050
|
+
const name = button.dataset.table;
|
|
2051
|
+
if (schema === void 0 || name === void 0)
|
|
2052
|
+
return;
|
|
2053
|
+
clearError();
|
|
2054
|
+
loadPage(schema, name).catch(showError);
|
|
2055
|
+
});
|
|
2056
|
+
run.addEventListener("click", () => {
|
|
2057
|
+
const sql = input.value.trim();
|
|
2058
|
+
if (sql === "") {
|
|
2059
|
+
showError(new Error("Enter a statement"));
|
|
2060
|
+
return;
|
|
2061
|
+
}
|
|
2062
|
+
clearError();
|
|
2063
|
+
api.send("POST", "/sql/query", { sql }).then((payload) => {
|
|
2064
|
+
const rows = rowsOf(payload);
|
|
2065
|
+
renderGrid(columnsOf(payload, rows), rows);
|
|
2066
|
+
const count = isRecord2(payload) && typeof payload.rowCount === "number" ? payload.rowCount : rows.length;
|
|
2067
|
+
const truncated = isRecord2(payload) && payload.truncated === true ? " (truncated)" : "";
|
|
2068
|
+
result.textContent = `${count} rows${truncated}`;
|
|
2069
|
+
}).catch(showError);
|
|
2070
|
+
});
|
|
2071
|
+
const namespace = document.getElementById("namespace");
|
|
2072
|
+
if (namespace) {
|
|
2073
|
+
namespace.addEventListener("change", () => {
|
|
2074
|
+
clearError();
|
|
2075
|
+
loadTables().catch(showError);
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
loadTables().catch(showError);
|
|
2079
|
+
}
|
|
1919
2080
|
function bootAdmin(config) {
|
|
1920
2081
|
const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
1921
2082
|
const sources = ["declared", "inferred", "mixed"];
|
|
@@ -2356,6 +2517,50 @@ function bootAdmin(config) {
|
|
|
2356
2517
|
if (render)
|
|
2357
2518
|
await render();
|
|
2358
2519
|
}
|
|
2520
|
+
const delay = (ms) => new Promise((resolve) => {
|
|
2521
|
+
window.setTimeout(resolve, ms);
|
|
2522
|
+
});
|
|
2523
|
+
const confirmAction = async (button, pending, done, work) => {
|
|
2524
|
+
if (button.dataset.pending === "1")
|
|
2525
|
+
return;
|
|
2526
|
+
const label = button.textContent ?? "";
|
|
2527
|
+
const width = button.offsetWidth;
|
|
2528
|
+
button.dataset.pending = "1";
|
|
2529
|
+
button.classList.add("pressed");
|
|
2530
|
+
button.setAttribute("aria-busy", "true");
|
|
2531
|
+
button.style.minWidth = `${width}px`;
|
|
2532
|
+
button.textContent = pending;
|
|
2533
|
+
try {
|
|
2534
|
+
await work();
|
|
2535
|
+
button.textContent = done;
|
|
2536
|
+
await delay(1e3);
|
|
2537
|
+
} catch (error2) {
|
|
2538
|
+
showError(error2);
|
|
2539
|
+
} finally {
|
|
2540
|
+
button.textContent = label;
|
|
2541
|
+
button.style.minWidth = "";
|
|
2542
|
+
button.classList.remove("pressed");
|
|
2543
|
+
button.removeAttribute("aria-busy");
|
|
2544
|
+
delete button.dataset.pending;
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
document.addEventListener("click", (event) => {
|
|
2548
|
+
const target = event.target;
|
|
2549
|
+
if (!(target instanceof Element))
|
|
2550
|
+
return;
|
|
2551
|
+
const button = target.closest("button");
|
|
2552
|
+
if (!(button instanceof HTMLButtonElement) || button.dataset.pending === "1")
|
|
2553
|
+
return;
|
|
2554
|
+
button.classList.add("pressed");
|
|
2555
|
+
const token = String(Date.now());
|
|
2556
|
+
button.dataset.press = token;
|
|
2557
|
+
window.setTimeout(() => {
|
|
2558
|
+
if (button.dataset.press !== token || button.dataset.pending === "1")
|
|
2559
|
+
return;
|
|
2560
|
+
button.classList.remove("pressed");
|
|
2561
|
+
delete button.dataset.press;
|
|
2562
|
+
}, 450);
|
|
2563
|
+
});
|
|
2359
2564
|
el("namespace", HTMLSelectElement).addEventListener("change", () => {
|
|
2360
2565
|
state.namespace = el("namespace", HTMLSelectElement).value;
|
|
2361
2566
|
refresh().catch(showError);
|
|
@@ -2366,7 +2571,7 @@ function bootAdmin(config) {
|
|
|
2366
2571
|
refresh().catch(showError);
|
|
2367
2572
|
});
|
|
2368
2573
|
el("refresh", HTMLButtonElement).addEventListener("click", () => {
|
|
2369
|
-
refresh().catch(showError);
|
|
2574
|
+
confirmAction(el("refresh", HTMLButtonElement), "Refreshing...", "Updated", () => refresh()).catch(showError);
|
|
2370
2575
|
});
|
|
2371
2576
|
el("collections", HTMLElement).addEventListener("click", (event) => {
|
|
2372
2577
|
const target = event.target;
|
|
@@ -2489,10 +2694,10 @@ function bootAdmin(config) {
|
|
|
2489
2694
|
}).then(() => renderFaults()).catch(showError);
|
|
2490
2695
|
});
|
|
2491
2696
|
el("fault-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2492
|
-
api("DELETE", "/faults").then(() => renderFaults()).catch(showError);
|
|
2697
|
+
confirmAction(el("fault-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/faults").then(() => renderFaults())).catch(showError);
|
|
2493
2698
|
});
|
|
2494
2699
|
el("journal-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2495
|
-
api("DELETE", "/requests").then(() => renderJournal()).catch(showError);
|
|
2700
|
+
confirmAction(el("journal-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/requests").then(() => renderJournal())).catch(showError);
|
|
2496
2701
|
});
|
|
2497
2702
|
el("route-list", HTMLElement).addEventListener("click", (event) => {
|
|
2498
2703
|
const target = event.target;
|
|
@@ -2548,6 +2753,22 @@ function bootAdmin(config) {
|
|
|
2548
2753
|
panel.script = value.script;
|
|
2549
2754
|
return panel;
|
|
2550
2755
|
};
|
|
2756
|
+
const decodeExtension = (value) => {
|
|
2757
|
+
if (!isRecord2(value))
|
|
2758
|
+
return void 0;
|
|
2759
|
+
if (value.kind === "sql") {
|
|
2760
|
+
return {
|
|
2761
|
+
kind: "sql",
|
|
2762
|
+
id: typeof value.id === "string" && value.id !== "" ? value.id : "sql",
|
|
2763
|
+
title: typeof value.title === "string" && value.title !== "" ? value.title : "SQL",
|
|
2764
|
+
description: typeof value.description === "string" ? value.description : "Browse tables and run queries."
|
|
2765
|
+
};
|
|
2766
|
+
}
|
|
2767
|
+
if (value.kind !== "panel")
|
|
2768
|
+
return void 0;
|
|
2769
|
+
const panel = decodePanel(value);
|
|
2770
|
+
return panel === void 0 ? void 0 : { kind: "panel", ...panel };
|
|
2771
|
+
};
|
|
2551
2772
|
const mountPanels = (panels) => {
|
|
2552
2773
|
const nav = el("nav", HTMLElement);
|
|
2553
2774
|
const views = el("views", HTMLElement);
|
|
@@ -2601,15 +2822,57 @@ function bootAdmin(config) {
|
|
|
2601
2822
|
return decoded === void 0 ? [] : [decoded];
|
|
2602
2823
|
});
|
|
2603
2824
|
mountPanels(panels);
|
|
2825
|
+
const extensions = requireList(isRecord2(manifest) ? manifest.extensions : void 0, "Extensions").flatMap((extension) => {
|
|
2826
|
+
const decoded = decodeExtension(extension);
|
|
2827
|
+
return decoded === void 0 ? [] : [decoded];
|
|
2828
|
+
});
|
|
2829
|
+
const extensionPanels = extensions.flatMap((extension) => extension.kind === "panel" ? [extension] : []);
|
|
2830
|
+
mountPanels(extensionPanels);
|
|
2831
|
+
for (const extension of extensions) {
|
|
2832
|
+
if (extension.kind !== "sql")
|
|
2833
|
+
continue;
|
|
2834
|
+
const nav = el("nav", HTMLElement);
|
|
2835
|
+
const views = el("views", HTMLElement);
|
|
2836
|
+
const button = document.createElement("button");
|
|
2837
|
+
button.type = "button";
|
|
2838
|
+
button.dataset.view = extension.id;
|
|
2839
|
+
button.textContent = extension.title;
|
|
2840
|
+
nav.append(button);
|
|
2841
|
+
const section = document.createElement("section");
|
|
2842
|
+
section.className = "view";
|
|
2843
|
+
section.id = `view-${extension.id}`;
|
|
2844
|
+
section.hidden = true;
|
|
2845
|
+
const title = document.createElement("h2");
|
|
2846
|
+
title.textContent = extension.title;
|
|
2847
|
+
const lede = document.createElement("p");
|
|
2848
|
+
lede.className = "lede";
|
|
2849
|
+
lede.textContent = extension.description;
|
|
2850
|
+
const body = document.createElement("div");
|
|
2851
|
+
body.className = "panel-body";
|
|
2852
|
+
section.append(title, lede, body);
|
|
2853
|
+
views.append(section);
|
|
2854
|
+
mountSqlExplorer(body, panelApi);
|
|
2855
|
+
}
|
|
2604
2856
|
return refresh();
|
|
2605
2857
|
}).catch(showError);
|
|
2606
2858
|
}
|
|
2607
|
-
var clientPrelude = [
|
|
2859
|
+
var clientPrelude = [
|
|
2860
|
+
isRecord2,
|
|
2861
|
+
mountAdminBrand,
|
|
2862
|
+
startAdminBrand,
|
|
2863
|
+
faultPresetList,
|
|
2864
|
+
mountSqlExplorer,
|
|
2865
|
+
bootAdmin
|
|
2866
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2608
2867
|
var adminClientSource = (config) => {
|
|
2609
2868
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2869
|
+
const entry = bootAdmin.name;
|
|
2870
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(entry)) {
|
|
2871
|
+
throw new Error("admin client cannot call its boot function");
|
|
2872
|
+
}
|
|
2610
2873
|
return `<script>
|
|
2611
2874
|
${clientPrelude}
|
|
2612
|
-
|
|
2875
|
+
${entry}(${payload});
|
|
2613
2876
|
</script>`;
|
|
2614
2877
|
};
|
|
2615
2878
|
|
|
@@ -2650,19 +2913,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2650
2913
|
"GET /ui/manifest"
|
|
2651
2914
|
];
|
|
2652
2915
|
var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
2916
|
+
var RESERVED_VIEWS = /* @__PURE__ */ new Set(["overview", "state", "clock", "faults", "journal", "routes"]);
|
|
2917
|
+
var checkPanel = (panel, seen, label) => {
|
|
2918
|
+
if (!PANEL_ID.test(panel.id)) {
|
|
2919
|
+
throw new RangeError(`${label} id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
|
|
2920
|
+
}
|
|
2921
|
+
if (RESERVED_VIEWS.has(panel.id)) {
|
|
2922
|
+
throw new RangeError(`${label} id ${panel.id} is reserved by the admin shell`);
|
|
2923
|
+
}
|
|
2924
|
+
if (seen.has(panel.id))
|
|
2925
|
+
throw new RangeError(`duplicate admin view id ${panel.id}`);
|
|
2926
|
+
seen.add(panel.id);
|
|
2927
|
+
if (panel.title.trim() === "")
|
|
2928
|
+
throw new RangeError(`${label} ${panel.id} needs a title`);
|
|
2929
|
+
};
|
|
2653
2930
|
var assertAdminUi = (ui) => {
|
|
2654
|
-
if (!ui
|
|
2931
|
+
if (!ui)
|
|
2655
2932
|
return;
|
|
2656
2933
|
const seen = /* @__PURE__ */ new Set();
|
|
2657
|
-
for (const panel of ui.panels)
|
|
2658
|
-
|
|
2659
|
-
|
|
2934
|
+
for (const panel of ui.panels ?? [])
|
|
2935
|
+
checkPanel(panel, seen, "admin panel");
|
|
2936
|
+
for (const extension of ui.extensions ?? []) {
|
|
2937
|
+
if (extension.kind === "panel") {
|
|
2938
|
+
checkPanel(extension, seen, "admin extension");
|
|
2939
|
+
continue;
|
|
2660
2940
|
}
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
seen.add(panel.id);
|
|
2664
|
-
if (panel.title.trim() === "")
|
|
2665
|
-
throw new RangeError(`admin panel ${panel.id} needs a title`);
|
|
2941
|
+
const id = extension.id ?? "sql";
|
|
2942
|
+
checkPanel({ id, title: extension.title ?? "SQL" }, seen, "admin extension");
|
|
2666
2943
|
}
|
|
2667
2944
|
};
|
|
2668
2945
|
|
|
@@ -2823,9 +3100,24 @@ var renderAdminDocument = (service) => {
|
|
|
2823
3100
|
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
2824
3101
|
label.field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--faint); }
|
|
2825
3102
|
label.field input, label.field select, .controls input[type="password"] {
|
|
2826
|
-
background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
2827
|
-
padding: 7px 8px; min-height: 36px;
|
|
2828
|
-
}
|
|
3103
|
+
background-color: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
3104
|
+
padding: 7px 8px; min-height: 36px; line-height: 1.2;
|
|
3105
|
+
}
|
|
3106
|
+
/* A native menu ignores min-height, so Preset rendered about half as tall as
|
|
3107
|
+
the text fields in the same form. Paint it like those fields. */
|
|
3108
|
+
label.field select {
|
|
3109
|
+
-webkit-appearance: none; appearance: none;
|
|
3110
|
+
padding-right: 28px;
|
|
3111
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%2371717a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E");
|
|
3112
|
+
background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
|
|
3113
|
+
}
|
|
3114
|
+
.stack > .field > input,
|
|
3115
|
+
.stack > .field > select,
|
|
3116
|
+
.stack > .field > textarea,
|
|
3117
|
+
dialog .field > input,
|
|
3118
|
+
dialog .field > select,
|
|
3119
|
+
dialog .field > textarea { width: 100%; }
|
|
3120
|
+
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger, nav.side button { cursor: pointer; }
|
|
2829
3121
|
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger {
|
|
2830
3122
|
border-radius: 9px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
|
|
2831
3123
|
background: var(--bg-elev);
|
|
@@ -2833,6 +3125,14 @@ var renderAdminDocument = (service) => {
|
|
|
2833
3125
|
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
|
|
2834
3126
|
.btn-quiet { background: transparent; }
|
|
2835
3127
|
.btn-danger { color: var(--err); }
|
|
3128
|
+
/* Held after mouseup. Clearing an empty journal changes nothing on screen,
|
|
3129
|
+
so the press itself has to stay visible. */
|
|
3130
|
+
.icon-btn:active, .btn:active, .btn-quiet:active, .btn-danger:active, nav.side button:active,
|
|
3131
|
+
.icon-btn.pressed, .btn.pressed, .btn-quiet.pressed, .btn-danger.pressed, nav.side button.pressed {
|
|
3132
|
+
background: var(--bg-inset); border-color: var(--line-strong); color: var(--ink);
|
|
3133
|
+
}
|
|
3134
|
+
.btn-danger:active, .btn-danger.pressed { background: var(--err-soft); color: var(--err); }
|
|
3135
|
+
.btn-primary:active, .btn-primary.pressed { filter: brightness(0.88); color: var(--accent-ink); }
|
|
2836
3136
|
/* minmax(0, 1fr): a 1fr column will not shrink below its content, so a long
|
|
2837
3137
|
record or the full nav row would widen the page past the viewport. */
|
|
2838
3138
|
.layout {
|
|
@@ -2873,6 +3173,12 @@ var renderAdminDocument = (service) => {
|
|
|
2873
3173
|
border-radius: 999px; padding: 4px 8px;
|
|
2874
3174
|
}
|
|
2875
3175
|
.chip i { color: var(--faint); font-style: normal; }
|
|
3176
|
+
.sql-layout {
|
|
3177
|
+
display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 16px;
|
|
3178
|
+
}
|
|
3179
|
+
.sql-tables { display: flex; flex-direction: column; gap: 4px; max-height: 28rem; overflow: auto; }
|
|
3180
|
+
.sql-tables button { text-align: left; }
|
|
3181
|
+
.sql-input { font-family: var(--mono); min-height: 7rem; width: 100%; }
|
|
2876
3182
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2877
3183
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2878
3184
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -2921,14 +3227,22 @@ var renderAdminDocument = (service) => {
|
|
|
2921
3227
|
input, select, textarea { font-size: 16px; }
|
|
2922
3228
|
.brand, .vendor, .controls { width: 100%; }
|
|
2923
3229
|
label.field, label.field select, label.field input { flex: 1; min-width: 0; }
|
|
2924
|
-
|
|
3230
|
+
/* The layout fills the screen. A single-column grid stretches every auto
|
|
3231
|
+
row, so the tab bar grew with the leftover height and the buttons floated
|
|
3232
|
+
in the middle of it. The bar stays one row; the page below takes the rest. */
|
|
3233
|
+
.layout {
|
|
3234
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3235
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
3236
|
+
align-content: start;
|
|
3237
|
+
}
|
|
2925
3238
|
nav.side {
|
|
3239
|
+
align-self: start; height: auto;
|
|
2926
3240
|
flex-direction: row; align-items: center; overflow-x: auto; min-width: 0;
|
|
2927
3241
|
border-right: 0; border-bottom: 1px solid var(--line);
|
|
2928
3242
|
padding: 8px;
|
|
2929
3243
|
}
|
|
2930
3244
|
nav.side button { white-space: nowrap; flex: none; }
|
|
2931
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
3245
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
2932
3246
|
main { padding: 14px; }
|
|
2933
3247
|
table, thead, tbody, tr, th, td { display: block; }
|
|
2934
3248
|
thead { display: none; }
|
|
@@ -3099,6 +3413,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
3099
3413
|
status: 200,
|
|
3100
3414
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
3101
3415
|
});
|
|
3416
|
+
var describeExtension = (extension) => {
|
|
3417
|
+
if (extension.kind === "sql") {
|
|
3418
|
+
return {
|
|
3419
|
+
kind: "sql",
|
|
3420
|
+
id: extension.id ?? "sql",
|
|
3421
|
+
title: extension.title ?? "SQL",
|
|
3422
|
+
...extension.description !== void 0 ? { description: extension.description } : {}
|
|
3423
|
+
};
|
|
3424
|
+
}
|
|
3425
|
+
return {
|
|
3426
|
+
kind: "panel",
|
|
3427
|
+
id: extension.id,
|
|
3428
|
+
title: extension.title,
|
|
3429
|
+
...extension.description !== void 0 ? { description: extension.description } : {},
|
|
3430
|
+
html: extension.html,
|
|
3431
|
+
...extension.script !== void 0 ? { script: extension.script } : {}
|
|
3432
|
+
};
|
|
3433
|
+
};
|
|
3102
3434
|
var adminUiRoutes = (service, ui) => {
|
|
3103
3435
|
const shell = () => renderAdminDocument(service);
|
|
3104
3436
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -3113,7 +3445,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
3113
3445
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
3114
3446
|
html: panel.html,
|
|
3115
3447
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
3116
|
-
}))
|
|
3448
|
+
})),
|
|
3449
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
3117
3450
|
})
|
|
3118
3451
|
};
|
|
3119
3452
|
};
|
|
@@ -3790,7 +4123,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3790
4123
|
};
|
|
3791
4124
|
|
|
3792
4125
|
// ../core/dist/version.js
|
|
3793
|
-
var PACKAGE_VERSION = true ? "1.
|
|
4126
|
+
var PACKAGE_VERSION = true ? "1.7.0" : UNRELEASED_VERSION;
|
|
3794
4127
|
|
|
3795
4128
|
// ../core/dist/signing.js
|
|
3796
4129
|
var encoder = new TextEncoder();
|
|
@@ -5749,4 +6082,4 @@ export {
|
|
|
5749
6082
|
tokenCredential,
|
|
5750
6083
|
PharmetikaAPI
|
|
5751
6084
|
};
|
|
5752
|
-
//# sourceMappingURL=chunk-
|
|
6085
|
+
//# sourceMappingURL=chunk-ZAUHRESG.js.map
|