@microsoft/applicationinsights-properties-js 2.8.0-beta.2203-03 → 2.8.0-beta.2203-06

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-properties-js",
3
- "version": "2.8.0-beta.2203-03",
3
+ "version": "2.8.0-beta.2203-06",
4
4
  "ext": {
5
5
  "@js": {
6
6
  "file": "applicationinsights-properties-js.js",
7
7
  "type": "text/javascript; charset=utf-8",
8
- "integrity": "sha256-fZV3Pc9flhZgJKP/11AG2RjE0plhOKWY932CMQyaStA= sha384-ANve0ecQ16sETx+vc5YkRVOhSppKo8Pr6ZiQt14nvpdD/KPkRsiboQUbwR5nOmeo sha512-1aiq1Fpc6Tvs69FRL9FbgpXm5gGja2z+9X1y/FjUBxrWMjhXaL3T3CAolDnrNkDbESWjVQQRq7F2Yk9JlxII6A==",
8
+ "integrity": "sha256-vH+L6jiVP7Fgwvy/6Gy0nGLGEL3tcGkNZp8eVPRa7xY= sha384-K1OirZr5I3rCIoE/+C2XXCovQwbTi74mZizL2lviL1RBDlTP2w65ta9coWgXpfTe sha512-/ja9JjL9ubbMvBLU0g7PXzlmbu5JF2IRXz1S9Q+nFOejetA2+8fLZe+LiUmW1kslO8/4a7Sg1GkjJEFeGU2pqg==",
9
9
  "hashes": {
10
- "sha256": "fZV3Pc9flhZgJKP/11AG2RjE0plhOKWY932CMQyaStA=",
11
- "sha384": "ANve0ecQ16sETx+vc5YkRVOhSppKo8Pr6ZiQt14nvpdD/KPkRsiboQUbwR5nOmeo",
12
- "sha512": "1aiq1Fpc6Tvs69FRL9FbgpXm5gGja2z+9X1y/FjUBxrWMjhXaL3T3CAolDnrNkDbESWjVQQRq7F2Yk9JlxII6A=="
10
+ "sha256": "vH+L6jiVP7Fgwvy/6Gy0nGLGEL3tcGkNZp8eVPRa7xY=",
11
+ "sha384": "K1OirZr5I3rCIoE/+C2XXCovQwbTi74mZizL2lviL1RBDlTP2w65ta9coWgXpfTe",
12
+ "sha512": "/ja9JjL9ubbMvBLU0g7PXzlmbu5JF2IRXz1S9Q+nFOejetA2+8fLZe+LiUmW1kslO8/4a7Sg1GkjJEFeGU2pqg=="
13
13
  }
14
14
  },
15
15
  "@min.js": {
16
16
  "file": "applicationinsights-properties-js.min.js",
17
17
  "type": "text/javascript; charset=utf-8",
18
- "integrity": "sha256-g1qsarkFPqXxJYlvQBrJner6JZ9/EOLj5jm7p932V78= sha384-+mtH5q1hm5i6+HW1JGwnxx6XqOUuxTmPQQ3mCyfnRwCqW/+lXNqA53L1qosNFz4j sha512-xpvJa1SE84lPrg4tH1rd2NSNO8L7LhnKDJyj+MnC30S35NogG8mAzQhxF9eA/FimrBKTZWEg5wjPKwxowKOGXA==",
18
+ "integrity": "sha256-UY+TPsRA7tTA7GpLHp+s7kPdpZAgaSFWG0dSgzb7nPE= sha384-LfkawEjJaxvUReU5TBTajdDXoZ2+KSXAeiIHhe/+QLFQ0zherBwAQUrm6i/KV422 sha512-STXgd4i5pRqWVbmUJvKZVO4STfZuFp+EpiNOlctFe9lkwM/bVd9XB7LI0vncA9novNm3U6nrXaHm9WLwdjXRIg==",
19
19
  "hashes": {
20
- "sha256": "g1qsarkFPqXxJYlvQBrJner6JZ9/EOLj5jm7p932V78=",
21
- "sha384": "+mtH5q1hm5i6+HW1JGwnxx6XqOUuxTmPQQ3mCyfnRwCqW/+lXNqA53L1qosNFz4j",
22
- "sha512": "xpvJa1SE84lPrg4tH1rd2NSNO8L7LhnKDJyj+MnC30S35NogG8mAzQhxF9eA/FimrBKTZWEg5wjPKwxowKOGXA=="
20
+ "sha256": "UY+TPsRA7tTA7GpLHp+s7kPdpZAgaSFWG0dSgzb7nPE=",
21
+ "sha384": "LfkawEjJaxvUReU5TBTajdDXoZ2+KSXAeiIHhe/+QLFQ0zherBwAQUrm6i/KV422",
22
+ "sha512": "STXgd4i5pRqWVbmUJvKZVO4STfZuFp+EpiNOlctFe9lkwM/bVd9XB7LI0vncA9novNm3U6nrXaHm9WLwdjXRIg=="
23
23
  }
24
24
  }
25
25
  }
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Properties Plugin, 2.8.0-beta.2203-03
2
+ * Application Insights JavaScript SDK - Properties Plugin, 2.8.0-beta.2203-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -327,6 +327,7 @@
327
327
  var strIsInitialized = "isInitialized";
328
328
  var strTeardown = "teardown";
329
329
  var strCore = "core";
330
+ var strUpdate = "update";
330
331
  var strDisabled = "disabled";
331
332
  var strDoTeardown = "_doTeardown";
332
333
 
@@ -654,7 +655,7 @@
654
655
  });
655
656
  return objFreeze(enumClass);
656
657
  }
657
- function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
658
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
658
659
  var theArgs = arguments;
659
660
  var extended = theArgs[0] || {};
660
661
  var argLen = theArgs.length;
@@ -964,6 +965,10 @@
964
965
  }
965
966
  return DiagnosticLogger;
966
967
  }());
968
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
969
+ if (isUserAct === void 0) { isUserAct = false; }
970
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
971
+ }
967
972
 
968
973
  var strExecutionContextKey = "ctx";
969
974
  var PerfEvent = /** @class */ (function () {
@@ -1290,7 +1295,7 @@
1290
1295
  completeDetails.func.call(completeDetails.self, completeDetails.args);
1291
1296
  }
1292
1297
  catch (e) {
1293
- core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1298
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1294
1299
  }
1295
1300
  });
1296
1301
  _onComplete = [];
@@ -1389,6 +1394,27 @@
1389
1394
  context.createNew = _createNew;
1390
1395
  return context;
1391
1396
  }
1397
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1398
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1399
+ var context = internalContext.ctx;
1400
+ function _processNext(updateState) {
1401
+ return context.iterate(function (plugin) {
1402
+ if (isFunction(plugin[strUpdate])) {
1403
+ plugin[strUpdate](context, updateState);
1404
+ }
1405
+ });
1406
+ }
1407
+ function _createNew(plugins, startAt) {
1408
+ if (plugins === void 0) { plugins = null; }
1409
+ if (isArray(plugins)) {
1410
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1411
+ }
1412
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1413
+ }
1414
+ context.processNext = _processNext;
1415
+ context.createNew = _createNew;
1416
+ return context;
1417
+ }
1392
1418
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1393
1419
  var firstProxy = null;
1394
1420
  var add = startAt ? false : true;
@@ -1435,6 +1461,7 @@
1435
1461
  },
1436
1462
  processTelemetry: _processTelemetry,
1437
1463
  unload: _unloadPlugin,
1464
+ update: _updatePlugin,
1438
1465
  _id: chainId,
1439
1466
  _setNext: function (nextPlugin) {
1440
1467
  nextProxy = nextPlugin;
@@ -1474,7 +1501,7 @@
1474
1501
  hasRun = true;
1475
1502
  }
1476
1503
  if (!nextProxy || !hasNextRun) {
1477
- itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1504
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1478
1505
  }
1479
1506
  }
1480
1507
  }, details, isAsync);
@@ -1522,6 +1549,24 @@
1522
1549
  unloadCtx.processNext(unloadState);
1523
1550
  }
1524
1551
  }
1552
+ function _updatePlugin(updateCtx, updateState) {
1553
+ function _callUpdate() {
1554
+ var hasRun = false;
1555
+ if (plugin) {
1556
+ var pluginState = _getPluginState(plugin);
1557
+ var pluginCore = plugin[strCore] || pluginState.core;
1558
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1559
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1560
+ hasRun = true;
1561
+ }
1562
+ }
1563
+ }
1564
+ return hasRun;
1565
+ }
1566
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1567
+ updateCtx.processNext(updateState);
1568
+ }
1569
+ }
1525
1570
  return objFreeze(proxyChain);
1526
1571
  }
1527
1572
 
@@ -1691,7 +1736,7 @@
1691
1736
  _supportsCookies = doc[strCookie] !== undefined;
1692
1737
  }
1693
1738
  catch (e) {
1694
- logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1739
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1695
1740
  }
1696
1741
  }
1697
1742
  return _supportsCookies;
@@ -1785,7 +1830,7 @@
1785
1830
  handler(unloadCtx, unloadState);
1786
1831
  }
1787
1832
  catch (e) {
1788
- unloadCtx.diagLog().throwInternal(2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1833
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1789
1834
  }
1790
1835
  });
1791
1836
  handlers = [];
@@ -1844,6 +1889,30 @@
1844
1889
  }
1845
1890
  return result;
1846
1891
  };
1892
+ _self.update = function (updateCtx, updateState) {
1893
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1894
+ return;
1895
+ }
1896
+ var result;
1897
+ var updateDone = false;
1898
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1899
+ var theUpdateState = updateState || {
1900
+ reason: 0
1901
+ };
1902
+ function _updateCallback() {
1903
+ if (!updateDone) {
1904
+ updateDone = true;
1905
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
1906
+ }
1907
+ }
1908
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
1909
+ _updateCallback();
1910
+ }
1911
+ else {
1912
+ result = true;
1913
+ }
1914
+ return result;
1915
+ };
1847
1916
  _self._addHook = function (hooks) {
1848
1917
  if (hooks) {
1849
1918
  if (isArray(hooks)) {
@@ -2045,7 +2114,7 @@
2045
2114
  name = strTrim(name.toString());
2046
2115
  if (name.length > 150 ) {
2047
2116
  nameTrunc = name.substring(0, 150 );
2048
- logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2117
+ _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
2049
2118
  }
2050
2119
  }
2051
2120
  return nameTrunc || name;
@@ -2058,7 +2127,7 @@
2058
2127
  value = strTrim(value);
2059
2128
  if (value.toString().length > maxLength) {
2060
2129
  valueTrunc = value.toString().substring(0, maxLength);
2061
- logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2130
+ _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
2062
2131
  }
2063
2132
  }
2064
2133
  return valueTrunc || value;
@@ -2075,7 +2144,7 @@
2075
2144
  value = getJSON().stringify(value);
2076
2145
  }
2077
2146
  catch (e) {
2078
- logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2147
+ _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
2079
2148
  }
2080
2149
  }
2081
2150
  value = dataSanitizeString(logger, value, 8192 );
@@ -2106,7 +2175,7 @@
2106
2175
  input = strTrim(input);
2107
2176
  if (input.length > maxLength) {
2108
2177
  inputTrunc = input.substring(0, maxLength);
2109
- logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2178
+ _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
2110
2179
  }
2111
2180
  }
2112
2181
  return inputTrunc || input;
@@ -2181,8 +2250,8 @@
2181
2250
  }
2182
2251
  return null;
2183
2252
  }
2184
- function utlCanUseLocalStorage() {
2185
- if (_canUseLocalStorage === undefined) {
2253
+ function utlCanUseLocalStorage(reset) {
2254
+ if (reset || _canUseLocalStorage === undefined) {
2186
2255
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2187
2256
  }
2188
2257
  return _canUseLocalStorage;
@@ -2195,7 +2264,7 @@
2195
2264
  }
2196
2265
  catch (e) {
2197
2266
  _canUseLocalStorage = false;
2198
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2267
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2199
2268
  }
2200
2269
  }
2201
2270
  return null;
@@ -2209,7 +2278,7 @@
2209
2278
  }
2210
2279
  catch (e) {
2211
2280
  _canUseLocalStorage = false;
2212
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2281
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2213
2282
  }
2214
2283
  }
2215
2284
  return false;
@@ -2223,7 +2292,7 @@
2223
2292
  }
2224
2293
  catch (e) {
2225
2294
  _canUseLocalStorage = false;
2226
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2295
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2227
2296
  }
2228
2297
  }
2229
2298
  return false;
@@ -2525,7 +2594,7 @@
2525
2594
  return Device;
2526
2595
  }());
2527
2596
 
2528
- var Version = "2.8.0-beta.2203-03";
2597
+ var Version = "2.8.0-beta.2203-06";
2529
2598
  var Internal = /** @class */ (function () {
2530
2599
  function Internal(config) {
2531
2600
  this.sdkVersion = (config.sdkExtension && config.sdkExtension() ? config.sdkExtension() + "_" : "") + "javascript:" + Version;