@microsoft/1ds-post-js 3.2.10 → 4.0.0
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/README.md +1 -1
- package/bundle/es5/ms.post-4.0.0.gbl.js +5816 -0
- package/bundle/es5/ms.post-4.0.0.gbl.js.map +1 -0
- package/bundle/es5/ms.post-4.0.0.gbl.min.js +7 -0
- package/bundle/es5/ms.post-4.0.0.gbl.min.js.map +1 -0
- package/bundle/es5/ms.post-4.0.0.integrity.json +46 -0
- package/bundle/es5/ms.post-4.0.0.js +5820 -0
- package/bundle/es5/ms.post-4.0.0.js.map +1 -0
- package/bundle/es5/ms.post-4.0.0.min.js +7 -0
- package/bundle/es5/ms.post-4.0.0.min.js.map +1 -0
- package/bundle/es5/ms.post.gbl.js +5816 -0
- package/bundle/es5/ms.post.gbl.js.map +1 -0
- package/bundle/es5/ms.post.gbl.min.js +7 -0
- package/bundle/es5/ms.post.gbl.min.js.map +1 -0
- package/bundle/es5/ms.post.integrity.json +46 -0
- package/bundle/es5/ms.post.js +5820 -0
- package/bundle/es5/ms.post.js.map +1 -0
- package/bundle/es5/ms.post.min.js +7 -0
- package/bundle/es5/ms.post.min.js.map +1 -0
- package/{bundle → dist/es5}/ms.post.js +2942 -1670
- package/dist/es5/ms.post.js.map +1 -0
- package/dist/es5/ms.post.min.js +7 -0
- package/dist/es5/ms.post.min.js.map +1 -0
- package/{dist-esm/src → dist-es5}/BatchNotificationActions.js +1 -1
- package/{dist-esm/src → dist-es5}/ClockSkewManager.js +2 -2
- package/{dist-esm/src → dist-es5}/ClockSkewManager.js.map +1 -1
- package/{dist-esm/src → dist-es5}/DataModels.js +1 -1
- package/{dist-esm/src → dist-es5}/EventBatch.js +1 -1
- package/{dist-esm/src → dist-es5}/HttpManager.js +175 -94
- package/dist-es5/HttpManager.js.map +1 -0
- package/{dist-esm/src → dist-es5}/Index.js +2 -2
- package/dist-es5/Index.js.map +1 -0
- package/{dist-esm/src → dist-es5}/InternalConstants.js +1 -1
- package/{dist-esm/src → dist-es5}/KillSwitch.js +2 -2
- package/{dist-esm/src → dist-es5}/KillSwitch.js.map +1 -1
- package/{dist-esm/src → dist-es5}/PostChannel.js +166 -144
- package/dist-es5/PostChannel.js.map +1 -0
- package/{dist-esm/src → dist-es5}/RetryPolicy.js +1 -1
- package/{dist-esm/src → dist-es5}/Serializer.js +3 -2
- package/dist-es5/Serializer.js.map +1 -0
- package/dist-es5/TimeoutOverrideWrapper.js +24 -0
- package/dist-es5/TimeoutOverrideWrapper.js.map +1 -0
- package/{dist-esm/src → dist-es5}/typings/XDomainRequest.js +1 -1
- package/package.json +17 -11
- package/tsconfig.json +5 -2
- package/{src/DataModels.ts → types/1ds-post-js.d.ts} +408 -467
- package/types/1ds-post-js.namespaced.d.ts +404 -0
- package/bundle/ms.post-3.2.10.gbl.js +0 -4524
- package/bundle/ms.post-3.2.10.gbl.js.map +0 -1
- package/bundle/ms.post-3.2.10.gbl.min.js +0 -7
- package/bundle/ms.post-3.2.10.gbl.min.js.map +0 -1
- package/bundle/ms.post-3.2.10.integrity.json +0 -46
- package/bundle/ms.post-3.2.10.js +0 -4527
- package/bundle/ms.post-3.2.10.js.map +0 -1
- package/bundle/ms.post-3.2.10.min.js +0 -7
- package/bundle/ms.post-3.2.10.min.js.map +0 -1
- package/bundle/ms.post.gbl.js +0 -4524
- package/bundle/ms.post.gbl.js.map +0 -1
- package/bundle/ms.post.gbl.min.js +0 -7
- package/bundle/ms.post.gbl.min.js.map +0 -1
- package/bundle/ms.post.integrity.json +0 -46
- package/bundle/ms.post.js.map +0 -1
- package/bundle/ms.post.min.js +0 -7
- package/bundle/ms.post.min.js.map +0 -1
- package/dist/ms.post.js +0 -2144
- package/dist/ms.post.js.map +0 -1
- package/dist/ms.post.min.js +0 -7
- package/dist/ms.post.min.js.map +0 -1
- package/dist-esm/src/BatchNotificationActions.d.ts +0 -36
- package/dist-esm/src/ClockSkewManager.d.ts +0 -38
- package/dist-esm/src/DataModels.d.ts +0 -405
- package/dist-esm/src/EventBatch.d.ts +0 -47
- package/dist-esm/src/HttpManager.d.ts +0 -88
- package/dist-esm/src/HttpManager.js.map +0 -1
- package/dist-esm/src/Index.d.ts +0 -9
- package/dist-esm/src/Index.js.map +0 -1
- package/dist-esm/src/InternalConstants.d.ts +0 -28
- package/dist-esm/src/KillSwitch.d.ts +0 -26
- package/dist-esm/src/PostChannel.d.ts +0 -101
- package/dist-esm/src/PostChannel.js.map +0 -1
- package/dist-esm/src/RetryPolicy.d.ts +0 -21
- package/dist-esm/src/Serializer.d.ts +0 -108
- package/dist-esm/src/Serializer.js.map +0 -1
- package/dist-esm/src/TimeoutOverrideWrapper.d.ts +0 -18
- package/dist-esm/src/TimeoutOverrideWrapper.js +0 -28
- package/dist-esm/src/TimeoutOverrideWrapper.js.map +0 -1
- package/dist-esm/src/typings/XDomainRequest.d.ts +0 -17
- package/src/BatchNotificationActions.ts +0 -44
- package/src/ClockSkewManager.ts +0 -127
- package/src/EventBatch.ts +0 -137
- package/src/HttpManager.ts +0 -1379
- package/src/Index.ts +0 -18
- package/src/InternalConstants.ts +0 -42
- package/src/KillSwitch.ts +0 -84
- package/src/PostChannel.ts +0 -1163
- package/src/RetryPolicy.ts +0 -46
- package/src/Serializer.ts +0 -487
- package/src/TimeoutOverrideWrapper.ts +0 -29
- package/src/typings/XDomainRequest.ts +0 -23
- /package/{dist-esm/src → dist-es5}/BatchNotificationActions.js.map +0 -0
- /package/{dist-esm/src → dist-es5}/DataModels.js.map +0 -0
- /package/{dist-esm/src → dist-es5}/EventBatch.js.map +0 -0
- /package/{dist-esm/src → dist-es5}/InternalConstants.js.map +0 -0
- /package/{dist-esm/src → dist-es5}/RetryPolicy.js.map +0 -0
- /package/{dist-esm/src → dist-es5}/typings/XDomainRequest.js.map +0 -0
|
@@ -1,467 +1,408 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
*
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* [Optional]
|
|
63
|
-
*
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
*/
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
*
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* [Optional]
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
*/
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
*
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
*
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
*
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
*
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
/**
|
|
243
|
-
*
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
*
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
*
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
*
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
*
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
*
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
SendingSyncEvent = 1003,
|
|
410
|
-
/**
|
|
411
|
-
* The Channel was resumed
|
|
412
|
-
*/
|
|
413
|
-
SendingResumed = 1004,
|
|
414
|
-
/**
|
|
415
|
-
* The event(s) being sent as a retry
|
|
416
|
-
*/
|
|
417
|
-
SendingRetry = 1005,
|
|
418
|
-
/**
|
|
419
|
-
* Maximum batch size would be exceeded
|
|
420
|
-
*/
|
|
421
|
-
SendingMaxBatchSize = 1010,
|
|
422
|
-
/**
|
|
423
|
-
* The Maximum number of events have already been queued
|
|
424
|
-
*/
|
|
425
|
-
SendingMaxQueuedEvents = 1020,
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* The final value for a Sending notification
|
|
429
|
-
*/
|
|
430
|
-
SendingEventMax = 1999,
|
|
431
|
-
|
|
432
|
-
// Events Dropped - Failures
|
|
433
|
-
EventsDropped = 8000, // EventsDiscardedReason.Unknown
|
|
434
|
-
NonRetryableStatus = 8001, // EventsDiscardedReason.NonRetryableStatus
|
|
435
|
-
InvalidEvent = 8002, // EventsDiscardedReason.InvalidEvent
|
|
436
|
-
SizeLimitExceeded = 8003, // EventsDiscardedReason.SizeLimitExceeded
|
|
437
|
-
KillSwitch = 8004, // EventsDiscardedReason.KillSwitch,
|
|
438
|
-
QueueFull = 8005, // EventsDiscardedReason.QueueFull
|
|
439
|
-
EventsDroppedMax = 8999,
|
|
440
|
-
|
|
441
|
-
/**
|
|
442
|
-
* Represents the range Http Status codes 000-999 as 9000-9999
|
|
443
|
-
*/
|
|
444
|
-
ResponseFailure = 9000,
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* Represents the range Http Status codes 200-299
|
|
448
|
-
*/
|
|
449
|
-
PartialSuccess = 9200,
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Represents the range Http Status codes 300-399
|
|
453
|
-
*/
|
|
454
|
-
ClientConfigFailure = 9300,
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* Represents the range Http Status codes 400-499
|
|
458
|
-
*/
|
|
459
|
-
ClientFailure = 9400,
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Represents the range Http Status codes 500-599
|
|
463
|
-
*/
|
|
464
|
-
ServerFailure = 9500,
|
|
465
|
-
|
|
466
|
-
ResponseFailureMax = 9999
|
|
467
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* 1DS JS SDK Post Channel, 4.0.0
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Javascript Telemetry SDKs <TelReachSDK@microsoft.com>
|
|
6
|
+
* https://1dsdocs.azurewebsites.net/sdk.html
|
|
7
|
+
*
|
|
8
|
+
* ---------------------------------------------------------------------------
|
|
9
|
+
* This is a single combined (rollup) declaration file for the package,
|
|
10
|
+
* if you require a namespace wrapped version it is also available.
|
|
11
|
+
* - Namespaced version: types/1ds-post-js.namespaced.d.ts
|
|
12
|
+
* ---------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { BaseTelemetryPlugin } from '@microsoft/1ds-core-js';
|
|
16
|
+
import { IAppInsightsCore } from '@microsoft/1ds-core-js';
|
|
17
|
+
import { IChannelControls } from '@microsoft/1ds-core-js';
|
|
18
|
+
import { IDiagnosticLogger } from '@microsoft/1ds-core-js';
|
|
19
|
+
import { IExtendedConfiguration } from '@microsoft/1ds-core-js';
|
|
20
|
+
import { IPlugin } from '@microsoft/1ds-core-js';
|
|
21
|
+
import { IProcessTelemetryContext } from '@microsoft/1ds-core-js';
|
|
22
|
+
import { IPromise } from '@nevware21/ts-async';
|
|
23
|
+
import { ITelemetryItem } from '@microsoft/1ds-core-js';
|
|
24
|
+
import { ITelemetryPlugin } from '@microsoft/1ds-core-js';
|
|
25
|
+
import { IUnloadHook } from '@microsoft/1ds-core-js';
|
|
26
|
+
import { IValueSanitizer } from '@microsoft/1ds-core-js';
|
|
27
|
+
import { SendRequestReason } from '@microsoft/1ds-core-js';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Best Effort. RealTime Latency events are sent every 9 sec and
|
|
31
|
+
* Normal Latency events are sent every 18 sec.
|
|
32
|
+
*/
|
|
33
|
+
export declare const BE_PROFILE = "BEST_EFFORT";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The IChannelConfiguration interface holds the configuration details passed to Post module.
|
|
37
|
+
*/
|
|
38
|
+
export declare interface IChannelConfiguration {
|
|
39
|
+
/**
|
|
40
|
+
* [Optional] The number of events that can be kept in memory before the SDK starts to drop events. By default, this is 10,000.
|
|
41
|
+
*/
|
|
42
|
+
eventsLimitInMem?: number;
|
|
43
|
+
/**
|
|
44
|
+
* [Optional] Sets the maximum number of immediate latency events that will be cached in memory before the SDK starts to drop other
|
|
45
|
+
* immediate events only, does not drop normal and real time latency events as immediate events have their own internal queue. Under
|
|
46
|
+
* normal situations immediate events are scheduled to be sent in the next Javascript execution cycle, so the typically number of
|
|
47
|
+
* immediate events is small (~1), the only time more than one event may be present is when the channel is paused or immediate send
|
|
48
|
+
* is disabled (via manual transmit profile). By default max number of events is 500 and the default transmit time is 0ms.
|
|
49
|
+
*/
|
|
50
|
+
immediateEventLimit?: number;
|
|
51
|
+
/**
|
|
52
|
+
* [Optional] If defined, when the number of queued events reaches or exceeded this limit this will cause the queue to be immediately
|
|
53
|
+
* flushed rather than waiting for the normal timers. Defaults to undefined.
|
|
54
|
+
*/
|
|
55
|
+
autoFlushEventsLimit?: number;
|
|
56
|
+
/**
|
|
57
|
+
* [Optional] If defined allows you to disable the auto batch (iKey set of requests) flushing logic. This is in addition to the
|
|
58
|
+
* default transmission profile timers, autoFlushEventsLimit and eventsLimitInMem config values.
|
|
59
|
+
*/
|
|
60
|
+
disableAutoBatchFlushLimit?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* [Optional] The HTTP override that should be used to send requests, as an IXHROverride object.
|
|
63
|
+
* By default during the unload of a page or if the event specifies that it wants to use sendBeacon() or sync fetch (with keep-alive),
|
|
64
|
+
* this override will NOT be called. You can now change this behavior by enabling the 'alwaysUseXhrOverride' configuration value.
|
|
65
|
+
* The payload data (first argument) now also includes any configured 'timeout' (defaults to undefined) and whether you should avoid
|
|
66
|
+
* creating any synchronous XHR requests 'disableXhrSync' (defaults to false/undefined)
|
|
67
|
+
*/
|
|
68
|
+
httpXHROverride?: IXHROverride;
|
|
69
|
+
/**
|
|
70
|
+
* Override for Instrumentation key
|
|
71
|
+
*/
|
|
72
|
+
overrideInstrumentationKey?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Override for Endpoint where telemetry data is sent
|
|
75
|
+
*/
|
|
76
|
+
overrideEndpointUrl?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The master off switch. Do not send any data if set to TRUE
|
|
79
|
+
*/
|
|
80
|
+
disableTelemetry?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* MC1 and MS0 cookies will not be returned from Collector endpoint.
|
|
83
|
+
*/
|
|
84
|
+
ignoreMc1Ms0CookieProcessing?: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Override for setTimeout
|
|
87
|
+
*/
|
|
88
|
+
setTimeoutOverride?: typeof setTimeout;
|
|
89
|
+
/**
|
|
90
|
+
* Override for clearTimeout
|
|
91
|
+
*/
|
|
92
|
+
clearTimeoutOverride?: typeof clearTimeout;
|
|
93
|
+
/**
|
|
94
|
+
* [Optional] POST channel preprocessing function. Can be used to gzip the payload before transmission and to set the appropriate
|
|
95
|
+
* Content-Encoding header. The preprocessor is explicitly not called during teardown when using the sendBeacon() API.
|
|
96
|
+
*/
|
|
97
|
+
payloadPreprocessor?: PayloadPreprocessorFunction;
|
|
98
|
+
/**
|
|
99
|
+
* [Optional] POST channel listener function, used for enabling logging or reporting (RemoteDDVChannel) of the payload that is being sent.
|
|
100
|
+
*/
|
|
101
|
+
payloadListener?: PayloadListenerFunction;
|
|
102
|
+
/**
|
|
103
|
+
* [Optional] By default additional timing metrics details are added to each event after they are sent to allow you to review how long it took
|
|
104
|
+
* to create serialized request. As not all implementations require this level of detail and it's now possible to get the same metrics via
|
|
105
|
+
* the IPerfManager and IPerfEvent we are enabling these details to be disabled. Default value is false to retain the previous behavior,
|
|
106
|
+
* if you are not using these metrics and performance is a concern then it is recommended to set this value to true.
|
|
107
|
+
*/
|
|
108
|
+
disableEventTimings?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* [Optional] The value sanitizer to use while constructing the envelope.
|
|
111
|
+
*/
|
|
112
|
+
valueSanitizer?: IValueSanitizer;
|
|
113
|
+
/**
|
|
114
|
+
* [Optional] During serialization, when an object is identified, should the object be serialized by JSON.stringify(theObject); (when true) otherwise by theObject.toString().
|
|
115
|
+
* Defaults to false
|
|
116
|
+
*/
|
|
117
|
+
stringifyObjects?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* [Optional] Enables support for objects with compound keys which indirectly represent an object where the "key" of the object contains a "." as part of it's name.
|
|
120
|
+
* @example
|
|
121
|
+
* ```typescript
|
|
122
|
+
* event: { "somedata.embeddedvalue": 123 }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
enableCompoundKey?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* [Optional] Switch to disable the v8 optimizeObject() calls used to provide better serialization performance. Defaults to false.
|
|
128
|
+
*/
|
|
129
|
+
disableOptimizeObj?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* [Optional] By default a "Cache-Control" header will be added to the outbound payloads with the value "no-cache, no-store", this is to
|
|
132
|
+
* avoid instances where Chrome can "Stall" requests which use the same outbound URL.
|
|
133
|
+
*/
|
|
134
|
+
/**
|
|
135
|
+
* [Optional] Either an array or single value identifying the requested TransportType type that should be used.
|
|
136
|
+
* This is used during initialization to identify the requested send transport, it will be ignored if a httpXHROverride is provided.
|
|
137
|
+
*/
|
|
138
|
+
transports?: number | number[];
|
|
139
|
+
/**
|
|
140
|
+
* [Optional] Either an array or single value identifying the requested TransportType type(s) that should be used during unload or events
|
|
141
|
+
* marked as sendBeacon. This is used during initialization to identify the requested send transport, it will be ignored if a httpXHROverride
|
|
142
|
+
* is provided and alwaysUseXhrOverride is true.
|
|
143
|
+
*/
|
|
144
|
+
unloadTransports?: number | number[];
|
|
145
|
+
/**
|
|
146
|
+
* [Optional] A flag to enable or disable the usage of the sendBeacon() API (if available). If running on ReactNative this defaults
|
|
147
|
+
* to `false` for all other cases it defaults to `true`.
|
|
148
|
+
*/
|
|
149
|
+
useSendBeacon?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* [Optional] A flag to disable the usage of the [fetch with keep-alive](https://javascript.info/fetch-api#keepalive) support.
|
|
152
|
+
*/
|
|
153
|
+
disableFetchKeepAlive?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* [Optional] Avoid adding request headers to the outgoing request that would cause a pre-flight (OPTIONS) request to be sent for each request.
|
|
156
|
+
* This currently defaults to true but will be changed once the collector handles additional settings to allow the browser to better cache any
|
|
157
|
+
* previous OPTIONS response, at which point some of the current dynamic values sent on the query string will be moved to a header.
|
|
158
|
+
*/
|
|
159
|
+
avoidOptions?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* [Optional] Specify a timeout (in ms) to apply to requests when sending requests using XHR, XDR or fetch requests. Defaults to undefined
|
|
162
|
+
* and therefore the runtime defaults (normally zero for browser environments)
|
|
163
|
+
*/
|
|
164
|
+
xhrTimeout?: number;
|
|
165
|
+
/**
|
|
166
|
+
* [Optional] When using Xhr for sending requests disable sending as synchronous during unload or synchronous flush.
|
|
167
|
+
* You should enable this feature for IE (when there is no sendBeacon() or fetch (with keep-alive)) and you have clients
|
|
168
|
+
* that end up blocking the UI during page unloading. This will cause ALL XHR requests to be sent asynchronously which
|
|
169
|
+
* during page unload may result in the lose of telemetry.
|
|
170
|
+
*/
|
|
171
|
+
disableXhrSync?: boolean;
|
|
172
|
+
/**
|
|
173
|
+
* [Optional] By default during unload (or when you specify to use sendBeacon() or sync fetch (with keep-alive) for an event) the SDK
|
|
174
|
+
* ignores any provided httpXhrOverride and attempts to use sendBeacon() or fetch(with keep-alive) when they are available.
|
|
175
|
+
* When this configuration option is true any provided httpXhrOverride will always be used, so any provided httpXhrOverride will
|
|
176
|
+
* also need to "handle" the synchronous unload scenario.
|
|
177
|
+
*/
|
|
178
|
+
alwaysUseXhrOverride?: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* [Optional] Identifies the number of times any single event will be retried if it receives a failed (retirable) response, this
|
|
181
|
+
* causes the event to be internally "requeued" and resent in the next batch. As each normal batched send request is retried at
|
|
182
|
+
* least once before starting to increase the internal backoff send interval, normally batched events will generally be attempted
|
|
183
|
+
* the next nearest even number of times. This means that the total number of actual send attempts will almost always be even
|
|
184
|
+
* (setting to 5 will cause 6 requests), unless using manual synchronous flushing (calling flush(false)) which is not subject to
|
|
185
|
+
* request level retry attempts.
|
|
186
|
+
* Defaults to 6 times.
|
|
187
|
+
*/
|
|
188
|
+
maxEventRetryAttempts?: number;
|
|
189
|
+
/**
|
|
190
|
+
* [Optional] Identifies the number of times any single event will be retried if it receives a failed (retriable) response as part
|
|
191
|
+
* of processing / flushing events once a page unload state has been detected, this causes the event to be internally "requeued"
|
|
192
|
+
* and resent in the next batch, which during page unload. Unlike the normal batching process, send requests are never retried,
|
|
193
|
+
* so the value listed here is always the maximum number of attempts for any single event.
|
|
194
|
+
* Defaults to 2 times.
|
|
195
|
+
* Notes:
|
|
196
|
+
* The SDK by default will use the sendBeacon() API if it exists which is treated as a fire and forget successful response, so for
|
|
197
|
+
* environments that support or supply this API the events won't be retried (because they will be deeded to be successfully sent).
|
|
198
|
+
* When an environment (IE) doesn't support sendBeacon(), this will cause multiple synchronous (by default) XMLHttpRequests to be sent,
|
|
199
|
+
* which will block the UI until a response is received. You can disable ALL synchronous XHR requests by setting the 'disableXhrSync'
|
|
200
|
+
* configuration setting and/or changing this value to 0 or 1.
|
|
201
|
+
*/
|
|
202
|
+
maxUnloadEventRetryAttempts?: number;
|
|
203
|
+
/**
|
|
204
|
+
* [Optional] flag to indicate whether the sendBeacon and fetch (with keep-alive flag) should add the "NoResponseBody" query string
|
|
205
|
+
* value to indicate that the server should return a 204 for successful requests. Defaults to true
|
|
206
|
+
*/
|
|
207
|
+
addNoResponse?: boolean;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** IPayloadData describes interface of payload sent via POST channel */
|
|
211
|
+
export declare interface IPayloadData {
|
|
212
|
+
urlString: string;
|
|
213
|
+
data: Uint8Array | string;
|
|
214
|
+
headers?: {
|
|
215
|
+
[name: string]: string;
|
|
216
|
+
};
|
|
217
|
+
timeout?: number;
|
|
218
|
+
disableXhrSync?: boolean;
|
|
219
|
+
disableFetchKeepAlive?: boolean;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Post channel interface
|
|
224
|
+
*/
|
|
225
|
+
export declare interface IPostChannel extends ITelemetryPlugin {
|
|
226
|
+
/**
|
|
227
|
+
* Diagnostic logger
|
|
228
|
+
*/
|
|
229
|
+
diagLog: (itemCtx?: IProcessTelemetryContext) => IDiagnosticLogger;
|
|
230
|
+
/**
|
|
231
|
+
* Override for setTimeout
|
|
232
|
+
*/
|
|
233
|
+
_setTimeoutOverride?: (callback: (...args: any[]) => void, ms: number, ...args: any[]) => any;
|
|
234
|
+
/**
|
|
235
|
+
* Backs off transmission. This exponentially increases all the timers.
|
|
236
|
+
*/
|
|
237
|
+
_backOffTransmission(): void;
|
|
238
|
+
/**
|
|
239
|
+
* Clears back off for transmission.
|
|
240
|
+
*/
|
|
241
|
+
_clearBackOff(): void;
|
|
242
|
+
/**
|
|
243
|
+
* Add handler to be executed with request response text.
|
|
244
|
+
*/
|
|
245
|
+
addResponseHandler(responseHandler: (responseText: string) => void): IUnloadHook;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The IXHROverride interface overrides the way HTTP requests are sent.
|
|
250
|
+
*/
|
|
251
|
+
export declare interface IXHROverride {
|
|
252
|
+
/**
|
|
253
|
+
* This method sends data to the specified URI using a POST request. If sync is true,
|
|
254
|
+
* then the request is sent synchronously. The <i>oncomplete</i> function should always be called after the request is
|
|
255
|
+
* completed (either successfully or timed out or failed due to errors).
|
|
256
|
+
*/
|
|
257
|
+
sendPOST: SendPOSTFunction;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Near Real Time profile. RealTime Latency events are sent every 3 sec and
|
|
262
|
+
* Normal Latency events are sent every 6 sec.
|
|
263
|
+
*/
|
|
264
|
+
export declare const NRT_PROFILE = "NEAR_REAL_TIME";
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Defines the function signature of a payload listener, which is called after the payload has been sent to the server. The listener is passed
|
|
268
|
+
* both the initial payload object and any altered (modified) payload from a preprocessor so it can determine what payload it may want to log or send.
|
|
269
|
+
* Used by the Remove DDV extension to listen to server send events.
|
|
270
|
+
* @param orgPayload - The initially constructed payload object
|
|
271
|
+
* @param sendPayload - The alternative (possibly modified by a preprocessor) payload
|
|
272
|
+
* @param isSync - A boolean flag indicating whether this request was initiated as part of a sync response (unload / flush request), this is for informative only.
|
|
273
|
+
* @param isBeaconSend - A boolean flag indicating whether the payload was sent using the navigator.sendBeacon() API.
|
|
274
|
+
*/
|
|
275
|
+
export declare type PayloadListenerFunction = (orgPayload: IPayloadData, sendPayload?: IPayloadData, isSync?: boolean, isBeaconSend?: boolean) => void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Defines the function signature for the Payload Preprocessor.
|
|
279
|
+
* @param payload - The Initial constructed payload that if not modified should be passed onto the callback function.
|
|
280
|
+
* @param callback - The preprocessor MUST call the callback function to ensure that the events are sent to the server, failing to call WILL result in dropped events.
|
|
281
|
+
* The modifiedBuffer argument can be either the original payload or may be modified by performing GZipping of the payload and adding the content header.
|
|
282
|
+
* @param isSync - A boolean flag indicating whether this request was initiated as part of a sync response (unload / flush request), this is for informative only.
|
|
283
|
+
* e.g the preprocessor may wish to not perform any GZip operations if the request was a sync request which is normally called as part of an unload request.
|
|
284
|
+
*/
|
|
285
|
+
export declare type PayloadPreprocessorFunction = (payload: IPayloadData, callback: (modifiedBuffer: IPayloadData) => void, isSync?: boolean) => void;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Class that manages adding events to inbound queues and batching of events
|
|
289
|
+
* into requests.
|
|
290
|
+
*/
|
|
291
|
+
export declare class PostChannel extends BaseTelemetryPlugin implements IChannelControls, IPostChannel {
|
|
292
|
+
identifier: string;
|
|
293
|
+
priority: number;
|
|
294
|
+
version: string;
|
|
295
|
+
constructor();
|
|
296
|
+
/**
|
|
297
|
+
* Start the queue manager to batch and send events via post.
|
|
298
|
+
* @param config - The core configuration.
|
|
299
|
+
*/
|
|
300
|
+
initialize(coreConfig: IExtendedConfiguration, core: IAppInsightsCore, extensions: IPlugin[]): void;
|
|
301
|
+
/**
|
|
302
|
+
* Add an event to the appropriate inbound queue based on its latency.
|
|
303
|
+
* @param ev - The event to be added to the queue.
|
|
304
|
+
* @param itemCtx - This is the context for the current request, ITelemetryPlugin instances
|
|
305
|
+
* can optionally use this to access the current core instance or define / pass additional information
|
|
306
|
+
* to later plugins (vs appending items to the telemetry item)
|
|
307
|
+
*/
|
|
308
|
+
processTelemetry(ev: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
309
|
+
/**
|
|
310
|
+
* Sets the event queue limits at runtime (after initialization), if the number of queued events is greater than the
|
|
311
|
+
* eventLimit or autoFlushLimit then a flush() operation will be scheduled.
|
|
312
|
+
* @param eventLimit The number of events that can be kept in memory before the SDK starts to drop events. If the value passed is less than or
|
|
313
|
+
* equal to zero the value will be reset to the default (10,000).
|
|
314
|
+
* @param autoFlushLimit When defined, once this number of events has been queued the system perform a flush() to send the queued events
|
|
315
|
+
* without waiting for the normal schedule timers. Passing undefined, null or a value less than or equal to zero will disable the auto flush.
|
|
316
|
+
*/
|
|
317
|
+
setEventQueueLimits(eventLimit: number, autoFlushLimit?: number): void;
|
|
318
|
+
/**
|
|
319
|
+
* Pause the transmission of any requests
|
|
320
|
+
*/
|
|
321
|
+
pause(): void;
|
|
322
|
+
/**
|
|
323
|
+
* Resumes transmission of events.
|
|
324
|
+
*/
|
|
325
|
+
resume(): void;
|
|
326
|
+
/**
|
|
327
|
+
* Add handler to be executed with request response text.
|
|
328
|
+
*/
|
|
329
|
+
addResponseHandler(responseHanlder: (responseText: string) => void): IUnloadHook;
|
|
330
|
+
/**
|
|
331
|
+
* Flush to send data immediately; channel should default to sending data asynchronously. If executing asynchronously (the default) and
|
|
332
|
+
* you DO NOT pass a callback function then a [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)
|
|
333
|
+
* will be returned which will resolve once the flush is complete. The actual implementation of the `IPromise`
|
|
334
|
+
* will be a native Promise (if supported) or the default as supplied by [ts-async library](https://github.com/nevware21/ts-async)
|
|
335
|
+
* @param async - send data asynchronously when true
|
|
336
|
+
* @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.
|
|
337
|
+
* If the caller doesn't return true the caller should assume that it may never be called.
|
|
338
|
+
* @param sendReason - specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified
|
|
339
|
+
* @returns - If a callback is provided `true` to indicate that callback will be called after the flush is complete otherwise the caller
|
|
340
|
+
* should assume that any provided callback will never be called, Nothing or if occurring asynchronously a
|
|
341
|
+
* [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) which will be resolved once the unload is complete,
|
|
342
|
+
* the [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) will only be returned when no callback is provided
|
|
343
|
+
* and async is true.
|
|
344
|
+
*/
|
|
345
|
+
flush(async?: boolean, callBack?: (flushComplete?: boolean) => void, sendReason?: SendRequestReason): boolean | void | IPromise<boolean>;
|
|
346
|
+
/**
|
|
347
|
+
* Set AuthMsaDeviceTicket header
|
|
348
|
+
* @param ticket - Ticket value.
|
|
349
|
+
*/
|
|
350
|
+
setMsaAuthTicket(ticket: string): void;
|
|
351
|
+
/**
|
|
352
|
+
* Check if there are any events waiting to be scheduled for sending.
|
|
353
|
+
* @returns True if there are events, false otherwise.
|
|
354
|
+
*/
|
|
355
|
+
hasEvents(): boolean;
|
|
356
|
+
/**
|
|
357
|
+
* Load custom transmission profiles. Each profile should have timers for real time, and normal and can
|
|
358
|
+
* optionally specify the immediate latency time in ms (defaults to 0 when not defined). Each profile should
|
|
359
|
+
* make sure that a each normal latency timer is a multiple of the real-time latency and the immediate
|
|
360
|
+
* is smaller than the real-time.
|
|
361
|
+
* Setting the timer value to -1 means that the events for that latency will not be scheduled to be sent.
|
|
362
|
+
* Note that once a latency has been set to not send, all latencies below it will also not be sent. The
|
|
363
|
+
* timers should be in the form of [normal, high, [immediate]].
|
|
364
|
+
* e.g Custom:
|
|
365
|
+
* [10,5] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 0ms
|
|
366
|
+
* [10,5,1] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 1ms
|
|
367
|
+
* [10,5,0] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 0ms
|
|
368
|
+
* [10,5,-1] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate events will not be
|
|
369
|
+
* scheduled on their own and but they will be included with real-time or normal events as the first events in a batch.
|
|
370
|
+
* This also removes any previously loaded custom profiles.
|
|
371
|
+
* @param profiles - A dictionary containing the transmit profiles.
|
|
372
|
+
*/
|
|
373
|
+
_loadTransmitProfiles(profiles: {
|
|
374
|
+
[profileName: string]: number[];
|
|
375
|
+
}): void;
|
|
376
|
+
/**
|
|
377
|
+
* Set the transmit profile to be used. This will change the transmission timers
|
|
378
|
+
* based on the transmit profile.
|
|
379
|
+
* @param profileName - The name of the transmit profile to be used.
|
|
380
|
+
*/
|
|
381
|
+
_setTransmitProfile(profileName: string): void;
|
|
382
|
+
/**
|
|
383
|
+
* Backs off transmission. This exponentially increases all the timers.
|
|
384
|
+
*/
|
|
385
|
+
_backOffTransmission(): void;
|
|
386
|
+
/**
|
|
387
|
+
* Clears backoff for transmission.
|
|
388
|
+
*/
|
|
389
|
+
_clearBackOff(): void;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Real Time profile (default profile). RealTime Latency events are sent every 1 sec and
|
|
394
|
+
* Normal Latency events are sent every 2 sec.
|
|
395
|
+
*/
|
|
396
|
+
export declare const RT_PROFILE = "REAL_TIME";
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* SendPOSTFunction type defines how an HTTP POST request is sent to an ingestion server
|
|
400
|
+
* @param payload - The payload object that should be sent, contains the url, bytes/string and headers for the request
|
|
401
|
+
* @param oncomplete - The function to call once the request has completed whether a success, failure or timeout
|
|
402
|
+
* @param sync - A boolean flag indicating whether the request should be sent as a synchronous request.
|
|
403
|
+
*/
|
|
404
|
+
export declare type SendPOSTFunction = (payload: IPayloadData, oncomplete: (status: number, headers: {
|
|
405
|
+
[headerName: string]: string;
|
|
406
|
+
}, response?: string) => void, sync?: boolean) => void;
|
|
407
|
+
|
|
408
|
+
export { }
|