@omnia/fx-models
Version:
Provide Omnia Fx Models Stuffs.
142 lines (141 loc) • 4.89 kB
TypeScript
import { Guid, GuidValue, ApiResponseCodes } from ".";
import { OmniaNamedModel, IOmniaPropertyBag } from "./NamedProperty";
import { RedirectRuleType } from "./Enums";
import { EnterprisePropertiesSettings } from "../sp";
import { AppInstance } from "./apps/App";
import { DisplayBreakpointVersionedAlternateLayoutMapping, VersionedLayout } from "./versionedlayout";
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;
appInstance: AppInstance;
redirectRules: RedirectRule[];
allowAnonymous: boolean;
allowMobileLogin: boolean;
}
export interface AppRouteWithProperties extends AppRoute {
properties: Array<AppRoutePropertyBagModel>;
layouts: VersionedLayout[];
displayBreakpointAlternateLayoutMappings: {
[versionedLayoutId: string]: DisplayBreakpointVersionedAlternateLayoutMapping;
};
status: ApiResponseCodes;
}
export declare abstract class AppRoutePropertyBagModel extends OmniaNamedModel {
}
export interface IAppRoute {
path: string;
appInstance: AppInstance;
redirectRules: RedirectRule[];
allowAnonymous: boolean;
allowMobileLogin: boolean;
manifestId: Guid;
readonly propertyBag: IOmniaPropertyBag<AppRoutePropertyBagModel>;
readonly layouts: VersionedLayout[];
readonly displayBreakpointAlternateLayoutMappings: {
[versionedLayoutId: string]: DisplayBreakpointVersionedAlternateLayoutMapping;
};
status: ApiResponseCodes;
}
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;
}
export interface AppRouteValidationRequest {
alias: string;
routePrefix?: string;
ignoreFromAppId?: GuidValue;
}
export interface AppRouteValidationResult {
isValid: boolean;
isReserved: boolean;
isExist: boolean;
appInstance: AppInstance;
}