1 | import { IOptions } from 'search-params';
|
2 | import { URLParamsEncodingType } from './encoding';
|
3 | import { Token } from './tokeniser';
|
4 | export { URLParamsEncodingType };
|
5 | export interface PathOptions {
|
6 | |
7 |
|
8 |
|
9 |
|
10 | queryParams?: IOptions;
|
11 | |
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | urlParamsEncoding?: URLParamsEncodingType;
|
25 | }
|
26 | export interface InternalPathOptions {
|
27 | queryParams?: IOptions;
|
28 | urlParamsEncoding: URLParamsEncodingType;
|
29 | }
|
30 | export interface PathPartialTestOptions extends PathOptions {
|
31 | caseSensitive?: boolean;
|
32 | delimited?: boolean;
|
33 | }
|
34 | export interface PathTestOptions extends PathOptions {
|
35 | caseSensitive?: boolean;
|
36 | strictTrailingSlash?: boolean;
|
37 | }
|
38 | export interface PathBuildOptions extends PathOptions {
|
39 | ignoreConstraints?: boolean;
|
40 | ignoreSearch?: boolean;
|
41 | }
|
42 | export declare type TestMatch<T extends Record<string, any> = Record<string, any>> = T | null;
|
43 | export declare class Path<T extends Record<string, any> = Record<string, any>> {
|
44 | static createPath<T extends Record<string, any> = Record<string, any>>(path: string, options?: PathOptions): Path<T>;
|
45 | path: string;
|
46 | tokens: Token[];
|
47 | hasUrlParams: boolean;
|
48 | hasSpatParam: boolean;
|
49 | hasMatrixParams: boolean;
|
50 | hasQueryParams: boolean;
|
51 | options: InternalPathOptions;
|
52 | spatParams: string[];
|
53 | urlParams: string[];
|
54 | queryParams: string[];
|
55 | params: string[];
|
56 | source: string;
|
57 | constructor(path: string, options?: PathOptions);
|
58 | isQueryParam(name: string): boolean;
|
59 | isSpatParam(name: string): boolean;
|
60 | test(path: string, opts?: PathTestOptions): TestMatch<T>;
|
61 | partialTest(path: string, opts?: PathPartialTestOptions): TestMatch<T>;
|
62 | build(params?: T, opts?: PathBuildOptions): string;
|
63 | private getParams;
|
64 | private urlTest;
|
65 | }
|
66 | export default Path;
|