@microsoft/applicationinsights-web 2.7.4-nightly.2202-07 → 2.8.0-beta.2202-06

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/browser/{ai.2.7.4-nightly.2202-07.cjs.js → ai.2.8.0-beta.2202-06.cjs.js} +924 -524
  2. package/browser/ai.2.8.0-beta.2202-06.cjs.js.map +1 -0
  3. package/browser/ai.2.8.0-beta.2202-06.cjs.min.js +6 -0
  4. package/browser/ai.2.8.0-beta.2202-06.cjs.min.js.map +1 -0
  5. package/browser/{ai.2.7.4-nightly.2202-07.gbl.js → ai.2.8.0-beta.2202-06.gbl.js} +924 -524
  6. package/browser/ai.2.8.0-beta.2202-06.gbl.js.map +1 -0
  7. package/browser/ai.2.8.0-beta.2202-06.gbl.min.js +6 -0
  8. package/browser/ai.2.8.0-beta.2202-06.gbl.min.js.map +1 -0
  9. package/browser/ai.2.8.0-beta.2202-06.integrity.json +66 -0
  10. package/browser/{ai.2.7.4-nightly.2202-07.js → ai.2.8.0-beta.2202-06.js} +924 -524
  11. package/browser/ai.2.8.0-beta.2202-06.js.map +1 -0
  12. package/browser/ai.2.8.0-beta.2202-06.min.js +6 -0
  13. package/browser/ai.2.8.0-beta.2202-06.min.js.map +1 -0
  14. package/browser/ai.2.cjs.js +923 -523
  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 +923 -523
  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 +923 -523
  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 +653 -213
  27. package/dist/applicationinsights-web.api.md +20 -6
  28. package/dist/applicationinsights-web.d.ts +158 -37
  29. package/dist/applicationinsights-web.js +923 -523
  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 +158 -37
  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 +8 -8
  40. package/browser/ai.2.7.4-nightly.2202-07.cjs.js.map +0 -1
  41. package/browser/ai.2.7.4-nightly.2202-07.cjs.min.js +0 -6
  42. package/browser/ai.2.7.4-nightly.2202-07.cjs.min.js.map +0 -1
  43. package/browser/ai.2.7.4-nightly.2202-07.gbl.js.map +0 -1
  44. package/browser/ai.2.7.4-nightly.2202-07.gbl.min.js +0 -6
  45. package/browser/ai.2.7.4-nightly.2202-07.gbl.min.js.map +0 -1
  46. package/browser/ai.2.7.4-nightly.2202-07.integrity.json +0 -66
  47. package/browser/ai.2.7.4-nightly.2202-07.js.map +0 -1
  48. package/browser/ai.2.7.4-nightly.2202-07.min.js +0 -6
  49. package/browser/ai.2.7.4-nightly.2202-07.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.7.4-nightly.2202-07
2
+ * Microsoft.ApplicationInsights, 2.8.0-beta.2202-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -50,26 +50,6 @@ export declare class AppInsightsCore extends BaseCore implements IAppInsightsCor
50
50
  constructor();
51
51
  initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
52
52
  track(telemetryItem: ITelemetryItem): void;
53
- /**
54
- * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
55
- * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
56
- * called.
57
- * @param {INotificationListener} listener - An INotificationListener object.
58
- */
59
- addNotificationListener(listener: INotificationListener): void;
60
- /**
61
- * Removes all instances of the listener.
62
- * @param {INotificationListener} listener - INotificationListener to remove.
63
- */
64
- removeNotificationListener(listener: INotificationListener): void;
65
- /**
66
- * Periodically check logger.queue for
67
- */
68
- pollInternalLogs(eventName?: string): number;
69
- /**
70
- * Periodically check logger.queue for
71
- */
72
- stopPollingInternalLogs(): void;
73
53
  }
74
54
 
75
55
  export declare class ApplicationAnalytics extends BaseTelemetryPlugin implements IAppInsights, IAppInsightsInternal {
@@ -405,6 +385,18 @@ export declare class BaseCore implements IAppInsightsCore {
405
385
  track(telemetryItem: ITelemetryItem): void;
406
386
  getProcessTelContext(): IProcessTelemetryContext;
407
387
  getNotifyMgr(): INotificationManager;
388
+ /**
389
+ * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
390
+ * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
391
+ * called.
392
+ * @param {INotificationListener} listener - An INotificationListener object.
393
+ */
394
+ addNotificationListener(listener: INotificationListener): void;
395
+ /**
396
+ * Removes all instances of the listener.
397
+ * @param {INotificationListener} listener - INotificationListener to remove.
398
+ */
399
+ removeNotificationListener(listener: INotificationListener): void;
408
400
  /**
409
401
  * Get the current cookie manager for this instance
410
402
  */
@@ -417,6 +409,21 @@ export declare class BaseCore implements IAppInsightsCore {
417
409
  getPerfMgr(): IPerfManager;
418
410
  setPerfMgr(perfMgr: IPerfManager): void;
419
411
  eventCnt(): number;
412
+ /**
413
+ * Periodically check logger.queue for
414
+ */
415
+ pollInternalLogs(eventName?: string): number;
416
+ /**
417
+ * Periodically check logger.queue for
418
+ */
419
+ stopPollingInternalLogs(): void;
420
+ /**
421
+ * Add a telemetry processor to decorate or drop telemetry events.
422
+ * @param telemetryInitializer - The Telemetry Initializer function
423
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
424
+ */
425
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
426
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
420
427
  protected releaseQueue(): void;
421
428
  }
422
429
 
@@ -426,6 +433,13 @@ export declare class BaseCore implements IAppInsightsCore {
426
433
  * implementation so that new default implementations can be added without breaking all plugins.
427
434
  */
428
435
  export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
436
+ identifier: string;
437
+ version?: string;
438
+ /**
439
+ * Holds the core instance that was used during initialization
440
+ */
441
+ core: IAppInsightsCore;
442
+ priority: number;
429
443
  /**
430
444
  * Call back for telemetry processing before it it is sent
431
445
  * @param env - This is the current event being reported
@@ -447,13 +461,6 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
447
461
  * Returns whether the plugin has been initialized
448
462
  */
449
463
  isInitialized: () => boolean;
450
- identifier: string;
451
- version?: string;
452
- /**
453
- * Holds the core instance that was used during initialization
454
- */
455
- core: IAppInsightsCore;
456
- priority: number;
457
464
  /**
458
465
  * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
459
466
  * returns that value (helps with minification for callers), otherwise it will return the configured
@@ -465,13 +472,14 @@ export declare abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
465
472
  * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
466
473
  */
467
474
  protected setInitialized: (isInitialized: boolean) => void;
468
- /**
469
- * Internal helper to initialize the instance
470
- */
471
- private _baseTelInit;
472
475
  constructor();
473
476
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
474
477
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
478
+ /**
479
+ * Add this hook so that it is automatically removed during unloading
480
+ * @param hooks - The single hook or an array of IInstrumentHook objects
481
+ */
482
+ protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
475
483
  }
476
484
 
477
485
  declare class ConfigurationManager {
@@ -830,6 +838,12 @@ declare const enum FieldType {
830
838
  */
831
839
  declare function _formatErrorCode(errorObj: any): any;
832
840
 
841
+ declare const enum GetExtCfgMergeType {
842
+ None = 0,
843
+ MergeDefaultOnly = 1,
844
+ MergeDefaultFromRootOrDefault = 2
845
+ }
846
+
833
847
  declare interface IAjaxRecordResponse {
834
848
  statusText: string;
835
849
  headerMap: Object;
@@ -905,12 +919,23 @@ export declare interface IAppInsightsCore extends IPerfManagerProvider {
905
919
  * @param {INotificationListener} listener - INotificationListener to remove.
906
920
  */
907
921
  removeNotificationListener?(listener: INotificationListener): void;
922
+ /**
923
+ * Add a telemetry processor to decorate or drop telemetry events.
924
+ * @param telemetryInitializer - The Telemetry Initializer function
925
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
926
+ */
927
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
908
928
  pollInternalLogs?(eventName?: string): number;
909
929
  stopPollingInternalLogs?(): void;
910
930
  /**
911
931
  * Return a new instance of the IProcessTelemetryContext for processing events
912
932
  */
913
933
  getProcessTelContext(): IProcessTelemetryContext;
934
+ /**
935
+ * Find and return the (first) plugin with the specified identifier if present
936
+ * @param pluginIdentifier
937
+ */
938
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
914
939
  }
915
940
 
916
941
  export declare interface IAppInsightsDeprecated {
@@ -1182,10 +1207,13 @@ declare interface IChannelControls extends ITelemetryPlugin {
1182
1207
  teardown(): void;
1183
1208
  /**
1184
1209
  * Flush to send data immediately; channel should default to sending data asynchronously
1185
- * @param async: send data asynchronously when true
1186
- * @param callBack: if specified, notify caller when send is complete
1210
+ * @param async - send data asynchronously when true
1211
+ * @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.
1212
+ * If the caller doesn't return true the caller should assume that it may never be called.
1213
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
1214
+ * @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
1187
1215
  */
1188
- flush(async: boolean, callBack?: () => void): void;
1216
+ flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
1189
1217
  }
1190
1218
 
1191
1219
  declare interface IChannelControlsAI extends IChannelControls {
@@ -2413,6 +2441,73 @@ declare interface IInstrumentationRequirements extends IDependenciesPlugin {
2413
2441
  includeCorrelationHeaders: (ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any;
2414
2442
  }
2415
2443
 
2444
+ declare interface IInstrumentCallDetails {
2445
+ name: string;
2446
+ inst: any;
2447
+ /**
2448
+ * This returns an object that the hook function can use to store hook specific
2449
+ * context, it it not shared with any other hook instances and is unique for the
2450
+ * current call.
2451
+ * A hook implementation can use this to pass / share context between different
2452
+ * hook callbacks eg. request/response requst/hookErrors etc.
2453
+ */
2454
+ ctx: () => any;
2455
+ /**
2456
+ * Allows the hook functions to replace the original arguments
2457
+ * @param idx - The argument index (0 based)
2458
+ * @param value - The new value for the argument
2459
+ */
2460
+ set: (idx: number, value: any) => void;
2461
+ /**
2462
+ * The result of the original method, only populated after the original method has returned
2463
+ */
2464
+ rslt?: any;
2465
+ /**
2466
+ * The error (exception) which occurred while executing the original method
2467
+ */
2468
+ err?: Error;
2469
+ /**
2470
+ * The Event object from (window.event) at the start of the original call
2471
+ */
2472
+ evt?: Event;
2473
+ }
2474
+
2475
+ /**
2476
+ * The holder of the specific instance callback
2477
+ */
2478
+ declare interface IInstrumentHook {
2479
+ /** Unique Id for this callback on the hooked method */
2480
+ id: number;
2481
+ /** Holds the callbacks */
2482
+ cbks: IInstrumentHooksCallbacks;
2483
+ /** Remove this hook from the function */
2484
+ rm: () => void;
2485
+ }
2486
+
2487
+ /**
2488
+ * The callbacks to call for the instrumented function, you must provide at least the request and/or response callbacks, both are not required.
2489
+ * You must always supply the error callback
2490
+ */
2491
+ declare interface IInstrumentHooksCallbacks {
2492
+ /**
2493
+ * The hook callback to call before the original function is called
2494
+ */
2495
+ req?: InstrumentorHooksCallback;
2496
+ /**
2497
+ * The hook callback to call after the original function was called
2498
+ */
2499
+ rsp?: InstrumentorHooksCallback;
2500
+ /**
2501
+ * The callback to call if the hook function causes an exception
2502
+ */
2503
+ hkErr?: InstrumentorHooksCallback;
2504
+ /**
2505
+ * The callback to call if the original function causes an exception, even if you
2506
+ * supply a callback the original exception will still be thrown
2507
+ */
2508
+ fnErr?: InstrumentorHooksCallback;
2509
+ }
2510
+
2416
2511
  declare interface IInternal {
2417
2512
  /**
2418
2513
  * The SDK version used to create this telemetry item.
@@ -2437,6 +2532,10 @@ declare interface IInternal {
2437
2532
  sdkSrc: string;
2438
2533
  }
2439
2534
 
2535
+ declare interface ILoadedPlugin<T extends IPlugin> {
2536
+ plugin: T;
2537
+ }
2538
+
2440
2539
  declare interface ILocation {
2441
2540
  /**
2442
2541
  * Client IP address for reverse lookup
@@ -2562,6 +2661,12 @@ export declare interface INotificationManager {
2562
2661
  perfEvent?(perfEvent: IPerfEvent): void;
2563
2662
  }
2564
2663
 
2664
+ /**
2665
+ * A callback function that will be called for the wrapped instrumentation function
2666
+ * before the original function is executed.
2667
+ */
2668
+ declare type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
2669
+
2565
2670
  declare class _InternalLogMessage {
2566
2671
  static dataType: string;
2567
2672
  message: string;
@@ -2944,7 +3049,7 @@ export declare interface IProcessTelemetryContext {
2944
3049
  /**
2945
3050
  * Gets the named extension config
2946
3051
  */
2947
- getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
3052
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
2948
3053
  /**
2949
3054
  * Gets the named config from either the named identifier extension or core config if neither exist then the
2950
3055
  * default value is returned
@@ -2952,7 +3057,7 @@ export declare interface IProcessTelemetryContext {
2952
3057
  * @param field The config field name
2953
3058
  * @param defaultValue The default value to return if no defined config exists
2954
3059
  */
2955
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
3060
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
2956
3061
  /**
2957
3062
  * Helper to allow plugins to check and possibly shortcut executing code only
2958
3063
  * required if there is a nextPlugin
@@ -2971,6 +3076,12 @@ export declare interface IProcessTelemetryContext {
2971
3076
  * @param env - This is the current event being reported
2972
3077
  */
2973
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;
2974
3085
  /**
2975
3086
  * Create a new context using the core and config from the current instance
2976
3087
  * @param plugins - The execution order to process the plugins, if null or not supplied
@@ -2979,6 +3090,10 @@ export declare interface IProcessTelemetryContext {
2979
3090
  * order then the next plugin will be NOT set.
2980
3091
  */
2981
3092
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
3093
+ /**
3094
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
3095
+ */
3096
+ onComplete: (onComplete: () => void) => void;
2982
3097
  }
2983
3098
 
2984
3099
  declare interface IPropertiesPlugin {
@@ -3281,6 +3396,10 @@ declare interface ITelemetryContext_2 {
3281
3396
  addTelemetryInitializer(telemetryInitializer: (envelope: IEnvelope) => boolean | void): void;
3282
3397
  }
3283
3398
 
3399
+ declare interface ITelemetryInitializerHandler {
3400
+ remove(): void;
3401
+ }
3402
+
3284
3403
  /**
3285
3404
  * Telemety item supported in Core
3286
3405
  */
@@ -4455,6 +4574,8 @@ export declare const Telemetry: {
4455
4574
  DistributedTracingModes: typeof DistributedTracingModes;
4456
4575
  };
4457
4576
 
4577
+ declare type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
4578
+
4458
4579
  declare class TelemetryItemCreator {
4459
4580
  /**
4460
4581
  * Create a telemetry item that the 1DS channel understands
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Web, 2.7.4-nightly.2202-07
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2202-06
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.7.4-nightly.2202-07
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2202-06
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.7.4-nightly.2202-07
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2202-06
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.7.4-nightly.2202-07
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2202-06
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.7.4-nightly.2202-07
2
+ * Application Insights JavaScript SDK - Web, 2.8.0-beta.2202-06
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.7.4-nightly.2202-07",
3
+ "version": "2.8.0-beta.2202-06",
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,15 +66,15 @@
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.7.4-nightly.2202-07",
70
- "@microsoft/applicationinsights-channel-js": "2.7.4-nightly.2202-07",
71
- "@microsoft/applicationinsights-common": "2.7.4-nightly.2202-07",
72
- "@microsoft/applicationinsights-core-js": "2.7.4-nightly.2202-07",
73
- "@microsoft/applicationinsights-dependencies-js": "2.7.4-nightly.2202-07",
74
- "@microsoft/applicationinsights-properties-js": "2.7.4-nightly.2202-07"
69
+ "@microsoft/applicationinsights-analytics-js": "2.8.0-beta.2202-06",
70
+ "@microsoft/applicationinsights-channel-js": "2.8.0-beta.2202-06",
71
+ "@microsoft/applicationinsights-common": "2.8.0-beta.2202-06",
72
+ "@microsoft/applicationinsights-core-js": "2.8.0-beta.2202-06",
73
+ "@microsoft/applicationinsights-dependencies-js": "2.8.0-beta.2202-06",
74
+ "@microsoft/applicationinsights-properties-js": "2.8.0-beta.2202-06"
75
75
  },
76
76
  "license": "MIT",
77
77
  "publishConfig": {
78
- "tag": "nightly"
78
+ "tag": "beta"
79
79
  }
80
80
  }