API Endpoint Category Resolver (constants/endpointCategories.ts)

OmniAI-Gateway · src/shared/constants/endpointCategories.ts · typescript · MIT
voice, integration, infra, tag:routing, tag:categories, tag:policy

TypeScript utility mapping request paths to predefined endpoint categories for API key policy enforcement in gateway.

// Source: https://github.com/MAHIAMIR45/OmniAI-Gateway | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Endpoint Category Definitions — API key endpoint restrictions.
 *
 * Each category maps a stable ID to a set of `/v1/` route prefixes.
 * The `resolveEndpointCategory()` function maps an incoming request path
 * to its category for policy enforcement.
 *
 * Empty `allowedEndpoints` on a key = all endpoints allowed (backward compatible).
 *
 * @module shared/constants/endpointCategories
 */

export interface EndpointCategory {
  id: string;
  label: string;
  description: string;
  prefixes: string[];
}

export const ENDPOINT_CATEGORIES: readonly EndpointCategory[] = [
  {
    id: "chat",
    label: "Chat / Messages",
  

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key