@contrail/util 1.1.15-alpha-7 → 1.1.15-alpha-8

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.
@@ -17,6 +17,7 @@ exports.withTimingSync = withTimingSync;
17
17
  exports.displayTimingTree = displayTimingTree;
18
18
  exports.startSpan = startSpan;
19
19
  exports.endSpan = endSpan;
20
+ const crypto_1 = require("crypto");
20
21
  const DEFAULT_TIMING_PROFILE = {
21
22
  activeSpans: new Map(),
22
23
  spansById: new Map(),
@@ -56,13 +57,13 @@ function withTimingAsync(label, fn, options) {
56
57
  return __awaiter(this, void 0, void 0, function* () {
57
58
  const start = performance.now();
58
59
  const chosenId = options === null || options === void 0 ? void 0 : options.parentNodeId;
59
- const uniqueId = crypto.randomUUID();
60
+ const uniqueId = (0, crypto_1.randomUUID)();
60
61
  const timingNode = {
61
62
  label,
62
63
  durationMs: 0,
63
64
  children: [],
64
65
  id: uniqueId,
65
- startTime: start
66
+ startTime: start,
66
67
  };
67
68
  setSpanId(uniqueId, timingNode);
68
69
  const parent = chosenId ? getNodeById(chosenId) : getParentNode();
@@ -88,13 +89,13 @@ function withTimingAsync(label, fn, options) {
88
89
  function withTimingSync(label, fn, options) {
89
90
  const start = performance.now();
90
91
  const chosenId = options === null || options === void 0 ? void 0 : options.parentNodeId;
91
- const uniqueId = crypto.randomUUID();
92
+ const uniqueId = (0, crypto_1.randomUUID)();
92
93
  const timingNode = {
93
94
  label,
94
95
  durationMs: 0,
95
96
  children: [],
96
97
  id: uniqueId,
97
- startTime: start
98
+ startTime: start,
98
99
  };
99
100
  setSpanId(uniqueId, timingNode);
100
101
  const parent = chosenId ? getNodeById(chosenId) : getParentNode();
@@ -133,10 +134,10 @@ function displayTimingTree(nodes = DEFAULT_TIMING_PROFILE.timingSpans, depth = 0
133
134
  currentGroup = [node];
134
135
  }
135
136
  else {
136
- const hasOverlap = currentGroup.some(groupNode => {
137
+ const hasOverlap = currentGroup.some((groupNode) => {
137
138
  const nodeEnd = node.startTime + node.durationMs;
138
139
  const groupNodeEnd = groupNode.startTime + groupNode.durationMs;
139
- return (node.startTime < groupNodeEnd && nodeEnd > groupNode.startTime);
140
+ return node.startTime < groupNodeEnd && nodeEnd > groupNode.startTime;
140
141
  });
141
142
  if (hasOverlap) {
142
143
  currentGroup.push(node);
@@ -193,13 +194,13 @@ function startSpan(spanName, options) {
193
194
  }
194
195
  const startTime = performance.now();
195
196
  const chosenId = options === null || options === void 0 ? void 0 : options.parentNodeId;
196
- const uniqueId = crypto.randomUUID();
197
+ const uniqueId = (0, crypto_1.randomUUID)();
197
198
  const timingNode = {
198
199
  label: spanName,
199
200
  durationMs: 0,
200
201
  children: [],
201
202
  id: uniqueId,
202
- startTime: startTime
203
+ startTime: startTime,
203
204
  };
204
205
  setSpanId(uniqueId, timingNode);
205
206
  const parent = chosenId ? getNodeById(chosenId) : getParentNode();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrail/util",
3
- "version": "1.1.15-alpha-7",
3
+ "version": "1.1.15-alpha-8",
4
4
  "description": "General JavaScript utilities",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",