@microsoft/applicationinsights-web-basic 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.
@@ -218,52 +218,6 @@
218
218
  "overloadIndex": 1,
219
219
  "parameters": []
220
220
  },
221
- {
222
- "kind": "Method",
223
- "canonicalReference": "@microsoft/applicationinsights-web-basic!AppInsightsCore#addNotificationListener:member(1)",
224
- "docComment": "/**\n * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised. The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be called.\n *\n * @param listener - An INotificationListener object.\n */\n",
225
- "excerptTokens": [
226
- {
227
- "kind": "Content",
228
- "text": "addNotificationListener(listener: "
229
- },
230
- {
231
- "kind": "Reference",
232
- "text": "INotificationListener",
233
- "canonicalReference": "@microsoft/applicationinsights-web-basic!INotificationListener:interface"
234
- },
235
- {
236
- "kind": "Content",
237
- "text": "): "
238
- },
239
- {
240
- "kind": "Content",
241
- "text": "void"
242
- },
243
- {
244
- "kind": "Content",
245
- "text": ";"
246
- }
247
- ],
248
- "isOptional": false,
249
- "isStatic": false,
250
- "returnTypeTokenRange": {
251
- "startIndex": 3,
252
- "endIndex": 4
253
- },
254
- "releaseTag": "Public",
255
- "overloadIndex": 1,
256
- "parameters": [
257
- {
258
- "parameterName": "listener",
259
- "parameterTypeTokenRange": {
260
- "startIndex": 1,
261
- "endIndex": 2
262
- }
263
- }
264
- ],
265
- "name": "addNotificationListener"
266
- },
267
221
  {
268
222
  "kind": "Method",
269
223
  "canonicalReference": "@microsoft/applicationinsights-web-basic!AppInsightsCore#initialize:member(1)",
@@ -362,126 +316,6 @@
362
316
  ],
363
317
  "name": "initialize"
364
318
  },
365
- {
366
- "kind": "Method",
367
- "canonicalReference": "@microsoft/applicationinsights-web-basic!AppInsightsCore#pollInternalLogs:member(1)",
368
- "docComment": "/**\n * Periodically check logger.queue for\n */\n",
369
- "excerptTokens": [
370
- {
371
- "kind": "Content",
372
- "text": "pollInternalLogs(eventName?: "
373
- },
374
- {
375
- "kind": "Content",
376
- "text": "string"
377
- },
378
- {
379
- "kind": "Content",
380
- "text": "): "
381
- },
382
- {
383
- "kind": "Content",
384
- "text": "number"
385
- },
386
- {
387
- "kind": "Content",
388
- "text": ";"
389
- }
390
- ],
391
- "isOptional": false,
392
- "isStatic": false,
393
- "returnTypeTokenRange": {
394
- "startIndex": 3,
395
- "endIndex": 4
396
- },
397
- "releaseTag": "Public",
398
- "overloadIndex": 1,
399
- "parameters": [
400
- {
401
- "parameterName": "eventName",
402
- "parameterTypeTokenRange": {
403
- "startIndex": 1,
404
- "endIndex": 2
405
- }
406
- }
407
- ],
408
- "name": "pollInternalLogs"
409
- },
410
- {
411
- "kind": "Method",
412
- "canonicalReference": "@microsoft/applicationinsights-web-basic!AppInsightsCore#removeNotificationListener:member(1)",
413
- "docComment": "/**\n * Removes all instances of the listener.\n *\n * @param listener - INotificationListener to remove.\n */\n",
414
- "excerptTokens": [
415
- {
416
- "kind": "Content",
417
- "text": "removeNotificationListener(listener: "
418
- },
419
- {
420
- "kind": "Reference",
421
- "text": "INotificationListener",
422
- "canonicalReference": "@microsoft/applicationinsights-web-basic!INotificationListener:interface"
423
- },
424
- {
425
- "kind": "Content",
426
- "text": "): "
427
- },
428
- {
429
- "kind": "Content",
430
- "text": "void"
431
- },
432
- {
433
- "kind": "Content",
434
- "text": ";"
435
- }
436
- ],
437
- "isOptional": false,
438
- "isStatic": false,
439
- "returnTypeTokenRange": {
440
- "startIndex": 3,
441
- "endIndex": 4
442
- },
443
- "releaseTag": "Public",
444
- "overloadIndex": 1,
445
- "parameters": [
446
- {
447
- "parameterName": "listener",
448
- "parameterTypeTokenRange": {
449
- "startIndex": 1,
450
- "endIndex": 2
451
- }
452
- }
453
- ],
454
- "name": "removeNotificationListener"
455
- },
456
- {
457
- "kind": "Method",
458
- "canonicalReference": "@microsoft/applicationinsights-web-basic!AppInsightsCore#stopPollingInternalLogs:member(1)",
459
- "docComment": "/**\n * Periodically check logger.queue for\n */\n",
460
- "excerptTokens": [
461
- {
462
- "kind": "Content",
463
- "text": "stopPollingInternalLogs(): "
464
- },
465
- {
466
- "kind": "Content",
467
- "text": "void"
468
- },
469
- {
470
- "kind": "Content",
471
- "text": ";"
472
- }
473
- ],
474
- "isOptional": false,
475
- "isStatic": false,
476
- "returnTypeTokenRange": {
477
- "startIndex": 1,
478
- "endIndex": 2
479
- },
480
- "releaseTag": "Public",
481
- "overloadIndex": 1,
482
- "parameters": [],
483
- "name": "stopPollingInternalLogs"
484
- },
485
319
  {
486
320
  "kind": "Method",
487
321
  "canonicalReference": "@microsoft/applicationinsights-web-basic!AppInsightsCore#track:member(1)",
@@ -871,6 +705,56 @@
871
705
  ],
872
706
  "name": "addNotificationListener"
873
707
  },
708
+ {
709
+ "kind": "MethodSignature",
710
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#addTelemetryInitializer:member(1)",
711
+ "docComment": "/**\n * Add a telemetry processor to decorate or drop telemetry events.\n *\n * @param telemetryInitializer - The Telemetry Initializer function\n *\n * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed\n */\n",
712
+ "excerptTokens": [
713
+ {
714
+ "kind": "Content",
715
+ "text": "addTelemetryInitializer(telemetryInitializer: "
716
+ },
717
+ {
718
+ "kind": "Reference",
719
+ "text": "TelemetryInitializerFunction",
720
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!TelemetryInitializerFunction:type"
721
+ },
722
+ {
723
+ "kind": "Content",
724
+ "text": "): "
725
+ },
726
+ {
727
+ "kind": "Reference",
728
+ "text": "ITelemetryInitializerHandler",
729
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!ITelemetryInitializerHandler:interface"
730
+ },
731
+ {
732
+ "kind": "Content",
733
+ "text": " | void"
734
+ },
735
+ {
736
+ "kind": "Content",
737
+ "text": ";"
738
+ }
739
+ ],
740
+ "isOptional": false,
741
+ "returnTypeTokenRange": {
742
+ "startIndex": 3,
743
+ "endIndex": 5
744
+ },
745
+ "releaseTag": "Public",
746
+ "overloadIndex": 1,
747
+ "parameters": [
748
+ {
749
+ "parameterName": "telemetryInitializer",
750
+ "parameterTypeTokenRange": {
751
+ "startIndex": 1,
752
+ "endIndex": 2
753
+ }
754
+ }
755
+ ],
756
+ "name": "addTelemetryInitializer"
757
+ },
874
758
  {
875
759
  "kind": "PropertySignature",
876
760
  "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#config:member",
@@ -956,6 +840,90 @@
956
840
  "parameters": [],
957
841
  "name": "getNotifyMgr"
958
842
  },
843
+ {
844
+ "kind": "MethodSignature",
845
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#getPlugin:member(1)",
846
+ "docComment": "/**\n * Find and return the (first) plugin with the specified identifier if present\n *\n * @param pluginIdentifier - \n */\n",
847
+ "excerptTokens": [
848
+ {
849
+ "kind": "Content",
850
+ "text": "getPlugin<T extends "
851
+ },
852
+ {
853
+ "kind": "Reference",
854
+ "text": "IPlugin",
855
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IPlugin:interface"
856
+ },
857
+ {
858
+ "kind": "Content",
859
+ "text": " "
860
+ },
861
+ {
862
+ "kind": "Content",
863
+ "text": "= "
864
+ },
865
+ {
866
+ "kind": "Reference",
867
+ "text": "IPlugin",
868
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!IPlugin:interface"
869
+ },
870
+ {
871
+ "kind": "Content",
872
+ "text": ">(pluginIdentifier: "
873
+ },
874
+ {
875
+ "kind": "Content",
876
+ "text": "string"
877
+ },
878
+ {
879
+ "kind": "Content",
880
+ "text": "): "
881
+ },
882
+ {
883
+ "kind": "Reference",
884
+ "text": "ILoadedPlugin",
885
+ "canonicalReference": "@microsoft/applicationinsights-web-basic!ILoadedPlugin:interface"
886
+ },
887
+ {
888
+ "kind": "Content",
889
+ "text": "<T>"
890
+ },
891
+ {
892
+ "kind": "Content",
893
+ "text": ";"
894
+ }
895
+ ],
896
+ "isOptional": false,
897
+ "returnTypeTokenRange": {
898
+ "startIndex": 8,
899
+ "endIndex": 10
900
+ },
901
+ "releaseTag": "Public",
902
+ "overloadIndex": 1,
903
+ "parameters": [
904
+ {
905
+ "parameterName": "pluginIdentifier",
906
+ "parameterTypeTokenRange": {
907
+ "startIndex": 6,
908
+ "endIndex": 7
909
+ }
910
+ }
911
+ ],
912
+ "typeParameters": [
913
+ {
914
+ "typeParameterName": "T",
915
+ "constraintTokenRange": {
916
+ "startIndex": 1,
917
+ "endIndex": 3
918
+ },
919
+ "defaultTypeTokenRange": {
920
+ "startIndex": 4,
921
+ "endIndex": 5
922
+ }
923
+ }
924
+ ],
925
+ "name": "getPlugin"
926
+ },
959
927
  {
960
928
  "kind": "MethodSignature",
961
929
  "canonicalReference": "@microsoft/applicationinsights-web-basic!IAppInsightsCore#getProcessTelContext:member(1)",
@@ -9,17 +9,12 @@
9
9
  // @public (undocumented)
10
10
  export class AppInsightsCore extends BaseCore implements IAppInsightsCore {
11
11
  constructor();
12
- // Warning: (ae-forgotten-export) The symbol "INotificationListener" needs to be exported by the entry point index.d.ts
13
- addNotificationListener(listener: INotificationListener): void;
14
12
  // Warning: (ae-forgotten-export) The symbol "IPlugin" needs to be exported by the entry point index.d.ts
15
13
  // Warning: (ae-forgotten-export) The symbol "IDiagnosticLogger" needs to be exported by the entry point index.d.ts
16
14
  // Warning: (ae-forgotten-export) The symbol "INotificationManager" needs to be exported by the entry point index.d.ts
17
15
  //
18
16
  // (undocumented)
19
17
  initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
20
- pollInternalLogs(eventName?: string): number;
21
- removeNotificationListener(listener: INotificationListener): void;
22
- stopPollingInternalLogs(): void;
23
18
  // (undocumented)
24
19
  track(telemetryItem: ITelemetryItem): void;
25
20
  }
@@ -47,12 +42,18 @@ export const CoreUtils: ICoreUtils;
47
42
  //
48
43
  // @public (undocumented)
49
44
  export interface IAppInsightsCore extends IPerfManagerProvider {
45
+ // Warning: (ae-forgotten-export) The symbol "INotificationListener" needs to be exported by the entry point index.d.ts
50
46
  addNotificationListener?(listener: INotificationListener): void;
47
+ // Warning: (ae-forgotten-export) The symbol "TelemetryInitializerFunction" needs to be exported by the entry point index.d.ts
48
+ // Warning: (ae-forgotten-export) The symbol "ITelemetryInitializerHandler" needs to be exported by the entry point index.d.ts
49
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
51
50
  // (undocumented)
52
51
  config: IConfiguration;
53
52
  // Warning: (ae-forgotten-export) The symbol "ICookieMgr" needs to be exported by the entry point index.d.ts
54
53
  getCookieMgr(): ICookieMgr;
55
54
  getNotifyMgr(): INotificationManager;
55
+ // Warning: (ae-forgotten-export) The symbol "ILoadedPlugin" needs to be exported by the entry point index.d.ts
56
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
56
57
  // Warning: (ae-forgotten-export) The symbol "IProcessTelemetryContext" needs to be exported by the entry point index.d.ts
57
58
  getProcessTelContext(): IProcessTelemetryContext;
58
59
  // Warning: (ae-forgotten-export) The symbol "IChannelControls" needs to be exported by the entry point index.d.ts
@@ -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
@@ -11,26 +11,6 @@ declare namespace ApplicationInsights {
11
11
  constructor();
12
12
  initialize(config: IConfiguration, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
13
13
  track(telemetryItem: ITelemetryItem): void;
14
- /**
15
- * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
16
- * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
17
- * called.
18
- * @param {INotificationListener} listener - An INotificationListener object.
19
- */
20
- addNotificationListener(listener: INotificationListener): void;
21
- /**
22
- * Removes all instances of the listener.
23
- * @param {INotificationListener} listener - INotificationListener to remove.
24
- */
25
- removeNotificationListener(listener: INotificationListener): void;
26
- /**
27
- * Periodically check logger.queue for
28
- */
29
- pollInternalLogs(eventName?: string): number;
30
- /**
31
- * Periodically check logger.queue for
32
- */
33
- stopPollingInternalLogs(): void;
34
14
  }
35
15
 
36
16
  /**
@@ -82,6 +62,18 @@ declare namespace ApplicationInsights {
82
62
  track(telemetryItem: ITelemetryItem): void;
83
63
  getProcessTelContext(): IProcessTelemetryContext;
84
64
  getNotifyMgr(): INotificationManager;
65
+ /**
66
+ * Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised.
67
+ * The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be
68
+ * called.
69
+ * @param {INotificationListener} listener - An INotificationListener object.
70
+ */
71
+ addNotificationListener(listener: INotificationListener): void;
72
+ /**
73
+ * Removes all instances of the listener.
74
+ * @param {INotificationListener} listener - INotificationListener to remove.
75
+ */
76
+ removeNotificationListener(listener: INotificationListener): void;
85
77
  /**
86
78
  * Get the current cookie manager for this instance
87
79
  */
@@ -94,6 +86,21 @@ declare namespace ApplicationInsights {
94
86
  getPerfMgr(): IPerfManager;
95
87
  setPerfMgr(perfMgr: IPerfManager): void;
96
88
  eventCnt(): number;
89
+ /**
90
+ * Periodically check logger.queue for
91
+ */
92
+ pollInternalLogs(eventName?: string): number;
93
+ /**
94
+ * Periodically check logger.queue for
95
+ */
96
+ stopPollingInternalLogs(): void;
97
+ /**
98
+ * Add a telemetry processor to decorate or drop telemetry events.
99
+ * @param telemetryInitializer - The Telemetry Initializer function
100
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
101
+ */
102
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
103
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
97
104
  protected releaseQueue(): void;
98
105
  }
99
106
 
@@ -103,6 +110,13 @@ declare namespace ApplicationInsights {
103
110
  * implementation so that new default implementations can be added without breaking all plugins.
104
111
  */
105
112
  abstract class BaseTelemetryPlugin implements ITelemetryPlugin {
113
+ identifier: string;
114
+ version?: string;
115
+ /**
116
+ * Holds the core instance that was used during initialization
117
+ */
118
+ core: IAppInsightsCore;
119
+ priority: number;
106
120
  /**
107
121
  * Call back for telemetry processing before it it is sent
108
122
  * @param env - This is the current event being reported
@@ -124,13 +138,6 @@ declare namespace ApplicationInsights {
124
138
  * Returns whether the plugin has been initialized
125
139
  */
126
140
  isInitialized: () => boolean;
127
- identifier: string;
128
- version?: string;
129
- /**
130
- * Holds the core instance that was used during initialization
131
- */
132
- core: IAppInsightsCore;
133
- priority: number;
134
141
  /**
135
142
  * Helper to return the current IProcessTelemetryContext, if the passed argument exists this just
136
143
  * returns that value (helps with minification for callers), otherwise it will return the configured
@@ -142,13 +149,14 @@ declare namespace ApplicationInsights {
142
149
  * Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing
143
150
  */
144
151
  protected setInitialized: (isInitialized: boolean) => void;
145
- /**
146
- * Internal helper to initialize the instance
147
- */
148
- private _baseTelInit;
149
152
  constructor();
150
153
  initialize(config: IConfiguration, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
151
154
  abstract processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
155
+ /**
156
+ * Add this hook so that it is automatically removed during unloading
157
+ * @param hooks - The single hook or an array of IInstrumentHook objects
158
+ */
159
+ protected _addHook(hooks: IInstrumentHook | IInstrumentHook[]): void;
152
160
  }
153
161
 
154
162
  /**
@@ -174,6 +182,12 @@ declare namespace ApplicationInsights {
174
182
  W3C = 2
175
183
  }
176
184
 
185
+ const enum GetExtCfgMergeType {
186
+ None = 0,
187
+ MergeDefaultOnly = 1,
188
+ MergeDefaultFromRootOrDefault = 2
189
+ }
190
+
177
191
  interface IAppInsightsCore extends IPerfManagerProvider {
178
192
  config: IConfiguration;
179
193
  logger: IDiagnosticLogger;
@@ -209,12 +223,23 @@ declare namespace ApplicationInsights {
209
223
  * @param {INotificationListener} listener - INotificationListener to remove.
210
224
  */
211
225
  removeNotificationListener?(listener: INotificationListener): void;
226
+ /**
227
+ * Add a telemetry processor to decorate or drop telemetry events.
228
+ * @param telemetryInitializer - The Telemetry Initializer function
229
+ * @returns - A ITelemetryInitializerHandler to enable the initializer to be removed
230
+ */
231
+ addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler | void;
212
232
  pollInternalLogs?(eventName?: string): number;
213
233
  stopPollingInternalLogs?(): void;
214
234
  /**
215
235
  * Return a new instance of the IProcessTelemetryContext for processing events
216
236
  */
217
237
  getProcessTelContext(): IProcessTelemetryContext;
238
+ /**
239
+ * Find and return the (first) plugin with the specified identifier if present
240
+ * @param pluginIdentifier
241
+ */
242
+ getPlugin<T extends IPlugin = IPlugin>(pluginIdentifier: string): ILoadedPlugin<T>;
218
243
  }
219
244
 
220
245
  /**
@@ -316,10 +341,13 @@ declare namespace ApplicationInsights {
316
341
  teardown(): void;
317
342
  /**
318
343
  * Flush to send data immediately; channel should default to sending data asynchronously
319
- * @param async: send data asynchronously when true
320
- * @param callBack: if specified, notify caller when send is complete
344
+ * @param async - send data asynchronously when true
345
+ * @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.
346
+ * If the caller doesn't return true the caller should assume that it may never be called.
347
+ * @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
348
+ * @returns - true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
321
349
  */
322
- flush(async: boolean, callBack?: () => void): void;
350
+ flush(async: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void;
323
351
  }
324
352
 
325
353
  interface IChannelControlsAI extends IChannelControls {
@@ -1154,6 +1182,77 @@ declare namespace ApplicationInsights {
1154
1182
  iKey?: string;
1155
1183
  }
1156
1184
 
1185
+ interface IInstrumentCallDetails {
1186
+ name: string;
1187
+ inst: any;
1188
+ /**
1189
+ * This returns an object that the hook function can use to store hook specific
1190
+ * context, it it not shared with any other hook instances and is unique for the
1191
+ * current call.
1192
+ * A hook implementation can use this to pass / share context between different
1193
+ * hook callbacks eg. request/response requst/hookErrors etc.
1194
+ */
1195
+ ctx: () => any;
1196
+ /**
1197
+ * Allows the hook functions to replace the original arguments
1198
+ * @param idx - The argument index (0 based)
1199
+ * @param value - The new value for the argument
1200
+ */
1201
+ set: (idx: number, value: any) => void;
1202
+ /**
1203
+ * The result of the original method, only populated after the original method has returned
1204
+ */
1205
+ rslt?: any;
1206
+ /**
1207
+ * The error (exception) which occurred while executing the original method
1208
+ */
1209
+ err?: Error;
1210
+ /**
1211
+ * The Event object from (window.event) at the start of the original call
1212
+ */
1213
+ evt?: Event;
1214
+ }
1215
+
1216
+ /**
1217
+ * The holder of the specific instance callback
1218
+ */
1219
+ interface IInstrumentHook {
1220
+ /** Unique Id for this callback on the hooked method */
1221
+ id: number;
1222
+ /** Holds the callbacks */
1223
+ cbks: IInstrumentHooksCallbacks;
1224
+ /** Remove this hook from the function */
1225
+ rm: () => void;
1226
+ }
1227
+
1228
+ /**
1229
+ * The callbacks to call for the instrumented function, you must provide at least the request and/or response callbacks, both are not required.
1230
+ * You must always supply the error callback
1231
+ */
1232
+ interface IInstrumentHooksCallbacks {
1233
+ /**
1234
+ * The hook callback to call before the original function is called
1235
+ */
1236
+ req?: InstrumentorHooksCallback;
1237
+ /**
1238
+ * The hook callback to call after the original function was called
1239
+ */
1240
+ rsp?: InstrumentorHooksCallback;
1241
+ /**
1242
+ * The callback to call if the hook function causes an exception
1243
+ */
1244
+ hkErr?: InstrumentorHooksCallback;
1245
+ /**
1246
+ * The callback to call if the original function causes an exception, even if you
1247
+ * supply a callback the original exception will still be thrown
1248
+ */
1249
+ fnErr?: InstrumentorHooksCallback;
1250
+ }
1251
+
1252
+ interface ILoadedPlugin<T extends IPlugin> {
1253
+ plugin: T;
1254
+ }
1255
+
1157
1256
  interface IMetricTelemetry extends IPartC {
1158
1257
  /**
1159
1258
  * @description (required) - name of this metric
@@ -1272,6 +1371,12 @@ declare namespace ApplicationInsights {
1272
1371
  perfEvent?(perfEvent: IPerfEvent): void;
1273
1372
  }
1274
1373
 
1374
+ /**
1375
+ * A callback function that will be called for the wrapped instrumentation function
1376
+ * before the original function is executed.
1377
+ */
1378
+ type InstrumentorHooksCallback = (funcArgs: IInstrumentCallDetails, ...orgArgs: any[]) => void;
1379
+
1275
1380
  class _InternalLogMessage {
1276
1381
  static dataType: string;
1277
1382
  message: string;
@@ -1616,7 +1721,7 @@ declare namespace ApplicationInsights {
1616
1721
  /**
1617
1722
  * Gets the named extension config
1618
1723
  */
1619
- getExtCfg: <T>(identifier: string, defaultValue?: T | any) => T;
1724
+ getExtCfg: <T>(identifier: string, defaultValue?: T | any, mergeDefault?: GetExtCfgMergeType) => T;
1620
1725
  /**
1621
1726
  * Gets the named config from either the named identifier extension or core config if neither exist then the
1622
1727
  * default value is returned
@@ -1624,7 +1729,7 @@ declare namespace ApplicationInsights {
1624
1729
  * @param field The config field name
1625
1730
  * @param defaultValue The default value to return if no defined config exists
1626
1731
  */
1627
- getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean) => number | string | boolean;
1732
+ getConfig: (identifier: string, field: string, defaultValue?: number | string | boolean | string[] | RegExp[] | Function) => number | string | boolean | string[] | RegExp[] | Function;
1628
1733
  /**
1629
1734
  * Helper to allow plugins to check and possibly shortcut executing code only
1630
1735
  * required if there is a nextPlugin
@@ -1643,6 +1748,12 @@ declare namespace ApplicationInsights {
1643
1748
  * @param env - This is the current event being reported
1644
1749
  */
1645
1750
  processNext: (env: ITelemetryItem) => void;
1751
+ /**
1752
+ * Synchronously iterate over the context chain running the callback for each plugin, once
1753
+ * every plugin has been executed via the callback, any associated onComplete will be called.
1754
+ * @param callback - The function call for each plugin in the context chain
1755
+ */
1756
+ iterate: <T extends ITelemetryPlugin = ITelemetryPlugin>(callback: (plugin: T) => void) => void;
1646
1757
  /**
1647
1758
  * Create a new context using the core and config from the current instance
1648
1759
  * @param plugins - The execution order to process the plugins, if null or not supplied
@@ -1651,6 +1762,10 @@ declare namespace ApplicationInsights {
1651
1762
  * order then the next plugin will be NOT set.
1652
1763
  */
1653
1764
  createNew: (plugins?: IPlugin[] | ITelemetryPluginChain, startAt?: IPlugin) => IProcessTelemetryContext;
1765
+ /**
1766
+ * Set the function to call when the current chain has executed all processNext or unloadNext items.
1767
+ */
1768
+ onComplete: (onComplete: () => void) => void;
1654
1769
  }
1655
1770
 
1656
1771
  interface IRequestContext {
@@ -1792,6 +1907,10 @@ declare namespace ApplicationInsights {
1792
1907
  obj: string[];
1793
1908
  }
1794
1909
 
1910
+ interface ITelemetryInitializerHandler {
1911
+ remove(): void;
1912
+ }
1913
+
1795
1914
  /**
1796
1915
  * Telemety item supported in Core
1797
1916
  */
@@ -2056,6 +2175,8 @@ declare namespace ApplicationInsights {
2056
2175
  [key: string]: any;
2057
2176
  }
2058
2177
 
2178
+ type TelemetryInitializerFunction = <T extends ITelemetryItem>(item: T) => boolean | void;
2179
+
2059
2180
  interface XDomainRequest extends XMLHttpRequestEventTarget {
2060
2181
  readonly responseText: string;
2061
2182
  send(payload: string): void;