@microsoft/applicationinsights-debugplugin-js 2.8.0-beta.2203-02 → 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.
Files changed (51) hide show
  1. package/browser/{ai.dbg.2.8.0-beta.2203-02.cjs.js → ai.dbg.2.8.0-beta.2203-05.cjs.js} +150 -23
  2. package/browser/ai.dbg.2.8.0-beta.2203-05.cjs.js.map +1 -0
  3. package/browser/ai.dbg.2.8.0-beta.2203-05.cjs.min.js +6 -0
  4. package/browser/ai.dbg.2.8.0-beta.2203-05.cjs.min.js.map +1 -0
  5. package/browser/{ai.dbg.2.8.0-beta.2203-02.gbl.js → ai.dbg.2.8.0-beta.2203-05.gbl.js} +150 -23
  6. package/browser/ai.dbg.2.8.0-beta.2203-05.gbl.js.map +1 -0
  7. package/browser/ai.dbg.2.8.0-beta.2203-05.gbl.min.js +6 -0
  8. package/browser/ai.dbg.2.8.0-beta.2203-05.gbl.min.js.map +1 -0
  9. package/browser/ai.dbg.2.8.0-beta.2203-05.integrity.json +66 -0
  10. package/browser/{ai.dbg.2.8.0-beta.2203-02.js → ai.dbg.2.8.0-beta.2203-05.js} +150 -23
  11. package/browser/ai.dbg.2.8.0-beta.2203-05.js.map +1 -0
  12. package/browser/ai.dbg.2.8.0-beta.2203-05.min.js +6 -0
  13. package/browser/ai.dbg.2.8.0-beta.2203-05.min.js.map +1 -0
  14. package/browser/ai.dbg.2.cjs.js +149 -22
  15. package/browser/ai.dbg.2.cjs.js.map +1 -1
  16. package/browser/ai.dbg.2.cjs.min.js +2 -2
  17. package/browser/ai.dbg.2.cjs.min.js.map +1 -1
  18. package/browser/ai.dbg.2.gbl.js +149 -22
  19. package/browser/ai.dbg.2.gbl.js.map +1 -1
  20. package/browser/ai.dbg.2.gbl.min.js +2 -2
  21. package/browser/ai.dbg.2.gbl.min.js.map +1 -1
  22. package/browser/ai.dbg.2.js +149 -22
  23. package/browser/ai.dbg.2.js.map +1 -1
  24. package/browser/ai.dbg.2.min.js +2 -2
  25. package/browser/ai.dbg.2.min.js.map +1 -1
  26. package/dist/applicationinsights-debugplugin-js.d.ts +1 -1
  27. package/dist/applicationinsights-debugplugin-js.js +149 -22
  28. package/dist/applicationinsights-debugplugin-js.js.map +1 -1
  29. package/dist/applicationinsights-debugplugin-js.min.js +2 -2
  30. package/dist/applicationinsights-debugplugin-js.min.js.map +1 -1
  31. package/dist/applicationinsights-debugplugin-js.rollup.d.ts +1 -1
  32. package/dist-esm/DebugPlugin.js +1 -1
  33. package/dist-esm/applicationinsights-debugplugin-js.js +1 -1
  34. package/dist-esm/components/Dashboard.js +1 -1
  35. package/dist-esm/components/LogEntry.js +1 -1
  36. package/dist-esm/components/debugBins.js +1 -1
  37. package/dist-esm/components/filterList.js +1 -1
  38. package/dist-esm/components/helpers.js +1 -1
  39. package/dist-esm/components/styleNodeSrc.js +1 -1
  40. package/dist-esm/interfaces/IDebugPluginConfig.js +1 -1
  41. package/package.json +3 -3
  42. package/browser/ai.dbg.2.8.0-beta.2203-02.cjs.js.map +0 -1
  43. package/browser/ai.dbg.2.8.0-beta.2203-02.cjs.min.js +0 -6
  44. package/browser/ai.dbg.2.8.0-beta.2203-02.cjs.min.js.map +0 -1
  45. package/browser/ai.dbg.2.8.0-beta.2203-02.gbl.js.map +0 -1
  46. package/browser/ai.dbg.2.8.0-beta.2203-02.gbl.min.js +0 -6
  47. package/browser/ai.dbg.2.8.0-beta.2203-02.gbl.min.js.map +0 -1
  48. package/browser/ai.dbg.2.8.0-beta.2203-02.integrity.json +0 -66
  49. package/browser/ai.dbg.2.8.0-beta.2203-02.js.map +0 -1
  50. package/browser/ai.dbg.2.8.0-beta.2203-02.min.js +0 -6
  51. package/browser/ai.dbg.2.8.0-beta.2203-02.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Debug Plugin, 2.8.0-beta.2203-02
2
+ * Application Insights JavaScript SDK - Debug Plugin, 2.8.0-beta.2203-05
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  'use strict';
@@ -325,6 +325,7 @@ var strSetNextPlugin = "setNextPlugin";
325
325
  var strIsInitialized = "isInitialized";
326
326
  var strTeardown = "teardown";
327
327
  var strCore = "core";
328
+ var strUpdate = "update";
328
329
  var strDisabled = "disabled";
329
330
  var strDoTeardown = "_doTeardown";
330
331
 
@@ -671,18 +672,45 @@ function isTruthy(value) {
671
672
  function throwError(message) {
672
673
  throw new Error(message);
673
674
  }
675
+ function _createProxyFunction(source, funcName) {
676
+ var srcFunc = null;
677
+ var src = null;
678
+ if (isFunction(source)) {
679
+ srcFunc = source;
680
+ }
681
+ else {
682
+ src = source;
683
+ }
684
+ return function () {
685
+ var originalArguments = arguments;
686
+ if (srcFunc) {
687
+ src = srcFunc();
688
+ }
689
+ if (src) {
690
+ return src[funcName].apply(src, originalArguments);
691
+ }
692
+ };
693
+ }
694
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
695
+ if (overwriteTarget === void 0) { overwriteTarget = true; }
696
+ if (target && name && source) {
697
+ if (overwriteTarget || isUndefined(target[name])) {
698
+ target[name] = _createProxyFunction(source, theFunc);
699
+ }
700
+ }
701
+ }
674
702
  function createEnumStyle(values) {
675
703
  var enumClass = {};
676
704
  objForEachKey(values, function (field, value) {
677
705
  enumClass[field] = value;
678
706
  if (!isUndefined(enumClass[value])) {
679
- throwError("Value: [" + value + "] already exists for " + field);
707
+ throwError("[" + value + "] exists for " + field);
680
708
  }
681
709
  enumClass[value] = field;
682
710
  });
683
711
  return objFreeze(enumClass);
684
712
  }
685
- function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
713
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
686
714
  var theArgs = arguments;
687
715
  var extended = theArgs[0] || {};
688
716
  var argLen = theArgs.length;
@@ -1029,6 +1057,10 @@ var DiagnosticLogger = /** @class */ (function () {
1029
1057
  }
1030
1058
  return DiagnosticLogger;
1031
1059
  }());
1060
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1061
+ if (isUserAct === void 0) { isUserAct = false; }
1062
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1063
+ }
1032
1064
 
1033
1065
  var strExecutionContextKey = "ctx";
1034
1066
  var PerfEvent = /** @class */ (function () {
@@ -1315,8 +1347,11 @@ function _getNextProxyStart(proxy, config, core, startAt) {
1315
1347
  return createTelemetryProxyChain([startAt], config, core);
1316
1348
  }
1317
1349
  function _createInternalContext(telemetryChain, config, core, startAt) {
1318
- var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1350
+ var _nextProxy = null;
1319
1351
  var _onComplete = [];
1352
+ if (startAt !== null) {
1353
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1354
+ }
1320
1355
  var context = {
1321
1356
  _next: _moveNext,
1322
1357
  ctx: {
@@ -1366,7 +1401,7 @@ function _createInternalContext(telemetryChain, config, core, startAt) {
1366
1401
  completeDetails.func.call(completeDetails.self, completeDetails.args);
1367
1402
  }
1368
1403
  catch (e) {
1369
- core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1404
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1370
1405
  }
1371
1406
  });
1372
1407
  _onComplete = [];
@@ -1465,6 +1500,27 @@ function createProcessTelemetryUnloadContext(telemetryChain, config, core, start
1465
1500
  context.createNew = _createNew;
1466
1501
  return context;
1467
1502
  }
1503
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1504
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1505
+ var context = internalContext.ctx;
1506
+ function _processNext(updateState) {
1507
+ return context.iterate(function (plugin) {
1508
+ if (isFunction(plugin[strUpdate])) {
1509
+ plugin[strUpdate](context, updateState);
1510
+ }
1511
+ });
1512
+ }
1513
+ function _createNew(plugins, startAt) {
1514
+ if (plugins === void 0) { plugins = null; }
1515
+ if (isArray(plugins)) {
1516
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1517
+ }
1518
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1519
+ }
1520
+ context.processNext = _processNext;
1521
+ context.createNew = _createNew;
1522
+ return context;
1523
+ }
1468
1524
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1469
1525
  var firstProxy = null;
1470
1526
  var add = startAt ? false : true;
@@ -1511,6 +1567,7 @@ function createTelemetryPluginProxy(plugin, config, core) {
1511
1567
  },
1512
1568
  processTelemetry: _processTelemetry,
1513
1569
  unload: _unloadPlugin,
1570
+ update: _updatePlugin,
1514
1571
  _id: chainId,
1515
1572
  _setNext: function (nextPlugin) {
1516
1573
  nextProxy = nextPlugin;
@@ -1550,7 +1607,7 @@ function createTelemetryPluginProxy(plugin, config, core) {
1550
1607
  hasRun = true;
1551
1608
  }
1552
1609
  if (!nextProxy || !hasNextRun) {
1553
- itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1610
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1554
1611
  }
1555
1612
  }
1556
1613
  }, details, isAsync);
@@ -1598,6 +1655,24 @@ function createTelemetryPluginProxy(plugin, config, core) {
1598
1655
  unloadCtx.processNext(unloadState);
1599
1656
  }
1600
1657
  }
1658
+ function _updatePlugin(updateCtx, updateState) {
1659
+ function _callUpdate() {
1660
+ var hasRun = false;
1661
+ if (plugin) {
1662
+ var pluginState = _getPluginState(plugin);
1663
+ var pluginCore = plugin[strCore] || pluginState.core;
1664
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1665
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1666
+ hasRun = true;
1667
+ }
1668
+ }
1669
+ }
1670
+ return hasRun;
1671
+ }
1672
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1673
+ updateCtx.processNext(updateState);
1674
+ }
1675
+ }
1601
1676
  return objFreeze(proxyChain);
1602
1677
  }
1603
1678
 
@@ -1748,7 +1823,7 @@ function areCookiesSupported(logger) {
1748
1823
  _supportsCookies = doc[strCookie] !== undefined;
1749
1824
  }
1750
1825
  catch (e) {
1751
- logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1826
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1752
1827
  }
1753
1828
  }
1754
1829
  return _supportsCookies;
@@ -1829,6 +1904,30 @@ function uaDisallowsSameSiteNone(userAgent) {
1829
1904
 
1830
1905
  var strExtensionConfig = "extensionConfig";
1831
1906
 
1907
+ function createUnloadHandlerContainer() {
1908
+ var handlers = [];
1909
+ function _addHandler(handler) {
1910
+ if (handler) {
1911
+ handlers.push(handler);
1912
+ }
1913
+ }
1914
+ function _runHandlers(unloadCtx, unloadState) {
1915
+ arrForEach(handlers, function (handler) {
1916
+ try {
1917
+ handler(unloadCtx, unloadState);
1918
+ }
1919
+ catch (e) {
1920
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1921
+ }
1922
+ });
1923
+ handlers = [];
1924
+ }
1925
+ return {
1926
+ add: _addHandler,
1927
+ run: _runHandlers
1928
+ };
1929
+ }
1930
+
1832
1931
  var strGetPlugin = "getPlugin";
1833
1932
  var BaseTelemetryPlugin = /** @class */ (function () {
1834
1933
  function BaseTelemetryPlugin() {
@@ -1836,6 +1935,7 @@ var BaseTelemetryPlugin = /** @class */ (function () {
1836
1935
  var _isinitialized;
1837
1936
  var _rootCtx;
1838
1937
  var _nextPlugin;
1938
+ var _unloadHandlerContainer;
1839
1939
  var _hooks;
1840
1940
  _initDefaults();
1841
1941
  dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
@@ -1857,6 +1957,7 @@ var BaseTelemetryPlugin = /** @class */ (function () {
1857
1957
  function _unloadCallback() {
1858
1958
  if (!unloadDone) {
1859
1959
  unloadDone = true;
1960
+ _unloadHandlerContainer.run(theUnloadCtx, unloadState);
1860
1961
  arrForEach(_hooks, function (fn) {
1861
1962
  fn.rm();
1862
1963
  });
@@ -1875,6 +1976,30 @@ var BaseTelemetryPlugin = /** @class */ (function () {
1875
1976
  }
1876
1977
  return result;
1877
1978
  };
1979
+ _self.update = function (updateCtx, updateState) {
1980
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1981
+ return;
1982
+ }
1983
+ var result;
1984
+ var updateDone = false;
1985
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1986
+ var theUpdateState = updateState || {
1987
+ reason: 0
1988
+ };
1989
+ function _updateCallback() {
1990
+ if (!updateDone) {
1991
+ updateDone = true;
1992
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
1993
+ }
1994
+ }
1995
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
1996
+ _updateCallback();
1997
+ }
1998
+ else {
1999
+ result = true;
2000
+ }
2001
+ return result;
2002
+ };
1878
2003
  _self._addHook = function (hooks) {
1879
2004
  if (hooks) {
1880
2005
  if (isArray(hooks)) {
@@ -1885,6 +2010,7 @@ var BaseTelemetryPlugin = /** @class */ (function () {
1885
2010
  }
1886
2011
  }
1887
2012
  };
2013
+ proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
1888
2014
  });
1889
2015
  _self.diagLog = function (itemCtx) {
1890
2016
  return _getTelCtx(itemCtx).diagLog();
@@ -1941,6 +2067,7 @@ var BaseTelemetryPlugin = /** @class */ (function () {
1941
2067
  _rootCtx = null;
1942
2068
  _nextPlugin = null;
1943
2069
  _hooks = [];
2070
+ _unloadHandlerContainer = createUnloadHandlerContainer();
1944
2071
  }
1945
2072
  }
1946
2073
  return BaseTelemetryPlugin;
@@ -1961,12 +2088,12 @@ function _normalizeNamespace(name) {
1961
2088
  }
1962
2089
  return name;
1963
2090
  }
1964
- function _getEvtNamespace(eventName, namespaces) {
1965
- if (namespaces) {
2091
+ function _getEvtNamespace(eventName, evtNamespace) {
2092
+ if (evtNamespace) {
1966
2093
  var theNamespace_1 = "";
1967
- if (isArray(namespaces)) {
2094
+ if (isArray(evtNamespace)) {
1968
2095
  theNamespace_1 = "";
1969
- arrForEach(namespaces, function (name) {
2096
+ arrForEach(evtNamespace, function (name) {
1970
2097
  name = _normalizeNamespace(name);
1971
2098
  if (name) {
1972
2099
  if (name[0] !== ".") {
@@ -1977,7 +2104,7 @@ function _getEvtNamespace(eventName, namespaces) {
1977
2104
  });
1978
2105
  }
1979
2106
  else {
1980
- theNamespace_1 = _normalizeNamespace(namespaces);
2107
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
1981
2108
  }
1982
2109
  if (theNamespace_1) {
1983
2110
  if (theNamespace_1[0] !== ".") {
@@ -2497,8 +2624,8 @@ function utlDisableStorage() {
2497
2624
  _canUseLocalStorage = false;
2498
2625
  _canUseSessionStorage = false;
2499
2626
  }
2500
- function utlCanUseLocalStorage() {
2501
- if (_canUseLocalStorage === undefined) {
2627
+ function utlCanUseLocalStorage(reset) {
2628
+ if (reset || _canUseLocalStorage === undefined) {
2502
2629
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2503
2630
  }
2504
2631
  return _canUseLocalStorage;
@@ -2511,7 +2638,7 @@ function utlGetLocalStorage(logger, name) {
2511
2638
  }
2512
2639
  catch (e) {
2513
2640
  _canUseLocalStorage = false;
2514
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2641
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2515
2642
  }
2516
2643
  }
2517
2644
  return null;
@@ -2525,7 +2652,7 @@ function utlSetLocalStorage(logger, name, data) {
2525
2652
  }
2526
2653
  catch (e) {
2527
2654
  _canUseLocalStorage = false;
2528
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2655
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2529
2656
  }
2530
2657
  }
2531
2658
  return false;
@@ -2539,13 +2666,13 @@ function utlRemoveStorage(logger, name) {
2539
2666
  }
2540
2667
  catch (e) {
2541
2668
  _canUseLocalStorage = false;
2542
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2669
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2543
2670
  }
2544
2671
  }
2545
2672
  return false;
2546
2673
  }
2547
- function utlCanUseSessionStorage() {
2548
- if (_canUseSessionStorage === undefined) {
2674
+ function utlCanUseSessionStorage(reset) {
2675
+ if (reset || _canUseSessionStorage === undefined) {
2549
2676
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
2550
2677
  }
2551
2678
  return _canUseSessionStorage;
@@ -2567,7 +2694,7 @@ function utlGetSessionStorage(logger, name) {
2567
2694
  }
2568
2695
  catch (e) {
2569
2696
  _canUseSessionStorage = false;
2570
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2697
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2571
2698
  }
2572
2699
  }
2573
2700
  return null;
@@ -2581,7 +2708,7 @@ function utlSetSessionStorage(logger, name, data) {
2581
2708
  }
2582
2709
  catch (e) {
2583
2710
  _canUseSessionStorage = false;
2584
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2711
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2585
2712
  }
2586
2713
  }
2587
2714
  return false;
@@ -2595,7 +2722,7 @@ function utlRemoveSessionStorage(logger, name) {
2595
2722
  }
2596
2723
  catch (e) {
2597
2724
  _canUseSessionStorage = false;
2598
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2725
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2599
2726
  }
2600
2727
  }
2601
2728
  return false;
@@ -3830,4 +3957,4 @@ var DebugPlugin = /** @class */ (function (_super) {
3830
3957
  var DebugPlugin$1 = DebugPlugin;
3831
3958
 
3832
3959
  exports.DebugPlugin = DebugPlugin$1;
3833
- //# sourceMappingURL=ai.dbg.2.8.0-beta.2203-02.cjs.js.map
3960
+ //# sourceMappingURL=ai.dbg.2.8.0-beta.2203-05.cjs.js.map