@microsoft/applicationinsights-web 2.8.0-beta.2203-01 → 2.8.0-beta.2203-02

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 (50) hide show
  1. package/browser/{ai.2.8.0-beta.2203-01.cjs.js → ai.2.8.0-beta.2203-02.cjs.js} +876 -515
  2. package/browser/ai.2.8.0-beta.2203-02.cjs.js.map +1 -0
  3. package/browser/ai.2.8.0-beta.2203-02.cjs.min.js +6 -0
  4. package/browser/ai.2.8.0-beta.2203-02.cjs.min.js.map +1 -0
  5. package/browser/{ai.2.8.0-beta.2203-01.gbl.js → ai.2.8.0-beta.2203-02.gbl.js} +876 -515
  6. package/browser/ai.2.8.0-beta.2203-02.gbl.js.map +1 -0
  7. package/browser/ai.2.8.0-beta.2203-02.gbl.min.js +6 -0
  8. package/browser/ai.2.8.0-beta.2203-02.gbl.min.js.map +1 -0
  9. package/browser/ai.2.8.0-beta.2203-02.integrity.json +66 -0
  10. package/browser/{ai.2.8.0-beta.2203-01.js → ai.2.8.0-beta.2203-02.js} +876 -515
  11. package/browser/ai.2.8.0-beta.2203-02.js.map +1 -0
  12. package/browser/ai.2.8.0-beta.2203-02.min.js +6 -0
  13. package/browser/ai.2.8.0-beta.2203-02.min.js.map +1 -0
  14. package/browser/ai.2.cjs.js +875 -514
  15. package/browser/ai.2.cjs.js.map +1 -1
  16. package/browser/ai.2.cjs.min.js +2 -2
  17. package/browser/ai.2.cjs.min.js.map +1 -1
  18. package/browser/ai.2.gbl.js +875 -514
  19. package/browser/ai.2.gbl.js.map +1 -1
  20. package/browser/ai.2.gbl.min.js +2 -2
  21. package/browser/ai.2.gbl.min.js.map +1 -1
  22. package/browser/ai.2.js +875 -514
  23. package/browser/ai.2.js.map +1 -1
  24. package/browser/ai.2.min.js +2 -2
  25. package/browser/ai.2.min.js.map +1 -1
  26. package/dist/applicationinsights-web.api.json +328 -568
  27. package/dist/applicationinsights-web.api.md +44 -32
  28. package/dist/applicationinsights-web.d.ts +298 -93
  29. package/dist/applicationinsights-web.js +941 -578
  30. package/dist/applicationinsights-web.js.map +1 -1
  31. package/dist/applicationinsights-web.min.js +2 -2
  32. package/dist/applicationinsights-web.min.js.map +1 -1
  33. package/dist/applicationinsights-web.rollup.d.ts +298 -93
  34. package/dist-esm/ApplicationInsightsContainer.js +1 -1
  35. package/dist-esm/ApplicationInsightsDeprecated.js +1 -1
  36. package/dist-esm/Init.js +1 -1
  37. package/dist-esm/Initialization.js +1 -1
  38. package/dist-esm/applicationinsights-web.js +1 -1
  39. package/package.json +7 -7
  40. package/types/Initialization.d.ts +6 -2
  41. package/browser/ai.2.8.0-beta.2203-01.cjs.js.map +0 -1
  42. package/browser/ai.2.8.0-beta.2203-01.cjs.min.js +0 -6
  43. package/browser/ai.2.8.0-beta.2203-01.cjs.min.js.map +0 -1
  44. package/browser/ai.2.8.0-beta.2203-01.gbl.js.map +0 -1
  45. package/browser/ai.2.8.0-beta.2203-01.gbl.min.js +0 -6
  46. package/browser/ai.2.8.0-beta.2203-01.gbl.min.js.map +0 -1
  47. package/browser/ai.2.8.0-beta.2203-01.integrity.json +0 -66
  48. package/browser/ai.2.8.0-beta.2203-01.js.map +0 -1
  49. package/browser/ai.2.8.0-beta.2203-01.min.js +0 -6
  50. package/browser/ai.2.8.0-beta.2203-01.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.0-beta.2203-01
2
+ * Microsoft.ApplicationInsights, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -424,6 +424,10 @@ export declare class BaseCore implements IAppInsightsCore {
424
424
  */
425
425
  addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
426
426
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
427
+ /**
428
+ * Returns the unique event namespace that should be used
429
+ */
430
+ evtNamespace(): string;
427
431
  protected releaseQueue(): void;
428
432
  }
429
433
 
@@ -472,8 +476,26 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
472
476
  * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
473
477
  */
474
478
  protected setInitialized: (isInitialized: boolean) => void;
479
+ /**
480
+ * Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin
481
+ * finishes it's removal.
482
+ * @param unloadCtx - This is the context that should be used during unloading.
483
+ * @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.
484
+ * @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.
485
+ * @returns boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.
486
+ */
487
+ protected _doTeardown?: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: () => void) => void | boolean;
475
488
  constructor();
476
489
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
490
+ /**
491
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
492
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
493
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
494
+ * @param unloadCtx - This is the context that should be used during unloading.
495
+ * @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.
496
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
497
+ */
498
+ teardown(unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState): void | boolean;
477
499
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
478
500
  /**
479
501
  * Add this hook so that it is automatically removed during unloading
@@ -585,7 +607,6 @@ export declare class DependenciesPlugin extends BaseTelemetryPlugin implements I
585
607
  priority: number;
586
608
  constructor();
587
609
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
588
- teardown(): void;
589
610
  processTelemetry(item: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
590
611
  /**
591
612
  * Logs dependency call
@@ -608,20 +629,13 @@ export declare class DependenciesPlugin extends BaseTelemetryPlugin implements I
608
629
  }): void;
609
630
  }
610
631
 
611
- export declare enum DistributedTracingModes {
612
- /**
613
- * (Default) Send Application Insights correlation headers
614
- */
615
- AI = 0,
616
- /**
617
- * Send both W3C Trace Context headers and back-compatibility Application Insights headers
618
- */
619
- AI_AND_W3C = 1,
620
- /**
621
- * Send W3C Trace Context headers
622
- */
623
- W3C = 2
624
- }
632
+ export declare const DistributedTracingModes: {
633
+ AI: number;
634
+ AI_AND_W3C: number;
635
+ W3C: number;
636
+ };
637
+
638
+ export declare type DistributedTracingModes = number | eDistributedTracingModes;
625
639
 
626
640
  /**
627
641
  * The abstract common base of all domains.
@@ -639,6 +653,117 @@ declare interface Domain {
639
653
  */
640
654
  export declare function doPerf<T>(mgrSource: IPerfManagerProvider | IPerfManager, getSource: () => string, func: (perfEvt?: IPerfEvent) => T, details?: () => any, isAsync?: boolean): T;
641
655
 
656
+ declare const enum eDistributedTracingModes {
657
+ /**
658
+ * (Default) Send Application Insights correlation headers
659
+ */
660
+ AI = 0,
661
+ /**
662
+ * Send both W3C Trace Context headers and back-compatibility Application Insights headers
663
+ */
664
+ AI_AND_W3C = 1,
665
+ /**
666
+ * Send W3C Trace Context headers
667
+ */
668
+ W3C = 2
669
+ }
670
+
671
+ declare const enum _eInternalMessageId {
672
+ BrowserDoesNotSupportLocalStorage = 0,
673
+ BrowserCannotReadLocalStorage = 1,
674
+ BrowserCannotReadSessionStorage = 2,
675
+ BrowserCannotWriteLocalStorage = 3,
676
+ BrowserCannotWriteSessionStorage = 4,
677
+ BrowserFailedRemovalFromLocalStorage = 5,
678
+ BrowserFailedRemovalFromSessionStorage = 6,
679
+ CannotSendEmptyTelemetry = 7,
680
+ ClientPerformanceMathError = 8,
681
+ ErrorParsingAISessionCookie = 9,
682
+ ErrorPVCalc = 10,
683
+ ExceptionWhileLoggingError = 11,
684
+ FailedAddingTelemetryToBuffer = 12,
685
+ FailedMonitorAjaxAbort = 13,
686
+ FailedMonitorAjaxDur = 14,
687
+ FailedMonitorAjaxOpen = 15,
688
+ FailedMonitorAjaxRSC = 16,
689
+ FailedMonitorAjaxSend = 17,
690
+ FailedMonitorAjaxGetCorrelationHeader = 18,
691
+ FailedToAddHandlerForOnBeforeUnload = 19,
692
+ FailedToSendQueuedTelemetry = 20,
693
+ FailedToReportDataLoss = 21,
694
+ FlushFailed = 22,
695
+ MessageLimitPerPVExceeded = 23,
696
+ MissingRequiredFieldSpecification = 24,
697
+ NavigationTimingNotSupported = 25,
698
+ OnError = 26,
699
+ SessionRenewalDateIsZero = 27,
700
+ SenderNotInitialized = 28,
701
+ StartTrackEventFailed = 29,
702
+ StopTrackEventFailed = 30,
703
+ StartTrackFailed = 31,
704
+ StopTrackFailed = 32,
705
+ TelemetrySampledAndNotSent = 33,
706
+ TrackEventFailed = 34,
707
+ TrackExceptionFailed = 35,
708
+ TrackMetricFailed = 36,
709
+ TrackPVFailed = 37,
710
+ TrackPVFailedCalc = 38,
711
+ TrackTraceFailed = 39,
712
+ TransmissionFailed = 40,
713
+ FailedToSetStorageBuffer = 41,
714
+ FailedToRestoreStorageBuffer = 42,
715
+ InvalidBackendResponse = 43,
716
+ FailedToFixDepricatedValues = 44,
717
+ InvalidDurationValue = 45,
718
+ TelemetryEnvelopeInvalid = 46,
719
+ CreateEnvelopeError = 47,
720
+ CannotSerializeObject = 48,
721
+ CannotSerializeObjectNonSerializable = 49,
722
+ CircularReferenceDetected = 50,
723
+ ClearAuthContextFailed = 51,
724
+ ExceptionTruncated = 52,
725
+ IllegalCharsInName = 53,
726
+ ItemNotInArray = 54,
727
+ MaxAjaxPerPVExceeded = 55,
728
+ MessageTruncated = 56,
729
+ NameTooLong = 57,
730
+ SampleRateOutOfRange = 58,
731
+ SetAuthContextFailed = 59,
732
+ SetAuthContextFailedAccountName = 60,
733
+ StringValueTooLong = 61,
734
+ StartCalledMoreThanOnce = 62,
735
+ StopCalledWithoutStart = 63,
736
+ TelemetryInitializerFailed = 64,
737
+ TrackArgumentsNotSpecified = 65,
738
+ UrlTooLong = 66,
739
+ SessionStorageBufferFull = 67,
740
+ CannotAccessCookie = 68,
741
+ IdTooLong = 69,
742
+ InvalidEvent = 70,
743
+ FailedMonitorAjaxSetRequestHeader = 71,
744
+ SendBrowserInfoOnUserInit = 72,
745
+ PluginException = 73,
746
+ NotificationException = 74,
747
+ SnippetScriptLoadFailure = 99,
748
+ InvalidInstrumentationKey = 100,
749
+ CannotParseAiBlobValue = 101,
750
+ InvalidContentBlob = 102,
751
+ TrackPageActionEventFailed = 103,
752
+ FailedAddingCustomDefinedRequestContext = 104,
753
+ InMemoryStorageBufferFull = 105
754
+ }
755
+
756
+ declare const enum eLoggingSeverity {
757
+ /**
758
+ * Error will be sent as internal telemetry
759
+ */
760
+ CRITICAL = 1,
761
+ /**
762
+ * Error will NOT be sent as internal telemetry, and will only be shown in browser console
763
+ */
764
+ WARNING = 2
765
+ }
766
+
642
767
  declare class Envelope extends Envelope_2 implements IEnvelope {
643
768
  /**
644
769
  * The data contract for serializing this object.
@@ -936,6 +1061,10 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
936
1061
  * @param pluginIdentifier
937
1062
  */
938
1063
  getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
1064
+ /**
1065
+ * Returns the unique event namespace that should be used when registering events
1066
+ */
1067
+ evtNamespace(): string;
939
1068
  }
940
1069
 
941
1070
  export declare interface IAppInsightsDeprecated {
@@ -1189,6 +1318,67 @@ declare interface IBackendResponse {
1189
1318
  readonly appId?: string;
1190
1319
  }
1191
1320
 
1321
+ declare interface IBaseProcessingContext {
1322
+ /**
1323
+ * The current core instance for the request
1324
+ */
1325
+ core: () => IAppInsightsCore;
1326
+ /**
1327
+ * THe current diagnostic logger for the request
1328
+ */
1329
+ diagLog: () => IDiagnosticLogger;
1330
+ /**
1331
+ * Gets the current core config instance
1332
+ */
1333
+ getCfg: () => IConfiguration;
1334
+ /**
1335
+ * Gets the named extension config
1336
+ */
1337
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
1338
+ /**
1339
+ * Gets the named config from either the named identifier extension or core config if neither exist then the
1340
+ * default value is returned
1341
+ * @param identifier The named extension identifier
1342
+ * @param field The config field name
1343
+ * @param defaultValue The default value to return if no defined config exists
1344
+ */
1345
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
1346
+ /**
1347
+ * Helper to allow plugins to check and possibly shortcut executing code only
1348
+ * required if there is a nextPlugin
1349
+ */
1350
+ hasNext: () => boolean;
1351
+ /**
1352
+ * Returns the next configured plugin proxy
1353
+ */
1354
+ getNext: () => ITelemetryPluginChain;
1355
+ /**
1356
+ * Helper to set the next plugin proxy
1357
+ */
1358
+ setNext: (nextCtx: ITelemetryPluginChain) => void;
1359
+ /**
1360
+ * Synchronously iterate over the context chain running the callback for each plugin, once
1361
+ * every plugin has been executed via the callback, any associated onComplete will be called.
1362
+ * @param callback - The function call for each plugin in the context chain
1363
+ */
1364
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
1365
+ /**
1366
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
1367
+ * @param onComplete - The onComplete to call
1368
+ * @param that - The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context
1369
+ * @param args - Any additional arguments to pass to the onComplete function
1370
+ */
1371
+ onComplete: (onComplete: Function, that?: any, ...args: any[]) => void;
1372
+ /**
1373
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
1374
+ * @param plugins - The execution order to process the plugins, if null or not supplied
1375
+ * then the current execution order will be copied.
1376
+ * @param startAt - The plugin to start processing from, if missing from the execution
1377
+ * order then the next plugin will be NOT set.
1378
+ */
1379
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IBaseProcessingContext;
1380
+ }
1381
+
1192
1382
  /**
1193
1383
  * Provides data transmission capabilities
1194
1384
  */
@@ -1202,9 +1392,14 @@ declare interface IChannelControls extends ITelemetryPlugin {
1202
1392
  */
1203
1393
  resume(): void;
1204
1394
  /**
1205
- * Tear down transmission pipeline
1395
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
1396
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
1397
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
1398
+ * @param unloadCtx - This is the context that should be used during unloading.
1399
+ * @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.
1400
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
1206
1401
  */
1207
- teardown(): void;
1402
+ teardown: (unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
1208
1403
  /**
1209
1404
  * Flush to send data immediately; channel should default to sending data asynchronously
1210
1405
  * @param async - send data asynchronously when true
@@ -2059,7 +2254,7 @@ export declare interface ICoreUtils {
2059
2254
  * @param callback {any} - The callback function that needs to be executed for the given event
2060
2255
  * @return {boolean} - true if the handler was successfully added
2061
2256
  */
2062
- addEventHandler: (eventName: string, callback: any) => boolean;
2257
+ addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
2063
2258
  /**
2064
2259
  * 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)
2065
2260
  * https://caniuse.com/#search=Date.now
@@ -2534,6 +2729,19 @@ declare interface IInternal {
2534
2729
 
2535
2730
  declare interface ILoadedPlugin<T extends IPlugin> {
2536
2731
  plugin: T;
2732
+ /**
2733
+ * Identifies whether the plugin is enabled and can process events. This is slightly different from isInitialized as the plugin may be initialized but disabled
2734
+ * via the setEnabled() or it may be a shared plugin which has had it's teardown function called from another instance..
2735
+ * @returns boolean = true if the plugin is in a state where it is operational.
2736
+ */
2737
+ isEnabled: () => boolean;
2738
+ /**
2739
+ * You can optionally enable / disable a plugin from processing events.
2740
+ * Setting enabled to true will not necessarily cause the `isEnabled()` to also return true
2741
+ * as the plugin must also have been successfully initialized and not had it's `teardown` method called
2742
+ * (unless it's also been re-initialized)
2743
+ */
2744
+ setEnabled: (isEnabled: boolean) => void;
2537
2745
  }
2538
2746
 
2539
2747
  declare interface ILocation {
@@ -2762,7 +2970,7 @@ export declare const _InternalMessageId: {
2762
2970
  InMemoryStorageBufferFull: number;
2763
2971
  };
2764
2972
 
2765
- export declare type _InternalMessageId = number | typeof _InternalMessageId;
2973
+ export declare type _InternalMessageId = number | _eInternalMessageId;
2766
2974
 
2767
2975
  declare interface IOperatingSystem {
2768
2976
  name: string;
@@ -3015,10 +3223,14 @@ export declare interface IPlugin {
3015
3223
  */
3016
3224
  isInitialized?: () => boolean;
3017
3225
  /**
3018
- * Tear down the plugin and remove any hooked value, the plugin should remove that it is no longer initialized and
3019
- * therefore can be re-initialized after being torn down.
3226
+ * Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and
3227
+ * therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further
3228
+ * processTelemetry calls are ignored and it just calls the processNext() with the provided context.
3229
+ * @param unloadCtx - This is the context that should be used during unloading.
3230
+ * @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.
3231
+ * @returns boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.
3020
3232
  */
3021
- teardown?: () => void;
3233
+ teardown?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => void | boolean;
3022
3234
  /**
3023
3235
  * Extension name
3024
3236
  */
@@ -3033,67 +3245,42 @@ export declare interface IPlugin {
3033
3245
  * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
3034
3246
  * between multiple AppInsights instances
3035
3247
  */
3036
- export declare interface IProcessTelemetryContext {
3037
- /**
3038
- * The current core instance for the request
3039
- */
3040
- core: () => IAppInsightsCore;
3041
- /**
3042
- * THe current diagnostic logger for the request
3043
- */
3044
- diagLog: () => IDiagnosticLogger;
3045
- /**
3046
- * Gets the current core config instance
3047
- */
3048
- getCfg: () => IConfiguration;
3049
- /**
3050
- * Gets the named extension config
3051
- */
3052
- getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
3053
- /**
3054
- * Gets the named config from either the named identifier extension or core config if neither exist then the
3055
- * default value is returned
3056
- * @param identifier The named extension identifier
3057
- * @param field The config field name
3058
- * @param defaultValue The default value to return if no defined config exists
3059
- */
3060
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
3061
- /**
3062
- * Helper to allow plugins to check and possibly shortcut executing code only
3063
- * required if there is a nextPlugin
3064
- */
3065
- hasNext: () => boolean;
3066
- /**
3067
- * Returns the next configured plugin proxy
3068
- */
3069
- getNext: () => ITelemetryPluginChain;
3070
- /**
3071
- * Helper to set the next plugin proxy
3072
- */
3073
- setNext: (nextCtx: ITelemetryPluginChain) => void;
3248
+ export declare interface IProcessTelemetryContext extends IBaseProcessingContext {
3074
3249
  /**
3075
3250
  * Call back for telemetry processing before it it is sent
3076
3251
  * @param env - This is the current event being reported
3252
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
3077
3253
  */
3078
- processNext: (env: ITelemetryItem) => void;
3079
- /**
3080
- * Synchronously iterate over the context chain running the callback for each plugin, once
3081
- * every plugin has been executed via the callback, any associated onComplete will be called.
3082
- * @param callback - The function call for each plugin in the context chain
3083
- */
3084
- iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
3254
+ processNext: (env: ITelemetryItem) => boolean | void;
3085
3255
  /**
3086
- * Create a new context using the core and config from the current instance
3256
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
3087
3257
  * @param plugins - The execution order to process the plugins, if null or not supplied
3088
3258
  * then the current execution order will be copied.
3089
3259
  * @param startAt - The plugin to start processing from, if missing from the execution
3090
3260
  * order then the next plugin will be NOT set.
3091
3261
  */
3092
3262
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
3263
+ }
3264
+
3265
+ /**
3266
+ * The current context for the current call to processTelemetry(), used to support sharing the same plugin instance
3267
+ * between multiple AppInsights instances
3268
+ */
3269
+ declare interface IProcessTelemetryUnloadContext extends IBaseProcessingContext {
3093
3270
  /**
3094
- * Set the function to call when the current chain has executed all processNext or unloadNext items.
3271
+ * This Plugin has finished unloading, so unload the next one
3272
+ * @param uploadState - The state of the unload process
3273
+ * @returns boolean (true) if there is no more plugins to process otherwise false or undefined (void)
3095
3274
  */
3096
- onComplete: (onComplete: () => void) => void;
3275
+ processNext: (unloadState: ITelemetryUnloadState) => boolean | void;
3276
+ /**
3277
+ * Create a new context using the core and config from the current instance, returns a new instance of the same type
3278
+ * @param plugins - The execution order to process the plugins, if null or not supplied
3279
+ * then the current execution order will be copied.
3280
+ * @param startAt - The plugin to start processing from, if missing from the execution
3281
+ * order then the next plugin will be NOT set.
3282
+ */
3283
+ createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryUnloadContext;
3097
3284
  }
3098
3285
 
3099
3286
  declare interface IPropertiesPlugin {
@@ -3449,15 +3636,7 @@ export declare interface ITelemetryItem {
3449
3636
  /**
3450
3637
  * Configuration provided to SDK core
3451
3638
  */
3452
- export declare interface ITelemetryPlugin extends IPlugin {
3453
- /**
3454
- * Call back for telemetry processing before it it is sent
3455
- * @param env - This is the current event being reported
3456
- * @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
3457
- * can optionally use this to access the current core instance or define / pass additional information
3458
- * to later plugins (vs appending items to the telemetry item)
3459
- */
3460
- processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
3639
+ export declare interface ITelemetryPlugin extends ITelemetryProcessor, IPlugin {
3461
3640
  /**
3462
3641
  * Set next extension for telemetry processing, this is not optional as plugins should use the
3463
3642
  * processNext() function of the passed IProcessTelemetryContext instead. It is being kept for
@@ -3473,7 +3652,7 @@ export declare interface ITelemetryPlugin extends IPlugin {
3473
3652
  /**
3474
3653
  * Configuration provided to SDK core
3475
3654
  */
3476
- export declare interface ITelemetryPluginChain {
3655
+ export declare interface ITelemetryPluginChain extends ITelemetryProcessor {
3477
3656
  /**
3478
3657
  * Returns the underlying plugin that is being proxied for the processTelemetry call
3479
3658
  */
@@ -3482,6 +3661,16 @@ export declare interface ITelemetryPluginChain {
3482
3661
  * Returns the next plugin
3483
3662
  */
3484
3663
  getNext: () => ITelemetryPluginChain;
3664
+ /**
3665
+ * This plugin is being unloaded and should remove any hooked events and cleanup any global/scoped values, after this
3666
+ * call the plugin will be removed from the telemetry processing chain and will no longer receive any events..
3667
+ * @param unloadCtx - The unload context to use for this call.
3668
+ * @param unloadState - The details of the unload operation
3669
+ */
3670
+ unload?: (unloadCtx: IProcessTelemetryUnloadContext, unloadState: ITelemetryUnloadState) => void;
3671
+ }
3672
+
3673
+ declare interface ITelemetryProcessor {
3485
3674
  /**
3486
3675
  * Call back for telemetry processing before it it is sent
3487
3676
  * @param env - This is the current event being reported
@@ -3489,7 +3678,7 @@ export declare interface ITelemetryPluginChain {
3489
3678
  * can optionally use this to access the current core instance or define / pass additional information
3490
3679
  * to later plugins (vs appending items to the telemetry item)
3491
3680
  */
3492
- processTelemetry: (env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void;
3681
+ processTelemetry: (env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void;
3493
3682
  }
3494
3683
 
3495
3684
  declare interface ITelemetryTrace {
@@ -3511,6 +3700,12 @@ declare interface ITelemetryTrace {
3511
3700
  name?: string;
3512
3701
  }
3513
3702
 
3703
+ declare interface ITelemetryUnloadState {
3704
+ reason: TelemetryUnloadReason;
3705
+ isAsync: boolean;
3706
+ flushComplete?: boolean;
3707
+ }
3708
+
3514
3709
  declare interface ITraceState {
3515
3710
  }
3516
3711
 
@@ -3784,16 +3979,12 @@ declare interface IWeb {
3784
3979
  domain: string;
3785
3980
  }
3786
3981
 
3787
- export declare enum LoggingSeverity {
3788
- /**
3789
- * Error will be sent as internal telemetry
3790
- */
3791
- CRITICAL = 1,
3792
- /**
3793
- * Error will NOT be sent as internal telemetry, and will only be shown in browser console
3794
- */
3795
- WARNING = 2
3796
- }
3982
+ export declare const LoggingSeverity: {
3983
+ CRITICAL: number;
3984
+ WARNING: number;
3985
+ };
3986
+
3987
+ export declare type LoggingSeverity = number | eLoggingSeverity;
3797
3988
 
3798
3989
  /**
3799
3990
  * Instances of Message represent printf-like trace statements that are text-searched. Log4Net, NLog and other text-based log file entries are translated into intances of this type. The message does not have measurements.
@@ -4571,7 +4762,11 @@ export declare const Telemetry: {
4571
4762
  SessionExt: string;
4572
4763
  SDKExt: string;
4573
4764
  };
4574
- DistributedTracingModes: typeof DistributedTracingModes;
4765
+ DistributedTracingModes: {
4766
+ AI: number;
4767
+ AI_AND_W3C: number;
4768
+ W3C: number;
4769
+ };
4575
4770
  };
4576
4771
 
4577
4772
  declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
@@ -4593,6 +4788,16 @@ declare class TelemetryItemCreator {
4593
4788
  }): ITelemetryItem;
4594
4789
  }
4595
4790
 
4791
+ /**
4792
+ * The TelemetryUnloadReason enumeration contains the possible reasons for why a plugin is being unloaded / torndown().
4793
+ */
4794
+ declare const enum TelemetryUnloadReason {
4795
+ /**
4796
+ * Teardown has been called without any context.
4797
+ */
4798
+ ManualTeardown = 0
4799
+ }
4800
+
4596
4801
  export declare class Trace extends MessageData implements ISerializable {
4597
4802
  static envelopeType: string;
4598
4803
  static dataType: string;
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { AppInsightsDeprecated } from "./ApplicationInsightsDeprecated";
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  import { stringToBoolOrDefault, ProcessLegacy } from "@microsoft/applicationinsights-common";
package/dist-esm/Init.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-01
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2203-02
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export { Initialization as ApplicationInsights, Telemetry } from "./Initialization";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-web",
3
- "version": "2.8.0-beta.2203-01",
3
+ "version": "2.8.0-beta.2203-02",
4
4
  "description": "Microsoft Application Insights JavaScript SDK - Web",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -66,12 +66,12 @@
66
66
  "dependencies": {
67
67
  "@microsoft/dynamicproto-js": "^1.1.4",
68
68
  "@microsoft/applicationinsights-shims": "2.0.1",
69
- "@microsoft/applicationinsights-analytics-js": "2.8.0-beta.2203-01",
70
- "@microsoft/applicationinsights-channel-js": "2.8.0-beta.2203-01",
71
- "@microsoft/applicationinsights-common": "2.8.0-beta.2203-01",
72
- "@microsoft/applicationinsights-core-js": "2.8.0-beta.2203-01",
73
- "@microsoft/applicationinsights-dependencies-js": "2.8.0-beta.2203-01",
74
- "@microsoft/applicationinsights-properties-js": "2.8.0-beta.2203-01"
69
+ "@microsoft/applicationinsights-analytics-js": "2.8.0-beta.2203-02",
70
+ "@microsoft/applicationinsights-channel-js": "2.8.0-beta.2203-02",
71
+ "@microsoft/applicationinsights-common": "2.8.0-beta.2203-02",
72
+ "@microsoft/applicationinsights-core-js": "2.8.0-beta.2203-02",
73
+ "@microsoft/applicationinsights-dependencies-js": "2.8.0-beta.2203-02",
74
+ "@microsoft/applicationinsights-properties-js": "2.8.0-beta.2203-02"
75
75
  },
76
76
  "license": "MIT",
77
77
  "publishConfig": {
@@ -2,7 +2,7 @@ import { IConfiguration, IAppInsightsCore, ITelemetryItem, ICustomProperties, ID
2
2
  import { ApplicationInsights } from "@microsoft/applicationinsights-analytics-js";
3
3
  import { Sender } from "@microsoft/applicationinsights-channel-js";
4
4
  import { IDependenciesPlugin } from "@microsoft/applicationinsights-dependencies-js";
5
- import { IUtil, ICorrelationIdHelper, IUrlHelper, IDateTimeUtils, FieldType, IRequestHeaders, AIData, AIBase, Envelope, Event, Exception, Metric, PageView, PageViewData, RemoteDependencyData, IEventTelemetry, ITraceTelemetry, IMetricTelemetry, IDependencyTelemetry, IExceptionTelemetry, IAutoExceptionTelemetry, IPageViewTelemetry, IPageViewPerformanceTelemetry, Trace, PageViewPerformance, Data, SeverityLevel, IConfig, ConfigurationManager, ContextTagKeys, IDataSanitizer, TelemetryItemCreator, IAppInsights, IPropertiesPlugin, DistributedTracingModes, ITelemetryContext as Common_ITelemetryContext, parseConnectionString } from "@microsoft/applicationinsights-common";
5
+ import { IUtil, ICorrelationIdHelper, IUrlHelper, IDateTimeUtils, FieldType, IRequestHeaders, AIData, AIBase, Envelope, Event, Exception, Metric, PageView, PageViewData, RemoteDependencyData, IEventTelemetry, ITraceTelemetry, IMetricTelemetry, IDependencyTelemetry, IExceptionTelemetry, IAutoExceptionTelemetry, IPageViewTelemetry, IPageViewPerformanceTelemetry, Trace, PageViewPerformance, Data, SeverityLevel, IConfig, ConfigurationManager, ContextTagKeys, IDataSanitizer, TelemetryItemCreator, IAppInsights, IPropertiesPlugin, ITelemetryContext as Common_ITelemetryContext, parseConnectionString } from "@microsoft/applicationinsights-common";
6
6
  export { IUtil, ICorrelationIdHelper, IUrlHelper, IDateTimeUtils, IRequestHeaders };
7
7
  /**
8
8
  *
@@ -78,7 +78,11 @@ export declare const Telemetry: {
78
78
  SessionExt: string;
79
79
  SDKExt: string;
80
80
  };
81
- DistributedTracingModes: typeof DistributedTracingModes;
81
+ DistributedTracingModes: {
82
+ AI: number;
83
+ AI_AND_W3C: number;
84
+ W3C: number;
85
+ };
82
86
  };
83
87
  /**
84
88
  * Application Insights API