@microsoft/applicationinsights-core-js 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.
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +860 -457
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +1193 -267
- package/dist/applicationinsights-core-js.api.md +54 -14
- package/dist/applicationinsights-core-js.d.ts +133 -45
- package/dist/applicationinsights-core-js.js +860 -457
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +133 -45
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +3 -69
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +237 -82
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +45 -19
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +155 -87
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/Constants.js +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +2 -27
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +6 -6
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +51 -11
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +3 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +34 -36
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +289 -119
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +29 -4
- package/dist-esm/JavaScriptSDK/RandomHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +2 -2
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +82 -0
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -2
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +6 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js.map +1 -0
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/applicationinsights-core-js.js +4 -4
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +2 -2
- package/src/JavaScriptSDK/AppInsightsCore.ts +2 -101
- package/src/JavaScriptSDK/BaseCore.ts +330 -100
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +69 -32
- package/src/JavaScriptSDK/ChannelController.ts +175 -103
- package/src/JavaScriptSDK/CoreUtils.ts +1 -28
- package/src/JavaScriptSDK/EnvUtils.ts +5 -5
- package/src/JavaScriptSDK/HelperFuncs.ts +57 -14
- package/src/JavaScriptSDK/InstrumentHooks.ts +3 -1
- package/src/JavaScriptSDK/NotificationManager.ts +32 -31
- package/src/JavaScriptSDK/PerfManager.ts +1 -1
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +350 -133
- package/src/JavaScriptSDK/RandomHelper.ts +34 -3
- package/src/JavaScriptSDK/TelemetryHelpers.ts +4 -6
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +119 -0
- package/src/JavaScriptSDK.Interfaces/IAppInsightsCore.ts +17 -1
- package/src/JavaScriptSDK.Interfaces/IChannelControls.ts +7 -3
- package/src/JavaScriptSDK.Interfaces/IInstrumentHooks.ts +5 -0
- package/src/JavaScriptSDK.Interfaces/IProcessTelemetryContext.ts +23 -5
- package/src/JavaScriptSDK.Interfaces/ITelemetryInitializers.ts +16 -0
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +1 -1
- package/types/JavaScriptSDK/AppInsightsCore.d.ts +0 -21
- package/types/JavaScriptSDK/BaseCore.d.ts +30 -1
- package/types/JavaScriptSDK/BaseTelemetryPlugin.d.ts +13 -11
- package/types/JavaScriptSDK/ChannelController.d.ts +12 -17
- package/types/JavaScriptSDK/CoreUtils.d.ts +0 -6
- package/types/JavaScriptSDK/HelperFuncs.d.ts +14 -5
- package/types/JavaScriptSDK/ProcessTelemetryContext.d.ts +49 -3
- package/types/JavaScriptSDK/RandomHelper.d.ts +6 -0
- package/types/JavaScriptSDK/TelemetryHelpers.d.ts +3 -3
- package/types/JavaScriptSDK/TelemetryInitializerPlugin.d.ts +23 -0
- package/types/JavaScriptSDK.Interfaces/IAppInsightsCore.d.ts +15 -0
- package/types/JavaScriptSDK.Interfaces/IChannelControls.d.ts +7 -3
- package/types/JavaScriptSDK.Interfaces/IInstrumentHooks.d.ts +4 -0
- package/types/JavaScriptSDK.Interfaces/IProcessTelemetryContext.d.ts +18 -3
- package/types/JavaScriptSDK.Interfaces/ITelemetryInitializers.d.ts +13 -0
- package/types/applicationinsights-core-js.d.ts +5 -4
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js +0 -76
- package/dist-esm/JavaScriptSDK/TelemetryPluginChain.js.map +0 -1
- package/src/JavaScriptSDK/TelemetryPluginChain.ts +0 -120
- package/types/JavaScriptSDK/TelemetryPluginChain.d.ts +0 -32
|
@@ -29,12 +29,8 @@ export function addPageUnloadEventListener(listener: any, excludeEvents?: string
|
|
|
29
29
|
// @public (undocumented)
|
|
30
30
|
export class AppInsightsCore extends BaseCore implements IAppInsightsCore {
|
|
31
31
|
constructor();
|
|
32
|
-
addNotificationListener(listener: INotificationListener): void;
|
|
33
32
|
// (undocumented)
|
|
34
33
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
35
|
-
pollInternalLogs(eventName?: string): number;
|
|
36
|
-
removeNotificationListener(listener: INotificationListener): void;
|
|
37
|
-
stopPollingInternalLogs(): void;
|
|
38
34
|
// (undocumented)
|
|
39
35
|
track(telemetryItem: ITelemetryItem): void;
|
|
40
36
|
}
|
|
@@ -43,7 +39,7 @@ export class AppInsightsCore extends BaseCore implements IAppInsightsCore {
|
|
|
43
39
|
export function areCookiesSupported(logger?: IDiagnosticLogger): any;
|
|
44
40
|
|
|
45
41
|
// @public
|
|
46
|
-
export function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
42
|
+
export function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
47
43
|
|
|
48
44
|
// @public
|
|
49
45
|
export function arrIndexOf<T>(arr: T[], searchElement: T, fromIndex?: number): number;
|
|
@@ -60,6 +56,8 @@ export function attachEvent(obj: any, eventNameWithoutOn: string, handlerRef: an
|
|
|
60
56
|
// @public (undocumented)
|
|
61
57
|
export class BaseCore implements IAppInsightsCore {
|
|
62
58
|
constructor();
|
|
59
|
+
addNotificationListener(listener: INotificationListener): void;
|
|
60
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
63
61
|
// (undocumented)
|
|
64
62
|
config: IConfiguration;
|
|
65
63
|
// (undocumented)
|
|
@@ -73,6 +71,10 @@ export class BaseCore implements IAppInsightsCore {
|
|
|
73
71
|
getNotifyMgr(): INotificationManager;
|
|
74
72
|
// (undocumented)
|
|
75
73
|
getPerfMgr(): IPerfManager;
|
|
74
|
+
// Warning: (ae-forgotten-export) The symbol "ILoadedPlugin" needs to be exported by the entry point applicationinsights-core-js.d.ts
|
|
75
|
+
//
|
|
76
|
+
// (undocumented)
|
|
77
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
76
78
|
// (undocumented)
|
|
77
79
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
78
80
|
// (undocumented)
|
|
@@ -83,11 +85,14 @@ export class BaseCore implements IAppInsightsCore {
|
|
|
83
85
|
isInitialized: () => boolean;
|
|
84
86
|
// (undocumented)
|
|
85
87
|
logger: IDiagnosticLogger;
|
|
88
|
+
pollInternalLogs(eventName?: string): number;
|
|
86
89
|
// (undocumented)
|
|
87
90
|
protected releaseQueue(): void;
|
|
91
|
+
removeNotificationListener(listener: INotificationListener): void;
|
|
88
92
|
setCookieMgr(cookieMgr: ICookieMgr): void;
|
|
89
93
|
// (undocumented)
|
|
90
94
|
setPerfMgr(perfMgr: IPerfManager): void;
|
|
95
|
+
stopPollingInternalLogs(): void;
|
|
91
96
|
// (undocumented)
|
|
92
97
|
track(telemetryItem: ITelemetryItem): void;
|
|
93
98
|
}
|
|
@@ -95,6 +100,7 @@ export class BaseCore implements IAppInsightsCore {
|
|
|
95
100
|
// @public
|
|
96
101
|
export abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
97
102
|
constructor();
|
|
103
|
+
protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
|
|
98
104
|
core: IAppInsightsCore;
|
|
99
105
|
diagLog: (itemCtx?: IProcessTelemetryContext) => IDiagnosticLogger;
|
|
100
106
|
protected _getTelCtx: (currentCtx?: IProcessTelemetryContext) => IProcessTelemetryContext;
|
|
@@ -126,6 +132,9 @@ export function createClassFromInterface<T>(defaults?: T): new () => T;
|
|
|
126
132
|
// @public (undocumented)
|
|
127
133
|
export function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
128
134
|
|
|
135
|
+
// @public
|
|
136
|
+
export function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
|
|
137
|
+
|
|
129
138
|
// @public
|
|
130
139
|
export function dateNow(): number;
|
|
131
140
|
|
|
@@ -198,6 +207,16 @@ export function getDocument(): Document | null;
|
|
|
198
207
|
// @public
|
|
199
208
|
export function getExceptionName(object: any): string;
|
|
200
209
|
|
|
210
|
+
// @public (undocumented)
|
|
211
|
+
export const enum GetExtCfgMergeType {
|
|
212
|
+
// (undocumented)
|
|
213
|
+
MergeDefaultFromRootOrDefault = 2,
|
|
214
|
+
// (undocumented)
|
|
215
|
+
MergeDefaultOnly = 1,
|
|
216
|
+
// (undocumented)
|
|
217
|
+
None = 0
|
|
218
|
+
}
|
|
219
|
+
|
|
201
220
|
// @public
|
|
202
221
|
export function getGblPerfMgr(): IPerfManager;
|
|
203
222
|
|
|
@@ -254,10 +273,12 @@ export function hasWindow(): boolean;
|
|
|
254
273
|
// @public (undocumented)
|
|
255
274
|
export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
256
275
|
addNotificationListener?(listener: INotificationListener): void;
|
|
276
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
257
277
|
// (undocumented)
|
|
258
278
|
config: IConfiguration;
|
|
259
279
|
getCookieMgr(): ICookieMgr;
|
|
260
280
|
getNotifyMgr(): INotificationManager;
|
|
281
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
261
282
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
262
283
|
// (undocumented)
|
|
263
284
|
getTransmissionControls(): IChannelControls[][];
|
|
@@ -278,7 +299,7 @@ export interface IAppInsightsCore extends IPerfManagerProvider {
|
|
|
278
299
|
|
|
279
300
|
// @public
|
|
280
301
|
export interface IChannelControls extends ITelemetryPlugin {
|
|
281
|
-
flush(async: boolean, callBack?: () => void): void;
|
|
302
|
+
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
282
303
|
pause(): void;
|
|
283
304
|
resume(): void;
|
|
284
305
|
teardown(): void;
|
|
@@ -430,6 +451,7 @@ export interface IEventHelper {
|
|
|
430
451
|
export interface IInstrumentCallDetails {
|
|
431
452
|
ctx: () => any;
|
|
432
453
|
err?: Error;
|
|
454
|
+
evt?: Event;
|
|
433
455
|
// (undocumented)
|
|
434
456
|
inst: any;
|
|
435
457
|
// (undocumented)
|
|
@@ -466,7 +488,7 @@ export interface IInstrumentHooksCallbacks {
|
|
|
466
488
|
}
|
|
467
489
|
|
|
468
490
|
// @public
|
|
469
|
-
export function initializePlugins(processContext:
|
|
491
|
+
export function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
|
|
470
492
|
|
|
471
493
|
// @public
|
|
472
494
|
export interface INotificationListener {
|
|
@@ -648,10 +670,12 @@ export interface IProcessTelemetryContext {
|
|
|
648
670
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
649
671
|
diagLog: () => IDiagnosticLogger;
|
|
650
672
|
getCfg: () => IConfiguration;
|
|
651
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
|
|
652
|
-
getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
|
|
673
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
674
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
653
675
|
getNext: () => ITelemetryPluginChain;
|
|
654
676
|
hasNext: () => boolean;
|
|
677
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
678
|
+
onComplete: (onComplete: () => void) => void;
|
|
655
679
|
processNext: (env: ITelemetryItem) => void;
|
|
656
680
|
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
657
681
|
}
|
|
@@ -722,6 +746,17 @@ export function isUndefined(value: any): boolean;
|
|
|
722
746
|
// @public
|
|
723
747
|
export function isXhrSupported(): boolean;
|
|
724
748
|
|
|
749
|
+
// @public (undocumented)
|
|
750
|
+
export interface ITelemetryInitializerContainer {
|
|
751
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// @public (undocumented)
|
|
755
|
+
export interface ITelemetryInitializerHandler {
|
|
756
|
+
// (undocumented)
|
|
757
|
+
remove(): void;
|
|
758
|
+
}
|
|
759
|
+
|
|
725
760
|
// @public
|
|
726
761
|
export interface ITelemetryItem {
|
|
727
762
|
baseData?: {
|
|
@@ -799,7 +834,7 @@ export { objCreate }
|
|
|
799
834
|
export function objDefineAccessors<T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void): boolean;
|
|
800
835
|
|
|
801
836
|
// @public
|
|
802
|
-
export function objForEachKey(target:
|
|
837
|
+
export function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
|
|
803
838
|
|
|
804
839
|
// @public (undocumented)
|
|
805
840
|
export const objFreeze: <T>(value: T) => T;
|
|
@@ -847,9 +882,9 @@ export class PerfManager implements IPerfManager {
|
|
|
847
882
|
// @public
|
|
848
883
|
export function perfNow(): number;
|
|
849
884
|
|
|
850
|
-
// @public
|
|
885
|
+
// @public @deprecated
|
|
851
886
|
export class ProcessTelemetryContext implements IProcessTelemetryContext {
|
|
852
|
-
constructor(
|
|
887
|
+
constructor(pluginChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
|
|
853
888
|
core: () => IAppInsightsCore;
|
|
854
889
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
855
890
|
diagLog: () => IDiagnosticLogger;
|
|
@@ -860,12 +895,14 @@ export class ProcessTelemetryContext implements IProcessTelemetryContext {
|
|
|
860
895
|
getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
|
|
861
896
|
getNext: () => ITelemetryPluginChain;
|
|
862
897
|
hasNext: () => boolean;
|
|
898
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
899
|
+
onComplete: (onComplete: () => void) => void;
|
|
863
900
|
processNext: (env: ITelemetryItem) => void;
|
|
864
901
|
setNext: (nextCtx: ITelemetryPluginChain) => void;
|
|
865
902
|
}
|
|
866
903
|
|
|
867
904
|
// @public
|
|
868
|
-
export function proxyAssign(target:
|
|
905
|
+
export function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
869
906
|
|
|
870
907
|
// @public
|
|
871
908
|
export function random32(signed?: boolean): number;
|
|
@@ -905,7 +942,7 @@ export function setGblPerfMgr(perfManager: IPerfManager): void;
|
|
|
905
942
|
export function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
|
|
906
943
|
|
|
907
944
|
// @public (undocumented)
|
|
908
|
-
export function sortPlugins(plugins:
|
|
945
|
+
export function sortPlugins<T = IPlugin>(plugins: T[]): T[];
|
|
909
946
|
|
|
910
947
|
// @public
|
|
911
948
|
export function strContains(value: string, search: string): boolean;
|
|
@@ -939,6 +976,9 @@ export interface Tags {
|
|
|
939
976
|
[key: string]: any;
|
|
940
977
|
}
|
|
941
978
|
|
|
979
|
+
// @public (undocumented)
|
|
980
|
+
export type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
981
|
+
|
|
942
982
|
// @public (undocumented)
|
|
943
983
|
export function throwError(message: string): never;
|
|
944
984
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights Core Javascript SDK, 2.
|
|
2
|
+
* Microsoft Application Insights Core Javascript SDK, 2.8.0-beta.2202-06
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -64,26 +64,6 @@ declare namespace ApplicationInsights {
|
|
|
64
64
|
constructor();
|
|
65
65
|
initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
|
|
66
66
|
track(telemetryItem: ITelemetryItem): void;
|
|
67
|
-
/**
|
|
68
|
-
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
69
|
-
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
70
|
-
* called.
|
|
71
|
-
* @param {INotificationListener} listener - An INotificationListener object.
|
|
72
|
-
*/
|
|
73
|
-
addNotificationListener(listener: INotificationListener): void;
|
|
74
|
-
/**
|
|
75
|
-
* Removes all instances of the listener.
|
|
76
|
-
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
77
|
-
*/
|
|
78
|
-
removeNotificationListener(listener: INotificationListener): void;
|
|
79
|
-
/**
|
|
80
|
-
* Periodically check logger.queue for
|
|
81
|
-
*/
|
|
82
|
-
pollInternalLogs(eventName?: string): number;
|
|
83
|
-
/**
|
|
84
|
-
* Periodically check logger.queue for
|
|
85
|
-
*/
|
|
86
|
-
stopPollingInternalLogs(): void;
|
|
87
67
|
}
|
|
88
68
|
|
|
89
69
|
function areCookiesSupported(logger?: IDiagnosticLogger): any;
|
|
@@ -96,7 +76,7 @@ declare namespace ApplicationInsights {
|
|
|
96
76
|
* @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
|
|
97
77
|
* @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.
|
|
98
78
|
*/
|
|
99
|
-
function arrForEach<T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
79
|
+
function arrForEach<T = any>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void | number, thisArg?: any): void;
|
|
100
80
|
|
|
101
81
|
/**
|
|
102
82
|
* Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
@@ -150,6 +130,18 @@ declare namespace ApplicationInsights {
|
|
|
150
130
|
track(telemetryItem: ITelemetryItem): void;
|
|
151
131
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
152
132
|
getNotifyMgr(): INotificationManager;
|
|
133
|
+
/**
|
|
134
|
+
* Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
|
|
135
|
+
* The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
|
|
136
|
+
* called.
|
|
137
|
+
* @param {INotificationListener} listener - An INotificationListener object.
|
|
138
|
+
*/
|
|
139
|
+
addNotificationListener(listener: INotificationListener): void;
|
|
140
|
+
/**
|
|
141
|
+
* Removes all instances of the listener.
|
|
142
|
+
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
143
|
+
*/
|
|
144
|
+
removeNotificationListener(listener: INotificationListener): void;
|
|
153
145
|
/**
|
|
154
146
|
* Get the current cookie manager for this instance
|
|
155
147
|
*/
|
|
@@ -162,6 +154,21 @@ declare namespace ApplicationInsights {
|
|
|
162
154
|
getPerfMgr(): IPerfManager;
|
|
163
155
|
setPerfMgr(perfMgr: IPerfManager): void;
|
|
164
156
|
eventCnt(): number;
|
|
157
|
+
/**
|
|
158
|
+
* Periodically check logger.queue for
|
|
159
|
+
*/
|
|
160
|
+
pollInternalLogs(eventName?: string): number;
|
|
161
|
+
/**
|
|
162
|
+
* Periodically check logger.queue for
|
|
163
|
+
*/
|
|
164
|
+
stopPollingInternalLogs(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
167
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
168
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
169
|
+
*/
|
|
170
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
171
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
165
172
|
protected releaseQueue(): void;
|
|
166
173
|
}
|
|
167
174
|
|
|
@@ -171,6 +178,13 @@ declare namespace ApplicationInsights {
|
|
|
171
178
|
* implementation so that new default implementations can be added without breaking all plugins.
|
|
172
179
|
*/
|
|
173
180
|
abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
|
|
181
|
+
identifier: string;
|
|
182
|
+
version?: string;
|
|
183
|
+
/**
|
|
184
|
+
* Holds the core instance that was used during initialization
|
|
185
|
+
*/
|
|
186
|
+
core: IAppInsightsCore;
|
|
187
|
+
priority: number;
|
|
174
188
|
/**
|
|
175
189
|
* Call back for telemetry processing before it it is sent
|
|
176
190
|
* @param env - This is the current event being reported
|
|
@@ -192,13 +206,6 @@ declare namespace ApplicationInsights {
|
|
|
192
206
|
* Returns whether the plugin has been initialized
|
|
193
207
|
*/
|
|
194
208
|
isInitialized: () => boolean;
|
|
195
|
-
identifier: string;
|
|
196
|
-
version?: string;
|
|
197
|
-
/**
|
|
198
|
-
* Holds the core instance that was used during initialization
|
|
199
|
-
*/
|
|
200
|
-
core: IAppInsightsCore;
|
|
201
|
-
priority: number;
|
|
202
209
|
/**
|
|
203
210
|
* Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
|
|
204
211
|
* returns that value (helps with minification for callers), otherwise it will return the configured
|
|
@@ -210,13 +217,14 @@ declare namespace ApplicationInsights {
|
|
|
210
217
|
* Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
|
|
211
218
|
*/
|
|
212
219
|
protected setInitialized: (isInitialized: boolean) => void;
|
|
213
|
-
/**
|
|
214
|
-
* Internal helper to initialize the instance
|
|
215
|
-
*/
|
|
216
|
-
private _baseTelInit;
|
|
217
220
|
constructor();
|
|
218
221
|
initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
219
222
|
abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
223
|
+
/**
|
|
224
|
+
* Add this hook so that it is automatically removed during unloading
|
|
225
|
+
* @param hooks - The single hook or an array of IInstrumentHook objects
|
|
226
|
+
*/
|
|
227
|
+
protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
|
|
220
228
|
}
|
|
221
229
|
|
|
222
230
|
/**
|
|
@@ -242,6 +250,14 @@ declare namespace ApplicationInsights {
|
|
|
242
250
|
|
|
243
251
|
function createCookieMgr(rootConfig?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr;
|
|
244
252
|
|
|
253
|
+
/**
|
|
254
|
+
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
255
|
+
* @param plugins - The plugin instances that will be executed
|
|
256
|
+
* @param config - The current config
|
|
257
|
+
* @param core - The current core instance
|
|
258
|
+
*/
|
|
259
|
+
function createProcessTelemetryContext(telemetryChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin): IProcessTelemetryContext;
|
|
260
|
+
|
|
245
261
|
/**
|
|
246
262
|
* 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)
|
|
247
263
|
* https://caniuse.com/#search=Date.now
|
|
@@ -411,6 +427,12 @@ declare namespace ApplicationInsights {
|
|
|
411
427
|
*/
|
|
412
428
|
function getExceptionName(object: any): string;
|
|
413
429
|
|
|
430
|
+
const enum GetExtCfgMergeType {
|
|
431
|
+
None = 0,
|
|
432
|
+
MergeDefaultOnly = 1,
|
|
433
|
+
MergeDefaultFromRootOrDefault = 2
|
|
434
|
+
}
|
|
435
|
+
|
|
414
436
|
/**
|
|
415
437
|
* Get the current global performance manager that will be used with no performance manager is supplied.
|
|
416
438
|
* @returns - The current default manager
|
|
@@ -569,12 +591,23 @@ declare namespace ApplicationInsights {
|
|
|
569
591
|
* @param {INotificationListener} listener - INotificationListener to remove.
|
|
570
592
|
*/
|
|
571
593
|
removeNotificationListener?(listener: INotificationListener): void;
|
|
594
|
+
/**
|
|
595
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
596
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
597
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
598
|
+
*/
|
|
599
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
572
600
|
pollInternalLogs?(eventName?: string): number;
|
|
573
601
|
stopPollingInternalLogs?(): void;
|
|
574
602
|
/**
|
|
575
603
|
* Return a new instance of the IProcessTelemetryContext for processing events
|
|
576
604
|
*/
|
|
577
605
|
getProcessTelContext(): IProcessTelemetryContext;
|
|
606
|
+
/**
|
|
607
|
+
* Find and return the (first) plugin with the specified identifier if present
|
|
608
|
+
* @param pluginIdentifier
|
|
609
|
+
*/
|
|
610
|
+
getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
|
|
578
611
|
}
|
|
579
612
|
|
|
580
613
|
/**
|
|
@@ -595,10 +628,13 @@ declare namespace ApplicationInsights {
|
|
|
595
628
|
teardown(): void;
|
|
596
629
|
/**
|
|
597
630
|
* Flush to send data immediately; channel should default to sending data asynchronously
|
|
598
|
-
* @param async
|
|
599
|
-
* @param callBack
|
|
631
|
+
* @param async - send data asynchronously when true
|
|
632
|
+
* @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.
|
|
633
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
634
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
635
|
+
* @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
|
|
600
636
|
*/
|
|
601
|
-
flush(async: boolean, callBack?: () => void): void;
|
|
637
|
+
flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
|
|
602
638
|
}
|
|
603
639
|
|
|
604
640
|
/**
|
|
@@ -1143,6 +1179,10 @@ declare namespace ApplicationInsights {
|
|
|
1143
1179
|
* The error (exception) which occurred while executing the original method
|
|
1144
1180
|
*/
|
|
1145
1181
|
err?: Error;
|
|
1182
|
+
/**
|
|
1183
|
+
* The Event object from (window.event) at the start of the original call
|
|
1184
|
+
*/
|
|
1185
|
+
evt?: Event;
|
|
1146
1186
|
}
|
|
1147
1187
|
|
|
1148
1188
|
/**
|
|
@@ -1188,6 +1228,10 @@ declare namespace ApplicationInsights {
|
|
|
1188
1228
|
fnErr?: InstrumentorHooksCallback;
|
|
1189
1229
|
}
|
|
1190
1230
|
|
|
1231
|
+
interface ILoadedPlugin<T extends IPlugin> {
|
|
1232
|
+
plugin: T;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1191
1235
|
/**
|
|
1192
1236
|
* Initialize the queue of plugins
|
|
1193
1237
|
* @param plugins - The array of plugins to initialize and setting of the next plugin
|
|
@@ -1195,7 +1239,7 @@ declare namespace ApplicationInsights {
|
|
|
1195
1239
|
* @param core THe current core instance
|
|
1196
1240
|
* @param extensions The extensions
|
|
1197
1241
|
*/
|
|
1198
|
-
function initializePlugins(processContext:
|
|
1242
|
+
function initializePlugins(processContext: IProcessTelemetryContext, extensions: IPlugin[]): void;
|
|
1199
1243
|
|
|
1200
1244
|
/**
|
|
1201
1245
|
* An interface used for the notification listener.
|
|
@@ -1559,7 +1603,7 @@ declare namespace ApplicationInsights {
|
|
|
1559
1603
|
/**
|
|
1560
1604
|
* Gets the named extension config
|
|
1561
1605
|
*/
|
|
1562
|
-
getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
|
|
1606
|
+
getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
|
|
1563
1607
|
/**
|
|
1564
1608
|
* Gets the named config from either the named identifier extension or core config if neither exist then the
|
|
1565
1609
|
* default value is returned
|
|
@@ -1567,7 +1611,7 @@ declare namespace ApplicationInsights {
|
|
|
1567
1611
|
* @param field The config field name
|
|
1568
1612
|
* @param defaultValue The default value to return if no defined config exists
|
|
1569
1613
|
*/
|
|
1570
|
-
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
|
|
1614
|
+
getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
|
|
1571
1615
|
/**
|
|
1572
1616
|
* Helper to allow plugins to check and possibly shortcut executing code only
|
|
1573
1617
|
* required if there is a nextPlugin
|
|
@@ -1586,6 +1630,12 @@ declare namespace ApplicationInsights {
|
|
|
1586
1630
|
* @param env - This is the current event being reported
|
|
1587
1631
|
*/
|
|
1588
1632
|
processNext: (env: ITelemetryItem) => void;
|
|
1633
|
+
/**
|
|
1634
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
1635
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
1636
|
+
* @param callback - The function call for each plugin in the context chain
|
|
1637
|
+
*/
|
|
1638
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
1589
1639
|
/**
|
|
1590
1640
|
* Create a new context using the core and config from the current instance
|
|
1591
1641
|
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
@@ -1594,10 +1644,15 @@ declare namespace ApplicationInsights {
|
|
|
1594
1644
|
* order then the next plugin will be NOT set.
|
|
1595
1645
|
*/
|
|
1596
1646
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
1647
|
+
/**
|
|
1648
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
1649
|
+
*/
|
|
1650
|
+
onComplete: (onComplete: () => void) => void;
|
|
1597
1651
|
}
|
|
1598
1652
|
|
|
1599
1653
|
/**
|
|
1600
|
-
* Check if an object is of type Array
|
|
1654
|
+
* Check if an object is of type Array with optional generic T, the generic type is not validated
|
|
1655
|
+
* and exists to help with TypeScript validation only.
|
|
1601
1656
|
*/
|
|
1602
1657
|
let isArray: <T = any>(obj: any) => obj is Array<T>;
|
|
1603
1658
|
|
|
@@ -1689,6 +1744,19 @@ declare namespace ApplicationInsights {
|
|
|
1689
1744
|
*/
|
|
1690
1745
|
function isXhrSupported(): boolean;
|
|
1691
1746
|
|
|
1747
|
+
interface ITelemetryInitializerContainer {
|
|
1748
|
+
/**
|
|
1749
|
+
* Add a telemetry processor to decorate or drop telemetry events.
|
|
1750
|
+
* @param telemetryInitializer - The Telemetry Initializer function
|
|
1751
|
+
* @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
|
|
1752
|
+
*/
|
|
1753
|
+
addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
interface ITelemetryInitializerHandler {
|
|
1757
|
+
remove(): void;
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1692
1760
|
/**
|
|
1693
1761
|
* Telemety item supported in Core
|
|
1694
1762
|
*/
|
|
@@ -1900,7 +1968,7 @@ declare namespace ApplicationInsights {
|
|
|
1900
1968
|
* @param target The target object to find and process the keys
|
|
1901
1969
|
* @param callbackfn The function to call with the details
|
|
1902
1970
|
*/
|
|
1903
|
-
function objForEachKey(target:
|
|
1971
|
+
function objForEachKey<T = any>(target: T, callbackfn: (name: string, value: T[keyof T]) => void): void;
|
|
1904
1972
|
|
|
1905
1973
|
const objFreeze: <T>(value: T) => T;
|
|
1906
1974
|
|
|
@@ -2002,6 +2070,10 @@ declare namespace ApplicationInsights {
|
|
|
2002
2070
|
*/
|
|
2003
2071
|
function perfNow(): number;
|
|
2004
2072
|
|
|
2073
|
+
/**
|
|
2074
|
+
* This class will be removed!
|
|
2075
|
+
* @deprecated use createProcessTelemetryContext() instead
|
|
2076
|
+
*/
|
|
2005
2077
|
class ProcessTelemetryContext implements IProcessTelemetryContext {
|
|
2006
2078
|
/**
|
|
2007
2079
|
* Gets the current core config instance
|
|
@@ -2039,16 +2111,31 @@ declare namespace ApplicationInsights {
|
|
|
2039
2111
|
*/
|
|
2040
2112
|
processNext: (env: ITelemetryItem) => void;
|
|
2041
2113
|
/**
|
|
2114
|
+
* Synchronously iterate over the context chain running the callback for each plugin, once
|
|
2115
|
+
* every plugin has been executed via the callback, any associated onComplete will be called.
|
|
2116
|
+
* @param callback - The function call for each plugin in the context chain
|
|
2117
|
+
*/
|
|
2118
|
+
iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
|
|
2119
|
+
/**
|
|
2120
|
+
/**
|
|
2042
2121
|
* Create a new context using the core and config from the current instance
|
|
2122
|
+
* @param plugins - The execution order to process the plugins, if null or not supplied
|
|
2123
|
+
* then the current execution order will be copied.
|
|
2124
|
+
* @param startAt - The plugin to start processing from, if missing from the execution
|
|
2125
|
+
* order then the next plugin will be NOT set.
|
|
2043
2126
|
*/
|
|
2044
2127
|
createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
|
|
2128
|
+
/**
|
|
2129
|
+
* Set the function to call when the current chain has executed all processNext or unloadNext items.
|
|
2130
|
+
*/
|
|
2131
|
+
onComplete: (onComplete: () => void) => void;
|
|
2045
2132
|
/**
|
|
2046
2133
|
* Creates a new Telemetry Item context with the current config, core and plugin execution chain
|
|
2047
2134
|
* @param plugins - The plugin instances that will be executed
|
|
2048
2135
|
* @param config - The current config
|
|
2049
2136
|
* @param core - The current core instance
|
|
2050
2137
|
*/
|
|
2051
|
-
constructor(
|
|
2138
|
+
constructor(pluginChain: ITelemetryPluginChain, config: IConfiguration, core: IAppInsightsCore, startAt?: IPlugin);
|
|
2052
2139
|
}
|
|
2053
2140
|
|
|
2054
2141
|
/**
|
|
@@ -2065,9 +2152,8 @@ declare namespace ApplicationInsights {
|
|
|
2065
2152
|
* @param target - The target object to be assigned with the source properties and functions
|
|
2066
2153
|
* @param source - The source object which will be assigned / called by setting / calling the targets proxies
|
|
2067
2154
|
* @param chkSet - An optional callback to determine whether a specific property/function should be proxied
|
|
2068
|
-
* @memberof Initialization
|
|
2069
2155
|
*/
|
|
2070
|
-
function proxyAssign(target:
|
|
2156
|
+
function proxyAssign<T, S>(target: T, source: S, chkSet?: (name: string, isFunc?: boolean, source?: S, target?: T) => boolean): T;
|
|
2071
2157
|
|
|
2072
2158
|
/**
|
|
2073
2159
|
* generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
|
|
@@ -2165,7 +2251,7 @@ declare namespace ApplicationInsights {
|
|
|
2165
2251
|
*/
|
|
2166
2252
|
function setValue<T, K extends keyof T>(target: T, field: K, value: T[K], valChk?: (value: T[K]) => boolean, srcChk?: (value: T[K]) => boolean): T[K];
|
|
2167
2253
|
|
|
2168
|
-
function sortPlugins(plugins:
|
|
2254
|
+
function sortPlugins<T = IPlugin>(plugins: T[]): T[];
|
|
2169
2255
|
|
|
2170
2256
|
/**
|
|
2171
2257
|
* A simple wrapper (for minification support) to check if the value contains the search string.
|
|
@@ -2211,6 +2297,8 @@ declare namespace ApplicationInsights {
|
|
|
2211
2297
|
[key: string]: any;
|
|
2212
2298
|
}
|
|
2213
2299
|
|
|
2300
|
+
type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
|
|
2301
|
+
|
|
2214
2302
|
function throwError(message: string): never;
|
|
2215
2303
|
|
|
2216
2304
|
/**
|