@omnia/fx-models
Version:
Provide Omnia Fx Models Stuffs.
107 lines (106 loc) • 3.75 kB
TypeScript
import { Guid } from '.';
import { OmniaNamedModel } from './NamedProperty';
import { RedirectRuleType } from './Enums';
import { EnterprisePropertiesSettings } from '../sp';
export interface TargetingFilterData {
enterprisePropertiesSettings: {
[key: string]: EnterprisePropertiesSettings;
};
}
export interface RouteTargetingData {
route: string;
targetingData: TargetingFilterData;
}
export interface RelativePathRedirectRule extends RedirectRule {
relativePath: string;
}
export interface TargetingRedirectRule extends RedirectRule {
targetingDataByRoute: {
[key: string]: TargetingFilterData;
};
routes: RouteTargetingData[];
defaultRoute: string;
}
export interface RedirectRule {
omniaServiceId: Guid;
uniqueId: Guid;
redirectRuleType: RedirectRuleType;
}
export interface AppRoute {
path: string;
omniaServiceId: Guid;
manifestId: Guid;
redirectRules: RedirectRule[];
}
export interface AppRouteWithProperties extends AppRoute {
properties: Array<AppRoutePropertyBagModel>;
}
export declare abstract class AppRoutePropertyBagModel extends OmniaNamedModel {
}
export interface ITokenBasedUrlPath {
/**
* The current route path
*/
readonly value: string;
/**
* Combines relative url parts into one string and make sure it is formated correctly
* @param parts
*/
combine(...parts: string[]): string;
/**
* Lets you get back mapped values towards the current route path by providing a routeTemplate to match with
* by specifying tokens in the template e.g. if the current path is '/add/customer5' a routeTemplate '/{action}/{id}'
* will return object containing { action: "add", id: "customer5" } its also possible to register a filter that only
* returns the matching property if the value matches e.g routeTemplate '/{action=add}/{id}' will only return property
* action if the route contains '/add' on that path
*
* @param routeTemplate the route template to use to match with current route
*/
mapRoute<TResult>(routeTemplate: string): TResult;
}
export interface IUrlPath {
/**
* The current route path
*/
value: string;
/**
* Combines relative url parts into one string and make sure it is formated correctly
* @param parts
*/
combine(...parts: string[]): string;
/**
* Same as combine but appends the current relative app route path to the beginning
* @param parts
*/
combineWithAppRoute(...parts: string[]): string;
/**
* Lets you get back mapped values towards the current route path by providing a routeTemplate to match with
* by specifying tokens in the template e.g. if the current path is '/add/customer5' a routeTemplate '/{action}/{id}'
* will return object containing { action: "add", id: "customer5" } its also possible to register a filter that only
* returns the matching property if the value matches e.g routeTemplate '/{action=add}/{id}' will only return property
* action if the route contains '/add' on that path
*
* @param routeTemplate the route template to use to match with current route
*/
mapRoute<TResult>(routeTemplate: string): TResult;
}
export interface IUrlQuerystring {
/**
* The current querystring value
*/
readonly value: string;
/**
* Returns true if querystring contains debug=true
*/
readonly isDebug: boolean;
/**
* Gets querystring parameter by name
*/
getParam(name: string): string;
}
export interface IUrlHash {
/**
* The current hash value
*/
readonly value: string;
}