apps/gateway/src/routes/dashboard.ts
Metadata
- Purpose: Gateway HTTP route handlers and request/response behavior.
- Domain:
applications - Language:
ts - Bytes: 15002
- Lines: 375
- Content hash (short):
c23ceb14 - Source (start): apps/gateway/src/routes/dashboard.ts:1
- Source (end): apps/gateway/src/routes/dashboard.ts:375
Indexed Symbols
toRecordArray(line 10, function) - Implements to record array for HTTP request handling.toStringValue(line 14, function) - Implements to string value for HTTP request handling.toNumberValue(line 18, function) - Implements to number value for HTTP request handling.toDateValue(line 23, function) - Implements to date value for HTTP request handling.normalizeStatus(line 31, function) - Implements normalize status for HTTP request handling.formatCurrency(line 35, function) - Implements format currency for HTTP request handling.isTicketOpen(line 44, function) - Implements is ticket open for HTTP request handling.isInvoiceOverdue(line 48, function) - Implements is invoice overdue for HTTP request handling.compareDatesDescending(line 57, function) - Implements compare dates descending for HTTP request handling.firstNonEmptyString(line 65, function) - Implements first non empty string for HTTP request handling.scopedPortalClientId(line 75, function) - Implements scoped portal client id for HTTP request handling.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import type { FastifyPluginAsync } from "fastify";
import { getWorkspaceIdFromHeaders } from "../utils/workspace.js";
import { ensureRoles } from "../utils/authorization.js";
import { listResources } from "../services/resource-repository.js";
import { listWorkflowExecutions } from "../services/workflow-repository.js";
import { listRecentOutboxEvents } from "../services/event-pipeline.js";
type ResourceRecord = Record<string, unknown>;
function toRecordArray(input: unknown[]): ResourceRecord[] {
return input.filter((item): item is ResourceRecord => typeof item === "object" && item !== null);
}
function toStringValue(value: unknown): string {
return typeof value === "string" ? value : "";
}
function toNumberValue(value: unknown): number {
const parsed = Number(value);
return Number.isFinite(parsed) ? parsed : 0;
}
function toDateValue(value: unknown): Date | null {
if (typeof value !== "string") {
return null;