import type { RemoteCaseActionObject } from '../globals'; import type { BuildRestAPIPayload, RoutingInfo, RoutePayload } from './types'; /** * @file Implements parsing logic for Application Routing Table * @author WebWiz Team */ /** * RouteParser * This class consist of methods required for parsing App Routing Table */ declare class RouteParser { private routingInfo?; private appRoutes; private appRoutesMeta?; private appName?; private appAlias?; private orgName?; private reqContextName; private reqServletPath?; private defaultViewUrlPath; private staticRoutePage?; private defaultClassName; private readonly staticRoutesList?; private readonly dynamicRoutesList?; private appDelimeter?; private reqServletNameReal?; private bDefaultPortal?; private portalName; private ignoreFromEndPoint?; /** * Creates an instance of RouteParser. * @memberof RouteParser */ constructor(); /** * This method initializes instance variables of Class * @function init * @param routingInfo - Application Routing Table Information * @param defaultViewUrlPath - url path of default view */ init: (routingInfo: RoutingInfo, defaultViewUrlPath: string) => void; /** * This method merges new routes to the existing routing table * @param routingInfo - new route entries with route and routeMeta */ addRoutes: (routingInfo: RoutingInfo) => void; setDefaultRoute: (defaultRoute: string) => void; setStaticRoutePage: (routePage: string) => void; getStaticRoutePage: () => string; setDefaultClassName: (defaultClassName: string) => void; /** * this method separates static routes and dynamic routes of App Routing Table, * in two different arrays * @function _createStaticDynamicRoutesList * @param routesObj - routingInfo.routes */ _createStaticDynamicRoutesList: (routesObj: { [key: string]: any; }) => void; /** * this method returns key name after removing curly braces * @function _getDynamicKeyName * @param dynamicKey - dynamic key * @returns key name after removing curly braces */ _getDynamicKeyName: (dynamicKey: string) => string; /** * this method returns true if constellation portal is default portal * @function isDefaultPortal * @returns returns isDefaultPortal */ isDefaultPortal: () => boolean; /** * this method returns constellation portal Name * @function getPortalName * returns portalName */ getPortalName: () => string; /** * this method returns application Path * @function getApplicationPath * @returns returns applicationPath */ getApplicationPath: () => string; /** * this method returns application Name * @function getReqServletNameReal * @returns returns reqServletNameReal */ getReqServletNameReal: () => string; /** * this method returns application Name * @function getAppDelimeter * @returns returns appDelimeter */ getAppDelimeter: () => string; /** * this method returns application Name * @function getApplicationName * @returns returns applicationName */ getApplicationName: () => string; getApplicationAlias: () => string; getServletPath: () => string; /** * this method returns application Name * @function getApplicationName * @returns returns applicationName */ getOrganizationName: () => string; /** * this method returns reqContextName(prweb) * @function getReqContextName * @returns returns reqContextName */ getReqContextName: () => string; getRoutingInfo: () => RoutingInfo | undefined; /** * this method returns processed semantic url * @function processUrl * @param semanticURL - semantic url * @param convertCase - convert case of semantic url? * @returns - processed semantic url */ processUrl: (semanticURL: string, convertCase: boolean) => string; stripIgnoredParams(semanticURLParam: string): string; getRouteDetails(matchedRoute: string, isRuntimeInfoAvailable: boolean): { routeKey: string; payload: RoutePayload; }; transformRemoteCasePayload(payload: RoutePayload): RoutePayload; /** * this method returns endpoint and payload corresponding to semantic url * @function getEndPointInfo * @param semanticURLParam - semantic url * @returns - resolved route corresponding to semantic url */ getEndPointInfo: (semanticURLParam: string) => any; /** * Get semantic url for given routeKey (ex: showView) * @function getSemanticURL * @param routeKey - routeKey * @param payload - payload * @param queryParameters - queryParameters * @returns semantic url or empty string */ getSemanticURL(routeKey: string, payload: any, queryParameters?: any): string; /** * Get resolved semantic url for given routeKey (example: openWorkByHandle) * @function getResolvedSemanticURL * @param routeKey - routeKey - This will be actionType : openWorkByHandle * @param payload - payload to match * @param params - dynamic param values * @returns resolved semantic url or empty string */ getResolvedSemanticURL(routeKey: string, payload: any, params?: { [key: string]: string; }): string; /** * Updates the semantic Url and document title. * @function updateSemanticURLAndDocumentTitle * @param data - data which contains key, className, actionName and isRemoteCase. */ updateSemanticURLAndDocumentTitle(data: RemoteCaseActionObject): void; /** * Build semantic url for given routeKey (ex: showView) * @function buildSemanticURL * @param routeKey - routeKey * @param payload - payload * @param queryParameters - queryParameters object * @returns semantic url or empty string */ buildSemanticURL(routeKey: string, payload: any, queryParameters?: any): string; /** * Resolves and return the dynamic parameters of queryParameter string * @param url - url * @param queryParameters - queryParameters object * @param ignoreCase - Flag to resolve the query parameters ignoring the case * @returns - Returns the url with resolved dynamic query parameters */ _getQueryParamsResolvedURL(url: string, queryParameters?: any, ignoreCase?: boolean): string; _getQueryParamsObject(queryParameters: any): { [key: string]: any; }; /** * Get restApi for given routeKey (ex: showView) * @function getRestEndPoint * @param routeKey - routeKey * @param payload - payload * @returns restApi and reqType. Throws an error for invalid routeKey */ getRestEndPoint(routeKey: string, payload?: BuildRestAPIPayload): { restApi: string; reqType: string; body: {}; } | { restApi: string; reqType: string; body?: undefined; } | null; /** * Build restApi for given routeKey (ex: showView) * @function _buildRestApi * @param routeKey - routeKey * @param payload - payload * @returns restApi and reqType. Throws an error for invalid routeKey */ _buildRestApi(routeKey: string, payload?: BuildRestAPIPayload): { restApi: string; reqType: string; body: {}; } | { restApi: string; reqType: string; body?: undefined; }; _isSpecialInstruction(key: string): boolean | ""; _processInstruction(instruction: string, keys: [string], payload: any): { [key: string]: string; }; /** * Detects if a restApi exists with the given routeKey * @function doesRestApiExist * @param routeKey - routeKey * @returns Flag indicating whether the Api exists */ doesRestApiExist(routeKey: string): boolean; /** * Resolve Dynamic Fragments from Endpoint and Payload * @function _resolveRoute * @param routingInfo - routing table entry * @param semanticURL - semantic url * @param matchedRoute - matched route pattern * @returns Resolved route */ _resolveRoute: (routingInfo: any, semanticURL: string, matchedRoute: string) => any; /** * Process the RouteEndPoint inside JSON and remove dynamic params * @function _resolveRouteEndPoint * @param routingInfo - routing table entry * @param matchedRoute - matched route pattern * @returns Resolved route */ _resolveRouteEndPoint: (routingInfo: any, matchedRoute: string) => any; /** * Process the replacePayload inside JSON and remove dynamic params * @function _resolvePayload * @param routingInfo - routing table entry * @param tokensMap - key-value pair: key(Dynamic Param in Matched Route), value(corresponding semantic url token) * @param matchedRoute - matched route pattern * @returns Resolved routing table entry */ _resolvePayload: (routingInfo: any, tokensMap: any, matchedRoute: string) => any; _resolvePayloadRecursive(payload: any, tokensMap: any): { [key: string]: any; }; /** * this method returns route in App Routing Table corresponding to semantic Url * @function _getMatchedRouteInRoutingTable * @param semanticURL - semantic url * @returns matched route or undefined */ _getMatchedRouteInRoutingTable: (semanticURL: string, className?: string) => string | undefined; /** * this method returns static route if it matches semantic Url,otherwise returns undefined * @function _findMatchedRouteInStaticList * @param semanticURL - semantic url * @returns static route or undefined */ _findMatchedRouteInStaticList: (semanticURL: string, className?: string) => string | undefined; _findMatchingRouteByClass: (normalizedURL: string, normalizedClass?: string) => any | undefined; _findInStaticList: (normalizedURL: string) => string | undefined; /** * this method returns dynamic route corresponding to semantic Url, otherwise returns undefined * @function _findMatchedRouteInDynamicList * @param semanticURL - semantic url * @returns dynamic route or undefined */ _findMatchedRouteInDynamicList: (semanticURL: string) => string | undefined; /** * this method send warning and error messages to console * @function _sendWarningAndErrorMessages * @param message - message * @param additionalInfo - additional information to be logged in console */ _sendWarningAndErrorMessages: (message: any, additionalInfo?: any) => void; } declare const appRouteParser: RouteParser; export default appRouteParser;