diff --git a/anet-dictionary.yml b/anet-dictionary.yml index d37183e146..3d2bc5af04 100644 --- a/anet-dictionary.yml +++ b/anet-dictionary.yml @@ -754,7 +754,7 @@ fields: - recurrence: quarterly questions: test1: - test: $.subject.position.organization.[?(@property === "identificationCode" && @.match(/^Z/i))] + test: $.subject.position.organization[?(@property === "identificationCode" && @.match(/^Z/i))] type: enum label: Test question 1 choices: @@ -768,7 +768,7 @@ fields: label: three color: '#ff8279' test2: - test: $.subject.position.organization.[?(@property === "identificationCode" && @.match(/^Z/i))] + test: $.subject.position.organization[?(@property === "identificationCode" && @.match(/^Z/i))] type: enum label: Test question 2 choices: @@ -782,7 +782,7 @@ fields: label: five color: '#c2ffb3' test3: - test: $.subject.position.organization.[?(@property === "identificationCode" && @.match(/^Z/i))] + test: $.subject.position.organization[?(@property === "identificationCode" && @.match(/^Z/i))] type: enum label: Test question 3 choices: @@ -818,7 +818,7 @@ fields: label: high color: '#ff8279' question2: - test: $.subject.position.organization.[?(@property === "identificationCode" && @.match(/^P/i))] + test: $.subject.position.organization[?(@property === "identificationCode" && @.match(/^P/i))] type: enumset label: Attendee from P org choices: @@ -826,7 +826,7 @@ fields: label: P color: '#ff0000' question3: - test: $.subject.position.organization.[?(@property === "identificationCode" && @.match(/^Z/i))] + test: $.subject.position.organization[?(@property === "identificationCode" && @.match(/^Z/i))] type: enumset label: Attendee from Z org choices: @@ -834,7 +834,7 @@ fields: label: Z color: '#00ff00' question4: - test: $.relatedObject.[?(@property === "atmosphere" && @ === "POSITIVE")] + test: $.relatedObject[?(@property === "atmosphere" && @ === "POSITIVE")] type: enumset label: Report had POSITIVE atmosphere choices: diff --git a/client/package.json b/client/package.json index 8ec03fb9bf..30a1435407 100644 --- a/client/package.json +++ b/client/package.json @@ -134,7 +134,7 @@ "graphql": "15.5.0", "hopscotch": "0.3.1", "html-react-parser": "1.2.3", - "jsonpath-plus": "4.0.0", + "jsonpath-plus": "5.0.3", "leaflet": "1.6.0", "leaflet-defaulticon-compatibility": "0.1.1", "leaflet-geosearch": "3.2.1", diff --git a/client/src/components/CustomFields.js b/client/src/components/CustomFields.js index 9d6990c79a..4edbbf381b 100644 --- a/client/src/components/CustomFields.js +++ b/client/src/components/CustomFields.js @@ -685,7 +685,8 @@ export function getInvisibleFields( Object.entries(fieldsConfig).forEach(([key, fieldConfig]) => { const visibleWhenPath = fieldConfig.visibleWhen const isVisible = - !visibleWhenPath || !_isEmpty(JSONPath(visibleWhenPath, formikValues)) + !visibleWhenPath || + !_isEmpty(JSONPath({ path: visibleWhenPath, json: formikValues })) const fieldName = `${parentFieldName}.${key}` diff --git a/client/src/components/Model.js b/client/src/components/Model.js index a42da5fd18..ff7dc07d6b 100644 --- a/client/src/components/Model.js +++ b/client/src/components/Model.js @@ -609,7 +609,8 @@ export default class Model { Object.entries(assessmentConfig) .filter( ([key, question]) => - !question.test || !_isEmpty(JSONPath(question.test, testValue)) + !question.test || + !_isEmpty(JSONPath({ path: question.test, json: testValue })) ) .forEach(([key, question]) => { filteredAssessmentConfig[key] = question diff --git a/client/yarn.lock b/client/yarn.lock index f176fcb093..20537ba1c5 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -7990,7 +7990,6 @@ extsprintf@^1.2.0: "faker@https://github.com/Marak/faker.js.git": version "5.2.0" - uid "72fb83d66f275b8337406cc5cbaa29f4ac32b91a" resolved "https://github.com/Marak/faker.js.git#72fb83d66f275b8337406cc5cbaa29f4ac32b91a" fast-deep-equal@^2.0.1: @@ -10847,10 +10846,10 @@ jsonfile@^6.0.1: optionalDependencies: graceful-fs "^4.1.6" -jsonpath-plus@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-4.0.0.tgz#954b69faa3d8b07f30ae2f9e601176a4b0d2806e" - integrity sha512-e0Jtg4KAzDJKKwzbLaUtinCn0RZseWBVRTRGihSpvFlM3wTR7ExSp+PTdeTsDrLNJUe7L7JYJe8mblHX5SCT6A== +jsonpath-plus@5.0.3: + version "5.0.3" + resolved "https://registry.yarnpkg.com/jsonpath-plus/-/jsonpath-plus-5.0.3.tgz#502f0fc953d0f92428b2c2357c0c6809a803ec36" + integrity sha512-RDvpzY21CmKTvEfxuGqQmPqRTuzNOim7L+/TcsdBM8jguI5ok38t0p2eKr9GAsVkazrTyylpMZV/hKSQCWqx9g== jsprim@^1.2.2: version "1.4.1"