@microsoft/applicationinsights-core-js 3.0.0-beta.2303-02 → 3.0.0-beta.2303-04

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 (132) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +2 -2
  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 +113 -206
  7. package/dist/applicationinsights-core-js.api.md +11 -14
  8. package/dist/applicationinsights-core-js.d.ts +15 -13
  9. package/dist/applicationinsights-core-js.js +2 -2
  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 +15 -13
  14. package/dist-esm/Config/ConfigDefaultHelpers.js +1 -1
  15. package/dist-esm/Config/ConfigDefaults.js +1 -1
  16. package/dist-esm/Config/DynamicConfig.js +1 -1
  17. package/dist-esm/Config/DynamicProperty.js +1 -1
  18. package/dist-esm/Config/DynamicState.js +1 -1
  19. package/dist-esm/Config/DynamicSupport.js +1 -1
  20. package/dist-esm/Config/IConfigDefaults.js +1 -1
  21. package/dist-esm/Config/IDynamicConfigHandler.js +1 -1
  22. package/dist-esm/Config/IDynamicPropertyHandler.js +1 -1
  23. package/dist-esm/Config/IDynamicWatcher.js +1 -1
  24. package/dist-esm/Config/_IDynamicConfigHandlerState.js +1 -1
  25. package/dist-esm/JavaScriptSDK/AggregationError.js +1 -1
  26. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  27. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  28. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  29. package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
  30. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  31. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
  32. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  33. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  34. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  35. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  36. package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
  37. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  38. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +1 -1
  39. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  40. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  41. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  42. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  43. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  44. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
  45. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  46. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  47. package/dist-esm/JavaScriptSDK/UnloadHookContainer.js +1 -1
  48. package/dist-esm/JavaScriptSDK/W3cTraceParent.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  50. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  51. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  52. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  53. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  54. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  55. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  56. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  57. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  63. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  64. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  65. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  66. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  67. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  68. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  69. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  70. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  71. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  72. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  73. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  74. package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
  75. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadHook.js +1 -1
  76. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  77. package/dist-esm/__DynamicConstants.js +1 -1
  78. package/dist-esm/applicationinsights-core-js.js +1 -1
  79. package/package.json +1 -1
  80. package/types/JavaScriptSDK/AppInsightsCore.d.ts +5 -6
  81. package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +9 -6
  82. package/src/JavaScriptSDK/AggregationError.ts +0 -36
  83. package/src/JavaScriptSDK/AppInsightsCore.ts +0 -1322
  84. package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +0 -343
  85. package/src/JavaScriptSDK/Constants.ts +0 -4
  86. package/src/JavaScriptSDK/CookieMgr.ts +0 -449
  87. package/src/JavaScriptSDK/CoreUtils.ts +0 -58
  88. package/src/JavaScriptSDK/DataCacheHelper.ts +0 -107
  89. package/src/JavaScriptSDK/DbgExtensionUtils.ts +0 -56
  90. package/src/JavaScriptSDK/DiagnosticLogger.ts +0 -380
  91. package/src/JavaScriptSDK/EnvUtils.ts +0 -312
  92. package/src/JavaScriptSDK/EventHelpers.ts +0 -550
  93. package/src/JavaScriptSDK/HelperFuncs.ts +0 -351
  94. package/src/JavaScriptSDK/InstrumentHooks.ts +0 -280
  95. package/src/JavaScriptSDK/InternalConstants.ts +0 -31
  96. package/src/JavaScriptSDK/NotificationManager.ts +0 -165
  97. package/src/JavaScriptSDK/PerfManager.ts +0 -288
  98. package/src/JavaScriptSDK/ProcessTelemetryContext.ts +0 -674
  99. package/src/JavaScriptSDK/RandomHelper.ts +0 -145
  100. package/src/JavaScriptSDK/TelemetryHelpers.ts +0 -184
  101. package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +0 -112
  102. package/src/JavaScriptSDK/UnloadHandlerContainer.ts +0 -45
  103. package/src/JavaScriptSDK/UnloadHookContainer.ts +0 -52
  104. package/src/JavaScriptSDK/W3cTraceParent.ts +0 -197
  105. package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +0 -24
  106. package/src/JavaScriptSDK.Enums/EventsDiscardedReason.ts +0 -71
  107. package/src/JavaScriptSDK.Enums/LoggingEnums.ts +0 -121
  108. package/src/JavaScriptSDK.Enums/SendRequestReason.ts +0 -56
  109. package/src/JavaScriptSDK.Enums/TelemetryUnloadReason.ts +0 -27
  110. package/src/JavaScriptSDK.Enums/TelemetryUpdateReason.ts +0 -27
  111. package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +0 -216
  112. package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +0 -46
  113. package/src/JavaScriptSDK.Interfaces/IConfiguration.ts +0 -176
  114. package/src/JavaScriptSDK.Interfaces/ICookieMgr.ts +0 -116
  115. package/src/JavaScriptSDK.Interfaces/IDbgExtension.ts +0 -14
  116. package/src/JavaScriptSDK.Interfaces/IDiagnosticLogger.ts +0 -75
  117. package/src/JavaScriptSDK.Interfaces/IDistributedTraceContext.ts +0 -54
  118. package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +0 -100
  119. package/src/JavaScriptSDK.Interfaces/INotificationListener.ts +0 -39
  120. package/src/JavaScriptSDK.Interfaces/INotificationManager.ts +0 -52
  121. package/src/JavaScriptSDK.Interfaces/IPerfEvent.ts +0 -69
  122. package/src/JavaScriptSDK.Interfaces/IPerfManager.ts +0 -53
  123. package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +0 -157
  124. package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +0 -17
  125. package/src/JavaScriptSDK.Interfaces/ITelemetryItem.ts +0 -62
  126. package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +0 -94
  127. package/src/JavaScriptSDK.Interfaces/ITelemetryPluginChain.ts +0 -30
  128. package/src/JavaScriptSDK.Interfaces/ITelemetryUnloadState.ts +0 -10
  129. package/src/JavaScriptSDK.Interfaces/ITelemetryUpdateState.ts +0 -44
  130. package/src/JavaScriptSDK.Interfaces/ITraceParent.ts +0 -38
  131. package/src/JavaScriptSDK.Interfaces/IUnloadHook.ts +0 -22
  132. package/src/JavaScriptSDK.Interfaces/IUnloadableComponent.ts +0 -17
@@ -1,343 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
- "use strict";
4
-
5
- import dynamicProto from "@microsoft/dynamicproto-js";
6
- import { isFunction, objDefine } from "@nevware21/ts-utils";
7
- import { createDynamicConfig } from "../Config/DynamicConfig";
8
- import { IConfigDefaults } from "../Config/IConfigDefaults";
9
- import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
10
- import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
11
- import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
12
- import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
13
- import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
14
- import {
15
- IProcessTelemetryContext, IProcessTelemetryUnloadContext, IProcessTelemetryUpdateContext
16
- } from "../JavaScriptSDK.Interfaces/IProcessTelemetryContext";
17
- import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
18
- import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
19
- import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
20
- import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
21
- import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
22
- import { ILegacyUnloadHook, IUnloadHook } from "../JavaScriptSDK.Interfaces/IUnloadHook";
23
- import { isNotNullOrUndefined, proxyFunctionAs } from "./HelperFuncs";
24
- import { STR_EXTENSION_CONFIG } from "./InternalConstants";
25
- import {
26
- createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext
27
- } from "./ProcessTelemetryContext";
28
- import { IUnloadHandlerContainer, UnloadHandler, createUnloadHandlerContainer } from "./UnloadHandlerContainer";
29
- import { IUnloadHookContainer, createUnloadHookContainer } from "./UnloadHookContainer";
30
-
31
- let strGetPlugin = "getPlugin";
32
-
33
- const defaultValues: IConfigDefaults<IConfiguration> = {
34
- [STR_EXTENSION_CONFIG]: { isVal: isNotNullOrUndefined, v: {} }
35
- };
36
-
37
-
38
- /**
39
- * BaseTelemetryPlugin provides a basic implementation of the ITelemetryPlugin interface so that plugins
40
- * can avoid implementation the same set of boiler plate code as well as provide a base
41
- * implementation so that new default implementations can be added without breaking all plugins.
42
- */
43
- export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
44
-
45
- public identifier: string;
46
- public version?: string;
47
-
48
- /**
49
- * Holds the core instance that was used during initialization
50
- */
51
- public core: IAppInsightsCore;
52
-
53
- priority: number;
54
-
55
- /**
56
- * Call back for telemetry processing before it it is sent
57
- * @param env - This is the current event being reported
58
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
59
- * can optionally use this to access the current core instance or define / pass additional information
60
- * to later plugins (vs appending items to the telemetry item)
61
- */
62
- public processNext: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
63
-
64
- /**
65
- * Set next extension for telemetry processing
66
- */
67
- public setNextPlugin: (next: ITelemetryPlugin | ITelemetryPluginChain) => void;
68
-
69
- /**
70
- * Returns the current diagnostic logger that can be used to log issues, if no logger is currently
71
- * assigned a new default one will be created and returned.
72
- */
73
- public diagLog: (itemCtx?:IProcessTelemetryContext) => IDiagnosticLogger;
74
-
75
- /**
76
- * Returns whether the plugin has been initialized
77
- */
78
- public isInitialized: () => boolean;
79
-
80
- /**
81
- * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
82
- * returns that value (helps with minification for callers), otherwise it will return the configured
83
- * context or a temporary one.
84
- * @param currentCtx - [Optional] The current execution context
85
- */
86
- protected _getTelCtx: (currentCtx?:IProcessTelemetryContext) => IProcessTelemetryContext;
87
-
88
- /**
89
- * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
90
- */
91
- protected setInitialized: (isInitialized: boolean) => void;
92
-
93
- /**
94
- * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
95
- * finishes it's removal.
96
- * @param unloadCtx - This is the context that should be used during unloading.
97
- * @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.
98
- * @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.
99
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
100
- */
101
- protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
102
-
103
- /**
104
- * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
105
- * @param updateCtx - This is the context that should be used during updating.
106
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
107
- * @param asyncCallback - An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.
108
- * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
109
- */
110
- protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
111
-
112
- /**
113
- * Exposes the underlying unload hook container instance for this extension to allow it to be passed down to any sub components of the class.
114
- * This should NEVER be exposed or called publically as it's scope is for internal use by BaseTelemetryPlugin and any derived class (which is why
115
- * it's scoped as protected)
116
- */
117
- protected readonly _unloadHooks: IUnloadHookContainer;
118
-
119
- constructor() {
120
- let _self = this; // Setting _self here as it's used outside of the dynamicProto as well
121
-
122
- // NOTE!: DON'T set default values here, instead set them in the _initDefaults() function as it is also called during teardown()
123
- let _isinitialized: boolean;
124
- let _rootCtx: IProcessTelemetryContext; // Used as the root context, holding the current config and initialized core
125
- let _nextPlugin: ITelemetryPlugin | ITelemetryPluginChain; // Used for backward compatibility where plugins don't call the main pipeline
126
- let _unloadHandlerContainer: IUnloadHandlerContainer;
127
- let _hookContainer: IUnloadHookContainer;
128
-
129
- _initDefaults();
130
-
131
- dynamicProto(BaseTelemetryPlugin, _self, (_self) => {
132
-
133
- _self.initialize = (config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain): void => {
134
- _setDefaults(config, core, pluginChain);
135
- _isinitialized = true;
136
- }
137
-
138
- _self.teardown = (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => {
139
- // If this plugin has already been torn down (not operational) or is not initialized (core is not set)
140
- // or the core being used for unload was not the same core used for initialization.
141
- let core = _self.core;
142
- if (!core || (unloadCtx && core !== unloadCtx.core())) {
143
- // Do Nothing as either the plugin is not initialized or was not initialized by the current core
144
- return;
145
- }
146
-
147
- let result: void | boolean;
148
- let unloadDone = false;
149
- let theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
150
- let theUnloadState: ITelemetryUnloadState = unloadState || {
151
- reason: TelemetryUnloadReason.ManualTeardown,
152
- isAsync: false
153
- };
154
-
155
- function _unloadCallback() {
156
- if (!unloadDone) {
157
- unloadDone = true;
158
-
159
- _unloadHandlerContainer.run(theUnloadCtx, unloadState);
160
- _hookContainer.run(theUnloadCtx.diagLog());
161
-
162
- if (result === true) {
163
- theUnloadCtx.processNext(theUnloadState);
164
- }
165
-
166
- _initDefaults();
167
- }
168
- }
169
-
170
- if (!_self._doTeardown || _self._doTeardown(theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
171
- _unloadCallback();
172
- } else {
173
- // Tell the caller that we will be calling processNext()
174
- result = true;
175
- }
176
-
177
- return result;
178
- };
179
-
180
- _self.update = (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => {
181
- // If this plugin has already been torn down (not operational) or is not initialized (core is not set)
182
- // or the core being used for unload was not the same core used for initialization.
183
- let core = _self.core;
184
- if (!core || (updateCtx && core !== updateCtx.core())) {
185
- // Do Nothing
186
- return;
187
- }
188
-
189
- let result: void | boolean;
190
- let updateDone = false;
191
- let theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
192
- let theUpdateState: ITelemetryUpdateState = updateState || {
193
- reason: TelemetryUpdateReason.Unknown
194
- };
195
-
196
- function _updateCallback() {
197
- if (!updateDone) {
198
- updateDone = true;
199
- _setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
200
- }
201
- }
202
-
203
- if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
204
- _updateCallback();
205
- } else {
206
- result = true;
207
- }
208
-
209
- return result;
210
- };
211
-
212
- proxyFunctionAs(_self, "_addUnloadCb", () => _unloadHandlerContainer, "add");
213
- proxyFunctionAs(_self, "_addHook", () => _hookContainer, "add");
214
- objDefine(_self, "_unloadHooks" as keyof BaseTelemetryPlugin, { g: () => _hookContainer });
215
- });
216
-
217
- // These are added after the dynamicProto so that are not moved to the prototype
218
-
219
- _self.diagLog = (itemCtx:IProcessTelemetryContext): IDiagnosticLogger => {
220
- return _getTelCtx(itemCtx).diagLog();
221
- }
222
-
223
- _self.isInitialized = () => {
224
- return _isinitialized;
225
- }
226
-
227
- _self.setInitialized = (isInitialized: boolean):void => {
228
- _isinitialized = isInitialized;
229
- }
230
-
231
- // _self.getNextPlugin = () => DO NOT IMPLEMENT
232
- // Sub-classes of this base class *should* not be relying on this value and instead
233
- // should use processNext() function. If you require access to the plugin use the
234
- // IProcessTelemetryContext.getNext().getPlugin() while in the pipeline, Note getNext() may return null.
235
-
236
- _self.setNextPlugin = (next: ITelemetryPlugin | ITelemetryPluginChain) => {
237
- _nextPlugin = next;
238
- };
239
-
240
- _self.processNext = (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => {
241
- if (itemCtx) {
242
- // Normal core execution sequence
243
- itemCtx.processNext(env);
244
- } else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
245
- // Looks like backward compatibility or out of band processing. And as it looks
246
- // like a ITelemetryPlugin or ITelemetryPluginChain, just call processTelemetry
247
- _nextPlugin.processTelemetry(env, null);
248
- }
249
- };
250
-
251
- _self._getTelCtx = _getTelCtx;
252
-
253
- function _getTelCtx(currentCtx: IProcessTelemetryContext = null) {
254
- let itemCtx:IProcessTelemetryContext = currentCtx;
255
- if (!itemCtx) {
256
- let rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
257
- // tslint:disable-next-line: prefer-conditional-expression
258
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
259
- // Looks like a chain object
260
- itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
261
- } else {
262
- itemCtx = rootCtx.createNew(null, _nextPlugin as ITelemetryPlugin);
263
- }
264
- }
265
-
266
- return itemCtx;
267
- }
268
-
269
- function _setDefaults(config: IConfiguration, core: IAppInsightsCore, pluginChain: ITelemetryPluginChain) {
270
- // Make sure the extensionConfig exists and the config is dynamic
271
- createDynamicConfig(config, defaultValues, core.logger);
272
-
273
- if (!pluginChain && core) {
274
- // Get the first plugin from the core
275
- pluginChain = core.getProcessTelContext().getNext();
276
- }
277
-
278
- let nextPlugin: IPlugin = _nextPlugin as IPlugin;
279
- if (_nextPlugin && _nextPlugin[strGetPlugin]) {
280
- // If it looks like a proxy/chain then get the plugin
281
- nextPlugin = _nextPlugin[strGetPlugin]();
282
- }
283
-
284
- // Support legacy plugins where core was defined as a property
285
- _self.core = core;
286
- _rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
287
- }
288
-
289
- function _initDefaults() {
290
- _isinitialized = false;
291
- _self.core = null;
292
- _rootCtx = null;
293
- _nextPlugin = null;
294
- _hookContainer = createUnloadHookContainer();
295
- _unloadHandlerContainer = createUnloadHandlerContainer();
296
- }
297
- }
298
-
299
- public initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?:ITelemetryPluginChain): void {
300
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
301
- }
302
-
303
- /**
304
- * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
305
- * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
306
- * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
307
- * @param unloadCtx - This is the context that should be used during unloading.
308
- * @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.
309
- * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
310
- */
311
- public teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean {
312
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
313
- return false;
314
- }
315
-
316
- public abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
317
-
318
- /**
319
- * The the plugin should re-evaluate configuration and update any cached configuration settings.
320
- * @param updateCtx - This is the context that should be used during updating.
321
- * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
322
- * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
323
- */
324
- public update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean{
325
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
326
- }
327
-
328
- /**
329
- * Add an unload handler that will be called when the SDK is being unloaded
330
- * @param handler - the handler
331
- */
332
- protected _addUnloadCb(handler: UnloadHandler): void {
333
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
334
- }
335
-
336
- /**
337
- * Add this hook so that it is automatically removed during unloading
338
- * @param hooks - The single hook or an array of IInstrumentHook objects
339
- */
340
- protected _addHook(hooks: IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook> | ILegacyUnloadHook | ILegacyUnloadHook[] | Iterator<ILegacyUnloadHook>): void {
341
- // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging
342
- }
343
- }
@@ -1,4 +0,0 @@
1
- // Copyright (c) Microsoft Corporation. All rights reserved.
2
- // Licensed under the MIT License.
3
-
4
- export const ChannelControllerPriority = 500;