apps/gateway/src/services/worker-runtime-repository.ts
Metadata
- Purpose: Gateway service module implementing business logic or integrations.
- Domain:
applications - Language:
ts - Bytes: 1637
- Lines: 57
- Content hash (short):
0dce8e53 - Source (start): apps/gateway/src/services/worker-runtime-repository.ts:1
- Source (end): apps/gateway/src/services/worker-runtime-repository.ts:57
Indexed Symbols
normalizeStatus(line 17, function) - Implements normalize status for service-layer operations.normalizeDetails(line 21, function) - Implements normalize details for service-layer operations.heartbeatWorker(line 25, function) - Implements heartbeat worker for service-layer operations.listWorkerRuntimeStatus(line 41, function) - Implements list worker runtime status for service-layer operations.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import { query } from "./postgres.js";
export type WorkerRuntimeStatus = {
workerName: string;
status: "healthy" | "degraded";
lastSeenAt: string;
details: Record<string, unknown>;
};
type WorkerRuntimeStatusRow = {
worker_name: string;
status: string;
last_seen_at: string;
details: unknown;
};
function normalizeStatus(value: string): "healthy" | "degraded" {
return value === "degraded" ? "degraded" : "healthy";
}
function normalizeDetails(input: unknown): Record<string, unknown> {
return typeof input === "object" && input !== null ? (input as Record<string, unknown>) : {};
}
export async function heartbeatWorker(