@crvouga/mockingbird-service-slack 3.10.6 → 3.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 +13 -1
- package/DISCOVERY.md +29 -0
- package/dist/chunk-3HKWQQ7A.js +12990 -0
- package/dist/chunk-3HKWQQ7A.js.map +7 -0
- package/dist/{chunk-RPZWYSPY.js → chunk-44Z7JVQV.js} +54 -7
- package/dist/chunk-44Z7JVQV.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 +1 -1
- package/dist/chunk-4OFEQI5S.js +0 -12990
- package/dist/chunk-4OFEQI5S.js.map +0 -7
- package/dist/chunk-RPZWYSPY.js.map +0 -7
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
resolveAdminPrefix,
|
|
15
15
|
restoreClock,
|
|
16
16
|
unbindSocketTransport
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3HKWQQ7A.js";
|
|
18
18
|
|
|
19
19
|
// ../../adapters/node/dist/cli.js
|
|
20
20
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
@@ -1667,9 +1667,7 @@ data: ${JSON.stringify(data)}
|
|
|
1667
1667
|
async handle(request, path, namespace, body, admin) {
|
|
1668
1668
|
const route = path.slice("/fleet".length), method = request.method;
|
|
1669
1669
|
if (path === "/ui")
|
|
1670
|
-
return new Response(fleetConsole(this.ctx.config.adminPrefix ?? "/__admin"), {
|
|
1671
|
-
headers: { "content-type": "text/html; charset=utf-8" }
|
|
1672
|
-
});
|
|
1670
|
+
return new Response(fleetConsole(this.ctx.config.adminPrefix ?? "/__admin", this.ctx.dashboard?.()), { headers: { "content-type": "text/html; charset=utf-8" } });
|
|
1673
1671
|
if (route === "" && method === "GET")
|
|
1674
1672
|
return Response.json({
|
|
1675
1673
|
...this.capability(),
|
|
@@ -2639,7 +2637,8 @@ data: ${JSON.stringify(data)}
|
|
|
2639
2637
|
clearInterval(this.expiryTimer);
|
|
2640
2638
|
}
|
|
2641
2639
|
};
|
|
2642
|
-
var
|
|
2640
|
+
var escapeAttribute = (value) => value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
|
|
2641
|
+
var fleetConsole = (prefix, dashboard) => `<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><title>Mockingbird Fleet</title><style>body{font:16px system-ui;max-width:1000px;margin:3rem auto;padding:1rem;background:#10151b;color:#e0e9f2}input,select,button{padding:.7rem;margin:.3rem;background:#233142;color:inherit;border:1px solid #60768b;border-radius:5px}pre{white-space:pre-wrap;overflow-wrap:anywhere}a{color:#9fdbff}</style><h1>Mockingbird Fleet</h1>${dashboard ? `<p id="dashboard">Every emulator's admin UI and the notifications UI are on the <a href="${escapeAttribute(dashboard)}">dashboard</a>.</p>` : ""}<label>Admin key <input id="key" type="password" autocomplete="off"></label><label>Namespace <input id="ns" value="default"></label><button id="refresh">Refresh</button><section id="children"></section><label>Action <select id="action"><option value="snapshots">Capture checkpoint</option><option value="reset">Reset namespace</option></select></label><button id="run">Run</button><h2>Lifecycle and operations</h2><pre id="result"></pre><script type="module">const base=${JSON.stringify(`${prefix}/fleet`)};const key=document.querySelector('#key'),ns=document.querySelector('#ns'),result=document.querySelector('#result');async function api(path,method='GET',body){const r=await fetch(base+path,{method,headers:{'content-type':'application/json','x-mockingbird-admin-key':key.value},...(body?{body:JSON.stringify(body)}:{})});const data=await r.json();result.textContent=JSON.stringify(data,null,2);return data}document.querySelector('#refresh').onclick=async()=>{const data=await api('');const host=document.querySelector('#children');host.replaceChildren();for(const [name,child]of Object.entries(data.manifest?.services??{})){const link=document.createElement('a');link.href=child.adminUrl;link.textContent=name+' ('+child.protocol+') ';host.append(link)}await api('/operations?namespace='+encodeURIComponent(ns.value))};document.querySelector('#run').onclick=()=>api('/namespaces/'+encodeURIComponent(ns.value)+'/'+document.querySelector('#action').value,'POST',{});</script></html>`;
|
|
2643
2642
|
|
|
2644
2643
|
// ../../adapters/node/dist/fleet-preflight.js
|
|
2645
2644
|
import { readFile, realpath } from "node:fs/promises";
|
|
@@ -2703,6 +2702,28 @@ var fleet_config_schema_default = {
|
|
|
2703
2702
|
}
|
|
2704
2703
|
}
|
|
2705
2704
|
},
|
|
2705
|
+
dashboard: {
|
|
2706
|
+
description: "Serve the dashboard (every emulator's admin UI and the notifications UI) next to the fleet. Honored by mockingbird-fleet serve.",
|
|
2707
|
+
anyOf: [
|
|
2708
|
+
{
|
|
2709
|
+
type: "boolean"
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
type: "object",
|
|
2713
|
+
additionalProperties: false,
|
|
2714
|
+
properties: {
|
|
2715
|
+
port: {
|
|
2716
|
+
type: "integer",
|
|
2717
|
+
minimum: 0,
|
|
2718
|
+
maximum: 65535
|
|
2719
|
+
},
|
|
2720
|
+
host: {
|
|
2721
|
+
type: "string"
|
|
2722
|
+
}
|
|
2723
|
+
}
|
|
2724
|
+
}
|
|
2725
|
+
]
|
|
2726
|
+
},
|
|
2706
2727
|
cors: {
|
|
2707
2728
|
type: "object",
|
|
2708
2729
|
required: ["origins"],
|
|
@@ -2987,6 +3008,7 @@ async function preflightFleet(config, options) {
|
|
|
2987
3008
|
throw new Error("protected archive policy requires a protected repository; configure its protector before startup");
|
|
2988
3009
|
resolveAdminPrefix(config.adminPrefix);
|
|
2989
3010
|
normalizeBootControls(config.adminControls);
|
|
3011
|
+
validateDashboard(config.dashboard);
|
|
2990
3012
|
if (config.idBase !== void 0)
|
|
2991
3013
|
normalizeIdBase(config.idBase, "idBase");
|
|
2992
3014
|
const targets = /* @__PURE__ */ new Map();
|
|
@@ -3062,7 +3084,7 @@ async function preflightFleet(config, options) {
|
|
|
3062
3084
|
break;
|
|
3063
3085
|
}
|
|
3064
3086
|
}
|
|
3065
|
-
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.
|
|
3087
|
+
targets.set(name, { ...target, packageVersion: packageVersion ?? "3.12.0" });
|
|
3066
3088
|
} catch (error) {
|
|
3067
3089
|
throw new Error(`service ${name}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
3068
3090
|
}
|
|
@@ -3147,6 +3169,22 @@ function validateFleetPolicies(options) {
|
|
|
3147
3169
|
if (duration !== void 0 && (!Number.isSafeInteger(duration) || duration < 1))
|
|
3148
3170
|
throw new Error("hook deadlines must be positive integer milliseconds");
|
|
3149
3171
|
}
|
|
3172
|
+
function validateDashboard(value) {
|
|
3173
|
+
if (value === void 0 || typeof value === "boolean")
|
|
3174
|
+
return;
|
|
3175
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
3176
|
+
throw new Error("dashboard: expected true, false or { port, host }");
|
|
3177
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
3178
|
+
if (key === "port") {
|
|
3179
|
+
if (!Number.isInteger(entry) || entry < 0 || entry > 65535)
|
|
3180
|
+
throw new Error("dashboard.port: expected an integer from 0 to 65535");
|
|
3181
|
+
} else if (key === "host") {
|
|
3182
|
+
if (typeof entry !== "string" || !entry)
|
|
3183
|
+
throw new Error("dashboard.host: expected a host");
|
|
3184
|
+
} else
|
|
3185
|
+
throw new Error(`dashboard.${key}: unknown key; expected port or host`);
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3150
3188
|
|
|
3151
3189
|
// ../../adapters/node/dist/serve.js
|
|
3152
3190
|
import { createServer } from "node:http";
|
|
@@ -3602,6 +3640,7 @@ async function startFleet(config, options) {
|
|
|
3602
3640
|
const checkpoints = /* @__PURE__ */ new Map();
|
|
3603
3641
|
let supervisor;
|
|
3604
3642
|
let management;
|
|
3643
|
+
let dashboard;
|
|
3605
3644
|
let manifest;
|
|
3606
3645
|
const privateConnections = () => Object.fromEntries([...children].map(([name, child]) => [
|
|
3607
3646
|
name,
|
|
@@ -3669,6 +3708,7 @@ async function startFleet(config, options) {
|
|
|
3669
3708
|
}
|
|
3670
3709
|
}
|
|
3671
3710
|
const cleanup = await Promise.allSettled([
|
|
3711
|
+
dashboard?.close(),
|
|
3672
3712
|
supervisor?.close(),
|
|
3673
3713
|
removeOwned(options.readyFile, id),
|
|
3674
3714
|
removeOwned(options.connectionsFile, id)
|
|
@@ -4035,6 +4075,7 @@ async function startFleet(config, options) {
|
|
|
4035
4075
|
clock,
|
|
4036
4076
|
transaction,
|
|
4037
4077
|
manifest: () => manifest,
|
|
4078
|
+
dashboard: () => dashboard?.url,
|
|
4038
4079
|
publish,
|
|
4039
4080
|
recovery,
|
|
4040
4081
|
controlling
|
|
@@ -4098,6 +4139,10 @@ async function startFleet(config, options) {
|
|
|
4098
4139
|
}
|
|
4099
4140
|
}
|
|
4100
4141
|
await management.startPolicies();
|
|
4142
|
+
if (options.dashboard) {
|
|
4143
|
+
dashboard = await options.dashboard({ manifest, config });
|
|
4144
|
+
manifest.dashboard = dashboard.url;
|
|
4145
|
+
}
|
|
4101
4146
|
await publish();
|
|
4102
4147
|
if (manifest.state === "ready")
|
|
4103
4148
|
options.onReady?.(manifest);
|
|
@@ -4929,6 +4974,8 @@ var serveCommand = (target) => ({
|
|
|
4929
4974
|
const adminKey2 = config.adminKey ?? asString(values["admin-key"]) ?? process.env.MOCKINGBIRD_ADMIN_KEY;
|
|
4930
4975
|
if (adminKey2 !== void 0)
|
|
4931
4976
|
config.adminKey = adminKey2;
|
|
4977
|
+
if (config.dashboard)
|
|
4978
|
+
console.error(`${configPath}: "dashboard" is served by mockingbird-fleet (npx @crvouga/mockingbird-fleet serve --config ${configPath}); a service's own serve command starts the fleet without it`);
|
|
4932
4979
|
const adminControls = await resolveServeControls(values, process.env, config.adminControls);
|
|
4933
4980
|
if (adminControls !== void 0)
|
|
4934
4981
|
config.adminControls = adminControls;
|
|
@@ -5383,4 +5430,4 @@ export {
|
|
|
5383
5430
|
createServer2 as createServer,
|
|
5384
5431
|
serveTarget
|
|
5385
5432
|
};
|
|
5386
|
-
//# sourceMappingURL=chunk-
|
|
5433
|
+
//# sourceMappingURL=chunk-44Z7JVQV.js.map
|