@microsoft/applicationinsights-core-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-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.
Files changed (167) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +2440 -1199
  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.api.json +16710 -8876
  7. package/dist/applicationinsights-core-js.api.md +465 -140
  8. package/dist/applicationinsights-core-js.d.ts +856 -217
  9. package/dist/applicationinsights-core-js.js +2440 -1199
  10. package/dist/applicationinsights-core-js.js.map +1 -1
  11. package/dist/applicationinsights-core-js.min.js +2 -2
  12. package/dist/applicationinsights-core-js.min.js.map +1 -1
  13. package/dist/applicationinsights-core-js.rollup.d.ts +856 -217
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +4 -72
  15. package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
  16. package/dist-esm/JavaScriptSDK/BaseCore.js +496 -99
  17. package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
  18. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +120 -21
  19. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
  20. package/dist-esm/JavaScriptSDK/ChannelController.js +202 -87
  21. package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
  22. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  23. package/dist-esm/JavaScriptSDK/CookieMgr.js +4 -4
  24. package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
  25. package/dist-esm/JavaScriptSDK/CoreUtils.js +7 -148
  26. package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
  27. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +93 -0
  28. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -0
  29. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  30. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +45 -12
  31. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
  32. package/dist-esm/JavaScriptSDK/EnvUtils.js +13 -12
  33. package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
  34. package/dist-esm/JavaScriptSDK/EventHelpers.js +477 -0
  35. package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -0
  36. package/dist-esm/JavaScriptSDK/HelperFuncs.js +80 -86
  37. package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
  38. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
  39. package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
  40. package/dist-esm/JavaScriptSDK/InternalConstants.js +28 -0
  41. package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -0
  42. package/dist-esm/JavaScriptSDK/NotificationManager.js +37 -42
  43. package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
  44. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  45. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +430 -119
  46. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
  47. package/dist-esm/JavaScriptSDK/RandomHelper.js +30 -4
  48. package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
  49. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +60 -14
  50. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
  51. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +81 -0
  52. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
  53. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +33 -0
  54. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -0
  55. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +51 -0
  56. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -0
  57. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +10 -9
  58. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js.map +1 -1
  59. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +90 -96
  60. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js.map +1 -1
  61. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +8 -0
  63. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js.map +1 -0
  64. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +8 -0
  65. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js.map +1 -0
  66. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
  67. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  70. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  71. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  72. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  73. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  74. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  75. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  76. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  77. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  78. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  79. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
  80. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
  81. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  82. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  83. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -2
  84. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js.map +1 -1
  85. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +8 -0
  86. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js.map +1 -0
  87. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +8 -0
  88. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js.map +1 -0
  89. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +6 -0
  90. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js.map +1 -0
  91. package/dist-esm/applicationinsights-core-js.js +13 -7
  92. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  93. package/package.json +2 -2
  94. package/src/JavaScriptSDK/AppInsightsCore.ts +4 -105
  95. package/src/JavaScriptSDK/BaseCore.ts +696 -120
  96. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +205 -31
  97. package/src/JavaScriptSDK/ChannelController.ts +242 -103
  98. package/src/JavaScriptSDK/CookieMgr.ts +7 -5
  99. package/src/JavaScriptSDK/CoreUtils.ts +8 -172
  100. package/src/JavaScriptSDK/DataCacheHelper.ts +106 -0
  101. package/src/JavaScriptSDK/DiagnosticLogger.ts +49 -12
  102. package/src/JavaScriptSDK/EnvUtils.ts +13 -12
  103. package/src/JavaScriptSDK/EventHelpers.ts +550 -0
  104. package/src/JavaScriptSDK/HelperFuncs.ts +114 -97
  105. package/src/JavaScriptSDK/InstrumentHooks.ts +4 -2
  106. package/src/JavaScriptSDK/InternalConstants.ts +26 -0
  107. package/src/JavaScriptSDK/NotificationManager.ts +34 -37
  108. package/src/JavaScriptSDK/PerfManager.ts +4 -7
  109. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +543 -134
  110. package/src/JavaScriptSDK/RandomHelper.ts +35 -3
  111. package/src/JavaScriptSDK/TelemetryHelpers.ts +83 -21
  112. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +111 -0
  113. package/src/JavaScriptSDK/UnloadHandlerContainer.ts +46 -0
  114. package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +56 -0
  115. package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +48 -8
  116. package/src/JavaScriptSDK.Enums/LoggingEnums.ts +183 -87
  117. package/src/JavaScriptSDK.Enums/SendRequestReason.ts +5 -0
  118. package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +27 -0
  119. package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +27 -0
  120. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +82 -2
  121. package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +16 -5
  122. package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +16 -6
  123. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +94 -14
  124. package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
  125. package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +28 -10
  126. package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +9 -11
  127. package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +10 -0
  128. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +34 -0
  129. package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +17 -0
  130. package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
  131. package/types/JavaScriptSDK/BaseCore.d.ts +81 -3
  132. package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +53 -10
  133. package/types/JavaScriptSDK/ChannelController.d.ts +16 -17
  134. package/types/JavaScriptSDK/CoreUtils.d.ts +1 -48
  135. package/types/JavaScriptSDK/DataCacheHelper.d.ts +13 -0
  136. package/types/JavaScriptSDK/DiagnosticLogger.d.ts +23 -0
  137. package/types/JavaScriptSDK/EventHelpers.d.ts +154 -0
  138. package/types/JavaScriptSDK/HelperFuncs.d.ts +37 -32
  139. package/types/JavaScriptSDK/InternalConstants.d.ts +20 -0
  140. package/types/JavaScriptSDK/PerfManager.d.ts +1 -1
  141. package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +69 -6
  142. package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
  143. package/types/JavaScriptSDK/TelemetryHelpers.d.ts +23 -3
  144. package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +16 -0
  145. package/types/JavaScriptSDK/UnloadHandlerContainer.d.ts +11 -0
  146. package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +34 -0
  147. package/types/JavaScriptSDK.Enums/EventsDiscardedReason.d.ts +14 -9
  148. package/types/JavaScriptSDK.Enums/LoggingEnums.d.ts +89 -86
  149. package/types/JavaScriptSDK.Enums/SendRequestReason.d.ts +4 -0
  150. package/types/JavaScriptSDK.Enums/TelemetryUnloadReason.d.ts +21 -0
  151. package/types/JavaScriptSDK.Enums/TelemetryUpdateReason.d.ts +20 -0
  152. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +72 -1
  153. package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +16 -5
  154. package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +9 -0
  155. package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +82 -11
  156. package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
  157. package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +25 -8
  158. package/types/JavaScriptSDK.Interfaces/ITelemetryPluginChain.d.ts +9 -10
  159. package/types/JavaScriptSDK.Interfaces/ITelemetryUnloadState.d.ts +6 -0
  160. package/types/JavaScriptSDK.Interfaces/ITelemetryUpdateState.d.ts +22 -0
  161. package/types/JavaScriptSDK.Interfaces/IUnloadableComponent.d.ts +13 -0
  162. package/types/applicationinsights-core-js.d.ts +20 -10
  163. package/types/tsdoc-metadata.json +1 -1
  164. package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
  165. package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
  166. package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
  167. package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
@@ -1,12 +1,11 @@
1
1
  import { ITelemetryItem } from "./ITelemetryItem";
2
2
  import { IConfiguration } from "./IConfiguration";
3
3
  import { IAppInsightsCore } from "./IAppInsightsCore";
4
- import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
4
+ import { IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext } from "./IProcessTelemetryContext";
5
5
  import { ITelemetryPluginChain } from "./ITelemetryPluginChain";
6
- /**
7
- * Configuration provided to SDK core
8
- */
9
- export interface ITelemetryPlugin extends IPlugin {
6
+ import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
7
+ import { ITelemetryUpdateState } from "./ITelemetryUpdateState";
8
+ export interface ITelemetryProcessor {
10
9
  /**
11
10
  * Call back for telemetry processing before it it is sent
12
11
  * @param env - This is the current event being reported
@@ -15,6 +14,20 @@ export interface ITelemetryPlugin extends IPlugin {
15
14
  * to later plugins (vs appending items to the telemetry item)
16
15
  */
17
16
  processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
17
+ /**
18
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
19
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
20
+ * the configuration has bee updated.
21
+ * @param updateCtx - This is the context that should be used during updating.
22
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
23
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
24
+ */
25
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
26
+ }
27
+ /**
28
+ * Configuration provided to SDK core
29
+ */
30
+ export interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
18
31
  /**
19
32
  * Set next extension for telemetry processing, this is not optional as plugins should use the
20
33
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
@@ -42,10 +55,14 @@ export interface IPlugin {
42
55
  */
43
56
  isInitialized?: () => boolean;
44
57
  /**
45
- * Tear down the plugin and remove any hooked value, the plugin should remove that it is no longer initialized and
46
- * therefore can be re-initialized after being torn down.
58
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
59
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
60
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
61
+ * @param unloadCtx - This is the context that should be used during unloading.
62
+ * @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.
63
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
47
64
  */
48
- teardown?: () => void;
65
+ teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
49
66
  /**
50
67
  * Extension name
51
68
  */
@@ -1,10 +1,10 @@
1
- import { ITelemetryItem } from "./ITelemetryItem";
2
- import { IProcessTelemetryContext } from "./IProcessTelemetryContext";
3
- import { ITelemetryPlugin } from "./ITelemetryPlugin";
1
+ import { IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
2
+ import { ITelemetryPlugin, ITelemetryProcessor } from "./ITelemetryPlugin";
3
+ import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
4
4
  /**
5
5
  * Configuration provided to SDK core
6
6
  */
7
- export interface ITelemetryPluginChain {
7
+ export interface ITelemetryPluginChain extends ITelemetryProcessor {
8
8
  /**
9
9
  * Returns the underlying plugin that is being proxied for the processTelemetry call
10
10
  */
@@ -14,11 +14,10 @@ export interface ITelemetryPluginChain {
14
14
  */
15
15
  getNext: () => ITelemetryPluginChain;
16
16
  /**
17
- * Call back for telemetry processing before it it is sent
18
- * @param env - This is the current event being reported
19
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
20
- * can optionally use this to access the current core instance or define / pass additional information
21
- * to later plugins (vs appending items to the telemetry item)
17
+ * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
18
+ * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
19
+ * @param unloadCtx - The unload context to use for this call.
20
+ * @param unloadState - The details of the unload operation
22
21
  */
23
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
22
+ unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
24
23
  }
@@ -0,0 +1,6 @@
1
+ import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
2
+ export interface ITelemetryUnloadState {
3
+ reason: TelemetryUnloadReason;
4
+ isAsync: boolean;
5
+ flushComplete?: boolean;
6
+ }
@@ -0,0 +1,22 @@
1
+ import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
2
+ import { IPlugin } from "./ITelemetryPlugin";
3
+ export interface ITelemetryUpdateState {
4
+ /**
5
+ * Identifies the reason for the update notification, this is a bitwise numeric value
6
+ */
7
+ reason: TelemetryUpdateReason;
8
+ /**
9
+ * If this is a configuration update this was the previous configuration that was used
10
+ */
11
+ /**
12
+ * If this is a configuration update is the new configuration that is being used
13
+ */
14
+ /**
15
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
16
+ */
17
+ added?: IPlugin[];
18
+ /**
19
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
20
+ */
21
+ removed?: IPlugin[];
22
+ }
@@ -0,0 +1,13 @@
1
+ import { IProcessTelemetryUnloadContext } from "./IProcessTelemetryContext";
2
+ import { ITelemetryUnloadState } from "./ITelemetryUnloadState";
3
+ export interface IUnloadableComponent {
4
+ /**
5
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
6
+ * finishes it's removal.
7
+ * @param unloadCtx - This is the context that should be used during unloading.
8
+ * @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.
9
+ * @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.
10
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
11
+ */
12
+ _doUnload?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
13
+ }
@@ -1,21 +1,26 @@
1
1
  export { IConfiguration } from "./JavaScriptSDK.Interfaces/IConfiguration";
2
2
  export { IChannelControls, MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
3
3
  export { ITelemetryPlugin, IPlugin } from "./JavaScriptSDK.Interfaces/ITelemetryPlugin";
4
- export { IAppInsightsCore } from "./JavaScriptSDK.Interfaces/IAppInsightsCore";
4
+ export { IAppInsightsCore, ILoadedPlugin } from "./JavaScriptSDK.Interfaces/IAppInsightsCore";
5
5
  export { ITelemetryItem, ICustomProperties, Tags } from "./JavaScriptSDK.Interfaces/ITelemetryItem";
6
- export { IProcessTelemetryContext } from "./JavaScriptSDK.Interfaces/IProcessTelemetryContext";
6
+ export { IBaseProcessingContext, IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext, GetExtCfgMergeType } from "./JavaScriptSDK.Interfaces/IProcessTelemetryContext";
7
7
  export { INotificationListener } from "./JavaScriptSDK.Interfaces/INotificationListener";
8
8
  export { ITelemetryPluginChain } from "./JavaScriptSDK.Interfaces/ITelemetryPluginChain";
9
9
  export { IDiagnosticLogger } from "./JavaScriptSDK.Interfaces/IDiagnosticLogger";
10
10
  export { InstrumentorHooksCallback, IInstrumentHooksCallbacks, IInstrumentHooks, IInstrumentHook, IInstrumentCallDetails } from "./JavaScriptSDK.Interfaces/IInstrumentHooks";
11
- export { EventsDiscardedReason } from "./JavaScriptSDK.Enums/EventsDiscardedReason";
11
+ export { IUnloadableComponent } from "./JavaScriptSDK.Interfaces/IUnloadableComponent";
12
+ export { eEventsDiscardedReason, EventsDiscardedReason } from "./JavaScriptSDK.Enums/EventsDiscardedReason";
12
13
  export { SendRequestReason } from "./JavaScriptSDK.Enums/SendRequestReason";
14
+ export { TelemetryUpdateReason } from "./JavaScriptSDK.Enums/TelemetryUpdateReason";
15
+ export { TelemetryUnloadReason } from "./JavaScriptSDK.Enums/TelemetryUnloadReason";
13
16
  export { AppInsightsCore } from "./JavaScriptSDK/AppInsightsCore";
14
17
  export { BaseCore } from "./JavaScriptSDK/BaseCore";
15
18
  export { BaseTelemetryPlugin } from "./JavaScriptSDK/BaseTelemetryPlugin";
16
- export { randomValue, random32, mwcRandomSeed, mwcRandom32 } from "./JavaScriptSDK/RandomHelper";
17
- export { CoreUtils, ICoreUtils, EventHelper, IEventHelper, Undefined, addEventHandler, newGuid, perfNow, newId, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener } from "./JavaScriptSDK/CoreUtils";
18
- export { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, attachEvent, detachEvent, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal } from "./JavaScriptSDK/HelperFuncs";
19
+ export { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from "./JavaScriptSDK/RandomHelper";
20
+ export { CoreUtils, ICoreUtils, EventHelper, IEventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from "./JavaScriptSDK/CoreUtils";
21
+ export { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, objExtend, objToString } from "./JavaScriptSDK/HelperFuncs";
22
+ export { EnumValue, createEnumStyle, EnumMap, createEnumMap, createValueMap } from "./JavaScriptSDK.Enums/EnumHelperFuncs";
23
+ export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, _IRegisteredEvents, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
19
24
  export { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from "./JavaScriptSDK/EnvUtils";
20
25
  export { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from "@microsoft/applicationinsights-shims";
21
26
  export { NotificationManager } from "./JavaScriptSDK/NotificationManager";
@@ -23,13 +28,18 @@ export { INotificationManager } from "./JavaScriptSDK.Interfaces/INotificationMa
23
28
  export { IPerfEvent } from "./JavaScriptSDK.Interfaces/IPerfEvent";
24
29
  export { IPerfManager, IPerfManagerProvider } from "./JavaScriptSDK.Interfaces/IPerfManager";
25
30
  export { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from "./JavaScriptSDK/PerfManager";
26
- export { safeGetLogger, DiagnosticLogger, _InternalLogMessage } from "./JavaScriptSDK/DiagnosticLogger";
27
- export { ProcessTelemetryContext } from "./JavaScriptSDK/ProcessTelemetryContext";
28
- export { initializePlugins, sortPlugins } from "./JavaScriptSDK/TelemetryHelpers";
29
- export { _InternalMessageId, LoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
31
+ export { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from "./JavaScriptSDK/DiagnosticLogger";
32
+ export { ProcessTelemetryContext, createProcessTelemetryContext } from "./JavaScriptSDK/ProcessTelemetryContext";
33
+ export { initializePlugins, sortPlugins, unloadComponents } from "./JavaScriptSDK/TelemetryHelpers";
34
+ export { _InternalMessageId, _eInternalMessageId, LoggingSeverity, eLoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
30
35
  export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from "./JavaScriptSDK/InstrumentHooks";
31
36
  export { ICookieMgr, ICookieMgrConfig } from "./JavaScriptSDK.Interfaces/ICookieMgr";
32
37
  export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./JavaScriptSDK/CookieMgr";
33
38
  export { strIKey, strExtensionConfig } from "./JavaScriptSDK/Constants";
34
39
  export { IDbgExtension } from "./JavaScriptSDK.Interfaces/IDbgExtension";
35
40
  export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils";
41
+ export { TelemetryInitializerFunction, ITelemetryInitializerHandler, ITelemetryInitializerContainer } from "./JavaScriptSDK.Interfaces/ITelemetryInitializers";
42
+ export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
43
+ export { UnloadHandler, IUnloadHandlerContainer, createUnloadHandlerContainer } from "./JavaScriptSDK/UnloadHandlerContainer";
44
+ export { ITelemetryUpdateState } from "./JavaScriptSDK.Interfaces/ITelemetryUpdateState";
45
+ export { ITelemetryUnloadState } from "./JavaScriptSDK.Interfaces/ITelemetryUnloadState";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.19.4"
8
+ "packageVersion": "7.20.0"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,76 +0,0 @@
1
- /*
2
- * Application Insights JavaScript SDK - Core, 2.8.0-nightly.2202-06
3
- * Copyright (c) Microsoft and contributors. All rights reserved.
4
- */
5
-
6
-
7
- "use strict";
8
- import { doPerf } from "./PerfManager";
9
- import { LoggingSeverity, _InternalMessageId } from "../JavaScriptSDK.Enums/LoggingEnums";
10
- import { isFunction } from "./HelperFuncs";
11
- import { dumpObj } from "./EnvUtils";
12
- var TelemetryPluginChain = /** @class */ (function () {
13
- function TelemetryPluginChain(plugin, defItemCtx) {
14
- var _self = this;
15
- var _nextProxy = null;
16
- var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
17
- var _hasSetNext = isFunction(plugin.setNextPlugin);
18
- _self._hasRun = false;
19
- _self.getPlugin = function () {
20
- return plugin;
21
- };
22
- _self.getNext = function () {
23
- return _nextProxy;
24
- };
25
- _self.setNext = function (nextPlugin) {
26
- _nextProxy = nextPlugin;
27
- };
28
- _self.processTelemetry = function (env, itemCtx) {
29
- if (!itemCtx) {
30
- // Looks like a plugin didn't pass the (optional) context, so restore to the default
31
- itemCtx = defItemCtx;
32
- }
33
- var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
34
- doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
35
- if (plugin && _hasProcessTelemetry) {
36
- _self._hasRun = true;
37
- try {
38
- // Ensure that we keep the context in sync (for processNext()), just in case a plugin
39
- // doesn't calls processTelemetry() instead of itemContext.processNext() or some
40
- // other form of error occurred
41
- itemCtx.setNext(_nextProxy);
42
- if (_hasSetNext) {
43
- // Backward compatibility setting the next plugin on the instance
44
- plugin.setNextPlugin(_nextProxy);
45
- }
46
- // Set a flag on the next plugin so we know if it was attempted to be executed
47
- _nextProxy && (_nextProxy._hasRun = false);
48
- plugin.processTelemetry(env, itemCtx);
49
- }
50
- catch (error) {
51
- var hasRun = _nextProxy && _nextProxy._hasRun;
52
- if (!_nextProxy || !hasRun) {
53
- // Either we have no next plugin or the current one did not attempt to call the next plugin
54
- // Which means the current one is the root of the failure so log/report this failure
55
- itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
56
- }
57
- if (_nextProxy && !hasRun) {
58
- // As part of the failure the current plugin did not attempt to call the next plugin in the cahin
59
- // So rather than leave the pipeline dead in the water we call the next plugin
60
- _nextProxy.processTelemetry(env, itemCtx);
61
- }
62
- }
63
- }
64
- else if (_nextProxy) {
65
- _self._hasRun = true;
66
- // The underlying plugin is either not defined or does not have a processTelemetry implementation
67
- // so we still want the next plugin to be executed.
68
- _nextProxy.processTelemetry(env, itemCtx);
69
- }
70
- }, function () { return ({ item: env }); }, !(env.sync));
71
- };
72
- }
73
- return TelemetryPluginChain;
74
- }());
75
- export { TelemetryPluginChain };
76
- //# sourceMappingURL=TelemetryPluginChain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TelemetryPluginChain.js.map","sources":["TelemetryPluginChain.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n\"use strict\";\r\nimport { doPerf } from \"./PerfManager\";\r\nimport { LoggingSeverity, _InternalMessageId } from \"../JavaScriptSDK.Enums/LoggingEnums\";\r\nimport { isFunction } from \"./HelperFuncs\";\r\nimport { dumpObj } from \"./EnvUtils\";\r\nvar TelemetryPluginChain = /** @class */ (function () {\r\n function TelemetryPluginChain(plugin, defItemCtx) {\r\n var _self = this;\r\n var _nextProxy = null;\r\n var _hasProcessTelemetry = isFunction(plugin.processTelemetry);\r\n var _hasSetNext = isFunction(plugin.setNextPlugin);\r\n _self._hasRun = false;\r\n _self.getPlugin = function () {\r\n return plugin;\r\n };\r\n _self.getNext = function () {\r\n return _nextProxy;\r\n };\r\n _self.setNext = function (nextPlugin) {\r\n _nextProxy = nextPlugin;\r\n };\r\n _self.processTelemetry = function (env, itemCtx) {\r\n if (!itemCtx) {\r\n // Looks like a plugin didn't pass the (optional) context, so restore to the default\r\n itemCtx = defItemCtx;\r\n }\r\n var identifier = plugin ? plugin.identifier : \"TelemetryPluginChain\";\r\n doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + \":processTelemetry\"; }, function () {\r\n if (plugin && _hasProcessTelemetry) {\r\n _self._hasRun = true;\r\n try {\r\n // Ensure that we keep the context in sync (for processNext()), just in case a plugin\r\n // doesn't calls processTelemetry() instead of itemContext.processNext() or some\r\n // other form of error occurred\r\n itemCtx.setNext(_nextProxy);\r\n if (_hasSetNext) {\r\n // Backward compatibility setting the next plugin on the instance\r\n plugin.setNextPlugin(_nextProxy);\r\n }\r\n // Set a flag on the next plugin so we know if it was attempted to be executed\r\n _nextProxy && (_nextProxy._hasRun = false);\r\n plugin.processTelemetry(env, itemCtx);\r\n }\r\n catch (error) {\r\n var hasRun = _nextProxy && _nextProxy._hasRun;\r\n if (!_nextProxy || !hasRun) {\r\n // Either we have no next plugin or the current one did not attempt to call the next plugin\r\n // Which means the current one is the root of the failure so log/report this failure\r\n itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, \"Plugin [\" + plugin.identifier + \"] failed during processTelemetry - \" + dumpObj(error));\r\n }\r\n if (_nextProxy && !hasRun) {\r\n // As part of the failure the current plugin did not attempt to call the next plugin in the cahin\r\n // So rather than leave the pipeline dead in the water we call the next plugin\r\n _nextProxy.processTelemetry(env, itemCtx);\r\n }\r\n }\r\n }\r\n else if (_nextProxy) {\r\n _self._hasRun = true;\r\n // The underlying plugin is either not defined or does not have a processTelemetry implementation\r\n // so we still want the next plugin to be executed.\r\n _nextProxy.processTelemetry(env, itemCtx);\r\n }\r\n }, function () { return ({ item: env }); }, !(env.sync));\r\n };\r\n }\r\n return TelemetryPluginChain;\r\n}());\r\nexport { TelemetryPluginChain };\r\n//# sourceMappingURL=TelemetryPluginChain.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"}
@@ -1,120 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- "use strict";
4
-
5
- import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
6
- import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
7
- import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
8
- import { ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
9
- import { _InternalLogMessage } from "./DiagnosticLogger";
10
- import { doPerf } from "./PerfManager";
11
- import { LoggingSeverity, _InternalMessageId } from "../JavaScriptSDK.Enums/LoggingEnums";
12
- import { isFunction } from "./HelperFuncs";
13
- import { dumpObj } from "./EnvUtils";
14
-
15
- export class TelemetryPluginChain implements ITelemetryPluginChain {
16
-
17
- /**
18
- * Returns the underlying plugin that is being proxied for the processTelemetry call
19
- */
20
- getPlugin: () => ITelemetryPlugin;
21
-
22
- /**
23
- * Returns the next plugin
24
- */
25
- getNext: () => ITelemetryPluginChain;
26
-
27
- /**
28
- * Sets the next proxy to be executed as the next plugin
29
- * (Should only be used during initialization, which is why it's not defined on the interface)
30
- */
31
- setNext: (nextPlugin:ITelemetryPluginChain) => void;
32
-
33
- /**
34
- * Call back for telemetry processing before it it is sent
35
- * @param env - This is the current event being reported
36
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
37
- * can optionally use this to access the current core instance or define / pass additional information
38
- * to later plugins (vs appending items to the telemetry item)
39
- */
40
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
41
-
42
- /**
43
- * Internal flag used to try and identify root cause failures
44
- */
45
- private _hasRun: boolean;
46
-
47
- constructor(plugin:ITelemetryPlugin, defItemCtx:IProcessTelemetryContext) {
48
- let _self = this;
49
- let _nextProxy:ITelemetryPluginChain = null;
50
- let _hasProcessTelemetry = isFunction(plugin.processTelemetry);
51
- let _hasSetNext = isFunction(plugin.setNextPlugin);
52
-
53
- _self._hasRun = false;
54
-
55
- _self.getPlugin = () => {
56
- return plugin;
57
- };
58
-
59
- _self.getNext = () => {
60
- return _nextProxy;
61
- };
62
-
63
- _self.setNext = (nextPlugin:ITelemetryPluginChain) => {
64
- _nextProxy = nextPlugin;
65
- }
66
-
67
- _self.processTelemetry = (env: ITelemetryItem, itemCtx:IProcessTelemetryContext) => {
68
- if (!itemCtx) {
69
- // Looks like a plugin didn't pass the (optional) context, so restore to the default
70
- itemCtx = defItemCtx;
71
- }
72
-
73
- let identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
74
-
75
- doPerf(itemCtx ? itemCtx.core() : null, () => identifier + ":processTelemetry", () => {
76
- if (plugin && _hasProcessTelemetry) {
77
- _self._hasRun = true;
78
- try {
79
-
80
- // Ensure that we keep the context in sync (for processNext()), just in case a plugin
81
- // doesn't calls processTelemetry() instead of itemContext.processNext() or some
82
- // other form of error occurred
83
- itemCtx.setNext(_nextProxy);
84
- if (_hasSetNext) {
85
- // Backward compatibility setting the next plugin on the instance
86
- plugin.setNextPlugin(_nextProxy);
87
- }
88
-
89
- // Set a flag on the next plugin so we know if it was attempted to be executed
90
- _nextProxy && ((_nextProxy as TelemetryPluginChain)._hasRun = false);
91
-
92
- plugin.processTelemetry(env, itemCtx);
93
- } catch (error) {
94
- let hasRun = _nextProxy && (_nextProxy as TelemetryPluginChain)._hasRun;
95
- if (!_nextProxy || !hasRun) {
96
- // Either we have no next plugin or the current one did not attempt to call the next plugin
97
- // Which means the current one is the root of the failure so log/report this failure
98
- itemCtx.diagLog().throwInternal(
99
- LoggingSeverity.CRITICAL,
100
- _InternalMessageId.PluginException,
101
- "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
102
- }
103
-
104
- if (_nextProxy && !hasRun) {
105
- // As part of the failure the current plugin did not attempt to call the next plugin in the cahin
106
- // So rather than leave the pipeline dead in the water we call the next plugin
107
- _nextProxy.processTelemetry(env, itemCtx);
108
- }
109
- }
110
- } else if (_nextProxy) {
111
- _self._hasRun = true;
112
-
113
- // The underlying plugin is either not defined or does not have a processTelemetry implementation
114
- // so we still want the next plugin to be executed.
115
- _nextProxy.processTelemetry(env, itemCtx);
116
- }
117
- }, () => ({ item: env }), !((env as any).sync));
118
- };
119
- }
120
- }
@@ -1,32 +0,0 @@
1
- import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
2
- import { IProcessTelemetryContext } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
3
- import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
4
- import { ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
5
- export declare class TelemetryPluginChain implements ITelemetryPluginChain {
6
- /**
7
- * Returns the underlying plugin that is being proxied for the processTelemetry call
8
- */
9
- getPlugin: () => ITelemetryPlugin;
10
- /**
11
- * Returns the next plugin
12
- */
13
- getNext: () => ITelemetryPluginChain;
14
- /**
15
- * Sets the next proxy to be executed as the next plugin
16
- * (Should only be used during initialization, which is why it's not defined on the interface)
17
- */
18
- setNext: (nextPlugin: ITelemetryPluginChain) => void;
19
- /**
20
- * Call back for telemetry processing before it it is sent
21
- * @param env - This is the current event being reported
22
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
23
- * can optionally use this to access the current core instance or define / pass additional information
24
- * to later plugins (vs appending items to the telemetry item)
25
- */
26
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
27
- /**
28
- * Internal flag used to try and identify root cause failures
29
- */
30
- private _hasRun;
31
- constructor(plugin: ITelemetryPlugin, defItemCtx: IProcessTelemetryContext);
32
- }