/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. */ /** * Derived from React Router, this type helper is used to extract the parameters from a path pattern. * * @internal * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URLPattern | MDN: URLPattern} */ export type ParamPattern = Path extends "*" | "/*" ? "*" : Path extends `${infer Rest}/*` ? "*" | _$PathParam : _$PathParam; /** * Type helper to extract the parameters from a path pattern. * * @internal */ type _$PathParam = Path extends `${infer L}${"/" | "."}${infer R}` ? _$PathParam | _$PathParam : Path extends `:${infer Param}` ? Param extends `${infer Optional}?` ? Optional : Param extends `${infer ParamName}(${infer _ParamPattern})` ? ParamName : Param : never; export type URLPatternPathnameInit = Pick, "pathname">; /** * Either a URLPattern or a pathname pattern string. */ export type URLRouteInit = I extends string ? { pathname: I; } : I; /** * Type helper to extract the parameters from a URL Pattern pathname. */ export type ExtractURLPatternPathnameParams = I extends string ? ParamPattern : I extends URLPatternPathnameInit ? ParamPattern : never; /** * Type helper to extract a URL Pattern pathname. */ export type ExtractURLPatternPathname = I extends string ? I : I extends URLPatternPathnameInit ? I["pathname"] : never; /** * A record of path parameter names to their raw values. */ export type URLPatternPathParameters = { [key in ExtractURLPatternPathnameParams]: V; }; /** * A URL pattern with path parameters. */ export declare class URLRoutePattern extends URLPattern { toString(): string; constructor(init: I); static from(init: I): URLRoutePattern; /** * Given a URL, attempts to match the path parameters. */ matchParams(input: URLPatternInit | string, baseURL?: string): null | URLPatternPathParameters; /** * Given a set of parameters, returns an Axios configuration object. */ toAxiosConfig(params?: Partial>): { url: string; params: Partial>; }; /** * Compiles the URL route with the given parameters. */ compile(params: URLPatternPathParameters): string; toURL(params: URLPatternPathParameters, baseURL?: string): URL; toJSON(): URLPatternInit; } export {}; //# sourceMappingURL=index.d.ts.map