@crvouga/mockingbird-service-stripe 1.11.1 → 1.12.1
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 +12 -0
- package/dist/{chunk-EINNHTOB.js → chunk-KRP5BJPJ.js} +270 -16
- package/dist/chunk-KRP5BJPJ.js.map +7 -0
- package/dist/{chunk-NTTU6ZMY.js → chunk-VKC5HKFL.js} +2 -2
- 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-EINNHTOB.js.map +0 -7
- /package/dist/{chunk-NTTU6ZMY.js.map → chunk-VKC5HKFL.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-stripe
|
|
2
2
|
|
|
3
|
+
## 1.12.1 (2026-10-01)
|
|
4
|
+
|
|
5
|
+
### Fixes and improvements
|
|
6
|
+
|
|
7
|
+
- freeze clock before setting time ([a054a1d](https://github.com/crvouga/mockingbird/commit/a054a1defad62539d719b1d31c15107afea623bd))
|
|
8
|
+
|
|
9
|
+
## 1.12.0 (2026-09-30)
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
- record SQL timelines and serve the admin explorer ([8ced17a](https://github.com/crvouga/mockingbird/commit/8ced17ac398e386ef4e9d7e01fc7744c34b95d07))
|
|
14
|
+
|
|
3
15
|
## 1.11.1 (2026-09-30)
|
|
4
16
|
|
|
5
17
|
### Fixes and improvements
|
|
@@ -189,6 +189,8 @@ var createControlPlane = (context) => {
|
|
|
189
189
|
return adminError(400, "expected a JSON object");
|
|
190
190
|
if (body.reset === true)
|
|
191
191
|
context.clock.reset();
|
|
192
|
+
if (body.freeze === true)
|
|
193
|
+
context.clock.freeze();
|
|
192
194
|
if (body.set !== void 0) {
|
|
193
195
|
const instant = parseInstant(body.set);
|
|
194
196
|
if (instant === void 0)
|
|
@@ -201,8 +203,6 @@ var createControlPlane = (context) => {
|
|
|
201
203
|
return adminError(400, 'advance: expected ms or "15m"-style');
|
|
202
204
|
context.clock.advance(delta);
|
|
203
205
|
}
|
|
204
|
-
if (body.freeze === true)
|
|
205
|
-
context.clock.freeze();
|
|
206
206
|
if (body.freeze === false)
|
|
207
207
|
context.clock.unfreeze();
|
|
208
208
|
return json(200, context.clock.state());
|
|
@@ -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"];
|
|
@@ -2602,6 +2763,22 @@ function bootAdmin(config) {
|
|
|
2602
2763
|
panel.script = value.script;
|
|
2603
2764
|
return panel;
|
|
2604
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
|
+
};
|
|
2605
2782
|
const mountPanels = (panels) => {
|
|
2606
2783
|
const nav = el("nav", HTMLElement);
|
|
2607
2784
|
const views = el("views", HTMLElement);
|
|
@@ -2655,10 +2832,48 @@ function bootAdmin(config) {
|
|
|
2655
2832
|
return decoded === void 0 ? [] : [decoded];
|
|
2656
2833
|
});
|
|
2657
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
|
+
}
|
|
2658
2866
|
return refresh();
|
|
2659
2867
|
}).catch(showError);
|
|
2660
2868
|
}
|
|
2661
|
-
var clientPrelude = [
|
|
2869
|
+
var clientPrelude = [
|
|
2870
|
+
isRecord2,
|
|
2871
|
+
mountAdminBrand,
|
|
2872
|
+
startAdminBrand,
|
|
2873
|
+
faultPresetList,
|
|
2874
|
+
mountSqlExplorer,
|
|
2875
|
+
bootAdmin
|
|
2876
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2662
2877
|
var adminClientSource = (config) => {
|
|
2663
2878
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2664
2879
|
const entry = bootAdmin.name;
|
|
@@ -2708,19 +2923,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2708
2923
|
"GET /ui/manifest"
|
|
2709
2924
|
];
|
|
2710
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
|
+
};
|
|
2711
2940
|
var assertAdminUi = (ui) => {
|
|
2712
|
-
if (!ui
|
|
2941
|
+
if (!ui)
|
|
2713
2942
|
return;
|
|
2714
2943
|
const seen = /* @__PURE__ */ new Set();
|
|
2715
|
-
for (const panel of ui.panels)
|
|
2716
|
-
|
|
2717
|
-
|
|
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;
|
|
2718
2950
|
}
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
seen.add(panel.id);
|
|
2722
|
-
if (panel.title.trim() === "")
|
|
2723
|
-
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");
|
|
2724
2953
|
}
|
|
2725
2954
|
};
|
|
2726
2955
|
|
|
@@ -2954,6 +3183,12 @@ var renderAdminDocument = (service) => {
|
|
|
2954
3183
|
border-radius: 999px; padding: 4px 8px;
|
|
2955
3184
|
}
|
|
2956
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%; }
|
|
2957
3192
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2958
3193
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2959
3194
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -3017,7 +3252,7 @@ var renderAdminDocument = (service) => {
|
|
|
3017
3252
|
padding: 8px;
|
|
3018
3253
|
}
|
|
3019
3254
|
nav.side button { white-space: nowrap; flex: none; }
|
|
3020
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
3255
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
3021
3256
|
main { padding: 14px; }
|
|
3022
3257
|
table, thead, tbody, tr, th, td { display: block; }
|
|
3023
3258
|
thead { display: none; }
|
|
@@ -3188,6 +3423,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
3188
3423
|
status: 200,
|
|
3189
3424
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
3190
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
|
+
};
|
|
3191
3444
|
var adminUiRoutes = (service, ui) => {
|
|
3192
3445
|
const shell = () => renderAdminDocument(service);
|
|
3193
3446
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -3202,7 +3455,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
3202
3455
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
3203
3456
|
html: panel.html,
|
|
3204
3457
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
3205
|
-
}))
|
|
3458
|
+
})),
|
|
3459
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
3206
3460
|
})
|
|
3207
3461
|
};
|
|
3208
3462
|
};
|
|
@@ -3805,7 +4059,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3805
4059
|
};
|
|
3806
4060
|
|
|
3807
4061
|
// ../core/dist/version.js
|
|
3808
|
-
var PACKAGE_VERSION = true ? "1.
|
|
4062
|
+
var PACKAGE_VERSION = true ? "1.12.1" : UNRELEASED_VERSION;
|
|
3809
4063
|
|
|
3810
4064
|
// ../core/dist/signing.js
|
|
3811
4065
|
var encoder = new TextEncoder();
|
|
@@ -19952,4 +20206,4 @@ export {
|
|
|
19952
20206
|
createRuntime2 as createRuntime,
|
|
19953
20207
|
StripeAPI
|
|
19954
20208
|
};
|
|
19955
|
-
//# sourceMappingURL=chunk-
|
|
20209
|
+
//# sourceMappingURL=chunk-KRP5BJPJ.js.map
|