@contrail/documents 1.3.27 → 1.4.0-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,13 @@
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
+ ## [1.3.25] - (initial changelog entry)
11
+
12
+ - Initial changelog. Prior releases did not include a changelog.
13
+ 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
- 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;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DocumentElementFactory = void 0;
4
4
  const util_1 = require("@contrail/util");
5
+ const telemetry_1 = require("@contrail/telemetry");
5
6
  const nanoid_1 = require("nanoid");
6
7
  const components_1 = require("./components/components");
7
8
  const document_element_property_binding_handler_1 = require("./document-element-property-binding-handler");
@@ -37,7 +38,7 @@ class DocumentElementFactory {
37
38
  let element = this.initNewElement(type);
38
39
  element = Object.assign(element, options);
39
40
  if (((_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.length) > 0) {
40
- element.elements = element.elements.map(e => {
41
+ element.elements = element.elements.map((e) => {
41
42
  e.id = (0, nanoid_1.nanoid)(16);
42
43
  return e;
43
44
  });
@@ -81,7 +82,7 @@ class DocumentElementFactory {
81
82
  element.elements = elements;
82
83
  element.modelBindings = modelBindings;
83
84
  if (((_a = element === null || element === void 0 ? void 0 : element.elements) === null || _a === void 0 ? void 0 : _a.length) > 0) {
84
- element.elements = element.elements.map(e => {
85
+ element.elements = element.elements.map((e) => {
85
86
  e.id = (0, nanoid_1.nanoid)(16);
86
87
  return e;
87
88
  });
@@ -114,18 +115,18 @@ class DocumentElementFactory {
114
115
  }
115
116
  const newInnerElements = [];
116
117
  if (newElement.type === 'table') {
117
- const oldChildElements = elements.filter(e => e.tableId === element.id && ['cell', 'column', 'row'].indexOf(e.type) !== -1);
118
+ const oldChildElements = elements.filter((e) => e.tableId === element.id && ['cell', 'column', 'row'].indexOf(e.type) !== -1);
118
119
  let newTableElement, newChildElements = [];
119
120
  try {
120
121
  [newTableElement, ...newChildElements] = document_table_1.TableCopyService.copy(newElement, oldChildElements);
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.warn({ newElement, oldChildElements, newChildElements }, 'Invalid table element to copy');
125
126
  continue;
126
127
  }
127
128
  newElement = newTableElement;
128
- newChildElements.forEach(newChildElement => {
129
+ newChildElements.forEach((newChildElement) => {
129
130
  var _a;
130
131
  let oldChildId;
131
132
  if (newChildElement.type === 'row') {
@@ -137,7 +138,7 @@ class DocumentElementFactory {
137
138
  else if (newChildElement.type === 'cell') {
138
139
  const oldRowId = element.rowIds[newTableElement.rowIds.indexOf(newChildElement.rowId)];
139
140
  const oldColumnId = element.columnIds[newTableElement.columnIds.indexOf(newChildElement.columnId)];
140
- oldChildId = (_a = elements.find(e => e.type === 'cell' && e.rowId === oldRowId && e.columnId === oldColumnId)) === null || _a === void 0 ? void 0 : _a.id;
141
+ oldChildId = (_a = elements.find((e) => e.type === 'cell' && e.rowId === oldRowId && e.columnId === oldColumnId)) === null || _a === void 0 ? void 0 : _a.id;
141
142
  }
142
143
  newChildElement.documentId = documentId;
143
144
  newChildElement.specifiedId = newChildElement.id;
@@ -175,18 +176,18 @@ class DocumentElementFactory {
175
176
  if (DocumentElementFactory.isMask(newElement))
176
177
  maskElements.push(newElement);
177
178
  }
178
- groupElements.forEach(groupElement => {
179
+ groupElements.forEach((groupElement) => {
179
180
  groupElement.elementIds = groupElement.elementIds
180
- .map(oldElementId => oldIdToNewId.get(oldElementId))
181
- .filter(id => !!id);
181
+ .map((oldElementId) => oldIdToNewId.get(oldElementId))
182
+ .filter((id) => !!id);
182
183
  });
183
- maskElements.forEach(maskElement => {
184
+ maskElements.forEach((maskElement) => {
184
185
  const newElementIds = maskElement.elementIds
185
- .map(oldElementId => oldIdToNewId.get(oldElementId))
186
- .filter(id => !!id);
186
+ .map((oldElementId) => oldIdToNewId.get(oldElementId))
187
+ .filter((id) => !!id);
187
188
  maskElement.elementIds = (newElementIds === null || newElementIds === void 0 ? void 0 : newElementIds.length) > 0 ? newElementIds : null;
188
189
  });
189
- calloutElements.forEach(calloutElement => {
190
+ calloutElements.forEach((calloutElement) => {
190
191
  if (calloutElement.start.id) {
191
192
  const startId = oldIdToNewId.get(calloutElement.start.id);
192
193
  if (startId) {
package/lib/index.d.ts CHANGED
@@ -10,3 +10,4 @@ export * from './util/curved-line/point';
10
10
  export * from './util/curved-line/curved-line';
11
11
  export * from './util/callout/callout';
12
12
  export * from './document-frame.service';
13
+ export * from './log-something';
package/lib/index.js CHANGED
@@ -26,3 +26,4 @@ __exportStar(require("./util/curved-line/point"), exports);
26
26
  __exportStar(require("./util/curved-line/curved-line"), exports);
27
27
  __exportStar(require("./util/callout/callout"), exports);
28
28
  __exportStar(require("./document-frame.service"), exports);
29
+ __exportStar(require("./log-something"), exports);
@@ -0,0 +1 @@
1
+ export declare function logSomething(): void;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logSomething = logSomething;
4
+ const telemetry_1 = require("@contrail/telemetry");
5
+ function logSomething() {
6
+ telemetry_1.logger.info('logSomething from @contrail/documents');
7
+ }
@@ -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.27",
3
+ "version": "1.4.0-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 NODE_OPTIONS=--no-node-snapshot 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.8.3"
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.19",
43
- "@contrail/types": "^3.1.4",
44
43
  "@contrail/document-util": "^1.0.15",
44
+ "@contrail/telemetry": "^1.0.2",
45
+ "@contrail/types": "^3.1.4",
45
46
  "reflect-metadata": "^0.1.13"
46
47
  }
47
48
  }