UNPKG

@stevenpaz/types

Version:

Contains the Edgio types.

1,583 lines (1,580 loc) 40.5 kB
/* eslint-disable */ /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ export type Hostname = string; export type Rules = Matches | Features; export type Comment = string; export type HttpStatusCode = | 100 | 101 | 102 | 103 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 425 | 426 | 428 | 429 | 431 | 440 | 444 | 451 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 | 548 | 549 | 888 | 893; export type SingleLineString = string; export type HeaderTreatment = "pass" | "overwrite" | "if_missing" | "remove"; export type TimeInterval = string; export type GenericField = string; export type Bytes = string; export interface EdgioTypes { properties: Property[]; rules?: Rules[]; rtld?: Rtld; } export interface Property { name: string; /** * @maxItems 100 */ origins?: Origins[]; /** * @minItems 1 */ hostnames?: [Hostnames, ...Hostnames[]]; rules?: Rules[]; edge_functions?: EdgeFunctions; } export interface Origins { id?: string; name?: string; type?: "customer_origin" | "cdn_storage"; hosts?: OriginBackends[]; balancer?: | "primary_failover" | "round_robin" | "carp" | "carp64" | "static_with_tags" | "static_weighted" | "static_nocache_bypass" | "sqf"; override_host_header?: string; shields?: { global?: string; apac?: string; emea?: string; us_west?: string; us_east?: string; }; pci_certified_shields?: boolean; tls_verify?: { use_sni?: boolean; sni_hint_and_strict_san_check?: Hostname; allow_self_signed_certs?: boolean; pinned_certs?: string[]; }; } export interface OriginBackends { weight?: number; dns_max_ttl?: number; dns_preference?: "prefv4" | "prefv6" | "onlyv4" | "onlyv6"; max_hard_pool?: number; dns_min_ttl?: number; location: | [] | [ { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [ { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; }, { port?: number; hostname: Hostname; } ] | [] | [Hostname] | [Hostname, Hostname] | [Hostname, Hostname, Hostname] | [Hostname, Hostname, Hostname, Hostname] | [Hostname, Hostname, Hostname, Hostname, Hostname] | [Hostname, Hostname, Hostname, Hostname, Hostname, Hostname] | [Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname] | [ Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname ] | [ Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname ] | [ Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname, Hostname ] | Hostname; max_pool?: number; balancer?: "carp" | "sqf" | "primary_failover" | "round_robin"; scheme?: "http" | "https" | "match"; } export interface Hostnames { hostname: Hostname; default_origin_name?: string; report_code?: number; tls?: { npn?: boolean; alpn?: boolean; protocols?: string; use_sigalgs?: boolean; sni?: boolean; sni_strict?: boolean; sni_host_match?: boolean; client_renegotiation?: boolean; options?: string; cipher_list?: string; named_curve?: string; oscp?: boolean; pem?: string; ca?: string; }; } export interface Matches { /** * @minItems 2 */ if?: [ Boolean | Conditionals | Features, Boolean | Conditionals | Features, ...(Boolean | Conditionals | Features)[] ]; } export interface Boolean { /** * @minItems 2 * @maxItems 28 * * This interface was referenced by `Boolean`'s JSON-Schema definition * via the `patternProperty` "^(or|and)$". */ [k: string]: [Conditionals, Conditionals, ...Conditionals[]]; } export interface Conditionals { /** * @minItems 2 * @maxItems 2 * * This interface was referenced by `Conditionals`'s JSON-Schema definition * via the `patternProperty` "^(==|!=|===|!==)$". * @minItems 2 * @maxItems 3 * * This interface was referenced by `Conditionals`'s JSON-Schema definition * via the `patternProperty` "^(<|<=)$". * @minItems 2 * @maxItems 2 * * This interface was referenced by `Conditionals`'s JSON-Schema definition * via the `patternProperty` "^(>|>=)$". * @minItems 2 * * This interface was referenced by `Conditionals`'s JSON-Schema definition * via the `patternProperty` "^(in|not_in)$". * @minItems 2 * * This interface was referenced by `Conditionals`'s JSON-Schema definition * via the `patternProperty` "^(=~|!~)$". */ [k: string]: | [ (number | string | boolean) | RulesVariables, (number | string | boolean) | RulesVariables ] | [RulesVariables | number, RulesVariables | number] | [ RulesVariables | number, RulesVariables | number, RulesVariables | number ] | [RulesVariables | number, RulesVariables | number] | [ RulesVariables | (string | unknown[]), RulesVariables | (string | unknown[]), ...(RulesVariables | (string | unknown[]))[] ] | [ RulesVariables | (string | number), RulesVariables | (string | number), ...(RulesVariables | (string | number))[] ]; } export interface RulesVariables { /** * client_ip : Identifies requests that originate from a particular IP address. * * referring_domain : Identifies requests by the referrer's hostname. A referrer's hostname is determined by the `Referer` header. * * method : Identifies requests by their HTTP method. Only assets that are requested using the selected request method will satisfy this condition. * * origin_path : Identifies requests by the request URL's relative path. This relative path comparison is performed on rewritten or redirected URLs. * * pop_code : Identifies requests by the POP that processed the request. * * path : Identifies requests by the relative path of the request URL submitted by the client. * * query : Identifies requests by the query string of the request URL submitted by the client. * * * * https://docs.edg.io/guides/v7/performance/rules/conditions#request */ request?: | "client_ip" | "referring_domain" | "method" | "scheme" | "origin_path" | "origin_query_string" | "pop_code" | "path" | "query"; /** * filename : Identifies requests by the filename defined in the URL. * * directory : Identifies requests by the request URL's relative path. This relative path excludes the filename of the requested asset. * * * * https://docs.edg.io/guides/v7/performance/rules/conditions#request.path */ "request.path"?: "filename" | "extension" | "directory"; "request.origin_query"?: string; "request.cookie"?: string; "request.header"?: string; random?: number; /** * asn : Identifies requests by the network from which the request was issued. A network is identified by its Autonomous System Number (ASN). * * city : Identifies requests by the city from which they originated. * * continent : Identifies requests by the continent from which the request was issued. * * country : Identifies requests by the country from which the request was issued. * * dma_code : Identifies requests by the metro code (Designated Market Area - DMA) from which the request was issued. * * latitude : Identifies requests by the latitude from which the request was issued. * * longitude : Identifies requests by the longitude from which the request was issued. * * postal_code : Identifies requests by the postal code from which the request was issued. * * region_code : Identifies requests by the code for the region (e.g., state or province) from which the request was issued. * * * * https://docs.edg.io/guides/v7/performance/rules/conditions#location */ location?: | "asn" | "city" | "continent" | "country" | "dma_code" | "latitude" | "longitude" | "postal_code" | "region_code" | "metro_code"; variable?: | "is_origin_shield" | "usrvar_enable_debug" | "usrvar_enable_sf_debug" | "usrvar_enable_options_resp" | "usrvar_options" | "status" | "country_code"; /** * Identifies requests by the POP that processed the request. * * https://docs.edg.io/guides/v7/performance/rules/features#request */ pop_code?: string; /** * brand_name : Identifies requests by the manufacturer (e.g., Samsung) of the device that issued the request. * * dual_orientation : Identifies requests by whether the device that issued the request supports dual orientation (i.e., portrait and landscape). * * html_preferred_dtd : Identifies requests by a device's preferred document type definition (DTD) for HTML content (e.g., `html5`). * * image_inlining : Identifies requests by whether the device that issued the request supports Base64-encoded images. * * is_android : Identifies requests by whether the operating system of the device that issued the request is Android. * * is_app : Identifies requests by whether the device that issued the request is a native application. * * is_full_desktop : Identifies requests by whether the device that issued the request provides a full desktop experience. * * is_ios : Identifies requests by whether the operating system of the device that issued the request is iOS. * * is_robot : Identifies requests by whether the device that issued the request is considered to be an automated HTTP client (e.g., a robot crawler). * * is_smartphone : Identifies requests by whether the device that issued the request is a smartphone. * * is_smarttv : Identifies requests by whether the device that issued the request is a smart TV. * * is_tablet : Identifies requests by whether the device that issued the request is a tablet. This is an OS-independent description. * * is_touchscreen : Identifies requests by whether the device that issued the request uses a touchscreen as the primary pointing device. * * is_windows_phone : Identifies requests by whether the device that issued the request is a Windows Mobile 6.5/Windows Phone 7 or higher. * * is_wireless_device : Identifies requests by whether the device that issued the request is a wireless device. * * marketing_name : Identifies requests by the marketing name (e.g., `BlackBerry 8100 Pearl`) of the device that issued the request. * * mobile_browser : Identifies requests by the name of the browser (e.g., Chrome) that issued the request. * * model_name : Identifies requests by the model name (e.g., s7) of the device that issued the request. * * progressive_download : Identifies requests by whether the device that issued the request supports the playback of audio/video while it is still being downloaded. * * release_date : Identifies requests by the date on which the device that issued the request was added to the WURFL database. * * resolution_height : Identifies requests by the height, in pixels, of the device that issued the request. * * resolution_width : Identifies requests by the width, in pixels, of the device that issued the request. * * * * https://docs.edg.io/guides/v7/performance/rules/conditions#device */ device?: | "device_os" | "brand_name" | "dual_orientation" | "html_preferred_dtd" | "image_inlining" | "is_android" | "is_app" | "is_full_desktop" | "is_ios" | "is_robot" | "is_smartphone" | "is_smarttv" | "is_tablet" | "is_touchscreen" | "is_windows_phone" | "is_wireless_device" | "marketing_name" | "mobile_browser" | "model_name" | "progressive_download" | "release_date" | "resolution_height" | "resolution_width"; /** * Response features manipulate the response sent to the client. * * https://docs.edg.io/guides/v7/performance/rules/features#response */ response?: "status_code"; } export interface Features { edge_function?: string; comment?: Comment; /** * Access features control access to content. * * https://docs.edg.io/guides/v7/performance/rules/features#access */ access?: Access; /** * Caching features customize when and how content is cached. * * https://docs.edg.io/guides/v7/performance/rules/features#caching */ caching?: Caching; /** * Response features manipulate the response sent to the client. * * https://docs.edg.io/guides/v7/performance/rules/features#response */ response?: Response; /** * Header features add, modify, or delete headers from the request or response. * * https://docs.edg.io/guides/v7/performance/rules/features#headers */ headers?: Headers; logs?: Logs; /** * Origin features control how the CDN communicates with an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#origin */ origin?: Origin; /** * URL features redirect or rewrite requests to a different URL. * * https://docs.edg.io/guides/v7/performance/rules/features#url */ url?: Url; client?: Client; /** * This feature assigns a value to one or more user-defined variable(s) that are passed to your bespoke traffic processing solution. Define each desired variable as a key-value pair. * * https://docs.edg.io/guides/v7/performance/rules/features#set-variables * * * Example: * ``` * new Router() * .get('/', { * set_variables: { * "traffic": "standard", * "event": "basketball", * } * }) * ``` */ set_variables?: SetVariables; } /** * Access features control access to content. * * https://docs.edg.io/guides/v7/performance/rules/features#access */ export interface Access { /** * Determines whether requests are rejected with a `403 Forbidden` response. * * https://docs.edg.io/guides/v7/performance/rules/features#deny-access * * * Example: * ``` * new Router() * .get('/', { * access: { * "deny_access": true, * } * }) * ``` */ deny_access?: boolean; /** * Determines the type of response that will be returned to a user when a request is denied due to Token-Based Authentication. * * https://docs.edg.io/guides/v7/performance/rules/features#token-auth-denial-code */ token_auth_denial_code?: HttpResponseNoBody; /** * Determines whether URL comparisons made by the following Token-Based Authentication parameters are case-sensitive: * * https://docs.edg.io/guides/v7/performance/rules/features#token-auth-ignore-url-case * * * Example: * ``` * new Router() * .get('/', { * access: { * "token_auth_ignore_url_case": true, * } * }) * ``` */ token_auth_ignore_url_case?: boolean; /** * Determines whether Token-Based Authentication will be applied to a request. * * https://docs.edg.io/guides/v7/performance/rules/features#token-auth * * * Example: * ``` * new Router() * .get('/', { * access: { * "token_auth": true, * } * }) * ``` */ token_auth?: boolean; } export interface HttpResponseNoBody { code?: HttpStatusCode; /** * Header features add, modify, or delete headers from the request or response. * * https://docs.edg.io/guides/v7/performance/rules/features#headers */ headers?: HttpResponseHeader; } export interface HttpResponseHeader { /** * This interface was referenced by `HttpResponseHeader`'s JSON-Schema definition * via the `patternProperty` "^[+]?[-_a-zA-Z0-9 .]+$". * This interface was referenced by `HttpResponseHeader`'s JSON-Schema definition * via the `patternProperty` "^(Accept-Ranges|Age|Connection|Content-Encoding|Content-Length|Content-Range|Date|Server|Trailer|Transfer-Encoding|Upgrade|Vary|Via|Warning|X-EC.*)$". */ [k: string]: (SingleLineString | RulesVariables) | null; } /** * Caching features customize when and how content is cached. * * https://docs.edg.io/guides/v7/performance/rules/features#caching */ export interface Caching { /** * Throttles the bandwidth for the response provided by our edge servers. * * https://docs.edg.io/guides/v7/performance/rules/features#bandwidth-throttling * * * Example: * ``` * new Router() * .get('/', { * caching: { * "bandwidth_throttling": { * "kbytes_per_sec": 300, * "prebuf_seconds": 15, * } * } * }) * ``` */ bandwidth_throttling?: { kbytes_per_sec: number; prebuf_seconds?: number; }; /** * Determines whether our CDN will honor your caching policy when determining whether requests should be cached. * * https://docs.edg.io/guides/v7/performance/rules/features#bypass-cache * * * Example: * ``` * new Router() * .get('/', { * caching: { * "bypass_cache": true, * } * }) * ``` */ bypass_cache?: boolean; /** * Controls the generation of `Cache-Control` headers by an edge server when the `Set Client Max Age` feature is active. * * https://docs.edg.io/guides/v7/performance/rules/features#cache-control-header-treatment * * * Example: * ``` * new Router() * .get('/', { * caching: { * "cache_control_header_treatment": "pass", * } * }) * ``` */ cache_control_header_treatment?: HeaderTreatment; /** * Determines how an edge server will handle the `Expires` response header when the `Set Client Max Age` feature is active. This feature overrides the `Expires` header generated by the `Set Client Max Age` feature. * * https://docs.edg.io/guides/v7/performance/rules/features#expires-header-treatment * * * Example: * ``` * new Router() * .get('/', { * caching: { * "expires_header_treatment": 'if_missing', * } * }) * ``` */ expires_header_treatment?: HeaderTreatment; /** * Determines the `max-age` interval for browser to edge server cache revalidation. In other words, the amount of time that will pass before a browser can check for a new version of an asset from an edge server. * * https://docs.edg.io/guides/v7/performance/rules/features#client-max-age * * * Example: * ``` * new Router() * .get('/', { * caching: { * "client_max_age": "10h", * } * }) * ``` */ client_max_age?: TimeInterval; /** * Determines whether the cache key will include or exclude query string parameters associated with a request. * * https://docs.edg.io/guides/v7/performance/rules/features#cache-key-query-string */ cache_key_query_string?: { include_all?: boolean; exclude_all?: boolean; include?: string[]; include_all_except?: string[]; }; cache_key_rewrite?: RegexRewrite; max_age?: | TimeInterval | { /** * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` "^[1-5][0-9][0-9]$". */ [k: string]: TimeInterval; }; h264_support?: string[]; h264_support_video_seek_params?: { seek_start: GenericField; seek_end?: GenericField; }; /** * Determines whether an HTTP client's no-cache requests will be forwarded to the origin server. A no-cache request occurs when the HTTP client sends a `Cache-Control:no-cache` and/or `Pragma:no-cache header` in the HTTP request. * * https://docs.edg.io/guides/v7/performance/rules/features#honor-no-cache-request-header * * * Example: * ``` * new Router() * .get('/', { * caching: { * "honor_no_cache_request_header": true, * } * }) * ``` */ honor_no_cache_request_header?: boolean; /** * Determines on a per HTTP status code basis whether our CDN will ignore cache directives served from an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#ignore-origin-no-cache * * * Example: * ``` * new Router() * .get('/', { * caching: { * "ignore_origin_no_cache": [200, 300, 301], * } * }) * ``` */ ignore_origin_no_cache?: HttpStatusCode[]; /** * Determines the response that will be returned to clients when a request generates a `416 Requested Range Not Satisfiable` status code. By default, this status code is returned when the specified byte-range request cannot be satisfied by an edge server and an `If-Range` request header field was not specified. * * https://docs.edg.io/guides/v7/performance/rules/features#ignore-unsatisfiable-ranges * * * Example: * ``` * new Router() * .get('/', { * caching: { * "ignore_unsatisfiable_ranges": true, * } * }) * ``` */ ignore_unsatisfiable_ranges?: boolean; /** * Controls how long past the normal expiration time a cached asset may be served from an edge server when the edge server is unable to revalidate the cached asset with the origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#revalidate-after-origin-unavailable */ revalidate_after_origin_unavailable?: | TimeInterval | { /** * This interface was referenced by `undefined`'s JSON-Schema definition * via the `patternProperty` "^[1-5][0-9][0-9]$". */ [k: string]: TimeInterval; }; /** * Defines the minimum file size (Kb) for caching partial content. * * https://docs.edg.io/guides/v7/performance/rules/features#partial-cache-sharing-min-hit-size * * * Example: * ``` * new Router() * .get('/', { * caching: { * "partial_cache_sharing_min_hit_size": 1024, * } * }) * ``` */ partial_cache_sharing_min_hit_size?: number; /** * Determines whether cached content will be eligible for early revalidation before its TTL expires. Define the amount of time prior to the expiration of the requested content's TTL during which it will be eligible for early revalidation. * * https://docs.edg.io/guides/v7/performance/rules/features#prevalidate-cached-content * * * Example: * ``` * new Router() * .get('/', { * caching: { * "prevalidate_cached_content": "10m", * } * }) * ``` */ prevalidate_cached_content?: TimeInterval; /** * Determines how an HTTP client's request for a 0-byte cache asset is handled by our edge servers. * * https://docs.edg.io/guides/v7/performance/rules/features#refresh-zero-byte-cache-files * * * Example: * ``` * new Router() * .get('/', { * caching: { * "refresh_zero_byte_cache_files": true, * } * }) * ``` */ refresh_zero_byte_cache_files?: boolean; /** * Defines the set of status codes that can result in cached content. * * https://docs.edg.io/guides/v7/performance/rules/features#cacheable-status-codes * * * Example: * ``` * new Router() * .get('/', { * caching: { * "cacheable_status_codes": [300, 301, 302], * } * }) * ``` */ cacheable_status_codes?: HttpStatusCode[]; /** * Determines whether expired cached content will be delivered when an error occurs during cache revalidation or when retrieving the requested content from an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#stale-on-error * * * Example: * ``` * new Router() * .get('/', { * caching: { * "stale_on_error": true, * } * }) * ``` */ stale_on_error?: boolean; /** * Improves performance by allowing our edge servers to serve stale content while revalidation takes place. * * https://docs.edg.io/guides/v7/performance/rules/features#stale-while-revalidate * * * Example: * ``` * new Router() * .get('/', { * caching: { * "stale_while_revalidate": "10m", * } * }) * ``` */ stale_while_revalidate?: TimeInterval; /** * Determines whether `POST` and `PUT` requests are eligible for caching on our network. * * https://docs.edg.io/guides/v7/performance/rules/features#enable-caching-for-methods * * * Example: * ``` * new Router() * .get('/', { * caching: { * "enable_caching_for_methods": ["POST", "PUT"], * } * }) * ``` */ enable_caching_for_methods?: ("GET" | "POST" | "PUT")[]; /** * Restricts caching to requests whose body does not exceed the specified file size. * * https://docs.edg.io/guides/v7/performance/rules/features#cacheable-request-body-size */ cacheable_request_body_size?: Bytes; /** * Determines how often, in seconds, the system will attempt to connect to an unavailable origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#revalidate-while-stale-timer * * * Example: * ``` * new Router() * .get('/', { * caching: { * "revalidate_while_stale_timer": 200, * } * }) * ``` */ revalidate_while_stale_timer?: number; /** * Determines whether our CDN will instruct the client to bypass cache. * * https://docs.edg.io/guides/v7/performance/rules/features#bypass-client-cache * * * Example: * ``` * new Router() * .get('/', { * caching: { * "bypass_client_cache": true, * } * }) * ``` */ bypass_client_cache?: boolean; service_worker_max_age?: TimeInterval; allow_empty_query_in_cache_key?: boolean; } export interface RegexRewrite { source?: string; destination?: string; } /** * Response features manipulate the response sent to the client. * * https://docs.edg.io/guides/v7/performance/rules/features#response */ export interface Response { /** * Defines the HTTP status code for the response sent to the client. * * https://docs.edg.io/guides/v7/performance/rules/features#set-status-code * * * Example: * ``` * new Router() * .get('/', { * response: { * "set_status_code": 200, * } * }) * ``` */ set_status_code?: HttpStatusCode; /** * Determines whether to stop processing the request. * * https://docs.edg.io/guides/v7/performance/rules/features#set-done * * * Example: * ``` * new Router() * .get('/', { * response: { * "set_status_code": 200, * "set_response_body": "<!DOCTYPE html><title>hi</title>", * "set_done": true, * } * }) * ``` */ set_done?: boolean; /** * Defines a custom response body. * * https://docs.edg.io/guides/v7/performance/rules/features#set-response-body * * * Example: * ``` * new Router() * .get('/', { * response: { * "set_response_body": "<!DOCTYPE html><title>hi</title>", * } * }) * ``` */ set_response_body?: string; allow_prefetching_uncached_content?: boolean; /** * Defines the set of media types (aka content type) that are eligible for edge server compression. * * https://docs.edg.io/guides/v7/performance/rules/features#compress-content-types * * * Example: * ``` * new Router() * .get('/', { * response: { * "compress_content_types": ["text/plain", "text/html", "text/css"], * } * }) * ``` */ compress_content_types?: string[]; } /** * Header features add, modify, or delete headers from the request or response. * * https://docs.edg.io/guides/v7/performance/rules/features#headers */ export interface Headers { /** * Determines whether a response may include debug cache response headers. These response headers provide information on the cache policy for the requested asset. * * https://docs.edg.io/guides/v7/performance/rules/features#debug-header * * * Example: * ``` * new Router() * .get('/', { * headers: { * "debug_header": true, * } * }) * ``` */ debug_header?: boolean; /** * Set, overwrite, append, or delete one or more header(s) from the request. * * https://docs.edg.io/guides/v7/performance/rules/features#set-request-headers */ set_request_headers?: HttpRequestHeader; /** * Set, overwrite, append, or delete one or more header(s) from the response. * * https://docs.edg.io/guides/v7/performance/rules/features#set-response-headers * * * Example: * ``` * new Router() * .get('/', { * headers: { * "set_response_headers": { * "sports": "basketball", * "+broadcast": " ott" * }, * } * }) * ``` */ set_response_headers?: HttpResponseHeader; /** * Adds one or more header(s) to the response. * * https://docs.edg.io/guides/v7/performance/rules/features#add-response-headers */ add_response_headers?: HttpResponseHeader; /** * Adds a custom request header that identifies the requesting client by IP address. * * https://docs.edg.io/guides/v7/performance/rules/features#set-client-ip-custom-header * * * Example: * ``` * new Router() * .get('/', { * headers: { * "set_client_ip_custom_header": "client-ip", * } * }) * ``` */ set_client_ip_custom_header?: GenericField; /** * Deletes one or more header(s) from a response. * * https://docs.edg.io/guides/v7/performance/rules/features#remove-response-headers * * * Example: * ``` * new Router() * .get('/', { * headers: { * "remove_response_headers": ["city", "state", "zipcode"], * } * }) * ``` */ remove_response_headers?: string[]; /** * Deletes one or more header(s) from the response provided by an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#remove-origin-response-headers * * * Example: * ``` * new Router() * .get('/', { * headers: { * "remove_origin_response_headers": ["city", "state", "zipcode"], * } * }) * ``` */ remove_origin_response_headers?: string[]; /** * Determines whether to include the [Server-Timing header](/guides/performance/response#server-timing-response-header) in the response. The `Server-Timing` response header contains cache status information and information about the POP that served the response. * * https://docs.edg.io/guides/v7/performance/rules/features#server-timing-header * * * Example: * ``` * new Router() * .get('/', { * headers: { * "server_timing_header": true, * } * }) * ``` */ server_timing_header?: boolean; } export interface HttpRequestHeader { /** * This interface was referenced by `HttpRequestHeader`'s JSON-Schema definition * via the `patternProperty` "^[+]?[-_a-zA-Z0-9 .]+$". * This interface was referenced by `HttpRequestHeader`'s JSON-Schema definition * via the `patternProperty` "^(Forwarded-For|Host|Vary|Via|Warning|X-Forwarded-For|X-EC.*)$". */ [k: string]: SingleLineString | null; } export interface Logs { custom_log_field_format?: string; /** * Determines whether a query string will be stored along with the URL in access logs. This feature does not apply to requests whose URL does not contain a query string. * * https://docs.edg.io/guides/v7/performance/rules/features#log-query-string * * * Example: * ``` * new Router() * .get('/', { * logs: { * "log_query_string": true, * } * }) * ``` */ log_query_string?: boolean; /** * Masks the client's subnet for logging and reporting purposes. * * https://docs.edg.io/guides/v7/performance/rules/features#mask-client-subnet * * * Example: * ``` * new Router() * .get('/', { * logs: { * "mask_client_subnet": true, * } * }) * ``` */ mask_client_subnet?: boolean; } /** * Origin features control how the CDN communicates with an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#origin */ export interface Origin { /** * Defines the maximum number of requests for a `Keep-Alive` connection before it is closed. * * https://docs.edg.io/guides/v7/performance/rules/features#max-keep-alive-requests * * * Example: * ``` * new Router() * .get('/', { * origin: { * "max_keep_alive_requests": 12000, * } * }) * ``` */ max_keep_alive_requests?: number; /** * Defines the set of CDN-specific request headers that will be forwarded from an edge server to an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#proxy-special-headers * * * Example: * ``` * new Router() * .get('/', { * origin: { * "proxy_special_headers": ["X-Forwarded-For","X-Host","X-EC-Tag"], * } * }) * ``` */ proxy_special_headers?: GenericField[]; /** * Defines the [origin configuration](/guides/basics/hostnames_and_origins#origin) to which requests will be forwarded when they cannot be served from cache. * * https://docs.edg.io/guides/v7/performance/rules/features#set-origin * * * Example: * ``` * new Router() * .get('/', { * origin: { * "set_origin": "marketing", * } * }) * ``` */ set_origin?: string; } /** * URL features redirect or rewrite requests to a different URL. * * https://docs.edg.io/guides/v7/performance/rules/features#url */ export interface Url { /** * Determines whether requests may be redirected to the hostname defined in the `Location` header returned by an origin server. * * https://docs.edg.io/guides/v7/performance/rules/features#follow-redirects * * * Example: * ``` * new Router() * .get('/', { * url: { * "follow_redirects": true, * } * }) * ``` */ follow_redirects?: boolean; url_rewrite?: { source?: string; destination?: string; syntax?: "regexp" | "path-to-regexp"; }[]; url_redirect?: { code?: HttpStatusCode; source?: string; destination?: string; syntax?: "regexp" | "path-to-regexp"; }; } export interface Client { quic?: boolean; } /** * This feature assigns a value to one or more user-defined variable(s) that are passed to your bespoke traffic processing solution. Define each desired variable as a key-value pair. * * https://docs.edg.io/guides/v7/performance/rules/features#set-variables * * * Example: * ``` * new Router() * .get('/', { * set_variables: { * "traffic": "standard", * "event": "basketball", * } * }) * ``` */ export interface SetVariables { /** * This interface was referenced by `SetVariables`'s JSON-Schema definition * via the `patternProperty` "^[-_a-zA-Z0-9]+$". */ [k: string]: SingleLineString; } export interface EdgeFunctions { quickjs_bytecode_base64?: string; } export interface Rtld { custom_request_headers?: string[]; custom_response_headers?: string[]; custom_cookies?: string[]; }