@microsoft/applicationinsights-web-basic 2.7.5-nightly.2202-11 → 2.7.5-nightly.2203-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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.7.5-nightly.2202-11
2
+ * Microsoft.ApplicationInsights, 2.7.5-nightly.2203-03
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -11,26 +11,6 @@ declare namespace ApplicationInsights {
11
11
  constructor();
12
12
  initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
13
13
  track(telemetryItem: ITelemetryItem): void;
14
- /**
15
- * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
16
- * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
17
- * called.
18
- * @param {INotificationListener} listener - An INotificationListener object.
19
- */
20
- addNotificationListener(listener: INotificationListener): void;
21
- /**
22
- * Removes all instances of the listener.
23
- * @param {INotificationListener} listener - INotificationListener to remove.
24
- */
25
- removeNotificationListener(listener: INotificationListener): void;
26
- /**
27
- * Periodically check logger.queue for
28
- */
29
- pollInternalLogs(eventName?: string): number;
30
- /**
31
- * Periodically check logger.queue for
32
- */
33
- stopPollingInternalLogs(): void;
34
14
  }
35
15
 
36
16
  /**
@@ -39,7 +19,6 @@ declare namespace ApplicationInsights {
39
19
  */
40
20
  class ApplicationInsights {
41
21
  config: IConfiguration & IConfig;
42
- private core;
43
22
  /**
44
23
  * Creates an instance of ApplicationInsights.
45
24
  * @param {IConfiguration & IConfig} config
@@ -65,11 +44,51 @@ declare namespace ApplicationInsights {
65
44
  * @memberof ApplicationInsights
66
45
  */
67
46
  flush(async?: boolean): void;
68
- private pollInternalLogs;
47
+ pollInternalLogs(): void;
69
48
  stopPollingInternalLogs(): void;
70
- private getSKUDefaults;
49
+ getSKUDefaults(): void;
50
+ /**
51
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
52
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
53
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
54
+ * approach is to create a new instance and initialize that instance.
55
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
56
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
57
+ */
58
+ unload(isAsync?: boolean, unloadComplete?: () => void): void;
59
+ /**
60
+ * Find and return the (first) plugin with the specified identifier if present
61
+ * @param pluginIdentifier
62
+ */
63
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
64
+ /**
65
+ * Add a new plugin to the installation
66
+ * @param plugin - The new plugin to add
67
+ * @param replaceExisting - should any existing plugin be replaced
68
+ * @param doAsync - Should the add be performed asynchronously
69
+ */
70
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting: boolean, doAsync: boolean, addCb?: (added?: boolean) => void): void;
71
+ /**
72
+ * Returns the unique event namespace that should be used
73
+ */
74
+ evtNamespace(): string;
75
+ /**
76
+ * Add an unload handler that will be called when the SDK is being unloaded
77
+ * @param handler - the handler
78
+ */
79
+ addUnloadCb(handler: UnloadHandler): void;
71
80
  }
72
81
 
82
+ /**
83
+ * Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers
84
+ * that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
85
+ * implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
86
+ * cause a testing requirement to test with and without the implementations
87
+ * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
88
+ * @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
89
+ */
90
+ function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => undefined | void | number, thisArg?: any): void;
91
+
73
92
  class BaseCore implements IAppInsightsCore {
74
93
  static defaultConfig: IConfiguration;
75
94
  config: IConfiguration;
@@ -82,6 +101,18 @@ declare namespace ApplicationInsights {
82
101
  track(telemetryItem: ITelemetryItem): void;
83
102
  getProcessTelContext(): IProcessTelemetryContext;
84
103
  getNotifyMgr(): INotificationManager;
104
+ /**
105
+ * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
106
+ * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
107
+ * called.
108
+ * @param {INotificationListener} listener - An INotificationListener object.
109
+ */
110
+ addNotificationListener(listener: INotificationListener): void;
111
+ /**
112
+ * Removes all instances of the listener.
113
+ * @param {INotificationListener} listener - INotificationListener to remove.
114
+ */
115
+ removeNotificationListener(listener: INotificationListener): void;
85
116
  /**
86
117
  * Get the current cookie manager for this instance
87
118
  */
@@ -94,7 +125,67 @@ declare namespace ApplicationInsights {
94
125
  getPerfMgr(): IPerfManager;
95
126
  setPerfMgr(perfMgr: IPerfManager): void;
96
127
  eventCnt(): number;
128
+ /**
129
+ * Periodically check logger.queue for
130
+ */
131
+ pollInternalLogs(eventName?: string): number;
132
+ /**
133
+ * Periodically check logger.queue for
134
+ */
135
+ stopPollingInternalLogs(): void;
136
+ /**
137
+ * Add a telemetry processor to decorate or drop telemetry events.
138
+ * @param telemetryInitializer - The Telemetry Initializer function
139
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
140
+ */
141
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
142
+ /**
143
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
144
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
145
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
146
+ * approach is to create a new instance and initialize that instance.
147
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
148
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
149
+ * @param isAsync - Can the unload be performed asynchronously (default)
150
+ * @param unloadComplete - An optional callback that will be called once the unload has completed
151
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
152
+ */
153
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
154
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
155
+ /**
156
+ * Add a new plugin to the installation
157
+ * @param plugin - The new plugin to add
158
+ * @param replaceExisting - should any existing plugin be replaced, default is false
159
+ * @param doAsync - Should the add be performed asynchronously
160
+ * @param addCb - [Optional] callback to call after the plugin has been added
161
+ */
162
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
163
+ /**
164
+ * Returns the unique event namespace that should be used
165
+ */
166
+ evtNamespace(): string;
167
+ /**
168
+ * Add an unload handler that will be called when the SDK is being unloaded
169
+ * @param handler - the handler
170
+ */
171
+ addUnloadCb(handler: UnloadHandler): void;
172
+ /**
173
+ * Flush and send any batched / cached data immediately
174
+ * @param async - send data asynchronously when true (defaults to true)
175
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
176
+ * If the caller doesn't return true the caller should assume that it may never be called.
177
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
178
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
179
+ */
180
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): void;
97
181
  protected releaseQueue(): void;
182
+ /**
183
+ * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
184
+ * @param updateCtx - The plugin update context
185
+ * @param updateState - The Update State
186
+ * @returns boolean - True means the extension class will call updateState otherwise the Core will
187
+ */
188
+ protected _updateHook?(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
98
189
  }
99
190
 
100
191
  /**
@@ -103,6 +194,13 @@ declare namespace ApplicationInsights {
103
194
  * implementation so that new default implementations can be added without breaking all plugins.
104
195
  */
105
196
  abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
197
+ identifier: string;
198
+ version?: string;
199
+ /**
200
+ * Holds the core instance that was used during initialization
201
+ */
202
+ core: IAppInsightsCore;
203
+ priority: number;
106
204
  /**
107
205
  * Call back for telemetry processing before it it is sent
108
206
  * @param env - This is the current event being reported
@@ -124,13 +222,6 @@ declare namespace ApplicationInsights {
124
222
  * Returns whether the plugin has been initialized
125
223
  */
126
224
  isInitialized: () => boolean;
127
- identifier: string;
128
- version?: string;
129
- /**
130
- * Holds the core instance that was used during initialization
131
- */
132
- core: IAppInsightsCore;
133
- priority: number;
134
225
  /**
135
226
  * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
136
227
  * returns that value (helps with minification for callers), otherwise it will return the configured
@@ -143,12 +234,51 @@ declare namespace ApplicationInsights {
143
234
  */
144
235
  protected setInitialized: (isInitialized: boolean) => void;
145
236
  /**
146
- * Internal helper to initialize the instance
237
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
238
+ * finishes it's removal.
239
+ * @param unloadCtx - This is the context that should be used during unloading.
240
+ * @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.
241
+ * @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.
242
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
147
243
  */
148
- private _baseTelInit;
244
+ protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
245
+ /**
246
+ * Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal
247
+ * @param updateCtx - This is the context that should be used during updating.
248
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
249
+ * @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.
250
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
251
+ */
252
+ protected _doUpdate?: (updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: () => void) => void | boolean;
149
253
  constructor();
150
254
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
255
+ /**
256
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
257
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
258
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
259
+ * @param unloadCtx - This is the context that should be used during unloading.
260
+ * @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.
261
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
262
+ */
263
+ teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
151
264
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
265
+ /**
266
+ * The the plugin should re-evaluate configuration and update any cached configuration settings.
267
+ * @param updateCtx - This is the context that should be used during updating.
268
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
269
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
270
+ */
271
+ update(updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState): void | boolean;
272
+ /**
273
+ * Add an unload handler that will be called when the SDK is being unloaded
274
+ * @param handler - the handler
275
+ */
276
+ protected _addUnloadCb(handler: UnloadHandler): void;
277
+ /**
278
+ * Add this hook so that it is automatically removed during unloading
279
+ * @param hooks - The single hook or an array of IInstrumentHook objects
280
+ */
281
+ protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
152
282
  }
153
283
 
154
284
  /**
@@ -159,7 +289,15 @@ declare namespace ApplicationInsights {
159
289
  */
160
290
  const CoreUtils: ICoreUtils;
161
291
 
162
- enum DistributedTracingModes {
292
+ const DistributedTracingModes: {
293
+ AI: number;
294
+ AI_AND_W3C: number;
295
+ W3C: number;
296
+ };
297
+
298
+ type DistributedTracingModes = number | eDistributedTracingModes;
299
+
300
+ const enum eDistributedTracingModes {
163
301
  /**
164
302
  * (Default) Send Application Insights correlation headers
165
303
  */
@@ -174,6 +312,108 @@ declare namespace ApplicationInsights {
174
312
  W3C = 2
175
313
  }
176
314
 
315
+ const enum _eInternalMessageId {
316
+ BrowserDoesNotSupportLocalStorage = 0,
317
+ BrowserCannotReadLocalStorage = 1,
318
+ BrowserCannotReadSessionStorage = 2,
319
+ BrowserCannotWriteLocalStorage = 3,
320
+ BrowserCannotWriteSessionStorage = 4,
321
+ BrowserFailedRemovalFromLocalStorage = 5,
322
+ BrowserFailedRemovalFromSessionStorage = 6,
323
+ CannotSendEmptyTelemetry = 7,
324
+ ClientPerformanceMathError = 8,
325
+ ErrorParsingAISessionCookie = 9,
326
+ ErrorPVCalc = 10,
327
+ ExceptionWhileLoggingError = 11,
328
+ FailedAddingTelemetryToBuffer = 12,
329
+ FailedMonitorAjaxAbort = 13,
330
+ FailedMonitorAjaxDur = 14,
331
+ FailedMonitorAjaxOpen = 15,
332
+ FailedMonitorAjaxRSC = 16,
333
+ FailedMonitorAjaxSend = 17,
334
+ FailedMonitorAjaxGetCorrelationHeader = 18,
335
+ FailedToAddHandlerForOnBeforeUnload = 19,
336
+ FailedToSendQueuedTelemetry = 20,
337
+ FailedToReportDataLoss = 21,
338
+ FlushFailed = 22,
339
+ MessageLimitPerPVExceeded = 23,
340
+ MissingRequiredFieldSpecification = 24,
341
+ NavigationTimingNotSupported = 25,
342
+ OnError = 26,
343
+ SessionRenewalDateIsZero = 27,
344
+ SenderNotInitialized = 28,
345
+ StartTrackEventFailed = 29,
346
+ StopTrackEventFailed = 30,
347
+ StartTrackFailed = 31,
348
+ StopTrackFailed = 32,
349
+ TelemetrySampledAndNotSent = 33,
350
+ TrackEventFailed = 34,
351
+ TrackExceptionFailed = 35,
352
+ TrackMetricFailed = 36,
353
+ TrackPVFailed = 37,
354
+ TrackPVFailedCalc = 38,
355
+ TrackTraceFailed = 39,
356
+ TransmissionFailed = 40,
357
+ FailedToSetStorageBuffer = 41,
358
+ FailedToRestoreStorageBuffer = 42,
359
+ InvalidBackendResponse = 43,
360
+ FailedToFixDepricatedValues = 44,
361
+ InvalidDurationValue = 45,
362
+ TelemetryEnvelopeInvalid = 46,
363
+ CreateEnvelopeError = 47,
364
+ CannotSerializeObject = 48,
365
+ CannotSerializeObjectNonSerializable = 49,
366
+ CircularReferenceDetected = 50,
367
+ ClearAuthContextFailed = 51,
368
+ ExceptionTruncated = 52,
369
+ IllegalCharsInName = 53,
370
+ ItemNotInArray = 54,
371
+ MaxAjaxPerPVExceeded = 55,
372
+ MessageTruncated = 56,
373
+ NameTooLong = 57,
374
+ SampleRateOutOfRange = 58,
375
+ SetAuthContextFailed = 59,
376
+ SetAuthContextFailedAccountName = 60,
377
+ StringValueTooLong = 61,
378
+ StartCalledMoreThanOnce = 62,
379
+ StopCalledWithoutStart = 63,
380
+ TelemetryInitializerFailed = 64,
381
+ TrackArgumentsNotSpecified = 65,
382
+ UrlTooLong = 66,
383
+ SessionStorageBufferFull = 67,
384
+ CannotAccessCookie = 68,
385
+ IdTooLong = 69,
386
+ InvalidEvent = 70,
387
+ FailedMonitorAjaxSetRequestHeader = 71,
388
+ SendBrowserInfoOnUserInit = 72,
389
+ PluginException = 73,
390
+ NotificationException = 74,
391
+ SnippetScriptLoadFailure = 99,
392
+ InvalidInstrumentationKey = 100,
393
+ CannotParseAiBlobValue = 101,
394
+ InvalidContentBlob = 102,
395
+ TrackPageActionEventFailed = 103,
396
+ FailedAddingCustomDefinedRequestContext = 104,
397
+ InMemoryStorageBufferFull = 105
398
+ }
399
+
400
+ const enum eLoggingSeverity {
401
+ /**
402
+ * Error will be sent as internal telemetry
403
+ */
404
+ CRITICAL = 1,
405
+ /**
406
+ * Error will NOT be sent as internal telemetry, and will only be shown in browser console
407
+ */
408
+ WARNING = 2
409
+ }
410
+
411
+ const enum GetExtCfgMergeType {
412
+ None = 0,
413
+ MergeDefaultOnly = 1,
414
+ MergeDefaultFromRootOrDefault = 2
415
+ }
416
+
177
417
  interface IAppInsightsCore extends IPerfManagerProvider {
178
418
  config: IConfiguration;
179
419
  logger: IDiagnosticLogger;
@@ -209,12 +449,62 @@ declare namespace ApplicationInsights {
209
449
  * @param {INotificationListener} listener - INotificationListener to remove.
210
450
  */
211
451
  removeNotificationListener?(listener: INotificationListener): void;
452
+ /**
453
+ * Add a telemetry processor to decorate or drop telemetry events.
454
+ * @param telemetryInitializer - The Telemetry Initializer function
455
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
456
+ */
457
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
212
458
  pollInternalLogs?(eventName?: string): number;
213
459
  stopPollingInternalLogs?(): void;
214
460
  /**
215
461
  * Return a new instance of the IProcessTelemetryContext for processing events
216
462
  */
217
463
  getProcessTelContext(): IProcessTelemetryContext;
464
+ /**
465
+ * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered
466
+ * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous
467
+ * unload call return `true` stating that all plugins reported that they also unloaded, the recommended
468
+ * approach is to create a new instance and initialize that instance.
469
+ * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable
470
+ * to successfully remove any global references or they may just be completing the unload process asynchronously.
471
+ * @param isAsync - Can the unload be performed asynchronously (default)
472
+ * @param unloadComplete - An optional callback that will be called once the unload has completed
473
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
474
+ */
475
+ unload(isAsync?: boolean, unloadComplete?: (unloadState: ITelemetryUnloadState) => void, cbTimeout?: number): void;
476
+ /**
477
+ * Find and return the (first) plugin with the specified identifier if present
478
+ * @param pluginIdentifier
479
+ */
480
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
481
+ /**
482
+ * Add a new plugin to the installation
483
+ * @param plugin - The new plugin to add
484
+ * @param replaceExisting - should any existing plugin be replaced, default is false
485
+ * @param doAsync - Should the add be performed asynchronously
486
+ * @param addCb - [Optional] callback to call after the plugin has been added
487
+ */
488
+ addPlugin<T extends IPlugin = ITelemetryPlugin>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: (added?: boolean) => void): void;
489
+ /**
490
+ * Returns the unique event namespace that should be used when registering events
491
+ */
492
+ evtNamespace(): string;
493
+ /**
494
+ * Add a handler that will be called when the SDK is being unloaded
495
+ * @param handler - the handler
496
+ */
497
+ addUnloadCb(handler: UnloadHandler): void;
498
+ /**
499
+ * Flush and send any batched / cached data immediately
500
+ * @param async - send data asynchronously when true (defaults to true)
501
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
502
+ * If the caller doesn't return true the caller should assume that it may never be called.
503
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
504
+ * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.
505
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
506
+ */
507
+ flush(isAsync?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
218
508
  }
219
509
 
220
510
  /**
@@ -298,6 +588,67 @@ declare namespace ApplicationInsights {
298
588
  readonly appId?: string;
299
589
  }
300
590
 
591
+ interface IBaseProcessingContext {
592
+ /**
593
+ * The current core instance for the request
594
+ */
595
+ core: () => IAppInsightsCore;
596
+ /**
597
+ * THe current diagnostic logger for the request
598
+ */
599
+ diagLog: () => IDiagnosticLogger;
600
+ /**
601
+ * Gets the current core config instance
602
+ */
603
+ getCfg: () => IConfiguration;
604
+ /**
605
+ * Gets the named extension config
606
+ */
607
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
608
+ /**
609
+ * Gets the named config from either the named identifier extension or core config if neither exist then the
610
+ * default value is returned
611
+ * @param identifier The named extension identifier
612
+ * @param field The config field name
613
+ * @param defaultValue The default value to return if no defined config exists
614
+ */
615
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
616
+ /**
617
+ * Helper to allow plugins to check and possibly shortcut executing code only
618
+ * required if there is a nextPlugin
619
+ */
620
+ hasNext: () => boolean;
621
+ /**
622
+ * Returns the next configured plugin proxy
623
+ */
624
+ getNext: () => ITelemetryPluginChain;
625
+ /**
626
+ * Helper to set the next plugin proxy
627
+ */
628
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
629
+ /**
630
+ * Synchronously iterate over the context chain running the callback for each plugin, once
631
+ * every plugin has been executed via the callback, any associated onComplete will be called.
632
+ * @param callback - The function call for each plugin in the context chain
633
+ */
634
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
635
+ /**
636
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
637
+ * @param onComplete - The onComplete to call
638
+ * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
639
+ * @param args - Any additional arguments to pass to the onComplete function
640
+ */
641
+ onComplete: (onComplete: () => void, that?: any, ...args: any[]) => void;
642
+ /**
643
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
644
+ * @param plugins - The execution order to process the plugins, if null or not supplied
645
+ * then the current execution order will be copied.
646
+ * @param startAt - The plugin to start processing from, if missing from the execution
647
+ * order then the next plugin will be NOT set.
648
+ */
649
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
650
+ }
651
+
301
652
  /**
302
653
  * Provides data transmission capabilities
303
654
  */
@@ -311,15 +662,23 @@ declare namespace ApplicationInsights {
311
662
  */
312
663
  resume(): void;
313
664
  /**
314
- * Tear down transmission pipeline
665
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
666
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
667
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
668
+ * @param unloadCtx - This is the context that should be used during unloading.
669
+ * @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.
670
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
315
671
  */
316
- teardown(): void;
672
+ teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
317
673
  /**
318
674
  * Flush to send data immediately; channel should default to sending data asynchronously
319
- * @param async: send data asynchronously when true
320
- * @param callBack: if specified, notify caller when send is complete
675
+ * @param async - send data asynchronously when true
676
+ * @param callBack - if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called.
677
+ * If the caller doesn't return true the caller should assume that it may never be called.
678
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
679
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
321
680
  */
322
- flush(async: boolean, callBack?: () => void): void;
681
+ flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
323
682
  }
324
683
 
325
684
  interface IChannelControlsAI extends IChannelControls {
@@ -994,7 +1353,7 @@ declare namespace ApplicationInsights {
994
1353
  * @param callback {any} - The callback function that needs to be executed for the given event
995
1354
  * @return {boolean} - true if the handler was successfully added
996
1355
  */
997
- addEventHandler: (eventName: string, callback: any) => boolean;
1356
+ addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
998
1357
  /**
999
1358
  * Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
1000
1359
  * https://caniuse.com/#search=Date.now
@@ -1154,6 +1513,96 @@ declare namespace ApplicationInsights {
1154
1513
  iKey?: string;
1155
1514
  }
1156
1515
 
1516
+ interface IInstrumentCallDetails {
1517
+ name: string;
1518
+ inst: any;
1519
+ /**
1520
+ * This returns an object that the hook function can use to store hook specific
1521
+ * context, it it not shared with any other hook instances and is unique for the
1522
+ * current call.
1523
+ * A hook implementation can use this to pass / share context between different
1524
+ * hook callbacks eg. request/response requst/hookErrors etc.
1525
+ */
1526
+ ctx: () => any;
1527
+ /**
1528
+ * Allows the hook functions to replace the original arguments
1529
+ * @param idx - The argument index (0 based)
1530
+ * @param value - The new value for the argument
1531
+ */
1532
+ set: (idx: number, value: any) => void;
1533
+ /**
1534
+ * The result of the original method, only populated after the original method has returned
1535
+ */
1536
+ rslt?: any;
1537
+ /**
1538
+ * The error (exception) which occurred while executing the original method
1539
+ */
1540
+ err?: Error;
1541
+ /**
1542
+ * The Event object from (window.event) at the start of the original call
1543
+ */
1544
+ evt?: Event;
1545
+ }
1546
+
1547
+ /**
1548
+ * The holder of the specific instance callback
1549
+ */
1550
+ interface IInstrumentHook {
1551
+ /** Unique Id for this callback on the hooked method */
1552
+ id: number;
1553
+ /** Holds the callbacks */
1554
+ cbks: IInstrumentHooksCallbacks;
1555
+ /** Remove this hook from the function */
1556
+ rm: () => void;
1557
+ }
1558
+
1559
+ /**
1560
+ * The callbacks to call for the instrumented function, you must provide at least the request and/or response callbacks, both are not required.
1561
+ * You must always supply the error callback
1562
+ */
1563
+ interface IInstrumentHooksCallbacks {
1564
+ /**
1565
+ * [Optional] Namespace details (same as the namespace used for events), useful for debugging and testing to
1566
+ * identify the source of the instrumented hooks
1567
+ */
1568
+ ns?: string | string[];
1569
+ /**
1570
+ * The hook callback to call before the original function is called
1571
+ */
1572
+ req?: InstrumentorHooksCallback;
1573
+ /**
1574
+ * The hook callback to call after the original function was called
1575
+ */
1576
+ rsp?: InstrumentorHooksCallback;
1577
+ /**
1578
+ * The callback to call if the hook function causes an exception
1579
+ */
1580
+ hkErr?: InstrumentorHooksCallback;
1581
+ /**
1582
+ * The callback to call if the original function causes an exception, even if you
1583
+ * supply a callback the original exception will still be thrown
1584
+ */
1585
+ fnErr?: InstrumentorHooksCallback;
1586
+ }
1587
+
1588
+ interface ILoadedPlugin<T extends IPlugin> {
1589
+ plugin: T;
1590
+ /**
1591
+ * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
1592
+ * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
1593
+ * @returns boolean = true if the plugin is in a state where it is operational.
1594
+ */
1595
+ isEnabled: () => boolean;
1596
+ /**
1597
+ * You can optionally enable / disable a plugin from processing events.
1598
+ * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
1599
+ * as the plugin must also have been successfully initialized and not had it's `teardown` method called
1600
+ * (unless it's also been re-initialized)
1601
+ */
1602
+ setEnabled: (isEnabled: boolean) => void;
1603
+ remove: (isAsync?: boolean, removeCb?: (removed?: boolean) => void) => void;
1604
+ }
1605
+
1157
1606
  interface IMetricTelemetry extends IPartC {
1158
1607
  /**
1159
1608
  * @description (required) - name of this metric
@@ -1272,6 +1721,12 @@ declare namespace ApplicationInsights {
1272
1721
  perfEvent?(perfEvent: IPerfEvent): void;
1273
1722
  }
1274
1723
 
1724
+ /**
1725
+ * A callback function that will be called for the wrapped instrumentation function
1726
+ * before the original function is executed.
1727
+ */
1728
+ type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
1729
+
1275
1730
  class _InternalLogMessage {
1276
1731
  static dataType: string;
1277
1732
  message: string;
@@ -1367,7 +1822,7 @@ declare namespace ApplicationInsights {
1367
1822
  InMemoryStorageBufferFull: number;
1368
1823
  };
1369
1824
 
1370
- type _InternalMessageId = number | typeof _InternalMessageId;
1825
+ type _InternalMessageId = number | _eInternalMessageId;
1371
1826
 
1372
1827
  interface IPageViewPerformanceTelemetry extends IPartC {
1373
1828
  /**
@@ -1582,10 +2037,14 @@ declare namespace ApplicationInsights {
1582
2037
  */
1583
2038
  isInitialized?: () => boolean;
1584
2039
  /**
1585
- * Tear down the plugin and remove any hooked value, the plugin should remove that it is no longer initialized and
1586
- * therefore can be re-initialized after being torn down.
2040
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
2041
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
2042
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
2043
+ * @param unloadCtx - This is the context that should be used during unloading.
2044
+ * @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.
2045
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
1587
2046
  */
1588
- teardown?: () => void;
2047
+ teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
1589
2048
  /**
1590
2049
  * Extension name
1591
2050
  */
@@ -1600,57 +2059,63 @@ declare namespace ApplicationInsights {
1600
2059
  * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
1601
2060
  * between multiple AppInsights instances
1602
2061
  */
1603
- interface IProcessTelemetryContext {
2062
+ interface IProcessTelemetryContext extends IBaseProcessingContext {
1604
2063
  /**
1605
- * The current core instance for the request
1606
- */
1607
- core: () => IAppInsightsCore;
1608
- /**
1609
- * THe current diagnostic logger for the request
1610
- */
1611
- diagLog: () => IDiagnosticLogger;
1612
- /**
1613
- * Gets the current core config instance
1614
- */
1615
- getCfg: () => IConfiguration;
1616
- /**
1617
- * Gets the named extension config
1618
- */
1619
- getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
1620
- /**
1621
- * Gets the named config from either the named identifier extension or core config if neither exist then the
1622
- * default value is returned
1623
- * @param identifier The named extension identifier
1624
- * @param field The config field name
1625
- * @param defaultValue The default value to return if no defined config exists
2064
+ * Call back for telemetry processing before it it is sent
2065
+ * @param env - This is the current event being reported
2066
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1626
2067
  */
1627
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
2068
+ processNext: (env: ITelemetryItem) => boolean | void;
1628
2069
  /**
1629
- * Helper to allow plugins to check and possibly shortcut executing code only
1630
- * required if there is a nextPlugin
2070
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
2071
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2072
+ * then the current execution order will be copied.
2073
+ * @param startAt - The plugin to start processing from, if missing from the execution
2074
+ * order then the next plugin will be NOT set.
1631
2075
  */
1632
- hasNext: () => boolean;
2076
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2077
+ }
2078
+
2079
+ /**
2080
+ * The current context for the current call to teardown() implementations, used to support when plugins are being removed
2081
+ * or the SDK is being unloaded.
2082
+ */
2083
+ interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
1633
2084
  /**
1634
- * Returns the next configured plugin proxy
2085
+ * This Plugin has finished unloading, so unload the next one
2086
+ * @param uploadState - The state of the unload process
2087
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1635
2088
  */
1636
- getNext: () => ITelemetryPluginChain;
2089
+ processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
1637
2090
  /**
1638
- * Helper to set the next plugin proxy
2091
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
2092
+ * @param plugins - The execution order to process the plugins, if null or not supplied
2093
+ * then the current execution order will be copied.
2094
+ * @param startAt - The plugin to start processing from, if missing from the execution
2095
+ * order then the next plugin will be NOT set.
1639
2096
  */
1640
- setNext: (nextCtx: ITelemetryPluginChain) => void;
2097
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
2098
+ }
2099
+
2100
+ /**
2101
+ * The current context for the current call to the plugin update() implementations, used to support the notifications
2102
+ * for when plugins are added, removed or the configuration was changed.
2103
+ */
2104
+ interface IProcessTelemetryUpdateContext extends IBaseProcessingContext {
1641
2105
  /**
1642
- * Call back for telemetry processing before it it is sent
1643
- * @param env - This is the current event being reported
2106
+ * This Plugin has finished unloading, so unload the next one
2107
+ * @param updateState - The update State
2108
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
1644
2109
  */
1645
- processNext: (env: ITelemetryItem) => void;
2110
+ processNext: (updateState: ITelemetryUpdateState) => boolean | void;
1646
2111
  /**
1647
- * Create a new context using the core and config from the current instance
2112
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1648
2113
  * @param plugins - The execution order to process the plugins, if null or not supplied
1649
2114
  * then the current execution order will be copied.
1650
2115
  * @param startAt - The plugin to start processing from, if missing from the execution
1651
2116
  * order then the next plugin will be NOT set.
1652
2117
  */
1653
- createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
2118
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUpdateContext;
1654
2119
  }
1655
2120
 
1656
2121
  interface IRequestContext {
@@ -1787,11 +2252,17 @@ declare namespace ApplicationInsights {
1787
2252
  aiDataContract: any;
1788
2253
  }
1789
2254
 
2255
+ function isNullOrUndefined(value: any): value is null | undefined;
2256
+
1790
2257
  interface IStackDetails {
1791
2258
  src: string;
1792
2259
  obj: string[];
1793
2260
  }
1794
2261
 
2262
+ interface ITelemetryInitializerHandler {
2263
+ remove(): void;
2264
+ }
2265
+
1795
2266
  /**
1796
2267
  * Telemety item supported in Core
1797
2268
  */
@@ -1841,15 +2312,7 @@ declare namespace ApplicationInsights {
1841
2312
  /**
1842
2313
  * Configuration provided to SDK core
1843
2314
  */
1844
- interface ITelemetryPlugin extends IPlugin {
1845
- /**
1846
- * Call back for telemetry processing before it it is sent
1847
- * @param env - This is the current event being reported
1848
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
1849
- * can optionally use this to access the current core instance or define / pass additional information
1850
- * to later plugins (vs appending items to the telemetry item)
1851
- */
1852
- processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2315
+ interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
1853
2316
  /**
1854
2317
  * Set next extension for telemetry processing, this is not optional as plugins should use the
1855
2318
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
@@ -1865,7 +2328,7 @@ declare namespace ApplicationInsights {
1865
2328
  /**
1866
2329
  * Configuration provided to SDK core
1867
2330
  */
1868
- interface ITelemetryPluginChain {
2331
+ interface ITelemetryPluginChain extends ITelemetryProcessor {
1869
2332
  /**
1870
2333
  * Returns the underlying plugin that is being proxied for the processTelemetry call
1871
2334
  */
@@ -1874,6 +2337,16 @@ declare namespace ApplicationInsights {
1874
2337
  * Returns the next plugin
1875
2338
  */
1876
2339
  getNext: () => ITelemetryPluginChain;
2340
+ /**
2341
+ * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
2342
+ * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
2343
+ * @param unloadCtx - The unload context to use for this call.
2344
+ * @param unloadState - The details of the unload operation
2345
+ */
2346
+ unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2347
+ }
2348
+
2349
+ interface ITelemetryProcessor {
1877
2350
  /**
1878
2351
  * Call back for telemetry processing before it it is sent
1879
2352
  * @param env - This is the current event being reported
@@ -1881,7 +2354,43 @@ declare namespace ApplicationInsights {
1881
2354
  * can optionally use this to access the current core instance or define / pass additional information
1882
2355
  * to later plugins (vs appending items to the telemetry item)
1883
2356
  */
1884
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
2357
+ processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
2358
+ /**
2359
+ * The the plugin should re-evaluate configuration and update any cached configuration settings or
2360
+ * plugins. If implemented this method will be called whenever a plugin is added or removed and if
2361
+ * the configuration has bee updated.
2362
+ * @param updateCtx - This is the context that should be used during updating.
2363
+ * @param updateState - The details / state of the update process, it holds details like the current and previous configuration.
2364
+ * @returns boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.
2365
+ */
2366
+ update?: (updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => void | boolean;
2367
+ }
2368
+
2369
+ interface ITelemetryUnloadState {
2370
+ reason: TelemetryUnloadReason;
2371
+ isAsync: boolean;
2372
+ flushComplete?: boolean;
2373
+ }
2374
+
2375
+ interface ITelemetryUpdateState {
2376
+ /**
2377
+ * Identifies the reason for the update notification, this is a bitwise numeric value
2378
+ */
2379
+ reason: TelemetryUpdateReason;
2380
+ /**
2381
+ * If this is a configuration update this was the previous configuration that was used
2382
+ */
2383
+ /**
2384
+ * If this is a configuration update is the new configuration that is being used
2385
+ */
2386
+ /**
2387
+ * This holds a collection of plugins that have been added (if the reason identifies that one or more plugins have been added)
2388
+ */
2389
+ added?: IPlugin[];
2390
+ /**
2391
+ * This holds a collection of plugins that have been removed (if the reason identifies that one or more plugins have been removed)
2392
+ */
2393
+ removed?: IPlugin[];
1885
2394
  }
1886
2395
 
1887
2396
  interface ITraceTelemetry extends IPartC {
@@ -1905,16 +2414,21 @@ declare namespace ApplicationInsights {
1905
2414
  iKey?: string;
1906
2415
  }
1907
2416
 
1908
- enum LoggingSeverity {
1909
- /**
1910
- * Error will be sent as internal telemetry
1911
- */
1912
- CRITICAL = 1,
1913
- /**
1914
- * Error will NOT be sent as internal telemetry, and will only be shown in browser console
1915
- */
1916
- WARNING = 2
1917
- }
2417
+ const LoggingSeverity: {
2418
+ CRITICAL: number;
2419
+ WARNING: number;
2420
+ };
2421
+
2422
+ type LoggingSeverity = number | eLoggingSeverity;
2423
+
2424
+ /**
2425
+ * Creates proxy functions on the target which internally will call the source version with all arguments passed to the target method.
2426
+ *
2427
+ * @param target - The target object to be assigned with the source properties and functions
2428
+ * @param source - The source object which will be assigned / called by setting / calling the targets proxies
2429
+ * @param functionsToProxy - An array of function names that will be proxied on the target
2430
+ */
2431
+ function proxyFunctions<T, S>(target: T, source: S | (() => S), functionsToProxy: (keyof S)[], overwriteTarget?: boolean): T;
1918
2432
 
1919
2433
  class Sender extends BaseTelemetryPlugin implements IChannelControlsAI {
1920
2434
  static constructEnvelope(orig: ITelemetryItem, iKey: string, logger: IDiagnosticLogger, convertUndefined?: any): IEnvelope;
@@ -1960,7 +2474,6 @@ declare namespace ApplicationInsights {
1960
2474
  * Will not flush if the Send has been paused.
1961
2475
  */
1962
2476
  onunloadFlush(): void;
1963
- teardown(): void;
1964
2477
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
1965
2478
  processTelemetry(telemetryItem: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
1966
2479
  /**
@@ -2031,6 +2544,10 @@ declare namespace ApplicationInsights {
2031
2544
  * The event(s) being sent as a retry
2032
2545
  */
2033
2546
  Retry = 5,
2547
+ /**
2548
+ * The SDK is unloading
2549
+ */
2550
+ SdkUnload = 6,
2034
2551
  /**
2035
2552
  * Maximum batch size would be exceeded
2036
2553
  */
@@ -2056,6 +2573,55 @@ declare namespace ApplicationInsights {
2056
2573
  [key: string]: any;
2057
2574
  }
2058
2575
 
2576
+ type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2577
+
2578
+ /**
2579
+ * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
2580
+ */
2581
+ const enum TelemetryUnloadReason {
2582
+ /**
2583
+ * Teardown has been called without any context.
2584
+ */
2585
+ ManualTeardown = 0,
2586
+ /**
2587
+ * Just this plugin is being removed
2588
+ */
2589
+ PluginUnload = 1,
2590
+ /**
2591
+ * This instance of the plugin is being removed and replaced
2592
+ */
2593
+ PluginReplace = 2,
2594
+ /**
2595
+ * The entire SDK is being unloaded
2596
+ */
2597
+ SdkUnload = 50
2598
+ }
2599
+
2600
+ /**
2601
+ * The TelemetryUpdateReason enumeration contains a set of bit-wise values that specify the reason for update request.
2602
+ */
2603
+ const enum TelemetryUpdateReason {
2604
+ /**
2605
+ * Unknown.
2606
+ */
2607
+ Unknown = 0,
2608
+ /**
2609
+ * The configuration has ben updated or changed
2610
+ */
2611
+ /**
2612
+ * One or more plugins have been added
2613
+ */
2614
+ PluginAdded = 16,
2615
+ /**
2616
+ * One or more plugins have been removed
2617
+ */
2618
+ PluginRemoved = 32
2619
+ }
2620
+
2621
+ function throwError(message: string): never;
2622
+
2623
+ type UnloadHandler = (itemCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
2624
+
2059
2625
  interface XDomainRequest extends XMLHttpRequestEventTarget {
2060
2626
  readonly responseText: string;
2061
2627
  send(payload: string): void;