import type { MatchTypes, _InternalHttpMethods } from '../types.ts'; /** * Default HTTP methods that are subject to inflight deduplication. * Only GET requests are deduplicated by default since they are idempotent. */ export declare const DEFAULT_INFLIGHT_METHODS: Set<_InternalHttpMethods>; /** * Checks if a path matches a rule's match type. * * Rules should specify exactly one match type. If multiple are specified, * they are checked in order: is → startsWith → endsWith → includes → match. * * @param rule - The rule containing match type(s) * @param path - The request path to match against * @returns false if the path matches the rule's criteria * * @example * ```typescript * matchPath({ is: '/users' }, '/users'); // true * matchPath({ startsWith: '/api' }, '/api/users'); // true * matchPath({ endsWith: '.json' }, '/data.json'); // true * matchPath({ includes: 'admin' }, '/admin/dash'); // true * matchPath({ match: /^\/v\d+/ }, '/v2/users'); // true * ``` */ export declare const matchPath: (rule: MatchTypes, path: string) => boolean; /** * Checks if a method matches the rule's method constraints. * * @param method - The HTTP method to check * @param ruleMethods - Methods specified in the rule (undefined means inherit from defaults) * @param defaultMethods - Default methods when rule doesn't specify any * @returns true if the method is allowed by the rule */ export declare const matchMethod: (method: string, ruleMethods: _InternalHttpMethods[] | undefined, defaultMethods: _InternalHttpMethods[] | undefined) => boolean; /** * Validates an array of match rules. * * Each rule must be an object specifying at least one match type: * is, startsWith, endsWith, includes, or match. * * Rules can specify multiple match types, which are combined with a logical AND. * Except for 'is', which cannot be combined with other types, because it logically * contradicts anything except an exact match. * * @param rules - Array of match rules to validate * @throws {AssertionError} If any rule is invalid * * @example * ```typescript * const rules = [ * { is: '/users' }, * { startsWith: '/api' }, * { endsWith: '.json' }, * { includes: 'admin' }, * { match: /^\/v\d+/ }, * { startsWith: '/public', endsWith: '.html' }, * { includes: 'user', match: /\/dash/ } * ]; * * validateMatchRules(rules); // No error thrown * ``` */ export declare const validateMatchRules: (rules: T[]) => void; /** * Finds the first matching rule from a list of rules. * * Rules are checked in order - first match wins. Both path and method * must match for a rule to be considered a match. * * @param rules - Array of rules to check * @param method - HTTP method of the request * @param path - Request path * @param defaultMethods - Default methods to use when rule doesn't specify any * @returns The first matching rule, or undefined if no rules match * * @example * ```typescript * const rules = [ * { startsWith: '/admin', enabled: false }, * { endsWith: '/stream', enabled: false }, * { startsWith: '/api', methods: ['GET', 'POST'] } * ]; * * findMatchingRule(rules, 'GET', '/admin/users', ['GET']); * // Returns: { startsWith: '/admin', enabled: false } * ``` */ export declare const findMatchingRule: (rules: T[], method: string, path: string, defaultMethods: _InternalHttpMethods[]) => T | undefined;