@legalplace/tagextractor 2.4.14 → 2.4.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.4.16](https://git.legalplace.eu/legalplace/tagextractor/compare/@legalplace/tagextractor@2.4.15...@legalplace/tagextractor@2.4.16) (2022-12-14)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * adding InputsInitiator to constructor of tagExtractor ([88b5b59](https://git.legalplace.eu/legalplace/tagextractor/commits/88b5b59b796ab89f9fcd61a114328079786d58fc)), closes [api#6881](https://git.legalplace.eu/api/issues/6881)
12
+ * update tests ([b200c3f](https://git.legalplace.eu/legalplace/tagextractor/commits/b200c3f96d477569ac7ed26b143a739bc96f9fc0)), closes [api#6881](https://git.legalplace.eu/api/issues/6881)
13
+
14
+
15
+
16
+
17
+
18
+ ## [2.4.15](https://git.legalplace.eu/legalplace/tagextractor/compare/@legalplace/tagextractor@2.4.14...@legalplace/tagextractor@2.4.15) (2022-12-13)
19
+
20
+ **Note:** Version bump only for package @legalplace/tagextractor
21
+
22
+
23
+
24
+
25
+
6
26
  ## [2.4.14](https://git.legalplace.eu/legalplace/tagextractor/compare/@legalplace/tagextractor@2.4.13...@legalplace/tagextractor@2.4.14) (2022-12-12)
7
27
 
8
28
  **Note:** Version bump only for package @legalplace/tagextractor
@@ -16,9 +16,8 @@ class TagExtractor {
16
16
  this.references = this.isReferencesType(modelOrReferences)
17
17
  ? modelOrReferences
18
18
  : new referencesparser_1.ReferencesParser(modelOrReferences).references;
19
- this.inputs = ovc_converter_1.default.isOptionsVariables(ovc)
20
- ? ovc
21
- : ovc_converter_1.default.convertToOptionsVariables(ovc, this.references);
19
+ const dirtyInputs = ovc_converter_1.default.isOptionsVariables(ovc) ? ovc : ovc_converter_1.default.convertToOptionsVariables(ovc, this.references);
20
+ this.inputs = new referencesparser_1.InputsInitiator(this.references, dirtyInputs).getInputs();
22
21
  this.conditionsRunner = new conditions_runner_1.default(this.references, this.inputs);
23
22
  this.extractFromOptions();
24
23
  this.extractFromVariables();
@@ -67,13 +67,13 @@ describe("TagsExtractor", () => {
67
67
  expect(tagExtractor.isOptionDisplayed(24, 0)).toBeFalsy();
68
68
  expect(getOptionCondition).toHaveBeenCalledWith(24, 0);
69
69
  });
70
- it("should return false when parentsInputs list contains false value", () => {
70
+ it("should return true when it's a static option", () => {
71
71
  const inputsWithParentsInputsFalse = {
72
72
  ...simpleInputs,
73
- options: { ...simpleInputs.options, "6": [false] },
73
+ options: { ...simpleInputs.options, "6": [true] },
74
74
  };
75
75
  const customTagExtractor = new Extractor_1.default(simpleReferences, inputsWithParentsInputsFalse);
76
- expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeFalsy();
76
+ expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeTruthy();
77
77
  });
78
78
  it("should not return errors when parentsInputs is undefined", () => {
79
79
  const inputsWithParentsInputsUndefined = {
@@ -82,7 +82,7 @@ describe("TagsExtractor", () => {
82
82
  };
83
83
  delete inputsWithParentsInputsUndefined.options["6"];
84
84
  const customTagExtractor = new Extractor_1.default(simpleReferences, inputsWithParentsInputsUndefined);
85
- expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeFalsy();
85
+ expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeTruthy();
86
86
  });
87
87
  it("should return true when all checks are okay", () => {
88
88
  expect(tagExtractor.isOptionDisplayed(24, 0)).toBeTruthy();
@@ -142,7 +142,7 @@ describe("TagsExtractor", () => {
142
142
  const customTagExtractor = new Extractor_1.default(simpleReferences, inputsWithoutOptionTaggedAnswer);
143
143
  expect(customTagExtractor.getTags.options).toMatchObject({});
144
144
  });
145
- it("should return option tag when champ multiples", () => {
145
+ it("should return option tag when static champ multiples", () => {
146
146
  const inputWithChampMultiple = {
147
147
  ...simpleInputs,
148
148
  options: { ...simpleInputs.options, "7": [true, false] },
@@ -164,7 +164,7 @@ describe("TagsExtractor", () => {
164
164
  label: "Connaissiez-vous déjà LegalPlace ?",
165
165
  condition: true,
166
166
  visible: true,
167
- value: false,
167
+ value: true,
168
168
  },
169
169
  ],
170
170
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/tagextractor",
3
- "version": "2.4.14",
3
+ "version": "2.4.16",
4
4
  "description": "TagExtractor",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://git.legalplace.eu/legalplace/tagextractor",
@@ -17,11 +17,11 @@
17
17
  "test:coverage": "jest test --coverage --watchAll=false "
18
18
  },
19
19
  "dependencies": {
20
- "@legalplace/conditions-runner": "^1.1.21",
20
+ "@legalplace/conditions-runner": "^1.1.22",
21
21
  "@legalplace/lplogic": "2.1.6",
22
22
  "@legalplace/models-v3-types": "3.8.0",
23
- "@legalplace/ovc-converter": "^1.1.20",
24
- "@legalplace/referencesparser": "1.9.0"
23
+ "@legalplace/ovc-converter": "^1.1.21",
24
+ "@legalplace/referencesparser": "2.2.0"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@legalplace/eslint-config": "^2.1.3",
@@ -43,5 +43,5 @@
43
43
  "typescript": "4.5.2"
44
44
  },
45
45
  "prettier": "@legalplace/prettier-config",
46
- "gitHead": "5d816467992c5b6b51726b445c08c193bfdecd23"
46
+ "gitHead": "9ca00a5dd3d041d119d591d5c903284812c6a5d4"
47
47
  }
@@ -101,17 +101,17 @@ describe("TagsExtractor", () => {
101
101
  expect(tagExtractor.isOptionDisplayed(24, 0)).toBeFalsy();
102
102
  expect(getOptionCondition).toHaveBeenCalledWith(24, 0);
103
103
  });
104
- it("should return false when parentsInputs list contains false value", () => {
104
+ it("should return true when it's a static option", () => {
105
105
  const inputsWithParentsInputsFalse = {
106
106
  ...simpleInputs,
107
- options: { ...simpleInputs.options, "6": [false] },
107
+ options: { ...simpleInputs.options, "6": [true] },
108
108
  };
109
109
  const customTagExtractor = new TagExtractor(
110
110
  simpleReferences,
111
111
  inputsWithParentsInputsFalse
112
112
  );
113
113
 
114
- expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeFalsy();
114
+ expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeTruthy();
115
115
  });
116
116
  it("should not return errors when parentsInputs is undefined", () => {
117
117
  const inputsWithParentsInputsUndefined = {
@@ -124,7 +124,7 @@ describe("TagsExtractor", () => {
124
124
  inputsWithParentsInputsUndefined
125
125
  );
126
126
 
127
- expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeFalsy();
127
+ expect(customTagExtractor.isOptionDisplayed(24, 0)).toBeTruthy();
128
128
  });
129
129
  it("should return true when all checks are okay", () => {
130
130
  expect(tagExtractor.isOptionDisplayed(24, 0)).toBeTruthy();
@@ -198,7 +198,7 @@ describe("TagsExtractor", () => {
198
198
 
199
199
  expect(customTagExtractor.getTags.options).toMatchObject({});
200
200
  });
201
- it("should return option tag when champ multiples", () => {
201
+ it("should return option tag when static champ multiples", () => {
202
202
  const inputWithChampMultiple = {
203
203
  ...simpleInputs,
204
204
  options: { ...simpleInputs.options, "7": [true, false] },
@@ -223,7 +223,7 @@ describe("TagsExtractor", () => {
223
223
  label: "Connaissiez-vous déjà LegalPlace ?",
224
224
  condition: true,
225
225
  visible: true,
226
- value: false,
226
+ value: true,
227
227
  },
228
228
  ],
229
229
  };
@@ -1,5 +1,10 @@
1
- import { ModelV3 } from "@legalplace/models-v3-types";
2
- import { ReferencesParser, Types } from "@legalplace/referencesparser";
1
+ /* eslint-disable */
2
+ import { ModelV3 } from "@legalplace/models-v3-types"
3
+ import {
4
+ ReferencesParser,
5
+ Types,
6
+ InputsInitiator,
7
+ } from "@legalplace/referencesparser";
3
8
  import ConditionsRunner from "@legalplace/conditions-runner";
4
9
  import OvcConverter from "@legalplace/ovc-converter";
5
10
  import type InputsType from "@legalplace/types/dist/inputs";
@@ -33,11 +38,15 @@ class TagExtractor {
33
38
  : new ReferencesParser(modelOrReferences).references;
34
39
 
35
40
  // Converting inputs if needed
36
- this.inputs = OvcConverter.isOptionsVariables(ovc)
37
- ? ovc
38
- : OvcConverter.convertToOptionsVariables(ovc, this.references);
41
+ // TODO to remove after ts-ignore et update references package on ovc-converter et conditions-runner packages
42
+ // @ts-ignore
43
+ const dirtyInputs = OvcConverter.isOptionsVariables(ovc) ? ovc : OvcConverter.convertToOptionsVariables(ovc, this.references);
39
44
 
45
+ // Initiating inputs
46
+ this.inputs = new InputsInitiator(this.references, dirtyInputs).getInputs();
40
47
  // Initiaing Conditions runner
48
+ // TODO to remove after ts-ignore et update references package on ovc-converter et conditions-runner packages
49
+ // @ts-ignore
41
50
  this.conditionsRunner = new ConditionsRunner(this.references, this.inputs);
42
51
 
43
52
  // Extracting tags from options