Skip to main content

apps/web/lib/gateway-server.ts

Metadata

Indexed Symbols

No indexed functions/methods detected in this file.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

import "server-only";

import { randomUUID } from "node:crypto";
import { resolveOperatorAuthToken } from "./operator-session";

const apiBaseUrl = process.env.API_BASE_URL ?? process.env.NEXT_PUBLIC_API_BASE_URL ?? "http://localhost:8080";

export type GatewayRole =
| "msp_admin"
| "ops_engineer"
| "automation_operator"
| "billing"
| "data_admin"
| "viewer"
| "platform_admin"
| "integration_admin"
| "endpoint_agent"
| "client_portal";

type RequestOptions = {
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
body?: unknown;
requireIdempotency?: boolean;
acceptedRoles?: GatewayRole[];
authToken?: string | null;