import { Cookie } from './Cookie.js'; import { CookieOptions } from '../declarations.js'; /** * Class representing a collection of Cookies. */ export declare class CookieCollection { private secret?; private options; private readonly cookies; /** * Create a CookieCollection. * * @param cookie - String cookie from header. * @param options - Cookies options. * @param secret - Secret value to sign and unsign cookies. */ static create(cookie?: string, options?: CookieOptions, secret?: string): CookieCollection; /** * Create a CookieCollection. * * @param cookie - String cookie from header. * @param options - Cookies options. * @param secret - Secret value to sign and unsign cookies. */ protected constructor(cookie?: string, options?: CookieOptions, secret?: string); /** * Add a cookie to the collection. * * @param name - Cookie name. * @param value - Cookie value. * @param options - Cookie options. */ add(name: string, value: unknown, options?: CookieOptions): this; /** * Update a cookie in the collection. * * @param name - Cookie name. * @param value - New cookie value. * @param options - Cookie options. */ update(name: string, value: unknown, options?: CookieOptions): this; /** * Get a cookie from the collection. * * @param name - Cookie name. * @returns Cookie value. */ get(name: string): Cookie | undefined; /** * Get a cookie from the collection. * * @param name - Cookie name. * @param fallback - Fallback value if the cookie does not exist. * @returns Cookie value. */ get(name: string, fallback: Cookie): Cookie; /** * Get a cookie value from the collection. * * @param name - Cookie name. * @returns Cookie value. */ getValue(name: string): ValueType | undefined; /** * Get a cookie value from the collection. * * @param name - Cookie name. * @param fallback - Fallback value if the cookie does not exist. * @returns Cookie value. */ getValue(name: string, fallback: ValueType): ValueType; /** * Check if the collection has a cookie. * * @param name - Cookie name. */ has(name: string): boolean; /** * Remove a cookie from the collection. * * @param name - Cookie name to remove. * @param options - Cookie options. * @param force - If true, remove only from collection without setting expiry. */ remove(name: string, options?: CookieOptions, force?: boolean): this; /** * Get all cookies in the collection. * * @param serialize - If true, serialize the cookies. */ all(serialize?: S): S extends true ? string[] : Record; /** * Check if the collection is empty. */ isEmpty(): boolean; /** * Clear all cookies from the collection. * * @param force - If true, remove only from collection without setting expiry. */ clear(force?: boolean): this; /** * Set secure flag for all cookies in the collection. * * @param value - Whether the cookies are secure. */ secure(value?: boolean): this; /** * Set secret for signing and unsigning cookies. * * @param value - Secret value. */ setSecret(value: string): this; /** * Set options for all cookies in the collection. * * @param options - Cookie options. */ setOptions(options: CookieOptions): this; /** * Parse the cookies from a string. * * @param cookie - String cookie from header. */ private parse; /** * Deserialize the cookie value. * * @param name - Cookie name. * @param rawValue - Cookie raw value. * @param secret - Optional secret for unsigning. * @returns A new cookie instance. */ private deserializeCookieValue; }