@dbs-portal/tool-mock
Version:
API mocking toolkit using MSW for DBS Portal development workflows
66 lines • 1.78 kB
TypeScript
/**
* URL utilities for mock handlers
*/
import type { UrlMatchOptions } from './types';
/**
* Parse URL parameters from a path pattern
*/
export declare function parseUrlParams(url: string, pattern: string): Record<string, string>;
/**
* Parse query parameters from URL
*/
export declare function parseQueryParams(url: string): Record<string, string>;
/**
* Check if URL matches a pattern
*/
export declare function matchesUrl(url: string, options: UrlMatchOptions): boolean;
/**
* Extract path from URL
*/
export declare function extractPath(url: string): string;
/**
* Build URL with parameters
*/
export declare function buildUrl(baseUrl: string, path: string, params?: Record<string, string>, query?: Record<string, string>): string;
/**
* Normalize URL for comparison
*/
export declare function normalizeUrl(url: string): string;
/**
* Check if URL is absolute
*/
export declare function isAbsoluteUrl(url: string): boolean;
/**
* Join URL paths
*/
export declare function joinPaths(...paths: string[]): string;
/**
* Get base URL from full URL
*/
export declare function getBaseUrl(url: string): string;
/**
* Parse URL into components
*/
export declare function parseUrl(url: string): {
protocol?: string;
host?: string;
hostname?: string;
port?: string;
pathname: string;
search: string;
hash: string;
params: Record<string, string>;
};
/**
* Create URL matcher function
*/
export declare function createUrlMatcher(patterns: (string | RegExp)[]): (url: string) => boolean;
/**
* Validate URL format
*/
export declare function isValidUrl(url: string): boolean;
/**
* Convert relative URL to absolute
*/
export declare function toAbsoluteUrl(url: string, baseUrl: string): string;
//# sourceMappingURL=url.d.ts.map