@crvouga/mockingbird-service-aws-speech 1.6.1 → 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 +10 -0
- package/dist/{chunk-BNMCHWY6.js → chunk-4VZZ5XPO.js} +268 -14
- package/dist/chunk-4VZZ5XPO.js.map +7 -0
- package/dist/{chunk-GIB672WX.js → chunk-NPNXXH46.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-BNMCHWY6.js.map +0 -7
- /package/dist/{chunk-GIB672WX.js.map → chunk-NPNXXH46.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-aws-speech
|
|
2
2
|
|
|
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
|
+
|
|
3
13
|
## 1.6.1 (2026-09-30)
|
|
4
14
|
|
|
5
15
|
### Fixes and improvements
|
|
@@ -1656,6 +1656,167 @@ function faultPresetList(value) {
|
|
|
1656
1656
|
})
|
|
1657
1657
|
};
|
|
1658
1658
|
}
|
|
1659
|
+
function mountSqlExplorer(root, api) {
|
|
1660
|
+
const cell = (value) => {
|
|
1661
|
+
if (value === null || value === void 0)
|
|
1662
|
+
return "";
|
|
1663
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1664
|
+
return String(value);
|
|
1665
|
+
}
|
|
1666
|
+
return JSON.stringify(value) ?? "";
|
|
1667
|
+
};
|
|
1668
|
+
root.replaceChildren();
|
|
1669
|
+
const layout = document.createElement("div");
|
|
1670
|
+
layout.className = "sql-layout";
|
|
1671
|
+
const tables = document.createElement("div");
|
|
1672
|
+
tables.className = "sql-tables";
|
|
1673
|
+
const stack = document.createElement("div");
|
|
1674
|
+
stack.className = "stack";
|
|
1675
|
+
const banner = document.createElement("p");
|
|
1676
|
+
banner.className = "banner";
|
|
1677
|
+
const grid = document.createElement("div");
|
|
1678
|
+
const input = document.createElement("textarea");
|
|
1679
|
+
input.className = "sql-input";
|
|
1680
|
+
input.spellcheck = false;
|
|
1681
|
+
input.placeholder = "SELECT * FROM ...";
|
|
1682
|
+
const actions = document.createElement("div");
|
|
1683
|
+
actions.className = "row-actions";
|
|
1684
|
+
const run = document.createElement("button");
|
|
1685
|
+
run.type = "button";
|
|
1686
|
+
run.textContent = "Run";
|
|
1687
|
+
actions.append(run);
|
|
1688
|
+
const result = document.createElement("pre");
|
|
1689
|
+
stack.append(banner, grid, input, actions, result);
|
|
1690
|
+
layout.append(tables, stack);
|
|
1691
|
+
root.append(layout);
|
|
1692
|
+
const showError = (error) => {
|
|
1693
|
+
banner.textContent = error instanceof Error ? error.message : String(error);
|
|
1694
|
+
banner.classList.add("show");
|
|
1695
|
+
};
|
|
1696
|
+
const clearError = () => {
|
|
1697
|
+
banner.textContent = "";
|
|
1698
|
+
banner.classList.remove("show");
|
|
1699
|
+
};
|
|
1700
|
+
const renderGrid = (columns, rows) => {
|
|
1701
|
+
grid.replaceChildren();
|
|
1702
|
+
if (columns.length === 0) {
|
|
1703
|
+
const empty = document.createElement("p");
|
|
1704
|
+
empty.className = "empty";
|
|
1705
|
+
empty.textContent = "No rows.";
|
|
1706
|
+
grid.append(empty);
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
const table = document.createElement("table");
|
|
1710
|
+
const head = document.createElement("thead");
|
|
1711
|
+
const headRow = document.createElement("tr");
|
|
1712
|
+
for (const column of columns) {
|
|
1713
|
+
const th = document.createElement("th");
|
|
1714
|
+
th.textContent = column;
|
|
1715
|
+
headRow.append(th);
|
|
1716
|
+
}
|
|
1717
|
+
head.append(headRow);
|
|
1718
|
+
const body = document.createElement("tbody");
|
|
1719
|
+
for (const row of rows) {
|
|
1720
|
+
const tr = document.createElement("tr");
|
|
1721
|
+
for (const column of columns) {
|
|
1722
|
+
const td = document.createElement("td");
|
|
1723
|
+
td.dataset.label = column;
|
|
1724
|
+
td.textContent = cell(row[column]);
|
|
1725
|
+
tr.append(td);
|
|
1726
|
+
}
|
|
1727
|
+
body.append(tr);
|
|
1728
|
+
}
|
|
1729
|
+
table.append(head, body);
|
|
1730
|
+
grid.append(table);
|
|
1731
|
+
};
|
|
1732
|
+
const rowsOf = (value) => {
|
|
1733
|
+
if (!isRecord2(value) || !Array.isArray(value.rows))
|
|
1734
|
+
return [];
|
|
1735
|
+
return value.rows.flatMap((row) => isRecord2(row) ? [row] : []);
|
|
1736
|
+
};
|
|
1737
|
+
const columnsOf = (value, rows) => {
|
|
1738
|
+
if (isRecord2(value) && Array.isArray(value.columns)) {
|
|
1739
|
+
const named = value.columns.flatMap((column) => typeof column === "string" ? [column] : []);
|
|
1740
|
+
if (named.length > 0)
|
|
1741
|
+
return named;
|
|
1742
|
+
}
|
|
1743
|
+
const first = rows[0];
|
|
1744
|
+
return first === void 0 ? [] : Object.keys(first);
|
|
1745
|
+
};
|
|
1746
|
+
let selected = "";
|
|
1747
|
+
const loadPage = async (schema, name) => {
|
|
1748
|
+
selected = `${schema}.${name}`;
|
|
1749
|
+
const page = await api.get(`/sql/tables/${encodeURIComponent(schema)}/${encodeURIComponent(name)}?limit=50`);
|
|
1750
|
+
const rows = rowsOf(page);
|
|
1751
|
+
renderGrid(columnsOf(page, rows), rows);
|
|
1752
|
+
const total = isRecord2(page) && typeof page.total === "number" ? page.total : rows.length;
|
|
1753
|
+
result.textContent = `${selected} \xB7 ${total} rows`;
|
|
1754
|
+
for (const button of tables.querySelectorAll("button")) {
|
|
1755
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1756
|
+
continue;
|
|
1757
|
+
button.setAttribute("aria-current", button.dataset.schema === schema && button.dataset.table === name ? "true" : "false");
|
|
1758
|
+
}
|
|
1759
|
+
};
|
|
1760
|
+
const loadTables = async () => {
|
|
1761
|
+
const payload = await api.get("/sql/tables");
|
|
1762
|
+
const listed = isRecord2(payload) && Array.isArray(payload.tables) ? payload.tables : [];
|
|
1763
|
+
tables.replaceChildren();
|
|
1764
|
+
if (listed.length === 0) {
|
|
1765
|
+
const empty = document.createElement("p");
|
|
1766
|
+
empty.className = "empty";
|
|
1767
|
+
empty.textContent = "No tables.";
|
|
1768
|
+
tables.append(empty);
|
|
1769
|
+
return;
|
|
1770
|
+
}
|
|
1771
|
+
for (const item of listed) {
|
|
1772
|
+
if (!isRecord2(item) || typeof item.schema !== "string" || typeof item.name !== "string")
|
|
1773
|
+
continue;
|
|
1774
|
+
const button = document.createElement("button");
|
|
1775
|
+
button.type = "button";
|
|
1776
|
+
button.dataset.schema = item.schema;
|
|
1777
|
+
button.dataset.table = item.name;
|
|
1778
|
+
button.textContent = `${item.schema}.${item.name}`;
|
|
1779
|
+
tables.append(button);
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
tables.addEventListener("click", (event) => {
|
|
1783
|
+
const target = event.target;
|
|
1784
|
+
if (!(target instanceof Element))
|
|
1785
|
+
return;
|
|
1786
|
+
const button = target.closest("button");
|
|
1787
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1788
|
+
return;
|
|
1789
|
+
const schema = button.dataset.schema;
|
|
1790
|
+
const name = button.dataset.table;
|
|
1791
|
+
if (schema === void 0 || name === void 0)
|
|
1792
|
+
return;
|
|
1793
|
+
clearError();
|
|
1794
|
+
loadPage(schema, name).catch(showError);
|
|
1795
|
+
});
|
|
1796
|
+
run.addEventListener("click", () => {
|
|
1797
|
+
const sql = input.value.trim();
|
|
1798
|
+
if (sql === "") {
|
|
1799
|
+
showError(new Error("Enter a statement"));
|
|
1800
|
+
return;
|
|
1801
|
+
}
|
|
1802
|
+
clearError();
|
|
1803
|
+
api.send("POST", "/sql/query", { sql }).then((payload) => {
|
|
1804
|
+
const rows = rowsOf(payload);
|
|
1805
|
+
renderGrid(columnsOf(payload, rows), rows);
|
|
1806
|
+
const count = isRecord2(payload) && typeof payload.rowCount === "number" ? payload.rowCount : rows.length;
|
|
1807
|
+
const truncated = isRecord2(payload) && payload.truncated === true ? " (truncated)" : "";
|
|
1808
|
+
result.textContent = `${count} rows${truncated}`;
|
|
1809
|
+
}).catch(showError);
|
|
1810
|
+
});
|
|
1811
|
+
const namespace = document.getElementById("namespace");
|
|
1812
|
+
if (namespace) {
|
|
1813
|
+
namespace.addEventListener("change", () => {
|
|
1814
|
+
clearError();
|
|
1815
|
+
loadTables().catch(showError);
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
loadTables().catch(showError);
|
|
1819
|
+
}
|
|
1659
1820
|
function bootAdmin(config) {
|
|
1660
1821
|
const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
1661
1822
|
const sources = ["declared", "inferred", "mixed"];
|
|
@@ -2332,6 +2493,22 @@ function bootAdmin(config) {
|
|
|
2332
2493
|
panel.script = value.script;
|
|
2333
2494
|
return panel;
|
|
2334
2495
|
};
|
|
2496
|
+
const decodeExtension = (value) => {
|
|
2497
|
+
if (!isRecord2(value))
|
|
2498
|
+
return void 0;
|
|
2499
|
+
if (value.kind === "sql") {
|
|
2500
|
+
return {
|
|
2501
|
+
kind: "sql",
|
|
2502
|
+
id: typeof value.id === "string" && value.id !== "" ? value.id : "sql",
|
|
2503
|
+
title: typeof value.title === "string" && value.title !== "" ? value.title : "SQL",
|
|
2504
|
+
description: typeof value.description === "string" ? value.description : "Browse tables and run queries."
|
|
2505
|
+
};
|
|
2506
|
+
}
|
|
2507
|
+
if (value.kind !== "panel")
|
|
2508
|
+
return void 0;
|
|
2509
|
+
const panel = decodePanel(value);
|
|
2510
|
+
return panel === void 0 ? void 0 : { kind: "panel", ...panel };
|
|
2511
|
+
};
|
|
2335
2512
|
const mountPanels = (panels) => {
|
|
2336
2513
|
const nav = el("nav", HTMLElement);
|
|
2337
2514
|
const views = el("views", HTMLElement);
|
|
@@ -2385,10 +2562,48 @@ function bootAdmin(config) {
|
|
|
2385
2562
|
return decoded === void 0 ? [] : [decoded];
|
|
2386
2563
|
});
|
|
2387
2564
|
mountPanels(panels);
|
|
2565
|
+
const extensions = requireList(isRecord2(manifest) ? manifest.extensions : void 0, "Extensions").flatMap((extension) => {
|
|
2566
|
+
const decoded = decodeExtension(extension);
|
|
2567
|
+
return decoded === void 0 ? [] : [decoded];
|
|
2568
|
+
});
|
|
2569
|
+
const extensionPanels = extensions.flatMap((extension) => extension.kind === "panel" ? [extension] : []);
|
|
2570
|
+
mountPanels(extensionPanels);
|
|
2571
|
+
for (const extension of extensions) {
|
|
2572
|
+
if (extension.kind !== "sql")
|
|
2573
|
+
continue;
|
|
2574
|
+
const nav = el("nav", HTMLElement);
|
|
2575
|
+
const views = el("views", HTMLElement);
|
|
2576
|
+
const button = document.createElement("button");
|
|
2577
|
+
button.type = "button";
|
|
2578
|
+
button.dataset.view = extension.id;
|
|
2579
|
+
button.textContent = extension.title;
|
|
2580
|
+
nav.append(button);
|
|
2581
|
+
const section = document.createElement("section");
|
|
2582
|
+
section.className = "view";
|
|
2583
|
+
section.id = `view-${extension.id}`;
|
|
2584
|
+
section.hidden = true;
|
|
2585
|
+
const title = document.createElement("h2");
|
|
2586
|
+
title.textContent = extension.title;
|
|
2587
|
+
const lede = document.createElement("p");
|
|
2588
|
+
lede.className = "lede";
|
|
2589
|
+
lede.textContent = extension.description;
|
|
2590
|
+
const body = document.createElement("div");
|
|
2591
|
+
body.className = "panel-body";
|
|
2592
|
+
section.append(title, lede, body);
|
|
2593
|
+
views.append(section);
|
|
2594
|
+
mountSqlExplorer(body, panelApi);
|
|
2595
|
+
}
|
|
2388
2596
|
return refresh();
|
|
2389
2597
|
}).catch(showError);
|
|
2390
2598
|
}
|
|
2391
|
-
var clientPrelude = [
|
|
2599
|
+
var clientPrelude = [
|
|
2600
|
+
isRecord2,
|
|
2601
|
+
mountAdminBrand,
|
|
2602
|
+
startAdminBrand,
|
|
2603
|
+
faultPresetList,
|
|
2604
|
+
mountSqlExplorer,
|
|
2605
|
+
bootAdmin
|
|
2606
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2392
2607
|
var adminClientSource = (config) => {
|
|
2393
2608
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2394
2609
|
const entry = bootAdmin.name;
|
|
@@ -2438,19 +2653,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2438
2653
|
"GET /ui/manifest"
|
|
2439
2654
|
];
|
|
2440
2655
|
var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
2656
|
+
var RESERVED_VIEWS = /* @__PURE__ */ new Set(["overview", "state", "clock", "faults", "journal", "routes"]);
|
|
2657
|
+
var checkPanel = (panel, seen, label) => {
|
|
2658
|
+
if (!PANEL_ID.test(panel.id)) {
|
|
2659
|
+
throw new RangeError(`${label} id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
|
|
2660
|
+
}
|
|
2661
|
+
if (RESERVED_VIEWS.has(panel.id)) {
|
|
2662
|
+
throw new RangeError(`${label} id ${panel.id} is reserved by the admin shell`);
|
|
2663
|
+
}
|
|
2664
|
+
if (seen.has(panel.id))
|
|
2665
|
+
throw new RangeError(`duplicate admin view id ${panel.id}`);
|
|
2666
|
+
seen.add(panel.id);
|
|
2667
|
+
if (panel.title.trim() === "")
|
|
2668
|
+
throw new RangeError(`${label} ${panel.id} needs a title`);
|
|
2669
|
+
};
|
|
2441
2670
|
var assertAdminUi = (ui) => {
|
|
2442
|
-
if (!ui
|
|
2671
|
+
if (!ui)
|
|
2443
2672
|
return;
|
|
2444
2673
|
const seen = /* @__PURE__ */ new Set();
|
|
2445
|
-
for (const panel of ui.panels)
|
|
2446
|
-
|
|
2447
|
-
|
|
2674
|
+
for (const panel of ui.panels ?? [])
|
|
2675
|
+
checkPanel(panel, seen, "admin panel");
|
|
2676
|
+
for (const extension of ui.extensions ?? []) {
|
|
2677
|
+
if (extension.kind === "panel") {
|
|
2678
|
+
checkPanel(extension, seen, "admin extension");
|
|
2679
|
+
continue;
|
|
2448
2680
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
seen.add(panel.id);
|
|
2452
|
-
if (panel.title.trim() === "")
|
|
2453
|
-
throw new RangeError(`admin panel ${panel.id} needs a title`);
|
|
2681
|
+
const id = extension.id ?? "sql";
|
|
2682
|
+
checkPanel({ id, title: extension.title ?? "SQL" }, seen, "admin extension");
|
|
2454
2683
|
}
|
|
2455
2684
|
};
|
|
2456
2685
|
|
|
@@ -2684,6 +2913,12 @@ var renderAdminDocument = (service) => {
|
|
|
2684
2913
|
border-radius: 999px; padding: 4px 8px;
|
|
2685
2914
|
}
|
|
2686
2915
|
.chip i { color: var(--faint); font-style: normal; }
|
|
2916
|
+
.sql-layout {
|
|
2917
|
+
display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 16px;
|
|
2918
|
+
}
|
|
2919
|
+
.sql-tables { display: flex; flex-direction: column; gap: 4px; max-height: 28rem; overflow: auto; }
|
|
2920
|
+
.sql-tables button { text-align: left; }
|
|
2921
|
+
.sql-input { font-family: var(--mono); min-height: 7rem; width: 100%; }
|
|
2687
2922
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2688
2923
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2689
2924
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -2747,7 +2982,7 @@ var renderAdminDocument = (service) => {
|
|
|
2747
2982
|
padding: 8px;
|
|
2748
2983
|
}
|
|
2749
2984
|
nav.side button { white-space: nowrap; flex: none; }
|
|
2750
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
2985
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
2751
2986
|
main { padding: 14px; }
|
|
2752
2987
|
table, thead, tbody, tr, th, td { display: block; }
|
|
2753
2988
|
thead { display: none; }
|
|
@@ -2918,6 +3153,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
2918
3153
|
status: 200,
|
|
2919
3154
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
2920
3155
|
});
|
|
3156
|
+
var describeExtension = (extension) => {
|
|
3157
|
+
if (extension.kind === "sql") {
|
|
3158
|
+
return {
|
|
3159
|
+
kind: "sql",
|
|
3160
|
+
id: extension.id ?? "sql",
|
|
3161
|
+
title: extension.title ?? "SQL",
|
|
3162
|
+
...extension.description !== void 0 ? { description: extension.description } : {}
|
|
3163
|
+
};
|
|
3164
|
+
}
|
|
3165
|
+
return {
|
|
3166
|
+
kind: "panel",
|
|
3167
|
+
id: extension.id,
|
|
3168
|
+
title: extension.title,
|
|
3169
|
+
...extension.description !== void 0 ? { description: extension.description } : {},
|
|
3170
|
+
html: extension.html,
|
|
3171
|
+
...extension.script !== void 0 ? { script: extension.script } : {}
|
|
3172
|
+
};
|
|
3173
|
+
};
|
|
2921
3174
|
var adminUiRoutes = (service, ui) => {
|
|
2922
3175
|
const shell = () => renderAdminDocument(service);
|
|
2923
3176
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -2932,7 +3185,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
2932
3185
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
2933
3186
|
html: panel.html,
|
|
2934
3187
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
2935
|
-
}))
|
|
3188
|
+
})),
|
|
3189
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
2936
3190
|
})
|
|
2937
3191
|
};
|
|
2938
3192
|
};
|
|
@@ -3535,7 +3789,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3535
3789
|
};
|
|
3536
3790
|
|
|
3537
3791
|
// ../core/dist/version.js
|
|
3538
|
-
var PACKAGE_VERSION = true ? "1.
|
|
3792
|
+
var PACKAGE_VERSION = true ? "1.7.0" : UNRELEASED_VERSION;
|
|
3539
3793
|
|
|
3540
3794
|
// ../core/dist/signing.js
|
|
3541
3795
|
var encoder = new TextEncoder();
|
|
@@ -5697,4 +5951,4 @@ export {
|
|
|
5697
5951
|
accessKeyCredential,
|
|
5698
5952
|
SpeechAPI
|
|
5699
5953
|
};
|
|
5700
|
-
//# sourceMappingURL=chunk-
|
|
5954
|
+
//# sourceMappingURL=chunk-4VZZ5XPO.js.map
|