@contrail/document-generation 2.1.36 → 2.1.38-alpha-logger-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/CHANGELOG.md +17 -0
- package/lib/board-document-generator.js +2 -1
- package/lib/components/component-grid-generator.js +4 -3
- package/lib/frames/frame-generator.js +2 -1
- package/lib/interfaces.js +1 -1
- package/lib/showcase-frame-generator.js +2 -1
- package/lib/util/document-text-element-util.d.ts +1 -0
- package/lib/util/document-text-element-util.js +13 -0
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@contrail/document-generation` are documented here.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
6
|
+
Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Replaced `console.log/warn/error` calls with structured logger from `@contrail/telemetry`. No API changes. On the backend, logs are now captured by the OTel pipeline. In the browser, behavior is unchanged (Pino delegates to native console).
|
|
13
|
+
|
|
14
|
+
## [2.1.37] - (initial changelog entry)
|
|
15
|
+
|
|
16
|
+
- Initial changelog. Prior releases did not include a changelog.
|
|
17
|
+
See git history for changes predating this entry.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BoardDocumentGenerator = void 0;
|
|
4
|
+
const telemetry_1 = require("@contrail/telemetry");
|
|
4
5
|
const documents_1 = require("@contrail/documents");
|
|
5
6
|
const interfaces_1 = require("./interfaces");
|
|
6
7
|
const util_1 = require("@contrail/util");
|
|
@@ -20,7 +21,7 @@ class BoardDocumentGenerator {
|
|
|
20
21
|
if (frameTemplate) {
|
|
21
22
|
template.frameSize = frameTemplate.document.size;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
telemetry_1.logger.debug(`generateDocumentElements: ${structure.depth} ${structure.groupingProperties.length}`);
|
|
24
25
|
let position = options.startingCoordinates || { x: 0, y: 0 };
|
|
25
26
|
const group = structure.rootGroup;
|
|
26
27
|
const deepestSubgroups = [];
|
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ComponentGridGenerator = void 0;
|
|
4
|
+
const telemetry_1 = require("@contrail/telemetry");
|
|
4
5
|
const util_1 = require("@contrail/util");
|
|
5
6
|
const component_generator_1 = require("./component-generator");
|
|
6
7
|
const component_util_1 = require("./component-util");
|
|
7
8
|
class ComponentGridGenerator {
|
|
8
9
|
static generateComponentGrid(data, startingPosition = { x: 0, y: 0 }, template, idealSize) {
|
|
9
10
|
if (!data) {
|
|
10
|
-
|
|
11
|
+
telemetry_1.logger.warn('WARN: data null in generateComponentGrid');
|
|
11
12
|
return [];
|
|
12
13
|
}
|
|
13
14
|
if (data.length === 0) {
|
|
14
15
|
return [];
|
|
15
16
|
}
|
|
16
17
|
if (!template) {
|
|
17
|
-
|
|
18
|
+
telemetry_1.logger.warn('WARN: template null in generateComponentGrid');
|
|
18
19
|
return [];
|
|
19
20
|
}
|
|
20
21
|
if (!template.componentTemplate) {
|
|
21
|
-
|
|
22
|
+
telemetry_1.logger.warn('WARN: component template is null in generateComponentGrid');
|
|
22
23
|
return [];
|
|
23
24
|
}
|
|
24
25
|
const elements = [];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FrameGenerator = void 0;
|
|
4
|
+
const telemetry_1 = require("@contrail/telemetry");
|
|
4
5
|
const documents_1 = require("@contrail/documents");
|
|
5
6
|
const component_grid_generator_1 = require("../components/component-grid-generator");
|
|
6
7
|
const util_1 = require("@contrail/util");
|
|
@@ -146,7 +147,7 @@ class FrameGenerator {
|
|
|
146
147
|
}
|
|
147
148
|
catch (e) { }
|
|
148
149
|
if (oldChildElements.length !== newChildElements.length || oldChildElements.length === 0) {
|
|
149
|
-
|
|
150
|
+
telemetry_1.logger.debug(`Invalid table element to copy ${documentElement} ${oldChildElements} ${newChildElements}`);
|
|
150
151
|
continue;
|
|
151
152
|
}
|
|
152
153
|
documentElement = newTableElement;
|
package/lib/interfaces.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShowcaseFrameGenerator = void 0;
|
|
4
|
+
const telemetry_1 = require("@contrail/telemetry");
|
|
4
5
|
const frame_1 = require("./frames/frame");
|
|
5
6
|
const frame_generator_1 = require("./frames/frame-generator");
|
|
6
7
|
class ShowcaseFrameGenerator {
|
|
@@ -13,7 +14,7 @@ class ShowcaseFrameGenerator {
|
|
|
13
14
|
const groups = this.getFrameGroups(structure);
|
|
14
15
|
for (let group of groups) {
|
|
15
16
|
const showcaseFrame = frame_generator_1.FrameGenerator.generateFrameContentForGroup(new frame_1.ShowcaseFrame((group === null || group === void 0 ? void 0 : group.name) || ''), group, template, frameTemplate);
|
|
16
|
-
|
|
17
|
+
telemetry_1.logger.debug(`showcaseFrame: ${showcaseFrame}`);
|
|
17
18
|
frames.push(showcaseFrame);
|
|
18
19
|
}
|
|
19
20
|
return frames;
|
|
@@ -10,4 +10,5 @@ export declare class DocumentTextElementUtil {
|
|
|
10
10
|
static extractTextStyleItalicFromHTML(text: any): string;
|
|
11
11
|
static extractTextStyleStrikethroughFromHTML(text: any): string;
|
|
12
12
|
static extractTextAlignFromHTML(text: any): string;
|
|
13
|
+
static extractPlainText(html: string): string;
|
|
13
14
|
}
|
|
@@ -163,5 +163,18 @@ class DocumentTextElementUtil {
|
|
|
163
163
|
return textAlign;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
+
static extractPlainText(html) {
|
|
167
|
+
if (!html)
|
|
168
|
+
return '';
|
|
169
|
+
return html
|
|
170
|
+
.replace(/<[^>]*>/g, '')
|
|
171
|
+
.replace(/&/g, '&')
|
|
172
|
+
.replace(/</g, '<')
|
|
173
|
+
.replace(/>/g, '>')
|
|
174
|
+
.replace(/"/g, '"')
|
|
175
|
+
.replace(/'/g, "'")
|
|
176
|
+
.replace(/ /g, ' ')
|
|
177
|
+
.trim();
|
|
178
|
+
}
|
|
166
179
|
}
|
|
167
180
|
exports.DocumentTextElementUtil = DocumentTextElementUtil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrail/document-generation",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.38-alpha-logger-1",
|
|
4
4
|
"description": "Utilities for automatic generation of documents.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"ts-jest": "^29.1.1",
|
|
27
27
|
"tslint": "^5.11.0",
|
|
28
28
|
"tslint-config-prettier": "^1.18.0",
|
|
29
|
-
"typescript": "^
|
|
29
|
+
"typescript": "^5.0.0"
|
|
30
30
|
},
|
|
31
31
|
"jest": {
|
|
32
32
|
"moduleFileExtensions": [
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"@contrail/data-grouping": "^1.0.50",
|
|
47
47
|
"@contrail/document-table": "^1.0.5",
|
|
48
48
|
"@contrail/documents": "^1.3.3",
|
|
49
|
+
"@contrail/telemetry": "^1.1.0-alpha-frontend-logging-2",
|
|
49
50
|
"@contrail/types": "^3.1.3",
|
|
50
|
-
"@contrail/util": "^1.1
|
|
51
|
+
"@contrail/util": "^1.2.1-alpha-otel-logs-12"
|
|
51
52
|
}
|
|
52
53
|
}
|