UNPKG

azion

Version:

Azion Packages for Edge Computing.

1,199 lines (1,054 loc) 38.2 kB
import { AzionRuntimeModule } from 'azion/types'; import { BuildOptions } from 'esbuild'; import { Configuration } from 'webpack'; import { Plugin as Plugin_2 } from 'esbuild'; import { WebpackPluginInstance } from 'webpack'; export declare interface AWS4HMACAttributes { /** AWS region */ region: string; /** AWS service */ service?: string; /** Access key */ accessKey: string; /** Secret key */ secretKey: string; } /** * Application configuration for Azion. */ export declare type AzionApplication = { /** Application name */ name: string; /** Enable edge cache */ edgeCacheEnabled?: boolean; /** Enable functions */ functionsEnabled?: boolean; /** Enable application accelerator */ applicationAcceleratorEnabled?: boolean; /** Enable image processor */ imageProcessorEnabled?: boolean; /** Indicates if the application is active */ active?: boolean; /** Enable debug mode */ debug?: boolean; /** Cache settings */ cache?: AzionCache[]; /** Rules configuration V4 */ rules?: AzionRules; /** Device groups */ deviceGroups?: AzionDeviceGroup[]; /** Function instances */ functionsInstances?: AzionFunctionInstance[]; }; /** * Storage configuration for Azion. */ export declare type AzionBucket = { /** Storage name */ name: string; /** access type */ workloadsAccess?: 'read_only' | 'read_write' | 'restricted'; /** Storage path */ dir: string; /** Storage prefix */ prefix: string; }; export declare interface AzionBuild<T extends Configuration | BuildOptions | unknown = Configuration | BuildOptions> { entry?: BuildEntryPoint; bundler?: 'webpack' | 'esbuild'; preset?: PresetInput; polyfills?: boolean; worker?: boolean; extend?: (context: T) => T; memoryFS?: { injectionDirs: string[]; removePathPrefix: string; }; } export declare interface AzionBuildPreset { config: AzionConfig; handler?: AzionRuntimeModule; prebuild?: (config: BuildConfiguration, ctx: BuildContext) => Promise<void | AzionPrebuildResult>; postbuild?: (config: BuildConfiguration, ctx: BuildContext) => Promise<void>; metadata: PresetMetadata; } /** * Cache configuration for Azion. */ export declare type AzionCache = { /** Cache name */ name: string; /** Indicates if stale content should be served */ stale?: boolean; /** Indicates if query string parameters should be sorted */ queryStringSort?: boolean; /** Tiered cache configuration */ tieredCache?: { /** Indicates if tiered cache should be enabled */ enabled: boolean; /** Tiered cache topology */ topology?: TieredCacheTopology; }; /** HTTP methods to be cached */ methods?: { /** Cache POST requests */ post?: boolean; /** Cache OPTIONS requests */ options?: boolean; }; /** Browser cache settings */ browser?: { /** Maximum age for browser cache in seconds */ maxAgeSeconds: number | string; }; /** cache settings */ edge?: { /** Maximum age for edge cache in seconds */ maxAgeSeconds: number | string; }; /** Cache by cookie configuration */ cacheByCookie?: { /** Cookie caching option */ option: 'ignore' | 'all' | 'allowlist' | 'denylist'; /** List of cookies to be considered */ list?: string[]; }; /** Cache by query string configuration */ cacheByQueryString?: { /** Query string caching option */ option: 'ignore' | 'all' | 'allowlist' | 'denylist'; /** List of query string parameters to be considered */ list?: string[]; }; }; export declare type AzionCommonRuleBehaviorType = 'deliver' | 'redirect_to_301' | 'redirect_to_302' | 'enable_gzip' | 'run_function' | 'capture_match_groups'; /** * Main configuration type for Azion. */ export declare type AzionConfig = { /** Build configuration */ build?: AzionBuild; /** Application configuration */ applications?: AzionApplication[]; /** Functions configurations */ functions?: AzionFunction[]; /** Connectors configuration */ connectors?: AzionConnector[]; /** Storage configurations */ storage?: AzionBucket[]; /** Firewall configuration */ firewall?: AzionFirewall[]; /** Network list configurations */ networkList?: AzionNetworkList[]; /** Purge configurations */ purge?: AzionPurge[]; /** WAF configuration */ waf?: AzionWaf[]; /** Workload configuration */ workloads?: AzionWorkload[]; /** Custom pages configuration */ customPages?: AzionCustomPage[]; /** KV configuration */ kv?: AzionKV[]; }; export declare interface AzionConfigs { configs: AzionConfig[]; } export declare type AzionConnector = AzionConnectorStorage | AzionConnectorHttp | AzionConnectorLiveIngest; export declare interface AzionConnectorHttp { /** connector name */ name: string; /** Active status */ active?: boolean; /** Connector type */ type: 'http'; /** Connector attributes */ attributes: ConnectorHttpAttributes; } export declare interface AzionConnectorLiveIngest { /** connector name */ name: string; /** Active status */ active?: boolean; /** Connector type */ type: 'live_ingest'; /** Connector attributes */ attributes: ConnectorLiveIngestAttributes; } export declare interface AzionConnectorStorage { /** connector name */ name: string; /** Active status */ active?: boolean; /** Connector type */ type: 'storage'; /** Connector attributes */ attributes: ConnectorStorageAttributes; } export declare interface AzionCustomPage { /** Custom page name */ name: string; /** Active status */ active?: boolean; /** Array of error page configurations */ pages: AzionCustomPageEntry[]; } export declare interface AzionCustomPageConnector { /** Page connector type */ type?: CustomPageType; /** Page connector attributes */ attributes: AzionCustomPageConnectorAttributes; } export declare interface AzionCustomPageConnectorAttributes { /** Connector name or ID reference */ connector: string | number; /** Time to live in seconds */ ttl?: number; /** URI path */ uri?: string | null; /** Custom status code */ customStatusCode?: number | null; } export declare interface AzionCustomPageEntry { /** Error code */ code: CustomPageErrorCode; /** Page configuration */ page: AzionCustomPageConnector; } /** * Device Group configuration for Azion V4. */ export declare type AzionDeviceGroup = { /** Device group name */ name: string; /** User agent regex pattern */ userAgent: string; }; /** * Domain configuration for Azion. */ export declare type AzionDomain = { /** Domain name */ name: string; /** Indicates if access is restricted to CNAME only */ cnameAccessOnly?: boolean; /** List of CNAMEs associated with the domain */ cnames?: string[]; /** Associated application ID */ id?: number; /** Associated appliaction ID */ edgeApplicationId?: number; /** Associated firewall ID */ edgeFirewallId?: number; /** Digital certificate ID */ digitalCertificateId?: string | number | null; /** Indicates if the domain is active */ active?: boolean; /** Mutual TLS configuration */ mtls?: { /** Verification mode for MTLS */ verification: 'enforce' | 'permissive'; /** ID of the trusted CA certificate */ trustedCaCertificateId: number; /** List of CRL (Certificate Revocation List) IDs */ crlList?: number[]; }; }; /** * Firewall configuration for Azion. */ export declare type AzionFirewall = { /** Firewall name */ name: string; /** Indicates if the firewall is active */ active?: boolean; /** Indicates if Functions are enabled */ functions?: boolean; /** Indicates if Network Protection is enabled */ networkProtection?: boolean; /** Indicates if WAF is enabled */ waf?: boolean; /** List of firewall rules */ rules?: AzionFirewallRule[]; /** Debug mode */ debugRules?: boolean; /** Functions Instances */ functionsInstances?: AzionFirewallFunctionsInstance[]; }; /** * Firewall behavior configuration for Azion. * Array of behavior items to be applied when the rule matches. */ export declare type AzionFirewallBehavior = AzionFirewallBehaviorItem[]; /** * Individual firewall behavior types */ export declare type AzionFirewallBehaviorItem = { runFunction: string | number; } | { setWafRuleset: { wafMode: FirewallWafMode; wafId: string | number; }; } | { setRateLimit: { type: FirewallRateLimitType; limitBy: FirewallRateLimitBy; averageRateLimit: string; maximumBurstSize: string; }; } | { deny: true; } | { drop: true; } | { setCustomResponse: { statusCode: number | string; contentType: string; contentBody: string; }; }; export declare type AzionFirewallCriteria = AzionFirewallCriteriaWithValue | AzionFirewallCriteriaWithoutValue; export declare type AzionFirewallCriteriaBase = { /** Variable to be evaluated */ variable: RuleVariable; /** Conditional type */ conditional: RuleConditional; }; export declare type AzionFirewallCriteriaWithoutValue = AzionFirewallCriteriaBase & { /** Operator for comparison that doesn't require input value */ operator: RuleOperatorWithoutValue; }; export declare type AzionFirewallCriteriaWithValue = AzionFirewallCriteriaBase & { /** Operator for comparison that requires input value */ operator: RuleOperatorWithValue; /** Argument for comparison */ argument: string | number; }; export declare type AzionFirewallFunctionsInstance = { /** Function instance name */ name: string; /** Function instance arguments */ args?: Record<string, string>; /** Active */ active?: boolean; /** Reference to Function name or ID */ ref: string | number; }; /** * Firewall rule configuration for Azion. */ export declare type AzionFirewallRule = { /** Rule name */ name: string; /** Rule description */ description?: string; /** Indicates if the rule is active */ active?: boolean; /** Match criteria for the rule */ match?: string; /** Variable to be used in the match */ variable?: RuleVariable; /** Array of criteria for complex conditions */ criteria?: AzionFirewallCriteria[]; /** Behavior to be applied when the rule matches */ behaviors: AzionFirewallBehavior; }; /** * Function configuration for Azion (DX-friendly). */ export declare type AzionFunction = { /** Function name */ name: string; /** Function file path */ path: string; /** Runtime environment */ runtime?: FunctionRuntime; /** Default arguments to be passed to the function */ defaultArgs?: Record<string, unknown>; /** Execution environment */ executionEnvironment?: FunctionExecutionEnvironment; /** Active status */ active?: boolean; /** Function bindings */ bindings?: AzionFunctionBindings; }; /** * Bindings configuration for Azion Functions. */ export declare type AzionFunctionBindings = { /** Storage bindings */ storage?: AzionStorageBinding; }; /** * Function Instance configuration for Azion V4 (within Application). */ export declare type AzionFunctionInstance = { /** Function instance name */ name: string; /** Reference to Function name or ID */ ref: string | number; /** Instance-specific arguments */ args?: Record<string, unknown>; /** Active status */ active?: boolean; }; /** * KV */ export declare type AzionKV = { /** KV name */ name: string; }; /** * Manifest Rule for API (with phase). */ export declare type AzionManifestRule = { /** Rule phase */ phase: AzionRulePhase; /** Rule data */ rule: AzionRule; }; /** * Network list configuration for Azion V4. */ export declare type AzionNetworkList = { /** Network list name */ name: string; /** Network list type */ type: NetworkListType; /** List of network items */ items: string[]; /** Active status */ active?: boolean; }; export declare interface AzionPrebuildResult { /** Files to be injected into memory during build process */ filesToInject: string[]; injection: { globals: { _ENTRIES?: string; AsyncLocalStorage?: string; [key: string]: string | undefined; }; entry?: string; banner?: string; }; bundler: { defineVars: { __CONFIG__?: string; __BUILD_METADATA__?: string; [key: string]: string | undefined; }; plugins: (Plugin_2 | WebpackPluginInstance)[]; }; } /** * Purge configuration for Azion. */ export declare type AzionPurge = { /** Items to be purged */ items: string[]; /** Cache layer to be purged */ layer?: 'cache' | 'tiered_cache'; /** Purge type */ type: 'url' | 'cachekey' | 'wildcard'; }; export declare type AzionRequestOnlyBehaviorType = 'deny' | 'no_content' | 'finish_request_phase' | 'forward_cookies' | 'optimize_images' | 'bypass_cache' | 'filter_request_cookie' | 'set_origin' | 'redirect_http_to_https' | 'set_connector' | 'set_cache_policy' | 'rewrite_request' | 'add_request_header' | 'filter_request_header' | 'add_request_cookie'; /** * Request rule configuration for Azion. */ export declare type AzionRequestRule = { /** Rule name */ name: string; /** Rule description */ description?: string; /** Indicates if the rule is active */ active?: boolean; /** Match criteria for the rule */ match?: string; /** Variable to be used in the match */ variable?: RuleVariable; /** Array of criteria for complex conditions */ criteria?: AzionRuleCriteria[]; /** Behavior to be applied when the rule matches */ behavior?: { /** Rewrite the request */ rewrite?: string; /** Bypass cache */ bypassCache?: boolean | null; /** Force HTTPS */ httpToHttps?: boolean | null; /** Redirect with 301 status */ redirectTo301?: string | null; /** Redirect with 302 status */ redirectTo302?: string | null; /** Forward cookies */ forwardCookies?: boolean | null; /** Set a cookie */ setCookie?: string | null; /** Deliver the content */ deliver?: boolean | null; /** Deny */ deny?: boolean | null; /** No content */ noContent?: boolean | null; /** enable GZIP compression */ enableGZIP?: boolean | null; /** Filter cookie */ filterCookie?: string | null; /** Filter header */ filterHeader?: string | null; /** Optimize images */ optimizeImages?: boolean | null; /** Capture configuration */ capture?: { /** Match pattern */ match: string; /** Captured value */ captured: string; /** Subject to capture from */ subject: string; }; /** Run a serverless function */ runFunction?: string | number; /** Set cache configuration */ setCache?: string | number | { /** Cache name */ name: string | number; /** Browser cache TTL */ browser_cache_settings_maximum_ttl?: number | null; /** CDN cache TTL */ cdn_cache_settings_maximum_ttl?: number | null; }; /** Finish request phase */ finishRequestPhase?: boolean; /** Set connector */ setConnector?: string | number; /** Add request header */ addRequestHeader?: string[]; /** Add request cookie */ addRequestCookie?: string; /** Filter request cookie */ filterRequestCookie?: string; }; }; export declare type AzionRequestRuleBehaviorType = AzionCommonRuleBehaviorType | AzionRequestOnlyBehaviorType; export declare type AzionResponseOnlyBehaviorType = 'filter_response_cookie' | 'set_cookie' | 'add_response_header' | 'filter_response_header'; /** * Response rule configuration for Azion. */ export declare type AzionResponseRule = { /** Rule name */ name: string; /** Rule description */ description?: string; /** Indicates if the rule is active */ active?: boolean; /** Match criteria for the rule */ match?: string; /** Variable to be used in the match */ variable?: RuleVariable; /** Array of criteria for complex conditions */ criteria?: AzionRuleCriteria[]; /** Behavior to be applied when the rule matches */ behavior?: { /** Set headers */ setHeaders?: string[]; /** Deliver the content */ deliver?: boolean | null; /** Capture configuration */ capture?: { /** Match pattern */ match: string; /** Captured value */ captured: string; /** Subject to capture from */ subject: string; }; /** Enable GZIP compression */ enableGZIP?: boolean | null; /** Filter a header */ filterHeader?: string | null; /** Run a serverless function */ runFunction?: string | number; /** Redirect with 301 status */ redirectTo301?: string | null; /** Redirect with 302 status */ redirectTo302?: string | null; /** Add response header */ addResponseHeader?: string[]; /** Filter response cookie */ filterResponseCookie?: string; }; }; export declare type AzionResponseRuleBehaviorType = AzionCommonRuleBehaviorType | AzionResponseOnlyBehaviorType; /** * Rule configuration for Azion. */ export declare type AzionRule = { /** Rule name */ name: string; /** Rule description */ description?: string; /** Indicates if the rule is active */ active?: boolean; /** Array of criteria arrays */ criteria: AzionRuleCriteriaArray; /** Array of behaviors */ behaviors: AzionRuleBehavior[]; }; export declare type AzionRuleBehavior = AzionRuleNoArgsBehavior | AzionRuleStringBehavior | AzionRuleRunFunctionBehavior | AzionRuleSetCachePolicyBehavior | AzionRuleSetConnectorBehavior | AzionRuleSetOriginBehavior | AzionRuleHeaderBehavior | AzionRuleCookieBehavior | AzionRuleCaptureGroupsBehavior; export declare interface AzionRuleBehaviorBase { type: AzionRuleBehaviorType; } export declare type AzionRuleBehaviorType = AzionRequestRuleBehaviorType | AzionResponseRuleBehaviorType; export declare interface AzionRuleCaptureGroupsBehavior extends AzionRuleBehaviorBase { type: 'capture_match_groups'; attributes: { regex: string; subject: string; captured_array: string; }; } export declare interface AzionRuleCookieBehavior extends AzionRuleBehaviorBase { type: 'add_request_cookie' | 'filter_request_cookie' | 'set_cookie' | 'filter_response_cookie'; attributes: { value: string; }; } export declare type AzionRuleCriteria = AzionRuleCriteriaWithValue | AzionRuleCriteriaWithoutValue; export declare type AzionRuleCriteriaArray = AzionRuleCriteria[][]; export declare type AzionRuleCriteriaBase = { /** Variable to be evaluated */ variable: RuleVariable; /** Conditional type */ conditional: RuleConditional; }; export declare type AzionRuleCriteriaWithoutValue = AzionRuleCriteriaBase & { /** Operator for comparison that doesn't require input value */ operator: RuleOperatorWithoutValue; }; export declare type AzionRuleCriteriaWithValue = AzionRuleCriteriaBase & { /** Operator for comparison that requires input value */ operator: RuleOperatorWithValue; /** Input value for comparison */ argument: string; }; export declare interface AzionRuleHeaderBehavior extends AzionRuleBehaviorBase { type: 'add_request_header' | 'add_response_header' | 'filter_request_header' | 'filter_response_header'; attributes: { value: string; }; } export declare interface AzionRuleNoArgsBehavior extends AzionRuleBehaviorBase { type: 'deny' | 'no_content' | 'deliver' | 'finish_request_phase' | 'forward_cookies' | 'optimize_images' | 'bypass_cache' | 'enable_gzip' | 'redirect_http_to_https'; } export declare type AzionRulePhase = 'request' | 'response'; export declare interface AzionRuleRunFunctionBehavior extends AzionRuleBehaviorBase { type: 'run_function'; attributes: { value: string | number; }; } /** * Rules configuration for Azion. */ export declare type AzionRules = { /** Request rules */ request?: AzionRule[]; /** Response rules */ response?: AzionRule[]; }; export declare interface AzionRuleSetCachePolicyBehavior extends AzionRuleBehaviorBase { type: 'set_cache_policy'; attributes: { value: string | number; }; } export declare interface AzionRuleSetConnectorBehavior extends AzionRuleBehaviorBase { type: 'set_connector'; attributes: { value: string | number; }; } export declare interface AzionRuleSetOriginBehavior extends AzionRuleBehaviorBase { type: 'set_origin'; attributes: { value: string | number; }; } export declare interface AzionRuleStringBehavior extends AzionRuleBehaviorBase { type: 'redirect_to_301' | 'redirect_to_302' | 'rewrite_request' | 'filter_response_cookie'; attributes: { value: string; }; } /** * Storage binding configuration for Azion. */ export declare type AzionStorageBinding = { /** Storage bucket name or ID */ bucket: string; /** Storage prefix */ prefix?: string; }; export declare type AzionWaf = { /** WAF name */ name: string; /** Product version */ productVersion?: string; /** Engine settings */ engineSettings: WafEngineSettings; }; export declare type AzionWorkload = { name: string; active?: boolean; infrastructure?: WorkloadInfrastructure; tls?: AzionWorkloadTLS; protocols?: AzionWorkloadProtocols; mtls?: AzionWorkloadMTLS; domains?: string[]; workloadDomainAllowAccess?: boolean; /** Workload deployments */ deployments?: AzionWorkloadDeployment[]; }; /** * Workload Deployment configuration for Azion V4. */ export declare interface AzionWorkloadDeployment { /** Deployment name */ name: string; /** Whether this is the current deployment */ current?: boolean; /** Active status */ active?: boolean; /** Deployment strategy */ strategy: AzionWorkloadDeploymentStrategy; } /** * Workload Deployment Strategy configuration for Azion V4. */ export declare interface AzionWorkloadDeploymentStrategy { /** Strategy type */ type: string; /** Strategy attributes */ attributes: { /** Application name or ID reference */ application: string | number; /** Firewall name or ID reference (optional) */ firewall?: string | number | null; /** Custom page name or ID reference (optional) */ customPage?: string | number | null; }; } export declare type AzionWorkloadMTLS = { enabled: boolean; config: { verification: WorkloadMTLSVerification; certificate?: number | null; crl?: number[] | null; }; }; export declare type AzionWorkloadProtocols = { http: { versions: WorkloadHTTPVersion[]; httpPorts: number[]; httpsPorts: number[]; quicPorts?: number[] | null; }; }; export declare type AzionWorkloadTLS = { certificate?: number | null; ciphers?: WorkloadTLSCipher | null; minimumVersion?: WorkloadTLSVersion | null; }; export declare type BuildBundler = 'webpack' | 'esbuild'; export declare type BuildConfiguration = Omit<AzionBuild<Configuration | BuildOptions>, 'preset' | 'entry'> & { entry: Record<string, string>; baseOutputDir?: string; preset: AzionBuildPreset; setup: BundlerSetup; }; export declare interface BuildContext { production: boolean; handler: BuildEntryPoint; skipFrameworkBuild?: boolean; } export declare type BuildEntryPoint = string | string[] | Record<string, string>; export declare interface BundlerSetup { contentToInject?: string; defineVars?: Record<string, string>; } export declare type CacheAdaptiveDelivery = 'ignore' | 'allowlist'; export declare type CacheBrowserSetting = 'honor' | 'override' | 'no-cache'; export declare type CacheByCookie = 'ignore' | 'all' | 'allowlist' | 'denylist'; export declare type CacheByQueryString = 'ignore' | 'all' | 'allowlist' | 'denylist'; export declare type CacheCdnSetting = 'honor' | 'override'; export declare type CacheVaryByMethod = 'options' | 'post'; export declare type CommonVariable = 'args' | 'device_group' | 'domain' | 'geoip_city' | 'geoip_city_continent_code' | 'geoip_city_country_code' | 'geoip_city_country_name' | 'geoip_continent_code' | 'geoip_country_code' | 'geoip_country_name' | 'geoip_region' | 'geoip_region_name' | 'host' | 'remote_addr' | 'remote_port' | 'remote_user' | 'request' | 'request_body' | 'request_method' | 'request_uri' | 'scheme' | 'uri' | 'network'; export declare interface ConnectorAddress { /** Address active status */ active?: boolean; /** IPv4/IPv6 address or CNAME */ address: string; /** HTTP port */ httpPort?: number; /** HTTPS port */ httpsPort?: number; /** Address modules */ modules?: ConnectorAddressModules | null; } export declare interface ConnectorAddressModules { } export declare type ConnectorAttributes = ConnectorStorageAttributes | ConnectorHttpAttributes | ConnectorLiveIngestAttributes; export declare interface ConnectorConnectionOptions { /** DNS resolution policy */ dnsResolution?: ConnectorDnsResolution; /** Transport protocol policy */ transportPolicy?: ConnectorTransportPolicy; /** HTTP version preference */ httpVersionPolicy?: ConnectorHttpVersionPolicy; /** Custom host override */ host?: string; /** Path prefix for requests */ pathPrefix?: string; /** Follow HTTP redirects */ followingRedirect?: boolean; /** Real IP header name */ realIpHeader?: string; /** Real port header name */ realPortHeader?: string; } export declare type ConnectorDnsResolution = 'both' | 'force_ipv4'; export declare type ConnectorHmacType = 'aws4_hmac_sha256'; export declare interface ConnectorHttpAttributes { /** Array of addresses */ addresses: ConnectorAddress[]; /** Connection options */ connectionOptions: ConnectorConnectionOptions; /** Modules configuration */ modules?: ConnectorModules; } export declare type ConnectorHttpVersionPolicy = 'http1_1'; export declare interface ConnectorLiveIngestAttributes { /** Array of addresses */ addresses: ConnectorAddress[]; /** Connection options */ connectionOptions: ConnectorConnectionOptions; /** Modules configuration */ modules?: ConnectorModules; } export declare type ConnectorLoadBalanceMethod = 'round_robin' | 'least_conn' | 'ip_hash'; export declare interface ConnectorModules { /** Load balancer module */ loadBalancer: { enabled: boolean; config: LoadBalancerConfig | null; }; /** Origin shield module */ originShield: { enabled: boolean; config: OriginShieldConfig | null; }; } export declare interface ConnectorStorageAttributes { /** Storage bucket name */ bucket: string; /** Storage prefix */ prefix?: string; } export declare type ConnectorTransportPolicy = 'preserve' | 'force_https' | 'force_http'; export declare type ConnectorType = 'http' | 'storage' | 'live_ingest'; /** * Converts a JSON string to an AzionConfig object. * @param {string} config - The JSON string to be converted. * @returns {AzionConfig} The AzionConfig object. * @throws {Error} Throws an error if the provided JSON string is invalid. * * @example * const config = `{ * "origin": [ * { * "name": "My Origin", * "origin_type": "single_origin", * "origin_path": '', * "method": 'ip_hash', * "addresses": [ * { * "address": "origin.example.com", * "weight": 100 * } * ], * } * ] *}`; * const configObject = convertJsonConfigToObject(config); * console.log(configObject); * */ export declare function convertJsonConfigToObject(config: string): AzionConfig; /** * Smart converter that detects format and converts if needed */ export declare function convertToV4Config(config: any): AzionConfig; /** * Converts V3 legacy configuration to V4 format * Transforms rules structure from { variable, match, behavior } to { criteria, behaviors } * @param {any} legacyConfig - V3 configuration object * @returns {AzionConfig} V4 configuration object */ export declare function convertV3ToV4Config(legacyConfig: any): AzionConfig; export declare type CustomPageErrorCode = 'default' | '400' | '401' | '403' | '404' | '405' | '406' | '408' | '409' | '410' | '411' | '414' | '415' | '416' | '426' | '429' | '431' | '500' | '501' | '502' | '503' | '504' | '505'; export declare type CustomPageType = 'page_connector'; /** * Helper function to provide IntelliSense for Azion configuration. * Similar to Vite's defineConfig - provides type safety without runtime overhead. * * @param {AzionConfig} config - The configuration object for the Azion Platform. * @returns {AzionConfig} The same configuration object (no validation or processing) * * @example * import { defineConfig } from 'azion/config'; * * export default defineConfig({ * build: { * preset: 'typescript', * }, * domain: { * name: 'example.com', * }, * // ... other configurations * }); */ export declare function defineConfig(config: AzionConfig): AzionConfig; declare type DynamicVariable = `arg_${string}` | `cookie_${string}` | `http_${string}` | `sent_http_${string}` | `upstream_cookie_${string}` | `upstream_http_${string}`; export declare type FirewallBehaviorName = 'deny' | 'drop' | 'set_rate_limit' | 'set_waf_ruleset' | 'run_function' | 'set_custom_response'; export declare type FirewallRateLimitBy = 'clientIp' | 'global'; export declare type FirewallRateLimitType = 'second' | 'minute'; export declare type FirewallVariable = 'header_accept' | 'header_accept_encoding' | 'header_accept_language' | 'header_cookie' | 'header_origin' | 'header_referer' | 'header_user_agent' | 'host' | 'network' | 'request_args' | 'request_method' | 'request_uri' | 'scheme' | 'client_certificate_validation' | 'ssl_verification_status'; export declare type FirewallWafMode = 'learning' | 'blocking'; export declare type FunctionExecutionEnvironment = 'application' | 'firewall'; export declare type FunctionRuntime = 'azion_js'; export declare interface HMACConfig { /** HMAC type */ type: ConnectorHmacType; /** HMAC attributes */ attributes: AWS4HMACAttributes; } /** * Validates if a config object appears to be V3 legacy format */ export declare function isV3LegacyConfig(config: any): boolean; export declare interface LoadBalancerConfig { /** Load balancing method */ method?: ConnectorLoadBalanceMethod; /** Maximum retry attempts */ maxRetries?: number; /** Connection timeout in seconds */ connectionTimeout?: number; /** Read/write timeout in seconds */ readWriteTimeout?: number; } export declare type NetworkListType = 'ip_cidr' | 'asn' | 'countries'; export declare interface OriginShieldConfig { /** Origin IP ACL */ originIpAcl?: { enabled?: boolean; }; /** HMAC configuration */ hmac?: { enabled?: boolean; config?: HMACConfig | null; }; } export declare type PresetInput = string | AzionBuildPreset; export declare type PresetMetadata = { name: string; registry?: string; ext?: string; }; /** * Processes the provided configuration object and returns a JSON object that can be used to create or update an Azion CDN configuration. * @param inputConfig AzionConfig * @returns * * @example * const config = { * origin: [ * { * name: 'My Origin', * type: 'single_origin', * addresses: [ * { * address: 'origin.example.com', * weight: 100, * }, * ], * protocolPolicy: 'https', * }, * ], * } * const payloadCDN = processConfig(config); * console.log(payloadCDN); */ export declare function processConfig(inputConfig: AzionConfig): any; export declare type RequestVariable = CommonVariable | 'server_addr' | 'server_port' | 'ssl_client_fingerprint' | 'ssl_client_escaped_cert' | 'ssl_client_s_dn' | 'ssl_client_s_dn_parsed' | 'ssl_client_cert' | 'ssl_client_i_dn' | 'ssl_client_serial' | 'ssl_client_v_end' | 'ssl_client_v_remain' | 'ssl_client_v_start' | 'ssl_client_verify'; export declare type ResponseVariable = CommonVariable | 'sent_http_name' | 'status' | 'tcpinfo_rtt' | 'upstream_addr' | 'upstream_status'; export declare type RuleConditional = 'if' | 'and' | 'or'; export declare type RuleOperatorWithoutValue = 'exists' | 'does_not_exist'; export declare type RuleOperatorWithValue = 'is_equal' | 'is_not_equal' | 'starts_with' | 'does_not_start_with' | 'matches' | 'does_not_match' | 'is_in_list' | 'is_not_in_list'; export declare type RuleVariable = WithDollarBraces<CommonVariable | RequestVariable | ResponseVariable> | DynamicVariable | WithDollarBraces<DynamicVariable>; export declare type TieredCacheTopology = 'nearest-region' | 'br-east-1' | 'us-east-1'; /** * Validates the provided configuration against a JSON Schema. * This function uses AJV (Another JSON Schema Validator) to validate the configuration. * If the configuration is not valid, an exception is thrown with the error message of the first validation issue encountered. * @param {AzionConfig | Record<string, unknown>} config - The configuration to be validated. * @param {object} schema - The JSON Schema to be used for validation. Default is the Azion CDN configuration schema. * @throws {Error} Throws an error if the configuration fails validation. */ export declare function validateConfig(config: AzionConfig | Record<string, unknown>, schema?: Record<string, unknown>): void; /** * Validates the provided manifest against the Azion Manifest Schema. * This function uses AJV (Another JSON Schema Validator) to validate the manifest. * If the manifest is not valid, an exception is thrown with the error message of the first validation issue encountered. * @param {Record<string, unknown>} manifest - The manifest to be validated. * @param {object} schema - The JSON Schema to be used for validation. Default is the Azion Manifest schema. * @throws {Error} Throws an error if the manifest fails validation. */ export declare function validateManifest(manifest: Record<string, unknown>, schema?: Record<string, unknown>): void; export declare interface WafEngineAttributes { /** WAF rulesets */ rulesets: WafRuleset[]; /** Threat thresholds */ thresholds: WafThreshold[]; } export declare interface WafEngineSettings { /** Engine version */ engineVersion: WafEngineVersion; /** Engine type */ type: WafEngineType; /** Engine attributes */ attributes: WafEngineAttributes; } export declare type WafEngineType = 'score'; export declare type WafEngineVersion = '2021-Q3'; export declare type WafMode = 'learning' | 'blocking' | 'counting'; export declare type WafRuleset = 1; export declare type WafSensitivity = 'lowest' | 'low' | 'medium' | 'high' | 'highest'; export declare type WafThreatType = 'cross_site_scripting' | 'directory_traversal' | 'evading_tricks' | 'file_upload' | 'identified_attack' | 'remote_file_inclusion' | 'sql_injection' | 'unwanted_access'; export declare interface WafThreshold { /** Threat type */ threat: WafThreatType; /** Sensitivity level */ sensitivity: WafSensitivity; } declare type WithDollarBraces<T extends string> = `\${${T}}` | T; export declare type WorkloadHTTPVersion = 'http1' | 'http2' | 'http3'; export declare type WorkloadInfrastructure = 1 | 2; export declare type WorkloadMTLSVerification = 'enforce' | 'permissive'; export declare type workloadsAccessType = 'read_only' | 'read_write' | 'restricted'; export declare type WorkloadTLSCipher = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8; export declare type WorkloadTLSVersion = '' | 'tls_1_0' | 'tls_1_1' | 'tls_1_2' | 'tls_1_3'; export { }