chore: flatten provider console subsystems
This commit is contained in:
@@ -372,13 +372,6 @@ const SUBSYSTEM_COLORS = [
|
|||||||
] as const;
|
] as const;
|
||||||
const SUBSYSTEM_PREFIXES_TO_DROP = ["gateway", "providers"] as const;
|
const SUBSYSTEM_PREFIXES_TO_DROP = ["gateway", "providers"] as const;
|
||||||
const SUBSYSTEM_MAX_SEGMENTS = 2;
|
const SUBSYSTEM_MAX_SEGMENTS = 2;
|
||||||
const SUBSYSTEM_DISPLAY_ALIASES = new Map<string, string>([
|
|
||||||
["whatsapp/inbound", "WhatsApp In"],
|
|
||||||
["whatsapp/outbound", "WhatsApp Out"],
|
|
||||||
["whatsapp/heartbeat", "WhatsApp Heartbeat"],
|
|
||||||
["whatsapp", "WhatsApp"],
|
|
||||||
["telegram", "Telegram"],
|
|
||||||
]);
|
|
||||||
|
|
||||||
function pickSubsystemColor(
|
function pickSubsystemColor(
|
||||||
color: ChalkInstance,
|
color: ChalkInstance,
|
||||||
@@ -405,12 +398,13 @@ function formatSubsystemForConsole(subsystem: string): string {
|
|||||||
parts.shift();
|
parts.shift();
|
||||||
}
|
}
|
||||||
if (parts.length === 0) return original;
|
if (parts.length === 0) return original;
|
||||||
if (parts.length > SUBSYSTEM_MAX_SEGMENTS) {
|
if (parts[0] === "whatsapp" || parts[0] === "telegram") {
|
||||||
const shortened = parts.slice(-SUBSYSTEM_MAX_SEGMENTS).join("/");
|
return parts[0];
|
||||||
return SUBSYSTEM_DISPLAY_ALIASES.get(shortened) ?? shortened;
|
|
||||||
}
|
}
|
||||||
const shortened = parts.join("/");
|
if (parts.length > SUBSYSTEM_MAX_SEGMENTS) {
|
||||||
return SUBSYSTEM_DISPLAY_ALIASES.get(shortened) ?? shortened;
|
return parts.slice(-SUBSYSTEM_MAX_SEGMENTS).join("/");
|
||||||
|
}
|
||||||
|
return parts.join("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatConsoleLine(opts: {
|
function formatConsoleLine(opts: {
|
||||||
|
|||||||
Reference in New Issue
Block a user