import { NavigationOptions } from "aurelia-history"; import { RouteConfig, RouteConfigSpecifier, RouterConfiguration } from "aurelia-router"; type OnlyIfFunction = ( instance?: unknown ) => boolean; type OnlyIfFunctions = { "online": OnlyIfFunction; "offline": OnlyIfFunction; "under development": OnlyIfFunction; [ key: string ]: OnlyIfFunction; }; type OnlyIfStringParameter = keyof OnlyIfFunctions; export interface OnlyIfDecorator { /** * @Decorator * Executes the method if the instance owns the given properties */ instanceHasProperties: ( ...instanceProperties: string[] ) => any; /** * @Decorator * Executes the method if the condition is met */ is: ( condition: OnlyIfFunction | OnlyIfStringParameter ) => any; } export interface ViewDecorator { /** * @Decorator * Redirects to a given route if the condition is met */ redirect: ( routeConfig: RedirectConfig, callback: ( instance?: unknown ) => boolean ) => ( constructor: any ) => any; } export interface AppDecorator { /** * @Decorator * Configures the main router */ router: ( routerConfig: RouterDecoratorConfig ) => any; } /** * Used to configure a method */ export declare const onlyIf: OnlyIfDecorator; /** * Used to configure a view */ export declare const view: ViewDecorator; /** * Used to configure the App */ export declare const app: AppDecorator; export interface RouterDecoratorConfig { title: string; routesConfig: string | RouteConfig[]; unknownRoutes?: RouteConfigSpecifier; callback?: ( config: RouterConfiguration ) => void; } export interface OfflineFunction extends Function { offlineCallbackName: string; } export interface RedirectConfig { route: string; params?: any; options?: NavigationOptions; }