@microsoft/applicationinsights-dependencies-js 3.4.0-nightlybeta3.2505-36 → 3.4.0-nightlybeta3.2507-22

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 (34) hide show
  1. package/browser/es5/applicationinsights-dependencies-js.cjs.js +870 -322
  2. package/browser/es5/applicationinsights-dependencies-js.cjs.js.map +1 -1
  3. package/browser/es5/applicationinsights-dependencies-js.cjs.min.js +2 -2
  4. package/browser/es5/applicationinsights-dependencies-js.cjs.min.js.map +1 -1
  5. package/browser/es5/applicationinsights-dependencies-js.gbl.js +872 -324
  6. package/browser/es5/applicationinsights-dependencies-js.gbl.js.map +1 -1
  7. package/browser/es5/applicationinsights-dependencies-js.gbl.min.js +2 -2
  8. package/browser/es5/applicationinsights-dependencies-js.gbl.min.js.map +1 -1
  9. package/browser/es5/applicationinsights-dependencies-js.integrity.json +25 -25
  10. package/browser/es5/applicationinsights-dependencies-js.js +872 -324
  11. package/browser/es5/applicationinsights-dependencies-js.js.map +1 -1
  12. package/browser/es5/applicationinsights-dependencies-js.min.js +2 -2
  13. package/browser/es5/applicationinsights-dependencies-js.min.js.map +1 -1
  14. package/dist/es5/applicationinsights-dependencies-js.js +870 -322
  15. package/dist/es5/applicationinsights-dependencies-js.js.map +1 -1
  16. package/dist/es5/applicationinsights-dependencies-js.min.js +2 -2
  17. package/dist/es5/applicationinsights-dependencies-js.min.js.map +1 -1
  18. package/dist-es5/DependencyInitializer.js +1 -1
  19. package/dist-es5/DependencyListener.js +1 -1
  20. package/dist-es5/InternalConstants.js +2 -1
  21. package/dist-es5/InternalConstants.js.map +1 -1
  22. package/dist-es5/__DynamicConstants.js +15 -19
  23. package/dist-es5/__DynamicConstants.js.map +1 -1
  24. package/dist-es5/ajax.js +130 -62
  25. package/dist-es5/ajax.js.map +1 -1
  26. package/dist-es5/ajaxRecord.js +137 -148
  27. package/dist-es5/ajaxRecord.js.map +1 -1
  28. package/dist-es5/applicationinsights-dependencies-js.js +1 -2
  29. package/dist-es5/applicationinsights-dependencies-js.js.map +1 -1
  30. package/package.json +3 -3
  31. package/types/applicationinsights-dependencies-js.d.ts +150 -50
  32. package/types/applicationinsights-dependencies-js.namespaced.d.ts +628 -88
  33. package/dist-es5/ajaxUtils.js +0 -30
  34. package/dist-es5/ajaxUtils.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights XHR dependencies plugin, 3.4.0-nightlybeta3.2505-36
2
+ * Microsoft Application Insights XHR dependencies plugin, 3.4.0-nightlybeta3.2507-22
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -16,13 +16,14 @@ import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
16
16
  import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
17
17
  import { IConfig } from '@microsoft/applicationinsights-common';
18
18
  import { IConfiguration } from '@microsoft/applicationinsights-core-js';
19
+ import { ICorrelationConfig } from '@microsoft/applicationinsights-common';
19
20
  import { IDependencyTelemetry } from '@microsoft/applicationinsights-common';
20
- import { IDiagnosticLogger } from '@microsoft/applicationinsights-core-js';
21
21
  import { IDistributedTraceContext } from '@microsoft/applicationinsights-core-js';
22
22
  import { IPlugin } from '@microsoft/applicationinsights-core-js';
23
23
  import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
24
24
  import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
25
25
  import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
26
+ import { IW3cTraceState } from '@microsoft/applicationinsights-core-js';
26
27
 
27
28
  export declare class AjaxPlugin extends BaseTelemetryPlugin implements IDependenciesPlugin, IInstrumentationRequirements, IDependencyListenerContainer {
28
29
  static identifier: string;
@@ -38,7 +39,7 @@ export declare class AjaxPlugin extends BaseTelemetryPlugin implements IDependen
38
39
  trackDependencyData(dependency: IDependencyTelemetry, properties?: {
39
40
  [key: string]: any;
40
41
  }): void;
41
- includeCorrelationHeaders(ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented): any;
42
+ includeCorrelationHeaders(ajaxData: IAjaxRecordData, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented): any;
42
43
  /**
43
44
  * Add an ajax listener which is called just prior to the request being sent and before the correlation headers are added, to allow you
44
45
  * to access the headers and modify the values used to generate the distributed tracing correlation headers.
@@ -68,77 +69,172 @@ export declare class AjaxPlugin extends BaseTelemetryPlugin implements IDependen
68
69
  }): void;
69
70
  }
70
71
 
71
- export declare class ajaxRecord {
72
+ /**
73
+ * The initializer function that will be called, if it returns false the event will be dropped and not reported
74
+ * or counted against the `maxAjaxCallsPerView`.
75
+ */
76
+ export declare type DependencyInitializerFunction = (item: IDependencyInitializerDetails) => boolean | void;
77
+
78
+ /**
79
+ * The function that will get called when the ajax request is about to occur.
80
+ */
81
+ export declare type DependencyListenerFunction = (dependencyDetails: IDependencyListenerDetails) => boolean | void;
82
+
83
+ export declare const DfltAjaxCorrelationHeaderExDomains: string[];
84
+
85
+ declare const _DYN_INCLUDE_CORRELATION_0 = "includeCorrelationHeaders";
86
+
87
+ /**
88
+ * Interface for ajax data passed to includeCorrelationHeaders function.
89
+ * Contains the public properties and methods needed for correlation header processing.
90
+ *
91
+ * @public
92
+ */
93
+ export declare interface IAjaxRecordData {
94
+ /**
95
+ * Gets the absolute URL for the request
96
+ * @returns The absolute URL string or null
97
+ */
98
+ getAbsoluteUrl(): string | null;
99
+ /**
100
+ * Gets the sanitized path name for the request URL
101
+ * @returns The sanitized path name string or null
102
+ */
103
+ getPathName(): string | null;
104
+ /**
105
+ * The distributed trace context for the request containing trace ID, span ID, and trace flags
106
+ */
107
+ readonly traceCtx: IDistributedTraceContext;
108
+ /**
109
+ * Object containing request headers that have been set for this request
110
+ */
111
+ requestHeaders: {
112
+ [key: string]: string;
113
+ };
114
+ /**
115
+ * Indicates whether the request was aborted (0 = not aborted, 1 = aborted)
116
+ */
117
+ aborted: number;
118
+ /**
119
+ * Optional context object that can be set by dependency listeners
120
+ */
121
+ context?: {
122
+ [key: string]: any;
123
+ };
124
+ }
125
+
126
+ /**
127
+ * Internal interface that extends the public IAjaxRecordData with additional properties and methods
128
+ * used internally by the AJAX monitoring implementation.
129
+ *
130
+ * @internal
131
+ */
132
+ declare interface IAjaxRecordInternal extends IAjaxRecordData {
133
+ /**
134
+ * Indicates if the ajax call has completed
135
+ */
72
136
  completed: boolean;
137
+ /**
138
+ * Size of the request headers in bytes
139
+ */
73
140
  requestHeadersSize: number;
74
- requestHeaders: any;
141
+ /**
142
+ * Duration of receiving the response in milliseconds
143
+ */
75
144
  responseReceivingDuration: number;
145
+ /**
146
+ * Duration of the callback execution in milliseconds
147
+ */
76
148
  callbackDuration: number;
149
+ /**
150
+ * Total duration of the ajax call in milliseconds
151
+ */
77
152
  ajaxTotalDuration: number;
78
- aborted: number;
153
+ /**
154
+ * URL of the page that initiated the request
155
+ */
79
156
  pageUrl: string;
157
+ /**
158
+ * The URL of the request
159
+ */
80
160
  requestUrl: string;
161
+ /**
162
+ * Size of the request in bytes
163
+ */
81
164
  requestSize: number;
165
+ /**
166
+ * HTTP method used for the request
167
+ */
82
168
  method: string;
169
+ /**
170
+ * Performance mark associated with this request
171
+ */
83
172
  perfMark: PerformanceMark;
173
+ /**
174
+ * Performance timing data from the Resource Timing API
175
+ */
84
176
  perfTiming: PerformanceResourceTiming;
177
+ /**
178
+ * Number of attempts to find performance data
179
+ */
85
180
  perfAttempts?: number;
181
+ /**
182
+ * Indicates if the request was made asynchronously
183
+ */
86
184
  async?: boolean;
185
+ /**
186
+ * Should the Error Status text be included in the response
187
+ */
87
188
  errorStatusText?: boolean;
189
+ /**
190
+ * HTTP status code of the response
191
+ */
88
192
  status: string | number;
193
+ /**
194
+ * Timestamp when the request was sent
195
+ */
89
196
  requestSentTime: number;
197
+ /**
198
+ * Timestamp when the first byte was received
199
+ */
90
200
  responseStartedTime: number;
201
+ /**
202
+ * Timestamp when the last byte was received
203
+ */
91
204
  responseFinishedTime: number;
92
- callbackFinishedTime: number;
93
- endTime: number;
94
- xhrMonitoringState: XHRMonitoringState;
95
- clientFailure: number;
96
205
  /**
97
- * The traceId to use for the dependency call
206
+ * Timestamp when the onreadystatechange callback finished
98
207
  */
99
- traceID: string;
208
+ callbackFinishedTime: number;
100
209
  /**
101
- * The spanId to use for the dependency call
210
+ * Timestamp when the ajax call ended
102
211
  */
103
- spanID: string;
212
+ endTime: number;
104
213
  /**
105
- * The traceFlags to use for the dependency call
214
+ * State tracking object for XHR monitoring
106
215
  */
107
- traceFlags?: number;
216
+ xhrMonitoringState: IXHRMonitoringState;
108
217
  /**
109
- * The trace context to use for reporting the remote dependency call
218
+ * Indicates if a JavaScript exception occurred in xhr.onreadystatechange code (1 if occurred, 0 otherwise)
110
219
  */
111
- eventTraceCtx: ITraceCtx;
220
+ clientFailure: number;
112
221
  /**
113
- * The listener assigned context values that will be passed to any dependency initializer
222
+ * Creates a telemetry item for tracking this ajax request
223
+ * @param ajaxType - Type of the ajax request
224
+ * @param enableRequestHeaderTracking - Whether to include request headers in telemetry
225
+ * @param getResponse - Function to get response data
226
+ * @returns Dependency telemetry item or null
114
227
  */
115
- context?: {
116
- [key: string]: any;
117
- };
118
- constructor(traceId: string, spanId: string, logger: IDiagnosticLogger, traceCtx?: IDistributedTraceContext);
119
- getAbsoluteUrl(): string;
120
- getPathName(): string;
121
228
  CreateTrackItem(ajaxType: string, enableRequestHeaderTracking: boolean, getResponse: () => IAjaxRecordResponse): IDependencyTelemetry;
229
+ /**
230
+ * Gets Part A properties for telemetry
231
+ * @returns Object containing Part A properties or null
232
+ */
122
233
  getPartAProps(): {
123
234
  [key: string]: any;
124
235
  };
125
236
  }
126
237
 
127
- /**
128
- * The initializer function that will be called, if it returns false the event will be dropped and not reported
129
- * or counted against the `maxAjaxCallsPerView`.
130
- */
131
- export declare type DependencyInitializerFunction = (item: IDependencyInitializerDetails) => boolean | void;
132
-
133
- /**
134
- * The function that will get called when the ajax request is about to occur.
135
- */
136
- export declare type DependencyListenerFunction = (dependencyDetails: IDependencyListenerDetails) => boolean | void;
137
-
138
- export declare const DfltAjaxCorrelationHeaderExDomains: string[];
139
-
140
- declare const _DYN_INCLUDE_CORRELATION_0 = "includeCorrelationHeaders";
141
-
142
238
  declare interface IAjaxRecordResponse {
143
239
  statusText: string;
144
240
  headerMap: Object;
@@ -148,6 +244,8 @@ declare interface IAjaxRecordResponse {
148
244
  response?: Object;
149
245
  }
150
246
 
247
+ export { ICorrelationConfig }
248
+
151
249
  export declare interface IDependenciesPlugin extends IDependencyListenerContainer {
152
250
  /**
153
251
  * Logs dependency call
@@ -240,6 +338,12 @@ export declare interface IDependencyListenerDetails {
240
338
  * https://www.w3.org/TR/trace-context/#trace-flags
241
339
  */
242
340
  traceFlags?: number;
341
+ /**
342
+ * The W3C TraceState object that contains the trace state information, this is mutable and changes made to this
343
+ * instance will be reflected in the distributed trace context. You cannot overwrite the traceState, but you can
344
+ * modify the values within the traceState.
345
+ */
346
+ readonly traceState?: IW3cTraceState;
243
347
  /**
244
348
  * [Optional] Context that the application can assign that will also be passed to any dependency initializer
245
349
  */
@@ -258,22 +362,18 @@ export declare interface IDependencyListenerHandler extends IDependencyHandler {
258
362
  }
259
363
 
260
364
  export declare interface IInstrumentationRequirements extends IDependenciesPlugin {
261
- [_DYN_INCLUDE_CORRELATION_0]: (ajaxData: ajaxRecord, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any;
262
- }
263
-
264
- declare interface ITraceCtx {
265
- traceId: string;
266
- spanId: string;
267
- traceFlags: number;
365
+ [_DYN_INCLUDE_CORRELATION_0]: (ajaxData: IAjaxRecordData, input?: Request | string, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any;
268
366
  }
269
367
 
270
- declare class XHRMonitoringState {
368
+ /**
369
+ * Interface defining the XHR monitoring state properties
370
+ */
371
+ declare interface IXHRMonitoringState {
271
372
  openDone: boolean;
272
373
  setRequestHeaderDone: boolean;
273
374
  sendDone: boolean;
274
375
  abortDone: boolean;
275
376
  stateChangeAttached: boolean;
276
- constructor();
277
377
  }
278
378
 
279
379
  export declare interface XMLHttpRequestData {
@@ -288,7 +388,7 @@ export declare interface XMLHttpRequestData {
288
388
  * The individual tracking data for each AI instance
289
389
  */
290
390
  i: {
291
- [key: string]: ajaxRecord;
391
+ [key: string]: IAjaxRecordInternal;
292
392
  };
293
393
  }
294
394