dadacat-lambda-pipeline
Version:
JavaScript client for the dadacat 3-lambda image generation pipeline
75 lines (66 loc) • 2.57 kB
JavaScript
/**
* DadaCat Lambda Pipeline - JavaScript Client
*
* A JavaScript library for interacting with the dadacat 3-lambda image generation pipeline.
*
* @author DadaCat Team
* @version 1.0.0
*/
// Export all client classes
export { DadacatClient } from './clients/DadacatClient.js';
export { ImageGenClient } from './clients/ImageGenClient.js';
export { B2UploadClient } from './clients/B2UploadClient.js';
// Export the main orchestrator
export { PipelineOrchestrator } from './PipelineOrchestrator.js';
// Export image generation options validator
export { ImageGenerationOptions } from './ImageGenerationOptions.js';
// Import for use in functions below
import { PipelineOrchestrator } from './PipelineOrchestrator.js';
/**
* Create a new pipeline orchestrator with the given configuration
* @param {Object} config - Pipeline configuration
* @param {string} config.dadacatUrl - URL for the dadacat-agent-x86 lambda
* @param {string} config.imageGenUrl - URL for the ImageGenerationProcessor API
* @param {string} config.b2UploadUrl - Base URL for the ImageB2Uploader API Gateway
* @param {number} [config.maxRetries=3] - Maximum number of retries
* @param {number} [config.retryDelay=5] - Delay between retries in seconds
* @param {number} [config.timeout=300] - Maximum timeout in seconds
* @param {number} [config.pollingInterval=5] - Polling interval in seconds
* @returns {PipelineOrchestrator} Configured pipeline orchestrator
*/
export function createPipeline(config) {
return new PipelineOrchestrator(config);
}
/**
* Default Lambda URLs for the pipeline
* These are the production endpoints with CORS protection
* @type {Object}
*/
export const DEFAULT_LAMBDA_URLS = {
dadacatUrl: 'https://36p5iskcyhwes5rcipwloye4xm0jmqkv.lambda-url.us-east-2.on.aws/',
imageGenUrl: 'https://dtren15fk6.execute-api.us-east-2.amazonaws.com/prod',
b2UploadUrl: 'https://dtren15fk6.execute-api.us-east-2.amazonaws.com/prod'
};
/**
* Default configuration for the pipeline
* @type {Object}
*/
export const DEFAULT_CONFIG = {
maxRetries: 3,
retryDelay: 5,
timeout: 300,
pollingInterval: 5
};
/**
* Convenience function to create a pipeline with default URLs
* @param {Object} [overrideConfig] - Optional configuration to override defaults
* @returns {PipelineOrchestrator} Pipeline with default or custom configuration
*/
export function createDefaultPipeline(overrideConfig = {}) {
const config = {
...DEFAULT_LAMBDA_URLS,
...DEFAULT_CONFIG,
...overrideConfig
};
return new PipelineOrchestrator(config);
}