@crvouga/mockingbird-service-stripe 1.11.0 → 1.12.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-5YTYQI7H.js → chunk-PD7VQSPE.js} +2 -2
- package/dist/{chunk-RPSJESGN.js → chunk-ZCMRFOM2.js} +360 -27
- package/dist/chunk-ZCMRFOM2.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-RPSJESGN.js.map +0 -7
- /package/dist/{chunk-5YTYQI7H.js.map → chunk-PD7VQSPE.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-stripe
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.12.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.11.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.11.0 (2026-09-29)
|
|
4
22
|
|
|
5
23
|
### Features
|
|
6
24
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRuntime,
|
|
3
3
|
validateAccounts
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-ZCMRFOM2.js";
|
|
5
5
|
|
|
6
6
|
// src/server.ts
|
|
7
7
|
import { readFileSync } from "node:fs";
|
|
@@ -387,4 +387,4 @@ export {
|
|
|
387
387
|
createServer2 as createServer,
|
|
388
388
|
serveTarget
|
|
389
389
|
};
|
|
390
|
-
//# sourceMappingURL=chunk-
|
|
390
|
+
//# sourceMappingURL=chunk-PD7VQSPE.js.map
|
|
@@ -1926,6 +1926,167 @@ function faultPresetList(value) {
|
|
|
1926
1926
|
})
|
|
1927
1927
|
};
|
|
1928
1928
|
}
|
|
1929
|
+
function mountSqlExplorer(root, api) {
|
|
1930
|
+
const cell = (value) => {
|
|
1931
|
+
if (value === null || value === void 0)
|
|
1932
|
+
return "";
|
|
1933
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1934
|
+
return String(value);
|
|
1935
|
+
}
|
|
1936
|
+
return JSON.stringify(value) ?? "";
|
|
1937
|
+
};
|
|
1938
|
+
root.replaceChildren();
|
|
1939
|
+
const layout = document.createElement("div");
|
|
1940
|
+
layout.className = "sql-layout";
|
|
1941
|
+
const tables = document.createElement("div");
|
|
1942
|
+
tables.className = "sql-tables";
|
|
1943
|
+
const stack = document.createElement("div");
|
|
1944
|
+
stack.className = "stack";
|
|
1945
|
+
const banner = document.createElement("p");
|
|
1946
|
+
banner.className = "banner";
|
|
1947
|
+
const grid = document.createElement("div");
|
|
1948
|
+
const input = document.createElement("textarea");
|
|
1949
|
+
input.className = "sql-input";
|
|
1950
|
+
input.spellcheck = false;
|
|
1951
|
+
input.placeholder = "SELECT * FROM ...";
|
|
1952
|
+
const actions = document.createElement("div");
|
|
1953
|
+
actions.className = "row-actions";
|
|
1954
|
+
const run = document.createElement("button");
|
|
1955
|
+
run.type = "button";
|
|
1956
|
+
run.textContent = "Run";
|
|
1957
|
+
actions.append(run);
|
|
1958
|
+
const result = document.createElement("pre");
|
|
1959
|
+
stack.append(banner, grid, input, actions, result);
|
|
1960
|
+
layout.append(tables, stack);
|
|
1961
|
+
root.append(layout);
|
|
1962
|
+
const showError = (error) => {
|
|
1963
|
+
banner.textContent = error instanceof Error ? error.message : String(error);
|
|
1964
|
+
banner.classList.add("show");
|
|
1965
|
+
};
|
|
1966
|
+
const clearError = () => {
|
|
1967
|
+
banner.textContent = "";
|
|
1968
|
+
banner.classList.remove("show");
|
|
1969
|
+
};
|
|
1970
|
+
const renderGrid = (columns, rows) => {
|
|
1971
|
+
grid.replaceChildren();
|
|
1972
|
+
if (columns.length === 0) {
|
|
1973
|
+
const empty = document.createElement("p");
|
|
1974
|
+
empty.className = "empty";
|
|
1975
|
+
empty.textContent = "No rows.";
|
|
1976
|
+
grid.append(empty);
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
const table = document.createElement("table");
|
|
1980
|
+
const head = document.createElement("thead");
|
|
1981
|
+
const headRow = document.createElement("tr");
|
|
1982
|
+
for (const column of columns) {
|
|
1983
|
+
const th = document.createElement("th");
|
|
1984
|
+
th.textContent = column;
|
|
1985
|
+
headRow.append(th);
|
|
1986
|
+
}
|
|
1987
|
+
head.append(headRow);
|
|
1988
|
+
const body = document.createElement("tbody");
|
|
1989
|
+
for (const row of rows) {
|
|
1990
|
+
const tr = document.createElement("tr");
|
|
1991
|
+
for (const column of columns) {
|
|
1992
|
+
const td = document.createElement("td");
|
|
1993
|
+
td.dataset.label = column;
|
|
1994
|
+
td.textContent = cell(row[column]);
|
|
1995
|
+
tr.append(td);
|
|
1996
|
+
}
|
|
1997
|
+
body.append(tr);
|
|
1998
|
+
}
|
|
1999
|
+
table.append(head, body);
|
|
2000
|
+
grid.append(table);
|
|
2001
|
+
};
|
|
2002
|
+
const rowsOf = (value) => {
|
|
2003
|
+
if (!isRecord2(value) || !Array.isArray(value.rows))
|
|
2004
|
+
return [];
|
|
2005
|
+
return value.rows.flatMap((row) => isRecord2(row) ? [row] : []);
|
|
2006
|
+
};
|
|
2007
|
+
const columnsOf = (value, rows) => {
|
|
2008
|
+
if (isRecord2(value) && Array.isArray(value.columns)) {
|
|
2009
|
+
const named = value.columns.flatMap((column) => typeof column === "string" ? [column] : []);
|
|
2010
|
+
if (named.length > 0)
|
|
2011
|
+
return named;
|
|
2012
|
+
}
|
|
2013
|
+
const first = rows[0];
|
|
2014
|
+
return first === void 0 ? [] : Object.keys(first);
|
|
2015
|
+
};
|
|
2016
|
+
let selected = "";
|
|
2017
|
+
const loadPage = async (schema, name) => {
|
|
2018
|
+
selected = `${schema}.${name}`;
|
|
2019
|
+
const page = await api.get(`/sql/tables/${encodeURIComponent(schema)}/${encodeURIComponent(name)}?limit=50`);
|
|
2020
|
+
const rows = rowsOf(page);
|
|
2021
|
+
renderGrid(columnsOf(page, rows), rows);
|
|
2022
|
+
const total = isRecord2(page) && typeof page.total === "number" ? page.total : rows.length;
|
|
2023
|
+
result.textContent = `${selected} \xB7 ${total} rows`;
|
|
2024
|
+
for (const button of tables.querySelectorAll("button")) {
|
|
2025
|
+
if (!(button instanceof HTMLButtonElement))
|
|
2026
|
+
continue;
|
|
2027
|
+
button.setAttribute("aria-current", button.dataset.schema === schema && button.dataset.table === name ? "true" : "false");
|
|
2028
|
+
}
|
|
2029
|
+
};
|
|
2030
|
+
const loadTables = async () => {
|
|
2031
|
+
const payload = await api.get("/sql/tables");
|
|
2032
|
+
const listed = isRecord2(payload) && Array.isArray(payload.tables) ? payload.tables : [];
|
|
2033
|
+
tables.replaceChildren();
|
|
2034
|
+
if (listed.length === 0) {
|
|
2035
|
+
const empty = document.createElement("p");
|
|
2036
|
+
empty.className = "empty";
|
|
2037
|
+
empty.textContent = "No tables.";
|
|
2038
|
+
tables.append(empty);
|
|
2039
|
+
return;
|
|
2040
|
+
}
|
|
2041
|
+
for (const item of listed) {
|
|
2042
|
+
if (!isRecord2(item) || typeof item.schema !== "string" || typeof item.name !== "string")
|
|
2043
|
+
continue;
|
|
2044
|
+
const button = document.createElement("button");
|
|
2045
|
+
button.type = "button";
|
|
2046
|
+
button.dataset.schema = item.schema;
|
|
2047
|
+
button.dataset.table = item.name;
|
|
2048
|
+
button.textContent = `${item.schema}.${item.name}`;
|
|
2049
|
+
tables.append(button);
|
|
2050
|
+
}
|
|
2051
|
+
};
|
|
2052
|
+
tables.addEventListener("click", (event) => {
|
|
2053
|
+
const target = event.target;
|
|
2054
|
+
if (!(target instanceof Element))
|
|
2055
|
+
return;
|
|
2056
|
+
const button = target.closest("button");
|
|
2057
|
+
if (!(button instanceof HTMLButtonElement))
|
|
2058
|
+
return;
|
|
2059
|
+
const schema = button.dataset.schema;
|
|
2060
|
+
const name = button.dataset.table;
|
|
2061
|
+
if (schema === void 0 || name === void 0)
|
|
2062
|
+
return;
|
|
2063
|
+
clearError();
|
|
2064
|
+
loadPage(schema, name).catch(showError);
|
|
2065
|
+
});
|
|
2066
|
+
run.addEventListener("click", () => {
|
|
2067
|
+
const sql = input.value.trim();
|
|
2068
|
+
if (sql === "") {
|
|
2069
|
+
showError(new Error("Enter a statement"));
|
|
2070
|
+
return;
|
|
2071
|
+
}
|
|
2072
|
+
clearError();
|
|
2073
|
+
api.send("POST", "/sql/query", { sql }).then((payload) => {
|
|
2074
|
+
const rows = rowsOf(payload);
|
|
2075
|
+
renderGrid(columnsOf(payload, rows), rows);
|
|
2076
|
+
const count = isRecord2(payload) && typeof payload.rowCount === "number" ? payload.rowCount : rows.length;
|
|
2077
|
+
const truncated = isRecord2(payload) && payload.truncated === true ? " (truncated)" : "";
|
|
2078
|
+
result.textContent = `${count} rows${truncated}`;
|
|
2079
|
+
}).catch(showError);
|
|
2080
|
+
});
|
|
2081
|
+
const namespace = document.getElementById("namespace");
|
|
2082
|
+
if (namespace) {
|
|
2083
|
+
namespace.addEventListener("change", () => {
|
|
2084
|
+
clearError();
|
|
2085
|
+
loadTables().catch(showError);
|
|
2086
|
+
});
|
|
2087
|
+
}
|
|
2088
|
+
loadTables().catch(showError);
|
|
2089
|
+
}
|
|
1929
2090
|
function bootAdmin(config) {
|
|
1930
2091
|
const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
1931
2092
|
const sources = ["declared", "inferred", "mixed"];
|
|
@@ -2366,6 +2527,50 @@ function bootAdmin(config) {
|
|
|
2366
2527
|
if (render3)
|
|
2367
2528
|
await render3();
|
|
2368
2529
|
}
|
|
2530
|
+
const delay = (ms) => new Promise((resolve2) => {
|
|
2531
|
+
window.setTimeout(resolve2, ms);
|
|
2532
|
+
});
|
|
2533
|
+
const confirmAction = async (button, pending, done, work) => {
|
|
2534
|
+
if (button.dataset.pending === "1")
|
|
2535
|
+
return;
|
|
2536
|
+
const label = button.textContent ?? "";
|
|
2537
|
+
const width = button.offsetWidth;
|
|
2538
|
+
button.dataset.pending = "1";
|
|
2539
|
+
button.classList.add("pressed");
|
|
2540
|
+
button.setAttribute("aria-busy", "true");
|
|
2541
|
+
button.style.minWidth = `${width}px`;
|
|
2542
|
+
button.textContent = pending;
|
|
2543
|
+
try {
|
|
2544
|
+
await work();
|
|
2545
|
+
button.textContent = done;
|
|
2546
|
+
await delay(1e3);
|
|
2547
|
+
} catch (error) {
|
|
2548
|
+
showError(error);
|
|
2549
|
+
} finally {
|
|
2550
|
+
button.textContent = label;
|
|
2551
|
+
button.style.minWidth = "";
|
|
2552
|
+
button.classList.remove("pressed");
|
|
2553
|
+
button.removeAttribute("aria-busy");
|
|
2554
|
+
delete button.dataset.pending;
|
|
2555
|
+
}
|
|
2556
|
+
};
|
|
2557
|
+
document.addEventListener("click", (event) => {
|
|
2558
|
+
const target = event.target;
|
|
2559
|
+
if (!(target instanceof Element))
|
|
2560
|
+
return;
|
|
2561
|
+
const button = target.closest("button");
|
|
2562
|
+
if (!(button instanceof HTMLButtonElement) || button.dataset.pending === "1")
|
|
2563
|
+
return;
|
|
2564
|
+
button.classList.add("pressed");
|
|
2565
|
+
const token = String(Date.now());
|
|
2566
|
+
button.dataset.press = token;
|
|
2567
|
+
window.setTimeout(() => {
|
|
2568
|
+
if (button.dataset.press !== token || button.dataset.pending === "1")
|
|
2569
|
+
return;
|
|
2570
|
+
button.classList.remove("pressed");
|
|
2571
|
+
delete button.dataset.press;
|
|
2572
|
+
}, 450);
|
|
2573
|
+
});
|
|
2369
2574
|
el("namespace", HTMLSelectElement).addEventListener("change", () => {
|
|
2370
2575
|
state.namespace = el("namespace", HTMLSelectElement).value;
|
|
2371
2576
|
refresh().catch(showError);
|
|
@@ -2376,7 +2581,7 @@ function bootAdmin(config) {
|
|
|
2376
2581
|
refresh().catch(showError);
|
|
2377
2582
|
});
|
|
2378
2583
|
el("refresh", HTMLButtonElement).addEventListener("click", () => {
|
|
2379
|
-
refresh().catch(showError);
|
|
2584
|
+
confirmAction(el("refresh", HTMLButtonElement), "Refreshing...", "Updated", () => refresh()).catch(showError);
|
|
2380
2585
|
});
|
|
2381
2586
|
el("collections", HTMLElement).addEventListener("click", (event) => {
|
|
2382
2587
|
const target = event.target;
|
|
@@ -2499,10 +2704,10 @@ function bootAdmin(config) {
|
|
|
2499
2704
|
}).then(() => renderFaults()).catch(showError);
|
|
2500
2705
|
});
|
|
2501
2706
|
el("fault-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2502
|
-
api("DELETE", "/faults").then(() => renderFaults()).catch(showError);
|
|
2707
|
+
confirmAction(el("fault-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/faults").then(() => renderFaults())).catch(showError);
|
|
2503
2708
|
});
|
|
2504
2709
|
el("journal-clear", HTMLButtonElement).addEventListener("click", () => {
|
|
2505
|
-
api("DELETE", "/requests").then(() => renderJournal()).catch(showError);
|
|
2710
|
+
confirmAction(el("journal-clear", HTMLButtonElement), "Clearing...", "Cleared", () => api("DELETE", "/requests").then(() => renderJournal())).catch(showError);
|
|
2506
2711
|
});
|
|
2507
2712
|
el("route-list", HTMLElement).addEventListener("click", (event) => {
|
|
2508
2713
|
const target = event.target;
|
|
@@ -2558,6 +2763,22 @@ function bootAdmin(config) {
|
|
|
2558
2763
|
panel.script = value.script;
|
|
2559
2764
|
return panel;
|
|
2560
2765
|
};
|
|
2766
|
+
const decodeExtension = (value) => {
|
|
2767
|
+
if (!isRecord2(value))
|
|
2768
|
+
return void 0;
|
|
2769
|
+
if (value.kind === "sql") {
|
|
2770
|
+
return {
|
|
2771
|
+
kind: "sql",
|
|
2772
|
+
id: typeof value.id === "string" && value.id !== "" ? value.id : "sql",
|
|
2773
|
+
title: typeof value.title === "string" && value.title !== "" ? value.title : "SQL",
|
|
2774
|
+
description: typeof value.description === "string" ? value.description : "Browse tables and run queries."
|
|
2775
|
+
};
|
|
2776
|
+
}
|
|
2777
|
+
if (value.kind !== "panel")
|
|
2778
|
+
return void 0;
|
|
2779
|
+
const panel = decodePanel(value);
|
|
2780
|
+
return panel === void 0 ? void 0 : { kind: "panel", ...panel };
|
|
2781
|
+
};
|
|
2561
2782
|
const mountPanels = (panels) => {
|
|
2562
2783
|
const nav = el("nav", HTMLElement);
|
|
2563
2784
|
const views = el("views", HTMLElement);
|
|
@@ -2611,15 +2832,57 @@ function bootAdmin(config) {
|
|
|
2611
2832
|
return decoded === void 0 ? [] : [decoded];
|
|
2612
2833
|
});
|
|
2613
2834
|
mountPanels(panels);
|
|
2835
|
+
const extensions = requireList(isRecord2(manifest) ? manifest.extensions : void 0, "Extensions").flatMap((extension) => {
|
|
2836
|
+
const decoded = decodeExtension(extension);
|
|
2837
|
+
return decoded === void 0 ? [] : [decoded];
|
|
2838
|
+
});
|
|
2839
|
+
const extensionPanels = extensions.flatMap((extension) => extension.kind === "panel" ? [extension] : []);
|
|
2840
|
+
mountPanels(extensionPanels);
|
|
2841
|
+
for (const extension of extensions) {
|
|
2842
|
+
if (extension.kind !== "sql")
|
|
2843
|
+
continue;
|
|
2844
|
+
const nav = el("nav", HTMLElement);
|
|
2845
|
+
const views = el("views", HTMLElement);
|
|
2846
|
+
const button = document.createElement("button");
|
|
2847
|
+
button.type = "button";
|
|
2848
|
+
button.dataset.view = extension.id;
|
|
2849
|
+
button.textContent = extension.title;
|
|
2850
|
+
nav.append(button);
|
|
2851
|
+
const section = document.createElement("section");
|
|
2852
|
+
section.className = "view";
|
|
2853
|
+
section.id = `view-${extension.id}`;
|
|
2854
|
+
section.hidden = true;
|
|
2855
|
+
const title = document.createElement("h2");
|
|
2856
|
+
title.textContent = extension.title;
|
|
2857
|
+
const lede = document.createElement("p");
|
|
2858
|
+
lede.className = "lede";
|
|
2859
|
+
lede.textContent = extension.description;
|
|
2860
|
+
const body = document.createElement("div");
|
|
2861
|
+
body.className = "panel-body";
|
|
2862
|
+
section.append(title, lede, body);
|
|
2863
|
+
views.append(section);
|
|
2864
|
+
mountSqlExplorer(body, panelApi);
|
|
2865
|
+
}
|
|
2614
2866
|
return refresh();
|
|
2615
2867
|
}).catch(showError);
|
|
2616
2868
|
}
|
|
2617
|
-
var clientPrelude = [
|
|
2869
|
+
var clientPrelude = [
|
|
2870
|
+
isRecord2,
|
|
2871
|
+
mountAdminBrand,
|
|
2872
|
+
startAdminBrand,
|
|
2873
|
+
faultPresetList,
|
|
2874
|
+
mountSqlExplorer,
|
|
2875
|
+
bootAdmin
|
|
2876
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2618
2877
|
var adminClientSource = (config) => {
|
|
2619
2878
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2879
|
+
const entry = bootAdmin.name;
|
|
2880
|
+
if (!/^[A-Za-z_$][\w$]*$/.test(entry)) {
|
|
2881
|
+
throw new Error("admin client cannot call its boot function");
|
|
2882
|
+
}
|
|
2620
2883
|
return `<script>
|
|
2621
2884
|
${clientPrelude}
|
|
2622
|
-
|
|
2885
|
+
${entry}(${payload});
|
|
2623
2886
|
</script>`;
|
|
2624
2887
|
};
|
|
2625
2888
|
|
|
@@ -2660,19 +2923,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2660
2923
|
"GET /ui/manifest"
|
|
2661
2924
|
];
|
|
2662
2925
|
var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
2926
|
+
var RESERVED_VIEWS = /* @__PURE__ */ new Set(["overview", "state", "clock", "faults", "journal", "routes"]);
|
|
2927
|
+
var checkPanel = (panel, seen, label) => {
|
|
2928
|
+
if (!PANEL_ID.test(panel.id)) {
|
|
2929
|
+
throw new RangeError(`${label} id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
|
|
2930
|
+
}
|
|
2931
|
+
if (RESERVED_VIEWS.has(panel.id)) {
|
|
2932
|
+
throw new RangeError(`${label} id ${panel.id} is reserved by the admin shell`);
|
|
2933
|
+
}
|
|
2934
|
+
if (seen.has(panel.id))
|
|
2935
|
+
throw new RangeError(`duplicate admin view id ${panel.id}`);
|
|
2936
|
+
seen.add(panel.id);
|
|
2937
|
+
if (panel.title.trim() === "")
|
|
2938
|
+
throw new RangeError(`${label} ${panel.id} needs a title`);
|
|
2939
|
+
};
|
|
2663
2940
|
var assertAdminUi = (ui) => {
|
|
2664
|
-
if (!ui
|
|
2941
|
+
if (!ui)
|
|
2665
2942
|
return;
|
|
2666
2943
|
const seen = /* @__PURE__ */ new Set();
|
|
2667
|
-
for (const panel of ui.panels)
|
|
2668
|
-
|
|
2669
|
-
|
|
2944
|
+
for (const panel of ui.panels ?? [])
|
|
2945
|
+
checkPanel(panel, seen, "admin panel");
|
|
2946
|
+
for (const extension of ui.extensions ?? []) {
|
|
2947
|
+
if (extension.kind === "panel") {
|
|
2948
|
+
checkPanel(extension, seen, "admin extension");
|
|
2949
|
+
continue;
|
|
2670
2950
|
}
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
seen.add(panel.id);
|
|
2674
|
-
if (panel.title.trim() === "")
|
|
2675
|
-
throw new RangeError(`admin panel ${panel.id} needs a title`);
|
|
2951
|
+
const id = extension.id ?? "sql";
|
|
2952
|
+
checkPanel({ id, title: extension.title ?? "SQL" }, seen, "admin extension");
|
|
2676
2953
|
}
|
|
2677
2954
|
};
|
|
2678
2955
|
|
|
@@ -2833,9 +3110,24 @@ var renderAdminDocument = (service) => {
|
|
|
2833
3110
|
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
|
2834
3111
|
label.field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--faint); }
|
|
2835
3112
|
label.field input, label.field select, .controls input[type="password"] {
|
|
2836
|
-
background: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
2837
|
-
padding: 7px 8px; min-height: 36px;
|
|
2838
|
-
}
|
|
3113
|
+
background-color: var(--bg-inset); border: 1px solid var(--line); border-radius: 8px;
|
|
3114
|
+
padding: 7px 8px; min-height: 36px; line-height: 1.2;
|
|
3115
|
+
}
|
|
3116
|
+
/* A native menu ignores min-height, so Preset rendered about half as tall as
|
|
3117
|
+
the text fields in the same form. Paint it like those fields. */
|
|
3118
|
+
label.field select {
|
|
3119
|
+
-webkit-appearance: none; appearance: none;
|
|
3120
|
+
padding-right: 28px;
|
|
3121
|
+
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");
|
|
3122
|
+
background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px;
|
|
3123
|
+
}
|
|
3124
|
+
.stack > .field > input,
|
|
3125
|
+
.stack > .field > select,
|
|
3126
|
+
.stack > .field > textarea,
|
|
3127
|
+
dialog .field > input,
|
|
3128
|
+
dialog .field > select,
|
|
3129
|
+
dialog .field > textarea { width: 100%; }
|
|
3130
|
+
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger, nav.side button { cursor: pointer; }
|
|
2839
3131
|
.icon-btn, .btn, .btn-primary, .btn-quiet, .btn-danger {
|
|
2840
3132
|
border-radius: 9px; min-height: 36px; padding: 0 12px; border: 1px solid var(--line);
|
|
2841
3133
|
background: var(--bg-elev);
|
|
@@ -2843,6 +3135,14 @@ var renderAdminDocument = (service) => {
|
|
|
2843
3135
|
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
|
|
2844
3136
|
.btn-quiet { background: transparent; }
|
|
2845
3137
|
.btn-danger { color: var(--err); }
|
|
3138
|
+
/* Held after mouseup. Clearing an empty journal changes nothing on screen,
|
|
3139
|
+
so the press itself has to stay visible. */
|
|
3140
|
+
.icon-btn:active, .btn:active, .btn-quiet:active, .btn-danger:active, nav.side button:active,
|
|
3141
|
+
.icon-btn.pressed, .btn.pressed, .btn-quiet.pressed, .btn-danger.pressed, nav.side button.pressed {
|
|
3142
|
+
background: var(--bg-inset); border-color: var(--line-strong); color: var(--ink);
|
|
3143
|
+
}
|
|
3144
|
+
.btn-danger:active, .btn-danger.pressed { background: var(--err-soft); color: var(--err); }
|
|
3145
|
+
.btn-primary:active, .btn-primary.pressed { filter: brightness(0.88); color: var(--accent-ink); }
|
|
2846
3146
|
/* minmax(0, 1fr): a 1fr column will not shrink below its content, so a long
|
|
2847
3147
|
record or the full nav row would widen the page past the viewport. */
|
|
2848
3148
|
.layout {
|
|
@@ -2883,6 +3183,12 @@ var renderAdminDocument = (service) => {
|
|
|
2883
3183
|
border-radius: 999px; padding: 4px 8px;
|
|
2884
3184
|
}
|
|
2885
3185
|
.chip i { color: var(--faint); font-style: normal; }
|
|
3186
|
+
.sql-layout {
|
|
3187
|
+
display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 16px;
|
|
3188
|
+
}
|
|
3189
|
+
.sql-tables { display: flex; flex-direction: column; gap: 4px; max-height: 28rem; overflow: auto; }
|
|
3190
|
+
.sql-tables button { text-align: left; }
|
|
3191
|
+
.sql-input { font-family: var(--mono); min-height: 7rem; width: 100%; }
|
|
2886
3192
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2887
3193
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2888
3194
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -2931,14 +3237,22 @@ var renderAdminDocument = (service) => {
|
|
|
2931
3237
|
input, select, textarea { font-size: 16px; }
|
|
2932
3238
|
.brand, .vendor, .controls { width: 100%; }
|
|
2933
3239
|
label.field, label.field select, label.field input { flex: 1; min-width: 0; }
|
|
2934
|
-
|
|
3240
|
+
/* The layout fills the screen. A single-column grid stretches every auto
|
|
3241
|
+
row, so the tab bar grew with the leftover height and the buttons floated
|
|
3242
|
+
in the middle of it. The bar stays one row; the page below takes the rest. */
|
|
3243
|
+
.layout {
|
|
3244
|
+
grid-template-columns: minmax(0, 1fr);
|
|
3245
|
+
grid-template-rows: auto minmax(0, 1fr);
|
|
3246
|
+
align-content: start;
|
|
3247
|
+
}
|
|
2935
3248
|
nav.side {
|
|
3249
|
+
align-self: start; height: auto;
|
|
2936
3250
|
flex-direction: row; align-items: center; overflow-x: auto; min-width: 0;
|
|
2937
3251
|
border-right: 0; border-bottom: 1px solid var(--line);
|
|
2938
3252
|
padding: 8px;
|
|
2939
3253
|
}
|
|
2940
3254
|
nav.side button { white-space: nowrap; flex: none; }
|
|
2941
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
3255
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
2942
3256
|
main { padding: 14px; }
|
|
2943
3257
|
table, thead, tbody, tr, th, td { display: block; }
|
|
2944
3258
|
thead { display: none; }
|
|
@@ -3109,6 +3423,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
3109
3423
|
status: 200,
|
|
3110
3424
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
3111
3425
|
});
|
|
3426
|
+
var describeExtension = (extension) => {
|
|
3427
|
+
if (extension.kind === "sql") {
|
|
3428
|
+
return {
|
|
3429
|
+
kind: "sql",
|
|
3430
|
+
id: extension.id ?? "sql",
|
|
3431
|
+
title: extension.title ?? "SQL",
|
|
3432
|
+
...extension.description !== void 0 ? { description: extension.description } : {}
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
return {
|
|
3436
|
+
kind: "panel",
|
|
3437
|
+
id: extension.id,
|
|
3438
|
+
title: extension.title,
|
|
3439
|
+
...extension.description !== void 0 ? { description: extension.description } : {},
|
|
3440
|
+
html: extension.html,
|
|
3441
|
+
...extension.script !== void 0 ? { script: extension.script } : {}
|
|
3442
|
+
};
|
|
3443
|
+
};
|
|
3112
3444
|
var adminUiRoutes = (service, ui) => {
|
|
3113
3445
|
const shell = () => renderAdminDocument(service);
|
|
3114
3446
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -3123,7 +3455,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
3123
3455
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
3124
3456
|
html: panel.html,
|
|
3125
3457
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
3126
|
-
}))
|
|
3458
|
+
})),
|
|
3459
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
3127
3460
|
})
|
|
3128
3461
|
};
|
|
3129
3462
|
};
|
|
@@ -3726,7 +4059,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3726
4059
|
};
|
|
3727
4060
|
|
|
3728
4061
|
// ../core/dist/version.js
|
|
3729
|
-
var PACKAGE_VERSION = true ? "1.
|
|
4062
|
+
var PACKAGE_VERSION = true ? "1.12.0" : UNRELEASED_VERSION;
|
|
3730
4063
|
|
|
3731
4064
|
// ../core/dist/signing.js
|
|
3732
4065
|
var encoder = new TextEncoder();
|
|
@@ -10911,11 +11244,11 @@ var searchRecords = (records, params, options) => {
|
|
|
10911
11244
|
params.page
|
|
10912
11245
|
);
|
|
10913
11246
|
const offset = page === null ? 0 : Number(page[1]);
|
|
10914
|
-
const
|
|
11247
|
+
const window2 = matched.slice(offset, offset + limit);
|
|
10915
11248
|
const more = matched.length > offset + limit;
|
|
10916
11249
|
return {
|
|
10917
11250
|
object: "search_result",
|
|
10918
|
-
data:
|
|
11251
|
+
data: window2.map(options.render),
|
|
10919
11252
|
has_more: more,
|
|
10920
11253
|
next_page: more ? `page_${offset + limit}` : null,
|
|
10921
11254
|
...expandPathsOf(params.expand).includes("total_count") ? { total_count: matched.length } : {},
|
|
@@ -14167,11 +14500,11 @@ var invoiceHandlers = (services) => {
|
|
|
14167
14500
|
const cursor = stringOf(params, "starting_after");
|
|
14168
14501
|
const found = cursor === null ? 0 : data.findIndex((line) => line.id === cursor) + 1;
|
|
14169
14502
|
const from = Math.max(0, found);
|
|
14170
|
-
const
|
|
14503
|
+
const window2 = data.slice(from, from + limit);
|
|
14171
14504
|
return jsonRes(200, {
|
|
14172
14505
|
object: "list",
|
|
14173
|
-
data:
|
|
14174
|
-
has_more: from +
|
|
14506
|
+
data: window2,
|
|
14507
|
+
has_more: from + window2.length < data.length,
|
|
14175
14508
|
url: `/v1/invoices/${invoice.id}/lines`
|
|
14176
14509
|
});
|
|
14177
14510
|
},
|
|
@@ -19873,4 +20206,4 @@ export {
|
|
|
19873
20206
|
createRuntime2 as createRuntime,
|
|
19874
20207
|
StripeAPI
|
|
19875
20208
|
};
|
|
19876
|
-
//# sourceMappingURL=chunk-
|
|
20209
|
+
//# sourceMappingURL=chunk-ZCMRFOM2.js.map
|