export declare namespace Azion { export namespace Storage { export type ContentObjectStorage = ArrayBuffer | ReadableStream | string | Uint8Array; export interface StorageInstance { list(): Promise<{ entries: { key: string; content_length?: number; }[]; }>; put(key: string, value: ContentObjectStorage, options?: { 'content-length'?: string; 'content-type'?: string; }): Promise; delete(key: string): Promise; get(key: string): Promise; } export interface StorageObject { arrayBuffer(): Promise; metadata: Map; contentType: string; contentLength: number; } } export namespace Sql { export interface Connection { query: (sql: string) => Promise; execute: (sql: string) => Promise; } export interface Rows { next: () => Promise; columnCount: () => number; columnName: (index: number) => string; columnType: (index: number) => string; } export interface Row { columnName: (index: number) => string; columnType: (index: number) => string; getValue: (index: number) => any; getString: (index: number) => string; } export interface Database { connection: Connection; open?: (name: string) => Promise; } export {}; } } /** * Base event interface for Azion */ export declare interface AzionFetchEvent extends Event { request: Request & { metadata: AzionRuntimeRequestMetadata; }; waitUntil: (promise: Promise) => void; respondWith: (response: Response | Promise) => void; } /** * Firewall event interface */ export declare interface AzionFirewallEvent extends AzionFetchEvent { deny: () => void; drop: () => void; continue: () => void; } /** * Base context for Azion modules */ export declare interface AzionRuntimeCtx { waitUntil: (promise: Promise) => void; args?: Record; } /** * Specific context for firewall modules */ export declare interface AzionRuntimeFirewallCtx extends AzionRuntimeCtx { deny: () => void; continue: () => void; drop: () => void; } /** * Generic module type that can handle any combination of fetch and firewall events */ export declare interface AzionRuntimeModule { fetch?: (request: AzionRuntimeRequest, env?: null, ctx?: AzionRuntimeCtx) => Promise; firewall?: (request: AzionRuntimeRequest, env?: null, ctx?: AzionRuntimeCtx) => Promise; } /** * Type for Azion request with metadata */ export declare type AzionRuntimeRequest = Request & { metadata: AzionRuntimeRequestMetadata; }; export declare interface AzionRuntimeRequestMetadata { geoip_asn: string; geoip_city: string; geoip_city_continent_code: string; geoip_city_country_code: string; geoip_city_country_name: string; geoip_continent_code: string; geoip_country_code: string; geoip_country_name: string; geoip_region: string; geoip_region_name: string; remote_addr: string; remote_port: string; remote_user: string; server_protocol: string; server_fingerprint: string; server_fingerprint_ja4h: string; ssl_cipher: string; ssl_protocol: string; client_fingerprint: string; client_id: string; configuration_id: string; edge_connector_id: string; function_id: string; http_ssl_ja4: string; request_id: string; solution_id: string; [key: string]: string; } /** * Event listener type for fetch events */ export declare type FetchEventListener = (event: AzionFetchEvent, args?: Record) => void | Promise; /** * Event listener type for firewall events */ export declare type FirewallEventListener = (event: AzionFirewallEvent, args?: Record) => void | Promise; export { }