@legalplace/prerenderx 3.7.17 → 3.8.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/CHANGELOG.md +11 -0
- package/dist/index.js +5 -1
- package/dist/libs/FillPdfForm.d.ts +1 -1
- package/dist/libs/FillPdfForm.js +2 -2
- package/dist/libs/InputsInitiator.d.ts +2 -2
- package/dist/libs/OutputParser.d.ts +5 -5
- package/dist/libs/OutputParser.js +13 -13
- package/dist/libs/misc/FillPdfFormBase.js +1 -1
- package/dist/types/types.d.ts +4 -4
- package/package.json +6 -6
- package/tsconfig.json +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [3.8.0](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.7.17...@legalplace/prerenderx@3.8.0) (2026-02-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* update typeorm typescript eslint ([17c8ba4](https://git.legalplace.eu/legalplace/prerenderx/commits/17c8ba48c1351ee18df6fc07988453f05e74e303)), closes [api#86c4](https://git.legalplace.eu/api/issues/86c4)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [3.7.17](https://git.legalplace.eu/legalplace/prerenderx/compare/@legalplace/prerenderx@3.7.16...@legalplace/prerenderx@3.7.17) (2026-02-02)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @legalplace/prerenderx
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/libs/FillPdfForm.js
CHANGED
|
@@ -37,11 +37,11 @@ var FillPdfForm = (function (_super) {
|
|
|
37
37
|
var form = pdf.form;
|
|
38
38
|
result.id = pdf.id;
|
|
39
39
|
form.inputs.forEach(function (input) {
|
|
40
|
-
var id = ""
|
|
40
|
+
var id = "".concat(input.name);
|
|
41
41
|
result.fields[id] = _this.getInputValue(input);
|
|
42
42
|
});
|
|
43
43
|
form.boxes.forEach(function (box) {
|
|
44
|
-
var id = ""
|
|
44
|
+
var id = "".concat(box.name);
|
|
45
45
|
var value = _this.getBoxValue(box);
|
|
46
46
|
if (!(value === "" &&
|
|
47
47
|
Object.prototype.hasOwnProperty.call(result.fields, id)))
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Types } from "@legalplace/referencesparser";
|
|
2
2
|
import type InputsType from "@legalplace/types/dist/inputs";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
type relVarsValsT = Record<string, string | number>;
|
|
4
|
+
type getRelatedVarsT = (optionId: number, index: number, variables: number[], ovc: InputsType, references: Types.ReferencesType) => relVarsValsT;
|
|
5
5
|
export declare const getRelatedVariablesValues: getRelatedVarsT;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
type autonumsType = [string, string, number, string | null][];
|
|
7
|
+
type parseOutputT = (output: string, index: number, variables: relVarsValsT, autonums: autonumsType) => string;
|
|
8
8
|
export declare const parseOutputWithVariables: parseOutputT;
|
|
9
|
-
|
|
9
|
+
type TParseDocumentNameWithVariables = (text: string, ovc: InputsType, references: Types.ReferencesType, fallback?: string) => string;
|
|
10
10
|
export declare const parseDocumentNameWithVariables: TParseDocumentNameWithVariables;
|
|
11
11
|
export {};
|
|
@@ -34,11 +34,11 @@ var getRelatedVariablesValues = function (optionId, index, variables, ovc, refer
|
|
|
34
34
|
var value = ovc.variables[currentVariableId] || [""];
|
|
35
35
|
var variableParents = references.relations.variables[currentVariableId].parents;
|
|
36
36
|
if (variableParents === undefined)
|
|
37
|
-
throw new Error("Variable "
|
|
37
|
+
throw new Error("Variable ".concat(currentVariableId, " parents object does not exist"));
|
|
38
38
|
var rootVariableParentId = variableParents[variableParents.length - 1];
|
|
39
39
|
var rootVariableParentRelations = references.relations.options[rootVariableParentId];
|
|
40
40
|
if (rootVariableParentRelations === undefined)
|
|
41
|
-
throw new Error("Option "
|
|
41
|
+
throw new Error("Option ".concat(rootVariableParentId, " does not exist"));
|
|
42
42
|
if (typeof variableParents === "undefined")
|
|
43
43
|
return;
|
|
44
44
|
if (rootVariableParentRelations.children.options.includes(optionId) ||
|
|
@@ -57,43 +57,43 @@ var getRelatedVariablesValues = function (optionId, index, variables, ovc, refer
|
|
|
57
57
|
};
|
|
58
58
|
exports.getRelatedVariablesValues = getRelatedVariablesValues;
|
|
59
59
|
var parseOutputWithVariables = function (output, index, variables, autonums) {
|
|
60
|
-
var parsedOutput = ""
|
|
60
|
+
var parsedOutput = "".concat(output);
|
|
61
61
|
Object.keys(variables).forEach(function (variableId) {
|
|
62
62
|
var value = variables[variableId].toString();
|
|
63
63
|
if (value.trim().length === 0) {
|
|
64
64
|
value = new Array(16).join("_");
|
|
65
65
|
}
|
|
66
66
|
value = value.replace(/\n/g, "<br />");
|
|
67
|
-
parsedOutput = parsedOutput.replace(new RegExp("\\[var:"
|
|
67
|
+
parsedOutput = parsedOutput.replace(new RegExp("\\[var:".concat(variableId, "\\]"), "g"), value);
|
|
68
68
|
});
|
|
69
69
|
parsedOutput = parsedOutput.replace(/\[\[PAGE_BREAK\]\]/gi, '<div style="page-break-after:always"></div>');
|
|
70
70
|
parsedOutput = parsedOutput.replace(/\[(E|B)_BLUR\]/gi, "");
|
|
71
71
|
parsedOutput = parsedOutput.replace(/\[signature:([0-9]+)\]/g, function (v, signatureId) {
|
|
72
|
-
return "<span data-signature=\"signature\" data-signature-id=\""
|
|
72
|
+
return "<span data-signature=\"signature\" data-signature-id=\"".concat(signatureId, "\" data-signer-index=\"").concat(index, "\"></span>");
|
|
73
73
|
});
|
|
74
74
|
parsedOutput = parsedOutput.replace(/\[signature:date\]/g, function () { return '<span data-signature="date"></span>'; });
|
|
75
75
|
parsedOutput = parsedOutput.replace(/\[signature:date:([0-9]+)\]/g, function (v, signatureId) {
|
|
76
|
-
return "<span data-signature=\"date\" data-signature-id=\""
|
|
76
|
+
return "<span data-signature=\"date\" data-signature-id=\"".concat(signatureId, "\" data-signer-index=\"").concat(index, "\"></span>");
|
|
77
77
|
});
|
|
78
78
|
parsedOutput = parsedOutput.replace(/\[signature:mention:([0-9]+):(?:"|")((?:[^"&]|\\.)*?)(?:"|")\]/g, function (v, signatureId, mention) {
|
|
79
|
-
return "<span data-signature=\"mention\" data-signature-id=\""
|
|
79
|
+
return "<span data-signature=\"mention\" data-signature-id=\"".concat(signatureId, "\" data-signer-index=\"").concat(index, "\" data-signer-mention=\"").concat(mention, "\"></span>");
|
|
80
80
|
});
|
|
81
81
|
parsedOutput = parsedOutput.replace(/\[date\]/g, function () { return '<span data-signature="date"></span>'; });
|
|
82
82
|
parsedOutput = parsedOutput.replace(new RegExp(yousign_1.yousignTagFieldRegex, "g"), function (v, paramsString) {
|
|
83
83
|
try {
|
|
84
|
-
var parsedParams = (0, yousign_1.parseYousignTag)("[yousign:"
|
|
84
|
+
var parsedParams = (0, yousign_1.parseYousignTag)("[yousign:".concat(paramsString.replace(/((=)")|("(;|$))/g, '$2"$4'), "]"));
|
|
85
85
|
return (0, yousign_1.convertParamsToHtmlTag)(__assign(__assign({}, parsedParams), { signerIndex: index }));
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
|
-
console.error("Failed to parse Yousign tag: "
|
|
88
|
+
console.error("Failed to parse Yousign tag: ".concat(v), error);
|
|
89
89
|
return v;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
autonums.forEach(function (currentAn) {
|
|
93
93
|
if (currentAn[3] === null)
|
|
94
|
-
parsedOutput = parsedOutput.replace("["
|
|
94
|
+
parsedOutput = parsedOutput.replace("[".concat(currentAn[0], ":").concat(currentAn[1], "]"), "<span class=\"".concat(currentAn[0], "\">").concat(currentAn[2], "</span>"));
|
|
95
95
|
else
|
|
96
|
-
parsedOutput = parsedOutput.replace("["
|
|
96
|
+
parsedOutput = parsedOutput.replace("[".concat(currentAn[0], ":").concat(currentAn[1], "](").concat(currentAn[3], ")"), "<span class=\"".concat(currentAn[0], "\">").concat(currentAn[2], "</span>"));
|
|
97
97
|
});
|
|
98
98
|
return parsedOutput;
|
|
99
99
|
};
|
|
@@ -118,14 +118,14 @@ var parseDocumentNameWithVariables = function (text, ovc, references, fallback)
|
|
|
118
118
|
var value = ((_a = ovc.variables[variableId]) === null || _a === void 0 ? void 0 : _a[0]) || "";
|
|
119
119
|
variablesValues[variableId] = value.toString();
|
|
120
120
|
});
|
|
121
|
-
var parsedText = ""
|
|
121
|
+
var parsedText = "".concat(text);
|
|
122
122
|
variables.forEach(function (variableId) {
|
|
123
123
|
var value = variablesValues[variableId];
|
|
124
124
|
if (value.trim().length === 0 && fallback)
|
|
125
125
|
parsedText = fallback;
|
|
126
126
|
if (parsedText === fallback && fallback)
|
|
127
127
|
return;
|
|
128
|
-
parsedText = parsedText.replace(new RegExp("\\[var:"
|
|
128
|
+
parsedText = parsedText.replace(new RegExp("\\[var:".concat(variableId, "\\]"), "gi"), value);
|
|
129
129
|
});
|
|
130
130
|
return parsedText;
|
|
131
131
|
};
|
|
@@ -63,7 +63,7 @@ var FillPdfFormBase = (function () {
|
|
|
63
63
|
if (sections[i].options.includes(rootId))
|
|
64
64
|
return sections[i].id;
|
|
65
65
|
}
|
|
66
|
-
throw new Error("Cannot find parent section for option "
|
|
66
|
+
throw new Error("Cannot find parent section for option ".concat(id, " (Root option id: ").concat(rootId, ")"));
|
|
67
67
|
};
|
|
68
68
|
return FillPdfFormBase;
|
|
69
69
|
}());
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type DocumentOutputIndex = {
|
|
2
2
|
name: string;
|
|
3
3
|
slug: string;
|
|
4
4
|
pdf: boolean;
|
|
5
5
|
docx: boolean;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type DocumentPdfFormIndex = {
|
|
8
8
|
name: string;
|
|
9
9
|
slug: string;
|
|
10
10
|
form: boolean;
|
|
11
11
|
fdf: FDFType;
|
|
12
12
|
};
|
|
13
|
-
export
|
|
14
|
-
export
|
|
13
|
+
export type DocumentIndex = Record<string, DocumentOutputIndex | DocumentPdfFormIndex>;
|
|
14
|
+
export type FDFType = {
|
|
15
15
|
id: string;
|
|
16
16
|
fields: Record<string, string>;
|
|
17
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/prerenderx",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "PrerenderX",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"repository": "https://git.legalplace.eu/legalplace/prerenderx",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"release": "standard-version -a --no-verify"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@legalplace/conditions-runner": "^2.1.
|
|
19
|
+
"@legalplace/conditions-runner": "^2.1.44",
|
|
20
20
|
"@legalplace/eslint-config-base": "^1.2.0",
|
|
21
21
|
"@legalplace/lplogic": "2.3.1",
|
|
22
22
|
"@legalplace/models-v3-types": "^5.15.11",
|
|
23
|
-
"@legalplace/ovc-converter": "^2.1.
|
|
23
|
+
"@legalplace/ovc-converter": "^2.1.9",
|
|
24
24
|
"@legalplace/prettier-config": "^2.1.3",
|
|
25
|
-
"@legalplace/referencesparser": "^3.1.
|
|
26
|
-
"@legalplace/yousign": "^0.
|
|
25
|
+
"@legalplace/referencesparser": "^3.1.94",
|
|
26
|
+
"@legalplace/yousign": "^0.8.0",
|
|
27
27
|
"crypto": "^1.0.1",
|
|
28
28
|
"standard-version": "^9.3.1"
|
|
29
29
|
},
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"ts-jest": "^24.0.2"
|
|
38
38
|
},
|
|
39
39
|
"prettier": "@legalplace/prettier-config",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "26e3e07833416d5dba91fd29e4fa1652dda8ca4b"
|
|
41
41
|
}
|