/** * Configuration Transformation Utilities * * Transforms ProfileConfig (XDG user configuration) into StackConfig (minimal CDK interface). * This module implements the separation between user-facing configuration and infrastructure needs. * * **Key principles:** * - ProfileConfig contains ALL configuration (wizard, deployment, runtime) * - StackConfig contains ONLY infrastructure-related fields * - Transformation is one-way: ProfileConfig → StackConfig * - Validation ensures required fields are present * * @module utils/config-transform * @version 0.10.0 */ import type { ProfileConfig, ValidationResult } from "../types/config"; import type { StackConfig } from "../types/stack-config"; /** * Transform ProfileConfig to StackConfig * * Extracts only the fields required by the CDK stack infrastructure from the full ProfileConfig. * This creates a clean separation between user configuration and infrastructure needs. * * **Transformation logic:** * - Benchling: Only secretArn (credentials stored in secret) * - Quilt: Service endpoints (catalog, database, queueUrl, region, bucketWritePolicyArn, athenaUserPolicyArn, icebergDatabase) * - Deployment: Infrastructure settings (region, imageTag, vpc, stackName) * - Security: Optional IP allowlist * * **Excluded fields:** * - benchling.tenant, clientId, appDefinitionId (read from secret at runtime) * - packages.* (passed as environment variables) * - logging.* (passed as environment variables) * - _metadata, _inherits (wizard metadata) * * @param profile - Full profile configuration from XDG * @returns Minimal stack configuration for CDK * @throws Error if required fields are missing * * @example * ```typescript * const profile = XDGConfig.readProfile("default"); * const stackConfig = profileToStackConfig(profile); * createStack(stackConfig); // Pass to CDK stack * ``` */ export declare function profileToStackConfig(profile: ProfileConfig, options?: { skipValidation?: boolean; }): StackConfig; /** * Validate ProfileConfig for stack deployment * * Checks that all required fields for CDK stack creation are present and valid. * This validation is run before transformation to provide clear error messages. * * **Required fields:** * - benchling.secretArn (secret must exist in AWS Secrets Manager) * - quilt.catalog (catalog domain) * - quilt.database (Athena database name) * - quilt.queueUrl (SQS queue URL) * - quilt.region (AWS region) * - deployment.region (deployment region) * * **Optional fields:** * - quilt.bucketWritePolicyArn (IAM managed policy for S3 access) * - quilt.athenaUserPolicyArn (IAM managed policy for Athena access) * - deployment.imageTag (defaults to "latest") * - deployment.vpc (defaults to creating new VPC) * - deployment.stackName (auto-generated from profile name) * - security.webhookAllowList (defaults to no IP filtering) * * @param config - Profile configuration to validate * @returns Validation result with errors and warnings * * @example * ```typescript * const profile = XDGConfig.readProfile("default"); * const result = validateStackConfig(profile); * * if (!result.isValid) { * console.error("Configuration errors:"); * result.errors.forEach(err => console.error(` - ${err}`)); * process.exit(1); * } * * if (result.warnings && result.warnings.length > 0) { * console.warn("Configuration warnings:"); * result.warnings.forEach(warn => console.warn(` - ${warn}`)); * } * ``` */ export declare function validateStackConfig(config: ProfileConfig): ValidationResult; //# sourceMappingURL=config-transform.d.ts.map