@legalplace/tagextractor 1.1.8 → 1.2.0
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/dist/libs/Extractor.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ModelV3 } from '@legalplace/models-v3-types';
|
|
2
|
+
import { ReferencesType } from '@legalplace/referencesparser/dist/libs/References.type';
|
|
2
3
|
import InputsType from '../types/inputs.type';
|
|
3
4
|
import OvcType from '../types/ovc.type';
|
|
4
5
|
import TagsType from '../types/tags.type';
|
|
@@ -7,7 +8,8 @@ declare class TagExtractor {
|
|
|
7
8
|
private inputs;
|
|
8
9
|
private conditionsRunner;
|
|
9
10
|
private tags;
|
|
10
|
-
|
|
11
|
+
private isReferencesType;
|
|
12
|
+
constructor(modelOrReferences: ModelV3 | ReferencesType, ovc: OvcType | InputsType);
|
|
11
13
|
get getTags(): TagsType;
|
|
12
14
|
private extractFromOptions;
|
|
13
15
|
private extractFromVariables;
|
package/dist/libs/Extractor.js
CHANGED
|
@@ -14,12 +14,15 @@ var referencesparser_1 = require("@legalplace/referencesparser");
|
|
|
14
14
|
var ConditionsRunner_1 = __importDefault(require("./ConditionsRunner"));
|
|
15
15
|
var OvcConverter_1 = __importDefault(require("./OvcConverter"));
|
|
16
16
|
var TagExtractor = (function () {
|
|
17
|
-
function TagExtractor(
|
|
17
|
+
function TagExtractor(modelOrReferences, ovc) {
|
|
18
18
|
this.tags = {
|
|
19
19
|
options: {},
|
|
20
20
|
variables: {}
|
|
21
21
|
};
|
|
22
|
-
this.
|
|
22
|
+
this.isReferencesType = function (_obj) {
|
|
23
|
+
return Object.keys(_obj).some(function (key) { return key === 'boxes'; });
|
|
24
|
+
};
|
|
25
|
+
this.references = this.isReferencesType(modelOrReferences) ? modelOrReferences : new referencesparser_1.ReferencesParser(modelOrReferences).references;
|
|
23
26
|
this.inputs = OvcConverter_1.default.isOptionsVariables(ovc) ? ovc : OvcConverter_1.default.convertToOptionsVariables(ovc, this.references);
|
|
24
27
|
this.conditionsRunner = new ConditionsRunner_1.default(this.references, this.inputs);
|
|
25
28
|
this.extractFromOptions();
|
package/package.json
CHANGED
package/src/libs/Extractor.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ModelV3 } from '@legalplace/models-v3-types'
|
|
2
2
|
import { ReferencesParser, Types } from '@legalplace/referencesparser'
|
|
3
|
+
import { ReferencesType } from '@legalplace/referencesparser/dist/libs/References.type'
|
|
3
4
|
import InputsType from '../types/inputs.type'
|
|
4
5
|
import OvcType from '../types/ovc.type'
|
|
5
6
|
import TagsType from '../types/tags.type'
|
|
@@ -18,9 +19,13 @@ class TagExtractor {
|
|
|
18
19
|
variables: {}
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
//
|
|
23
|
-
|
|
22
|
+
private isReferencesType = (_obj: ModelV3 | ReferencesType): _obj is ReferencesType => {
|
|
23
|
+
// We check if the object contains one of the fields only contained in ReferencesType
|
|
24
|
+
return Object.keys(_obj).some(key => key === 'boxes')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
constructor(modelOrReferences: ModelV3 | ReferencesType, ovc: OvcType | InputsType) {
|
|
28
|
+
this.references = this.isReferencesType(modelOrReferences) ? modelOrReferences : new ReferencesParser(modelOrReferences).references
|
|
24
29
|
|
|
25
30
|
// Converting inputs if needed
|
|
26
31
|
this.inputs = OvcConverter.isOptionsVariables(ovc) ? ovc : OvcConverter.convertToOptionsVariables(ovc, this.references)
|