@pactosigna/records 0.1.0 → 0.1.2
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/cli.js +523 -444
- package/dist/generators/prs-generator.d.ts.map +1 -1
- package/dist/generators/pta-generator.d.ts.map +1 -1
- package/dist/generators/rmr-generator.d.ts.map +1 -1
- package/dist/generators/srs-generator.d.ts.map +1 -1
- package/dist/generators/urs-generator.d.ts.map +1 -1
- package/dist/index.js +95 -16
- package/dist/pdf/layout.d.ts +1 -0
- package/dist/pdf/layout.d.ts.map +1 -1
- package/dist/pdf/logo.d.ts +10 -0
- package/dist/pdf/logo.d.ts.map +1 -0
- package/dist/pdf/markdown-to-pdfmake.d.ts +2 -0
- package/dist/pdf/markdown-to-pdfmake.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prs-generator.d.ts","sourceRoot":"","sources":["../../src/generators/prs-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"prs-generator.d.ts","sourceRoot":"","sources":["../../src/generators/prs-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAwC9E;AAED,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pta-generator.d.ts","sourceRoot":"","sources":["../../src/generators/pta-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;CACjD;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AASD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,EAAE,EACrB,IAAI,EAAE,cAAc,EAAE,EACtB,IAAI,EAAE,cAAc,EAAE,GACrB,kBAAkB,CAgJpB;AASD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"pta-generator.d.ts","sourceRoot":"","sources":["../../src/generators/pta-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,WAAW,GAAG,YAAY,GAAG,YAAY,CAAC;CACjD;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,IAAI,EAAE,WAAW,EAAE,CAAC;CACrB;AASD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,cAAc,EAAE,EACrB,IAAI,EAAE,cAAc,EAAE,EACtB,IAAI,EAAE,cAAc,EAAE,GACrB,kBAAkB,CAgJpB;AASD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAmE9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rmr-generator.d.ts","sourceRoot":"","sources":["../../src/generators/rmr-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAW5D,MAAM,WAAW,SAAS;IACxB,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AA8ED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAmEzD;AAmHD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"rmr-generator.d.ts","sourceRoot":"","sources":["../../src/generators/rmr-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAW5D,MAAM,WAAW,SAAS;IACxB,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AA8ED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAmEzD;AAmHD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,CA8D9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"srs-generator.d.ts","sourceRoot":"","sources":["../../src/generators/srs-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"srs-generator.d.ts","sourceRoot":"","sources":["../../src/generators/srs-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAItD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAwC9E;AAED,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urs-generator.d.ts","sourceRoot":"","sources":["../../src/generators/urs-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"urs-generator.d.ts","sourceRoot":"","sources":["../../src/generators/urs-generator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAKtD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,GAAG,oBAAoB,GAAG,IAAI,CAwC9E"}
|
package/dist/index.js
CHANGED
|
@@ -74,6 +74,52 @@ function readDocuments(rootDir, folderPath, statusFilter = INCLUDED_STATUSES) {
|
|
|
74
74
|
// src/pdf/markdown-to-pdfmake.ts
|
|
75
75
|
import MarkdownIt from "markdown-it";
|
|
76
76
|
var md = new MarkdownIt();
|
|
77
|
+
var UNICODE_REPLACEMENTS = {
|
|
78
|
+
"\u2264": "<=",
|
|
79
|
+
// ≤
|
|
80
|
+
"\u2265": ">=",
|
|
81
|
+
// ≥
|
|
82
|
+
"\u2260": "!=",
|
|
83
|
+
// ≠
|
|
84
|
+
"\u2248": "~=",
|
|
85
|
+
// ≈
|
|
86
|
+
"\xB1": "+/-",
|
|
87
|
+
// ±
|
|
88
|
+
"\u2014": "--",
|
|
89
|
+
// — (em dash)
|
|
90
|
+
"\u2013": "-",
|
|
91
|
+
// – (en dash)
|
|
92
|
+
"\u2018": "'",
|
|
93
|
+
// ' (left single quote)
|
|
94
|
+
"\u2019": "'",
|
|
95
|
+
// ' (right single quote)
|
|
96
|
+
"\u201C": '"',
|
|
97
|
+
// " (left double quote)
|
|
98
|
+
"\u201D": '"',
|
|
99
|
+
// " (right double quote)
|
|
100
|
+
"\u2026": "...",
|
|
101
|
+
// … (ellipsis)
|
|
102
|
+
"\u2192": "->",
|
|
103
|
+
// →
|
|
104
|
+
"\u2190": "<-",
|
|
105
|
+
// ←
|
|
106
|
+
"\xD7": "x",
|
|
107
|
+
// × (multiplication sign)
|
|
108
|
+
"\xF7": "/",
|
|
109
|
+
// ÷ (division sign)
|
|
110
|
+
"\u221E": "Inf",
|
|
111
|
+
// ∞
|
|
112
|
+
"\u2211": "Sum",
|
|
113
|
+
// ∑
|
|
114
|
+
"\u0394": "Delta",
|
|
115
|
+
// Δ
|
|
116
|
+
"\u03BC": "u"
|
|
117
|
+
// μ (micro)
|
|
118
|
+
};
|
|
119
|
+
var UNICODE_PATTERN = new RegExp("[" + Object.keys(UNICODE_REPLACEMENTS).join("") + "]", "g");
|
|
120
|
+
function sanitizeUnicode(text) {
|
|
121
|
+
return text.replace(UNICODE_PATTERN, (match) => UNICODE_REPLACEMENTS[match] ?? match);
|
|
122
|
+
}
|
|
77
123
|
function markdownToPdfmake(markdown) {
|
|
78
124
|
if (!markdown.trim()) return [];
|
|
79
125
|
const tokens = md.parse(markdown, {});
|
|
@@ -123,7 +169,7 @@ function markdownToPdfmake(markdown) {
|
|
|
123
169
|
}
|
|
124
170
|
if (token.type === "fence") {
|
|
125
171
|
result.push({
|
|
126
|
-
text: token.content,
|
|
172
|
+
text: sanitizeUnicode(token.content),
|
|
127
173
|
style: "code",
|
|
128
174
|
margin: [0, 4, 0, 4],
|
|
129
175
|
background: "#F5F5F5"
|
|
@@ -161,7 +207,7 @@ function parseInlineContent(token) {
|
|
|
161
207
|
italics = false;
|
|
162
208
|
break;
|
|
163
209
|
case "code_inline":
|
|
164
|
-
fragments.push({ text: child.content, font: "Courier", fontSize: 9 });
|
|
210
|
+
fragments.push({ text: sanitizeUnicode(child.content), font: "Courier", fontSize: 9 });
|
|
165
211
|
break;
|
|
166
212
|
case "softbreak":
|
|
167
213
|
case "hardbreak":
|
|
@@ -169,17 +215,17 @@ function parseInlineContent(token) {
|
|
|
169
215
|
break;
|
|
170
216
|
case "text":
|
|
171
217
|
if (bold || italics) {
|
|
172
|
-
const fragment = { text: child.content };
|
|
218
|
+
const fragment = { text: sanitizeUnicode(child.content) };
|
|
173
219
|
if (bold) fragment.bold = true;
|
|
174
220
|
if (italics) fragment.italics = true;
|
|
175
221
|
fragments.push(fragment);
|
|
176
222
|
} else {
|
|
177
|
-
fragments.push(child.content);
|
|
223
|
+
fragments.push(sanitizeUnicode(child.content));
|
|
178
224
|
}
|
|
179
225
|
break;
|
|
180
226
|
default:
|
|
181
227
|
if (child.content) {
|
|
182
|
-
fragments.push(child.content);
|
|
228
|
+
fragments.push(sanitizeUnicode(child.content));
|
|
183
229
|
}
|
|
184
230
|
break;
|
|
185
231
|
}
|
|
@@ -273,6 +319,33 @@ function parseTable(tokens, startIndex) {
|
|
|
273
319
|
};
|
|
274
320
|
}
|
|
275
321
|
|
|
322
|
+
// src/pdf/logo.ts
|
|
323
|
+
import { readFileSync as readFileSync3, existsSync as existsSync2 } from "fs";
|
|
324
|
+
import { resolve as resolve3 } from "path";
|
|
325
|
+
var DEFAULT_LOGO_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="86 33 112 132" fill="none">
|
|
326
|
+
<path d="M 126.660 39.048 C 118.948 40.342, 108.092 43.909, 100.250 47.726 L 93 51.254 93 79.417 C 93 101.290, 93.337 108.873, 94.508 113.369 C 99.124 131.093, 111.353 144.203, 132.521 154.123 L 141.228 158.203 147.482 155.545 C 164.571 148.282, 177.761 137.330, 183.523 125.620 C 185.450 121.704, 187.687 115.350, 188.496 111.500 C 190.017 104.251, 190.622 77.552, 189.250 78.172 C 188.838 78.359, 186.137 79.754, 183.250 81.273 L 178 84.034 177.976 97.767 C 177.955 109.837, 177.670 112.188, 175.617 117.178 C 174.332 120.302, 171.823 124.699, 170.040 126.950 C 166.118 131.901, 156.845 138.641, 147.912 143.031 L 141.324 146.270 133.165 142.025 C 123.422 136.956, 112.066 126.834, 108.987 120.474 C 104.626 111.464, 104.024 106.777, 104.012 81.694 L 104 57.888 108.468 55.911 C 118.291 51.566, 127.969 49.691, 141 49.610 C 154.549 49.525, 161.523 50.879, 172.184 55.663 L 178 58.273 178.015 67.887 C 178.024 73.174, 178.361 78.008, 178.765 78.629 C 179.273 79.409, 181.073 78.866, 184.588 76.874 L 189.677 73.990 189.588 62.811 L 189.500 51.632 182.359 47.990 C 173.984 43.718, 164.090 40.483, 155 39.044 C 147.525 37.861, 133.720 37.863, 126.660 39.048 M 126.500 55.097 C 124.300 55.590, 119.463 56.951, 115.750 58.122 L 109 60.251 109 85.729 L 109 111.207 113.250 117.047 C 115.588 120.259, 117.838 122.912, 118.250 122.943 C 118.662 122.975, 119 116.984, 119 109.630 L 119 96.261 132.250 95.756 C 142.964 95.347, 146.648 94.801, 151.500 92.903 C 167.650 86.582, 173.814 69.996, 163.666 60.161 C 159.792 56.406, 152.831 54, 145.841 54 L 141 54 141 59 L 141 64 145.435 64 C 153.585 64, 158 66.985, 158 72.495 C 158 74.610, 157.079 76.941, 155.504 78.813 C 151.445 83.637, 146.077 85.209, 131.750 85.768 L 119 86.265 119 76.758 L 119 67.250 122.125 66.625 C 123.844 66.281, 125.644 66, 126.125 66 C 126.606 66, 127 69.600, 127 74 L 127 82 132 82 L 137 82 137 68 L 137 54 133.750 54.100 C 131.963 54.156, 128.700 54.604, 126.500 55.097 M 159.103 93.372 C 143.915 101.453, 141 104.415, 141 111.767 C 141 115.024, 141.605 116.696, 143.455 118.545 C 144.805 119.895, 146.717 120.996, 147.705 120.990 C 148.692 120.985, 151.907 119.860, 154.849 118.490 C 160.989 115.632, 162 115.473, 162 117.364 C 162 118.898, 157.383 122.272, 148.500 127.227 C 142.608 130.513, 142.495 130.658, 142.195 135.287 C 142.028 137.879, 142.122 140, 142.406 140 C 142.689 140, 146.800 137.874, 151.541 135.277 C 166.125 127.286, 171 121.968, 171 114.050 C 171 109.325, 168.324 106, 164.522 106 C 163.159 106, 159.572 107.213, 156.550 108.695 C 153.528 110.177, 150.722 111.055, 150.313 110.647 C 148.679 109.012, 152.158 106.229, 162.820 100.641 L 174 94.781 174 90.391 C 174 87.976, 173.662 86.055, 173.250 86.122 C 172.838 86.189, 166.471 89.451, 159.103 93.372 M 127 115.952 L 127 132.904 131.430 135.952 C 133.867 137.628, 136.117 139, 136.430 139 C 136.744 139, 137 130, 137 119 L 137 99 132 99 L 127 99 127 115.952" fill="#0D2D56" fill-rule="evenodd"/>
|
|
327
|
+
<path d="M 159.103 93.372 C 143.915 101.453, 141 104.415, 141 111.767 C 141 115.024, 141.605 116.696, 143.455 118.545 C 144.805 119.895, 146.717 120.996, 147.705 120.990 C 148.692 120.985, 151.907 119.860, 154.849 118.490 C 160.989 115.632, 162 115.473, 162 117.364 C 162 118.898, 157.383 122.272, 148.500 127.227 C 142.608 130.513, 142.495 130.658, 142.195 135.287 C 142.028 137.879, 142.122 140, 142.406 140 C 142.689 140, 146.800 137.874, 151.541 135.277 C 166.125 127.286, 171 121.968, 171 114.050 C 171 109.325, 168.324 106, 164.522 106 C 163.159 106, 159.572 107.213, 156.550 108.695 C 153.528 110.177, 150.722 111.055, 150.313 110.647 C 148.679 109.012, 152.158 106.229, 162.820 100.641 L 174 94.781 174 90.391 C 174 87.976, 173.662 86.055, 173.250 86.122 C 172.838 86.189, 166.471 89.451, 159.103 93.372 M 127 115.952 L 127 132.904 131.430 135.952 C 133.867 137.628, 136.117 139, 136.430 139 C 136.744 139, 137 130, 137 119 L 137 99 132 99 L 127 99 127 115.952" fill="#73C4B0" fill-rule="evenodd"/>
|
|
328
|
+
</svg>`;
|
|
329
|
+
var HEADER_LOGO_HEIGHT = 30;
|
|
330
|
+
function resolveHeaderLogo(rootDir, customLogoPath) {
|
|
331
|
+
if (customLogoPath) {
|
|
332
|
+
const absPath = resolve3(rootDir, customLogoPath);
|
|
333
|
+
if (existsSync2(absPath)) {
|
|
334
|
+
const ext = absPath.toLowerCase();
|
|
335
|
+
if (ext.endsWith(".png") || ext.endsWith(".jpg") || ext.endsWith(".jpeg")) {
|
|
336
|
+
const data = readFileSync3(absPath);
|
|
337
|
+
const mime = ext.endsWith(".png") ? "image/png" : "image/jpeg";
|
|
338
|
+
const base64 = `data:${mime};base64,${data.toString("base64")}`;
|
|
339
|
+
return { image: base64, height: HEADER_LOGO_HEIGHT };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
svg: DEFAULT_LOGO_SVG,
|
|
345
|
+
height: HEADER_LOGO_HEIGHT
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
|
|
276
349
|
// src/pdf/layout.ts
|
|
277
350
|
var HEADER_GRAY = "#F0F0F0";
|
|
278
351
|
var HEADING_COLOR = "#2C3E50";
|
|
@@ -329,8 +402,9 @@ function buildCoverPage(options) {
|
|
|
329
402
|
return cover;
|
|
330
403
|
}
|
|
331
404
|
function buildDocumentDefinition(options) {
|
|
332
|
-
const { recordTitle, recordId, version, date, content = [] } = options;
|
|
405
|
+
const { rootDir, config, recordTitle, recordId, version, date, content = [] } = options;
|
|
333
406
|
const coverPage = buildCoverPage(options);
|
|
407
|
+
const logo = resolveHeaderLogo(rootDir, config.branding.logo);
|
|
334
408
|
return {
|
|
335
409
|
pageSize: "A4",
|
|
336
410
|
pageMargins: [40, 80, 40, 50],
|
|
@@ -353,7 +427,7 @@ function buildDocumentDefinition(options) {
|
|
|
353
427
|
widths: [usableWidth * 0.2, "*", usableWidth * 0.25],
|
|
354
428
|
body: [
|
|
355
429
|
[
|
|
356
|
-
|
|
430
|
+
logo,
|
|
357
431
|
{
|
|
358
432
|
stack: [
|
|
359
433
|
{ text: recordTitle, bold: true, fontSize: 10, alignment: "center" },
|
|
@@ -436,6 +510,7 @@ function generateUrs(input) {
|
|
|
436
510
|
}
|
|
437
511
|
return buildDocumentDefinition({
|
|
438
512
|
config: input.config,
|
|
513
|
+
rootDir: input.rootDir,
|
|
439
514
|
recordTitle: "User Requirements Specification",
|
|
440
515
|
recordId: "URS",
|
|
441
516
|
version: input.version,
|
|
@@ -472,6 +547,7 @@ function generatePrs(input) {
|
|
|
472
547
|
}
|
|
473
548
|
return buildDocumentDefinition({
|
|
474
549
|
config: input.config,
|
|
550
|
+
rootDir: input.rootDir,
|
|
475
551
|
recordTitle: "Product Requirements Specification",
|
|
476
552
|
recordId: "PRS",
|
|
477
553
|
version: input.version,
|
|
@@ -508,6 +584,7 @@ function generateSrs(input) {
|
|
|
508
584
|
}
|
|
509
585
|
return buildDocumentDefinition({
|
|
510
586
|
config: input.config,
|
|
587
|
+
rootDir: input.rootDir,
|
|
511
588
|
recordTitle: "Software Requirements Specification",
|
|
512
589
|
recordId: "SRS",
|
|
513
590
|
version: input.version,
|
|
@@ -725,6 +802,7 @@ function generatePta(input) {
|
|
|
725
802
|
}
|
|
726
803
|
return buildDocumentDefinition({
|
|
727
804
|
config: input.config,
|
|
805
|
+
rootDir: input.rootDir,
|
|
728
806
|
recordTitle: "Product Traceability Analysis",
|
|
729
807
|
recordId: "PTA",
|
|
730
808
|
version: input.version,
|
|
@@ -798,8 +876,8 @@ ${probabilityLabels[labelIndex]}`,
|
|
|
798
876
|
|
|
799
877
|
// src/generators/rmr-generator.ts
|
|
800
878
|
import { RiskMatrixConfigSchema } from "@pactosigna/schemas";
|
|
801
|
-
import { readFileSync as
|
|
802
|
-
import { resolve as
|
|
879
|
+
import { readFileSync as readFileSync4, existsSync as existsSync3 } from "fs";
|
|
880
|
+
import { resolve as resolve4 } from "path";
|
|
803
881
|
import { parse as parseYaml2 } from "yaml";
|
|
804
882
|
var HEADER_GRAY3 = "#F0F0F0";
|
|
805
883
|
function isHazard(doc) {
|
|
@@ -810,12 +888,12 @@ function isRiskEntry(doc) {
|
|
|
810
888
|
}
|
|
811
889
|
function loadRiskMatrix(rootDir) {
|
|
812
890
|
const candidates = [
|
|
813
|
-
|
|
814
|
-
|
|
891
|
+
resolve4(rootDir, "risk-matrix.yaml"),
|
|
892
|
+
resolve4(rootDir, "docs/risk/risk-matrix.yaml")
|
|
815
893
|
];
|
|
816
894
|
for (const candidate of candidates) {
|
|
817
|
-
if (
|
|
818
|
-
const raw =
|
|
895
|
+
if (existsSync3(candidate)) {
|
|
896
|
+
const raw = readFileSync4(candidate, "utf-8");
|
|
819
897
|
const parsed = parseYaml2(raw);
|
|
820
898
|
const result = RiskMatrixConfigSchema.safeParse(parsed);
|
|
821
899
|
if (result.success) {
|
|
@@ -1031,6 +1109,7 @@ function generateRmr(input) {
|
|
|
1031
1109
|
}
|
|
1032
1110
|
return buildDocumentDefinition({
|
|
1033
1111
|
config: input.config,
|
|
1112
|
+
rootDir: input.rootDir,
|
|
1034
1113
|
recordTitle: "Risk Management Report",
|
|
1035
1114
|
recordId: "RMR",
|
|
1036
1115
|
version: input.version,
|
|
@@ -1042,8 +1121,8 @@ function generateRmr(input) {
|
|
|
1042
1121
|
|
|
1043
1122
|
// src/github/changelog.ts
|
|
1044
1123
|
import { execFileSync } from "child_process";
|
|
1045
|
-
import { resolve as
|
|
1046
|
-
import { readFileSync as
|
|
1124
|
+
import { resolve as resolve5 } from "path";
|
|
1125
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
1047
1126
|
import matter2 from "gray-matter";
|
|
1048
1127
|
function buildChangelog(rootDir, version, date) {
|
|
1049
1128
|
let previousTag = null;
|
|
@@ -1077,7 +1156,7 @@ function buildChangelog(rootDir, version, date) {
|
|
|
1077
1156
|
const descriptions = [];
|
|
1078
1157
|
for (const file of changedFiles.slice(0, 20)) {
|
|
1079
1158
|
try {
|
|
1080
|
-
const raw =
|
|
1159
|
+
const raw = readFileSync5(resolve5(rootDir, file), "utf-8");
|
|
1081
1160
|
const { data } = matter2(raw);
|
|
1082
1161
|
if (data.id && data.title) {
|
|
1083
1162
|
descriptions.push(`${data.id}: ${data.title}`);
|
package/dist/pdf/layout.d.ts
CHANGED
package/dist/pdf/layout.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/pdf/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../src/pdf/layout.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,aAAa,EAAE,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;CACrB;AAMD,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,EAAE,CA2DhE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,aAAa,GAAG,oBAAoB,CAuFpF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Content } from 'pdfmake/interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the logo to use in the PDF header.
|
|
4
|
+
*
|
|
5
|
+
* Priority:
|
|
6
|
+
* 1. Custom logo path from `branding.logo` in pactosigna.yaml (PNG only)
|
|
7
|
+
* 2. Built-in PactoSigna shield icon (SVG, always available)
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveHeaderLogo(rootDir: string, customLogoPath?: string): Content;
|
|
10
|
+
//# sourceMappingURL=logo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo.d.ts","sourceRoot":"","sources":["../../src/pdf/logo.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAiBlD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,OAAO,CAkBnF"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Content } from 'pdfmake/interfaces';
|
|
2
|
+
/** Replace Unicode characters unsupported by WinAnsiEncoding with ASCII equivalents. */
|
|
3
|
+
export declare function sanitizeUnicode(text: string): string;
|
|
2
4
|
/**
|
|
3
5
|
* Converts a markdown string to an array of pdfmake content nodes.
|
|
4
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-to-pdfmake.d.ts","sourceRoot":"","sources":["../../src/pdf/markdown-to-pdfmake.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"markdown-to-pdfmake.d.ts","sourceRoot":"","sources":["../../src/pdf/markdown-to-pdfmake.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,oBAAoB,CAAC;AAoC/D,wFAAwF;AACxF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAID;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE,CA4E7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pactosigna/records",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Generate audit-ready regulatory PDF records from PactoSigna-compliant git repositories",
|
|
6
6
|
"publishConfig": {
|
|
@@ -24,13 +24,6 @@
|
|
|
24
24
|
"engines": {
|
|
25
25
|
"node": ">=20.0.0"
|
|
26
26
|
},
|
|
27
|
-
"scripts": {
|
|
28
|
-
"build": "tsup && tsc -p tsconfig.build.json",
|
|
29
|
-
"test": "vitest run",
|
|
30
|
-
"test:coverage": "vitest run --coverage",
|
|
31
|
-
"typecheck": "tsc --noEmit",
|
|
32
|
-
"clean": "rm -rf dist"
|
|
33
|
-
},
|
|
34
27
|
"dependencies": {
|
|
35
28
|
"pdfmake": "^0.3.7",
|
|
36
29
|
"gray-matter": "^4.0.3",
|
|
@@ -41,14 +34,14 @@
|
|
|
41
34
|
"@pactosigna/schemas": ">=0.1.0"
|
|
42
35
|
},
|
|
43
36
|
"devDependencies": {
|
|
44
|
-
"@pactosigna/schemas": "workspace:*",
|
|
45
37
|
"@types/markdown-it": "^14.0.0",
|
|
46
38
|
"@types/pdfmake": "^0.3.2",
|
|
47
39
|
"@vitest/coverage-v8": "^3.0.0",
|
|
48
40
|
"tsup": "^8.0.0",
|
|
49
41
|
"typescript": "^5.7.2",
|
|
50
42
|
"vitest": "^3.0.0",
|
|
51
|
-
"zod": "^3.24.1"
|
|
43
|
+
"zod": "^3.24.1",
|
|
44
|
+
"@pactosigna/schemas": "0.1.0"
|
|
52
45
|
},
|
|
53
46
|
"repository": {
|
|
54
47
|
"type": "git",
|
|
@@ -64,5 +57,12 @@
|
|
|
64
57
|
"regulatory",
|
|
65
58
|
"pdf",
|
|
66
59
|
"records"
|
|
67
|
-
]
|
|
68
|
-
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup && tsc -p tsconfig.build.json",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"test:coverage": "vitest run --coverage",
|
|
65
|
+
"typecheck": "tsc --noEmit",
|
|
66
|
+
"clean": "rm -rf dist"
|
|
67
|
+
}
|
|
68
|
+
}
|