Skip to main content

apps/gateway/src/routes/ops-actions.ts

Metadata

Indexed Symbols

  • toRecord (line 18, function) - Implements to record for HTTP request handling.
  • nowIso (line 22, function) - Implements now iso for HTTP request handling.
  • workspaceIdFromRequest (line 26, function) - Implements workspace id from request for HTTP request handling.
  • parseIdempotency (line 30, function) - Implements parse idempotency for HTTP request handling.
  • getContext (line 39, function) - Implements get context for HTTP request handling.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

import { randomUUID } from "node:crypto";
import type { FastifyPluginAsync, FastifyReply, FastifyRequest } from "fastify";
import {
opsAlertLinkTicketRequestSchema,
opsEscalateTicketRequestSchema,
opsLinkAssetRequestSchema,
opsLinkRunbookRequestSchema,
opsResolveTicketRequestSchema
} from "@anchor/contracts";
import { enqueueOutboxEvent } from "../services/event-pipeline.js";
import { createResource, getResource, upsertResource } from "../services/resource-repository.js";
import { getIdempotencyKey, getIdempotencyRouteScope } from "../utils/idempotency.js";
import { ensureRoles } from "../utils/authorization.js";
import { getWorkspaceIdFromHeaders } from "../utils/workspace.js";

type AnyRecord = Record<string, unknown>;

function toRecord(input: unknown): AnyRecord {
return typeof input === "object" && input !== null ? (input as AnyRecord) : {};
}

function nowIso() {
return new Date().toISOString();
}