import type { RemoteCaseActionObject } from '../globals'; import type { BuildRestAPIPayload, RoutingInfo, RoutePayload, RouteObjectPayload } 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: Record) => 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) => any; 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: RoutePayload, queryParameters?: Record): 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 * @param locale - Optional locale to append as the `lang` query param when one is not already present. When omitted, `lang` may still be present if `resolveSemanticURL()` preserves or copies global query parameters from the current browser URL. * @returns resolved semantic url or empty string */ getResolvedSemanticURL(routeKey: string, payload: RoutePayload, params?: Record, locale?: string): string; buildDocumentTitle(name?: string, caseId?: string, applicationName?: string): string; /** * Updates the semantic Url and document title. * @function updateSemanticURLAndDocumentTitle * @param data - data which contains key, className, actionName and isRemoteCase. * @param locale - Optional locale to propagate as the `lang` query param. */ updateSemanticURLAndDocumentTitle(data: RemoteCaseActionObject, locale?: string): 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: RoutePayload, queryParameters?: Record): 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?: Record, ignoreCase?: boolean): string; _getQueryParamsObject(queryParameters: string): Record; /** * Get restApi for given routeKey (ex: showView) * @function getRestEndPoint * @param routeKey - routeKey * @param payload - payload * @returns restApi and reqType. Returns null 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: BuildRestAPIPayload): Record; /** * 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; /** * Resolves query parameters URL from matched route template * @param semanticURLQueryParams - query params from semantic URL * @param matchedRoute - matched route pattern * @param urlPath - resolved URL path tokens * @param semanticURLQueryParamsObj - parsed query params object * @returns resolved query params URL or undefined */ _resolveMatchedRouteQueryParams: (semanticURLQueryParams: string | undefined, matchedRoute: string, urlPath: string[], semanticURLQueryParamsObj: Record) => string | undefined; /** * 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: { routeKey: string; requestType: string; routeEndpoint: string; payload: RoutePayload; }, 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: { routeKey: string; requestType: string; routeEndpoint: string; payload: RoutePayload; }, tokensMap: Record, matchedRoute: string) => { payload: { [x: string]: unknown; caseClassName?: string; caseID?: string; RemoteSystemID?: string; page?: string; pageClass?: string; dataViewKeys?: string; dataContextParameters?: string; params?: import("./types").NestedValue; reqType?: string; routeEndpoint?: string; } | { length: number; toString(): string; toLocaleString(): string; toLocaleString(locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; pop(): Record | undefined; push(...items: Record[]): number; concat(...items: ConcatArray>[]): Record[]; concat(...items: (Record | ConcatArray>)[]): Record[]; join(separator?: string): string; reverse(): Record[]; shift(): Record | undefined; slice(start?: number, end?: number): Record[]; sort(compareFn?: ((a: Record, b: Record) => number) | undefined): Record[]; splice(start: number, deleteCount?: number): Record[]; splice(start: number, deleteCount: number, ...items: Record[]): Record[]; unshift(...items: Record[]): number; indexOf(searchElement: Record, fromIndex?: number): number; lastIndexOf(searchElement: Record, fromIndex?: number): number; every>(predicate: (value: Record, index: number, array: Record[]) => value is S, thisArg?: any): this is S[]; every(predicate: (value: Record, index: number, array: Record[]) => unknown, thisArg?: any): boolean; some(predicate: (value: Record, index: number, array: Record[]) => unknown, thisArg?: any): boolean; forEach(callbackfn: (value: Record, index: number, array: Record[]) => void, thisArg?: any): void; map(callbackfn: (value: Record, index: number, array: Record[]) => U, thisArg?: any): U[]; filter>(predicate: (value: Record, index: number, array: Record[]) => value is S, thisArg?: any): S[]; filter(predicate: (value: Record, index: number, array: Record[]) => unknown, thisArg?: any): Record[]; reduce(callbackfn: (previousValue: Record, currentValue: Record, currentIndex: number, array: Record[]) => Record): Record; reduce(callbackfn: (previousValue: Record, currentValue: Record, currentIndex: number, array: Record[]) => Record, initialValue: Record): Record; reduce(callbackfn: (previousValue: U, currentValue: Record, currentIndex: number, array: Record[]) => U, initialValue: U): U; reduceRight(callbackfn: (previousValue: Record, currentValue: Record, currentIndex: number, array: Record[]) => Record): Record; reduceRight(callbackfn: (previousValue: Record, currentValue: Record, currentIndex: number, array: Record[]) => Record, initialValue: Record): Record; reduceRight(callbackfn: (previousValue: U, currentValue: Record, currentIndex: number, array: Record[]) => U, initialValue: U): U; find>(predicate: (value: Record, index: number, obj: Record[]) => value is S, thisArg?: any): S | undefined; find(predicate: (value: Record, index: number, obj: Record[]) => unknown, thisArg?: any): Record | undefined; findIndex(predicate: (value: Record, index: number, obj: Record[]) => unknown, thisArg?: any): number; fill(value: Record, start?: number, end?: number): Record[]; copyWithin(target: number, start: number, end?: number): Record[]; entries(): ArrayIterator<[number, Record]>; keys(): ArrayIterator; values(): ArrayIterator>; includes(searchElement: Record, fromIndex?: number): boolean; flatMap(callback: (this: This, value: Record, index: number, array: Record[]) => U | readonly U[], thisArg?: This | undefined): U[]; flat(this: A, depth?: D | undefined): FlatArray[]; at(index: number): Record | undefined; findLast>(predicate: (value: Record, index: number, array: Record[]) => value is S, thisArg?: any): S | undefined; findLast(predicate: (value: Record, index: number, array: Record[]) => unknown, thisArg?: any): Record | undefined; findLastIndex(predicate: (value: Record, index: number, array: Record[]) => unknown, thisArg?: any): number; toReversed(): Record[]; toSorted(compareFn?: ((a: Record, b: Record) => number) | undefined): Record[]; toSpliced(start: number, deleteCount: number, ...items: Record[]): Record[]; toSpliced(start: number, deleteCount?: number): Record[]; with(index: number, value: Record): Record[]; [Symbol.iterator](): ArrayIterator>; [Symbol.unscopables]: { [x: number]: boolean | undefined; length?: boolean | undefined; toString?: boolean | undefined; toLocaleString?: boolean | undefined; pop?: boolean | undefined; push?: boolean | undefined; concat?: boolean | undefined; join?: boolean | undefined; reverse?: boolean | undefined; shift?: boolean | undefined; slice?: boolean | undefined; sort?: boolean | undefined; splice?: boolean | undefined; unshift?: boolean | undefined; indexOf?: boolean | undefined; lastIndexOf?: boolean | undefined; every?: boolean | undefined; some?: boolean | undefined; forEach?: boolean | undefined; map?: boolean | undefined; filter?: boolean | undefined; reduce?: boolean | undefined; reduceRight?: boolean | undefined; find?: boolean | undefined; findIndex?: boolean | undefined; fill?: boolean | undefined; copyWithin?: boolean | undefined; entries?: boolean | undefined; keys?: boolean | undefined; values?: boolean | undefined; includes?: boolean | undefined; flatMap?: boolean | undefined; flat?: boolean | undefined; at?: boolean | undefined; findLast?: boolean | undefined; findLastIndex?: boolean | undefined; toReversed?: boolean | undefined; toSorted?: boolean | undefined; toSpliced?: boolean | undefined; with?: boolean | undefined; [Symbol.iterator]?: boolean | undefined; readonly [Symbol.unscopables]?: boolean | undefined; }; caseClassName?: string; caseID?: string; RemoteSystemID?: string; page?: string; pageClass?: string; dataViewKeys?: string; dataContextParameters?: string; params?: import("./types").NestedValue; reqType?: string; routeEndpoint?: string; }; routeKey: string; requestType: string; routeEndpoint: string; }; _resolvePayloadRecursive(payload: RoutePayload | RoutePayload[], tokensMap: Record): Record | Record[]; /** * 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) => string | Record | import("./types").StaticRoute | 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: string, additionalInfo?: unknown) => void; } declare const appRouteParser: RouteParser; export default appRouteParser;