}
*
* @example Example for resetStore()
* const store = PCore.resetStore();
*/
resetStore = () => StateManager.resetStore();
/**
* Returns the {@link MessageManager} API's. It exposes below API's
*
* - addMessages
* - getMessages
* - clearMessages
*
*
* @example Example for addMessages api
* const { addMessages } = PCore.getMessageManager();
* addMessages({
* messages: [
* {
* type: 'error',
* message: 'Validation Error'
* }
* ],
* category: 'HTTP'
* context: 'app/primary_2'
* });
* // above example shows how to use addMessages api to add HTTP message
* // for the context app/primary_2
*
* @example Example for clearMessages api
* const { clearMessages } = PCore.getMessageManager();
* clearMessages({
* type: 'error',
* property: '.firstName',
* context: 'app/primary_2'
* });
* // above example shows how to use clearMessages api to clear messages of type error
* // on firstName property
*
* @returns the API object
* @function
*/
getMessageManager = () => {
return MessageManager;
};
/**
* This api provides Coexistence related api.
* @example Example for getCoexistenceManager()
* Example usage - PCore.getCoexistenceManager();
*
* @returns the API object
* @function
* @private
*/
getCoexistenceManager = (): typeof CoexistenceManager => CoexistenceManager;
/**
* Returns the value of prop from Redux Store. This is a syntactical sugar to StateManager.getValue()
*
* @param propReference property reference e.g. .FirstName or pyWorkPage.FirstName
* @param pageReference page reference e.g. .pyWorkPage, D_Accounts.pxResults(1)
* @param context context of the property
* @returns - value of the prop
* @function
*
*/
getStoreValue = (propReference: string, pageReference: string, context: string) => {
return StateManager.getValue(propReference, pageReference, context);
};
/**
* Returns the Container Manager Utils
* This exposes the container manager utility APIs like
*
* - getContainers
* - getContainerData
* - isContainerItemExists
* - getContainerItemName
* and others
*
*
* @example Example for getContainerUtils()
* Example usage - PCore.getContainerUtils()
* // returns -- ContainerUtils Object which containers the utility APIs
*
* @example Example for getContainerUtils().getContainerItemName
* Example usage - PCore.getContainerUtils().getContainerItemName('app/primary')
* // returns -- container item name if container already exists in store
*
* @returns {@link ContainerUtils} object
* @function
*/
getContainerUtils = (): typeof ContainerUtils => {
return ContainerUtils;
};
/**
* Obtains an entry point to the {@link AnnotationUtils} class that is used to access utility APIs to handle the annotation to a property.
*
* @example Example for getAnnotationUtils()
* Example usage - PCore.getAnnotationUtils()
* // returns -- AnnotationUtils class containing the utility APIs
*
* @example Example for getAnnotationUtils().isProperty()
* Example usage - PCore.getAnnotationUtils().isProperty('@P .EmployeeName')
* // returns -- true if the passed argument is property otherwise it returns false
*
* @returns the AnnotationUtils API object
* @function
*/
getAnnotationUtils = () => {
return AnnotationUtils;
};
/**
* Obtains an entry point to the {@link FieldUtils} class that is used to access utility APIs to handle the field related operations.
*
* @example Example for getFieldUtils()
* Example usage - PCore.getFieldUtils()
* // returns -- FieldUtils class containing the utility APIs
*
* @example Example for getFieldUtils().formatPageReference()
* Example usage - PCore.getFieldUtils().formatPageReference('.Questionsets[0].Questions')
* // returns -- '.Questionsets(1).Questions'
*
* @returns the FieldUtils API object
* @function
*/
getFieldUtils = () => {
return FieldUtils;
};
/**
* Obtains an entry point to the {@link FieldDefaultUtils} instance that is used to access APIs to handle the fields default related operations.
*
* @example Example for getFieldDefaultUtils()
* Example usage - PCore.getFieldDefaultUtils()
* // returns -- FieldDefaultUtils class instance containing the APIs
*
* @example Example for getFieldDefaultUtils().getDefaultsforType()
* Example usage - PCore.getFieldDefaultUtils().getDefaultsforType("Email")
*
* @returns the FieldDefaultUtils object
* @function
* @public
*/
getFieldDefaultUtils = () => {
return FieldDefaultUtils;
};
/**
* Returns the Asset Loader Class
* This exposes the Asset Loader utility APIs including:
*
* - getStaticServerUrl
* - getConstellationServiceUrl
* - initServer
* - register
* - getLoader
* - loadAssets
*
*
* @example Example for getAssetLoader()
* Example usage - PCore.getAssetLoader()
* // returns -- AssetLoader Object which containers the utility APIs
*
* @example Example for getAssetLoader().getLoader
* Example usage - PCore.getAssetLoader().getLoader('font-loader')
* // returns -- Font Loader Function to load font assets if font-loader is defined
* // else returns default loader
*
*
* @returns the Asset Loader Object
* @function
*/
getAssetLoader = () => {
return AssetLoader;
};
/**
* Obtains an entry point to the {@link module:AttachmentUtils|AttachmentUtils} object that contains utility APIs to handle the attachments of a case.
*
* @example In this example, the getAttachmentUtils API is used to obtain the uploadAttachment API.
* // To access uploadAttachment API
* const { uploadAttachment } = PCore.getAttachmentUtils();
* // returns -- An object of Attachment utility APIs
*
* @returns An object of AttachmentUtils APIs
* @function
*/
getAttachmentUtils = () => {
return Attachment;
};
/**
* Obtains an entry point to the {@link module:ViewRule|ViewRule} object that contains APIs to handle performing
* CRUD operations to View Rules
*
* @example In this example, the getViewRuleApi is used to obtain the getViewRule API.
* // To access getViewRule API
* const { getViewRule } = PCore.getViewRuleApi();
* // returns -- An object of ViewRule utility APIs
*
* In particular, the full list of utility APIs are:
*
* - createViewRule
* - getViewRule
* - updateViewRule
* - deleteViewRule
*
*
* @returns An object of ViewRule APIs
* @function
* @private
*/
getViewRuleApi = () => {
return ViewRule;
};
/**
* Obtains an entry point to the {@link FeedUtils} object that contains APIs to handle the feeds of a case.
* @example In this example, the FeedApi is used to obtain the postMessage API.
* // To access postMessage API
* const feedUtils = PCore.getFeedUtils();
* feedUtils.postMessage().then(()=>{
* // success case
* }).catch(()=>{
* // error case
* })
*
* @returns An object of FeedUtils APIs
* @function
*/
getFeedUtils = () => FeedUtils;
/**
* Obtains an entry point to the {@link TagUtils} object that contains APIs to handle the tags of a case.
*
* @example In this example, the API returns the tagUtils object containing the APIs that handle the tags of a case.
* const { getTaggedCases, getTags, postTags, removeTag , getTagsLandingPageURL } = PCore.getTagUtils();
*
* @returns This API returns the {@link TagUtils} object.
* @function
*/
getTagUtils = () => Tags;
/**
* Obtains an entry point to the {@link module:GenAIAssistantUtils|GenAIAssistantUtils} object that contains APIs to handle the GenAI Assistant.
* @example In this example, the API returns the genAiAssistantUtils object containing the APIs that handle the genai functionalities in a case.
* const { createConversation, sendMessage } = PCore.getGenAiAssistantUtils();
*
* @returns {object} Returns the {@link module:GenAIAssistantUtils|GenAIAssistantUtils} object.
* @function
*/
getGenAIAssistantUtils = () => GenAIAssistant;
/**
* Obtains an entry point to the {@link module:StakeholderUtils|StakeholderUtils} object that contains APIs to handle the participants of a case.
*
* @example In this example, the API returns the StakeholderUtils object containing the APIs that handle the participants of a case.
* const { getParticipants, getRoleView, getParticipantRoles, getParticipant, createParticipant, updateParticipant, deleteParticipant } = PCore.getStakeholderUtils();
*
* @returns This API returns the {@link StakeholderUtils} object.
* @function
*/
getStakeholderUtils = () => Stakeholders;
/**
* Obtains an entry point to the {@link UserApi} object that contains APIs to handle the user data.
*
* @example In this example, the getUserApi API is used to obtain the getOperatorDetails API.
* // To access Users API
* const { getOperatorDetails } = PCore.getUserApi();
* // returns -- An object of User APIs
*
* @returns An object of {@link UserApi} APIs
* @function
*/
getUserApi = () => {
return UserApi;
};
/**
* Obtains an entry point to the {@link CaseFollowerApi} object that contains APIs to handle the followers of a case.
*
* @example In this example, the getCaseFollowerApi API is used to obtain the addCaseFollower API.
* // To access Followers API
* const { addCaseFollower } = PCore.getCaseFollowerApi();
* // returns -- An object of Follower APIs
*
* @returns An object of {@link CaseFollowerApi} APIs
* @function
*/
getCaseFollowerApi = (): typeof FollowerApi => {
return FollowerApi;
};
/**
* Obtains an entry point to the {@link CaseUtils} object that contains utility APIs for the Case.
*
* @example In this example, the getCaseUtils API is used to obtain the isCaseActive API.
* const CaseUtils = PCore.getCaseUtils();
*
* @returns An object of {@link CaseUtils} APIs
* @function
*/
getCaseUtils = () => {
return CaseUtils;
};
/**
* Obtains an entry point to the {@link StateUtils} object that contains utility APIs for the Redux State.
*
* @example In this example, the getStateUtils API is used to obtain API's like getSharedState, setSharedState.
* const StateUtils = PCore.getStateUtils();
*
* @returns An object of StateUtils APIs
* @function
*/
getStateUtils = () => {
return StateUtils;
};
/**
* This API provides an entry point to the RelatedCasesApi object that contains APIs to handle the related cases of a case.
* To view the APIs in the RelatedCasesApi module, see {@link RelatedCasesApi}.
*
* @example In this example, the API returns the RelatedCasesApi object containing the APIs that handle the related cases of a case.
* PCore.getRelatedCasesApi();
*
* @returns This API returns the {@link RelatedCasesApi} object.
* @function
*/
getRelatedCasesApi = () => {
return RelatedCasesApi;
};
/**
* This API provides an entry point to the {@link PersonalizationUtils} object that contains utility APIs
* to manage the personalization instances of a list component.
* To view the APIs in the {@link PersonalizationUtils} module,
* see {@link PersonalizationUtils} Module.
*
* @param listId - A unique ID referencing a list component. The length of the ID should be limited to 32 characters.
*
* @example In this example, the API obtains the PersonalizationUtils object for the list whose ID is 443533r555.
* const listId = "443533r555";
* PCore.getPersonalizationUtils(listId);
*
* @returns - {@link PersonalizationUtils} object
* @function
*/
getPersonalizationUtils = getPersonalizationUtils;
/**
* This API obtains the metadata associated with the datasource contained in the config object
*
* @example Example for getDataApi()
* Example usage - PCore.getDataApi().init(dataConfig);
* // the API obtains the metadata associated with the data source contained in the dataConfig object.
* @function
*/
getDataApi = () => {
return DataApi;
};
/**
* This API provides an entry point to the {@link DataApiUtils} object that contains utility APIs to retrieve information from data views.
* To view the APIs in the {@link DataApiUtils} module, see {@link DataApiUtils} Module.
*
* @example In this example, the API obtains the entry point to the DataApiUtils object.
* PCore.getDataApiUtils();
*
* @returns The DataApiUtils object
* @function
*/
getDataApiUtils = (): typeof DataApiUtils => {
return DataApiUtils;
};
/**
* Returns an object of Analytics utils like:
*
* - getDataObjects
* - getDefaultColumns
* - getInsightIDs
* - getInsightByID
* - createInsight
* - exportToExcel
* - exportToCSV
* - translateStrings
*
*
* All APIs return a Promise.
*
* @example Examples for getAnalyticsUtils()
* // To retrieve a list of all insights
* PCore.getAnalyticsUtils().getInsightIDs().then(response => { ... }).catch(() => { ... });
*
* // To create an insight
* const insightMetadata = { ... };
* PCore.getAnalyticsUtils().createInsight(insightMetadata).then(response => { ... }).catch(() => { ... });
*
* @returns An object of {@link AnalyticsUtils} APIs
* @function
*/
getAnalyticsUtils = (): typeof AnalyticsUtils => {
return AnalyticsUtils;
};
/**
* Returns an instance of the LocaleUtils class.
* @example PCore.getLocaleUtils()
* //Returns the instance of the localeUtils with the following API's on it.
*
* - setLocaleForRule
* - getLocaleForRule
* - resetLocaleStore
* - getLocaleValue
* - setTimezone
* - getTimeZoneInUse
*
* @function
* @returns the localeUtils Object
*/
getLocaleUtils = () => {
return localeUtils;
};
/**
* Registers the custom LocaleUtils APIs overriding the existing ones.
* @example PCore.getLocaleUtils().registerLocaleManager(customLocaleUtilApis)
* customLocaleUtilApis - {
* "setLocaleForRule" : function(){ //custom implementation},
* "getLocaleForRule" : function(){ //custom implementation},
* "resetLocaleStore" : function(){ //custom implementation},
* "getLocaleValue" : function(){ //custom implementation},
* "setTimezone" : function(){ //custom implementation},
* "getTimeZoneInUse" : function(){ //custom implementation}
* }
* @function
* @param customLocaleUtilApis An object with the custom implementation if the LocaleUtils API's
*/
registerLocaleManager = (customLocaleUtilApis: { [key: string]: any }) => {
const existingLocaleUtilApis = this.getLocaleUtils();
Object.keys(customLocaleUtilApis).forEach((customLocaleUtilsApiKey) => {
// override existing apis with custom apis
existingLocaleUtilApis[customLocaleUtilsApiKey as keyof LocaleUtils] =
customLocaleUtilApis[customLocaleUtilsApiKey];
});
};
/**
* Access for a runtime environment to set some flags to override some
* default behaviors. Note that this action replaces
* any previous overrides. To add to the existing overrides, use
* setBehaviorOverride
* @param overridesObj The JSON object containing any behavior override flags
* Supported override flag:
* dynamicLoadComponents - when false, do not attempt to load components dynamically
* @example PCore.setBehaviorOverrides( { "dynamicLoadComponents": false } );
* @function
*/
setBehaviorOverrides = (overridesObj: object) => {
PCore.behaviorOverrides = overridesObj;
};
/**
* Access for a runtime environment to set/update a flag to override some
* default behaviors. Note that this action adds or updates
* the override key value. Other keys/values are left intact.
* To replace the existing overrides, use
* setBehaviorOverrides
* @param overrideKey The key value for the behavior override flag. (Ex: "dynamicLoadComponents")
* @param overrideValue the desired value of the override. (Ex: true, false)
* Supported override flags:
* dynamicLoadComponents - when false, do not attempt to load components dynamically
* dynamicSemanticUrl - when false, do not attempt to update the app's semantic URL dynamically
* dynamicSetCookie - when false, do not attempt to set the app's C11n cookie dynamically
*
* @example PCore.setBehaviorOverride("dynamicLoadComponents", true);
* @function
*/
setBehaviorOverride = (overrideKey: string, overrideValue: boolean) => {
PCore.behaviorOverrides[overrideKey] = overrideValue;
};
/**
* Returns the current JSON object of behavior overrides.
* @example PCore.getBehaviorOverrides() could return { "dynamicLoadComponents": false }
* @returns The current JSON object of behavior overrides.
* @function
*/
getBehaviorOverrides = () => {
return PCore.behaviorOverrides;
};
/**
* Returns the current value of the requested behavior override flag.
* If the requested flag has not been sent, this returns undefined.
* @param theOverride The requested override flag. Ex: dynamicLoadComponents
* @example PCore.getBehaviorOverride("dynamicLoadComponents") could return false
* @function
*/
getBehaviorOverride = (theOverride: string) => {
return PCore.behaviorOverrides[theOverride];
};
/**
* This API obtains an entry point to the AsynchronousUtils object that contains utility APIs that perform asynchronous operations using Observable patterns.
* To view the APIs in the AsynchronousUtils class, see {@link AsynchronousUtils} Class.
* @example In this example, the API returns the AsynchronousUtils object.
* const asyncUtils = PCore.getAsynchronousUtils();
* @function
*/
getAsynchronousUtils = () => {
return AsynchronousUtils;
};
/**
* Creates a PConnect object from the input configuration of a component.
* The PConnect object represents a newly created component context for the given input configuration and has access to all public PConnect APIs.
*
* Use the createPConnect(config) API if you need to explicitly create a PConnect object for a component.
*
* For example, in a table, each column has its own type and configuration. To render the cells in the table, you can use the createPConnect(config) API to create
* a PConnect object by passing the config object that contains the details of the cells along with the context and pageReference of the parent component.
*
* The configuration object passed to this API should include:
* - meta.type: Denotes the type of the component. In the example, the type is "DropDown". This is a required property
* - options.context: The name of the context under which the component is rendered. context must be passed if the component has to render on a context that is different from the parent component's context.
* - options.pageReference: The data reference path of the store where the data value is stored for the current component. pageReference must be passed if the component has to render on a page reference that is different from the parent component's page reference.
*
* These three properties are of type string.
*
* @example Example usage of createPConnect
* Example:
* const config = {
* "meta": {
* "type": "DropDown",
* "config": {
* label: "@L Type"
* }
* },
* "options": {
* context: "contextName",
* pageReference: "pageRef"
* }
* }
*
* const dropDownPConn = createPConnect(config);
* In this example, the API creates a PConnect object for a dropdown component based on the input configuration of the config object.
*
* @param config payload to create a PConnect Object
* @returns A PConnect object created from the configuration object.
* @function
*/
createPConnect = (config: object) => {
return createC11nEnv(config);
};
/**
* This API provides an entry point to the PubSubUtils object that is used to access the
* utility APIs in the Constellation Core that publish and subscribe events
* This exposes the Event PubSub UtilsAPIs like
*
*
* @example Example for getPubSubUtils()
* Example usage - PCore.getPubSubUtils();
* // returns the PubSubUtils object containing the utility APIs that publish and subscribe events
* @function
*/
getPubSubUtils = () => {
return PubSubUtils;
};
/**
* Call registerComponentCreator with component creator function, such that it will be registered and receives the C11nEnv object.
*
* @param creator function which is called to register a component creator.
* This function will receive the C11nEnv as first argument
* and if there are any additionalProps object as second argument.
*
* @example Example for registerComponentCreator()
* Example Usage:
* PCore.registerComponentCreator((c11nEnv, additionalProps = {}) => {
* return React.createElement(PConnectHOC(), {
* ...c11nEnv,
* ...c11nEnv.getPConnect().getConfigProps(),
* ...c11nEnv.getPConnect().getActions(),
* ...{ additionalProps }
* });
*
* All the components, which render will be using this registered component create function to create the component instance
* Note: Here the usage shows React.createElement which indicates, the components are created using React.
* @function
*/
registerComponentCreator = (creator: Function) => {
registerComponentCreator(creator);
};
/**
* Call getConstants function to get the public constants
* which are supposed to be used at appropriate places.
*
* @example Example for getConstants()
* Example Usage:
* const constants = PCore.getConstants();
*
* constants will have un-modifiable constants object which you can use at places Infra expects.
* for example: you have to use constants.MESSAGES.MESSAGES_TYPE_ERROR if you want to add or delete error messages in the application state.
*
* @function
*/
getConstants = () => {
return Object.freeze(publicConstants);
};
/**
* Call getEvents function to get all the case related events
* which are supposed to be used to subscribe using getPubSubUtils.
* This exposes Events like:
*
*
* @example Example for getEvents()
* Example Usage:
* const CaseEvent = PCore.getEvents().getCaseEvent();
*
* @function
*/
getEvents = () => {
return Events;
};
/**
* This API provides an entry point to the {@link module:RestClient|REST Client} API object.
* This exposes APIs that include:
*
* - invokeRestApi
* - getCancelTokenSource
* - isRequestCanceled
*
*
* @example Example for invokeRestApi api
* const { invokeRestApi } = PCore.getRestClient();
* const cancelTokenSource = getCancelTokenSource();
* invokeRestApi('getFeedMessages', {
* queryPayload: {
* filterForContext: 'DATA-PORTAL $SpaceTra',
* filterByContext: 'context'
* },
* body: {},
* headers: {},
* // passing cancel token so that we can cancel the request using cancelTokenSource
* cancelTokenSource: cancelTokenSource.token
* })
* .then(() => {
* // handle the response
* })
* .catch((error) => {
* // handle error
* if(isRequestCanceled(error)) {
* // handle the canceled request using cancelTokenSource.cancel();
* }
* });
* // above example shows how to use invokeRestApi api to make REST API call to get Feed messages.
*
* @example Example for getCancelTokenSource api
* const { getCancelTokenSource } = PCore.getRestClient();
* const cancelTokenSource = getCancelTokenSource();
* // cancel the ongoing request using the cancelTokenSource
* cancelTokenSource.cancel();
* // above example shows how to use getCancelTokenSource api to get the cancel token source using which we can cancel the ongoing request.
*
* @example Example for isRequestCanceled api
* const { isRequestCanceled } = PCore.getRestClient();
* if(isRequestCanceled(error)) {
* // handle the canceled request using cancelTokenSource.cancel();
* }
* // above example shows how to use isRequestCanceled api to know if the request is canceled using cancel token source.
*
*
* @returns the REST Client API object
* @function
*/
getRestClient = () => {
return RestClient;
};
/**
* This api provides api to mashup cases and views.
* @example Example for getMashupApi()
* Example usage - PCore.getMashupApi();
* // returns the MashupApi object containing the utility APIs to work with cases and pages
*
* @returns - the {@link MashupApi} API object
* @function
*/
getMashupApi = () => {
return MashupApi;
};
/**
* Call getEnvironmentInfo function to get the Environment Information
* such as Locale, Operator info, Application info.
*
* @example Example for getEnvironmentInfo
* Example Usage:
* const envInfo = PCore.getEnvironmentInfo();
* // to get application name
* const appName = envInfo.getApplicationName();
*
* @function
* @returns - the {@link EnvironmentInfo} API object
*/
// This is a stub for getEnvironmentInfo function
getEnvironmentInfo = (): typeof EnvironmentInfo => {
return EnvironmentInfo;
};
/**
* Call getRuntimeParamsAPI to get RuntimeParamsAPI
* which is used to set parameters object while authoring and to be made available in runtime
*
* @example Example for getRuntimeParamsAPI
* Example Usage:
* const runtimeParamsAPI = PCore.getRuntimeParamsAPI();
* // to set runtimeParams
* runtimeParamsAPI.setRuntimeParams({});
*
* @function
* @private
* @returns - the {@link RuntimeParamsAPI} API object
*/
getRuntimeParamsAPI = () => {
return RuntimeParamsAPI;
};
/**
* This api provides utilities to build semantic URLs.
* @example Example for getSemanticUrlUtils()
* // this example will return the SemanticUrlUtils API object
* const semanticUrlUtils = PCore.getSemanticUrlUtils();
*
* @returns - the {@link SemanticUrlUtils} API object
* @function
*/
getSemanticUrlUtils = () => SemanticUrlUtils;
/**
* This api provides remote case utils.
* @example Example for getRemoteCaseUtils()
* Example usage - PCore.getRemoteCaseUtils();
*
* @returns - the {@link RemoteCase} API object
* @function
* @private
*/
getRemoteCaseUtils = () => RemoteCase;
/**
* This api provides NavigationUtils
* @example Example for getNavigationUtils()
* Example usage - PCore.getNavigationUtils();
* @returns - the {@link NavigationUtils} API object
* @function
*/
getNavigationUtils = () => NavigationUtils;
/**
* This api provides registering module on demand.
* @example Example for registerModule()
* Example usage - PCore.registerModule("getFollowersApi", {
* getFollowers: () => {}
* });
*
* @param moduleName Name of the module to be exposed
* eq., getFollowersApi()
* @param module module object to be returned
* @function
* @private
*/
registerModule = (moduleName: string, module: object) => ModuleRegistry.registerModule(moduleName, module, this);
/**
* This api provides Error Handling
* @example Example for getErrorHandler()
* Example usage - PCore.getErrorHandler().setGenericFailedMessage('Failed to load preview');
* Example usage - PCore.getErrorHandler().getGenericFailedMessage();
* @returns - the {@link ErrorHandler} API object
* @function
*/
getErrorHandler = () => ErrorHandler;
/**
* Obtains an entry point to the {@link FormUtils} object that contains APIs that handle form related cases.
* @example In this example, the getFormUtils is used to obtain the getChanges API.
* // To access getChanges API
* const formUtils = PCore.getFormUtils();
* const changes = formUtils.getChanges('app/primary_1');
* @returns - the {@link FormUtils} API object
* @function
*/
getFormUtils = () => FormUtils;
/**
* This api provides messaging service (web sockets) related APIs
* @example Example getMessagingServiceManager()
* Example usage - PCore.getMessagingServiceManager().subscribe({matcher: "interaction"}, message => {
* // Do process message here
* }));
* PCore.getMessagingServiceManager().unsubscribe(subId);
* @returns - the {@link MessagingServiceManager} API object
* @function
*/
getMessagingServiceManager = () => MessagingServiceManager;
/**
* This api provides metadata access like views, data-pages, fields etc.,
* @example Example getMetadataUtils()
* Example usage - PCore.getMetadataUtils().getDatapageMetadata("D_TestPage")
* @returns - the {@link RuleStore} API object
* @function
* @private
*/
getMetadataUtils = () => MetadataUtils;
/**
* This API contains utility methods to retrieve data from data pages.
* @example Example getDataPageUtils()
* Example usage - PCore.getDataPageUtils()
* @returns - the {@link DataStore} API object
* @function
*/
getDataPageUtils = (): typeof DataStore => DataStore;
/**
* This API contains utility methods to retrieve information about data types.
* @example Example getDataTypeUtils()
* Example usage - PCore.getDataTypeUtils().getSavableDataPage();
* @returns - the {@link DataTypeUtils} API object
* @function
*/
getDataTypeUtils = () => DataTypeUtils;
/**
* This api is to register Datapage parameters for callback subscription
* @example Example getCascadeManager()
* Example usage - PCore.getCascadeManager()
* @returns - the {@link CascadeManager} API object
* @function
*/
getCascadeManager = () => CascadeManager;
/**
* Determines if the values of two objects are the same by performing a deep comparison.
* @example In this example isDeepEqual is used to compare 2 objects
* Example usage - PCore.isDeepEqual({'a': '123'}, {'a': '123'});
* @param oldValue The value of the first object.
* @param newValue The value of the second object.
* @returns returns true if both object are same in terms to value else return false
* @function
*/
isDeepEqual = (oldValue: object, newValue: object) => _isEqual(oldValue, newValue);
/**
* This API provides an entry point to the {@link AuthUtils} API object that contains utility APIs to
* to handle authentication tokens utilized for REST API calls.
*
*
* @example Example for getAuthUtils()
* Example usage - PCore.getAuthUtils().setTokens(tokenObj)
* Example usage - PCore.getAuthUtils().revokeTokens().then()
* Example usage - PCore.getAuthUtils().getAuthInstance(authConfig)
*
* @returns - the {@link AuthUtils} Object
* @function
*/
getAuthUtils = (): typeof AuthUtils => {
return AuthUtils;
};
/**
* This API provides an entry point to the {@link module:Debugger} API object that contains utility APIs to
* to enable Xray.
*
*
* @example Example for getDebugger()
* Example usage - PCore.getDebugger().enableXRay()
*
* @returns - the {@link module:Debugger} Object
* @function
* @private
*/
getDebugger = () => Debugger;
/**
* This API provides an entry point to the {@link module:DeferLoadManager} API object that exposes methods to
* manager defer loaded components
*
*
* @example Example for getDeferLoadManager()
* Example usage - PCore.getDeferLoadManager().start(viewName, caseKey, pageReference, contextName, uniqueId)
* Example usage - PCore.getDeferLoadManager().stop(uniqueId, contextName)
*
* @returns - the {@link DeferLoadManager} Object
* @function
* @private
*/
getDeferLoadManager = () => DeferLoadManager;
/**
* Obtains an entry point to the {@link ExpressionEngine} object that contains API to evaluate expression on given data
*
* @example Example for getExpressionEngine
* Example Usage:
* const expressionEngine = PCore.getExpressionEngine();
* // to evaluate an expression on localData
* const result = expressionEngine.evaluate();
*
* @function
* @returns - the {@link ExpressionEngine} API object
*/
getExpressionEngine = () => ExpressionEngine;
/**
* Obtains an entry point to the ActionsSequencer object that contains APIs to sequence different type of actions in the Constellation Infrastructure.
* To view the APIs in the ActionsSequencer class, see {@link ActionsSequencer|APIs in the ActionsSequencer class}
*
* @example In this example , the API returns the ActionsSequencer object containing the utility APIs
* PCore.getActionsSequencer();
*
* @returns The ActionsSequencer Object
* @function
*/
getActionsSequencer = () => ActionsSequencer;
/**
* This API create unique id and registers given property in passed context
* @example Example for RefreshManager
* const callback = refreshCaseView.bind(params);
* PCore.getRefreshManager().registerForRefresh('PROP_CHANGE',callback,'caseInfo.content.Name','app/modal_1/caseInfo.content','app/modal_1');
*
* options parameter is optional
* @returns return the RefreshManager instance
* @private
*/
getRefreshManager = () => RefreshManager;
getInitialiser = () => Initialiser;
getBootstrapUtils = (): typeof BootstrapUtils => BootstrapUtils;
/**
* Obtains an entry point to the ContextTreeManager object which provides apis to register and handle mutations confined to a view and its children.
* @example Example for getContextTreeManager
* PCore.getContextTreeManager().onViewMutate(
* tab.getPConnect().getContextName(),
* tab.getPConnect().getPageReference(),
* tab.getPConnect()._rawConfig.config?.name,
* (errors) => {
* setTabErrors((tabErrors) => {
* const errors = [...tabErrors];
* ...
* }
* @returns return the ContextTreeManager instance
*/
getContextTreeManager = () => ContextTreeManager;
/**
* This API captures performances of various network calls
* @example Example for PerformanceManager
* @returns {object} return the PerformanceManager instance
* @private
*/
getPerformanceManager = () => PerformanceManager;
/**
* This API provides with access related information
* @example Example for AccessPrivilege
* if(PCore.getAccessPrivilege().hasCreateAccess("Person")){
* hasAccess = true;
* }
* @returns {object} return the AccessPrivilege instance
* @private
*/
getAccessPrivilege = () => AccessPrivilege.getInstance();
}
export default PCore;