Alokai

Integration

interface Integration<CONFIG extends TObject = any, API extends ApiMethods = {}, CONTEXT extends TObject = any> {
	circuitBreaker?: {
    granularity?: CircuitBreakerGranularity;
    methods?: string[];
    preset: CircuitBreakerPreset;
  };
	configuration: CONFIG;
	customQueries?: Record<string, CustomQueryFunction>;
	errorHandler?: ErrorHandler;
	extensions?: (extensions: ApiClientExtension<API, CONTEXT, CONFIG>[]) => ApiClientExtension<API, CONTEXT, CONFIG>[];
	initConfig?: TObject;
	location: string;
	logger?: LoggerOptions;
	retry?: boolean | RetryConfig;
}

Properties

NameRequiredTypeDescription
circuitBreakerOptional{ granularity?: CircuitBreakerGranularity; methods?: string[]; preset: CircuitBreakerPreset; }Circuit breaker configuration for this integration. When to use: Define this when you need to customize circuit breaker behavior for this specific integration. This configuration has priority over environment variables (CB_PRESET). Available presets: - PRODUCTION - Balanced settings for production (default) - DEVELOPMENT - Relaxed settings for development - AGGRESSIVE - Strict settings for fast failure detection - TOLERANT - Lenient settings for legacy or slow backends - FAST_FAILURE - Very strict settings for mission-critical APIs - TEST - Very tolerant settings for testing (only allowed in non-production)
configurationRequiredCONFIG
customQueriesOptionalRecord<string, CustomQueryFunction>
errorHandlerOptionalErrorHandlerIntegration-specific error handler. When to use: Define this when you need custom error handling for this specific integration only. This handler has the highest priority and will override any global error handler defined in middleware.config.ts. Priority: Integration-specific > Global > Built-in default
extensionsOptional(extensions: ApiClientExtension<API, CONTEXT, CONFIG>[]) => ApiClientExtension<API, CONTEXT, CONFIG>[]
initConfigOptionalTObject
locationRequiredstring
loggerOptionalLoggerOptions
retryOptionalboolean | RetryConfigRetry transient failures (502/503/504/408/429 and normalized network errors). Off by default. - true - enable with the default policy (2 retries, randomized exponential backoff). - object - override retries, retryCondition, and/or retryDelay. - false / omitted - no retries.

Referenced Types

On this page