flightdeck 0.2.33 → 0.2.35
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/dist/{flightdeck.lib-DKgZNVMu.js → flightdeck.lib-BvPhVP3B.js} +2 -2
- package/dist/flightdeck.lib-BvPhVP3B.js.map +1 -0
- package/dist/flightdeck.x.js +3 -3
- package/dist/flightdeck.x.js.map +1 -1
- package/dist/klaxon.x.js +1 -1
- package/dist/klaxon.x.js.map +1 -1
- package/dist/lib.d.ts +141 -154
- package/dist/lib.js +1 -1
- package/package.json +9 -9
- package/src/flightdeck.env.ts +1 -1
- package/src/flightdeck.lib.ts +1 -1
- package/src/flightdeck.x.ts +5 -2
- package/src/klaxon.x.ts +1 -1
- package/dist/flightdeck.lib-DKgZNVMu.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve } from "node:path";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
3
|
import { execSync, spawn } from "node:child_process";
|
|
4
4
|
import { createServer } from "node:http";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -405,4 +405,4 @@ var FlightDeckLogger = class {
|
|
|
405
405
|
|
|
406
406
|
//#endregion
|
|
407
407
|
export { FLIGHTDECK_ERROR, FLIGHTDECK_INFO, FLIGHTDECK_LNAV_FORMAT, FLIGHTDECK_SETUP_PHASES, FLIGHTDECK_UPDATE_PHASES, FLIGHTDECK_WARN, FlightDeck, FlightDeckLogger, flightDeckLogSchema, isVersionNumber };
|
|
408
|
-
//# sourceMappingURL=flightdeck.lib-
|
|
408
|
+
//# sourceMappingURL=flightdeck.lib-BvPhVP3B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flightdeck.lib-BvPhVP3B.js","names":["version: string","options: FlightDeckOptions<S>","data: Uint8Array[]","serviceName: S","packageName: string","processCode: number","serviceName?: string","options?: { jsonLogging: boolean }","level:\n\t\t\t| typeof FLIGHTDECK_ERROR\n\t\t\t| typeof FLIGHTDECK_INFO\n\t\t\t| typeof FLIGHTDECK_WARN","log: FlightDeckLog"],"sources":["../src/flightdeck.env.ts","../src/flightdeck.lib.ts"],"sourcesContent":["import { createEnv } from \"@t3-oss/env-core\"\nimport { z } from \"zod/v4\"\n\nexport const env = createEnv({\n\tserver: { FLIGHTDECK_SECRET: z.string().optional() },\n\tclientPrefix: `NEVER`,\n\tclient: {},\n\truntimeEnv: import.meta.env as Record<string, string>,\n\temptyStringAsUndefined: true,\n})\n","/* eslint-disable @typescript-eslint/only-throw-error */\nimport { execSync, spawn } from \"node:child_process\"\nimport { createServer } from \"node:http\"\nimport { homedir } from \"node:os\"\nimport { resolve } from \"node:path\"\nimport { inspect } from \"node:util\"\n\nimport { Future } from \"atom.io/internal\"\nimport { discoverType } from \"atom.io/introspection\"\nimport { fromEntries, toEntries } from \"atom.io/json\"\nimport { ChildSocket } from \"atom.io/realtime-server\"\nimport { CronJob } from \"cron\"\nimport { FilesystemStorage } from \"safedeposit\"\nimport { z } from \"zod/v4\"\n\nimport type { LnavFormat } from \"../gen/lnav-format-schema.gen\"\nimport { env } from \"./flightdeck.env\"\n\nexport const FLIGHTDECK_SETUP_PHASES = [`downloaded`, `installed`] as const\n\nexport type FlightDeckSetupPhase = (typeof FLIGHTDECK_SETUP_PHASES)[number]\n\nexport const FLIGHTDECK_UPDATE_PHASES = [`notified`, `confirmed`] as const\n\nexport type FlightDeckUpdatePhase = (typeof FLIGHTDECK_UPDATE_PHASES)[number]\n\nexport function isVersionNumber(version: string): boolean {\n\treturn (\n\t\t/^\\d+\\.\\d+\\.\\d+$/.test(version) || !Number.isNaN(Number.parseFloat(version))\n\t)\n}\n\nexport type FlightDeckOptions<S extends string = string> = {\n\tpackageName: string\n\tservices: { [service in S]: { run: string; waitFor: boolean } }\n\tscripts: {\n\t\tdownload: string\n\t\tinstall: string\n\t\tcheckAvailability?: string\n\t}\n\tport?: number | undefined\n\tflightdeckRootDir?: string | undefined\n\tjsonLogging?: boolean | undefined\n}\n\nexport class FlightDeck<S extends string = string> {\n\tpublic readonly options: FlightDeckOptions<S>\n\tprotected safety = 0\n\n\tprotected storage: FilesystemStorage<{\n\t\tsetupPhase: FlightDeckSetupPhase\n\t\tupdatePhase: FlightDeckUpdatePhase\n\t\tupdateAwaitedVersion: string\n\t}>\n\tprotected services: {\n\t\t[service in S]: ChildSocket<\n\t\t\t{ timeToStop: []; updatesReady: [] },\n\t\t\t{ readyToUpdate: []; alive: [] }\n\t\t> | null\n\t}\n\tprotected serviceIdx: { readonly [service in S]: number }\n\tpublic defaultServicesReadyToUpdate: { readonly [service in S]: boolean }\n\tpublic servicesReadyToUpdate: { [service in S]: boolean }\n\tpublic autoRespawnDeadServices: boolean\n\n\tprotected logger: Pick<Console, `error` | `info` | `warn`>\n\tprotected serviceLoggers: {\n\t\treadonly [service in S]: FlightDeckLogger\n\t}\n\n\tprotected updateAvailabilityChecker: CronJob | null = null\n\n\tpublic servicesLive: Future<void>[]\n\tpublic servicesDead: Future<void>[]\n\tpublic live = new Future(() => {})\n\tpublic dead = new Future(() => {})\n\n\tprotected restartTimes: number[] = []\n\n\tpublic constructor(options: FlightDeckOptions<S>) {\n\t\tthis.options = options\n\t\tconst { FLIGHTDECK_SECRET } = env\n\t\tconst { flightdeckRootDir = resolve(homedir(), `.flightdeck`) } = options\n\t\tconst port = options.port ?? 8080\n\t\tconst origin = `http://localhost:${port}`\n\n\t\tconst servicesEntries = toEntries(options.services)\n\t\tthis.services = fromEntries(\n\t\t\tservicesEntries.map(([serviceName]) => [serviceName, null]),\n\t\t)\n\t\tthis.serviceIdx = fromEntries(\n\t\t\tservicesEntries.map(([serviceName], idx) => [serviceName, idx]),\n\t\t)\n\t\tthis.defaultServicesReadyToUpdate = fromEntries(\n\t\t\tservicesEntries.map(([serviceName, { waitFor }]) => [\n\t\t\t\tserviceName,\n\t\t\t\t!waitFor,\n\t\t\t]),\n\t\t)\n\t\tthis.servicesReadyToUpdate = { ...this.defaultServicesReadyToUpdate }\n\t\tthis.autoRespawnDeadServices = true\n\n\t\tthis.logger = new FlightDeckLogger(\n\t\t\tthis.options.packageName,\n\t\t\tprocess.pid,\n\t\t\tundefined,\n\t\t\t{ jsonLogging: this.options.jsonLogging ?? false },\n\t\t)\n\t\tthis.serviceLoggers = fromEntries(\n\t\t\tservicesEntries.map(([serviceName]) => [\n\t\t\t\tserviceName,\n\t\t\t\tnew FlightDeckLogger(\n\t\t\t\t\tthis.options.packageName,\n\t\t\t\t\tprocess.pid,\n\t\t\t\t\tserviceName,\n\t\t\t\t\t{ jsonLogging: this.options.jsonLogging ?? false },\n\t\t\t\t),\n\t\t\t]),\n\t\t)\n\n\t\tthis.servicesLive = servicesEntries.map(() => new Future(() => {}))\n\t\tthis.servicesDead = servicesEntries.map(() => new Future(() => {}))\n\t\tthis.live.use(Promise.all(this.servicesLive))\n\t\tthis.dead.use(Promise.all(this.servicesDead))\n\n\t\tthis.storage = new FilesystemStorage({\n\t\t\tpath: resolve(flightdeckRootDir, `storage`, options.packageName),\n\t\t})\n\n\t\tif (FLIGHTDECK_SECRET === undefined) {\n\t\t\tthis.logger.warn(\n\t\t\t\t`No FLIGHTDECK_SECRET environment variable found. FlightDeck will not run an update server.`,\n\t\t\t)\n\t\t} else {\n\t\t\tcreateServer((req, res) => {\n\t\t\t\tlet data: Uint8Array[] = []\n\t\t\t\treq\n\t\t\t\t\t.on(`data`, (chunk) => {\n\t\t\t\t\t\tdata.push(chunk instanceof Buffer ? chunk : Buffer.from(chunk))\n\t\t\t\t\t})\n\t\t\t\t\t.on(`end`, async () => {\n\t\t\t\t\t\tconst authHeader = req.headers.authorization\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (typeof req.url === `undefined`) throw 400\n\t\t\t\t\t\t\tconst expectedAuthHeader = `Bearer ${FLIGHTDECK_SECRET}`\n\t\t\t\t\t\t\tif (authHeader !== `Bearer ${FLIGHTDECK_SECRET}`) {\n\t\t\t\t\t\t\t\tthis.logger.info(\n\t\t\t\t\t\t\t\t\t`Unauthorized: needed \\`${expectedAuthHeader}\\`, got \\`${authHeader}\\``,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tthrow 401\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst url = new URL(req.url, origin)\n\t\t\t\t\t\t\tthis.logger.info(req.method, url.pathname)\n\n\t\t\t\t\t\t\tconst versionForeignInput = Buffer.concat(data).toString()\n\t\t\t\t\t\t\tif (!isVersionNumber(versionForeignInput)) {\n\t\t\t\t\t\t\t\tthrow 400\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tres.writeHead(200)\n\t\t\t\t\t\t\tres.end()\n\n\t\t\t\t\t\t\tthis.storage.setItem(`updatePhase`, `notified`)\n\t\t\t\t\t\t\tthis.storage.setItem(`updateAwaitedVersion`, versionForeignInput)\n\t\t\t\t\t\t\tconst { checkAvailability } = options.scripts\n\t\t\t\t\t\t\tif (checkAvailability) {\n\t\t\t\t\t\t\t\tawait this.updateAvailabilityChecker?.stop()\n\t\t\t\t\t\t\t\tawait this.seekUpdate(versionForeignInput)\n\t\t\t\t\t\t\t\tconst updatePhase = this.storage.getItem(`updatePhase`)\n\t\t\t\t\t\t\t\tthis.logger.info(`> storage(\"updatePhase\") >`, updatePhase)\n\t\t\t\t\t\t\t\tif (updatePhase === `notified`) {\n\t\t\t\t\t\t\t\t\tthis.updateAvailabilityChecker = new CronJob(\n\t\t\t\t\t\t\t\t\t\t`*/30 * * * * *`,\n\t\t\t\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\t\t\t\tawait this.seekUpdate(versionForeignInput)\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tthis.updateAvailabilityChecker.start()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.downloadPackage()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (thrown) {\n\t\t\t\t\t\t\tthis.logger.error(thrown, req.url)\n\t\t\t\t\t\t\tif (typeof thrown === `number`) {\n\t\t\t\t\t\t\t\tres.writeHead(thrown)\n\t\t\t\t\t\t\t\tres.end()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tdata = []\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t}).listen(port, () => {\n\t\t\t\tthis.logger.info(`Server started on port ${port}`)\n\t\t\t})\n\t\t}\n\n\t\tthis.startAllServices()\n\t\t\t.then(() => {\n\t\t\t\tthis.logger.info(`All services started.`)\n\t\t\t})\n\t\t\t.catch((thrown) => {\n\t\t\t\tif (thrown instanceof Error) {\n\t\t\t\t\tthis.logger.error(`Failed to start all services:`, thrown.message)\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\tprotected async seekUpdate(version: string): Promise<void> {\n\t\tthis.logger.info(`Checking for updates...`)\n\t\tconst { checkAvailability } = this.options.scripts\n\t\tif (!checkAvailability) {\n\t\t\tthis.logger.info(`No checkAvailability script found.`)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tconst out = execSync(`${checkAvailability} ${version}`)\n\t\t\tthis.logger.info(`Check stdout:`, out.toString())\n\t\t\tawait this.updateAvailabilityChecker?.stop()\n\t\t\tthis.storage.setItem(`updatePhase`, `confirmed`)\n\t\t\tthis.downloadPackage()\n\t\t\tthis.announceUpdate()\n\t\t} catch (thrown) {\n\t\t\tif (thrown instanceof Error) {\n\t\t\t\tthis.logger.error(`Check failed:`, thrown.message)\n\t\t\t} else {\n\t\t\t\tconst thrownType = discoverType(thrown)\n\t\t\t\tthis.logger.error(`Check threw`, thrownType, thrown)\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected announceUpdate(): void {\n\t\tfor (const entry of toEntries(this.services)) {\n\t\t\tconst [serviceName, service] = entry\n\t\t\tif (service) {\n\t\t\t\tif (this.options.services[serviceName].waitFor) {\n\t\t\t\t\tservice.emit(`updatesReady`)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.startService(serviceName)\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected tryUpdate(): void {\n\t\tif (toEntries(this.servicesReadyToUpdate).every(([, isReady]) => isReady)) {\n\t\t\tthis.logger.info(`All services are ready to update.`)\n\t\t\tthis.stopAllServices()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.logger.info(`All services stopped; starting up fresh...`)\n\t\t\t\t\tthis.startAllServices()\n\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\tthis.logger.info(`All services started; we're back online.`)\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((thrown) => {\n\t\t\t\t\t\t\tif (thrown instanceof Error) {\n\t\t\t\t\t\t\t\tthis.logger.error(\n\t\t\t\t\t\t\t\t\t`Failed to start all services:`,\n\t\t\t\t\t\t\t\t\tthrown.message,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch((thrown) => {\n\t\t\t\t\tif (thrown instanceof Error) {\n\t\t\t\t\t\tthis.logger.error(`Failed to stop all services:`, thrown.message)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\tprotected startAllServices(): Future<unknown> {\n\t\tthis.logger.info(`Starting all services...`)\n\t\tthis.autoRespawnDeadServices = true\n\t\tconst setupPhase = this.storage.getItem(`setupPhase`)\n\t\tthis.logger.info(`> storage(\"setupPhase\") >`, setupPhase)\n\t\tswitch (setupPhase) {\n\t\t\tcase null:\n\t\t\t\tthis.logger.info(`Starting from scratch.`)\n\t\t\t\tthis.downloadPackage()\n\t\t\t\tthis.installPackage()\n\t\t\t\treturn this.startAllServices()\n\t\t\tcase `downloaded`:\n\t\t\t\tthis.logger.info(`Found package downloaded but not installed.`)\n\t\t\t\tthis.installPackage()\n\t\t\t\treturn this.startAllServices()\n\t\t\tcase `installed`: {\n\t\t\t\tfor (const [serviceName] of toEntries(this.services)) {\n\t\t\t\t\tthis.startService(serviceName)\n\t\t\t\t}\n\t\t\t\treturn this.live\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected startService(serviceName: S): void {\n\t\tthis.logger.info(\n\t\t\t`Starting service ${this.options.packageName}::${serviceName}, try ${this.safety}/2...`,\n\t\t)\n\t\tif (this.safety >= 2) {\n\t\t\tthrow new Error(`Out of tries...`)\n\t\t}\n\t\tthis.safety++\n\n\t\tconst [exe, ...args] = this.options.services[serviceName].run.split(` `)\n\t\tconst serviceProcess = spawn(exe, args, {\n\t\t\tcwd: this.options.flightdeckRootDir,\n\t\t\tenv: import.meta.env as Record<string, string>,\n\t\t})\n\t\tconst serviceLogger = this.serviceLoggers[serviceName]\n\t\tconst service = (this.services[serviceName] = new ChildSocket(\n\t\t\tserviceProcess,\n\t\t\t`${this.options.packageName}::${serviceName}`,\n\t\t\tserviceLogger,\n\t\t))\n\t\tserviceLogger.processCode = service.process.pid ?? -1\n\t\tthis.services[serviceName].onAny((...messages) => {\n\t\t\tserviceLogger.info(`💬`, ...messages)\n\t\t})\n\t\tthis.services[serviceName].on(`readyToUpdate`, () => {\n\t\t\tthis.logger.info(`Service \"${serviceName}\" is ready to update.`)\n\t\t\tthis.servicesReadyToUpdate[serviceName] = true\n\t\t\tthis.tryUpdate()\n\t\t})\n\t\tthis.services[serviceName].on(`alive`, () => {\n\t\t\tthis.servicesLive[this.serviceIdx[serviceName]].use(Promise.resolve())\n\t\t\tthis.servicesDead[this.serviceIdx[serviceName]] = new Future(() => {})\n\t\t\tif (this.dead.done) {\n\t\t\t\tthis.dead = new Future(() => {})\n\t\t\t}\n\t\t\tthis.dead.use(Promise.all(this.servicesDead))\n\t\t})\n\t\tthis.services[serviceName].process.once(`close`, (exitCode) => {\n\t\t\tthis.logger.info(\n\t\t\t\t`Auto-respawn saw \"${serviceName}\" exit with code ${exitCode}`,\n\t\t\t)\n\t\t\tthis.services[serviceName] = null\n\t\t\tif (!this.autoRespawnDeadServices) {\n\t\t\t\tthis.logger.info(`Auto-respawn is off; \"${serviceName}\" rests.`)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst updatePhase = this.storage.getItem(`updatePhase`)\n\t\t\tthis.logger.info(`> storage(\"updatePhase\") >`, updatePhase)\n\t\t\tconst updatesAreReady = updatePhase === `confirmed`\n\t\t\tif (updatesAreReady) {\n\t\t\t\tthis.serviceLoggers[serviceName].info(`Updating before startup...`)\n\t\t\t\tthis.restartTimes = []\n\t\t\t\tthis.installPackage()\n\t\t\t\tthis.startService(serviceName)\n\t\t\t} else {\n\t\t\t\tconst now = Date.now()\n\t\t\t\tconst fiveMinutesAgo = now - 5 * 60 * 1000\n\t\t\t\tthis.restartTimes = this.restartTimes.filter(\n\t\t\t\t\t(time) => time > fiveMinutesAgo,\n\t\t\t\t)\n\t\t\t\tthis.restartTimes.push(now)\n\n\t\t\t\tif (this.restartTimes.length < 5) {\n\t\t\t\t\tthis.serviceLoggers[serviceName].info(`Crashed. Restarting...`)\n\t\t\t\t\tthis.startService(serviceName)\n\t\t\t\t} else {\n\t\t\t\t\tthis.serviceLoggers[serviceName].info(\n\t\t\t\t\t\t`Crashed 5 times in 5 minutes. Not restarting.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tthis.safety = 0\n\t}\n\n\tprotected downloadPackage(): void {\n\t\tthis.logger.info(`Downloading...`)\n\t\ttry {\n\t\t\tconst out = execSync(this.options.scripts.download)\n\t\t\tthis.logger.info(`Download stdout:`, out.toString())\n\t\t\tthis.storage.setItem(`setupPhase`, `downloaded`)\n\t\t\tthis.logger.info(`Downloaded!`)\n\t\t} catch (thrown) {\n\t\t\tif (thrown instanceof Error) {\n\t\t\t\tthis.logger.error(`Failed to get the latest release: ${thrown.message}`)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\tprotected installPackage(): void {\n\t\tthis.logger.info(`Installing...`)\n\n\t\ttry {\n\t\t\tconst out = execSync(this.options.scripts.install)\n\t\t\tthis.logger.info(`Install stdout:`, out.toString())\n\t\t\tthis.storage.setItem(`setupPhase`, `installed`)\n\t\t\tthis.logger.info(`Installed!`)\n\t\t} catch (thrown) {\n\t\t\tif (thrown instanceof Error) {\n\t\t\t\tthis.logger.error(`Failed to get the latest release: ${thrown.message}`)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\tpublic stopAllServices(): Future<unknown> {\n\t\tthis.logger.info(`Stopping all services... auto-respawn disabled.`)\n\t\tthis.autoRespawnDeadServices = false\n\t\tfor (const [serviceName] of toEntries(this.services)) {\n\t\t\tthis.stopService(serviceName)\n\t\t}\n\t\treturn this.dead\n\t}\n\n\tpublic stopService(serviceName: S): void {\n\t\tconst service = this.services[serviceName]\n\t\tif (service) {\n\t\t\tthis.logger.info(`Stopping service \"${serviceName}\"...`)\n\t\t\tthis.servicesDead[this.serviceIdx[serviceName]].use(\n\t\t\t\tnew Promise((pass) => {\n\t\t\t\t\tservice.emit(`timeToStop`)\n\t\t\t\t\tservice.process.once(`close`, (exitCode) => {\n\t\t\t\t\t\tthis.logger.info(\n\t\t\t\t\t\t\t`Stopped service \"${serviceName}\"; exited with code ${exitCode}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tthis.services[serviceName] = null\n\t\t\t\t\t\tpass()\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\tthis.dead.use(Promise.all(this.servicesDead))\n\t\t\tthis.servicesLive[this.serviceIdx[serviceName]] = new Future(() => {})\n\t\t\tif (this.live.done) {\n\t\t\t\tthis.live = new Future(() => {})\n\t\t\t}\n\t\t\tthis.live.use(Promise.all(this.servicesLive))\n\t\t} else {\n\t\t\tthis.serviceLoggers[serviceName].error(\n\t\t\t\t`Tried to stop service, but it wasn't running.`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nexport const FLIGHTDECK_INFO = `info`\nexport const FLIGHTDECK_WARN = `warn`\nexport const FLIGHTDECK_ERROR = `ERR!`\n\nexport const flightDeckLogSchema = z.object({\n\tlevel: z.union([\n\t\tz.literal(FLIGHTDECK_INFO),\n\t\tz.literal(FLIGHTDECK_WARN),\n\t\tz.literal(FLIGHTDECK_ERROR),\n\t]),\n\ttimestamp: z.number(),\n\tpackage: z.string(),\n\tservice: z.string().optional(),\n\tprocess: z.number(),\n\tbody: z.string(),\n})\nexport type FlightDeckLog = z.infer<typeof flightDeckLogSchema>\n\nconst LINE_FORMAT = `line-format` satisfies keyof LnavFormat\nconst VALUE = `value` satisfies keyof LnavFormat\n\nexport type LnavFormatVisualComponent = Exclude<\n\tExclude<LnavFormat[`line-format`], undefined>[number],\n\tstring\n>\n\nexport type LnavFormatBreakdown = Exclude<LnavFormat[`value`], undefined>\nexport type MemberOf<T> = T[keyof T]\nexport type LnavFormatValueDefinition = MemberOf<LnavFormatBreakdown>\n\nexport type FlightDeckFormat = {\n\t[LINE_FORMAT]: (\n\t\t| string\n\t\t| (LnavFormatVisualComponent & {\n\t\t\t\tfield: keyof FlightDeckLog | `__level__` | `__timestamp__`\n\t\t })\n\t)[]\n\t[VALUE]: {\n\t\t[K in keyof FlightDeckLog]: LnavFormatValueDefinition & {\n\t\t\tkind: FlightDeckLog[K] extends number | undefined\n\t\t\t\t? `integer`\n\t\t\t\t: FlightDeckLog[K] extends string | undefined\n\t\t\t\t\t? `string`\n\t\t\t\t\t: never\n\t\t}\n\t}\n}\n\nexport const FLIGHTDECK_LNAV_FORMAT = {\n\ttitle: `FlightDeck Log`,\n\tdescription: `Format for events logged by the FlightDeck process manager.`,\n\t\"file-type\": `json`,\n\t\"timestamp-field\": `timestamp`,\n\t\"timestamp-divisor\": 1000,\n\t\"module-field\": `package`,\n\t\"opid-field\": `service`,\n\t\"level-field\": `level`,\n\tlevel: {\n\t\tinfo: FLIGHTDECK_INFO,\n\t\twarning: FLIGHTDECK_WARN,\n\t\terror: FLIGHTDECK_ERROR,\n\t},\n\n\t[LINE_FORMAT]: [\n\t\t{\n\t\t\tfield: `level`,\n\t\t},\n\t\t{\n\t\t\tprefix: ` `,\n\t\t\tfield: `__timestamp__`,\n\t\t\t\"timestamp-format\": `%Y-%m-%dT%H:%M:%S.%L%Z`,\n\t\t},\n\t\t{\n\t\t\tprefix: ` `,\n\t\t\tfield: `process`,\n\t\t\t\"min-width\": 5,\n\t\t},\n\t\t{\n\t\t\tprefix: `:`,\n\t\t\tfield: `package`,\n\t\t},\n\t\t{\n\t\t\tprefix: `:`,\n\t\t\tfield: `service`,\n\t\t\t\"default-value\": ``,\n\t\t},\n\t\t{\n\t\t\tprefix: `: `,\n\t\t\tfield: `body`,\n\t\t},\n\t],\n\n\t[VALUE]: {\n\t\ttimestamp: {\n\t\t\tkind: `integer`,\n\t\t},\n\t\tlevel: {\n\t\t\tkind: `string`,\n\t\t},\n\t\tpackage: {\n\t\t\tkind: `string`,\n\t\t},\n\t\tservice: {\n\t\t\tkind: `string`,\n\t\t},\n\t\tprocess: {\n\t\t\tkind: `integer`,\n\t\t},\n\t\tbody: {\n\t\t\tkind: `string`,\n\t\t},\n\t},\n} as const satisfies FlightDeckFormat & LnavFormat\n\nexport class FlightDeckLogger\n\timplements Pick<Console, `error` | `info` | `warn`>\n{\n\tpublic readonly packageName: string\n\tpublic readonly serviceName?: string\n\tpublic readonly jsonLogging: boolean\n\tpublic processCode: number\n\tpublic constructor(\n\t\tpackageName: string,\n\t\tprocessCode: number,\n\t\tserviceName?: string,\n\t\toptions?: { jsonLogging: boolean },\n\t) {\n\t\tthis.packageName = packageName\n\t\tif (serviceName) {\n\t\t\tthis.serviceName = serviceName\n\t\t}\n\t\tthis.processCode = processCode\n\t\tthis.jsonLogging = options?.jsonLogging ?? false\n\t}\n\tprotected log(\n\t\tlevel:\n\t\t\t| typeof FLIGHTDECK_ERROR\n\t\t\t| typeof FLIGHTDECK_INFO\n\t\t\t| typeof FLIGHTDECK_WARN,\n\t\t...messages: unknown[]\n\t): void {\n\t\tif (this.jsonLogging) {\n\t\t\tlet body = messages\n\t\t\t\t.map((message) =>\n\t\t\t\t\ttypeof message === `string`\n\t\t\t\t\t\t? message\n\t\t\t\t\t\t: inspect(message, false, null, true),\n\t\t\t\t)\n\t\t\t\t.join(` `)\n\t\t\tif (body.includes(`\\n`)) {\n\t\t\t\tbody = `\\n ${body.split(`\\n`).join(`\\n `)}`\n\t\t\t}\n\t\t\tconst log: FlightDeckLog = {\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tlevel,\n\t\t\t\tprocess: this.processCode,\n\t\t\t\tpackage: this.packageName,\n\t\t\t\tbody,\n\t\t\t}\n\t\t\tif (this.serviceName) {\n\t\t\t\tlog.service = this.serviceName\n\t\t\t}\n\t\t\tprocess.stdout.write(JSON.stringify(log) + `\\n`)\n\t\t} else {\n\t\t\tconst source = this.serviceName\n\t\t\t\t? `${this.packageName}:${this.serviceName}`\n\t\t\t\t: this.packageName\n\t\t\tswitch (level) {\n\t\t\t\tcase FLIGHTDECK_INFO:\n\t\t\t\t\tconsole.log(`${source}:`, ...messages)\n\t\t\t\t\tbreak\n\t\t\t\tcase FLIGHTDECK_WARN:\n\t\t\t\t\tconsole.warn(`${source}:`, ...messages)\n\t\t\t\t\tbreak\n\t\t\t\tcase FLIGHTDECK_ERROR:\n\t\t\t\t\tconsole.error(`${source}:`, ...messages)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tpublic info(...messages: unknown[]): void {\n\t\tthis.log(FLIGHTDECK_INFO, ...messages)\n\t}\n\n\tpublic warn(...messages: unknown[]): void {\n\t\tthis.log(FLIGHTDECK_WARN, ...messages)\n\t}\n\n\tpublic error(...messages: unknown[]): void {\n\t\tthis.log(FLIGHTDECK_ERROR, ...messages)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,MAAa,MAAM,UAAU;CAC5B,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,CAAC,UAAU,CAAE;CACpD,eAAe;CACf,QAAQ,CAAE;CACV,YAAY,OAAO,KAAK;CACxB,wBAAwB;AACxB,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a;GACrB,IAAI,OAAO,SACT,IAAI,CAAC,mBACE,aAAa,UACjB,UACA,QAAQ,SAAS,OAAO,MAAM,KAAK,CACtC,CACA,MAAM,GAAG;AACX,OAAI,KAAK,UAAU,IAAI,CACtB,SAAQ,MAAM,KAAK,OAAO,IAAI,CAAC,MAAM,MAAM,CAAC;GAE7C,MAAMC,MAAqB;IAC1B,WAAW,KAAK,KAAK;IACrB;IACA,SAAS,KAAK;IACd,SAAS,KAAK;IACd;GACA;AACD,OAAI,KAAK,YACR,KAAI,UAAU,KAAK;AAEpB,WAAQ,OAAO,MAAM,KAAK,UAAU,IAAI,IAAI,IAAI;EAChD,OAAM;GACN,MAAM,SAAS,KAAK,eAChB,EAAE,KAAK,YAAY,GAAG,KAAK,YAAY,IACxC,KAAK;AACR,WAAQ,OAAR;IACC,KAAK;AACJ,aAAQ,KAAK,EAAE,OAAO,IAAI,GAAG,SAAS;AACtC;IACD,KAAK;AACJ,aAAQ,MAAM,EAAE,OAAO,IAAI,GAAG,SAAS;AACvC;IACD,KAAK;AACJ,aAAQ,OAAO,EAAE,OAAO,IAAI,GAAG,SAAS;AACxC;GACD;EACD;CACD;CACD,AAAO,KAAK,GAAG,UAA2B;AACzC,OAAK,IAAI,iBAAiB,GAAG,SAAS;CACtC;CAED,AAAO,KAAK,GAAG,UAA2B;AACzC,OAAK,IAAI,iBAAiB,GAAG,SAAS;CACtC;CAED,AAAO,MAAM,GAAG,UAA2B;AAC1C,OAAK,IAAI,kBAAkB,GAAG,SAAS;CACvC;AACD"}
|
package/dist/flightdeck.x.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { FlightDeck, FlightDeckLogger } from "./flightdeck.lib-
|
|
2
|
+
import { FlightDeck, FlightDeckLogger } from "./flightdeck.lib-BvPhVP3B.js";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { cli, optional, parseBooleanOption, parseNumberOption } from "comline";
|
|
5
|
-
import { z } from "zod";
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
6
|
|
|
7
7
|
//#region src/flightdeck.x.ts
|
|
8
8
|
const CLI_LOGGER = new FlightDeckLogger(`comline`, process.pid, void 0, { jsonLogging: true });
|
|
@@ -16,7 +16,7 @@ const FLIGHTDECK_MANUAL = {
|
|
|
16
16
|
optionsSchema: z.object({
|
|
17
17
|
port: z.number().optional(),
|
|
18
18
|
packageName: z.string(),
|
|
19
|
-
services: z.record(z.object({
|
|
19
|
+
services: z.record(z.string(), z.object({
|
|
20
20
|
run: z.string(),
|
|
21
21
|
waitFor: z.boolean()
|
|
22
22
|
})),
|
package/dist/flightdeck.x.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flightdeck.x.js","names":[],"sources":["../src/flightdeck.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\"\n\nimport type { OptionsGroup } from \"comline\"\nimport { cli, optional, parseBooleanOption, parseNumberOption } from \"comline\"\nimport { z } from \"zod\"\n\nimport type { FlightDeckOptions } from \"./flightdeck.lib\"\nimport { FlightDeck, FlightDeckLogger } from \"./flightdeck.lib\"\n\nconst CLI_LOGGER = new FlightDeckLogger(`comline`, process.pid, undefined, {\n\tjsonLogging: true,\n})\nObject.assign(console, {\n\tlog: CLI_LOGGER.info.bind(CLI_LOGGER),\n\tinfo: CLI_LOGGER.info.bind(CLI_LOGGER),\n\twarn: CLI_LOGGER.warn.bind(CLI_LOGGER),\n\terror: CLI_LOGGER.error.bind(CLI_LOGGER),\n})\n\nconst FLIGHTDECK_MANUAL = {\n\toptionsSchema: z.object({\n\t\tport: z.number().optional(),\n\t\tpackageName: z.string(),\n\t\tservices: z.record(
|
|
1
|
+
{"version":3,"file":"flightdeck.x.js","names":[],"sources":["../src/flightdeck.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as path from \"node:path\"\n\nimport type { OptionsGroup } from \"comline\"\nimport { cli, optional, parseBooleanOption, parseNumberOption } from \"comline\"\nimport { z } from \"zod/v4\"\n\nimport type { FlightDeckOptions } from \"./flightdeck.lib\"\nimport { FlightDeck, FlightDeckLogger } from \"./flightdeck.lib\"\n\nconst CLI_LOGGER = new FlightDeckLogger(`comline`, process.pid, undefined, {\n\tjsonLogging: true,\n})\nObject.assign(console, {\n\tlog: CLI_LOGGER.info.bind(CLI_LOGGER),\n\tinfo: CLI_LOGGER.info.bind(CLI_LOGGER),\n\twarn: CLI_LOGGER.warn.bind(CLI_LOGGER),\n\terror: CLI_LOGGER.error.bind(CLI_LOGGER),\n})\n\nconst FLIGHTDECK_MANUAL = {\n\toptionsSchema: z.object({\n\t\tport: z.number().optional(),\n\t\tpackageName: z.string(),\n\t\tservices: z.record(\n\t\t\tz.string(),\n\t\t\tz.object({ run: z.string(), waitFor: z.boolean() }),\n\t\t),\n\t\tflightdeckRootDir: z.string(),\n\t\tscripts: z.object({\n\t\t\tdownload: z.string(),\n\t\t\tinstall: z.string(),\n\t\t\tcheckAvailability: z.string(),\n\t\t}),\n\t\tjsonLogging: z.boolean().optional(),\n\t}),\n\toptions: {\n\t\tport: {\n\t\t\tflag: `p`,\n\t\t\trequired: false,\n\t\t\tdescription: `Port to run the flightdeck server on.`,\n\t\t\texample: `--port=8080`,\n\t\t\tparse: parseNumberOption,\n\t\t},\n\t\tpackageName: {\n\t\t\tflag: `n`,\n\t\t\trequired: true,\n\t\t\tdescription: `Name of the package.`,\n\t\t\texample: `--packageName=\\\"my-app\\\"`,\n\t\t},\n\t\tservices: {\n\t\t\tflag: `s`,\n\t\t\trequired: true,\n\t\t\tdescription: `Map of service names to executables.`,\n\t\t\texample: `--services=\"{\\\\\"frontend\\\\\":{\\\\\"run\\\\\":\\\\\"./frontend\\\\\",\\\\\"waitFor\\\\\":false},\\\\\"backend\\\\\":{\\\\\"run\\\\\":\\\\\"./backend\\\\\",\\\\\"waitFor\\\\\":true}}\"`,\n\t\t\tparse: JSON.parse,\n\t\t},\n\t\tflightdeckRootDir: {\n\t\t\tflag: `d`,\n\t\t\trequired: true,\n\t\t\tdescription: `Directory where the service is stored.`,\n\t\t\texample: `--flightdeckRootDir=\\\"./services/sample/repo/my-app/current\\\"`,\n\t\t},\n\t\tscripts: {\n\t\t\tflag: `r`,\n\t\t\trequired: true,\n\t\t\tdescription: `Map of scripts to run.`,\n\t\t\texample: `--scripts=\"{\\\\\"download\\\\\":\\\\\"npm i\",\\\\\"install\\\\\":\\\\\"npm run build\\\\\"}\"`,\n\t\t\tparse: JSON.parse,\n\t\t},\n\t\tjsonLogging: {\n\t\t\tflag: `j`,\n\t\t\trequired: false,\n\t\t\tdescription: `Enable json logging.`,\n\t\t\texample: `--jsonLogging`,\n\t\t\tparse: parseBooleanOption,\n\t\t},\n\t},\n} satisfies OptionsGroup<FlightDeckOptions>\n\nconst SCHEMA_MANUAL = {\n\toptionsSchema: z.object({\n\t\toutdir: z.string().optional(),\n\t}),\n\toptions: {\n\t\toutdir: {\n\t\t\tflag: `o`,\n\t\t\trequired: false,\n\t\t\tdescription: `Directory to write the schema to.`,\n\t\t\texample: `--outdir=./dist`,\n\t\t},\n\t},\n} satisfies OptionsGroup<{ outdir?: string | undefined }>\n\nconst parse = cli(\n\t{\n\t\tcliName: `flightdeck`,\n\t\troutes: optional({ schema: null, $configPath: null }),\n\t\trouteOptions: {\n\t\t\t\"\": FLIGHTDECK_MANUAL,\n\t\t\t$configPath: FLIGHTDECK_MANUAL,\n\t\t\tschema: SCHEMA_MANUAL,\n\t\t},\n\t\tdebugOutput: true,\n\t\tdiscoverConfigPath: (args) => {\n\t\t\tif (args[0] === `schema`) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst configPath =\n\t\t\t\targs[0] ?? path.join(process.cwd(), `flightdeck.config.json`)\n\t\t\treturn configPath\n\t\t},\n\t},\n\tconsole,\n)\n\nconst { inputs, writeJsonSchema } = parse(process.argv)\n\nswitch (inputs.case) {\n\tcase `schema`:\n\t\t{\n\t\t\tconst { outdir } = inputs.opts\n\t\t\twriteJsonSchema(outdir ?? `.`)\n\t\t}\n\t\tbreak\n\tcase ``:\n\tcase `$configPath`: {\n\t\tconst flightDeck = new FlightDeck(inputs.opts)\n\t\tprocess.on(`close`, async () => {\n\t\t\tawait flightDeck.stopAllServices()\n\t\t})\n\t}\n}\n"],"mappings":";;;;;;;AAWA,MAAM,aAAa,IAAI,kBAAkB,UAAU,QAAQ,aAAgB,EAC1E,aAAa,KACb;AACD,OAAO,OAAO,SAAS;CACtB,KAAK,WAAW,KAAK,KAAK,WAAW;CACrC,MAAM,WAAW,KAAK,KAAK,WAAW;CACtC,MAAM,WAAW,KAAK,KAAK,WAAW;CACtC,OAAO,WAAW,MAAM,KAAK,WAAW;AACxC,EAAC;AAEF,MAAM,oBAAoB;CACzB,eAAe,EAAE,OAAO;EACvB,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,aAAa,EAAE,QAAQ;EACvB,UAAU,EAAE,OACX,EAAE,QAAQ,EACV,EAAE,OAAO;GAAE,KAAK,EAAE,QAAQ;GAAE,SAAS,EAAE,SAAS;EAAE,EAAC,CACnD;EACD,mBAAmB,EAAE,QAAQ;EAC7B,SAAS,EAAE,OAAO;GACjB,UAAU,EAAE,QAAQ;GACpB,SAAS,EAAE,QAAQ;GACnB,mBAAmB,EAAE,QAAQ;EAC7B,EAAC;EACF,aAAa,EAAE,SAAS,CAAC,UAAU;CACnC,EAAC;CACF,SAAS;EACR,MAAM;GACL,OAAO;GACP,UAAU;GACV,cAAc;GACd,UAAU;GACV,OAAO;EACP;EACD,aAAa;GACZ,OAAO;GACP,UAAU;GACV,cAAc;GACd,UAAU;EACV;EACD,UAAU;GACT,OAAO;GACP,UAAU;GACV,cAAc;GACd,UAAU;GACV,OAAO,KAAK;EACZ;EACD,mBAAmB;GAClB,OAAO;GACP,UAAU;GACV,cAAc;GACd,UAAU;EACV;EACD,SAAS;GACR,OAAO;GACP,UAAU;GACV,cAAc;GACd,UAAU;GACV,OAAO,KAAK;EACZ;EACD,aAAa;GACZ,OAAO;GACP,UAAU;GACV,cAAc;GACd,UAAU;GACV,OAAO;EACP;CACD;AACD;AAED,MAAM,gBAAgB;CACrB,eAAe,EAAE,OAAO,EACvB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAC7B,EAAC;CACF,SAAS,EACR,QAAQ;EACP,OAAO;EACP,UAAU;EACV,cAAc;EACd,UAAU;CACV,EACD;AACD;AAED,MAAM,QAAQ,IACb;CACC,UAAU;CACV,QAAQ,SAAS;EAAE,QAAQ;EAAM,aAAa;CAAM,EAAC;CACrD,cAAc;EACb,IAAI;EACJ,aAAa;EACb,QAAQ;CACR;CACD,aAAa;CACb,oBAAoB,CAAC,SAAS;AAC7B,MAAI,KAAK,QAAQ,QAChB;EAED,MAAM,aACL,KAAK,MAAM,KAAK,KAAK,QAAQ,KAAK,GAAG,wBAAwB;AAC9D,SAAO;CACP;AACD,GACD,QACA;AAED,MAAM,EAAE,QAAQ,iBAAiB,GAAG,MAAM,QAAQ,KAAK;AAEvD,QAAQ,OAAO,MAAf;CACC,MAAM;EACL;GACC,MAAM,EAAE,QAAQ,GAAG,OAAO;AAC1B,mBAAgB,WAAW,GAAG;EAC9B;AACD;CACD,MAAM;CACN,MAAM,cAAc;EACnB,MAAM,aAAa,IAAI,WAAW,OAAO;AACzC,UAAQ,IAAI,QAAQ,YAAY;AAC/B,SAAM,WAAW,iBAAiB;EAClC,EAAC;CACF;AACD"}
|
package/dist/klaxon.x.js
CHANGED
package/dist/klaxon.x.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"klaxon.x.js","names":["changesetsPublishedPackagesSchema: z.ZodSchema<Klaxon.ScrambleOptions>"],"sources":["../src/klaxon.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { cli, required } from \"comline\"\nimport { z } from \"zod\"\n\nimport * as Klaxon from \"./klaxon.lib\"\n\nconst changesetsPublishedPackagesSchema: z.ZodSchema<Klaxon.ScrambleOptions> =\n\tz.object({\n\t\tpackageConfig: z.record(z.string(), z.object({ endpoint: z.string() })),\n\t\tsecretsConfig: z.record(z.string(), z.string()),\n\t\tpublishedPackages: z.array(\n\t\t\tz.object({\n\t\t\t\tname: z.string(),\n\t\t\t\tversion: z.string(),\n\t\t\t}),\n\t\t),\n\t})\n\nconst klaxon = cli({\n\tcliName: `klaxon`,\n\troutes: required({\n\t\tscramble: null,\n\t}),\n\trouteOptions: {\n\t\tscramble: {\n\t\t\toptions: {\n\t\t\t\tpackageConfig: {\n\t\t\t\t\tdescription: `Maps the names of your packages to the endpoints that klaxon will POST to.`,\n\t\t\t\t\texample: `--packageConfig=\"{\\\\\"my-app\\\\\":{\\\\\"endpoint\\\\\":\\\\\"https://my-app.com\\\\\"}}\"`,\n\t\t\t\t\tflag: `c`,\n\t\t\t\t\tparse: JSON.parse,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t\tsecretsConfig: {\n\t\t\t\t\tdescription: `Maps the names of your packages to the secrets that klaxon will use to authenticate with their respective endpoints.`,\n\t\t\t\t\texample: `--secretsConfig=\"{\\\\\"my-app\\\\\":\\\\\"XXXX-XXXX-XXXX\\\\\"}\"`,\n\t\t\t\t\tflag: `s`,\n\t\t\t\t\tparse: JSON.parse,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t\tpublishedPackages: {\n\t\t\t\t\tdescription: `The output of the \"Publish\" step in Changesets.`,\n\t\t\t\t\texample: `--publishedPackages=\"[{\\\\\"name\\\\\":\\\\\"my-app\\\\\",\\\\\"version\\\\\":\\\\\"0.0.0\\\\\"}]\"`,\n\t\t\t\t\tflag: `p`,\n\t\t\t\t\tparse: JSON.parse,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\toptionsSchema: changesetsPublishedPackagesSchema,\n\t\t},\n\t},\n})\n\nconst { inputs } = klaxon(process.argv)\nawait Klaxon.scramble(inputs.opts).then((scrambleResult) => {\n\tconsole.log(scrambleResult)\n})\n"],"mappings":";;;;;;AAOA,MAAMA,oCACL,EAAE,OAAO;CACR,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAE,EAAC,CAAC;CACvE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC;CAC/C,mBAAmB,EAAE,MACpB,EAAE,OAAO;EACR,MAAM,EAAE,QAAQ;EAChB,SAAS,EAAE,QAAQ;CACnB,EAAC,CACF;AACD,EAAC;AAEH,MAAM,SAAS,IAAI;CAClB,UAAU;CACV,QAAQ,SAAS,EAChB,UAAU,KACV,EAAC;CACF,cAAc,EACb,UAAU;EACT,SAAS;GACR,eAAe;IACd,cAAc;IACd,UAAU;IACV,OAAO;IACP,OAAO,KAAK;IACZ,UAAU;GACV;GACD,eAAe;IACd,cAAc;IACd,UAAU;IACV,OAAO;IACP,OAAO,KAAK;IACZ,UAAU;GACV;GACD,mBAAmB;IAClB,cAAc;IACd,UAAU;IACV,OAAO;IACP,OAAO,KAAK;IACZ,UAAU;GACV;EACD;EACD,eAAe;CACf,EACD;AACD,EAAC;AAEF,MAAM,EAAE,QAAQ,GAAG,OAAO,QAAQ,KAAK;AACvC,MAAM,SAAgB,OAAO,KAAK,CAAC,KAAK,CAAC,mBAAmB;AAC3D,SAAQ,IAAI,eAAe;AAC3B,EAAC"}
|
|
1
|
+
{"version":3,"file":"klaxon.x.js","names":["changesetsPublishedPackagesSchema: z.ZodSchema<Klaxon.ScrambleOptions>"],"sources":["../src/klaxon.x.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { cli, required } from \"comline\"\nimport { z } from \"zod/v4\"\n\nimport * as Klaxon from \"./klaxon.lib\"\n\nconst changesetsPublishedPackagesSchema: z.ZodSchema<Klaxon.ScrambleOptions> =\n\tz.object({\n\t\tpackageConfig: z.record(z.string(), z.object({ endpoint: z.string() })),\n\t\tsecretsConfig: z.record(z.string(), z.string()),\n\t\tpublishedPackages: z.array(\n\t\t\tz.object({\n\t\t\t\tname: z.string(),\n\t\t\t\tversion: z.string(),\n\t\t\t}),\n\t\t),\n\t})\n\nconst klaxon = cli({\n\tcliName: `klaxon`,\n\troutes: required({\n\t\tscramble: null,\n\t}),\n\trouteOptions: {\n\t\tscramble: {\n\t\t\toptions: {\n\t\t\t\tpackageConfig: {\n\t\t\t\t\tdescription: `Maps the names of your packages to the endpoints that klaxon will POST to.`,\n\t\t\t\t\texample: `--packageConfig=\"{\\\\\"my-app\\\\\":{\\\\\"endpoint\\\\\":\\\\\"https://my-app.com\\\\\"}}\"`,\n\t\t\t\t\tflag: `c`,\n\t\t\t\t\tparse: JSON.parse,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t\tsecretsConfig: {\n\t\t\t\t\tdescription: `Maps the names of your packages to the secrets that klaxon will use to authenticate with their respective endpoints.`,\n\t\t\t\t\texample: `--secretsConfig=\"{\\\\\"my-app\\\\\":\\\\\"XXXX-XXXX-XXXX\\\\\"}\"`,\n\t\t\t\t\tflag: `s`,\n\t\t\t\t\tparse: JSON.parse,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t\tpublishedPackages: {\n\t\t\t\t\tdescription: `The output of the \"Publish\" step in Changesets.`,\n\t\t\t\t\texample: `--publishedPackages=\"[{\\\\\"name\\\\\":\\\\\"my-app\\\\\",\\\\\"version\\\\\":\\\\\"0.0.0\\\\\"}]\"`,\n\t\t\t\t\tflag: `p`,\n\t\t\t\t\tparse: JSON.parse,\n\t\t\t\t\trequired: true,\n\t\t\t\t},\n\t\t\t},\n\t\t\toptionsSchema: changesetsPublishedPackagesSchema,\n\t\t},\n\t},\n})\n\nconst { inputs } = klaxon(process.argv)\nawait Klaxon.scramble(inputs.opts).then((scrambleResult) => {\n\tconsole.log(scrambleResult)\n})\n"],"mappings":";;;;;;AAOA,MAAMA,oCACL,EAAE,OAAO;CACR,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAE,EAAC,CAAC;CACvE,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC;CAC/C,mBAAmB,EAAE,MACpB,EAAE,OAAO;EACR,MAAM,EAAE,QAAQ;EAChB,SAAS,EAAE,QAAQ;CACnB,EAAC,CACF;AACD,EAAC;AAEH,MAAM,SAAS,IAAI;CAClB,UAAU;CACV,QAAQ,SAAS,EAChB,UAAU,KACV,EAAC;CACF,cAAc,EACb,UAAU;EACT,SAAS;GACR,eAAe;IACd,cAAc;IACd,UAAU;IACV,OAAO;IACP,OAAO,KAAK;IACZ,UAAU;GACV;GACD,eAAe;IACd,cAAc;IACd,UAAU;IACV,OAAO;IACP,OAAO,KAAK;IACZ,UAAU;GACV;GACD,mBAAmB;IAClB,cAAc;IACd,UAAU;IACV,OAAO;IACP,OAAO,KAAK;IACZ,UAAU;GACV;EACD;EACD,eAAe;CACf,EACD;AACD,EAAC;AAEF,MAAM,EAAE,QAAQ,GAAG,OAAO,QAAQ,KAAK;AACvC,MAAM,SAAgB,OAAO,KAAK,CAAC,KAAK,CAAC,mBAAmB;AAC3D,SAAQ,IAAI,eAAe;AAC3B,EAAC"}
|
package/dist/lib.d.ts
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
1
|
import { __export } from "./chunk-Cl8Af3a2.js";
|
|
2
|
-
import { z } from "zod";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
3
|
import { Future } from "atom.io/internal";
|
|
4
4
|
import { ChildSocket } from "atom.io/realtime-server";
|
|
5
5
|
import { CronJob } from "cron";
|
|
6
6
|
import { FilesystemStorage } from "safedeposit";
|
|
7
|
+
import { z as z$1 } from "zod";
|
|
7
8
|
|
|
8
9
|
//#region gen/lnav-format-schema.gen.d.ts
|
|
9
|
-
declare const lnavFormatSchema: z.ZodObject<{
|
|
10
|
-
regex: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
11
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
12
|
-
"module-format": z.ZodOptional<z.ZodBoolean>;
|
|
13
|
-
}, "strict", z.ZodTypeAny, {
|
|
10
|
+
declare const lnavFormatSchema: z$1.ZodObject<{
|
|
11
|
+
regex: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
12
|
+
pattern: z$1.ZodOptional<z$1.ZodString>;
|
|
13
|
+
"module-format": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
14
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
14
15
|
pattern?: string | undefined;
|
|
15
16
|
"module-format"?: boolean | undefined;
|
|
16
17
|
}, {
|
|
17
18
|
pattern?: string | undefined;
|
|
18
19
|
"module-format"?: boolean | undefined;
|
|
19
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
20
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
20
21
|
pattern?: string | undefined;
|
|
21
22
|
"module-format"?: boolean | undefined;
|
|
22
23
|
}>, Record<string, {
|
|
23
24
|
pattern?: string | undefined;
|
|
24
25
|
"module-format"?: boolean | undefined;
|
|
25
26
|
}>>>;
|
|
26
|
-
json: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
-
"convert-to-local-time": z.ZodOptional<z.ZodBoolean>;
|
|
28
|
-
"hide-extra": z.ZodOptional<z.ZodBoolean>;
|
|
29
|
-
multiline: z.ZodOptional<z.ZodBoolean>;
|
|
30
|
-
"timestamp-divisor": z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodNumber]>>;
|
|
31
|
-
"file-pattern": z.ZodOptional<z.ZodString>;
|
|
32
|
-
converter: z.ZodOptional<z.ZodObject<{
|
|
33
|
-
type: z.ZodOptional<z.ZodString>;
|
|
34
|
-
header: z.ZodOptional<z.ZodObject<{
|
|
35
|
-
expr: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNever]>>, Record<string, string>, Record<string, string>>>;
|
|
36
|
-
size: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
json: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
28
|
+
"convert-to-local-time": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
29
|
+
"hide-extra": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
30
|
+
multiline: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
31
|
+
"timestamp-divisor": z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodNumber, z$1.ZodNumber]>>;
|
|
32
|
+
"file-pattern": z$1.ZodOptional<z$1.ZodString>;
|
|
33
|
+
converter: z$1.ZodOptional<z$1.ZodObject<{
|
|
34
|
+
type: z$1.ZodOptional<z$1.ZodString>;
|
|
35
|
+
header: z$1.ZodOptional<z$1.ZodObject<{
|
|
36
|
+
expr: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodString, z$1.ZodNever]>>, Record<string, string>, Record<string, string>>>;
|
|
37
|
+
size: z$1.ZodOptional<z$1.ZodNumber>;
|
|
38
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
38
39
|
expr?: Record<string, string> | undefined;
|
|
39
40
|
size?: number | undefined;
|
|
40
41
|
}, {
|
|
41
42
|
expr?: Record<string, string> | undefined;
|
|
42
43
|
size?: number | undefined;
|
|
43
44
|
}>>;
|
|
44
|
-
command: z.ZodOptional<z.ZodString>;
|
|
45
|
-
}, "strict", z.ZodTypeAny, {
|
|
45
|
+
command: z$1.ZodOptional<z$1.ZodString>;
|
|
46
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
46
47
|
type?: string | undefined;
|
|
47
48
|
header?: {
|
|
48
49
|
expr?: Record<string, string> | undefined;
|
|
@@ -57,29 +58,29 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
57
58
|
} | undefined;
|
|
58
59
|
command?: string | undefined;
|
|
59
60
|
}>>;
|
|
60
|
-
"level-field": z.ZodOptional<z.ZodString>;
|
|
61
|
-
"level-pointer": z.ZodOptional<z.ZodString>;
|
|
62
|
-
"timestamp-field": z.ZodOptional<z.ZodString>;
|
|
63
|
-
"subsecond-field": z.ZodOptional<z.ZodString>;
|
|
64
|
-
"subsecond-units": z.ZodOptional<z.ZodEnum<["milli", "micro", "nano"]>>;
|
|
65
|
-
"time-field": z.ZodOptional<z.ZodString>;
|
|
66
|
-
"body-field": z.ZodOptional<z.ZodString>;
|
|
67
|
-
url: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodString]>>;
|
|
68
|
-
title: z.ZodOptional<z.ZodString>;
|
|
69
|
-
description: z.ZodOptional<z.ZodString>;
|
|
70
|
-
"timestamp-format": z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
71
|
-
"module-field": z.ZodOptional<z.ZodString>;
|
|
72
|
-
"opid-field": z.ZodOptional<z.ZodString>;
|
|
73
|
-
opid: z.ZodOptional<z.ZodObject<{
|
|
74
|
-
subid: z.ZodOptional<z.ZodString>;
|
|
75
|
-
description: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
76
|
-
format: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
77
|
-
field: z.ZodOptional<z.ZodString>;
|
|
78
|
-
extractor: z.ZodOptional<z.ZodString>;
|
|
79
|
-
prefix: z.ZodOptional<z.ZodString>;
|
|
80
|
-
suffix: z.ZodOptional<z.ZodString>;
|
|
81
|
-
joiner: z.ZodOptional<z.ZodString>;
|
|
82
|
-
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
"level-field": z$1.ZodOptional<z$1.ZodString>;
|
|
62
|
+
"level-pointer": z$1.ZodOptional<z$1.ZodString>;
|
|
63
|
+
"timestamp-field": z$1.ZodOptional<z$1.ZodString>;
|
|
64
|
+
"subsecond-field": z$1.ZodOptional<z$1.ZodString>;
|
|
65
|
+
"subsecond-units": z$1.ZodOptional<z$1.ZodEnum<["milli", "micro", "nano"]>>;
|
|
66
|
+
"time-field": z$1.ZodOptional<z$1.ZodString>;
|
|
67
|
+
"body-field": z$1.ZodOptional<z$1.ZodString>;
|
|
68
|
+
url: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodArray<z$1.ZodString, "many">, z$1.ZodString]>>;
|
|
69
|
+
title: z$1.ZodOptional<z$1.ZodString>;
|
|
70
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
71
|
+
"timestamp-format": z$1.ZodOptional<z$1.ZodArray<z$1.ZodString, "many">>;
|
|
72
|
+
"module-field": z$1.ZodOptional<z$1.ZodString>;
|
|
73
|
+
"opid-field": z$1.ZodOptional<z$1.ZodString>;
|
|
74
|
+
opid: z$1.ZodOptional<z$1.ZodObject<{
|
|
75
|
+
subid: z$1.ZodOptional<z$1.ZodString>;
|
|
76
|
+
description: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
77
|
+
format: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
78
|
+
field: z$1.ZodOptional<z$1.ZodString>;
|
|
79
|
+
extractor: z$1.ZodOptional<z$1.ZodString>;
|
|
80
|
+
prefix: z$1.ZodOptional<z$1.ZodString>;
|
|
81
|
+
suffix: z$1.ZodOptional<z$1.ZodString>;
|
|
82
|
+
joiner: z$1.ZodOptional<z$1.ZodString>;
|
|
83
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
83
84
|
field?: string | undefined;
|
|
84
85
|
extractor?: string | undefined;
|
|
85
86
|
prefix?: string | undefined;
|
|
@@ -92,7 +93,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
92
93
|
suffix?: string | undefined;
|
|
93
94
|
joiner?: string | undefined;
|
|
94
95
|
}>, "many">>;
|
|
95
|
-
}, "strict", z.ZodTypeAny, {
|
|
96
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
96
97
|
format?: {
|
|
97
98
|
field?: string | undefined;
|
|
98
99
|
extractor?: string | undefined;
|
|
@@ -108,7 +109,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
108
109
|
suffix?: string | undefined;
|
|
109
110
|
joiner?: string | undefined;
|
|
110
111
|
}[] | undefined;
|
|
111
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
112
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
112
113
|
format?: {
|
|
113
114
|
field?: string | undefined;
|
|
114
115
|
extractor?: string | undefined;
|
|
@@ -125,14 +126,14 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
125
126
|
joiner?: string | undefined;
|
|
126
127
|
}[] | undefined;
|
|
127
128
|
}>>>;
|
|
128
|
-
"sub-description": z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
129
|
-
format: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
130
|
-
field: z.ZodOptional<z.ZodString>;
|
|
131
|
-
extractor: z.ZodOptional<z.ZodString>;
|
|
132
|
-
prefix: z.ZodOptional<z.ZodString>;
|
|
133
|
-
suffix: z.ZodOptional<z.ZodString>;
|
|
134
|
-
joiner: z.ZodOptional<z.ZodString>;
|
|
135
|
-
}, "strict", z.ZodTypeAny, {
|
|
129
|
+
"sub-description": z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
130
|
+
format: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
131
|
+
field: z$1.ZodOptional<z$1.ZodString>;
|
|
132
|
+
extractor: z$1.ZodOptional<z$1.ZodString>;
|
|
133
|
+
prefix: z$1.ZodOptional<z$1.ZodString>;
|
|
134
|
+
suffix: z$1.ZodOptional<z$1.ZodString>;
|
|
135
|
+
joiner: z$1.ZodOptional<z$1.ZodString>;
|
|
136
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
136
137
|
field?: string | undefined;
|
|
137
138
|
extractor?: string | undefined;
|
|
138
139
|
prefix?: string | undefined;
|
|
@@ -145,7 +146,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
145
146
|
suffix?: string | undefined;
|
|
146
147
|
joiner?: string | undefined;
|
|
147
148
|
}>, "many">>;
|
|
148
|
-
}, "strict", z.ZodTypeAny, {
|
|
149
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
149
150
|
format?: {
|
|
150
151
|
field?: string | undefined;
|
|
151
152
|
extractor?: string | undefined;
|
|
@@ -161,7 +162,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
161
162
|
suffix?: string | undefined;
|
|
162
163
|
joiner?: string | undefined;
|
|
163
164
|
}[] | undefined;
|
|
164
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
165
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
165
166
|
format?: {
|
|
166
167
|
field?: string | undefined;
|
|
167
168
|
extractor?: string | undefined;
|
|
@@ -178,7 +179,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
178
179
|
joiner?: string | undefined;
|
|
179
180
|
}[] | undefined;
|
|
180
181
|
}>>>;
|
|
181
|
-
}, "strict", z.ZodTypeAny, {
|
|
182
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
182
183
|
description?: Record<string, {
|
|
183
184
|
format?: {
|
|
184
185
|
field?: string | undefined;
|
|
@@ -219,30 +220,30 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
219
220
|
}[] | undefined;
|
|
220
221
|
}> | undefined;
|
|
221
222
|
}>>;
|
|
222
|
-
"ordered-by-time": z.ZodOptional<z.ZodBoolean>;
|
|
223
|
-
level: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString]>, z.ZodNever]>>, Record<string, string | number>, Record<string, string | number>>>;
|
|
224
|
-
value: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
225
|
-
kind: z.ZodOptional<z.ZodEnum<["string", "integer", "float", "boolean", "json", "struct", "quoted", "xml"]>>;
|
|
226
|
-
collate: z.ZodOptional<z.ZodString>;
|
|
227
|
-
unit: z.ZodOptional<z.ZodObject<{
|
|
228
|
-
field: z.ZodOptional<z.ZodString>;
|
|
229
|
-
"scaling-factor": z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
230
|
-
op: z.ZodOptional<z.ZodEnum<["identity", "multiply", "divide"]>>;
|
|
231
|
-
value: z.ZodOptional<z.ZodNumber>;
|
|
232
|
-
}, "strict", z.ZodTypeAny, {
|
|
223
|
+
"ordered-by-time": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
224
|
+
level: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodUnion<[z$1.ZodNumber, z$1.ZodString]>, z$1.ZodNever]>>, Record<string, string | number>, Record<string, string | number>>>;
|
|
225
|
+
value: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
226
|
+
kind: z$1.ZodOptional<z$1.ZodEnum<["string", "integer", "float", "boolean", "json", "struct", "quoted", "xml"]>>;
|
|
227
|
+
collate: z$1.ZodOptional<z$1.ZodString>;
|
|
228
|
+
unit: z$1.ZodOptional<z$1.ZodObject<{
|
|
229
|
+
field: z$1.ZodOptional<z$1.ZodString>;
|
|
230
|
+
"scaling-factor": z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
231
|
+
op: z$1.ZodOptional<z$1.ZodEnum<["identity", "multiply", "divide"]>>;
|
|
232
|
+
value: z$1.ZodOptional<z$1.ZodNumber>;
|
|
233
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
233
234
|
value?: number | undefined;
|
|
234
235
|
op?: "identity" | "multiply" | "divide" | undefined;
|
|
235
236
|
}, {
|
|
236
237
|
value?: number | undefined;
|
|
237
238
|
op?: "identity" | "multiply" | "divide" | undefined;
|
|
238
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
239
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
239
240
|
value?: number | undefined;
|
|
240
241
|
op?: "identity" | "multiply" | "divide" | undefined;
|
|
241
242
|
}>, Record<string, {
|
|
242
243
|
value?: number | undefined;
|
|
243
244
|
op?: "identity" | "multiply" | "divide" | undefined;
|
|
244
245
|
}>>>;
|
|
245
|
-
}, "strict", z.ZodTypeAny, {
|
|
246
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
246
247
|
field?: string | undefined;
|
|
247
248
|
"scaling-factor"?: Record<string, {
|
|
248
249
|
value?: number | undefined;
|
|
@@ -255,13 +256,13 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
255
256
|
op?: "identity" | "multiply" | "divide" | undefined;
|
|
256
257
|
}> | undefined;
|
|
257
258
|
}>>;
|
|
258
|
-
identifier: z.ZodOptional<z.ZodBoolean>;
|
|
259
|
-
"foreign-key": z.ZodOptional<z.ZodBoolean>;
|
|
260
|
-
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
261
|
-
"action-list": z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
262
|
-
rewriter: z.ZodOptional<z.ZodString>;
|
|
263
|
-
description: z.ZodOptional<z.ZodString>;
|
|
264
|
-
}, "strict", z.ZodTypeAny, {
|
|
259
|
+
identifier: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
260
|
+
"foreign-key": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
261
|
+
hidden: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
262
|
+
"action-list": z$1.ZodOptional<z$1.ZodArray<z$1.ZodString, "many">>;
|
|
263
|
+
rewriter: z$1.ZodOptional<z$1.ZodString>;
|
|
264
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
265
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
265
266
|
description?: string | undefined;
|
|
266
267
|
kind?: "string" | "boolean" | "integer" | "float" | "json" | "struct" | "quoted" | "xml" | undefined;
|
|
267
268
|
collate?: string | undefined;
|
|
@@ -293,7 +294,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
293
294
|
hidden?: boolean | undefined;
|
|
294
295
|
"action-list"?: string[] | undefined;
|
|
295
296
|
rewriter?: string | undefined;
|
|
296
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
297
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
297
298
|
description?: string | undefined;
|
|
298
299
|
kind?: "string" | "boolean" | "integer" | "float" | "json" | "struct" | "quoted" | "xml" | undefined;
|
|
299
300
|
collate?: string | undefined;
|
|
@@ -326,18 +327,18 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
326
327
|
"action-list"?: string[] | undefined;
|
|
327
328
|
rewriter?: string | undefined;
|
|
328
329
|
}>>>;
|
|
329
|
-
tags: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
330
|
-
paths: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
331
|
-
glob: z.ZodOptional<z.ZodString>;
|
|
332
|
-
}, "strict", z.ZodTypeAny, {
|
|
330
|
+
tags: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
331
|
+
paths: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
332
|
+
glob: z$1.ZodOptional<z$1.ZodString>;
|
|
333
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
333
334
|
glob?: string | undefined;
|
|
334
335
|
}, {
|
|
335
336
|
glob?: string | undefined;
|
|
336
337
|
}>, "many">>;
|
|
337
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
338
|
-
description: z.ZodOptional<z.ZodString>;
|
|
339
|
-
level: z.ZodOptional<z.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
340
|
-
}, "strict", z.ZodTypeAny, {
|
|
338
|
+
pattern: z$1.ZodOptional<z$1.ZodString>;
|
|
339
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
340
|
+
level: z$1.ZodOptional<z$1.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
341
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
341
342
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
342
343
|
pattern?: string | undefined;
|
|
343
344
|
description?: string | undefined;
|
|
@@ -351,7 +352,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
351
352
|
paths?: {
|
|
352
353
|
glob?: string | undefined;
|
|
353
354
|
}[] | undefined;
|
|
354
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
355
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
355
356
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
356
357
|
pattern?: string | undefined;
|
|
357
358
|
description?: string | undefined;
|
|
@@ -366,18 +367,18 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
366
367
|
glob?: string | undefined;
|
|
367
368
|
}[] | undefined;
|
|
368
369
|
}>>>;
|
|
369
|
-
partitions: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
370
|
-
paths: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
371
|
-
glob: z.ZodOptional<z.ZodString>;
|
|
372
|
-
}, "strict", z.ZodTypeAny, {
|
|
370
|
+
partitions: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
371
|
+
paths: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
372
|
+
glob: z$1.ZodOptional<z$1.ZodString>;
|
|
373
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
373
374
|
glob?: string | undefined;
|
|
374
375
|
}, {
|
|
375
376
|
glob?: string | undefined;
|
|
376
377
|
}>, "many">>;
|
|
377
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
378
|
-
description: z.ZodOptional<z.ZodString>;
|
|
379
|
-
level: z.ZodOptional<z.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
380
|
-
}, "strict", z.ZodTypeAny, {
|
|
378
|
+
pattern: z$1.ZodOptional<z$1.ZodString>;
|
|
379
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
380
|
+
level: z$1.ZodOptional<z$1.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
381
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
381
382
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
382
383
|
pattern?: string | undefined;
|
|
383
384
|
description?: string | undefined;
|
|
@@ -391,7 +392,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
391
392
|
paths?: {
|
|
392
393
|
glob?: string | undefined;
|
|
393
394
|
}[] | undefined;
|
|
394
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
395
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
395
396
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
396
397
|
pattern?: string | undefined;
|
|
397
398
|
description?: string | undefined;
|
|
@@ -406,11 +407,11 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
406
407
|
glob?: string | undefined;
|
|
407
408
|
}[] | undefined;
|
|
408
409
|
}>>>;
|
|
409
|
-
action: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
410
|
-
label: z.ZodOptional<z.ZodString>;
|
|
411
|
-
"capture-output": z.ZodOptional<z.ZodBoolean>;
|
|
412
|
-
cmd: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
413
|
-
}, "strict", z.ZodTypeAny, {
|
|
410
|
+
action: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodUnion<[z$1.ZodString, z$1.ZodObject<{
|
|
411
|
+
label: z$1.ZodOptional<z$1.ZodString>;
|
|
412
|
+
"capture-output": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
413
|
+
cmd: z$1.ZodOptional<z$1.ZodArray<z$1.ZodString, "many">>;
|
|
414
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
414
415
|
label?: string | undefined;
|
|
415
416
|
"capture-output"?: boolean | undefined;
|
|
416
417
|
cmd?: string[] | undefined;
|
|
@@ -418,7 +419,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
418
419
|
label?: string | undefined;
|
|
419
420
|
"capture-output"?: boolean | undefined;
|
|
420
421
|
cmd?: string[] | undefined;
|
|
421
|
-
}>]>, z.ZodNever]>>, Record<string, string | {
|
|
422
|
+
}>]>, z$1.ZodNever]>>, Record<string, string | {
|
|
422
423
|
label?: string | undefined;
|
|
423
424
|
"capture-output"?: boolean | undefined;
|
|
424
425
|
cmd?: string[] | undefined;
|
|
@@ -427,11 +428,11 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
427
428
|
"capture-output"?: boolean | undefined;
|
|
428
429
|
cmd?: string[] | undefined;
|
|
429
430
|
}>>>;
|
|
430
|
-
sample: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
431
|
-
description: z.ZodOptional<z.ZodString>;
|
|
432
|
-
line: z.ZodOptional<z.ZodString>;
|
|
433
|
-
level: z.ZodOptional<z.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
434
|
-
}, "strict", z.ZodTypeAny, {
|
|
431
|
+
sample: z$1.ZodOptional<z$1.ZodArray<z$1.ZodObject<{
|
|
432
|
+
description: z$1.ZodOptional<z$1.ZodString>;
|
|
433
|
+
line: z$1.ZodOptional<z$1.ZodString>;
|
|
434
|
+
level: z$1.ZodOptional<z$1.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
435
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
435
436
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
436
437
|
description?: string | undefined;
|
|
437
438
|
line?: string | undefined;
|
|
@@ -440,19 +441,19 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
440
441
|
description?: string | undefined;
|
|
441
442
|
line?: string | undefined;
|
|
442
443
|
}>, "many">>;
|
|
443
|
-
"line-format": z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
444
|
-
field: z.ZodOptional<z.ZodString>;
|
|
445
|
-
"default-value": z.ZodOptional<z.ZodString>;
|
|
446
|
-
"timestamp-format": z.ZodOptional<z.ZodString>;
|
|
447
|
-
"min-width": z.ZodOptional<z.ZodNumber>;
|
|
448
|
-
"auto-width": z.ZodOptional<z.ZodBoolean>;
|
|
449
|
-
"max-width": z.ZodOptional<z.ZodNumber>;
|
|
450
|
-
align: z.ZodOptional<z.ZodEnum<["left", "right"]>>;
|
|
451
|
-
overflow: z.ZodOptional<z.ZodEnum<["abbrev", "truncate", "dot-dot", "last-word"]>>;
|
|
452
|
-
"text-transform": z.ZodOptional<z.ZodEnum<["none", "uppercase", "lowercase", "capitalize"]>>;
|
|
453
|
-
prefix: z.ZodOptional<z.ZodString>;
|
|
454
|
-
suffix: z.ZodOptional<z.ZodString>;
|
|
455
|
-
}, "strict", z.ZodTypeAny, {
|
|
444
|
+
"line-format": z$1.ZodOptional<z$1.ZodArray<z$1.ZodUnion<[z$1.ZodString, z$1.ZodObject<{
|
|
445
|
+
field: z$1.ZodOptional<z$1.ZodString>;
|
|
446
|
+
"default-value": z$1.ZodOptional<z$1.ZodString>;
|
|
447
|
+
"timestamp-format": z$1.ZodOptional<z$1.ZodString>;
|
|
448
|
+
"min-width": z$1.ZodOptional<z$1.ZodNumber>;
|
|
449
|
+
"auto-width": z$1.ZodOptional<z$1.ZodBoolean>;
|
|
450
|
+
"max-width": z$1.ZodOptional<z$1.ZodNumber>;
|
|
451
|
+
align: z$1.ZodOptional<z$1.ZodEnum<["left", "right"]>>;
|
|
452
|
+
overflow: z$1.ZodOptional<z$1.ZodEnum<["abbrev", "truncate", "dot-dot", "last-word"]>>;
|
|
453
|
+
"text-transform": z$1.ZodOptional<z$1.ZodEnum<["none", "uppercase", "lowercase", "capitalize"]>>;
|
|
454
|
+
prefix: z$1.ZodOptional<z$1.ZodString>;
|
|
455
|
+
suffix: z$1.ZodOptional<z$1.ZodString>;
|
|
456
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
456
457
|
"timestamp-format"?: string | undefined;
|
|
457
458
|
field?: string | undefined;
|
|
458
459
|
prefix?: string | undefined;
|
|
@@ -477,11 +478,11 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
477
478
|
overflow?: "abbrev" | "truncate" | "dot-dot" | "last-word" | undefined;
|
|
478
479
|
"text-transform"?: "none" | "uppercase" | "lowercase" | "capitalize" | undefined;
|
|
479
480
|
}>]>, "many">>;
|
|
480
|
-
"search-table": z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
481
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
482
|
-
glob: z.ZodOptional<z.ZodString>;
|
|
483
|
-
level: z.ZodOptional<z.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
484
|
-
}, "strict", z.ZodTypeAny, {
|
|
481
|
+
"search-table": z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
482
|
+
pattern: z$1.ZodOptional<z$1.ZodString>;
|
|
483
|
+
glob: z$1.ZodOptional<z$1.ZodString>;
|
|
484
|
+
level: z$1.ZodOptional<z$1.ZodEnum<["trace", "debug5", "debug4", "debug3", "debug2", "debug", "info", "stats", "notice", "warning", "error", "critical", "fatal"]>>;
|
|
485
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
485
486
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
486
487
|
pattern?: string | undefined;
|
|
487
488
|
glob?: string | undefined;
|
|
@@ -489,7 +490,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
489
490
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
490
491
|
pattern?: string | undefined;
|
|
491
492
|
glob?: string | undefined;
|
|
492
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
493
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
493
494
|
level?: "info" | "trace" | "debug5" | "debug4" | "debug3" | "debug2" | "debug" | "stats" | "notice" | "warning" | "error" | "critical" | "fatal" | undefined;
|
|
494
495
|
pattern?: string | undefined;
|
|
495
496
|
glob?: string | undefined;
|
|
@@ -498,13 +499,13 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
498
499
|
pattern?: string | undefined;
|
|
499
500
|
glob?: string | undefined;
|
|
500
501
|
}>>>;
|
|
501
|
-
highlights: z.ZodOptional<z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodObject<{
|
|
502
|
-
pattern: z.ZodOptional<z.ZodString>;
|
|
503
|
-
color: z.ZodOptional<z.ZodString>;
|
|
504
|
-
"background-color": z.ZodOptional<z.ZodString>;
|
|
505
|
-
underline: z.ZodOptional<z.ZodBoolean>;
|
|
506
|
-
blink: z.ZodOptional<z.ZodBoolean>;
|
|
507
|
-
}, "strict", z.ZodTypeAny, {
|
|
502
|
+
highlights: z$1.ZodOptional<z$1.ZodEffects<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnion<[z$1.ZodObject<{
|
|
503
|
+
pattern: z$1.ZodOptional<z$1.ZodString>;
|
|
504
|
+
color: z$1.ZodOptional<z$1.ZodString>;
|
|
505
|
+
"background-color": z$1.ZodOptional<z$1.ZodString>;
|
|
506
|
+
underline: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
507
|
+
blink: z$1.ZodOptional<z$1.ZodBoolean>;
|
|
508
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
508
509
|
pattern?: string | undefined;
|
|
509
510
|
color?: string | undefined;
|
|
510
511
|
"background-color"?: string | undefined;
|
|
@@ -516,7 +517,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
516
517
|
"background-color"?: string | undefined;
|
|
517
518
|
underline?: boolean | undefined;
|
|
518
519
|
blink?: boolean | undefined;
|
|
519
|
-
}>, z.ZodNever]>>, Record<string, {
|
|
520
|
+
}>, z$1.ZodNever]>>, Record<string, {
|
|
520
521
|
pattern?: string | undefined;
|
|
521
522
|
color?: string | undefined;
|
|
522
523
|
"background-color"?: string | undefined;
|
|
@@ -529,9 +530,9 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
529
530
|
underline?: boolean | undefined;
|
|
530
531
|
blink?: boolean | undefined;
|
|
531
532
|
}>>>;
|
|
532
|
-
"file-type": z.ZodOptional<z.ZodEnum<["text", "json", "csv"]>>;
|
|
533
|
-
"max-unrecognized-lines": z.ZodOptional<z.ZodNumber>;
|
|
534
|
-
}, "strict", z.ZodTypeAny, {
|
|
533
|
+
"file-type": z$1.ZodOptional<z$1.ZodEnum<["text", "json", "csv"]>>;
|
|
534
|
+
"max-unrecognized-lines": z$1.ZodOptional<z$1.ZodNumber>;
|
|
535
|
+
}, "strict", z$1.ZodTypeAny, {
|
|
535
536
|
level?: Record<string, string | number> | undefined;
|
|
536
537
|
value?: Record<string, {
|
|
537
538
|
description?: string | undefined;
|
|
@@ -782,7 +783,7 @@ declare const lnavFormatSchema: z.ZodObject<{
|
|
|
782
783
|
"file-type"?: "json" | "text" | "csv" | undefined;
|
|
783
784
|
"max-unrecognized-lines"?: number | undefined;
|
|
784
785
|
}>;
|
|
785
|
-
type LnavFormat = z.infer<typeof lnavFormatSchema>; //#endregion
|
|
786
|
+
type LnavFormat = z$1.infer<typeof lnavFormatSchema>; //#endregion
|
|
786
787
|
//#region src/flightdeck.lib.d.ts
|
|
787
788
|
declare const FLIGHTDECK_SETUP_PHASES: readonly ["downloaded", "installed"];
|
|
788
789
|
type FlightDeckSetupPhase = (typeof FLIGHTDECK_SETUP_PHASES)[number];
|
|
@@ -846,27 +847,13 @@ declare const FLIGHTDECK_INFO = "info";
|
|
|
846
847
|
declare const FLIGHTDECK_WARN = "warn";
|
|
847
848
|
declare const FLIGHTDECK_ERROR = "ERR!";
|
|
848
849
|
declare const flightDeckLogSchema: z.ZodObject<{
|
|
849
|
-
level: z.ZodUnion<[z.ZodLiteral<"info">, z.ZodLiteral<"warn">, z.ZodLiteral<"ERR!">]>;
|
|
850
|
+
level: z.ZodUnion<readonly [z.ZodLiteral<"info">, z.ZodLiteral<"warn">, z.ZodLiteral<"ERR!">]>;
|
|
850
851
|
timestamp: z.ZodNumber;
|
|
851
852
|
package: z.ZodString;
|
|
852
853
|
service: z.ZodOptional<z.ZodString>;
|
|
853
854
|
process: z.ZodNumber;
|
|
854
855
|
body: z.ZodString;
|
|
855
|
-
},
|
|
856
|
-
level: "info" | "warn" | "ERR!";
|
|
857
|
-
timestamp: number;
|
|
858
|
-
package: string;
|
|
859
|
-
process: number;
|
|
860
|
-
body: string;
|
|
861
|
-
service?: string | undefined;
|
|
862
|
-
}, {
|
|
863
|
-
level: "info" | "warn" | "ERR!";
|
|
864
|
-
timestamp: number;
|
|
865
|
-
package: string;
|
|
866
|
-
process: number;
|
|
867
|
-
body: string;
|
|
868
|
-
service?: string | undefined;
|
|
869
|
-
}>;
|
|
856
|
+
}, z.core.$strip>;
|
|
870
857
|
type FlightDeckLog = z.infer<typeof flightDeckLogSchema>;
|
|
871
858
|
declare const LINE_FORMAT = "line-format";
|
|
872
859
|
declare const VALUE = "value";
|
package/dist/lib.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FLIGHTDECK_ERROR, FLIGHTDECK_INFO, FLIGHTDECK_LNAV_FORMAT, FLIGHTDECK_SETUP_PHASES, FLIGHTDECK_UPDATE_PHASES, FLIGHTDECK_WARN, FlightDeck, FlightDeckLogger, flightDeckLogSchema, isVersionNumber } from "./flightdeck.lib-
|
|
1
|
+
import { FLIGHTDECK_ERROR, FLIGHTDECK_INFO, FLIGHTDECK_LNAV_FORMAT, FLIGHTDECK_SETUP_PHASES, FLIGHTDECK_UPDATE_PHASES, FLIGHTDECK_WARN, FlightDeck, FlightDeckLogger, flightDeckLogSchema, isVersionNumber } from "./flightdeck.lib-BvPhVP3B.js";
|
|
2
2
|
import { klaxon_lib_exports } from "./klaxon.lib-CNw2A3ce.js";
|
|
3
3
|
|
|
4
4
|
export { FLIGHTDECK_ERROR, FLIGHTDECK_INFO, FLIGHTDECK_LNAV_FORMAT, FLIGHTDECK_SETUP_PHASES, FLIGHTDECK_UPDATE_PHASES, FLIGHTDECK_WARN, FlightDeck, FlightDeckLogger, klaxon_lib_exports as Klaxon, flightDeckLogSchema, isVersionNumber };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flightdeck",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.35",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jeremy Banka",
|
|
@@ -29,25 +29,25 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@t3-oss/env-core": "0.13.4",
|
|
31
31
|
"cron": "4.3.0",
|
|
32
|
-
"zod": "3.
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
32
|
+
"zod": "3.25.7",
|
|
33
|
+
"atom.io": "0.33.4",
|
|
34
|
+
"comline": "0.3.0",
|
|
35
|
+
"safedeposit": "0.1.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/bun": "npm:bun-types@1.2.13",
|
|
39
39
|
"@biomejs/js-api": "0.7.1",
|
|
40
40
|
"@biomejs/wasm-nodejs": "1.9.4",
|
|
41
|
-
"@types/node": "22.15.
|
|
41
|
+
"@types/node": "22.15.19",
|
|
42
42
|
"@types/tmp": "0.2.6",
|
|
43
43
|
"concurrently": "9.1.2",
|
|
44
44
|
"eslint": "9.27.0",
|
|
45
45
|
"json-schema-to-zod": "2.6.1",
|
|
46
46
|
"rimraf": "6.0.1",
|
|
47
47
|
"tmp": "0.2.3",
|
|
48
|
-
"tsdown": "0.11.
|
|
49
|
-
"vitest": "3.1.
|
|
50
|
-
"varmint": "0.5.
|
|
48
|
+
"tsdown": "0.11.12",
|
|
49
|
+
"vitest": "3.1.4",
|
|
50
|
+
"varmint": "0.5.1"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"gen": "bun ./__scripts__/gen.bun.ts",
|
package/src/flightdeck.env.ts
CHANGED
package/src/flightdeck.lib.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { fromEntries, toEntries } from "atom.io/json"
|
|
|
11
11
|
import { ChildSocket } from "atom.io/realtime-server"
|
|
12
12
|
import { CronJob } from "cron"
|
|
13
13
|
import { FilesystemStorage } from "safedeposit"
|
|
14
|
-
import { z } from "zod"
|
|
14
|
+
import { z } from "zod/v4"
|
|
15
15
|
|
|
16
16
|
import type { LnavFormat } from "../gen/lnav-format-schema.gen"
|
|
17
17
|
import { env } from "./flightdeck.env"
|
package/src/flightdeck.x.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as path from "node:path"
|
|
|
4
4
|
|
|
5
5
|
import type { OptionsGroup } from "comline"
|
|
6
6
|
import { cli, optional, parseBooleanOption, parseNumberOption } from "comline"
|
|
7
|
-
import { z } from "zod"
|
|
7
|
+
import { z } from "zod/v4"
|
|
8
8
|
|
|
9
9
|
import type { FlightDeckOptions } from "./flightdeck.lib"
|
|
10
10
|
import { FlightDeck, FlightDeckLogger } from "./flightdeck.lib"
|
|
@@ -23,7 +23,10 @@ const FLIGHTDECK_MANUAL = {
|
|
|
23
23
|
optionsSchema: z.object({
|
|
24
24
|
port: z.number().optional(),
|
|
25
25
|
packageName: z.string(),
|
|
26
|
-
services: z.record(
|
|
26
|
+
services: z.record(
|
|
27
|
+
z.string(),
|
|
28
|
+
z.object({ run: z.string(), waitFor: z.boolean() }),
|
|
29
|
+
),
|
|
27
30
|
flightdeckRootDir: z.string(),
|
|
28
31
|
scripts: z.object({
|
|
29
32
|
download: z.string(),
|
package/src/klaxon.x.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flightdeck.lib-DKgZNVMu.js","names":["version: string","options: FlightDeckOptions<S>","data: Uint8Array[]","serviceName: S","packageName: string","processCode: number","serviceName?: string","options?: { jsonLogging: boolean }","level:\n\t\t\t| typeof FLIGHTDECK_ERROR\n\t\t\t| typeof FLIGHTDECK_INFO\n\t\t\t| typeof FLIGHTDECK_WARN","log: FlightDeckLog"],"sources":["../src/flightdeck.env.ts","../src/flightdeck.lib.ts"],"sourcesContent":["import { createEnv } from \"@t3-oss/env-core\"\nimport { z } from \"zod\"\n\nexport const env = createEnv({\n\tserver: { FLIGHTDECK_SECRET: z.string().optional() },\n\tclientPrefix: `NEVER`,\n\tclient: {},\n\truntimeEnv: import.meta.env as Record<string, string>,\n\temptyStringAsUndefined: true,\n})\n","/* eslint-disable @typescript-eslint/only-throw-error */\nimport { execSync, spawn } from \"node:child_process\"\nimport { createServer } from \"node:http\"\nimport { homedir } from \"node:os\"\nimport { resolve } from \"node:path\"\nimport { inspect } from \"node:util\"\n\nimport { Future } from \"atom.io/internal\"\nimport { discoverType } from \"atom.io/introspection\"\nimport { fromEntries, toEntries } from \"atom.io/json\"\nimport { ChildSocket } from \"atom.io/realtime-server\"\nimport { CronJob } from \"cron\"\nimport { FilesystemStorage } from \"safedeposit\"\nimport { z } from \"zod\"\n\nimport type { LnavFormat } from \"../gen/lnav-format-schema.gen\"\nimport { env } from \"./flightdeck.env\"\n\nexport const FLIGHTDECK_SETUP_PHASES = [`downloaded`, `installed`] as const\n\nexport type FlightDeckSetupPhase = (typeof FLIGHTDECK_SETUP_PHASES)[number]\n\nexport const FLIGHTDECK_UPDATE_PHASES = [`notified`, `confirmed`] as const\n\nexport type FlightDeckUpdatePhase = (typeof FLIGHTDECK_UPDATE_PHASES)[number]\n\nexport function isVersionNumber(version: string): boolean {\n\treturn (\n\t\t/^\\d+\\.\\d+\\.\\d+$/.test(version) || !Number.isNaN(Number.parseFloat(version))\n\t)\n}\n\nexport type FlightDeckOptions<S extends string = string> = {\n\tpackageName: string\n\tservices: { [service in S]: { run: string; waitFor: boolean } }\n\tscripts: {\n\t\tdownload: string\n\t\tinstall: string\n\t\tcheckAvailability?: string\n\t}\n\tport?: number | undefined\n\tflightdeckRootDir?: string | undefined\n\tjsonLogging?: boolean | undefined\n}\n\nexport class FlightDeck<S extends string = string> {\n\tpublic readonly options: FlightDeckOptions<S>\n\tprotected safety = 0\n\n\tprotected storage: FilesystemStorage<{\n\t\tsetupPhase: FlightDeckSetupPhase\n\t\tupdatePhase: FlightDeckUpdatePhase\n\t\tupdateAwaitedVersion: string\n\t}>\n\tprotected services: {\n\t\t[service in S]: ChildSocket<\n\t\t\t{ timeToStop: []; updatesReady: [] },\n\t\t\t{ readyToUpdate: []; alive: [] }\n\t\t> | null\n\t}\n\tprotected serviceIdx: { readonly [service in S]: number }\n\tpublic defaultServicesReadyToUpdate: { readonly [service in S]: boolean }\n\tpublic servicesReadyToUpdate: { [service in S]: boolean }\n\tpublic autoRespawnDeadServices: boolean\n\n\tprotected logger: Pick<Console, `error` | `info` | `warn`>\n\tprotected serviceLoggers: {\n\t\treadonly [service in S]: FlightDeckLogger\n\t}\n\n\tprotected updateAvailabilityChecker: CronJob | null = null\n\n\tpublic servicesLive: Future<void>[]\n\tpublic servicesDead: Future<void>[]\n\tpublic live = new Future(() => {})\n\tpublic dead = new Future(() => {})\n\n\tprotected restartTimes: number[] = []\n\n\tpublic constructor(options: FlightDeckOptions<S>) {\n\t\tthis.options = options\n\t\tconst { FLIGHTDECK_SECRET } = env\n\t\tconst { flightdeckRootDir = resolve(homedir(), `.flightdeck`) } = options\n\t\tconst port = options.port ?? 8080\n\t\tconst origin = `http://localhost:${port}`\n\n\t\tconst servicesEntries = toEntries(options.services)\n\t\tthis.services = fromEntries(\n\t\t\tservicesEntries.map(([serviceName]) => [serviceName, null]),\n\t\t)\n\t\tthis.serviceIdx = fromEntries(\n\t\t\tservicesEntries.map(([serviceName], idx) => [serviceName, idx]),\n\t\t)\n\t\tthis.defaultServicesReadyToUpdate = fromEntries(\n\t\t\tservicesEntries.map(([serviceName, { waitFor }]) => [\n\t\t\t\tserviceName,\n\t\t\t\t!waitFor,\n\t\t\t]),\n\t\t)\n\t\tthis.servicesReadyToUpdate = { ...this.defaultServicesReadyToUpdate }\n\t\tthis.autoRespawnDeadServices = true\n\n\t\tthis.logger = new FlightDeckLogger(\n\t\t\tthis.options.packageName,\n\t\t\tprocess.pid,\n\t\t\tundefined,\n\t\t\t{ jsonLogging: this.options.jsonLogging ?? false },\n\t\t)\n\t\tthis.serviceLoggers = fromEntries(\n\t\t\tservicesEntries.map(([serviceName]) => [\n\t\t\t\tserviceName,\n\t\t\t\tnew FlightDeckLogger(\n\t\t\t\t\tthis.options.packageName,\n\t\t\t\t\tprocess.pid,\n\t\t\t\t\tserviceName,\n\t\t\t\t\t{ jsonLogging: this.options.jsonLogging ?? false },\n\t\t\t\t),\n\t\t\t]),\n\t\t)\n\n\t\tthis.servicesLive = servicesEntries.map(() => new Future(() => {}))\n\t\tthis.servicesDead = servicesEntries.map(() => new Future(() => {}))\n\t\tthis.live.use(Promise.all(this.servicesLive))\n\t\tthis.dead.use(Promise.all(this.servicesDead))\n\n\t\tthis.storage = new FilesystemStorage({\n\t\t\tpath: resolve(flightdeckRootDir, `storage`, options.packageName),\n\t\t})\n\n\t\tif (FLIGHTDECK_SECRET === undefined) {\n\t\t\tthis.logger.warn(\n\t\t\t\t`No FLIGHTDECK_SECRET environment variable found. FlightDeck will not run an update server.`,\n\t\t\t)\n\t\t} else {\n\t\t\tcreateServer((req, res) => {\n\t\t\t\tlet data: Uint8Array[] = []\n\t\t\t\treq\n\t\t\t\t\t.on(`data`, (chunk) => {\n\t\t\t\t\t\tdata.push(chunk instanceof Buffer ? chunk : Buffer.from(chunk))\n\t\t\t\t\t})\n\t\t\t\t\t.on(`end`, async () => {\n\t\t\t\t\t\tconst authHeader = req.headers.authorization\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tif (typeof req.url === `undefined`) throw 400\n\t\t\t\t\t\t\tconst expectedAuthHeader = `Bearer ${FLIGHTDECK_SECRET}`\n\t\t\t\t\t\t\tif (authHeader !== `Bearer ${FLIGHTDECK_SECRET}`) {\n\t\t\t\t\t\t\t\tthis.logger.info(\n\t\t\t\t\t\t\t\t\t`Unauthorized: needed \\`${expectedAuthHeader}\\`, got \\`${authHeader}\\``,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tthrow 401\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tconst url = new URL(req.url, origin)\n\t\t\t\t\t\t\tthis.logger.info(req.method, url.pathname)\n\n\t\t\t\t\t\t\tconst versionForeignInput = Buffer.concat(data).toString()\n\t\t\t\t\t\t\tif (!isVersionNumber(versionForeignInput)) {\n\t\t\t\t\t\t\t\tthrow 400\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tres.writeHead(200)\n\t\t\t\t\t\t\tres.end()\n\n\t\t\t\t\t\t\tthis.storage.setItem(`updatePhase`, `notified`)\n\t\t\t\t\t\t\tthis.storage.setItem(`updateAwaitedVersion`, versionForeignInput)\n\t\t\t\t\t\t\tconst { checkAvailability } = options.scripts\n\t\t\t\t\t\t\tif (checkAvailability) {\n\t\t\t\t\t\t\t\tawait this.updateAvailabilityChecker?.stop()\n\t\t\t\t\t\t\t\tawait this.seekUpdate(versionForeignInput)\n\t\t\t\t\t\t\t\tconst updatePhase = this.storage.getItem(`updatePhase`)\n\t\t\t\t\t\t\t\tthis.logger.info(`> storage(\"updatePhase\") >`, updatePhase)\n\t\t\t\t\t\t\t\tif (updatePhase === `notified`) {\n\t\t\t\t\t\t\t\t\tthis.updateAvailabilityChecker = new CronJob(\n\t\t\t\t\t\t\t\t\t\t`*/30 * * * * *`,\n\t\t\t\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\t\t\t\tawait this.seekUpdate(versionForeignInput)\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\tthis.updateAvailabilityChecker.start()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.downloadPackage()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (thrown) {\n\t\t\t\t\t\t\tthis.logger.error(thrown, req.url)\n\t\t\t\t\t\t\tif (typeof thrown === `number`) {\n\t\t\t\t\t\t\t\tres.writeHead(thrown)\n\t\t\t\t\t\t\t\tres.end()\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tdata = []\n\t\t\t\t\t\t}\n\t\t\t\t\t})\n\t\t\t}).listen(port, () => {\n\t\t\t\tthis.logger.info(`Server started on port ${port}`)\n\t\t\t})\n\t\t}\n\n\t\tthis.startAllServices()\n\t\t\t.then(() => {\n\t\t\t\tthis.logger.info(`All services started.`)\n\t\t\t})\n\t\t\t.catch((thrown) => {\n\t\t\t\tif (thrown instanceof Error) {\n\t\t\t\t\tthis.logger.error(`Failed to start all services:`, thrown.message)\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\tprotected async seekUpdate(version: string): Promise<void> {\n\t\tthis.logger.info(`Checking for updates...`)\n\t\tconst { checkAvailability } = this.options.scripts\n\t\tif (!checkAvailability) {\n\t\t\tthis.logger.info(`No checkAvailability script found.`)\n\t\t\treturn\n\t\t}\n\t\ttry {\n\t\t\tconst out = execSync(`${checkAvailability} ${version}`)\n\t\t\tthis.logger.info(`Check stdout:`, out.toString())\n\t\t\tawait this.updateAvailabilityChecker?.stop()\n\t\t\tthis.storage.setItem(`updatePhase`, `confirmed`)\n\t\t\tthis.downloadPackage()\n\t\t\tthis.announceUpdate()\n\t\t} catch (thrown) {\n\t\t\tif (thrown instanceof Error) {\n\t\t\t\tthis.logger.error(`Check failed:`, thrown.message)\n\t\t\t} else {\n\t\t\t\tconst thrownType = discoverType(thrown)\n\t\t\t\tthis.logger.error(`Check threw`, thrownType, thrown)\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected announceUpdate(): void {\n\t\tfor (const entry of toEntries(this.services)) {\n\t\t\tconst [serviceName, service] = entry\n\t\t\tif (service) {\n\t\t\t\tif (this.options.services[serviceName].waitFor) {\n\t\t\t\t\tservice.emit(`updatesReady`)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.startService(serviceName)\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected tryUpdate(): void {\n\t\tif (toEntries(this.servicesReadyToUpdate).every(([, isReady]) => isReady)) {\n\t\t\tthis.logger.info(`All services are ready to update.`)\n\t\t\tthis.stopAllServices()\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.logger.info(`All services stopped; starting up fresh...`)\n\t\t\t\t\tthis.startAllServices()\n\t\t\t\t\t\t.then(() => {\n\t\t\t\t\t\t\tthis.logger.info(`All services started; we're back online.`)\n\t\t\t\t\t\t})\n\t\t\t\t\t\t.catch((thrown) => {\n\t\t\t\t\t\t\tif (thrown instanceof Error) {\n\t\t\t\t\t\t\t\tthis.logger.error(\n\t\t\t\t\t\t\t\t\t`Failed to start all services:`,\n\t\t\t\t\t\t\t\t\tthrown.message,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch((thrown) => {\n\t\t\t\t\tif (thrown instanceof Error) {\n\t\t\t\t\t\tthis.logger.error(`Failed to stop all services:`, thrown.message)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\tprotected startAllServices(): Future<unknown> {\n\t\tthis.logger.info(`Starting all services...`)\n\t\tthis.autoRespawnDeadServices = true\n\t\tconst setupPhase = this.storage.getItem(`setupPhase`)\n\t\tthis.logger.info(`> storage(\"setupPhase\") >`, setupPhase)\n\t\tswitch (setupPhase) {\n\t\t\tcase null:\n\t\t\t\tthis.logger.info(`Starting from scratch.`)\n\t\t\t\tthis.downloadPackage()\n\t\t\t\tthis.installPackage()\n\t\t\t\treturn this.startAllServices()\n\t\t\tcase `downloaded`:\n\t\t\t\tthis.logger.info(`Found package downloaded but not installed.`)\n\t\t\t\tthis.installPackage()\n\t\t\t\treturn this.startAllServices()\n\t\t\tcase `installed`: {\n\t\t\t\tfor (const [serviceName] of toEntries(this.services)) {\n\t\t\t\t\tthis.startService(serviceName)\n\t\t\t\t}\n\t\t\t\treturn this.live\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected startService(serviceName: S): void {\n\t\tthis.logger.info(\n\t\t\t`Starting service ${this.options.packageName}::${serviceName}, try ${this.safety}/2...`,\n\t\t)\n\t\tif (this.safety >= 2) {\n\t\t\tthrow new Error(`Out of tries...`)\n\t\t}\n\t\tthis.safety++\n\n\t\tconst [exe, ...args] = this.options.services[serviceName].run.split(` `)\n\t\tconst serviceProcess = spawn(exe, args, {\n\t\t\tcwd: this.options.flightdeckRootDir,\n\t\t\tenv: import.meta.env as Record<string, string>,\n\t\t})\n\t\tconst serviceLogger = this.serviceLoggers[serviceName]\n\t\tconst service = (this.services[serviceName] = new ChildSocket(\n\t\t\tserviceProcess,\n\t\t\t`${this.options.packageName}::${serviceName}`,\n\t\t\tserviceLogger,\n\t\t))\n\t\tserviceLogger.processCode = service.process.pid ?? -1\n\t\tthis.services[serviceName].onAny((...messages) => {\n\t\t\tserviceLogger.info(`💬`, ...messages)\n\t\t})\n\t\tthis.services[serviceName].on(`readyToUpdate`, () => {\n\t\t\tthis.logger.info(`Service \"${serviceName}\" is ready to update.`)\n\t\t\tthis.servicesReadyToUpdate[serviceName] = true\n\t\t\tthis.tryUpdate()\n\t\t})\n\t\tthis.services[serviceName].on(`alive`, () => {\n\t\t\tthis.servicesLive[this.serviceIdx[serviceName]].use(Promise.resolve())\n\t\t\tthis.servicesDead[this.serviceIdx[serviceName]] = new Future(() => {})\n\t\t\tif (this.dead.done) {\n\t\t\t\tthis.dead = new Future(() => {})\n\t\t\t}\n\t\t\tthis.dead.use(Promise.all(this.servicesDead))\n\t\t})\n\t\tthis.services[serviceName].process.once(`close`, (exitCode) => {\n\t\t\tthis.logger.info(\n\t\t\t\t`Auto-respawn saw \"${serviceName}\" exit with code ${exitCode}`,\n\t\t\t)\n\t\t\tthis.services[serviceName] = null\n\t\t\tif (!this.autoRespawnDeadServices) {\n\t\t\t\tthis.logger.info(`Auto-respawn is off; \"${serviceName}\" rests.`)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst updatePhase = this.storage.getItem(`updatePhase`)\n\t\t\tthis.logger.info(`> storage(\"updatePhase\") >`, updatePhase)\n\t\t\tconst updatesAreReady = updatePhase === `confirmed`\n\t\t\tif (updatesAreReady) {\n\t\t\t\tthis.serviceLoggers[serviceName].info(`Updating before startup...`)\n\t\t\t\tthis.restartTimes = []\n\t\t\t\tthis.installPackage()\n\t\t\t\tthis.startService(serviceName)\n\t\t\t} else {\n\t\t\t\tconst now = Date.now()\n\t\t\t\tconst fiveMinutesAgo = now - 5 * 60 * 1000\n\t\t\t\tthis.restartTimes = this.restartTimes.filter(\n\t\t\t\t\t(time) => time > fiveMinutesAgo,\n\t\t\t\t)\n\t\t\t\tthis.restartTimes.push(now)\n\n\t\t\t\tif (this.restartTimes.length < 5) {\n\t\t\t\t\tthis.serviceLoggers[serviceName].info(`Crashed. Restarting...`)\n\t\t\t\t\tthis.startService(serviceName)\n\t\t\t\t} else {\n\t\t\t\t\tthis.serviceLoggers[serviceName].info(\n\t\t\t\t\t\t`Crashed 5 times in 5 minutes. Not restarting.`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tthis.safety = 0\n\t}\n\n\tprotected downloadPackage(): void {\n\t\tthis.logger.info(`Downloading...`)\n\t\ttry {\n\t\t\tconst out = execSync(this.options.scripts.download)\n\t\t\tthis.logger.info(`Download stdout:`, out.toString())\n\t\t\tthis.storage.setItem(`setupPhase`, `downloaded`)\n\t\t\tthis.logger.info(`Downloaded!`)\n\t\t} catch (thrown) {\n\t\t\tif (thrown instanceof Error) {\n\t\t\t\tthis.logger.error(`Failed to get the latest release: ${thrown.message}`)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\tprotected installPackage(): void {\n\t\tthis.logger.info(`Installing...`)\n\n\t\ttry {\n\t\t\tconst out = execSync(this.options.scripts.install)\n\t\t\tthis.logger.info(`Install stdout:`, out.toString())\n\t\t\tthis.storage.setItem(`setupPhase`, `installed`)\n\t\t\tthis.logger.info(`Installed!`)\n\t\t} catch (thrown) {\n\t\t\tif (thrown instanceof Error) {\n\t\t\t\tthis.logger.error(`Failed to get the latest release: ${thrown.message}`)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n\n\tpublic stopAllServices(): Future<unknown> {\n\t\tthis.logger.info(`Stopping all services... auto-respawn disabled.`)\n\t\tthis.autoRespawnDeadServices = false\n\t\tfor (const [serviceName] of toEntries(this.services)) {\n\t\t\tthis.stopService(serviceName)\n\t\t}\n\t\treturn this.dead\n\t}\n\n\tpublic stopService(serviceName: S): void {\n\t\tconst service = this.services[serviceName]\n\t\tif (service) {\n\t\t\tthis.logger.info(`Stopping service \"${serviceName}\"...`)\n\t\t\tthis.servicesDead[this.serviceIdx[serviceName]].use(\n\t\t\t\tnew Promise((pass) => {\n\t\t\t\t\tservice.emit(`timeToStop`)\n\t\t\t\t\tservice.process.once(`close`, (exitCode) => {\n\t\t\t\t\t\tthis.logger.info(\n\t\t\t\t\t\t\t`Stopped service \"${serviceName}\"; exited with code ${exitCode}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tthis.services[serviceName] = null\n\t\t\t\t\t\tpass()\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\tthis.dead.use(Promise.all(this.servicesDead))\n\t\t\tthis.servicesLive[this.serviceIdx[serviceName]] = new Future(() => {})\n\t\t\tif (this.live.done) {\n\t\t\t\tthis.live = new Future(() => {})\n\t\t\t}\n\t\t\tthis.live.use(Promise.all(this.servicesLive))\n\t\t} else {\n\t\t\tthis.serviceLoggers[serviceName].error(\n\t\t\t\t`Tried to stop service, but it wasn't running.`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nexport const FLIGHTDECK_INFO = `info`\nexport const FLIGHTDECK_WARN = `warn`\nexport const FLIGHTDECK_ERROR = `ERR!`\n\nexport const flightDeckLogSchema = z.object({\n\tlevel: z.union([\n\t\tz.literal(FLIGHTDECK_INFO),\n\t\tz.literal(FLIGHTDECK_WARN),\n\t\tz.literal(FLIGHTDECK_ERROR),\n\t]),\n\ttimestamp: z.number(),\n\tpackage: z.string(),\n\tservice: z.string().optional(),\n\tprocess: z.number(),\n\tbody: z.string(),\n})\nexport type FlightDeckLog = z.infer<typeof flightDeckLogSchema>\n\nconst LINE_FORMAT = `line-format` satisfies keyof LnavFormat\nconst VALUE = `value` satisfies keyof LnavFormat\n\nexport type LnavFormatVisualComponent = Exclude<\n\tExclude<LnavFormat[`line-format`], undefined>[number],\n\tstring\n>\n\nexport type LnavFormatBreakdown = Exclude<LnavFormat[`value`], undefined>\nexport type MemberOf<T> = T[keyof T]\nexport type LnavFormatValueDefinition = MemberOf<LnavFormatBreakdown>\n\nexport type FlightDeckFormat = {\n\t[LINE_FORMAT]: (\n\t\t| string\n\t\t| (LnavFormatVisualComponent & {\n\t\t\t\tfield: keyof FlightDeckLog | `__level__` | `__timestamp__`\n\t\t })\n\t)[]\n\t[VALUE]: {\n\t\t[K in keyof FlightDeckLog]: LnavFormatValueDefinition & {\n\t\t\tkind: FlightDeckLog[K] extends number | undefined\n\t\t\t\t? `integer`\n\t\t\t\t: FlightDeckLog[K] extends string | undefined\n\t\t\t\t\t? `string`\n\t\t\t\t\t: never\n\t\t}\n\t}\n}\n\nexport const FLIGHTDECK_LNAV_FORMAT = {\n\ttitle: `FlightDeck Log`,\n\tdescription: `Format for events logged by the FlightDeck process manager.`,\n\t\"file-type\": `json`,\n\t\"timestamp-field\": `timestamp`,\n\t\"timestamp-divisor\": 1000,\n\t\"module-field\": `package`,\n\t\"opid-field\": `service`,\n\t\"level-field\": `level`,\n\tlevel: {\n\t\tinfo: FLIGHTDECK_INFO,\n\t\twarning: FLIGHTDECK_WARN,\n\t\terror: FLIGHTDECK_ERROR,\n\t},\n\n\t[LINE_FORMAT]: [\n\t\t{\n\t\t\tfield: `level`,\n\t\t},\n\t\t{\n\t\t\tprefix: ` `,\n\t\t\tfield: `__timestamp__`,\n\t\t\t\"timestamp-format\": `%Y-%m-%dT%H:%M:%S.%L%Z`,\n\t\t},\n\t\t{\n\t\t\tprefix: ` `,\n\t\t\tfield: `process`,\n\t\t\t\"min-width\": 5,\n\t\t},\n\t\t{\n\t\t\tprefix: `:`,\n\t\t\tfield: `package`,\n\t\t},\n\t\t{\n\t\t\tprefix: `:`,\n\t\t\tfield: `service`,\n\t\t\t\"default-value\": ``,\n\t\t},\n\t\t{\n\t\t\tprefix: `: `,\n\t\t\tfield: `body`,\n\t\t},\n\t],\n\n\t[VALUE]: {\n\t\ttimestamp: {\n\t\t\tkind: `integer`,\n\t\t},\n\t\tlevel: {\n\t\t\tkind: `string`,\n\t\t},\n\t\tpackage: {\n\t\t\tkind: `string`,\n\t\t},\n\t\tservice: {\n\t\t\tkind: `string`,\n\t\t},\n\t\tprocess: {\n\t\t\tkind: `integer`,\n\t\t},\n\t\tbody: {\n\t\t\tkind: `string`,\n\t\t},\n\t},\n} as const satisfies FlightDeckFormat & LnavFormat\n\nexport class FlightDeckLogger\n\timplements Pick<Console, `error` | `info` | `warn`>\n{\n\tpublic readonly packageName: string\n\tpublic readonly serviceName?: string\n\tpublic readonly jsonLogging: boolean\n\tpublic processCode: number\n\tpublic constructor(\n\t\tpackageName: string,\n\t\tprocessCode: number,\n\t\tserviceName?: string,\n\t\toptions?: { jsonLogging: boolean },\n\t) {\n\t\tthis.packageName = packageName\n\t\tif (serviceName) {\n\t\t\tthis.serviceName = serviceName\n\t\t}\n\t\tthis.processCode = processCode\n\t\tthis.jsonLogging = options?.jsonLogging ?? false\n\t}\n\tprotected log(\n\t\tlevel:\n\t\t\t| typeof FLIGHTDECK_ERROR\n\t\t\t| typeof FLIGHTDECK_INFO\n\t\t\t| typeof FLIGHTDECK_WARN,\n\t\t...messages: unknown[]\n\t): void {\n\t\tif (this.jsonLogging) {\n\t\t\tlet body = messages\n\t\t\t\t.map((message) =>\n\t\t\t\t\ttypeof message === `string`\n\t\t\t\t\t\t? message\n\t\t\t\t\t\t: inspect(message, false, null, true),\n\t\t\t\t)\n\t\t\t\t.join(` `)\n\t\t\tif (body.includes(`\\n`)) {\n\t\t\t\tbody = `\\n ${body.split(`\\n`).join(`\\n `)}`\n\t\t\t}\n\t\t\tconst log: FlightDeckLog = {\n\t\t\t\ttimestamp: Date.now(),\n\t\t\t\tlevel,\n\t\t\t\tprocess: this.processCode,\n\t\t\t\tpackage: this.packageName,\n\t\t\t\tbody,\n\t\t\t}\n\t\t\tif (this.serviceName) {\n\t\t\t\tlog.service = this.serviceName\n\t\t\t}\n\t\t\tprocess.stdout.write(JSON.stringify(log) + `\\n`)\n\t\t} else {\n\t\t\tconst source = this.serviceName\n\t\t\t\t? `${this.packageName}:${this.serviceName}`\n\t\t\t\t: this.packageName\n\t\t\tswitch (level) {\n\t\t\t\tcase FLIGHTDECK_INFO:\n\t\t\t\t\tconsole.log(`${source}:`, ...messages)\n\t\t\t\t\tbreak\n\t\t\t\tcase FLIGHTDECK_WARN:\n\t\t\t\t\tconsole.warn(`${source}:`, ...messages)\n\t\t\t\t\tbreak\n\t\t\t\tcase FLIGHTDECK_ERROR:\n\t\t\t\t\tconsole.error(`${source}:`, ...messages)\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\tpublic info(...messages: unknown[]): void {\n\t\tthis.log(FLIGHTDECK_INFO, ...messages)\n\t}\n\n\tpublic warn(...messages: unknown[]): void {\n\t\tthis.log(FLIGHTDECK_WARN, ...messages)\n\t}\n\n\tpublic error(...messages: unknown[]): void {\n\t\tthis.log(FLIGHTDECK_ERROR, ...messages)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,MAAa,MAAM,UAAU;CAC5B,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,CAAC,UAAU,CAAE;CACpD,eAAe;CACf,QAAQ,CAAE;CACV,YAAY,OAAO,KAAK;CACxB,wBAAwB;AACxB,EAAC;;;;ACSF,MAAa,0BAA0B,EAAE,cAAc,UAAW;AAIlE,MAAa,2BAA2B,EAAE,YAAY,UAAW;AAIjE,SAAgB,gBAAgBA,SAA0B;AACzD,Q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