update jsonpath library

This commit is contained in:
2024-02-08 14:28:40 +00:00
parent f034f4be3d
commit 2af463fbe9
67 changed files with 961 additions and 966 deletions
+22 -22
View File
@@ -1,4 +1,4 @@
import jsonpath from "jsonpath";
import { JSONPath as jsonpath } from "jsonpath-plus";
import { v4 as uuidv4 } from "uuid";
import data from "../../data/collections.json";
import {
@@ -14,43 +14,43 @@ import xpath from "xpath";
* @param String formtype - string from appeal entity name
*/
export const getFormCollection = (formtype) => {
const collectionName = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + formtype + "')]"
const collectionName = jsonpath(
"$..[?(@.LogicalName=='" + formtype + "')]",
data
);
return collectionName[0];
};
export const getFormCollectionByID = (appealTypeID) => {
const collectionName = jsonpath.query(
data,
"$..[?(@.appealTypeID =='" + appealTypeID + "')]"
const collectionName = jsonpath(
"$..[?(@.appealTypeID =='" + appealTypeID + "')]",
data
);
return collectionName[0];
};
export const getPickListLabel = (data, picklistType, picklistID) => {
const pickListData = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + picklistType + "')]"
const pickListData = jsonpath(
"$..[?(@.LogicalName=='" + picklistType + "')]",
data
);
const pickListLabel = jsonpath.query(
pickListData,
"$..[?(@.Value=='" + picklistID + "')].Label.LocalizedLabels..Label"
const pickListLabel = jsonpath(
"$..[?(@.Value=='" + picklistID + "')].Label.LocalizedLabels..Label",
pickListData
);
return pickListLabel[0];
};
export const getRadioLabel = (data, radiotListName, radioListID) => {
const radioListData = jsonpath.query(
data,
"$..[?(@.LogicalName=='" + radiotListName + "')]"
const radioListData = jsonpath(
"$..[?(@.LogicalName=='" + radiotListName + "')]",
data
);
const pickListLabel = jsonpath.query(
radioListData,
"$..[?(@.Value=='" + radioListID + "')].Label.LocalizedLabels..Label"
const pickListLabel = jsonpath(
"$..[?(@.Value=='" + radioListID + "')].Label.LocalizedLabels..Label",
radioListData
);
return pickListLabel[0];
};
@@ -294,11 +294,11 @@ export const getProgressObj = (
dateEnd = !_.isEmpty(dateEnd) && dateEnd[0].value;
const isRequiredField = jsonpath.query(
mandatoryFieldsData,
const isRequiredField = jsonpath(
"$..value[?(@.LogicalName=='" +
datafieldname[0].value +
"')]"
"')]",
mandatoryFieldsData
);
if (datafieldname[0].value == "pinswg_fileUpload") {