Skip to main content
Glama
mock-alias.ts987 B
import { testDataRegistry } from './test-data-registry.js'; const MOCK_RE = /^mock-(person|company)-/i; // Try common keys first; then shallow-scan values. export function findMockAlias( obj: Record<string, unknown> | null | undefined ): string | null { if (!process.env.E2E_MODE) return null; if (!obj || typeof obj !== 'object') return null; const record = obj as Record<string, unknown>; const keys = [ 'mock_id', 'test_alias', 'alias', 'external_id', 'test_id', 'id_alias', ]; for (const k of keys) { const v = record[k]; if (typeof v === 'string' && MOCK_RE.test(v)) return v; } for (const v of Object.values(record)) { if (typeof v === 'string' && MOCK_RE.test(v)) return v; } return null; } export function registerMockAliasIfPresent( recordData: Record<string, unknown> | null | undefined, realId: string ) { const alias = findMockAlias(recordData); if (alias && realId) testDataRegistry.set(alias, realId); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kesslerio/attio-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server