@microsoft/applicationinsights-core-js 3.0.0-beta.2211-04 → 3.0.0-beta.2212-03

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 (79) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +115 -133
  3. package/browser/applicationinsights-core-js.js.map +1 -1
  4. package/browser/applicationinsights-core-js.min.js +2 -2
  5. package/browser/applicationinsights-core-js.min.js.map +1 -1
  6. package/dist/applicationinsights-core-js.d.ts +1 -1
  7. package/dist/applicationinsights-core-js.js +115 -133
  8. package/dist/applicationinsights-core-js.js.map +1 -1
  9. package/dist/applicationinsights-core-js.min.js +2 -2
  10. package/dist/applicationinsights-core-js.min.js.map +1 -1
  11. package/dist/applicationinsights-core-js.rollup.d.ts +1 -1
  12. package/dist-esm/Config/ConfigDefaults.js +1 -1
  13. package/dist-esm/Config/DynamicConfig.js +1 -1
  14. package/dist-esm/Config/DynamicProperty.js +1 -1
  15. package/dist-esm/Config/DynamicState.js +1 -1
  16. package/dist-esm/Config/DynamicSupport.js +1 -1
  17. package/dist-esm/Config/IConfigDefaults.js +1 -1
  18. package/dist-esm/Config/IDynamicConfigHandler.js +1 -1
  19. package/dist-esm/Config/IDynamicPropertyHandler.js +1 -1
  20. package/dist-esm/Config/IDynamicWatcher.js +1 -1
  21. package/dist-esm/Config/_IDynamicConfigHandlerState.js +1 -1
  22. package/dist-esm/JavaScriptSDK/AggregationError.js +1 -1
  23. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +4 -6
  24. package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  25. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  26. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  27. package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
  28. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  29. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
  30. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  31. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  32. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  33. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  34. package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
  35. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  36. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  37. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  38. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  39. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  40. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  41. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  42. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +5 -8
  43. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  44. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  45. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  46. package/dist-esm/JavaScriptSDK/W3cTraceParent.js +1 -1
  47. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  50. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  51. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  52. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  53. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  54. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  55. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  56. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  57. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  64. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  66. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  67. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  70. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  71. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  72. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
  73. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
  74. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  75. package/dist-esm/__DynamicConstants.js +1 -1
  76. package/dist-esm/applicationinsights-core-js.js +1 -1
  77. package/package.json +2 -2
  78. package/src/JavaScriptSDK/AppInsightsCore.ts +3 -6
  79. package/src/JavaScriptSDK/TelemetryHelpers.ts +5 -6
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -34,14 +34,11 @@ export function initializePlugins(processContext, extensions) {
34
34
  // Set this plugin as the next for the previous one
35
35
  lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);
36
36
  }
37
- var isInitialized = false;
38
- if (isFunction(thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */])) {
37
+ pluginState = _getPluginState(thePlugin);
38
+ var isInitialized = !!pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];
39
+ if (thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]) {
39
40
  isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();
40
41
  }
41
- else {
42
- pluginState = _getPluginState(thePlugin);
43
- isInitialized = pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];
44
- }
45
42
  if (!isInitialized) {
46
43
  initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);
47
44
  }
@@ -54,7 +51,7 @@ export function initializePlugins(processContext, extensions) {
54
51
  var core = processContext[STR_CORE /* @min:%2ecore */]();
55
52
  thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());
56
53
  pluginState = _getPluginState(thePlugin);
57
- // Only add the core to the state if the plugin didn't set it (doesn't extent from BaseTelemetryPlugin)
54
+ // Only add the core to the state if the plugin didn't set it (doesn't extend from BaseTelemetryPlugin)
58
55
  if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {
59
56
  pluginState[STR_CORE] = core;
60
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TelemetryHelpers.js.map","sources":["TelemetryHelpers.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { arrForEach, isFunction } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CALL, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_SPAN_ID, _DYN_TEARDOWN, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { STR_CORE, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config - The current config for the instance\r\n * @param core - THe current core instance\r\n * @param extensions - The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (thePlugin) {\r\n if (lastPlugin && lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] && thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);\r\n }\r\n var isInitialized = false;\r\n if (isFunction(thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */])) {\r\n isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();\r\n }\r\n else {\r\n pluginState = _getPluginState(thePlugin);\r\n isInitialized = pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];\r\n }\r\n if (!isInitialized) {\r\n initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext[STR_CORE /* @min:%2ecore */]();\r\n thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extent from BaseTelemetryPlugin)\r\n if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {\r\n pluginState[STR_CORE] = core;\r\n }\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = true;\r\n delete pluginState[_DYN_TEARDOWN /* @min:%2eteardown */];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = extB[STR_PROCESS_TELEMETRY];\r\n if (extA[STR_PROCESS_TELEMETRY]) {\r\n result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components[_DYN_LENGTH /* @min:%2elength */]) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component._doUnload || component[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */];\r\n if (isFunction(func)) {\r\n if (func[_DYN_CALL /* @min:%2ecall */](component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace[_DYN_TRACE_ID /* @min:%2etraceId */];\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace[_DYN_TRACE_ID /* @min:%2etraceId */] = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace[_DYN_SPAN_ID /* @min:%2espanId */];\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace[_DYN_SPAN_ID /* @min:%2espanId */] = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"TelemetryHelpers.js.map","sources":["TelemetryHelpers.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { arrForEach, isFunction } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CALL, _DYN_GET_NEXT, _DYN_GET_PLUGIN, _DYN_INITIALIZE, _DYN_IS_INITIALIZED, _DYN_LENGTH, _DYN_NAME, _DYN_PUSH, _DYN_SET_NEXT_PLUGIN, _DYN_SPAN_ID, _DYN_TEARDOWN, _DYN_TRACE_FLAGS, _DYN_TRACE_ID, _DYN__DO_TEARDOWN } from \"../__DynamicConstants\";\r\nimport { createElmNodeData } from \"./DataCacheHelper\";\r\nimport { STR_CORE, STR_PRIORITY, STR_PROCESS_TELEMETRY } from \"./InternalConstants\";\r\nimport { isValidSpanId, isValidTraceId } from \"./W3cTraceParent\";\r\nvar pluginStateData = createElmNodeData(\"plugin\");\r\nexport function _getPluginState(plugin) {\r\n return pluginStateData.get(plugin, \"state\", {}, true);\r\n}\r\n/**\r\n * Initialize the queue of plugins\r\n * @param plugins - The array of plugins to initialize and setting of the next plugin\r\n * @param config - The current config for the instance\r\n * @param core - THe current core instance\r\n * @param extensions - The extensions\r\n */\r\nexport function initializePlugins(processContext, extensions) {\r\n // Set the next plugin and identified the uninitialized plugins\r\n var initPlugins = [];\r\n var lastPlugin = null;\r\n var proxy = processContext[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n var pluginState;\r\n while (proxy) {\r\n var thePlugin = proxy[_DYN_GET_PLUGIN /* @min:%2egetPlugin */]();\r\n if (thePlugin) {\r\n if (lastPlugin && lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */] && thePlugin[STR_PROCESS_TELEMETRY /* @min:%2eprocessTelemetry */]) {\r\n // Set this plugin as the next for the previous one\r\n lastPlugin[_DYN_SET_NEXT_PLUGIN /* @min:%2esetNextPlugin */](thePlugin);\r\n }\r\n pluginState = _getPluginState(thePlugin);\r\n var isInitialized = !!pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */];\r\n if (thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]) {\r\n isInitialized = thePlugin[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */]();\r\n }\r\n if (!isInitialized) {\r\n initPlugins[_DYN_PUSH /* @min:%2epush */](thePlugin);\r\n }\r\n lastPlugin = thePlugin;\r\n proxy = proxy[_DYN_GET_NEXT /* @min:%2egetNext */]();\r\n }\r\n }\r\n // Now initialize the plugins\r\n arrForEach(initPlugins, function (thePlugin) {\r\n var core = processContext[STR_CORE /* @min:%2ecore */]();\r\n thePlugin[_DYN_INITIALIZE /* @min:%2einitialize */](processContext.getCfg(), core, extensions, processContext[_DYN_GET_NEXT /* @min:%2egetNext */]());\r\n pluginState = _getPluginState(thePlugin);\r\n // Only add the core to the state if the plugin didn't set it (doesn't extend from BaseTelemetryPlugin)\r\n if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {\r\n pluginState[STR_CORE] = core;\r\n }\r\n pluginState[_DYN_IS_INITIALIZED /* @min:%2eisInitialized */] = true;\r\n delete pluginState[_DYN_TEARDOWN /* @min:%2eteardown */];\r\n });\r\n}\r\nexport function sortPlugins(plugins) {\r\n // Sort by priority\r\n return plugins.sort(function (extA, extB) {\r\n var result = 0;\r\n if (extB) {\r\n var bHasProcess = extB[STR_PROCESS_TELEMETRY];\r\n if (extA[STR_PROCESS_TELEMETRY]) {\r\n result = bHasProcess ? extA[STR_PRIORITY] - extB[STR_PRIORITY] : 1;\r\n }\r\n else if (bHasProcess) {\r\n result = -1;\r\n }\r\n }\r\n else {\r\n result = extA ? 1 : -1;\r\n }\r\n return result;\r\n });\r\n // sort complete\r\n}\r\n/**\r\n * Teardown / Unload helper to perform teardown/unloading operations for the provided components synchronously or asynchronously, this will call any\r\n * _doTeardown() or _doUnload() functions on the provided components to allow them to finish removal.\r\n * @param components - The components you want to unload\r\n * @param unloadCtx - This is the context that should be used during unloading.\r\n * @param unloadState - The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.\r\n * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.\r\n * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.\r\n */\r\nexport function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {\r\n var idx = 0;\r\n function _doUnload() {\r\n while (idx < components[_DYN_LENGTH /* @min:%2elength */]) {\r\n var component = components[idx++];\r\n if (component) {\r\n var func = component._doUnload || component[_DYN__DO_TEARDOWN /* @min:%2e_doTeardown */];\r\n if (isFunction(func)) {\r\n if (func[_DYN_CALL /* @min:%2ecall */](component, unloadCtx, unloadState, _doUnload) === true) {\r\n return true;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n return _doUnload();\r\n}\r\n/**\r\n * Creates a IDistributedTraceContext which optionally also \"sets\" the value on a parent\r\n * @param parentCtx - An optional parent distributed trace instance\r\n * @returns A new IDistributedTraceContext instance that uses an internal temporary object\r\n */\r\nexport function createDistributedTraceContext(parentCtx) {\r\n var trace = {};\r\n return {\r\n getName: function () {\r\n return trace[_DYN_NAME /* @min:%2ename */];\r\n },\r\n setName: function (newValue) {\r\n parentCtx && parentCtx.setName(newValue);\r\n trace[_DYN_NAME /* @min:%2ename */] = newValue;\r\n },\r\n getTraceId: function () {\r\n return trace[_DYN_TRACE_ID /* @min:%2etraceId */];\r\n },\r\n setTraceId: function (newValue) {\r\n parentCtx && parentCtx.setTraceId(newValue);\r\n if (isValidTraceId(newValue)) {\r\n trace[_DYN_TRACE_ID /* @min:%2etraceId */] = newValue;\r\n }\r\n },\r\n getSpanId: function () {\r\n return trace[_DYN_SPAN_ID /* @min:%2espanId */];\r\n },\r\n setSpanId: function (newValue) {\r\n parentCtx && parentCtx.setSpanId(newValue);\r\n if (isValidSpanId(newValue)) {\r\n trace[_DYN_SPAN_ID /* @min:%2espanId */] = newValue;\r\n }\r\n },\r\n getTraceFlags: function () {\r\n return trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */];\r\n },\r\n setTraceFlags: function (newTraceFlags) {\r\n parentCtx && parentCtx.setTraceFlags(newTraceFlags);\r\n trace[_DYN_TRACE_FLAGS /* @min:%2etraceFlags */] = newTraceFlags;\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=TelemetryHelpers.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  //
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { isArray, isString, strLeft, strTrim } from "@nevware21/ts-utils";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  "use strict";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  "use strict";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 3.0.0-beta.2211-04
2
+ * Application Insights JavaScript SDK - Core, 3.0.0-beta.2212-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export { MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-core-js",
3
3
  "author": "Microsoft Application Insights Team",
4
- "version": "3.0.0-beta.2211-04",
4
+ "version": "3.0.0-beta.2212-03",
5
5
  "description": "Microsoft Application Insights Core Javascript SDK",
6
6
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
7
7
  "keywords": [
@@ -66,7 +66,7 @@
66
66
  "dependencies": {
67
67
  "@microsoft/applicationinsights-shims": "2.0.2",
68
68
  "@microsoft/dynamicproto-js": "^1.1.7",
69
- "@nevware21/ts-utils": "^0.5.0"
69
+ "@nevware21/ts-utils": "^0.6.0"
70
70
  },
71
71
  "publishConfig": {
72
72
  "tag": "beta"
@@ -825,11 +825,8 @@ export class AppInsightsCore implements IAppInsightsCore {
825
825
  // Add any channels provided in the extensions and sort them
826
826
  _channels = sortPlugins(arrAppend(_channels, theExtensions.channels));
827
827
 
828
- // Sort the complete set of extensions by priority
829
- let allExtensions = sortPlugins(theExtensions.core);
830
-
831
- // Add on "channelController" as the last "plugin"
832
- arrAppend(allExtensions, _channels);
828
+ // Create an array of all extensions, including the _channels
829
+ let allExtensions = arrAppend(sortPlugins(theExtensions.core), _channels);
833
830
 
834
831
  // Required to allow plugins to call core.getPlugin() during their own initialization
835
832
  _extensions = objFreeze(allExtensions);
@@ -841,7 +838,7 @@ export class AppInsightsCore implements IAppInsightsCore {
841
838
  initializePlugins(rootCtx.createNew(_channels), allExtensions);
842
839
  }
843
840
 
844
- // Now initialize the normal extensions
841
+ // Now initialize the normal extensions (explicitly not including the _channels as this can cause duplicate initialization)
845
842
  initializePlugins(rootCtx, allExtensions);
846
843
 
847
844
  if (updateState) {
@@ -51,12 +51,11 @@ export function initializePlugins(processContext: IProcessTelemetryContext, exte
51
51
  lastPlugin.setNextPlugin(thePlugin);
52
52
  }
53
53
 
54
- let isInitialized = false;
55
- if (isFunction(thePlugin.isInitialized)) {
54
+ pluginState = _getPluginState(thePlugin);
55
+
56
+ let isInitialized = !!pluginState.isInitialized;
57
+ if (thePlugin.isInitialized) {
56
58
  isInitialized = thePlugin.isInitialized();
57
- } else {
58
- pluginState = _getPluginState(thePlugin);
59
- isInitialized = pluginState.isInitialized;
60
59
  }
61
60
 
62
61
  if (!isInitialized) {
@@ -80,7 +79,7 @@ export function initializePlugins(processContext: IProcessTelemetryContext, exte
80
79
 
81
80
  pluginState = _getPluginState(thePlugin);
82
81
 
83
- // Only add the core to the state if the plugin didn't set it (doesn't extent from BaseTelemetryPlugin)
82
+ // Only add the core to the state if the plugin didn't set it (doesn't extend from BaseTelemetryPlugin)
84
83
  if (!thePlugin[STR_CORE] && !pluginState[STR_CORE]) {
85
84
  pluginState[STR_CORE] = core;
86
85
  }