/** * The DataApiUtils module contains utility APIs to retrieve information from data views. * @module DataApiUtils */ import type { AxiosResponse } from 'axios'; import type { Parameters } from '../datapage/types'; import type { DataOptions, DataResponse, ChangeSet, MoveListRecordsPayload, Payload } from './types'; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This function helps in fetching the data of a list type data view. * @ignore * @param dataViewName - name of the data view. * @param payload - query object containing information about the list of columns, filters and pagination. * @param context - context name eq., primary * @param options - object containing extra information like skipClearErrorMessages to not clear the error messages */ export declare const getListDataView: (dataViewName: string, payload?: Payload, context?: string, options?: DataOptions) => Promise; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This function helps in fetching the view metadata of an object initialized through a data page. * @param dataViewName - The name of the view that contains the data of the object * @param viewName - name of the view. * @param dataViewParams - object that will set parameters to the data view * @param context - context name eq., primary * @param options - object containing extra information like skipClearErrorMessages to not clear the error messages * * * * @example In the example below, the API retrieves the the Glimpse of an operator. * * const dataViewName = "D_pyOperatorGlimpse"; * const viewName = "pyGlimpse"; * const dataViewParams = { opname: "joe" }; * const context = "app/primary_1"; * PCore.getDataApiUtils().getDataObjectView(dataViewName, viewName, dataViewParams, context) * .then(response => { * //The response of this API is as shown below: * { * fetchDateTime: "2020-06-29T11:06:23.896Z" * data: { uiResources: { ... }, data: { ... } } * } * }) * .catch(error => { * console.log(error); * }); * * @returns response object */ export declare const getDataObjectView: (dataViewName: string, viewName: string, dataViewParams: Parameters, context: string, options?: DataOptions) => Promise>; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This API obtains the number of records in a data view as a Promise. * @param dataViewName - The name of the data view that contains the records whose count must be obtained. * @param payload - A query object containing the details of list of columns, filter conditions, and pagination to be retrieved. * @param context - The name of the context where the API is being called. * * @example In the example below, the API retrieves the number of records of employees whose gender is 'Female' and whose role is 'Finance'. * * const dataViewName = "D_EmployeeList"; * const payLoad = { * "dataViewParameters": { * "dept": "HR" * }, * "query": { * "distinctResultsOnly": true, * "filter": { * "filterConditions": { * "F1": { * "comparator": "EQ", * "ignoreCase": true, * "lhs": { * "field": "Role" * }, * "rhs": { * "value": "Finance" * } * }, * "F2": { * "comparator": "EQ", * "ignoreCase": true, * "lhs": { * "field": "Gender" * }, * "rhs": { * "value": "Female" * } * } * }, * "logic": "F1 AND F2" * } * "select": [ * { * "field": "pyID" * } * ] * } * }; * const context = "app/primary_1"; * PCore.getDataApiUtils().getListCount(dataViewName, payload, context) * .then(response => { * //The response of this API is as shown below: * { * fetchDateTime: "2020-06-29T11:06:23.896Z" * hasMoreResults: false * resultCount: 4923 * } * }) * .catch(error => { * console.log(error); * }); * * * @returns response object */ export declare const getListCount: (dataViewName: string, payload?: Payload, context?: string) => Promise>; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This API retrieves the list of data records in a data view as a Promise. * @param dataViewName - The name of the data view from which the list of data records must be retrieved. * @param payload A query object containing the details of list of columns, filter conditions, and pagination to be retrieved. * @param context - The name of the context where the API is being called. * @param options - object containing extra information like skipClearErrorMessages * @example In the example below, the API retrieves the first 10 records of employees whose gender is 'Male' and whose role is 'Software'. * * const dataViewName = "D_EmployeeList"; * const payLoad = { * "dataViewParameters": { "dept": "Engineering" }, "query": { "distinctResultsOnly": true, "filter": { "filterConditions": { "F1": { "comparator": "EQ", "ignoreCase": true, "lhs": { "field": "Role" }, "rhs": { "value": "Software" } }, "F2": { "comparator": "EQ", "ignoreCase": true, "lhs": { "field": "Gender" }, "rhs": { "value": "Male" } } }, "logic": "F1 AND F2" } "select": [ { "field": "Name" }, { "field": "Role" }, { "field": "Gender" } ] }, "paging":{ "pageNumber":1, "pageSize":10 } }; * const context = "app/primary_1"; * PCore.getDataApiUtils().getData(dataViewName, payload, context) * .then(response => { * // The response of this API is as shown below: * { * data: [ * { * "Name" : "Mark wood", * "Role" : "Software", * "Gender" "Male" * }, * { * "Name" : "Edwards", * "Role" : "Software", * "Gender" "Male" * } * ] * fetchDateTime: "2020-06-29T11:06:24.329Z" * pageNumber: 1 * pageSize: 10 * } * }) * .catch(error => { * console.log(error); * }); * * * @returns response object */ export declare const getData: (dataViewName: string, payload?: Payload, context?: string, options?: DataOptions) => Promise; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This API obtains the metadata of a data view as a Promise. * @param dataViewName - The name of the data view whose metadata must be obtained. * @param context - context name eq., primary * @param associationFilter - List of simple/complex associations to fetch the fields from * @param propertyFilter - List of field IDs to which the response should be limited to * * @example In the example below, the API returns the metadata of the data view whose name is 'D_BugList'. * * const dataViewName = "D_BugList" * PCore.getDataApiUtils().getDataViewMetadata(dataViewName); * * //The response of this api will be like shown below. * { "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 const getDataViewMetadata: (dataViewName: string, context: string | undefined, associationFilter?: string[] | null, propertyFilter?: string[]) => Promise>; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This API returns a promise which when resolved returns edit metadata of a case. * @param caseID - The caseID on which edit is being performed * @param context - context name eq., primary * @example In the example below, the API returns the edit metadata o a case. * * const caseID = "METORG-VEHICLEMANAGER-WORK V-7222"; * const viewType = "form" * PCore.getDataApiUtils().getCaseEditMetadata(caseID, viewType); * * //The response of this api will be like shown below. * { * uiResources: {}, * data: { * caseInfo: { "caseTypeID": "MetOrg-VehicleManager-Work-VehiclePurchase", "owner": "abc@xyz.com", "availableActions": [], "lastUpdatedBy": "abc@xyz.com", "sla": {}, "content": { "classID": "MetOrg-VehicleManager-Work-VehiclePurchase", "VehicleUsage": "", "Year": "2013", "VehicleType": "e7faf92e-e6b0-4793-b59f-e406a2abdb75", "NeededBy": "20200605T181445.999 GMT", "Model": "458 Italia", "Make": "Ferrari", "RequestingDepartment": "52724c8d-54b9-4819-851d-3765098adebb" }, "createdBy": "abc@xyz.com", "createTime": "2020-05-28T20:05:41.235Z", "urgency": "10", "name": "2013 Ferrari 458 ITALIA", "stages": [], "ID": "METORG-VEHICLEMANAGER-WORK V-7222", "lastUpdateTime": "2020-05-28T20:05:41.541Z", "stageID": "PRIM3", "stageLabel": "Delivery", "status": "New" * } * } * } * * @deprecated to be removed */ export declare const getCaseEditMetadata: (caseID: string, context: string) => Promise>; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This API returns a promise which when resolved indicates that acquiring the lock of the case is successful. * @param caseID - The caseID (or pzInsKey) to which the lock has to be acquired. * @param context - context name eq., primary * * @example In the example below, the API returns the successful lock to edit the case. * * const caseID = "METORG-VEHICLEMANAGER-WORK V-7222"; * const viewType = "page"; * PCore.getDataApiUtils().getCaseEditLock(caseID, viewType); * * // The response of this api will be like shown below. * { * uiResources: {}, * data: {} * } * * Having above structure in the response indicates successfull lock acquiring. * * @deprecated to be removed */ export declare const getCaseEditLock: (caseID: string, context: string) => Promise>; /** * Note: The terms data page and data view used in context of this API are interchangeable. * This API returns a promise which when resolved indicates that updation of the case data is successful. * @param caseID - The caseID (or pzInsKey) to which the lock has been acquired. * @param changeSet - The object which holds the updated details in the case. * @param eTag - PCore.getDataApiUtils().getCaseEditLock(caseID, viewType) response headers contain the "etag" header, and pass that value as eTag here. * @param context - context name eq., primary * @example In the example below, the API returns the object indicating successful updation of case data. * * const caseID = "METORG-VEHICLEMANAGER-WORK V-7222"; * const changeSet = { "METORG-VEHICLEMANAGER-WORK V-7222": { Make: "New Value" } }; * const eTag = "20200831T114802.686 GMT"; * PCore.getDataApiUtils().updateCaseEditFieldsData(caseID, changeSet, eTag); * * // The response of this api will be like shown below. * { * uiResources: {}, * data: {} * } * * Having above structure in the response indicates successfull lock acquiring. * { "data": { "caseInfo": { "caseTypeID": "MetOrg-VehicleManager-Work-VehiclePurchase", "owner": "reactuser", "availableActions": [], "lastUpdatedBy": "user5", "assignments": [], "sla": {}, "createdBy": "reactuser", "createTime": "2020-06-08T12:10:08.813Z", "urgency": "10", "name": "Vehicle Purchase", "stages": [], "ID": "METORG-VEHICLEMANAGER-WORK V-10001", "lastUpdateTime": "2020-09-01T05:52:54.225Z", "stageID": "PRIM5", "stageLabel": "Request", "status": "New" } }, "confirmationNote": "Thank you! The next step in this case has been routed appropriately." } * * @deprecated to be removed */ export declare const updateCaseEditFieldsData: (caseID: string, changeSet: ChangeSet, eTag: string, context: string) => Promise>; declare const _default: { getData: (dataViewName: string, payload?: Payload, context?: string, options?: DataOptions) => Promise; getListCount: (dataViewName: string, payload?: Payload, context?: string) => Promise>; getDataViewMetadata: (dataViewName: string, context: string | undefined, associationFilter?: string[] | null, propertyFilter?: string[]) => Promise>; getDataObjectView: (dataViewName: string, viewName: string, dataViewParams: Parameters, context: string, options?: DataOptions) => Promise>; getCaseEditMetadata: (caseID: string, context: string) => Promise>; getCaseEditLock: (caseID: string, context: string) => Promise>; updateCaseEditFieldsData: (caseID: string, changeSet: ChangeSet, eTag: string, context: string) => Promise>; moveListRecords: (payload: MoveListRecordsPayload, reduxContext: string) => Promise>; isTimeElapsed: (loadTime: string, timeoutSecs: number, type?: string) => boolean; getAppCacheKey: (initialKey: string) => string; isDistinctResultsOnly: (select: { field: string; }[]) => boolean; }; export default _default;