/** * Job graph transformation utilities for converting production jobs to test configurations. * * This module provides functions to transform a production job definition into a test job * by replacing sources, sinks, and adding test-specific tagging. The transformations are * purely functional - they do not make any API calls or create resources. * * Key transformations: * - Source replacement: Replace vendor sources with dataset queries or keep originals with limits * - Sink replacement: Replace vendor sinks with synchronous test sinks or test dataset sinks * - Test tagging: Add test run ID and sink name tags to track test data * * The transformed job can then be executed using the standard job:create command. */ import { JobExecution, JobProcessing } from '../types.js'; import { SchemaCreateJob } from '../openapi/openApiTypes.js'; /** * Options for transforming a job to a test configuration. */ export interface JobToTestOptions { /** Target execution type (default: keep original) */ execution?: JobExecution; /** Target processing type (default: keep original) */ processing?: JobProcessing; /** Path to sample data file (not yet implemented) */ sampleDataFile?: string; /** Dataset ID to use as data source (requires start and end) */ datasetId?: string; /** Query to filter dataset source data (optional, requires datasetId) */ query?: string; /** Start time for dataset query (ISO 8601 format) */ start?: string; /** End time for dataset query (ISO 8601 format) */ end?: string; /** Record limit for batch sources (default: 1000) */ limitRecords?: number; /** Dataset ID for async test output (enables tagging) */ testDataset?: string; /** Custom test run identifier (default: auto-generated) */ testTag?: string; /** Custom test job name (default: {original}_test) */ testName?: string; /** * Tuning for the logs-event-sampler inserted after each live source in a * source-preserving draft. Omitted fields fall back to the UI's draft * defaults (see {@link DEFAULT_DRAFT_SAMPLER_BURST}). */ sampler?: DraftSamplerOptions; } /** Sampler knobs for a source-preserving draft, mirroring the UI's logs-event-sampler. */ export interface DraftSamplerOptions { /** `maxAllowedRate` in messages/sec; omitted -> server default applies. */ maxAllowedRate?: number; /** `maxBurstLimit` in messages; omitted -> {@link DEFAULT_DRAFT_SAMPLER_BURST}. */ maxBurstLimit?: number; } /** * Default `maxBurstLimit` for a draft logs-event-sampler. Matches the UI's * template-draft fallback (`logSampler?.maxBurstLimit ?? 1000`) so CLI raw-job * drafts sample at the same rate as the UI's template drafts. `maxAllowedRate` * has no CLI default: when unset we omit it and let the server default apply, * exactly as the UI does. */ export declare const DEFAULT_DRAFT_SAMPLER_BURST = 1000; /** * Transforms a production job configuration into a test job configuration. * * This is the main entry point for job transformation. It applies the following changes: * 1. Renames the job (appends "_test" or uses custom name) * 2. Updates execution and processing types if specified * 3. Adds test run ID tag to job tags * 4. Transforms sources (replace with dataset query, sample data, or add limits) * 5. Transforms sinks (replace with sync sink or test dataset sinks) * 6. Adds test tagging operations before sinks * * The transformation is purely functional and does not make any API calls. * * @param originalJob - The production job to transform * @param options - Transformation options * @returns A new job configuration suitable for testing * @throws Error if job graph is missing or invalid * * @example * const testJob = transformJobToTest(prodJob, { * execution: 'SYNCHRONOUS', * processing: 'BATCH', * datasetId: 'my_dataset', * start: '2025-01-01T00:00:00Z', * end: '2025-01-01T01:00:00Z', * limitRecords: 100 * }); */ export declare function transformJobToTest(originalJob: SchemaCreateJob, options: JobToTestOptions): SchemaCreateJob; /** * Build a source-preserving draft from a job-graph pipeline: keep the proposed * source vertices streaming live (so add/remove-source edits are exercised), * interpose a logs-event-sampler after each live source to bound per-source * volume, strip production sinks, and fan output into a shared logs-sync-sink. * Mirrors the UI's template draft mode for raw (non-templated) jobs. Verifies * the graph runs, not external sink delivery. */ export declare function transformJobGraphToSourcePreservingDraft(originalJob: SchemaCreateJob, options?: JobToTestOptions): SchemaCreateJob; /** * Displays a summary of the transformations applied to a job. * * This shows a before/after comparison including: * - Job name changes * - Execution type changes * - Processing type changes * - operation and edge changes * - Test run ID * * The output is formatted for console display. * * @param originalJob - The original production job * @param transformedJob - The transformed test job */ export declare function showDiff(originalJob: SchemaCreateJob, transformedJob: SchemaCreateJob): void; //# sourceMappingURL=job-graph-transformer.d.ts.map