/** * Service Resolver for Deployment-Time Configuration * * Resolves Quilt service endpoints from CloudFormation stack outputs at deployment time. * These values are then passed as explicit environment variables to the container, * eliminating the need for runtime CloudFormation API calls. * * **Breaking Change (v0.9.0)**: Replaces runtime config-resolver with deployment-time resolution. * * @module utils/service-resolver * @version 1.0.0 */ import { CloudFormationClient } from "@aws-sdk/client-cloudformation"; /** * Resolved Quilt service endpoints */ export interface QuiltServices { /** * SQS queue URL for package creation jobs * @example "https://sqs.us-east-1.amazonaws.com/123456789012/quilt-packager-queue" */ packagerQueueUrl: string; /** * Athena/Glue database name for catalog metadata * @example "quilt_catalog" */ athenaUserDatabase: string; /** * Quilt catalog domain (without protocol or trailing slash) * @example "quilt.example.com" */ quiltWebHost: string; /** * Athena workgroup for user queries (optional, from Quilt stack discovery) * @example "quilt-user-workgroup" */ athenaUserWorkgroup?: string; /** * Iceberg Glue database for single-query bucketless search (optional) * @example "icebergdatabase-v9cxuqnwjj5a" */ icebergDatabase?: string; } /** * Options for service resolution */ export interface ServiceResolverOptions { /** * CloudFormation stack ARN */ stackArn: string; /** * Mock CloudFormation client for testing */ mockCloudFormation?: CloudFormationClient; } /** * Parsed CloudFormation stack ARN */ export interface ParsedStackArn { region: string; account: string; stackName: string; stackId: string; } /** * Custom error for service resolution failures */ export declare class ServiceResolverError extends Error { readonly suggestion?: string | undefined; readonly details?: string | undefined; constructor(message: string, suggestion?: string | undefined, details?: string | undefined); format(): string; } /** * Parse CloudFormation stack ARN into components * * @param arn - CloudFormation stack ARN * @returns Parsed ARN components * @throws ServiceResolverError if ARN is invalid * * @example * parseStackArn('arn:aws:cloudformation:us-east-1:123456789012:stack/QuiltStack/abc-123') * // Returns: { region: 'us-east-1', account: '123456789012', stackName: 'QuiltStack', stackId: 'abc-123' } */ export declare function parseStackArn(arn: string): ParsedStackArn; /** * Normalize catalog URL to hostname only * * Removes protocol prefix (http:// or https://) and trailing slashes. * * @param url - Catalog URL or hostname * @returns Normalized hostname * * @example * normalizeCatalogUrl('https://quilt.example.com/') // Returns: 'quilt.example.com' * normalizeCatalogUrl('quilt.example.com') // Returns: 'quilt.example.com' */ export declare function normalizeCatalogUrl(url: string): string; /** * Validate SQS queue URL format * * @param url - SQS queue URL * @returns true if valid * @throws ServiceResolverError if invalid */ export declare function validateQueueUrl(url: string): boolean; /** * Resolve Quilt service endpoints from CloudFormation stack outputs * * Queries the CloudFormation stack at deployment time to extract service endpoints. * These are then passed as explicit environment variables to the container. * * **Required Stack Outputs**: * - `PackagerQueueUrl`: SQS queue URL for package creation * - `UserAthenaDatabaseName`: Athena database name for catalog * - `QuiltWebHost`: Quilt catalog web host (e.g., catalog.example.com) * * **Optional Stack Outputs**: * - `UserAthenaWorkgroupName`: Athena workgroup for user queries * - `IcebergDatabase`/`IcebergDatabaseName`: Iceberg Glue database for package metadata * * @param options - Service resolver options * @returns Resolved service endpoints * @throws ServiceResolverError if required outputs are missing or invalid * * @example * const services = await resolveQuiltServices({ * stackArn: 'arn:aws:cloudformation:us-east-1:123:stack/QuiltStack/id' * }); * // Returns: * // { * // packagerQueueUrl: 'https://sqs.us-east-1.amazonaws.com/123/quilt-queue', * // athenaUserDatabase: 'quilt_catalog', * // quiltWebHost: 'quilt.example.com', * // athenaUserWorkgroup: 'quilt-user-workgroup' (optional), * // } */ export declare function resolveQuiltServices(options: ServiceResolverOptions): Promise; //# sourceMappingURL=service-resolver.d.ts.map