UNPKG

1.92 kBTypeScriptView Raw
1import { ComponentInstruction } from '../instruction';
2import { Url } from '../url_parser';
3import { RouteHandler } from './route_handlers/route_handler';
4import { GeneratedUrl, RoutePath } from './route_paths/route_path';
5export declare abstract class RouteMatch {
6}
7export declare class PathMatch extends RouteMatch {
8 instruction: ComponentInstruction;
9 remaining: Url;
10 remainingAux: Url[];
11 constructor(instruction: ComponentInstruction, remaining: Url, remainingAux: Url[]);
12}
13export declare class RedirectMatch extends RouteMatch {
14 redirectTo: any[];
15 specificity: any;
16 constructor(redirectTo: any[], specificity: any);
17}
18export interface AbstractRule {
19 hash: string;
20 path: string;
21 recognize(beginningSegment: Url): Promise<RouteMatch>;
22 generate(params: {
23 [key: string]: any;
24 }): ComponentInstruction;
25}
26export declare class RedirectRule implements AbstractRule {
27 private _pathRecognizer;
28 redirectTo: any[];
29 hash: string;
30 constructor(_pathRecognizer: RoutePath, redirectTo: any[]);
31 path: string;
32 /**
33 * Returns `null` or a `ParsedUrl` representing the new path to match
34 */
35 recognize(beginningSegment: Url): Promise<RouteMatch>;
36 generate(params: {
37 [key: string]: any;
38 }): ComponentInstruction;
39}
40export declare class RouteRule implements AbstractRule {
41 private _routePath;
42 handler: RouteHandler;
43 private _routeName;
44 specificity: string;
45 terminal: boolean;
46 hash: string;
47 private _cache;
48 constructor(_routePath: RoutePath, handler: RouteHandler, _routeName: string);
49 path: string;
50 recognize(beginningSegment: Url): Promise<RouteMatch>;
51 generate(params: {
52 [key: string]: any;
53 }): ComponentInstruction;
54 generateComponentPathValues(params: {
55 [key: string]: any;
56 }): GeneratedUrl;
57 private _getInstruction(urlPath, urlParams, params);
58}