@legalplace/prerenderx 2.5.7 → 2.6.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/prerenderx",
3
- "version": "2.5.7",
3
+ "version": "2.6.1",
4
4
  "description": "PrerenderX",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://git.legalplace.eu/legalplace/prerenderx",
@@ -34,8 +34,6 @@ type FDFType = {
34
34
  }
35
35
 
36
36
  class Prerender {
37
- private model: ModelV3
38
-
39
37
  private references: Types.ReferencesType
40
38
 
41
39
  private ovc: OVC_TYPE
@@ -52,19 +50,20 @@ class Prerender {
52
50
 
53
51
  private renderedDocuments: Record<string, string | FDFType> = {}
54
52
 
55
- constructor(model: ModelV3, ovc: OVC_TYPE | OldOVC) {
56
- this.model = model
53
+ constructor(entry: ModelV3 | Types.ReferencesType, ovc: OVC_TYPE | OldOVC) {
54
+ // Initiating references
55
+ if (ReferencesParser.isReferences(entry)) {
56
+ this.references = entry
57
+ } else {
58
+ // Parsing references
59
+ this.references = new ReferencesParser(entry).getReferences()
60
+ }
57
61
 
58
62
  // Initiating num auto
59
63
  this.NumAuto = new NumAuto()
60
64
 
61
- // Parsing references
62
- this.references = new ReferencesParser(model).getReferences()
63
-
64
65
  // Converting OVC if needed
65
- this.ovc = OvcConverter.isOvc(ovc)
66
- ? OvcConverter.convertToOptionsVariables(ovc, this.references)
67
- : ovc
66
+ this.ovc = OvcConverter.isOvc(ovc) ? OvcConverter.convertToOptionsVariables(ovc, this.references) : ovc
68
67
 
69
68
  // Initiating inputs
70
69
  const inputs = new IntputsInitiator(this.references, this.ovc).getInputs()
@@ -92,9 +91,9 @@ class Prerender {
92
91
  }
93
92
 
94
93
  private generateDocumentNamesHash() {
95
- Object.keys(this.model.documents).forEach(slug => {
96
- const document = this.model.documents[slug]
97
- const documentParams = this.model.documents[slug].params
94
+ Object.keys(this.references.documents).forEach(slug => {
95
+ const document = this.references.documents[slug]
96
+ const documentParams = this.references.documents[slug].params
98
97
  const conditionObject = this.references.conditions.documents[slug]
99
98
  const condition = conditionObject === undefined ? true : this.conditions.executeCondition(conditionObject, 0, 0, 'documents')
100
99