/** * Provides APIs that helps analytics entities or actions perform data interactions with the PRPC server. * @module AnalyticsUtils */ import type { AxiosResponse } from 'axios'; import type { DataResponse } from '../data-view/types'; import type { DataObjectMeta, DataObjectsAPIResponse, DefaultColumn } from './types/data-model'; import type { InfinityInsights, LaunchpadRuntimeInsights } from './types/insights'; /** * Retrieves the list of data objects in the current application. * @param useCache whether to use session cache or not. * @function getDataPageObjects * @returns Resolves to a response containing data objects corresponding to data pages. */ export declare function getDataPageObjects(useCache?: boolean): Promise>; /** * Retrieves the list of data objects in the current application. * @function getDataObjects * @returns Resolves to a response containing data objects corresponding to data types and case types. * * @example In this example, the API returns a Promise that resolves to a response containing the list of data objects. * PCore.getAnalyticsUtils().getDataObjects().then(response => { console.log(response.data); }).catch(() => { ... }); * // console output:[{ * // classID: "OPB1HW-MyApp-Work-MyCase", * // defaultListViewData: "D_MyCaseList", * // (other properties like: description, name, links) * // }] */ export declare function getDataObjects(): Promise>; /** * Retrieves the default columns for a table displaying case data. * @function getDefaultColumns * @param payload A payload object that will specify the report to retrieve the columns from for use as the "default fields" of a data entity. * @param payload.reportName The name of the report in which the default columns are configured. * @param payload.className The class of the report in which the default columns are configured * @returns Resolves to a response containing info for the default columns. * * @example In the example below, the API returns a Promise that resolves to a response containing information for the default columns. * const payload = { className: "OZ1CUU-MyApp-Work-MyCase", reportName: "DataTableEditorReport" }; * PCore.getAnalyticsUtils().getDefaultColumns(payload).then(response => { console.log(response.data); }).catch(() => { ... }); * // console output:[ * // { pyFieldName: "pzInsKey" }, * // { pyFieldName: "pyID" }, * // { pyFieldName: "columnName" } * // ] */ export declare function getDefaultColumns(payload: { reportName: string; className: string; }): Promise>; /** * This API retrieves the columns configured on the RD which is bound to the given data view. * @function getFieldsForDataSource * @param dataViewName - dataViewName name * @param skipStoreCheck - The flag that determines if the fields of the given data view must be fetched from the rule store or from the browser cache. * Set skipStoreCheck to true if the fields of the given data view must be fetched from the browser cache. * Set skipStoreCheck to false if the fields of the given data view must be fetched from the rule store. * If the fields are not found in the rule store, it is fetched from the browser cache. * @param contextName name of the context. * @returns list of columns configured on RD bound on the data view * * @example In the example below, the API returns a Promise that resolves to a response containing list of RD columns. * const dataViewName = "D_MyCaseList" * PCore.getAnalyticsUtils().getFieldsForDataSource(dataViewName, false, 'app/Primary_1'); * //The response of this api will be like shown below. { "data": [ { pyFieldName: "pzInsKey" }, { pyFieldName: "pyID" }, { pyFieldName: "columnName" } ] } */ export declare function getFieldsForDataSource(dataViewName: string, skipStoreCheck: boolean, contextName: string): Promise; /** * Retrieves the the primary fields for the given dataview * @function getPrimaryFieldsForDataSource * @param dataViewName - dataViewName name * @param dataViewClassName - class name * If Primary Fields are not found, defaults to listing Fields * @returns list of primary fields or fields */ export declare function getPrimaryFieldsForDataSource(dataViewName?: string, dataViewClassName?: string): Promise; /** * Retrieves the primary fields for the given list of classes * NOTE: It skips returning classes in the response object if the API calls failed for any reason * or if PrimaryFields were never defined for a given class * * @function getPrimaryFieldsForInsights * @param {string[]} [topLevelClassID] - Top level classID for which, primary fields need to be fetched * @param {string} [topLevelDataPageID] - Data page ID needed to fallback to RD fields if primary fields were not set * @param {string[]} [joinedClassIDs] - IDs of classes for which, primary fields need to be fetched * @returns {object} An object with classIDs as keys and array of primary fields as values * @private */ export declare function getPrimaryFieldsForInsights(topLevelClassID?: string, topLevelDataPageID?: string, joinedClassIDs?: string[]): Promise<{ data: { [classID: string]: string[]; }; }>; /** * This API obtains the metadata of a data view as a Promise and caches the response in session storage. * @function getDataViewMetadata * @param dataViewName - dataViewName name * @param skipStoreCheck - The flag that determines if the metadata of the given data view must be fetched from the rule store or from the metadata API * Note: * - The default value is false. * - Set `skipStoreCheck` to true if the metadata of the given data view must be fetched from the /metadata API call * - Set `skipStoreCheck` to false if the metadata of the given data view must be fetched from rules store. if its not found on that then fetch it from /metadata API call * @returns metadata object for the given dataView * * @example In the example below, the API returns the metadata of the data view whose name is 'D_BugList'. * * const dataViewName = "D_BugList" * PCore.getAnalyticsUtils().getDataViewMetadata(dataViewName); * * //The response of this api will be like shown below. { "data" : { "classID": "PegaProjMgm-Work-Bug", "className": "Bug", "structure": "List", "isQueryable": true, "fields": [ { "description": "operator who manager assigns work to", "fieldID": "pyAssignedOperator", "fieldType": "Identifier", "isReadOnly": false, "name": "Assigned To", "dataType": "Identifier" }, { "description": "This property is used to identify the work object's parent Backlog and should include the pyID of that work object. In the future, it will be derived from the user's data input into UserStoryIDEntry or based upon the context of the creation of the item.", "displayAs": "pxTextInput", "fieldID": "BacklogID", "fieldType": "Text (single line)", "isReadOnly": false, "name": "Backlog ID", "maxLength": 32, "dataType": "Text" } ] } } */ export declare function getDataViewMetadata(dataViewName: string, skipStoreCheck: boolean, associationFilter?: string[] | null): Promise<{ data: DataObjectMeta; }>; /** * Retrieves all available insight IDs. * @function getInsightIDs * @returns Resolves to a response containing a list of insights with the related information. * * @example In this example, the API returns a Promise that resolves to a response containing a list of insight with the related information * PCore.getAnalyticsUtils().getInsightIDs().then(response => { console.log(response.data); }).catch(() => { ... }); * // console output: { * // pyInsights: [{ * // pyID: "124e9385-a623-4c55-ba8e-5af8cbd0ae64", * // pyName: "Saved Insight" * // pyCreateDateTime: "20200630T183653.784 GMT", * // pyCreateOperator: "user@pega.com", * // pyUpdateDateTime: "20200630T183656.330 GMT", * // pyUpdateOperator: "user@pega.com", * // pxObjClass: "PegaBI-API-Insight" * // }] * // } */ export declare function getInsightIDs(): Promise; /** * Retrieves the metadata related to the given insight ID. * @function getInsightByID * @param insightID The unique ID for the insight you are trying to retrieve. * @returns Resolves to a response containing the metadata for the given insight. * * @example In the example below, the API returns a Promise that resolves to a response containing the metadata for the specified insight. * const insightID = "124e9385-a623-4c55-ba8e-5af8cbd0ae64"; * PCore.getAnalyticsUtils().getInsightByID(insightID).then(response => { console.log(response.data); }).catch(() => { ... }); * // console output: { * // pyInsights: [{ * // pyContent: "[stringified insight metadata json]", * // pyName: "Insight Name", * // pyPermissions: [{ * // pyAccessCategory: "Rule-Access-Role-Name", * // pyAccessType: "view", * // pyAccessValue: "TestApp:Users" * // }] * // }] * // } */ export declare function getInsightByID(insightID: string): Promise; /** * Retrieves the metadata related to the given insight IDs. * @function getInsightsByID * @param insightIDs The unique IDs for the insights you are trying to retrieve. * @returns Resolves to a response containing the metadata for the given insight. * @private * * @example In the example below, the API returns a Promise that resolves to a response containing the metadata for the specified insight. * const insightIDs = ["124e9385-a623-4c55-ba8e-5af8cbd0ae64", "b15cca34-e61b-468a-b1ee-f8492ada78e4"]; * PCore.getAnalyticsUtils().getInsightsByID(insightIDs).then(response => { console.log(response.data); }).catch(() => { ... }); * // console output: { * // pyInsights: [{ * // pyContent: "[stringified insight metadata json]", * // pyName: "Insight Name", * // pyPermissions: [{ * // pyAccessCategory: "Rule-Access-Role-Name", * // pyAccessType: "view", * // pyAccessValue: "TestApp:Users" * // }] * // },{ * // pyContent: "[stringified insight metadata json]", * // pyName: "Insight Name", * // pyPermissions: [{ * // pyAccessCategory: "Rule-Access-Role-Name", * // pyAccessType: "view", * // pyAccessValue: "TestApp:Users" * // }] * // }] * // } */ export declare function getInsightsByID(insightIDs: string[]): Promise>; /** * Creates a new insight rule containing the provided metadata. * @function createInsight * @param insightObject The metadata you want to store in an insight rule. * @returns Resolves to a response containing the ID for the new insight. * @private * * @example The API creates a new insight rule and returns a Promise that resolves to a response containing top-level info for the insight. * const insightObject = { * pyContent: "[stringified insight metadata json]", * pyName: "Insight Name", * pyPermissions: [{ * pyAccessCategory: "Rule-Access-Role-Name", * pyAccessType: "view", // or "edit" * pyAccessValue: "TestApp:Users" * }] * }; * PCore.getAnalyticsUtils().createInsight(insightObject).then(response => { console.log(response.data); }).catch(() => { ... }); * // console output: { * // pyID: "124e9385-a623-4c55-ba8e-5af8cbd0ae64", * // pyName: "Insight Name", * // pyCreateDateTime: "20200630T183653.784 GMT", * // pyCreateOperator: "user@pega.com", * // pyUpdateDateTime: "20200630T183656.330 GMT", * // pxObjClass: "PegaBI-API-Insight" * // } */ export declare function createInsight(insightObject: InfinityInsights.CreateInsightRequestBody | LaunchpadRuntimeInsights.CreateInsightRequestBody): Promise | Partial>>; /** * Update an existing insight rule. * @param insightID The ID of the insight rule to update. * @param insightObject The insight metadata to save. * @private * * @example The API updates an existing insight rule and returns a Promise that resolves to a response containing top-level info for the insight. * const insightID = "124e9385-a623-4c55-ba8e-5af8cbd0ae64"; * const insightObject = { * pyContent: "[stringified insight metadata json]", * pyName: "Insight Name", * pyPermissions: [{ * pyAccessCategory: "Rule-Access-Role-Name", * pyAccessType: "view", // or "edit" * pyAccessValue: "TestApp:Users" * }] * }; * PCore.getAnalyticsUtils().updateInsight(insightID, insightObject).then(response => { console.log(response.data); }).catch(() => { ... }); * // console output: { * // pyID: "124e9385-a623-4c55-ba8e-5af8cbd0ae64", * // pyName: "Insight Name", * // pyCreateDateTime: "20200630T183653.784 GMT", * // pyCreateOperator: "user@pega.com", * // pyUpdateDateTime: "20200630T183656.330 GMT", * // pxObjClass: "PegaBI-API-Insight" * // } */ export declare function updateInsight(insightID: string, insightObject: InfinityInsights.UpdateInsightRequestBody | LaunchpadRuntimeInsights.UpdateInsightRequestBody): Promise | Partial>>; /** * Delete an existing insight rule. * @function deleteInsight * @param insightID The ID of the insight rule to delete. * @returns Resolves to a response containing the ID of the insight which was deleted. * @private * * @example In the example below, the API deletes an existing insight rule and returns a Promise that resolves to a response containing the ID * const insightID = ""; * PCore.getAnalyticsUtils().deleteInsight(insightID).then(response => { console.log(response.data); }).catch(() => { ... }); */ export declare function deleteInsight(insightID: string): Promise; /** * Exports a table to an Excel file. * @function exportToExcel * @param exportRequest A payload object to configure an export * @param exportRequest.pyName Gives the exported table a name. * @param exportRequest.pyMode The type of export to perform ("excel", etc.) * @param exportRequest.pyClassName The class of the data to export. * @param exportRequest.pyReportTitle The name of the file to export. * @param exportRequest.pyContent A stringified JSON object containing table component metadata and state. * @returns Resolves to a base64 response that is the Excel file. * @private * * @example In the example below, the API returns a Promise that resolves to a base64 response (the Excel file). * const exportRequest = { * pyName: "Export", * pyMode: "excel", * pyClassName: "@baseclass", * pyReportTitle: "Insight1", * pyContent: JSON.stringify({ metadata, state }) * }; * PCore.getAnalyticsUtils().exportToExcel(exportRequest).then(response => { ... }).catch(() => { ... }); */ export declare function exportToExcel(exportRequest: { pyName: string; pyMode: string; pyClassName: string; pyReportTitle: string; pyContent: string; }): Promise>; /** * Exports a table to a CSV file. * @function exportToCSV * @param exportRequest A payload object to configure an export * @param exportRequest.pyName Gives the exported table a name. * @param exportRequest.pyMode The type of export to perform ("csv", etc.) * @param exportRequest.pyClassName The class of the data to export. * @param exportRequest.pyReportTitle The name of the file to export. * @param exportRequest.pyContent A stringified JSON object containing table component metadata and state. * @returns Resolves to a base64 response that is the Excel file. * @private * * @example In the example below, the API returns a Promise that resolves to a base64 response (the CSV file). * const exportRequest = { * pyName: "Export", * pyMode: "excel", * pyClassName: "@baseclass", * pyReportTitle: "Insight1", * pyContent: JSON.stringify({ metadata, state }) * }; * PCore.getAnalyticsUtils().exportToCSV(exportRequest).then(response => { ... }).catch(() => { ... }); */ export declare function exportToCSV(exportRequest: { pyName: string; pyMode: string; pyClassName: string; pyReportTitle: string; pyContent: string; }): Promise>; /** * Schedules a table insight as an Excel file. * @function scheduleInsight * @param insightID The ID of the insight related to the schedule * @param exportRequest A payload object to configure an export * @param exportRequest.pyName Gives the exported table a name. * @param exportRequest.pyMode The type of export to perform ("excel", etc.) * @param exportRequest.pyClassName The class of the data to export. * @param exportRequest.pyReportTitle The name of the file to export. * @param exportRequest.pyContent A stringified JSON object containing table component metadata and state. * @private * * @example In the example below, the API schedules an insight. * const exportRequest = { * pyName: "Export", * pyMode: "excel", * pyClassName: "@baseclass", * pyReportTitle: "Insight1", * pyContent: JSON.stringify({ metadata, state }) * }; * PCore.getAnalyticsUtils().scheduleInsight(exportRequest).then(response => { ... }).catch(() => { ... }); */ export declare const scheduleInsight: (insightID: string, exportRequest: { pyName: string; pyMode: string; pyClassName: string; pyReportTitle: string; pyContent: string; }) => Promise>; /** * Updates a scheduled table insight * @function updateScheduledInsight * @param insightID The ID of the insight related to the schedule * @param scheduleID The ID of the schedule being updated * @param exportRequest A payload object to configure an export * @param exportRequest.pyName Gives the exported table a name. * @param exportRequest.pyMode The type of export to perform ("excel", etc.) * @param exportRequest.pyClassName The class of the data to export. * @param exportRequest.pyReportTitle The name of the file to export. * @param exportRequest.pyContent A stringified JSON object containing table component metadata and state. * @param exportRequest.pyID Key for scheduled insight to update * @private * * @example In the example below, the API updates a scheduled insight. * const exportRequest = { * pyName: "Export", * pyMode: "excel", * pyClassName: "@baseclass", * pyReportTitle: "Insight 1", * pyContent: JSON.stringify({ metadata, state }) * pyID: 'W-8001' * }; * PCore.getAnalyticsUtils().updateScheduledInsight(insightID, scheduleID, exportRequest).then(response => { ... }).catch(() => { ... }); */ export declare const updateScheduledInsight: (insightID: string, scheduleID: string, exportRequest: { pyName: string; pyMode: string; pyClassName: string; pyReportTitle: string; pyContent: string; pyID: string; }) => Promise>; /** * Deletes a scheduled table insight * @function deleteScheduledInsight * @param insightID The ID of the insight related to the schedule * @param scheduleID The ID of the schedule being deleted * @private * * @example In the example below, the API deletes an insight. * PCore.getAnalyticsUtils().deleteScheduledInsight(insightId, scheduleID).then(response => { ... }).catch(() => { ... }); */ export declare const deleteScheduledInsight: (insightID: string, scheduleID: string) => Promise>; /** * Translates a list of strings. * @function translateStrings * @param stringsToTranslate A list of strings to translate. * @returns Resolves to a response containing a grouping of key/value pairs. * * @example In the example below, the API returns a Promise that resolves to a response containing a grouping of key/value pairs. * const stringsToTranslate = ["Hello", "Thank you"]; * PCore.getAnalyticsUtils().translateStrings(stringsToTranslate).then(response => { console.log(response.data); }).catch(() => { ... }); * // console output: { Hello: "Bonjour", "Thank you": "Merci" } */ export declare function translateStrings(stringsToTranslate: string): Promise; declare const _default: { getDataObjects: typeof getDataObjects; getDataPageObjects: typeof getDataPageObjects; getDataViewMetadata: typeof getDataViewMetadata; getDefaultColumns: typeof getDefaultColumns; getFieldsForDataSource: typeof getFieldsForDataSource; getPrimaryFieldsForDataSource: typeof getPrimaryFieldsForDataSource; getPrimaryFieldsForInsights: typeof getPrimaryFieldsForInsights; getInsightIDs: typeof getInsightIDs; getInsightByID: typeof getInsightByID; getInsightsByID: typeof getInsightsByID; createInsight: typeof createInsight; updateInsight: typeof updateInsight; deleteInsight: typeof deleteInsight; exportToExcel: typeof exportToExcel; exportToCSV: typeof exportToCSV; scheduleInsight: (insightID: string, exportRequest: { pyName: string; pyMode: string; pyClassName: string; pyReportTitle: string; pyContent: string; }) => Promise>; updateScheduledInsight: (insightID: string, scheduleID: string, exportRequest: { pyName: string; pyMode: string; pyClassName: string; pyReportTitle: string; pyContent: string; pyID: string; }) => Promise>; deleteScheduledInsight: (insightID: string, scheduleID: string) => Promise>; translateStrings: typeof translateStrings; }; export default _default;