@crvouga/mockingbird-service-livekit 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-KW4C4G6B.js → chunk-KUUBFZEF.js} +268 -14
- package/dist/chunk-KUUBFZEF.js.map +7 -0
- package/dist/{chunk-5FLDCYLG.js → chunk-QYZHDKN7.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-KW4C4G6B.js.map +0 -7
- /package/dist/{chunk-5FLDCYLG.js.map → chunk-QYZHDKN7.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog — @crvouga/mockingbird-service-livekit
|
|
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
|
|
@@ -1492,6 +1492,167 @@ function faultPresetList(value) {
|
|
|
1492
1492
|
})
|
|
1493
1493
|
};
|
|
1494
1494
|
}
|
|
1495
|
+
function mountSqlExplorer(root, api) {
|
|
1496
|
+
const cell = (value) => {
|
|
1497
|
+
if (value === null || value === void 0)
|
|
1498
|
+
return "";
|
|
1499
|
+
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
1500
|
+
return String(value);
|
|
1501
|
+
}
|
|
1502
|
+
return JSON.stringify(value) ?? "";
|
|
1503
|
+
};
|
|
1504
|
+
root.replaceChildren();
|
|
1505
|
+
const layout = document.createElement("div");
|
|
1506
|
+
layout.className = "sql-layout";
|
|
1507
|
+
const tables = document.createElement("div");
|
|
1508
|
+
tables.className = "sql-tables";
|
|
1509
|
+
const stack = document.createElement("div");
|
|
1510
|
+
stack.className = "stack";
|
|
1511
|
+
const banner = document.createElement("p");
|
|
1512
|
+
banner.className = "banner";
|
|
1513
|
+
const grid = document.createElement("div");
|
|
1514
|
+
const input = document.createElement("textarea");
|
|
1515
|
+
input.className = "sql-input";
|
|
1516
|
+
input.spellcheck = false;
|
|
1517
|
+
input.placeholder = "SELECT * FROM ...";
|
|
1518
|
+
const actions = document.createElement("div");
|
|
1519
|
+
actions.className = "row-actions";
|
|
1520
|
+
const run = document.createElement("button");
|
|
1521
|
+
run.type = "button";
|
|
1522
|
+
run.textContent = "Run";
|
|
1523
|
+
actions.append(run);
|
|
1524
|
+
const result = document.createElement("pre");
|
|
1525
|
+
stack.append(banner, grid, input, actions, result);
|
|
1526
|
+
layout.append(tables, stack);
|
|
1527
|
+
root.append(layout);
|
|
1528
|
+
const showError = (error2) => {
|
|
1529
|
+
banner.textContent = error2 instanceof Error ? error2.message : String(error2);
|
|
1530
|
+
banner.classList.add("show");
|
|
1531
|
+
};
|
|
1532
|
+
const clearError = () => {
|
|
1533
|
+
banner.textContent = "";
|
|
1534
|
+
banner.classList.remove("show");
|
|
1535
|
+
};
|
|
1536
|
+
const renderGrid = (columns, rows) => {
|
|
1537
|
+
grid.replaceChildren();
|
|
1538
|
+
if (columns.length === 0) {
|
|
1539
|
+
const empty = document.createElement("p");
|
|
1540
|
+
empty.className = "empty";
|
|
1541
|
+
empty.textContent = "No rows.";
|
|
1542
|
+
grid.append(empty);
|
|
1543
|
+
return;
|
|
1544
|
+
}
|
|
1545
|
+
const table = document.createElement("table");
|
|
1546
|
+
const head = document.createElement("thead");
|
|
1547
|
+
const headRow = document.createElement("tr");
|
|
1548
|
+
for (const column of columns) {
|
|
1549
|
+
const th = document.createElement("th");
|
|
1550
|
+
th.textContent = column;
|
|
1551
|
+
headRow.append(th);
|
|
1552
|
+
}
|
|
1553
|
+
head.append(headRow);
|
|
1554
|
+
const body = document.createElement("tbody");
|
|
1555
|
+
for (const row of rows) {
|
|
1556
|
+
const tr = document.createElement("tr");
|
|
1557
|
+
for (const column of columns) {
|
|
1558
|
+
const td = document.createElement("td");
|
|
1559
|
+
td.dataset.label = column;
|
|
1560
|
+
td.textContent = cell(row[column]);
|
|
1561
|
+
tr.append(td);
|
|
1562
|
+
}
|
|
1563
|
+
body.append(tr);
|
|
1564
|
+
}
|
|
1565
|
+
table.append(head, body);
|
|
1566
|
+
grid.append(table);
|
|
1567
|
+
};
|
|
1568
|
+
const rowsOf = (value) => {
|
|
1569
|
+
if (!isRecord2(value) || !Array.isArray(value.rows))
|
|
1570
|
+
return [];
|
|
1571
|
+
return value.rows.flatMap((row) => isRecord2(row) ? [row] : []);
|
|
1572
|
+
};
|
|
1573
|
+
const columnsOf = (value, rows) => {
|
|
1574
|
+
if (isRecord2(value) && Array.isArray(value.columns)) {
|
|
1575
|
+
const named = value.columns.flatMap((column) => typeof column === "string" ? [column] : []);
|
|
1576
|
+
if (named.length > 0)
|
|
1577
|
+
return named;
|
|
1578
|
+
}
|
|
1579
|
+
const first = rows[0];
|
|
1580
|
+
return first === void 0 ? [] : Object.keys(first);
|
|
1581
|
+
};
|
|
1582
|
+
let selected = "";
|
|
1583
|
+
const loadPage = async (schema, name) => {
|
|
1584
|
+
selected = `${schema}.${name}`;
|
|
1585
|
+
const page = await api.get(`/sql/tables/${encodeURIComponent(schema)}/${encodeURIComponent(name)}?limit=50`);
|
|
1586
|
+
const rows = rowsOf(page);
|
|
1587
|
+
renderGrid(columnsOf(page, rows), rows);
|
|
1588
|
+
const total = isRecord2(page) && typeof page.total === "number" ? page.total : rows.length;
|
|
1589
|
+
result.textContent = `${selected} \xB7 ${total} rows`;
|
|
1590
|
+
for (const button of tables.querySelectorAll("button")) {
|
|
1591
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1592
|
+
continue;
|
|
1593
|
+
button.setAttribute("aria-current", button.dataset.schema === schema && button.dataset.table === name ? "true" : "false");
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
const loadTables = async () => {
|
|
1597
|
+
const payload = await api.get("/sql/tables");
|
|
1598
|
+
const listed = isRecord2(payload) && Array.isArray(payload.tables) ? payload.tables : [];
|
|
1599
|
+
tables.replaceChildren();
|
|
1600
|
+
if (listed.length === 0) {
|
|
1601
|
+
const empty = document.createElement("p");
|
|
1602
|
+
empty.className = "empty";
|
|
1603
|
+
empty.textContent = "No tables.";
|
|
1604
|
+
tables.append(empty);
|
|
1605
|
+
return;
|
|
1606
|
+
}
|
|
1607
|
+
for (const item of listed) {
|
|
1608
|
+
if (!isRecord2(item) || typeof item.schema !== "string" || typeof item.name !== "string")
|
|
1609
|
+
continue;
|
|
1610
|
+
const button = document.createElement("button");
|
|
1611
|
+
button.type = "button";
|
|
1612
|
+
button.dataset.schema = item.schema;
|
|
1613
|
+
button.dataset.table = item.name;
|
|
1614
|
+
button.textContent = `${item.schema}.${item.name}`;
|
|
1615
|
+
tables.append(button);
|
|
1616
|
+
}
|
|
1617
|
+
};
|
|
1618
|
+
tables.addEventListener("click", (event) => {
|
|
1619
|
+
const target = event.target;
|
|
1620
|
+
if (!(target instanceof Element))
|
|
1621
|
+
return;
|
|
1622
|
+
const button = target.closest("button");
|
|
1623
|
+
if (!(button instanceof HTMLButtonElement))
|
|
1624
|
+
return;
|
|
1625
|
+
const schema = button.dataset.schema;
|
|
1626
|
+
const name = button.dataset.table;
|
|
1627
|
+
if (schema === void 0 || name === void 0)
|
|
1628
|
+
return;
|
|
1629
|
+
clearError();
|
|
1630
|
+
loadPage(schema, name).catch(showError);
|
|
1631
|
+
});
|
|
1632
|
+
run.addEventListener("click", () => {
|
|
1633
|
+
const sql = input.value.trim();
|
|
1634
|
+
if (sql === "") {
|
|
1635
|
+
showError(new Error("Enter a statement"));
|
|
1636
|
+
return;
|
|
1637
|
+
}
|
|
1638
|
+
clearError();
|
|
1639
|
+
api.send("POST", "/sql/query", { sql }).then((payload) => {
|
|
1640
|
+
const rows = rowsOf(payload);
|
|
1641
|
+
renderGrid(columnsOf(payload, rows), rows);
|
|
1642
|
+
const count = isRecord2(payload) && typeof payload.rowCount === "number" ? payload.rowCount : rows.length;
|
|
1643
|
+
const truncated = isRecord2(payload) && payload.truncated === true ? " (truncated)" : "";
|
|
1644
|
+
result.textContent = `${count} rows${truncated}`;
|
|
1645
|
+
}).catch(showError);
|
|
1646
|
+
});
|
|
1647
|
+
const namespace = document.getElementById("namespace");
|
|
1648
|
+
if (namespace) {
|
|
1649
|
+
namespace.addEventListener("change", () => {
|
|
1650
|
+
clearError();
|
|
1651
|
+
loadTables().catch(showError);
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
loadTables().catch(showError);
|
|
1655
|
+
}
|
|
1495
1656
|
function bootAdmin(config) {
|
|
1496
1657
|
const fieldKinds = ["string", "number", "boolean", "null", "object", "array", "unknown"];
|
|
1497
1658
|
const sources = ["declared", "inferred", "mixed"];
|
|
@@ -2168,6 +2329,22 @@ function bootAdmin(config) {
|
|
|
2168
2329
|
panel.script = value.script;
|
|
2169
2330
|
return panel;
|
|
2170
2331
|
};
|
|
2332
|
+
const decodeExtension = (value) => {
|
|
2333
|
+
if (!isRecord2(value))
|
|
2334
|
+
return void 0;
|
|
2335
|
+
if (value.kind === "sql") {
|
|
2336
|
+
return {
|
|
2337
|
+
kind: "sql",
|
|
2338
|
+
id: typeof value.id === "string" && value.id !== "" ? value.id : "sql",
|
|
2339
|
+
title: typeof value.title === "string" && value.title !== "" ? value.title : "SQL",
|
|
2340
|
+
description: typeof value.description === "string" ? value.description : "Browse tables and run queries."
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
if (value.kind !== "panel")
|
|
2344
|
+
return void 0;
|
|
2345
|
+
const panel = decodePanel(value);
|
|
2346
|
+
return panel === void 0 ? void 0 : { kind: "panel", ...panel };
|
|
2347
|
+
};
|
|
2171
2348
|
const mountPanels = (panels) => {
|
|
2172
2349
|
const nav = el("nav", HTMLElement);
|
|
2173
2350
|
const views = el("views", HTMLElement);
|
|
@@ -2221,10 +2398,48 @@ function bootAdmin(config) {
|
|
|
2221
2398
|
return decoded === void 0 ? [] : [decoded];
|
|
2222
2399
|
});
|
|
2223
2400
|
mountPanels(panels);
|
|
2401
|
+
const extensions = requireList(isRecord2(manifest) ? manifest.extensions : void 0, "Extensions").flatMap((extension) => {
|
|
2402
|
+
const decoded = decodeExtension(extension);
|
|
2403
|
+
return decoded === void 0 ? [] : [decoded];
|
|
2404
|
+
});
|
|
2405
|
+
const extensionPanels = extensions.flatMap((extension) => extension.kind === "panel" ? [extension] : []);
|
|
2406
|
+
mountPanels(extensionPanels);
|
|
2407
|
+
for (const extension of extensions) {
|
|
2408
|
+
if (extension.kind !== "sql")
|
|
2409
|
+
continue;
|
|
2410
|
+
const nav = el("nav", HTMLElement);
|
|
2411
|
+
const views = el("views", HTMLElement);
|
|
2412
|
+
const button = document.createElement("button");
|
|
2413
|
+
button.type = "button";
|
|
2414
|
+
button.dataset.view = extension.id;
|
|
2415
|
+
button.textContent = extension.title;
|
|
2416
|
+
nav.append(button);
|
|
2417
|
+
const section = document.createElement("section");
|
|
2418
|
+
section.className = "view";
|
|
2419
|
+
section.id = `view-${extension.id}`;
|
|
2420
|
+
section.hidden = true;
|
|
2421
|
+
const title = document.createElement("h2");
|
|
2422
|
+
title.textContent = extension.title;
|
|
2423
|
+
const lede = document.createElement("p");
|
|
2424
|
+
lede.className = "lede";
|
|
2425
|
+
lede.textContent = extension.description;
|
|
2426
|
+
const body = document.createElement("div");
|
|
2427
|
+
body.className = "panel-body";
|
|
2428
|
+
section.append(title, lede, body);
|
|
2429
|
+
views.append(section);
|
|
2430
|
+
mountSqlExplorer(body, panelApi);
|
|
2431
|
+
}
|
|
2224
2432
|
return refresh();
|
|
2225
2433
|
}).catch(showError);
|
|
2226
2434
|
}
|
|
2227
|
-
var clientPrelude = [
|
|
2435
|
+
var clientPrelude = [
|
|
2436
|
+
isRecord2,
|
|
2437
|
+
mountAdminBrand,
|
|
2438
|
+
startAdminBrand,
|
|
2439
|
+
faultPresetList,
|
|
2440
|
+
mountSqlExplorer,
|
|
2441
|
+
bootAdmin
|
|
2442
|
+
].map((fn) => fn.toString()).join("\n");
|
|
2228
2443
|
var adminClientSource = (config) => {
|
|
2229
2444
|
const payload = JSON.stringify(config).replace(/</g, "\\u003c");
|
|
2230
2445
|
const entry = bootAdmin.name;
|
|
@@ -2274,19 +2489,33 @@ var STANDARD_ADMIN_ROUTES = [
|
|
|
2274
2489
|
"GET /ui/manifest"
|
|
2275
2490
|
];
|
|
2276
2491
|
var PANEL_ID = /^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/;
|
|
2492
|
+
var RESERVED_VIEWS = /* @__PURE__ */ new Set(["overview", "state", "clock", "faults", "journal", "routes"]);
|
|
2493
|
+
var checkPanel = (panel, seen, label) => {
|
|
2494
|
+
if (!PANEL_ID.test(panel.id)) {
|
|
2495
|
+
throw new RangeError(`${label} id must match ${PANEL_ID}: ${JSON.stringify(panel.id)}`);
|
|
2496
|
+
}
|
|
2497
|
+
if (RESERVED_VIEWS.has(panel.id)) {
|
|
2498
|
+
throw new RangeError(`${label} id ${panel.id} is reserved by the admin shell`);
|
|
2499
|
+
}
|
|
2500
|
+
if (seen.has(panel.id))
|
|
2501
|
+
throw new RangeError(`duplicate admin view id ${panel.id}`);
|
|
2502
|
+
seen.add(panel.id);
|
|
2503
|
+
if (panel.title.trim() === "")
|
|
2504
|
+
throw new RangeError(`${label} ${panel.id} needs a title`);
|
|
2505
|
+
};
|
|
2277
2506
|
var assertAdminUi = (ui) => {
|
|
2278
|
-
if (!ui
|
|
2507
|
+
if (!ui)
|
|
2279
2508
|
return;
|
|
2280
2509
|
const seen = /* @__PURE__ */ new Set();
|
|
2281
|
-
for (const panel of ui.panels)
|
|
2282
|
-
|
|
2283
|
-
|
|
2510
|
+
for (const panel of ui.panels ?? [])
|
|
2511
|
+
checkPanel(panel, seen, "admin panel");
|
|
2512
|
+
for (const extension of ui.extensions ?? []) {
|
|
2513
|
+
if (extension.kind === "panel") {
|
|
2514
|
+
checkPanel(extension, seen, "admin extension");
|
|
2515
|
+
continue;
|
|
2284
2516
|
}
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
seen.add(panel.id);
|
|
2288
|
-
if (panel.title.trim() === "")
|
|
2289
|
-
throw new RangeError(`admin panel ${panel.id} needs a title`);
|
|
2517
|
+
const id = extension.id ?? "sql";
|
|
2518
|
+
checkPanel({ id, title: extension.title ?? "SQL" }, seen, "admin extension");
|
|
2290
2519
|
}
|
|
2291
2520
|
};
|
|
2292
2521
|
|
|
@@ -2520,6 +2749,12 @@ var renderAdminDocument = (service) => {
|
|
|
2520
2749
|
border-radius: 999px; padding: 4px 8px;
|
|
2521
2750
|
}
|
|
2522
2751
|
.chip i { color: var(--faint); font-style: normal; }
|
|
2752
|
+
.sql-layout {
|
|
2753
|
+
display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 16px;
|
|
2754
|
+
}
|
|
2755
|
+
.sql-tables { display: flex; flex-direction: column; gap: 4px; max-height: 28rem; overflow: auto; }
|
|
2756
|
+
.sql-tables button { text-align: left; }
|
|
2757
|
+
.sql-input { font-family: var(--mono); min-height: 7rem; width: 100%; }
|
|
2523
2758
|
table { width: 100%; border-collapse: collapse; font-size: 14px; }
|
|
2524
2759
|
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
|
|
2525
2760
|
th { color: var(--faint); font-weight: 600; font-size: 12px; }
|
|
@@ -2583,7 +2818,7 @@ var renderAdminDocument = (service) => {
|
|
|
2583
2818
|
padding: 8px;
|
|
2584
2819
|
}
|
|
2585
2820
|
nav.side button { white-space: nowrap; flex: none; }
|
|
2586
|
-
.split { grid-template-columns: minmax(0, 1fr); }
|
|
2821
|
+
.split, .sql-layout { grid-template-columns: minmax(0, 1fr); }
|
|
2587
2822
|
main { padding: 14px; }
|
|
2588
2823
|
table, thead, tbody, tr, th, td { display: block; }
|
|
2589
2824
|
thead { display: none; }
|
|
@@ -2754,6 +2989,24 @@ var json2 = (body) => new Response(JSON.stringify(body), {
|
|
|
2754
2989
|
status: 200,
|
|
2755
2990
|
headers: { "content-type": "application/json; charset=utf-8" }
|
|
2756
2991
|
});
|
|
2992
|
+
var describeExtension = (extension) => {
|
|
2993
|
+
if (extension.kind === "sql") {
|
|
2994
|
+
return {
|
|
2995
|
+
kind: "sql",
|
|
2996
|
+
id: extension.id ?? "sql",
|
|
2997
|
+
title: extension.title ?? "SQL",
|
|
2998
|
+
...extension.description !== void 0 ? { description: extension.description } : {}
|
|
2999
|
+
};
|
|
3000
|
+
}
|
|
3001
|
+
return {
|
|
3002
|
+
kind: "panel",
|
|
3003
|
+
id: extension.id,
|
|
3004
|
+
title: extension.title,
|
|
3005
|
+
...extension.description !== void 0 ? { description: extension.description } : {},
|
|
3006
|
+
html: extension.html,
|
|
3007
|
+
...extension.script !== void 0 ? { script: extension.script } : {}
|
|
3008
|
+
};
|
|
3009
|
+
};
|
|
2757
3010
|
var adminUiRoutes = (service, ui) => {
|
|
2758
3011
|
const shell = () => renderAdminDocument(service);
|
|
2759
3012
|
const document3 = () => ui?.render ? ui.render({ service, defaultHtml: shell }) : shell();
|
|
@@ -2768,7 +3021,8 @@ var adminUiRoutes = (service, ui) => {
|
|
|
2768
3021
|
...panel.description !== void 0 ? { description: panel.description } : {},
|
|
2769
3022
|
html: panel.html,
|
|
2770
3023
|
...panel.script !== void 0 ? { script: panel.script } : {}
|
|
2771
|
-
}))
|
|
3024
|
+
})),
|
|
3025
|
+
extensions: (ui?.extensions ?? []).map(describeExtension)
|
|
2772
3026
|
})
|
|
2773
3027
|
};
|
|
2774
3028
|
};
|
|
@@ -3675,7 +3929,7 @@ var stateAdminRoutes = (routes) => {
|
|
|
3675
3929
|
};
|
|
3676
3930
|
|
|
3677
3931
|
// ../core/dist/version.js
|
|
3678
|
-
var PACKAGE_VERSION = true ? "1.
|
|
3932
|
+
var PACKAGE_VERSION = true ? "1.7.0" : UNRELEASED_VERSION;
|
|
3679
3933
|
|
|
3680
3934
|
// ../core/dist/signing.js
|
|
3681
3935
|
var encoder = new TextEncoder();
|
|
@@ -5254,4 +5508,4 @@ export {
|
|
|
5254
5508
|
LIVEKIT_NAMESPACE,
|
|
5255
5509
|
LiveKitAPI
|
|
5256
5510
|
};
|
|
5257
|
-
//# sourceMappingURL=chunk-
|
|
5511
|
+
//# sourceMappingURL=chunk-KUUBFZEF.js.map
|