@contrail/document-generation 2.1.37 → 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 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
- console.log('generateDocumentElements: ', structure.depth, structure.groupingProperties.length);
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
- console.warn('WARN: data null in generateComponentGrid');
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
- console.warn('WARN: template null in generateComponentGrid');
18
+ telemetry_1.logger.warn('WARN: template null in generateComponentGrid');
18
19
  return [];
19
20
  }
20
21
  if (!template.componentTemplate) {
21
- console.warn('WARN: component template is null in generateComponentGrid');
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
- console.log(`Invalid table element to copy`, documentElement, oldChildElements, newChildElements);
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
@@ -5,4 +5,4 @@ var Orientation;
5
5
  (function (Orientation) {
6
6
  Orientation["HORIZONTAL"] = "horizontal";
7
7
  Orientation["VERTICAL"] = "vertical";
8
- })(Orientation = exports.Orientation || (exports.Orientation = {}));
8
+ })(Orientation || (exports.Orientation = Orientation = {}));
@@ -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
- console.log('showcaseFrame: ', showcaseFrame);
17
+ telemetry_1.logger.debug(`showcaseFrame: ${showcaseFrame}`);
17
18
  frames.push(showcaseFrame);
18
19
  }
19
20
  return frames;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/document-generation",
3
- "version": "2.1.37",
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": "^4.0.0"
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.19"
51
+ "@contrail/util": "^1.2.1-alpha-otel-logs-12"
51
52
  }
52
53
  }