@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
  (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
 
@@ -673,18 +674,45 @@
673
674
  function throwError(message) {
674
675
  throw new Error(message);
675
676
  }
677
+ function _createProxyFunction(source, funcName) {
678
+ var srcFunc = null;
679
+ var src = null;
680
+ if (isFunction(source)) {
681
+ srcFunc = source;
682
+ }
683
+ else {
684
+ src = source;
685
+ }
686
+ return function () {
687
+ var originalArguments = arguments;
688
+ if (srcFunc) {
689
+ src = srcFunc();
690
+ }
691
+ if (src) {
692
+ return src[funcName].apply(src, originalArguments);
693
+ }
694
+ };
695
+ }
696
+ function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
697
+ if (overwriteTarget === void 0) { overwriteTarget = true; }
698
+ if (target && name && source) {
699
+ if (overwriteTarget || isUndefined(target[name])) {
700
+ target[name] = _createProxyFunction(source, theFunc);
701
+ }
702
+ }
703
+ }
676
704
  function createEnumStyle(values) {
677
705
  var enumClass = {};
678
706
  objForEachKey(values, function (field, value) {
679
707
  enumClass[field] = value;
680
708
  if (!isUndefined(enumClass[value])) {
681
- throwError("Value: [" + value + "] already exists for " + field);
709
+ throwError("[" + value + "] exists for " + field);
682
710
  }
683
711
  enumClass[value] = field;
684
712
  });
685
713
  return objFreeze(enumClass);
686
714
  }
687
- function objExtend(obj, obj2, obj3, obj4, obj5, obj6) {
715
+ function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
688
716
  var theArgs = arguments;
689
717
  var extended = theArgs[0] || {};
690
718
  var argLen = theArgs.length;
@@ -1031,6 +1059,10 @@
1031
1059
  }
1032
1060
  return DiagnosticLogger;
1033
1061
  }());
1062
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
1063
+ if (isUserAct === void 0) { isUserAct = false; }
1064
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
1065
+ }
1034
1066
 
1035
1067
  var strExecutionContextKey = "ctx";
1036
1068
  var PerfEvent = /** @class */ (function () {
@@ -1317,8 +1349,11 @@
1317
1349
  return createTelemetryProxyChain([startAt], config, core);
1318
1350
  }
1319
1351
  function _createInternalContext(telemetryChain, config, core, startAt) {
1320
- var _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1352
+ var _nextProxy = null;
1321
1353
  var _onComplete = [];
1354
+ if (startAt !== null) {
1355
+ _nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
1356
+ }
1322
1357
  var context = {
1323
1358
  _next: _moveNext,
1324
1359
  ctx: {
@@ -1368,7 +1403,7 @@
1368
1403
  completeDetails.func.call(completeDetails.self, completeDetails.args);
1369
1404
  }
1370
1405
  catch (e) {
1371
- core.logger.throwInternal(2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1406
+ _throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
1372
1407
  }
1373
1408
  });
1374
1409
  _onComplete = [];
@@ -1467,6 +1502,27 @@
1467
1502
  context.createNew = _createNew;
1468
1503
  return context;
1469
1504
  }
1505
+ function createProcessTelemetryUpdateContext(telemetryChain, config, core, startAt) {
1506
+ var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
1507
+ var context = internalContext.ctx;
1508
+ function _processNext(updateState) {
1509
+ return context.iterate(function (plugin) {
1510
+ if (isFunction(plugin[strUpdate])) {
1511
+ plugin[strUpdate](context, updateState);
1512
+ }
1513
+ });
1514
+ }
1515
+ function _createNew(plugins, startAt) {
1516
+ if (plugins === void 0) { plugins = null; }
1517
+ if (isArray(plugins)) {
1518
+ plugins = createTelemetryProxyChain(plugins, config, core, startAt);
1519
+ }
1520
+ return createProcessTelemetryUpdateContext(plugins || context.getNext(), config, core, startAt);
1521
+ }
1522
+ context.processNext = _processNext;
1523
+ context.createNew = _createNew;
1524
+ return context;
1525
+ }
1470
1526
  function createTelemetryProxyChain(plugins, config, core, startAt) {
1471
1527
  var firstProxy = null;
1472
1528
  var add = startAt ? false : true;
@@ -1513,6 +1569,7 @@
1513
1569
  },
1514
1570
  processTelemetry: _processTelemetry,
1515
1571
  unload: _unloadPlugin,
1572
+ update: _updatePlugin,
1516
1573
  _id: chainId,
1517
1574
  _setNext: function (nextPlugin) {
1518
1575
  nextProxy = nextPlugin;
@@ -1552,7 +1609,7 @@
1552
1609
  hasRun = true;
1553
1610
  }
1554
1611
  if (!nextProxy || !hasNextRun) {
1555
- itemCtx.diagLog().throwInternal(1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1612
+ _throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
1556
1613
  }
1557
1614
  }
1558
1615
  }, details, isAsync);
@@ -1600,6 +1657,24 @@
1600
1657
  unloadCtx.processNext(unloadState);
1601
1658
  }
1602
1659
  }
1660
+ function _updatePlugin(updateCtx, updateState) {
1661
+ function _callUpdate() {
1662
+ var hasRun = false;
1663
+ if (plugin) {
1664
+ var pluginState = _getPluginState(plugin);
1665
+ var pluginCore = plugin[strCore] || pluginState.core;
1666
+ if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
1667
+ if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
1668
+ hasRun = true;
1669
+ }
1670
+ }
1671
+ }
1672
+ return hasRun;
1673
+ }
1674
+ if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
1675
+ updateCtx.processNext(updateState);
1676
+ }
1677
+ }
1603
1678
  return objFreeze(proxyChain);
1604
1679
  }
1605
1680
 
@@ -1750,7 +1825,7 @@
1750
1825
  _supportsCookies = doc[strCookie] !== undefined;
1751
1826
  }
1752
1827
  catch (e) {
1753
- logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1828
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1754
1829
  }
1755
1830
  }
1756
1831
  return _supportsCookies;
@@ -1831,6 +1906,30 @@
1831
1906
 
1832
1907
  var strExtensionConfig = "extensionConfig";
1833
1908
 
1909
+ function createUnloadHandlerContainer() {
1910
+ var handlers = [];
1911
+ function _addHandler(handler) {
1912
+ if (handler) {
1913
+ handlers.push(handler);
1914
+ }
1915
+ }
1916
+ function _runHandlers(unloadCtx, unloadState) {
1917
+ arrForEach(handlers, function (handler) {
1918
+ try {
1919
+ handler(unloadCtx, unloadState);
1920
+ }
1921
+ catch (e) {
1922
+ _throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
1923
+ }
1924
+ });
1925
+ handlers = [];
1926
+ }
1927
+ return {
1928
+ add: _addHandler,
1929
+ run: _runHandlers
1930
+ };
1931
+ }
1932
+
1834
1933
  var strGetPlugin = "getPlugin";
1835
1934
  var BaseTelemetryPlugin = /** @class */ (function () {
1836
1935
  function BaseTelemetryPlugin() {
@@ -1838,6 +1937,7 @@
1838
1937
  var _isinitialized;
1839
1938
  var _rootCtx;
1840
1939
  var _nextPlugin;
1940
+ var _unloadHandlerContainer;
1841
1941
  var _hooks;
1842
1942
  _initDefaults();
1843
1943
  dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
@@ -1859,6 +1959,7 @@
1859
1959
  function _unloadCallback() {
1860
1960
  if (!unloadDone) {
1861
1961
  unloadDone = true;
1962
+ _unloadHandlerContainer.run(theUnloadCtx, unloadState);
1862
1963
  arrForEach(_hooks, function (fn) {
1863
1964
  fn.rm();
1864
1965
  });
@@ -1877,6 +1978,30 @@
1877
1978
  }
1878
1979
  return result;
1879
1980
  };
1981
+ _self.update = function (updateCtx, updateState) {
1982
+ if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
1983
+ return;
1984
+ }
1985
+ var result;
1986
+ var updateDone = false;
1987
+ var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
1988
+ var theUpdateState = updateState || {
1989
+ reason: 0
1990
+ };
1991
+ function _updateCallback() {
1992
+ if (!updateDone) {
1993
+ updateDone = true;
1994
+ _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
1995
+ }
1996
+ }
1997
+ if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
1998
+ _updateCallback();
1999
+ }
2000
+ else {
2001
+ result = true;
2002
+ }
2003
+ return result;
2004
+ };
1880
2005
  _self._addHook = function (hooks) {
1881
2006
  if (hooks) {
1882
2007
  if (isArray(hooks)) {
@@ -1887,6 +2012,7 @@
1887
2012
  }
1888
2013
  }
1889
2014
  };
2015
+ proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
1890
2016
  });
1891
2017
  _self.diagLog = function (itemCtx) {
1892
2018
  return _getTelCtx(itemCtx).diagLog();
@@ -1943,6 +2069,7 @@
1943
2069
  _rootCtx = null;
1944
2070
  _nextPlugin = null;
1945
2071
  _hooks = [];
2072
+ _unloadHandlerContainer = createUnloadHandlerContainer();
1946
2073
  }
1947
2074
  }
1948
2075
  return BaseTelemetryPlugin;
@@ -1963,12 +2090,12 @@
1963
2090
  }
1964
2091
  return name;
1965
2092
  }
1966
- function _getEvtNamespace(eventName, namespaces) {
1967
- if (namespaces) {
2093
+ function _getEvtNamespace(eventName, evtNamespace) {
2094
+ if (evtNamespace) {
1968
2095
  var theNamespace_1 = "";
1969
- if (isArray(namespaces)) {
2096
+ if (isArray(evtNamespace)) {
1970
2097
  theNamespace_1 = "";
1971
- arrForEach(namespaces, function (name) {
2098
+ arrForEach(evtNamespace, function (name) {
1972
2099
  name = _normalizeNamespace(name);
1973
2100
  if (name) {
1974
2101
  if (name[0] !== ".") {
@@ -1979,7 +2106,7 @@
1979
2106
  });
1980
2107
  }
1981
2108
  else {
1982
- theNamespace_1 = _normalizeNamespace(namespaces);
2109
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
1983
2110
  }
1984
2111
  if (theNamespace_1) {
1985
2112
  if (theNamespace_1[0] !== ".") {
@@ -2499,8 +2626,8 @@
2499
2626
  _canUseLocalStorage = false;
2500
2627
  _canUseSessionStorage = false;
2501
2628
  }
2502
- function utlCanUseLocalStorage() {
2503
- if (_canUseLocalStorage === undefined) {
2629
+ function utlCanUseLocalStorage(reset) {
2630
+ if (reset || _canUseLocalStorage === undefined) {
2504
2631
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
2505
2632
  }
2506
2633
  return _canUseLocalStorage;
@@ -2513,7 +2640,7 @@
2513
2640
  }
2514
2641
  catch (e) {
2515
2642
  _canUseLocalStorage = false;
2516
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2643
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2517
2644
  }
2518
2645
  }
2519
2646
  return null;
@@ -2527,7 +2654,7 @@
2527
2654
  }
2528
2655
  catch (e) {
2529
2656
  _canUseLocalStorage = false;
2530
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2657
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
2531
2658
  }
2532
2659
  }
2533
2660
  return false;
@@ -2541,13 +2668,13 @@
2541
2668
  }
2542
2669
  catch (e) {
2543
2670
  _canUseLocalStorage = false;
2544
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2671
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2545
2672
  }
2546
2673
  }
2547
2674
  return false;
2548
2675
  }
2549
- function utlCanUseSessionStorage() {
2550
- if (_canUseSessionStorage === undefined) {
2676
+ function utlCanUseSessionStorage(reset) {
2677
+ if (reset || _canUseSessionStorage === undefined) {
2551
2678
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
2552
2679
  }
2553
2680
  return _canUseSessionStorage;
@@ -2569,7 +2696,7 @@
2569
2696
  }
2570
2697
  catch (e) {
2571
2698
  _canUseSessionStorage = false;
2572
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2699
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2573
2700
  }
2574
2701
  }
2575
2702
  return null;
@@ -2583,7 +2710,7 @@
2583
2710
  }
2584
2711
  catch (e) {
2585
2712
  _canUseSessionStorage = false;
2586
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2713
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2587
2714
  }
2588
2715
  }
2589
2716
  return false;
@@ -2597,7 +2724,7 @@
2597
2724
  }
2598
2725
  catch (e) {
2599
2726
  _canUseSessionStorage = false;
2600
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2727
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2601
2728
  }
2602
2729
  }
2603
2730
  return false;