@contrail/documents 1.3.24 → 1.3.26-alpha-otel-logs-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/documents` 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
+ ## [1.3.25] - (initial changelog entry)
15
+
16
+ - Initial changelog. Prior releases did not include a changelog.
17
+ See git history for changes predating this entry.
@@ -13,8 +13,8 @@ class ItemComponentService {
13
13
  var _a;
14
14
  if (!((_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.length) || element.elements.length > 2)
15
15
  return false;
16
- const annotationElement = element.elements.find(e => e.type == 'annotation');
17
- const imageElement = element.elements.find(e => e.type == 'image');
16
+ const annotationElement = element.elements.find((e) => e.type == 'annotation');
17
+ const imageElement = element.elements.find((e) => e.type == 'image');
18
18
  return (!annotationElement || annotationElement.isHidden) && imageElement && !imageElement.isHidden;
19
19
  }
20
20
  static updateSizeAndPosition(propertyElements, componentElement, annotatedElements = []) {
@@ -22,7 +22,7 @@ class ItemComponentService {
22
22
  const newElements = [];
23
23
  let lastYPosition = 0;
24
24
  let width = 200;
25
- const imageElements = propertyElements.filter(element => {
25
+ const imageElements = propertyElements.filter((element) => {
26
26
  return element.type === 'image';
27
27
  });
28
28
  if (imageElements.length > 0) {
@@ -73,7 +73,7 @@ class ItemComponentService {
73
73
  newElements.push(element);
74
74
  });
75
75
  const cardWidth = (_a = componentElement === null || componentElement === void 0 ? void 0 : componentElement.size) === null || _a === void 0 ? void 0 : _a.width;
76
- const imageElement = newElements === null || newElements === void 0 ? void 0 : newElements.find(e => e.type === 'image');
76
+ const imageElement = newElements === null || newElements === void 0 ? void 0 : newElements.find((e) => e.type === 'image');
77
77
  const thumbnailWidth = ((_b = imageElement === null || imageElement === void 0 ? void 0 : imageElement.size) === null || _b === void 0 ? void 0 : _b.width) || exports.DEFAULT_THUMBNAIL_WIDTH;
78
78
  const align = ((_d = (_c = imageElement === null || imageElement === void 0 ? void 0 : imageElement.style) === null || _c === void 0 ? void 0 : _c.text) === null || _d === void 0 ? void 0 : _d.align) || 'center';
79
79
  if (cardWidth && cardWidth > thumbnailWidth) {
@@ -116,14 +116,14 @@ class ItemComponentService {
116
116
  const annotationSize = ((_b = (_a = element.style) === null || _a === void 0 ? void 0 : _a.font) === null || _b === void 0 ? void 0 : _b.size) || document_element_constants_1.ANNOTATION_IMG_SIZE;
117
117
  let height = annotationSize + document_element_constants_1.ANNOTATION_PADDING_Y;
118
118
  let xPos = 0;
119
- const annotatedElement = annotatedElements.find(elem => elem.id === componentElement.id);
119
+ const annotatedElement = annotatedElements.find((elem) => elem.id === componentElement.id);
120
120
  if (!annotatedElement || element.isHidden) {
121
121
  return height;
122
122
  }
123
- const annotations = annotatedElement.annotations.filter(annotation => annotation.category === 'property');
123
+ const annotations = annotatedElement.annotations.filter((annotation) => annotation.category === 'property');
124
124
  if (annotations.length > 0) {
125
125
  let count = 0;
126
- annotations === null || annotations === void 0 ? void 0 : annotations.forEach(annotation => {
126
+ annotations === null || annotations === void 0 ? void 0 : annotations.forEach((annotation) => {
127
127
  if ((count + 1) * annotationSize * 1.25 > width) {
128
128
  count = 0;
129
129
  xPos = -width * 0.5;
@@ -137,7 +137,7 @@ class ItemComponentService {
137
137
  }
138
138
  static getImageElement(element) {
139
139
  var _a;
140
- return (_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.find(e => e.type === 'image');
140
+ return (_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.find((e) => e.type === 'image');
141
141
  }
142
142
  static getItemCardDimensions(element, visualHeight) {
143
143
  var _a, _b, _c;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uniqueElementsToUpdate = exports.DocumentAction = void 0;
3
+ exports.DocumentAction = void 0;
4
+ exports.uniqueElementsToUpdate = uniqueElementsToUpdate;
4
5
  const actions_1 = require("@contrail/actions");
5
6
  class DocumentAction extends actions_1.Action {
6
7
  constructor(change, undoChange = null) {
@@ -11,4 +12,3 @@ exports.DocumentAction = DocumentAction;
11
12
  function uniqueElementsToUpdate(elementsToUpdate, mainElementsToUpdate) {
12
13
  return elementsToUpdate.filter(({ change }) => mainElementsToUpdate.findIndex((elementToUpdate) => elementToUpdate.change.id === change.id) === -1);
13
14
  }
14
- exports.uniqueElementsToUpdate = uniqueElementsToUpdate;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DocumentElementFactory = void 0;
4
+ const telemetry_1 = require("@contrail/telemetry");
4
5
  const util_1 = require("@contrail/util");
5
6
  const nanoid_1 = require("nanoid");
6
7
  const components_1 = require("./components/components");
@@ -121,7 +122,7 @@ class DocumentElementFactory {
121
122
  }
122
123
  catch (e) { }
123
124
  if (oldChildElements.length !== newChildElements.length || oldChildElements.length === 0) {
124
- console.log(`Invalid table element to copy`, newElement, oldChildElements, newChildElements);
125
+ telemetry_1.logger.debug(`Invalid table element to copy`);
125
126
  continue;
126
127
  }
127
128
  newElement = newTableElement;
@@ -5,10 +5,10 @@ var BackgroundSizeType;
5
5
  (function (BackgroundSizeType) {
6
6
  BackgroundSizeType["CONTAIN"] = "CONTAIN";
7
7
  BackgroundSizeType["COVER"] = "COVER";
8
- })(BackgroundSizeType = exports.BackgroundSizeType || (exports.BackgroundSizeType = {}));
8
+ })(BackgroundSizeType || (exports.BackgroundSizeType = BackgroundSizeType = {}));
9
9
  var LineType;
10
10
  (function (LineType) {
11
11
  LineType[LineType["STRAIGHT"] = 0] = "STRAIGHT";
12
12
  LineType[LineType["SQUARE"] = 1] = "SQUARE";
13
13
  LineType[LineType["CURVE"] = 2] = "CURVE";
14
- })(LineType = exports.LineType || (exports.LineType = {}));
14
+ })(LineType || (exports.LineType = LineType = {}));
@@ -9,4 +9,4 @@ var DocumentChangeType;
9
9
  DocumentChangeType["REORDER_ELEMENT"] = "REORDER_ELEMENT";
10
10
  DocumentChangeType["REGENERATE_LINEBOARD"] = "REGENERATE_LINEBOARD";
11
11
  DocumentChangeType["REBIND_MODEL"] = "REBIND_MODEL";
12
- })(DocumentChangeType = exports.DocumentChangeType || (exports.DocumentChangeType = {}));
12
+ })(DocumentChangeType || (exports.DocumentChangeType = DocumentChangeType = {}));
@@ -10,7 +10,7 @@ var DYNAMIC_TEXT_DATA_SOURCE;
10
10
  DYNAMIC_TEXT_DATA_SOURCE["BOARD"] = "board";
11
11
  DYNAMIC_TEXT_DATA_SOURCE["SHOWCASE"] = "showcase";
12
12
  DYNAMIC_TEXT_DATA_SOURCE["FRAME"] = "frame";
13
- })(DYNAMIC_TEXT_DATA_SOURCE = exports.DYNAMIC_TEXT_DATA_SOURCE || (exports.DYNAMIC_TEXT_DATA_SOURCE = {}));
13
+ })(DYNAMIC_TEXT_DATA_SOURCE || (exports.DYNAMIC_TEXT_DATA_SOURCE = DYNAMIC_TEXT_DATA_SOURCE = {}));
14
14
  var DynamicTextDisplayFunction;
15
15
  (function (DynamicTextDisplayFunction) {
16
16
  DynamicTextDisplayFunction["VALUE"] = "value";
@@ -22,7 +22,7 @@ var DynamicTextDisplayFunction;
22
22
  DynamicTextDisplayFunction["MAX"] = "max";
23
23
  DynamicTextDisplayFunction["AVERAGE"] = "average";
24
24
  DynamicTextDisplayFunction["SUM"] = "sum";
25
- })(DynamicTextDisplayFunction = exports.DynamicTextDisplayFunction || (exports.DynamicTextDisplayFunction = {}));
25
+ })(DynamicTextDisplayFunction || (exports.DynamicTextDisplayFunction = DynamicTextDisplayFunction = {}));
26
26
  exports.MOVE_TO_FRAME_TEXT = 'Move to a frame';
27
27
  exports.CLICK_TO_CONFIGURE = 'Click to configure';
28
28
  exports.HARD_CODED_TEXT = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/documents",
3
- "version": "1.3.24",
3
+ "version": "1.3.26-alpha-otel-logs-1",
4
4
  "description": "Documents library for contrail platform",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "build": "tsc",
9
9
  "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
10
10
  "lint": "tslint -p tsconfig.json",
11
- "test": "jest"
11
+ "test": "LOG_LEVEL=silent jest"
12
12
  },
13
13
  "keywords": [],
14
14
  "author": "",
@@ -21,7 +21,7 @@
21
21
  "ts-jest": "^29.1.1",
22
22
  "tslint": "^5.11.0",
23
23
  "tslint-config-prettier": "^1.18.0",
24
- "typescript": "^4.0.0"
24
+ "typescript": "^5.0.0"
25
25
  },
26
26
  "jest": {
27
27
  "moduleFileExtensions": [
@@ -40,8 +40,9 @@
40
40
  "dependencies": {
41
41
  "@contrail/actions": "^1.0.17",
42
42
  "@contrail/document-table": "^1.0.5",
43
+ "@contrail/document-util": "^1.0.15",
44
+ "@contrail/telemetry": "^1.1.0-alpha-frontend-logging-2",
43
45
  "@contrail/types": "^3.1.4",
44
- "@contrail/document-util": "^1.0.9",
45
46
  "reflect-metadata": "^0.1.13"
46
47
  }
47
48
  }