@microsoft/applicationinsights-dependencies-js 2.8.0-beta.2203-04 → 2.8.0-beta.2203-05

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.
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "applicationinsights-dependencies-js",
3
- "version": "2.8.0-beta.2203-04",
3
+ "version": "2.8.0-beta.2203-05",
4
4
  "ext": {
5
5
  "@js": {
6
6
  "file": "applicationinsights-dependencies-js.js",
7
7
  "type": "text/javascript; charset=utf-8",
8
- "integrity": "sha256-VClLCm0jU5oXgdmC8WiCO31kpbnH4x7uh15nEkwb2nA= sha384-CNZT78nSUVtvxNu25AjUQib3yP0h9ic7SC+CAf24ktlLz15PouKrfkb+GCVmpF80 sha512-PsSzOTtdtTAxuXLfErLspHF8mIPeOiEhKANcZr9kFXkpOmTWqcquGowQhye6bnSoLA9d5GPHBJk6IAmxsjvU2A==",
8
+ "integrity": "sha256-MGJnDkF2aKf07AbIbC3VUTZkEGTWtwNXxfnr1gCaPas= sha384-KOLKxBZ7Ka3NwnKcPUGplMScvfYUyg6hI0DRIFc7ahEWaHTuXZwUSbBZGVZziwNH sha512-0tOiMkoIpPGXAkIupl0oZJgMDJOwQaknZSgxutIEZpEekjF9qiKZwle8lIhNaFh4kqNGVL8ZR8VCUAUkSS7S0A==",
9
9
  "hashes": {
10
- "sha256": "VClLCm0jU5oXgdmC8WiCO31kpbnH4x7uh15nEkwb2nA=",
11
- "sha384": "CNZT78nSUVtvxNu25AjUQib3yP0h9ic7SC+CAf24ktlLz15PouKrfkb+GCVmpF80",
12
- "sha512": "PsSzOTtdtTAxuXLfErLspHF8mIPeOiEhKANcZr9kFXkpOmTWqcquGowQhye6bnSoLA9d5GPHBJk6IAmxsjvU2A=="
10
+ "sha256": "MGJnDkF2aKf07AbIbC3VUTZkEGTWtwNXxfnr1gCaPas=",
11
+ "sha384": "KOLKxBZ7Ka3NwnKcPUGplMScvfYUyg6hI0DRIFc7ahEWaHTuXZwUSbBZGVZziwNH",
12
+ "sha512": "0tOiMkoIpPGXAkIupl0oZJgMDJOwQaknZSgxutIEZpEekjF9qiKZwle8lIhNaFh4kqNGVL8ZR8VCUAUkSS7S0A=="
13
13
  }
14
14
  },
15
15
  "@min.js": {
16
16
  "file": "applicationinsights-dependencies-js.min.js",
17
17
  "type": "text/javascript; charset=utf-8",
18
- "integrity": "sha256-xLHjbFkNqKiBsLzvZT4xzvfyOdiSemI9NQoJYBLdRWA= sha384-vWH8FeK5txjcwiguzHWpdEj4OWP3cq7O8e+B+O2ctAoie+J38vXwSadOG0t0zFVm sha512-p93/hMd05OfdEpTfye4l0RGT+pcs48QaLIZKNXegx/F77quTmPFyQq9ar0pkuWnVwF+6+QjOsoPPiXkb2ZaNZQ==",
18
+ "integrity": "sha256-mV4tY4MRAkuuyvBQ2xypFSqBOqGYhTyElfTw+xscQvE= sha384-1MSBPqUZwfS9eSw9o/rxs5JgkdWkXmmAwZ5zRE2ciPz0HCXxQ9HW9kOkwbnW8tTU sha512-ptvnXWfFWR36K/XyGXBOBtVTLgPSRUBEB8P0FCaziu3uB7WmZhAO8kIkyvakNdcu8wN6nK4vFRrZ6l0etgNvvw==",
19
19
  "hashes": {
20
- "sha256": "xLHjbFkNqKiBsLzvZT4xzvfyOdiSemI9NQoJYBLdRWA=",
21
- "sha384": "vWH8FeK5txjcwiguzHWpdEj4OWP3cq7O8e+B+O2ctAoie+J38vXwSadOG0t0zFVm",
22
- "sha512": "p93/hMd05OfdEpTfye4l0RGT+pcs48QaLIZKNXegx/F77quTmPFyQq9ar0pkuWnVwF+6+QjOsoPPiXkb2ZaNZQ=="
20
+ "sha256": "mV4tY4MRAkuuyvBQ2xypFSqBOqGYhTyElfTw+xscQvE=",
21
+ "sha384": "1MSBPqUZwfS9eSw9o/rxs5JgkdWkXmmAwZ5zRE2ciPz0HCXxQ9HW9kOkwbnW8tTU",
22
+ "sha512": "ptvnXWfFWR36K/XyGXBOBtVTLgPSRUBEB8P0FCaziu3uB7WmZhAO8kIkyvakNdcu8wN6nK4vFRrZ6l0etgNvvw=="
23
23
  }
24
24
  }
25
25
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-beta.2203-04
2
+ * Application Insights JavaScript SDK - Dependencies Plugin, 2.8.0-beta.2203-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -340,6 +340,7 @@
340
340
  var strIsInitialized = "isInitialized";
341
341
  var strTeardown = "teardown";
342
342
  var strCore = "core";
343
+ var strUpdate = "update";
343
344
  var strDisabled = "disabled";
344
345
  var strDoTeardown = "_doTeardown";
345
346
 
@@ -606,7 +607,7 @@
606
607
  });
607
608
  return objFreeze(enumClass);
608
609
  }
609
- function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
610
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
610
611
  var theArgs = arguments;
611
612
  var extended = theArgs[0] || {};
612
613
  var argLen = theArgs.length;
@@ -951,6 +952,10 @@
951
952
  }
952
953
  return DiagnosticLogger;
953
954
  }());
955
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
956
+ if (isUserAct === void 0) { isUserAct = false; }
957
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
958
+ }
954
959
 
955
960
  var strExecutionContextKey = "ctx";
956
961
  var PerfEvent = /** @class */ (function () {
@@ -1277,7 +1282,7 @@
1277
1282
  completeDetails.func.call(completeDetails.self, completeDetails.args);
1278
1283
  }
1279
1284
  catch (e) {
1280
- core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1285
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1281
1286
  }
1282
1287
  });
1283
1288
  _onComplete = [];
@@ -1376,6 +1381,27 @@
1376
1381
  context.createNew = _createNew;
1377
1382
  return context;
1378
1383
  }
1384
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1385
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1386
+ var context = internalContext.ctx;
1387
+ function _processNext(updateState) {
1388
+ return context.iterate(function (plugin) {
1389
+ if (isFunction(plugin[strUpdate])) {
1390
+ plugin[strUpdate](context, updateState);
1391
+ }
1392
+ });
1393
+ }
1394
+ function _createNew(plugins, startAt) {
1395
+ if (plugins === void 0) { plugins = null; }
1396
+ if (isArray(plugins)) {
1397
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1398
+ }
1399
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1400
+ }
1401
+ context.processNext = _processNext;
1402
+ context.createNew = _createNew;
1403
+ return context;
1404
+ }
1379
1405
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1380
1406
  var firstProxy = null;
1381
1407
  var add = startAt ? false : true;
@@ -1422,6 +1448,7 @@
1422
1448
  },
1423
1449
  processTelemetry: _processTelemetry,
1424
1450
  unload: _unloadPlugin,
1451
+ update: _updatePlugin,
1425
1452
  _id: chainId,
1426
1453
  _setNext: function (nextPlugin) {
1427
1454
  nextProxy = nextPlugin;
@@ -1461,7 +1488,7 @@
1461
1488
  hasRun = true;
1462
1489
  }
1463
1490
  if (!nextProxy || !hasNextRun) {
1464
- itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1491
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1465
1492
  }
1466
1493
  }
1467
1494
  }, details, isAsync);
@@ -1509,6 +1536,24 @@
1509
1536
  unloadCtx.processNext(unloadState);
1510
1537
  }
1511
1538
  }
1539
+ function _updatePlugin(updateCtx, updateState) {
1540
+ function _callUpdate() {
1541
+ var hasRun = false;
1542
+ if (plugin) {
1543
+ var pluginState = _getPluginState(plugin);
1544
+ var pluginCore = plugin[strCore] || pluginState.core;
1545
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1546
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1547
+ hasRun = true;
1548
+ }
1549
+ }
1550
+ }
1551
+ return hasRun;
1552
+ }
1553
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1554
+ updateCtx.processNext(updateState);
1555
+ }
1556
+ }
1512
1557
  return objFreeze(proxyChain);
1513
1558
  }
1514
1559
 
@@ -1527,7 +1572,7 @@
1527
1572
  handler(unloadCtx, unloadState);
1528
1573
  }
1529
1574
  catch (e) {
1530
- unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1575
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1531
1576
  }
1532
1577
  });
1533
1578
  handlers = [];
@@ -1586,6 +1631,30 @@
1586
1631
  }
1587
1632
  return result;
1588
1633
  };
1634
+ _self.update = function (updateCtx, updateState) {
1635
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1636
+ return;
1637
+ }
1638
+ var result;
1639
+ var updateDone = false;
1640
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1641
+ var theUpdateState = updateState || {
1642
+ reason: 0
1643
+ };
1644
+ function _updateCallback() {
1645
+ if (!updateDone) {
1646
+ updateDone = true;
1647
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
1648
+ }
1649
+ }
1650
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
1651
+ _updateCallback();
1652
+ }
1653
+ else {
1654
+ result = true;
1655
+ }
1656
+ return result;
1657
+ };
1589
1658
  _self._addHook = function (hooks) {
1590
1659
  if (hooks) {
1591
1660
  if (isArray(hooks)) {
@@ -1674,12 +1743,12 @@
1674
1743
  }
1675
1744
  return name;
1676
1745
  }
1677
- function _getEvtNamespace(eventName, namespaces) {
1678
- if (namespaces) {
1746
+ function _getEvtNamespace(eventName, evtNamespace) {
1747
+ if (evtNamespace) {
1679
1748
  var theNamespace_1 = "";
1680
- if (isArray(namespaces)) {
1749
+ if (isArray(evtNamespace)) {
1681
1750
  theNamespace_1 = "";
1682
- arrForEach(namespaces, function (name) {
1751
+ arrForEach(evtNamespace, function (name) {
1683
1752
  name = _normalizeNamespace(name);
1684
1753
  if (name) {
1685
1754
  if (name[0] !== ".") {
@@ -1690,7 +1759,7 @@
1690
1759
  });
1691
1760
  }
1692
1761
  else {
1693
- theNamespace_1 = _normalizeNamespace(namespaces);
1762
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
1694
1763
  }
1695
1764
  if (theNamespace_1) {
1696
1765
  if (theNamespace_1[0] !== ".") {
@@ -2049,7 +2118,7 @@
2049
2118
  name = strTrim(name.toString());
2050
2119
  if (name.length > 150 ) {
2051
2120
  nameTrunc = name.substring(0, 150 );
2052
- logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2121
+ _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2053
2122
  }
2054
2123
  }
2055
2124
  return nameTrunc || name;
@@ -2062,7 +2131,7 @@
2062
2131
  value = strTrim(value);
2063
2132
  if (value.toString().length > maxLength) {
2064
2133
  valueTrunc = value.toString().substring(0, maxLength);
2065
- logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2134
+ _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2066
2135
  }
2067
2136
  }
2068
2137
  return valueTrunc || value;
@@ -2079,7 +2148,7 @@
2079
2148
  value = getJSON().stringify(value);
2080
2149
  }
2081
2150
  catch (e) {
2082
- logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2151
+ _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2083
2152
  }
2084
2153
  }
2085
2154
  value = dataSanitizeString(logger, value, 8192 );
@@ -2107,7 +2176,7 @@
2107
2176
  input = strTrim(input);
2108
2177
  if (input.length > maxLength) {
2109
2178
  inputTrunc = input.substring(0, maxLength);
2110
- logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2179
+ _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2111
2180
  }
2112
2181
  }
2113
2182
  return inputTrunc || input;