{"version":3,"sources":["../../../../src/lib/A-Request/A-Request.types.ts"],"names":["A_Request_Event"],"mappings":";;AA2EO,IAAK,eAAA,qBAAAA,gBAAAA,KAAL;AACH,EAAAA,iBAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,iBAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,iBAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,iBAAA,KAAA,CAAA,GAAM,KAAA;AACN,EAAAA,iBAAA,OAAA,CAAA,GAAQ,OAAA;AALA,EAAA,OAAAA,gBAAAA;AAAA,CAAA,EAAA,eAAA,IAAA,EAAA","file":"A-Request.types.mjs","sourcesContent":["import type { IncomingMessage } from \"http\";\nimport { A_Request } from \"./A-Request.entity\";\nimport { A_TYPES__Entity_Serialized } from \"@adaas/a-concept\";\nimport { A_HttpServerRequestMethod } from \"@adaas/a-server/server/A-HttpServer.types\";\nimport { A_RequestFeatures } from \"./A-Request.constants\";\n\n\n// =============================================\n// Core Request Types\n// =============================================\n/**\n * Constructor parameters for A_Request entity\n */\nexport type A_Request_Init = {\n    /**\n     * Unique identifier for the request (should correspond to Response id)\n     */\n    id: string;\n\n    /**\n     * ASEID Shard for the request.  \n     * it's some sort of request fingerprint\n     */\n    shard: string\n    /**\n     * Node.js IncomingMessage object\n     */\n    request: IncomingMessage;\n    /**\n     * Request scope for context resolution\n     */\n    scope: string;\n};\n\n/**\n * Serialized representation of A_Request entity\n */\nexport type A_Request_Serialized<\n    _ReqBodyType = any,\n    _ParamsType extends Record<string, string> = any,\n    _QueryType = any,\n> = A_TYPES__Entity_Serialized & {\n    method: A_HttpServerRequestMethod;\n    url: string;\n    headers: Record<string, string | string[] | undefined>;\n    params?: _ParamsType;\n    query?: _QueryType;\n    cookies: Record<string, string>;\n    body?: _ReqBodyType;\n    userAgent?: string;\n    isValid: boolean;\n    bodyType?: A_Request_BodyType;\n    filesCount?: number;\n    fileFieldNames?: string[];\n    totalFileSize?: number;\n}\n\n/**\n * Supported HTTP request methods\n */\nexport type A_Request_Methods =\n    | 'GET'\n    | 'POST'\n    | 'PUT'\n    | 'DELETE'\n    | 'PATCH'\n    | 'OPTIONS'\n    | 'HEAD'\n    | 'CONNECT'\n    | 'TRACE'\n    | 'DEFAULT'; // Default is used for routes that do not have a method specified\n\n/**\n * Request lifecycle events\n */\nexport enum A_Request_Event {\n    Error = 'error',\n    Finish = 'finish',\n    Data = 'data',\n    End = 'end',\n    Close = 'close',\n}\n\n\nexport type A_RequestFeatureNames = typeof A_RequestFeatures[keyof typeof A_RequestFeatures];\n\n/**\n * Request event callback function type\n */\nexport type A_Request_EventCallback = (request: A_Request) => void;\n\n\n// =============================================\n// Body Parsing Types\n// =============================================\n\n/**\n * Supported body content types for parsing\n */\nexport type A_Request_BodyType = 'json' | 'form' | 'multipart' | 'raw' | 'text';\n\n/**\n * Result of body parsing operation\n */\nexport type A_Request_ParsedBody = {\n    /**\n     * Type of parsed content\n     */\n    type: A_Request_BodyType;\n    /**\n     * Parsed data\n     */\n    data: any;\n    /**\n     * Size of the body in bytes\n     */\n    size: number;\n    /**\n     * Character encoding used\n     */\n    encoding?: string;\n    /**\n     * Multipart boundary (for multipart content)\n     */\n    boundary?: string;\n};\n\n\n\n// =============================================\n// Session Management Types\n// =============================================\n\n/**\n * Session data structure for user session management\n */\nexport type A_Request_SessionData = {\n    /**\n     * Unique session identifier\n     */\n    id?: string;\n    /**\n     * Associated user ID\n     */\n    userId?: string;\n    /**\n     * Session creation timestamp\n     */\n    createdAt?: Date;\n    /**\n     * Last access timestamp\n     */\n    lastAccess?: Date;\n    /**\n     * Session data storage\n     */\n    data?: Record<string, any>;\n    /**\n     * Whether session is expired\n     */\n    isExpired?: boolean;\n    /**\n     * Maximum session age in milliseconds\n     */\n    maxAge?: number;\n};\n\n\n// =============================================\n// File Upload Types\n// =============================================\n\n/**\n * File upload information for multipart requests\n */\nexport type A_Request_FileUpload = {\n    /**\n     * Form field name\n     */\n    fieldName: string;\n    /**\n     * Original filename\n     */\n    filename: string;\n    /**\n     * File encoding\n     */\n    encoding: string;\n    /**\n     * MIME type\n     */\n    mimetype: string;\n    /**\n     * File size in bytes\n     */\n    size: number;\n    /**\n     * File buffer data\n     */\n    buffer: Buffer;\n    /**\n     * Path if saved to disk\n     */\n    path?: string;\n    /**\n     * File hash for integrity verification\n     */\n    hash?: string;\n};\n\n\n// =============================================\n// Validation Types\n// =============================================\n\n/**\n * Request validation result with detailed feedback\n */\nexport type A_Request_ValidationResult = {\n    /**\n     * Whether validation passed\n     */\n    isValid: boolean;\n    /**\n     * Validation error messages\n     */\n    errors: string[];\n    /**\n     * Warning messages\n     */\n    warnings: string[];\n    /**\n     * Sanitized data after validation\n     */\n    sanitized?: any;\n};\n\n\n// =============================================\n// Configuration Types\n// =============================================\n\n/**\n * Request processing configuration options\n */\nexport type A_Request_Options = {\n    /**\n     * Maximum request body size in bytes (default: 10MB)\n     */\n    maxBodySize?: number;\n    /**\n     * Request timeout in milliseconds (default: 30s)\n     */\n    timeout?: number;\n    /**\n     * Default character encoding (default: 'utf8')\n     */\n    encoding?: string;\n    /**\n     * Automatically parse cookies (default: true)\n     */\n    parseCookies?: boolean;\n    /**\n     * Automatically parse query parameters (default: true)\n     */\n    parseQuery?: boolean;\n    /**\n     * Automatically parse request body (default: true)\n     */\n    parseBody?: boolean;\n    /**\n     * Enable file upload handling (default: false)\n     */\n    enableFileUploads?: boolean;\n    /**\n     * Enable strict validation mode (default: false)\n     */\n    strictValidation?: boolean;\n};\n\n/**\n * Request Event Listener Function\n */\nexport type A_Request_Listener = (req?: A_Request) => void;"]}