/** * Single source of truth for "is this CDC?" across maestro. * * Two shapes carry the discriminator: * - a connection/input `plugin` (`mysql_cdc`, ...), used before a platform * pipeline exists (create flows, DynamoDB inputs); * - a platform job `input.connector === 'cdc'`, the explicit type the * platform-api stamps on every CDC job. * * Keep the plugin list in sync with pi-factory (`CDC_PLUGINS`) and in-factory * (`cdcPlugins`). */ export const CDC_PLUGINS: readonly string[] = ['mysql_cdc', 'postgresql_cdc', 'oracle_cdc']; export function isCdcPlugin(plugin?: string | null): boolean { return plugin != null && CDC_PLUGINS.includes(plugin); } export interface PlatformJobLike { input?: { connector?: string } | null; } export interface PlatformPipelineLike { jobs?: PlatformJobLike[] | null; } export function isCdcJob(job?: PlatformJobLike | null): boolean { return job?.input?.connector === 'cdc'; } /** A pipeline is CDC when any of its platform jobs is a CDC job. */ export function isCdcPipeline(pipeline?: PlatformPipelineLike | null): boolean { return (pipeline?.jobs ?? []).some((job) => isCdcJob(job)); }